/* FreeToolzHub — individual tool page. Mounts a REAL engine for working tools (PDF / Image / AI); shows a labelled DS demo flow otherwise. */ function fmtBytes(b){ return b<1024?b+' B':b<1048576?(b/1024).toFixed(1)+' KB':(b/1048576).toFixed(2)+' MB'; } function ToolPage({ go, toolId, pushToast }) { const { Card, Icon, Badge, Button, UploadDropzone, ProgressBar, Tag } = window.DesignSystem_3a7ab0; const { byId, TONE_MAP, TOOLS } = window.FTH; const tool = byId(toolId); const [bg, fg] = TONE_MAP[tool.tone]; const engineRef = React.useRef(null); // demo state (non-working tools) const [stage, setStage] = React.useState('idle'); const [progress, setProgress] = React.useState(0); const engineFor = (t) => { if (window.SimpleTools && window.SimpleTools.has(t.id)) return { mount: (ctx)=>window.SimpleTools.mount(t.id, ctx) }; if (window.AITools && window.AITools.REAL.has(t.id)) return window.AITools; if (window.PDFTools && window.PDFTools.REAL.has(t.id)) return window.PDFTools; if (window.ImageTools && window.ImageTools.REAL.has(t.id)) return window.ImageTools; return null; }; React.useEffect(() => { setStage('idle'); setProgress(0); const eng = engineFor(tool); if (eng && engineRef.current) { eng.mount({ want: tool.id, workspace: engineRef.current, toast: (m) => pushToast(m), fmtBytes, svg: window.svg, }); } }, [toolId]); const startDemo = () => { setStage('processing'); setProgress(0); let p = 0; const t = setInterval(() => { p += Math.random()*18 + 6; if (p >= 100) { p = 100; clearInterval(t); setTimeout(()=>setStage('done'), 350); } setProgress(p); }, 240); }; const isWorking = !!engineFor(tool); const related = TOOLS.filter(t => t.cat===tool.cat && t.id!==tool.id).slice(0,5); const relPool = related.length ? related : TOOLS.filter(t => t.id!==tool.id).slice(0,5); const steps = [ ['upload-cloud','Upload','Drop your file or pick it from your device.'], ['sliders-horizontal','Adjust','Set options and preview the result live.'], ['download','Download','Save your clean file — no watermark, no wait.'], ]; const benefits = [ ['shield-check','No watermark, ever','Your exports are clean and professional — nothing added.'], ['lock','Private by design','Files are processed in your browser and never uploaded.'], ['zap','Blazing fast','Optimized to finish in seconds, even with large files.'], ['infinity','Always free','No trials, no caps, no premium lock.'], ]; const faqs = [ [`Is ${tool.title} really free?`, `Yes — it's 100% free with no usage limits, no trial, and no premium upgrade.`], [`Will my file have a watermark?`, `No. Your output is completely clean — FreeToolzHub never adds a watermark.`], [`Do I need to sign up?`, `No account required. Just open the tool and start working.`], [`Are my files safe?`, isWorking && tool.cat!=='ai' ? `Your file is processed entirely in your browser and never leaves your device.` : `We process securely and never store your files.`], ]; return (
{tool.desc} Completely free, with no watermark and no sign-up.
Preview of the processing step.
This is a demo of the result step.
{s[2]}
{b[2]}