import{X as e,al as t,E as r,ae as l,S as n,ao as a,G as o,a8 as i,a1 as s,aN as c,as as d,q as u,ap as h,aV as p,cp as g,ef as f,a2 as v,a0 as w,eg as m,cY as x,U as y}from"./index-C-dDkA_D.js";import{V as b,a as E}from"./index-BysPVQV8.js";var C=h('<div style=padding:20px;overflow:auto><table style="border-collapse:collapse;width:100%;background-color:white;box-shadow:0 2px 8px rgba(0,0,0,0.1)"><tbody>'),k=h("<div style=width:100%;height:100%;overflow:auto;position:relative;background:#ffffff;padding-top:50px>"),j=h("<tr>"),S=h('<td style="border:1px solid #ddd;padding:8px 12px;white-space:pre-wrap;word-break:break-word;min-width:100px">');const $=()=>{const h=u(),[$,F]=e(!0),[_,z]=e(!1),[J,I]=e(!1),[q,B]=e([]),[L,V]=e(0);let W;const A=()=>{W&&(document.fullscreenElement?document.exitFullscreen().then(()=>{I(!1)}):W.requestFullscreen().then(()=>{I(!0)}))};return t(()=>{(async()=>{try{F(!0),z(!1),await new Promise((e,t)=>{if(window.ExcelJS)return void e();const r=document.getElementById("exceljs-script");if(r)return r.addEventListener("load",()=>e()),void r.addEventListener("error",()=>t(new w("Failed to load ExcelJS library")));const l=document.createElement("script");l.src="static/exceljs/exceljs.min.js",l.id="exceljs-script",l.async=!0,l.onload=()=>e(),l.onerror=()=>t(new w("Failed to load ExcelJS library")),document.head.appendChild(l)});const e=y.raw_url,t=await fetch(e);if(!t.ok)throw new w("Failed to fetch Excel file");const r=await t.arrayBuffer(),l=new window.ExcelJS.Workbook;await l.xlsx.load(r);const n=[];l.worksheets.forEach(e=>{const t=[];e.eachRow((e,r)=>{const l=[];e.eachCell({includeEmpty:!0},(e,t)=>{let r="";null!==e.value&&void 0!==e.value&&(r="object"==typeof e.value&&"text"in e.value?e.value.text:"object"==typeof e.value&&"result"in e.value?String(e.value.result):String(e.value));const n={};e.font&&(n.bold=e.font.bold,n.italic=e.font.italic),e.fill&&e.fill.fgColor&&(n.bgColor=e.fill.fgColor.argb),e.alignment&&(n.alignment=e.alignment.horizontal||"left"),l.push({value:r,style:n})}),t.push(l)}),n.push({name:e.name,rows:t})}),B(n),F(!1)}catch(e){console.error("Excel加载失败:",e),z(!0),F(!1)}})()}),r(x,{w:"$full",h:"70vh",pos:"relative",get children(){return[r(l,{pos:"absolute",top:"$2",left:"$2",right:"$2",zIndex:"10",display:"flex",justifyContent:"space-between",alignItems:"center",px:"$2",get children(){return[r(n,{get when(){return s(()=>!($()||_()))()&&q().length>0},get children(){return r(a,{spacing:"$2",flexWrap:"wrap",get children(){return r(o,{get each(){return q()},children:(e,t)=>r(i,{size:"sm",get variant(){return L()===t()?"solid":"outline"},colorScheme:"primary",onClick:()=>V(t()),get children(){return e.name}})})}})}}),r(l,{opacity:"0.7",transition:"opacity 0.2s",_hover:{opacity:"1"},get children(){return r(c,{withArrow:!0,get label(){return s(()=>!!J())()?h("home.preview.exit_fullscreen"):h("home.preview.fullscreen")},get children(){return r(d,{size:"sm",colorScheme:"neutral","aria-label":"Toggle Fullscreen",get icon(){return s(()=>!!J())()?r(b,{}):r(E,{})},onClick:A})}})}})]}}),(e=k(),"function"==typeof W?m(W,e):W=e,p(e,r(n,{get when(){return s(()=>!($()||_()))()&&q().length>0},get children(){var e=C(),t=e.firstChild.firstChild;return p(t,r(o,{get each(){var e;return(null==(e=q()[L()])?void 0:e.rows)||[]},children:e=>{return t=j(),p(t,r(o,{each:e,children:e=>{return t=S(),p(t,()=>e.value),g(r=>{var l,n,a,o,i=(null==(l=e.style)?void 0:l.bold)?"bold":"normal",s=(null==(n=e.style)?void 0:n.italic)?"italic":"normal",c=(null==(a=e.style)?void 0:a.bgColor)?`#${e.style.bgColor.slice(2)}`:"transparent",d=(null==(o=e.style)?void 0:o.alignment)||"left";return i!==r.e&&f(t,"font-weight",r.e=i),s!==r.t&&f(t,"font-style",r.t=s),c!==r.a&&f(t,"background-color",r.a=c),d!==r.o&&f(t,"text-align",r.o=d),r},{e:void 0,t:void 0,a:void 0,o:void 0}),t;var t}})),t;var t}})),e}}),null),p(e,r(n,{get when(){return $()},get children(){return r(v,{})}}),null),p(e,r(n,{get when(){return _()},get children(){return r(w,{get msg(){return h("preview.failed_load_excel")},h:"70vh"})}}),null),e)];var e}})};export{$ as default};
