@ehfuse/file-viewer 0.2.5 → 0.2.7
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.
- package/dist/index.esm.js +4 -4
- package/dist/index.js +4 -4
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{useState as p,useEffect as P,useMemo as uo,useCallback as M,useRef as b}from"react";import{Dialog as Mn,DialogTitle as Cn,DialogContent as Tn,Drawer as In,IconButton as T,Box as c,Typography as R,Tooltip as B,Button as mo,Tabs as kn,Tab as Ln,Menu as En,MenuItem as Se,Snackbar as Rn,ListItemIcon as Pe,ListItemText as Be,useMediaQuery as Fn,useTheme as Sn}from"@mui/material";import Pn from"@mui/icons-material/Close";import Bn from"@mui/icons-material/Menu";import Dn from"@mui/icons-material/MoreHoriz";import po from"@mui/icons-material/Download";import zn from"@mui/icons-material/Add";import Hn from"@mui/icons-material/Remove";import ho from"@mui/icons-material/RotateLeft";import fo from"@mui/icons-material/RotateRight";import go from"@mui/icons-material/FitScreen";import De from"@mui/icons-material/KeyboardArrowLeft";import ze from"@mui/icons-material/KeyboardArrowRight";import Vn from"@mui/icons-material/TextSnippet";import An from"@mui/icons-material/VideoFile";import Xn from"@mui/icons-material/AudioFile";import Wn from"@mui/icons-material/Description";import _n from"@mui/icons-material/InsertDriveFile";import xo from"@mui/icons-material/Code";import Yn from"@mui/icons-material/TableView";import{Document as yo,Page as bo,pdfjs as jn}from"react-pdf";import vo from"@monaco-editor/react";import On from"react-spreadsheet";import*as pe from"xlsx";import{LoadingProgress as wo}from"@ehfuse/mui-fadeout-loading-progress";var lt=a=>{let s=a.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(s)?"image":s==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(s)?"text":["csv","xls","xlsx"].includes(s)?"spreadsheet":["html","htm"].includes(s)?"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(s)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(s)?"video":["mp3","wav","ogg","m4a","aac"].includes(s)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(s)?"office":"unsupported"},ao=a=>{let s=(a||"").toLowerCase().split(";")[0].trim();return s?s.startsWith("image/")?"image":s==="application/pdf"?"pdf":s.startsWith("video/")?"video":s.startsWith("audio/")?"audio":s==="text/html"?"html":s==="text/csv"||s==="application/vnd.ms-excel"||s==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":s.startsWith("text/")||s==="application/json"||s==="application/xml"?"text":"unsupported":"unsupported"},k=(a,s)=>{let u=lt(a);return u!=="unsupported"?u:ao(s)},fn=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),gn=a=>fn.has(lt(a)),xn={"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"},yn=(a,s)=>{let u=(a??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(u))return u;let m=(s??"").trim().toLowerCase().split(";")[0],O=xn[m]??"";return O?`${u}.${O}`:u},st=a=>{let s=a.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"}[s]||"plaintext"};var bn=a=>(a||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",ct=(a,s)=>{let u=URL.createObjectURL(a),m=document.createElement("a");m.href=u,m.download=bn(s),m.rel="noopener",document.body.appendChild(m),m.click(),m.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),6e4)};var lo=async a=>{let s=URL.createObjectURL(a);try{let u=await new Promise(($,Q)=>{let E=new Image;E.onload=()=>$(E),E.onerror=()=>Q(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),E.src=s}),m=document.createElement("canvas");m.width=u.naturalWidth||u.width||1024,m.height=u.naturalHeight||u.height||1024;let O=m.getContext("2d");if(!O)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return O.drawImage(u,0,0,m.width,m.height),await new Promise(($,Q)=>{m.toBlob(E=>E?$(E):Q(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(s)}};import{useMediaQuery as vn,useTheme as wn}from"@mui/material";function so(){let a=wn();return!vn(a.breakpoints.up("lg"))}import{jsx as ne,jsxs as co}from"react/jsx-runtime";function re(a){return co("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:a.width||"22px",...a,children:[ne("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"}),ne("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),ne("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"}),ne("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"}),co("g",{children:[ne("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),ne("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 D,jsxs as dt}from"react/jsx-runtime";function ie(a){return D("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:a.width||"28px",...a,children:dt("g",{children:[D("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 "}),D("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),dt("g",{children:[dt("g",{children:[D("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"}),D("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"}),D("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),D("g",{children:D("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"})})]}),D("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 "}),D("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),D("g",{children:D("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 me,jsx as n,jsxs as h}from"react/jsx-runtime";var Un="/pdfjs",Mo=32,Co=240,Nn=8192,ut=.25,mt=8,pt=80,To=80,$n=a=>{switch(a){case"image":return n(re,{});case"pdf":return n(ie,{});case"text":return n(Vn,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return n(Yn,{sx:{mr:1,color:"#4CAF50"}});case"html":return n(xo,{sx:{mr:1,color:"#E91E63"}});case"code":return n(xo,{sx:{mr:1,color:"#2196F3"}});case"video":return n(An,{sx:{mr:1,color:"#AB47BC"}});case"audio":return n(Xn,{sx:{mr:1,color:"#FF7043"}});case"office":return n(Wn,{sx:{mr:1,color:"#FFA726"}});default:return n(_n,{sx:{mr:1,color:"#78909C"}})}},Io=a=>typeof a?.rotate=="number"?a.rotate:typeof a?._pageInfo?.rotate=="number"?a._pageInfo.rotate:0,ko=({open:a,onClose:s,file:u,files:m=null,initialIndex:O=0,loadFile:$,onDownload:Q,pdfAssetBase:E=Un})=>{let g=so(),Ro=Sn(),ae=Fn(Ro.breakpoints.down("sm")),x=uo(()=>m&&m.length>0?m:[],[m]),[_,z]=p(0);P(()=>{a&&z(x.length>0?Math.min(Math.max(O,0),x.length-1):0)},[a,O,x]);let d=x.length>0?x[_]??u:u,[Xe,We]=p(!0),[Fo,ht]=p(!1),[I,_e]=p(""),[L,X]=p(1),[U,le]=p(0),[ft,he]=p(""),[C,gt]=p(""),[xt,fe]=p(""),[se,ge]=p(14),[Ye,xe]=p(""),[je,yt]=p("preview"),[Oe,ce]=p([]),[bt,vt]=p([]),[So,Ue]=p(""),[Ne,wt]=p(null),[Mt,ye]=p(!1),[Po,$e]=p(!0),[Ct,be]=p(""),[F,Tt]=p(),[S,G]=p(1),[Bo,Ge]=p(!1),[It,J]=p(null),[ve,kt]=p("portrait"),[Do,Lt]=p(0),[Ke,Et]=p(0),[de,Rt]=p({width:0,height:0}),Ft=b([]),qe=b(null),K=b(null),Ze=b(null),Qe=b(null),zo=M(e=>{if(Ze.current?.disconnect(),Qe.current?.(),Qe.current=null,K.current=e,!e){Ze.current=null;return}let t=i=>{i.touches.length>=2&&i.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),Qe.current=()=>e.removeEventListener("touchmove",t);let o=new ResizeObserver(i=>{let l=i[0]?.contentRect;l&&Rt({width:l.width,height:l.height})});o.observe(e),Ze.current=o;let r=e.getBoundingClientRect();Rt({width:r.width,height:r.height})},[]),[we,St]=p(!1),[Je,Ho]=p({x:0,y:0}),[et,Vo]=p({x:0,y:0}),Ao=M(async(e,t)=>{let o=URL.createObjectURL(e);_e(o),gt(e.type||"");let r=k(t,e.type||"");if(r==="text"||r==="code"){let l=await e.text();fe(l);return}if(r==="html"){let l=await e.text();xe(l);return}if(r!=="spreadsheet")return;let i=t.split(".").pop()?.toLowerCase()||"";if(i==="csv"){let f=(await e.text()).split(`
|
|
2
|
-
`).map(y=>y.split(",").map(V=>({value:V.trim()})));ce(f);return}if(i==="xls"||i==="xlsx"){ye(!0),$e(!0);let l=await e.arrayBuffer(),f=pe.read(l,{type:"array"});vt(f.SheetNames),wt(f);let y=f.SheetNames[0];Ue(y),rt(f,y)}},[]),Me=b(null),Pt=M(async e=>{if(e.blob)return e.blob;if($)return await $(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.")},[$]);P(()=>(d&&a?Yo():(I&&URL.revokeObjectURL(I),Me.current=null,_e(""),fe(""),xe(""),ce([]),ge(14),X(1),le(0)),()=>{I&&URL.revokeObjectURL(I)}),[d,a]);let Xo=({numPages:e})=>{Tt(e),G(1),Re.current=!0},Wo=e=>{let{width:t,height:o}=_o(e);Lt(Io(e)),t>0&&o>0&&Et(t/o);let r=t>o?"landscape":"portrait";kt(r)},_o=e=>{let t=e?.width||0,o=e?.height||0,r=Io(e);try{if(typeof e?.getViewport=="function"){let i=e.getViewport({scale:1,rotation:r});t=i.width,o=i.height}}catch(i){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",i)}return{width:t,height:o}},Ce=M(()=>{G(e=>Math.max(e-1,1))},[]),Te=M(()=>{G(e=>Math.min(e+1,F||1))},[F]),Bt=uo(()=>({cMapUrl:`${E}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${E}/standard_fonts/`,wasmUrl:`${E}/wasm/`}),[E]);P(()=>{typeof window>"u"||(jn.GlobalWorkerOptions.workerSrc=`${E}/pdf.worker.min.mjs`)},[E]),P(()=>{if(!a||x.length<=1||k(d?.name||"",C)==="pdf")return;let e=t=>{t.key==="ArrowLeft"?(t.preventDefault(),z(o=>Math.max(o-1,0))):t.key==="ArrowRight"&&(t.preventDefault(),z(o=>Math.min(o+1,x.length-1)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,x.length,d?.name,C]),P(()=>{if(!a||x.length<=1||k(d?.name||"",C)==="pdf"||L>1)return;let e=0,t=0,o=i=>{e=i.touches[0]?.clientX??0,t=i.touches[0]?.clientY??0},r=i=>{let l=(i.changedTouches[0]?.clientX??0)-e,f=(i.changedTouches[0]?.clientY??0)-t;Math.abs(l)<60||Math.abs(f)>Math.abs(l)||(l<0?z(y=>Math.min(y+1,x.length-1)):z(y=>Math.max(y-1,0)))};return document.addEventListener("touchstart",o,{passive:!0}),document.addEventListener("touchend",r,{passive:!0}),()=>{document.removeEventListener("touchstart",o),document.removeEventListener("touchend",r)}},[a,x.length,d?.name,C,L]),P(()=>{if(!a||k(d?.name||"",C)!=="pdf")return;let e=o=>{switch(o.key){case"ArrowLeft":case"ArrowUp":o.preventDefault(),Ce();break;case"ArrowRight":case"ArrowDown":o.preventDefault(),Te();break;case"Home":o.preventDefault(),G(1);break;case"End":o.preventDefault(),F&&G(F);break}},t=o=>{o.ctrlKey||Math.abs(o.deltaY)>50&&(o.preventDefault(),o.deltaY>0?Te():Ce())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[a,d,C,Ce,Te,F]),P(()=>{if(!F||!a||k(d?.name||"",C)!=="pdf")return;if(S===1&&qe.current){qe.current.scrollTo({top:0,behavior:"smooth"});return}let e=Ft.current[S-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[a,d,C,F,S]),P(()=>{if(Xe){let e=window.setTimeout(()=>ht(!0),180);return()=>window.clearTimeout(e)}},[Xe]);let Yo=async()=>{if(d){We(!0),he(""),gt(""),fe(""),xe(""),ce([]);try{let e=await Pt(d);Me.current=e,await Ao(e,d.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),he("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{We(!1)}}},Dt=async()=>{if(d)try{if(Q){await Q(d);return}let e=Me.current??await Pt(d);ct(e,d.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},jo=()=>{let e=d?k(d.name,C):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(t=>Math.min(t+2,24)):X(e==="pdf"?t=>Math.min(t+.25,mt):t=>Math.min(t+.25,3))},Oo=()=>{let e=d?k(d.name,C):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(t=>Math.max(t-2,10)):X(e==="pdf"?t=>Math.max(t-.25,ut):t=>Math.max(t-.25,.25))},v=b(new Map),Uo=e=>Math.min(Math.max(e,.25),3),No=e=>Math.min(Math.max(e,ut),mt),tt=b(null),Ie=b(null),Y=b({scale:1,tx:0,ty:0,rotation:0}),N=b(0),ee=b(null),ke=b(null),Le=M((e,t,o,r)=>{let i=tt.current,l=Ie.current;if(!i||!l)return{tx:t,ty:o};let f=l.offsetWidth,y=l.offsetHeight,V=(Math.round(r/90)%4+4)%4;if(V===1||V===3){let hn=f;f=y,y=hn}let W=f*e,no=y*e,ro=W>i.clientWidth?(W+i.clientWidth)/2-To:0,io=no>i.clientHeight?(no+i.clientHeight)/2-To:0;return{tx:Math.min(ro,Math.max(-ro,t)),ty:Math.min(io,Math.max(-io,o))}},[]),zt=M((e,t)=>{let o=tt.current,r=Ie.current;if(!o||!r)return e>1;let i=(Math.round(t/90)%4+4)%4,l=i===1||i===3,f=l?r.offsetHeight:r.offsetWidth,y=l?r.offsetWidth:r.offsetHeight;return f*e>o.clientWidth+1||y*e>o.clientHeight+1},[]),q=M(e=>{let t=Ie.current;if(!t)return;let{scale:o,tx:r,ty:i,rotation:l}=Y.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${r}px, ${i}px) scale(${o}) rotate(${l}deg)`},[]),Ht=M(()=>{let e=Y.current,t=Le(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!N.current&&(N.current=requestAnimationFrame(()=>{N.current=0,q(!1)}))},[q,Le]),Vt=M(()=>{N.current&&(cancelAnimationFrame(N.current),N.current=0),v.current.clear(),ee.current=null,ke.current=null},[]),$o=M(e=>{Ie.current=e,e&&(Y.current={scale:1,tx:0,ty:0,rotation:0},q(!1))},[q]);P(()=>{if(k(d?.name||"",C)!=="image")return;let e=Y.current;e.scale=L,e.rotation=U;let t=Le(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,q(!0)},[L,U,d,C,I,q,Le]),P(()=>()=>{N.current&&cancelAnimationFrame(N.current)},[]);let Go=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),v.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...v.current.values()],o=Y.current;if(t.length===2){ee.current=null;let r=e.currentTarget.getBoundingClientRect();ke.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:r.left+r.width/2,centerY:r.top+r.height/2}}else t.length===1&&zt(o.scale,o.rotation)&&(ee.current={startX:e.clientX,startY:e.clientY,baseTx:o.tx,baseTy:o.ty})},Ko=e=>{if(!v.current.has(e.pointerId))return;v.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=Y.current,o=ke.current,r=[...v.current.values()];if(o&&r.length>=2){let l=Math.hypot(r[0].x-r[1].x,r[0].y-r[1].y),f=(r[0].x+r[1].x)/2,y=(r[0].y+r[1].y)/2,V=Uo(o.baseScale*l/o.startDist),W=V/o.baseScale;t.scale=V,t.tx=f-o.centerX-W*(o.startMidX-o.centerX-o.baseTx),t.ty=y-o.centerY-W*(o.startMidY-o.centerY-o.baseTy),Ht();return}let i=ee.current;i&&r.length===1&&(t.tx=i.baseTx+(e.clientX-i.startX),t.ty=i.baseTy+(e.clientY-i.startY),Ht())},At=e=>{if(!v.current.has(e.pointerId))return;v.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=Y.current;if(v.current.size<2&&(ke.current=null,Math.abs(t.scale-L)>.001&&X(t.scale)),v.current.size===0)ee.current=null;else if(v.current.size===1&&zt(t.scale,t.rotation)){let o=[...v.current.values()][0];ee.current={startX:o.x,startY:o.y,baseTx:t.tx,baseTy:t.ty}}},Xt=M(async()=>{if(I)try{let t=await(await fetch(I)).blob(),o=t.type==="image/png"?t:await lo(t);await navigator.clipboard.write([new ClipboardItem({"image/png":o})]),be("\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),be("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[I]);P(()=>{if(!a||k(d?.name||"",C)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let o=t.target,r=o?.tagName;r==="INPUT"||r==="TEXTAREA"||o?.isContentEditable||(t.preventDefault(),Xt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,d,C,Xt]);let te=b(null),H=b(0),ue=b(null),oe=b(null),Z=()=>K.current?.querySelector(".react-pdf__Page")??null,Ee=b(null),Wt=b(null),qo=()=>{let e=Wt.current,t=Z()?.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 r=o.getContext("2d");if(!r)return!1;r.drawImage(t,0,0);let i=t.getBoundingClientRect(),l=e.getBoundingClientRect();return Object.assign(o.style,{position:"absolute",left:`${i.left-l.left}px`,top:`${i.top-l.top}px`,width:`${i.width}px`,height:`${i.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(o),Ee.current=o,!0},_t=()=>{Ee.current?.remove(),Ee.current=null;let e=Z();e&&(e.style.visibility="")},Zo=()=>{H.current||(H.current=requestAnimationFrame(()=>{H.current=0;let e=te.current,t=Z();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,ue.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Yt=()=>{H.current&&(cancelAnimationFrame(H.current),H.current=0),te.current=null,oe.current=null,ue.current=null,_t();let e=Z();e&&(e.style.transform="",e.style.willChange="auto")},jt=e=>{let t=Z(),o=K.current;if(!t||!o)return;t.style.transform&&(t.style.transform="");let r=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=(e[0].x+e[1].x)/2,f=(e[0].y+e[1].y)/2;te.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:l,startMidY:f,lastMidX:l,lastMidY:f,k:1,tx:0,ty:0},ue.current={k:1,tx:0,ty:0,midX:l,midY:f},t.style.willChange="transform"},Qo=e=>{if(e.pointerType!=="touch")return;v.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...v.current.values()];if(t.length===2){if(oe.current||Ee.current)return;jt(t)}},Jo=e=>{if(!v.current.has(e.pointerId))return;v.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=te.current,o=[...v.current.values()];if(t&&o.length>=2){e.preventDefault();let r=Math.hypot(o[0].x-o[1].x,o[0].y-o[1].y),i=Math.min(Math.max(r/t.startDist,ut/(L||1)),mt/(L||1)),l=(o[0].x+o[1].x)/2,f=(o[0].y+o[1].y)/2,y=l-t.rectLeft-i*(t.startMidX-t.rectLeft),V=f-t.rectTop-i*(t.startMidY-t.rectTop),W=pt;y=Math.min(t.viewerR-W-t.rectLeft,Math.max(t.viewerL+W-t.rectLeft-i*t.pageW,y)),V=Math.min(t.viewerB-W-t.rectTop,Math.max(t.viewerT+W-t.rectTop-i*t.pageH,V)),t.k=i,t.tx=y,t.ty=V,t.lastMidX=l,t.lastMidY=f,Zo()}},Ot=e=>{if(v.current.delete(e.pointerId),v.current.size>=2)return;let t=te.current;if(te.current=null,!t)return;H.current&&(cancelAnimationFrame(H.current),H.current=0);let o=ue.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};ue.current=null;let r=No(L*o.k);if(Math.abs(r-L)<.001){let l=K.current;Yt(),l&&(l.scrollLeft-=o.tx,l.scrollTop-=o.ty);return}let i=K.current;if(i){let l=i.getBoundingClientRect();oe.current={u:(o.midX-t.rectLeft-o.tx)/o.k,v:(o.midY-t.rectTop-o.ty)/o.k,offX:o.midX-l.left,offY:o.midY-l.top,factor:r/(L||1)}}if(qo()){let l=Z();l&&(l.style.transform="",l.style.visibility="hidden")}X(r),Math.round(Math.min(it*r,eo))===at&&requestAnimationFrame(()=>Nt())},Re=b(!0),ot=b(null),Ut=()=>{let e=K.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},Nt=()=>{let e=oe.current;if(!e)return;oe.current=null;let t=K.current,o=Z();if(!t||!o)return;_t(),o.style.transform="",o.style.willChange="auto";let r=o.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 l=[...v.current.values()];l.length>=2&&jt(l)},$t=()=>{let e=`${S}:${U}`;if(oe.current){ot.current=e,Nt();return}(Re.current||ot.current!==e)&&(Re.current=!1,ot.current=e,Ut())};P(()=>()=>{H.current&&cancelAnimationFrame(H.current)},[]);let Gt=()=>{le(e=>e-90)},Kt=()=>{le(e=>e+90)},qt=()=>{let e=k(d?.name||"",C);Yt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(14):e==="pdf"?(X(1),L===1&&U===0?Ut():Re.current=!0):(Vt(),Y.current={scale:1,tx:0,ty:0,rotation:0},q(!0),X(1)),le(0)},Zt=(e,t)=>{St(!0),Ho({x:e.clientX,y:e.clientY}),Vo({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Qt=M((e,t)=>{if(!we)return;let o=e.clientX-Je.x,r=e.clientY-Je.y;t.scrollLeft=et.x-o,t.scrollTop=et.y-r,e.preventDefault()},[we,Je,et]),nt=M(()=>{St(!1),document.body.style.cursor="default"},[]);P(()=>{if(we){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(r=>{Qt(t,r)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",nt),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",nt),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[we,Qt,nt]);let en=M(()=>{We(!1),ht(!1)},[]),rt=M(async(e,t)=>{ye(!0),$e(!0);try{await new Promise(f=>setTimeout(f,500));let o=e.Sheets[t],r=pe.utils.decode_range(o["!ref"]||"A1");console.debug("Excel range:",r);let l=pe.utils.sheet_to_json(o,{header:1,range:r,defval:""}).map(f=>f.map(y=>({value:y!=null?String(y):""})));ce(l),await new Promise(f=>setTimeout(f,200))}catch(o){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",o)}finally{$e(!1)}},[]),tn=M(()=>{ye(!1)},[]),on=M(e=>{Ne&&(Ue(e),rt(Ne,e))},[Ne,rt]),Jt=()=>{Vt(),Y.current={scale:1,tx:0,ty:0,rotation:0},be(""),I&&URL.revokeObjectURL(I),Me.current=null,_e(""),fe(""),xe(""),ce([]),vt([]),Ue(""),wt(null),ye(!1),X(1),le(0),he(""),Tt(void 0),G(1),kt("portrait"),Lt(0),Et(0),s()};if(!d)return null;let w=k(d.name,C),nn=((Do+U)%360+360)%360,Fe=U%180===0?Ke:Ke>0?1/Ke:0,rn=Math.max(de.width-Mo,Co),an=Math.max(de.height-Mo,Co),it=de.width>0&&Fe>0?Math.min(rn,an*Fe):ve==="portrait"?600:800,ln=typeof window<"u"&&window.devicePixelRatio||1,eo=Nn/ln*(Fe>0?Math.min(1,Fe):1),at=Math.round(Math.min(it*L,eo)),to=Math.round(it*L),sn=to>at,cn=Math.max(16,Math.round(de.width)-pt),dn=Math.max(16,Math.round(de.height)-pt),un=ve==="landscape"?"200px":"150px",mn=ve==="landscape"?.18:.17,oo=()=>F?n(c,{ref:qe,sx:{width:un,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:F},(e,t)=>h(c,{ref:o=>{Ft.current[t]=o},children:[n(c,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:S===t+1?"2px solid":"1px solid",borderColor:S===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:ve==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{G(t+1),g&&Ge(!1)},children:n(yo,{file:I,options:Bt,loading:n("div",{style:{display:"none"}}),children:n(bo,{pageNumber:t+1,scale:mn,loading:n("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),n(R,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:S===t+1?"primary.main":"",fontWeight:S===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,pn=()=>{let e=k(d?.name||"",C);if(Fo&&!(e==="spreadsheet"))return n(c,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:n(wo,{visible:Xe,exitDelay:100,onComplete:en})});if(ft)return h(c,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[n(R,{color:"error",variant:"h6",children:ft}),n(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(!I)return null;switch(e){case"image":return n(c,{ref:tt,"data-allow-pinch":"true",onPointerDown:Go,onPointerMove:Ko,onPointerUp:At,onPointerCancel:At,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:n("img",{ref:$o,src:I,alt:d.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(me,{children:[h(c,{ref:Wt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!g&&oo(),n(c,{ref:zo,className:"draggable-scroll",onMouseDown:o=>{let r=o.currentTarget;Zt(o,r)},"data-allow-pinch":"true",onPointerDown:Qo,onPointerMove:Jo,onPointerUp:Ot,onPointerCancel:Ot,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:g?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...g&&{px:`${cn}px`,py:`${dn}px`},...sn&&{"& .react-pdf__Page__canvas":{width:`${to}px !important`,height:"auto !important"}}}},children:n(yo,{file:I,onLoadSuccess:Xo,onLoadError:o=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",o),he("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:n("div",{style:{display:"none"}}),error:h(c,{sx:{textAlign:"center",p:4},children:[n(R,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),n(R,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:Bt,children:n(bo,{pageNumber:S,width:at,rotate:U===0?void 0:nn,loading:n("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Wo,onRenderSuccess:$t,onRenderError:$t})})})]}),g&&n(In,{anchor:"left",open:Bo,onClose:()=>Ge(!1),sx:{zIndex:o=>o.zIndex.modal+2},children:oo()})]});case"text":case"code":return n(c,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:xt?n(c,{sx:{flex:1,height:"100%",overflow:"hidden"},children:n(vo,{height:"100%",language:st(d.name),value:xt,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:se,lineHeight:Math.round(se*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,r)=>{o.onDidAttemptReadOnlyEdit(()=>{});let i=o.getDomNode();if(i){let l=document.createElement("style");l.textContent=`
|
|
1
|
+
import{useState as p,useEffect as P,useMemo as uo,useCallback as M,useRef as y}from"react";import{Dialog as wr,DialogTitle as Mr,DialogContent as Cr,Drawer as Tr,IconButton as L,Box as d,Typography as S,Tooltip as D,Button as mo,Tabs as Ir,Tab as kr,Menu as Lr,MenuItem as Pe,Snackbar as Er,ListItemIcon as Se,ListItemText as De,useMediaQuery as Fr,useTheme as Rr}from"@mui/material";import Pr from"@mui/icons-material/Close";import Sr from"@mui/icons-material/Menu";import Dr from"@mui/icons-material/MoreHoriz";import po from"@mui/icons-material/Download";import Br from"@mui/icons-material/Add";import zr from"@mui/icons-material/Remove";import ho from"@mui/icons-material/RotateLeft";import fo from"@mui/icons-material/RotateRight";import go from"@mui/icons-material/FitScreen";import ct from"@mui/icons-material/KeyboardArrowLeft";import dt from"@mui/icons-material/KeyboardArrowRight";import Hr from"@mui/icons-material/TextSnippet";import Vr from"@mui/icons-material/VideoFile";import Ar from"@mui/icons-material/AudioFile";import Xr from"@mui/icons-material/Description";import Wr from"@mui/icons-material/InsertDriveFile";import xo from"@mui/icons-material/Code";import _r from"@mui/icons-material/TableView";import{Document as yo,Page as bo,pdfjs as Yr}from"react-pdf";import vo from"@monaco-editor/react";import jr from"react-spreadsheet";import*as pe from"xlsx";import{LoadingProgress as wo}from"@ehfuse/mui-fadeout-loading-progress";var it=a=>{let s=a.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(s)?"image":s==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(s)?"text":["csv","xls","xlsx"].includes(s)?"spreadsheet":["html","htm"].includes(s)?"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(s)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(s)?"video":["mp3","wav","ogg","m4a","aac"].includes(s)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(s)?"office":"unsupported"},ao=a=>{let s=(a||"").toLowerCase().split(";")[0].trim();return s?s.startsWith("image/")?"image":s==="application/pdf"?"pdf":s.startsWith("video/")?"video":s.startsWith("audio/")?"audio":s==="text/html"?"html":s==="text/csv"||s==="application/vnd.ms-excel"||s==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":s.startsWith("text/")||s==="application/json"||s==="application/xml"?"text":"unsupported":"unsupported"},I=(a,s)=>{let u=it(a);return u!=="unsupported"?u:ao(s)},hr=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),fr=a=>hr.has(it(a)),gr={"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"},xr=(a,s)=>{let u=(a??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(u))return u;let m=(s??"").trim().toLowerCase().split(";")[0],j=gr[m]??"";return j?`${u}.${j}`:u},at=a=>{let s=a.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"}[s]||"plaintext"};var yr=a=>(a||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",lt=(a,s)=>{let u=URL.createObjectURL(a),m=document.createElement("a");m.href=u,m.download=yr(s),m.rel="noopener",document.body.appendChild(m),m.click(),m.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),6e4)};var lo=async a=>{let s=URL.createObjectURL(a);try{let u=await new Promise((N,Z)=>{let E=new Image;E.onload=()=>N(E),E.onerror=()=>Z(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),E.src=s}),m=document.createElement("canvas");m.width=u.naturalWidth||u.width||1024,m.height=u.naturalHeight||u.height||1024;let j=m.getContext("2d");if(!j)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return j.drawImage(u,0,0,m.width,m.height),await new Promise((N,Z)=>{m.toBlob(E=>E?N(E):Z(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(s)}};import{useMediaQuery as br,useTheme as vr}from"@mui/material";function so(){let a=vr();return!br(a.breakpoints.up("lg"))}import{jsx as re,jsxs as co}from"react/jsx-runtime";function ne(a){return co("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:a.width||"22px",...a,children:[re("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"}),re("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),re("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"}),re("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"}),co("g",{children:[re("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),re("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 B,jsxs as st}from"react/jsx-runtime";function ie(a){return B("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:a.width||"28px",...a,children:st("g",{children:[B("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 "}),B("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),st("g",{children:[st("g",{children:[B("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"}),B("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"}),B("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),B("g",{children:B("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"})})]}),B("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 "}),B("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),B("g",{children:B("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 me,jsx as r,jsxs as f}from"react/jsx-runtime";var Or="/pdfjs",Mo=32,Co=240,Ur=8192,ut=.25,mt=8,pt=80,To=80,Nr=a=>{switch(a){case"image":return r(ne,{});case"pdf":return r(ie,{});case"text":return r(Hr,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return r(_r,{sx:{mr:1,color:"#4CAF50"}});case"html":return r(xo,{sx:{mr:1,color:"#E91E63"}});case"code":return r(xo,{sx:{mr:1,color:"#2196F3"}});case"video":return r(Vr,{sx:{mr:1,color:"#AB47BC"}});case"audio":return r(Ar,{sx:{mr:1,color:"#FF7043"}});case"office":return r(Xr,{sx:{mr:1,color:"#FFA726"}});default:return r(Wr,{sx:{mr:1,color:"#78909C"}})}},Io=a=>typeof a?.rotate=="number"?a.rotate:typeof a?._pageInfo?.rotate=="number"?a._pageInfo.rotate:0,ko=({open:a,onClose:s,file:u,files:m=null,initialIndex:j=0,loadFile:N,onDownload:Z,pdfAssetBase:E=Or})=>{let x=so(),Fo=Rr(),ae=Fr(Fo.breakpoints.down("sm")),v=uo(()=>m&&m.length>0?m:[],[m]),[Q,W]=p(0);P(()=>{a&&W(v.length>0?Math.min(Math.max(j,0),v.length-1):0)},[a,j,v]);let c=v.length>0?v[Q]??u:u,[Ve,Ae]=p(!0),[Ro,ht]=p(!1),[T,Xe]=p(""),[k,A]=p(1),[O,le]=p(0),[ft,he]=p(""),[C,gt]=p(""),[xt,fe]=p(""),[se,ge]=p(14),[We,xe]=p(""),[_e,yt]=p("preview"),[Ye,ce]=p([]),[bt,vt]=p([]),[Po,je]=p(""),[Oe,wt]=p(null),[Mt,ye]=p(!1),[So,Ue]=p(!0),[Ct,be]=p(""),[F,Tt]=p(),[R,$]=p(1),[Do,Ne]=p(!1),[It,J]=p(null),[ve,kt]=p("portrait"),[Bo,Lt]=p(0),[$e,Et]=p(0),[de,Ft]=p({width:0,height:0}),Rt=y([]),Ge=y(null),G=y(null),Ke=y(null),qe=y(null),zo=M(e=>{if(Ke.current?.disconnect(),qe.current?.(),qe.current=null,G.current=e,!e){Ke.current=null;return}let t=i=>{i.touches.length>=2&&i.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),qe.current=()=>e.removeEventListener("touchmove",t);let o=new ResizeObserver(i=>{let l=i[0]?.contentRect;l&&Ft({width:l.width,height:l.height})});o.observe(e),Ke.current=o;let n=e.getBoundingClientRect();Ft({width:n.width,height:n.height})},[]),[we,Pt]=p(!1),[Ze,Ho]=p({x:0,y:0}),[Qe,Vo]=p({x:0,y:0}),Ao=M(async(e,t)=>{let o=URL.createObjectURL(e);Xe(o),gt(e.type||"");let n=I(t,e.type||"");if(n==="text"||n==="code"){let l=await e.text();fe(l);return}if(n==="html"){let l=await e.text();xe(l);return}if(n!=="spreadsheet")return;let i=t.split(".").pop()?.toLowerCase()||"";if(i==="csv"){let h=(await e.text()).split(`
|
|
2
|
+
`).map(g=>g.split(",").map(H=>({value:H.trim()})));ce(h);return}if(i==="xls"||i==="xlsx"){ye(!0),Ue(!0);let l=await e.arrayBuffer(),h=pe.read(l,{type:"array"});vt(h.SheetNames),wt(h);let g=h.SheetNames[0];je(g),ot(h,g)}},[]),Me=y(null),St=M(async e=>{if(e.blob)return e.blob;if(N)return await N(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.")},[N]);P(()=>(c&&a?Yo():(T&&URL.revokeObjectURL(T),Me.current=null,Xe(""),fe(""),xe(""),ce([]),ge(14),A(1),le(0)),()=>{T&&URL.revokeObjectURL(T)}),[c,a]);let Xo=({numPages:e})=>{Tt(e),$(1),Fe.current=!0},Wo=e=>{let{width:t,height:o}=_o(e);Lt(Io(e)),t>0&&o>0&&Et(t/o);let n=t>o?"landscape":"portrait";kt(n)},_o=e=>{let t=e?.width||0,o=e?.height||0,n=Io(e);try{if(typeof e?.getViewport=="function"){let i=e.getViewport({scale:1,rotation:n});t=i.width,o=i.height}}catch(i){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",i)}return{width:t,height:o}},Ce=M(()=>{$(e=>Math.max(e-1,1))},[]),Te=M(()=>{$(e=>Math.min(e+1,F||1))},[F]),Dt=uo(()=>({cMapUrl:`${E}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${E}/standard_fonts/`,wasmUrl:`${E}/wasm/`}),[E]);P(()=>{typeof window>"u"||(Yr.GlobalWorkerOptions.workerSrc=`${E}/pdf.worker.min.mjs`)},[E]),P(()=>{if(!a||v.length<=1||I(c?.name||"",C)==="pdf")return;let e=t=>{t.key==="ArrowLeft"?(t.preventDefault(),W(o=>Math.max(o-1,0))):t.key==="ArrowRight"&&(t.preventDefault(),W(o=>Math.min(o+1,v.length-1)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,v.length,c?.name,C]),P(()=>{if(!a||v.length<=1||I(c?.name||"",C)==="pdf"||k>1)return;let e=0,t=0,o=i=>{e=i.touches[0]?.clientX??0,t=i.touches[0]?.clientY??0},n=i=>{let l=(i.changedTouches[0]?.clientX??0)-e,h=(i.changedTouches[0]?.clientY??0)-t;Math.abs(l)<60||Math.abs(h)>Math.abs(l)||(l<0?W(g=>Math.min(g+1,v.length-1)):W(g=>Math.max(g-1,0)))};return document.addEventListener("touchstart",o,{passive:!0}),document.addEventListener("touchend",n,{passive:!0}),()=>{document.removeEventListener("touchstart",o),document.removeEventListener("touchend",n)}},[a,v.length,c?.name,C,k]),P(()=>{if(!a||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(),Te();break;case"Home":o.preventDefault(),$(1);break;case"End":o.preventDefault(),F&&$(F);break}},t=o=>{o.ctrlKey||Math.abs(o.deltaY)>50&&(o.preventDefault(),o.deltaY>0?Te():Ce())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[a,c,C,Ce,Te,F]),P(()=>{if(!F||!a||I(c?.name||"",C)!=="pdf")return;if(R===1&&Ge.current){Ge.current.scrollTo({top:0,behavior:"smooth"});return}let e=Rt.current[R-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[a,c,C,F,R]),P(()=>{if(Ve){let e=window.setTimeout(()=>ht(!0),180);return()=>window.clearTimeout(e)}},[Ve]);let Yo=async()=>{if(c){Ae(!0),he(""),gt(""),fe(""),xe(""),ce([]);try{let e=await St(c);Me.current=e,await Ao(e,c.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),he("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{Ae(!1)}}},Bt=async()=>{if(c)try{if(Z){await Z(c);return}let e=Me.current??await St(c);lt(e,c.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},jo=()=>{let e=c?I(c.name,C):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(t=>Math.min(t+2,24)):A(e==="pdf"?t=>Math.min(t+.25,mt):t=>Math.min(t+.25,3))},Oo=()=>{let e=c?I(c.name,C):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(t=>Math.max(t-2,10)):A(e==="pdf"?t=>Math.max(t-.25,ut):t=>Math.max(t-.25,.25))},b=y(new Map),Uo=e=>Math.min(Math.max(e,.25),3),No=e=>Math.min(Math.max(e,ut),mt),Je=y(null),Ie=y(null),_=y({scale:1,tx:0,ty:0,rotation:0}),U=y(0),ee=y(null),ke=y(null),Le=M((e,t,o,n)=>{let i=Je.current,l=Ie.current;if(!i||!l)return{tx:t,ty:o};let h=l.offsetWidth,g=l.offsetHeight,H=(Math.round(n/90)%4+4)%4;if(H===1||H===3){let pr=h;h=g,g=pr}let X=h*e,ro=g*e,no=X>i.clientWidth?(X+i.clientWidth)/2-To:0,io=ro>i.clientHeight?(ro+i.clientHeight)/2-To:0;return{tx:Math.min(no,Math.max(-no,t)),ty:Math.min(io,Math.max(-io,o))}},[]),zt=M((e,t)=>{let o=Je.current,n=Ie.current;if(!o||!n)return e>1;let i=(Math.round(t/90)%4+4)%4,l=i===1||i===3,h=l?n.offsetHeight:n.offsetWidth,g=l?n.offsetWidth:n.offsetHeight;return h*e>o.clientWidth+1||g*e>o.clientHeight+1},[]),K=M(e=>{let t=Ie.current;if(!t)return;let{scale:o,tx:n,ty:i,rotation:l}=_.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${n}px, ${i}px) scale(${o}) rotate(${l}deg)`},[]),Ht=M(()=>{let e=_.current,t=Le(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!U.current&&(U.current=requestAnimationFrame(()=>{U.current=0,K(!1)}))},[K,Le]),Vt=M(()=>{U.current&&(cancelAnimationFrame(U.current),U.current=0),b.current.clear(),ee.current=null,ke.current=null},[]),$o=M(e=>{Ie.current=e,e&&(_.current={scale:1,tx:0,ty:0,rotation:0},K(!1))},[K]);P(()=>{if(I(c?.name||"",C)!=="image")return;let e=_.current;e.scale=k,e.rotation=O;let t=Le(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,K(!0)},[k,O,c,C,T,K,Le]),P(()=>()=>{U.current&&cancelAnimationFrame(U.current)},[]);let Go=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...b.current.values()],o=_.current;if(t.length===2){ee.current=null;let n=e.currentTarget.getBoundingClientRect();ke.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&&zt(o.scale,o.rotation)&&(ee.current={startX:e.clientX,startY:e.clientY,baseTx:o.tx,baseTy:o.ty})},Ko=e=>{if(!b.current.has(e.pointerId))return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=_.current,o=ke.current,n=[...b.current.values()];if(o&&n.length>=2){let l=Math.hypot(n[0].x-n[1].x,n[0].y-n[1].y),h=(n[0].x+n[1].x)/2,g=(n[0].y+n[1].y)/2,H=Uo(o.baseScale*l/o.startDist),X=H/o.baseScale;t.scale=H,t.tx=h-o.centerX-X*(o.startMidX-o.centerX-o.baseTx),t.ty=g-o.centerY-X*(o.startMidY-o.centerY-o.baseTy),Ht();return}let i=ee.current;i&&n.length===1&&(t.tx=i.baseTx+(e.clientX-i.startX),t.ty=i.baseTy+(e.clientY-i.startY),Ht())},At=e=>{if(!b.current.has(e.pointerId))return;b.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=_.current;if(b.current.size<2&&(ke.current=null,Math.abs(t.scale-k)>.001&&A(t.scale)),b.current.size===0)ee.current=null;else if(b.current.size===1&&zt(t.scale,t.rotation)){let o=[...b.current.values()][0];ee.current={startX:o.x,startY:o.y,baseTx:t.tx,baseTy:t.ty}}},Xt=M(async()=>{if(T)try{let t=await(await fetch(T)).blob(),o=t.type==="image/png"?t:await lo(t);await navigator.clipboard.write([new ClipboardItem({"image/png":o})]),be("\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),be("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[T]);P(()=>{if(!a||I(c?.name||"",C)!=="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(),Xt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,c,C,Xt]);let te=y(null),z=y(0),ue=y(null),oe=y(null),q=()=>G.current?.querySelector(".react-pdf__Page")??null,Ee=y(null),Wt=y(null),qo=()=>{let e=Wt.current,t=q()?.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 i=t.getBoundingClientRect(),l=e.getBoundingClientRect();return Object.assign(o.style,{position:"absolute",left:`${i.left-l.left}px`,top:`${i.top-l.top}px`,width:`${i.width}px`,height:`${i.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(o),Ee.current=o,!0},_t=()=>{Ee.current?.remove(),Ee.current=null;let e=q();e&&(e.style.visibility="")},Zo=()=>{z.current||(z.current=requestAnimationFrame(()=>{z.current=0;let e=te.current,t=q();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,ue.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Yt=()=>{z.current&&(cancelAnimationFrame(z.current),z.current=0),te.current=null,oe.current=null,ue.current=null,_t();let e=q();e&&(e.style.transform="",e.style.willChange="auto")},jt=e=>{let t=q(),o=G.current;if(!t||!o)return;t.style.transform&&(t.style.transform="");let n=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=(e[0].x+e[1].x)/2,h=(e[0].y+e[1].y)/2;te.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:i.left,viewerT:i.top,viewerR:i.right,viewerB:i.bottom,startMidX:l,startMidY:h,lastMidX:l,lastMidY:h,k:1,tx:0,ty:0},ue.current={k:1,tx:0,ty:0,midX:l,midY:h},t.style.willChange="transform"},Qo=e=>{if(e.pointerType!=="touch")return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...b.current.values()];if(t.length===2){if(oe.current||Ee.current)return;jt(t)}},Jo=e=>{if(!b.current.has(e.pointerId))return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=te.current,o=[...b.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),i=Math.min(Math.max(n/t.startDist,ut/(k||1)),mt/(k||1)),l=(o[0].x+o[1].x)/2,h=(o[0].y+o[1].y)/2,g=l-t.rectLeft-i*(t.startMidX-t.rectLeft),H=h-t.rectTop-i*(t.startMidY-t.rectTop),X=pt;g=Math.min(t.viewerR-X-t.rectLeft,Math.max(t.viewerL+X-t.rectLeft-i*t.pageW,g)),H=Math.min(t.viewerB-X-t.rectTop,Math.max(t.viewerT+X-t.rectTop-i*t.pageH,H)),t.k=i,t.tx=g,t.ty=H,t.lastMidX=l,t.lastMidY=h,Zo()}},Ot=e=>{if(b.current.delete(e.pointerId),b.current.size>=2)return;let t=te.current;if(te.current=null,!t)return;z.current&&(cancelAnimationFrame(z.current),z.current=0);let o=ue.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};ue.current=null;let n=No(k*o.k);if(Math.abs(n-k)<.001){let l=G.current;Yt(),l&&(l.scrollLeft-=o.tx,l.scrollTop-=o.ty);return}let i=G.current;if(i){let l=i.getBoundingClientRect();oe.current={u:(o.midX-t.rectLeft-o.tx)/o.k,v:(o.midY-t.rectTop-o.ty)/o.k,offX:o.midX-l.left,offY:o.midY-l.top,factor:n/(k||1)}}if(qo()){let l=q();l&&(l.style.transform="",l.style.visibility="hidden")}A(n),Math.round(Math.min(rt*n,eo))===nt&&requestAnimationFrame(()=>Nt())},Fe=y(!0),et=y(null),Ut=()=>{let e=G.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},Nt=()=>{let e=oe.current;if(!e)return;oe.current=null;let t=G.current,o=q();if(!t||!o)return;_t(),o.style.transform="",o.style.willChange="auto";let n=o.getBoundingClientRect(),i=t.getBoundingClientRect();t.scrollLeft+=n.left-i.left+e.u*e.factor-e.offX,t.scrollTop+=n.top-i.top+e.v*e.factor-e.offY;let l=[...b.current.values()];l.length>=2&&jt(l)},$t=()=>{let e=`${R}:${O}`;if(oe.current){et.current=e,Nt();return}(Fe.current||et.current!==e)&&(Fe.current=!1,et.current=e,Ut())};P(()=>()=>{z.current&&cancelAnimationFrame(z.current)},[]);let Gt=()=>{le(e=>e-90)},Kt=()=>{le(e=>e+90)},qt=()=>{let e=I(c?.name||"",C);Yt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(14):e==="pdf"?(A(1),k===1&&O===0?Ut():Fe.current=!0):(Vt(),_.current={scale:1,tx:0,ty:0,rotation:0},K(!0),A(1)),le(0)},Zt=(e,t)=>{Pt(!0),Ho({x:e.clientX,y:e.clientY}),Vo({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Qt=M((e,t)=>{if(!we)return;let o=e.clientX-Ze.x,n=e.clientY-Ze.y;t.scrollLeft=Qe.x-o,t.scrollTop=Qe.y-n,e.preventDefault()},[we,Ze,Qe]),tt=M(()=>{Pt(!1),document.body.style.cursor="default"},[]);P(()=>{if(we){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(n=>{Qt(t,n)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",tt),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",tt),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[we,Qt,tt]);let er=M(()=>{Ae(!1),ht(!1)},[]),ot=M(async(e,t)=>{ye(!0),Ue(!0);try{await new Promise(h=>setTimeout(h,500));let o=e.Sheets[t],n=pe.utils.decode_range(o["!ref"]||"A1");console.debug("Excel range:",n);let l=pe.utils.sheet_to_json(o,{header:1,range:n,defval:""}).map(h=>h.map(g=>({value:g!=null?String(g):""})));ce(l),await new Promise(h=>setTimeout(h,200))}catch(o){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",o)}finally{Ue(!1)}},[]),tr=M(()=>{ye(!1)},[]),or=M(e=>{Oe&&(je(e),ot(Oe,e))},[Oe,ot]),Jt=()=>{Vt(),_.current={scale:1,tx:0,ty:0,rotation:0},be(""),T&&URL.revokeObjectURL(T),Me.current=null,Xe(""),fe(""),xe(""),ce([]),vt([]),je(""),wt(null),ye(!1),A(1),le(0),he(""),Tt(void 0),$(1),kt("portrait"),Lt(0),Et(0),s()};if(!c)return null;let w=I(c.name,C),rr=((Bo+O)%360+360)%360,Re=O%180===0?$e:$e>0?1/$e:0,nr=Math.max(de.width-Mo,Co),ir=Math.max(de.height-Mo,Co),rt=de.width>0&&Re>0?Math.min(nr,ir*Re):ve==="portrait"?600:800,ar=typeof window<"u"&&window.devicePixelRatio||1,eo=Ur/ar*(Re>0?Math.min(1,Re):1),nt=Math.round(Math.min(rt*k,eo)),to=Math.round(rt*k),lr=to>nt,sr=Math.max(16,Math.round(de.width)-pt),cr=Math.max(16,Math.round(de.height)-pt),dr=ve==="landscape"?"200px":"150px",ur=ve==="landscape"?.18:.17,oo=()=>F?r(d,{ref:Ge,sx:{width:dr,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:F},(e,t)=>f(d,{ref:o=>{Rt.current[t]=o},children:[r(d,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:R===t+1?"2px solid":"1px solid",borderColor:R===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:ve==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{$(t+1),x&&Ne(!1)},children:r(yo,{file:T,options:Dt,loading:r("div",{style:{display:"none"}}),children:r(bo,{pageNumber:t+1,scale:ur,loading:r("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),r(S,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:R===t+1?"primary.main":"",fontWeight:R===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,mr=()=>{let e=I(c?.name||"",C);if(Ro&&!(e==="spreadsheet"))return r(d,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:r(wo,{visible:Ve,exitDelay:100,onComplete:er})});if(ft)return f(d,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[r(S,{color:"error",variant:"h6",children:ft}),r(S,{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(!T)return null;switch(e){case"image":return r(d,{ref:Je,"data-allow-pinch":"true",onPointerDown:Go,onPointerMove:Ko,onPointerUp:At,onPointerCancel:At,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:$o,src:T,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 f(me,{children:[f(d,{ref:Wt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!x&&oo(),r(d,{ref:zo,className:"draggable-scroll",onMouseDown:o=>{let n=o.currentTarget;Zt(o,n)},"data-allow-pinch":"true",onPointerDown:Qo,onPointerMove:Jo,onPointerUp:Ot,onPointerCancel:Ot,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:x?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...x&&{px:`${sr}px`,py:`${cr}px`},...lr&&{"& .react-pdf__Page__canvas":{width:`${to}px !important`,height:"auto !important"}}}},children:r(yo,{file:T,onLoadSuccess:Xo,onLoadError:o=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",o),he("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:r("div",{style:{display:"none"}}),error:f(d,{sx:{textAlign:"center",p:4},children:[r(S,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),r(S,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:Dt,children:r(bo,{pageNumber:R,width:nt,rotate:O===0?void 0:rr,loading:r("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Wo,onRenderSuccess:$t,onRenderError:$t})})})]}),x&&r(Tr,{anchor:"left",open:Do,onClose:()=>Ne(!1),sx:{zIndex:o=>o.zIndex.modal+2},children:oo()})]});case"text":case"code":return r(d,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:xt?r(d,{sx:{flex:1,height:"100%",overflow:"hidden"},children:r(vo,{height:"100%",language:at(c.name),value:xt,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:se,lineHeight:Math.round(se*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,n)=>{o.onDidAttemptReadOnlyEdit(()=>{});let i=o.getDomNode();if(i){let l=document.createElement("style");l.textContent=`
|
|
3
3
|
.monaco-editor .margin-view-overlays {
|
|
4
4
|
border-right: 1px solid #3c3c3c;
|
|
5
5
|
}
|
|
@@ -27,7 +27,7 @@ import{useState as p,useEffect as P,useMemo as uo,useCallback as M,useRef as b}f
|
|
|
27
27
|
.monaco-editor .overlay.cursor-layer {
|
|
28
28
|
padding-left: 15px !important;
|
|
29
29
|
}
|
|
30
|
-
`,i.appendChild(l)}}})}):
|
|
30
|
+
`,i.appendChild(l)}}})}):r(d,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:r(S,{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:We?f(d,{sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[f(d,{sx:{display:"flex",gap:1,p:1,borderBottom:"1px solid",borderColor:"grey.300",backgroundColor:"grey.50"},children:[r(mo,{variant:_e==="preview"?"contained":"outlined",size:"small",onClick:()=>yt("preview"),children:"\uBBF8\uB9AC\uBCF4\uAE30"}),r(mo,{variant:_e==="source"?"contained":"outlined",size:"small",onClick:()=>yt("source"),children:"\uC18C\uC2A4\uCF54\uB4DC"})]}),_e==="preview"?r(d,{sx:{flex:1,overflow:"auto",backgroundColor:"white",border:"1px solid",borderColor:"grey.300",fontSize:`${se}px`,p:2},dangerouslySetInnerHTML:{__html:We}}):r(d,{sx:{flex:1,height:"100%",overflow:"hidden"},children:r(vo,{height:"100%",language:"html",value:We,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:se,lineHeight:Math.round(se*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,n)=>{o.onDidAttemptReadOnlyEdit(()=>{});let i=o.getDomNode();if(i){let l=document.createElement("style");l.textContent=`
|
|
31
31
|
.monaco-editor .margin-view-overlays {
|
|
32
32
|
border-right: 1px solid #3c3c3c;
|
|
33
33
|
}
|
|
@@ -55,4 +55,4 @@ import{useState as p,useEffect as P,useMemo as uo,useCallback as M,useRef as b}f
|
|
|
55
55
|
.monaco-editor .overlay.cursor-layer {
|
|
56
56
|
padding-left: 15px !important;
|
|
57
57
|
}
|
|
58
|
-
`,i.appendChild(l)}}})})]}):n(c,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:n(R,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return n(c,{className:"draggable-scroll",onMouseDown:o=>{let r=o.currentTarget;Zt(o,r)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:n("video",{src:I,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${L}) rotate(${U}deg)`,transition:"transform 0.3s ease",pointerEvents:L>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(c,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[Oe.length>0||Mt?h(c,{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:[Oe.length>0&&n(c,{sx:{minWidth:"max-content",minHeight:"max-content"},children:n(On,{data:Oe,darkMode:!1})}),Mt&&n(c,{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:n(wo,{visible:Po,exitDelay:200,fadeoutDuration:300,onComplete:tn})})]}):n(c,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:n(R,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),bt.length>1&&n(c,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:n(kn,{value:So,onChange:(o,r)=>on(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:bt.map(o=>n(Ln,{label:o,value:o},o))})})]});case"audio":return h(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[n(R,{variant:"h6",sx:{mb:2},children:d.name}),n("audio",{src:I,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(c,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[n(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"}),n(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(Mn,{open:a,onClose:Jt,maxWidth:"lg",fullScreen:!0,children:[h(Cn,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:g?1:3},onContextMenu:e=>e.preventDefault(),children:[h(c,{sx:{display:"flex",alignItems:"center",gap:ae?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:g?"1.7rem":void 0}},children:[x.length>1?h(c,{sx:{display:"flex",alignItems:"center",gap:g?0:.5},children:[n(B,{title:"\uC774\uC804 \uD30C\uC77C",children:n("span",{style:{display:"inline-flex"},children:n(T,{onClick:()=>z(e=>Math.max(e-1,0)),disabled:_<=0,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:n(De,{})})})}),h(R,{variant:"body2",sx:{color:"grey.300",minWidth:40,textAlign:"center",userSelect:"none"},children:[_+1," / ",x.length]}),n(B,{title:"\uB2E4\uC74C \uD30C\uC77C",children:n("span",{style:{display:"inline-flex"},children:n(T,{onClick:()=>z(e=>Math.min(e+1,x.length-1)),disabled:_>=x.length-1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:n(ze,{})})})})]}):null,g&&w==="pdf"&&F?n(B,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:n(T,{onClick:()=>Ge(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:n(Bn,{})})}):null,w==="pdf"&&F?h(c,{sx:{display:"flex",alignItems:"center",gap:g?0:.5},children:[n(B,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:n("span",{style:{display:"inline-flex"},children:n(T,{onClick:Ce,disabled:S<=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:n(De,{})})})}),n(R,{variant:"body2",sx:{minWidth:g?"auto":"80px",textAlign:"center",color:"white",px:g?.5:1,fontSize:g?"1.05rem":void 0,fontWeight:g?600:void 0,whiteSpace:"nowrap"},children:ae?S:`${S} / ${F}`}),n(B,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:n("span",{style:{display:"inline-flex"},children:n(T,{onClick:Te,disabled:S>=F,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:n(ze,{})})})})]}):null]}),n(c,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:ae?0:2,overflow:"hidden"},children:!ae&&h(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[$n(w),d.name]})}),h(c,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:ae?.35:1,"& .MuiSvgIcon-root":{fontSize:g?"1.7rem":void 0}},children:[(w==="image"||w==="pdf"||w==="text"||w==="html"||w==="code"||w==="spreadsheet")&&h(me,{children:[!(g&&(w==="image"||w==="pdf"))&&h(me,{children:[n(B,{title:"\uD655\uB300",children:n(T,{onClick:jo,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:n(zn,{})})}),n(B,{title:"\uCD95\uC18C",children:n(T,{onClick:Oo,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:n(Hn,{})})})]}),!g&&n(B,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:n(T,{onClick:qt,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:n(go,{})})}),!g&&(w==="image"||w==="pdf")&&h(me,{children:[n(B,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:n(T,{onClick:Gt,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:n(ho,{})})}),n(B,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:n(T,{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:n(fo,{})})})]})]}),!g&&n(B,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:n(T,{onClick:Dt,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:n(po,{})})}),g&&h(me,{children:[n(B,{title:"\uB354\uBCF4\uAE30",children:n(T,{onClick:e=>J(e.currentTarget),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:n(Dn,{})})}),h(En,{anchorEl:It,open:!!It,onClose:()=>J(null),children:[w==="image"||w==="pdf"?h(Se,{onClick:()=>{qt(),J(null)},children:[n(Pe,{children:n(go,{fontSize:"small"})}),n(Be,{children:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30"})]}):null,w==="image"||w==="pdf"?h(Se,{onClick:()=>{Gt(),J(null)},children:[n(Pe,{children:n(ho,{fontSize:"small"})}),n(Be,{children:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,w==="image"||w==="pdf"?h(Se,{onClick:()=>{Kt(),J(null)},children:[n(Pe,{children:n(fo,{fontSize:"small"})}),n(Be,{children:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,h(Se,{onClick:()=>{Dt(),J(null)},children:[n(Pe,{children:n(po,{fontSize:"small"})}),n(Be,{children:"\uB2E4\uC6B4\uB85C\uB4DC"})]})]})]}),n(B,{title:"\uB2EB\uAE30",children:n(T,{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:n(Pn,{})})})]})]}),!g&&x.length>1&&_>0?n(T,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>z(e=>Math.max(e-1,0)),sx:{position:"fixed",left:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:n(De,{sx:{fontSize:30}})}):null,!g&&x.length>1&&_<x.length-1?n(T,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>z(e=>Math.min(e+1,x.length-1)),sx:{position:"fixed",right:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:n(ze,{sx:{fontSize:30}})}):null,g&&x.length>1?h(c,{sx:{position:"fixed",bottom:18,left:"50%",transform:"translateX(-50%)",zIndex:10,display:"flex",alignItems:"center",gap:.5,px:1,py:.25,borderRadius:999,backgroundColor:"rgba(0, 0, 0, 0.45)"},children:[n(T,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>z(e=>Math.max(e-1,0)),disabled:_<=0,sx:{color:"white","&.Mui-disabled":{color:"rgba(255,255,255,0.3)"}},children:n(De,{sx:{fontSize:28}})}),h(R,{variant:"body2",sx:{color:"white",minWidth:44,textAlign:"center",userSelect:"none"},children:[_+1," / ",x.length]}),n(T,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>z(e=>Math.min(e+1,x.length-1)),disabled:_>=x.length-1,sx:{color:"white","&.Mui-disabled":{color:"rgba(255,255,255,0.3)"}},children:n(ze,{sx:{fontSize:28}})})]}):null,n(Tn,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:pn()}),n(Rn,{open:!!Ct,autoHideDuration:2e3,onClose:()=>be(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:Ct,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},Gn=ko;import{jsx as Lo}from"react/jsx-runtime";function He(a){return Lo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#E91E63",...a,children:Lo("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 j,jsxs as Kn}from"react/jsx-runtime";function Ve(a){return Kn("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#B45309",...a,children:[j("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"}),j("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"}),j("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),j("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),j("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),j("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),j("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),j("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),j("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 qn from"@mui/icons-material/TextSnippet";import Zn from"@mui/icons-material/VideoFile";import Qn from"@mui/icons-material/AudioFile";import Jn from"@mui/icons-material/Description";import er from"@mui/icons-material/InsertDriveFile";import tr from"@mui/icons-material/Code";import or from"@mui/icons-material/TableView";import{jsx as A}from"react/jsx-runtime";function Ae(a,s=22){let u=`${s}px`,m={fontSize:s};switch(a){case"image":return A(re,{width:u,height:u});case"pdf":return A(ie,{width:u,height:u});case"html":return A(He,{width:u,height:u});case"archive":return A(Ve,{width:u,height:u});case"text":return A(qn,{sx:{...m,color:"#66BB6A"}});case"spreadsheet":return A(or,{sx:{...m,color:"#4CAF50"}});case"code":return A(tr,{sx:{...m,color:"#2196F3"}});case"video":return A(Zn,{sx:{...m,color:"#AB47BC"}});case"audio":return A(Qn,{sx:{...m,color:"#FF7043"}});case"office":return A(Jn,{sx:{...m,color:"#FFA726"}});default:return A(er,{sx:{...m,color:"#78909C"}})}}var nr=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function Eo({fileName:a,mime:s,size:u=22}){let m=a.includes(".")?a.slice(a.lastIndexOf(".")+1).toLowerCase():"";return nr.has(m)?Ae("archive",u):Ae(k(a,s??""),u)}export{Eo as FileTypeIcon,ko as FileViewer,Gn as FileViewerDefault,He as HtmlIcon,re as ImageIcon,ie as PdfIcon,Ve as ZipIcon,yn as ensureFileExtension,st as getEditorLanguage,lt as getFileType,ao as getFileTypeFromMime,Ae as getFileTypeIcon,gn as isFileViewerPreviewable,k as resolveFileType,ct as saveBlobAsFile};
|
|
58
|
+
`,i.appendChild(l)}}})})]}):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(S,{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;Zt(o,n)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:r("video",{src:T,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${k}) rotate(${O}deg)`,transition:"transform 0.3s ease",pointerEvents:k>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return f(d,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[Ye.length>0||Mt?f(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:[Ye.length>0&&r(d,{sx:{minWidth:"max-content",minHeight:"max-content"},children:r(jr,{data:Ye,darkMode:!1})}),Mt&&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(wo,{visible:So,exitDelay:200,fadeoutDuration:300,onComplete:tr})})]}):r(d,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:r(S,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),bt.length>1&&r(d,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:r(Ir,{value:Po,onChange:(o,n)=>or(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:bt.map(o=>r(kr,{label:o,value:o},o))})})]});case"audio":return f(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[r(S,{variant:"h6",sx:{mb:2},children:c.name}),r("audio",{src:T,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 f(d,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[r(S,{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(S,{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 f(wr,{open:a,onClose:Jt,maxWidth:"lg",fullScreen:!0,children:[f(Mr,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:x?1:3},onContextMenu:e=>e.preventDefault(),children:[f(d,{sx:{display:"flex",alignItems:"center",gap:ae?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:x?"1.7rem":void 0}},children:[v.length>1?f(d,{sx:{display:"flex",alignItems:"center",gap:x?0:.5},children:[r(D,{title:"\uC774\uC804 \uD30C\uC77C",children:r("span",{style:{display:"inline-flex"},children:r(L,{onClick:()=>W(e=>Math.max(e-1,0)),disabled:Q<=0,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:r(ct,{})})})}),f(S,{variant:"body2",sx:{color:"grey.300",minWidth:40,textAlign:"center",userSelect:"none"},children:[Q+1," / ",v.length]}),r(D,{title:"\uB2E4\uC74C \uD30C\uC77C",children:r("span",{style:{display:"inline-flex"},children:r(L,{onClick:()=>W(e=>Math.min(e+1,v.length-1)),disabled:Q>=v.length-1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:r(dt,{})})})})]}):null,x&&w==="pdf"&&F?r(D,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:r(L,{onClick:()=>Ne(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:r(Sr,{})})}):null,w==="pdf"&&F?f(d,{sx:{display:"flex",alignItems:"center",gap:x?0:.5},children:[r(D,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:r("span",{style:{display:"inline-flex"},children:r(L,{onClick:Ce,disabled:R<=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(ct,{})})})}),r(S,{variant:"body2",sx:{minWidth:x?"auto":"80px",textAlign:"center",color:"white",px:x?.5:1,fontSize:x?"1.05rem":void 0,fontWeight:x?600:void 0,whiteSpace:"nowrap"},children:ae?R:`${R} / ${F}`}),r(D,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:r("span",{style:{display:"inline-flex"},children:r(L,{onClick:Te,disabled:R>=F,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(dt,{})})})})]}):null]}),r(d,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:ae?0:2,overflow:"hidden"},children:!ae&&f(d,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Nr(w),c.name]})}),f(d,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:ae?.35:1,"& .MuiSvgIcon-root":{fontSize:x?"1.7rem":void 0}},children:[(w==="image"||w==="pdf"||w==="text"||w==="html"||w==="code"||w==="spreadsheet")&&f(me,{children:[!(x&&(w==="image"||w==="pdf"))&&f(me,{children:[r(D,{title:"\uD655\uB300",children:r(L,{onClick:jo,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(Br,{})})}),r(D,{title:"\uCD95\uC18C",children:r(L,{onClick:Oo,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(zr,{})})})]}),!x&&r(D,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:r(L,{onClick:qt,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(go,{})})}),!x&&(w==="image"||w==="pdf")&&f(me,{children:[r(D,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:r(L,{onClick:Gt,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(ho,{})})}),r(D,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:r(L,{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:r(fo,{})})})]})]}),!x&&r(D,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:r(L,{onClick:Bt,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(po,{})})}),x&&f(me,{children:[r(D,{title:"\uB354\uBCF4\uAE30",children:r(L,{onClick:e=>J(e.currentTarget),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:r(Dr,{})})}),f(Lr,{anchorEl:It,open:!!It,onClose:()=>J(null),children:[w==="image"||w==="pdf"?f(Pe,{onClick:()=>{qt(),J(null)},children:[r(Se,{children:r(go,{fontSize:"small"})}),r(De,{children:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30"})]}):null,w==="image"||w==="pdf"?f(Pe,{onClick:()=>{Gt(),J(null)},children:[r(Se,{children:r(ho,{fontSize:"small"})}),r(De,{children:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,w==="image"||w==="pdf"?f(Pe,{onClick:()=>{Kt(),J(null)},children:[r(Se,{children:r(fo,{fontSize:"small"})}),r(De,{children:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,f(Pe,{onClick:()=>{Bt(),J(null)},children:[r(Se,{children:r(po,{fontSize:"small"})}),r(De,{children:"\uB2E4\uC6B4\uB85C\uB4DC"})]})]})]}),r(D,{title:"\uB2EB\uAE30",children:r(L,{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(Pr,{})})})]})]}),!x&&v.length>1&&Q>0?r(L,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>W(e=>Math.max(e-1,0)),sx:{position:"fixed",left:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:r(ct,{sx:{fontSize:30}})}):null,!x&&v.length>1&&Q<v.length-1?r(L,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>W(e=>Math.min(e+1,v.length-1)),sx:{position:"fixed",right:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:r(dt,{sx:{fontSize:30}})}):null,r(Cr,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:mr()}),r(Er,{open:!!Ct,autoHideDuration:2e3,onClose:()=>be(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:Ct,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},$r=ko;import{jsx as Lo}from"react/jsx-runtime";function Be(a){return Lo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#E91E63",...a,children:Lo("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 Y,jsxs as Gr}from"react/jsx-runtime";function ze(a){return Gr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#B45309",...a,children:[Y("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"}),Y("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"}),Y("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),Y("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),Y("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),Y("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),Y("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),Y("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),Y("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 Kr from"@mui/icons-material/TextSnippet";import qr from"@mui/icons-material/VideoFile";import Zr from"@mui/icons-material/AudioFile";import Qr from"@mui/icons-material/Description";import Jr from"@mui/icons-material/InsertDriveFile";import en from"@mui/icons-material/Code";import tn from"@mui/icons-material/TableView";import{jsx as V}from"react/jsx-runtime";function He(a,s=22){let u=`${s}px`,m={fontSize:s};switch(a){case"image":return V(ne,{width:u,height:u});case"pdf":return V(ie,{width:u,height:u});case"html":return V(Be,{width:u,height:u});case"archive":return V(ze,{width:u,height:u});case"text":return V(Kr,{sx:{...m,color:"#66BB6A"}});case"spreadsheet":return V(tn,{sx:{...m,color:"#4CAF50"}});case"code":return V(en,{sx:{...m,color:"#2196F3"}});case"video":return V(qr,{sx:{...m,color:"#AB47BC"}});case"audio":return V(Zr,{sx:{...m,color:"#FF7043"}});case"office":return V(Qr,{sx:{...m,color:"#FFA726"}});default:return V(Jr,{sx:{...m,color:"#78909C"}})}}var on=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function Eo({fileName:a,mime:s,size:u=22}){let m=a.includes(".")?a.slice(a.lastIndexOf(".")+1).toLowerCase():"";return on.has(m)?He("archive",u):He(I(a,s??""),u)}export{Eo as FileTypeIcon,ko as FileViewer,$r as FileViewerDefault,Be as HtmlIcon,ne as ImageIcon,ie as PdfIcon,ze as ZipIcon,xr as ensureFileExtension,at as getEditorLanguage,it as getFileType,ao as getFileTypeFromMime,He as getFileTypeIcon,fr as isFileViewerPreviewable,I as resolveFileType,lt as saveBlobAsFile};
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var In=Object.create;var Fe=Object.defineProperty;var kn=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,Rn=Object.prototype.hasOwnProperty;var Fn=(a,d)=>{for(var u in d)Fe(a,u,{get:d[u],enumerable:!0})},co=(a,d,u,m)=>{if(d&&typeof d=="object"||typeof d=="function")for(let k of Ln(d))!Rn.call(a,k)&&k!==u&&Fe(a,k,{get:()=>d[k],enumerable:!(m=kn(d,k))||m.enumerable});return a};var f=(a,d,u)=>(u=a!=null?In(En(a)):{},co(d||!a||!a.__esModule?Fe(u,"default",{value:a,enumerable:!0}):u,a)),Sn=a=>co(Fe({},"__esModule",{value:!0}),a);var Xn={};Fn(Xn,{FileTypeIcon:()=>gt,FileViewer:()=>ht,FileViewerDefault:()=>So,HtmlIcon:()=>de,ImageIcon:()=>G,PdfIcon:()=>K,ZipIcon:()=>ue,ensureFileExtension:()=>mo,getEditorLanguage:()=>Pe,getFileType:()=>Se,getFileTypeFromMime:()=>nt,getFileTypeIcon:()=>me,isFileViewerPreviewable:()=>uo,resolveFileType:()=>M,saveBlobAsFile:()=>Be});module.exports=Sn(Xn);var i=require("react"),r=require("@mui/material"),bo=f(require("@mui/icons-material/Close"),1),vo=f(require("@mui/icons-material/Menu"),1),wo=f(require("@mui/icons-material/MoreHoriz"),1),lt=f(require("@mui/icons-material/Download"),1),Mo=f(require("@mui/icons-material/Add"),1),Co=f(require("@mui/icons-material/Remove"),1),st=f(require("@mui/icons-material/RotateLeft"),1),ct=f(require("@mui/icons-material/RotateRight"),1),dt=f(require("@mui/icons-material/FitScreen"),1),le=f(require("@mui/icons-material/KeyboardArrowLeft"),1),se=f(require("@mui/icons-material/KeyboardArrowRight"),1),To=f(require("@mui/icons-material/TextSnippet"),1),Io=f(require("@mui/icons-material/VideoFile"),1),ko=f(require("@mui/icons-material/AudioFile"),1),Lo=f(require("@mui/icons-material/Description"),1),Eo=f(require("@mui/icons-material/InsertDriveFile"),1),ut=f(require("@mui/icons-material/Code"),1),Ro=f(require("@mui/icons-material/TableView"),1),Y=require("react-pdf"),mt=f(require("@monaco-editor/react"),1),Fo=f(require("react-spreadsheet"),1),ce=f(require("xlsx"),1),pt=require("@ehfuse/mui-fadeout-loading-progress");var Se=a=>{let d=a.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"},nt=a=>{let d=(a||"").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"},M=(a,d)=>{let u=Se(a);return u!=="unsupported"?u:nt(d)},Pn=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),uo=a=>Pn.has(Se(a)),Bn={"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"},mo=(a,d)=>{let u=(a??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(u))return u;let m=(d??"").trim().toLowerCase().split(";")[0],k=Bn[m]??"";return k?`${u}.${k}`:u},Pe=a=>{let d=a.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 Dn=a=>(a||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",Be=(a,d)=>{let u=URL.createObjectURL(a),m=document.createElement("a");m.href=u,m.download=Dn(d),m.rel="noopener",document.body.appendChild(m),m.click(),m.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),6e4)};var po=async a=>{let d=URL.createObjectURL(a);try{let u=await new Promise((j,q)=>{let L=new Image;L.onload=()=>j(L),L.onerror=()=>q(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),L.src=d}),m=document.createElement("canvas");m.width=u.naturalWidth||u.width||1024,m.height=u.naturalHeight||u.height||1024;let k=m.getContext("2d");if(!k)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return k.drawImage(u,0,0,m.width,m.height),await new Promise((j,q)=>{m.toBlob(L=>L?j(L):q(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(d)}};var De=require("@mui/material");function ho(){let a=(0,De.useTheme)();return!(0,De.useMediaQuery)(a.breakpoints.up("lg"))}var V=require("react/jsx-runtime");function G(a){return(0,V.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:a.width||"22px",...a,children:[(0,V.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,V.jsx)("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),(0,V.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,V.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,V.jsxs)("g",{children:[(0,V.jsx)("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),(0,V.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 C=require("react/jsx-runtime");function K(a){return(0,C.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:a.width||"28px",...a,children:(0,C.jsxs)("g",{children:[(0,C.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,C.jsx)("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),(0,C.jsxs)("g",{children:[(0,C.jsxs)("g",{children:[(0,C.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,C.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,C.jsx)("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),(0,C.jsx)("g",{children:(0,C.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,C.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,C.jsx)("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),(0,C.jsx)("g",{children:(0,C.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 zn="/pdfjs",fo=32,go=240,Hn=8192,rt=.25,it=8,at=80,xo=80,Vn=a=>{switch(a){case"image":return(0,o.jsx)(G,{});case"pdf":return(0,o.jsx)(K,{});case"text":return(0,o.jsx)(To.default,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return(0,o.jsx)(Ro.default,{sx:{mr:1,color:"#4CAF50"}});case"html":return(0,o.jsx)(ut.default,{sx:{mr:1,color:"#E91E63"}});case"code":return(0,o.jsx)(ut.default,{sx:{mr:1,color:"#2196F3"}});case"video":return(0,o.jsx)(Io.default,{sx:{mr:1,color:"#AB47BC"}});case"audio":return(0,o.jsx)(ko.default,{sx:{mr:1,color:"#FF7043"}});case"office":return(0,o.jsx)(Lo.default,{sx:{mr:1,color:"#FFA726"}});default:return(0,o.jsx)(Eo.default,{sx:{mr:1,color:"#78909C"}})}},yo=a=>typeof a?.rotate=="number"?a.rotate:typeof a?._pageInfo?.rotate=="number"?a._pageInfo.rotate:0,ht=({open:a,onClose:d,file:u,files:m=null,initialIndex:k=0,loadFile:j,onDownload:q,pdfAssetBase:L=zn})=>{let g=ho(),Xo=(0,r.useTheme)(),te=(0,r.useMediaQuery)(Xo.breakpoints.down("sm")),x=(0,i.useMemo)(()=>m&&m.length>0?m:[],[m]),[A,P]=(0,i.useState)(0);(0,i.useEffect)(()=>{a&&P(x.length>0?Math.min(Math.max(k,0),x.length-1):0)},[a,k,x]);let p=x.length>0?x[A]??u:u,[ze,He]=(0,i.useState)(!0),[Wo,xt]=(0,i.useState)(!1),[T,Ve]=(0,i.useState)(""),[I,z]=(0,i.useState)(1),[W,oe]=(0,i.useState)(0),[yt,pe]=(0,i.useState)(""),[w,bt]=(0,i.useState)(""),[vt,he]=(0,i.useState)(""),[ne,fe]=(0,i.useState)(14),[Ae,ge]=(0,i.useState)(""),[Xe,wt]=(0,i.useState)("preview"),[We,re]=(0,i.useState)([]),[Mt,Ct]=(0,i.useState)([]),[_o,_e]=(0,i.useState)(""),[Ye,Tt]=(0,i.useState)(null),[It,xe]=(0,i.useState)(!1),[Yo,je]=(0,i.useState)(!0),[kt,ye]=(0,i.useState)(""),[E,Lt]=(0,i.useState)(),[R,O]=(0,i.useState)(1),[jo,Oe]=(0,i.useState)(!1),[Et,Z]=(0,i.useState)(null),[be,Rt]=(0,i.useState)("portrait"),[Oo,Ft]=(0,i.useState)(0),[Ue,St]=(0,i.useState)(0),[ie,Pt]=(0,i.useState)({width:0,height:0}),Bt=(0,i.useRef)([]),Ne=(0,i.useRef)(null),U=(0,i.useRef)(null),$e=(0,i.useRef)(null),Ge=(0,i.useRef)(null),Uo=(0,i.useCallback)(e=>{if($e.current?.disconnect(),Ge.current?.(),Ge.current=null,U.current=e,!e){$e.current=null;return}let t=s=>{s.touches.length>=2&&s.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),Ge.current=()=>e.removeEventListener("touchmove",t);let n=new ResizeObserver(s=>{let c=s[0]?.contentRect;c&&Pt({width:c.width,height:c.height})});n.observe(e),$e.current=n;let l=e.getBoundingClientRect();Pt({width:l.width,height:l.height})},[]),[ve,Dt]=(0,i.useState)(!1),[Ke,No]=(0,i.useState)({x:0,y:0}),[qe,$o]=(0,i.useState)({x:0,y:0}),Go=(0,i.useCallback)(async(e,t)=>{let n=URL.createObjectURL(e);Ve(n),bt(e.type||"");let l=M(t,e.type||"");if(l==="text"||l==="code"){let c=await e.text();he(c);return}if(l==="html"){let c=await e.text();ge(c);return}if(l!=="spreadsheet")return;let s=t.split(".").pop()?.toLowerCase()||"";if(s==="csv"){let h=(await e.text()).split(`
|
|
2
|
-
`).map(y=>y.split(",").map(D=>({value:D.trim()})));re(h);return}if(s==="xls"||s==="xlsx"){xe(!0),je(!0);let c=await e.arrayBuffer(),h=ce.read(c,{type:"array"});Ct(h.SheetNames),Tt(h);let y=h.SheetNames[0];_e(y),et(h,y)}},[]),we=(0,i.useRef)(null),zt=(0,i.useCallback)(async e=>{if(e.blob)return e.blob;if(j)return await j(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.")},[j]);(0,i.useEffect)(()=>(p&&a?Qo():(T&&URL.revokeObjectURL(T),we.current=null,Ve(""),he(""),ge(""),re([]),fe(14),z(1),oe(0)),()=>{T&&URL.revokeObjectURL(T)}),[p,a]);let Ko=({numPages:e})=>{Lt(e),O(1),Ee.current=!0},qo=e=>{let{width:t,height:n}=Zo(e);Ft(yo(e)),t>0&&n>0&&St(t/n);let l=t>n?"landscape":"portrait";Rt(l)},Zo=e=>{let t=e?.width||0,n=e?.height||0,l=yo(e);try{if(typeof e?.getViewport=="function"){let s=e.getViewport({scale:1,rotation:l});t=s.width,n=s.height}}catch(s){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",s)}return{width:t,height:n}},Me=(0,i.useCallback)(()=>{O(e=>Math.max(e-1,1))},[]),Ce=(0,i.useCallback)(()=>{O(e=>Math.min(e+1,E||1))},[E]),Ht=(0,i.useMemo)(()=>({cMapUrl:`${L}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${L}/standard_fonts/`,wasmUrl:`${L}/wasm/`}),[L]);(0,i.useEffect)(()=>{typeof window>"u"||(Y.pdfjs.GlobalWorkerOptions.workerSrc=`${L}/pdf.worker.min.mjs`)},[L]),(0,i.useEffect)(()=>{if(!a||x.length<=1||M(p?.name||"",w)==="pdf")return;let e=t=>{t.key==="ArrowLeft"?(t.preventDefault(),P(n=>Math.max(n-1,0))):t.key==="ArrowRight"&&(t.preventDefault(),P(n=>Math.min(n+1,x.length-1)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,x.length,p?.name,w]),(0,i.useEffect)(()=>{if(!a||x.length<=1||M(p?.name||"",w)==="pdf"||I>1)return;let e=0,t=0,n=s=>{e=s.touches[0]?.clientX??0,t=s.touches[0]?.clientY??0},l=s=>{let c=(s.changedTouches[0]?.clientX??0)-e,h=(s.changedTouches[0]?.clientY??0)-t;Math.abs(c)<60||Math.abs(h)>Math.abs(c)||(c<0?P(y=>Math.min(y+1,x.length-1)):P(y=>Math.max(y-1,0)))};return document.addEventListener("touchstart",n,{passive:!0}),document.addEventListener("touchend",l,{passive:!0}),()=>{document.removeEventListener("touchstart",n),document.removeEventListener("touchend",l)}},[a,x.length,p?.name,w,I]),(0,i.useEffect)(()=>{if(!a||M(p?.name||"",w)!=="pdf")return;let e=n=>{switch(n.key){case"ArrowLeft":case"ArrowUp":n.preventDefault(),Me();break;case"ArrowRight":case"ArrowDown":n.preventDefault(),Ce();break;case"Home":n.preventDefault(),O(1);break;case"End":n.preventDefault(),E&&O(E);break}},t=n=>{n.ctrlKey||Math.abs(n.deltaY)>50&&(n.preventDefault(),n.deltaY>0?Ce():Me())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[a,p,w,Me,Ce,E]),(0,i.useEffect)(()=>{if(!E||!a||M(p?.name||"",w)!=="pdf")return;if(R===1&&Ne.current){Ne.current.scrollTo({top:0,behavior:"smooth"});return}let e=Bt.current[R-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[a,p,w,E,R]),(0,i.useEffect)(()=>{if(ze){let e=window.setTimeout(()=>xt(!0),180);return()=>window.clearTimeout(e)}},[ze]);let Qo=async()=>{if(p){He(!0),pe(""),bt(""),he(""),ge(""),re([]);try{let e=await zt(p);we.current=e,await Go(e,p.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),pe("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{He(!1)}}},Vt=async()=>{if(p)try{if(q){await q(p);return}let e=we.current??await zt(p);Be(e,p.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},Jo=()=>{let e=p?M(p.name,w):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?fe(t=>Math.min(t+2,24)):z(e==="pdf"?t=>Math.min(t+.25,it):t=>Math.min(t+.25,3))},en=()=>{let e=p?M(p.name,w):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?fe(t=>Math.max(t-2,10)):z(e==="pdf"?t=>Math.max(t-.25,rt):t=>Math.max(t-.25,.25))},b=(0,i.useRef)(new Map),tn=e=>Math.min(Math.max(e,.25),3),on=e=>Math.min(Math.max(e,rt),it),Ze=(0,i.useRef)(null),Te=(0,i.useRef)(null),X=(0,i.useRef)({scale:1,tx:0,ty:0,rotation:0}),_=(0,i.useRef)(0),Q=(0,i.useRef)(null),Ie=(0,i.useRef)(null),ke=(0,i.useCallback)((e,t,n,l)=>{let s=Ze.current,c=Te.current;if(!s||!c)return{tx:t,ty:n};let h=c.offsetWidth,y=c.offsetHeight,D=(Math.round(l/90)%4+4)%4;if(D===1||D===3){let Tn=h;h=y,y=Tn}let H=h*e,ao=y*e,lo=H>s.clientWidth?(H+s.clientWidth)/2-xo:0,so=ao>s.clientHeight?(ao+s.clientHeight)/2-xo:0;return{tx:Math.min(lo,Math.max(-lo,t)),ty:Math.min(so,Math.max(-so,n))}},[]),At=(0,i.useCallback)((e,t)=>{let n=Ze.current,l=Te.current;if(!n||!l)return e>1;let s=(Math.round(t/90)%4+4)%4,c=s===1||s===3,h=c?l.offsetHeight:l.offsetWidth,y=c?l.offsetWidth:l.offsetHeight;return h*e>n.clientWidth+1||y*e>n.clientHeight+1},[]),N=(0,i.useCallback)(e=>{let t=Te.current;if(!t)return;let{scale:n,tx:l,ty:s,rotation:c}=X.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${l}px, ${s}px) scale(${n}) rotate(${c}deg)`},[]),Xt=(0,i.useCallback)(()=>{let e=X.current,t=ke(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!_.current&&(_.current=requestAnimationFrame(()=>{_.current=0,N(!1)}))},[N,ke]),Wt=(0,i.useCallback)(()=>{_.current&&(cancelAnimationFrame(_.current),_.current=0),b.current.clear(),Q.current=null,Ie.current=null},[]),nn=(0,i.useCallback)(e=>{Te.current=e,e&&(X.current={scale:1,tx:0,ty:0,rotation:0},N(!1))},[N]);(0,i.useEffect)(()=>{if(M(p?.name||"",w)!=="image")return;let e=X.current;e.scale=I,e.rotation=W;let t=ke(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,N(!0)},[I,W,p,w,T,N,ke]),(0,i.useEffect)(()=>()=>{_.current&&cancelAnimationFrame(_.current)},[]);let rn=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...b.current.values()],n=X.current;if(t.length===2){Q.current=null;let l=e.currentTarget.getBoundingClientRect();Ie.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:l.left+l.width/2,centerY:l.top+l.height/2}}else t.length===1&&At(n.scale,n.rotation)&&(Q.current={startX:e.clientX,startY:e.clientY,baseTx:n.tx,baseTy:n.ty})},an=e=>{if(!b.current.has(e.pointerId))return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=X.current,n=Ie.current,l=[...b.current.values()];if(n&&l.length>=2){let c=Math.hypot(l[0].x-l[1].x,l[0].y-l[1].y),h=(l[0].x+l[1].x)/2,y=(l[0].y+l[1].y)/2,D=tn(n.baseScale*c/n.startDist),H=D/n.baseScale;t.scale=D,t.tx=h-n.centerX-H*(n.startMidX-n.centerX-n.baseTx),t.ty=y-n.centerY-H*(n.startMidY-n.centerY-n.baseTy),Xt();return}let s=Q.current;s&&l.length===1&&(t.tx=s.baseTx+(e.clientX-s.startX),t.ty=s.baseTy+(e.clientY-s.startY),Xt())},_t=e=>{if(!b.current.has(e.pointerId))return;b.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=X.current;if(b.current.size<2&&(Ie.current=null,Math.abs(t.scale-I)>.001&&z(t.scale)),b.current.size===0)Q.current=null;else if(b.current.size===1&&At(t.scale,t.rotation)){let n=[...b.current.values()][0];Q.current={startX:n.x,startY:n.y,baseTx:t.tx,baseTy:t.ty}}},Yt=(0,i.useCallback)(async()=>{if(T)try{let t=await(await fetch(T)).blob(),n=t.type==="image/png"?t:await po(t);await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),ye("\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),ye("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[T]);(0,i.useEffect)(()=>{if(!a||M(p?.name||"",w)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let n=t.target,l=n?.tagName;l==="INPUT"||l==="TEXTAREA"||n?.isContentEditable||(t.preventDefault(),Yt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,p,w,Yt]);let J=(0,i.useRef)(null),B=(0,i.useRef)(0),ae=(0,i.useRef)(null),ee=(0,i.useRef)(null),$=()=>U.current?.querySelector(".react-pdf__Page")??null,Le=(0,i.useRef)(null),jt=(0,i.useRef)(null),ln=()=>{let e=jt.current,t=$()?.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 l=n.getContext("2d");if(!l)return!1;l.drawImage(t,0,0);let s=t.getBoundingClientRect(),c=e.getBoundingClientRect();return Object.assign(n.style,{position:"absolute",left:`${s.left-c.left}px`,top:`${s.top-c.top}px`,width:`${s.width}px`,height:`${s.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(n),Le.current=n,!0},Ot=()=>{Le.current?.remove(),Le.current=null;let e=$();e&&(e.style.visibility="")},sn=()=>{B.current||(B.current=requestAnimationFrame(()=>{B.current=0;let e=J.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})}))},Ut=()=>{B.current&&(cancelAnimationFrame(B.current),B.current=0),J.current=null,ee.current=null,ae.current=null,Ot();let e=$();e&&(e.style.transform="",e.style.willChange="auto")},Nt=e=>{let t=$(),n=U.current;if(!t||!n)return;t.style.transform&&(t.style.transform="");let l=t.getBoundingClientRect(),s=n.getBoundingClientRect(),c=(e[0].x+e[1].x)/2,h=(e[0].y+e[1].y)/2;J.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:l.left,rectTop:l.top,pageW:l.width,pageH:l.height,viewerL:s.left,viewerT:s.top,viewerR:s.right,viewerB:s.bottom,startMidX:c,startMidY:h,lastMidX:c,lastMidY:h,k:1,tx:0,ty:0},ae.current={k:1,tx:0,ty:0,midX:c,midY:h},t.style.willChange="transform"},cn=e=>{if(e.pointerType!=="touch")return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...b.current.values()];if(t.length===2){if(ee.current||Le.current)return;Nt(t)}},dn=e=>{if(!b.current.has(e.pointerId))return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=J.current,n=[...b.current.values()];if(t&&n.length>=2){e.preventDefault();let l=Math.hypot(n[0].x-n[1].x,n[0].y-n[1].y),s=Math.min(Math.max(l/t.startDist,rt/(I||1)),it/(I||1)),c=(n[0].x+n[1].x)/2,h=(n[0].y+n[1].y)/2,y=c-t.rectLeft-s*(t.startMidX-t.rectLeft),D=h-t.rectTop-s*(t.startMidY-t.rectTop),H=at;y=Math.min(t.viewerR-H-t.rectLeft,Math.max(t.viewerL+H-t.rectLeft-s*t.pageW,y)),D=Math.min(t.viewerB-H-t.rectTop,Math.max(t.viewerT+H-t.rectTop-s*t.pageH,D)),t.k=s,t.tx=y,t.ty=D,t.lastMidX=c,t.lastMidY=h,sn()}},$t=e=>{if(b.current.delete(e.pointerId),b.current.size>=2)return;let t=J.current;if(J.current=null,!t)return;B.current&&(cancelAnimationFrame(B.current),B.current=0);let n=ae.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};ae.current=null;let l=on(I*n.k);if(Math.abs(l-I)<.001){let c=U.current;Ut(),c&&(c.scrollLeft-=n.tx,c.scrollTop-=n.ty);return}let s=U.current;if(s){let c=s.getBoundingClientRect();ee.current={u:(n.midX-t.rectLeft-n.tx)/n.k,v:(n.midY-t.rectTop-n.ty)/n.k,offX:n.midX-c.left,offY:n.midY-c.top,factor:l/(I||1)}}if(ln()){let c=$();c&&(c.style.transform="",c.style.visibility="hidden")}z(l),Math.round(Math.min(tt*l,no))===ot&&requestAnimationFrame(()=>Kt())},Ee=(0,i.useRef)(!0),Qe=(0,i.useRef)(null),Gt=()=>{let e=U.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},Kt=()=>{let e=ee.current;if(!e)return;ee.current=null;let t=U.current,n=$();if(!t||!n)return;Ot(),n.style.transform="",n.style.willChange="auto";let l=n.getBoundingClientRect(),s=t.getBoundingClientRect();t.scrollLeft+=l.left-s.left+e.u*e.factor-e.offX,t.scrollTop+=l.top-s.top+e.v*e.factor-e.offY;let c=[...b.current.values()];c.length>=2&&Nt(c)},qt=()=>{let e=`${R}:${W}`;if(ee.current){Qe.current=e,Kt();return}(Ee.current||Qe.current!==e)&&(Ee.current=!1,Qe.current=e,Gt())};(0,i.useEffect)(()=>()=>{B.current&&cancelAnimationFrame(B.current)},[]);let Zt=()=>{oe(e=>e-90)},Qt=()=>{oe(e=>e+90)},Jt=()=>{let e=M(p?.name||"",w);Ut(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?fe(14):e==="pdf"?(z(1),I===1&&W===0?Gt():Ee.current=!0):(Wt(),X.current={scale:1,tx:0,ty:0,rotation:0},N(!0),z(1)),oe(0)},eo=(e,t)=>{Dt(!0),No({x:e.clientX,y:e.clientY}),$o({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},to=(0,i.useCallback)((e,t)=>{if(!ve)return;let n=e.clientX-Ke.x,l=e.clientY-Ke.y;t.scrollLeft=qe.x-n,t.scrollTop=qe.y-l,e.preventDefault()},[ve,Ke,qe]),Je=(0,i.useCallback)(()=>{Dt(!1),document.body.style.cursor="default"},[]);(0,i.useEffect)(()=>{if(ve){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(l=>{to(t,l)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",Je),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",Je),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[ve,to,Je]);let un=(0,i.useCallback)(()=>{He(!1),xt(!1)},[]),et=(0,i.useCallback)(async(e,t)=>{xe(!0),je(!0);try{await new Promise(h=>setTimeout(h,500));let n=e.Sheets[t],l=ce.utils.decode_range(n["!ref"]||"A1");console.debug("Excel range:",l);let c=ce.utils.sheet_to_json(n,{header:1,range:l,defval:""}).map(h=>h.map(y=>({value:y!=null?String(y):""})));re(c),await new Promise(h=>setTimeout(h,200))}catch(n){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",n)}finally{je(!1)}},[]),mn=(0,i.useCallback)(()=>{xe(!1)},[]),pn=(0,i.useCallback)(e=>{Ye&&(_e(e),et(Ye,e))},[Ye,et]),oo=()=>{Wt(),X.current={scale:1,tx:0,ty:0,rotation:0},ye(""),T&&URL.revokeObjectURL(T),we.current=null,Ve(""),he(""),ge(""),re([]),Ct([]),_e(""),Tt(null),xe(!1),z(1),oe(0),pe(""),Lt(void 0),O(1),Rt("portrait"),Ft(0),St(0),d()};if(!p)return null;let v=M(p.name,w),hn=((Oo+W)%360+360)%360,Re=W%180===0?Ue:Ue>0?1/Ue:0,fn=Math.max(ie.width-fo,go),gn=Math.max(ie.height-fo,go),tt=ie.width>0&&Re>0?Math.min(fn,gn*Re):be==="portrait"?600:800,xn=typeof window<"u"&&window.devicePixelRatio||1,no=Hn/xn*(Re>0?Math.min(1,Re):1),ot=Math.round(Math.min(tt*I,no)),ro=Math.round(tt*I),yn=ro>ot,bn=Math.max(16,Math.round(ie.width)-at),vn=Math.max(16,Math.round(ie.height)-at),wn=be==="landscape"?"200px":"150px",Mn=be==="landscape"?.18:.17,io=()=>E?(0,o.jsx)(r.Box,{ref:Ne,sx:{width:wn,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:E},(e,t)=>(0,o.jsxs)(r.Box,{ref:n=>{Bt.current[t]=n},children:[(0,o.jsx)(r.Box,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:R===t+1?"2px solid":"1px solid",borderColor:R===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:be==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{O(t+1),g&&Oe(!1)},children:(0,o.jsx)(Y.Document,{file:T,options:Ht,loading:(0,o.jsx)("div",{style:{display:"none"}}),children:(0,o.jsx)(Y.Page,{pageNumber:t+1,scale:Mn,loading:(0,o.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),(0,o.jsx)(r.Typography,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:R===t+1?"primary.main":"",fontWeight:R===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,Cn=()=>{let e=M(p?.name||"",w);if(Wo&&!(e==="spreadsheet"))return(0,o.jsx)(r.Box,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(pt.LoadingProgress,{visible:ze,exitDelay:100,onComplete:un})});if(yt)return(0,o.jsxs)(r.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,o.jsx)(r.Typography,{color:"error",variant:"h6",children:yt}),(0,o.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(!T)return null;switch(e){case"image":return(0,o.jsx)(r.Box,{ref:Ze,"data-allow-pinch":"true",onPointerDown:rn,onPointerMove:an,onPointerUp:_t,onPointerCancel:_t,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:nn,src:T,alt:p.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)(r.Box,{ref:jt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!g&&io(),(0,o.jsx)(r.Box,{ref:Uo,className:"draggable-scroll",onMouseDown:n=>{let l=n.currentTarget;eo(n,l)},"data-allow-pinch":"true",onPointerDown:cn,onPointerMove:dn,onPointerUp:$t,onPointerCancel:$t,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:g?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...g&&{px:`${bn}px`,py:`${vn}px`},...yn&&{"& .react-pdf__Page__canvas":{width:`${ro}px !important`,height:"auto !important"}}}},children:(0,o.jsx)(Y.Document,{file:T,onLoadSuccess:Ko,onLoadError:n=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",n),pe("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:(0,o.jsx)("div",{style:{display:"none"}}),error:(0,o.jsxs)(r.Box,{sx:{textAlign:"center",p:4},children:[(0,o.jsx)(r.Typography,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),(0,o.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:Ht,children:(0,o.jsx)(Y.Page,{pageNumber:R,width:ot,rotate:W===0?void 0:hn,loading:(0,o.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:qo,onRenderSuccess:qt,onRenderError:qt})})})]}),g&&(0,o.jsx)(r.Drawer,{anchor:"left",open:jo,onClose:()=>Oe(!1),sx:{zIndex:n=>n.zIndex.modal+2},children:io()})]});case"text":case"code":return(0,o.jsx)(r.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:vt?(0,o.jsx)(r.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,o.jsx)(mt.default,{height:"100%",language:Pe(p.name),value:vt,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:ne,lineHeight:Math.round(ne*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(n,l)=>{n.onDidAttemptReadOnlyEdit(()=>{});let s=n.getDomNode();if(s){let c=document.createElement("style");c.textContent=`
|
|
1
|
+
"use strict";var Tr=Object.create;var Ee=Object.defineProperty;var Ir=Object.getOwnPropertyDescriptor;var kr=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty;var Fr=(a,d)=>{for(var u in d)Ee(a,u,{get:d[u],enumerable:!0})},co=(a,d,u,m)=>{if(d&&typeof d=="object"||typeof d=="function")for(let k of kr(d))!Er.call(a,k)&&k!==u&&Ee(a,k,{get:()=>d[k],enumerable:!(m=Ir(d,k))||m.enumerable});return a};var f=(a,d,u)=>(u=a!=null?Tr(Lr(a)):{},co(d||!a||!a.__esModule?Ee(u,"default",{value:a,enumerable:!0}):u,a)),Rr=a=>co(Ee({},"__esModule",{value:!0}),a);var Ar={};Fr(Ar,{FileTypeIcon:()=>gt,FileViewer:()=>ht,FileViewerDefault:()=>Po,HtmlIcon:()=>se,ImageIcon:()=>$,PdfIcon:()=>G,ZipIcon:()=>ce,ensureFileExtension:()=>mo,getEditorLanguage:()=>Re,getFileType:()=>Fe,getFileTypeFromMime:()=>rt,getFileTypeIcon:()=>de,isFileViewerPreviewable:()=>uo,resolveFileType:()=>M,saveBlobAsFile:()=>Pe});module.exports=Rr(Ar);var i=require("react"),n=require("@mui/material"),bo=f(require("@mui/icons-material/Close"),1),vo=f(require("@mui/icons-material/Menu"),1),wo=f(require("@mui/icons-material/MoreHoriz"),1),lt=f(require("@mui/icons-material/Download"),1),Mo=f(require("@mui/icons-material/Add"),1),Co=f(require("@mui/icons-material/Remove"),1),st=f(require("@mui/icons-material/RotateLeft"),1),ct=f(require("@mui/icons-material/RotateRight"),1),dt=f(require("@mui/icons-material/FitScreen"),1),De=f(require("@mui/icons-material/KeyboardArrowLeft"),1),Be=f(require("@mui/icons-material/KeyboardArrowRight"),1),To=f(require("@mui/icons-material/TextSnippet"),1),Io=f(require("@mui/icons-material/VideoFile"),1),ko=f(require("@mui/icons-material/AudioFile"),1),Lo=f(require("@mui/icons-material/Description"),1),Eo=f(require("@mui/icons-material/InsertDriveFile"),1),ut=f(require("@mui/icons-material/Code"),1),Fo=f(require("@mui/icons-material/TableView"),1),_=require("react-pdf"),mt=f(require("@monaco-editor/react"),1),Ro=f(require("react-spreadsheet"),1),le=f(require("xlsx"),1),pt=require("@ehfuse/mui-fadeout-loading-progress");var Fe=a=>{let d=a.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"},rt=a=>{let d=(a||"").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"},M=(a,d)=>{let u=Fe(a);return u!=="unsupported"?u:rt(d)},Pr=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),uo=a=>Pr.has(Fe(a)),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"},mo=(a,d)=>{let u=(a??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(u))return u;let m=(d??"").trim().toLowerCase().split(";")[0],k=Sr[m]??"";return k?`${u}.${k}`:u},Re=a=>{let d=a.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 Dr=a=>(a||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",Pe=(a,d)=>{let u=URL.createObjectURL(a),m=document.createElement("a");m.href=u,m.download=Dr(d),m.rel="noopener",document.body.appendChild(m),m.click(),m.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),6e4)};var po=async a=>{let d=URL.createObjectURL(a);try{let u=await new Promise((Y,K)=>{let L=new Image;L.onload=()=>Y(L),L.onerror=()=>K(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),L.src=d}),m=document.createElement("canvas");m.width=u.naturalWidth||u.width||1024,m.height=u.naturalHeight||u.height||1024;let k=m.getContext("2d");if(!k)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return k.drawImage(u,0,0,m.width,m.height),await new Promise((Y,K)=>{m.toBlob(L=>L?Y(L):K(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(d)}};var Se=require("@mui/material");function ho(){let a=(0,Se.useTheme)();return!(0,Se.useMediaQuery)(a.breakpoints.up("lg"))}var H=require("react/jsx-runtime");function $(a){return(0,H.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:a.width||"22px",...a,children:[(0,H.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,H.jsx)("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),(0,H.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,H.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,H.jsxs)("g",{children:[(0,H.jsx)("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),(0,H.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 C=require("react/jsx-runtime");function G(a){return(0,C.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:a.width||"28px",...a,children:(0,C.jsxs)("g",{children:[(0,C.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,C.jsx)("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),(0,C.jsxs)("g",{children:[(0,C.jsxs)("g",{children:[(0,C.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,C.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,C.jsx)("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),(0,C.jsx)("g",{children:(0,C.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,C.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,C.jsx)("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),(0,C.jsx)("g",{children:(0,C.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 Br="/pdfjs",fo=32,go=240,zr=8192,nt=.25,it=8,at=80,xo=80,Hr=a=>{switch(a){case"image":return(0,o.jsx)($,{});case"pdf":return(0,o.jsx)(G,{});case"text":return(0,o.jsx)(To.default,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return(0,o.jsx)(Fo.default,{sx:{mr:1,color:"#4CAF50"}});case"html":return(0,o.jsx)(ut.default,{sx:{mr:1,color:"#E91E63"}});case"code":return(0,o.jsx)(ut.default,{sx:{mr:1,color:"#2196F3"}});case"video":return(0,o.jsx)(Io.default,{sx:{mr:1,color:"#AB47BC"}});case"audio":return(0,o.jsx)(ko.default,{sx:{mr:1,color:"#FF7043"}});case"office":return(0,o.jsx)(Lo.default,{sx:{mr:1,color:"#FFA726"}});default:return(0,o.jsx)(Eo.default,{sx:{mr:1,color:"#78909C"}})}},yo=a=>typeof a?.rotate=="number"?a.rotate:typeof a?._pageInfo?.rotate=="number"?a._pageInfo.rotate:0,ht=({open:a,onClose:d,file:u,files:m=null,initialIndex:k=0,loadFile:Y,onDownload:K,pdfAssetBase:L=Br})=>{let x=ho(),Xo=(0,n.useTheme)(),te=(0,n.useMediaQuery)(Xo.breakpoints.down("sm")),b=(0,i.useMemo)(()=>m&&m.length>0?m:[],[m]),[q,V]=(0,i.useState)(0);(0,i.useEffect)(()=>{a&&V(b.length>0?Math.min(Math.max(k,0),b.length-1):0)},[a,k,b]);let p=b.length>0?b[q]??u:u,[ze,He]=(0,i.useState)(!0),[Wo,xt]=(0,i.useState)(!1),[T,Ve]=(0,i.useState)(""),[I,B]=(0,i.useState)(1),[X,oe]=(0,i.useState)(0),[yt,ue]=(0,i.useState)(""),[w,bt]=(0,i.useState)(""),[vt,me]=(0,i.useState)(""),[re,pe]=(0,i.useState)(14),[Ae,he]=(0,i.useState)(""),[Xe,wt]=(0,i.useState)("preview"),[We,ne]=(0,i.useState)([]),[Mt,Ct]=(0,i.useState)([]),[_o,_e]=(0,i.useState)(""),[Ye,Tt]=(0,i.useState)(null),[It,fe]=(0,i.useState)(!1),[Yo,je]=(0,i.useState)(!0),[kt,ge]=(0,i.useState)(""),[E,Lt]=(0,i.useState)(),[F,j]=(0,i.useState)(1),[jo,Oe]=(0,i.useState)(!1),[Et,Z]=(0,i.useState)(null),[xe,Ft]=(0,i.useState)("portrait"),[Oo,Rt]=(0,i.useState)(0),[Ue,Pt]=(0,i.useState)(0),[ie,St]=(0,i.useState)({width:0,height:0}),Dt=(0,i.useRef)([]),Ne=(0,i.useRef)(null),O=(0,i.useRef)(null),$e=(0,i.useRef)(null),Ge=(0,i.useRef)(null),Uo=(0,i.useCallback)(e=>{if($e.current?.disconnect(),Ge.current?.(),Ge.current=null,O.current=e,!e){$e.current=null;return}let t=s=>{s.touches.length>=2&&s.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),Ge.current=()=>e.removeEventListener("touchmove",t);let r=new ResizeObserver(s=>{let c=s[0]?.contentRect;c&&St({width:c.width,height:c.height})});r.observe(e),$e.current=r;let l=e.getBoundingClientRect();St({width:l.width,height:l.height})},[]),[ye,Bt]=(0,i.useState)(!1),[Ke,No]=(0,i.useState)({x:0,y:0}),[qe,$o]=(0,i.useState)({x:0,y:0}),Go=(0,i.useCallback)(async(e,t)=>{let r=URL.createObjectURL(e);Ve(r),bt(e.type||"");let l=M(t,e.type||"");if(l==="text"||l==="code"){let c=await e.text();me(c);return}if(l==="html"){let c=await e.text();he(c);return}if(l!=="spreadsheet")return;let s=t.split(".").pop()?.toLowerCase()||"";if(s==="csv"){let h=(await e.text()).split(`
|
|
2
|
+
`).map(g=>g.split(",").map(D=>({value:D.trim()})));ne(h);return}if(s==="xls"||s==="xlsx"){fe(!0),je(!0);let c=await e.arrayBuffer(),h=le.read(c,{type:"array"});Ct(h.SheetNames),Tt(h);let g=h.SheetNames[0];_e(g),et(h,g)}},[]),be=(0,i.useRef)(null),zt=(0,i.useCallback)(async e=>{if(e.blob)return e.blob;if(Y)return await Y(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.")},[Y]);(0,i.useEffect)(()=>(p&&a?Qo():(T&&URL.revokeObjectURL(T),be.current=null,Ve(""),me(""),he(""),ne([]),pe(14),B(1),oe(0)),()=>{T&&URL.revokeObjectURL(T)}),[p,a]);let Ko=({numPages:e})=>{Lt(e),j(1),ke.current=!0},qo=e=>{let{width:t,height:r}=Zo(e);Rt(yo(e)),t>0&&r>0&&Pt(t/r);let l=t>r?"landscape":"portrait";Ft(l)},Zo=e=>{let t=e?.width||0,r=e?.height||0,l=yo(e);try{if(typeof e?.getViewport=="function"){let s=e.getViewport({scale:1,rotation:l});t=s.width,r=s.height}}catch(s){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",s)}return{width:t,height:r}},ve=(0,i.useCallback)(()=>{j(e=>Math.max(e-1,1))},[]),we=(0,i.useCallback)(()=>{j(e=>Math.min(e+1,E||1))},[E]),Ht=(0,i.useMemo)(()=>({cMapUrl:`${L}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${L}/standard_fonts/`,wasmUrl:`${L}/wasm/`}),[L]);(0,i.useEffect)(()=>{typeof window>"u"||(_.pdfjs.GlobalWorkerOptions.workerSrc=`${L}/pdf.worker.min.mjs`)},[L]),(0,i.useEffect)(()=>{if(!a||b.length<=1||M(p?.name||"",w)==="pdf")return;let e=t=>{t.key==="ArrowLeft"?(t.preventDefault(),V(r=>Math.max(r-1,0))):t.key==="ArrowRight"&&(t.preventDefault(),V(r=>Math.min(r+1,b.length-1)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,b.length,p?.name,w]),(0,i.useEffect)(()=>{if(!a||b.length<=1||M(p?.name||"",w)==="pdf"||I>1)return;let e=0,t=0,r=s=>{e=s.touches[0]?.clientX??0,t=s.touches[0]?.clientY??0},l=s=>{let c=(s.changedTouches[0]?.clientX??0)-e,h=(s.changedTouches[0]?.clientY??0)-t;Math.abs(c)<60||Math.abs(h)>Math.abs(c)||(c<0?V(g=>Math.min(g+1,b.length-1)):V(g=>Math.max(g-1,0)))};return document.addEventListener("touchstart",r,{passive:!0}),document.addEventListener("touchend",l,{passive:!0}),()=>{document.removeEventListener("touchstart",r),document.removeEventListener("touchend",l)}},[a,b.length,p?.name,w,I]),(0,i.useEffect)(()=>{if(!a||M(p?.name||"",w)!=="pdf")return;let e=r=>{switch(r.key){case"ArrowLeft":case"ArrowUp":r.preventDefault(),ve();break;case"ArrowRight":case"ArrowDown":r.preventDefault(),we();break;case"Home":r.preventDefault(),j(1);break;case"End":r.preventDefault(),E&&j(E);break}},t=r=>{r.ctrlKey||Math.abs(r.deltaY)>50&&(r.preventDefault(),r.deltaY>0?we():ve())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[a,p,w,ve,we,E]),(0,i.useEffect)(()=>{if(!E||!a||M(p?.name||"",w)!=="pdf")return;if(F===1&&Ne.current){Ne.current.scrollTo({top:0,behavior:"smooth"});return}let e=Dt.current[F-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[a,p,w,E,F]),(0,i.useEffect)(()=>{if(ze){let e=window.setTimeout(()=>xt(!0),180);return()=>window.clearTimeout(e)}},[ze]);let Qo=async()=>{if(p){He(!0),ue(""),bt(""),me(""),he(""),ne([]);try{let e=await zt(p);be.current=e,await Go(e,p.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),ue("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{He(!1)}}},Vt=async()=>{if(p)try{if(K){await K(p);return}let e=be.current??await zt(p);Pe(e,p.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},Jo=()=>{let e=p?M(p.name,w):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?pe(t=>Math.min(t+2,24)):B(e==="pdf"?t=>Math.min(t+.25,it):t=>Math.min(t+.25,3))},er=()=>{let e=p?M(p.name,w):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?pe(t=>Math.max(t-2,10)):B(e==="pdf"?t=>Math.max(t-.25,nt):t=>Math.max(t-.25,.25))},y=(0,i.useRef)(new Map),tr=e=>Math.min(Math.max(e,.25),3),or=e=>Math.min(Math.max(e,nt),it),Ze=(0,i.useRef)(null),Me=(0,i.useRef)(null),A=(0,i.useRef)({scale:1,tx:0,ty:0,rotation:0}),W=(0,i.useRef)(0),Q=(0,i.useRef)(null),Ce=(0,i.useRef)(null),Te=(0,i.useCallback)((e,t,r,l)=>{let s=Ze.current,c=Me.current;if(!s||!c)return{tx:t,ty:r};let h=c.offsetWidth,g=c.offsetHeight,D=(Math.round(l/90)%4+4)%4;if(D===1||D===3){let Cr=h;h=g,g=Cr}let z=h*e,ao=g*e,lo=z>s.clientWidth?(z+s.clientWidth)/2-xo:0,so=ao>s.clientHeight?(ao+s.clientHeight)/2-xo:0;return{tx:Math.min(lo,Math.max(-lo,t)),ty:Math.min(so,Math.max(-so,r))}},[]),At=(0,i.useCallback)((e,t)=>{let r=Ze.current,l=Me.current;if(!r||!l)return e>1;let s=(Math.round(t/90)%4+4)%4,c=s===1||s===3,h=c?l.offsetHeight:l.offsetWidth,g=c?l.offsetWidth:l.offsetHeight;return h*e>r.clientWidth+1||g*e>r.clientHeight+1},[]),U=(0,i.useCallback)(e=>{let t=Me.current;if(!t)return;let{scale:r,tx:l,ty:s,rotation:c}=A.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${l}px, ${s}px) scale(${r}) rotate(${c}deg)`},[]),Xt=(0,i.useCallback)(()=>{let e=A.current,t=Te(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!W.current&&(W.current=requestAnimationFrame(()=>{W.current=0,U(!1)}))},[U,Te]),Wt=(0,i.useCallback)(()=>{W.current&&(cancelAnimationFrame(W.current),W.current=0),y.current.clear(),Q.current=null,Ce.current=null},[]),rr=(0,i.useCallback)(e=>{Me.current=e,e&&(A.current={scale:1,tx:0,ty:0,rotation:0},U(!1))},[U]);(0,i.useEffect)(()=>{if(M(p?.name||"",w)!=="image")return;let e=A.current;e.scale=I,e.rotation=X;let t=Te(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,U(!0)},[I,X,p,w,T,U,Te]),(0,i.useEffect)(()=>()=>{W.current&&cancelAnimationFrame(W.current)},[]);let nr=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...y.current.values()],r=A.current;if(t.length===2){Q.current=null;let l=e.currentTarget.getBoundingClientRect();Ce.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:l.left+l.width/2,centerY:l.top+l.height/2}}else t.length===1&&At(r.scale,r.rotation)&&(Q.current={startX:e.clientX,startY:e.clientY,baseTx:r.tx,baseTy:r.ty})},ir=e=>{if(!y.current.has(e.pointerId))return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=A.current,r=Ce.current,l=[...y.current.values()];if(r&&l.length>=2){let c=Math.hypot(l[0].x-l[1].x,l[0].y-l[1].y),h=(l[0].x+l[1].x)/2,g=(l[0].y+l[1].y)/2,D=tr(r.baseScale*c/r.startDist),z=D/r.baseScale;t.scale=D,t.tx=h-r.centerX-z*(r.startMidX-r.centerX-r.baseTx),t.ty=g-r.centerY-z*(r.startMidY-r.centerY-r.baseTy),Xt();return}let s=Q.current;s&&l.length===1&&(t.tx=s.baseTx+(e.clientX-s.startX),t.ty=s.baseTy+(e.clientY-s.startY),Xt())},_t=e=>{if(!y.current.has(e.pointerId))return;y.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=A.current;if(y.current.size<2&&(Ce.current=null,Math.abs(t.scale-I)>.001&&B(t.scale)),y.current.size===0)Q.current=null;else if(y.current.size===1&&At(t.scale,t.rotation)){let r=[...y.current.values()][0];Q.current={startX:r.x,startY:r.y,baseTx:t.tx,baseTy:t.ty}}},Yt=(0,i.useCallback)(async()=>{if(T)try{let t=await(await fetch(T)).blob(),r=t.type==="image/png"?t:await po(t);await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),ge("\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),ge("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[T]);(0,i.useEffect)(()=>{if(!a||M(p?.name||"",w)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let r=t.target,l=r?.tagName;l==="INPUT"||l==="TEXTAREA"||r?.isContentEditable||(t.preventDefault(),Yt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,p,w,Yt]);let J=(0,i.useRef)(null),S=(0,i.useRef)(0),ae=(0,i.useRef)(null),ee=(0,i.useRef)(null),N=()=>O.current?.querySelector(".react-pdf__Page")??null,Ie=(0,i.useRef)(null),jt=(0,i.useRef)(null),ar=()=>{let e=jt.current,t=N()?.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 l=r.getContext("2d");if(!l)return!1;l.drawImage(t,0,0);let s=t.getBoundingClientRect(),c=e.getBoundingClientRect();return Object.assign(r.style,{position:"absolute",left:`${s.left-c.left}px`,top:`${s.top-c.top}px`,width:`${s.width}px`,height:`${s.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(r),Ie.current=r,!0},Ot=()=>{Ie.current?.remove(),Ie.current=null;let e=N();e&&(e.style.visibility="")},lr=()=>{S.current||(S.current=requestAnimationFrame(()=>{S.current=0;let e=J.current,t=N();!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})}))},Ut=()=>{S.current&&(cancelAnimationFrame(S.current),S.current=0),J.current=null,ee.current=null,ae.current=null,Ot();let e=N();e&&(e.style.transform="",e.style.willChange="auto")},Nt=e=>{let t=N(),r=O.current;if(!t||!r)return;t.style.transform&&(t.style.transform="");let l=t.getBoundingClientRect(),s=r.getBoundingClientRect(),c=(e[0].x+e[1].x)/2,h=(e[0].y+e[1].y)/2;J.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:l.left,rectTop:l.top,pageW:l.width,pageH:l.height,viewerL:s.left,viewerT:s.top,viewerR:s.right,viewerB:s.bottom,startMidX:c,startMidY:h,lastMidX:c,lastMidY:h,k:1,tx:0,ty:0},ae.current={k:1,tx:0,ty:0,midX:c,midY:h},t.style.willChange="transform"},sr=e=>{if(e.pointerType!=="touch")return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...y.current.values()];if(t.length===2){if(ee.current||Ie.current)return;Nt(t)}},cr=e=>{if(!y.current.has(e.pointerId))return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=J.current,r=[...y.current.values()];if(t&&r.length>=2){e.preventDefault();let l=Math.hypot(r[0].x-r[1].x,r[0].y-r[1].y),s=Math.min(Math.max(l/t.startDist,nt/(I||1)),it/(I||1)),c=(r[0].x+r[1].x)/2,h=(r[0].y+r[1].y)/2,g=c-t.rectLeft-s*(t.startMidX-t.rectLeft),D=h-t.rectTop-s*(t.startMidY-t.rectTop),z=at;g=Math.min(t.viewerR-z-t.rectLeft,Math.max(t.viewerL+z-t.rectLeft-s*t.pageW,g)),D=Math.min(t.viewerB-z-t.rectTop,Math.max(t.viewerT+z-t.rectTop-s*t.pageH,D)),t.k=s,t.tx=g,t.ty=D,t.lastMidX=c,t.lastMidY=h,lr()}},$t=e=>{if(y.current.delete(e.pointerId),y.current.size>=2)return;let t=J.current;if(J.current=null,!t)return;S.current&&(cancelAnimationFrame(S.current),S.current=0);let r=ae.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};ae.current=null;let l=or(I*r.k);if(Math.abs(l-I)<.001){let c=O.current;Ut(),c&&(c.scrollLeft-=r.tx,c.scrollTop-=r.ty);return}let s=O.current;if(s){let c=s.getBoundingClientRect();ee.current={u:(r.midX-t.rectLeft-r.tx)/r.k,v:(r.midY-t.rectTop-r.ty)/r.k,offX:r.midX-c.left,offY:r.midY-c.top,factor:l/(I||1)}}if(ar()){let c=N();c&&(c.style.transform="",c.style.visibility="hidden")}B(l),Math.round(Math.min(tt*l,ro))===ot&&requestAnimationFrame(()=>Kt())},ke=(0,i.useRef)(!0),Qe=(0,i.useRef)(null),Gt=()=>{let e=O.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},Kt=()=>{let e=ee.current;if(!e)return;ee.current=null;let t=O.current,r=N();if(!t||!r)return;Ot(),r.style.transform="",r.style.willChange="auto";let l=r.getBoundingClientRect(),s=t.getBoundingClientRect();t.scrollLeft+=l.left-s.left+e.u*e.factor-e.offX,t.scrollTop+=l.top-s.top+e.v*e.factor-e.offY;let c=[...y.current.values()];c.length>=2&&Nt(c)},qt=()=>{let e=`${F}:${X}`;if(ee.current){Qe.current=e,Kt();return}(ke.current||Qe.current!==e)&&(ke.current=!1,Qe.current=e,Gt())};(0,i.useEffect)(()=>()=>{S.current&&cancelAnimationFrame(S.current)},[]);let Zt=()=>{oe(e=>e-90)},Qt=()=>{oe(e=>e+90)},Jt=()=>{let e=M(p?.name||"",w);Ut(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?pe(14):e==="pdf"?(B(1),I===1&&X===0?Gt():ke.current=!0):(Wt(),A.current={scale:1,tx:0,ty:0,rotation:0},U(!0),B(1)),oe(0)},eo=(e,t)=>{Bt(!0),No({x:e.clientX,y:e.clientY}),$o({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},to=(0,i.useCallback)((e,t)=>{if(!ye)return;let r=e.clientX-Ke.x,l=e.clientY-Ke.y;t.scrollLeft=qe.x-r,t.scrollTop=qe.y-l,e.preventDefault()},[ye,Ke,qe]),Je=(0,i.useCallback)(()=>{Bt(!1),document.body.style.cursor="default"},[]);(0,i.useEffect)(()=>{if(ye){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(l=>{to(t,l)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",Je),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",Je),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[ye,to,Je]);let dr=(0,i.useCallback)(()=>{He(!1),xt(!1)},[]),et=(0,i.useCallback)(async(e,t)=>{fe(!0),je(!0);try{await new Promise(h=>setTimeout(h,500));let r=e.Sheets[t],l=le.utils.decode_range(r["!ref"]||"A1");console.debug("Excel range:",l);let c=le.utils.sheet_to_json(r,{header:1,range:l,defval:""}).map(h=>h.map(g=>({value:g!=null?String(g):""})));ne(c),await new Promise(h=>setTimeout(h,200))}catch(r){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",r)}finally{je(!1)}},[]),ur=(0,i.useCallback)(()=>{fe(!1)},[]),mr=(0,i.useCallback)(e=>{Ye&&(_e(e),et(Ye,e))},[Ye,et]),oo=()=>{Wt(),A.current={scale:1,tx:0,ty:0,rotation:0},ge(""),T&&URL.revokeObjectURL(T),be.current=null,Ve(""),me(""),he(""),ne([]),Ct([]),_e(""),Tt(null),fe(!1),B(1),oe(0),ue(""),Lt(void 0),j(1),Ft("portrait"),Rt(0),Pt(0),d()};if(!p)return null;let v=M(p.name,w),pr=((Oo+X)%360+360)%360,Le=X%180===0?Ue:Ue>0?1/Ue:0,hr=Math.max(ie.width-fo,go),fr=Math.max(ie.height-fo,go),tt=ie.width>0&&Le>0?Math.min(hr,fr*Le):xe==="portrait"?600:800,gr=typeof window<"u"&&window.devicePixelRatio||1,ro=zr/gr*(Le>0?Math.min(1,Le):1),ot=Math.round(Math.min(tt*I,ro)),no=Math.round(tt*I),xr=no>ot,yr=Math.max(16,Math.round(ie.width)-at),br=Math.max(16,Math.round(ie.height)-at),vr=xe==="landscape"?"200px":"150px",wr=xe==="landscape"?.18:.17,io=()=>E?(0,o.jsx)(n.Box,{ref:Ne,sx:{width:vr,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:E},(e,t)=>(0,o.jsxs)(n.Box,{ref:r=>{Dt.current[t]=r},children:[(0,o.jsx)(n.Box,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:F===t+1?"2px solid":"1px solid",borderColor:F===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:xe==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{j(t+1),x&&Oe(!1)},children:(0,o.jsx)(_.Document,{file:T,options:Ht,loading:(0,o.jsx)("div",{style:{display:"none"}}),children:(0,o.jsx)(_.Page,{pageNumber:t+1,scale:wr,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:F===t+1?"primary.main":"",fontWeight:F===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,Mr=()=>{let e=M(p?.name||"",w);if(Wo&&!(e==="spreadsheet"))return(0,o.jsx)(n.Box,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(pt.LoadingProgress,{visible:ze,exitDelay:100,onComplete:dr})});if(yt)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:yt}),(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(!T)return null;switch(e){case"image":return(0,o.jsx)(n.Box,{ref:Ze,"data-allow-pinch":"true",onPointerDown:nr,onPointerMove:ir,onPointerUp:_t,onPointerCancel:_t,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:rr,src:T,alt:p.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:jt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!x&&io(),(0,o.jsx)(n.Box,{ref:Uo,className:"draggable-scroll",onMouseDown:r=>{let l=r.currentTarget;eo(r,l)},"data-allow-pinch":"true",onPointerDown:sr,onPointerMove:cr,onPointerUp:$t,onPointerCancel:$t,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:x?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...x&&{px:`${yr}px`,py:`${br}px`},...xr&&{"& .react-pdf__Page__canvas":{width:`${no}px !important`,height:"auto !important"}}}},children:(0,o.jsx)(_.Document,{file:T,onLoadSuccess:Ko,onLoadError:r=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",r),ue("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:Ht,children:(0,o.jsx)(_.Page,{pageNumber:F,width:ot,rotate:X===0?void 0:pr,loading:(0,o.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:qo,onRenderSuccess:qt,onRenderError:qt})})})]}),x&&(0,o.jsx)(n.Drawer,{anchor:"left",open:jo,onClose:()=>Oe(!1),sx:{zIndex:r=>r.zIndex.modal+2},children:io()})]});case"text":case"code":return(0,o.jsx)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:vt?(0,o.jsx)(n.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,o.jsx)(mt.default,{height:"100%",language:Re(p.name),value:vt,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:(r,l)=>{r.onDidAttemptReadOnlyEdit(()=>{});let s=r.getDomNode();if(s){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 @@
|
|
|
27
27
|
.monaco-editor .overlay.cursor-layer {
|
|
28
28
|
padding-left: 15px !important;
|
|
29
29
|
}
|
|
30
|
-
`,s.appendChild(c)}}})}):(0,o.jsx)(
|
|
30
|
+
`,s.appendChild(c)}}})}):(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:Ae?(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:Xe==="preview"?"contained":"outlined",size:"small",onClick:()=>wt("preview"),children:"\uBBF8\uB9AC\uBCF4\uAE30"}),(0,o.jsx)(n.Button,{variant:Xe==="source"?"contained":"outlined",size:"small",onClick:()=>wt("source"),children:"\uC18C\uC2A4\uCF54\uB4DC"})]}),Xe==="preview"?(0,o.jsx)(n.Box,{sx:{flex:1,overflow:"auto",backgroundColor:"white",border:"1px solid",borderColor:"grey.300",fontSize:`${re}px`,p:2},dangerouslySetInnerHTML:{__html:Ae}}):(0,o.jsx)(n.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,o.jsx)(mt.default,{height:"100%",language:"html",value:Ae,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:(r,l)=>{r.onDidAttemptReadOnlyEdit(()=>{});let s=r.getDomNode();if(s){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 @@
|
|
|
55
55
|
.monaco-editor .overlay.cursor-layer {
|
|
56
56
|
padding-left: 15px !important;
|
|
57
57
|
}
|
|
58
|
-
`,s.appendChild(c)}}})})]}):(0,o.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,o.jsx)(r.Typography,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return(0,o.jsx)(r.Box,{className:"draggable-scroll",onMouseDown:n=>{let l=n.currentTarget;eo(n,l)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:(0,o.jsx)("video",{src:T,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${I}) rotate(${W}deg)`,transition:"transform 0.3s ease",pointerEvents:I>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)(r.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[We.length>0||It?(0,o.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:[We.length>0&&(0,o.jsx)(r.Box,{sx:{minWidth:"max-content",minHeight:"max-content"},children:(0,o.jsx)(Fo.default,{data:We,darkMode:!1})}),It&&(0,o.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,o.jsx)(pt.LoadingProgress,{visible:Yo,exitDelay:200,fadeoutDuration:300,onComplete:mn})})]}):(0,o.jsx)(r.Box,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.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."})}),Mt.length>1&&(0,o.jsx)(r.Box,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:(0,o.jsx)(r.Tabs,{value:_o,onChange:(n,l)=>pn(l),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:Mt.map(n=>(0,o.jsx)(r.Tab,{label:n,value:n},n))})})]});case"audio":return(0,o.jsxs)(r.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[(0,o.jsx)(r.Typography,{variant:"h6",sx:{mb:2},children:p.name}),(0,o.jsx)("audio",{src:T,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)(r.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,o.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,o.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,o.jsxs)(r.Dialog,{open:a,onClose:oo,maxWidth:"lg",fullScreen:!0,children:[(0,o.jsxs)(r.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:g?1:3},onContextMenu:e=>e.preventDefault(),children:[(0,o.jsxs)(r.Box,{sx:{display:"flex",alignItems:"center",gap:te?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:g?"1.7rem":void 0}},children:[x.length>1?(0,o.jsxs)(r.Box,{sx:{display:"flex",alignItems:"center",gap:g?0:.5},children:[(0,o.jsx)(r.Tooltip,{title:"\uC774\uC804 \uD30C\uC77C",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(r.IconButton,{onClick:()=>P(e=>Math.max(e-1,0)),disabled:A<=0,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:(0,o.jsx)(le.default,{})})})}),(0,o.jsxs)(r.Typography,{variant:"body2",sx:{color:"grey.300",minWidth:40,textAlign:"center",userSelect:"none"},children:[A+1," / ",x.length]}),(0,o.jsx)(r.Tooltip,{title:"\uB2E4\uC74C \uD30C\uC77C",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(r.IconButton,{onClick:()=>P(e=>Math.min(e+1,x.length-1)),disabled:A>=x.length-1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:(0,o.jsx)(se.default,{})})})})]}):null,g&&v==="pdf"&&E?(0,o.jsx)(r.Tooltip,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:(0,o.jsx)(r.IconButton,{onClick:()=>Oe(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,o.jsx)(vo.default,{})})}):null,v==="pdf"&&E?(0,o.jsxs)(r.Box,{sx:{display:"flex",alignItems:"center",gap:g?0:.5},children:[(0,o.jsx)(r.Tooltip,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(r.IconButton,{onClick:Me,disabled:R<=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)(le.default,{})})})}),(0,o.jsx)(r.Typography,{variant:"body2",sx:{minWidth:g?"auto":"80px",textAlign:"center",color:"white",px:g?.5:1,fontSize:g?"1.05rem":void 0,fontWeight:g?600:void 0,whiteSpace:"nowrap"},children:te?R:`${R} / ${E}`}),(0,o.jsx)(r.Tooltip,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(r.IconButton,{onClick:Ce,disabled:R>=E,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)(se.default,{})})})})]}):null]}),(0,o.jsx)(r.Box,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:te?0:2,overflow:"hidden"},children:!te&&(0,o.jsxs)(r.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Vn(v),p.name]})}),(0,o.jsxs)(r.Box,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:te?.35:1,"& .MuiSvgIcon-root":{fontSize:g?"1.7rem":void 0}},children:[(v==="image"||v==="pdf"||v==="text"||v==="html"||v==="code"||v==="spreadsheet")&&(0,o.jsxs)(o.Fragment,{children:[!(g&&(v==="image"||v==="pdf"))&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r.Tooltip,{title:"\uD655\uB300",children:(0,o.jsx)(r.IconButton,{onClick:Jo,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)(Mo.default,{})})}),(0,o.jsx)(r.Tooltip,{title:"\uCD95\uC18C",children:(0,o.jsx)(r.IconButton,{onClick:en,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)(Co.default,{})})})]}),!g&&(0,o.jsx)(r.Tooltip,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:(0,o.jsx)(r.IconButton,{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:(0,o.jsx)(dt.default,{})})}),!g&&(v==="image"||v==="pdf")&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r.Tooltip,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,o.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,o.jsx)(st.default,{})})}),(0,o.jsx)(r.Tooltip,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,o.jsx)(r.IconButton,{onClick:Qt,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)(ct.default,{})})})]})]}),!g&&(0,o.jsx)(r.Tooltip,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:(0,o.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,o.jsx)(lt.default,{})})}),g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r.Tooltip,{title:"\uB354\uBCF4\uAE30",children:(0,o.jsx)(r.IconButton,{onClick:e=>Z(e.currentTarget),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,o.jsx)(wo.default,{})})}),(0,o.jsxs)(r.Menu,{anchorEl:Et,open:!!Et,onClose:()=>Z(null),children:[v==="image"||v==="pdf"?(0,o.jsxs)(r.MenuItem,{onClick:()=>{Jt(),Z(null)},children:[(0,o.jsx)(r.ListItemIcon,{children:(0,o.jsx)(dt.default,{fontSize:"small"})}),(0,o.jsx)(r.ListItemText,{children:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30"})]}):null,v==="image"||v==="pdf"?(0,o.jsxs)(r.MenuItem,{onClick:()=>{Zt(),Z(null)},children:[(0,o.jsx)(r.ListItemIcon,{children:(0,o.jsx)(st.default,{fontSize:"small"})}),(0,o.jsx)(r.ListItemText,{children:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,v==="image"||v==="pdf"?(0,o.jsxs)(r.MenuItem,{onClick:()=>{Qt(),Z(null)},children:[(0,o.jsx)(r.ListItemIcon,{children:(0,o.jsx)(ct.default,{fontSize:"small"})}),(0,o.jsx)(r.ListItemText,{children:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,(0,o.jsxs)(r.MenuItem,{onClick:()=>{Vt(),Z(null)},children:[(0,o.jsx)(r.ListItemIcon,{children:(0,o.jsx)(lt.default,{fontSize:"small"})}),(0,o.jsx)(r.ListItemText,{children:"\uB2E4\uC6B4\uB85C\uB4DC"})]})]})]}),(0,o.jsx)(r.Tooltip,{title:"\uB2EB\uAE30",children:(0,o.jsx)(r.IconButton,{onClick:oo,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)(bo.default,{})})})]})]}),!g&&x.length>1&&A>0?(0,o.jsx)(r.IconButton,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>P(e=>Math.max(e-1,0)),sx:{position:"fixed",left:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:(0,o.jsx)(le.default,{sx:{fontSize:30}})}):null,!g&&x.length>1&&A<x.length-1?(0,o.jsx)(r.IconButton,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>P(e=>Math.min(e+1,x.length-1)),sx:{position:"fixed",right:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:(0,o.jsx)(se.default,{sx:{fontSize:30}})}):null,g&&x.length>1?(0,o.jsxs)(r.Box,{sx:{position:"fixed",bottom:18,left:"50%",transform:"translateX(-50%)",zIndex:10,display:"flex",alignItems:"center",gap:.5,px:1,py:.25,borderRadius:999,backgroundColor:"rgba(0, 0, 0, 0.45)"},children:[(0,o.jsx)(r.IconButton,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>P(e=>Math.max(e-1,0)),disabled:A<=0,sx:{color:"white","&.Mui-disabled":{color:"rgba(255,255,255,0.3)"}},children:(0,o.jsx)(le.default,{sx:{fontSize:28}})}),(0,o.jsxs)(r.Typography,{variant:"body2",sx:{color:"white",minWidth:44,textAlign:"center",userSelect:"none"},children:[A+1," / ",x.length]}),(0,o.jsx)(r.IconButton,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>P(e=>Math.min(e+1,x.length-1)),disabled:A>=x.length-1,sx:{color:"white","&.Mui-disabled":{color:"rgba(255,255,255,0.3)"}},children:(0,o.jsx)(se.default,{sx:{fontSize:28}})})]}):null,(0,o.jsx)(r.DialogContent,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:Cn()}),(0,o.jsx)(r.Snackbar,{open:!!kt,autoHideDuration:2e3,onClose:()=>ye(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:kt,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},So=ht;var ft=require("react/jsx-runtime");function de(a){return(0,ft.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#E91E63",...a,children:(0,ft.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 F=require("react/jsx-runtime");function ue(a){return(0,F.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#B45309",...a,children:[(0,F.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,F.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,F.jsx)("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),(0,F.jsx)("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),(0,F.jsx)("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),(0,F.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 Po=f(require("@mui/icons-material/TextSnippet"),1),Bo=f(require("@mui/icons-material/VideoFile"),1),Do=f(require("@mui/icons-material/AudioFile"),1),zo=f(require("@mui/icons-material/Description"),1),Ho=f(require("@mui/icons-material/InsertDriveFile"),1),Vo=f(require("@mui/icons-material/Code"),1),Ao=f(require("@mui/icons-material/TableView"),1);var S=require("react/jsx-runtime");function me(a,d=22){let u=`${d}px`,m={fontSize:d};switch(a){case"image":return(0,S.jsx)(G,{width:u,height:u});case"pdf":return(0,S.jsx)(K,{width:u,height:u});case"html":return(0,S.jsx)(de,{width:u,height:u});case"archive":return(0,S.jsx)(ue,{width:u,height:u});case"text":return(0,S.jsx)(Po.default,{sx:{...m,color:"#66BB6A"}});case"spreadsheet":return(0,S.jsx)(Ao.default,{sx:{...m,color:"#4CAF50"}});case"code":return(0,S.jsx)(Vo.default,{sx:{...m,color:"#2196F3"}});case"video":return(0,S.jsx)(Bo.default,{sx:{...m,color:"#AB47BC"}});case"audio":return(0,S.jsx)(Do.default,{sx:{...m,color:"#FF7043"}});case"office":return(0,S.jsx)(zo.default,{sx:{...m,color:"#FFA726"}});default:return(0,S.jsx)(Ho.default,{sx:{...m,color:"#78909C"}})}}var An=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function gt({fileName:a,mime:d,size:u=22}){let m=a.includes(".")?a.slice(a.lastIndexOf(".")+1).toLowerCase():"";return An.has(m)?me("archive",u):me(M(a,d??""),u)}
|
|
58
|
+
`,s.appendChild(c)}}})})]}):(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 l=r.currentTarget;eo(r,l)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:(0,o.jsx)("video",{src:T,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${I}) rotate(${X}deg)`,transition:"transform 0.3s ease",pointerEvents:I>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:[We.length>0||It?(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:[We.length>0&&(0,o.jsx)(n.Box,{sx:{minWidth:"max-content",minHeight:"max-content"},children:(0,o.jsx)(Ro.default,{data:We,darkMode:!1})}),It&&(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)(pt.LoadingProgress,{visible:Yo,exitDelay:200,fadeoutDuration:300,onComplete:ur})})]}):(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."})}),Mt.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:_o,onChange:(r,l)=>mr(l),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:Mt.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:p.name}),(0,o.jsx)("audio",{src:T,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:a,onClose:oo,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:x?1:3},onContextMenu:e=>e.preventDefault(),children:[(0,o.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:te?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:x?"1.7rem":void 0}},children:[b.length>1?(0,o.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:x?0:.5},children:[(0,o.jsx)(n.Tooltip,{title:"\uC774\uC804 \uD30C\uC77C",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(n.IconButton,{onClick:()=>V(e=>Math.max(e-1,0)),disabled:q<=0,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:(0,o.jsx)(De.default,{})})})}),(0,o.jsxs)(n.Typography,{variant:"body2",sx:{color:"grey.300",minWidth:40,textAlign:"center",userSelect:"none"},children:[q+1," / ",b.length]}),(0,o.jsx)(n.Tooltip,{title:"\uB2E4\uC74C \uD30C\uC77C",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(n.IconButton,{onClick:()=>V(e=>Math.min(e+1,b.length-1)),disabled:q>=b.length-1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:(0,o.jsx)(Be.default,{})})})})]}):null,x&&v==="pdf"&&E?(0,o.jsx)(n.Tooltip,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:(0,o.jsx)(n.IconButton,{onClick:()=>Oe(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,o.jsx)(vo.default,{})})}):null,v==="pdf"&&E?(0,o.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:x?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:ve,disabled:F<=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)(De.default,{})})})}),(0,o.jsx)(n.Typography,{variant:"body2",sx:{minWidth:x?"auto":"80px",textAlign:"center",color:"white",px:x?.5:1,fontSize:x?"1.05rem":void 0,fontWeight:x?600:void 0,whiteSpace:"nowrap"},children:te?F:`${F} / ${E}`}),(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:we,disabled:F>=E,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)(Be.default,{})})})})]}):null]}),(0,o.jsx)(n.Box,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:te?0:2,overflow:"hidden"},children:!te&&(0,o.jsxs)(n.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Hr(v),p.name]})}),(0,o.jsxs)(n.Box,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:te?.35:1,"& .MuiSvgIcon-root":{fontSize:x?"1.7rem":void 0}},children:[(v==="image"||v==="pdf"||v==="text"||v==="html"||v==="code"||v==="spreadsheet")&&(0,o.jsxs)(o.Fragment,{children:[!(x&&(v==="image"||v==="pdf"))&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.Tooltip,{title:"\uD655\uB300",children:(0,o.jsx)(n.IconButton,{onClick:Jo,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)(Mo.default,{})})}),(0,o.jsx)(n.Tooltip,{title:"\uCD95\uC18C",children:(0,o.jsx)(n.IconButton,{onClick:er,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)(Co.default,{})})})]}),!x&&(0,o.jsx)(n.Tooltip,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:(0,o.jsx)(n.IconButton,{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:(0,o.jsx)(dt.default,{})})}),!x&&(v==="image"||v==="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: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,o.jsx)(st.default,{})})}),(0,o.jsx)(n.Tooltip,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,o.jsx)(n.IconButton,{onClick:Qt,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)(ct.default,{})})})]})]}),!x&&(0,o.jsx)(n.Tooltip,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:(0,o.jsx)(n.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,o.jsx)(lt.default,{})})}),x&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.Tooltip,{title:"\uB354\uBCF4\uAE30",children:(0,o.jsx)(n.IconButton,{onClick:e=>Z(e.currentTarget),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,o.jsx)(wo.default,{})})}),(0,o.jsxs)(n.Menu,{anchorEl:Et,open:!!Et,onClose:()=>Z(null),children:[v==="image"||v==="pdf"?(0,o.jsxs)(n.MenuItem,{onClick:()=>{Jt(),Z(null)},children:[(0,o.jsx)(n.ListItemIcon,{children:(0,o.jsx)(dt.default,{fontSize:"small"})}),(0,o.jsx)(n.ListItemText,{children:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30"})]}):null,v==="image"||v==="pdf"?(0,o.jsxs)(n.MenuItem,{onClick:()=>{Zt(),Z(null)},children:[(0,o.jsx)(n.ListItemIcon,{children:(0,o.jsx)(st.default,{fontSize:"small"})}),(0,o.jsx)(n.ListItemText,{children:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,v==="image"||v==="pdf"?(0,o.jsxs)(n.MenuItem,{onClick:()=>{Qt(),Z(null)},children:[(0,o.jsx)(n.ListItemIcon,{children:(0,o.jsx)(ct.default,{fontSize:"small"})}),(0,o.jsx)(n.ListItemText,{children:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804"})]}):null,(0,o.jsxs)(n.MenuItem,{onClick:()=>{Vt(),Z(null)},children:[(0,o.jsx)(n.ListItemIcon,{children:(0,o.jsx)(lt.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:oo,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)(bo.default,{})})})]})]}),!x&&b.length>1&&q>0?(0,o.jsx)(n.IconButton,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>V(e=>Math.max(e-1,0)),sx:{position:"fixed",left:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:(0,o.jsx)(De.default,{sx:{fontSize:30}})}):null,!x&&b.length>1&&q<b.length-1?(0,o.jsx)(n.IconButton,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>V(e=>Math.min(e+1,b.length-1)),sx:{position:"fixed",right:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:(0,o.jsx)(Be.default,{sx:{fontSize:30}})}):null,(0,o.jsx)(n.DialogContent,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:Mr()}),(0,o.jsx)(n.Snackbar,{open:!!kt,autoHideDuration:2e3,onClose:()=>ge(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:kt,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},Po=ht;var ft=require("react/jsx-runtime");function se(a){return(0,ft.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#E91E63",...a,children:(0,ft.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 R=require("react/jsx-runtime");function ce(a){return(0,R.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#B45309",...a,children:[(0,R.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,R.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,R.jsx)("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),(0,R.jsx)("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),(0,R.jsx)("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),(0,R.jsx)("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),(0,R.jsx)("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),(0,R.jsx)("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),(0,R.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 So=f(require("@mui/icons-material/TextSnippet"),1),Do=f(require("@mui/icons-material/VideoFile"),1),Bo=f(require("@mui/icons-material/AudioFile"),1),zo=f(require("@mui/icons-material/Description"),1),Ho=f(require("@mui/icons-material/InsertDriveFile"),1),Vo=f(require("@mui/icons-material/Code"),1),Ao=f(require("@mui/icons-material/TableView"),1);var P=require("react/jsx-runtime");function de(a,d=22){let u=`${d}px`,m={fontSize:d};switch(a){case"image":return(0,P.jsx)($,{width:u,height:u});case"pdf":return(0,P.jsx)(G,{width:u,height:u});case"html":return(0,P.jsx)(se,{width:u,height:u});case"archive":return(0,P.jsx)(ce,{width:u,height:u});case"text":return(0,P.jsx)(So.default,{sx:{...m,color:"#66BB6A"}});case"spreadsheet":return(0,P.jsx)(Ao.default,{sx:{...m,color:"#4CAF50"}});case"code":return(0,P.jsx)(Vo.default,{sx:{...m,color:"#2196F3"}});case"video":return(0,P.jsx)(Do.default,{sx:{...m,color:"#AB47BC"}});case"audio":return(0,P.jsx)(Bo.default,{sx:{...m,color:"#FF7043"}});case"office":return(0,P.jsx)(zo.default,{sx:{...m,color:"#FFA726"}});default:return(0,P.jsx)(Ho.default,{sx:{...m,color:"#78909C"}})}}var Vr=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function gt({fileName:a,mime:d,size:u=22}){let m=a.includes(".")?a.slice(a.lastIndexOf(".")+1).toLowerCase():"";return Vr.has(m)?de("archive",u):de(M(a,d??""),u)}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ehfuse/file-viewer",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React 파일 미리보기 다이얼로그 (이미지/PDF/텍스트/코드/HTML/스프레드시트/비디오/오디오, MUI 기반)",
|
|
6
6
|
"publishConfig": {
|
|
7
|
-
"access": "
|
|
7
|
+
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"author": "KIM YOUNG JIN <ehfuse@gmail.com>",
|
|
10
10
|
"license": "MIT",
|