"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["recent-commits-graph"],{"./web_src/js/components/RepoRecentCommits.vue":(function(I,v,s){s.d(v,{default:function(){return R}});var e=s("./node_modules/.pnpm/@vue+runtime-core@3.5.21/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js"),l=s("./node_modules/.pnpm/@vue+shared@3.5.21/node_modules/@vue/shared/dist/shared.esm-bundler.js"),n=s("./node_modules/.pnpm/@vue+reactivity@3.5.21/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js"),m=s("./web_src/js/svg.ts"),a=s("./node_modules/.pnpm/chart.js@4.5.0/node_modules/chart.js/dist/chart.js"),p=s("./web_src/js/modules/fetch.ts"),h=s("./node_modules/.pnpm/vue-chartjs@5.3.2_chart.js@4.5.0_vue@3.5.21_typescript@5.9.2_/node_modules/vue-chartjs/dist/index.js"),c=s("./web_src/js/utils/time.ts"),u=s("./web_src/js/utils/color.ts"),j=s("./web_src/js/utils.ts"),K=s("./node_modules/.pnpm/chartjs-adapter-dayjs-4@1.0.4_chart.js@4.5.0_dayjs@1.11.18/node_modules/chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm.js");const y={class:"ui header tw-flex tw-items-center tw-justify-between"},f={class:"tw-flex ui segment main-graph"},g={key:0,class:"tw-m-auto"},b={key:0},_={key:1,class:"text red"};var w=(0,e.pM)({__name:"RepoRecentCommits",props:{locale:{}},setup(F){const{pageData:k}=window.config;a.t1.defaults.color=u.K.text,a.t1.defaults.borderColor=u.K.border,a.t1.register(a.UA,a.kc,a.E8,a.m_);const r=(0,n.IJ)(!1),d=(0,n.IJ)(""),C=k.repoLink,i=(0,n.KR)([]);(0,e.sV)(()=>{L()});async function L(){r.value=!0;try{let t;do t=await(0,p.fG)(`${C}/activity/recent-commits/data`),t.status===202&&await(0,j.yy)(1e3);while(t.status===202);if(t.ok){const o=await t.json(),T=Object.values(o)[0].week,A=(0,c.Z1)(new Date),X=(0,c.Ex)(T,A);i.value=(0,c.a$)(X,o).slice(-52),d.value=""}else d.value=t.statusText}catch(t){d.value=t.message}finally{r.value=!1}}function D(t){return{datasets:[{data:t.map(o=>({x:o.week,y:o.commits})),label:"Commits",backgroundColor:u.K.commits,borderWidth:0,tension:.3}]}}const E={responsive:!0,maintainAspectRatio:!1,scales:{x:{type:"time",grid:{display:!1},time:{minUnit:"week"},ticks:{maxRotation:0,maxTicksLimit:52}},y:{ticks:{maxTicksLimit:6}}}};return(t,o)=>((0,e.uX)(),(0,e.CE)("div",null,[(0,e.Lk)("div",y,(0,l.v_)(r.value?t.locale.loadingTitle:d.value?t.locale.loadingTitleFailed:"Number of commits in the past year"),1),(0,e.Lk)("div",f,[r.value||d.value!==""?((0,e.uX)(),(0,e.CE)("div",g,[r.value?((0,e.uX)(),(0,e.CE)("div",b,[(0,e.bF)((0,n.R1)(m.Ah),{name:"gitea-running",class:"tw-mr-2 rotate-clockwise"}),(0,e.eW)(" "+(0,l.v_)(t.locale.loadingInfo),1)])):((0,e.uX)(),(0,e.CE)("div",_,[(0,e.bF)((0,n.R1)(m.Ah),{name:"octicon-x-circle-fill"}),(0,e.eW)(" "+(0,l.v_)(d.value),1)]))])):(0,e.Q3)("v-if",!0),i.value.length!==0?(0,e.bU)(i.value,()=>((0,e.uX)(),(0,e.Wv)((0,n.R1)(h.yP),{key:1,data:D(i.value),options:E},null,8,["data"])),o,0):(0,e.Q3)("v-if",!0)])]))}}),x=s("./node_modules/.pnpm/vue-loader@17.4.2_vue@3.5.21_typescript@5.9.2__webpack@5.101.3/node_modules/vue-loader/dist/exportHelper.js"),R=(0,x.A)(w,[["__scopeId","data-v-2b6cfd0a"]])})}]);
