export const $ = (id) => document.getElementById(id);

export const state = {
  apiBase: $('apiBase'),
  adminToken: $('adminToken'),
  rememberToken: $('rememberToken'),
  projectName: $('projectName'),
  projectOptions: $('projectOptions'),
  trafficRange: $('trafficRange'),
  configRange: $('configRange'),
  modelRange: $('modelRange'),
  agentRange: $('agentRange'),
  modelProviderFilter: $('modelProviderFilter'),
  modelProviderOptions: $('modelProviderOptions'),
  modelEndpointFilter: $('modelEndpointFilter'),
  modelEndpointOptions: $('modelEndpointOptions'),
  modelNameFilter: $('modelNameFilter'),
  modelNameOptions: $('modelNameOptions'),
  latestEventFilter: $('latestEventFilter'),
  latestEventOptions: $('latestEventOptions'),
  refreshButton: $('refreshButton'),
  errorBox: $('errorBox'),
  statusDot: $('statusDot'),
  statusText: $('statusText'),
  tabButtons: Array.from(document.querySelectorAll('[data-tab-button]')),
  tabPanels: Array.from(document.querySelectorAll('[data-tab-panel]')),
  totalOpen: $('totalOpen'),
  totalView: $('totalView'),
  totalEvents: $('totalEvents'),
  totalAiRequests: $('totalAiRequests'),
  totalTextTokens: $('totalTextTokens'),
  totalGeneratedImages: $('totalGeneratedImages'),
  totalClients: $('totalClients'),
  todayActiveClients: $('todayActiveClients'),
  todayNewClients: $('todayNewClients'),
  last7NewClients: $('last7NewClients'),
  githubStars: $('githubStars'),
  githubForks: $('githubForks'),
  githubOpenIssues: $('githubOpenIssues'),
  githubRepoUrl: $('githubRepoUrl'),
  dailyTable: $('dailyTable'),
  clientsTable: $('clientsTable'),
  ipStatsTable: $('ipStatsTable'),
  prevIpPage: $('prevIpPage'),
  nextIpPage: $('nextIpPage'),
  ipPageInput: $('ipPageInput'),
  jumpIpPage: $('jumpIpPage'),
  ipPageInfo: $('ipPageInfo'),
  clientDetailDialog: $('clientDetailDialog'),
  clientDetailTitle: $('clientDetailTitle'),
  closeClientDetail: $('closeClientDetail'),
  clientDetailRange: $('clientDetailRange'),
  clientDetailDaily: $('clientDetailDaily'),
  clientDetailEvents: $('clientDetailEvents'),
  pagesTable: $('pagesTable'),
  versionsTable: $('versionsTable'),
  retentionTable: $('retentionTable'),
  configUsage: $('configUsage'),
  modelUsage: $('modelUsage'),
  agentRuntime: $('agentRuntime'),
  latestTable: $('latestTable'),
  prevLatestPage: $('prevLatestPage'),
  nextLatestPage: $('nextLatestPage'),
  latestPageInput: $('latestPageInput'),
  jumpLatestPage: $('jumpLatestPage'),
  latestPageInfo: $('latestPageInfo'),
  loadNoticeButton: $('loadNoticeButton'),
  publishNoticeButton: $('publishNoticeButton'),
  disableNoticeButton: $('disableNoticeButton'),
  noticeMeta: $('noticeMeta'),
  noticeStatus: $('noticeStatus'),
  noticeTitle: $('noticeTitle'),
  noticeEnabled: $('noticeEnabled'),
  noticeContent: $('noticeContent'),
  loadLicenseConfigButton: $('loadLicenseConfigButton'),
  saveLicenseConfigButton: $('saveLicenseConfigButton'),
  licenseMeta: $('licenseMeta'),
  licenseFreeDays: $('licenseFreeDays'),
  licenseExpirePopupEnabled: $('licenseExpirePopupEnabled'),
  licenseExpirePopupDismissible: $('licenseExpirePopupDismissible'),
  licenseStatus: $('licenseStatus'),
  licenseOfflineClientId: $('licenseOfflineClientId'),
  licenseOfflineExpiresAt: $('licenseOfflineExpiresAt'),
  licenseOfflineExpirePopupEnabled: $('licenseOfflineExpirePopupEnabled'),
  licenseOfflineExpirePopupDismissible: $('licenseOfflineExpirePopupDismissible'),
  licenseOfflineCode: $('licenseOfflineCode'),
  generateOfflineLicenseButton: $('generateOfflineLicenseButton'),
  downloadOfflineLicenseButton: $('downloadOfflineLicenseButton'),
  offlineLicenseStatus: $('offlineLicenseStatus'),
  loadResourcesButton: $('loadResourcesButton'),
  newResourceButton: $('newResourceButton'),
  resourceForm: $('resourceForm'),
  resourceId: $('resourceId'),
  resourceImagePreview: $('resourceImagePreview'),
  resourceImage: $('resourceImage'),
  resourceRemoveImage: $('resourceRemoveImage'),
  resourceTitle: $('resourceTitle'),
  resourceTags: $('resourceTags'),
  resourceEnabled: $('resourceEnabled'),
  resourceSortOrder: $('resourceSortOrder'),
  resourceDescription: $('resourceDescription'),
  resourceModalContent: $('resourceModalContent'),
  resetResourceButton: $('resetResourceButton'),
  saveResourceButton: $('saveResourceButton'),
  resourcesStatus: $('resourcesStatus'),
  resourcesTable: $('resourcesTable'),
};

export const appState = {
  activeTab: 'overview',
  latestPage: 1,
  latestTotal: 0,
  latestPageSize: 10,
  ipPage: 1,
  ipTotal: 0,
  ipPageSize: 20,
  selectedClientId: '',
  resources: [],
};
