Layout DT


SUBMITTED BY: terrorxdroid

DATE: March 27, 2024, 5:31 p.m.

UPDATED: Oct. 2, 2024, 8:18 p.m.

FORMAT: Text only

SIZE: 87.9 kB

HITS: 554

  1. [
  2. {
  3. "label": "Nome do app",
  4. "name": "APP_NAME",
  5. "value": "DTunnel Mod",
  6. "type": "STRING"
  7. },
  8. {
  9. "label": "Logo do app",
  10. "name": "APP_LOGO",
  11. "value": null,
  12. "type": "IMAGE"
  13. },
  14. {
  15. "label": "Imagem de fundo",
  16. "name": "APP_BACKGROUND_IMAGE",
  17. "value": null,
  18. "type": "IMAGE"
  19. },
  20. {
  21. "label": "Tipo do fundo do app",
  22. "name": "APP_BACKGROUND_TYPE",
  23. "value": {
  24. "options": [
  25. {
  26. "label": "Imagem",
  27. "value": "IMAGE"
  28. },
  29. {
  30. "label": "Cor",
  31. "value": "COLOR"
  32. }
  33. ],
  34. "selected": "COLOR"
  35. },
  36. "type": "SELECT"
  37. },
  38. {
  39. "label": "Cor de fundo",
  40. "name": "APP_BACKGROUND_COLOR",
  41. "value": "#080e16c7",
  42. "type": "COLOR"
  43. },
  44. {
  45. "label": "Cor do card inicial",
  46. "name": "APP_CARD_COLOR",
  47. "value": "#1d242e73",
  48. "type": "COLOR"
  49. },
  50. {
  51. "label": "Raio do card inicial",
  52. "name": "APP_CARD_RADIUS",
  53. "value": 20,
  54. "type": "INTEGER"
  55. },
  56. {
  57. "label": "Cor do card de status",
  58. "name": "APP_CARD_STATUS_COLOR",
  59. "value": "#1d242e73",
  60. "type": "COLOR"
  61. },
  62. {
  63. "label": "Raio do card de status",
  64. "name": "APP_CARD_STATUS_RADIUS",
  65. "value": 25,
  66. "type": "INTEGER"
  67. },
  68. {
  69. "label": "Cor do card de configurações",
  70. "name": "APP_CARD_CONFIG_COLOR",
  71. "value": "#0E171EC9",
  72. "type": "COLOR"
  73. },
  74. {
  75. "label": "Cor do fundo dos dialogs",
  76. "name": "APP_DIALOG_BACKGROUND_COLOR",
  77. "value": "#050C5AE4",
  78. "type": "COLOR"
  79. },
  80. {
  81. "label": "Cor do fundo do dialog de log",
  82. "name": "APP_DIALOG_LOGGER_COLOR",
  83. "value": "#080e16c7",
  84. "type": "COLOR"
  85. },
  86. {
  87. "label": "Cor das bordas",
  88. "name": "APP_BORDER_COLOR",
  89. "value": "#1d242e73",
  90. "type": "COLOR"
  91. },
  92. {
  93. "label": "Cor dos inputs",
  94. "name": "APP_INPUT_COLOR",
  95. "value": "#1d242e73",
  96. "type": "COLOR"
  97. },
  98. {
  99. "label": "Raio dos inputs",
  100. "name": "APP_INPUT_RADIUS",
  101. "value": 25,
  102. "type": "INTEGER"
  103. },
  104. {
  105. "label": "Cor dos textos",
  106. "name": "APP_TEXT_COLOR",
  107. "value": "#FFFFFFFF",
  108. "type": "COLOR"
  109. },
  110. {
  111. "label": "Cor dos botões",
  112. "name": "APP_BUTTON_COLOR",
  113. "value": "#1d242e73",
  114. "type": "COLOR"
  115. },
  116. {
  117. "label": "Raio dos botões",
  118. "name": "APP_BUTTON_RADIUS",
  119. "value": 25,
  120. "type": "INTEGER"
  121. },
  122. {
  123. "label": "Cor dos icones",
  124. "name": "APP_ICON_COLOR",
  125. "value": "#FFFFFFFF",
  126. "type": "COLOR"
  127. },
  128. {
  129. "label": "Exibir modo de conexão",
  130. "name": "APP_SHOW_CONNECTION_MODE",
  131. "value": true,
  132. "type": "BOOLEAN"
  133. },
  134. {
  135. "label": "Atualizar automaticamente as configurações ao lançar uma atualização.",
  136. "name": "APP_CONFIG_AUTO_UPDATE",
  137. "value": false,
  138. "type": "BOOLEAN"
  139. },
  140. {
  141. "label": "Iniciar o app automaticamente ao reiniciar o dispositivo",
  142. "name": "APP_AUTO_START",
  143. "value": false,
  144. "type": "BOOLEAN"
  145. },
  146. {
  147. "label": "Usar limiter de conexão",
  148. "name": "APP_CONNECTION_LIMITER",
  149. "value": false,
  150. "type": "BOOLEAN"
  151. },
  152. {
  153. "label": "Usar botão de atualizações",
  154. "name": "APP_BTN_UPDATE_ENABLED",
  155. "value": false,
  156. "type": "BOOLEAN"
  157. },
  158. {
  159. "label": "Usar botão de registros",
  160. "name": "APP_BTN_LOGGER_ENABLED",
  161. "value": true,
  162. "type": "BOOLEAN"
  163. },
  164. {
  165. "label": "Usar botão de pagina webview",
  166. "name": "APP_BTN_PAGE_ENABLED",
  167. "value": false,
  168. "type": "BOOLEAN"
  169. },
  170. {
  171. "label": "Ativar dialog de erros",
  172. "name": "APP_DIALOG_ERROR_ENABLED",
  173. "value": false,
  174. "type": "BOOLEAN"
  175. },
  176. {
  177. "label": "Ativar dialog de checkuser",
  178. "name": "APP_CHECKUSER_DIALOG_ENABLED",
  179. "value": false,
  180. "type": "BOOLEAN"
  181. },
  182. {
  183. "label": "Ativar toast de sucesso",
  184. "name": "APP_SUCCESS_TOAST_ENABLED",
  185. "value": true,
  186. "type": "BOOLEAN"
  187. },
  188. {
  189. "label": "Ativar toast de erro",
  190. "name": "APP_ERROR_TOAST_ENABLED",
  191. "value": false,
  192. "type": "BOOLEAN"
  193. },
  194. {
  195. "label": "Usar layout webview",
  196. "name": "APP_LAYOUT_WEBVIEW_ENABLED",
  197. "value": true,
  198. "type": "BOOLEAN"
  199. },
  200. {
  201. "label": "Mensagem",
  202. "name": "APP_MESSAGE",
  203. "value": null,
  204. "type": "TEXT"
  205. },
  206. {
  207. "label": "Tipo de mensagem",
  208. "name": "APP_MESSAGE_TYPE",
  209. "value": {
  210. "options": [
  211. {
  212. "label": "Alerta",
  213. "value": "ALERT"
  214. },
  215. {
  216. "label": "Informação",
  217. "value": "INFO"
  218. },
  219. {
  220. "label": "Boas vindas",
  221. "value": "WELCOME"
  222. },
  223. {
  224. "label": "Sem mensagem",
  225. "value": "NONE"
  226. }
  227. ],
  228. "selected": "NONE"
  229. },
  230. "type": "SELECT"
  231. },
  232. {
  233. "label": "URL de atualização do aplicativo",
  234. "name": "APP_UPDATE_URL",
  235. "value": null,
  236. "type": "URL"
  237. },
  238. {
  239. "label": "LAYOUT WEBVIEW (POR SUA CONTA E RISCO)",
  240. "name": "APP_LAYOUT_WEBVIEW",
  241. "value": "<!DOCTYPE html>\n\n<html lang=\"en\">\n\n<head>\n\n <meta charset=\"UTF-8\">\n\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\n <title>DTunnel</title>\n\n</head>\n\n<style>\n\n * {\n\n font-family: 'roboto';\n\n margin: 0;\n\n padding: 0;\n\n box-sizing: border-box;\n\n -webkit-tap-highlight-color: transparent;\n\n }\n\n ::placeholder {\n\n color: #FFF;\n\n }\n\n body {\n\n height: 100vh;\n\n }\n\n @keyframes fade-in {\n\n from {\n\n opacity: 0;\n\n }\n\n to {\n\n opacity: 1;\n\n }\n\n }\n\n @keyframes fade-out {\n\n from {\n\n opacity: 1;\n\n }\n\n to {\n\n opacity: 0;\n\n }\n\n }\n\n @keyframes pulse {\n\n 0% {\n\n transform: scale(1);\n\n box-shadow: none;\n\n }\n\n 50% {\n\n transform: scale(1.2);\n\n box-shadow: 0 0 20px 5px #fff;\n\n }\n\n 100% {\n\n transform: scale(1);\n\n box-shadow: none;\n\n }\n\n }\n\n @keyframes spin {\n\n from {\n\n transform: rotate(0deg);\n\n }\n\n to {\n\n transform: rotate(360deg);\n\n }\n\n }\n\n</style>\n\n<body>\n\n <div id=\"root\"></div>\n\n <script>\n\n const BACKGROUND_IMAGE = null// JSON.parse(window?.DtGetAppConfig?.execute('APP_BACKGROUND_IMAGE') ?? '{\"value\": \"https://i.imgur.com/fIohvOR.jpeg\"}').value;\n\n const BACKGROUND_COLOR = BACKGROUND_IMAGE\n\n ? `url(${BACKGROUND_IMAGE}) center center / cover rgb(32, 32, 32)`\n\n : 'linear-gradient(45deg, #000000, #000000 25%, #000000 25%, #000000 50%, #000000 50%, #000000 85%, #000000 25%, #000000)'\n\n const INPUT_COLOR = '#00000080'\n\n const BUTTON_BACKGROUND_COLOR = '#00000080'\n\n const ICON_COLOR = '#FFFFFF'\n\n const TEXT_COLOR = '#FFFFFF'\n\n const TOOLS_BUTTON_BACKGROUND_COLOR = '#000000'\n\n const VPN_BUTTON_BACKGROUND_COLOR = '#00000080'\n\n const VPN_STOPPED_COLOR = '#fff'\n\n const VPN_STARTING_COLOR = '#fff'\n\n const VPN_RUNNING_COLOR = '#fff'\n\n const CHECKUSER_TEXT_COLOR = '#FFFFFF'\n\n const LOGGER_TEXT_COLOR = '#FFFFFF'\n\n const DIALOG_HEADER_TITLE_COLOR = '#FFFFFF'\n\n const DIALOG_HEADER_CLOSE_BUTTON_COLOR = '#FFFFFF'\n\n const DIALOG_CONTENT_BACKGROUND_COLOR = '#00000080'\n\n const DIALOG_FOOTER_BUTTON_COLOR = '#00000080'\n\n const DIALOG_FOOTER_BUTTON_TEXT_COLOR = '#FFFFFF'\n\n const LINK_SUPPORT = 'https://t.me/dtutoriais'\n\n const TERMS_URL = 'https://t.me/dtutoriais'\n\n const URL_SPEEDTEST = 'https://fast.com'\n\n const URL_YOUTUBE = 'https://www.youtube.com/embed/g9JLURIh9lE'\n\n const URL_MP3 = 'https://xvideos.com'\n\n class Component {\n\n constructor(element) {\n\n this.element = element;\n\n }\n\n addEventListener(event, listener) {\n\n this.element.addEventListener(event, listener);\n\n }\n\n append(component) {\n\n if (component instanceof Component) {\n\n this.element.appendChild(component.element);\n\n } else {\n\n this.element.append(component);\n\n }\n\n }\n\n appendChild(component) {\n\n if (component instanceof Component) {\n\n this.element.appendChild(component.element);\n\n } else {\n\n this.element.appendChild(component);\n\n }\n\n }\n\n remove() {\n\n this.element.remove();\n\n }\n\n contains(component) {\n\n if (component instanceof Component) {\n\n return this.element.contains(component.element);\n\n } else {\n\n return this.element.contains(component);\n\n }\n\n }\n\n }\n\n class StyledComponent extends Component {\n\n constructor(element, styles = {}) {\n\n super(element);\n\n this.styles = styles;\n\n this.setStyles(styles);\n\n }\n\n setStyles(styles) {\n\n Object.keys(styles).forEach((key) => {\n\n if (this.element.style.hasOwnProperty(key)) {\n\n this.element.style[key] = styles[key];\n\n }\n\n });\n\n }\n\n }\n\n class Toast extends StyledComponent {\n\n constructor(element, styles = {}) {\n\n super(element, styles);\n\n }\n\n showToast(message, type, duration = 3000) {\n\n this.element.innerHTML = message;\n\n this.element.style.wordWrap = 'break-word';\n\n this.element.style.width = '90%';\n\n this.element.style.maxWidth = '400px';\n\n this.element.style.textAlign = 'center';\n\n this.element.style.display = 'block';\n\n this.element.style.position = 'fixed';\n\n this.element.style.bottom = '10%';\n\n this.element.style.left = '50%';\n\n this.element.style.transform = 'translateX(-50%)';\n\n this.element.style.opacity = '0';\n\n this.element.style.color = '#FFFFFF';\n\n switch (type) {\n\n case 'success':\n\n this.element.style.background = 'linear-gradient(135deg, #4CAF50, #009688)';\n\n break;\n\n case 'error':\n\n this.element.style.background = 'linear-gradient(135deg, #F44336, #FF5722)';\n\n break;\n\n case 'info':\n\n default:\n\n this.element.style.background = 'linear-gradient(135deg, #2196F3, #03A9F4)';\n\n break;\n\n }\n\n this.element.style.padding = '10px';\n\n this.element.style.borderRadius = '4px';\n\n this.element.style.opacity = '0';\n\n this.element.style.transition = 'opacity 0.3s ease-in-out';\n\n setTimeout(() => {\n\n this.element.style.opacity = '1';\n\n }, 100);\n\n setTimeout(() => this.hideToast(), duration);\n\n this.element.addEventListener('click', () => this.hideToast());\n\n }\n\n hideToast() {\n\n this.element.style.transition = 'opacity 0.3s ease-in-out';\n\n this.element.style.opacity = '0';\n\n setTimeout(() => {\n\n this.element.remove();\n\n }, 300);\n\n }\n\n static success(message, duration = 3000) {\n\n const toastElement = document.createElement('div');\n\n document.body.appendChild(toastElement);\n\n const toast = new Toast(toastElement);\n\n toast.showToast(message, 'success', duration);\n\n }\n\n static error(message, duration = 3000) {\n\n const toastElement = document.createElement('div');\n\n document.body.appendChild(toastElement);\n\n const toast = new Toast(toastElement);\n\n toast.showToast(message, 'error', duration);\n\n }\n\n static info(message, duration = 3000) {\n\n const toastElement = document.createElement('div');\n\n document.body.appendChild(toastElement);\n\n const toast = new Toast(toastElement);\n\n toast.showToast(message, 'info', duration);\n\n }\n\n }\n\n class AppComponent extends StyledComponent {\n\n constructor(element, styles = {}) {\n\n const defaultStyles = {\n\n width: '100%',\n\n height: '100%',\n\n background: '#404258',\n\n display: 'flex',\n\n flexDirection: 'column',\n\n justifyContent: 'center',\n\n alignItems: 'center',\n\n };\n\n super(element, { ...defaultStyles, ...styles });\n\n }\n\n }\n\n class CardComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n const defaultStyles = {\n\n display: 'flex',\n\n flexDirection: 'column',\n\n alignItems: 'center',\n\n justifyContent: 'center',\n\n width: '85%',\n\n maxWidth: '23rem',\n\n margin: '1.2rem',\n\n borderRadius: '5px',\n\n border: 'none',\n\n };\n\n super(document.createElement('div'), { ...defaultStyles, ...styles });\n\n }\n\n }\n\n class InputGroupComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n const defaultStyles = {\n\n display: 'flex',\n\n width: '100%',\n\n alignItems: 'center',\n\n background: '#363749',\n\n color: '#FFF',\n\n padding: '0.2rem',\n\n borderRadius: '5px',\n\n boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',\n\n };\n\n super(document.createElement('div'), { ...defaultStyles, ...styles });\n\n }\n\n append(...components) {\n\n components.forEach((component) => super.append(component));\n\n }\n\n }\n\n class InputComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n const defaultStyles = {\n\n background: 'transparent',\n\n border: 'none',\n\n width: '100%',\n\n outline: 'none',\n\n color: TEXT_COLOR,\n\n fontSize: '15px',\n\n };\n\n super(document.createElement('input'), { ...defaultStyles, ...styles });\n\n }\n\n setEnabled(value) {\n\n this.element.disabled = !value;\n\n }\n\n }\n\n class InputText extends InputComponent {\n\n constructor(styles = {}) {\n\n super(styles);\n\n this.element.type = 'text';\n\n }\n\n get value() {\n\n return this.element.value;\n\n }\n\n setPlaceholder(text) {\n\n this.element.placeholder = text;\n\n }\n\n setOnInputListener(callback) {\n\n this.addEventListener('input', callback);\n\n }\n\n setValue(value) {\n\n this.element.value = value;\n\n }\n\n setOnInputListener(callback) {\n\n this.addEventListener('input', callback);\n\n }\n\n }\n\n class InputPassword extends InputText {\n\n constructor(styles = {}) {\n\n super(styles);\n\n this.element.type = 'password';\n\n }\n\n setShowing(value) {\n\n this.element.type = !value ? 'password' : 'text';\n\n }\n\n get isShowing() { return this.element.type != 'password' }\n\n }\n\n class SvgComponent extends StyledComponent {\n\n constructor(styles = {}, ...paths) {\n\n const defaultStyles = {\n\n fill: '#FFFFFF',\n\n padding: '5px',\n\n width: '2.2rem',\n\n height: '2.2rem',\n\n };\n\n super(document.createElementNS('http://www.w3.org/2000/svg', 'svg'), {\n\n ...defaultStyles,\n\n ...styles,\n\n });\n\n this.applyOptions();\n\n paths.forEach((p) => this.addPath(p));\n\n }\n\n applyOptions() {\n\n this.setFill(this.styles.fill || 'currentColor');\n\n this.setWidth(this.styles.width || '16');\n\n this.setHeight(this.styles.height || '16');\n\n this.setViewBox(this.styles.viewBox || '0 0 16 16');\n\n this.setXmlns(this.styles.xmlns || 'http://www.w3.org/2000/svg');\n\n }\n\n setFill(color) {\n\n this.element.setAttribute('fill', color);\n\n }\n\n setWidth(width) {\n\n this.element.setAttribute('width', width);\n\n }\n\n setHeight(height) {\n\n this.element.setAttribute('height', height);\n\n }\n\n setViewBox(viewBox) {\n\n this.element.setAttribute('viewBox', viewBox);\n\n }\n\n setXmlns(xmlns) {\n\n this.element.setAttribute('xmlns', xmlns);\n\n }\n\n addPath(...path) {\n\n path.forEach((item) => {\n\n const pathElement = document.createElementNS(\n\n 'http://www.w3.org/2000/svg',\n\n 'path'\n\n );\n\n pathElement.setAttribute('d', item);\n\n this.element.appendChild(pathElement);\n\n });\n\n }\n\n }\n\n class Spinner extends StyledComponent {\n\n constructor() {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n width: '100%',\n\n alignItems: 'center',\n\n justifyContent: 'center',\n\n padding: '20px'\n\n });\n\n this.createSpinnerElements();\n\n }\n\n createSpinnerElements() {\n\n const spinnerElement = new StyledComponent(document.createElement('div'));\n\n spinnerElement.setStyles({\n\n borderTop: '4px solid transparent',\n\n borderRight: '4px solid #ccc',\n\n borderBottom: '4px solid #ccc',\n\n borderLeft: '4px solid #ccc',\n\n borderRadius: '50%',\n\n width: '45px',\n\n height: '45px',\n\n animation: 'spin 1s linear infinite',\n\n });\n\n this.append(spinnerElement)\n\n }\n\n }\n\n class IconComponent extends SvgComponent {\n\n constructor(styles = {}, ...iconPath) {\n\n super({\n\n cursor: 'pointer',\n\n background: TOOLS_BUTTON_BACKGROUND_COLOR,\n\n borderRadius: '20%',\n\n height: '45px',\n\n width: '45px',\n\n padding: '10px',\n\n boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',\n\n fill: ICON_COLOR,\n\n ...styles,\n\n },\n\n ...iconPath,\n\n );\n\n }\n\n }\n\n class CalanderIconComponent extends IconComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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',\n\n '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'\n\n );\n\n }\n\n }\n\n class LoggerIconComponent extends IconComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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',\n\n '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'\n\n )\n\n }\n\n }\n\n class ArrowRepeatIconComponent extends IconComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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',\n\n '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'\n\n );\n\n }\n\n }\n\n class MoreIconComponent extends IconComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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'\n\n );\n\n }\n\n }\n\n class BatteryIconComponent extends SvgComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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'\n\n );\n\n }\n\n }\n\n class HeadsetIconComponent extends SvgComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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'\n\n );\n\n }\n\n }\n\n class SpeedMeterIconComponent extends SvgComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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',\n\n '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'\n\n );\n\n }\n\n }\n\n class YouTubeIconComponent extends SvgComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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'\n\n );\n\n }\n\n }\n\n class Mp3IconComponent extends SvgComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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',\n\n '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',\n\n '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',\n\n );\n\n }\n\n }\n\n class TrashIconComponent extends SvgComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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',\n\n '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'\n\n );\n\n }\n\n }\n\n class ReceptionIconComponent extends SvgComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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'\n\n );\n\n }\n\n }\n\n class InfoIconComponent extends SvgComponent {\n\n constructor(styles = {}) {\n\n super(styles,\n\n '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',\n\n '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'\n\n );\n\n }\n\n }\n\n class ArrowDownIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n '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'\n\n );\n\n }\n\n }\n\n class NetworkIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n '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',\n\n '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'\n\n );\n\n }\n\n }\n\n class RouterIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n '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',\n\n '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',\n\n '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',\n\n 'M8.5 5.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0Z'\n\n );\n\n }\n\n }\n\n class PersonIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n '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'\n\n );\n\n }\n\n }\n\n class LockIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n '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'\n\n );\n\n }\n\n }\n\n class EyeIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n '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',\n\n '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',\n\n );\n\n }\n\n }\n\n class ArrowDownShortIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n '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'\n\n );\n\n }\n\n }\n\n class ArrowUpShortIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n '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'\n\n );\n\n }\n\n }\n\n class PowerIconComponent extends SvgComponent {\n\n constructor(style = {}) {\n\n super({\n\n cursor: 'pointer',\n\n height: '8.5rem',\n\n width: '8.5rem',\n\n background: VPN_BUTTON_BACKGROUND_COLOR,\n\n borderRadius: '100%',\n\n boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',\n\n padding: '20px',\n\n animation: 'pulse 2.5s infinite',\n\n fill: ICON_COLOR,\n\n ...style,\n\n },\n\n 'M7.5 1v7h1V1h-1z',\n\n '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',\n\n );\n\n }\n\n }\n\n class DialogComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('div'), {\n\n position: 'absolute',\n\n top: '0',\n\n bottom: '0',\n\n left: '0',\n\n right: '0',\n\n height: '100vh',\n\n background: 'rgba(0, 0, 0, 0.5)',\n\n backdropFilter: 'blur(5px)',\n\n display: 'flex',\n\n alignItems: 'center',\n\n justifyContent: 'center',\n\n visibility: 'hidden',\n\n opacity: '0',\n\n ...styles,\n\n });\n\n this.element.addEventListener('click', (event) => {\n\n if (event.target === this.element) {\n\n this.close();\n\n }\n\n });\n\n this.onCloseEvent = null\n\n }\n\n setOnCloseEventListener(callback) {\n\n this.onCloseEvent = callback\n\n }\n\n setContent(content) {\n\n if (!(content instanceof DialogContentComponent)) {\n\n throw new TypeError('Content must be a DialogContentComponent');\n\n }\n\n if (!this.contains(content)) {\n\n this.append(content);\n\n }\n\n }\n\n show() {\n\n this.setStyles({\n\n opacity: '1',\n\n visibility: 'visible',\n\n display: 'flex',\n\n animation: 'fade-in 0.3s forwards',\n\n pointerEvents: 'auto',\n\n })\n\n if (!document.body.contains(this.element)) {\n\n document.body.append(this.element);\n\n }\n\n }\n\n close() {\n\n this.setStyles({\n\n opacity: '0',\n\n animation: 'fade-out 0.3s forwards',\n\n })\n\n setTimeout(() => {\n\n this.setStyles({\n\n display: 'none',\n\n pointerEvents: 'none',\n\n })\n\n if (this.onCloseEvent != null) {\n\n this.onCloseEvent()\n\n }\n\n }, 300);\n\n }\n\n remove() {\n\n if (document.body.contains(this.element)) {\n\n this.element.remove();\n\n }\n\n }\n\n }\n\n class DialogContentComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n flexDirection: 'column',\n\n justifyContent: 'center',\n\n alignItems: 'center',\n\n background: DIALOG_CONTENT_BACKGROUND_COLOR,\n\n borderRadius: '5px',\n\n maxWidth: '30rem',\n\n width: '85%',\n\n ...styles,\n\n });\n\n this.lastHeader = null;\n\n this.lastBody = null;\n\n this.lastFooter = null;\n\n }\n\n setHeader(component) {\n\n this?.lastHeader?.remove()\n\n this.lastHeader = component\n\n this.append(component);\n\n }\n\n setBody(component) {\n\n this?.lastBody?.remove()\n\n this.lastBody = component\n\n this.append(component);\n\n }\n\n setFooter(component) {\n\n this?.lastFooter?.remove()\n\n this.lastFooter = component\n\n this.append(component);\n\n }\n\n }\n\n class DialogHeaderComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n justifyContent: 'space-between',\n\n alignItems: 'center',\n\n width: '100%',\n\n padding: '5px',\n\n ...styles,\n\n });\n\n this.title = new StyledComponent(document.createElement('span'), {\n\n fontSize: '16px',\n\n color: DIALOG_HEADER_TITLE_COLOR,\n\n fontFamily: 'sans-serif',\n\n fontWeight: 'bold',\n\n padding: '5px',\n\n });\n\n this.closeButton = new SvgComponent({\n\n cursor: 'pointer',\n\n height: '35px',\n\n width: '35px',\n\n fill: DIALOG_HEADER_CLOSE_BUTTON_COLOR,\n\n },\n\n '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'\n\n );\n\n this.initialize();\n\n }\n\n setTitleText(title) {\n\n this.title.element.innerText = title;\n\n }\n\n setCloseButtonClickListener(callback) {\n\n this.closeButton.addEventListener('click', callback);\n\n }\n\n initialize() {\n\n this.append(this.title);\n\n this.append(this.closeButton);\n\n }\n\n }\n\n class DialogBodyComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n width: '100%',\n\n padding: '5px',\n\n ...styles,\n\n });\n\n }\n\n }\n\n class DialogFooterComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n justifyContent: 'space-between',\n\n gap: '5px',\n\n alignItems: 'center',\n\n width: '100%',\n\n padding: '5px',\n\n ...styles,\n\n });\n\n }\n\n addButton(button) {\n\n if (!(button instanceof DialogFooterButtonComponent)) {\n\n throw new TypeError('Button must be a DialogFooterButtonComponent instance');\n\n }\n\n this.append(button);\n\n return this;\n\n }\n\n }\n\n class DialogFooterButtonComponent extends StyledComponent {\n\n constructor(text, onclick, styles = {}) {\n\n super(document.createElement('button'), {\n\n fontSize: '14px',\n\n fontWeight: 'bold',\n\n color: DIALOG_FOOTER_BUTTON_TEXT_COLOR,\n\n background: DIALOG_FOOTER_BUTTON_COLOR,\n\n border: 'none',\n\n borderRadius: '3px',\n\n padding: '10px',\n\n width: '100%',\n\n cursor: 'pointer',\n\n boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',\n\n ...styles,\n\n });\n\n this.setText(text)\n\n this.setClickListener(onclick);\n\n }\n\n setText(text) {\n\n this.element.innerText = text;\n\n }\n\n setClickListener(callback) {\n\n this.addEventListener('click', callback);\n\n }\n\n }\n\n class DialogBuilder {\n\n constructor(styles = {}) {\n\n this.dialog = new DialogComponent(styles);\n\n this.header = new DialogHeaderComponent();\n\n this.content = new DialogContentComponent();\n\n this.footer = new DialogFooterComponent();\n\n this.footerButtons = [];\n\n this.content.setHeader(this.header);\n\n this.header.setCloseButtonClickListener(() => this.dialog.close());\n\n }\n\n static create(styles = {}) {\n\n return new DialogBuilder(styles);\n\n }\n\n setTitle(title) {\n\n this.header.setTitleText(title);\n\n return this;\n\n }\n\n setAutoRemove(autoRemove) {\n\n this.dialog.setOnCloseEventListener(() => {\n\n if (autoRemove) {\n\n this.dialog.remove();\n\n }\n\n });\n\n return this;\n\n }\n\n setBody(bodyComponent) {\n\n this.content.setBody(bodyComponent);\n\n return this;\n\n }\n\n addFooterButton(text, callback) {\n\n const button = new DialogFooterButtonComponent(text, callback);\n\n this.footerButtons.push(button);\n\n return this;\n\n }\n\n show() {\n\n this.dialog.setContent(this.content);\n\n if (this.footerButtons.length > 0) {\n\n this.content.setFooter(this.footer);\n\n this.footerButtons.forEach((button) => {\n\n this.footer.addButton(button);\n\n });\n\n }\n\n this.dialog.show();\n\n return this;\n\n }\n\n close() {\n\n this.dialog.close();\n\n }\n\n }\n\n class ConfigComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n gap: '5px',\n\n alignItems: 'center',\n\n textAlign: 'left',\n\n marginTop: '5px',\n\n padding: '5px',\n\n background: 'rgba(255, 255, 255, 0.1)',\n\n width: '100%',\n\n borderRadius: '5px',\n\n ...styles\n\n });\n\n this.image = document.createElement('img');\n\n this.name = document.createElement('span');\n\n this.description = document.createElement('span');\n\n this.mode = document.createElement('span');\n\n this.initialize();\n\n }\n\n setImage(url) {\n\n this.image.src = url;\n\n }\n\n setName(name) {\n\n this.name.innerHTML = name;\n\n }\n\n setDescription(description) {\n\n this.description.innerHTML = description;\n\n }\n\n setMode(mode) {\n\n this.mode.innerHTML = mode;\n\n }\n\n initialize() {\n\n this.setImageStyles();\n\n this.setNameStyles();\n\n this.setDescriptionStyles();\n\n this.setModeStyles();\n\n const startArea = this.createStartArea();\n\n const endArea = this.createEndArea();\n\n this.appendElements(startArea, endArea);\n\n }\n\n setImageStyles() {\n\n this.image.style.width = '40px';\n\n this.image.style.height = '40px';\n\n }\n\n setNameStyles() {\n\n this.name.style.fontSize = '12px';\n\n this.name.style.fontFamily = 'sans-serif';\n\n this.name.style.color = '#FFFFFF';\n\n this.name.style.fontWeight = 'bold';\n\n }\n\n setDescriptionStyles() {\n\n this.description.style.fontSize = '10px';\n\n this.description.style.fontFamily = 'sans-serif';\n\n this.description.style.color = '#FFFFFF';\n\n this.description.style.fontWeight = 'bold';\n\n this.description.style.fontStyle = 'italic';\n\n }\n\n setModeStyles() {\n\n this.mode.style.fontSize = '10px';\n\n this.mode.style.fontFamily = 'sans-serif';\n\n this.mode.style.color = '#FFFFFF';\n\n this.mode.style.fontWeight = 'bold';\n\n this.mode.style.fontStyle = 'italic';\n\n this.mode.style.whiteSpace = 'nowrap';\n\n }\n\n createStartArea() {\n\n const startArea = document.createElement('div');\n\n startArea.style.display = 'flex';\n\n startArea.style.width = '100%';\n\n startArea.style.gap = '10px';\n\n startArea.style.flexDirection = 'column';\n\n startArea.appendChild(this.name);\n\n startArea.appendChild(this.description);\n\n return startArea;\n\n }\n\n createEndArea() {\n\n const endArea = document.createElement('div');\n\n endArea.style.display = 'flex';\n\n endArea.style.flexDirection = 'column';\n\n endArea.style.alignItems = 'end';\n\n endArea.style.alignSelf = 'end';\n\n endArea.style.width = '50%';\n\n endArea.appendChild(this.mode);\n\n return endArea;\n\n }\n\n appendElements(startArea, endArea) {\n\n this.appendChild(this.image);\n\n this.appendChild(startArea);\n\n this.appendChild(endArea);\n\n }\n\n }\n\n class CategoryComponent extends StyledComponent {\n\n constructor(styles = {}, items = []) {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n justifyContent: 'center',\n\n alignItems: 'center',\n\n flexDirection: 'column',\n\n textAlign: 'center',\n\n padding: '2px',\n\n width: '100%',\n\n ...styles\n\n });\n\n this.items = items;\n\n this.name = document.createElement('span');\n\n this.setNameStyles();\n\n this.initialize();\n\n this.setItems(items);\n\n }\n\n setNameStyles() {\n\n this.name.style.width = '100%';\n\n this.name.style.borderRadius = '5px';\n\n this.name.style.fontSize = '12px';\n\n this.name.style.fontFamily = 'sans-serif';\n\n this.name.style.color = '#FFFFFF';\n\n this.name.style.background = 'rgba(255, 255, 255, 0.1)';\n\n this.name.style.padding = '5px';\n\n this.name.style.fontWeight = 'bold';\n\n }\n\n setName(value) {\n\n this.name.innerHTML = value;\n\n }\n\n setItems(items) {\n\n items.forEach(item => this.append(item));\n\n }\n\n initialize() {\n\n this.appendChild(this.name);\n\n }\n\n }\n\n class ConfigBodyComponent extends DialogBodyComponent {\n\n constructor(items) {\n\n super({\n\n flexDirection: 'column',\n\n gap: '5px',\n\n maxHeight: '65vh',\n\n overflowY: 'auto'\n\n });\n\n items.forEach(item => this.append(item));\n\n }\n\n }\n\n class LoggerItemComponent extends StyledComponent {\n\n constructor(styles = {}, message) {\n\n super(document.createElement('span'), {\n\n fontFamily: 'monospace',\n\n width: '100%',\n\n fontSize: '12px',\n\n color: LOGGER_TEXT_COLOR,\n\n ...styles,\n\n });\n\n this.element.innerHTML = message\n\n }\n\n }\n\n class LoggerBodyComponent extends DialogBodyComponent {\n\n constructor(styles = {}, items = []) {\n\n super({\n\n flexDirection: 'column',\n\n maxHeight: '65vh',\n\n overflowY: 'auto',\n\n width: '100%',\n\n ...styles,\n\n });\n\n this.setItems(items);\n\n }\n\n setItems(items) {\n\n this.element.innerHTML = '';\n\n items.forEach(item => this.append(item));\n\n this.scrollDown();\n\n }\n\n scrollDown() {\n\n this.element.scrollTop = this.element.scrollHeight;\n\n }\n\n }\n\n class CheckUserBodyComponent extends DialogBodyComponent {\n\n constructor(data = {}) {\n\n super()\n\n const component = new StyledComponent(document.createElement('div'), {\n\n display: 'flex',\n\n flexDirection: 'column',\n\n color: TEXT_COLOR,\n\n fontFamily: 'sans-serif',\n\n gap: '2px',\n\n textAlign: 'center',\n\n width: '100%',\n\n });\n\n component.element.innerHTML = `\n\n <span style=\"color: ${CHECKUSER_TEXT_COLOR}\">👤Nome de usuario: ${data.username}</span>\n\n <span style=\"color: ${CHECKUSER_TEXT_COLOR}\">📆Expira em: ${data.expiration_date}</span>\n\n <span style=\"color: ${CHECKUSER_TEXT_COLOR}\">📆Dias restantes: ${data.expiration_days}</span>\n\n <span style=\"color: ${CHECKUSER_TEXT_COLOR}\">🚫Conexoes: ${data.count_connections}|${data.limit_connections}</span>\n\n `\n\n this.append(component)\n\n }\n\n }\n\n class VpnStateComponent extends StyledComponent {\n\n constructor(style = {}) {\n\n super(document.createElement('span'), {\n\n fontSize: '1.5rem',\n\n fontFamily: 'sans-serif',\n\n fontWeight: 'bold',\n\n color: '#FFF',\n\n marginTop: '2rem',\n\n ...style,\n\n })\n\n this.setState('DISCONNECTED')\n\n }\n\n setState(state) {\n\n this.element.innerHTML = state\n\n }\n\n }\n\n class LocalIPComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('span'), {\n\n position: 'absolute',\n\n fontSize: '1rem',\n\n fontFamily: 'Helvetica',\n\n fontWeight: 'bold',\n\n whiteSpace: 'nowrap',\n\n color: TEXT_COLOR,\n\n top: `${window?.DtGetStatusBarHeight?.execute() ?? '30'}px`,\n\n left: '10px',\n\n ...styles,\n\n })\n\n this.setIP(window?.DtGetLocalIP?.execute() ?? '127.0.0.1')\n\n setInterval(() => {\n\n this.setIP(window?.DtGetLocalIP?.execute() ?? '127.0.0.1')\n\n }, 1000)\n\n }\n\n setIP(ip) {\n\n this.element.innerHTML = `IP: ${ip}`\n\n }\n\n }\n\n class NetworkStatsComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n position: 'absolute',\n\n gap: '5px',\n\n top: `${(window?.DtGetStatusBarHeight?.execute() ?? 30) + 20}px`,\n\n left: '-5px',\n\n ...styles,\n\n });\n\n this.meterDownContainer = this.createMeterContainer();\n\n this.meterDownText = this.createMeterText();\n\n this.arrowDownShortIcon = new ArrowDownShortIconComponent();\n\n this.meterDownContainer.append(this.arrowDownShortIcon);\n\n this.meterDownContainer.append(this.meterDownText);\n\n this.meterUpContainer = this.createMeterContainer();\n\n this.meterUpText = this.createMeterText();\n\n this.arrowUpShortIcon = new ArrowUpShortIconComponent();\n\n this.meterUpContainer.append(this.arrowUpShortIcon);\n\n this.meterUpContainer.append(this.meterUpText);\n\n this.append(this.meterDownContainer);\n\n this.append(this.meterUpContainer);\n\n this.getNetworkDownloadFn = () => window?.DtGetNetworkDownloadBytes?.execute() ?? 0;\n\n this.getNetworkUploadFn = () => window?.DtGetNetworkUploadBytes?.execute() ?? 0;\n\n this.currentNetworkDownload = parseFloat(localStorage.getItem('networkDownload') ?? this.getNetworkDownloadFn());\n\n this.currentNetworkUpload = parseFloat(localStorage.getItem('networkUpload') ?? this.getNetworkUploadFn());\n\n localStorage.setItem('networkDownload', this.currentNetworkDownload);\n\n localStorage.setItem('networkUpload', this.currentNetworkUpload);\n\n this.showMeter();\n\n setInterval(() => this.showMeter(), 1000);\n\n }\n\n createMeterContainer() {\n\n return new StyledComponent(document.createElement('div'), {\n\n display: 'flex',\n\n alignItems: 'center',\n\n });\n\n }\n\n createMeterText() {\n\n return new StyledComponent(document.createElement('span'), {\n\n fontSize: '1rem',\n\n marginLeft: '-5px',\n\n fontFamily: 'Helvetica',\n\n fontWeight: 'bold',\n\n whiteSpace: 'nowrap',\n\n color: '#fff',\n\n });\n\n }\n\n formatBytes(bytes) {\n\n const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];\n\n if (bytes === 0) return '0 B';\n\n const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));\n\n return (bytes / Math.pow(1024, i)).toPrecision(3) + ' ' + sizes[i];\n\n }\n\n showMeter() {\n\n const newNetworkDownload = this.getNetworkDownloadFn();\n\n const newNetworkUpload = this.getNetworkUploadFn();\n\n this.meterDownText.element.innerHTML = this.formatBytes(newNetworkDownload - this.currentNetworkDownload);\n\n this.meterUpText.element.innerHTML = this.formatBytes(newNetworkUpload - this.currentNetworkUpload);\n\n }\n\n }\n\n class PingComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('span'), {\n\n position: 'absolute',\n\n fontSize: '1rem',\n\n fontFamily: 'Helvetica',\n\n fontWeight: 'bold',\n\n whiteSpace: 'nowrap',\n\n top: `${window?.DtGetStatusBarHeight?.execute() ?? '30'}px`,\n\n right: '10px',\n\n ...styles,\n\n });\n\n this.startPing();\n\n }\n\n async startPing() {\n\n this.setPing(await this.ping());\n\n setInterval(async () => this.setPing(await this.ping()), 1000);\n\n }\n\n setPing(ping) {\n\n this.element.textContent = `PING: ${ping}ms`;\n\n const pingValue = parseInt(ping, 10);\n\n const color = this.getColorFromPing(pingValue);\n\n this.setStyles({ color });\n\n }\n\n getColorFromPing(ping) {\n\n const pingValue = parseInt(ping, 10);\n\n const color = pingValue >= 0 && pingValue <= 50 ? '#00ff00' :\n\n pingValue > 50 && pingValue <= 100 ? '#ffff00' :\n\n '#ff0000';\n\n return color;\n\n }\n\n async ping() {\n\n const startTime = new Date().getTime();\n\n const url = `https://cdn-icons-png.flaticon.com/512/7517/7517373.png?${startTime}`\n\n try {\n\n const data = await fetch(url)\n\n return new Date().getTime() - startTime;\n\n } catch (err) {\n\n console.log(err);\n\n return -1;\n\n }\n\n }\n\n }\n\n class IframeBodyComponent extends DialogBodyComponent {\n\n constructor(styles = {}, url = null) {\n\n super({\n\n minHeight: '600px',\n\n ...styles\n\n })\n\n this.iframeElement = new StyledComponent(document.createElement('iframe'), {\n\n width: '100%',\n\n border: 'none',\n\n borderRadius: '5px',\n\n display: 'none',\n\n })\n\n this.spinner = new Spinner()\n\n this.iframeElement.addEventListener('load', () => {\n\n this.iframeElement.setStyles({ display: 'block' })\n\n this.spinner.setStyles({ display: 'none' })\n\n })\n\n this.setUrl(url)\n\n this.applyOptions()\n\n this.append(this.iframeElement)\n\n this.append(this.spinner)\n\n }\n\n setUrl(url) {\n\n this.iframeElement.element.src = url\n\n }\n\n setOnLoadListener(callback) {\n\n this.iframeElement.addEventListener('load', callback)\n\n }\n\n applyOptions() {\n\n this.iframeElement.element.setAttribute('allow', 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share')\n\n this.iframeElement.element.setAttribute('allowfullscreen', '')\n\n this.iframeElement.element.setAttribute('frameborder', '0')\n\n }\n\n }\n\n class CleanAppMessageBodyComponent extends DialogBodyComponent {\n\n constructor(styles = {}, url = null) {\n\n super({\n\n height: 'auto',\n\n ...styles\n\n })\n\n this.spanComponent = new StyledComponent(document.createElement('span'), {\n\n fontSize: '16px',\n\n fontFamily: 'Helvetica',\n\n fontWeight: 'bold',\n\n color: TEXT_COLOR,\n\n })\n\n 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?'\n\n this.append(this.spanComponent)\n\n }\n\n }\n\n class StyledButtonComponent extends StyledComponent {\n\n constructor(text, icon, onclick, styles = {}) {\n\n super(document.createElement('button'), {\n\n width: '100%',\n\n borderRadius: '5px',\n\n padding: '10px',\n\n border: 'none',\n\n color: TEXT_COLOR,\n\n background: BUTTON_BACKGROUND_COLOR,\n\n boxShadow: 'rgba(0, 0, 0, 0.35) 0px 5px 15px',\n\n cursor: 'pointer',\n\n display: 'flex',\n\n alignItems: 'center',\n\n ...styles\n\n });\n\n this.textComponent = new StyledComponent(document.createElement('span'), {\n\n fontSize: '16px',\n\n fontWeight: 'bold',\n\n });\n\n this.textComponent.element.innerHTML = text;\n\n this.element.addEventListener('click', onclick)\n\n this.append(icon ?? '')\n\n this.append(this.textComponent);\n\n }\n\n }\n\n class ApnSettingStyledButtonComponent extends StyledButtonComponent {\n\n constructor() {\n\n super(\n\n 'APN',\n\n new ReceptionIconComponent(),\n\n () => window?.DtStartApnActivity?.execute()\n\n )\n\n }\n\n }\n\n class TermsStyledButtonComponent extends StyledButtonComponent {\n\n constructor() {\n\n super(\n\n 'TERMOS',\n\n new InfoIconComponent(),\n\n () => window?.DtStartWebViewActivity?.execute(TERMS_URL)\n\n )\n\n }\n\n }\n\n class BatteryStyledButtonComponent extends StyledButtonComponent {\n\n constructor() {\n\n super(\n\n 'BATERIA',\n\n new BatteryIconComponent(),\n\n () => window?.DtIgnoreBatteryOptimizations?.execute(),\n\n )\n\n }\n\n }\n\n class SupportStyledButtonComponent extends StyledButtonComponent {\n\n constructor() {\n\n super(\n\n 'SUPORTE',\n\n new HeadsetIconComponent(),\n\n () => window?.DtStartWebViewActivity?.execute(LINK_SUPPORT)\n\n );\n\n }\n\n }\n\n class SpeedTestStyledButtonComponent extends StyledButtonComponent {\n\n constructor() {\n\n super(\n\n 'SPEEDTEST',\n\n new SpeedMeterIconComponent(),\n\n () => {\n\n DialogBuilder.create()\n\n .setTitle('SPEEDTEST')\n\n .setAutoRemove(true)\n\n .setBody(new IframeBodyComponent({}, URL_SPEEDTEST))\n\n .show()\n\n })\n\n }\n\n }\n\n class YouTubeStyledButtonComponent extends StyledButtonComponent {\n\n static dialog = DialogBuilder.create({ zIndex: 1 })\n\n .setTitle('YOUTUBE')\n\n .setBody(new IframeBodyComponent({}, URL_YOUTUBE))\n\n constructor() {\n\n super(\n\n 'YOUTUBE',\n\n new YouTubeIconComponent(),\n\n () => this.dialog.show(),\n\n )\n\n }\n\n get dialog() {\n\n return YouTubeStyledButtonComponent.dialog;\n\n }\n\n }\n\n class Mp3StyledButtonComponent extends StyledButtonComponent {\n\n static dialog = DialogBuilder.create({ zIndex: 1 })\n\n .setTitle('MP3')\n\n .setBody(new IframeBodyComponent({}, URL_MP3))\n\n constructor() {\n\n super(\n\n 'MP3',\n\n new Mp3IconComponent(),\n\n () => this.dialog.show(),\n\n )\n\n }\n\n get dialog() {\n\n return Mp3StyledButtonComponent.dialog;\n\n }\n\n }\n\n class CleanAppStyledButtonComponent extends StyledButtonComponent {\n\n constructor() {\n\n super(\n\n 'LIMPAR',\n\n new TrashIconComponent(),\n\n () => {\n\n const dialog = DialogBuilder.create()\n\n .setTitle('LIMPAR DADOS')\n\n .setAutoRemove(true)\n\n .setBody(new CleanAppMessageBodyComponent())\n\n .addFooterButton('NÃO', () => dialog.close())\n\n .addFooterButton('SIM', () => window?.DtCleanApp?.execute())\n\n .show();\n\n })\n\n }\n\n }\n\n class HotSpotStyledButtonComponent extends StyledButtonComponent {\n\n constructor() {\n\n super(\n\n 'HOTSPOT',\n\n new RouterIconComponent(),\n\n () => this.toggleHotSpot())\n\n this.setStyles({ display: 'flex', justifyContent: 'center' });\n\n }\n\n startHotSpot() {\n\n window?.DtStartHotSpotService?.execute();\n\n Toast.success('HotSpot iniciado com sucesso!')\n\n }\n\n stopHotSpot() {\n\n window?.DtStopHotSpotService?.execute();\n\n Toast.success('HotSpot parado com sucesso!')\n\n }\n\n toggleHotSpot() {\n\n const hotSpotStatus = window?.DtGetStatusHotSpotService?.execute() ?? 'STOPPED';\n\n hotSpotStatus == 'RUNNING' ? this.stopHotSpot() : this.startHotSpot();\n\n }\n\n }\n\n class MenuDialogBodyComponent extends DialogBodyComponent {\n\n constructor() {\n\n super({\n\n display: 'flex',\n\n flexDirection: 'column',\n\n gap: '5px'\n\n })\n\n }\n\n addRowButtons(...buttons) {\n\n const element = new StyledComponent(document.createElement('div'), {\n\n display: 'flex',\n\n gap: '5px',\n\n width: '100%'\n\n });\n\n buttons.forEach(button => element.append(button));\n\n this.append(element);\n\n return this;\n\n }\n\n }\n\n class ConfigInputComponent extends InputGroupComponent {\n\n constructor() {\n\n super({ cursor: 'pointer', background: INPUT_COLOR });\n\n this.configInput = new InputText({ cursor: 'pointer', fontFamily: 'roboto' });\n\n this.configInput.setEnabled(false);\n\n this.configInput.setPlaceholder('SELECIONE UM SERVIDOR');\n\n this.configInput.setValue(JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{}').name ?? '');\n\n this.append(new NetworkIconComponent(), this.configInput, new ArrowDownIconComponent());\n\n this.configure()\n\n this.addEventListener('click', () => {\n\n 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\"}]}]';\n\n const items = JSON.parse(window?.DtGetConfigs?.execute() || mock);\n\n items.sort((a, b) => a.sorter - b.sorter);\n\n items.forEach((item) => item.items.sort((a, b) => a.sorter - b.sorter));\n\n const dialog = DialogBuilder.create()\n\n .setTitle('CONFIGURAÇÕES')\n\n .setAutoRemove(true)\n\n .setBody(\n\n new ConfigBodyComponent(\n\n items.map((item) => {\n\n const category = new CategoryComponent();\n\n category.setName(item.name);\n\n category.setItems(\n\n item.items.map((item) => {\n\n const config = new ConfigComponent();\n\n config.setName(item.name);\n\n config.setDescription(item.description ?? '');\n\n config.setMode(item.mode);\n\n config.setImage(item.icon);\n\n config.addEventListener('click', () => {\n\n window?.DtSetConfig?.execute(item.id);\n\n dialog.close();\n\n });\n\n return config;\n\n })\n\n );\n\n return category;\n\n })\n\n )\n\n )\n\n .show();\n\n });\n\n const originalClickListener = window.dtConfigClickListener;\n\n window.dtConfigClickListener = () => {\n\n if (originalClickListener) {\n\n originalClickListener();\n\n }\n\n this.configure();\n\n };\n\n this.configure();\n\n }\n\n configure() {\n\n const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{\"auth\":{\"password\": \"\"}, \"mode\": \"v2ra\"}')\n\n this.configInput.setValue(config.name ?? '')\n\n }\n\n }\n\n class UserPassInputComponent extends StyledComponent {\n\n constructor() {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n marginTop: '5px',\n\n width: '100%',\n\n display: 'flex',\n\n gap: '5px',\n\n });\n\n this.usernameGroupComponent = new InputGroupComponent({ background: INPUT_COLOR });\n\n const personIconComponent = new PersonIconComponent();\n\n this.usernameInput = new InputText();\n\n this.usernameInput.setPlaceholder('Nome de usuário');\n\n this.usernameInput.setValue(window?.DtUsername?.get() ?? '');\n\n this.usernameInput.setOnInputListener(() => window?.DtUsername?.set(this.usernameInput.value));\n\n this.usernameGroupComponent.append(personIconComponent, this.usernameInput);\n\n this.append(this.usernameGroupComponent);\n\n this.passwordGroupComponent = new InputGroupComponent({ background: INPUT_COLOR });\n\n this.passwordInput = new InputPassword();\n\n const eyeIconComponent = new EyeIconComponent();\n\n eyeIconComponent.addEventListener('click', () => this.passwordInput.setShowing(!this.passwordInput.isShowing));\n\n this.passwordInput.setPlaceholder('Senha');\n\n this.passwordInput.setValue(window?.DtPassword?.get() ?? '');\n\n this.passwordInput.setOnInputListener(() => { window?.DtPassword?.set(this.passwordInput.value) });\n\n this.passwordGroupComponent.append(new LockIconComponent(), this.passwordInput, eyeIconComponent);\n\n this.append(this.passwordGroupComponent);\n\n this.v2rayUuidGroupComponent = new InputGroupComponent({ background: INPUT_COLOR });\n\n this.v2rayUuidInput = new InputPassword();\n\n this.v2rayUuidInput.setPlaceholder('V2Ray UUID');\n\n this.v2rayUuidInput.setValue(window?.DtUuid?.get() ?? '');\n\n this.v2rayUuidInput.setOnInputListener(() => window?.DtUuid?.set(this.v2rayUuidInput.value));\n\n this.v2rayUuidGroupComponent.append(new LockIconComponent(), this.v2rayUuidInput);\n\n this.append(this.v2rayUuidGroupComponent);\n\n const originalClickListener = window.dtConfigClickListener;\n\n window.dtConfigClickListener = () => {\n\n if (originalClickListener) {\n\n originalClickListener();\n\n }\n\n this.configure();\n\n };\n\n this.configure();\n\n }\n\n configure() {\n\n const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{\"auth\":{\"password\": \"\"}, \"mode\": \"v2ra\"}')\n\n const isV2ray = config?.mode?.toLowerCase()?.startsWith('v2ray');\n\n this.usernameGroupComponent.setStyles({\n\n display: isV2ray || config?.auth?.username ? 'none' : 'flex',\n\n })\n\n this.passwordGroupComponent.setStyles({\n\n display: isV2ray || config?.auth?.password ? 'none' : 'flex',\n\n })\n\n this.v2rayUuidGroupComponent.setStyles({\n\n display: !isV2ray || config?.auth?.v2ray_uuid ? 'none' : 'flex',\n\n })\n\n const isRunning = (window?.DtGetVpnState?.execute() ?? 'DISCONNECTED') != 'DISCONNECTED';\n\n this.usernameInput.setEnabled(!isRunning)\n\n this.passwordInput.setEnabled(!isRunning)\n\n this.v2rayUuidInput.setEnabled(!isRunning)\n\n }\n\n }\n\n class ButtonAndStateContainerComponent extends StyledComponent {\n\n constructor(styles = {}) {\n\n super(document.createElement('div'), {\n\n display: 'flex',\n\n flexDirection: 'column',\n\n alignItems: 'center',\n\n justifyContent: 'center',\n\n width: '100%',\n\n ...styles,\n\n });\n\n this.startOrStopButtonComponent = new PowerIconComponent();\n\n this.startOrStopButtonComponent.addEventListener('click', () => {\n\n if (window?.DtGetVpnState?.execute() !== 'DISCONNECTED') {\n\n window?.DtExecuteVpnStop?.execute();\n\n } else {\n\n window?.DtExecuteVpnStart?.execute();\n\n }\n\n });\n\n this.append(this.startOrStopButtonComponent);\n\n this.vpnStateComponent = new VpnStateComponent();\n\n this.append(this.vpnStateComponent);\n\n window.dtVpnStateListener = state => this.configureState(state);\n\n this.configureState(window?.DtGetVpnState?.execute() ?? 'DISCONNECTED');\n\n }\n\n configureState(state) {\n\n const isRunning = state != 'DISCONNECTED';\n\n this.vpnStateComponent.setState((window?.DtTranslateText?.execute('LBL_STATE_' + state) ?? 'UNKNOWN').toUpperCase())\n\n if (state == 'DISCONNECTED') {\n\n this.vpnStateComponent.setStyles({ color: VPN_STOPPED_COLOR })\n\n this.startOrStopButtonComponent.setStyles({ fill: VPN_STOPPED_COLOR })\n\n }\n\n if (state != 'DISCONNECTED' && state != 'CONNECTED') {\n\n this.vpnStateComponent.setStyles({ color: VPN_STARTING_COLOR })\n\n this.startOrStopButtonComponent.setStyles({ fill: VPN_STARTING_COLOR })\n\n }\n\n if (state == 'CONNECTED') {\n\n this.vpnStateComponent.setStyles({ color: VPN_RUNNING_COLOR })\n\n this.startOrStopButtonComponent.setStyles({ fill: VPN_RUNNING_COLOR })\n\n }\n\n }\n\n }\n\n class CardToolsComponent extends CardComponent {\n\n constructor() {\n\n super({\n\n margin: '20px 0',\n\n width: '100%',\n\n flexDirection: 'row',\n\n justifyContent: 'space-between',\n\n background: 'transparent',\n\n boxShadow: 'none',\n\n });\n\n this.loggerBody = new LoggerBodyComponent({});\n\n this.addArrowRepeatIcon();\n\n this.addLoggerIcon();\n\n this.addCalanderIcon();\n\n this.addMoreButton();\n\n window.dtOnNewLogListener = () => this.renderizeLogger();\n\n this.renderizeLogger();\n\n }\n\n addCalanderIcon() {\n\n const calanderIconComponent = new CalanderIconComponent();\n\n calanderIconComponent.addEventListener('click', () =>\n\n window?.DtStartCheckUser?.execute()\n\n );\n\n this.append(calanderIconComponent);\n\n }\n\n addLoggerIcon() {\n\n const loggerIconComponent = new LoggerIconComponent();\n\n loggerIconComponent.addEventListener('click', () => {\n\n const loggerDialog = DialogBuilder.create()\n\n .setTitle('REGISTRO')\n\n .setBody(this.loggerBody)\n\n .setAutoRemove(true)\n\n .addFooterButton('LIMPAR', () => window?.DtClearLogs?.execute())\n\n .addFooterButton('FECHAR', () => loggerDialog.close())\n\n .show();\n\n this.loggerBody.scrollDown();\n\n });\n\n this.append(loggerIconComponent);\n\n }\n\n addArrowRepeatIcon() {\n\n const arrowRepeatIconComponent = new ArrowRepeatIconComponent();\n\n arrowRepeatIconComponent.addEventListener('click', () =>\n\n window?.DtStartAppUpdate?.execute()\n\n );\n\n this.append(arrowRepeatIconComponent);\n\n }\n\n addMoreButton() {\n\n const moreButton = new MoreIconComponent();\n\n moreButton.addEventListener('click', () => {\n\n DialogBuilder.create()\n\n .setTitle('FERRAMENTAS')\n\n .setAutoRemove(true)\n\n .setBody(\n\n new MenuDialogBodyComponent()\n\n .addRowButtons(\n\n new ApnSettingStyledButtonComponent(),\n\n new BatteryStyledButtonComponent(),\n\n )\n\n .addRowButtons(\n\n new SpeedTestStyledButtonComponent(),\n\n new CleanAppStyledButtonComponent()\n\n )\n\n .addRowButtons(\n\n new YouTubeStyledButtonComponent(),\n\n new Mp3StyledButtonComponent(),\n\n )\n\n .addRowButtons(\n\n new HotSpotStyledButtonComponent(),\n\n )\n\n )\n\n .show();\n\n });\n\n this.append(moreButton);\n\n }\n\n renderizeLogger() {\n\n const mock = Array.from({ length: 300 }, (_, i) => ({ TIME: `MESSAGE ${i}` }));\n\n const data = JSON.parse(window?.DtGetLogs?.execute() ?? JSON.stringify(mock))\n\n const items = data.map(log => {\n\n const message = Object.keys(log)[0] + ' ' + log[Object.keys(log)]\n\n return new LoggerItemComponent({}, message)\n\n })\n\n this.loggerBody.setItems(items)\n\n }\n\n }\n\n class CheckUserDialog {\n\n constructor() {\n\n this.dialog = DialogBuilder.create()\n\n .setAutoRemove(true)\n\n .setTitle('CHECKUSER')\n\n .setBody(new Spinner());\n\n }\n\n initialize() {\n\n window.dtCheckUserStartedListener = () => this.checkUserStartedListener();\n\n window.dtCheckUserModelListener = model => this.checkUserModelListener(model);\n\n }\n\n checkUserStartedListener() {\n\n const config = JSON.parse(window?.DtGetDefaultConfig?.execute() ?? '{}');\n\n if (!config.url_check_user) return;\n\n this.dialog.show();\n\n }\n\n checkUserModelListener(model) {\n\n const data = JSON.parse(model ?? `{\"username\": \"test\"}`);\n\n this.dialog\n\n .setTitle(`📆 Olá, ${data.username}`)\n\n .setBody(new CheckUserBodyComponent(data));\n\n }\n\n }\n\n const rootComponent = new AppComponent(document.querySelector('#root'), { background: BACKGROUND_COLOR });\n\n window.onerror = e => {\n\n rootComponent.element.style.color = '#FFFFFF';\n\n rootComponent.element.style.fontSize = '18px';\n\n rootComponent.element.innerHTML = e\n\n return false;\n\n };\n\n const cardComponent = new CardComponent({ position: 'absolute', top: '15%' });\n\n const configInput = new ConfigInputComponent();\n\n cardComponent.append(configInput);\n\n const userPassInputComponent = new UserPassInputComponent()\n\n cardComponent.append(userPassInputComponent);\n\n const cardToolsComponent = new CardToolsComponent();\n\n cardComponent.append(cardToolsComponent);\n\n const buttonAndStateContainer = new ButtonAndStateContainerComponent({ marginTop: '3rem' });\n\n cardComponent.append(buttonAndStateContainer);\n\n rootComponent.append(new LocalIPComponent());\n\n rootComponent.append(new PingComponent());\n\n rootComponent.append(new NetworkStatsComponent());\n\n rootComponent.append(cardComponent);\n\n const checkUserDialog = new CheckUserDialog();\n\n checkUserDialog.initialize();\n\n </script>\n\n</body>\n\n</html>",
  242. "type": "HTML"
  243. },
  244. {
  245. "label": "ANDROID WEBVIEW (POR SUA CONTA E RISCO)",
  246. "name": "APP_SUPPORT_BUTTON",
  247. "value": null,
  248. "type": "HTML"
  249. },
  250. {
  251. "label": "PAGINA WEBVIEW (POR SUA CONTA E RISCO)",
  252. "name": "APP_WEB_VIEW",
  253. "value": null,
  254. "type": "HTML"
  255. }
  256. ]

comments powered by Disqus