import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./got-BBDj7u1e.mjs";import{t as r}from"./timezone-keeL11Io.mjs";import{load as i}from"cheerio";import{CookieJar as a}from"tough-cookie";import o from"p-map";const s=`https://oas.gdut.edu.cn/seeyon`,c={department:{id:`-288156881891407086`,name:`部处简讯`},academy:{id:`-6133000885854714423`,name:`学院简讯`},notice:{id:`2945931106835317958`,name:`校内通知`},announcement:{id:`906433874899913754`,name:`公示公告`},tender_result:{id:`-1226046021292568614`,name:`招标结果`},tender_invite:{id:`-3656117696093796045`,name:`招标公告`}};function l(e){return JSON.stringify([{page:1,size:50},{subject:``,departmentName:``,newsType:e?e.id:``,startDate:``,endDate:``,canLogin:`true`}])}const u={path:`/oa_news/:type?`,categories:[`university`],example:`/gdut/oa_news/notice`,parameters:{type:`通知类型，留空则获取所有分类`},feature:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`oas.gdut.edu.cn/seeyon`],target:`/oa_news/`}],name:`通知公文网`,maintainers:[`jim-kirisame`,`GamerNoTitle`,`Richard-Zheng`],handler:d,url:`oas.gdut.edu.cn/seeyon`,description:`学校可能会因为 IP 来源非学校而做出一定的限制，建议在校内网络环境下使用 RSS 阅读器订阅。

| 类型 | 参数 | 可能需要校内访问 |
| ---- | ---- | ---------------- |
| 部处简讯 | department | 是 |
| 学院简讯 | academy | 是 |
| 校内通知 | notice | 是 |
| 公示公告 | announcement | 是 |
| 招标结果 | tender_result | 否 |
| 招标公告 | tender_invite | 否 |
`};async function d(u){let d=u.req.param(`type`)??`notice`;if(c[d]===void 0)throw Error(`通知类型`+d+`未定义`);let f=c[d],p=new a;await n(s+`/ggIP.do?method=portalSeachMore&subject=&departmentName=&newsType=&startDate=&endDate=`,{cookieJar:p});let m=await n.post(s+`/ajax.do?method=ajaxAction&managerName=ggManager&rnd=1`,{cookieJar:p,form:{managerMethod:`kkFindListDatas`,arguments:l(f)}});if(!m.data.data)throw Error(`文章列表获取失败，可能是被临时限制了访问，请稍后重试
`+JSON.stringify(m.data));let h=await o(m.data.data.map(e=>({title:e.title,guid:e.id,link:s+`/newsData.do?method=newsView&newsId=`+e.id,pubDate:r(t(e.publishDate),8),author:e.publishUserDepart,category:e.typeName})),async t=>{let r=t.link;return t.description=await e.tryGet(r,async()=>{let e=i((await n(r,{cookieJar:p})).data),t=e(`#content`);return t.find(`*`).filter(function(){return this.type===`comment`||this.tagName===`meta`||this.tagName===`style`}).remove(),t.find(`*`).contents().filter(function(){return this.type===`comment`||this.tagName===`meta`||this.tagName===`style`}).remove(),t.find(`*`).each(function(){if(this.attribs.style!==void 0){let e=this.attribs.style.split(`;`).filter(e=>{let t=[`color:rgb(0,0,0)`,`color:black`,`background:rgb(255,255,255)`,`background:white`,`text-align:left`,`text-align:justify`,`font-style:normal`,`font-weight:normal`],n=[`font-family`,`font-size`,`background`,`text-autospace`,`text-transform`,`letter-spacing`,`line-height`,`padding`,`margin`,`text-justify`,`word-break`,`vertical-align`,`mso-`,`-ms-`],r=e.trim();if(t.includes(r.replaceAll(/\s+/g,``)))return!1;for(let e of n)if(r.startsWith(e))return!1;return!0}).join(`;`);e?this.attribs.style=e:delete this.attribs.style}this.attribs.class&&this.attribs.class.trim().startsWith(`Mso`)&&delete this.attribs.class,this.attribs.lang&&delete this.attribs.lang,(this.tagName===`font`||this.tagName===`o:p`)&&e(this).replaceWith(this.childNodes),this.tagName===`span`&&!this.attribs.style&&e(this).replaceWith(this.childNodes)}),t.find(`span`).each(function(){this.childNodes.length===0&&e(this).remove()}),t.html()}),t},{concurrency:2});return{title:`广东工业大学通知公文网 - `+f.name,link:s,description:`广东工业大学通知公文网`,item:h}}export{u as route};