diff --git a/public/asset-manifest.json b/public/asset-manifest.json index cf99c0b..a50c08c 100644 --- a/public/asset-manifest.json +++ b/public/asset-manifest.json @@ -1,6 +1,6 @@ { "core.min.js": "core.d23af1c652.min.js", - "vendor.min.js": "vendor.0fb1006f8b.min.js", + "vendor.min.js": "vendor.bec1cbf32f.min.js", "mermaid.min.js": "mermaid.a7356d5ed1.min.js", "all.min.css": "all.f9696d33d4.min.css", "markdown.min.js": "markdown.6c8dfb7b1d.min.js", diff --git a/public/script/admin.js b/public/script/admin.js index a4df23e..f950f61 100644 --- a/public/script/admin.js +++ b/public/script/admin.js @@ -1731,7 +1731,7 @@ export const errorsAdminController = function (state, http, location, interval) const offset = append ? (state.redisNextOffset || state.entries.length) : 0; const limit = append ? state.pageSize - : Math.max(state.pageSize, state.entries.length || state.pageSize); + : Math.max(state.pageSize, state.redisNextOffset || state.entries.length || state.pageSize); http .get("/api/admin/errors", { params: { offset, limit } }) .then( diff --git a/public/script/vendor.min.js b/public/script/vendor.min.js index fb8fb97..ace9762 100644 --- a/public/script/vendor.min.js +++ b/public/script/vendor.min.js @@ -11,7 +11,7 @@ while being at `)],{type:"text/csv"}),v=document.createElement("a");v.href=URL.createObjectURL(N),v.download=i.username+"-repositories.csv",v.click()},e.showStatusMessage=h=>{let w=h.statusMessage||"(no message)";window.prompt(`Status message for ${h.repoId} (${h.status}):`,w)},e.fetchGithubInfo=h=>{let w=window.open("","_blank");w&&w.document.write("
Loading GitHub info for "+h.repoId+"...
"),t.get("/api/admin/repos/"+h.repoId+"/github").then(R=>{w&&(w.document.open(),w.document.write('
'+JSON.stringify(R.data,null,2).replace(/[<>]/g,S=>S==="<"?"<":">")+"
"),w.document.close())},R=>{let S=R&&R.data?JSON.stringify(R.data,null,2):String(R);w&&(w.document.body.innerHTML='
'+S+"
")})};function u(h){t.get("/api/admin/users/"+h+"/repos",{}).then(w=>{e.repositories=w.data},w=>{console.error(w)})}function y(h){t.get("/api/admin/users/"+h,{}).then(w=>{e.userInfo=w.data},w=>{console.error(w)})}y(i.username),u(i.username),e.banUser=()=>{confirm(`Ban user ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/ban`).then(()=>y(i.username),h=>console.error(h))},e.activateUser=()=>{t.post(`/api/admin/users/${i.username}/activate`).then(()=>y(i.username),h=>console.error(h))},e.promoteUser=()=>{confirm(`Promote ${i.username} to admin?`)&&t.post(`/api/admin/users/${i.username}/promote`).then(()=>y(i.username),h=>console.error(h))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/demote`).then(()=>y(i.username),h=>console.error(h))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function m(){t.get("/api/admin/tokens").then(h=>{e.tokens=h.data||[]},h=>{h.status!==401&&h.status!==403&&console.error(h)})}m(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(h=>{e.tokenForm.plaintext=h.data.token,e.tokenForm.name="",m()},h=>console.error(h))},e.revokeToken=h=>{confirm(`Revoke token "${h.name}"?`)&&t.delete("/api/admin/tokens/"+h.id).then(()=>m(),w=>console.error(w))},e.removeCache=h=>{confirm("Remove cached files for "+h.repoId+"?")&&t.delete("/api/admin/repos/"+h.repoId).then(()=>u(i.username),w=>console.error(w))},e.removeRepository=h=>{confirm("Remove repository "+h.repoId+"?")&&t.delete("/api/repo/"+h.repoId+"/").then(()=>u(i.username),w=>console.error(w))},e.updateRepository=h=>{let w=st({title:`Refreshing ${h.repoId}...`,date:new Date,body:`The repository ${h.repoId} is going to be refreshed.`});e.toasts.push(w),t.post(`/api/repo/${h.repoId}/refresh`).then(R=>{R.data.status=="ready"?w.title=`${h.repoId} is refreshed.`:w.title=`Refreshing of ${h.repoId}.`},R=>{w.title=`Error during the refresh of ${h.repoId}.`,w.body=R.body})},e.getGitHubRepositories=h=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(w=>{e.userInfo.repositories=w.data})};let b=null;e.watch("query",()=>{s.timeout.cancel(b),b=s.timeout(()=>{u(i.username)},500)},!0)},zu=function(e,t,o){let i=Ct(),s=Bt();e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),e.conferences=[],e.total=-1,e.totalPage=0,e.statusCounts=[];let r=R=>{if(R.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){R.preventDefault();let S=document.querySelector('.admin-filter-toolbar input[type="search"]');S&&S.focus()}};s(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=R=>{R==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[R]="",e.query.page=1},e.chips=[];let d=()=>{let R=[];(e.query.dateFrom||e.query.dateTo)&&R.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=R};e.statusCountFor=R=>{let S=(e.statusCounts||[]).find(N=>N._id===R);return S?S.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=R=>{e.query.sort===R?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=R,e.query.direction="desc"),e.query.page=1},e.sortIcon=R=>e.query.sort===R?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let p="admin.conferences.filterPrefs",u={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},y=loadFilterPrefs(p)||{};e.query=Object.assign({},u,y,{page:1,search:""});let m=o.search();m.search&&(e.query.search=m.search);let b="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(b)||"[]"),e.savePreset=()=>{let R=window.prompt("Preset name:");if(!R)return;let S=Object.assign({},e.query);delete S.page,e.presets=(e.presets||[]).filter(N=>N.name!==R),e.presets.push({name:R,query:S}),localStorage.setItem(b,JSON.stringify(e.presets))},e.applyPreset=R=>{Object.assign(e.query,R.query,{page:1})},e.deletePreset=R=>{e.presets=(e.presets||[]).filter(S=>S.name!==R.name),localStorage.setItem(b,JSON.stringify(e.presets))},e.removeConference=R=>{confirm("Remove conference "+R.conferenceID+"?")&&t.delete("/api/admin/conferences/"+R.conferenceID).then(()=>h(),S=>console.error(S))},e.exportCsv=()=>{let R=new URLSearchParams(Object.entries(e.query).filter(([,S])=>S!==""&&S!==!1&&S!=null));R.set("format","csv"),R.set("limit","10000"),window.open("/api/admin/conferences?"+R.toString(),"_blank")},e.fetchError=null;function h(){e.fetchError=null,t.get("/api/admin/conferences",{params:e.query}).then(R=>{e.total=R.data.total,e.totalPage=Math.ceil(R.data.total/e.query.limit),e.conferences=R.data.results,e.statusCounts=R.data.statusCounts||[]},R=>{e.fetchError=R&&R.data&&R.data.error||"Failed to load conferences",console.error(R)})}Ji(e,{flags:()=>e.query,keys:["ready","preparing","error","expired","removed"],count:R=>e.statusCountFor(R),onChange:()=>{e.query.page=1}}),h();let w=null;e.watch("query",()=>{i.timeout.cancel(w),w=i.timeout(h,500);let{page:R,search:S,...N}=e.query;saveFilterPrefs(p,N),d()},!0),d()},Hu=function(e,t,o,i,s){let r=Ct();e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),e.queueList=[],e.jobs=[],e.selectedQueue="download",e.selectedStats=null,e.range="1h",e.allStates=["active","waiting","delayed","failed","completed"],e.stateFilter={active:!0,waiting:!0,delayed:!0,failed:!0,completed:!0},Ji(e,{flags:()=>e.stateFilter,keys:e.allStates,count:N=>(e.jobs||[]).filter(v=>v._state===N).length}),e.query={search:"",autoRefresh:!0},e.filteredJobs=()=>(e.jobs||[]).filter(N=>e.stateFilter[N._state]),e.jobProgressPct=N=>N?._state==="completed"?100:N&&N.progress&&typeof N.progress=="object"&&typeof N.progress.percent=="number"?Math.max(0,Math.min(100,Math.round(N.progress.percent))):typeof N.progress=="number"?Math.max(0,Math.min(100,Math.round(N.progress))):null;let d={get_files:"Fetching files",download:"Downloading",downloading:"Downloading",anonymize:"Anonymizing",anonymizing:"Anonymizing",ready:"Ready",removing:"Removing",preparing:"Preparing"};e.jobDetail=N=>{if(N?._state==="failed")return Yi(N.failedReason||"")||"Failed";let v=N?.progress&&typeof N.progress=="object"?N.progress.status:null;return N?._state==="active"&&v?d[v]||Yi(v):"\u2014"},e.jobDuration=N=>{if(!N.processedOn)return"\u2014";let v=N.finishedOn||Date.now();return qn(v-N.processedOn)},e.metricsPoints=[],e.selectQueue=N=>{e.selectedQueue=N,p(),u()},e.setRange=N=>{e.range=N,u()};function p(){let N={queue:e.selectedQueue,search:e.query.search};t.get("/api/admin/queues",{params:N}).then(v=>{e.queueList=v.data.queues||[],e.jobs=v.data.jobs||[],e.selectedStats=e.queueList.find(E=>E.key===e.selectedQueue)||e.queueList[0]||null},v=>console.error(v))}function u(){t.get("/api/admin/queues/metrics",{params:{queue:e.selectedQueue,range:e.range}}).then(N=>{e.metricsPoints=N.data.points||[],s(w,0)},N=>console.error(N))}p(),u();let y=i(()=>{e.query.autoRefresh&&(p(),u())},15e3);e.on("dispose",()=>i.cancel(y)),e.refreshNow=function(){p(),u()};function m(N){let v=N&&N.data&&(N.data.message||N.data.error)||"Request failed";e.actionError=v,s(()=>{e.actionError=null},5e3),console.error(N)}e.actionError=null,e.removeJob=N=>{t.delete(`/api/admin/queue/${e.selectedQueue}/${N.id}`).then(p,m)},e.retryJob=N=>{t.post(`/api/admin/queue/${e.selectedQueue}/${N.id}`).then(p,m)},e.retryFailed=()=>{confirm(`Retry all failed jobs in ${e.selectedQueue}?`)&&t.post(`/api/admin/queue/${e.selectedQueue}/retry-failed`).then(p,N=>console.error(N))},e.drainSelected=()=>{confirm(`Drain the ${e.selectedQueue} queue?`)&&t.post(`/api/admin/queue/${e.selectedQueue}/drain`).then(p,N=>console.error(N))},e.togglePause=()=>{let N=e.selectedStats&&e.selectedStats.paused?"resume":"pause";t.post(`/api/admin/queue/${e.selectedQueue}/${N}`).then(p,v=>console.error(v))},e.emptyQueue=()=>{confirm(`Empty the ${e.selectedQueue} queue? This removes ALL jobs.`)&&t.post(`/api/admin/queue/${e.selectedQueue}/empty`).then(p,N=>console.error(N))},e.pauseAll=()=>{confirm("Pause all queues?")&&t.post("/api/admin/queues/pause-all").then(p,N=>console.error(N))};let b=null;e.watch("query.search",()=>{r.timeout.cancel(b),b=r.timeout(p,350)}),e.expanded={},e.toggleJob=N=>{e.expanded[N.id]=!e.expanded[N.id]},e.humanTime=N=>{if(!N)return"";let v=new Date(N);return v.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})+" "+v.toLocaleDateString([],{month:"short",day:"numeric"})},e.delayCountdown=N=>{if(!N)return"";var v=Math.max(0,Math.ceil((N-Date.now())/1e3));if(v<=0)return"resuming soon";var E=Math.floor(v/60),M=v%60;return"in "+(E>0?E+"m "+M+"s":M+"s")};function h(N){if(N<=0)return{ticks:[0],niceMax:1};let v=Math.pow(10,Math.floor(Math.log10(N))),E=v;N/E<2?E=v/2:N/E>5&&(E=v*2);let M=Math.ceil(N/E)*E,V=[];for(let _=0;_<=M;_+=E)V.push(_);return{ticks:V,niceMax:M}}function w(){var N=document.getElementById("q-throughput-chart");if(!N)return;var v=N.getContext("2d"),E=window.devicePixelRatio||1,M=N.parentElement.getBoundingClientRect(),V=44,_=44,G=22,te=Math.max(200,Math.round(M.width)),X=Math.max(180,Math.min(420,Math.round(M.height)||180)),O=te-V-_,U=X-G;N.width=te*E,N.height=X*E,N.style.width=te+"px",N.style.height=X+"px",v.setTransform(E,0,0,E,0,0);var C=document.body.classList.contains("dark-mode"),L="#8A857C",z=C?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",K=C?"#6FBF8A":"#2F7D4F",ie=C?"rgba(111,191,138,0.12)":"rgba(47,125,79,0.08)",se=C?"#F08A82":"#B42318",Y=C?"rgba(240,138,130,0.08)":"rgba(180,35,24,0.06)",he=getComputedStyle(document.body).getPropertyValue("--q-time-series").trim()||(C?"#E0A94A":"#946512"),Se=e.metricsPoints||[];if(Se.length===0){v.fillStyle=L,v.font="13px Inter, system-ui, sans-serif",v.textAlign="center",v.fillText("No metrics data yet",te/2,X/2),R=null;return}var Ue=Se.map(function(we){return we.completed}),Be=Se.map(function(we){return we.failed}),Qe=Se.map(function(we){return we.avgMs});if(!Ue.some(Boolean)&&!Be.some(Boolean)){v.strokeStyle=C?"rgba(255,255,255,0.14)":"rgba(0,0,0,0.12)",v.beginPath(),v.moveTo(0,X-18.5),v.lineTo(te,X-18.5),v.stroke(),v.fillStyle=C?"#CFC8BD":"#4F4A42",v.font="500 14px Inter, system-ui, sans-serif",v.textAlign="center",v.fillText("No jobs processed in this window",te/2,X/2-6),v.fillStyle=L,v.font="12.5px Inter, system-ui, sans-serif",v.fillText("Completed and failed jobs will chart here",te/2,X/2+16),R=null;return}var He=Se.length,tt=O/(He-1||1),Re=Math.max(1,Math.max.apply(null,Ue),Math.max.apply(null,Be)),Fe=h(Re),W=Math.max.apply(null,Qe),fe=W>0?h(W):{ticks:[0],niceMax:1},de=function(we){return U-we/Fe.niceMax*(U-10)},ce=function(we){return U-we/fe.niceMax*(U-10)},ve=function(we){return V+we*tt};v.textAlign="right",v.textBaseline="middle",v.font="11px Inter, system-ui, sans-serif",Fe.ticks.forEach(function(we){var be=de(we);v.strokeStyle=z,v.lineWidth=1,v.beginPath(),v.moveTo(V,be),v.lineTo(te-_,be),v.stroke(),v.fillStyle=L,we!==0&&v.fillText(we>=1e3?(we/1e3).toFixed(1)+"k":String(we),V-6,be)}),W>0&&(v.textAlign="left",fe.ticks.forEach(function(we){var be=ce(we);v.fillStyle=he,we!==0&&v.fillText(qn(we),te-_+6,be)}));var Me=Se[He-1].ts,P=Se[0].ts,T=Math.max(0,(Me-P)/6e4),F=[1,2,5,10,15,30,60,120,180,360,720,1440,2880,10080],J=F.find(function(we){return T/we<=4})||F[F.length-1],H=function(we){return we<60?we+"m":we<1440?we/60+"h":we/1440+"d"},x=function(we){for(var be=0,ot=1;ot0&&Math.abs(Se[ke].ts-(Me-ee*6e4))>le+1)){var pe=ve(ke),Ee=ee===0?"now":H(ee)+" ago",De=v.measureText(Ee).width,Ve=oe===0?"right":ke===0?"left":"center",Ge=Ve==="right"?pe:Ve==="left"?pe+De:pe+De/2;Ge>ne-12||(v.textAlign=Ve,v.fillText(Ee,pe,U+6),ne=Ve==="right"?pe-De:Ve==="left"?pe:pe-De/2)}}function ze(we,be,ot,at){we.length!==0&&(v.beginPath(),v.moveTo(ve(0),U),we.forEach(function(yt,lt){var dt=ve(lt),ft=be(yt);if(lt===0)v.lineTo(dt,ft);else{var Vt=(ve(lt-1)+dt)/2;v.bezierCurveTo(Vt,be(we[lt-1]),Vt,ft,dt,ft)}}),v.lineTo(ve(we.length-1),U),v.closePath(),v.fillStyle=ot,v.fill(),v.beginPath(),we.forEach(function(yt,lt){var dt=ve(lt),ft=be(yt);if(lt===0)v.moveTo(dt,ft);else{var Vt=(ve(lt-1)+dt)/2;v.bezierCurveTo(Vt,be(we[lt-1]),Vt,ft,dt,ft)}}),v.strokeStyle=at,v.lineWidth=1.5,v.stroke())}ze(Ue,de,ie,K),ze(Be,de,Y,se),W>0&&(v.beginPath(),Qe.forEach(function(we,be){var ot=ve(be),at=ce(we);if(be===0)v.moveTo(ot,at);else{var yt=(ve(be-1)+ot)/2;v.bezierCurveTo(yt,ce(Qe[be-1]),yt,at,ot,at)}}),v.strokeStyle=he,v.lineWidth=1,v.setLineDash([4,3]),v.stroke(),v.setLineDash([])),R={pts:Se,maxLen:He,marginLeft:V,step:tt,totalW:te,toX:ve}}var R=null;function S(){var N=document.getElementById("q-throughput-chart");if(!(!N||N._tipBound)){N._tipBound=!0;var v=document.getElementById("q-chart-tooltip"),E=document.getElementById("q-chart-crosshair");N.addEventListener("mousemove",function(M){if(!(!R||!v||!E)){var V=R,_=N.getBoundingClientRect(),G=M.clientX-_.left,te=Math.round((G-V.marginLeft)/V.step);if(te<0||te>=V.maxLen){v.style.display="none",E.style.display="none";return}var X=V.pts[te],O=V.pts[V.pts.length-1].ts,U=Math.round((O-X.ts)/6e4),C;if(U<=0)C="now";else if(U<60)C=U+"m ago";else if(U<1440){var L=Math.floor(U/60),z=U%60;C=L+"h"+(z?" "+z+"m":"")+" ago"}else C=Math.round(U/1440)+"d ago";var K='
'+C+'
● completed: '+X.completed+'/min
● failed: '+X.failed+"/min
";if(X.avgMs>0){var ie=qn(X.avgMs);K+='
● avg time: '+ie+"
"}v.innerHTML=K;var se=V.toX(te),Y=v.offsetWidth,he=se+10;he+Y>V.totalW&&(he=se-Y-10),v.style.display="block",v.style.left=he+"px",v.style.top="8px",E.style.display="block",E.style.left=se+"px"}}),N.addEventListener("mouseleave",function(){v&&(v.style.display="none"),E&&(E.style.display="none")})}}e.watch("metricsPoints",function(){s(S,50)})},ju=function(e,t,o,i){_u(e,t),e.redisCollecting=null,e.redisStatsState="loading";let s=Ct();e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),e.entries=[],e.visible=[],e.available=null,e.cap=1e3,e.total=0,e.pageSize=250,e.expanded={},e.detailTab={},e.copyHint="",e.parsedFilterCount=0,e.stats={last24h:0,prev24h:0,delta:0,severity:{error:0,warn:0,info:0},unique:{error:0,warn:0,info:0},buckets:[],dropped:0},e.query={search:"",bucket:"",sort:"recent",group:"code",autoRefresh:!0},e.relTime=v=>{if(!v)return"";let E=new Date(v).getTime();if(isNaN(E))return v;let M=Math.max(0,Date.now()-E),V=Math.floor(M/1e3);if(V<5)return"just now";if(V<60)return`${V}s ago`;let _=Math.floor(V/60);if(_<60)return`${_}m ago`;let G=Math.floor(_/60);if(G<24)return`${G}h ago`;let te=Math.floor(G/24);return te<7?`${te}d ago`:new Date(v).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},e.absTime=v=>{if(!v)return"";let E=new Date(v);return isNaN(E.getTime())?v:E.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},e.absTimeShort=v=>{if(!v)return"";let E=new Date(v);return isNaN(E.getTime())?v:E.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})};let r=/^[a-zA-Z][a-zA-Z0-9]*(?:_[a-zA-Z0-9]+)+$/;function d(v,E){let M=v&&(v.httpStatus||v.status)||null;if(typeof M=="number"){if(M>=500)return"error";if(M===401||M===403||M===404)return"info";if(M>=400)return"warn"}return E==="error"?"error":E==="warn"?"warn":"info"}function p(v){let E=(v.raw||[]).find(G=>G&&typeof G=="object"&&!Array.isArray(G));if(E){E.message&&r.test(E.message)?(v.displayMessage=E.message,v.displayContext=v.message):E.code&&r.test(String(E.code))?(v.displayMessage=String(E.code),v.displayContext=v.message):E.name&&E.name!=="AnonymousError"&&E.name!=="Error"?(v.displayMessage=E.name,v.displayContext=E.message||v.message):v.displayMessage=v.message,v._status=E.httpStatus||E.status||null,v._url=E.url||null,v._method=E.method||null,v._repoId=E.repoId||E.detail||null,v._detail=E.detail&&E.detail!==v._repoId?E.detail:null;let G=typeof E.stack=="string"?E.stack:null;for(var M=[E.cause,E.err].filter(Boolean),V=0;!G&&V{O==null||O===""||M.push([X,O])};V("name",E&&E.name),V("code",v.displayMessage||E&&E.message),v._bucket&&V("kind",v._bucket),V("httpStatus",E&&E.httpStatus),E&&E.status&&!E.httpStatus&&V("status",E.status),V("module",v.module);let _=E&&E.detail;if(typeof _=="string"){let X=_.trim();if(X[0]==="{"||X[0]==="[")try{_=JSON.parse(_)}catch{}}if(V("detail",_),V("repoId",E&&E.repoId),V("filePath",E&&E.filePath),V("upstreamStatus",E&&E.upstreamStatus),V("upstreamBody",E&&E.upstreamBody),V("url",v._url),V("err",E&&E.err),V("cause",E&&!E.err&&E.cause),V("ts",v.ts),!M.length)return JSON.stringify(v,null,2);let G=M.reduce((X,O)=>Math.max(X,O[0].length),0),te=["{"];return M.forEach(([X,O],U)=>{let L=` ${`"${X}":`.padEnd(G+3," ")} `,z=UY===0?se:ie+se).join(` `)}else typeof O=="number"||typeof O=="boolean"?K=String(O):K=JSON.stringify(O);te.push(`${L}${K}${z}`)}),te.push("}"),te.join(` -`)}function y(v){let E=[],M="",V=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,_=0,G;for(;G=V.exec(v);)M+=v.slice(_,G.index),_=V.lastIndex,E.push({key:G[1],op:G[2]||"=",val:G[3]});return M+=v.slice(_),{filters:E,free:M.trim().toLowerCase()}}function m(v,E){for(let M of E.filters){let V=(G,te,X)=>{let O=parseFloat(G),U=parseFloat(te);return X==="="?String(G)===String(te):X==="!="?String(G)!==String(te):X===">="?O>=U:X==="<="?O<=U:X===">"?O>U:X==="<"?OE&&X._bucket!==E?!1:m(X,v)),V=e.query.group;if(V){let X=C=>JSON.stringify(V==="module"?[C.module,C._bucket]:[C.raw?.[0]?.service||"unknown",C.module,C.displayMessage||C.message||"_",C._bucket,C._status]),O=new Map;for(let C of M){let L=X(C);if(O.has(L)){let z=O.get(L);z.count++,z._related.push(C),new Date(C.ts)>new Date(z.ts)&&(z.ts=C.ts,z._url=C._url,z._status=C._status),new Date(C.ts)new Date(L.ts).getTime()>=U).length;M=Array.from(O.values())}else M=M.map((X,O)=>(X._key="row:"+O+":"+X.ts,X._related=[X],X._firstSeen=X.ts,X._lastHourCount=0,X.count=1,X));let _=X=>({error:0,warn:1,info:2})[X._bucket]??1;e.query.sort==="count"?M.sort((X,O)=>_(X)-_(O)||O.count-X.count||new Date(O.ts)-new Date(X.ts)):M.sort((X,O)=>_(X)-_(O)||new Date(O.ts)-new Date(X.ts)),e.visible=M;let G=!!(e.query.bucket||(e.query.search||"").trim()),te=!G&&(e.stats?.severity?.error||0)>0&&!M.some(X=>X._bucket==="error")&&e.entries.length<1500;(G&&!M.length||te)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,h(!0))}function h(v){let E=v?e.redisNextOffset||e.entries.length:0,M=v?e.pageSize:Math.max(e.pageSize,e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:E,limit:M}}).then(V=>{let _=(V.data.entries||[]).map(p);e.entries=v?e.entries.concat(_):_,e.redisRedacted=(v&&e.redisRedacted||0)+(V.data.redactedEntries||0),e.redisNextOffset=V.data.nextOffset??E+(V.data.entries||[]).length,e.available=!!V.data.available,e.redisCollecting=V.data.redisCollecting!==!1,e.cap=V.data.max||e.cap,e.total=V.data.total||e.entries.length,e._autoLoading=!1,b()},()=>{e._autoLoading=!1,e.available=!1})}e.loadMore=()=>h(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length){let E=v.data||{};e.redisStatsState=E.available===!1?"unavailable":"ready";let M=E.prev24h?Math.round((E.last24h-E.prev24h)/E.prev24h*100):0;e.stats={last24h:E.last24h||0,prev24h:E.prev24h||0,delta:M,severity:E.severity||{error:0,warn:0,info:0},unique:E.unique||{error:0,warn:0,info:0},buckets:E.buckets||[],dropped:E.dropped||0},b()},()=>{e.redisStatsState="unavailable"})}function R(){h(),w()}e.barPx=(v,E)=>{let M=e.stats.buckets||[],V=0,_=0;for(let O of M)V=Math.max(V,(O.error||0)+(O.warn||0)),_=Math.max(_,O.info||0);let G=v[E]||0;if(!G)return 0;if(E==="info")return _?Math.max(2,Math.round(G/_*(V?16:60))):0;let te=(v.error||0)+(v.warn||0),X=Math.round(te/V*44);return Math.max(4,Math.round(G/te*X))},e.bucketTitle=v=>`${new Date(v.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${v.error||0} err \xB7 ${v.warn||0} warn \xB7 ${v.info||0} info`,e.toggle=v=>{e.expanded[v._key]=!e.expanded[v._key]},e.setBucket=v=>{e.query.bucket=v},e.refreshNow=R,e.clearAll=()=>{confirm("Clear Redis error history? Central logs are unaffected.")&&t.delete("/api/admin/errors").then(R,v=>console.error(v))},e.exportCsv=()=>{let v=["ts","level","module","displayMessage","_status","_url","_repoId"],E=[v.join(",")];for(let G of e.visible)E.push(v.map(te=>{let X=G[te]==null?"":String(G[te]);return/[",\n]/.test(X)?`"${X.replace(/"/g,'""')}"`:X}).join(","));let M=new Blob([E.join(` +`)}function y(v){let E=[],M="",V=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,_=0,G;for(;G=V.exec(v);)M+=v.slice(_,G.index),_=V.lastIndex,E.push({key:G[1],op:G[2]||"=",val:G[3]});return M+=v.slice(_),{filters:E,free:M.trim().toLowerCase()}}function m(v,E){for(let M of E.filters){let V=(G,te,X)=>{let O=parseFloat(G),U=parseFloat(te);return X==="="?String(G)===String(te):X==="!="?String(G)!==String(te):X===">="?O>=U:X==="<="?O<=U:X===">"?O>U:X==="<"?OE&&X._bucket!==E?!1:m(X,v)),V=e.query.group;if(V){let X=C=>JSON.stringify(V==="module"?[C.module,C._bucket]:[C.raw?.[0]?.service||"unknown",C.module,C.displayMessage||C.message||"_",C._bucket,C._status]),O=new Map;for(let C of M){let L=X(C);if(O.has(L)){let z=O.get(L);z.count++,z._related.push(C),new Date(C.ts)>new Date(z.ts)&&(z.ts=C.ts,z._url=C._url,z._status=C._status),new Date(C.ts)new Date(L.ts).getTime()>=U).length;M=Array.from(O.values())}else M=M.map((X,O)=>(X._key="row:"+O+":"+X.ts,X._related=[X],X._firstSeen=X.ts,X._lastHourCount=0,X.count=1,X));let _=X=>({error:0,warn:1,info:2})[X._bucket]??1;e.query.sort==="count"?M.sort((X,O)=>_(X)-_(O)||O.count-X.count||new Date(O.ts)-new Date(X.ts)):M.sort((X,O)=>_(X)-_(O)||new Date(O.ts)-new Date(X.ts)),e.visible=M;let G=!!(e.query.bucket||(e.query.search||"").trim()),te=!G&&(e.stats?.severity?.error||0)>0&&!M.some(X=>X._bucket==="error")&&e.entries.length<1500;(G&&!M.length||te)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,h(!0))}function h(v){let E=v?e.redisNextOffset||e.entries.length:0,M=v?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:E,limit:M}}).then(V=>{let _=(V.data.entries||[]).map(p);e.entries=v?e.entries.concat(_):_,e.redisRedacted=(v&&e.redisRedacted||0)+(V.data.redactedEntries||0),e.redisNextOffset=V.data.nextOffset??E+(V.data.entries||[]).length,e.available=!!V.data.available,e.redisCollecting=V.data.redisCollecting!==!1,e.cap=V.data.max||e.cap,e.total=V.data.total||e.entries.length,e._autoLoading=!1,b()},()=>{e._autoLoading=!1,e.available=!1})}e.loadMore=()=>h(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length){let E=v.data||{};e.redisStatsState=E.available===!1?"unavailable":"ready";let M=E.prev24h?Math.round((E.last24h-E.prev24h)/E.prev24h*100):0;e.stats={last24h:E.last24h||0,prev24h:E.prev24h||0,delta:M,severity:E.severity||{error:0,warn:0,info:0},unique:E.unique||{error:0,warn:0,info:0},buckets:E.buckets||[],dropped:E.dropped||0},b()},()=>{e.redisStatsState="unavailable"})}function R(){h(),w()}e.barPx=(v,E)=>{let M=e.stats.buckets||[],V=0,_=0;for(let O of M)V=Math.max(V,(O.error||0)+(O.warn||0)),_=Math.max(_,O.info||0);let G=v[E]||0;if(!G)return 0;if(E==="info")return _?Math.max(2,Math.round(G/_*(V?16:60))):0;let te=(v.error||0)+(v.warn||0),X=Math.round(te/V*44);return Math.max(4,Math.round(G/te*X))},e.bucketTitle=v=>`${new Date(v.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${v.error||0} err \xB7 ${v.warn||0} warn \xB7 ${v.info||0} info`,e.toggle=v=>{e.expanded[v._key]=!e.expanded[v._key]},e.setBucket=v=>{e.query.bucket=v},e.refreshNow=R,e.clearAll=()=>{confirm("Clear Redis error history? Central logs are unaffected.")&&t.delete("/api/admin/errors").then(R,v=>console.error(v))},e.exportCsv=()=>{let v=["ts","level","module","displayMessage","_status","_url","_repoId"],E=[v.join(",")];for(let G of e.visible)E.push(v.map(te=>{let X=G[te]==null?"":String(G[te]);return/[",\n]/.test(X)?`"${X.replace(/"/g,'""')}"`:X}).join(","));let M=new Blob([E.join(` `)],{type:"text/csv;charset=utf-8"}),V=URL.createObjectURL(M),_=document.createElement("a");_.href=V,_.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(_),_.click(),document.body.removeChild(_),URL.revokeObjectURL(V)};function S(v){e.copyHint=`${v} copied`,s.timeout(()=>{e.copyHint=""},1500)}e.copyJson=v=>{navigator.clipboard.writeText(v._detailJson).then(()=>S("JSON"))},e.copyCurl=v=>{if(!v._url)return;let M=`curl -X ${v._method||"GET"} '${window.location.origin}${v._url}'`;navigator.clipboard.writeText(M).then(()=>S("curl"))},R();let N=i(()=>{e.query.autoRefresh&&R()},15e3);e.on("dispose",()=>i.cancel(N)),e.watch("query.search",b),e.watch("query.bucket",b),e.watch("query.sort",b),e.watch("query.group",b)},Gu=function(e,t,o,i){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null){o.url("/");return}e.data=null,e.loading=!0,e.error=null,e.performance=null,e.performanceMinutes=15,e.performanceTab="routes",e.cacheReport=null,e.cacheError=null,e.cacheMinutes=60,e.cacheTraffic="all",e.ovView=["performance","cache"].includes((window.location.hash||"").slice(1))?window.location.hash.slice(1):"summary",e.setOvView=function(v){e.ovView=v;try{window.history.replaceState(null,"",v==="summary"?window.location.pathname:"#"+v)}catch{}};var s=!1;e.loadCache=function(){if(!s){s=!0;var v=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:v}}).then(function(E){v===e.cacheMinutes&&(e.cacheReport=E.data,e.cacheError=E.data.available?null:E.data.reason||"Cache monitoring is unavailable.")},function(){e.cacheError="Could not refresh cache monitoring. Displayed values may be stale."}).finally(function(){s=!1,v!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(v){return e.cacheTraffic==="all"||v.traffic===e.cacheTraffic})},e.cacheRate=function(v,E){var M=e.cacheRows(),V=function(te){return M.filter(function(X){return X.name===te}).reduce(function(X,O){return X+O[E]},0)},_=V(v+"_hit"),G=V(v+"_miss");return _+G?(100*_/(_+G)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(v){return v.replaceAll("_"," ")},e.cacheP95=function(v){var E=0,M=e.cacheReport?.latencyBucketsMs||[];if(!v.count)return"No samples";if(!v.ms)return"Not timed";for(var V=0;V<=M.length;V++)if(E+=v["b"+V]||0,E>=Math.ceil(v.count*.95))return V 10\u202Fs";return"No samples"},e.healthAlert=function(){let v=e.data&&e.data.system||{},E=[["Memory",v.memPercent],["Disk",v.diskPercent]].filter(([,V])=>V>90);return E.length?E.map(([V,_])=>V+" is at "+_+"%").join(" and ")+". New anonymizations may fail until "+(E.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(v){return v==null?"":qn(v)},e.latencyBound=function(v,E){return v.count?v[E]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(v[E]):"No samples"},e.firstByteBound=function(v){return e.latencyBound({count:v.firstByteCount,p95UpperMs:v.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(v){return Math.max(0,Math.round((Date.now()-v.sampledAt)/1e3))},e.peakRss=function(v){return(e.performance.runtimeSeries||[]).filter(function(E){return E.instance===v.instance}).reduce(function(E,M){return Math.max(E,M.rss)},v.memory.rss)},e.performanceWarning=function(v){return e.sampleAge(v)>45||v.droppedBatches||v.droppedMetrics||v.sockets?.closeWait>0||v.eventLoop?.p95Ms>100||v.memoryLimitBytes&&v.memory.rss>v.memoryLimitBytes*.8};var r=!1;e.loadPerformance=function(){var v=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==v&&(e.performance=null),!r&&(r=!0,t.get("/api/admin/performance",{params:{minutes:v}}).then(function(E){v===e.performanceMinutes&&(e.performance=E.data,e.performanceError=E.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){v===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){r=!1,v!==e.performanceMinutes&&e.loadPerformance()}))};function d(v){if(v==null)return"\u2014";for(var E=["B","KB","MB","GB","TB"],M=0,V=v;V>=1024&&M0?1:0).replace(/\.0$/,"")+" "+E[M]}e.humanBytes=d;function p(v){if(!v)return"\u2014";var E=Math.floor(v/86400),M=Math.floor(v%86400/3600),V=Math.floor(v%3600/60);return E>0?E+"d "+(M<10?"0":"")+M+"h":M>0?M+"h "+(V<10?"0":"")+V+"m":V+"m"}e.humanDuration=p;function u(v){return v==null?"\u2014":v>=1e6?(v/1e6).toFixed(1)+"M":v>=1e3?(v/1e3).toFixed(1)+"K":String(v)}e.humanNum=u,e.queueTotal=function(v){return v?(v.waiting||0)+(v.active||0)+(v.delayed||0)+(v.failed||0):0},e.statusCount=function(v){if(!e.data||!e.data.repos)return 0;for(var E=e.data.repos.statusBreakdown||[],M=0;M0,zero:!V,title:String(_.getHours()).padStart(2,"0")+":00 \xB7 "+(M.error||0)+" 5xx, "+(M.warn||0)+" 4xx"}})},e.errorHoursPeak=function(){var v=e.errorStats&&e.errorStats.buckets||[];return v.reduce(function(E,M){return Math.max(E,(M.error||0)+(M.warn||0))},0)};function y(v){var E=v||[];return E.map(function(M,V){var _=E[V-1]||{},G=Object.assign({},M);return G.dailyRepositories=V?Math.max(0,(M.nbRepositories||0)-(_.nbRepositories||0)):0,G.dailyUsers=V?Math.max(0,(M.nbUsers||0)-(_.nbUsers||0)):0,G.dailyPageViews=V?Math.max(0,(M.nbPageViews||0)-(_.nbPageViews||0)):0,G})}function m(v){var E=v&&v.length?v[v.length-1]:{};return{repositories:E.dailyRepositories||0,users:E.dailyUsers||0,pageViews:E.dailyPageViews||0}}function b(v,E){if(!v||!v.length)return v;var M=new Date(v[v.length-1].date);if(isNaN(M))return v;var V={};v.forEach(function(O){V[new Date(O.date).toISOString().slice(0,10)]=O});for(var _=[],G=E-1;G>=0;G--){var te=new Date(M.getTime()-G*864e5),X=te.toISOString().slice(0,10);_.push(V[X]||{date:te.toISOString(),_empty:!0,dailyPageViews:0,dailyRepositories:0,dailyUsers:0,nbUsers:0})}return _}var h={};e.historyMax=function(v){return h[v]||0};var w={};e.axisMax=function(v){var E=h[v]||0;if(E<=2)return 2;if(E<=10)return Math.ceil(E/2)*2;var M=Math.pow(10,Math.floor(Math.log10(E)));return Math.ceil(E/M)*M},e.historyBarH=function(v,E){return!v||!h[E]||!v[E]?0:Math.max(1,Math.round(v[E]/e.axisMax(E)*140))},e.historyRange=function(v){return{min:w[v],max:h[v]}};var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.historyLabel=function(v){if(!v||!v.date)return"";var E=new Date(v.date);return R[E.getUTCMonth()]+" "+E.getUTCDate()},e.historyHasMissing=function(){return!!(e.data&&e.data.history||[]).some(function(v){return v&&v._empty})},e.firstDataIndex=function(){for(var v=e.data&&e.data.history||[],E=0;E=M)return{lo:X,hi:X+2*G[te]}}return{lo:0,hi:e.axisMax("nbUsers")}},e.userStepPath=function(v){var E=e.data&&e.data.history||[],M=e.userAxis(),V=h.nbUsers?M.hi-M.lo:0,_=e.firstDataIndex();if(!V||_>=E.length)return"";for(var G=function(U){return(140-((U||0)-M.lo)/V*140).toFixed(2)},te=v?"M"+_+" 140":"",X=_;Xh[M])&&(h[M]=E[M]),(w[M]==null||E[M] .meta-more"),o=[...e.querySelectorAll(":scope > .meta-item")];if(o.forEach(s=>{s.removeAttribute("data-meta-hidden")}),t&&(t.hidden=!0,t.textContent="",t.removeAttribute("title"),t.removeAttribute("aria-label")),!e.clientWidth)return;if(e.classList.add("is-fitting"),e.scrollWidth<=e.clientWidth+1){e.classList.remove("is-fitting");return}let i=[];for(let s=o.length-1;s>=0&&e.scrollWidth>e.clientWidth+1;s--)if(o[s].setAttribute("data-meta-hidden",""),i.unshift(o[s]),t){let r=i.map(d=>d.dataset.metaLabel||d.textContent.trim().replace(/\s+/g," "));t.hidden=!1,t.textContent="+"+i.length,t.title=r.join(" \xB7 "),t.setAttribute("aria-label",i.length+" more: "+r.join(", "))}e.classList.remove("is-fitting")}function Wu(e,t){if(typeof document>"u"||typeof MutationObserver>"u"||!document.body)return;let o=!1,i=null,s=()=>{o=!1,i&&(document.querySelectorAll("[data-meta-fit]").forEach(wg),i.takeRecords())},r=()=>{!o&&i&&(o=!0,e.timeout(s,30))};i=new MutationObserver(d=>{d.some(p=>!(p.target.closest&&p.target.closest(".meta-more")))&&r()}),i.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),es(()=>{i.disconnect(),i=null}),t(window,"resize",r),document.fonts?.ready&&document.fonts.ready.then(r),r()}var kg=["bif","clp","djf","gnf","jpy","kmf","krw","mga","pyg","rwf","ugx","vnd","vuv","xaf","xof","xpf"],Lu=[{id:"subscription",label:"Subscriptions"},{id:"repository",label:"Repository purchases"},{id:"conference",label:"Conferences"}],Cg={author_monthly:"Author monthly",author_annual:"Author annual",author_pass:"Live updates",repo_extend:"Extended expiration",repo_never:"Never expire",repo_slot:"Extra repository",repo_pack:"Paper pack",conference_workshop:"Workshop",conference:"Conference",conference_large:"Large conference"};function $u(e){return Object.entries(e||{}).filter(([,t])=>t).sort((t,o)=>o[1]-t[1]).map(([t,o])=>{let i=kg.includes(t)?o:o/100;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:i%1?2:0,maximumFractionDigits:2}).format(i)}catch{return i+" "+t.toUpperCase()}})}var Ku=function(e,t,o){let i=Ct();if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null){o.url("/");return}e.families=Lu,e.periods=[{id:"7d",label:"7 days"},{id:"30d",label:"30 days"},{id:"90d",label:"90 days"},{id:"12m",label:"12 months"},{id:"all",label:"All time"}];let s=(()=>{try{return localStorage.getItem("admin.billing.period")}catch{return null}})();e.period=e.periods.some(h=>h.id===s)?s:"30d",e.summary=null,e.summaryError=null,e.summaryLoading=!0,e.periodLabel=()=>(e.periods.find(h=>h.id===e.period)||{}).label||"",e.periodPhrase=()=>e.period==="all"?"all time":"last "+e.periodLabel(),e.money=h=>$u(h),e.moneyText=(h,w="\u2014")=>$u(h).join(" \xB7 ")||w,e.revenueOn=()=>!!e.summary?.revenue?.available,e.planName=h=>((e.summary?.plans||[]).find(w=>w.planId===h)||{}).name||Cg[h]||h,e.bucketTotal=h=>h?h.subscription+h.repository+h.conference:0,e.chartMax=()=>{let h=Math.max(0,...(e.summary?.series||[]).map(e.bucketTotal));if(h<=4)return 4;let w=Math.pow(10,Math.floor(Math.log10(h)));return[1,1.2,1.5,2,2.5,3,4,5,6,8,10].map(R=>R*w).find(R=>R>=h&&R%2===0)||10*w},e.segmentPct=(h,w)=>h&&h[w]?h[w]/e.chartMax()*100:0,e.familyTotal=h=>(e.summary?.series||[]).reduce((w,R)=>w+R[h],0),e.bucketLabel=h=>{if(!h)return"";let w=new Date(h.date),R={timeZone:"UTC",day:"numeric",month:"short"};return e.summary?.bucket==="month"?w.toLocaleDateString(void 0,{timeZone:"UTC",month:"short",year:"numeric"}):((e.period==="12m"||e.period==="all"||w.getUTCFullYear()!==new Date().getUTCFullYear())&&(R.year="numeric"),(e.summary?.bucket==="week"?"Week of ":"")+w.toLocaleDateString(void 0,R))},e.bucketTip=h=>{let w=e.bucketTotal(h);if(!w)return e.bucketLabel(h)+": no sales";let R=Lu.filter(S=>h[S.id]).map(S=>h[S.id]+" "+S.label.toLowerCase());return e.bucketLabel(h)+": "+w+(w===1?" sale":" sales")+" ("+R.join(", ")+")"},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((h,w)=>h+e.bucketTotal(w),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(h=>h.active||h.allTimeSales||h.sales),e.planTotals=()=>{let h=w=>(e.summary?.plans||[]).reduce((R,S)=>R+(S[w]||0),0);return{active:h("active"),sales:h("sales"),allTimeSales:h("allTimeSales")}},e.webhookState=()=>{let h=e.summary?.webhooks;return h?h.failed||h.reconciliationFailed?"bad":h.oldestPendingSeconds>900||h.unreviewedRevocations?"warn":"ok":"ok"},e.age=h=>h?qn(h*1e3):"\u2014";let r=0;e.loadSummary=()=>{let h=++r;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(w=>{if(h!==r)return;e.summaryLoading=!1;let R=w.data;if(!R||!R.subscriptions||!R.sales||!Array.isArray(R.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=R},w=>{h===r&&(e.summaryLoading=!1,e.summaryError=w&&w.data&&w.data.error||"Could not load billing figures.")})},e.setPeriod=h=>{if(e.period!==h){e.period=h;try{localStorage.setItem("admin.billing.period",h)}catch{}e.loadSummary()}},e.grants=[],e.total=-1,e.totalPage=0,e.stateCounts={},e.statuses=[],e.grantsError=null,e.filtersOpen=!1,e.query={page:1,limit:25,search:"",plan:"",status:"",state:"",sort:"purchasedAt",direction:"desc"};let d=o.search();d.search&&(e.query.search=d.search),e.stateView=()=>e.query.state||"all",e.setStateView=h=>{e.query.state=h==="all"?"":h,e.query.page=1},e.stateCount=h=>h==="all"?["active","expired","revoked"].reduce((w,R)=>w+(e.stateCounts[R]||0),0):e.stateCounts[h]||0,e.sortBy=h=>{e.query.sort===h?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=h,e.query.direction="desc"),e.query.page=1},e.sortIcon=h=>e.query.sort===h?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"",e.chips=[];let p=()=>{let h=[];e.query.plan&&h.push({key:"plan",label:"Plan",value:e.planName(e.query.plan)}),e.query.status&&h.push({key:"status",label:"Stripe status",value:e.query.status.replace(/_/g," ")}),e.chips=h};e.clearFilter=h=>{e.query[h]="",e.query.page=1},e.filterPlan=h=>{Object.assign(e.query,{plan:h,page:1});let w=document.getElementById("bl-grants");w&&w.scrollIntoView&&w.scrollIntoView({behavior:"smooth",block:"start"})},e.clearFilters=()=>Object.assign(e.query,{search:"",plan:"",status:"",state:"",page:1}),e.hasFilters=()=>!!(e.query.search||e.query.plan||e.query.status||e.query.state),e.statusText=h=>(h.status||"unknown").replace(/_/g," "),e.revocationText=h=>h==="dispute"?"Disputed":h==="full_refund"?"Refunded":"Revoked",e.scopeHref=h=>h?.kind==="repo"?"/admin/repositories?search="+encodeURIComponent(h.id):h?.kind==="conference"?"/conference/"+encodeURIComponent(h.id):null;let u=0;function y(){let h=++u;e.grantsError=null;let w=Object.fromEntries(Object.entries(e.query).filter(([,R])=>R!==""&&R!=null));t.get("/api/admin/billing/grants",{params:w}).then(R=>{h===u&&(e.total=R.data?.total??0,e.totalPage=Math.ceil(e.total/e.query.limit),e.grants=R.data?.results||[],e.stateCounts=R.data.stateCounts||{},e.statuses=R.data.statuses||[])},R=>{h===u&&(e.grantsError=R&&R.data&&R.data.error||"Could not load subscriptions and purchases.")})}e.reloadGrants=y,e.loadSummary(),y(),p();let m=null,b=JSON.stringify({...e.query,page:0});e.watch("query",()=>{let h=JSON.stringify({...e.query,page:0});if(h!==b&&e.query.page!==1){b=h,e.query.page=1;return}b=h,i.timeout.cancel(m),m=i.timeout(y,300),p()},!0)};var ka=(e,t,o)=>{let i=e instanceof RegExp?Yu(e,o):e,s=t instanceof RegExp?Yu(t,o):t,r=i!==null&&s!=null&&Sg(i,s,o);return r&&{start:r[0],end:r[1],pre:o.slice(0,r[0]),body:o.slice(r[0]+i.length,r[1]),post:o.slice(r[1]+s.length)}},Yu=(e,t)=>{let o=t.match(e);return o?o[0]:null},Sg=(e,t,o)=>{let i,s,r,d,p,u=o.indexOf(e),y=o.indexOf(t,u+1),m=u;if(u>=0&&y>0){if(e===t)return[u,y];for(i=[],r=o.length;m>=0&&!p;){if(m===u)i.push(m),u=o.indexOf(e,m+1);else if(i.length===1){let b=i.pop();b!==void 0&&(p=[b,y])}else s=i.pop(),s!==void 0&&s=0?u:y}i.length&&d!==void 0&&(p=[r,d])}return p};var Xu="\0SLASH"+Math.random()+"\0",Ju="\0OPEN"+Math.random()+"\0",Na="\0CLOSE"+Math.random()+"\0",Qu="\0COMMA"+Math.random()+"\0",Zu="\0PERIOD"+Math.random()+"\0",Ng=new RegExp(Xu,"g"),Rg=new RegExp(Ju,"g"),Dg=new RegExp(Na,"g"),Pg=new RegExp(Qu,"g"),Ag=new RegExp(Zu,"g"),Tg=/\\\\/g,Og=/\\{/g,Ig=/\\}/g,Mg=/\\,/g,Vg=/\\\./g,qg=1e5,_g=4e6,Lg=1e3,$g=1e3;function Ca(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Fg(e){return e.replace(Tg,Xu).replace(Og,Ju).replace(Ig,Na).replace(Mg,Qu).replace(Vg,Zu)}function Ug(e){return e.replace(Ng,"\\").replace(Rg,"{").replace(Dg,"}").replace(Pg,",").replace(Ag,".")}function Ea(e,t){for(let o=0;o=t}function Lo(e,t,o,i,s,r){let d=[],p=0;for(let u=0;u=i)return d;let m=e[u]+t+o[y];if(!(r&&!m)){if(p+m.length>s)return d;d.push(m),p+=m.length}}return d}function Wg(e,t,o,i){let s=e.split(/\.\./),r=[];if(s[0]===void 0||s[1]===void 0)return r;let d=Ca(s[0]),p=Ca(s[1]),u=Math.max(s[0].length,s[1].length),y=s.length===3&&s[2]!==void 0?Math.max(Math.abs(Ca(s[2])),1):1,m=jg;p0){let v=new Array(N+1).join("0");R<0?S="-"+v+S.slice(1):S=v+S}}if(w+S.length>i)break;r.push(S),w+=S.length}return r}function Sa(e,t,o,i,s,r,d){if(s>i)return[e];let p=[""],u=0,y=!1,m=!0;for(;;){let b=ka("{","}",e);if(!b)return Lo(p,e,[""],t,o,y);let h=b.pre;if(/\$$/.test(h)){if(p=Lo(p,h+"{"+b.body+"}",[""],t,o,y&&!b.post.length),m=!1,!b.post.length)break;e=b.post;continue}let w=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(b.body),R=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(b.body),S=w||R,N=b.body.indexOf(",")>=0;if(!S&&!N){if(u=t||V+X.length>o)break e;v.push(X),V+=X.length}}}}if(p=Lo(p,h,v,t,o,y&&!b.post.length),!b.post.length)break;e=b.post}return p}var Kg={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}"],"[:alpha:]":["\\p{L}\\p{Nl}"],"[:ascii:]":["\\x00-\\x7f"],"[:blank:]":["\\p{Zs}\\t"],"[:cntrl:]":["\\p{Cc}"],"[:digit:]":["\\p{Nd}"],"[:graph:]":["\\p{Z}\\p{C}",!0],"[:lower:]":["\\p{Ll}"],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}\\p{S}"],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f"],"[:upper:]":["\\p{Lu}"],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],"[:xdigit:]":["A-Fa-f0-9"]},$o=e=>e.replace(/[[\]\\-]/g,"\\$&"),Ra=/$./,ec=(e,t,o=!1,i)=>{let s=v=>{let E=i?v.normalize(i):v;return[...E].length===1?E:v},r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let d=[],p=[],u=r+1,y=!1,m=!1,b=!1,h=r,w="";e:for(;uw.codePointAt(0)?d.push($o(w)+"-"+$o(E)):E===w&&d.push($o(E)),w="",u+=v.length;continue}if(e.startsWith("-]",u+v.length)){d.push($o(E+"-")),u+=v.length+1;continue}if(e.startsWith("-",u+v.length)){w=E,u+=v.length+1;continue}d.push($o(E)),u+=v.length}if(h({t:"lit",ch:e}),Xg=e=>e.replace(/[\\^$.*+?()[\]{}|/]/g,"\\$&"),oc=e=>new RegExp(`^${Xg(e)}$`,"iu"),Qi=new Map,ic=e=>{let t=Qi.get(e);return t||(t=oc(e),Qi.size>=1e3&&Qi.clear(),Qi.set(e,t)),t},Ma=(e,t)=>{if(t===e.ch)return!0;if(!e.re)return!1;let o=t.charCodeAt(0);if(o>=128)return e.re.test(t);let i=e.ascii??(e.ascii=new Uint8Array(128));return i[o]||(i[o]=e.re.test(t)?1:2),i[o]===1},Jg=(e,t,o,i)=>{let s=[];for(let r=0;r{let t=new Map,o=[];return e.forEach((i,s)=>{i.t==="open"?o.push(s):i.t==="close"&&o.length&&t.set(o.pop(),s)}),t},rc=(e,t,o,i,s)=>{let r=[],d=[r];for(let p=o;p{let o=[],i="",s=()=>{for(let r of i.normalize(t))o.push(us(r));i=""};for(let r of e){if(r.t==="lit"){i+=r.ch;continue}s(),o.push(r.t==="ext"?{...r,alts:r.alts.map(d=>ac(d,t))}:r)}return s(),o},Zg=(e,t)=>{let o=1,i=p=>({t:"split",id:o++,out:p}),s=(p,u)=>p.reduceRight((y,m)=>r(m,y),u),r=(p,u)=>{switch(p.t){case"lit":let h=t?ic(p.ch):void 0;return{t:"lit",id:o++,ch:p.ch,re:h,next:u};case"any":case"star":return{t:p.t,id:o++,next:u};case"class":return{t:"class",id:o++,re:p.re,next:u}}let y=h=>p.alts.map(w=>s(w,h));switch(p.type){case"@":return i(y(u));case"?":return i([u,...y(u)]);case"!":return{t:"neg",id:o++,sub:i(y(Da)),next:u}}let m=i([]),b=i(y(m));return m.out.push(u,b),p.type==="*"?m:b};return[s(e,Da),o]},xg=e=>{let t=[],o=new Set,i=r=>r.t==="match"?"match":String(r.id),s=(r,d)=>{if(r.t==="match"||o.has(r))return;o.add(r);let p=u=>t.push(`${d}${r.id}: ${u}`);switch(r.t){case"split":p(`split -> ${r.out.map(i).join(", ")}`);for(let u of r.out)s(u,d);return;case"neg":return p(`!(${i(r.sub)}) -> ${i(r.next)}`),s(r.sub,d+" "),s(r.next,d);case"lit":p(`${JSON.stringify(r.ch)} -> ${i(r.next)}`);break;case"class":p(`${r.re} -> ${i(r.next)}`);break;default:p(`${r.t==="any"?"?":"*"} -> ${i(r.next)}`)}s(r.next,d)};return s(e,""),[`start -> ${i(e)}`,...t].join(` `)},Pa=class{constructor(t){et(this,"gen");et(this,"threads",[]);et(this,"match",!1);et(this,"runs",[]);et(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},lc=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((o,i)=>o!==t.ids[i])?!1:e.runs.every(o=>t.runs.some(i=>i.neg===o.neg&&lc(i.state,o.state))),tc=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),cs,Bn,Aa,Ta,Uo=class{constructor(t,o,i){qe(this,Bn);et(this,"dots");et(this,"dotStart");qe(this,cs);this.dots=t,this.dotStart=o,$e(this,cs,i)}state(){return new Pa(++re(this,cs).gen)}done(t){return t.ids=t.threads.map(o=>o.id).sort((o,i)=>o-i),t.match&&t.ids.unshift(Da.id),t}restricted(t,o){return o&&(this.dots||this.dotStart&&t===0)}add(t,o,i,s){switch(o.t){case"split":if(!_e(this,Bn,Aa).call(this,t,o))return;for(let d of o.out)this.add(t,d,i,s);return;case"neg":if(!_e(this,Bn,Aa).call(this,t,o))return;let r=this.state();return this.add(r,o.sub,i,!1),this.done(r),this.addRun(t,{t:"run",neg:o,state:r},i,s);case"star":if(this.restricted(i,s))return;_e(this,Bn,Ta).call(this,t,o)&&this.add(t,o.next,i,s);return;case"match":t.match=!0;return;default:_e(this,Bn,Ta).call(this,t,o)}}addRun(t,o,i,s){for(let r of t.runs)if(r.neg===o.neg&&lc(r.state,o.state))return;t.runs.push(o),o.state.match||this.add(t,o.neg.next,i,s)}step(t,o,i,s){let r=this.state();for(let d of t.threads)switch(d.t){case"lit":Ma(d,o)&&this.add(r,d.next,i+1,s);break;case"any":this.restricted(i,s)||this.add(r,d.next,i+1,s);break;case"class":!this.restricted(i,s)&&d.re.test(o)&&this.add(r,d.next,i+1,s);break;case"star":this.restricted(i,s)||this.add(r,d,i+1,s)}if(!this.restricted(i,s))for(let d of t.runs){if(d.state.dead){this.addRun(r,d,i+1,s);continue}let p=this.step(d.state,o,i,!1);this.addRun(r,{t:"run",neg:d.neg,state:p},i+1,s)}return this.done(r)}};cs=new WeakMap,Bn=new WeakSet,Aa=function(t,o){let{seen:i}=re(this,cs);return i[o.id]===t.gen?!1:(i[o.id]=t.gen,!0)},Ta=function(t,o){let{has:i}=re(this,cs);return i[o.id]===t.gen?!1:(i[o.id]=t.gen,t.threads.push(o),!0)};var dc=e=>{let t=e.ids.join();if(!e.runs.length)return t;let o=e.runs.map(i=>`${i.neg.id}(${dc(i.state)})`);return`${t}|${o.sort().join("|")}`},ev=1<<18,Bs,zs,_n,ps,Ln,$n,Fn,sn,Ia,xi,uc,Oa=class{constructor(t,o){qe(this,sn);qe(this,Bs);qe(this,zs,new Map);qe(this,_n,0);qe(this,ps);qe(this,Ln);qe(this,$n);qe(this,Fn);$e(this,Bs,t),$e(this,$n,new Uo(!1,!1,o)),$e(this,Fn,new Uo(!1,!0,o))}start(t){if(t){if(re(this,Ln))return re(this,Ln);let i=re(this,Fn).state();return re(this,Fn).add(i,re(this,Bs),0,!0),$e(this,Ln,_e(this,sn,Ia).call(this,re(this,Fn).done(i)))}if(re(this,ps))return re(this,ps);let o=re(this,$n).state();return re(this,$n).add(o,re(this,Bs),0,!0),$e(this,ps,_e(this,sn,xi).call(this,re(this,$n).done(o)))}next(t,o){let i=o.charCodeAt(0),s=i<128?void 0:t.next.get(o);if(s)return s;let r=t===re(this,Ln)?_e(this,sn,xi).call(this,re(this,Fn).step(t.state,o,0,!0)):_e(this,sn,xi).call(this,re(this,$n).step(t.state,o,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),$e(this,_n,re(this,_n)+128)),t.ascii[i]=r):t.next.set(o,r),nl(this,_n)._++,r}};Bs=new WeakMap,zs=new WeakMap,_n=new WeakMap,ps=new WeakMap,Ln=new WeakMap,$n=new WeakMap,Fn=new WeakMap,sn=new WeakSet,Ia=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},xi=function(t){let o=dc(t),i=re(this,zs).get(o);if(i)return i;re(this,_n)>ev&&_e(this,sn,uc).call(this);let s=_e(this,sn,Ia).call(this,t);return re(this,zs).set(o,s),$e(this,_n,re(this,_n)+(o.length+1)),s},uc=function(){re(this,zs).clear(),$e(this,_n,0),$e(this,ps,void 0),$e(this,Ln,void 0)};var tv=e=>{let t=[];for(let o=e;o.t!=="match";o=o.next){if(o.t==="split"||o.t==="neg")return;t.push(o)}return t},nv=(e,t,o,i)=>{let s=0,r=o,d=-1,p=0;for(;r{let t=0,o=0;for(let i of e){let[s,r]=sv(i);t+=s,o+=r}return[t,o]},sv=e=>{if(e.t==="star")return[0,1/0];if(e.t!=="ext")return[1,1];if(e.type==="!")return[0,1/0];let t=e.alts.map(cc),o=Math.min(...t.map(r=>r[0])),i=Math.max(...t.map(r=>r[1])),s=i===0?0:1/0;return e.type==="@"?[o,i]:e.type==="?"?[0,i]:e.type==="*"?[0,s]:[o,s]},nc=(e,t,o)=>{for(let i=0;iiv.test(e)?[...e]:e,sc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},Un,Hs,fs,er,hs,zo,tr,ms,Ho,jo,Go,Dn,vn,js,Gs,Wo,nr,nn,gs,Fo,Bo=class{constructor(t,o={}){qe(this,gs);et(this,"pattern");et(this,"options");qe(this,Un);qe(this,Hs);qe(this,fs);qe(this,er);qe(this,hs);qe(this,zo,!1);qe(this,tr);qe(this,ms);qe(this,Ho,!1);qe(this,jo,0);qe(this,Go,1/0);qe(this,Dn,[]);qe(this,vn,[]);qe(this,js);qe(this,Gs);qe(this,Wo,!1);qe(this,nr);qe(this,nn);if(t.includes("/"))throw new Error("can only match a single path portion, got pattern: "+t);this.pattern=t,this.options=o;let{nocase:i=!1,noext:s=!1,normalize:r}=o;$e(this,nn,r===!0?"NFC":r||void 0);let d=/^[?*+@]\(\)$/.test(t),p=Jg(t,i,s||d,re(this,nn)),[u]=rc(p,Qg(p),0,p.length,!0);re(this,nn)&&(u=ac(u,re(this,nn)));let[y,m]=Zg(u,i);if($e(this,Un,y),$e(this,Hs,m),u.every(b=>b.t==="lit"))$e(this,hs,u.map(b=>b.ch).join("")),$e(this,zo,i);else{let b=R=>R.t!=="lit"?void 0:i?{ch:R.ch,re:ic(R.ch)}:{ch:R.ch};for(let R of u){let S=b(R);if(!S)break;re(this,Dn).push(S)}for(let R=u.length-1;R>=0;R--){let S=b(u[R]);if(!S)break;re(this,vn).unshift(S)}$e(this,Wo,!!(re(this,Dn).length||re(this,vn).length)),i||($e(this,js,re(this,Dn).map(R=>R.ch).join("")),$e(this,Gs,re(this,vn).map(R=>R.ch).join(""))),$e(this,ms,tv(re(this,Un))?.slice(re(this,Dn).length,-re(this,vn).length||void 0)),$e(this,Ho,!!re(this,ms)?.every(R=>R.t==="star"||R.t==="any"));let[h,w]=cc(u);$e(this,jo,h),$e(this,Go,w)}}test(t){return re(this,nn)?(sc(t),_e(this,gs,Fo).call(this,t.normalize(re(this,nn)))):ov.test(t)?(sc(t),_e(this,gs,Fo).call(this,t,[...t])):_e(this,gs,Fo).call(this,t,t)}testUnchecked(t){return _e(this,gs,Fo).call(this,re(this,nn)?t.normalize(re(this,nn)):t)}toString(){return xg(re(this,Un))}};Un=new WeakMap,Hs=new WeakMap,fs=new WeakMap,er=new WeakMap,hs=new WeakMap,zo=new WeakMap,tr=new WeakMap,ms=new WeakMap,Ho=new WeakMap,jo=new WeakMap,Go=new WeakMap,Dn=new WeakMap,vn=new WeakMap,js=new WeakMap,Gs=new WeakMap,Wo=new WeakMap,nr=new WeakMap,nn=new WeakMap,gs=new WeakSet,Fo=function(t,o){if(re(this,hs)!==void 0)return re(this,zo)?(re(this,tr)??$e(this,tr,oc(re(this,hs)))).test(t):t===re(this,hs);let i=re(this,jo),s=re(this,Go);if(o===void 0){let m=t.length,b=m+1>>1;if(ms)return!1;(bs)&&(o=Zi(t))}if(o!==void 0&&(o.lengths))return!1;let r=re(this,Dn).length;if(re(this,Wo))if(re(this,js)!==void 0&&re(this,Gs)!==void 0){if(!t.startsWith(re(this,js))||!t.endsWith(re(this,Gs)))return!1}else{o??(o=Zi(t));let m=o.length-re(this,vn).length;if(!nc(re(this,Dn),o,0)||!nc(re(this,vn),o,m))return!1}let d=!this.options.dot&&t.startsWith(".");if(re(this,ms)){if(t==="."||t===".."||d&&!r)return!1;if(re(this,Ho))return!0;o??(o=Zi(t));let m=o.length-re(this,vn).length;return nv(re(this,ms),o,r,m)}if(o??(o=Zi(t)),t==="."||t===".."){re(this,fs)??$e(this,fs,tc(re(this,Hs)));let m=re(this,er)??$e(this,er,new Uo(!0,!1,re(this,fs))),b=m.state();m.add(b,re(this,Un),0,!0);let h=m.done(b);for(let w=0;w{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var zn=(e,{windowsPathsNoEscape:t=!1,magicalBraces:o=!1}={})=>o?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var vs=(e,{windowsPathsNoEscape:t=!1,magicalBraces:o=!0}={})=>o?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var zt=(e,t,o={})=>(Ko(t),!o.nocomment&&t.charAt(0)==="#"?!1:av(t,o).match(e)),Ws=new Map,rv=256,av=(e,t)=>{let o=e+"\0"+JSON.stringify(t),i=Ws.get(o);return i?Ws.delete(o):(i=new ys(e,{...t}),Ws.size>=rv&&Ws.delete(Ws.keys().next().value)),Ws.set(o,i),i},vc=typeof process=="object"&&process?process.env?.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",pc={win32:{sep:"\\"},posix:{sep:"/"}},lv=vc==="win32"?pc.win32.sep:pc.posix.sep;zt.sep=lv;var vt=Symbol("globstar **");zt.GLOBSTAR=vt;var dv=(e,t={})=>o=>zt(o,e,t);zt.filter=dv;var Pn=(e,t={})=>Object.assign({},e,t),uv=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return zt;let t=zt;return Object.assign((i,s,r={})=>t(i,s,Pn(e,r)),{Minimatch:class extends t.Minimatch{constructor(s,r={}){super(s,Pn(e,r))}static defaults(s){return t.defaults(Pn(e,s)).Minimatch}},unescape:(i,s={})=>t.unescape(i,Pn(e,s)),escape:(i,s={})=>t.escape(i,Pn(e,s)),filter:(i,s={})=>t.filter(i,Pn(e,s)),defaults:i=>t.defaults(Pn(e,i)),braceExpand:(i,s={})=>t.braceExpand(i,Pn(e,s)),match:(i,s,r={})=>t.match(i,s,Pn(e,r)),sep:t.sep,GLOBSTAR:vt})};zt.defaults=uv;var yc=(e,t={})=>(Ko(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:xu(e,{max:t.braceExpandMax}));zt.braceExpand=yc;var cv=(e,t,o={})=>{let i=new ys(t,o);return e=e.filter(s=>i.match(s)),i.options.nonull&&!e.length&&e.push(t),e};zt.match=cv;var fc=/[?*]|[+@!]\(.*?\)|\[|\]/,bc=(e,t)=>{let o=t+1;(e.charAt(o)==="!"||e.charAt(o)==="^")&&o++;let i=!1;for(;o{if(!t&&(e==="+()"||e==="@()"))return e;let o="";for(let i=0;i{if(/^[?*+@]\(\)$/.test(e)||e.includes("[:"))return!1;let t=0;for(let o=0;otypeof e=="string"?t===e:t!==""&&e.testUnchecked(t),mc=(e,t,o,i,s)=>Hn(e,t)?o:i!==void 0&&Hn(e,i)?s:-1,$a=e=>e==="."||e==="..",qa=e=>typeof e=="string"&&/^[a-z]:$/i.test(e),or=e=>typeof e=="string"&&/^unc$/i.test(e),_a=e=>{if(e[0]!==""||e[1]!=="")return-1;let t=e[2]!=="?"?2:or(e[3])?4:-1,o=e[t],i=e[t+1];return t!==-1&&o!==void 0&&o!==""&&o!==vt&&i!==void 0&&i!==""&&i!==vt?t:-1},sr=(e,t)=>!$a(e)&&(t||!e.startsWith(".")),Yo=(e,t,o,i,s)=>{for(let r=t;r=o||rr(e.charCodeAt(p),s))return!0}let d=Fa(e,r,s);if(d===-1)return!1;for(r=d+1;rt==="/"?e===47:t==="\\"?e===92:e===47||e===92,Fa=(e,t,o)=>{if(o!=="both")return e.indexOf(o,t);let i=e.indexOf("/",t),s=e.indexOf("\\",t);return i===-1?s:s===-1?i:Math.min(i,s)},gc=(e,t,o)=>o!=="both"?e.lastIndexOf(o,t):Math.max(e.lastIndexOf("/",t),e.lastIndexOf("\\",t)),La={},jn,Ys,Gn,An,Xs,Js,Wn,Jo,Qs,Qo,Le,ir,Xo,wc,kc,Cc,Ec,Sc,Nc,Ua,Rc,Dc,Ba,Ks,za,ys=class{constructor(t,o={}){qe(this,Le);et(this,"options");et(this,"set");et(this,"pattern");et(this,"windowsPathsNoEscape");et(this,"nonegate");et(this,"negate");et(this,"comment");et(this,"empty");et(this,"preserveMultipleSlashes");et(this,"partial");et(this,"globSet");et(this,"globParts");et(this,"nocase");et(this,"isWindows");et(this,"platform");et(this,"windowsNoMagicRoot");et(this,"maxGlobstarRecursion");qe(this,jn);qe(this,Ys);qe(this,Gn);qe(this,An);qe(this,Xs,[]);qe(this,Js,[]);qe(this,Wn,[]);qe(this,Jo,new Map);qe(this,Qs,!1);qe(this,Qo,new WeakMap);Ko(t),o=o||{},this.options=o,this.maxGlobstarRecursion=o.maxGlobstarRecursion??200,this.pattern=t,this.platform=o.platform||vc,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!o.windowsPathsNoEscape||o[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!o.preserveMultipleSlashes,this.negate=!1,this.nonegate=!!o.nonegate,this.comment=!1,this.empty=!1,this.partial=!!o.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=o.windowsNoMagicRoot!==void 0?o.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],$e(this,jn,!this.preserveMultipleSlashes),$e(this,Gn,(o.optimizationLevel??1)>=2);let s=o.normalize;$e(this,An,s===!0?"NFC":s||void 0),this.make();let r=this.set.map(d=>_e(this,Le,Xo).call(this,d));$e(this,Wn,this.set.map((d,p)=>re(this,jn)&&d.length-1>r[p])),$e(this,Xs,this.set.map((d,p)=>{let u=re(this,Wn)[p]?d.length-1:d.length,y=d.slice(r[p]+1,u).filter(m=>typeof m=="string"&&!!m);return[...new Set(y)]})),$e(this,Ys,re(this,Xs).some(d=>d.length)),$e(this,Js,this.set.map((d,p)=>{let[u,y,m]=d;if(re(this,Wn)[p]&&d.length===2&&u===vt&&y!==vt)return"tail";if(re(this,Wn)[p]&&o.matchBase&&d.length===1&&u!==vt&&u!=="")return"base";if(!(!re(this,jn)||r[p]!==-1)){if(d.length===3&&u===vt&&m===vt&&y!==vt&&y!==""&&this.maxGlobstarRecursion>0)return"mid";if(d.length===2&&y===vt&&u!==vt&&u!=="")return"head"}}))}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let o of t)if(typeof o!="string")return!0;return!1}make(){let t=this.pattern,o=this.options;if(!o.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())];let i=this.globSet.map(r=>_e(this,Le,za).call(this,r));this.globParts=this.preprocess(i),$e(this,Qs,!0);let s=this.globParts.map((r,d,p)=>{if(this.isWindows&&this.windowsNoMagicRoot){let u=r[2]==="?"&&or(r[3])?6:4,y=r[0]===""&&r[1]===""&&(r[2]==="?"||!fc.test(r[2]))&&r.slice(3,u).every(b=>!fc.test(b)),m=/^[a-z]:/i.test(r[0]);if(y)return[...r.slice(0,u).map(b=>_e(this,Le,ir).call(this,b)),...r.slice(u).map(b=>this.parse(b))];if(m)return[_e(this,Le,ir).call(this,r[0]),...r.slice(1).map(b=>this.parse(b))]}return r.map(u=>this.parse(u))});if(this.set=s.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r{for(let p=0;pi.length));for(let i=0;i{if(!(d[i]instanceof Bo||d[i]===La)||!fv(this.globParts[p][i]))return;let u=[...this.globParts[p]];u[i]="";let y=`${d.length}/${u.join("/")}`,m=s.get(y);m?m.push(p):s.set(y,[p])});let r=new Set;for(let d of s.values()){if(d.length<2)continue;let[p,...u]=d,m=`@(${d.map(b=>this.globParts[b][i]).join("|")})`;this.globParts[p][i]=m,this.set[p][i]=this.parse(m);for(let b of u)r.add(b)}r.size&&(t=!0,this.set=this.set.filter((d,p)=>!r.has(p)),this.globParts=this.globParts.filter((d,p)=>!r.has(p)))}}}preprocess(t){if(this.options.noglobstar)for(let i of t)for(let s=0;s=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):o>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(o=>{let i=-1;for(;(i=o.indexOf("**",i+1))!==-1;){let s=i;for(;o[s+1]==="**";)s++;s!==i&&o.splice(i,s-i)}return o})}levelOneOptimize(t){return t.map(o=>{let i=_e(this,Le,Xo).call(this,o)+1;return o=o.reduce((s,r)=>{let d=s[s.length-1];return r==="**"&&d==="**"?s:r===".."&&s.length>i&&d&&d!==".."&&d!=="."&&d!=="**"?(s.pop(),s):(s.push(r),s)},[]),o.length===0?[""]:o})}firstPhasePreProcess(t){let{braceExpandMax:o=1e5}=this.options,i=!1;do{i=!1;for(let s of t){let r=-1;for(;(r=s.indexOf("**",r+1))!==-1;){let u=r;for(;s[u+1]==="**";)u++;u>r&&s.splice(r+1,u-r);let y=s[r+1],m=s[r+2],b=s[r+3];if(y!==".."||!m||m==="."||m===".."||!b||b==="."||b===".."||t.length>=o)continue;i=!0,s.splice(r,1);let h=s.slice(0);h[r]="**",t.push(h),r--}if(!this.preserveMultipleSlashes){for(let u=1;u1e3)return t;for(let o=0;oo.length)}partsMatch(t,o,i=!1){let s=0,r=0,d=[],p="";for(;s=0;y--)u=r[y];for(let y=0;y=0){let v=S;for(;v>0&&rr(t.charCodeAt(v-1),o);)v--;p=v===0?0:gc(t,v-1,o)+1,d=t.slice(p,v)}let N=re(this,Gn)&&($a(s)||s===""&&d!==void 0&&$a(d));i=N?-1:1,h=!N}let w=-1;if(h&&typeof b=="string"&&(w=mc(b,s,r,d,p),w===-1))continue;if(re(this,Ys)){for(let S of re(this,Xs)[y])if(!t.includes(S))continue e}if(h&&typeof b=="object"&&(w=mc(b,s,r,d,p),w===-1))continue;let R=re(this,Js)[y];if(R==="base"&&h)return"yes";if(R==="tail"&&h){if(re(this,Gn)&&Yo(t,0,w,!0,o))return"maybe";if(!Yo(t,0,w,u,o))return"yes";continue}if(R==="mid"||R==="head"){let S=_e(this,Le,Cc).call(this,t,m,R==="head",u,o);if(S!=="no")return S;continue}return"maybe"}return"no"},kc=function(t,o,i){let s=!!this.options.dot,r=t.length;if(i==="head"){if(r<2||!Hn(o[0],t[0]))return!1;for(let p=1;pp&&d.testUnchecked(t.slice(p,u)))&&!Yo(t,y,t.length,s,r))return"yes";if(i||Yo(t,p,y,s,r))return"no";p=y}return"no"},Ec=function(t){let o=Va;return o?.f===t&&o.isWindows===this.isWindows&&o.preserveMultipleSlashes===this.preserveMultipleSlashes&&o.normalize===re(this,An)?o:void 0},Sc=function(t){let{isWindows:o,preserveMultipleSlashes:i}=this,s=_e(this,Le,za).call(this,o?t.split("\\").join("/"):t),r=re(this,An);return r&&(s=s.map(d=>d.normalize(r))),Va={f:t,isWindows:o,preserveMultipleSlashes:i,normalize:r,parts:s},Va},Nc=function(t){let o=[...t],i=!1;do{if(i=!1,!this.preserveMultipleSlashes){for(let d=1;dt.length)return!1;let b=t.length-u.length;if(_e(this,Le,Ks).call(this,t,u,i,b,0))m=u.length;else{if(t[t.length-1]!==""||s+u.length===t.length||(b--,!_e(this,Le,Ks).call(this,t,u,i,b,0)))return!1;m=u.length+1}}if(!p.length){let b=!!m;for(let h=s;h{v[1]=R-S[E]});let N={head:y,body:m,tail:b,segments:h};return s[r]=N,N},Ba=function(t,o,i,s,r,d,p,u,y){let m=o[r];if(!m){if(d)return s>=i||s===i-1&&t[s]==="";for(let R=s;Re.lastIndexOf(t)===o)}function ja(e){let t=(e||[]).filter(o=>typeof o=="string"&&o.length>0).map(o=>{let{negated:i,anchored:s,directoryOnly:r,body:d}=hv(o);return{negated:i,directoryOnly:r,matcher:new ys(d,{dot:!0,nonegate:!0,nocomment:!0,matchBase:!s&&!d.includes("/")})}});return(o,i=!1)=>{let s=(o||"").replace(/^\/+/,"");if(!s)return!1;let r=s.split("/"),d=r.slice(0,-1).map((u,y)=>r.slice(0,y+1).join("/")),p=i;for(let u of t){if(u.negated?!p:p)continue;(u.directoryOnly?d:[...d,s]).some(m=>u.matcher.match(m))&&(p=!u.negated)}return p}}var gee=new Set("^$\\.*+?()[]{}|/dDsSwWbBnrtvf0cxupP".split(""));function Ga(e){let t=e.indexOf("=>");if(t<0)return{term:e,replacement:null};let o=e.slice(0,t).replace(/\s+$/,""),i=e.slice(t+2).replace(/^\s+/,"");return o?{term:o,replacement:i}:{term:e,replacement:null}}var Pc=new Set(["*","+","?","(",")","[","]","{","}","|","^","$"]);function Ac(e){let t=[];return String(e||"").split(` `).forEach((o,i)=>{let{term:s}=Ga(o.trim());if(!s)return;let r=[];for(let d=0;d request.url.searchParams.get("offset") === "250" + "/api/admin/errors": request => request.url.searchParams.get("offset") === "250" || Number(request.url.searchParams.get("limit")) >= 251 ? {entries:[{ts:new Date().toISOString(),level:"error",module:"queue",message:"upstream_error",raw:[{code:"upstream_error",status:502}]}],available:true,total:251,nextOffset:251} : {entries:[],available:true,total:251,nextOffset:250,redactedEntries:250}, }); @@ -135,6 +135,9 @@ describe("Vue 3 UI", function () { const button=ui.window.document.querySelector(".errors-pager button"); expect(button).not.to.equal(null); button.click(); await delay(40); expect(ui.window.document.body.textContent).to.include("upstream_error").and.include("invalid legacy records were omitted"); + ui.window.document.querySelector('button[aria-label="Refresh"]').click(); await delay(40); + expect(ui.requests.filter(r => r.url.pathname === "/api/admin/errors").at(-1).url.searchParams.get("limit")).to.equal("251"); + expect(ui.window.document.body.textContent).to.include("upstream_error"); expect(ui.errors).to.deep.equal([]); });