1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7454],{31166:(e,t,r)=>{r.d(t,{Ay:()=>h,S8:()=>d,oK:()=>u,t0:()=>o,tV:()=>c});var n=r(95155),a=r(12115);let s={primary:"bg-accent text-white shadow-cta hover:bg-accent-hover hover:shadow-cta-hover",secondary:"bg-white text-warm-600 border border-warm-200 shadow-card hover:border-accent hover:text-accent-deep hover:bg-accent-sub",ghost:"text-warm-600 hover:bg-warm-50",danger:"bg-red-500 text-white hover:bg-red-600"},l={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},i=(0,a.forwardRef)(function(e,t){let{variant:r="primary",size:a="md",loading:i=!1,disabled:o,className:c="",children:d,...u}=e;return(0,n.jsxs)("button",{ref:t,disabled:o||i,className:["rounded-md font-semibold transition-all duration-200 active:scale-95 disabled:opacity-50 disabled:pointer-events-none inline-flex items-center justify-center gap-2",s[r],l[a],c].join(" "),...u,children:[i&&(0,n.jsxs)("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",className:"animate-spin","aria-hidden":"true",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeOpacity:"0.3"}),(0,n.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),d]})}),o="inline-flex items-center justify-center gap-2 min-h-[44px] px-5 rounded-xl bg-accent text-white text-sm font-bold whitespace-nowrap shadow-cta transition-all duration-200 hover:bg-accent-hover hover:shadow-cta-hover active:scale-95 disabled:opacity-50 disabled:shadow-none disabled:cursor-not-allowed disabled:hover:bg-accent",c="inline-flex items-center justify-center gap-1 min-h-[36px] px-2.5 rounded-lg bg-accent-sub text-accent-deep text-xs font-semibold whitespace-nowrap border border-accent/25 transition hover:bg-accent hover:text-white",d="inline-flex items-center justify-center gap-2 min-h-[44px] px-5 rounded-xl bg-accent-sub text-accent-deep text-sm font-semibold whitespace-nowrap border border-accent/25 transition hover:bg-accent-tint disabled:opacity-40 disabled:cursor-not-allowed",u="inline-flex shrink-0 items-center gap-1.5 rounded-full px-4 py-1.5 bg-accent text-white text-xs font-bold shadow-cta transition hover:bg-accent-hover hover:shadow-cta-hover disabled:opacity-50 disabled:shadow-none",h=i},67454:(e,t,r)=>{r.r(t),r.d(t,{default:()=>w});var n=r(95155),a=r(94801),s=r(12115),l=r(92531),i=r(46339),o=r(31166);let c=0,d=()=>`hwp-${Date.now()}-${c++}`;class u extends Error{}let h=null;async function p(){return h||(h=(h=(async()=>{let e=null,t="";globalThis.measureTextWidth=(r,n)=>(e||(e=document.createElement("canvas").getContext("2d")),e&&r!==t&&(e.font=r,t=r),e?.measureText(n).width??0);try{let e=await Promise.all([r.e(8696),r.e(9074)]).then(r.bind(r,42389));return await e.default({module_or_path:"/rhwp_bg.wasm"}),{HwpDocument:e.HwpDocument,HwpViewer:e.HwpViewer}}catch{throw new u("ë³í íë¡ê·¸ë¨ì ë´ë ¤ë°ì§ 못íìµëë¤. ì¸í°ë· ì°ê²°ì íì¸íê³ ë¤ì ëë¬ ì£¼ì¸ì â íì¼ ë¬¸ì ê° ìëëë¤.")}})()).catch(e=>{throw h=null,e})),h}async function x(e){let t=e.match(/<svg[^>]*>/i)?.[0]??"",r=e=>{let r=t.match(e);return r?parseFloat(r[1]):0},n=r(/\bwidth="([\d.]+)/),a=r(/\bheight="([\d.]+)/);if(!(n>0&&a>0)){let e=t.match(/viewBox="([\d.\s]+)"/)?.[1]?.trim().split(/\s+/).map(Number);e&&4===e.length&&(n=e[2],a=e[3])}n>0&&a>0||(n=794,a=1123);let s=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"}));try{let e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=()=>r(Error("svg render failed")),e.src=s});let t=document.createElement("canvas");t.width=Math.max(1,Math.round(2*n)),t.height=Math.max(1,Math.round(2*a));let r=t.getContext("2d");if(!r)throw Error("canvas 2d context ìì");return r.fillStyle="#ffffff",r.fillRect(0,0,t.width,t.height),r.drawImage(e,0,0,t.width,t.height),{png:t.toDataURL("image/png"),wPt:n/96*72,hPt:a/96*72}}finally{URL.revokeObjectURL(s)}}async function m(e,t,n){let[a,{HwpDocument:s,HwpViewer:l},{PDFDocument:i}]=await Promise.all([e.arrayBuffer().then(e=>new Uint8Array(e)),p(),Promise.all([r.e(2970),r.e(1544)]).then(r.bind(r,11544))]),o=new l(new s(a));try{let e=o.pageCount();if(0===e)throw new u("문ììì ì½ì ë´ì©ì ì°¾ì§ ëª»íìµëë¤. ë¹ ë¬¸ìì´ê±°ë ì´ ëêµ¬ê° ìì§ í´ìíì§ ëª»íë íìì¼ ì ìì´ì. íê¸ìì ë¤ì ì ì¥í´ ì¬ë ¤ì£¼ì¸ì.");if(e>200)throw new u(`íì´ì§ê° ë무 ë§ìµëë¤(ì½ ${e}ì¥, ìµë 200ì¥). 문ì를 ëë ì ë³íí´ ì£¼ì¸ì.`);t(e);let r=await i.create();for(let t=0;t<e;t++){let a=o.renderPageSvg(t),{png:s,wPt:l,hPt:i}=await x(a),c=await r.embedPng(s);r.addPage([l,i]).drawImage(c,{x:0,y:0,width:l,height:i}),n((t+1)/e)}let a=await r.save();return{blob:new Blob([a],{type:"application/pdf"}),pageCount:e}}finally{try{o.free?.()}catch{}}}
1function w(){let[e,t]=(0,s.useState)([]),[c,h]=(0,s.useState)(null),p=(0,s.useRef)(new Map),x=(0,s.useRef)([]),w=(0,s.useRef)(!1),g=(0,s.useCallback)((e,r)=>{t(t=>t.map(t=>t.id===e?{...t,...r}:t))},[]);(0,s.useEffect)(()=>()=>{t(e=>(e.forEach(e=>{e.resultUrl&&URL.revokeObjectURL(e.resultUrl)}),e))},[]);let f=(0,s.useCallback)(async()=>{if(!w.current){w.current=!0;try{for(;x.current.length>0;){let e=x.current.shift(),t=p.current.get(e);if(!t)continue;let r=t.name.split(".").pop()?.toLowerCase()??"hwp";g(e,{status:"processing",progress:0,pageCount:null,error:null});try{let{blob:r,pageCount:n}=await m(t,t=>g(e,{pageCount:t}),t=>g(e,{progress:t})),s=URL.createObjectURL(r),l=`${t.name.replace(/\.hwpx?$/i,"")}.pdf`;g(e,{status:"done",progress:1,pageCount:n,resultUrl:s,resultName:l}),(0,a.sx)("hwp_to_pdf_converted",{page_count:n,file_size:t.size})}catch(t){g(e,{status:"error",error:function(e,t){if(e instanceof u)return e.message;let r=(e instanceof Error?e.message:String(e??"")).toLowerCase();return r.includes("offset")||r.includes("bounds")||r.includes("dataview")||r.includes("range")||r.includes("unexpected end")||r.includes("eof")?"íì¼ì´ ììëìê±°ë ìì í ì ì¥ëì§ ìì ê² ê°ìµëë¤. íê¸ìì íì¼ì ì´ì´ ë¤ì ì ì¥í ë¤ ì¬ë ¤ì£¼ì¸ì.":r.includes("password")||r.includes("encrypt")||r.includes("ìí¸")?"ìí¸ê° 걸린 문ìë ë³íí ì ììµëë¤. íê¸ìì ìí¸ë¥¼ í´ì íê³ ë¤ì ì ì¥í´ ì¬ë ¤ì£¼ì¸ì.":r.includes("zip")||r.includes("invalid")||r.includes("signature")||r.includes("magic")||r.includes("not a")?"hwpx"===t?'ì´ hwpx 문ì를 ì½ì§ 못íìµëë¤. íê¸ìì "ë¤ë¥¸ ì´ë¦ì¼ë¡ ì ì¥ â íê¸ ë¬¸ì(.hwp)"ë¡ ë°ê¿ ì¬ë¦¬ë©´ ë³íë ì ììµëë¤.':"íê¸(.hwp) 문ìë¡ ì¸ìëì§ ììµëë¤. íì¼ì´ ì¬ë°ë¥¸ì§ íì¸íê³ ë¤ì ì¬ë ¤ì£¼ì¸ì.":"문ì를 PDFë¡ ë³ííì§ ëª»íìµëë¤. íê¸ìì íì¼ì ë¤ì ì ì¥íê±°ë, íì»´ìì ì§ì PDFë¡ ë´ë³´ë´ ì¬ì©í´ 주ì¸ì."}(t,r)}),(0,a.sx)("hwp_to_pdf_error")}finally{p.current.delete(e)}}}finally{w.current=!1}}},[g]),b=(0,s.useCallback)(r=>{let n=e.length,s=[],l=20-n;for(let e of r){if(l<=0)break;let t=e.name.split(".").pop()?.toLowerCase(),r=d(),n=e.name.replace(/\.[^.]+$/,"");if("hwp"!==t&&"hwpx"!==t){s.push({id:r,name:e.name,baseName:n,status:"error",pageCount:null,progress:0,resultUrl:null,resultName:null,error:"íê¸ ë¬¸ì(.hwp ëë .hwpx)ë§ ë³íí ì ììµëë¤."}),l--;continue}if(e.size>0x1400000){s.push({id:r,name:e.name,baseName:n,status:"error",pageCount:null,progress:0,resultUrl:null,resultName:null,error:`íì¼ì´ ë무 í½ëë¤(ê°ë¹ ìµë 20MB).`}),l--;continue}p.current.set(r,e),x.current.push(r),s.push({id:r,name:e.name,baseName:n,status:"queued",pageCount:null,progress:0,resultUrl:null,resultName:null,error:null}),l--}h(r.length>s.length?`문ìë ìµë 20ê°ê¹ì§ ë´ì ì ìì´ì. ëë ${r.length-s.length}ê°ë ì ì¸íìµëë¤.`:null),0!==s.length&&((0,a.sx)("hwp_to_pdf_files_added",{file_count:s.length}),t(e=>[...e,...s]),f())},[e.length,f]),v=(0,s.useCallback)(e=>{x.current=x.current.filter(t=>t!==e),p.current.delete(e),t(t=>{let r=t.find(t=>t.id===e);return r?.resultUrl&&URL.revokeObjectURL(r.resultUrl),t.filter(t=>t.id!==e)})},[]),y=(0,s.useCallback)(()=>{x.current=[],p.current.clear(),t(e=>(e.forEach(e=>{e.resultUrl&&URL.revokeObjectURL(e.resultUrl)}),[]))},[]),j=(0,s.useRef)(null),k=(0,s.useCallback)(async()=>{let t=e.filter(e=>"done"===e.status&&e.resultUrl&&e.resultName);if(0===t.length)return;let{default:n}=await Promise.all([r.e(5376),r.e(7496)]).then(r.t.bind(r,7496,23)),s=new n;await Promise.all(t.map(async e=>{let t=await fetch(e.resultUrl);s.file(e.resultName,await t.blob())}));let l=URL.createObjectURL(await s.generateAsync({type:"blob"}));Object.assign(document.createElement("a"),{href:l,download:"hwp-to-pdf.zip"}).click(),URL.revokeObjectURL(l),(0,a.sx)("hwp_to_pdf_zip_download",{file_count:t.length})},[e]),N=e.length>0,C=e.filter(e=>"done"===e.status).length,U=e.length>=20;return(0,n.jsxs)("div",{className:"space-y-4",children:[N?(0,n.jsxs)("div",{className:"rounded-2xl border border-warm-200 bg-white p-4 space-y-3",children:[c&&(0,n.jsx)("p",{className:"text-sm text-red-500",children:c}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("button",{onClick:()=>j.current?.click(),disabled:U,className:"px-3 py-1.5 text-xs rounded-lg border border-warm-200 text-warm-600 hover:bg-warm-50 transition disabled:opacity-40 disabled:cursor-not-allowed",children:"+ íì¼ ì¶ê°"}),(0,n.jsx)("span",{className:"text-warm-200 text-sm select-none",children:"|"}),(0,n.jsx)("button",{onClick:y,className:"px-3 py-1.5 text-xs rounded-lg border border-red-200 text-red-500 hover:bg-red-50 hover:border-red-300 transition",children:"ì ì²´ ìì "})]}),(0,n.jsx)("ul",{className:"space-y-2 max-h-[440px] overflow-y-auto",children:e.map(e=>(0,n.jsxs)("li",{className:"rounded-xl border border-warm-200 px-3.5 py-3 flex items-center gap-3",children:[(0,n.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:"error"===e.status?"text-red-400 shrink-0":"text-accent shrink-0","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,n.jsx)("polyline",{points:"14 2 14 8 20 8"})]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"text-sm text-warm-800 truncate",children:e.name}),"processing"===e.status&&(0,n.jsxs)("div",{className:"mt-1.5",children:[(0,n.jsx)("div",{className:"h-1.5 rounded-full bg-warm-100 overflow-hidden shadow-inner",children:(0,n.jsx)("div",{className:`h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none ${null==e.pageCount?"motion-safe:animate-pulse":""}`,style:{width:null==e.pageCount?"40%":`${Math.round(100*e.progress)}%`}})}),(0,n.jsx)("p",{className:"mt-1 text-xs text-warm-500",children:null==e.pageCount?"문ì ë¶ì ì¤â¦":`PDF ë³í ì¤â¦ ${Math.round(e.progress*e.page
1Count)}/${e.pageCount}쪽`})]}),"queued"===e.status&&(0,n.jsx)("p",{className:"mt-1 text-xs text-warm-400",children:"ë기 ì¤â¦"}),"error"===e.status&&e.error&&(0,n.jsx)("p",{className:"mt-1 text-xs text-red-500",children:e.error})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:["done"===e.status&&(0,n.jsx)("button",{onClick:()=>{e.resultUrl&&e.resultName&&(Object.assign(document.createElement("a"),{href:e.resultUrl,download:e.resultName}).click(),(0,a.sx)("hwp_to_pdf_download"))},className:o.tV,children:"PDF ë¤ì´ë¡ë"}),(0,n.jsx)("button",{onClick:()=>v(e.id),"aria-label":"목ë¡ìì ì ê±°",className:"p-1.5 rounded-lg text-warm-400 hover:text-red-500 hover:bg-red-50 transition",children:(0,n.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,n.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]},e.id))}),C>=2&&(0,n.jsx)("div",{className:"flex justify-end pt-1",children:(0,n.jsxs)("button",{onClick:k,className:o.t0,children:[(0,n.jsx)(i.s3,{size:16,className:"shrink-0"}),"PDF ",C,"ê° ZIP ë¤ì´ë¡ë"]})})]}):(0,n.jsx)(l.A,{onFiles:b,accept:".hwp,.hwpx",multiple:!0,icon:(0,n.jsxs)("svg",{width:"52",height:"52",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,n.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,n.jsx)("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),(0,n.jsx)("line",{x1:"9",y1:"17",x2:"12",y2:"17"})]}),label:"HWP íì¼ ì í",hint:`HWP \xb7 HWPX \xb7 ìµë 20ê° \xb7 ê°ë¹ 20MB`}),(0,n.jsx)("input",{ref:j,type:"file",accept:".hwp,.hwpx",multiple:!0,className:"hidden","aria-hidden":"true",onChange:e=>{b(Array.from(e.target.files??[])),e.target.value=""}})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.