@ehfuse/file-viewer 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 파일 종류 아이콘 — FileViewer 의 파일 목록과 같은 매핑(이미지/PDF/HTML 은 전용 SVG, 그 외는 MUI 아이콘 + 종류별 색).
3
+ * 다른 패키지(메일 첨부 등)가 같은 아이콘을 쓰도록 `@ehfuse/file-viewer/icons` 로 내보낸다.
4
+ */
5
+ import type { ReactElement } from "react";
6
+ import type { ViewerFileType } from "../types";
7
+ /** 파일 종류별 아이콘 요소(size = px). */
8
+ export declare function getFileTypeIcon(fileType: ViewerFileType | string, size?: number): ReactElement;
9
+ export interface FileTypeIconProps {
10
+ fileName: string;
11
+ mime?: string;
12
+ size?: number;
13
+ }
14
+ /** 파일명/MIME 으로 종류를 정해 아이콘을 그린다(압축 파일은 뷰어 타입이 없어 확장자로 따로 본다). */
15
+ export declare function FileTypeIcon({ fileName, mime, size }: FileTypeIconProps): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,2 @@
1
+ import type React from "react";
2
+ export declare function HtmlIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type React from "react";
2
+ export declare function ZipIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ export { ImageIcon } from "./ImageIcon";
2
+ export { PdfIcon } from "./PdfIcon";
3
+ export { HtmlIcon } from "./HtmlIcon";
4
+ export { ZipIcon } from "./ZipIcon";
5
+ export { FileTypeIcon, getFileTypeIcon, type FileTypeIconProps } from "./FileTypeIcon";
@@ -0,0 +1 @@
1
+ import{jsx as l,jsxs as d}from"react/jsx-runtime";function p(t){return d("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:t.width||"22px",...t,children:[l("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),l("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),l("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),l("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),d("g",{children:[l("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),l("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}import{jsx as i,jsxs as n}from"react/jsx-runtime";function a(t){return i("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:t.width||"28px",...t,children:n("g",{children:[i("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),i("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),n("g",{children:[n("g",{children:[i("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),i("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),i("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),i("g",{children:i("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),i("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),i("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),i("g",{children:i("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}import{jsx as f}from"react/jsx-runtime";function h(t){return f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:t.width||"22px",fill:t.fill||"#E91E63",...t,children:f("path",{d:"M488.426,197.019H475.2v-63.816c0-0.401-0.063-0.799-0.116-1.205c-0.021-2.534-0.827-5.023-2.562-6.992L366.325,3.691 c-0.032-0.031-0.063-0.042-0.085-0.073c-0.633-0.707-1.371-1.298-2.151-1.804c-0.231-0.158-0.464-0.287-0.706-0.422 c-0.676-0.366-1.393-0.675-2.131-0.896c-0.2-0.053-0.38-0.135-0.58-0.19C359.87,0.119,359.037,0,358.193,0H97.2 c-11.918,0-21.6,9.693-21.6,21.601v175.413H62.377c-17.049,0-30.873,13.818-30.873,30.87v160.542 c0,17.044,13.824,30.876,30.873,30.876h13.224V529.2c0,11.907,9.682,21.601,21.6,21.601h356.4c11.907,0,21.6-9.693,21.6-21.601 V419.302h13.226c17.044,0,30.871-13.827,30.871-30.87V227.89C519.297,210.838,505.47,197.019,488.426,197.019z M97.2,21.605 h250.193v110.51c0,5.967,4.841,10.8,10.8,10.8h95.407v54.108H97.2V21.605z M406.467,363.983h-26.104l-1.751-46.464 c-0.527-14.598-1.055-32.236-1.055-49.895h-0.517c-3.691,15.485-8.596,32.782-13.163,47.015l-14.354,47.366h-20.851l-12.625-47.002 c-3.85-14.228-7.889-31.524-10.694-47.374h-0.348c-0.707,16.397-1.234,35.129-2.1,50.253l-2.114,46.111h-24.711l7.535-121.395 h35.575l11.569,40.521c3.691,14.048,7.362,29.183,9.999,43.416h0.521c3.344-14.054,7.356-30.074,11.222-43.585l12.614-40.353 h34.879L406.467,363.983z M174.438,265.642v-23.058h90.77v23.058h-32.239v98.342h-26.821v-98.342H174.438z M89.403,313.195v50.788 H62.604V242.584h26.799v46.654h43.999v-46.654h26.645v121.399h-26.645v-50.794H89.403V313.195z M453.601,523.353H97.2V419.302 h356.4V523.353z M500.787,363.983h-73.786V242.584h26.811v98.339h46.976V363.983z"})})}import{jsx as o,jsxs as v}from"react/jsx-runtime";function m(t){return v("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:t.width||"22px",fill:t.fill||"#B45309",...t,children:[o("path",{d:"M475.095,131.992c-0.032-2.526-0.833-5.021-2.568-6.993L366.324,3.694c-0.021-0.034-0.053-0.045-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.422c-0.686-0.366-1.393-0.67-2.131-0.892 c-0.2-0.058-0.379-0.14-0.58-0.192C359.87,0.114,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.202 C475.2,132.796,475.137,132.398,475.095,131.992z M243.599,523.494H141.75v-15.936l62.398-89.797v-0.785h-56.565v-24.484h95.051 v17.106l-61.038,88.636v0.771h62.002V523.494z M292.021,523.494h-29.744V392.492h29.744V523.494z M399.705,463.44 c-10.104,9.524-25.069,13.796-42.566,13.796c-3.893,0-7.383-0.19-10.104-0.58v46.849h-29.352V394.242 c9.134-1.561,21.958-2.721,40.036-2.721c18.277,0,31.292,3.491,40.046,10.494c8.354,6.607,13.996,17.486,13.996,30.322 C411.761,445.163,407.479,456.053,399.705,463.44z M97.2,366.752V21.601h129.167v-3.396h32.756v3.396h88.28v110.515 c0,5.961,4.831,10.8,10.8,10.8H453.6l0.011,223.836H97.2z"}),o("path",{d:"M359.279,413.87c-6.033,0-10.114,0.586-12.245,1.171v38.676c2.521,0.585,5.632,0.785,9.914,0.785 c15.736,0,25.46-7.979,25.46-21.378C382.408,421.063,374.045,413.87,359.279,413.87z"}),o("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),o("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),o("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),o("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),o("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),o("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),o("path",{d:"M259.124,149.537c-23.193,0-34.225,18.792-34.225,41.99l-7.765,70.348c0,23.198,18.792,42.003,41.984,42.003 c23.19,0,41.974-18.805,41.974-42.003l-7.741-70.348C293.361,168.334,282.318,149.537,259.124,149.537z M273.04,285.431h-27.799 v-58.728h27.799V285.431z"})]})}import y from"@mui/icons-material/TextSnippet";import F from"@mui/icons-material/VideoFile";import V from"@mui/icons-material/AudioFile";import z from"@mui/icons-material/Description";import M from"@mui/icons-material/InsertDriveFile";import I from"@mui/icons-material/Code";import C from"@mui/icons-material/TableView";var w=t=>{let e=t.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(e)?"image":e==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(e)?"text":["csv","xls","xlsx"].includes(e)?"spreadsheet":["html","htm"].includes(e)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(e)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(e)?"video":["mp3","wav","ogg","m4a","aac"].includes(e)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(e)?"office":"unsupported"},u=t=>{let e=(t||"").toLowerCase().split(";")[0].trim();return e?e.startsWith("image/")?"image":e==="application/pdf"?"pdf":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":e==="text/html"?"html":e==="text/csv"||e==="application/vnd.ms-excel"||e==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":e.startsWith("text/")||e==="application/json"||e==="application/xml"?"text":"unsupported":"unsupported"},x=(t,e)=>{let c=w(t);return c!=="unsupported"?c:u(e)};import{jsx as r}from"react/jsx-runtime";function g(t,e=22){let c=`${e}px`,s={fontSize:e};switch(t){case"image":return r(p,{width:c,height:c});case"pdf":return r(a,{width:c,height:c});case"html":return r(h,{width:c,height:c});case"archive":return r(m,{width:c,height:c});case"text":return r(y,{sx:{...s,color:"#66BB6A"}});case"spreadsheet":return r(C,{sx:{...s,color:"#4CAF50"}});case"code":return r(I,{sx:{...s,color:"#2196F3"}});case"video":return r(F,{sx:{...s,color:"#AB47BC"}});case"audio":return r(V,{sx:{...s,color:"#FF7043"}});case"office":return r(z,{sx:{...s,color:"#FFA726"}});default:return r(M,{sx:{...s,color:"#78909C"}})}}var H=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function E({fileName:t,mime:e,size:c=22}){let s=t.includes(".")?t.slice(t.lastIndexOf(".")+1).toLowerCase():"";return H.has(s)?g("archive",c):g(x(t,e??""),c)}export{E as FileTypeIcon,h as HtmlIcon,p as ImageIcon,a as PdfIcon,m as ZipIcon,g as getFileTypeIcon};
package/dist/icons.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var H=Object.create;var a=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var c in t)a(e,c,{get:t[c],enumerable:!0})},v=(e,t,c,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of b(t))!S.call(e,n)&&n!==c&&a(e,n,{get:()=>t[n],enumerable:!(r=E(t,n))||r.enumerable});return e};var p=(e,t,c)=>(c=e!=null?H(T(e)):{},v(t||!e||!e.__esModule?a(c,"default",{value:e,enumerable:!0}):c,e)),R=e=>v(a({},"__esModule",{value:!0}),e);var k={};B(k,{FileTypeIcon:()=>C,HtmlIcon:()=>g,ImageIcon:()=>h,PdfIcon:()=>m,ZipIcon:()=>d,getFileTypeIcon:()=>f});module.exports=R(k);var l=require("react/jsx-runtime");function h(e){return(0,l.jsxs)("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:e.width||"22px",...e,children:[(0,l.jsx)("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),(0,l.jsx)("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),(0,l.jsx)("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),(0,l.jsx)("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),(0,l.jsxs)("g",{children:[(0,l.jsx)("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),(0,l.jsx)("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}var i=require("react/jsx-runtime");function m(e){return(0,i.jsx)("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:e.width||"28px",...e,children:(0,i.jsxs)("g",{children:[(0,i.jsx)("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),(0,i.jsx)("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),(0,i.jsxs)("g",{children:[(0,i.jsxs)("g",{children:[(0,i.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),(0,i.jsx)("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),(0,i.jsx)("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),(0,i.jsx)("g",{children:(0,i.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),(0,i.jsx)("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),(0,i.jsx)("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),(0,i.jsx)("g",{children:(0,i.jsx)("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}var x=require("react/jsx-runtime");function g(e){return(0,x.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:e.width||"22px",fill:e.fill||"#E91E63",...e,children:(0,x.jsx)("path",{d:"M488.426,197.019H475.2v-63.816c0-0.401-0.063-0.799-0.116-1.205c-0.021-2.534-0.827-5.023-2.562-6.992L366.325,3.691 c-0.032-0.031-0.063-0.042-0.085-0.073c-0.633-0.707-1.371-1.298-2.151-1.804c-0.231-0.158-0.464-0.287-0.706-0.422 c-0.676-0.366-1.393-0.675-2.131-0.896c-0.2-0.053-0.38-0.135-0.58-0.19C359.87,0.119,359.037,0,358.193,0H97.2 c-11.918,0-21.6,9.693-21.6,21.601v175.413H62.377c-17.049,0-30.873,13.818-30.873,30.87v160.542 c0,17.044,13.824,30.876,30.873,30.876h13.224V529.2c0,11.907,9.682,21.601,21.6,21.601h356.4c11.907,0,21.6-9.693,21.6-21.601 V419.302h13.226c17.044,0,30.871-13.827,30.871-30.87V227.89C519.297,210.838,505.47,197.019,488.426,197.019z M97.2,21.605 h250.193v110.51c0,5.967,4.841,10.8,10.8,10.8h95.407v54.108H97.2V21.605z M406.467,363.983h-26.104l-1.751-46.464 c-0.527-14.598-1.055-32.236-1.055-49.895h-0.517c-3.691,15.485-8.596,32.782-13.163,47.015l-14.354,47.366h-20.851l-12.625-47.002 c-3.85-14.228-7.889-31.524-10.694-47.374h-0.348c-0.707,16.397-1.234,35.129-2.1,50.253l-2.114,46.111h-24.711l7.535-121.395 h35.575l11.569,40.521c3.691,14.048,7.362,29.183,9.999,43.416h0.521c3.344-14.054,7.356-30.074,11.222-43.585l12.614-40.353 h34.879L406.467,363.983z M174.438,265.642v-23.058h90.77v23.058h-32.239v98.342h-26.821v-98.342H174.438z M89.403,313.195v50.788 H62.604V242.584h26.799v46.654h43.999v-46.654h26.645v121.399h-26.645v-50.794H89.403V313.195z M453.601,523.353H97.2V419.302 h356.4V523.353z M500.787,363.983h-73.786V242.584h26.811v98.339h46.976V363.983z"})})}var s=require("react/jsx-runtime");function d(e){return(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:e.width||"22px",fill:e.fill||"#B45309",...e,children:[(0,s.jsx)("path",{d:"M475.095,131.992c-0.032-2.526-0.833-5.021-2.568-6.993L366.324,3.694c-0.021-0.034-0.053-0.045-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.422c-0.686-0.366-1.393-0.67-2.131-0.892 c-0.2-0.058-0.379-0.14-0.58-0.192C359.87,0.114,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.202 C475.2,132.796,475.137,132.398,475.095,131.992z M243.599,523.494H141.75v-15.936l62.398-89.797v-0.785h-56.565v-24.484h95.051 v17.106l-61.038,88.636v0.771h62.002V523.494z M292.021,523.494h-29.744V392.492h29.744V523.494z M399.705,463.44 c-10.104,9.524-25.069,13.796-42.566,13.796c-3.893,0-7.383-0.19-10.104-0.58v46.849h-29.352V394.242 c9.134-1.561,21.958-2.721,40.036-2.721c18.277,0,31.292,3.491,40.046,10.494c8.354,6.607,13.996,17.486,13.996,30.322 C411.761,445.163,407.479,456.053,399.705,463.44z M97.2,366.752V21.601h129.167v-3.396h32.756v3.396h88.28v110.515 c0,5.961,4.831,10.8,10.8,10.8H453.6l0.011,223.836H97.2z"}),(0,s.jsx)("path",{d:"M359.279,413.87c-6.033,0-10.114,0.586-12.245,1.171v38.676c2.521,0.585,5.632,0.785,9.914,0.785 c15.736,0,25.46-7.979,25.46-21.378C382.408,421.063,374.045,413.87,359.279,413.87z"}),(0,s.jsx)("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),(0,s.jsx)("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),(0,s.jsx)("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),(0,s.jsx)("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),(0,s.jsx)("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),(0,s.jsx)("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),(0,s.jsx)("path",{d:"M259.124,149.537c-23.193,0-34.225,18.792-34.225,41.99l-7.765,70.348c0,23.198,18.792,42.003,41.984,42.003 c23.19,0,41.974-18.805,41.974-42.003l-7.741-70.348C293.361,168.334,282.318,149.537,259.124,149.537z M273.04,285.431h-27.799 v-58.728h27.799V285.431z"})]})}var u=p(require("@mui/icons-material/TextSnippet"),1),y=p(require("@mui/icons-material/VideoFile"),1),F=p(require("@mui/icons-material/AudioFile"),1),V=p(require("@mui/icons-material/Description"),1),z=p(require("@mui/icons-material/InsertDriveFile"),1),M=p(require("@mui/icons-material/Code"),1),I=p(require("@mui/icons-material/TableView"),1);var j=e=>{let t=e.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(t)?"image":t==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(t)?"text":["csv","xls","xlsx"].includes(t)?"spreadsheet":["html","htm"].includes(t)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(t)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(t)?"video":["mp3","wav","ogg","m4a","aac"].includes(t)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(t)?"office":"unsupported"},A=e=>{let t=(e||"").toLowerCase().split(";")[0].trim();return t?t.startsWith("image/")?"image":t==="application/pdf"?"pdf":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t==="text/html"?"html":t==="text/csv"||t==="application/vnd.ms-excel"||t==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":t.startsWith("text/")||t==="application/json"||t==="application/xml"?"text":"unsupported":"unsupported"},w=(e,t)=>{let c=j(e);return c!=="unsupported"?c:A(t)};var o=require("react/jsx-runtime");function f(e,t=22){let c=`${t}px`,r={fontSize:t};switch(e){case"image":return(0,o.jsx)(h,{width:c,height:c});case"pdf":return(0,o.jsx)(m,{width:c,height:c});case"html":return(0,o.jsx)(g,{width:c,height:c});case"archive":return(0,o.jsx)(d,{width:c,height:c});case"text":return(0,o.jsx)(u.default,{sx:{...r,color:"#66BB6A"}});case"spreadsheet":return(0,o.jsx)(I.default,{sx:{...r,color:"#4CAF50"}});case"code":return(0,o.jsx)(M.default,{sx:{...r,color:"#2196F3"}});case"video":return(0,o.jsx)(y.default,{sx:{...r,color:"#AB47BC"}});case"audio":return(0,o.jsx)(F.default,{sx:{...r,color:"#FF7043"}});case"office":return(0,o.jsx)(V.default,{sx:{...r,color:"#FFA726"}});default:return(0,o.jsx)(z.default,{sx:{...r,color:"#78909C"}})}}var P=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function C({fileName:e,mime:t,size:c=22}){let r=e.includes(".")?e.slice(e.lastIndexOf(".")+1).toLowerCase():"";return P.has(r)?f("archive",c):f(w(e,t??""),c)}
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export { FileViewer, default as FileViewerDefault } from "./FileViewer";
2
2
  export type { ViewerFile, FileViewerProps, ViewerFileType } from "./types";
3
3
  export { getFileType, getFileTypeFromMime, resolveFileType, isFileViewerPreviewable, ensureFileExtension, getEditorLanguage, } from "./utils/fileType";
4
4
  export { saveBlobAsFile } from "./utils/download";
5
+ export { ImageIcon, PdfIcon, HtmlIcon, ZipIcon, FileTypeIcon, getFileTypeIcon, type FileTypeIconProps } from "./icons";
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import{useState as d,useEffect as z,useMemo as io,useCallback as w,useRef as h}from"react";import{Dialog as ao,DialogTitle as so,DialogContent as lo,Drawer as co,IconButton as P,Box as u,Typography as R,Tooltip as S,Button as Jt,Tabs as uo,Tab as mo,Menu as po,MenuItem as Ce,Snackbar as fo,ListItemIcon as Te,ListItemText as ke,useMediaQuery as ho,useTheme as go}from"@mui/material";import xo from"@mui/icons-material/Close";import yo from"@mui/icons-material/Menu";import bo from"@mui/icons-material/MoreHoriz";import en from"@mui/icons-material/Download";import wo from"@mui/icons-material/Add";import vo from"@mui/icons-material/Remove";import tn from"@mui/icons-material/RotateLeft";import nn from"@mui/icons-material/RotateRight";import on from"@mui/icons-material/FitScreen";import Mo from"@mui/icons-material/KeyboardArrowLeft";import Co from"@mui/icons-material/KeyboardArrowRight";import To from"@mui/icons-material/TextSnippet";import ko from"@mui/icons-material/VideoFile";import Io from"@mui/icons-material/AudioFile";import Lo from"@mui/icons-material/Description";import Ro from"@mui/icons-material/InsertDriveFile";import rn from"@mui/icons-material/Code";import Eo from"@mui/icons-material/TableView";import{Document as an,Page as sn,pdfjs as Do}from"react-pdf";import ln from"@monaco-editor/react";import Po from"react-spreadsheet";import*as re from"xlsx";import{LoadingProgress as cn}from"@ehfuse/mui-fadeout-loading-progress";var Ge=l=>{let c=l.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(c)?"image":c==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(c)?"text":["csv","xls","xlsx"].includes(c)?"spreadsheet":["html","htm"].includes(c)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(c)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(c)?"video":["mp3","wav","ogg","m4a","aac"].includes(c)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(c)?"office":"unsupported"},$t=l=>{let c=(l||"").toLowerCase().split(";")[0].trim();return c?c.startsWith("image/")?"image":c==="application/pdf"?"pdf":c.startsWith("video/")?"video":c.startsWith("audio/")?"audio":c==="text/html"?"html":c==="text/csv"||c==="application/vnd.ms-excel"||c==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":c.startsWith("text/")||c==="application/json"||c==="application/xml"?"text":"unsupported":"unsupported"},I=(l,c)=>{let s=Ge(l);return s!=="unsupported"?s:$t(c)},Qn=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),Jn=l=>Qn.has(Ge(l)),eo={"image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-excel":"xls","text/csv":"csv","text/plain":"txt","application/json":"json","text/xml":"xml","application/xml":"xml","text/html":"html","video/mp4":"mp4","video/webm":"webm","audio/mpeg":"mp3","audio/wav":"wav"},to=(l,c)=>{let s=(l??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(s))return s;let x=(c??"").trim().toLowerCase().split(";")[0],W=eo[x]??"";return W?`${s}.${W}`:s},qe=l=>{let c=l.split(".").pop()?.toLowerCase()||"";return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"scss",less:"less",json:"json",xml:"xml",php:"php",py:"python",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",swift:"swift",kt:"kotlin",scala:"scala",sql:"sql",sh:"shell",bash:"shell",bat:"bat",ps1:"powershell",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",md:"markdown",markdown:"markdown",txt:"plaintext",log:"plaintext",csv:"plaintext"}[c]||"plaintext"};var no=l=>(l||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",Ke=(l,c)=>{let s=URL.createObjectURL(l),x=document.createElement("a");x.href=s,x.download=no(c),x.rel="noopener",document.body.appendChild(x),x.click(),x.remove(),window.setTimeout(()=>URL.revokeObjectURL(s),6e4)};var Gt=async l=>{let c=URL.createObjectURL(l);try{let s=await new Promise((F,f)=>{let A=new Image;A.onload=()=>F(A),A.onerror=()=>f(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),A.src=c}),x=document.createElement("canvas");x.width=s.naturalWidth||s.width||1024,x.height=s.naturalHeight||s.height||1024;let W=x.getContext("2d");if(!W)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return W.drawImage(s,0,0,x.width,x.height),await new Promise((F,f)=>{x.toBlob(A=>A?F(A):f(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(c)}};import{useMediaQuery as oo,useTheme as ro}from"@mui/material";function qt(){let l=ro();return!oo(l.breakpoints.up("lg"))}import{jsx as K,jsxs as Kt}from"react/jsx-runtime";function Zt(l){return Kt("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:l.width||"22px",...l,children:[K("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),K("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),K("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),K("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),Kt("g",{children:[K("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),K("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}import{jsx as L,jsxs as Ze}from"react/jsx-runtime";function Qt(l){return L("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:l.width||"28px",...l,children:Ze("g",{children:[L("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),L("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),Ze("g",{children:[Ze("g",{children:[L("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),L("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),L("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),L("g",{children:L("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),L("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),L("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),L("g",{children:L("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}import{Fragment as oe,jsx as o,jsxs as p}from"react/jsx-runtime";var So="/pdfjs",un=32,dn=240,Fo=8192,Qe=.25,Je=8,et=80,mn=80,Bo=l=>{switch(l){case"image":return o(Zt,{});case"pdf":return o(Qt,{});case"text":return o(To,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return o(Eo,{sx:{mr:1,color:"#4CAF50"}});case"html":return o(rn,{sx:{mr:1,color:"#E91E63"}});case"code":return o(rn,{sx:{mr:1,color:"#2196F3"}});case"video":return o(ko,{sx:{mr:1,color:"#AB47BC"}});case"audio":return o(Io,{sx:{mr:1,color:"#FF7043"}});case"office":return o(Lo,{sx:{mr:1,color:"#FFA726"}});default:return o(Ro,{sx:{mr:1,color:"#78909C"}})}},pn=l=>typeof l?.rotate=="number"?l.rotate:typeof l?._pageInfo?.rotate=="number"?l._pageInfo.rotate:0,fn=({open:l,onClose:c,file:s,loadFile:x,onDownload:W,pdfAssetBase:F=So})=>{let f=qt(),A=go(),Z=ho(A.breakpoints.down("sm")),[ie,Ie]=d(!0),[Le,tt]=d(!1),[v,Re]=d(""),[M,B]=d(1),[X,Q]=d(0),[nt,ae]=d(""),[C,ot]=d(""),[rt,se]=d(""),[J,le]=d(14),[Ee,ce]=d(""),[De,it]=d("preview"),[Pe,ee]=d([]),[at,st]=d([]),[hn,Se]=d(""),[Fe,lt]=d(null),[ct,ue]=d(!1),[gn,Be]=d(!0),[ut,de]=d(""),[T,dt]=d(),[k,j]=d(1),[xn,He]=d(!1),[mt,N]=d(null),[me,pt]=d("portrait"),[yn,ft]=d(0),[ze,ht]=d(0),[te,gt]=d({width:0,height:0}),xt=h([]),Ae=h(null),Y=h(null),Ve=h(null),We=h(null),bn=w(e=>{if(Ve.current?.disconnect(),We.current?.(),We.current=null,Y.current=e,!e){Ve.current=null;return}let t=i=>{i.touches.length>=2&&i.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),We.current=()=>e.removeEventListener("touchmove",t);let n=new ResizeObserver(i=>{let a=i[0]?.contentRect;a&&gt({width:a.width,height:a.height})});n.observe(e),Ve.current=n;let r=e.getBoundingClientRect();gt({width:r.width,height:r.height})},[]),[pe,yt]=d(!1),[Xe,wn]=d({x:0,y:0}),[_e,vn]=d({x:0,y:0}),Mn=w(async(e,t)=>{let n=URL.createObjectURL(e);Re(n),ot(e.type||"");let r=I(t,e.type||"");if(r==="text"||r==="code"){let a=await e.text();se(a);return}if(r==="html"){let a=await e.text();ce(a);return}if(r!=="spreadsheet")return;let i=t.split(".").pop()?.toLowerCase()||"";if(i==="csv"){let m=(await e.text()).split(`
2
- `).map(b=>b.split(",").map(D=>({value:D.trim()})));ee(m);return}if(i==="xls"||i==="xlsx"){ue(!0),Be(!0);let a=await e.arrayBuffer(),m=re.read(a,{type:"array"});st(m.SheetNames),lt(m);let b=m.SheetNames[0];Se(b),Ue(m,b)}},[]),fe=h(null),bt=w(async e=>{if(e.blob)return e.blob;if(x)return await x(e);if(e.url){let t=await fetch(e.url);if(!t.ok)throw new Error("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return await t.blob()}throw new Error("\uD30C\uC77C \uB370\uC774\uD130 \uC18C\uC2A4(blob/url/loadFile)\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")},[x]);z(()=>(s&&l?In():(v&&URL.revokeObjectURL(v),fe.current=null,Re(""),se(""),ce(""),ee([]),le(14),B(1),Q(0)),()=>{v&&URL.revokeObjectURL(v)}),[s,l]);let Cn=({numPages:e})=>{dt(e),j(1),ve.current=!0},Tn=e=>{let{width:t,height:n}=kn(e);ft(pn(e)),t>0&&n>0&&ht(t/n);let r=t>n?"landscape":"portrait";pt(r)},kn=e=>{let t=e?.width||0,n=e?.height||0,r=pn(e);try{if(typeof e?.getViewport=="function"){let i=e.getViewport({scale:1,rotation:r});t=i.width,n=i.height}}catch(i){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",i)}return{width:t,height:n}},he=w(()=>{j(e=>Math.max(e-1,1))},[]),ge=w(()=>{j(e=>Math.min(e+1,T||1))},[T]),wt=io(()=>({cMapUrl:`${F}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${F}/standard_fonts/`,wasmUrl:`${F}/wasm/`}),[F]);z(()=>{typeof window>"u"||(Do.GlobalWorkerOptions.workerSrc=`${F}/pdf.worker.min.mjs`)},[F]),z(()=>{if(!l||I(s?.name||"",C)!=="pdf")return;let e=n=>{switch(n.key){case"ArrowLeft":case"ArrowUp":n.preventDefault(),he();break;case"ArrowRight":case"ArrowDown":n.preventDefault(),ge();break;case"Home":n.preventDefault(),j(1);break;case"End":n.preventDefault(),T&&j(T);break}},t=n=>{n.ctrlKey||Math.abs(n.deltaY)>50&&(n.preventDefault(),n.deltaY>0?ge():he())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[l,s,C,he,ge,T]),z(()=>{if(!T||!l||I(s?.name||"",C)!=="pdf")return;if(k===1&&Ae.current){Ae.current.scrollTo({top:0,behavior:"smooth"});return}let e=xt.current[k-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[l,s,C,T,k]),z(()=>{ie&&tt(!0)},[ie,Le]);let In=async()=>{if(s){Ie(!0),ae(""),ot(""),se(""),ce(""),ee([]);try{let e=await bt(s);fe.current=e,await Mn(e,s.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),ae("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{Ie(!1)}}},vt=async()=>{if(s)try{if(W){await W(s);return}let e=fe.current??await bt(s);Ke(e,s.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},Ln=()=>{let e=s?I(s.name,C):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?le(t=>Math.min(t+2,24)):B(e==="pdf"?t=>Math.min(t+.25,Je):t=>Math.min(t+.25,3))},Rn=()=>{let e=s?I(s.name,C):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?le(t=>Math.max(t-2,10)):B(e==="pdf"?t=>Math.max(t-.25,Qe):t=>Math.max(t-.25,.25))},g=h(new Map),En=e=>Math.min(Math.max(e,.25),3),Dn=e=>Math.min(Math.max(e,Qe),Je),je=h(null),xe=h(null),V=h({scale:1,tx:0,ty:0,rotation:0}),_=h(0),$=h(null),ye=h(null),be=w((e,t,n,r)=>{let i=je.current,a=xe.current;if(!i||!a)return{tx:t,ty:n};let m=a.offsetWidth,b=a.offsetHeight,D=(Math.round(r/90)%4+4)%4;if(D===1||D===3){let Zn=m;m=b,b=Zn}let H=m*e,Ot=b*e,Ut=H>i.clientWidth?(H+i.clientWidth)/2-mn:0,Nt=Ot>i.clientHeight?(Ot+i.clientHeight)/2-mn:0;return{tx:Math.min(Ut,Math.max(-Ut,t)),ty:Math.min(Nt,Math.max(-Nt,n))}},[]),Mt=w((e,t)=>{let n=je.current,r=xe.current;if(!n||!r)return e>1;let i=(Math.round(t/90)%4+4)%4,a=i===1||i===3,m=a?r.offsetHeight:r.offsetWidth,b=a?r.offsetWidth:r.offsetHeight;return m*e>n.clientWidth+1||b*e>n.clientHeight+1},[]),O=w(e=>{let t=xe.current;if(!t)return;let{scale:n,tx:r,ty:i,rotation:a}=V.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${r}px, ${i}px) scale(${n}) rotate(${a}deg)`},[]),Ct=w(()=>{let e=V.current,t=be(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!_.current&&(_.current=requestAnimationFrame(()=>{_.current=0,O(!1)}))},[O,be]),Tt=w(()=>{_.current&&(cancelAnimationFrame(_.current),_.current=0),g.current.clear(),$.current=null,ye.current=null},[]),Pn=w(e=>{xe.current=e,e&&(V.current={scale:1,tx:0,ty:0,rotation:0},O(!1))},[O]);z(()=>{if(I(s?.name||"",C)!=="image")return;let e=V.current;e.scale=M,e.rotation=X;let t=be(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,O(!0)},[M,X,s,C,v,O,be]),z(()=>()=>{_.current&&cancelAnimationFrame(_.current)},[]);let Sn=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...g.current.values()],n=V.current;if(t.length===2){$.current=null;let r=e.currentTarget.getBoundingClientRect();ye.current={startDist:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,baseScale:n.scale,baseTx:n.tx,baseTy:n.ty,startMidX:(t[0].x+t[1].x)/2,startMidY:(t[0].y+t[1].y)/2,centerX:r.left+r.width/2,centerY:r.top+r.height/2}}else t.length===1&&Mt(n.scale,n.rotation)&&($.current={startX:e.clientX,startY:e.clientY,baseTx:n.tx,baseTy:n.ty})},Fn=e=>{if(!g.current.has(e.pointerId))return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=V.current,n=ye.current,r=[...g.current.values()];if(n&&r.length>=2){let a=Math.hypot(r[0].x-r[1].x,r[0].y-r[1].y),m=(r[0].x+r[1].x)/2,b=(r[0].y+r[1].y)/2,D=En(n.baseScale*a/n.startDist),H=D/n.baseScale;t.scale=D,t.tx=m-n.centerX-H*(n.startMidX-n.centerX-n.baseTx),t.ty=b-n.centerY-H*(n.startMidY-n.centerY-n.baseTy),Ct();return}let i=$.current;i&&r.length===1&&(t.tx=i.baseTx+(e.clientX-i.startX),t.ty=i.baseTy+(e.clientY-i.startY),Ct())},kt=e=>{if(!g.current.has(e.pointerId))return;g.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=V.current;if(g.current.size<2&&(ye.current=null,Math.abs(t.scale-M)>.001&&B(t.scale)),g.current.size===0)$.current=null;else if(g.current.size===1&&Mt(t.scale,t.rotation)){let n=[...g.current.values()][0];$.current={startX:n.x,startY:n.y,baseTx:t.tx,baseTy:t.ty}}},It=w(async()=>{if(v)try{let t=await(await fetch(v)).blob(),n=t.type==="image/png"?t:await Gt(t);await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),de("\uC774\uBBF8\uC9C0\uB97C \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4.")}catch(e){console.error("\uC774\uBBF8\uC9C0 \uBCF5\uC0AC \uC624\uB958:",e),de("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[v]);z(()=>{if(!l||I(s?.name||"",C)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let n=t.target,r=n?.tagName;r==="INPUT"||r==="TEXTAREA"||n?.isContentEditable||(t.preventDefault(),It())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[l,s,C,It]);let G=h(null),E=h(0),ne=h(null),q=h(null),U=()=>Y.current?.querySelector(".react-pdf__Page")??null,we=h(null),Lt=h(null),Bn=()=>{let e=Lt.current,t=U()?.querySelector("canvas");if(!e||!t||!t.width||!t.height)return!1;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let r=n.getContext("2d");if(!r)return!1;r.drawImage(t,0,0);let i=t.getBoundingClientRect(),a=e.getBoundingClientRect();return Object.assign(n.style,{position:"absolute",left:`${i.left-a.left}px`,top:`${i.top-a.top}px`,width:`${i.width}px`,height:`${i.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(n),we.current=n,!0},Rt=()=>{we.current?.remove(),we.current=null;let e=U();e&&(e.style.visibility="")},Hn=()=>{E.current||(E.current=requestAnimationFrame(()=>{E.current=0;let e=G.current,t=U();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,ne.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Et=()=>{E.current&&(cancelAnimationFrame(E.current),E.current=0),G.current=null,q.current=null,ne.current=null,Rt();let e=U();e&&(e.style.transform="",e.style.willChange="auto")},Dt=e=>{let t=U(),n=Y.current;if(!t||!n)return;t.style.transform&&(t.style.transform="");let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=(e[0].x+e[1].x)/2,m=(e[0].y+e[1].y)/2;G.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:r.left,rectTop:r.top,pageW:r.width,pageH:r.height,viewerL:i.left,viewerT:i.top,viewerR:i.right,viewerB:i.bottom,startMidX:a,startMidY:m,lastMidX:a,lastMidY:m,k:1,tx:0,ty:0},ne.current={k:1,tx:0,ty:0,midX:a,midY:m},t.style.willChange="transform"},zn=e=>{if(e.pointerType!=="touch")return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...g.current.values()];if(t.length===2){if(q.current||we.current)return;Dt(t)}},An=e=>{if(!g.current.has(e.pointerId))return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=G.current,n=[...g.current.values()];if(t&&n.length>=2){e.preventDefault();let r=Math.hypot(n[0].x-n[1].x,n[0].y-n[1].y),i=Math.min(Math.max(r/t.startDist,Qe/(M||1)),Je/(M||1)),a=(n[0].x+n[1].x)/2,m=(n[0].y+n[1].y)/2,b=a-t.rectLeft-i*(t.startMidX-t.rectLeft),D=m-t.rectTop-i*(t.startMidY-t.rectTop),H=et;b=Math.min(t.viewerR-H-t.rectLeft,Math.max(t.viewerL+H-t.rectLeft-i*t.pageW,b)),D=Math.min(t.viewerB-H-t.rectTop,Math.max(t.viewerT+H-t.rectTop-i*t.pageH,D)),t.k=i,t.tx=b,t.ty=D,t.lastMidX=a,t.lastMidY=m,Hn()}},Pt=e=>{if(g.current.delete(e.pointerId),g.current.size>=2)return;let t=G.current;if(G.current=null,!t)return;E.current&&(cancelAnimationFrame(E.current),E.current=0);let n=ne.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};ne.current=null;let r=Dn(M*n.k);if(Math.abs(r-M)<.001){let a=Y.current;Et(),a&&(a.scrollLeft-=n.tx,a.scrollTop-=n.ty);return}let i=Y.current;if(i){let a=i.getBoundingClientRect();q.current={u:(n.midX-t.rectLeft-n.tx)/n.k,v:(n.midY-t.rectTop-n.ty)/n.k,offX:n.midX-a.left,offY:n.midY-a.top,factor:r/(M||1)}}if(Bn()){let a=U();a&&(a.style.transform="",a.style.visibility="hidden")}B(r),Math.round(Math.min(Ne*r,_t))===$e&&requestAnimationFrame(()=>Ft())},ve=h(!0),Ye=h(null),St=()=>{let e=Y.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},Ft=()=>{let e=q.current;if(!e)return;q.current=null;let t=Y.current,n=U();if(!t||!n)return;Rt(),n.style.transform="",n.style.willChange="auto";let r=n.getBoundingClientRect(),i=t.getBoundingClientRect();t.scrollLeft+=r.left-i.left+e.u*e.factor-e.offX,t.scrollTop+=r.top-i.top+e.v*e.factor-e.offY;let a=[...g.current.values()];a.length>=2&&Dt(a)},Bt=()=>{let e=`${k}:${X}`;if(q.current){Ye.current=e,Ft();return}(ve.current||Ye.current!==e)&&(ve.current=!1,Ye.current=e,St())};z(()=>()=>{E.current&&cancelAnimationFrame(E.current)},[]);let Ht=()=>{Q(e=>e-90)},zt=()=>{Q(e=>e+90)},At=()=>{let e=I(s?.name||"",C);Et(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?le(14):e==="pdf"?(B(1),M===1&&X===0?St():ve.current=!0):(Tt(),V.current={scale:1,tx:0,ty:0,rotation:0},O(!0),B(1)),Q(0)},Vt=(e,t)=>{yt(!0),wn({x:e.clientX,y:e.clientY}),vn({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Wt=w((e,t)=>{if(!pe)return;let n=e.clientX-Xe.x,r=e.clientY-Xe.y;t.scrollLeft=_e.x-n,t.scrollTop=_e.y-r,e.preventDefault()},[pe,Xe,_e]),Oe=w(()=>{yt(!1),document.body.style.cursor="default"},[]);z(()=>{if(pe){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(r=>{Wt(t,r)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",Oe),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",Oe),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[pe,Wt,Oe]);let Vn=w(()=>{Ie(!1),tt(!1)},[]),Ue=w(async(e,t)=>{ue(!0),Be(!0);try{await new Promise(m=>setTimeout(m,500));let n=e.Sheets[t],r=re.utils.decode_range(n["!ref"]||"A1");console.debug("Excel range:",r);let a=re.utils.sheet_to_json(n,{header:1,range:r,defval:""}).map(m=>m.map(b=>({value:b!=null?String(b):""})));ee(a),await new Promise(m=>setTimeout(m,200))}catch(n){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",n)}finally{Be(!1)}},[]),Wn=w(()=>{ue(!1)},[]),Xn=w(e=>{Fe&&(Se(e),Ue(Fe,e))},[Fe,Ue]),Xt=()=>{Tt(),V.current={scale:1,tx:0,ty:0,rotation:0},de(""),v&&URL.revokeObjectURL(v),fe.current=null,Re(""),se(""),ce(""),ee([]),st([]),Se(""),lt(null),ue(!1),B(1),Q(0),ae(""),dt(void 0),j(1),pt("portrait"),ft(0),ht(0),c()};if(!s)return null;let y=I(s.name,C),_n=((yn+X)%360+360)%360,Me=X%180===0?ze:ze>0?1/ze:0,jn=Math.max(te.width-un,dn),Yn=Math.max(te.height-un,dn),Ne=te.width>0&&Me>0?Math.min(jn,Yn*Me):me==="portrait"?600:800,On=typeof window<"u"&&window.devicePixelRatio||1,_t=Fo/On*(Me>0?Math.min(1,Me):1),$e=Math.round(Math.min(Ne*M,_t)),jt=Math.round(Ne*M),Un=jt>$e,Nn=Math.max(16,Math.round(te.width)-et),$n=Math.max(16,Math.round(te.height)-et),Gn=me==="landscape"?"200px":"150px",qn=me==="landscape"?.18:.17,Yt=()=>T?o(u,{ref:Ae,sx:{width:Gn,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:T},(e,t)=>p(u,{ref:n=>{xt.current[t]=n},children:[o(u,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:k===t+1?"2px solid":"1px solid",borderColor:k===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:me==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{j(t+1),f&&He(!1)},children:o(an,{file:v,options:wt,loading:o("div",{style:{display:"none"}}),children:o(sn,{pageNumber:t+1,scale:qn,loading:o("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),o(R,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:k===t+1?"primary.main":"",fontWeight:k===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,Kn=()=>{let e=I(s?.name||"",C);if(Le&&!(e==="spreadsheet"))return o(u,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:o(cn,{visible:ie,exitDelay:100,onComplete:Vn})});if(nt)return p(u,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[o(R,{color:"error",variant:"h6",children:nt}),o(R,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]});if(!v)return null;switch(e){case"image":return o(u,{ref:je,"data-allow-pinch":"true",onPointerDown:Sn,onPointerMove:Fn,onPointerUp:kt,onPointerCancel:kt,sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"hidden",height:"100%",backgroundColor:"grey.100",p:2,touchAction:"none",overscrollBehavior:"contain",userSelect:"none","&:active":{cursor:"grabbing"}},children:o("img",{ref:Pn,src:v,alt:s.name,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",transform:"translate(0px, 0px) scale(1) rotate(0deg)",transformOrigin:"center center",pointerEvents:"none"}})});case"pdf":return p(oe,{children:[p(u,{ref:Lt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!f&&Yt(),o(u,{ref:bn,className:"draggable-scroll",onMouseDown:n=>{let r=n.currentTarget;Vt(n,r)},"data-allow-pinch":"true",onPointerDown:zn,onPointerMove:An,onPointerUp:Pt,onPointerCancel:Pt,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:f?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...f&&{px:`${Nn}px`,py:`${$n}px`},...Un&&{"& .react-pdf__Page__canvas":{width:`${jt}px !important`,height:"auto !important"}}}},children:o(an,{file:v,onLoadSuccess:Cn,onLoadError:n=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",n),ae("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:o("div",{style:{display:"none"}}),error:p(u,{sx:{textAlign:"center",p:4},children:[o(R,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),o(R,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:wt,children:o(sn,{pageNumber:k,width:$e,rotate:X===0?void 0:_n,loading:o("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Tn,onRenderSuccess:Bt,onRenderError:Bt})})})]}),f&&o(co,{anchor:"left",open:xn,onClose:()=>He(!1),sx:{zIndex:n=>n.zIndex.modal+2},children:Yt()})]});case"text":case"code":return o(u,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:rt?o(u,{sx:{flex:1,height:"100%",overflow:"hidden"},children:o(ln,{height:"100%",language:qe(s.name),value:rt,theme:"vs-dark",loading:!1,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:J,lineHeight:Math.round(J*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(n,r)=>{n.onDidAttemptReadOnlyEdit(()=>{});let i=n.getDomNode();if(i){let a=document.createElement("style");a.textContent=`
1
+ import{useState as m,useEffect as V,useMemo as mr,useCallback as v,useRef as g}from"react";import{Dialog as pr,DialogTitle as hr,DialogContent as fr,Drawer as gr,IconButton as P,Box as d,Typography as R,Tooltip as S,Button as no,Tabs as xr,Tab as yr,Menu as br,MenuItem as Le,Snackbar as vr,ListItemIcon as Re,ListItemText as Fe,useMediaQuery as wr,useTheme as Mr}from"@mui/material";import Cr from"@mui/icons-material/Close";import Tr from"@mui/icons-material/Menu";import Ir from"@mui/icons-material/MoreHoriz";import io from"@mui/icons-material/Download";import kr from"@mui/icons-material/Add";import Lr from"@mui/icons-material/Remove";import ao from"@mui/icons-material/RotateLeft";import so from"@mui/icons-material/RotateRight";import co from"@mui/icons-material/FitScreen";import Rr from"@mui/icons-material/KeyboardArrowLeft";import Fr from"@mui/icons-material/KeyboardArrowRight";import Er from"@mui/icons-material/TextSnippet";import Pr from"@mui/icons-material/VideoFile";import Sr from"@mui/icons-material/AudioFile";import Dr from"@mui/icons-material/Description";import Br from"@mui/icons-material/InsertDriveFile";import lo from"@mui/icons-material/Code";import Hr from"@mui/icons-material/TableView";import{Document as uo,Page as mo,pdfjs as zr}from"react-pdf";import po from"@monaco-editor/react";import Vr from"react-spreadsheet";import*as ce from"xlsx";import{LoadingProgress as ho}from"@ehfuse/mui-fadeout-loading-progress";var tt=s=>{let l=s.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(l)?"image":l==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(l)?"text":["csv","xls","xlsx"].includes(l)?"spreadsheet":["html","htm"].includes(l)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(l)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(l)?"video":["mp3","wav","ogg","m4a","aac"].includes(l)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(l)?"office":"unsupported"},eo=s=>{let l=(s||"").toLowerCase().split(";")[0].trim();return l?l.startsWith("image/")?"image":l==="application/pdf"?"pdf":l.startsWith("video/")?"video":l.startsWith("audio/")?"audio":l==="text/html"?"html":l==="text/csv"||l==="application/vnd.ms-excel"||l==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":l.startsWith("text/")||l==="application/json"||l==="application/xml"?"text":"unsupported":"unsupported"},M=(s,l)=>{let i=tt(s);return i!=="unsupported"?i:eo(l)},ir=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),ar=s=>ir.has(tt(s)),sr={"image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-excel":"xls","text/csv":"csv","text/plain":"txt","application/json":"json","text/xml":"xml","application/xml":"xml","text/html":"html","video/mp4":"mp4","video/webm":"webm","audio/mpeg":"mp3","audio/wav":"wav"},cr=(s,l)=>{let i=(s??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(i))return i;let u=(l??"").trim().toLowerCase().split(";")[0],_=sr[u]??"";return _?`${i}.${_}`:i},ot=s=>{let l=s.split(".").pop()?.toLowerCase()||"";return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"scss",less:"less",json:"json",xml:"xml",php:"php",py:"python",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",swift:"swift",kt:"kotlin",scala:"scala",sql:"sql",sh:"shell",bash:"shell",bat:"bat",ps1:"powershell",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",md:"markdown",markdown:"markdown",txt:"plaintext",log:"plaintext",csv:"plaintext"}[l]||"plaintext"};var lr=s=>(s||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",rt=(s,l)=>{let i=URL.createObjectURL(s),u=document.createElement("a");u.href=i,u.download=lr(l),u.rel="noopener",document.body.appendChild(u),u.click(),u.remove(),window.setTimeout(()=>URL.revokeObjectURL(i),6e4)};var to=async s=>{let l=URL.createObjectURL(s);try{let i=await new Promise((B,f)=>{let A=new Image;A.onload=()=>B(A),A.onerror=()=>f(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),A.src=l}),u=document.createElement("canvas");u.width=i.naturalWidth||i.width||1024,u.height=i.naturalHeight||i.height||1024;let _=u.getContext("2d");if(!_)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return _.drawImage(i,0,0,u.width,u.height),await new Promise((B,f)=>{u.toBlob(A=>A?B(A):f(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(l)}};import{useMediaQuery as dr,useTheme as ur}from"@mui/material";function oo(){let s=ur();return!dr(s.breakpoints.up("lg"))}import{jsx as Q,jsxs as ro}from"react/jsx-runtime";function J(s){return ro("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:s.width||"22px",...s,children:[Q("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),Q("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),Q("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),Q("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),ro("g",{children:[Q("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),Q("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}import{jsx as L,jsxs as nt}from"react/jsx-runtime";function ee(s){return L("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:s.width||"28px",...s,children:nt("g",{children:[L("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),L("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),nt("g",{children:[nt("g",{children:[L("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),L("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),L("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),L("g",{children:L("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),L("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),L("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),L("g",{children:L("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}import{Fragment as se,jsx as r,jsxs as h}from"react/jsx-runtime";var Ar="/pdfjs",fo=32,go=240,Xr=8192,it=.25,at=8,st=80,xo=80,Wr=s=>{switch(s){case"image":return r(J,{});case"pdf":return r(ee,{});case"text":return r(Er,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return r(Hr,{sx:{mr:1,color:"#4CAF50"}});case"html":return r(lo,{sx:{mr:1,color:"#E91E63"}});case"code":return r(lo,{sx:{mr:1,color:"#2196F3"}});case"video":return r(Pr,{sx:{mr:1,color:"#AB47BC"}});case"audio":return r(Sr,{sx:{mr:1,color:"#FF7043"}});case"office":return r(Dr,{sx:{mr:1,color:"#FFA726"}});default:return r(Br,{sx:{mr:1,color:"#78909C"}})}},yo=s=>typeof s?.rotate=="number"?s.rotate:typeof s?._pageInfo?.rotate=="number"?s._pageInfo.rotate:0,bo=({open:s,onClose:l,file:i,loadFile:u,onDownload:_,pdfAssetBase:B=Ar})=>{let f=oo(),A=Mr(),te=wr(A.breakpoints.down("sm")),[le,De]=m(!0),[Be,ct]=m(!1),[w,He]=m(""),[C,H]=m(1),[j,oe]=m(0),[lt,de]=m(""),[T,dt]=m(""),[ut,ue]=m(""),[re,me]=m(14),[ze,pe]=m(""),[Ve,mt]=m("preview"),[Ae,ne]=m([]),[pt,ht]=m([]),[Mo,Xe]=m(""),[We,ft]=m(null),[gt,he]=m(!1),[Co,_e]=m(!0),[xt,fe]=m(""),[I,yt]=m(),[k,O]=m(1),[To,je]=m(!1),[bt,G]=m(null),[ge,vt]=m("portrait"),[Io,wt]=m(0),[Ye,Mt]=m(0),[ie,Ct]=m({width:0,height:0}),Tt=g([]),Oe=g(null),U=g(null),Ue=g(null),Ne=g(null),ko=v(e=>{if(Ue.current?.disconnect(),Ne.current?.(),Ne.current=null,U.current=e,!e){Ue.current=null;return}let t=a=>{a.touches.length>=2&&a.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),Ne.current=()=>e.removeEventListener("touchmove",t);let o=new ResizeObserver(a=>{let c=a[0]?.contentRect;c&&Ct({width:c.width,height:c.height})});o.observe(e),Ue.current=o;let n=e.getBoundingClientRect();Ct({width:n.width,height:n.height})},[]),[xe,It]=m(!1),[$e,Lo]=m({x:0,y:0}),[Ge,Ro]=m({x:0,y:0}),Fo=v(async(e,t)=>{let o=URL.createObjectURL(e);He(o),dt(e.type||"");let n=M(t,e.type||"");if(n==="text"||n==="code"){let c=await e.text();ue(c);return}if(n==="html"){let c=await e.text();pe(c);return}if(n!=="spreadsheet")return;let a=t.split(".").pop()?.toLowerCase()||"";if(a==="csv"){let p=(await e.text()).split(`
2
+ `).map(b=>b.split(",").map(E=>({value:E.trim()})));ne(p);return}if(a==="xls"||a==="xlsx"){he(!0),_e(!0);let c=await e.arrayBuffer(),p=ce.read(c,{type:"array"});ht(p.SheetNames),ft(p);let b=p.SheetNames[0];Xe(b),Qe(p,b)}},[]),ye=g(null),kt=v(async e=>{if(e.blob)return e.blob;if(u)return await u(e);if(e.url){let t=await fetch(e.url);if(!t.ok)throw new Error("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return await t.blob()}throw new Error("\uD30C\uC77C \uB370\uC774\uD130 \uC18C\uC2A4(blob/url/loadFile)\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")},[u]);V(()=>(i&&s?Do():(w&&URL.revokeObjectURL(w),ye.current=null,He(""),ue(""),pe(""),ne([]),me(14),H(1),oe(0)),()=>{w&&URL.revokeObjectURL(w)}),[i,s]);let Eo=({numPages:e})=>{yt(e),O(1),Ie.current=!0},Po=e=>{let{width:t,height:o}=So(e);wt(yo(e)),t>0&&o>0&&Mt(t/o);let n=t>o?"landscape":"portrait";vt(n)},So=e=>{let t=e?.width||0,o=e?.height||0,n=yo(e);try{if(typeof e?.getViewport=="function"){let a=e.getViewport({scale:1,rotation:n});t=a.width,o=a.height}}catch(a){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",a)}return{width:t,height:o}},be=v(()=>{O(e=>Math.max(e-1,1))},[]),ve=v(()=>{O(e=>Math.min(e+1,I||1))},[I]),Lt=mr(()=>({cMapUrl:`${B}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${B}/standard_fonts/`,wasmUrl:`${B}/wasm/`}),[B]);V(()=>{typeof window>"u"||(zr.GlobalWorkerOptions.workerSrc=`${B}/pdf.worker.min.mjs`)},[B]),V(()=>{if(!s||M(i?.name||"",T)!=="pdf")return;let e=o=>{switch(o.key){case"ArrowLeft":case"ArrowUp":o.preventDefault(),be();break;case"ArrowRight":case"ArrowDown":o.preventDefault(),ve();break;case"Home":o.preventDefault(),O(1);break;case"End":o.preventDefault(),I&&O(I);break}},t=o=>{o.ctrlKey||Math.abs(o.deltaY)>50&&(o.preventDefault(),o.deltaY>0?ve():be())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[s,i,T,be,ve,I]),V(()=>{if(!I||!s||M(i?.name||"",T)!=="pdf")return;if(k===1&&Oe.current){Oe.current.scrollTo({top:0,behavior:"smooth"});return}let e=Tt.current[k-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[s,i,T,I,k]),V(()=>{le&&ct(!0)},[le,Be]);let Do=async()=>{if(i){De(!0),de(""),dt(""),ue(""),pe(""),ne([]);try{let e=await kt(i);ye.current=e,await Fo(e,i.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),de("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{De(!1)}}},Rt=async()=>{if(i)try{if(_){await _(i);return}let e=ye.current??await kt(i);rt(e,i.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},Bo=()=>{let e=i?M(i.name,T):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?me(t=>Math.min(t+2,24)):H(e==="pdf"?t=>Math.min(t+.25,at):t=>Math.min(t+.25,3))},Ho=()=>{let e=i?M(i.name,T):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?me(t=>Math.max(t-2,10)):H(e==="pdf"?t=>Math.max(t-.25,it):t=>Math.max(t-.25,.25))},x=g(new Map),zo=e=>Math.min(Math.max(e,.25),3),Vo=e=>Math.min(Math.max(e,it),at),qe=g(null),we=g(null),X=g({scale:1,tx:0,ty:0,rotation:0}),Y=g(0),q=g(null),Me=g(null),Ce=v((e,t,o,n)=>{let a=qe.current,c=we.current;if(!a||!c)return{tx:t,ty:o};let p=c.offsetWidth,b=c.offsetHeight,E=(Math.round(n/90)%4+4)%4;if(E===1||E===3){let nr=p;p=b,b=nr}let z=p*e,Zt=b*e,Qt=z>a.clientWidth?(z+a.clientWidth)/2-xo:0,Jt=Zt>a.clientHeight?(Zt+a.clientHeight)/2-xo:0;return{tx:Math.min(Qt,Math.max(-Qt,t)),ty:Math.min(Jt,Math.max(-Jt,o))}},[]),Ft=v((e,t)=>{let o=qe.current,n=we.current;if(!o||!n)return e>1;let a=(Math.round(t/90)%4+4)%4,c=a===1||a===3,p=c?n.offsetHeight:n.offsetWidth,b=c?n.offsetWidth:n.offsetHeight;return p*e>o.clientWidth+1||b*e>o.clientHeight+1},[]),N=v(e=>{let t=we.current;if(!t)return;let{scale:o,tx:n,ty:a,rotation:c}=X.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${n}px, ${a}px) scale(${o}) rotate(${c}deg)`},[]),Et=v(()=>{let e=X.current,t=Ce(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!Y.current&&(Y.current=requestAnimationFrame(()=>{Y.current=0,N(!1)}))},[N,Ce]),Pt=v(()=>{Y.current&&(cancelAnimationFrame(Y.current),Y.current=0),x.current.clear(),q.current=null,Me.current=null},[]),Ao=v(e=>{we.current=e,e&&(X.current={scale:1,tx:0,ty:0,rotation:0},N(!1))},[N]);V(()=>{if(M(i?.name||"",T)!=="image")return;let e=X.current;e.scale=C,e.rotation=j;let t=Ce(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,N(!0)},[C,j,i,T,w,N,Ce]),V(()=>()=>{Y.current&&cancelAnimationFrame(Y.current)},[]);let Xo=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),x.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...x.current.values()],o=X.current;if(t.length===2){q.current=null;let n=e.currentTarget.getBoundingClientRect();Me.current={startDist:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,baseScale:o.scale,baseTx:o.tx,baseTy:o.ty,startMidX:(t[0].x+t[1].x)/2,startMidY:(t[0].y+t[1].y)/2,centerX:n.left+n.width/2,centerY:n.top+n.height/2}}else t.length===1&&Ft(o.scale,o.rotation)&&(q.current={startX:e.clientX,startY:e.clientY,baseTx:o.tx,baseTy:o.ty})},Wo=e=>{if(!x.current.has(e.pointerId))return;x.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=X.current,o=Me.current,n=[...x.current.values()];if(o&&n.length>=2){let c=Math.hypot(n[0].x-n[1].x,n[0].y-n[1].y),p=(n[0].x+n[1].x)/2,b=(n[0].y+n[1].y)/2,E=zo(o.baseScale*c/o.startDist),z=E/o.baseScale;t.scale=E,t.tx=p-o.centerX-z*(o.startMidX-o.centerX-o.baseTx),t.ty=b-o.centerY-z*(o.startMidY-o.centerY-o.baseTy),Et();return}let a=q.current;a&&n.length===1&&(t.tx=a.baseTx+(e.clientX-a.startX),t.ty=a.baseTy+(e.clientY-a.startY),Et())},St=e=>{if(!x.current.has(e.pointerId))return;x.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=X.current;if(x.current.size<2&&(Me.current=null,Math.abs(t.scale-C)>.001&&H(t.scale)),x.current.size===0)q.current=null;else if(x.current.size===1&&Ft(t.scale,t.rotation)){let o=[...x.current.values()][0];q.current={startX:o.x,startY:o.y,baseTx:t.tx,baseTy:t.ty}}},Dt=v(async()=>{if(w)try{let t=await(await fetch(w)).blob(),o=t.type==="image/png"?t:await to(t);await navigator.clipboard.write([new ClipboardItem({"image/png":o})]),fe("\uC774\uBBF8\uC9C0\uB97C \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4.")}catch(e){console.error("\uC774\uBBF8\uC9C0 \uBCF5\uC0AC \uC624\uB958:",e),fe("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[w]);V(()=>{if(!s||M(i?.name||"",T)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let o=t.target,n=o?.tagName;n==="INPUT"||n==="TEXTAREA"||o?.isContentEditable||(t.preventDefault(),Dt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s,i,T,Dt]);let K=g(null),F=g(0),ae=g(null),Z=g(null),$=()=>U.current?.querySelector(".react-pdf__Page")??null,Te=g(null),Bt=g(null),_o=()=>{let e=Bt.current,t=$()?.querySelector("canvas");if(!e||!t||!t.width||!t.height)return!1;let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let n=o.getContext("2d");if(!n)return!1;n.drawImage(t,0,0);let a=t.getBoundingClientRect(),c=e.getBoundingClientRect();return Object.assign(o.style,{position:"absolute",left:`${a.left-c.left}px`,top:`${a.top-c.top}px`,width:`${a.width}px`,height:`${a.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(o),Te.current=o,!0},Ht=()=>{Te.current?.remove(),Te.current=null;let e=$();e&&(e.style.visibility="")},jo=()=>{F.current||(F.current=requestAnimationFrame(()=>{F.current=0;let e=K.current,t=$();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,ae.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},zt=()=>{F.current&&(cancelAnimationFrame(F.current),F.current=0),K.current=null,Z.current=null,ae.current=null,Ht();let e=$();e&&(e.style.transform="",e.style.willChange="auto")},Vt=e=>{let t=$(),o=U.current;if(!t||!o)return;t.style.transform&&(t.style.transform="");let n=t.getBoundingClientRect(),a=o.getBoundingClientRect(),c=(e[0].x+e[1].x)/2,p=(e[0].y+e[1].y)/2;K.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:n.left,rectTop:n.top,pageW:n.width,pageH:n.height,viewerL:a.left,viewerT:a.top,viewerR:a.right,viewerB:a.bottom,startMidX:c,startMidY:p,lastMidX:c,lastMidY:p,k:1,tx:0,ty:0},ae.current={k:1,tx:0,ty:0,midX:c,midY:p},t.style.willChange="transform"},Yo=e=>{if(e.pointerType!=="touch")return;x.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...x.current.values()];if(t.length===2){if(Z.current||Te.current)return;Vt(t)}},Oo=e=>{if(!x.current.has(e.pointerId))return;x.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=K.current,o=[...x.current.values()];if(t&&o.length>=2){e.preventDefault();let n=Math.hypot(o[0].x-o[1].x,o[0].y-o[1].y),a=Math.min(Math.max(n/t.startDist,it/(C||1)),at/(C||1)),c=(o[0].x+o[1].x)/2,p=(o[0].y+o[1].y)/2,b=c-t.rectLeft-a*(t.startMidX-t.rectLeft),E=p-t.rectTop-a*(t.startMidY-t.rectTop),z=st;b=Math.min(t.viewerR-z-t.rectLeft,Math.max(t.viewerL+z-t.rectLeft-a*t.pageW,b)),E=Math.min(t.viewerB-z-t.rectTop,Math.max(t.viewerT+z-t.rectTop-a*t.pageH,E)),t.k=a,t.tx=b,t.ty=E,t.lastMidX=c,t.lastMidY=p,jo()}},At=e=>{if(x.current.delete(e.pointerId),x.current.size>=2)return;let t=K.current;if(K.current=null,!t)return;F.current&&(cancelAnimationFrame(F.current),F.current=0);let o=ae.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};ae.current=null;let n=Vo(C*o.k);if(Math.abs(n-C)<.001){let c=U.current;zt(),c&&(c.scrollLeft-=o.tx,c.scrollTop-=o.ty);return}let a=U.current;if(a){let c=a.getBoundingClientRect();Z.current={u:(o.midX-t.rectLeft-o.tx)/o.k,v:(o.midY-t.rectTop-o.ty)/o.k,offX:o.midX-c.left,offY:o.midY-c.top,factor:n/(C||1)}}if(_o()){let c=$();c&&(c.style.transform="",c.style.visibility="hidden")}H(n),Math.round(Math.min(Je*n,Gt))===et&&requestAnimationFrame(()=>Wt())},Ie=g(!0),Ke=g(null),Xt=()=>{let e=U.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},Wt=()=>{let e=Z.current;if(!e)return;Z.current=null;let t=U.current,o=$();if(!t||!o)return;Ht(),o.style.transform="",o.style.willChange="auto";let n=o.getBoundingClientRect(),a=t.getBoundingClientRect();t.scrollLeft+=n.left-a.left+e.u*e.factor-e.offX,t.scrollTop+=n.top-a.top+e.v*e.factor-e.offY;let c=[...x.current.values()];c.length>=2&&Vt(c)},_t=()=>{let e=`${k}:${j}`;if(Z.current){Ke.current=e,Wt();return}(Ie.current||Ke.current!==e)&&(Ie.current=!1,Ke.current=e,Xt())};V(()=>()=>{F.current&&cancelAnimationFrame(F.current)},[]);let jt=()=>{oe(e=>e-90)},Yt=()=>{oe(e=>e+90)},Ot=()=>{let e=M(i?.name||"",T);zt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?me(14):e==="pdf"?(H(1),C===1&&j===0?Xt():Ie.current=!0):(Pt(),X.current={scale:1,tx:0,ty:0,rotation:0},N(!0),H(1)),oe(0)},Ut=(e,t)=>{It(!0),Lo({x:e.clientX,y:e.clientY}),Ro({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Nt=v((e,t)=>{if(!xe)return;let o=e.clientX-$e.x,n=e.clientY-$e.y;t.scrollLeft=Ge.x-o,t.scrollTop=Ge.y-n,e.preventDefault()},[xe,$e,Ge]),Ze=v(()=>{It(!1),document.body.style.cursor="default"},[]);V(()=>{if(xe){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(n=>{Nt(t,n)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",Ze),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",Ze),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[xe,Nt,Ze]);let Uo=v(()=>{De(!1),ct(!1)},[]),Qe=v(async(e,t)=>{he(!0),_e(!0);try{await new Promise(p=>setTimeout(p,500));let o=e.Sheets[t],n=ce.utils.decode_range(o["!ref"]||"A1");console.debug("Excel range:",n);let c=ce.utils.sheet_to_json(o,{header:1,range:n,defval:""}).map(p=>p.map(b=>({value:b!=null?String(b):""})));ne(c),await new Promise(p=>setTimeout(p,200))}catch(o){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",o)}finally{_e(!1)}},[]),No=v(()=>{he(!1)},[]),$o=v(e=>{We&&(Xe(e),Qe(We,e))},[We,Qe]),$t=()=>{Pt(),X.current={scale:1,tx:0,ty:0,rotation:0},fe(""),w&&URL.revokeObjectURL(w),ye.current=null,He(""),ue(""),pe(""),ne([]),ht([]),Xe(""),ft(null),he(!1),H(1),oe(0),de(""),yt(void 0),O(1),vt("portrait"),wt(0),Mt(0),l()};if(!i)return null;let y=M(i.name,T),Go=((Io+j)%360+360)%360,ke=j%180===0?Ye:Ye>0?1/Ye:0,qo=Math.max(ie.width-fo,go),Ko=Math.max(ie.height-fo,go),Je=ie.width>0&&ke>0?Math.min(qo,Ko*ke):ge==="portrait"?600:800,Zo=typeof window<"u"&&window.devicePixelRatio||1,Gt=Xr/Zo*(ke>0?Math.min(1,ke):1),et=Math.round(Math.min(Je*C,Gt)),qt=Math.round(Je*C),Qo=qt>et,Jo=Math.max(16,Math.round(ie.width)-st),er=Math.max(16,Math.round(ie.height)-st),tr=ge==="landscape"?"200px":"150px",or=ge==="landscape"?.18:.17,Kt=()=>I?r(d,{ref:Oe,sx:{width:tr,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:I},(e,t)=>h(d,{ref:o=>{Tt.current[t]=o},children:[r(d,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:k===t+1?"2px solid":"1px solid",borderColor:k===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:ge==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{O(t+1),f&&je(!1)},children:r(uo,{file:w,options:Lt,loading:r("div",{style:{display:"none"}}),children:r(mo,{pageNumber:t+1,scale:or,loading:r("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),r(R,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:k===t+1?"primary.main":"",fontWeight:k===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,rr=()=>{let e=M(i?.name||"",T);if(Be&&!(e==="spreadsheet"))return r(d,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:r(ho,{visible:le,exitDelay:100,onComplete:Uo})});if(lt)return h(d,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[r(R,{color:"error",variant:"h6",children:lt}),r(R,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]});if(!w)return null;switch(e){case"image":return r(d,{ref:qe,"data-allow-pinch":"true",onPointerDown:Xo,onPointerMove:Wo,onPointerUp:St,onPointerCancel:St,sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"hidden",height:"100%",backgroundColor:"grey.100",p:2,touchAction:"none",overscrollBehavior:"contain",userSelect:"none","&:active":{cursor:"grabbing"}},children:r("img",{ref:Ao,src:w,alt:i.name,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",transform:"translate(0px, 0px) scale(1) rotate(0deg)",transformOrigin:"center center",pointerEvents:"none"}})});case"pdf":return h(se,{children:[h(d,{ref:Bt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!f&&Kt(),r(d,{ref:ko,className:"draggable-scroll",onMouseDown:o=>{let n=o.currentTarget;Ut(o,n)},"data-allow-pinch":"true",onPointerDown:Yo,onPointerMove:Oo,onPointerUp:At,onPointerCancel:At,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:f?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...f&&{px:`${Jo}px`,py:`${er}px`},...Qo&&{"& .react-pdf__Page__canvas":{width:`${qt}px !important`,height:"auto !important"}}}},children:r(uo,{file:w,onLoadSuccess:Eo,onLoadError:o=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",o),de("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:r("div",{style:{display:"none"}}),error:h(d,{sx:{textAlign:"center",p:4},children:[r(R,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),r(R,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:Lt,children:r(mo,{pageNumber:k,width:et,rotate:j===0?void 0:Go,loading:r("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Po,onRenderSuccess:_t,onRenderError:_t})})})]}),f&&r(gr,{anchor:"left",open:To,onClose:()=>je(!1),sx:{zIndex:o=>o.zIndex.modal+2},children:Kt()})]});case"text":case"code":return r(d,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:ut?r(d,{sx:{flex:1,height:"100%",overflow:"hidden"},children:r(po,{height:"100%",language:ot(i.name),value:ut,theme:"vs-dark",loading:!1,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:re,lineHeight:Math.round(re*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,n)=>{o.onDidAttemptReadOnlyEdit(()=>{});let a=o.getDomNode();if(a){let c=document.createElement("style");c.textContent=`
3
3
  .monaco-editor .margin-view-overlays {
4
4
  border-right: 1px solid #3c3c3c;
5
5
  }
@@ -27,7 +27,7 @@ import{useState as d,useEffect as z,useMemo as io,useCallback as w,useRef as h}f
27
27
  .monaco-editor .overlay.cursor-layer {
28
28
  padding-left: 15px !important;
29
29
  }
30
- `,i.appendChild(a)}}})}):o(u,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:o(R,{color:"text.secondary",children:"\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"html":return o(u,{sx:{width:"100%",height:"calc(100vh - 60px)",overflow:"hidden",borderRadius:1},children:Ee?p(u,{sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[p(u,{sx:{display:"flex",gap:1,p:1,borderBottom:"1px solid",borderColor:"grey.300",backgroundColor:"grey.50"},children:[o(Jt,{variant:De==="preview"?"contained":"outlined",size:"small",onClick:()=>it("preview"),children:"\uBBF8\uB9AC\uBCF4\uAE30"}),o(Jt,{variant:De==="source"?"contained":"outlined",size:"small",onClick:()=>it("source"),children:"\uC18C\uC2A4\uCF54\uB4DC"})]}),De==="preview"?o(u,{sx:{flex:1,overflow:"auto",backgroundColor:"white",border:"1px solid",borderColor:"grey.300",fontSize:`${J}px`,p:2},dangerouslySetInnerHTML:{__html:Ee}}):o(u,{sx:{flex:1,height:"100%",overflow:"hidden"},children:o(ln,{height:"100%",language:"html",value:Ee,theme:"vs-dark",options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:J,lineHeight:Math.round(J*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(n,r)=>{n.onDidAttemptReadOnlyEdit(()=>{});let i=n.getDomNode();if(i){let a=document.createElement("style");a.textContent=`
30
+ `,a.appendChild(c)}}})}):r(d,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:r(R,{color:"text.secondary",children:"\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"html":return r(d,{sx:{width:"100%",height:"calc(100vh - 60px)",overflow:"hidden",borderRadius:1},children:ze?h(d,{sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[h(d,{sx:{display:"flex",gap:1,p:1,borderBottom:"1px solid",borderColor:"grey.300",backgroundColor:"grey.50"},children:[r(no,{variant:Ve==="preview"?"contained":"outlined",size:"small",onClick:()=>mt("preview"),children:"\uBBF8\uB9AC\uBCF4\uAE30"}),r(no,{variant:Ve==="source"?"contained":"outlined",size:"small",onClick:()=>mt("source"),children:"\uC18C\uC2A4\uCF54\uB4DC"})]}),Ve==="preview"?r(d,{sx:{flex:1,overflow:"auto",backgroundColor:"white",border:"1px solid",borderColor:"grey.300",fontSize:`${re}px`,p:2},dangerouslySetInnerHTML:{__html:ze}}):r(d,{sx:{flex:1,height:"100%",overflow:"hidden"},children:r(po,{height:"100%",language:"html",value:ze,theme:"vs-dark",options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:re,lineHeight:Math.round(re*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,n)=>{o.onDidAttemptReadOnlyEdit(()=>{});let a=o.getDomNode();if(a){let c=document.createElement("style");c.textContent=`
31
31
  .monaco-editor .margin-view-overlays {
32
32
  border-right: 1px solid #3c3c3c;
33
33
  }
@@ -55,4 +55,4 @@ import{useState as d,useEffect as z,useMemo as io,useCallback as w,useRef as h}f
55
55
  .monaco-editor .overlay.cursor-layer {
56
56
  padding-left: 15px !important;
57
57
  }
58
- `,i.appendChild(a)}}})})]}):o(u,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:o(R,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return o(u,{className:"draggable-scroll",onMouseDown:n=>{let r=n.currentTarget;Vt(n,r)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:o("video",{src:v,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${M}) rotate(${X}deg)`,transition:"transform 0.3s ease",pointerEvents:M>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return p(u,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[Pe.length>0||ct?p(u,{sx:{flex:1,position:"relative",overflow:"scroll",backgroundColor:"white",minHeight:"400px",minWidth:"100%","&::-webkit-scrollbar":{width:"18px",height:"18px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#888",borderRadius:"10px",border:"2px solid #f1f1f1","&:hover":{backgroundColor:"#555"}},"&::-webkit-scrollbar-corner":{backgroundColor:"#f1f1f1"}},children:[Pe.length>0&&o(u,{sx:{minWidth:"max-content",minHeight:"max-content"},children:o(Po,{data:Pe,darkMode:!1})}),ct&&o(u,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)",zIndex:1e3},children:o(cn,{visible:gn,exitDelay:200,fadeoutDuration:300,onComplete:Wn})})]}):o(u,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:o(R,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),at.length>1&&o(u,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:o(uo,{value:hn,onChange:(n,r)=>Xn(r),variant:"scrollable",scrollButtons:"auto",sx:{minHeight:"36px","& .MuiTabs-flexContainer":{gap:"6px"},"& .MuiTabs-indicator":{display:"none"},"& .MuiTab-root":{minHeight:"32px",fontSize:"0.875rem",textTransform:"none",padding:"6px 16px",margin:"0",backgroundColor:"white",border:"1px solid #d0d0d0",borderRadius:"0 0 4px 4px",color:"#666",minWidth:"80px",transition:"all 0.2s ease","&:hover":{backgroundColor:"#f8f8f8",color:"#333"},"&.Mui-selected":{backgroundColor:"primary.main",color:"white",border:"1px solid",borderColor:"primary.dark",fontWeight:600,"&:hover":{backgroundColor:"primary.dark"}}}},children:at.map(n=>o(mo,{label:n,value:n},n))})})]});case"audio":return p(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[o(R,{variant:"h6",sx:{mb:2},children:s.name}),o("audio",{src:v,controls:!0,style:{width:"100%",maxWidth:"500px"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC624\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})]});default:return p(u,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[o(R,{variant:"h6",color:"text.secondary",children:"\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4"}),o(R,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]})}};return p(ao,{open:l,onClose:Xt,maxWidth:"lg",fullScreen:!0,children:[p(so,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:f?1:3},onContextMenu:e=>e.preventDefault(),children:[p(u,{sx:{display:"flex",alignItems:"center",gap:Z?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:f?"1.7rem":void 0}},children:[f&&y==="pdf"&&T?o(S,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:o(P,{onClick:()=>He(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:o(yo,{})})}):null,y==="pdf"&&T?p(u,{sx:{display:"flex",alignItems:"center",gap:f?0:.5},children:[o(S,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:o("span",{style:{display:"inline-flex"},children:o(P,{onClick:he,disabled:k<=1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:o(Mo,{})})})}),o(R,{variant:"body2",sx:{minWidth:f?"auto":"80px",textAlign:"center",color:"white",px:f?.5:1,fontSize:f?"1.05rem":void 0,fontWeight:f?600:void 0,whiteSpace:"nowrap"},children:Z?k:`${k} / ${T}`}),o(S,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:o("span",{style:{display:"inline-flex"},children:o(P,{onClick:ge,disabled:k>=T,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:o(Co,{})})})})]}):null]}),o(u,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:Z?0:2,overflow:"hidden"},children:!Z&&p(u,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Bo(y),s.name]})}),p(u,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:Z?.35:1,"& .MuiSvgIcon-root":{fontSize:f?"1.7rem":void 0}},children:[(y==="image"||y==="pdf"||y==="text"||y==="html"||y==="code"||y==="spreadsheet")&&p(oe,{children:[!(f&&(y==="image"||y==="pdf"))&&p(oe,{children:[o(S,{title:"\uD655\uB300",children:o(P,{onClick:Ln,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(wo,{})})}),o(S,{title:"\uCD95\uC18C",children:o(P,{onClick:Rn,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(vo,{})})})]}),!f&&o(S,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:o(P,{onClick:At,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(on,{})})}),!f&&(y==="image"||y==="pdf")&&p(oe,{children:[o(S,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:o(P,{onClick:Ht,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(tn,{})})}),o(S,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:o(P,{onClick:zt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(nn,{})})})]})]}),!f&&o(S,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:o(P,{onClick:vt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(en,{})})}),f&&p(oe,{children:[o(S,{title:"\uB354\uBCF4\uAE30",children:o(P,{onClick:e=>N(e.currentTarget),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:o(bo,{})})}),p(po,{anchorEl:mt,open:!!mt,onClose:()=>N(null),children:[y==="image"||y==="pdf"?p(Ce,{onClick:()=>{At(),N(null)},children:[o(Te,{children:o(on,{fontSize:"small"})}),o(ke,{children:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30"})]}):null,y==="image"||y==="pdf"?p(Ce,{onClick:()=>{Ht(),N(null)},children:[o(Te,{children:o(tn,{fontSize:"small"})}),o(ke,{children:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,y==="image"||y==="pdf"?p(Ce,{onClick:()=>{zt(),N(null)},children:[o(Te,{children:o(nn,{fontSize:"small"})}),o(ke,{children:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,p(Ce,{onClick:()=>{vt(),N(null)},children:[o(Te,{children:o(en,{fontSize:"small"})}),o(ke,{children:"\uB2E4\uC6B4\uB85C\uB4DC"})]})]})]}),o(S,{title:"\uB2EB\uAE30",children:o(P,{onClick:Xt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(xo,{})})})]})]}),o(lo,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:Kn()}),o(fo,{open:!!ut,autoHideDuration:2e3,onClose:()=>de(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:ut,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},Ho=fn;export{fn as FileViewer,Ho as FileViewerDefault,to as ensureFileExtension,qe as getEditorLanguage,Ge as getFileType,$t as getFileTypeFromMime,Jn as isFileViewerPreviewable,I as resolveFileType,Ke as saveBlobAsFile};
58
+ `,a.appendChild(c)}}})})]}):r(d,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:r(R,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return r(d,{className:"draggable-scroll",onMouseDown:o=>{let n=o.currentTarget;Ut(o,n)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:r("video",{src:w,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${C}) rotate(${j}deg)`,transition:"transform 0.3s ease",pointerEvents:C>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return h(d,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[Ae.length>0||gt?h(d,{sx:{flex:1,position:"relative",overflow:"scroll",backgroundColor:"white",minHeight:"400px",minWidth:"100%","&::-webkit-scrollbar":{width:"18px",height:"18px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#888",borderRadius:"10px",border:"2px solid #f1f1f1","&:hover":{backgroundColor:"#555"}},"&::-webkit-scrollbar-corner":{backgroundColor:"#f1f1f1"}},children:[Ae.length>0&&r(d,{sx:{minWidth:"max-content",minHeight:"max-content"},children:r(Vr,{data:Ae,darkMode:!1})}),gt&&r(d,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)",zIndex:1e3},children:r(ho,{visible:Co,exitDelay:200,fadeoutDuration:300,onComplete:No})})]}):r(d,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:r(R,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),pt.length>1&&r(d,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:r(xr,{value:Mo,onChange:(o,n)=>$o(n),variant:"scrollable",scrollButtons:"auto",sx:{minHeight:"36px","& .MuiTabs-flexContainer":{gap:"6px"},"& .MuiTabs-indicator":{display:"none"},"& .MuiTab-root":{minHeight:"32px",fontSize:"0.875rem",textTransform:"none",padding:"6px 16px",margin:"0",backgroundColor:"white",border:"1px solid #d0d0d0",borderRadius:"0 0 4px 4px",color:"#666",minWidth:"80px",transition:"all 0.2s ease","&:hover":{backgroundColor:"#f8f8f8",color:"#333"},"&.Mui-selected":{backgroundColor:"primary.main",color:"white",border:"1px solid",borderColor:"primary.dark",fontWeight:600,"&:hover":{backgroundColor:"primary.dark"}}}},children:pt.map(o=>r(yr,{label:o,value:o},o))})})]});case"audio":return h(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[r(R,{variant:"h6",sx:{mb:2},children:i.name}),r("audio",{src:w,controls:!0,style:{width:"100%",maxWidth:"500px"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC624\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})]});default:return h(d,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[r(R,{variant:"h6",color:"text.secondary",children:"\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4"}),r(R,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]})}};return h(pr,{open:s,onClose:$t,maxWidth:"lg",fullScreen:!0,children:[h(hr,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:f?1:3},onContextMenu:e=>e.preventDefault(),children:[h(d,{sx:{display:"flex",alignItems:"center",gap:te?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:f?"1.7rem":void 0}},children:[f&&y==="pdf"&&I?r(S,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:r(P,{onClick:()=>je(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:r(Tr,{})})}):null,y==="pdf"&&I?h(d,{sx:{display:"flex",alignItems:"center",gap:f?0:.5},children:[r(S,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:r("span",{style:{display:"inline-flex"},children:r(P,{onClick:be,disabled:k<=1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:r(Rr,{})})})}),r(R,{variant:"body2",sx:{minWidth:f?"auto":"80px",textAlign:"center",color:"white",px:f?.5:1,fontSize:f?"1.05rem":void 0,fontWeight:f?600:void 0,whiteSpace:"nowrap"},children:te?k:`${k} / ${I}`}),r(S,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:r("span",{style:{display:"inline-flex"},children:r(P,{onClick:ve,disabled:k>=I,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:r(Fr,{})})})})]}):null]}),r(d,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:te?0:2,overflow:"hidden"},children:!te&&h(d,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Wr(y),i.name]})}),h(d,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:te?.35:1,"& .MuiSvgIcon-root":{fontSize:f?"1.7rem":void 0}},children:[(y==="image"||y==="pdf"||y==="text"||y==="html"||y==="code"||y==="spreadsheet")&&h(se,{children:[!(f&&(y==="image"||y==="pdf"))&&h(se,{children:[r(S,{title:"\uD655\uB300",children:r(P,{onClick:Bo,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(kr,{})})}),r(S,{title:"\uCD95\uC18C",children:r(P,{onClick:Ho,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Lr,{})})})]}),!f&&r(S,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:r(P,{onClick:Ot,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(co,{})})}),!f&&(y==="image"||y==="pdf")&&h(se,{children:[r(S,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:r(P,{onClick:jt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(ao,{})})}),r(S,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:r(P,{onClick:Yt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(so,{})})})]})]}),!f&&r(S,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:r(P,{onClick:Rt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(io,{})})}),f&&h(se,{children:[r(S,{title:"\uB354\uBCF4\uAE30",children:r(P,{onClick:e=>G(e.currentTarget),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:r(Ir,{})})}),h(br,{anchorEl:bt,open:!!bt,onClose:()=>G(null),children:[y==="image"||y==="pdf"?h(Le,{onClick:()=>{Ot(),G(null)},children:[r(Re,{children:r(co,{fontSize:"small"})}),r(Fe,{children:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30"})]}):null,y==="image"||y==="pdf"?h(Le,{onClick:()=>{jt(),G(null)},children:[r(Re,{children:r(ao,{fontSize:"small"})}),r(Fe,{children:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,y==="image"||y==="pdf"?h(Le,{onClick:()=>{Yt(),G(null)},children:[r(Re,{children:r(so,{fontSize:"small"})}),r(Fe,{children:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,h(Le,{onClick:()=>{Rt(),G(null)},children:[r(Re,{children:r(io,{fontSize:"small"})}),r(Fe,{children:"\uB2E4\uC6B4\uB85C\uB4DC"})]})]})]}),r(S,{title:"\uB2EB\uAE30",children:r(P,{onClick:$t,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Cr,{})})})]})]}),r(fr,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:rr()}),r(vr,{open:!!xt,autoHideDuration:2e3,onClose:()=>fe(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:xt,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},_r=bo;import{jsx as vo}from"react/jsx-runtime";function Ee(s){return vo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:s.width||"22px",fill:s.fill||"#E91E63",...s,children:vo("path",{d:"M488.426,197.019H475.2v-63.816c0-0.401-0.063-0.799-0.116-1.205c-0.021-2.534-0.827-5.023-2.562-6.992L366.325,3.691 c-0.032-0.031-0.063-0.042-0.085-0.073c-0.633-0.707-1.371-1.298-2.151-1.804c-0.231-0.158-0.464-0.287-0.706-0.422 c-0.676-0.366-1.393-0.675-2.131-0.896c-0.2-0.053-0.38-0.135-0.58-0.19C359.87,0.119,359.037,0,358.193,0H97.2 c-11.918,0-21.6,9.693-21.6,21.601v175.413H62.377c-17.049,0-30.873,13.818-30.873,30.87v160.542 c0,17.044,13.824,30.876,30.873,30.876h13.224V529.2c0,11.907,9.682,21.601,21.6,21.601h356.4c11.907,0,21.6-9.693,21.6-21.601 V419.302h13.226c17.044,0,30.871-13.827,30.871-30.87V227.89C519.297,210.838,505.47,197.019,488.426,197.019z M97.2,21.605 h250.193v110.51c0,5.967,4.841,10.8,10.8,10.8h95.407v54.108H97.2V21.605z M406.467,363.983h-26.104l-1.751-46.464 c-0.527-14.598-1.055-32.236-1.055-49.895h-0.517c-3.691,15.485-8.596,32.782-13.163,47.015l-14.354,47.366h-20.851l-12.625-47.002 c-3.85-14.228-7.889-31.524-10.694-47.374h-0.348c-0.707,16.397-1.234,35.129-2.1,50.253l-2.114,46.111h-24.711l7.535-121.395 h35.575l11.569,40.521c3.691,14.048,7.362,29.183,9.999,43.416h0.521c3.344-14.054,7.356-30.074,11.222-43.585l12.614-40.353 h34.879L406.467,363.983z M174.438,265.642v-23.058h90.77v23.058h-32.239v98.342h-26.821v-98.342H174.438z M89.403,313.195v50.788 H62.604V242.584h26.799v46.654h43.999v-46.654h26.645v121.399h-26.645v-50.794H89.403V313.195z M453.601,523.353H97.2V419.302 h356.4V523.353z M500.787,363.983h-73.786V242.584h26.811v98.339h46.976V363.983z"})})}import{jsx as W,jsxs as jr}from"react/jsx-runtime";function Pe(s){return jr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:s.width||"22px",fill:s.fill||"#B45309",...s,children:[W("path",{d:"M475.095,131.992c-0.032-2.526-0.833-5.021-2.568-6.993L366.324,3.694c-0.021-0.034-0.053-0.045-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.422c-0.686-0.366-1.393-0.67-2.131-0.892 c-0.2-0.058-0.379-0.14-0.58-0.192C359.87,0.114,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.202 C475.2,132.796,475.137,132.398,475.095,131.992z M243.599,523.494H141.75v-15.936l62.398-89.797v-0.785h-56.565v-24.484h95.051 v17.106l-61.038,88.636v0.771h62.002V523.494z M292.021,523.494h-29.744V392.492h29.744V523.494z M399.705,463.44 c-10.104,9.524-25.069,13.796-42.566,13.796c-3.893,0-7.383-0.19-10.104-0.58v46.849h-29.352V394.242 c9.134-1.561,21.958-2.721,40.036-2.721c18.277,0,31.292,3.491,40.046,10.494c8.354,6.607,13.996,17.486,13.996,30.322 C411.761,445.163,407.479,456.053,399.705,463.44z M97.2,366.752V21.601h129.167v-3.396h32.756v3.396h88.28v110.515 c0,5.961,4.831,10.8,10.8,10.8H453.6l0.011,223.836H97.2z"}),W("path",{d:"M359.279,413.87c-6.033,0-10.114,0.586-12.245,1.171v38.676c2.521,0.585,5.632,0.785,9.914,0.785 c15.736,0,25.46-7.979,25.46-21.378C382.408,421.063,374.045,413.87,359.279,413.87z"}),W("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),W("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),W("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),W("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),W("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),W("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),W("path",{d:"M259.124,149.537c-23.193,0-34.225,18.792-34.225,41.99l-7.765,70.348c0,23.198,18.792,42.003,41.984,42.003 c23.19,0,41.974-18.805,41.974-42.003l-7.741-70.348C293.361,168.334,282.318,149.537,259.124,149.537z M273.04,285.431h-27.799 v-58.728h27.799V285.431z"})]})}import Yr from"@mui/icons-material/TextSnippet";import Or from"@mui/icons-material/VideoFile";import Ur from"@mui/icons-material/AudioFile";import Nr from"@mui/icons-material/Description";import $r from"@mui/icons-material/InsertDriveFile";import Gr from"@mui/icons-material/Code";import qr from"@mui/icons-material/TableView";import{jsx as D}from"react/jsx-runtime";function Se(s,l=22){let i=`${l}px`,u={fontSize:l};switch(s){case"image":return D(J,{width:i,height:i});case"pdf":return D(ee,{width:i,height:i});case"html":return D(Ee,{width:i,height:i});case"archive":return D(Pe,{width:i,height:i});case"text":return D(Yr,{sx:{...u,color:"#66BB6A"}});case"spreadsheet":return D(qr,{sx:{...u,color:"#4CAF50"}});case"code":return D(Gr,{sx:{...u,color:"#2196F3"}});case"video":return D(Or,{sx:{...u,color:"#AB47BC"}});case"audio":return D(Ur,{sx:{...u,color:"#FF7043"}});case"office":return D(Nr,{sx:{...u,color:"#FFA726"}});default:return D($r,{sx:{...u,color:"#78909C"}})}}var Kr=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function wo({fileName:s,mime:l,size:i=22}){let u=s.includes(".")?s.slice(s.lastIndexOf(".")+1).toLowerCase():"";return Kr.has(u)?Se("archive",i):Se(M(s,l??""),i)}export{wo as FileTypeIcon,bo as FileViewer,_r as FileViewerDefault,Ee as HtmlIcon,J as ImageIcon,ee as PdfIcon,Pe as ZipIcon,cr as ensureFileExtension,ot as getEditorLanguage,tt as getFileType,eo as getFileTypeFromMime,Se as getFileTypeIcon,ar as isFileViewerPreviewable,M as resolveFileType,rt as saveBlobAsFile};
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";var ro=Object.create;var xe=Object.defineProperty;var io=Object.getOwnPropertyDescriptor;var ao=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,lo=Object.prototype.hasOwnProperty;var co=(l,d)=>{for(var c in d)xe(l,c,{get:d[c],enumerable:!0})},Gt=(l,d,c,f)=>{if(d&&typeof d=="object"||typeof d=="function")for(let v of ao(d))!lo.call(l,v)&&v!==c&&xe(l,v,{get:()=>d[v],enumerable:!(f=io(d,v))||f.enumerable});return l};var h=(l,d,c)=>(c=l!=null?ro(so(l)):{},Gt(d||!l||!l.__esModule?xe(c,"default",{value:l,enumerable:!0}):c,l)),uo=l=>Gt(xe({},"__esModule",{value:!0}),l);var yo={};co(yo,{FileViewer:()=>tt,FileViewerDefault:()=>wn,ensureFileExtension:()=>Kt,getEditorLanguage:()=>be,getFileType:()=>ye,getFileTypeFromMime:()=>Oe,isFileViewerPreviewable:()=>qt,resolveFileType:()=>I,saveBlobAsFile:()=>we});module.exports=uo(yo);var i=require("react"),r=require("@mui/material"),an=h(require("@mui/icons-material/Close"),1),sn=h(require("@mui/icons-material/Menu"),1),ln=h(require("@mui/icons-material/MoreHoriz"),1),Ge=h(require("@mui/icons-material/Download"),1),cn=h(require("@mui/icons-material/Add"),1),un=h(require("@mui/icons-material/Remove"),1),qe=h(require("@mui/icons-material/RotateLeft"),1),Ke=h(require("@mui/icons-material/RotateRight"),1),Ze=h(require("@mui/icons-material/FitScreen"),1),dn=h(require("@mui/icons-material/KeyboardArrowLeft"),1),mn=h(require("@mui/icons-material/KeyboardArrowRight"),1),pn=h(require("@mui/icons-material/TextSnippet"),1),fn=h(require("@mui/icons-material/VideoFile"),1),hn=h(require("@mui/icons-material/AudioFile"),1),gn=h(require("@mui/icons-material/Description"),1),xn=h(require("@mui/icons-material/InsertDriveFile"),1),Qe=h(require("@mui/icons-material/Code"),1),yn=h(require("@mui/icons-material/TableView"),1),A=require("react-pdf"),Je=h(require("@monaco-editor/react"),1),bn=h(require("react-spreadsheet"),1),Q=h(require("xlsx"),1),et=require("@ehfuse/mui-fadeout-loading-progress");var ye=l=>{let d=l.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(d)?"image":d==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(d)?"text":["csv","xls","xlsx"].includes(d)?"spreadsheet":["html","htm"].includes(d)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(d)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(d)?"video":["mp3","wav","ogg","m4a","aac"].includes(d)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(d)?"office":"unsupported"},Oe=l=>{let d=(l||"").toLowerCase().split(";")[0].trim();return d?d.startsWith("image/")?"image":d==="application/pdf"?"pdf":d.startsWith("video/")?"video":d.startsWith("audio/")?"audio":d==="text/html"?"html":d==="text/csv"||d==="application/vnd.ms-excel"||d==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":d.startsWith("text/")||d==="application/json"||d==="application/xml"?"text":"unsupported":"unsupported"},I=(l,d)=>{let c=ye(l);return c!=="unsupported"?c:Oe(d)},mo=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),qt=l=>mo.has(ye(l)),po={"image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-excel":"xls","text/csv":"csv","text/plain":"txt","application/json":"json","text/xml":"xml","application/xml":"xml","text/html":"html","video/mp4":"mp4","video/webm":"webm","audio/mpeg":"mp3","audio/wav":"wav"},Kt=(l,d)=>{let c=(l??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(c))return c;let f=(d??"").trim().toLowerCase().split(";")[0],v=po[f]??"";return v?`${c}.${v}`:c},be=l=>{let d=l.split(".").pop()?.toLowerCase()||"";return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"scss",less:"less",json:"json",xml:"xml",php:"php",py:"python",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",swift:"swift",kt:"kotlin",scala:"scala",sql:"sql",sh:"shell",bash:"shell",bat:"bat",ps1:"powershell",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",md:"markdown",markdown:"markdown",txt:"plaintext",log:"plaintext",csv:"plaintext"}[d]||"plaintext"};var fo=l=>(l||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",we=(l,d)=>{let c=URL.createObjectURL(l),f=document.createElement("a");f.href=c,f.download=fo(d),f.rel="noopener",document.body.appendChild(f),f.click(),f.remove(),window.setTimeout(()=>URL.revokeObjectURL(c),6e4)};var Zt=async l=>{let d=URL.createObjectURL(l);try{let c=await new Promise((E,p)=>{let F=new Image;F.onload=()=>E(F),F.onerror=()=>p(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),F.src=d}),f=document.createElement("canvas");f.width=c.naturalWidth||c.width||1024,f.height=c.naturalHeight||c.height||1024;let v=f.getContext("2d");if(!v)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return v.drawImage(c,0,0,f.width,f.height),await new Promise((E,p)=>{f.toBlob(F=>F?E(F):p(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(d)}};var ve=require("@mui/material");function Qt(){let l=(0,ve.useTheme)();return!(0,ve.useMediaQuery)(l.breakpoints.up("lg"))}var S=require("react/jsx-runtime");function Jt(l){return(0,S.jsxs)("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:l.width||"22px",...l,children:[(0,S.jsx)("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),(0,S.jsx)("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),(0,S.jsx)("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),(0,S.jsx)("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),(0,S.jsxs)("g",{children:[(0,S.jsx)("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),(0,S.jsx)("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}var b=require("react/jsx-runtime");function en(l){return(0,b.jsx)("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:l.width||"28px",...l,children:(0,b.jsxs)("g",{children:[(0,b.jsx)("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),(0,b.jsx)("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),(0,b.jsxs)("g",{children:[(0,b.jsxs)("g",{children:[(0,b.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),(0,b.jsx)("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),(0,b.jsx)("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),(0,b.jsx)("g",{children:(0,b.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),(0,b.jsx)("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),(0,b.jsx)("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),(0,b.jsx)("g",{children:(0,b.jsx)("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}var n=require("react/jsx-runtime");var ho="/pdfjs",tn=32,nn=240,go=8192,Ue=.25,Ne=8,$e=80,on=80,xo=l=>{switch(l){case"image":return(0,n.jsx)(Jt,{});case"pdf":return(0,n.jsx)(en,{});case"text":return(0,n.jsx)(pn.default,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return(0,n.jsx)(yn.default,{sx:{mr:1,color:"#4CAF50"}});case"html":return(0,n.jsx)(Qe.default,{sx:{mr:1,color:"#E91E63"}});case"code":return(0,n.jsx)(Qe.default,{sx:{mr:1,color:"#2196F3"}});case"video":return(0,n.jsx)(fn.default,{sx:{mr:1,color:"#AB47BC"}});case"audio":return(0,n.jsx)(hn.default,{sx:{mr:1,color:"#FF7043"}});case"office":return(0,n.jsx)(gn.default,{sx:{mr:1,color:"#FFA726"}});default:return(0,n.jsx)(xn.default,{sx:{mr:1,color:"#78909C"}})}},rn=l=>typeof l?.rotate=="number"?l.rotate:typeof l?._pageInfo?.rotate=="number"?l._pageInfo.rotate:0,tt=({open:l,onClose:d,file:c,loadFile:f,onDownload:v,pdfAssetBase:E=ho})=>{let p=Qt(),F=(0,r.useTheme)(),N=(0,r.useMediaQuery)(F.breakpoints.down("sm")),[J,Me]=(0,i.useState)(!0),[Ce,nt]=(0,i.useState)(!1),[w,Te]=(0,i.useState)(""),[M,D]=(0,i.useState)(1),[H,$]=(0,i.useState)(0),[ot,ee]=(0,i.useState)(""),[C,rt]=(0,i.useState)(""),[it,te]=(0,i.useState)(""),[G,ne]=(0,i.useState)(14),[ke,oe]=(0,i.useState)(""),[Ie,at]=(0,i.useState)("preview"),[Le,q]=(0,i.useState)([]),[st,lt]=(0,i.useState)([]),[vn,Re]=(0,i.useState)(""),[Ee,ct]=(0,i.useState)(null),[ut,re]=(0,i.useState)(!1),[Mn,De]=(0,i.useState)(!0),[dt,ie]=(0,i.useState)(""),[T,mt]=(0,i.useState)(),[k,V]=(0,i.useState)(1),[Cn,Pe]=(0,i.useState)(!1),[pt,j]=(0,i.useState)(null),[ae,ft]=(0,i.useState)("portrait"),[Tn,ht]=(0,i.useState)(0),[Se,gt]=(0,i.useState)(0),[K,xt]=(0,i.useState)({width:0,height:0}),yt=(0,i.useRef)([]),Fe=(0,i.useRef)(null),W=(0,i.useRef)(null),Be=(0,i.useRef)(null),He=(0,i.useRef)(null),kn=(0,i.useCallback)(e=>{if(Be.current?.disconnect(),He.current?.(),He.current=null,W.current=e,!e){Be.current=null;return}let t=s=>{s.touches.length>=2&&s.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),He.current=()=>e.removeEventListener("touchmove",t);let o=new ResizeObserver(s=>{let u=s[0]?.contentRect;u&&xt({width:u.width,height:u.height})});o.observe(e),Be.current=o;let a=e.getBoundingClientRect();xt({width:a.width,height:a.height})},[]),[se,bt]=(0,i.useState)(!1),[ze,In]=(0,i.useState)({x:0,y:0}),[Ae,Ln]=(0,i.useState)({x:0,y:0}),Rn=(0,i.useCallback)(async(e,t)=>{let o=URL.createObjectURL(e);Te(o),rt(e.type||"");let a=I(t,e.type||"");if(a==="text"||a==="code"){let u=await e.text();te(u);return}if(a==="html"){let u=await e.text();oe(u);return}if(a!=="spreadsheet")return;let s=t.split(".").pop()?.toLowerCase()||"";if(s==="csv"){let m=(await e.text()).split(`
2
- `).map(y=>y.split(",").map(R=>({value:R.trim()})));q(m);return}if(s==="xls"||s==="xlsx"){re(!0),De(!0);let u=await e.arrayBuffer(),m=Q.read(u,{type:"array"});lt(m.SheetNames),ct(m);let y=m.SheetNames[0];Re(y),_e(m,y)}},[]),le=(0,i.useRef)(null),wt=(0,i.useCallback)(async e=>{if(e.blob)return e.blob;if(f)return await f(e);if(e.url){let t=await fetch(e.url);if(!t.ok)throw new Error("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return await t.blob()}throw new Error("\uD30C\uC77C \uB370\uC774\uD130 \uC18C\uC2A4(blob/url/loadFile)\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")},[f]);(0,i.useEffect)(()=>(c&&l?Sn():(w&&URL.revokeObjectURL(w),le.current=null,Te(""),te(""),oe(""),q([]),ne(14),D(1),$(0)),()=>{w&&URL.revokeObjectURL(w)}),[c,l]);let En=({numPages:e})=>{mt(e),V(1),he.current=!0},Dn=e=>{let{width:t,height:o}=Pn(e);ht(rn(e)),t>0&&o>0&&gt(t/o);let a=t>o?"landscape":"portrait";ft(a)},Pn=e=>{let t=e?.width||0,o=e?.height||0,a=rn(e);try{if(typeof e?.getViewport=="function"){let s=e.getViewport({scale:1,rotation:a});t=s.width,o=s.height}}catch(s){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",s)}return{width:t,height:o}},ce=(0,i.useCallback)(()=>{V(e=>Math.max(e-1,1))},[]),ue=(0,i.useCallback)(()=>{V(e=>Math.min(e+1,T||1))},[T]),vt=(0,i.useMemo)(()=>({cMapUrl:`${E}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${E}/standard_fonts/`,wasmUrl:`${E}/wasm/`}),[E]);(0,i.useEffect)(()=>{typeof window>"u"||(A.pdfjs.GlobalWorkerOptions.workerSrc=`${E}/pdf.worker.min.mjs`)},[E]),(0,i.useEffect)(()=>{if(!l||I(c?.name||"",C)!=="pdf")return;let e=o=>{switch(o.key){case"ArrowLeft":case"ArrowUp":o.preventDefault(),ce();break;case"ArrowRight":case"ArrowDown":o.preventDefault(),ue();break;case"Home":o.preventDefault(),V(1);break;case"End":o.preventDefault(),T&&V(T);break}},t=o=>{o.ctrlKey||Math.abs(o.deltaY)>50&&(o.preventDefault(),o.deltaY>0?ue():ce())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[l,c,C,ce,ue,T]),(0,i.useEffect)(()=>{if(!T||!l||I(c?.name||"",C)!=="pdf")return;if(k===1&&Fe.current){Fe.current.scrollTo({top:0,behavior:"smooth"});return}let e=yt.current[k-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[l,c,C,T,k]),(0,i.useEffect)(()=>{J&&nt(!0)},[J,Ce]);let Sn=async()=>{if(c){Me(!0),ee(""),rt(""),te(""),oe(""),q([]);try{let e=await wt(c);le.current=e,await Rn(e,c.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),ee("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{Me(!1)}}},Mt=async()=>{if(c)try{if(v){await v(c);return}let e=le.current??await wt(c);we(e,c.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},Fn=()=>{let e=c?I(c.name,C):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ne(t=>Math.min(t+2,24)):D(e==="pdf"?t=>Math.min(t+.25,Ne):t=>Math.min(t+.25,3))},Bn=()=>{let e=c?I(c.name,C):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ne(t=>Math.max(t-2,10)):D(e==="pdf"?t=>Math.max(t-.25,Ue):t=>Math.max(t-.25,.25))},g=(0,i.useRef)(new Map),Hn=e=>Math.min(Math.max(e,.25),3),zn=e=>Math.min(Math.max(e,Ue),Ne),Ve=(0,i.useRef)(null),de=(0,i.useRef)(null),B=(0,i.useRef)({scale:1,tx:0,ty:0,rotation:0}),z=(0,i.useRef)(0),Y=(0,i.useRef)(null),me=(0,i.useRef)(null),pe=(0,i.useCallback)((e,t,o,a)=>{let s=Ve.current,u=de.current;if(!s||!u)return{tx:t,ty:o};let m=u.offsetWidth,y=u.offsetHeight,R=(Math.round(a/90)%4+4)%4;if(R===1||R===3){let oo=m;m=y,y=oo}let P=m*e,Ut=y*e,Nt=P>s.clientWidth?(P+s.clientWidth)/2-on:0,$t=Ut>s.clientHeight?(Ut+s.clientHeight)/2-on:0;return{tx:Math.min(Nt,Math.max(-Nt,t)),ty:Math.min($t,Math.max(-$t,o))}},[]),Ct=(0,i.useCallback)((e,t)=>{let o=Ve.current,a=de.current;if(!o||!a)return e>1;let s=(Math.round(t/90)%4+4)%4,u=s===1||s===3,m=u?a.offsetHeight:a.offsetWidth,y=u?a.offsetWidth:a.offsetHeight;return m*e>o.clientWidth+1||y*e>o.clientHeight+1},[]),X=(0,i.useCallback)(e=>{let t=de.current;if(!t)return;let{scale:o,tx:a,ty:s,rotation:u}=B.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${a}px, ${s}px) scale(${o}) rotate(${u}deg)`},[]),Tt=(0,i.useCallback)(()=>{let e=B.current,t=pe(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!z.current&&(z.current=requestAnimationFrame(()=>{z.current=0,X(!1)}))},[X,pe]),kt=(0,i.useCallback)(()=>{z.current&&(cancelAnimationFrame(z.current),z.current=0),g.current.clear(),Y.current=null,me.current=null},[]),An=(0,i.useCallback)(e=>{de.current=e,e&&(B.current={scale:1,tx:0,ty:0,rotation:0},X(!1))},[X]);(0,i.useEffect)(()=>{if(I(c?.name||"",C)!=="image")return;let e=B.current;e.scale=M,e.rotation=H;let t=pe(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,X(!0)},[M,H,c,C,w,X,pe]),(0,i.useEffect)(()=>()=>{z.current&&cancelAnimationFrame(z.current)},[]);let Vn=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...g.current.values()],o=B.current;if(t.length===2){Y.current=null;let a=e.currentTarget.getBoundingClientRect();me.current={startDist:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,baseScale:o.scale,baseTx:o.tx,baseTy:o.ty,startMidX:(t[0].x+t[1].x)/2,startMidY:(t[0].y+t[1].y)/2,centerX:a.left+a.width/2,centerY:a.top+a.height/2}}else t.length===1&&Ct(o.scale,o.rotation)&&(Y.current={startX:e.clientX,startY:e.clientY,baseTx:o.tx,baseTy:o.ty})},Wn=e=>{if(!g.current.has(e.pointerId))return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=B.current,o=me.current,a=[...g.current.values()];if(o&&a.length>=2){let u=Math.hypot(a[0].x-a[1].x,a[0].y-a[1].y),m=(a[0].x+a[1].x)/2,y=(a[0].y+a[1].y)/2,R=Hn(o.baseScale*u/o.startDist),P=R/o.baseScale;t.scale=R,t.tx=m-o.centerX-P*(o.startMidX-o.centerX-o.baseTx),t.ty=y-o.centerY-P*(o.startMidY-o.centerY-o.baseTy),Tt();return}let s=Y.current;s&&a.length===1&&(t.tx=s.baseTx+(e.clientX-s.startX),t.ty=s.baseTy+(e.clientY-s.startY),Tt())},It=e=>{if(!g.current.has(e.pointerId))return;g.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=B.current;if(g.current.size<2&&(me.current=null,Math.abs(t.scale-M)>.001&&D(t.scale)),g.current.size===0)Y.current=null;else if(g.current.size===1&&Ct(t.scale,t.rotation)){let o=[...g.current.values()][0];Y.current={startX:o.x,startY:o.y,baseTx:t.tx,baseTy:t.ty}}},Lt=(0,i.useCallback)(async()=>{if(w)try{let t=await(await fetch(w)).blob(),o=t.type==="image/png"?t:await Zt(t);await navigator.clipboard.write([new ClipboardItem({"image/png":o})]),ie("\uC774\uBBF8\uC9C0\uB97C \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4.")}catch(e){console.error("\uC774\uBBF8\uC9C0 \uBCF5\uC0AC \uC624\uB958:",e),ie("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[w]);(0,i.useEffect)(()=>{if(!l||I(c?.name||"",C)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let o=t.target,a=o?.tagName;a==="INPUT"||a==="TEXTAREA"||o?.isContentEditable||(t.preventDefault(),Lt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[l,c,C,Lt]);let O=(0,i.useRef)(null),L=(0,i.useRef)(0),Z=(0,i.useRef)(null),U=(0,i.useRef)(null),_=()=>W.current?.querySelector(".react-pdf__Page")??null,fe=(0,i.useRef)(null),Rt=(0,i.useRef)(null),Xn=()=>{let e=Rt.current,t=_()?.querySelector("canvas");if(!e||!t||!t.width||!t.height)return!1;let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let a=o.getContext("2d");if(!a)return!1;a.drawImage(t,0,0);let s=t.getBoundingClientRect(),u=e.getBoundingClientRect();return Object.assign(o.style,{position:"absolute",left:`${s.left-u.left}px`,top:`${s.top-u.top}px`,width:`${s.width}px`,height:`${s.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(o),fe.current=o,!0},Et=()=>{fe.current?.remove(),fe.current=null;let e=_();e&&(e.style.visibility="")},_n=()=>{L.current||(L.current=requestAnimationFrame(()=>{L.current=0;let e=O.current,t=_();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,Z.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Dt=()=>{L.current&&(cancelAnimationFrame(L.current),L.current=0),O.current=null,U.current=null,Z.current=null,Et();let e=_();e&&(e.style.transform="",e.style.willChange="auto")},Pt=e=>{let t=_(),o=W.current;if(!t||!o)return;t.style.transform&&(t.style.transform="");let a=t.getBoundingClientRect(),s=o.getBoundingClientRect(),u=(e[0].x+e[1].x)/2,m=(e[0].y+e[1].y)/2;O.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:a.left,rectTop:a.top,pageW:a.width,pageH:a.height,viewerL:s.left,viewerT:s.top,viewerR:s.right,viewerB:s.bottom,startMidX:u,startMidY:m,lastMidX:u,lastMidY:m,k:1,tx:0,ty:0},Z.current={k:1,tx:0,ty:0,midX:u,midY:m},t.style.willChange="transform"},jn=e=>{if(e.pointerType!=="touch")return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...g.current.values()];if(t.length===2){if(U.current||fe.current)return;Pt(t)}},Yn=e=>{if(!g.current.has(e.pointerId))return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=O.current,o=[...g.current.values()];if(t&&o.length>=2){e.preventDefault();let a=Math.hypot(o[0].x-o[1].x,o[0].y-o[1].y),s=Math.min(Math.max(a/t.startDist,Ue/(M||1)),Ne/(M||1)),u=(o[0].x+o[1].x)/2,m=(o[0].y+o[1].y)/2,y=u-t.rectLeft-s*(t.startMidX-t.rectLeft),R=m-t.rectTop-s*(t.startMidY-t.rectTop),P=$e;y=Math.min(t.viewerR-P-t.rectLeft,Math.max(t.viewerL+P-t.rectLeft-s*t.pageW,y)),R=Math.min(t.viewerB-P-t.rectTop,Math.max(t.viewerT+P-t.rectTop-s*t.pageH,R)),t.k=s,t.tx=y,t.ty=R,t.lastMidX=u,t.lastMidY=m,_n()}},St=e=>{if(g.current.delete(e.pointerId),g.current.size>=2)return;let t=O.current;if(O.current=null,!t)return;L.current&&(cancelAnimationFrame(L.current),L.current=0);let o=Z.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};Z.current=null;let a=zn(M*o.k);if(Math.abs(a-M)<.001){let u=W.current;Dt(),u&&(u.scrollLeft-=o.tx,u.scrollTop-=o.ty);return}let s=W.current;if(s){let u=s.getBoundingClientRect();U.current={u:(o.midX-t.rectLeft-o.tx)/o.k,v:(o.midY-t.rectTop-o.ty)/o.k,offX:o.midX-u.left,offY:o.midY-u.top,factor:a/(M||1)}}if(Xn()){let u=_();u&&(u.style.transform="",u.style.visibility="hidden")}D(a),Math.round(Math.min(je*a,jt))===Ye&&requestAnimationFrame(()=>Bt())},he=(0,i.useRef)(!0),We=(0,i.useRef)(null),Ft=()=>{let e=W.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},Bt=()=>{let e=U.current;if(!e)return;U.current=null;let t=W.current,o=_();if(!t||!o)return;Et(),o.style.transform="",o.style.willChange="auto";let a=o.getBoundingClientRect(),s=t.getBoundingClientRect();t.scrollLeft+=a.left-s.left+e.u*e.factor-e.offX,t.scrollTop+=a.top-s.top+e.v*e.factor-e.offY;let u=[...g.current.values()];u.length>=2&&Pt(u)},Ht=()=>{let e=`${k}:${H}`;if(U.current){We.current=e,Bt();return}(he.current||We.current!==e)&&(he.current=!1,We.current=e,Ft())};(0,i.useEffect)(()=>()=>{L.current&&cancelAnimationFrame(L.current)},[]);let zt=()=>{$(e=>e-90)},At=()=>{$(e=>e+90)},Vt=()=>{let e=I(c?.name||"",C);Dt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ne(14):e==="pdf"?(D(1),M===1&&H===0?Ft():he.current=!0):(kt(),B.current={scale:1,tx:0,ty:0,rotation:0},X(!0),D(1)),$(0)},Wt=(e,t)=>{bt(!0),In({x:e.clientX,y:e.clientY}),Ln({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Xt=(0,i.useCallback)((e,t)=>{if(!se)return;let o=e.clientX-ze.x,a=e.clientY-ze.y;t.scrollLeft=Ae.x-o,t.scrollTop=Ae.y-a,e.preventDefault()},[se,ze,Ae]),Xe=(0,i.useCallback)(()=>{bt(!1),document.body.style.cursor="default"},[]);(0,i.useEffect)(()=>{if(se){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(a=>{Xt(t,a)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",Xe),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",Xe),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[se,Xt,Xe]);let On=(0,i.useCallback)(()=>{Me(!1),nt(!1)},[]),_e=(0,i.useCallback)(async(e,t)=>{re(!0),De(!0);try{await new Promise(m=>setTimeout(m,500));let o=e.Sheets[t],a=Q.utils.decode_range(o["!ref"]||"A1");console.debug("Excel range:",a);let u=Q.utils.sheet_to_json(o,{header:1,range:a,defval:""}).map(m=>m.map(y=>({value:y!=null?String(y):""})));q(u),await new Promise(m=>setTimeout(m,200))}catch(o){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",o)}finally{De(!1)}},[]),Un=(0,i.useCallback)(()=>{re(!1)},[]),Nn=(0,i.useCallback)(e=>{Ee&&(Re(e),_e(Ee,e))},[Ee,_e]),_t=()=>{kt(),B.current={scale:1,tx:0,ty:0,rotation:0},ie(""),w&&URL.revokeObjectURL(w),le.current=null,Te(""),te(""),oe(""),q([]),lt([]),Re(""),ct(null),re(!1),D(1),$(0),ee(""),mt(void 0),V(1),ft("portrait"),ht(0),gt(0),d()};if(!c)return null;let x=I(c.name,C),$n=((Tn+H)%360+360)%360,ge=H%180===0?Se:Se>0?1/Se:0,Gn=Math.max(K.width-tn,nn),qn=Math.max(K.height-tn,nn),je=K.width>0&&ge>0?Math.min(Gn,qn*ge):ae==="portrait"?600:800,Kn=typeof window<"u"&&window.devicePixelRatio||1,jt=go/Kn*(ge>0?Math.min(1,ge):1),Ye=Math.round(Math.min(je*M,jt)),Yt=Math.round(je*M),Zn=Yt>Ye,Qn=Math.max(16,Math.round(K.width)-$e),Jn=Math.max(16,Math.round(K.height)-$e),eo=ae==="landscape"?"200px":"150px",to=ae==="landscape"?.18:.17,Ot=()=>T?(0,n.jsx)(r.Box,{ref:Fe,sx:{width:eo,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:T},(e,t)=>(0,n.jsxs)(r.Box,{ref:o=>{yt.current[t]=o},children:[(0,n.jsx)(r.Box,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:k===t+1?"2px solid":"1px solid",borderColor:k===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:ae==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{V(t+1),p&&Pe(!1)},children:(0,n.jsx)(A.Document,{file:w,options:vt,loading:(0,n.jsx)("div",{style:{display:"none"}}),children:(0,n.jsx)(A.Page,{pageNumber:t+1,scale:to,loading:(0,n.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),(0,n.jsx)(r.Typography,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:k===t+1?"primary.main":"",fontWeight:k===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,no=()=>{let e=I(c?.name||"",C);if(Ce&&!(e==="spreadsheet"))return(0,n.jsx)(r.Box,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(et.LoadingProgress,{visible:J,exitDelay:100,onComplete:On})});if(ot)return(0,n.jsxs)(r.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,n.jsx)(r.Typography,{color:"error",variant:"h6",children:ot}),(0,n.jsx)(r.Typography,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]});if(!w)return null;switch(e){case"image":return(0,n.jsx)(r.Box,{ref:Ve,"data-allow-pinch":"true",onPointerDown:Vn,onPointerMove:Wn,onPointerUp:It,onPointerCancel:It,sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"hidden",height:"100%",backgroundColor:"grey.100",p:2,touchAction:"none",overscrollBehavior:"contain",userSelect:"none","&:active":{cursor:"grabbing"}},children:(0,n.jsx)("img",{ref:An,src:w,alt:c.name,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",transform:"translate(0px, 0px) scale(1) rotate(0deg)",transformOrigin:"center center",pointerEvents:"none"}})});case"pdf":return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(r.Box,{ref:Rt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!p&&Ot(),(0,n.jsx)(r.Box,{ref:kn,className:"draggable-scroll",onMouseDown:o=>{let a=o.currentTarget;Wt(o,a)},"data-allow-pinch":"true",onPointerDown:jn,onPointerMove:Yn,onPointerUp:St,onPointerCancel:St,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:p?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...p&&{px:`${Qn}px`,py:`${Jn}px`},...Zn&&{"& .react-pdf__Page__canvas":{width:`${Yt}px !important`,height:"auto !important"}}}},children:(0,n.jsx)(A.Document,{file:w,onLoadSuccess:En,onLoadError:o=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",o),ee("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:(0,n.jsx)("div",{style:{display:"none"}}),error:(0,n.jsxs)(r.Box,{sx:{textAlign:"center",p:4},children:[(0,n.jsx)(r.Typography,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),(0,n.jsx)(r.Typography,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:vt,children:(0,n.jsx)(A.Page,{pageNumber:k,width:Ye,rotate:H===0?void 0:$n,loading:(0,n.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Dn,onRenderSuccess:Ht,onRenderError:Ht})})})]}),p&&(0,n.jsx)(r.Drawer,{anchor:"left",open:Cn,onClose:()=>Pe(!1),sx:{zIndex:o=>o.zIndex.modal+2},children:Ot()})]});case"text":case"code":return(0,n.jsx)(r.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:it?(0,n.jsx)(r.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,n.jsx)(Je.default,{height:"100%",language:be(c.name),value:it,theme:"vs-dark",loading:!1,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:G,lineHeight:Math.round(G*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,a)=>{o.onDidAttemptReadOnlyEdit(()=>{});let s=o.getDomNode();if(s){let u=document.createElement("style");u.textContent=`
1
+ "use strict";var yr=Object.create;var Te=Object.defineProperty;var br=Object.getOwnPropertyDescriptor;var vr=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty;var Cr=(s,u)=>{for(var c in u)Te(s,c,{get:u[c],enumerable:!0})},ro=(s,u,c,m)=>{if(u&&typeof u=="object"||typeof u=="function")for(let M of vr(u))!Mr.call(s,M)&&M!==c&&Te(s,M,{get:()=>u[M],enumerable:!(m=br(u,M))||m.enumerable});return s};var p=(s,u,c)=>(c=s!=null?yr(wr(s)):{},ro(u||!s||!s.__esModule?Te(c,"default",{value:s,enumerable:!0}):c,s)),Tr=s=>ro(Te({},"__esModule",{value:!0}),s);var Sr={};Cr(Sr,{FileTypeIcon:()=>dt,FileViewer:()=>ct,FileViewerDefault:()=>Lo,HtmlIcon:()=>re,ImageIcon:()=>O,PdfIcon:()=>U,ZipIcon:()=>ne,ensureFileExtension:()=>io,getEditorLanguage:()=>ke,getFileType:()=>Ie,getFileTypeFromMime:()=>Ze,getFileTypeIcon:()=>ie,isFileViewerPreviewable:()=>no,resolveFileType:()=>w,saveBlobAsFile:()=>Le});module.exports=Tr(Sr);var i=require("react"),n=require("@mui/material"),po=p(require("@mui/icons-material/Close"),1),ho=p(require("@mui/icons-material/Menu"),1),fo=p(require("@mui/icons-material/MoreHoriz"),1),tt=p(require("@mui/icons-material/Download"),1),go=p(require("@mui/icons-material/Add"),1),xo=p(require("@mui/icons-material/Remove"),1),ot=p(require("@mui/icons-material/RotateLeft"),1),rt=p(require("@mui/icons-material/RotateRight"),1),nt=p(require("@mui/icons-material/FitScreen"),1),yo=p(require("@mui/icons-material/KeyboardArrowLeft"),1),bo=p(require("@mui/icons-material/KeyboardArrowRight"),1),vo=p(require("@mui/icons-material/TextSnippet"),1),wo=p(require("@mui/icons-material/VideoFile"),1),Mo=p(require("@mui/icons-material/AudioFile"),1),Co=p(require("@mui/icons-material/Description"),1),To=p(require("@mui/icons-material/InsertDriveFile"),1),it=p(require("@mui/icons-material/Code"),1),Io=p(require("@mui/icons-material/TableView"),1),X=require("react-pdf"),at=p(require("@monaco-editor/react"),1),ko=p(require("react-spreadsheet"),1),oe=p(require("xlsx"),1),st=require("@ehfuse/mui-fadeout-loading-progress");var Ie=s=>{let u=s.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(u)?"image":u==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(u)?"text":["csv","xls","xlsx"].includes(u)?"spreadsheet":["html","htm"].includes(u)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(u)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(u)?"video":["mp3","wav","ogg","m4a","aac"].includes(u)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(u)?"office":"unsupported"},Ze=s=>{let u=(s||"").toLowerCase().split(";")[0].trim();return u?u.startsWith("image/")?"image":u==="application/pdf"?"pdf":u.startsWith("video/")?"video":u.startsWith("audio/")?"audio":u==="text/html"?"html":u==="text/csv"||u==="application/vnd.ms-excel"||u==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":u.startsWith("text/")||u==="application/json"||u==="application/xml"?"text":"unsupported":"unsupported"},w=(s,u)=>{let c=Ie(s);return c!=="unsupported"?c:Ze(u)},Ir=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),no=s=>Ir.has(Ie(s)),kr={"image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-excel":"xls","text/csv":"csv","text/plain":"txt","application/json":"json","text/xml":"xml","application/xml":"xml","text/html":"html","video/mp4":"mp4","video/webm":"webm","audio/mpeg":"mp3","audio/wav":"wav"},io=(s,u)=>{let c=(s??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(c))return c;let m=(u??"").trim().toLowerCase().split(";")[0],M=kr[m]??"";return M?`${c}.${M}`:c},ke=s=>{let u=s.split(".").pop()?.toLowerCase()||"";return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"scss",less:"less",json:"json",xml:"xml",php:"php",py:"python",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",swift:"swift",kt:"kotlin",scala:"scala",sql:"sql",sh:"shell",bash:"shell",bat:"bat",ps1:"powershell",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",md:"markdown",markdown:"markdown",txt:"plaintext",log:"plaintext",csv:"plaintext"}[u]||"plaintext"};var Lr=s=>(s||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",Le=(s,u)=>{let c=URL.createObjectURL(s),m=document.createElement("a");m.href=c,m.download=Lr(u),m.rel="noopener",document.body.appendChild(m),m.click(),m.remove(),window.setTimeout(()=>URL.revokeObjectURL(c),6e4)};var ao=async s=>{let u=URL.createObjectURL(s);try{let c=await new Promise((P,f)=>{let H=new Image;H.onload=()=>P(H),H.onerror=()=>f(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),H.src=u}),m=document.createElement("canvas");m.width=c.naturalWidth||c.width||1024,m.height=c.naturalHeight||c.height||1024;let M=m.getContext("2d");if(!M)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return M.drawImage(c,0,0,m.width,m.height),await new Promise((P,f)=>{m.toBlob(H=>H?P(H):f(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(u)}};var Re=require("@mui/material");function so(){let s=(0,Re.useTheme)();return!(0,Re.useMediaQuery)(s.breakpoints.up("lg"))}var B=require("react/jsx-runtime");function O(s){return(0,B.jsxs)("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:s.width||"22px",...s,children:[(0,B.jsx)("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),(0,B.jsx)("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),(0,B.jsx)("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),(0,B.jsx)("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),(0,B.jsxs)("g",{children:[(0,B.jsx)("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),(0,B.jsx)("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}var b=require("react/jsx-runtime");function U(s){return(0,b.jsx)("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:s.width||"28px",...s,children:(0,b.jsxs)("g",{children:[(0,b.jsx)("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),(0,b.jsx)("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),(0,b.jsxs)("g",{children:[(0,b.jsxs)("g",{children:[(0,b.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),(0,b.jsx)("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),(0,b.jsx)("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),(0,b.jsx)("g",{children:(0,b.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),(0,b.jsx)("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),(0,b.jsx)("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),(0,b.jsx)("g",{children:(0,b.jsx)("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}var o=require("react/jsx-runtime");var Rr="/pdfjs",co=32,lo=240,Fr=8192,Qe=.25,Je=8,et=80,uo=80,Er=s=>{switch(s){case"image":return(0,o.jsx)(O,{});case"pdf":return(0,o.jsx)(U,{});case"text":return(0,o.jsx)(vo.default,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return(0,o.jsx)(Io.default,{sx:{mr:1,color:"#4CAF50"}});case"html":return(0,o.jsx)(it.default,{sx:{mr:1,color:"#E91E63"}});case"code":return(0,o.jsx)(it.default,{sx:{mr:1,color:"#2196F3"}});case"video":return(0,o.jsx)(wo.default,{sx:{mr:1,color:"#AB47BC"}});case"audio":return(0,o.jsx)(Mo.default,{sx:{mr:1,color:"#FF7043"}});case"office":return(0,o.jsx)(Co.default,{sx:{mr:1,color:"#FFA726"}});default:return(0,o.jsx)(To.default,{sx:{mr:1,color:"#78909C"}})}},mo=s=>typeof s?.rotate=="number"?s.rotate:typeof s?._pageInfo?.rotate=="number"?s._pageInfo.rotate:0,ct=({open:s,onClose:u,file:c,loadFile:m,onDownload:M,pdfAssetBase:P=Rr})=>{let f=so(),H=(0,n.useTheme)(),K=(0,n.useMediaQuery)(H.breakpoints.down("sm")),[ae,Fe]=(0,i.useState)(!0),[Ee,ut]=(0,i.useState)(!1),[v,Pe]=(0,i.useState)(""),[C,S]=(0,i.useState)(1),[V,Z]=(0,i.useState)(0),[mt,se]=(0,i.useState)(""),[T,pt]=(0,i.useState)(""),[ht,ce]=(0,i.useState)(""),[Q,le]=(0,i.useState)(14),[Se,de]=(0,i.useState)(""),[De,ft]=(0,i.useState)("preview"),[Be,J]=(0,i.useState)([]),[gt,xt]=(0,i.useState)([]),[Ho,He]=(0,i.useState)(""),[ze,yt]=(0,i.useState)(null),[bt,ue]=(0,i.useState)(!1),[zo,Ve]=(0,i.useState)(!0),[vt,me]=(0,i.useState)(""),[I,wt]=(0,i.useState)(),[k,W]=(0,i.useState)(1),[Vo,Ae]=(0,i.useState)(!1),[Mt,N]=(0,i.useState)(null),[pe,Ct]=(0,i.useState)("portrait"),[Ao,Tt]=(0,i.useState)(0),[Xe,It]=(0,i.useState)(0),[ee,kt]=(0,i.useState)({width:0,height:0}),Lt=(0,i.useRef)([]),We=(0,i.useRef)(null),_=(0,i.useRef)(null),_e=(0,i.useRef)(null),je=(0,i.useRef)(null),Xo=(0,i.useCallback)(e=>{if(_e.current?.disconnect(),je.current?.(),je.current=null,_.current=e,!e){_e.current=null;return}let t=l=>{l.touches.length>=2&&l.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),je.current=()=>e.removeEventListener("touchmove",t);let r=new ResizeObserver(l=>{let d=l[0]?.contentRect;d&&kt({width:d.width,height:d.height})});r.observe(e),_e.current=r;let a=e.getBoundingClientRect();kt({width:a.width,height:a.height})},[]),[he,Rt]=(0,i.useState)(!1),[Ye,Wo]=(0,i.useState)({x:0,y:0}),[Oe,_o]=(0,i.useState)({x:0,y:0}),jo=(0,i.useCallback)(async(e,t)=>{let r=URL.createObjectURL(e);Pe(r),pt(e.type||"");let a=w(t,e.type||"");if(a==="text"||a==="code"){let d=await e.text();ce(d);return}if(a==="html"){let d=await e.text();de(d);return}if(a!=="spreadsheet")return;let l=t.split(".").pop()?.toLowerCase()||"";if(l==="csv"){let h=(await e.text()).split(`
2
+ `).map(y=>y.split(",").map(E=>({value:E.trim()})));J(h);return}if(l==="xls"||l==="xlsx"){ue(!0),Ve(!0);let d=await e.arrayBuffer(),h=oe.read(d,{type:"array"});xt(h.SheetNames),yt(h);let y=h.SheetNames[0];He(y),Ge(h,y)}},[]),fe=(0,i.useRef)(null),Ft=(0,i.useCallback)(async e=>{if(e.blob)return e.blob;if(m)return await m(e);if(e.url){let t=await fetch(e.url);if(!t.ok)throw new Error("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return await t.blob()}throw new Error("\uD30C\uC77C \uB370\uC774\uD130 \uC18C\uC2A4(blob/url/loadFile)\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")},[m]);(0,i.useEffect)(()=>(c&&s?No():(v&&URL.revokeObjectURL(v),fe.current=null,Pe(""),ce(""),de(""),J([]),le(14),S(1),Z(0)),()=>{v&&URL.revokeObjectURL(v)}),[c,s]);let Yo=({numPages:e})=>{wt(e),W(1),Me.current=!0},Oo=e=>{let{width:t,height:r}=Uo(e);Tt(mo(e)),t>0&&r>0&&It(t/r);let a=t>r?"landscape":"portrait";Ct(a)},Uo=e=>{let t=e?.width||0,r=e?.height||0,a=mo(e);try{if(typeof e?.getViewport=="function"){let l=e.getViewport({scale:1,rotation:a});t=l.width,r=l.height}}catch(l){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",l)}return{width:t,height:r}},ge=(0,i.useCallback)(()=>{W(e=>Math.max(e-1,1))},[]),xe=(0,i.useCallback)(()=>{W(e=>Math.min(e+1,I||1))},[I]),Et=(0,i.useMemo)(()=>({cMapUrl:`${P}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${P}/standard_fonts/`,wasmUrl:`${P}/wasm/`}),[P]);(0,i.useEffect)(()=>{typeof window>"u"||(X.pdfjs.GlobalWorkerOptions.workerSrc=`${P}/pdf.worker.min.mjs`)},[P]),(0,i.useEffect)(()=>{if(!s||w(c?.name||"",T)!=="pdf")return;let e=r=>{switch(r.key){case"ArrowLeft":case"ArrowUp":r.preventDefault(),ge();break;case"ArrowRight":case"ArrowDown":r.preventDefault(),xe();break;case"Home":r.preventDefault(),W(1);break;case"End":r.preventDefault(),I&&W(I);break}},t=r=>{r.ctrlKey||Math.abs(r.deltaY)>50&&(r.preventDefault(),r.deltaY>0?xe():ge())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[s,c,T,ge,xe,I]),(0,i.useEffect)(()=>{if(!I||!s||w(c?.name||"",T)!=="pdf")return;if(k===1&&We.current){We.current.scrollTo({top:0,behavior:"smooth"});return}let e=Lt.current[k-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[s,c,T,I,k]),(0,i.useEffect)(()=>{ae&&ut(!0)},[ae,Ee]);let No=async()=>{if(c){Fe(!0),se(""),pt(""),ce(""),de(""),J([]);try{let e=await Ft(c);fe.current=e,await jo(e,c.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),se("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{Fe(!1)}}},Pt=async()=>{if(c)try{if(M){await M(c);return}let e=fe.current??await Ft(c);Le(e,c.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},$o=()=>{let e=c?w(c.name,T):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?le(t=>Math.min(t+2,24)):S(e==="pdf"?t=>Math.min(t+.25,Je):t=>Math.min(t+.25,3))},Go=()=>{let e=c?w(c.name,T):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?le(t=>Math.max(t-2,10)):S(e==="pdf"?t=>Math.max(t-.25,Qe):t=>Math.max(t-.25,.25))},g=(0,i.useRef)(new Map),qo=e=>Math.min(Math.max(e,.25),3),Ko=e=>Math.min(Math.max(e,Qe),Je),Ue=(0,i.useRef)(null),ye=(0,i.useRef)(null),z=(0,i.useRef)({scale:1,tx:0,ty:0,rotation:0}),A=(0,i.useRef)(0),$=(0,i.useRef)(null),be=(0,i.useRef)(null),ve=(0,i.useCallback)((e,t,r,a)=>{let l=Ue.current,d=ye.current;if(!l||!d)return{tx:t,ty:r};let h=d.offsetWidth,y=d.offsetHeight,E=(Math.round(a/90)%4+4)%4;if(E===1||E===3){let xr=h;h=y,y=xr}let D=h*e,eo=y*e,to=D>l.clientWidth?(D+l.clientWidth)/2-uo:0,oo=eo>l.clientHeight?(eo+l.clientHeight)/2-uo:0;return{tx:Math.min(to,Math.max(-to,t)),ty:Math.min(oo,Math.max(-oo,r))}},[]),St=(0,i.useCallback)((e,t)=>{let r=Ue.current,a=ye.current;if(!r||!a)return e>1;let l=(Math.round(t/90)%4+4)%4,d=l===1||l===3,h=d?a.offsetHeight:a.offsetWidth,y=d?a.offsetWidth:a.offsetHeight;return h*e>r.clientWidth+1||y*e>r.clientHeight+1},[]),j=(0,i.useCallback)(e=>{let t=ye.current;if(!t)return;let{scale:r,tx:a,ty:l,rotation:d}=z.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${a}px, ${l}px) scale(${r}) rotate(${d}deg)`},[]),Dt=(0,i.useCallback)(()=>{let e=z.current,t=ve(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!A.current&&(A.current=requestAnimationFrame(()=>{A.current=0,j(!1)}))},[j,ve]),Bt=(0,i.useCallback)(()=>{A.current&&(cancelAnimationFrame(A.current),A.current=0),g.current.clear(),$.current=null,be.current=null},[]),Zo=(0,i.useCallback)(e=>{ye.current=e,e&&(z.current={scale:1,tx:0,ty:0,rotation:0},j(!1))},[j]);(0,i.useEffect)(()=>{if(w(c?.name||"",T)!=="image")return;let e=z.current;e.scale=C,e.rotation=V;let t=ve(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,j(!0)},[C,V,c,T,v,j,ve]),(0,i.useEffect)(()=>()=>{A.current&&cancelAnimationFrame(A.current)},[]);let Qo=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...g.current.values()],r=z.current;if(t.length===2){$.current=null;let a=e.currentTarget.getBoundingClientRect();be.current={startDist:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,baseScale:r.scale,baseTx:r.tx,baseTy:r.ty,startMidX:(t[0].x+t[1].x)/2,startMidY:(t[0].y+t[1].y)/2,centerX:a.left+a.width/2,centerY:a.top+a.height/2}}else t.length===1&&St(r.scale,r.rotation)&&($.current={startX:e.clientX,startY:e.clientY,baseTx:r.tx,baseTy:r.ty})},Jo=e=>{if(!g.current.has(e.pointerId))return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=z.current,r=be.current,a=[...g.current.values()];if(r&&a.length>=2){let d=Math.hypot(a[0].x-a[1].x,a[0].y-a[1].y),h=(a[0].x+a[1].x)/2,y=(a[0].y+a[1].y)/2,E=qo(r.baseScale*d/r.startDist),D=E/r.baseScale;t.scale=E,t.tx=h-r.centerX-D*(r.startMidX-r.centerX-r.baseTx),t.ty=y-r.centerY-D*(r.startMidY-r.centerY-r.baseTy),Dt();return}let l=$.current;l&&a.length===1&&(t.tx=l.baseTx+(e.clientX-l.startX),t.ty=l.baseTy+(e.clientY-l.startY),Dt())},Ht=e=>{if(!g.current.has(e.pointerId))return;g.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=z.current;if(g.current.size<2&&(be.current=null,Math.abs(t.scale-C)>.001&&S(t.scale)),g.current.size===0)$.current=null;else if(g.current.size===1&&St(t.scale,t.rotation)){let r=[...g.current.values()][0];$.current={startX:r.x,startY:r.y,baseTx:t.tx,baseTy:t.ty}}},zt=(0,i.useCallback)(async()=>{if(v)try{let t=await(await fetch(v)).blob(),r=t.type==="image/png"?t:await ao(t);await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),me("\uC774\uBBF8\uC9C0\uB97C \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4.")}catch(e){console.error("\uC774\uBBF8\uC9C0 \uBCF5\uC0AC \uC624\uB958:",e),me("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[v]);(0,i.useEffect)(()=>{if(!s||w(c?.name||"",T)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let r=t.target,a=r?.tagName;a==="INPUT"||a==="TEXTAREA"||r?.isContentEditable||(t.preventDefault(),zt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s,c,T,zt]);let G=(0,i.useRef)(null),F=(0,i.useRef)(0),te=(0,i.useRef)(null),q=(0,i.useRef)(null),Y=()=>_.current?.querySelector(".react-pdf__Page")??null,we=(0,i.useRef)(null),Vt=(0,i.useRef)(null),er=()=>{let e=Vt.current,t=Y()?.querySelector("canvas");if(!e||!t||!t.width||!t.height)return!1;let r=document.createElement("canvas");r.width=t.width,r.height=t.height;let a=r.getContext("2d");if(!a)return!1;a.drawImage(t,0,0);let l=t.getBoundingClientRect(),d=e.getBoundingClientRect();return Object.assign(r.style,{position:"absolute",left:`${l.left-d.left}px`,top:`${l.top-d.top}px`,width:`${l.width}px`,height:`${l.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(r),we.current=r,!0},At=()=>{we.current?.remove(),we.current=null;let e=Y();e&&(e.style.visibility="")},tr=()=>{F.current||(F.current=requestAnimationFrame(()=>{F.current=0;let e=G.current,t=Y();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,te.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Xt=()=>{F.current&&(cancelAnimationFrame(F.current),F.current=0),G.current=null,q.current=null,te.current=null,At();let e=Y();e&&(e.style.transform="",e.style.willChange="auto")},Wt=e=>{let t=Y(),r=_.current;if(!t||!r)return;t.style.transform&&(t.style.transform="");let a=t.getBoundingClientRect(),l=r.getBoundingClientRect(),d=(e[0].x+e[1].x)/2,h=(e[0].y+e[1].y)/2;G.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:a.left,rectTop:a.top,pageW:a.width,pageH:a.height,viewerL:l.left,viewerT:l.top,viewerR:l.right,viewerB:l.bottom,startMidX:d,startMidY:h,lastMidX:d,lastMidY:h,k:1,tx:0,ty:0},te.current={k:1,tx:0,ty:0,midX:d,midY:h},t.style.willChange="transform"},or=e=>{if(e.pointerType!=="touch")return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...g.current.values()];if(t.length===2){if(q.current||we.current)return;Wt(t)}},rr=e=>{if(!g.current.has(e.pointerId))return;g.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=G.current,r=[...g.current.values()];if(t&&r.length>=2){e.preventDefault();let a=Math.hypot(r[0].x-r[1].x,r[0].y-r[1].y),l=Math.min(Math.max(a/t.startDist,Qe/(C||1)),Je/(C||1)),d=(r[0].x+r[1].x)/2,h=(r[0].y+r[1].y)/2,y=d-t.rectLeft-l*(t.startMidX-t.rectLeft),E=h-t.rectTop-l*(t.startMidY-t.rectTop),D=et;y=Math.min(t.viewerR-D-t.rectLeft,Math.max(t.viewerL+D-t.rectLeft-l*t.pageW,y)),E=Math.min(t.viewerB-D-t.rectTop,Math.max(t.viewerT+D-t.rectTop-l*t.pageH,E)),t.k=l,t.tx=y,t.ty=E,t.lastMidX=d,t.lastMidY=h,tr()}},_t=e=>{if(g.current.delete(e.pointerId),g.current.size>=2)return;let t=G.current;if(G.current=null,!t)return;F.current&&(cancelAnimationFrame(F.current),F.current=0);let r=te.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};te.current=null;let a=Ko(C*r.k);if(Math.abs(a-C)<.001){let d=_.current;Xt(),d&&(d.scrollLeft-=r.tx,d.scrollTop-=r.ty);return}let l=_.current;if(l){let d=l.getBoundingClientRect();q.current={u:(r.midX-t.rectLeft-r.tx)/r.k,v:(r.midY-t.rectTop-r.ty)/r.k,offX:r.midX-d.left,offY:r.midY-d.top,factor:a/(C||1)}}if(er()){let d=Y();d&&(d.style.transform="",d.style.visibility="hidden")}S(a),Math.round(Math.min(qe*a,Zt))===Ke&&requestAnimationFrame(()=>Yt())},Me=(0,i.useRef)(!0),Ne=(0,i.useRef)(null),jt=()=>{let e=_.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},Yt=()=>{let e=q.current;if(!e)return;q.current=null;let t=_.current,r=Y();if(!t||!r)return;At(),r.style.transform="",r.style.willChange="auto";let a=r.getBoundingClientRect(),l=t.getBoundingClientRect();t.scrollLeft+=a.left-l.left+e.u*e.factor-e.offX,t.scrollTop+=a.top-l.top+e.v*e.factor-e.offY;let d=[...g.current.values()];d.length>=2&&Wt(d)},Ot=()=>{let e=`${k}:${V}`;if(q.current){Ne.current=e,Yt();return}(Me.current||Ne.current!==e)&&(Me.current=!1,Ne.current=e,jt())};(0,i.useEffect)(()=>()=>{F.current&&cancelAnimationFrame(F.current)},[]);let Ut=()=>{Z(e=>e-90)},Nt=()=>{Z(e=>e+90)},$t=()=>{let e=w(c?.name||"",T);Xt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?le(14):e==="pdf"?(S(1),C===1&&V===0?jt():Me.current=!0):(Bt(),z.current={scale:1,tx:0,ty:0,rotation:0},j(!0),S(1)),Z(0)},Gt=(e,t)=>{Rt(!0),Wo({x:e.clientX,y:e.clientY}),_o({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},qt=(0,i.useCallback)((e,t)=>{if(!he)return;let r=e.clientX-Ye.x,a=e.clientY-Ye.y;t.scrollLeft=Oe.x-r,t.scrollTop=Oe.y-a,e.preventDefault()},[he,Ye,Oe]),$e=(0,i.useCallback)(()=>{Rt(!1),document.body.style.cursor="default"},[]);(0,i.useEffect)(()=>{if(he){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(a=>{qt(t,a)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",$e),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",$e),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[he,qt,$e]);let nr=(0,i.useCallback)(()=>{Fe(!1),ut(!1)},[]),Ge=(0,i.useCallback)(async(e,t)=>{ue(!0),Ve(!0);try{await new Promise(h=>setTimeout(h,500));let r=e.Sheets[t],a=oe.utils.decode_range(r["!ref"]||"A1");console.debug("Excel range:",a);let d=oe.utils.sheet_to_json(r,{header:1,range:a,defval:""}).map(h=>h.map(y=>({value:y!=null?String(y):""})));J(d),await new Promise(h=>setTimeout(h,200))}catch(r){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",r)}finally{Ve(!1)}},[]),ir=(0,i.useCallback)(()=>{ue(!1)},[]),ar=(0,i.useCallback)(e=>{ze&&(He(e),Ge(ze,e))},[ze,Ge]),Kt=()=>{Bt(),z.current={scale:1,tx:0,ty:0,rotation:0},me(""),v&&URL.revokeObjectURL(v),fe.current=null,Pe(""),ce(""),de(""),J([]),xt([]),He(""),yt(null),ue(!1),S(1),Z(0),se(""),wt(void 0),W(1),Ct("portrait"),Tt(0),It(0),u()};if(!c)return null;let x=w(c.name,T),sr=((Ao+V)%360+360)%360,Ce=V%180===0?Xe:Xe>0?1/Xe:0,cr=Math.max(ee.width-co,lo),lr=Math.max(ee.height-co,lo),qe=ee.width>0&&Ce>0?Math.min(cr,lr*Ce):pe==="portrait"?600:800,dr=typeof window<"u"&&window.devicePixelRatio||1,Zt=Fr/dr*(Ce>0?Math.min(1,Ce):1),Ke=Math.round(Math.min(qe*C,Zt)),Qt=Math.round(qe*C),ur=Qt>Ke,mr=Math.max(16,Math.round(ee.width)-et),pr=Math.max(16,Math.round(ee.height)-et),hr=pe==="landscape"?"200px":"150px",fr=pe==="landscape"?.18:.17,Jt=()=>I?(0,o.jsx)(n.Box,{ref:We,sx:{width:hr,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:I},(e,t)=>(0,o.jsxs)(n.Box,{ref:r=>{Lt.current[t]=r},children:[(0,o.jsx)(n.Box,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:k===t+1?"2px solid":"1px solid",borderColor:k===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:pe==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{W(t+1),f&&Ae(!1)},children:(0,o.jsx)(X.Document,{file:v,options:Et,loading:(0,o.jsx)("div",{style:{display:"none"}}),children:(0,o.jsx)(X.Page,{pageNumber:t+1,scale:fr,loading:(0,o.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),(0,o.jsx)(n.Typography,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:k===t+1?"primary.main":"",fontWeight:k===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,gr=()=>{let e=w(c?.name||"",T);if(Ee&&!(e==="spreadsheet"))return(0,o.jsx)(n.Box,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(st.LoadingProgress,{visible:ae,exitDelay:100,onComplete:nr})});if(mt)return(0,o.jsxs)(n.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,o.jsx)(n.Typography,{color:"error",variant:"h6",children:mt}),(0,o.jsx)(n.Typography,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]});if(!v)return null;switch(e){case"image":return(0,o.jsx)(n.Box,{ref:Ue,"data-allow-pinch":"true",onPointerDown:Qo,onPointerMove:Jo,onPointerUp:Ht,onPointerCancel:Ht,sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"hidden",height:"100%",backgroundColor:"grey.100",p:2,touchAction:"none",overscrollBehavior:"contain",userSelect:"none","&:active":{cursor:"grabbing"}},children:(0,o.jsx)("img",{ref:Zo,src:v,alt:c.name,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",transform:"translate(0px, 0px) scale(1) rotate(0deg)",transformOrigin:"center center",pointerEvents:"none"}})});case"pdf":return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.Box,{ref:Vt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!f&&Jt(),(0,o.jsx)(n.Box,{ref:Xo,className:"draggable-scroll",onMouseDown:r=>{let a=r.currentTarget;Gt(r,a)},"data-allow-pinch":"true",onPointerDown:or,onPointerMove:rr,onPointerUp:_t,onPointerCancel:_t,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:f?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...f&&{px:`${mr}px`,py:`${pr}px`},...ur&&{"& .react-pdf__Page__canvas":{width:`${Qt}px !important`,height:"auto !important"}}}},children:(0,o.jsx)(X.Document,{file:v,onLoadSuccess:Yo,onLoadError:r=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",r),se("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:(0,o.jsx)("div",{style:{display:"none"}}),error:(0,o.jsxs)(n.Box,{sx:{textAlign:"center",p:4},children:[(0,o.jsx)(n.Typography,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),(0,o.jsx)(n.Typography,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:Et,children:(0,o.jsx)(X.Page,{pageNumber:k,width:Ke,rotate:V===0?void 0:sr,loading:(0,o.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Oo,onRenderSuccess:Ot,onRenderError:Ot})})})]}),f&&(0,o.jsx)(n.Drawer,{anchor:"left",open:Vo,onClose:()=>Ae(!1),sx:{zIndex:r=>r.zIndex.modal+2},children:Jt()})]});case"text":case"code":return(0,o.jsx)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:ht?(0,o.jsx)(n.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,o.jsx)(at.default,{height:"100%",language:ke(c.name),value:ht,theme:"vs-dark",loading:!1,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:Q,lineHeight:Math.round(Q*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(r,a)=>{r.onDidAttemptReadOnlyEdit(()=>{});let l=r.getDomNode();if(l){let d=document.createElement("style");d.textContent=`
3
3
  .monaco-editor .margin-view-overlays {
4
4
  border-right: 1px solid #3c3c3c;
5
5
  }
@@ -27,7 +27,7 @@
27
27
  .monaco-editor .overlay.cursor-layer {
28
28
  padding-left: 15px !important;
29
29
  }
30
- `,s.appendChild(u)}}})}):(0,n.jsx)(r.Box,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(r.Typography,{color:"text.secondary",children:"\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"html":return(0,n.jsx)(r.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",overflow:"hidden",borderRadius:1},children:ke?(0,n.jsxs)(r.Box,{sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[(0,n.jsxs)(r.Box,{sx:{display:"flex",gap:1,p:1,borderBottom:"1px solid",borderColor:"grey.300",backgroundColor:"grey.50"},children:[(0,n.jsx)(r.Button,{variant:Ie==="preview"?"contained":"outlined",size:"small",onClick:()=>at("preview"),children:"\uBBF8\uB9AC\uBCF4\uAE30"}),(0,n.jsx)(r.Button,{variant:Ie==="source"?"contained":"outlined",size:"small",onClick:()=>at("source"),children:"\uC18C\uC2A4\uCF54\uB4DC"})]}),Ie==="preview"?(0,n.jsx)(r.Box,{sx:{flex:1,overflow:"auto",backgroundColor:"white",border:"1px solid",borderColor:"grey.300",fontSize:`${G}px`,p:2},dangerouslySetInnerHTML:{__html:ke}}):(0,n.jsx)(r.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,n.jsx)(Je.default,{height:"100%",language:"html",value:ke,theme:"vs-dark",options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:G,lineHeight:Math.round(G*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,a)=>{o.onDidAttemptReadOnlyEdit(()=>{});let s=o.getDomNode();if(s){let u=document.createElement("style");u.textContent=`
30
+ `,l.appendChild(d)}}})}):(0,o.jsx)(n.Box,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(n.Typography,{color:"text.secondary",children:"\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"html":return(0,o.jsx)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",overflow:"hidden",borderRadius:1},children:Se?(0,o.jsxs)(n.Box,{sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[(0,o.jsxs)(n.Box,{sx:{display:"flex",gap:1,p:1,borderBottom:"1px solid",borderColor:"grey.300",backgroundColor:"grey.50"},children:[(0,o.jsx)(n.Button,{variant:De==="preview"?"contained":"outlined",size:"small",onClick:()=>ft("preview"),children:"\uBBF8\uB9AC\uBCF4\uAE30"}),(0,o.jsx)(n.Button,{variant:De==="source"?"contained":"outlined",size:"small",onClick:()=>ft("source"),children:"\uC18C\uC2A4\uCF54\uB4DC"})]}),De==="preview"?(0,o.jsx)(n.Box,{sx:{flex:1,overflow:"auto",backgroundColor:"white",border:"1px solid",borderColor:"grey.300",fontSize:`${Q}px`,p:2},dangerouslySetInnerHTML:{__html:Se}}):(0,o.jsx)(n.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,o.jsx)(at.default,{height:"100%",language:"html",value:Se,theme:"vs-dark",options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:Q,lineHeight:Math.round(Q*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(r,a)=>{r.onDidAttemptReadOnlyEdit(()=>{});let l=r.getDomNode();if(l){let d=document.createElement("style");d.textContent=`
31
31
  .monaco-editor .margin-view-overlays {
32
32
  border-right: 1px solid #3c3c3c;
33
33
  }
@@ -55,4 +55,4 @@
55
55
  .monaco-editor .overlay.cursor-layer {
56
56
  padding-left: 15px !important;
57
57
  }
58
- `,s.appendChild(u)}}})})]}):(0,n.jsx)(r.Box,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(r.Typography,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return(0,n.jsx)(r.Box,{className:"draggable-scroll",onMouseDown:o=>{let a=o.currentTarget;Wt(o,a)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:(0,n.jsx)("video",{src:w,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${M}) rotate(${H}deg)`,transition:"transform 0.3s ease",pointerEvents:M>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return(0,n.jsxs)(r.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[Le.length>0||ut?(0,n.jsxs)(r.Box,{sx:{flex:1,position:"relative",overflow:"scroll",backgroundColor:"white",minHeight:"400px",minWidth:"100%","&::-webkit-scrollbar":{width:"18px",height:"18px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#888",borderRadius:"10px",border:"2px solid #f1f1f1","&:hover":{backgroundColor:"#555"}},"&::-webkit-scrollbar-corner":{backgroundColor:"#f1f1f1"}},children:[Le.length>0&&(0,n.jsx)(r.Box,{sx:{minWidth:"max-content",minHeight:"max-content"},children:(0,n.jsx)(bn.default,{data:Le,darkMode:!1})}),ut&&(0,n.jsx)(r.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)",zIndex:1e3},children:(0,n.jsx)(et.LoadingProgress,{visible:Mn,exitDelay:200,fadeoutDuration:300,onComplete:Un})})]}):(0,n.jsx)(r.Box,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(r.Typography,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),st.length>1&&(0,n.jsx)(r.Box,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:(0,n.jsx)(r.Tabs,{value:vn,onChange:(o,a)=>Nn(a),variant:"scrollable",scrollButtons:"auto",sx:{minHeight:"36px","& .MuiTabs-flexContainer":{gap:"6px"},"& .MuiTabs-indicator":{display:"none"},"& .MuiTab-root":{minHeight:"32px",fontSize:"0.875rem",textTransform:"none",padding:"6px 16px",margin:"0",backgroundColor:"white",border:"1px solid #d0d0d0",borderRadius:"0 0 4px 4px",color:"#666",minWidth:"80px",transition:"all 0.2s ease","&:hover":{backgroundColor:"#f8f8f8",color:"#333"},"&.Mui-selected":{backgroundColor:"primary.main",color:"white",border:"1px solid",borderColor:"primary.dark",fontWeight:600,"&:hover":{backgroundColor:"primary.dark"}}}},children:st.map(o=>(0,n.jsx)(r.Tab,{label:o,value:o},o))})})]});case"audio":return(0,n.jsxs)(r.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[(0,n.jsx)(r.Typography,{variant:"h6",sx:{mb:2},children:c.name}),(0,n.jsx)("audio",{src:w,controls:!0,style:{width:"100%",maxWidth:"500px"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC624\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})]});default:return(0,n.jsxs)(r.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,n.jsx)(r.Typography,{variant:"h6",color:"text.secondary",children:"\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4"}),(0,n.jsx)(r.Typography,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]})}};return(0,n.jsxs)(r.Dialog,{open:l,onClose:_t,maxWidth:"lg",fullScreen:!0,children:[(0,n.jsxs)(r.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:p?1:3},onContextMenu:e=>e.preventDefault(),children:[(0,n.jsxs)(r.Box,{sx:{display:"flex",alignItems:"center",gap:N?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:p?"1.7rem":void 0}},children:[p&&x==="pdf"&&T?(0,n.jsx)(r.Tooltip,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:(0,n.jsx)(r.IconButton,{onClick:()=>Pe(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,n.jsx)(sn.default,{})})}):null,x==="pdf"&&T?(0,n.jsxs)(r.Box,{sx:{display:"flex",alignItems:"center",gap:p?0:.5},children:[(0,n.jsx)(r.Tooltip,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:(0,n.jsx)("span",{style:{display:"inline-flex"},children:(0,n.jsx)(r.IconButton,{onClick:ce,disabled:k<=1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(dn.default,{})})})}),(0,n.jsx)(r.Typography,{variant:"body2",sx:{minWidth:p?"auto":"80px",textAlign:"center",color:"white",px:p?.5:1,fontSize:p?"1.05rem":void 0,fontWeight:p?600:void 0,whiteSpace:"nowrap"},children:N?k:`${k} / ${T}`}),(0,n.jsx)(r.Tooltip,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:(0,n.jsx)("span",{style:{display:"inline-flex"},children:(0,n.jsx)(r.IconButton,{onClick:ue,disabled:k>=T,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(mn.default,{})})})})]}):null]}),(0,n.jsx)(r.Box,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:N?0:2,overflow:"hidden"},children:!N&&(0,n.jsxs)(r.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[xo(x),c.name]})}),(0,n.jsxs)(r.Box,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:N?.35:1,"& .MuiSvgIcon-root":{fontSize:p?"1.7rem":void 0}},children:[(x==="image"||x==="pdf"||x==="text"||x==="html"||x==="code"||x==="spreadsheet")&&(0,n.jsxs)(n.Fragment,{children:[!(p&&(x==="image"||x==="pdf"))&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.Tooltip,{title:"\uD655\uB300",children:(0,n.jsx)(r.IconButton,{onClick:Fn,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(cn.default,{})})}),(0,n.jsx)(r.Tooltip,{title:"\uCD95\uC18C",children:(0,n.jsx)(r.IconButton,{onClick:Bn,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(un.default,{})})})]}),!p&&(0,n.jsx)(r.Tooltip,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:(0,n.jsx)(r.IconButton,{onClick:Vt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(Ze.default,{})})}),!p&&(x==="image"||x==="pdf")&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.Tooltip,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,n.jsx)(r.IconButton,{onClick:zt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(qe.default,{})})}),(0,n.jsx)(r.Tooltip,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,n.jsx)(r.IconButton,{onClick:At,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(Ke.default,{})})})]})]}),!p&&(0,n.jsx)(r.Tooltip,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:(0,n.jsx)(r.IconButton,{onClick:Mt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(Ge.default,{})})}),p&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.Tooltip,{title:"\uB354\uBCF4\uAE30",children:(0,n.jsx)(r.IconButton,{onClick:e=>j(e.currentTarget),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,n.jsx)(ln.default,{})})}),(0,n.jsxs)(r.Menu,{anchorEl:pt,open:!!pt,onClose:()=>j(null),children:[x==="image"||x==="pdf"?(0,n.jsxs)(r.MenuItem,{onClick:()=>{Vt(),j(null)},children:[(0,n.jsx)(r.ListItemIcon,{children:(0,n.jsx)(Ze.default,{fontSize:"small"})}),(0,n.jsx)(r.ListItemText,{children:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30"})]}):null,x==="image"||x==="pdf"?(0,n.jsxs)(r.MenuItem,{onClick:()=>{zt(),j(null)},children:[(0,n.jsx)(r.ListItemIcon,{children:(0,n.jsx)(qe.default,{fontSize:"small"})}),(0,n.jsx)(r.ListItemText,{children:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,x==="image"||x==="pdf"?(0,n.jsxs)(r.MenuItem,{onClick:()=>{At(),j(null)},children:[(0,n.jsx)(r.ListItemIcon,{children:(0,n.jsx)(Ke.default,{fontSize:"small"})}),(0,n.jsx)(r.ListItemText,{children:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,(0,n.jsxs)(r.MenuItem,{onClick:()=>{Mt(),j(null)},children:[(0,n.jsx)(r.ListItemIcon,{children:(0,n.jsx)(Ge.default,{fontSize:"small"})}),(0,n.jsx)(r.ListItemText,{children:"\uB2E4\uC6B4\uB85C\uB4DC"})]})]})]}),(0,n.jsx)(r.Tooltip,{title:"\uB2EB\uAE30",children:(0,n.jsx)(r.IconButton,{onClick:_t,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,n.jsx)(an.default,{})})})]})]}),(0,n.jsx)(r.DialogContent,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:no()}),(0,n.jsx)(r.Snackbar,{open:!!dt,autoHideDuration:2e3,onClose:()=>ie(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:dt,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},wn=tt;
58
+ `,l.appendChild(d)}}})})]}):(0,o.jsx)(n.Box,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(n.Typography,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return(0,o.jsx)(n.Box,{className:"draggable-scroll",onMouseDown:r=>{let a=r.currentTarget;Gt(r,a)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:(0,o.jsx)("video",{src:v,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${C}) rotate(${V}deg)`,transition:"transform 0.3s ease",pointerEvents:C>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return(0,o.jsxs)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[Be.length>0||bt?(0,o.jsxs)(n.Box,{sx:{flex:1,position:"relative",overflow:"scroll",backgroundColor:"white",minHeight:"400px",minWidth:"100%","&::-webkit-scrollbar":{width:"18px",height:"18px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#888",borderRadius:"10px",border:"2px solid #f1f1f1","&:hover":{backgroundColor:"#555"}},"&::-webkit-scrollbar-corner":{backgroundColor:"#f1f1f1"}},children:[Be.length>0&&(0,o.jsx)(n.Box,{sx:{minWidth:"max-content",minHeight:"max-content"},children:(0,o.jsx)(ko.default,{data:Be,darkMode:!1})}),bt&&(0,o.jsx)(n.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)",zIndex:1e3},children:(0,o.jsx)(st.LoadingProgress,{visible:zo,exitDelay:200,fadeoutDuration:300,onComplete:ir})})]}):(0,o.jsx)(n.Box,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(n.Typography,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),gt.length>1&&(0,o.jsx)(n.Box,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:(0,o.jsx)(n.Tabs,{value:Ho,onChange:(r,a)=>ar(a),variant:"scrollable",scrollButtons:"auto",sx:{minHeight:"36px","& .MuiTabs-flexContainer":{gap:"6px"},"& .MuiTabs-indicator":{display:"none"},"& .MuiTab-root":{minHeight:"32px",fontSize:"0.875rem",textTransform:"none",padding:"6px 16px",margin:"0",backgroundColor:"white",border:"1px solid #d0d0d0",borderRadius:"0 0 4px 4px",color:"#666",minWidth:"80px",transition:"all 0.2s ease","&:hover":{backgroundColor:"#f8f8f8",color:"#333"},"&.Mui-selected":{backgroundColor:"primary.main",color:"white",border:"1px solid",borderColor:"primary.dark",fontWeight:600,"&:hover":{backgroundColor:"primary.dark"}}}},children:gt.map(r=>(0,o.jsx)(n.Tab,{label:r,value:r},r))})})]});case"audio":return(0,o.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[(0,o.jsx)(n.Typography,{variant:"h6",sx:{mb:2},children:c.name}),(0,o.jsx)("audio",{src:v,controls:!0,style:{width:"100%",maxWidth:"500px"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC624\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})]});default:return(0,o.jsxs)(n.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,o.jsx)(n.Typography,{variant:"h6",color:"text.secondary",children:"\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4"}),(0,o.jsx)(n.Typography,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]})}};return(0,o.jsxs)(n.Dialog,{open:s,onClose:Kt,maxWidth:"lg",fullScreen:!0,children:[(0,o.jsxs)(n.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:f?1:3},onContextMenu:e=>e.preventDefault(),children:[(0,o.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:K?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:f?"1.7rem":void 0}},children:[f&&x==="pdf"&&I?(0,o.jsx)(n.Tooltip,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:(0,o.jsx)(n.IconButton,{onClick:()=>Ae(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,o.jsx)(ho.default,{})})}):null,x==="pdf"&&I?(0,o.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:f?0:.5},children:[(0,o.jsx)(n.Tooltip,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(n.IconButton,{onClick:ge,disabled:k<=1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(yo.default,{})})})}),(0,o.jsx)(n.Typography,{variant:"body2",sx:{minWidth:f?"auto":"80px",textAlign:"center",color:"white",px:f?.5:1,fontSize:f?"1.05rem":void 0,fontWeight:f?600:void 0,whiteSpace:"nowrap"},children:K?k:`${k} / ${I}`}),(0,o.jsx)(n.Tooltip,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(n.IconButton,{onClick:xe,disabled:k>=I,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(bo.default,{})})})})]}):null]}),(0,o.jsx)(n.Box,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:K?0:2,overflow:"hidden"},children:!K&&(0,o.jsxs)(n.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Er(x),c.name]})}),(0,o.jsxs)(n.Box,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:K?.35:1,"& .MuiSvgIcon-root":{fontSize:f?"1.7rem":void 0}},children:[(x==="image"||x==="pdf"||x==="text"||x==="html"||x==="code"||x==="spreadsheet")&&(0,o.jsxs)(o.Fragment,{children:[!(f&&(x==="image"||x==="pdf"))&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.Tooltip,{title:"\uD655\uB300",children:(0,o.jsx)(n.IconButton,{onClick:$o,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(go.default,{})})}),(0,o.jsx)(n.Tooltip,{title:"\uCD95\uC18C",children:(0,o.jsx)(n.IconButton,{onClick:Go,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(xo.default,{})})})]}),!f&&(0,o.jsx)(n.Tooltip,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:(0,o.jsx)(n.IconButton,{onClick:$t,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(nt.default,{})})}),!f&&(x==="image"||x==="pdf")&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.Tooltip,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,o.jsx)(n.IconButton,{onClick:Ut,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(ot.default,{})})}),(0,o.jsx)(n.Tooltip,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,o.jsx)(n.IconButton,{onClick:Nt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(rt.default,{})})})]})]}),!f&&(0,o.jsx)(n.Tooltip,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:(0,o.jsx)(n.IconButton,{onClick:Pt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(tt.default,{})})}),f&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.Tooltip,{title:"\uB354\uBCF4\uAE30",children:(0,o.jsx)(n.IconButton,{onClick:e=>N(e.currentTarget),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,o.jsx)(fo.default,{})})}),(0,o.jsxs)(n.Menu,{anchorEl:Mt,open:!!Mt,onClose:()=>N(null),children:[x==="image"||x==="pdf"?(0,o.jsxs)(n.MenuItem,{onClick:()=>{$t(),N(null)},children:[(0,o.jsx)(n.ListItemIcon,{children:(0,o.jsx)(nt.default,{fontSize:"small"})}),(0,o.jsx)(n.ListItemText,{children:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30"})]}):null,x==="image"||x==="pdf"?(0,o.jsxs)(n.MenuItem,{onClick:()=>{Ut(),N(null)},children:[(0,o.jsx)(n.ListItemIcon,{children:(0,o.jsx)(ot.default,{fontSize:"small"})}),(0,o.jsx)(n.ListItemText,{children:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,x==="image"||x==="pdf"?(0,o.jsxs)(n.MenuItem,{onClick:()=>{Nt(),N(null)},children:[(0,o.jsx)(n.ListItemIcon,{children:(0,o.jsx)(rt.default,{fontSize:"small"})}),(0,o.jsx)(n.ListItemText,{children:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,(0,o.jsxs)(n.MenuItem,{onClick:()=>{Pt(),N(null)},children:[(0,o.jsx)(n.ListItemIcon,{children:(0,o.jsx)(tt.default,{fontSize:"small"})}),(0,o.jsx)(n.ListItemText,{children:"\uB2E4\uC6B4\uB85C\uB4DC"})]})]})]}),(0,o.jsx)(n.Tooltip,{title:"\uB2EB\uAE30",children:(0,o.jsx)(n.IconButton,{onClick:Kt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(po.default,{})})})]})]}),(0,o.jsx)(n.DialogContent,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:gr()}),(0,o.jsx)(n.Snackbar,{open:!!vt,autoHideDuration:2e3,onClose:()=>me(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:vt,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},Lo=ct;var lt=require("react/jsx-runtime");function re(s){return(0,lt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:s.width||"22px",fill:s.fill||"#E91E63",...s,children:(0,lt.jsx)("path",{d:"M488.426,197.019H475.2v-63.816c0-0.401-0.063-0.799-0.116-1.205c-0.021-2.534-0.827-5.023-2.562-6.992L366.325,3.691 c-0.032-0.031-0.063-0.042-0.085-0.073c-0.633-0.707-1.371-1.298-2.151-1.804c-0.231-0.158-0.464-0.287-0.706-0.422 c-0.676-0.366-1.393-0.675-2.131-0.896c-0.2-0.053-0.38-0.135-0.58-0.19C359.87,0.119,359.037,0,358.193,0H97.2 c-11.918,0-21.6,9.693-21.6,21.601v175.413H62.377c-17.049,0-30.873,13.818-30.873,30.87v160.542 c0,17.044,13.824,30.876,30.873,30.876h13.224V529.2c0,11.907,9.682,21.601,21.6,21.601h356.4c11.907,0,21.6-9.693,21.6-21.601 V419.302h13.226c17.044,0,30.871-13.827,30.871-30.87V227.89C519.297,210.838,505.47,197.019,488.426,197.019z M97.2,21.605 h250.193v110.51c0,5.967,4.841,10.8,10.8,10.8h95.407v54.108H97.2V21.605z M406.467,363.983h-26.104l-1.751-46.464 c-0.527-14.598-1.055-32.236-1.055-49.895h-0.517c-3.691,15.485-8.596,32.782-13.163,47.015l-14.354,47.366h-20.851l-12.625-47.002 c-3.85-14.228-7.889-31.524-10.694-47.374h-0.348c-0.707,16.397-1.234,35.129-2.1,50.253l-2.114,46.111h-24.711l7.535-121.395 h35.575l11.569,40.521c3.691,14.048,7.362,29.183,9.999,43.416h0.521c3.344-14.054,7.356-30.074,11.222-43.585l12.614-40.353 h34.879L406.467,363.983z M174.438,265.642v-23.058h90.77v23.058h-32.239v98.342h-26.821v-98.342H174.438z M89.403,313.195v50.788 H62.604V242.584h26.799v46.654h43.999v-46.654h26.645v121.399h-26.645v-50.794H89.403V313.195z M453.601,523.353H97.2V419.302 h356.4V523.353z M500.787,363.983h-73.786V242.584h26.811v98.339h46.976V363.983z"})})}var L=require("react/jsx-runtime");function ne(s){return(0,L.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:s.width||"22px",fill:s.fill||"#B45309",...s,children:[(0,L.jsx)("path",{d:"M475.095,131.992c-0.032-2.526-0.833-5.021-2.568-6.993L366.324,3.694c-0.021-0.034-0.053-0.045-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.422c-0.686-0.366-1.393-0.67-2.131-0.892 c-0.2-0.058-0.379-0.14-0.58-0.192C359.87,0.114,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.202 C475.2,132.796,475.137,132.398,475.095,131.992z M243.599,523.494H141.75v-15.936l62.398-89.797v-0.785h-56.565v-24.484h95.051 v17.106l-61.038,88.636v0.771h62.002V523.494z M292.021,523.494h-29.744V392.492h29.744V523.494z M399.705,463.44 c-10.104,9.524-25.069,13.796-42.566,13.796c-3.893,0-7.383-0.19-10.104-0.58v46.849h-29.352V394.242 c9.134-1.561,21.958-2.721,40.036-2.721c18.277,0,31.292,3.491,40.046,10.494c8.354,6.607,13.996,17.486,13.996,30.322 C411.761,445.163,407.479,456.053,399.705,463.44z M97.2,366.752V21.601h129.167v-3.396h32.756v3.396h88.28v110.515 c0,5.961,4.831,10.8,10.8,10.8H453.6l0.011,223.836H97.2z"}),(0,L.jsx)("path",{d:"M359.279,413.87c-6.033,0-10.114,0.586-12.245,1.171v38.676c2.521,0.585,5.632,0.785,9.914,0.785 c15.736,0,25.46-7.979,25.46-21.378C382.408,421.063,374.045,413.87,359.279,413.87z"}),(0,L.jsx)("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),(0,L.jsx)("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),(0,L.jsx)("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),(0,L.jsx)("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),(0,L.jsx)("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),(0,L.jsx)("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),(0,L.jsx)("path",{d:"M259.124,149.537c-23.193,0-34.225,18.792-34.225,41.99l-7.765,70.348c0,23.198,18.792,42.003,41.984,42.003 c23.19,0,41.974-18.805,41.974-42.003l-7.741-70.348C293.361,168.334,282.318,149.537,259.124,149.537z M273.04,285.431h-27.799 v-58.728h27.799V285.431z"})]})}var Ro=p(require("@mui/icons-material/TextSnippet"),1),Fo=p(require("@mui/icons-material/VideoFile"),1),Eo=p(require("@mui/icons-material/AudioFile"),1),Po=p(require("@mui/icons-material/Description"),1),So=p(require("@mui/icons-material/InsertDriveFile"),1),Do=p(require("@mui/icons-material/Code"),1),Bo=p(require("@mui/icons-material/TableView"),1);var R=require("react/jsx-runtime");function ie(s,u=22){let c=`${u}px`,m={fontSize:u};switch(s){case"image":return(0,R.jsx)(O,{width:c,height:c});case"pdf":return(0,R.jsx)(U,{width:c,height:c});case"html":return(0,R.jsx)(re,{width:c,height:c});case"archive":return(0,R.jsx)(ne,{width:c,height:c});case"text":return(0,R.jsx)(Ro.default,{sx:{...m,color:"#66BB6A"}});case"spreadsheet":return(0,R.jsx)(Bo.default,{sx:{...m,color:"#4CAF50"}});case"code":return(0,R.jsx)(Do.default,{sx:{...m,color:"#2196F3"}});case"video":return(0,R.jsx)(Fo.default,{sx:{...m,color:"#AB47BC"}});case"audio":return(0,R.jsx)(Eo.default,{sx:{...m,color:"#FF7043"}});case"office":return(0,R.jsx)(Po.default,{sx:{...m,color:"#FFA726"}});default:return(0,R.jsx)(So.default,{sx:{...m,color:"#78909C"}})}}var Pr=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function dt({fileName:s,mime:u,size:c=22}){let m=s.includes(".")?s.slice(s.lastIndexOf(".")+1).toLowerCase():"";return Pr.has(m)?ie("archive",c):ie(w(s,u??""),c)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ehfuse/file-viewer",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "React 파일 미리보기 다이얼로그 (이미지/PDF/텍스트/코드/HTML/스프레드시트/비디오/오디오, MUI 기반)",
6
6
  "publishConfig": {
@@ -42,7 +42,13 @@
42
42
  "types": "./dist/index.d.ts",
43
43
  "import": "./dist/index.esm.js",
44
44
  "require": "./dist/index.js"
45
- }
45
+ },
46
+ "./icons": {
47
+ "types": "./dist/icons/index.d.ts",
48
+ "import": "./dist/icons.esm.js",
49
+ "require": "./dist/icons.js"
50
+ },
51
+ "./package.json": "./package.json"
46
52
  },
47
53
  "scripts": {
48
54
  "build": "node build.js",