PageSourceSearch

https://downundervisa.com/assets/index-43SyHyIF.js

js downundervisa.com collected 2026-10-09 05:17:44 UTC 7,803 bytes, 3 lines download raw bytes

1import{aS as P,r as m,j as e,n as R,o as T}from"./main-Bo0oayNO.js";const A=R({method:"POST"}).handler(T("3ca39c6529c39c5dd978ec5cd466db6c7c8d526d7ba72ca600ba8225979cc255"));function M(){const{stats:a}=P.useLoaderData(),[r,x]=m.useState(["posts","pages","categories","tags"]),[t,b]=m.useState("json"),[p,j]=m.useState(!1),[y,h]=m.useState(null),f=[{id:"posts",label:"Posts",count:a.posts,icon:"📝"},{id:"pages",label:"Pages",count:a.pages,icon:"📄"},{id:"categories",label:"Categories",count:a.categories,icon:"📁"},{id:"tags",label:"Tags",count:a.tags,icon:"🏷️"},{id:"users",label:"Users",count:a.users,icon:"👥"},{id:"media",label:"Media (metadata)",count:a.media,icon:"🖼️"},{id:"settings",label:"Settings",count:a.settings,icon:"⚙️"}],k=s=>{x(l=>l.includes(s)?l.filter(n=>n!==s):[...l,s])},S=()=>{x(f.map(s=>s.id))},C=()=>{x([])},E=async()=>{if(r.length===0){h("Please select at least one type to export");return}j(!0),h(null);try{const s=await A({data:{types:r,format:t}});let l,n,u;if(t==="json")l=JSON.stringify(s,null,2),n="application/json",u="json";else{const i=[];for(const N of r){const d=s[N];if(Array.isArray(d)&&d.length>0){const w=Object.keys(d[0]);i.push(`# ${N.toUpperCase()}`),i.push(w.join(","));for(const L of d){const O=w.map(D=>{const g=L[D];if(g==null)return"";const c=String(g);return c.includes(",")||c.includes(`
2`)||c.includes('"')?`"${c.replace(/"/g,'""')}"`:c});i.push(O.join(","))}i.push("")}}l=i.join(`
3`),n="text/csv",u="csv"}const $=new Blob([l],{type:n}),v=URL.createObjectURL($),o=document.createElement("a");o.href=v,o.download=`stackpress-export-${new Date().toISOString().split("T")[0]}.${u}`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(v)}catch(s){h(s instanceof Error?s.message:"Export failed")}finally{j(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Export Data"}),e.jsx("p",{className:"text-gray-600 mt-1",children:"Download your content and settings as JSON or CSV"})]}),y&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-red-700",children:y}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-medium text-gray-900",children:"Select Data to Export"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:S,className:"text-sm text-primary-600 hover:text-primary-700",children:"Select All"}),e.jsx("span",{className:"text-gray-300",children:"|"}),e.jsx("button",{onClick:C,className:"text-sm text-primary-600 hover:text-primary-700",children:"Select None"})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:f.map(s=>e.jsxs("label",{className:`flex items-center p-4 rounded-lg border-2 cursor-pointer transition-colors ${r.includes(s.id)?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("input",{type:"checkbox",checked:r.includes(s.id),onChange:()=>k(s.id),className:"sr-only"}),e.jsx("span",{className:"text-2xl mr-3",children:s.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900",children:s.label}),e.jsxs("div",{className:"text-sm text-gray-500",children:[s.count," items"]})]}),e.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center ${r.includes(s.id)?"border-primary-500 bg-primary-500":"border-gray-300"}`,children:r.includes(s.id)&&e.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]},s.id))})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[e.jsx("h2",{className:"text-lg font-medium text-gray-900 mb-4",children:"Export Format"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("label",{className:`flex-1 flex items-center p-4 rounded-lg border-2 cursor-pointer transition-colors ${t==="json"?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("input",{type:"radio",name:"format",value:"json",checked:t==="json",onChange:()=>b("json"),className:"sr-only"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900",children:"JSON"}),e.jsx("div",{className:"text-sm text-gray-500",children:"Full data with relationships, best for backups and re-importing"})]}),e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${t==="json"?"border-primary-500":"border-gray-300"}`,children:t==="json"&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-primary-500"})})]}),e.jsxs("label",{className:`flex-1 flex items-center p-4 rounded-lg border-2 cursor-pointer transition-colors ${t==="csv"?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("input",{type:"radio",name:"format",value:"csv",checked:t==="csv",onChange:()=>b("csv"),className:"sr-only"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900",children:"CSV"}),e.jsx("div",{className:"text-sm text-gray-500",children:"Spreadsheet compatible, good for analysis in Excel/Sheets"})]}),e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${t==="csv"?"border-primary-500":"border-gray-300"}`,children:t==="csv"&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-primary-500"})})]})]})]}),e.jsx("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-gray-900",children:[r.length," type",r.length!==1?"s":""," selected"]}),e.jsx("div",{className:"text-sm text-gray-500",children:r.length>
30?`Exporting: ${r.join(", ")}`:"Select at least one type to export"})]}),e.jsx("button",{onClick:E,disabled:p||r.length===0,className:`px-6 py-3 rounded-lg font-medium text-white transition-colors ${p||r.length===0?"bg-gray-400 cursor-not-allowed":"bg-primary-600 hover:bg-primary-700"}`,children:p?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Exporting..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download Export"]})})]})}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[e.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Export Information"}),e.jsxs("ul",{className:"text-sm text-blue-800 space-y-1",children:[e.jsx("li",{children:"• JSON format preserves all data relationships and is recommended for backups"}),e.jsx("li",{children:"• CSV format is useful for viewing data in spreadsheet applications"}),e.jsx("li",{children:"• Media export includes metadata only, not the actual files"}),e.jsx("li",{children:"• Sensitive data like passwords and API keys are excluded from exports"}),e.jsx("li",{children:"• Large exports may take a few moments to generate"})]})]})]})}export{M as component};

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.