/* eslint-disable no-undef */
;(function () {
  'use strict'

  const chatButton = document.querySelector('.sidebar .chat-btn')
  const menu = document.querySelector('.navbar-menu')

  // 네트워크 상태 확인 및 버튼 제어
  function checkIfLocalFile () {
    if (window.location.protocol === 'file:') {
      chatButton.style.display = 'none' // 오프라인 상태면 chatButton 숨김
      menu.style.display = 'none'
    } else {
      import('https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js')
        .then((module) => {
          window.marked = module.marked
        })
        .catch((error) => {
          console.error('Failed to load Marked.js:', error)
        })
    }
  }

  // 초기 상태 설정
  checkIfLocalFile()
})()