// worker.js
var worker_default = {
  async fetch(request, env) {
    const url = new URL(request.url);
    if (url.pathname === "/load" && request.method === "GET") {
      const content = await env.NOTES.get("note");
      return new Response(content || "", {
        headers: { "Content-Type": "text/plain" }
      });
    }
    if (url.pathname === "/save" && request.method === "POST") {
      const body = await request.text();
      await env.NOTES.put("note", body);
      return new Response("\u5185\u5BB9\u5DF2\u4FDD\u5B58 \u2705");
    }
    if (url.pathname === "/") {
      return new Response(`<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <title>\u6211\u7684\u8BB0\u4E8B\u672C</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    :root {
      --bg-color: #f5f3ef;
      --container-bg: #338833;
      --accent-color: #ffffff;
      --text-color: #000000;
      --shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    body {
      margin: 0;
      padding: 0;
      font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
      background-color: var(--bg-color);
      color: var(--text-color);
    }
    .container {
      max-width: 800px;
      margin: 60px auto;
      min-height: 60vh;
      display: flex;
      flex-direction: column;
      justify-content: center;
      background-color: var(--container-bg);
      padding: 30px;
      border-radius: 16px;
      box-shadow: var(--shadow);
      transition: box-shadow 0.3s ease;
    }
    .container:hover {
      box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    }
    h1 {
      text-align: center;
      color: var(--accent-color);
      margin-top: 1px;
      margin-bottom: 16px;
      font-size: 1.2em;
      letter-spacing: 1px;
    }
    textarea {
      width: 100%;
      height: 70vh;
      border: none;
      border-radius: 10px;
      padding: 20px;
      font-size: 13px;
      line-height: 1.6;
      resize: none;
      box-sizing: border-box;
      background-color: #ffffff;
      color: var(--text-color);
      box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
      transition: box-shadow 0.3s ease;
    }
    textarea:focus {
      outline: none;
      box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
    }
    .status {
      text-align: right;
      font-size: 13px;
      color: var(--accent-color);
      margin-top: 12px;
      font-style: italic;
    }
    @media (max-width: 600px) {
      .container {
        margin: 20px;
        padding: 20px;
      }
      textarea {
        height: 510px;
      }
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>\u6211\u7684\u8BB0\u4E8B\u672C</h1>
    <textarea id="notepad" placeholder="\u6E29\u99A8\u8B66\u793A\uFF1A\u5207\u52FF\u5728\u6B64\u8BB0\u5F55\u79C1\u5BC6\u4FE1\u606F"></textarea>
    <div class="status" id="status">\u6B63\u5728\u52A0\u8F7D\u5185\u5BB9...</div>
  </div>
  <script>
    const textarea = document.getElementById('notepad');
    const status = document.getElementById('status');

    fetch('/load')
      .then(res => res.text())
      .then(data => {
        textarea.value = data;
        status.textContent = '\u5185\u5BB9\u5DF2\u52A0\u8F7D \u2705';
      });

    textarea.addEventListener('input', () => {
      fetch('/save', {
        method: 'POST',
        headers: { 'Content-Type': 'text/plain' },
        body: textarea.value
      }).then(() => {
        status.textContent = '\u5185\u5BB9\u5DF2\u4FDD\u5B58 \u2705';
      });
    });
  <\/script>
</body>
</html>`, {
        headers: { "Content-Type": "text/html;charset=utf-8" }
      });
    }
    return new Response("Not Found", { status: 404 });
  }
};
export {
  worker_default as default
};
//# sourceMappingURL=worker.js.map
