<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LAYOUT_APP_WEBVIEW</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Orbitron">
<script async="" src="https://www.googletagmanager.com/gtag/js?id=G-Q2HPLXNHN0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-Q2HPLXNHN0');
</script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
font-family: 'Ubuntu';
}
::placeholder {
color: #b0a8ffff;
}
body {
height: 100vh;
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fade-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes pulse {
0% {
transform: scale(1);
box-shadow: none;
}
50% {
transform: scale(1.2);
box-shadow: 0 0 10px 5px #b0a8ffff;
}
100% {
transform: scale(1);
box-shadow: none;
}
}
</style>
</head>
<body>
<div id="root" style="width: 100%; height: 100%; background: linear-gradient(45deg, rgb(20, 20, 44), rgb(27, 27, 27), rgb(31, 28, 58)); display: flex; flex-direction: column; justify-content: center; align-items: center;">
<span style="position: absolute; font-size: 1rem; font-family: Ubuntu; font-weight: bold; white-space: nowrap; color: rgb(176, 168, 255); top: 30px; left: 10px;">IP:
127.0.0.1</span>
<div style="display: flex; position: absolute; gap: 5px; top: 50px; left: -5px;">
<div style="display: flex; align-items: center;"><svg fill="#6205D5" width="2.2rem" height="2.2rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 5px; width: 2.2rem; height: 2.2rem;">
<path d="M8 4a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L7.5 10.293V4.5A.5.5 0 0 1 8 4z">
</path>
</svg><span style="font-size: 1rem; margin-left: -5px; font-family: Ubuntu; font-weight: bold; white-space: nowrap; color: rgb(255, 255, 255);">0
B</span></div>
<div style="display: flex; align-items: center;"><svg fill="#6205D5" width="2.2rem" height="2.2rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 5px; width: 2.2rem; height: 2.2rem;">
<path d="M8 12a.5.5 0 0 0 .5-.5V5.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 5.707V11.5a.5.5 0 0 0 .5.5z">
</path>
</svg><span style="font-size: 1rem; margin-left: -5px; font-family: Ubuntu; font-weight: bold; white-space: nowrap; color: rgb(255, 255, 255);">0
B</span></div>
</div>
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; width: 85%; max-width: 23rem; margin: 1.2rem; border-radius: 5px; border: none; position: absolute; top: 45%;">
<div style="display: flex; width: 100%; align-items: center; background: rgba(30, 28, 47, 0.314); color: rgb(255, 255, 255); padding: 0.2rem; border-radius: 50px; top: 90%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px; cursor: pointer;">
<svg fill="#6205D5" width="2.2rem" height="2.2rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 5px; width: 2.2rem; height: 2.2rem;">
<path d="M4.5 5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zM3 4.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0z"></path>
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v1a2 2 0 0 1-2 2H8.5v3a1.5 1.5 0 0 1 1.5 1.5h5.5a.5.5 0 0 1 0 1H10A1.5 1.5 0 0 1 8.5 14h-1A1.5 1.5 0 0 1 6 12.5H.5a.5.5 0 0 1 0-1H6A1.5 1.5 0 0 1 7.5 10V7H2a2 2 0 0 1-2-2V4zm1 0v1a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1zm6 7.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5z">
</path>
</svg><input type="text" disabled="" placeholder="SELECIONE UM SERVIDOR" style="background: transparent; border: none; width: 100%; outline: none; color: rgb(176, 168, 255); font-size: 15px; cursor: pointer; font-family: Ubuntu;"><svg fill="#6205D5" width="2.2rem" height="2.2rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 5px; width: 2.2rem; height: 2.2rem;">
<path d="M1 3.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5zM8 6a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 .708-.708L7.5 12.293V6.5A.5.5 0 0 1 8 6z">
</path>
</svg>
</div>
<div style="display: flex; margin-top: 5px; width: 100%; gap: 5px;">
<div style="display: flex; width: 100%; align-items: center; background: rgba(30, 28, 47, 0.314); color: rgb(255, 255, 255); padding: 0.2rem; border-radius: 50px; top: 90%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;">
<svg fill="#6205D5" width="2.2rem" height="2.2rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 5px; width: 2.2rem; height: 2.2rem;">
<path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z">
</path>
</svg><input type="text" placeholder="Nome de usuário" style="background: transparent; border: none; width: 100%; outline: none; color: rgb(176, 168, 255); font-size: 15px;">
</div>
<div style="display: flex; width: 100%; align-items: center; background: rgba(30, 28, 47, 0.314); color: rgb(255, 255, 255); padding: 0.2rem; border-radius: 50px; top: 90%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;">
<svg fill="#6205D5" width="2.2rem" height="2.2rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 5px; width: 2.2rem; height: 2.2rem;">
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z">
</path>
</svg><input type="password" placeholder="Senha" style="background: transparent; border: none; width: 100%; outline: none; color: rgb(176, 168, 255); font-size: 15px;"><svg fill="#6205D5" width="2.2rem" height="2.2rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 5px; width: 2.2rem; height: 2.2rem;">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z">
</path>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z">
</path>
</svg>
</div>
<div style="display: none; width: 100%; align-items: center; background: rgba(30, 28, 47, 0.314); color: rgb(255, 255, 255); padding: 0.2rem; border-radius: 50px; top: 90%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;">
<svg fill="#6205D5" width="2.2rem" height="2.2rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 5px; width: 2.2rem; height: 2.2rem;">
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z">
</path>
</svg><input type="password" placeholder="V2Ray UUID" style="background: transparent; border: none; width: 100%; outline: none; color: rgb(176, 168, 255); font-size: 15px;">
</div>
</div>
<div style="display: flex; flex-direction: row; align-items: center; justify-content: space-between; width: 100%; max-width: 23rem; margin: 50px 0px; border-radius: 5px; border: none; background: transparent; box-shadow: none; filter: drop-shadow(rgba(0, 0, 0, 0.1) 2px 2px 4px);">
<svg fill="#6205D5" width="45px" height="45px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 10px; width: 45px; height: 45px; cursor: pointer; background: rgba(30, 28, 47, 0.314); border-radius: 20%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;">
<path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z">
</path>
<path d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z">
</path>
</svg><svg fill="#6205D5" width="45px" height="45px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 10px; width: 45px; height: 45px; cursor: pointer; background: rgba(30, 28, 47, 0.314); border-radius: 20%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;">
<path d="M5 4a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm-.5 2.5A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zM5 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z">
</path>
<path d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z">
</path>
</svg><svg fill="#6205D5" width="45px" height="45px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 10px; width: 45px; height: 45px; cursor: pointer; background: rgba(30, 28, 47, 0.314); border-radius: 20%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;">
<path d="M4.684 11.523v-2.3h2.261v-.61H4.684V6.801h2.464v-.61H4v5.332h.684zm3.296 0h.676V8.98c0-.554.227-1.007.953-1.007.125 0 .258.004.329.015v-.613a1.806 1.806 0 0 0-.254-.02c-.582 0-.891.32-1.012.567h-.02v-.504H7.98v4.105zm2.805-5.093c0 .238.192.425.43.425a.428.428 0 1 0 0-.855.426.426 0 0 0-.43.43zm.094 5.093h.672V7.418h-.672v4.105z">
</path>
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z">
</path>
</svg><svg fill="#6205D5" width="45px" height="45px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 10px; width: 45px; height: 45px; cursor: pointer; background: rgba(30, 28, 47, 0.314); border-radius: 20%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;">
<path d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
</path>
</svg>
</div>
<div style="display: flex; flex-direction: column; align-items: center; position: absolute; bottom: 120%; margin-top: 3rem;">
<svg fill="#6205D5" width="7.5rem" height="7.5rem" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="fill: rgb(98, 5, 213); padding: 20px; width: 7.5rem; height: 7.5rem; cursor: pointer; background: rgba(30, 28, 47, 0.314); border-radius: 50%; box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px; filter: drop-shadow(rgba(0, 0, 0, 0.1) 2px 2px 4px);">
<path d="M7.5 1v7h1V1h-1z"></path>
<path d="M3 8.812a4.999 4.999 0 0 1 2.578-4.375l-.485-.874A6 6 0 1 0 11 3.616l-.501.865A5 5 0 1 1 3 8.812z">
</path>
</svg><span style="font-size: 1.4rem; font-family: Ubuntu; font-weight: bold; color: rgb(98, 5, 213); margin-top: 2rem;">UNKNOWN</span>
</div>
</div>
</div>
<script>
const BACKGROUND_IMAGE = null // JSON.parse(window?.DtGetAppConfig?.execute('APP_BACKGROUND_IMAGE') ?? '{"value": "https://i.ibb.co/0XyvpHx/DT7xsqhdau.jpg"}').value;
const BACKGROUND_COLOR = BACKGROUND_IMAGE ?
`url(${BACKGROUND_IMAGE}) center center / cover rgb(32, 32, 32)` :
'linear-gradient(45deg, rgba(20, 20, 44, 1), rgb(27, 27, 27), rgba(31, 28, 58, 1))'
const INPUT_COLOR = '#1e1c2f50'
const BUTTON_BACKGROUND_COLOR = '#1e1c2f50'
const ICON_COLOR = '#6205D5'
const TEXT_COLOR = '#b0a8ffff'
const TOOLS_BUTTON_BACKGROUND_COLOR = '#1e1c2f50'
const VPN_BUTTON_BACKGROUND_COLOR = '#1e1c2f50'
const VPN_STOPPED_COLOR = '#6205D5'
const VPN_STARTING_COLOR = '#6205D5'
const VPN_RUNNING_COLOR = '#6205D5'
const CHECKUSER_TEXT_COLOR = '#b0a8ffff'
const LOGGER_TEXT_COLOR = '#b0a8ffff'
const DIALOG_HEADER_TITLE_COLOR = '#b0a8ffff'
const DIALOG_HEADER_CLOSE_BUTTON_COLOR = '#b0a8ffff'
const DIALOG_CONTENT_BACKGROUND_COLOR = 'linear-gradient(45deg, rgba(20, 20, 44, 1), rgb(27, 27, 27), rgba(31, 28, 58, 1))'
const DIALOG_FOOTER_BUTTON_COLOR = '#1e1c2f50'
const DIALOG_FOOTER_BUTTON_TEXT_COLOR = '#b0a8ffff'
const URL_SPEEDTEST = 'https://fast.com'
const URL_YOUTUBE = 'https://www.youtube.com/embed/g9JLURIh9lE'
const URL_MP3 = 'https://www.palcomp3.com.br'
const POLITC_URL = 'https://sshtproject.com/privacidade/'
const TERMS_URL = 'https://sshtproject.com/termos/'
const SERVER_URL = 'http://sshtproject.com/servers/'
const TUTO_URL = 'https://sshtproject.com/tutoriais/'
const PREMIUM_URL = 'https://sshtproject.com/premium/'
class Component {
constructor(element) {
this.element = element;
}
addEventListener(event, listener) {
this.element.addEventListener(event, listener);
}
append(component) {
if (component instanceof Component) {
this.element.appendChild(component.element);
} else {
this.element.append(component);
}
}
appendChild(component) {
if (component instanceof Component) {
this.element.appendChild(component.element);
} else {
this.element.appendChild(component);
}
}
remove() {
this.element.remove();
}
contains(component) {
if (component instanceof Component) {
return this.element.contains(component.element);
} else {
return this.element.contains(component);
}
}
}
class StyledComponent extends Component {
constructor(element, styles = {}) {
super(element);
this.styles = styles;
this.setStyles(styles);
}
setStyles(styles) {
Object.keys(styles).forEach((key) => {
if (this.element.style.hasOwnProperty(key)) {
this.element.style[key] = styles[key];
}
});
}
}
class Toast extends StyledComponent {
constructor(element, styles = {}) {
super(element, styles);
}
showToast(message, type, duration = 3000) {
this.element.innerHTML = message;
this.element.style.wordWrap = 'break-word';
this.element.style.width = '90%';
this.element.style.maxWidth = '400px';
this.element.style.textAlign = 'center';
this.element.style.display = 'block';
this.element.style.position = 'fixed';
this.element.style.bottom = '10%';
this.element.style.left = '50%';
this.element.style.transform = 'translateX(-50%)';
this.element.style.opacity = '0';
this.element.style.color = '#FFFFFF';
switch (type) {
case 'success':
this.element.style.background = 'linear-gradient(135deg, #4CAF50, #009688)';
break;
case 'error':
this.element.style.background = 'linear-gradient(135deg, #F44336, #FF5722)';
break;
case 'info':
default:
this.element.style.background = 'linear-gradient(135deg, #2196F3, #03A9F4)';
break;
}
this.element.style.padding = '10px';
this.element.style.borderRadius = '4px';
this.element.style.opacity = '0';
this.element.style.transition = 'opacity 0.3s ease-in-out';
setTimeout(() => {
this.element.style.opacity = '1';
}, 100);
setTimeout(() => this.hideToast(), duration);
this.element.addEventListener('click', () => this.hideToast());
}
hideToast() {
this.element.style.transition = 'opacity 0.3s ease-in-out';
this.element.style.opacity = '0';
setTimeout(() => {
this.element.remove();
}, 300);
}
static success(message, duration = 3000) {
const toastElement = document.createElement('div');
document.body.appendChild(toastElement);
const toast = new Toast(toastElement);
toast.showToast(message, 'success', duration);
}
static error(message, duration = 3000) {
const toastElement = document.createElement('div');
document.body.appendChild(toastElement);
const toast = new Toast(toastElement);
toast.showToast(message, 'error', duration);
}
static info(message, duration = 3000) {
const toastElement = document.createElement('div');
document.body.appendChild(toastElement);
const toast = new Toast(toastElement);
toast.showToast(message, 'info', duration);
}
}
class AppComponent extends StyledComponent {
constructor(element, styles = {}) {
const defaultStyles = {
width: '100%',
height: '100%',
background: '#404258',
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
};
super(element, {
...defaultStyles,
...styles
});
}
}
class CardComponent extends StyledComponent {
constructor(styles = {}) {
const defaultStyles = {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
width: '85%',
maxWidth: '23rem',
margin: '1.2rem',
borderRadius: '5px',
border: 'none',
};
super(document.createElement('div'), {
...defaultStyles,
...styles
});
}
}
class InputGroupComponent extends StyledComponent {
constructor(styles = {}) {
const defaultStyles = {
display: 'flex',
width: '100%',
alignItems: 'center',
background: '#363749',
color: '#FFF',
padding: '0.2rem',
borderRadius: '50px',
top: '90%',
boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
};
super(document.createElement('div'), {
...defaultStyles,
...styles
});
}
append(...components) {
components.forEach((component) => super.append(component));
}
}
class InputComponent extends StyledComponent {
constructor(styles = {}) {
const defaultStyles = {
background: 'transparent',
border: 'none',
width: '100%',
outline: 'none',
color: TEXT_COLOR,
fontSize: '15px',
};
super(document.createElement('input'), {
...defaultStyles,
...styles
});
}
setEnabled(value) {
this.element.disabled = !value;
}
}
class InputText extends InputComponent {
constructor(styles = {}) {
super(styles);
this.element.type = 'text';
}
get value() {
return this.element.value;
}
setPlaceholder(text) {
this.element.placeholder = text;
}
setOnInputListener(callback) {
this.addEventListener('input', callback);
}
setValue(value) {
this.element.value = value;
}
setOnInputListener(callback) {
this.addEventListener('input', callback);
}
}
class InputPassword extends InputText {
constructor(styles = {}) {
super(styles);
this.element.type = 'password';
}
setShowing(value) {
this.element.type = !value ? 'password' : 'text';
}
get isShowing() {
return this.element.type != 'password'
}
}
class SvgComponent extends StyledComponent {
constructor(styles = {}, ...paths) {
const defaultStyles = {
fill: '#FFFFFF',
padding: '5px',
width: '2.2rem',
height: '2.2rem',
};
super(document.createElementNS('http://www.w3.org/2000/svg', 'svg'), {
...defaultStyles,
...styles,
});
this.applyOptions();
paths.forEach((p) => this.addPath(p));
}
applyOptions() {
this.setFill(this.styles.fill || 'currentColor');
this.setWidth(this.styles.width || '16');
this.setHeight(this.styles.height || '16');
this.setViewBox(this.styles.viewBox || '0 0 16 16');
this.setXmlns(this.styles.xmlns || 'http://www.w3.org/2000/svg');
}
setFill(color) {
this.element.setAttribute('fill', color);
}
setWidth(width) {
this.element.setAttribute('width', width);
}
setHeight(height) {
this.element.setAttribute('height', height);
}
setViewBox(viewBox) {
this.element.setAttribute('viewBox', viewBox);
}
setXmlns(xmlns) {
this.element.setAttribute('xmlns', xmlns);
}
addPath(...path) {
path.forEach((item) => {
const pathElement = document.createElementNS(
'http://www.w3.org/2000/svg',
'path'
);
pathElement.setAttribute('d', item);
this.element.appendChild(pathElement);
});
}
}
class Spinner extends StyledComponent {
constructor() {
super(document.createElement('div'), {
display: 'flex',
width: '100%',
alignItems: 'center',
justifyContent: 'center',
padding: '20px'
});
this.createSpinnerElements();
}
createSpinnerElements() {
const spinnerElement = new StyledComponent(document.createElement('div'));
spinnerElement.setStyles({
borderTop: '4px solid transparent',
borderRight: '4px solid #ccc',
borderBottom: '4px solid #ccc',
borderLeft: '4px solid #ccc',
borderRadius: '50%',
width: '45px',
height: '45px',
animation: 'spin 1s linear infinite',
});
this.append(spinnerElement)
}
}
class IconComponent extends SvgComponent {
constructor(styles = {}, ...iconPath) {
super({
cursor: 'pointer',
background: TOOLS_BUTTON_BACKGROUND_COLOR,
borderRadius: '20%',
height: '45px',
width: '45px',
padding: '10px',
boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
fill: ICON_COLOR,
...styles,
},
...iconPath,
);
}
}
class CalanderIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M4.684 11.523v-2.3h2.261v-.61H4.684V6.801h2.464v-.61H4v5.332h.684zm3.296 0h.676V8.98c0-.554.227-1.007.953-1.007.125 0 .258.004.329.015v-.613a1.806 1.806 0 0 0-.254-.02c-.582 0-.891.32-1.012.567h-.02v-.504H7.98v4.105zm2.805-5.093c0 .238.192.425.43.425a.428.428 0 1 0 0-.855.426.426 0 0 0-.43.43zm.094 5.093h.672V7.418h-.672v4.105z',
'M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'
);
}
}
class LoggerIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M5 4a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm-.5 2.5A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zM5 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1H5zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1H5z',
'M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z'
)
}
}
class ArrowRepeatIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z',
'M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z'
);
}
}
class MoreIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z'
);
}
}
class BatteryIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M2 6h10v4H2V6z', 'M2 4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H2zm10 1a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h10zm4 3a1.5 1.5 0 0 1-1.5 1.5v-3A1.5 1.5 0 0 1 16 8z'
);
}
}
class HeadsetIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M8 1a5 5 0 0 0-5 5v1h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a6 6 0 1 1 12 0v6a2.5 2.5 0 0 1-2.5 2.5H9.366a1 1 0 0 1-.866.5h-1a1 1 0 1 1 0-2h1a1 1 0 0 1 .866.5H11.5A1.5 1.5 0 0 0 13 12h-1a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h1V6a5 5 0 0 0-5-5z'
);
}
}
class ServerIconComponet extends IconComponent {
constructor(styles = {}) {
super(styles,
'M4.5 5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zM3 4.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm2 7a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm-2.5.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1z',
'M2 2a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h1v2H2a2 2 0 0 0-2 2v1a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-1a2 2 0 0 0-2-2h-1V7h1a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H2zm13 2v1a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1zm0 7v1a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1zm-3-4v2H4V7h8z'
);
}
}
class policyIconComponet extends IconComponent {
constructor(styles = {}) {
super(styles,
'M10.854 6.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 8.793l2.646-2.647a.5.5 0 0 1 .708 0z',
'M3 0h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v1H1V2a2 2 0 0 1 2-2z',
'M1 5v-.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1z'
);
}
}
class BuyIconComponet extends IconComponent {
constructor(styles = {}) {
super(styles,
'M8 1a2.5 2.5 0 0 1 2.5 2.5V4h-5v-.5A2.5 2.5 0 0 1 8 1zm3.5 3v-.5a3.5 3.5 0 1 0-7 0V4H1v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-3.5zM2 5h12v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5z'
);
}
}
class TutorialIconComponet extends IconComponent {
constructor(styles = {}) {
super(styles,
'M2.5 3.5a.5.5 0 0 1 0-1h11a.5.5 0 0 1 0 1h-11zm2-2a.5.5 0 0 1 0-1h7a.5.5 0 0 1 0 1h-7zM0 13a1.5 1.5 0 0 0 1.5 1.5h13A1.5 1.5 0 0 0 16 13V6a1.5 1.5 0 0 0-1.5-1.5h-13A1.5 1.5 0 0 0 0 6v7zm6.258-6.437a.5.5 0 0 1 .507.013l4 2.5a.5.5 0 0 1 0 .848l-4 2.5A.5.5 0 0 1 6 12V7a.5.5 0 0 1 .258-.437z'
);
}
}
class SpeedMeterIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M8 2a.5.5 0 0 1 .5.5V4a.5.5 0 0 1-1 0V2.5A.5.5 0 0 1 8 2zM3.732 3.732a.5.5 0 0 1 .707 0l.915.914a.5.5 0 1 1-.708.708l-.914-.915a.5.5 0 0 1 0-.707zM2 8a.5.5 0 0 1 .5-.5h1.586a.5.5 0 0 1 0 1H2.5A.5.5 0 0 1 2 8zm9.5 0a.5.5 0 0 1 .5-.5h1.5a.5.5 0 0 1 0 1H12a.5.5 0 0 1-.5-.5zm.754-4.246a.389.389 0 0 0-.527-.02L7.547 7.31A.91.91 0 1 0 8.85 8.569l3.434-4.297a.389.389 0 0 0-.029-.518z',
'M6.664 15.889A8 8 0 1 1 9.336.11a8 8 0 0 1-2.672 15.78zm-4.665-4.283A11.945 11.945 0 0 1 8 10c2.186 0 4.236.585 6.001 1.606a7 7 0 1 0-12.002 0z'
);
}
}
class YouTubeIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 0 1 1.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.007 2.007 0 0 1-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.007 2.007 0 0 1-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31.4 31.4 0 0 1 0 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.007 2.007 0 0 1 1.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A99.788 99.788 0 0 1 7.858 2h.193zM6.4 5.209v4.818l4.157-2.408L6.4 5.209z'
);
}
}
class Mp3IconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M4 3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V3zm1 0v3h6V3H5zm3 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2z',
'M11 11a3 3 0 1 1-6 0 3 3 0 0 1 6 0zm-3 2a2 2 0 1 0 0-4 2 2 0 0 0 0 4z',
'M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm2-1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H4z',
);
}
}
class TrashIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z',
'M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z'
);
}
}
class ReceptionIconComponent extends IconComponent {
constructor(styles = {}) {
super(styles,
'M0 11.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-2zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-5zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-8zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-11z'
);
}
}
class InfoIconComponent extends SvgComponent {
constructor(styles = {}) {
super(styles,
'M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z',
'm8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'
);
}
}
class ArrowDownIconComponent extends SvgComponent {
constructor(style = {}) {
super({
fill: ICON_COLOR,
...style,
},
'M1 3.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5zM8 6a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 .708-.708L7.5 12.293V6.5A.5.5 0 0 1 8 6z'
);
}
}
class NetworkIconComponent extends SvgComponent {
constructor(style = {}) {
super({
fill: ICON_COLOR,
...style,
},
'M4.5 5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1zM3 4.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0z',
'M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v1a2 2 0 0 1-2 2H8.5v3a1.5 1.5 0 0 1 1.5 1.5h5.5a.5.5 0 0 1 0 1H10A1.5 1.5 0 0 1 8.5 14h-1A1.5 1.5 0 0 1 6 12.5H.5a.5.5 0 0 1 0-1H6A1.5 1.5 0 0 1 7.5 10V7H2a2 2 0 0 1-2-2V4zm1 0v1a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1zm6 7.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5z'
);
}
}
class RouterIconComponent extends IconComponent {
constructor(style = {}) {
super({
fill: ICON_COLOR,
...style,
},
'M5.525 3.025a3.5 3.5 0 0 1 4.95 0 .5.5 0 1 0 .707-.707 4.5 4.5 0 0 0-6.364 0 .5.5 0 0 0 .707.707Z',
'M6.94 4.44a1.5 1.5 0 0 1 2.12 0 .5.5 0 0 0 .708-.708 2.5 2.5 0 0 0-3.536 0 .5.5 0 0 0 .707.707ZM2.5 11a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1Zm4.5-.5a.5.5 0 1 0 1 0 .5.5 0 0 0-1 0Zm2.5.5a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1Zm1.5-.5a.5.5 0 1 0 1 0 .5.5 0 0 0-1 0Zm2 0a.5.5 0 1 0 1 0 .5.5 0 0 0-1 0Z',
'M2.974 2.342a.5.5 0 1 0-.948.316L3.806 8H1.5A1.5 1.5 0 0 0 0 9.5v2A1.5 1.5 0 0 0 1.5 13H2a.5.5 0 0 0 .5.5h2A.5.5 0 0 0 5 13h6a.5.5 0 0 0 .5.5h2a.5.5 0 0 0 .5-.5h.5a1.5 1.5 0 0 0 1.5-1.5v-2A1.5 1.5 0 0 0 14.5 8h-2.306l1.78-5.342a.5.5 0 1 0-.948-.316L11.14 8H4.86L2.974 2.342ZM14.5 9a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-2a.5.5 0 0 1 .5-.5h13Z',
'M8.5 5.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0Z'
);
}
}
class PersonIconComponent extends SvgComponent {
constructor(style = {}) {
super({
fill: ICON_COLOR,
...style,
},
'M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z'
);
}
}
class LockIconComponent extends SvgComponent {
constructor(style = {}) {
super({
fill: ICON_COLOR,
...style,
},
'M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z'
);
}
}
class EyeIconComponent extends SvgComponent {
constructor(style = {}) {
super({
fill: ICON_COLOR,
...style,
},
'M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z',
'M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z',
);
}
}
class ArrowDownShortIconComponent extends SvgComponent {
constructor(style = {}) {
super({
fill: ICON_COLOR,
...style,
},
'M8 4a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L7.5 10.293V4.5A.5.5 0 0 1 8 4z'
);
}
}
class ArrowUpShortIconComponent extends SvgComponent {
constructor(style = {}) {
super({
fill: ICON_COLOR,
...style,
},
'M8 12a.5.5 0 0 0 .5-.5V5.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 5.707V11.5a.5.5 0 0 0 .5.5z'
);
}
}
class PowerIconComponent extends SvgComponent {
constructor(style = {}) {
super({
cursor: 'pointer',
height: '7.5rem',
width: '7.5rem',
background: VPN_BUTTON_BACKGROUND_COLOR,
borderRadius: '50%',
boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
padding: '20px',
filter: 'drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1))',
fill: ICON_COLOR,
...style,
},
'M7.5 1v7h1V1h-1z',
'M3 8.812a4.999 4.999 0 0 1 2.578-4.375l-.485-.874A6 6 0 1 0 11 3.616l-.501.865A5 5 0 1 1 3 8.812z',
);
}
}
class DialogComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('div'), {
position: 'absolute',
top: '0',
bottom: '0',
left: '0',
right: '0',
height: '100vh',
background: 'rgba(0, 0, 0, 0.5)',
backdropFilter: 'blur(5px)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
visibility: 'hidden',
opacity: '0',
...styles,
});
this.element.addEventListener('click', (event) => {
if (event.target === this.element) {
this.close();
}
});
this.onCloseEvent = null
}
setOnCloseEventListener(callback) {
this.onCloseEvent = callback
}
setContent(content) {
if (!(content instanceof DialogContentComponent)) {
throw new TypeError('Content must be a DialogContentComponent');
}
if (!this.contains(content)) {
this.append(content);
}
}
show() {
this.setStyles({
opacity: '1',
visibility: 'visible',
display: 'flex',
animation: 'fade-in 0.3s forwards',
pointerEvents: 'auto',
})
if (!document.body.contains(this.element)) {
document.body.append(this.element);
}
}
close() {
this.setStyles({
opacity: '0',
animation: 'fade-out 0.3s forwards',
})
setTimeout(() => {
this.setStyles({
display: 'none',
pointerEvents: 'none',
})
if (this.onCloseEvent != null) {
this.onCloseEvent()
}
}, 300);
}
remove() {
if (document.body.contains(this.element)) {
this.element.remove();
}
}
}
class DialogContentComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('div'), {
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
background: DIALOG_CONTENT_BACKGROUND_COLOR,
borderRadius: '5px',
maxWidth: '30rem',
width: '85%',
...styles,
});
this.lastHeader = null;
this.lastBody = null;
this.lastFooter = null;
}
setHeader(component) {
this?.lastHeader?.remove()
this.lastHeader = component
this.append(component);
}
setBody(component) {
this?.lastBody?.remove()
this.lastBody = component
this.append(component);
}
setFooter(component) {
this?.lastFooter?.remove()
this.lastFooter = component
this.append(component);
}
}
class DialogHeaderComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('div'), {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
width: '100%',
padding: '5px',
...styles,
});
this.title = new StyledComponent(document.createElement('span'), {
fontSize: '16px',
color: DIALOG_HEADER_TITLE_COLOR,
fontFamily: 'Ubuntu',
fontWeight: 'bold',
padding: '5px',
});
this.closeButton = new SvgComponent({
cursor: 'pointer',
height: '35px',
width: '35px',
fill: DIALOG_HEADER_CLOSE_BUTTON_COLOR,
},
'M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z'
);
this.initialize();
}
setTitleText(title) {
this.title.element.innerText = title;
}
setCloseButtonClickListener(callback) {
this.closeButton.addEventListener('click', callback);
}
initialize() {
this.append(this.title);
this.append(this.closeButton);
}
}
class DialogBodyComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('div'), {
display: 'flex',
width: '100%',
padding: '5px',
...styles,
});
}
}
class DialogFooterComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('div'), {
display: 'flex',
justifyContent: 'space-between',
gap: '5px',
alignItems: 'center',
width: '100%',
padding: '5px',
...styles,
});
}
addButton(button) {
if (!(button instanceof DialogFooterButtonComponent)) {
throw new TypeError('Button must be a DialogFooterButtonComponent instance');
}
this.append(button);
return this;
}
}
class DialogFooterButtonComponent extends StyledComponent {
constructor(text, onclick, styles = {}) {
super(document.createElement('button'), {
fontSize: '14px',
fontWeight: 'bold',
color: DIALOG_FOOTER_BUTTON_TEXT_COLOR,
background: DIALOG_FOOTER_BUTTON_COLOR,
border: 'none',
borderRadius: '3px',
padding: '10px',
width: '100%',
cursor: 'pointer',
boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
...styles,
});
this.setText(text)
this.setClickListener(onclick);
}
setText(text) {
this.element.innerText = text;
}
setClickListener(callback) {
this.addEventListener('click', callback);
}
}
class DialogBuilder {
constructor(styles = {}) {
this.dialog = new DialogComponent(styles);
this.header = new DialogHeaderComponent();
this.content = new DialogContentComponent();
this.footer = new DialogFooterComponent();
this.footerButtons = [];
this.content.setHeader(this.header);
this.header.setCloseButtonClickListener(() => this.dialog.close());
}
static create(styles = {}) {
return new DialogBuilder(styles);
}
setTitle(title) {
this.header.setTitleText(title);
return this;
}
setAutoRemove(autoRemove) {
this.dialog.setOnCloseEventListener(() => {
if (autoRemove) {
this.dialog.remove();
}
});
return this;
}
setBody(bodyComponent) {
this.content.setBody(bodyComponent);
return this;
}
addFooterButton(text, callback) {
const button = new DialogFooterButtonComponent(text, callback);
this.footerButtons.push(button);
return this;
}
show() {
this.dialog.setContent(this.content);
if (this.footerButtons.length > 0) {
this.content.setFooter(this.footer);
this.footerButtons.forEach((button) => {
this.footer.addButton(button);
});
}
this.dialog.show();
return this;
}
close() {
this.dialog.close();
}
}
class ConfigComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('div'), {
display: 'flex',
gap: '5px',
alignItems: 'center',
textAlign: 'left',
marginTop: '5px',
padding: '5px',
background: 'rgba(116, 35, 217, 0.1)',
width: '100%',
borderRadius: '15px',
filter: 'drop-shadow rgba(0, 0, 0, 0.1)',
...styles
});
this.image = document.createElement('img');
this.name = document.createElement('span');
this.description = document.createElement('span');
this.mode = document.createElement('span');
this.initialize();
}
setImage(url) {
this.image.src = url;
}
setName(name) {
this.name.innerHTML = name;
}
setDescription(description) {
this.description.innerHTML = description;
}
setMode(mode) {
this.mode.innerHTML = mode;
}
initialize() {
this.setImageStyles();
this.setNameStyles();
this.setDescriptionStyles();
this.setModeStyles();
const startArea = this.createStartArea();
const endArea = this.createEndArea();
this.appendElements(startArea, endArea);
}
setImageStyles() {
this.image.style.width = '40px';
this.image.style.height = '40px';
}
setNameStyles() {
this.name.style.fontSize = '12px';
this.name.style.fontFamily = 'Ubuntu', 'Ubuntu;';
this.name.style.color = '#b0a8ffff';
this.name.style.fontWeight = 'bold';
}
setDescriptionStyles() {
this.description.style.fontSize = '12px';
this.description.style.fontFamily = 'Ubuntu', 'Ubuntu;';
this.description.style.color = '#b0a8ffff';
this.description.style.fontWeight = 'bold';
}
setModeStyles() {
this.mode.style.fontSize = '12px';
this.mode.style.fontFamily = 'Ubuntu', 'Ubuntu;';
this.mode.style.color = '#b0a8ffff'
this.mode.style.fontWeight = 'bold';
this.mode.style.whiteSpace = 'nowrap';
}
createStartArea() {
const startArea = document.createElement('div');
startArea.style.display = 'flex';
startArea.style.width = '100%';
startArea.style.gap = '10px';
startArea.style.flexDirection = 'column';
startArea.appendChild(this.name);
startArea.appendChild(this.description);
return startArea;
}
createEndArea() {
const endArea = document.createElement('div');
endArea.style.display = 'flex';
endArea.style.flexDirection = 'column';
endArea.style.alignItems = 'end';
endArea.style.alignSelf = 'end';
endArea.style.width = '50%';
endArea.appendChild(this.mode);
return endArea;
}
appendElements(startArea, endArea) {
this.appendChild(this.image);
this.appendChild(startArea);
this.appendChild(endArea);
}
}
class CategoryComponent extends StyledComponent {
constructor(styles = {}, items = []) {
super(document.createElement('div'), {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'column',
textAlign: 'center',
padding: '1px',
width: '100%',
...styles
});
this.items = items;
this.name = document.createElement('span');
this.setNameStyles();
this.initialize();
this.setItems(items);
}
setNameStyles() {
this.name.style.width = '100%';
this.name.style.fontSize = '16px'
this.name.style.fontFamily = 'Ubuntu';
this.name.style.color = '#b0a8ffff';
this.name.style.background = 'rgba(116, 35, 217, 0.1)';
this.name.style.padding = '5px';
this.name.style.fontWeight = 'bold';
this.name.style.filter = 'drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1))';
}
setName(value) {
this.name.innerHTML = value;
}
setItems(items) {
items.forEach(item => this.append(item));
}
initialize() {
this.appendChild(this.name);
}
}
class ConfigBodyComponent extends DialogBodyComponent {
constructor(items) {
super({
flexDirection: 'column',
gap: '15px',
maxHeight: '80vh',
overflowY: 'auto'
});
items.forEach(item => this.append(item));
}
}
class LoggerItemComponent extends StyledComponent {
constructor(styles = {}, message) {
super(document.createElement('span'), {
fontFamily: 'monospace',
width: '100%',
fontSize: '15px',
color: LOGGER_TEXT_COLOR,
...styles,
});
this.element.innerHTML = message
}
}
class LoggerBodyComponent extends DialogBodyComponent {
constructor(styles = {}, items = []) {
super({
flexDirection: 'column',
maxHeight: '65vh',
overflowY: 'auto',
width: '100%',
...styles,
});
this.setItems(items);
}
setItems(items) {
this.element.innerHTML = '';
items.forEach(item => this.append(item));
this.scrollDown();
}
scrollDown() {
this.element.scrollTop = this.element.scrollHeight;
}
}
class CheckUserBodyComponent extends DialogBodyComponent {
constructor(data = {}) {
super()
const component = new StyledComponent(document.createElement('div'), {
display: 'flex',
flexDirection: 'column',
color: TEXT_COLOR,
fontFamily: 'Ubuntu',
gap: '2px',
textAlign: 'center',
width: '100%',
});
component.element.innerHTML = `
<span style="color: ${CHECKUSER_TEXT_COLOR}">=dNome de usuario: ${data.username}</span>
<span style="color: ${CHECKUSER_TEXT_COLOR}">=ÆExpira em: ${data.expiration_date}</span>
<span style="color: ${CHECKUSER_TEXT_COLOR}">=ÆDias restantes: ${data.expiration_days}</span>
<span style="color: ${CHECKUSER_TEXT_COLOR}">=«Conexoes: ${data.count_connections}|${data.limit_connections}</span>
`
this.append(component)
}
}
class VpnStateComponent extends StyledComponent {
constructor(style = {}) {
super(document.createElement('span'), {
fontSize: '1.4rem',
fontFamily: 'Ubuntu',
fontWeight: 'bold',
color: '#FFF',
marginTop: '2rem',
...style,
})
this.setState('DISCONNECTED')
}
setState(state) {
this.element.innerHTML = state
}
}
class LocalIPComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('span'), {
position: 'absolute',
fontSize: '1rem',
fontFamily: 'Ubuntu',
fontWeight: 'bold',
whiteSpace: 'nowrap',
color: TEXT_COLOR,
top: `${window?.DtGetStatusBarHeight?.execute() ?? '30'}px`,
left: '10px',
...styles,
})
this.setIP(window?.DtGetLocalIP?.execute() ?? '127.0.0.1')
setInterval(() => {
this.setIP(window?.DtGetLocalIP?.execute() ?? '127.0.0.1')
}, 1000)
}
setIP(ip) {
this.element.innerHTML = `IP: ${ip}`
}
}
class NetworkStatsComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('div'), {
display: 'flex',
position: 'absolute',
gap: '5px',
top: `${(window?.DtGetStatusBarHeight?.execute() ?? 30) + 20}px`,
left: '-5px',
...styles,
});
this.meterDownContainer = this.createMeterContainer();
this.meterDownText = this.createMeterText();
this.arrowDownShortIcon = new ArrowDownShortIconComponent();
this.meterDownContainer.append(this.arrowDownShortIcon);
this.meterDownContainer.append(this.meterDownText);
this.meterUpContainer = this.createMeterContainer();
this.meterUpText = this.createMeterText();
this.arrowUpShortIcon = new ArrowUpShortIconComponent();
this.meterUpContainer.append(this.arrowUpShortIcon);
this.meterUpContainer.append(this.meterUpText);
this.append(this.meterDownContainer);
this.append(this.meterUpContainer);
this.getNetworkDownloadFn = () => window?.DtGetNetworkDownloadBytes?.execute() ?? 0;
this.getNetworkUploadFn = () => window?.DtGetNetworkUploadBytes?.execute() ?? 0;
this.currentNetworkDownload = parseFloat(localStorage.getItem('networkDownload') ?? this.getNetworkDownloadFn());
this.currentNetworkUpload = parseFloat(localStorage.getItem('networkUpload') ?? this.getNetworkUploadFn());
localStorage.setItem('networkDownload', this.currentNetworkDownload);
localStorage.setItem('networkUpload', this.currentNetworkUpload);
this.showMeter();
setInterval(() => this.showMeter(), 1000);
}
createMeterContainer() {
return new StyledComponent(document.createElement('div'), {
display: 'flex',
alignItems: 'center',
});
}
createMeterText() {
return new StyledComponent(document.createElement('span'), {
fontSize: '1rem',
marginLeft: '-5px',
fontFamily: 'Ubuntu',
fontWeight: 'bold',
whiteSpace: 'nowrap',
color: '#fff',
});
}
formatBytes(bytes) {
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
if (bytes === 0) return '0 B';
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return (bytes / Math.pow(1024, i)).toPrecision(3) + ' ' + sizes[i];
}
showMeter() {
const newNetworkDownload = this.getNetworkDownloadFn();
const newNetworkUpload = this.getNetworkUploadFn();
this.meterDownText.element.innerHTML = this.formatBytes(newNetworkDownload - this.currentNetworkDownload);
this.meterUpText.element.innerHTML = this.formatBytes(newNetworkUpload - this.currentNetworkUpload);
}
}
class IframeBodyComponent extends DialogBodyComponent {
constructor(styles = {}, url = null) {
super({
minHeight: '600px',
...styles
})
this.iframeElement = new StyledComponent(document.createElement('iframe'), {
width: '100%',
border: 'none',
borderRadius: '5px',
display: 'none',
})
this.spinner = new Spinner()
this.iframeElement.addEventListener('load', () => {
this.iframeElement.setStyles({
display: 'block'
})
this.spinner.setStyles({
display: 'none'
})
})
this.setUrl(url)
this.applyOptions()
this.append(this.iframeElement)
this.append(this.spinner)
}
setUrl(url) {
this.iframeElement.element.src = url
}
setOnLoadListener(callback) {
this.iframeElement.addEventListener('load', callback)
}
applyOptions() {
this.iframeElement.element.setAttribute('allow', 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share')
this.iframeElement.element.setAttribute('allowfullscreen', '')
this.iframeElement.element.setAttribute('frameborder', '0')
}
}
class CleanAppMessageBodyComponent extends DialogBodyComponent {
constructor(styles = {}, url = null) {
super({
height: 'auto',
...styles
})
this.spanComponent = new StyledComponent(document.createElement('span'), {
fontSize: '16px',
fontFamily: 'Ubuntu',
fontWeight: 'bold',
color: TEXT_COLOR,
})
this.spanComponent.element.innerHTML = 'Você gostaria de limpar os dados do aplicativo? Por favor, esteja ciente de que essa ação resultará na remoção permanente de todas as informações armazenadas. Você tem certeza de que deseja prosseguir com essa operação?'
this.append(this.spanComponent)
}
}
class StyledButtonComponent extends StyledComponent {
constructor(text, icon, onclick, styles = {}) {
super(document.createElement('button'), {
width: '100%',
borderRadius: '5px',
padding: '10px',
border: 'none',
color: TEXT_COLOR,
background: BUTTON_BACKGROUND_COLOR,
boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',
cursor: 'pointer',
display: 'flex',
alignItems: 'center',
filter: 'drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1))',
...styles
});
this.textComponent = new StyledComponent(document.createElement('span'), {
fontSize: '16px',
fontWeight: 'bold',
});
this.textComponent.element.innerHTML = text;
this.element.addEventListener('click', onclick)
this.append(icon ?? '')
this.append(this.textComponent);
}
}
class ApnSettingStyledButtonComponent extends StyledButtonComponent {
constructor() {
super(
'APN',
new ReceptionIconComponent(),
() => window?.DtStartApnActivity?.execute()
)
}
}
class BatteryStyledButtonComponent extends StyledButtonComponent {
constructor() {
super(
'BATERIA',
new BatteryIconComponent(),
() => window?.DtIgnoreBatteryOptimizations?.execute(),
)
}
}
class SupportStyledButtonComponent extends StyledButtonComponent {
constructor() {
super(
'SUPORTE',
new HeadsetIconComponent(),
() => window?.DtStartWebViewActivity?.execute(LINK_SUPPORT)
);
}
}
class SpeedTestStyledButtonComponent extends StyledButtonComponent {
constructor() {
super(
'SPEEDTEST',
new SpeedMeterIconComponent(),
() => {
DialogBuilder.create()
.setTitle('SPEEDTEST')
.setAutoRemove(true)
.setBody(new IframeBodyComponent({}, URL_SPEEDTEST))
.show()
})
}
}
class ButtonServersComponent extends StyledButtonComponent {
constructor() {
super(
'SERVIDORES',
new ServerIconComponet(),
() => window?.DtStartWebViewActivity?.execute(SERVER_URL)
);
}
}
class PolicyServersComponent extends StyledButtonComponent {
constructor() {
super(
'PRIVACIDADE',
new policyIconComponet(),
() => window?.DtStartWebViewActivity?.execute(POLITC_URL)
);
}
}
class TermosComponent extends StyledButtonComponent {
constructor() {
super(
'TERMOS',
new policyIconComponet(),
() => window?.DtStartWebViewActivity?.execute(TERMS_URL)
);
}
}
class BuyComponent extends StyledButtonComponent {
constructor() {
super(
'COMPRAR LOGIN',
new BuyIconComponet(),
() => window?.DtStartWebViewActivity?.execute(PREMIUM_URL)
);
}
}
class ButtonTutorialComponent extends StyledButtonComponent {
constructor() {
super(
'TUTORIAIS',
new TutorialIconComponet(),
() => window?.DtStartWebViewActivity?.execute(TUTO_URL)
);
}
}
class YouTubeStyledButtonComponent extends StyledButtonComponent {
static dialog = DialogBuilder.create({
zIndex: 1
})
.setTitle('YOUTUBE')
.setBody(new IframeBodyComponent({}, URL_YOUTUBE))
constructor() {
super(
'YOUTUBE',
new YouTubeIconComponent(),
() => this.dialog.show(),
)
}
get dialog() {
return YouTubeStyledButtonComponent.dialog;
}
}
class Mp3StyledButtonComponent extends StyledButtonComponent {
static dialog = DialogBuilder.create({
zIndex: 1
})
.setTitle('MP3')
.setBody(new IframeBodyComponent({}, URL_MP3))
constructor() {
super(
'MP3',
new Mp3IconComponent(),
() => this.dialog.show(),
)
}
get dialog() {
return Mp3StyledButtonComponent.dialog;
}
}
class CleanAppStyledButtonComponent extends StyledButtonComponent {
constructor() {
super(
'LIMPAR',
new TrashIconComponent(),
() => {
const dialog = DialogBuilder.create()
.setTitle('LIMPAR DADOS')
.setAutoRemove(true)
.setBody(new CleanAppMessageBodyComponent())
.addFooterButton('NÃO', () => dialog.close())
.addFooterButton('SIM', () => window?.DtCleanApp?.execute())
.show();
})
}
}
class HotSpotStyledButtonComponent extends StyledButtonComponent {
constructor() {
super(
'HOTSPOT',
new RouterIconComponent(),
() => this.toggleHotSpot())
}
startHotSpot() {
window?.DtStartHotSpotService?.execute();
Toast.success('HotSpot iniciado com sucesso!')
}
stopHotSpot() {
window?.DtStopHotSpotService?.execute();
Toast.success('HotSpot parado com sucesso!')
}
toggleHotSpot() {
const hotSpotStatus = window?.DtGetStatusHotSpotService?.execute() ?? 'STOPPED';
hotSpotStatus == 'RUNNING' ? this.stopHotSpot() : this.startHotSpot();
}
}
class MenuDialogBodyComponent extends DialogBodyComponent {
constructor() {
super({
display: 'flex',
flexDirection: 'column',
gap: '5px'
})
}
addRowButtons(...buttons) {
const element = new StyledComponent(document.createElement('div'), {
display: 'flex',
gap: '5px',
width: '100%'
});
buttons.forEach(button => element.append(button));
this.append(element);
return this;
}
}
class ConfigInputComponent extends InputGroupComponent {
constructor() {
super({
cursor: 'pointer',
background: INPUT_COLOR
});
this.configInput = new InputText({
cursor: 'pointer',
fontFamily: 'Ubuntu'
});
this.configInput.setEnabled(false);
this.configInput.setPlaceholder('SELECIONE UM SERVIDOR');
this.configInput.setValue(JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{}').name ?? '');
this.append(new NetworkIconComponent(), this.configInput, new ArrowDownIconComponent());
this.configure()
this.addEventListener('click', () => {
const mock = '[{"sorter":6,"color":"#6D08041C","name":"CONFIG","id":1393,"items":[{"mode":"V2RAY - VLESS","sorter":4,"tlsVersion":"TLSv1.2","name":"CONFIG 01","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":11803,"status":"ACTIVE"},{"mode":"SSH_DIRECT","sorter":2,"tlsVersion":"TLSv1.2","name":"CONFIG 02","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":28627,"status":"ACTIVE"},{"mode":"OVPN_PROXY","sorter":23,"tlsVersion":"TLSv1.2","name":"CONFIG 03","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":30001,"status":"ACTIVE"}]},{"sorter":2,"color":"#6D08041C","name":"CONFIG 2","id":1846,"items":[{"mode":"SSH_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG 01","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":26295,"status":"ACTIVE"}]},{"sorter":4,"color":"#80000000","name":"CONFIG 3","id":3310,"items":[{"mode":"SSH_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG. TEST","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":29997,"status":"ACTIVE"},{"mode":"OVPN_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG. TEST 2","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":29998,"status":"ACTIVE"}]}]';
const items = JSON.parse(window?.DtGetConfigs?.execute() || mock);
items.sort((a, b) => a.sorter - b.sorter);
items.forEach((item) => item.items.sort((a, b) => a.sorter - b.sorter));
const dialog = DialogBuilder.create()
.setTitle('CONFIGURAÇÕES')
.setAutoRemove(true)
.setBody(
new ConfigBodyComponent(
items.map((item) => {
const category = new CategoryComponent();
category.setName(item.name);
category.setItems(
item.items.map((item) => {
const config = new ConfigComponent();
config.setName(item.name);
config.setDescription(item.description ?? '');
config.setMode(item.mode);
config.setImage(item.icon);
config.addEventListener('click', () => {
window?.DtSetConfig?.execute(item.id);
dialog.close();
});
return config;
})
);
return category;
})
)
)
.show();
});
const originalClickListener = window.dtConfigClickListener;
window.dtConfigClickListener = () => {
if (originalClickListener) {
originalClickListener();
}
this.configure();
};
this.configure();
}
configure() {
const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{"auth":{"password": ""}, "mode": "v2ra"}')
this.configInput.setValue(config.name ?? '')
}
}
class UserPassInputComponent extends StyledComponent {
constructor() {
super(document.createElement('div'), {
display: 'flex',
marginTop: '5px',
width: '100%',
display: 'flex',
gap: '5px',
});
this.usernameGroupComponent = new InputGroupComponent({
background: INPUT_COLOR
});
const personIconComponent = new PersonIconComponent();
this.usernameInput = new InputText();
this.usernameInput.setPlaceholder('Nome de usuário');
this.usernameInput.setValue(window?.DtUsername?.get() ?? '');
this.usernameInput.setOnInputListener(() => window?.DtUsername?.set(this.usernameInput.value));
this.usernameGroupComponent.append(personIconComponent, this.usernameInput);
this.append(this.usernameGroupComponent);
this.passwordGroupComponent = new InputGroupComponent({
background: INPUT_COLOR
});
this.passwordInput = new InputPassword();
const eyeIconComponent = new EyeIconComponent();
eyeIconComponent.addEventListener('click', () => this.passwordInput.setShowing(!this.passwordInput.isShowing));
this.passwordInput.setPlaceholder('Senha');
this.passwordInput.setValue(window?.DtPassword?.get() ?? '');
this.passwordInput.setOnInputListener(() => {
window?.DtPassword?.set(this.passwordInput.value)
});
this.passwordGroupComponent.append(new LockIconComponent(), this.passwordInput, eyeIconComponent);
this.append(this.passwordGroupComponent);
this.v2rayUuidGroupComponent = new InputGroupComponent({
background: INPUT_COLOR
});
this.v2rayUuidInput = new InputPassword();
this.v2rayUuidInput.setPlaceholder('V2Ray UUID');
this.v2rayUuidInput.setValue(window?.DtUuid?.get() ?? '');
this.v2rayUuidInput.setOnInputListener(() => window?.DtUuid?.set(this.v2rayUuidInput.value));
this.v2rayUuidGroupComponent.append(new LockIconComponent(), this.v2rayUuidInput);
this.append(this.v2rayUuidGroupComponent);
const originalClickListener = window.dtConfigClickListener;
window.dtConfigClickListener = () => {
if (originalClickListener) {
originalClickListener();
}
this.configure();
};
this.configure();
}
configure() {
const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{"auth":{"password": ""}, "mode": "v2ra"}')
const isV2ray = config?.mode?.toLowerCase()?.startsWith('v2ray');
this.usernameGroupComponent.setStyles({
display: isV2ray || config?.auth?.username ? 'none' : 'flex',
})
this.passwordGroupComponent.setStyles({
display: isV2ray || config?.auth?.password ? 'none' : 'flex',
})
this.v2rayUuidGroupComponent.setStyles({
display: !isV2ray || config?.auth?.v2ray_uuid ? 'none' : 'flex',
})
const isRunning = (window?.DtGetVpnState?.execute() ?? 'DISCONNECTED') != 'DISCONNECTED';
this.usernameInput.setEnabled(!isRunning)
this.passwordInput.setEnabled(!isRunning)
this.v2rayUuidInput.setEnabled(!isRunning)
}
}
class ButtonAndStateContainerComponent extends StyledComponent {
constructor(styles = {}) {
super(document.createElement('div'), {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
position: 'absolute',
bottom: '120%',
...styles,
});
this.startOrStopButtonComponent = new PowerIconComponent();
this.startOrStopButtonComponent.addEventListener('click', () => {
if (window?.DtGetVpnState?.execute() !== 'DISCONNECTED') {
window?.DtExecuteVpnStop?.execute();
} else {
window?.DtExecuteVpnStart?.execute();
}
});
this.append(this.startOrStopButtonComponent);
this.vpnStateComponent = new VpnStateComponent();
this.append(this.vpnStateComponent);
window.dtVpnStateListener = state => this.configureState(state);
this.configureState(window?.DtGetVpnState?.execute() ?? 'DISCONNECTED');
}
configureState(state) {
const isRunning = state != 'DISCONNECTED';
this.vpnStateComponent.setState((window?.DtTranslateText?.execute('LBL_STATE_' + state) ?? 'UNKNOWN').toUpperCase())
if (state == 'DISCONNECTED') {
this.vpnStateComponent.setStyles({
color: VPN_STOPPED_COLOR
})
this.startOrStopButtonComponent.setStyles({
fill: VPN_STOPPED_COLOR
})
}
if (state != 'DISCONNECTED' && state != 'CONNECTED') {
this.vpnStateComponent.setStyles({
color: VPN_STARTING_COLOR
})
this.startOrStopButtonComponent.setStyles({
fill: VPN_STARTING_COLOR
})
}
if (state == 'CONNECTED') {
this.vpnStateComponent.setStyles({
color: VPN_RUNNING_COLOR
})
this.startOrStopButtonComponent.setStyles({
fill: VPN_RUNNING_COLOR
})
}
}
}
class CardToolsComponent extends CardComponent {
constructor() {
super({
margin: '50px 0',
width: '100%',
flexDirection: 'row',
justifyContent: 'space-between',
background: 'transparent',
boxShadow: 'none',
filter: 'drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1))',
});
this.loggerBody = new LoggerBodyComponent({});
this.addArrowRepeatIcon();
this.addLoggerIcon();
this.addCalanderIcon();
this.addMoreButton();
window.dtOnNewLogListener = () => this.renderizeLogger();
this.renderizeLogger();
}
addCalanderIcon() {
const calanderIconComponent = new CalanderIconComponent();
calanderIconComponent.addEventListener('click', () =>
window?.DtStartCheckUser?.execute()
);
this.append(calanderIconComponent);
}
addLoggerIcon() {
const loggerIconComponent = new LoggerIconComponent();
loggerIconComponent.addEventListener('click', () => {
const loggerDialog = DialogBuilder.create()
.setTitle('REGISTRO')
.setBody(this.loggerBody)
.setAutoRemove(true)
.addFooterButton('LIMPAR', () => window?.DtClearLogs?.execute())
.addFooterButton('FECHAR', () => loggerDialog.close())
.show();
this.loggerBody.scrollDown();
});
this.append(loggerIconComponent);
}
addArrowRepeatIcon() {
const arrowRepeatIconComponent = new ArrowRepeatIconComponent();
arrowRepeatIconComponent.addEventListener('click', () =>
window?.DtStartAppUpdate?.execute()
);
this.append(arrowRepeatIconComponent);
}
addMoreButton() {
const moreButton = new MoreIconComponent();
moreButton.addEventListener('click', () => {
DialogBuilder.create()
.setTitle('FERRAMENTAS')
.setAutoRemove(true)
.setBody(
new MenuDialogBodyComponent()
.addRowButtons(
new BuyComponent(),
new ButtonServersComponent(),
)
.addRowButtons(
new ButtonTutorialComponent(),
new SpeedTestStyledButtonComponent(),
)
.addRowButtons(
new HotSpotStyledButtonComponent(),
new BatteryStyledButtonComponent(),
)
.addRowButtons(
new ApnSettingStyledButtonComponent(),
new CleanAppStyledButtonComponent()
)
.addRowButtons(
new PolicyServersComponent(),
new TermosComponent(),
)
)
.show();
});
this.append(moreButton);
}
renderizeLogger() {
const mock = Array.from({
length: 300
}, (_, i) => ({
TIME: `MESSAGE ${i}`
}));
const data = JSON.parse(window?.DtGetLogs?.execute() ?? JSON.stringify(mock))
const items = data.map(log => {
const message = Object.keys(log)[0] + ' ' + log[Object.keys(log)]
return new LoggerItemComponent({}, message)
})
this.loggerBody.setItems(items)
}
}
class CheckUserDialog {
constructor() {
this.dialog = DialogBuilder.create()
.setAutoRemove(true)
.setTitle('CHECKUSER')
.setBody(new Spinner());
}
initialize() {
window.dtCheckUserStartedListener = () => this.checkUserStartedListener();
window.dtCheckUserModelListener = model => this.checkUserModelListener(model);
}
checkUserStartedListener() {
const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{}');
if (!config.url_check_user) return;
this.dialog.show();
}
checkUserModelListener(model) {
const data = JSON.parse(model ?? `{"username": "test"}`);
this.dialog
.setTitle(` Olá, ${data.username}`)
.setBody(new CheckUserBodyComponent(data));
}
}
const rootComponent = new AppComponent(document.querySelector('#root'), {
background: BACKGROUND_COLOR
});
window.onerror = e => {
rootComponent.element.style.color = '#FFFFFF';
rootComponent.element.style.fontSize = '18px';
rootComponent.element.innerHTML = e
return false;
};
const cardComponent = new CardComponent({
position: 'absolute',
top: '45%'
});
const configInput = new ConfigInputComponent();
cardComponent.append(configInput);
const userPassInputComponent = new UserPassInputComponent()
cardComponent.append(userPassInputComponent);
const cardToolsComponent = new CardToolsComponent();
cardComponent.append(cardToolsComponent);
const buttonAndStateContainer = new ButtonAndStateContainerComponent({
marginTop: '3rem'
});
cardComponent.append(buttonAndStateContainer);
rootComponent.append(new LocalIPComponent());
rootComponent.append(new NetworkStatsComponent());
rootComponent.append(cardComponent);
const checkUserDialog = new CheckUserDialog();
checkUserDialog.initialize();
function createElements() {
const container = document.createElement("div");
container.classList.add("container");
container.style.position = 'absolute';
const content = document.createElement("div");
content.classList.add("content");
const background = document.createElement("div");
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg.setAttribute("width", "16");
svg.setAttribute("height", "16");
svg.setAttribute("fill", "currentColor");
svg.classList.add("bi", "bi-git");
svg.setAttribute("viewBox", "0 0 16 16");
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
path.setAttribute("d", "M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.031 1.031 0 0 0 0-1.457");
svg.appendChild(path);
const span = document.createElement("span");
span.classList.add("ms-2");
span.setAttribute("id", "version");
span.textContent = ' 1.1';
// Montando a estrutura
background.appendChild(svg);
background.appendChild(span);
content.appendChild(background);
container.appendChild(content);
// Aplicando estilos
container.style.fontSize = '1.4rem';
container.style.fontFamily = 'Verdana';
container.style.color = TEXT_COLOR;
const statusBarHeight = window?.DtGetStatusBarHeight?.execute();
const extraPixels = 0; // Number of extra pixels you want to add
const defaultHeight = 60; // Default height if statusBarHeight is undefined
const totalTopValue = (statusBarHeight !== undefined ? statusBarHeight : defaultHeight) + extraPixels;
container.style.top = `${totalTopValue}px`;
container.style.right = '10px';
// Adicionando ao DOM
document.body.appendChild(container);
// Atualizar a versão a cada 2 segundos
setInterval(updateVersion, 2000);
}
// Função para atualizar a versão
function updateVersion() {
const versionElement = document.getElementById('version');
const version = window?.DtGetLocalConfigVersion?.execute() ?? ' 1.0';
versionElement.textContent = version;
}
// Chamar a função para criar elementos e configurar a versão inicial
createElements();
updateVersion();
</script>
<div class="container" style="position: absolute; font-size: 1.4rem; font-family: Verdana; color: rgb(176, 168, 255); top: 60px; right: 10px;">
<div class="content">
<div><svg width="16" height="16" fill="currentColor" class="bi bi-git" viewBox="0 0 16 16">
<path d="M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.031 1.031 0 0 0 0-1.457">
</path>
</svg><span class="ms-2" id="version"> 1.0</span></div>
</div>
</div>
</body>
</html>