<!DOCTYPE html>
<html lang="en">

<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>404</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      background-color: #fff;
    }

    a {
      text-decoration: none;
    }

    .cont_404 {
      width: 100vw;
      height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding-top: 90px;
    }

    .cont_404 .m_404 {
      width: 300px;
      height: 210px;
    }

    .cont_404 .not_find {
      color: #1f1f25;
      font-size: 20px;
      font-weight: 700;
      margin: 20px 0 4px 0;
    }

    .cont_404 p {
      color: #9c9fac;
      font-size: 14px;
    }

    .cont_404 .b_home {
      display: block;
      width: 120px;
      height: 36px;
      margin-top: 20px;
      text-align: center;
      line-height: 36px;
      cursor: pointer;
      color: #9c9fac;
      font-size: 14px;
      font-weight: 700;
      border: 1px solid #e5e6eb;
      border-radius: 26px;
    }

    .cont_404 .b_sea_pc {
      width: 500px;
      height: 48px;
      background: #ffffff;
      border-radius: 26px;
      border: 1px solid #e8f0ff;
      box-shadow: 0px 0px 5px #e9e9fb;
      margin-top: 78px;
      display: flex;
      align-items: center;
      overflow: hidden;
      padding: 0 20px;
    }

    .cont_404 .b_sea_pc input {
      color: #9c9fac;
      font-size: 14px;
      width: 80%;
      height: 98%;
      line-height: 48px;
      outline: none;
      border: none;
    }

    .cont_404 .b_sea_pc .bg_img {
      width: 60px;
      height: 36px;
      margin-left: auto;
    }

    .cont_404 .b_sea_pc .bg_img img {
      width: 100%;
      height: 100%;
    }

    .cont_404 .b_sea_m {
      display: none;
    }

    @media screen and (max-width: 750px) {
      .cont_404 .m_404 {
        width: 200px;
        height: 140px;
      }

      .cont_404 .b_sea_pc {
        /* display: none; */
        width: 94%;
        box-sizing: border-box;
        margin-top: auto;
        margin-bottom: 5vw;
      }

      .cont_404 .b_sea_m {
        display: block;
        margin-top: auto;
      }

      .cont_404 .s_404 {
        width: 100%;
      }
    }
  </style>
</head>

<body>
  <div class="cont_404">
    <img class="m_404" src="/bg_404.png" alt="">
    <span class="not_find">找不到首页</span>
    <p>啊哦，你所访问的页面不存在...</p>
    <a class="b_home" href="/">返回首页</a>
    <a href="javascript:void(0);" class="b_sea_pc">
      <input type="text" placeholder="搜你想搜的" class="pc_input">
      <span class="bg_img">
        <img src="/icon_404.png" alt="">
      </span>
    </a>
  </div>
</body>
<script>
 let host = {
  'cnxiangyan.com': {
    agentId: 'MmfKTNELFhBBeMN0hJGqH2I5us9FuRUO',
    title: '中华烟',
    pathname: '/',
  },
  'kaoyanmiji.com': {
    agentId: '0MOGWBChxzCVkSSNEXbeLReGJMOZ3Tkh',
    title: '',
    pathname: '/',
  },
  'chazidian.com': {
    agentId: 'aUQUpGPraDYoLrfmceXIHsX2ZDhFcCwC',
    title: '',
    pathname: '/',
  },
  'meidekan.com': {
    agentId: 'c6b3qdpoaOYBnlDfj1P92BK12X3Gooan',
    title: '',
    pathname: '/',
  },
  'cooco.net.cn': {
    agentId: 'obQBh9r1eXwKe17N2lnUrdPg7iLFiLeY',
    title: '',
    pathname: '/',
  },
};
var $agentId = '';
var $title = '';
for (let key in host) {
  if (window.location.host.includes(key)) {
    $agentId = host[key].agentId;
    $title = host[key].title;
  }
}
setTimeout(function () {
  loadJS(
    'http://unpkg.com/lingjing-agent@latest/dist/js/index.global.js',
    initAIChat,
  );
}, 500);
let seaBtn = document.getElementsByClassName('bg_img');
let $inupt = document.getElementsByClassName('pc_input')[0];
$inupt.addEventListener('keydown', function (event) {
  console.log(event.keyCode);
  if (event.key === 'Enter' || event.keyCode === 13) {
    event.preventDefault();
    showLingJingChat();
  }
});
seaBtn[0].addEventListener('click', function () {
  showLingJingChat();
});
function showLingJingChat() {
  window._bdLingJingAiChat.show();
  setTimeout(function () {
    let searchInput = $inupt;
    let query = searchInput.value;
    if (query.length == 0) {
      query = $title;
    }
    let textareaContents = document.getElementsByClassName(
      'chat-input-box-textarea-content',
    );
    for (let i = 0; i < textareaContents.length; i++) {
      textareaContents[i].value = query;
      textareaContents[i].focus();
      let event = new Event('input', {
        bubbles: true,
        cancelable: true,
      });
      textareaContents[i].dispatchEvent(event);
      break;
    }
    setTimeout(() => {
      document.querySelectorAll('.chat-input-box-send').forEach((element) => {
        element.click();
        $inupt.value = '';
      });
    }, 500);
  }, 500);
}
function initAIChat() {
  getUID();
  window._bdLingJingAiChat = new LingJingAgent.Chat({
    // 站点对应的 agentId
    agentId: $agentId,
    // ⽤户唯⼀ id
    uid: window.uuid,
    // 对话流的 Container，默认为 document.body
    container: undefined,
    /** 启动⼊⼝（悬浮球）配置，可不填 */
    entry: {
      // ⼊⼝的 Container，默认为 document.body
      container: undefined,
      // ⼊⼝的 image 的 url 地址，默认为动图
      image: undefined,
    },
  });
}

function getUID() {
  var guid = function () {
    var uidStr = '';
    for (var i = 0; i < 8; i++) {
      uidStr += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
    }
    return uidStr;
  };
  if (!window.uuid) {
    window.uuid = localStorage.uid;
    if (!window.uuid) {
      window.uuid = guid();
      localStorage.setItem('uid', window.uuid);
    }
  }
}
function loadJS(url, callback) {
  var script = document.createElement('script'),
    fn = callback || function () {};
  script.type = 'text/javascript';

  if (script.readyState) {
    //IE
    script.onreadystatechange = function () {
      if (script.readyState == 'loaded' || script.readyState == 'complete') {
        script.onreadystatechange = null;
        fn();
      }
    };
  } else {
    //其他浏览器
    script.onload = function () {
      fn();
    };
  }
  script.src = url;
  document.getElementsByTagName('head')[0].appendChild(script);
}


</script>

</html>