import{a as e}from"./db-Cn_z-BCk.js";import{t}from"./csv-BkYNeWrG.js";var n=e=>String(e).padStart(2,`0`),r=()=>{let e=new Date;return`${e.getFullYear()}${n(e.getMonth()+1)}${n(e.getDate())}`},i=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)},a=e=>[String(e?.url||``).trim(),String(e?.detail_url||``).trim()].find(e=>/^https?:\/\//i.test(e))||``,o=async n=>{let o=await e();if(!o.length)throw Error(`暂无可导出数据`);let s=t(o.map(e=>{let t=String(e.salary?.text||``);return{title:String(e?.title||``),company:String(e?.company||``),platform:String(e?.platform||``),url:a(e),location:String(e?.city_name||e?.location||e?.province_name||``),salary_text:t,experience:String(e?.experience||``),education:String(e?.education||``),description:String(e?.description||``)}}),[`title`,`company`,`platform`,`url`,`location`,`salary_text`,`experience`,`education`,`description`],{title:`岗位名称`,company:`公司`,platform:`平台`,url:`职位链接`,location:`地点`,salary_text:`薪资`,experience:`经验`,education:`学历`,description:`职位描述`}),c=n?.fileName,l=c&&String(c).trim()?c.replace(/\.xlsx$/i,`.csv`):`岗位数据_${r()}.csv`;i(new Blob([s],{type:`text/csv;charset=utf-8`}),l)};export{o as exportAllJobsXlsx};