import{H as G,T as W,M as V}from"./components.cc67b643.js";import{r as c,o as u,c as x,a as s,b as e,d as E,W as U,A as m,F as _,g as d,h as K,s as Z,S as R,Q as O,P as $,i as j,j as X,k as J,l as ee,m as te,n as oe,w as B,p as A,q as ne,L as se,e as ae,t as ie,B as re,v as le,x as ce}from"./entry.3193a679.js";import{c as ue,p as me}from"./convertTime.e25903f5.js";import{a as r}from"./api.804dcc26.js";import{_ as _e,P as de}from"./Pagination.9f404252.js";import{P as pe}from"./PostItem.305460da.js";import{i as ge}from"./v-lazy-image.64d797d1.js";import{u as he,c as ve}from"./commentapi.c5bf6183.js";import{u as ye}from"./navigation.d318acec.js";const fe={class:"p-[10px]"},we={class:"flex h-[200px] gradient-bg"},xe={class:"flex-1"},Ee={class:"flex-1 flex flex-col mx-auto items-center space-y-8 h-screen mt-[36px]"},Ie={__name:"AdLink",setup(F){const p=c("/fzh/freedom.svg"),I=async g=>{await r.insertUserDurationActionData({action_type:m.CLICK_AD_LINK,web_type:g,user_id_key:localStorage.getItem(_),session_id_key:sessionStorage.getItem(d)})};return(g,h)=>(u(),x("section",fe,[s("div",we,[s("div",xe,[e(E(ge),{src:p.value,alt:"SVG Image",class:"mx-auto mt-[20px] h-[260px] w-[300px]"},null,8,["src"])]),s("div",Ee,[s("a",{target:"_blank",crossorigin:"",onClick:h[0]||(h[0]=v=>I(E(U).FREE_WEIBO)),href:"https://freeweibo.com",class:"self-center px-8 w640:px-16 py-2 text-white italic font-medium text-2xl tracking-wide rounded-3xl shadow-lg bg-green-500 transition-all hover:shadow-none hover:rounded-xl",style:{color:"white"}}," 自由微博 "),s("a",{target:"_blank",crossorigin:"",onClick:h[1]||(h[1]=v=>I(E(U).FREE_WECHAT)),href:"https://freewechat.com",class:"self-center px-8 w640:px-16 py-2 text-white italic font-medium text-2xl tracking-wide rounded-3xl shadow-lg bg-blue-500 transition-all hover:shadow-none hover:rounded-xl",style:{color:"white"}}," 自由微信 ")])])]))}},ke=Ie,Le=s("link",{rel:"canonical",href:"/fzh/"},null,-1),De={key:0,class:"flex w-screen h-screen overflow-hidden mx-auto text-center text-p-2 font-bold w641:text-2xl w769:text-3xl"},Ce={class:"flex-auto self-center"},Se=s("p",{class:"mt-8"},"数据加载中，请稍候...",-1),Te={key:1},Ae={class:"flex justify-center gap-12 w1280:gap-16 mb-20 mt-12 w640:mt-20"},be={class:"overflow-x-hidden bg-white shadow mx-0 w641:rounded-t-lg"},Ne={class:"pt-4"},Pe={class:"block w-full h-auto overflow-hidden divide-y divide-gray-200"},b="首页 - 自由知乎",Qe={__name:"index",setup(F){const p=K(),I=he(),{globalQuery:g}=Z(I),h=ye();ue(I,me,p);const v=c(new Date),i=c(!1),y=c(g.value.index.sortby==="censored_time_or_answer_censored_updated"?R.RECENT:g.value.index.sortby==="score"?R.POPULAR:0),C=c([]),N=g.value[O[$.INDEX]],f=p.query.page?Number(p.query.page):1,P=c([]),a=c({questionList:[],total:0}),q=async()=>{try{const o=await r.getAllQuestions(N);let k=o.data.data,l=o.data.total;a.value.questionList=k,a.value.total=l}catch(o){console.log(o)}},H=async()=>{var t,w;const o=a.value.questionList.map(L=>L.id),l=(w=(t=(await ve.getCommentCountListByQuestion({questionIDList:o})).data)==null?void 0:t.data)==null?void 0:w.data;P.value=l};j(async()=>{a.value.questionList.length==0&&await q();const o=a.value.questionList.map(n=>n.id),k=Math.ceil(a.value.total/N.pagesize),l=o.map(n=>`/question/${n}`);h.setNavigationData(O[$.INDEX],{dataList:l,totalPageCount:k}),v.value=new Date,await H(),window.addEventListener("beforeunload",function(n){i.value||(r.insertUserDurationActionData({url:"/",sort_type:y.value,action_type:m.USER_DURATION_ACTION,user_id_key:localStorage.getItem(_),session_id_key:sessionStorage.getItem(d),page_num:f}),i.value=!0)}),document.addEventListener("visibilitychange",()=>{document.hidden&&(i.value||(r.insertUserDurationActionData({url:"/",duration:new Date().getTime()-v.value.getTime(),sort_type:y.value,action_type:m.USER_DURATION_ACTION,is_click_item:!1,user_id_key:localStorage.getItem(_),session_id_key:sessionStorage.getItem(d),page_num:f}),i.value=!0))});const t=(n,D)=>{n.forEach(S=>{if(S.isIntersecting){const Y=S.target.className,T=Number(Y.split("block block-")[1]);C.value.includes(T)||(C.value=[...C.value,T],r.insertUserDurationActionData({url:"/",sort_type:y.value,action_type:m.HOME_PAGE_CONTENT_VIEW,user_id_key:localStorage.getItem(_),session_id_key:sessionStorage.getItem(d),content_list:[`https://freezhihu.org/question/${a.value.questionList[T].id}`],page_num:f}))}})},w=new IntersectionObserver(t,{root:null,rootMargin:"0px",threshold:0});document.querySelectorAll("section.block").forEach(n=>{w.observe(n)})}),X(()=>{document.removeEventListener("visibilitychange",()=>{}),document.removeEventListener("beforeunload",()=>{})}),J(async()=>{i.value||(r.insertUserDurationActionData({url:"/",duration:new Date().getTime()-v.value.getTime(),sort_type:y.value,action_type:m.USER_DURATION_ACTION,is_click_item:!1,user_id_key:localStorage.getItem(_),session_id_key:sessionStorage.getItem(d),page_num:f}),i.value=!0)});const z=async o=>{i.value||(await r.insertUserDurationActionData({url:"/",duration:new Date().getTime()-v.value.getTime(),sort_type:y.value,action_type:m.USER_DURATION_ACTION,is_click_item:!0,user_id_key:localStorage.getItem(_),session_id_key:sessionStorage.getItem(d),page_num:f}),i.value=!0),await r.insertUserDurationActionData({url:`https://freezhihu.org/question/${o.id}`,sort_type:y.value,action_type:m.HOME_PAGE_CONTENT_CLICK,user_id_key:localStorage.getItem(_),session_id_key:sessionStorage.getItem(d),page_num:f})},M=()=>{a.value.questionList=[],q()};ee(o=>{});const Q=te(se,{style:{fontSize:"48px"},spin:!0});return(o,k)=>{const l=W,t=V,w=G,L=oe("a-spin");return u(),x(A,null,[e(w,null,{default:B(()=>[e(l,null,{default:B(()=>[ae(ie(b))]),_:1}),e(t,{property:"og:type",content:"website"}),e(t,{property:"og:url",content:`${E(re)}${E(p).path}`},null,8,["content"]),e(t,{property:"og:site_name",content:"freezhihu"}),e(t,{property:"og:image",itemprop:"image primaryImageOfPage",content:"https://freezhihu.com/zhihu.png"}),e(t,{name:"twitter:card",content:"summary"}),e(t,{name:"twitter:domain",content:"freezhihu.com"}),e(t,{name:"twitter:title",property:"og:title",itemprop:"name",content:b}),e(t,{name:"twitter:description",property:"og:description",itemprop:"name",content:b}),e(t,{name:"description",content:"问题被删，上自由知乎。我们致力于对抗网络审查。"}),e(t,{name:"keywords",content:"自由知乎, FreeZhihu, 问题被删，上自由知乎, GreatFire, 言论自由, 对抗网络审查, anti-censorship, 自由微博, FreeWeibo, 自由微信, FreeWeChat, 自由浏览, FreeBrowser, 自由新闻"}),e(t,{name:"author",content:"GreatFire.org"}),e(t,{name:"referrer",content:"same-origin"}),Le]),_:1}),a.value.questionList.length==0?(u(),x("div",De,[s("div",Ce,[e(L,{indicator:E(Q)},null,8,["indicator"]),Se])])):(u(),x("div",Te,[s("div",Ae,[s("main",be,[s("div",Ne,[e(_e)]),s("ul",Pe,[(u(!0),x(A,null,ne(a.value.questionList,(n,D)=>(u(),x(A,{key:n.id},[e(pe,{onClick:S=>z(n),item:{...n,index:D},commentCount:P.value[D]||0},null,8,["onClick","item","commentCount"]),D===2?(u(),le(ke,{key:0})):ce("",!0)],64))),128))])])])])),e(de,{total:a.value.total,onClickItem:M},null,8,["total"])],64)}}};export{Qe as default};
