1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/index.DYj22dfZ.js","_astro/notification.QHNqE6Ji.js","_astro/message.IfAedvbn.js","_astro/websocket.C9eMhWi3.js"])))=>i.map(i=>d[i]); 2import{C as g,N as u,_ as $}from"./notification.QHNqE6Ji.js";import{m as w}from"./message.IfAedvbn.js";const D=200,A=1e3;let p=[],C=null,f=!1,y=!1,h=!1,e=null;function V(){e={listView:document.getElementById("mail-list-view"),detailView:document.getElementById("mail-detail-view"),emptyState:document.querySelector(".empty-state"),messageList:document.querySelector(".message-list"),skeleton:document.getElementById("detail-skeleton"),contentWrapper:document.getElementById("detail-content-wrapper"),detailContent:document.querySelector(".detail-content"),refreshBtn:document.getElementById("refresh-btn"),deleteBtn:document.getElementById("delete-message-btn")}}function I(s){const i=new Date(s),l=new Date().getTime()-i.getTime(),n=Math.floor(l/1e3),a=Math.floor(n/60),o=Math.floor(a/60),d=Math.floor(o/24);return n<1?"just now":n===1?"1 second ago":n<60?`${n} seconds ago`:a===1?"1 minute ago":a<60?`${a} minutes ago`:o===1?"1 hour ago":o<24?`${o} hours ago`:d===1?"1 day ago":d<7?`${d} days ago`:i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function B(s){const i=s.fromName||s.fromAddress?.split("@")[0]||"Unknown",t=s.fromAddress||"";return{name:i,email:t}}function k(s){const i=document.querySelector(".message-list");i&&(i.innerHTML=s.map(t=>{const l=B(t),n=!t.isRead,a=l.email.length>16?l.email.substring(0,16)+"...":l.email;let o=t.preview||t.subject||"";return o=o.replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").substring(0,40),` 3 <div 4 class="message-item px-4 md:px-6 py-4 border-b border-gray-200 hover:bg-gray-50 transition-all duration-200 cursor-pointer ${n?"bg-blue-50":""}" 5 data-mail-id="${t.id}" 6 > 7 <div class="flex flex-col md:grid md:grid-cols-12 gap-2 md:gap-4"> 8 <div class="flex items-center justify-between md:col-span-4 md:justify-start gap-3"> 9 <div class="flex items-center gap-3 flex-1 min-w-0"> 10 <div class="indicator-wrapper relative"> 11 <div class="w-2.5 h-2.5 rounded-full flex-shrink-0 ${n?"bg-green-500":"bg-gray-300"}"></div> 12 <div class="loading-spinner hidden absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"> 13 <svg class="animate-spin h-4 w-4 text-primary" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> 14 <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> 15 <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> 16 </svg> 17 </div> 18 </div> 19 <div class="overflow-hidden flex-1 min-w-0"> 20 <div class="font-semibold text-gray-800 text-sm truncate">${l.name}</div> 21 <div class="text-sm text-gray-500 truncate">${a}</div> 22 </div> 23 </div> 24 <span class="text-sm text-gray-500 whitespace-nowrap md:hidden">${I(t.receivedAt)}</span> 25 </div> 26 27 <div class="md:col-span-6 pl-6 md:pl-0"> 28 <div class="font-semibold text-gray-800 text-sm mb-1 truncate"> 29 ${t.hasAttachments?'<span class="text-gray-400">ð </span>':""} 30 ${t.subject||"(No Subject)"} 31 </div> 32 <div class="text-sm text-gray-500 truncate">${o}</div> 33 </div> 34 35 <div class="hidden md:flex md:col-span-2 items-center justify-end"> 36 <span class="text-sm text-gray-500">${I(t.receivedAt)}</span> 37 </div> 38 </div> 39 </div> 40 `}).join(""),i.querySelectorAll(".message-item").forEach(t=>{t.addEventListener("click",()=>{if(f)return;const l=t.getAttribute("data-mail-id");l&&window.showMailDetail&&window.showMailDetail(l)})}))}async function v(){const s=g.getMailboxId();if(s)try{if(p=await w.list(s),!e)return;p.length===0?(e.emptyState?.classList.remove("hidden"),e.messageList?.classList.add("hidden")):(e.emptyState?.classList.add("hidden"),e.messageList?.classList.remove("hidden"),k(p))}catch(i){console.error("Failed to load messages:",i)}}window.showMailDetail=async function(s){if(f)return;const i=g.getMailboxId();if(!i)return;f=!0;const t=document.querySelector(`[data-mail-id="${s}"]`);if(t){t.classList.add("opacity-70","pointer-events-none");const n=t.querySelector(".w-2\\.5.h-2\\.5.rounded-full"),a=t.querySelector(".loading-spinner");n&&n.classList.add("invisible"),a&&a.classList.remove("hidden")}document.querySelectorAll(".message-item").forEach(n=>
40{n.classList.add("pointer-events-none")});try{if(await new Promise(r=>setTimeout(r,D)),!e)return;e.listView?.classList.add("hidden"),e.detailView?.classList.remove("hidden"),e.skeleton?.classList.remove("hidden"),e.contentWrapper?.classList.add("hidden");const n=await w.get(i,s);if(C=s,w.markAsRead(i,s).catch(()=>{}),t){t.classList.remove("bg-blue-50");const r=t.querySelector(".w-2\\.5.h-2\\.5.rounded-full");r&&(r.classList.remove("bg-green-500"),r.classList.add("bg-gray-300"))}const a=B(n),o=document.getElementById("detail-avatar");o&&(o.textContent=a.name.charAt(0).toUpperCase());const d=document.getElementById("detail-from-name");d&&(d.textContent=a.name);const L=document.getElementById("detail-from-email");L&&(L.textContent=a.email);const b=document.getElementById("detail-subject");b&&(b.textContent=n.subject||"(No Subject)");const m=document.getElementById("detail-body");if(m)if(m.innerHTML="",n.html){let r=m.shadowRoot;r?r.innerHTML="":r=m.attachShadow({mode:"open"});const S=document.createElement("style");S.textContent=` 41 :host { 42 display: block; 43 color: #374151; 44 line-height: 1.625; 45 font-family: system-ui, -apple-system, sans-serif; 46 } 47 48 /* éå¶é®ä»¶å 容ï¼é²æ¢æç ´å¸å± */ 49 * { 50 max-width: 100%; 51 box-sizing: border-box; 52 } 53 54 img { 55 height: auto; 56 display: block; 57 } 58 59 a { 60 color: #3b82f6; 61 text-decoration: underline; 62 } 63 64 /* éç½®é®ä»¶å¯è½å¸¦æ¥çå ¨å±æ ·å¼ */ 65 body, html { 66 all: unset; 67 } 68 69 table { 70 border-collapse: collapse; 71 width: 100%; 72 } 73 74 pre { 75 white-space: pre-wrap; 76 word-wrap: break-word; 77 } 78 `;const E=document.createElement("div");E.innerHTML=n.html,r.appendChild(S),r.appendChild(E)}else m.textContent=n.text||"(No content)";const c=new Date(n.receivedAt),M=`${String(c.getDate()).padStart(2,"0")}-${String(c.getMonth()+1).padStart(2,"0")}-${c.getFullYear()} ${String(c.getHours()).padStart(2,"0")}:${String(c.getMinutes()).padStart(2,"0")}:${String(c.getSeconds()).padStart(2,"0")}`,x=document.getElementById("detail-date");x&&(x.textContent=M),e.skeleton?.classList.add("hidden"),e.contentWrapper?.classList.remove("hidden")}catch(n){console.error("Failed to load message:",n),u.error("Failed to load message. Please try again."),e&&(e.listView?.classList.remove("hidden"),e.detailView?.classList.add("hidden"))}finally{if(f=!1,document.querySelectorAll(".message-item").forEach(a=>{a.classList.remove("pointer-events-none","opacity-70")}),t){const a=t.querySelector(".w-2\\.5.h-2\\.5.rounded-full"),o=t.querySelector(".loading-spinner");a&&a.classList.remove("invisible"),o&&o.classList.add("hidden")}}};window.addEventListener("new-mail",()=>{v()});window.addEventListener("refresh-messages",async()=>{if(!(y||!e?.refreshBtn)){y=!0,e.refreshBtn.classList.add("opacity-50","cursor-not-allowed","pointer-events-none");try{await v(),u.success("Messages refreshed successfully!")}catch(s){console.error("Failed to refresh messages:",s),u.error("Failed to refresh messages. Please try again.")}finally{y=!1,e.refreshBtn?.classList.remove("opacity-50","cursor-not-allowed","pointer-events-none")}}});window.addEventListener("DOMContentLoaded",()=>{V(),v(),e?.deleteBtn?.addEventListener("click",async()=>{if(h||!e?.deleteBtn)return;const s=g.getMailboxId();if(s){h=!0,e.deleteBtn.classList.add("opacity-50","cursor-not-allowed","pointer-events-none");try{const{mailboxService:i}=await $(async()=>{const{mailboxService:t}=await import("./index.DYj22dfZ.js");return{mailboxService:t}},__vite__mapDeps([0,1,2,3]));await i.delete(s),g.clear(),u.success("Email deleted successfully"),setTimeout(()=>{window.location.reload()},A)}catch{h=!1,e.deleteBtn?.classList.remove("opacity-50","cursor-not-allowed","pointer-events-none"),u.error("Failed to delete email. Please try again.")}}})});
78window.backToList=function(){if(!e?.detailView||!e.listView)return;e.detailView.classList.remove("fullscreen-mode"),e.detailView.classList.add("hidden"),e.listView.classList.remove("hidden");const s=document.getElementById("fullscreen-icon"),i=document.getElementById("exit-fullscreen-icon");s?.classList.remove("hidden"),i?.classList.add("hidden"),document.body.style.overflow=""};window.toggleFullScreen=function(){if(!e?.detailView)return;const s=document.getElementById("fullscreen-icon"),i=document.getElementById("exit-fullscreen-icon");e.detailView.classList.contains("fullscreen-mode")?(e.detailView.classList.remove("fullscreen-mode"),s?.classList.remove("hidden"),i?.classList.add("hidden"),document.body.style.overflow=""):(e.detailView.classList.add("fullscreen-mode"),s?.classList.add("hidden"),i?.classList.remove("hidden"),document.body.style.overflow="hidden")};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.