From 9a4751692fc2eee07ebd98c767c1b49b4aafb918 Mon Sep 17 00:00:00 2001 From: admin <362324317@qq.com> Date: Sun, 17 May 2026 04:20:30 +0800 Subject: [PATCH] v0.3.2: fix 401 on save-records fetch + fix 429 rate limiter behind proxy - AdminDashboard: M() now sends admin_token from localStorage with fetch - rate-limit: keyGenerator uses req.ip instead of req.socket.remoteAddress (Express trust proxy reads X-Forwarded-For for real client IP) - main.ts: moved global rateLimiter after express.static so static files (JS/CSS/admin page/favicon) are never rate-limited --- VERSION | 2 +- .../frontend/assets/AdminDashboard-CYT9FxBx.js | 2 +- source_clean/src/main.ts | 5 +++-- source_clean/src/middleware/rate-limit.ts | 12 ++++++------ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/VERSION b/VERSION index 9e11b32..d15723f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.1 +0.3.2 diff --git a/source_clean/frontend/assets/AdminDashboard-CYT9FxBx.js b/source_clean/frontend/assets/AdminDashboard-CYT9FxBx.js index 4db596b..c0e40e1 100644 --- a/source_clean/frontend/assets/AdminDashboard-CYT9FxBx.js +++ b/source_clean/frontend/assets/AdminDashboard-CYT9FxBx.js @@ -36,4 +36,4 @@ PERFORMANCE OF THIS SOFTWARE. `:"
",g=h.join(y);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(e,u)?this._updatePosition(s,v,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,g,u,Math.random()+"",o[0],o[1],v,null,c)})},t.prototype._showSeriesItemTooltip=function(e,i,n){var a=this._ecModel,o=ft(i),s=o.seriesIndex,l=a.getSeriesByIndex(s),u=o.dataModel||l,f=o.dataIndex,h=o.dataType,c=u.getData(h),v=this._renderMode,d=e.positionDefault,p=Wn([c.getItemModel(f),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),y=p.get("trigger");if(!(y!=null&&y!=="item")){var g=u.getDataParams(f,h),m=new pu;g.marker=m.makeTooltipMarker("item",Ai(g.color),v);var _=kd(u.formatTooltip(f,!1,h)),S=p.get("order"),b=p.get("valueFormatter"),w=_.frag,x=w?Nd(b?z({valueFormatter:b},w):w,m,v,S,a.get("useUTC"),p.get("textStyle")):_.text,C="item_"+u.name+"_"+f;this._showOrMove(p,function(){this._showTooltipContent(p,x,g,C,e.offsetX,e.offsetY,e.position,e.target,m)}),n({type:"showTip",dataIndexInside:f,dataIndex:c.getRawIndex(f),seriesIndex:s,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,i,n){var a=this._renderMode==="html",o=ft(i),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(Y(l)){var f=l;l={content:f,formatter:f},u=!0}u&&a&&l.content&&(l=at(l),l.content=Qt(l.content));var h=[l],c=this._ecModel.getComponent(o.componentMainType,o.componentIndex);c&&h.push(c),h.push({formatter:l.content});var v=e.positionDefault,d=Wn(h,this._tooltipModel,v?{position:v}:null),p=d.get("content"),y=Math.random()+"",g=new pu;this._showOrMove(d,function(){var m=at(d.get("formatterParams")||{});this._showTooltipContent(d,p,m,y,e.offsetX,e.offsetY,e.position,i,g)}),n({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(e,i,n,a,o,s,l,u,f){if(this._ticket="",!(!e.get("showContent")||!e.get("show"))){var h=this._tooltipContent;h.setEnterable(e.get("enterable"));var c=e.get("formatter");l=l||e.get("position");var v=i,d=this._getNearestPoint([o,s],n,e.get("trigger"),e.get("borderColor"),e.get("defaultBorderColor",!0)),p=d.color;if(c)if(Y(c)){var y=e.ecModel.get("useUTC"),g=V(n)?n[0]:n,m=g&&g.axisType&&g.axisType.indexOf("time")>=0;v=c,m&&(v=hl(g.axisValue,v,y)),v=Lm(v,n,!0)}else if(tt(c)){var _=nt(function(S,b){S===this._ticket&&(h.setContent(b,f,e,p,l),this._updatePosition(e,l,o,s,h,n,u))},this);this._ticket=a,v=c(n,a,_)}else v=c;h.setContent(v,f,e,p,l),h.show(e,p),this._updatePosition(e,l,o,s,h,n,u)}},t.prototype._getNearestPoint=function(e,i,n,a,o){if(n==="axis"||V(i))return{color:a||o};if(!V(i))return{color:a||i.color||i.borderColor}},t.prototype._updatePosition=function(e,i,n,a,o,s,l){var u=this._api.getWidth(),f=this._api.getHeight();i=i||e.get("position");var h=o.getSize(),c=e.get("align"),v=e.get("verticalAlign"),d=l&&l.getBoundingRect().clone();if(l&&d.applyTransform(l.transform),tt(i)&&(i=i([n,a],s,o.el,d,{viewSize:[u,f],contentSize:h.slice()})),V(i))n=Pt(i[0],u),a=Pt(i[1],f);else if(q(i)){var p=i;p.width=h[0],p.height=h[1];var y=gn(p,{width:u,height:f});n=y.x,a=y.y,c=null,v=null}else if(Y(i)&&l){var g=tI(i,d,h,e.get("borderWidth"));n=g[0],a=g[1]}else{var g=J2(n,a,o,u,f,c?null:20,v?null:20);n=g[0],a=g[1]}if(c&&(n-=Pg(c)?h[0]/2:c==="right"?h[0]:0),v&&(a-=Pg(v)?h[1]/2:v==="bottom"?h[1]:0),V_(e)){var g=j2(n,a,o,u,f);n=g[0],a=g[1]}o.moveTo(n,a)},t.prototype._updateContentNotChangedOnAxis=function(e,i){var n=this._lastDataByCoordSys,a=this._cbParamsList,o=!!n&&n.length===e.length;return o&&T(n,function(s,l){var u=s.dataByAxis||[],f=e[l]||{},h=f.dataByAxis||[];o=o&&u.length===h.length,o&&T(u,function(c,v){var d=h[v]||{},p=c.seriesDataIndices||[],y=d.seriesDataIndices||[];o=o&&c.value===d.value&&c.axisType===d.axisType&&c.axisId===d.axisId&&p.length===y.length,o&&T(p,function(g,m){var _=y[m];o=o&&g.seriesIndex===_.seriesIndex&&g.dataIndex===_.dataIndex}),a&&T(c.seriesDataIndices,function(g){var m=g.seriesIndex,_=i[m],S=a[m];_&&S&&S.data!==_.data&&(o=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=i,!!o},t.prototype._hide=function(e){this._lastDataByCoordSys=null,e({type:"hideTip",from:this.uid})},t.prototype.dispose=function(e,i){et.node||!i.getDom()||(Ps(this,"_updatePosition"),this._tooltipContent.dispose(),hh("itemTooltip",i))},t.type="tooltip",t}(be);function Wn(r,t,e){var i=t.ecModel,n;e?(n=new Ct(e,i,i),n=new Ct(t.option,n,i)):n=t;for(var a=r.length-1;a>=0;a--){var o=r[a];o&&(o instanceof Ct&&(o=o.get("tooltip",!0)),Y(o)&&(o={formatter:o}),o&&(n=new Ct(o,n,i)))}return n}function Ig(r,t){return r.dispatchAction||nt(t.dispatchAction,t)}function J2(r,t,e,i,n,a,o){var s=e.getSize(),l=s[0],u=s[1];return a!=null&&(r+l+a+2>i?r-=l+a:r+=a),o!=null&&(t+u+o>n?t-=u+o:t+=o),[r,t]}function j2(r,t,e,i,n){var a=e.getSize(),o=a[0],s=a[1];return r=Math.min(r+o,i)-o,t=Math.min(t+s,n)-s,r=Math.max(r,0),t=Math.max(t,0),[r,t]}function tI(r,t,e,i){var n=e[0],a=e[1],o=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=t.width,f=t.height;switch(r){case"inside":s=t.x+u/2-n/2,l=t.y+f/2-a/2;break;case"top":s=t.x+u/2-n/2,l=t.y-a-o;break;case"bottom":s=t.x+u/2-n/2,l=t.y+f+o;break;case"left":s=t.x-n-o,l=t.y+f/2-a/2;break;case"right":s=t.x+u+o,l=t.y+f/2-a/2}return[s,l]}function Pg(r){return r==="center"||r==="middle"}function eI(r,t,e){var i=Ih(r).queryOptionMap,n=i.keys()[0];if(!(!n||n==="series")){var a=Va(t,n,i.get(n),{useDefault:!1,enableAll:!1,enableNone:!1}),o=a.models[0];if(o){var s=e.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var f=ft(u).tooltipConfig;if(f&&f.name===r.name)return l=u,!0}),l)return{componentMainType:n,componentIndex:o.componentIndex,el:l}}}}function rI(r){Br(F_),r.registerComponentModel(z2),r.registerComponentView(Q2),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},ee),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},ee)}function iI(r,t){if(!r)return!1;for(var e=V(r)?r:[r],i=0;i=0&&(s[o]=+s[o].toFixed(d)),[s,v]}var Uo={min:St(Wo,"min"),max:St(Wo,"max"),average:St(Wo,"average"),median:St(Wo,"median")};function kg(r,t){if(t){var e=r.getData(),i=r.coordinateSystem,n=i&&i.dimensions;if(!aI(t)&&!V(t.coord)&&V(n)){var a=U_(t,e,i,r);if(t=at(t),t.type&&Uo[t.type]&&a.baseAxis&&a.valueAxis){var o=ot(n,a.baseAxis.dim),s=ot(n,a.valueAxis.dim),l=Uo[t.type](e,a.valueAxis.dim,a.baseDataDim,a.valueDataDim,o,s);t.coord=l[0],t.value=l[1]}else t.coord=[t.xAxis!=null?t.xAxis:t.radiusAxis,t.yAxis!=null?t.yAxis:t.angleAxis]}if(t.coord==null||!V(n)){t.coord=[];var u=r.getBaseAxis();if(u&&t.type&&Uo[t.type]){var f=i.getOtherAxis(u);f&&(t.value=Us(e,e.mapDimension(f.dim),t.type))}}else for(var h=t.coord,c=0;c<2;c++)Uo[h[c]]&&(h[c]=Us(e,e.mapDimension(n[c]),h[c]));return t}}function U_(r,t,e,i){var n={};return r.valueIndex!=null||r.valueDim!=null?(n.valueDataDim=r.valueIndex!=null?t.getDimension(r.valueIndex):r.valueDim,n.valueAxis=e.getAxis(oI(i,n.valueDataDim)),n.baseAxis=e.getOtherAxis(n.valueAxis),n.baseDataDim=t.mapDimension(n.baseAxis.dim)):(n.baseAxis=i.getBaseAxis(),n.valueAxis=e.getOtherAxis(n.baseAxis),n.baseDataDim=t.mapDimension(n.baseAxis.dim),n.valueDataDim=t.mapDimension(n.valueAxis.dim)),n}function oI(r,t){var e=r.getData().getDimensionInfo(t);return e&&e.coordDim}function Rg(r,t){return r&&r.containData&&t.coord&&!nI(t)?r.containData(t.coord):!0}function sI(r,t){return r?function(e,i,n,a){var o=a<2?e.coord&&e.coord[a]:e.value;return vn(o,t[a])}:function(e,i,n,a){return vn(e.value,t[a])}}function Us(r,t,e){if(e==="average"){var i=0,n=0;return r.each(t,function(a,o){isNaN(a)||(i+=a,n++)}),i/n}else return e==="median"?r.getMedian(t):r.getDataExtent(t)[e==="max"?1:0]}var Wu=bt(),lI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e}return t.prototype.init=function(){this.markerGroupMap=rt()},t.prototype.render=function(e,i,n){var a=this,o=this.markerGroupMap;o.each(function(s){Wu(s).keep=!1}),i.eachSeries(function(s){var l=Sn.getMarkerModelFromSeries(s,a.type);l&&a.renderSeries(s,l,i,n)}),o.each(function(s){!Wu(s).keep&&a.group.remove(s.group)}),uI(i,o,this.type)},t.prototype.markKeep=function(e){Wu(e).keep=!0},t.prototype.toggleBlurSeries=function(e,i){var n=this;T(e,function(a){var o=Sn.getMarkerModelFromSeries(a,n.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(i?Hy(l):Nh(l))})}})},t.type="marker",t}(be);function uI(r,t,e){r.eachSeries(function(i){var n=Sn.getMarkerModelFromSeries(i,e),a=t.get(i.id);if(n&&a&&a.group){var o=Xh(n),s=o.z,l=o.zlevel;Zh(a.group,s,l)}})}var fI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e}return t.prototype.createMarkerModelFromSeries=function(e,i,n){return new t(e,i,n)},t.type="markLine",t.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},t}(Sn),Yo=bt(),hI=function(r,t,e,i){var n=r.getData(),a;if(V(i))a=i;else{var o=i.type;if(o==="min"||o==="max"||o==="average"||o==="median"||i.xAxis!=null||i.yAxis!=null){var s=void 0,l=void 0;if(i.yAxis!=null||i.xAxis!=null)s=t.getAxis(i.yAxis!=null?"y":"x"),l=ga(i.yAxis,i.xAxis);else{var u=U_(i,n,t,r);s=u.valueAxis;var f=F0(n,u.valueDataDim);l=Us(n,f,o)}var h=s.dim==="x"?0:1,c=1-h,v=at(i),d={coord:[]};v.type=null,v.coord=[],v.coord[c]=-1/0,d.coord[c]=1/0;var p=e.get("precision");p>=0&&pt(l)&&(l=+l.toFixed(Math.min(p,20))),v.coord[h]=d.coord[h]=l,a=[v,d,{type:o,valueIndex:i.valueIndex,value:l}]}else a=[]}var y=[kg(r,a[0]),kg(r,a[1]),z({},a[2])];return y[2].type=y[2].type||null,lt(y[2],y[0]),lt(y[2],y[1]),y};function Ys(r){return!isNaN(r)&&!isFinite(r)}function Eg(r,t,e,i){var n=1-r,a=i.dimensions[r];return Ys(t[n])&&Ys(e[n])&&t[r]===e[r]&&i.getAxis(a).containData(t[r])}function cI(r,t){if(r.type==="cartesian2d"){var e=t[0].coord,i=t[1].coord;if(e&&i&&(Eg(1,e,i,r)||Eg(0,e,i,r)))return!0}return Rg(r,t[0])&&Rg(r,t[1])}function Uu(r,t,e,i,n){var a=i.coordinateSystem,o=r.getItemModel(t),s,l=Pt(o.get("x"),n.getWidth()),u=Pt(o.get("y"),n.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(i.getMarkerPosition)s=i.getMarkerPosition(r.getValues(r.dimensions,t));else{var f=a.dimensions,h=r.get(f[0],t),c=r.get(f[1],t);s=a.dataToPoint([h,c])}if(yl(a,"cartesian2d")){var v=a.getAxis("x"),d=a.getAxis("y"),f=a.dimensions;Ys(r.get(f[0],t))?s[0]=v.toGlobalCoord(v.getExtent()[e?0:1]):Ys(r.get(f[1],t))&&(s[1]=d.toGlobalCoord(d.getExtent()[e?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}r.setItemLayout(t,s)}var vI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e}return t.prototype.updateTransform=function(e,i,n){i.eachSeries(function(a){var o=Sn.getMarkerModelFromSeries(a,"markLine");if(o){var s=o.getData(),l=Yo(o).from,u=Yo(o).to;l.each(function(f){Uu(l,f,!0,a,n),Uu(u,f,!1,a,n)}),s.each(function(f){s.setItemLayout(f,[l.getItemLayout(f),u.getItemLayout(f)])}),this.markerGroupMap.get(a.id).updateLayout()}},this)},t.prototype.renderSeries=function(e,i,n,a){var o=e.coordinateSystem,s=e.id,l=e.getData(),u=this.markerGroupMap,f=u.get(s)||u.set(s,new t2);this.group.add(f.group);var h=dI(o,e,i),c=h.from,v=h.to,d=h.line;Yo(i).from=c,Yo(i).to=v,i.setData(d);var p=i.get("symbol"),y=i.get("symbolSize"),g=i.get("symbolRotate"),m=i.get("symbolOffset");V(p)||(p=[p,p]),V(y)||(y=[y,y]),V(g)||(g=[g,g]),V(m)||(m=[m,m]),h.from.each(function(S){_(c,S,!0),_(v,S,!1)}),d.each(function(S){var b=d.getItemModel(S),w=b.getModel("lineStyle").getLineStyle();d.setItemLayout(S,[c.getItemLayout(S),v.getItemLayout(S)]);var x=b.get("z2");w.stroke==null&&(w.stroke=c.getItemVisual(S,"style").fill),d.setItemVisual(S,{z2:$(x,0),fromSymbolKeepAspect:c.getItemVisual(S,"symbolKeepAspect"),fromSymbolOffset:c.getItemVisual(S,"symbolOffset"),fromSymbolRotate:c.getItemVisual(S,"symbolRotate"),fromSymbolSize:c.getItemVisual(S,"symbolSize"),fromSymbol:c.getItemVisual(S,"symbol"),toSymbolKeepAspect:v.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:v.getItemVisual(S,"symbolOffset"),toSymbolRotate:v.getItemVisual(S,"symbolRotate"),toSymbolSize:v.getItemVisual(S,"symbolSize"),toSymbol:v.getItemVisual(S,"symbol"),style:w})}),f.updateData(d),h.line.eachItemGraphicEl(function(S){ft(S).dataModel=i,S.traverse(function(b){ft(b).dataModel=i})});function _(S,b,w){var x=S.getItemModel(b);Uu(S,b,w,e,a);var C=x.getModel("itemStyle").getItemStyle();C.fill==null&&(C.fill=f0(l,"color")),S.setItemVisual(b,{symbolKeepAspect:x.get("symbolKeepAspect"),symbolOffset:$(x.get("symbolOffset",!0),m[w?0:1]),symbolRotate:$(x.get("symbolRotate",!0),g[w?0:1]),symbolSize:$(x.get("symbolSize"),y[w?0:1]),symbol:$(x.get("symbol",!0),p[w?0:1]),style:C})}this.markKeep(f),f.group.silent=i.get("silent")||e.get("silent")},t.type="markLine",t}(lI);function dI(r,t,e){var i;r?i=Z(r&&r.dimensions,function(u){var f=t.getData().getDimensionInfo(t.getData().mapDimension(u))||{};return z(z({},f),{name:u,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var n=new ss(i,e),a=new ss(i,e),o=new ss([],e),s=Z(e.get("data"),St(hI,t,r,e));r&&(s=It(s,St(cI,r)));var l=sI(!!r,i);return n.initData(Z(s,function(u){return u[0]}),null,l),a.initData(Z(s,function(u){return u[1]}),null,l),o.initData(Z(s,function(u){return u[2]})),o.hasItemOption=!0,{from:n,to:a,line:o}}function pI(r){r.registerComponentModel(fI),r.registerComponentView(vI),r.registerPreprocessor(function(t){iI(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var gI=function(r,t){if(t==="all")return{type:"all",title:r.getLocaleModel().get(["legend","selector","all"])};if(t==="inverse")return{type:"inverse",title:r.getLocaleModel().get(["legend","selector","inverse"])}},ch=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e.layoutMode={type:"box",ignoreSize:!0},e}return t.prototype.init=function(e,i,n){this.mergeDefaultAndTheme(e,n),e.selected=e.selected||{},this._updateSelector(e)},t.prototype.mergeOption=function(e,i){r.prototype.mergeOption.call(this,e,i),this._updateSelector(e)},t.prototype._updateSelector=function(e){var i=e.selector,n=this.ecModel;i===!0&&(i=e.selector=["all","inverse"]),V(i)&&T(i,function(a,o){Y(a)&&(a={type:a}),i[o]=lt(a,gI(n,a.type))})},t.prototype.optionUpdated=function(){this._updateData(this.ecModel);var e=this._data;if(e[0]&&this.get("selectedMode")==="single"){for(var i=!1,n=0;n=0},t.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},t.type="legend.plain",t.dependencies=["series"],t.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",bottom:W.size.m,align:"auto",backgroundColor:W.color.transparent,borderColor:W.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:W.color.disabled,inactiveBorderColor:W.color.disabled,inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:W.color.disabled,inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:W.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:W.color.tertiary,borderWidth:1,borderColor:W.color.border},emphasis:{selectorLabel:{show:!0,color:W.color.quaternary}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(ct),Ji=St,vh=T,Xo=Mt,Y_=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e.newlineDisabled=!1,e}return t.prototype.init=function(){this.group.add(this._contentGroup=new Xo),this.group.add(this._selectorGroup=new Xo),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,i,n){var a=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!e.get("show",!0)){var o=e.get("align"),s=e.get("orient");(!o||o==="auto")&&(o=e.get("left")==="right"&&s==="vertical"?"right":"left");var l=e.get("selector",!0),u=e.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,e,i,n,l,s,u);var f=sc(e,n).refContainer,h=e.getBoxLayoutParams(),c=e.get("padding"),v=gn(h,f,c),d=this.layoutInner(e,o,v,a,l,u),p=gn(gt({width:d.width,height:d.height},h),f,c);this.group.x=p.x-d.x,this.group.y=p.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=N2(d,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,i,n,a,o,s,l){var u=this.getContentGroup(),f=rt(),h=i.get("selectedMode"),c=i.get("triggerEvent"),v=[];n.eachRawSeries(function(d){!d.get("legendHoverLink")&&v.push(d.id)}),vh(i.getData(),function(d,p){var y=this,g=d.get("name");if(!this.newlineDisabled&&(g===""||g===` `)){var m=new Xo;m.newline=!0,u.add(m);return}var _=n.getSeriesByName(g)[0];if(!f.get(g))if(_){var S=_.getData(),b=S.getVisual("legendLineStyle")||{},w=S.getVisual("legendIcon"),x=S.getVisual("style"),C=this._createItem(_,g,p,d,i,e,b,x,w,h,a);C.on("click",Ji(Og,g,null,a,v)).on("mouseover",Ji(dh,_.name,null,a,v)).on("mouseout",Ji(ph,_.name,null,a,v)),n.ssr&&C.eachChild(function(D){var A=ft(D);A.seriesIndex=_.seriesIndex,A.dataIndex=p,A.ssrType="legend"}),c&&C.eachChild(function(D){y.packEventData(D,i,_,p,g)}),f.set(g,!0)}else n.eachRawSeries(function(D){var A=this;if(!f.get(g)&&D.legendVisualProvider){var M=D.legendVisualProvider;if(!M.containName(g))return;var I=M.indexOfName(g),L=M.getItemVisual(I,"style"),P=M.getItemVisual(I,"legendIcon"),k=Xe(L.fill);k&&k[3]===0&&(k[3]=.2,L=z(z({},L),{fill:za(k,"rgba")}));var B=this._createItem(D,g,p,d,i,e,{},L,P,h,a);B.on("click",Ji(Og,null,g,a,v)).on("mouseover",Ji(dh,null,g,a,v)).on("mouseout",Ji(ph,null,g,a,v)),n.ssr&&B.eachChild(function(U){var O=ft(U);O.seriesIndex=D.seriesIndex,O.dataIndex=p,O.ssrType="legend"}),c&&B.eachChild(function(U){A.packEventData(U,i,D,p,g)}),f.set(g,!0)}},this)},this),o&&this._createSelector(o,i,a,s,l)},t.prototype.packEventData=function(e,i,n,a,o){var s={componentType:"legend",componentIndex:i.componentIndex,dataIndex:a,value:o,seriesIndex:n.seriesIndex};ft(e).eventData=s},t.prototype._createSelector=function(e,i,n,a,o){var s=this.getSelectorGroup();vh(e,function(u){var f=u.type,h=new Gt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:f==="all"?"legendAllSelect":"legendInverseSelect",legendId:i.id})}});s.add(h);var c=i.getModel("selectorLabel"),v=i.getModel(["emphasis","selectorLabel"]);$a(h,{normal:c,emphasis:v},{defaultText:u.title}),Ts(h)})},t.prototype._createItem=function(e,i,n,a,o,s,l,u,f,h,c){var v=e.visualDrawType,d=o.get("itemWidth"),p=o.get("itemHeight"),y=o.isSelected(i),g=a.get("symbolRotate"),m=a.get("symbolKeepAspect"),_=a.get("icon");f=_||f||"roundRect";var S=yI(f,a,l,u,v,y,c),b=new Xo,w=a.getModel("textStyle");if(tt(e.getLegendIcon)&&(!_||_==="inherit"))b.add(e.getLegendIcon({itemWidth:d,itemHeight:p,icon:f,iconRotate:g,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:m}));else{var x=_==="inherit"&&e.getData().getVisual("symbol")?g==="inherit"?e.getData().getVisual("symbolRotate"):g:0;b.add(mI({itemWidth:d,itemHeight:p,icon:f,iconRotate:x,itemStyle:S.itemStyle,symbolKeepAspect:m}))}var C=s==="left"?d+5:-5,D=s,A=o.get("formatter"),M=i;Y(A)&&A?M=A.replace("{name}",i??""):tt(A)&&(M=A(i));var I=y?w.getTextColor():a.get("inactiveColor");b.add(new Gt({style:Di(w,{text:M,x:C,y:p/2,fill:I,align:D,verticalAlign:"middle"},{inheritColor:I})}));var L=new _t({shape:b.getBoundingRect(),style:{fill:"transparent"}}),P=a.getModel("tooltip");return P.get("show")&&sl({el:L,componentModel:o,itemName:i,itemTooltipOption:P.option}),b.add(L),b.eachChild(function(k){k.silent=!0}),L.silent=!h,this.getContentGroup().add(b),Ts(b),b.__legendDataIndex=n,b},t.prototype.layoutInner=function(e,i,n,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();fa(e.get("orient"),l,e.get("itemGap"),n.width,n.height);var f=l.getBoundingRect(),h=[-f.x,-f.y];if(u.markRedraw(),l.markRedraw(),o){fa("horizontal",u,e.get("selectorItemGap",!0));var c=u.getBoundingRect(),v=[-c.x,-c.y],d=e.get("selectorButtonGap",!0),p=e.getOrient().index,y=p===0?"width":"height",g=p===0?"height":"width",m=p===0?"y":"x";s==="end"?v[p]+=f[y]+d:h[p]+=c[y]+d,v[1-p]+=f[g]/2-c[g]/2,u.x=v[0],u.y=v[1],l.x=h[0],l.y=h[1];var _={x:0,y:0};return _[y]=f[y]+d+c[y],_[g]=Math.max(f[g],c[g]),_[m]=Math.min(0,c[m]+v[1-p]),_}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type="legend.plain",t}(be);function yI(r,t,e,i,n,a,o){function s(y,g){y.lineWidth==="auto"&&(y.lineWidth=g.lineWidth>0?2:0),vh(y,function(m,_){y[_]==="inherit"&&(y[_]=g[_])})}var l=t.getModel("itemStyle"),u=l.getItemStyle(),f=r.lastIndexOf("empty",0)===0?"fill":"stroke",h=l.getShallow("decal");u.decal=!h||h==="inherit"?i.decal:Yf(h,o),u.fill==="inherit"&&(u.fill=i[n]),u.stroke==="inherit"&&(u.stroke=i[f]),u.opacity==="inherit"&&(u.opacity=(n==="fill"?i:e).opacity),s(u,i);var c=t.getModel("lineStyle"),v=c.getLineStyle();if(s(v,e),u.fill==="auto"&&(u.fill=i.fill),u.stroke==="auto"&&(u.stroke=i.fill),v.stroke==="auto"&&(v.stroke=i.fill),!a){var d=t.get("inactiveBorderWidth"),p=u[f];u.lineWidth=d==="auto"?i.lineWidth>0&&p?2:0:u.lineWidth,u.fill=t.get("inactiveColor"),u.stroke=t.get("inactiveBorderColor"),v.stroke=c.get("inactiveColor"),v.lineWidth=c.get("inactiveWidth")}return{itemStyle:u,lineStyle:v}}function mI(r){var t=r.icon||"roundRect",e=cr(t,0,0,r.itemWidth,r.itemHeight,r.itemStyle.fill,r.symbolKeepAspect);return e.setStyle(r.itemStyle),e.rotation=(r.iconRotate||0)*Math.PI/180,e.setOrigin([r.itemWidth/2,r.itemHeight/2]),t.indexOf("empty")>-1&&(e.style.stroke=e.style.fill,e.style.fill=W.color.neutral00,e.style.lineWidth=2),e}function Og(r,t,e,i){ph(r,t,e,i),e.dispatchAction({type:"legendToggleSelect",name:r??t}),dh(r,t,e,i)}function X_(r){for(var t=r.getZr().storage.getDisplayList(),e,i=0,n=t.length;in[o],y=[-v.x,-v.y];i||(y[a]=f[u]);var g=[0,0],m=[-d.x,-d.y],_=$(e.get("pageButtonGap",!0),e.get("itemGap",!0));if(p){var S=e.get("pageButtonPosition",!0);S==="end"?m[a]+=n[o]-d[o]:g[a]+=d[o]+_}m[1-a]+=v[s]/2-d[s]/2,f.setPosition(y),h.setPosition(g),c.setPosition(m);var b={x:0,y:0};if(b[o]=p?n[o]:v[o],b[s]=Math.max(v[s],d[s]),b[l]=Math.min(0,d[l]+m[1-a]),h.__rectSize=n[o],p){var w={x:0,y:0};w[o]=Math.max(n[o]-d[o]-_,0),w[s]=b[s],h.setClipPath(new _t({shape:w})),h.__rectSize=w[o]}else c.eachChild(function(C){C.attr({invisible:!0,silent:!0})});var x=this._getPageInfo(e);return x.pageIndex!=null&&Zt(f,{x:x.contentPosition[0],y:x.contentPosition[1]},p?e:null),this._updatePageInfoView(e,x),b},t.prototype._pageGo=function(e,i,n){var a=this._getPageInfo(i)[e];a!=null&&n.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:i.id})},t.prototype._updatePageInfoView=function(e,i){var n=this._controllerGroup;T(["pagePrev","pageNext"],function(f){var h=f+"DataIndex",c=i[h]!=null,v=n.childOfName(f);v&&(v.setStyle("fill",c?e.get("pageIconColor",!0):e.get("pageIconInactiveColor",!0)),v.cursor=c?"pointer":"default")});var a=n.childOfName("pageText"),o=e.get("pageFormatter"),s=i.pageIndex,l=s!=null?s+1:0,u=i.pageCount;a&&o&&a.setStyle("text",Y(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},t.prototype._getPageInfo=function(e){var i=e.get("scrollDataIndex",!0),n=this.getContentGroup(),a=this._containerGroup.__rectSize,o=e.getOrient().index,s=Yu[o],l=Xu[o],u=this._findTargetItemIndex(i),f=n.children(),h=f[u],c=f.length,v=c?1:0,d={contentPosition:[n.x,n.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return d;var p=S(h);d.contentPosition[o]=-p.s;for(var y=u+1,g=p,m=p,_=null;y<=c;++y)_=S(f[y]),(!_&&m.e>g.s+a||_&&!b(_,g.s))&&(m.i>g.i?g=m:g=_,g&&(d.pageNextDataIndex==null&&(d.pageNextDataIndex=g.i),++d.pageCount)),m=_;for(var y=u-1,g=p,m=p,_=null;y>=-1;--y)_=S(f[y]),(!_||!b(m,_.s))&&g.i=x&&w.s<=x+a}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var i,n=this.getContentGroup(),a;return n.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===e&&(i=s)}),i??a},t.type="legend.scroll",t}(Y_);function xI(r){r.registerAction("legendScroll","legendscroll",function(t,e){var i=t.scrollDataIndex;i!=null&&e.eachComponent({mainType:"legend",subType:"scroll",query:t},function(n){n.setScrollDataIndex(i)})})}function TI(r){Br(Z_),r.registerComponentModel(bI),r.registerComponentView(wI),xI(r)}function CI(r){Br(Z_),Br(TI)}var MI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e}return t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=$h(wg.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:W.color.accent10,borderRadius:0,backgroundColor:W.color.transparent,dataBackground:{lineStyle:{color:W.color.accent30,width:.5},areaStyle:{color:W.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:W.color.accent40,width:.5},areaStyle:{color:W.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:W.color.neutral00,borderColor:W.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:W.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:W.color.tertiary},brushSelect:!0,brushStyle:{color:W.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:W.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(wg),Yn=_t,DI=1,Zu=30,AI=7,Xn="horizontal",Fg="vertical",LI=5,II=["line","bar","candlestick","scatter"],PI={easing:"cubicOut",duration:100,delay:0},kI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e._displayables={},e}return t.prototype.init=function(e,i){this.api=i,this._onBrush=nt(this._onBrush,this),this._onBrushEnd=nt(this._onBrushEnd,this)},t.prototype.render=function(e,i,n,a){if(r.prototype.render.apply(this,arguments),gc(this,"_dispatchZoomAction",e.get("throttle"),"fixRate"),this._orient=e.getOrient(),e.get("show")===!1){this.group.removeAll();return}if(e.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Ps(this,"_dispatchZoomAction");var e=this.api.getZr();e.off("mousemove",this._onBrush),e.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var i=this._displayables.sliderGroup=new Mt;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(i),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,i=this.api,n=e.get("brushSelect"),a=n?AI:0,o=sc(e,i).refContainer,s=this._findCoordRect(),l=e.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Xn?{right:o.width-s.x-s.width,top:o.height-Zu-l-a,width:s.width,height:Zu}:{right:l,top:s.y,width:Zu,height:s.height},f=Cn(e.option);T(["right","top","width","height"],function(c){f[c]==="ph"&&(f[c]=u[c])});var h=gn(f,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===Fg&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,i=this._location,n=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(n===Xn&&!o?{scaleY:l?1:-1,scaleX:1}:n===Xn&&o?{scaleY:l?1:-1,scaleX:-1}:n===Fg&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=e.getBoundingRect([s]);e.x=i.x-u.x,e.y=i.y-u.y,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,i=this._size,n=this._displayables.sliderGroup,a=e.get("brushSelect");n.add(new Yn({silent:!0,shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:e.get("backgroundColor")},z2:-40}));var o=new Yn({shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:"transparent"},z2:0,onclick:nt(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),n.add(o)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var i=this._size,n=this._shadowSize||[],a=e.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():e.otherDim;if(l==null)return;var u=this._shadowPolygonPts,f=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||i[0]!==n[0]||i[1]!==n[1]){var h=o.getDataExtent(e.thisDim),c=o.getDataExtent(l),v=(c[1]-c[0])*.3;c=[c[0]-v,c[1]+v];var d=[0,i[1]],p=[0,i[0]],y=[[i[0],0],[0,0]],g=[],m=p[1]/Math.max(1,o.count()-1),_=i[0]/(h[1]-h[0]),S=e.thisAxis.type==="time",b=-m,w=Math.round(o.count()/i[0]),x;o.each([e.thisDim,l],function(I,L,P){if(w>0&&P%w){S||(b+=m);return}b=S?(+I-h[0])*_:b+m;var k=L==null||isNaN(L)||L==="",B=k?0:Et(L,c,d,!0);k&&!x&&P?(y.push([y[y.length-1][0],0]),g.push([g[g.length-1][0],0])):!k&&x&&(y.push([b,0]),g.push([b,0])),k||(y.push([b,B]),g.push([b,B])),x=k}),u=this._shadowPolygonPts=y,f=this._shadowPolylinePts=g}this._shadowData=o,this._shadowDim=l,this._shadowSize=[i[0],i[1]];var C=this.dataZoomModel;function D(I){var L=C.getModel(I?"selectedDataBackground":"dataBackground"),P=new Mt,k=new Wa({shape:{points:u},segmentIgnoreThreshold:1,style:L.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),B=new Ua({shape:{points:f},segmentIgnoreThreshold:1,style:L.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return P.add(k),P.add(B),P}for(var A=0;A<3;A++){var M=D(A===1);this._displayables.sliderGroup.add(M),this._displayables.dataShadowSegs.push(M)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,i=e.get("showDataShadow");if(i!==!1){var n,a=this.ecModel;return e.eachTargetAxis(function(o,s){var l=e.getAxisProxy(o,s).getTargetSeriesModels();T(l,function(u){if(!n&&!(i!==!0&&ot(II,u.get("type"))<0)){var f=a.getComponent(Ar(o),s).axis,h=RI(o),c,v=u.coordinateSystem;h!=null&&v.getOtherAxis&&(c=v.getOtherAxis(f).inverse),h=u.getData().mapDimension(h);var d=u.getData().mapDimension(o);n={thisAxis:f,series:u,thisDim:d,otherDim:h,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,i=this._displayables,n=i.handles=[null,null],a=i.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,f=l.get("borderRadius")||0,h=l.get("brushSelect"),c=i.filler=new Yn({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(c),o.add(new Yn({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:f},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:DI,fill:W.color.transparent}})),T([0,1],function(_){var S=l.get("handleIcon");!Rs[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var b=cr(S,-1,0,2,2,null,!0);b.attr({cursor:EI(this._orient),draggable:!0,drift:nt(this._onDragMove,this,_),ondragend:nt(this._onDragEnd,this),onmouseover:nt(this._showDataInfo,this,!0),onmouseout:nt(this._showDataInfo,this,!1),z2:5});var w=b.getBoundingRect(),x=l.get("handleSize");this._handleHeight=Pt(x,this._size[1]),this._handleWidth=w.width/w.height*this._handleHeight,b.setStyle(l.getModel("handleStyle").getItemStyle()),b.style.strokeNoScale=!0,b.rectHover=!0,b.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Ts(b);var C=l.get("handleColor");C!=null&&(b.style.fill=C),o.add(n[_]=b);var D=l.getModel("textStyle"),A=l.get("handleLabel")||{},M=A.show||!1;e.add(a[_]=new Gt({silent:!0,invisible:!M,style:Di(D,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:D.getTextColor(),font:D.getFont()}),z2:10}))},this);var v=c;if(h){var d=Pt(l.get("moveHandleSize"),s[1]),p=i.moveHandle=new _t({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:d}}),y=d*.8,g=i.moveHandleIcon=cr(l.get("moveHandleIcon"),-y/2,-y/2,y,y,W.color.neutral00,!0);g.silent=!0,g.y=s[1]+d/2-.5,p.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var m=Math.min(s[1]/2,Math.max(d,10));v=i.moveZone=new _t({invisible:!0,shape:{y:s[1]-m,height:d+m}}),v.on("mouseover",function(){u.enterEmphasis(p)}).on("mouseout",function(){u.leaveEmphasis(p)}),o.add(p),o.add(g),o.add(v)}v.attr({draggable:!0,cursor:"default",drift:nt(this._onDragMove,this,"all"),ondragstart:nt(this._showDataInfo,this,!0),ondragend:nt(this._onDragEnd,this),onmouseover:nt(this._showDataInfo,this,!0),onmouseout:nt(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),i=this._getViewExtent();this._handleEnds=[Et(e[0],[0,100],i,!0),Et(e[1],[0,100],i,!0)]},t.prototype._updateInterval=function(e,i){var n=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=n.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];fh(i,a,o,n.get("zoomLock")?"all":e,s.minSpan!=null?Et(s.minSpan,l,o,!0):null,s.maxSpan!=null?Et(s.maxSpan,l,o,!0):null);var u=this._range,f=this._range=Kn([Et(a[0],o,l,!0),Et(a[1],o,l,!0)]);return!u||u[0]!==f[0]||u[1]!==f[1]},t.prototype._updateView=function(e){var i=this._displayables,n=this._handleEnds,a=Kn(n.slice()),o=this._size;T([0,1],function(v){var d=i.handles[v],p=this._handleHeight;d.attr({scaleX:p/2,scaleY:p/2,x:n[v]+(v?-1:1),y:o[1]/2-p/2})},this),i.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};i.moveHandle&&(i.moveHandle.setShape(s),i.moveZone.setShape(s),i.moveZone.getBoundingRect(),i.moveHandleIcon&&i.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=i.dataShadowSegs,u=[0,a[0],a[1],o[0]],f=0;fi[0]||n[1]<0||n[1]>i[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",n[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var i=e.offsetX,n=e.offsetY;this._brushStart=new dt(i,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var i=this._displayables.brushRect;if(this._brushing=!1,!!i){i.attr("ignore",!0);var n=i.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(n.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[n.x,n.x+n.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();fh(0,l,o,0,u.minSpan!=null?Et(u.minSpan,s,o,!0):null,u.maxSpan!=null?Et(u.maxSpan,s,o,!0):null),this._range=Kn([Et(l[0],o,s,!0),Et(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(fs(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,i){var n=this._displayables,a=this.dataZoomModel,o=n.brushRect;o||(o=n.brushRect=new Yn({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),n.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(e,i),f=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:f[0],y:0,width:u[0]-f[0],height:h[1]})},t.prototype._dispatchZoomAction=function(e){var i=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?PI:null,start:i[0],end:i[1]})},t.prototype._findCoordRect=function(){var e,i=I2(this.dataZoomModel).infoList;if(!e&&i.length){var n=i[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var a=this.api.getWidth(),o=this.api.getHeight();e={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return e},t.type="dataZoom.slider",t}(P2);function RI(r){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[r]}function EI(r){return r==="vertical"?"ns-resize":"ew-resize"}function OI(r){r.registerComponentModel(MI),r.registerComponentView(kI),B2(r)}function Vg(r,t,e){var i=fr.createCanvas(),n=t.getWidth(),a=t.getHeight(),o=i.style;return o&&(o.position="absolute",o.left="0",o.top="0",o.width=n+"px",o.height=a+"px",i.setAttribute("data-zr-dom-id",r)),i.width=n*e,i.height=a*e,i}var $u=function(r){F(t,r);function t(e,i,n){var a=r.call(this)||this;a.motionBlur=!1,a.lastFrameAlpha=.7,a.dpr=1,a.virtual=!1,a.config={},a.incremental=!1,a.zlevel=0,a.maxRepaintRectCount=5,a.__dirty=!0,a.__firstTimePaint=!0,a.__used=!1,a.__drawIndex=0,a.__startIndex=0,a.__endIndex=0,a.__prevStartIndex=null,a.__prevEndIndex=null;var o;n=n||ys,typeof e=="string"?o=Vg(e,i,n):q(e)&&(o=e,e=o.id),a.id=e,a.dom=o;var s=o.style;return s&&($g(o),o.onselectstart=function(){return!1},s.padding="0",s.margin="0",s.borderWidth="0"),a.painter=i,a.dpr=n,a}return t.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},t.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},t.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=Vg("back-"+this.id,this.painter,e),this.ctxBack=this.domBack.getContext("2d"),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,i,n,a){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var o=[],s=this.maxRepaintRectCount,l=!1,u=new it(0,0,0,0);function f(m){if(!(!m.isFinite()||m.isZero()))if(o.length===0){var _=new it(0,0,0,0);_.copy(m),o.push(_)}else{for(var S=!1,b=1/0,w=0,x=0;x=s)}}for(var h=this.__startIndex;h15)break}}P.prevElClipPaths&&g.restore()};if(m)if(m.length===0)C=y.__endIndex;else for(var A=v.dpr,M=0;M0&&t>n[0]){for(l=0;lt);l++);s=i[n[l]]}if(n.splice(l+1,0,t),i[t]=e,!e.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(e.dom,u.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.painter||(e.painter=this)}},r.prototype.eachLayer=function(t,e){for(var i=this._zlevelList,n=0;n0?Zo:0),this._needsManuallyCompositing),f.__builtin__||_h("ZLevel "+u+" has been used by unkown layer "+f.id),f!==a&&(f.__used=!0,f.__startIndex!==l&&(f.__dirty=!0),f.__startIndex=l,f.incremental?f.__drawIndex=-1:f.__drawIndex=l,e(l),a=f),n.__dirty&oe&&!n.__inHover&&(f.__dirty=!0,f.incremental&&f.__drawIndex<0&&(f.__drawIndex=l))}e(l),this.eachBuiltinLayer(function(h,c){!h.__used&&h.getElementCount()>0&&(h.__dirty=!0,h.__startIndex=h.__endIndex=h.__drawIndex=0),h.__dirty&&h.__drawIndex<0&&(h.__drawIndex=h.__startIndex)})},r.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},r.prototype._clearLayer=function(t){t.clear()},r.prototype.setBackgroundColor=function(t){this._backgroundColor=t,T(this._layers,function(e){e.setUnpainted()})},r.prototype.configLayer=function(t,e){if(e){var i=this._layerConfig;i[t]?lt(i[t],e,!0):i[t]=e;for(var n=0;nS+b.searches,0),c=f.reduce((S,b)=>S+b.saves,0),v=f.length||1;let d=0,p=0;return f.forEach((S,b)=>{const w=S.searches+S.saves;w>p&&(p=w,d=b)}),{totalSearches:h,totalSaves:c,avgSearches:Math.round(h/v),avgSaves:Math.round(c/v),peakDay:((g=(y=f[d])==null?void 0:y.date)==null?void 0:g.slice(5))||"—",peakSearches:((m=f[d])==null?void 0:m.searches)||0,peakSaves:((_=f[d])==null?void 0:_.saves)||0,dayCount:v}}function l(){const f=e.value,h=r.value;if(!f)return;const c=s(h);if(typeof t=="function"?t(c):t&&(t.value=c),!h.length){i&&(i.dispose(),i=null),f.innerHTML='
暂无使用数据
';return}(!i||i.getDom()!==f)&&(i&&i.dispose(),i=FM(f),u());const v=h.map(S=>S.date.slice(5)),d=h.length,p=Math.max(...h.map(S=>Math.max(S.searches,S.saves)),1),y=Math.ceil(p*1.35)||1,g=Math.round(c.totalSearches/d),m=d>=30,_={tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(255,255,255,0.97)",borderColor:"#e8e8e8",borderWidth:1,borderRadius:8,padding:[10,14],textStyle:{fontSize:12,color:"#303133"},formatter:S=>{var M,I;const b=((M=S[0])==null?void 0:M.dataIndex)??0,w=((I=h[b])==null?void 0:I.date)||"",x=h[b],C=new Set,D=S.filter(L=>{const P=L.seriesName;return C.has(P)?!1:(C.add(P),!0)});let A=`
${w}
`;return D.forEach(L=>{const P=L.value,k=Array.isArray(P)?P[1]:P,B=L.seriesType==="bar",O=L.seriesName==="搜索"?x==null?void 0:x.searchDelta:x==null?void 0:x.saveDelta,H=O!==void 0&&O!==0?`${O>0?"↑":"↓"}${Math.abs(O)}`:O===0?'→0':"",R=B?``:``;A+=`
${R}${L.seriesName}:${k} 次${H}
`}),A}},legend:{data:["搜索","保存"],bottom:m?30:0,left:"center",itemWidth:14,itemHeight:10,textStyle:{fontSize:11,color:"#666"}},grid:{left:8,right:12,top:28,bottom:m?70:42,containLabel:!0},xAxis:{type:"category",data:v,axisLabel:{interval:0,fontSize:11,color:"#909399",rotate:d>15?45:0},axisLine:{lineStyle:{color:"#e8e8e8"}},splitLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"value",name:"次",nameTextStyle:{fontSize:10,color:"#909399"},min:0,max:y,splitNumber:4,axisLabel:{fontSize:10,color:"#909399"},splitLine:{lineStyle:{color:"#f5f5f5",type:"dashed"}}},series:[{name:"搜索",type:"bar",data:h.map(S=>S.searches),barWidth:a,barGap:o,itemStyle:{color:new ji(0,0,0,1,[{offset:0,color:"#6366f1"},{offset:1,color:"#a5b4fc"}]),borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:new ji(0,0,0,1,[{offset:0,color:"#4f46e5"},{offset:1,color:"#818cf8"}])}},animationDuration:500,animationEasing:"cubicOut"},{name:"保存",type:"bar",data:h.map(S=>S.saves),barWidth:a,barGap:o,itemStyle:{color:new ji(0,0,0,1,[{offset:0,color:"#10b981"},{offset:1,color:"#6ee7b7"}]),borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:new ji(0,0,0,1,[{offset:0,color:"#059669"},{offset:1,color:"#34d399"}])}},animationDuration:500,animationEasing:"cubicOut"},{name:"搜索",type:"line",smooth:!0,symbol:"circle",symbolSize:5,data:h.map(S=>S.searches),lineStyle:{width:2.5,color:"#4f46e5"},itemStyle:{color:"#4f46e5",borderColor:"#fff",borderWidth:2},areaStyle:{color:new ji(0,0,0,1,[{offset:0,color:"rgba(99,102,241,0.12)"},{offset:1,color:"rgba(99,102,241,0.01)"}])},label:{show:!1},connectNulls:!0,animationDuration:700,animationEasing:"cubicOut",z:3,markLine:g>0?{silent:!0,symbol:"none",lineStyle:{color:"#6366f1",type:"dashed",width:1,opacity:.5},label:{formatter:`均 ${g}`,position:"insideEndTop",fontSize:10,color:"#6366f1"},data:[{yAxis:g,name:"日均搜索"}]}:void 0},{name:"保存",type:"line",smooth:!0,symbol:"circle",symbolSize:5,data:h.map(S=>S.saves),lineStyle:{width:2.5,color:"#059669"},itemStyle:{color:"#059669",borderColor:"#fff",borderWidth:2},areaStyle:{color:new ji(0,0,0,1,[{offset:0,color:"rgba(16,185,129,0.12)"},{offset:1,color:"rgba(16,185,129,0.01)"}])},label:{show:!1},connectNulls:!0,animationDuration:700,animationEasing:"cubicOut",z:3,markLine:g>0?{silent:!0,symbol:"none",lineStyle:{color:"#10b981",type:"dashed",width:1,opacity:.5},label:{formatter:`均 ${Math.round(c.totalSaves/d)}`,position:"insideEndTop",fontSize:10,color:"#10b981"},data:[{yAxis:Math.round(c.totalSaves/d),name:"日均保存"}]}:void 0}],...m?{dataZoom:[{type:"slider",bottom:6,height:20,start:0,end:100,borderColor:"#e8e8e8",fillerColor:"rgba(99,102,241,0.08)",handleStyle:{color:"#6366f1",borderColor:"#6366f1"},textStyle:{fontSize:10,color:"#909399"}}]}:{}};i.setOption(_,!0)}qu(r,()=>{Hg(()=>l())},{deep:!0});function u(){e.value&&(n&&(n.disconnect(),n=null),n=new ResizeObserver(()=>{i==null||i.resize()}),n.observe(e.value))}return $_(()=>{n==null||n.disconnect(),n=null,i==null||i.dispose(),i=null}),{chartRef:e,render:l,initResize:u}}const HI={class:"section-content"},WI={class:"dash-row dash-row-stats"},UI={class:"stt-label"},YI={class:"stt-value"},XI={class:"dash-row"},ZI={class:"storage-grid"},$I={class:"drive-header"},qI=["src"],KI={class:"drive-name"},QI={class:"drive-space"},JI={class:"drive-used"},jI={class:"drive-total"},tP={class:"dash-row dash-row-cols-3"},eP={class:"insight-header"},rP={class:"trend-day-btns"},iP=["onClick"],nP={key:0,class:"trend-summary-row"},aP={class:"trend-summary-item"},oP={class:"trend-summary-num"},sP={class:"trend-summary-item"},lP={class:"trend-summary-num"},uP={class:"trend-summary-item"},fP={class:"trend-summary-num"},hP={class:"trend-summary-item"},cP={class:"trend-summary-num"},vP={class:"trend-summary-desc"},dP={class:"keyword-list"},pP={class:"kw-count"},gP={class:"ip-list"},yP={class:"ip-rank"},mP={class:"ip-addr"},_P={key:0,class:"ip-loc"},SP={class:"ip-count"},bP={class:"province-list"},wP={class:"province-rank"},xP={class:"province-bar-wrap"},TP={class:"province-name"},CP={class:"province-count"},MP={key:0,class:"section-content"},DP={class:"cloud-toggle-grid"},AP=["src"],LP={class:"cloud-label"},IP={key:1,class:"section-content"},PP={key:2,class:"section-content"},kP=q_({__name:"AdminDashboard",setup(r){t1();const x=Ce("dashboard"),C=Ce(""),D=Ce([]),A=Q_({uptime:"--",memory:"--",version:"--",dbOk:!1,redisOk:!1,pansouOk:!1});const t=Ce(""),e=Ce({todaySearches:0,todaySaves:0,monthSearches:0,monthSaves:0,totalSearches:0,totalSaves:0,hotKeywords:[],trendTrend:[],cloudUsage:[],topIps:[],provinceRankings:[]}),i=Ce(""),n=Ce([]),{chartRef:a,render:o,initResize:s}=GI(Ka(()=>e.value.trendTrend),R=>{b.value=R}),l=a;qu(()=>e.value.trendTrend,()=>{o()},{deep:!0}),qu(()=>x.value,(R,E)=>{R==="dashboard"&&E!=="dashboard"&&Hg(()=>{const N=document.querySelector(".trend-chart-echarts");N&&N.childElementCount===0?(o(),s()):N&&s()})});const u=[{key:"todaySearches",label:"今日搜索"},{key:"todaySaves",label:"今日保存"},{key:"monthSearches",label:"本月搜索"},{key:"monthSaves",label:"本月保存"},{key:"totalSearches",label:"总搜索量"},{key:"totalSaves",label:"总保存量"}];function f(R){return R===0?"danger":R<3?"warning":R<8?"":"info"}function h(R){return R?R.replace(/^(中国|China)\s*/i,"").trim():""}const c=Ka(()=>{const R=e.value.provinceRankings;return R.length>0?Math.max(...R.map(E=>E.count)):1}),v=["#409eff","#67c23a","#e6a23c","#f56c6c","#909399","#b37feb","#36cfc9","#ff85c0"];function d(R){return v[R%v.length]}const p=Ce("ip");function y(){}const g="data:image/svg+xml,"+encodeURIComponent('');function m(R){var E;return((E=n.value.find(N=>N.type===R))==null?void 0:E.icon)||g}const _=[7,15,30,60],S=Ce(7),b=Ce(null);async function w(R){S.value=R,await U()};async function M(){try{const E=await(await fetch("/api/admin/save-records?pageSize=5&page=1")).json();D.value=E.records||E.data||[]}catch{D.value=[]}}async function I(){var R,E,N;try{const J=await(await fetch("/health")).json();A.uptime=L(J.uptime||0),A.memory=P(J.memory||0),A.version=J.version||"--",A.dbOk=((R=J.components)==null?void 0:R.db)==="connected",A.redisOk=((E=J.components)==null?void 0:E.redis)==="connected",A.pansouOk=((N=J.components)==null?void 0:N.pansou)==="ok"}catch{}}function L(R){const E=Math.floor(R/86400),N=Math.floor(R%86400/3600),X=Math.floor(R%3600/60),J=[];return E>0&&J.push(E+"天"),N>0&&J.push(N+"时"),J.push(X+"分"),J.join(" ")}function P(R){return R>=1073741824?(R/1073741824).toFixed(1)+" GB":R>=1048576?(R/1048576).toFixed(0)+" MB":(R/1024).toFixed(0)+" KB"}const k=Ka(()=>x.value==="cloud-configs-toggle"),B=Ka(()=>x.value.startsWith("sys-"));K_(async()=>{try{const R=await e1();R.site_name&&(i.value=R.site_name,document.title=R.site_name+" - 管理后台")}catch{}try{const[R,E]=await Promise.all([r1(),i1()]);n.value=E.types,await U(),await M(),await I(),s()}catch(R){console.error("加载数据失败",R)}});async function U(){try{e.value=await n1(S.value);try{const E=await(await fetch("/health")).json();t.value=E.version}catch{}}catch(R){console.error("加载统计数据失败",R)}}function O(R){if(!R.storageUsed||!R.storageTotal)return 0;const E=parseFloat(R.storageUsed),N=parseFloat(R.storageTotal);return N<=0?0:Math.round(E/N*100)}async function H(R,E){const N=n.value.find(X=>X.type===R);if(N)try{await a1(R,E),N.enabled=E}catch(X){j_.error(X.message||"切换失败"),N.enabled=!E}}return(R,E)=>{const N=Hr("el-card"),X=Hr("el-progress"),J=Hr("el-empty"),yt=Hr("el-tag"),Bt=Hr("el-tab-pane"),ue=Hr("el-tabs"),xe=Hr("el-switch");return Tt(),Nt("div",null,[ml(Q("div",HI,[Q("div",WI,[(Tt(),Nt(Vr,null,Gr(u,K=>$t(N,{key:K.key,class:"stat-card stt-card"},{default:qt(()=>[Q("div",UI,wt(K.label),1),Q("div",YI,wt(e.value[K.key]??0),1)]),_:2},1024)),64))]),Q("div",XI,[$t(N,{class:"storage-section-card"},{header:qt(()=>[...E[1]||(E[1]=[Q("span",null,"💾 网盘使用空间",-1)])]),default:qt(()=>[Q("div",ZI,[(Tt(!0),Nt(Vr,null,Gr(e.value.cloudUsage,K=>(Tt(),Nt("div",{key:K.cloudType+"-"+(K.nickname||""),class:"storage-drive-card"},[Q("div",$I,[Q("img",{src:m(K.cloudType),class:"drive-icon"},null,8,qI),Q("span",KI,wt(K.nickname||K.cloudType),1),Q("span",{class:Nc(["drive-status",K.isActive?"active":"inactive"])},wt(K.isActive?"正常":"停用"),3)]),Q("div",QI,[Q("span",JI,wt(K.storageUsed||"--"),1),E[2]||(E[2]=Q("span",{class:"drive-sep"},"/",-1)),Q("span",jI,wt(K.storageTotal||"--"),1)]),$t(X,{percentage:O(K),"stroke-width":12,color:O(K)>80?"#f56c6c":O(K)>60?"#e6a23c":"#67c23a"},null,8,["percentage","color"])]))),128)),e.value.cloudUsage.length===0?(Tt(),Ei(J,{key:0,description:"暂无网盘数据","image-size":80})):Oe("",!0)])]),_:1})]),Q("div",tP,[$t(N,{class:"insight-card trend-card"},{header:qt(()=>[Q("div",eP,[E[3]||(E[3]=Q("span",null,"📈 网站使用趋势图",-1)),Q("div",rP,[(Tt(),Nt(Vr,null,Gr(_,K=>Q("button",{key:K,class:Nc(["trend-day-btn",{active:S.value===K}]),onClick:ut=>w(K)},wt(K)+"天",11,iP)),64))])])]),default:qt(()=>[b.value?(Tt(),Nt("div",nP,[Q("div",aP,[Q("span",oP,wt(b.value.totalSearches),1),E[4]||(E[4]=Q("span",{class:"trend-summary-desc"},"总搜索",-1))]),Q("div",sP,[Q("span",lP,wt(b.value.totalSaves),1),E[5]||(E[5]=Q("span",{class:"trend-summary-desc"},"总保存",-1))]),Q("div",uP,[Q("span",fP,wt(b.value.avgSearches)+"/"+wt(b.value.avgSaves),1),E[6]||(E[6]=Q("span",{class:"trend-summary-desc"},"日均搜索/保存",-1))]),Q("div",hP,[Q("span",cP,wt(b.value.peakDay),1),Q("span",vP,"峰值日 "+wt(b.value.peakSearches)+"+"+wt(b.value.peakSaves),1)])])):Oe("",!0),Q("div",{ref_key:"chartRef",ref:l,class:"trend-chart-echarts"},null,512)]),_:1}),$t(N,{class:"insight-card"},{header:qt(()=>[...E[7]||(E[7]=[Q("span",null,"🔍 热门搜索关键词 Top 20",-1)])]),default:qt(()=>[Q("div",dP,[(Tt(!0),Nt(Vr,null,Gr(e.value.hotKeywords,(K,ut)=>(Tt(),Ei(yt,{key:K.keyword,type:f(ut),size:"small",class:"keyword-tag"},{default:qt(()=>[zc(wt(K.keyword),1),Q("sup",pP,wt(K.count),1)]),_:2},1032,["type"]))),128)),e.value.hotKeywords.length===0?(Tt(),Ei(J,{key:0,description:"暂无搜索数据","image-size":60})):Oe("",!0)])]),_:1}),$t(N,{class:"insight-card"},{header:qt(()=>[$t(ue,{modelValue:p.value,"onUpdate:modelValue":E[0]||(E[0]=K=>p.value=K),class:"card-tabs",onTabClick:y},{default:qt(()=>[$t(Bt,{label:"🌐 IP Top 10",name:"ip"}),$t(Bt,{label:"🗺️ 地域 Top 10",name:"province"})]),_:1},8,["modelValue"])]),default:qt(()=>{var K;return[ml(Q("div",gP,[(Tt(!0),Nt(Vr,null,Gr(e.value.topIps,(ut,j)=>(Tt(),Nt("div",{key:ut.ip,class:"ip-row"},[Q("span",yP,wt(j+1),1),Q("span",mP,wt(ut.ip),1),ut.ip_location?(Tt(),Nt("span",_P,wt(h(ut.ip_location)),1)):Oe("",!0),Q("span",SP,wt(ut.count)+" 次",1)]))),128)),e.value.topIps.length===0?(Tt(),Ei(J,{key:0,description:"暂无数据","image-size":60})):Oe("",!0)],512),[[_l,p.value==="ip"]]),ml(Q("div",bP,[(Tt(!0),Nt(Vr,null,Gr(e.value.provinceRankings.slice(0,10),(ut,j)=>(Tt(),Nt("div",{key:ut.province,class:"province-row"},[Q("span",wP,wt(j+1),1),Q("span",xP,[Q("span",{class:"province-bar",style:J_({width:ut.count/c.value*100+"%",background:d(j)})},null,4)]),Q("span",TP,wt(ut.province),1),Q("span",CP,wt(ut.count)+" 次",1)]))),128)),(K=e.value.provinceRankings)!=null&&K.length?Oe("",!0):(Tt(),Ei(J,{key:0,description:"暂无数据","image-size":60}))],512),[[_l,p.value==="province"]])]}),_:1})])],512),[[_l,x.value==="dashboard"]]),k.value?(Tt(),Nt("div",MP,[$t(N,{class:"config-card"},{header:qt(()=>[...E[8]||(E[8]=[Q("span",null,"📂 网盘设置及授权",-1)])]),default:qt(()=>[Q("div",DP,[(Tt(!0),Nt(Vr,null,Gr(n.value,K=>(Tt(),Nt("div",{key:K.type,class:"cloud-toggle-chip"},[Q("img",{src:K.icon,class:"cloud-icon-img"},null,8,AP),Q("span",LP,wt(K.label),1),K.type==="others"?(Tt(),Ei(yt,{key:0,size:"small",type:"info"},{default:qt(()=>[...E[9]||(E[9]=[zc("关",-1)])]),_:1})):Oe("",!0),$t(xe,{"model-value":K.enabled,size:"small",onChange:ut=>H(K.type,ut)},null,8,["model-value","onChange"])]))),128))]),E[10]||(E[10]=Q("div",{class:"form-tip",style:{"margin-top":"12px"}}," 关闭的网盘类型在搜索结果中不会展示。修改后立即生效,无需点击保存。 ",-1))]),_:1}),$t(s1)])):Oe("",!0),B.value?(Tt(),Nt("div",IP,[$t(l1,{section:C.value},null,8,["section"])])):Oe("",!0),x.value==="save-records"?(Tt(),Nt("div",PP,[$t(u1)])):Oe("",!0)])}}}),GP=o1(kP,[["__scopeId","data-v-64f399c4"]]);export{GP as default}; +`||n==="")){var a=r.isSelected(n);Le(e,n)?e[n]=e[n]&&a:e[n]=a}}),e}function SI(r){r.registerAction("legendToggleSelect","legendselectchanged",St(Un,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",St(Un,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",St(Un,"inverseSelect")),r.registerAction("legendSelect","legendselected",St(Un,"select")),r.registerAction("legendUnSelect","legendunselected",St(Un,"unSelect"))}function Z_(r){r.registerComponentModel(ch),r.registerComponentView(Y_),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,_I),r.registerSubTypeDefaulter("legend",function(){return"plain"}),SI(r)}var bI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e}return t.prototype.setScrollDataIndex=function(e){this.option.scrollDataIndex=e},t.prototype.init=function(e,i,n){var a=Cn(e);r.prototype.init.call(this,e,i,n),Ng(this,e,a)},t.prototype.mergeOption=function(e,i){r.prototype.mergeOption.call(this,e,i),Ng(this,this.option,e)},t.type="legend.scroll",t.defaultOption=$h(ch.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:W.color.accent50,pageIconInactiveColor:W.color.accent10,pageIconSize:15,pageTextStyle:{color:W.color.tertiary},animationDurationUpdate:800}),t}(ch);function Ng(r,t,e){var i=r.getOrient(),n=[1,1];n[i.index]=0,Or(t,e,{type:"box",ignoreSize:!!n})}var zg=Mt,Yu=["width","height"],Xu=["x","y"],wI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e.newlineDisabled=!0,e._currentIndex=0,e}return t.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new zg),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new zg)},t.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(e,i,n,a,o,s,l){var u=this;r.prototype.renderInner.call(this,e,i,n,a,o,s,l);var f=this._controllerGroup,h=i.get("pageIconSize",!0),c=V(h)?h:[h,h];d("pagePrev",0);var v=i.getModel("pageTextStyle");f.add(new Gt({name:"pageText",style:{text:"xx/xx",fill:v.getTextColor(),font:v.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),d("pageNext",1);function d(p,y){var g=p+"DataIndex",m=ol(i.get("pageIcons",!0)[i.getOrient().name][y],{onclick:nt(u._pageGo,u,g,i,a)},{x:-c[0]/2,y:-c[1]/2,width:c[0],height:c[1]});m.name=p,f.add(m)}},t.prototype.layoutInner=function(e,i,n,a,o,s){var l=this.getSelectorGroup(),u=e.getOrient().index,f=Yu[u],h=Xu[u],c=Yu[1-u],v=Xu[1-u];o&&fa("horizontal",l,e.get("selectorItemGap",!0));var d=e.get("selectorButtonGap",!0),p=l.getBoundingRect(),y=[-p.x,-p.y],g=at(n);o&&(g[f]=n[f]-p[f]-d);var m=this._layoutContentAndController(e,a,g,u,f,c,v,h);if(o){if(s==="end")y[u]+=m[f]+d;else{var _=p[f]+d;y[u]-=_,m[h]-=_}m[f]+=p[f]+d,y[1-u]+=m[v]+m[c]/2-p[c]/2,m[c]=Math.max(m[c],p[c]),m[v]=Math.min(m[v],p[v]+y[1-u]),l.x=y[0],l.y=y[1],l.markRedraw()}return m},t.prototype._layoutContentAndController=function(e,i,n,a,o,s,l,u){var f=this.getContentGroup(),h=this._containerGroup,c=this._controllerGroup;fa(e.get("orient"),f,e.get("itemGap"),a?n.width:null,a?null:n.height),fa("horizontal",c,e.get("pageButtonItemGap",!0));var v=f.getBoundingRect(),d=c.getBoundingRect(),p=this._showController=v[o]>n[o],y=[-v.x,-v.y];i||(y[a]=f[u]);var g=[0,0],m=[-d.x,-d.y],_=$(e.get("pageButtonGap",!0),e.get("itemGap",!0));if(p){var S=e.get("pageButtonPosition",!0);S==="end"?m[a]+=n[o]-d[o]:g[a]+=d[o]+_}m[1-a]+=v[s]/2-d[s]/2,f.setPosition(y),h.setPosition(g),c.setPosition(m);var b={x:0,y:0};if(b[o]=p?n[o]:v[o],b[s]=Math.max(v[s],d[s]),b[l]=Math.min(0,d[l]+m[1-a]),h.__rectSize=n[o],p){var w={x:0,y:0};w[o]=Math.max(n[o]-d[o]-_,0),w[s]=b[s],h.setClipPath(new _t({shape:w})),h.__rectSize=w[o]}else c.eachChild(function(C){C.attr({invisible:!0,silent:!0})});var x=this._getPageInfo(e);return x.pageIndex!=null&&Zt(f,{x:x.contentPosition[0],y:x.contentPosition[1]},p?e:null),this._updatePageInfoView(e,x),b},t.prototype._pageGo=function(e,i,n){var a=this._getPageInfo(i)[e];a!=null&&n.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:i.id})},t.prototype._updatePageInfoView=function(e,i){var n=this._controllerGroup;T(["pagePrev","pageNext"],function(f){var h=f+"DataIndex",c=i[h]!=null,v=n.childOfName(f);v&&(v.setStyle("fill",c?e.get("pageIconColor",!0):e.get("pageIconInactiveColor",!0)),v.cursor=c?"pointer":"default")});var a=n.childOfName("pageText"),o=e.get("pageFormatter"),s=i.pageIndex,l=s!=null?s+1:0,u=i.pageCount;a&&o&&a.setStyle("text",Y(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},t.prototype._getPageInfo=function(e){var i=e.get("scrollDataIndex",!0),n=this.getContentGroup(),a=this._containerGroup.__rectSize,o=e.getOrient().index,s=Yu[o],l=Xu[o],u=this._findTargetItemIndex(i),f=n.children(),h=f[u],c=f.length,v=c?1:0,d={contentPosition:[n.x,n.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return d;var p=S(h);d.contentPosition[o]=-p.s;for(var y=u+1,g=p,m=p,_=null;y<=c;++y)_=S(f[y]),(!_&&m.e>g.s+a||_&&!b(_,g.s))&&(m.i>g.i?g=m:g=_,g&&(d.pageNextDataIndex==null&&(d.pageNextDataIndex=g.i),++d.pageCount)),m=_;for(var y=u-1,g=p,m=p,_=null;y>=-1;--y)_=S(f[y]),(!_||!b(m,_.s))&&g.i=x&&w.s<=x+a}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var i,n=this.getContentGroup(),a;return n.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===e&&(i=s)}),i??a},t.type="legend.scroll",t}(Y_);function xI(r){r.registerAction("legendScroll","legendscroll",function(t,e){var i=t.scrollDataIndex;i!=null&&e.eachComponent({mainType:"legend",subType:"scroll",query:t},function(n){n.setScrollDataIndex(i)})})}function TI(r){Br(Z_),r.registerComponentModel(bI),r.registerComponentView(wI),xI(r)}function CI(r){Br(Z_),Br(TI)}var MI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e}return t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=$h(wg.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:W.color.accent10,borderRadius:0,backgroundColor:W.color.transparent,dataBackground:{lineStyle:{color:W.color.accent30,width:.5},areaStyle:{color:W.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:W.color.accent40,width:.5},areaStyle:{color:W.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:W.color.neutral00,borderColor:W.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:W.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:W.color.tertiary},brushSelect:!0,brushStyle:{color:W.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:W.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(wg),Yn=_t,DI=1,Zu=30,AI=7,Xn="horizontal",Fg="vertical",LI=5,II=["line","bar","candlestick","scatter"],PI={easing:"cubicOut",duration:100,delay:0},kI=function(r){F(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.type=t.type,e._displayables={},e}return t.prototype.init=function(e,i){this.api=i,this._onBrush=nt(this._onBrush,this),this._onBrushEnd=nt(this._onBrushEnd,this)},t.prototype.render=function(e,i,n,a){if(r.prototype.render.apply(this,arguments),gc(this,"_dispatchZoomAction",e.get("throttle"),"fixRate"),this._orient=e.getOrient(),e.get("show")===!1){this.group.removeAll();return}if(e.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Ps(this,"_dispatchZoomAction");var e=this.api.getZr();e.off("mousemove",this._onBrush),e.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var i=this._displayables.sliderGroup=new Mt;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(i),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,i=this.api,n=e.get("brushSelect"),a=n?AI:0,o=sc(e,i).refContainer,s=this._findCoordRect(),l=e.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Xn?{right:o.width-s.x-s.width,top:o.height-Zu-l-a,width:s.width,height:Zu}:{right:l,top:s.y,width:Zu,height:s.height},f=Cn(e.option);T(["right","top","width","height"],function(c){f[c]==="ph"&&(f[c]=u[c])});var h=gn(f,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===Fg&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,i=this._location,n=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(n===Xn&&!o?{scaleY:l?1:-1,scaleX:1}:n===Xn&&o?{scaleY:l?1:-1,scaleX:-1}:n===Fg&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=e.getBoundingRect([s]);e.x=i.x-u.x,e.y=i.y-u.y,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,i=this._size,n=this._displayables.sliderGroup,a=e.get("brushSelect");n.add(new Yn({silent:!0,shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:e.get("backgroundColor")},z2:-40}));var o=new Yn({shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:"transparent"},z2:0,onclick:nt(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),n.add(o)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var i=this._size,n=this._shadowSize||[],a=e.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():e.otherDim;if(l==null)return;var u=this._shadowPolygonPts,f=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||i[0]!==n[0]||i[1]!==n[1]){var h=o.getDataExtent(e.thisDim),c=o.getDataExtent(l),v=(c[1]-c[0])*.3;c=[c[0]-v,c[1]+v];var d=[0,i[1]],p=[0,i[0]],y=[[i[0],0],[0,0]],g=[],m=p[1]/Math.max(1,o.count()-1),_=i[0]/(h[1]-h[0]),S=e.thisAxis.type==="time",b=-m,w=Math.round(o.count()/i[0]),x;o.each([e.thisDim,l],function(I,L,P){if(w>0&&P%w){S||(b+=m);return}b=S?(+I-h[0])*_:b+m;var k=L==null||isNaN(L)||L==="",B=k?0:Et(L,c,d,!0);k&&!x&&P?(y.push([y[y.length-1][0],0]),g.push([g[g.length-1][0],0])):!k&&x&&(y.push([b,0]),g.push([b,0])),k||(y.push([b,B]),g.push([b,B])),x=k}),u=this._shadowPolygonPts=y,f=this._shadowPolylinePts=g}this._shadowData=o,this._shadowDim=l,this._shadowSize=[i[0],i[1]];var C=this.dataZoomModel;function D(I){var L=C.getModel(I?"selectedDataBackground":"dataBackground"),P=new Mt,k=new Wa({shape:{points:u},segmentIgnoreThreshold:1,style:L.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),B=new Ua({shape:{points:f},segmentIgnoreThreshold:1,style:L.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return P.add(k),P.add(B),P}for(var A=0;A<3;A++){var M=D(A===1);this._displayables.sliderGroup.add(M),this._displayables.dataShadowSegs.push(M)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,i=e.get("showDataShadow");if(i!==!1){var n,a=this.ecModel;return e.eachTargetAxis(function(o,s){var l=e.getAxisProxy(o,s).getTargetSeriesModels();T(l,function(u){if(!n&&!(i!==!0&&ot(II,u.get("type"))<0)){var f=a.getComponent(Ar(o),s).axis,h=RI(o),c,v=u.coordinateSystem;h!=null&&v.getOtherAxis&&(c=v.getOtherAxis(f).inverse),h=u.getData().mapDimension(h);var d=u.getData().mapDimension(o);n={thisAxis:f,series:u,thisDim:d,otherDim:h,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,i=this._displayables,n=i.handles=[null,null],a=i.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,f=l.get("borderRadius")||0,h=l.get("brushSelect"),c=i.filler=new Yn({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(c),o.add(new Yn({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:f},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:DI,fill:W.color.transparent}})),T([0,1],function(_){var S=l.get("handleIcon");!Rs[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var b=cr(S,-1,0,2,2,null,!0);b.attr({cursor:EI(this._orient),draggable:!0,drift:nt(this._onDragMove,this,_),ondragend:nt(this._onDragEnd,this),onmouseover:nt(this._showDataInfo,this,!0),onmouseout:nt(this._showDataInfo,this,!1),z2:5});var w=b.getBoundingRect(),x=l.get("handleSize");this._handleHeight=Pt(x,this._size[1]),this._handleWidth=w.width/w.height*this._handleHeight,b.setStyle(l.getModel("handleStyle").getItemStyle()),b.style.strokeNoScale=!0,b.rectHover=!0,b.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Ts(b);var C=l.get("handleColor");C!=null&&(b.style.fill=C),o.add(n[_]=b);var D=l.getModel("textStyle"),A=l.get("handleLabel")||{},M=A.show||!1;e.add(a[_]=new Gt({silent:!0,invisible:!M,style:Di(D,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:D.getTextColor(),font:D.getFont()}),z2:10}))},this);var v=c;if(h){var d=Pt(l.get("moveHandleSize"),s[1]),p=i.moveHandle=new _t({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:d}}),y=d*.8,g=i.moveHandleIcon=cr(l.get("moveHandleIcon"),-y/2,-y/2,y,y,W.color.neutral00,!0);g.silent=!0,g.y=s[1]+d/2-.5,p.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var m=Math.min(s[1]/2,Math.max(d,10));v=i.moveZone=new _t({invisible:!0,shape:{y:s[1]-m,height:d+m}}),v.on("mouseover",function(){u.enterEmphasis(p)}).on("mouseout",function(){u.leaveEmphasis(p)}),o.add(p),o.add(g),o.add(v)}v.attr({draggable:!0,cursor:"default",drift:nt(this._onDragMove,this,"all"),ondragstart:nt(this._showDataInfo,this,!0),ondragend:nt(this._onDragEnd,this),onmouseover:nt(this._showDataInfo,this,!0),onmouseout:nt(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),i=this._getViewExtent();this._handleEnds=[Et(e[0],[0,100],i,!0),Et(e[1],[0,100],i,!0)]},t.prototype._updateInterval=function(e,i){var n=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=n.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];fh(i,a,o,n.get("zoomLock")?"all":e,s.minSpan!=null?Et(s.minSpan,l,o,!0):null,s.maxSpan!=null?Et(s.maxSpan,l,o,!0):null);var u=this._range,f=this._range=Kn([Et(a[0],o,l,!0),Et(a[1],o,l,!0)]);return!u||u[0]!==f[0]||u[1]!==f[1]},t.prototype._updateView=function(e){var i=this._displayables,n=this._handleEnds,a=Kn(n.slice()),o=this._size;T([0,1],function(v){var d=i.handles[v],p=this._handleHeight;d.attr({scaleX:p/2,scaleY:p/2,x:n[v]+(v?-1:1),y:o[1]/2-p/2})},this),i.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};i.moveHandle&&(i.moveHandle.setShape(s),i.moveZone.setShape(s),i.moveZone.getBoundingRect(),i.moveHandleIcon&&i.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=i.dataShadowSegs,u=[0,a[0],a[1],o[0]],f=0;fi[0]||n[1]<0||n[1]>i[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",n[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var i=e.offsetX,n=e.offsetY;this._brushStart=new dt(i,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var i=this._displayables.brushRect;if(this._brushing=!1,!!i){i.attr("ignore",!0);var n=i.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(n.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[n.x,n.x+n.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();fh(0,l,o,0,u.minSpan!=null?Et(u.minSpan,s,o,!0):null,u.maxSpan!=null?Et(u.maxSpan,s,o,!0):null),this._range=Kn([Et(l[0],o,s,!0),Et(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(fs(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,i){var n=this._displayables,a=this.dataZoomModel,o=n.brushRect;o||(o=n.brushRect=new Yn({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),n.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(e,i),f=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:f[0],y:0,width:u[0]-f[0],height:h[1]})},t.prototype._dispatchZoomAction=function(e){var i=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?PI:null,start:i[0],end:i[1]})},t.prototype._findCoordRect=function(){var e,i=I2(this.dataZoomModel).infoList;if(!e&&i.length){var n=i[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var a=this.api.getWidth(),o=this.api.getHeight();e={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return e},t.type="dataZoom.slider",t}(P2);function RI(r){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[r]}function EI(r){return r==="vertical"?"ns-resize":"ew-resize"}function OI(r){r.registerComponentModel(MI),r.registerComponentView(kI),B2(r)}function Vg(r,t,e){var i=fr.createCanvas(),n=t.getWidth(),a=t.getHeight(),o=i.style;return o&&(o.position="absolute",o.left="0",o.top="0",o.width=n+"px",o.height=a+"px",i.setAttribute("data-zr-dom-id",r)),i.width=n*e,i.height=a*e,i}var $u=function(r){F(t,r);function t(e,i,n){var a=r.call(this)||this;a.motionBlur=!1,a.lastFrameAlpha=.7,a.dpr=1,a.virtual=!1,a.config={},a.incremental=!1,a.zlevel=0,a.maxRepaintRectCount=5,a.__dirty=!0,a.__firstTimePaint=!0,a.__used=!1,a.__drawIndex=0,a.__startIndex=0,a.__endIndex=0,a.__prevStartIndex=null,a.__prevEndIndex=null;var o;n=n||ys,typeof e=="string"?o=Vg(e,i,n):q(e)&&(o=e,e=o.id),a.id=e,a.dom=o;var s=o.style;return s&&($g(o),o.onselectstart=function(){return!1},s.padding="0",s.margin="0",s.borderWidth="0"),a.painter=i,a.dpr=n,a}return t.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},t.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},t.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=Vg("back-"+this.id,this.painter,e),this.ctxBack=this.domBack.getContext("2d"),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,i,n,a){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var o=[],s=this.maxRepaintRectCount,l=!1,u=new it(0,0,0,0);function f(m){if(!(!m.isFinite()||m.isZero()))if(o.length===0){var _=new it(0,0,0,0);_.copy(m),o.push(_)}else{for(var S=!1,b=1/0,w=0,x=0;x=s)}}for(var h=this.__startIndex;h15)break}}P.prevElClipPaths&&g.restore()};if(m)if(m.length===0)C=y.__endIndex;else for(var A=v.dpr,M=0;M0&&t>n[0]){for(l=0;lt);l++);s=i[n[l]]}if(n.splice(l+1,0,t),i[t]=e,!e.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(e.dom,u.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.painter||(e.painter=this)}},r.prototype.eachLayer=function(t,e){for(var i=this._zlevelList,n=0;n0?Zo:0),this._needsManuallyCompositing),f.__builtin__||_h("ZLevel "+u+" has been used by unkown layer "+f.id),f!==a&&(f.__used=!0,f.__startIndex!==l&&(f.__dirty=!0),f.__startIndex=l,f.incremental?f.__drawIndex=-1:f.__drawIndex=l,e(l),a=f),n.__dirty&oe&&!n.__inHover&&(f.__dirty=!0,f.incremental&&f.__drawIndex<0&&(f.__drawIndex=l))}e(l),this.eachBuiltinLayer(function(h,c){!h.__used&&h.getElementCount()>0&&(h.__dirty=!0,h.__startIndex=h.__endIndex=h.__drawIndex=0),h.__dirty&&h.__drawIndex<0&&(h.__drawIndex=h.__startIndex)})},r.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},r.prototype._clearLayer=function(t){t.clear()},r.prototype.setBackgroundColor=function(t){this._backgroundColor=t,T(this._layers,function(e){e.setUnpainted()})},r.prototype.configLayer=function(t,e){if(e){var i=this._layerConfig;i[t]?lt(i[t],e,!0):i[t]=e;for(var n=0;nS+b.searches,0),c=f.reduce((S,b)=>S+b.saves,0),v=f.length||1;let d=0,p=0;return f.forEach((S,b)=>{const w=S.searches+S.saves;w>p&&(p=w,d=b)}),{totalSearches:h,totalSaves:c,avgSearches:Math.round(h/v),avgSaves:Math.round(c/v),peakDay:((g=(y=f[d])==null?void 0:y.date)==null?void 0:g.slice(5))||"—",peakSearches:((m=f[d])==null?void 0:m.searches)||0,peakSaves:((_=f[d])==null?void 0:_.saves)||0,dayCount:v}}function l(){const f=e.value,h=r.value;if(!f)return;const c=s(h);if(typeof t=="function"?t(c):t&&(t.value=c),!h.length){i&&(i.dispose(),i=null),f.innerHTML='
暂无使用数据
';return}(!i||i.getDom()!==f)&&(i&&i.dispose(),i=FM(f),u());const v=h.map(S=>S.date.slice(5)),d=h.length,p=Math.max(...h.map(S=>Math.max(S.searches,S.saves)),1),y=Math.ceil(p*1.35)||1,g=Math.round(c.totalSearches/d),m=d>=30,_={tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(255,255,255,0.97)",borderColor:"#e8e8e8",borderWidth:1,borderRadius:8,padding:[10,14],textStyle:{fontSize:12,color:"#303133"},formatter:S=>{var M,I;const b=((M=S[0])==null?void 0:M.dataIndex)??0,w=((I=h[b])==null?void 0:I.date)||"",x=h[b],C=new Set,D=S.filter(L=>{const P=L.seriesName;return C.has(P)?!1:(C.add(P),!0)});let A=`
${w}
`;return D.forEach(L=>{const P=L.value,k=Array.isArray(P)?P[1]:P,B=L.seriesType==="bar",O=L.seriesName==="搜索"?x==null?void 0:x.searchDelta:x==null?void 0:x.saveDelta,H=O!==void 0&&O!==0?`${O>0?"↑":"↓"}${Math.abs(O)}`:O===0?'→0':"",R=B?``:``;A+=`
${R}${L.seriesName}:${k} 次${H}
`}),A}},legend:{data:["搜索","保存"],bottom:m?30:0,left:"center",itemWidth:14,itemHeight:10,textStyle:{fontSize:11,color:"#666"}},grid:{left:8,right:12,top:28,bottom:m?70:42,containLabel:!0},xAxis:{type:"category",data:v,axisLabel:{interval:0,fontSize:11,color:"#909399",rotate:d>15?45:0},axisLine:{lineStyle:{color:"#e8e8e8"}},splitLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"value",name:"次",nameTextStyle:{fontSize:10,color:"#909399"},min:0,max:y,splitNumber:4,axisLabel:{fontSize:10,color:"#909399"},splitLine:{lineStyle:{color:"#f5f5f5",type:"dashed"}}},series:[{name:"搜索",type:"bar",data:h.map(S=>S.searches),barWidth:a,barGap:o,itemStyle:{color:new ji(0,0,0,1,[{offset:0,color:"#6366f1"},{offset:1,color:"#a5b4fc"}]),borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:new ji(0,0,0,1,[{offset:0,color:"#4f46e5"},{offset:1,color:"#818cf8"}])}},animationDuration:500,animationEasing:"cubicOut"},{name:"保存",type:"bar",data:h.map(S=>S.saves),barWidth:a,barGap:o,itemStyle:{color:new ji(0,0,0,1,[{offset:0,color:"#10b981"},{offset:1,color:"#6ee7b7"}]),borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:new ji(0,0,0,1,[{offset:0,color:"#059669"},{offset:1,color:"#34d399"}])}},animationDuration:500,animationEasing:"cubicOut"},{name:"搜索",type:"line",smooth:!0,symbol:"circle",symbolSize:5,data:h.map(S=>S.searches),lineStyle:{width:2.5,color:"#4f46e5"},itemStyle:{color:"#4f46e5",borderColor:"#fff",borderWidth:2},areaStyle:{color:new ji(0,0,0,1,[{offset:0,color:"rgba(99,102,241,0.12)"},{offset:1,color:"rgba(99,102,241,0.01)"}])},label:{show:!1},connectNulls:!0,animationDuration:700,animationEasing:"cubicOut",z:3,markLine:g>0?{silent:!0,symbol:"none",lineStyle:{color:"#6366f1",type:"dashed",width:1,opacity:.5},label:{formatter:`均 ${g}`,position:"insideEndTop",fontSize:10,color:"#6366f1"},data:[{yAxis:g,name:"日均搜索"}]}:void 0},{name:"保存",type:"line",smooth:!0,symbol:"circle",symbolSize:5,data:h.map(S=>S.saves),lineStyle:{width:2.5,color:"#059669"},itemStyle:{color:"#059669",borderColor:"#fff",borderWidth:2},areaStyle:{color:new ji(0,0,0,1,[{offset:0,color:"rgba(16,185,129,0.12)"},{offset:1,color:"rgba(16,185,129,0.01)"}])},label:{show:!1},connectNulls:!0,animationDuration:700,animationEasing:"cubicOut",z:3,markLine:g>0?{silent:!0,symbol:"none",lineStyle:{color:"#10b981",type:"dashed",width:1,opacity:.5},label:{formatter:`均 ${Math.round(c.totalSaves/d)}`,position:"insideEndTop",fontSize:10,color:"#10b981"},data:[{yAxis:Math.round(c.totalSaves/d),name:"日均保存"}]}:void 0}],...m?{dataZoom:[{type:"slider",bottom:6,height:20,start:0,end:100,borderColor:"#e8e8e8",fillerColor:"rgba(99,102,241,0.08)",handleStyle:{color:"#6366f1",borderColor:"#6366f1"},textStyle:{fontSize:10,color:"#909399"}}]}:{}};i.setOption(_,!0)}qu(r,()=>{Hg(()=>l())},{deep:!0});function u(){e.value&&(n&&(n.disconnect(),n=null),n=new ResizeObserver(()=>{i==null||i.resize()}),n.observe(e.value))}return $_(()=>{n==null||n.disconnect(),n=null,i==null||i.dispose(),i=null}),{chartRef:e,render:l,initResize:u}}const HI={class:"section-content"},WI={class:"dash-row dash-row-stats"},UI={class:"stt-label"},YI={class:"stt-value"},XI={class:"dash-row"},ZI={class:"storage-grid"},$I={class:"drive-header"},qI=["src"],KI={class:"drive-name"},QI={class:"drive-space"},JI={class:"drive-used"},jI={class:"drive-total"},tP={class:"dash-row dash-row-cols-3"},eP={class:"insight-header"},rP={class:"trend-day-btns"},iP=["onClick"],nP={key:0,class:"trend-summary-row"},aP={class:"trend-summary-item"},oP={class:"trend-summary-num"},sP={class:"trend-summary-item"},lP={class:"trend-summary-num"},uP={class:"trend-summary-item"},fP={class:"trend-summary-num"},hP={class:"trend-summary-item"},cP={class:"trend-summary-num"},vP={class:"trend-summary-desc"},dP={class:"keyword-list"},pP={class:"kw-count"},gP={class:"ip-list"},yP={class:"ip-rank"},mP={class:"ip-addr"},_P={key:0,class:"ip-loc"},SP={class:"ip-count"},bP={class:"province-list"},wP={class:"province-rank"},xP={class:"province-bar-wrap"},TP={class:"province-name"},CP={class:"province-count"},MP={key:0,class:"section-content"},DP={class:"cloud-toggle-grid"},AP=["src"],LP={class:"cloud-label"},IP={key:1,class:"section-content"},PP={key:2,class:"section-content"},kP=q_({__name:"AdminDashboard",setup(r){t1();const x=Ce("dashboard"),C=Ce(""),D=Ce([]),A=Q_({uptime:"--",memory:"--",version:"--",dbOk:!1,redisOk:!1,pansouOk:!1});const t=Ce(""),e=Ce({todaySearches:0,todaySaves:0,monthSearches:0,monthSaves:0,totalSearches:0,totalSaves:0,hotKeywords:[],trendTrend:[],cloudUsage:[],topIps:[],provinceRankings:[]}),i=Ce(""),n=Ce([]),{chartRef:a,render:o,initResize:s}=GI(Ka(()=>e.value.trendTrend),R=>{b.value=R}),l=a;qu(()=>e.value.trendTrend,()=>{o()},{deep:!0}),qu(()=>x.value,(R,E)=>{R==="dashboard"&&E!=="dashboard"&&Hg(()=>{const N=document.querySelector(".trend-chart-echarts");N&&N.childElementCount===0?(o(),s()):N&&s()})});const u=[{key:"todaySearches",label:"今日搜索"},{key:"todaySaves",label:"今日保存"},{key:"monthSearches",label:"本月搜索"},{key:"monthSaves",label:"本月保存"},{key:"totalSearches",label:"总搜索量"},{key:"totalSaves",label:"总保存量"}];function f(R){return R===0?"danger":R<3?"warning":R<8?"":"info"}function h(R){return R?R.replace(/^(中国|China)\s*/i,"").trim():""}const c=Ka(()=>{const R=e.value.provinceRankings;return R.length>0?Math.max(...R.map(E=>E.count)):1}),v=["#409eff","#67c23a","#e6a23c","#f56c6c","#909399","#b37feb","#36cfc9","#ff85c0"];function d(R){return v[R%v.length]}const p=Ce("ip");function y(){}const g="data:image/svg+xml,"+encodeURIComponent('');function m(R){var E;return((E=n.value.find(N=>N.type===R))==null?void 0:E.icon)||g}const _=[7,15,30,60],S=Ce(7),b=Ce(null);async function w(R){S.value=R,await U()};async function M(){try{const t=localStorage.getItem("admin_token"),E=await(await fetch("/api/admin/save-records?pageSize=5&page=1",{headers:t?{Authorization:"Bearer "+t}:{}})).json();D.value=E.records||E.data||[]}catch{D.value=[]}}async function I(){var R,E,N;try{const J=await(await fetch("/health")).json();A.uptime=L(J.uptime||0),A.memory=P(J.memory||0),A.version=J.version||"--",A.dbOk=((R=J.components)==null?void 0:R.db)==="connected",A.redisOk=((E=J.components)==null?void 0:E.redis)==="connected",A.pansouOk=((N=J.components)==null?void 0:N.pansou)==="ok"}catch{}}function L(R){const E=Math.floor(R/86400),N=Math.floor(R%86400/3600),X=Math.floor(R%3600/60),J=[];return E>0&&J.push(E+"天"),N>0&&J.push(N+"时"),J.push(X+"分"),J.join(" ")}function P(R){return R>=1073741824?(R/1073741824).toFixed(1)+" GB":R>=1048576?(R/1048576).toFixed(0)+" MB":(R/1024).toFixed(0)+" KB"}const k=Ka(()=>x.value==="cloud-configs-toggle"),B=Ka(()=>x.value.startsWith("sys-"));K_(async()=>{try{const R=await e1();R.site_name&&(i.value=R.site_name,document.title=R.site_name+" - 管理后台")}catch{}try{const[R,E]=await Promise.all([r1(),i1()]);n.value=E.types,await U(),await M(),await I(),s()}catch(R){console.error("加载数据失败",R)}});async function U(){try{e.value=await n1(S.value);try{const E=await(await fetch("/health")).json();t.value=E.version}catch{}}catch(R){console.error("加载统计数据失败",R)}}function O(R){if(!R.storageUsed||!R.storageTotal)return 0;const E=parseFloat(R.storageUsed),N=parseFloat(R.storageTotal);return N<=0?0:Math.round(E/N*100)}async function H(R,E){const N=n.value.find(X=>X.type===R);if(N)try{await a1(R,E),N.enabled=E}catch(X){j_.error(X.message||"切换失败"),N.enabled=!E}}return(R,E)=>{const N=Hr("el-card"),X=Hr("el-progress"),J=Hr("el-empty"),yt=Hr("el-tag"),Bt=Hr("el-tab-pane"),ue=Hr("el-tabs"),xe=Hr("el-switch");return Tt(),Nt("div",null,[ml(Q("div",HI,[Q("div",WI,[(Tt(),Nt(Vr,null,Gr(u,K=>$t(N,{key:K.key,class:"stat-card stt-card"},{default:qt(()=>[Q("div",UI,wt(K.label),1),Q("div",YI,wt(e.value[K.key]??0),1)]),_:2},1024)),64))]),Q("div",XI,[$t(N,{class:"storage-section-card"},{header:qt(()=>[...E[1]||(E[1]=[Q("span",null,"💾 网盘使用空间",-1)])]),default:qt(()=>[Q("div",ZI,[(Tt(!0),Nt(Vr,null,Gr(e.value.cloudUsage,K=>(Tt(),Nt("div",{key:K.cloudType+"-"+(K.nickname||""),class:"storage-drive-card"},[Q("div",$I,[Q("img",{src:m(K.cloudType),class:"drive-icon"},null,8,qI),Q("span",KI,wt(K.nickname||K.cloudType),1),Q("span",{class:Nc(["drive-status",K.isActive?"active":"inactive"])},wt(K.isActive?"正常":"停用"),3)]),Q("div",QI,[Q("span",JI,wt(K.storageUsed||"--"),1),E[2]||(E[2]=Q("span",{class:"drive-sep"},"/",-1)),Q("span",jI,wt(K.storageTotal||"--"),1)]),$t(X,{percentage:O(K),"stroke-width":12,color:O(K)>80?"#f56c6c":O(K)>60?"#e6a23c":"#67c23a"},null,8,["percentage","color"])]))),128)),e.value.cloudUsage.length===0?(Tt(),Ei(J,{key:0,description:"暂无网盘数据","image-size":80})):Oe("",!0)])]),_:1})]),Q("div",tP,[$t(N,{class:"insight-card trend-card"},{header:qt(()=>[Q("div",eP,[E[3]||(E[3]=Q("span",null,"📈 网站使用趋势图",-1)),Q("div",rP,[(Tt(),Nt(Vr,null,Gr(_,K=>Q("button",{key:K,class:Nc(["trend-day-btn",{active:S.value===K}]),onClick:ut=>w(K)},wt(K)+"天",11,iP)),64))])])]),default:qt(()=>[b.value?(Tt(),Nt("div",nP,[Q("div",aP,[Q("span",oP,wt(b.value.totalSearches),1),E[4]||(E[4]=Q("span",{class:"trend-summary-desc"},"总搜索",-1))]),Q("div",sP,[Q("span",lP,wt(b.value.totalSaves),1),E[5]||(E[5]=Q("span",{class:"trend-summary-desc"},"总保存",-1))]),Q("div",uP,[Q("span",fP,wt(b.value.avgSearches)+"/"+wt(b.value.avgSaves),1),E[6]||(E[6]=Q("span",{class:"trend-summary-desc"},"日均搜索/保存",-1))]),Q("div",hP,[Q("span",cP,wt(b.value.peakDay),1),Q("span",vP,"峰值日 "+wt(b.value.peakSearches)+"+"+wt(b.value.peakSaves),1)])])):Oe("",!0),Q("div",{ref_key:"chartRef",ref:l,class:"trend-chart-echarts"},null,512)]),_:1}),$t(N,{class:"insight-card"},{header:qt(()=>[...E[7]||(E[7]=[Q("span",null,"🔍 热门搜索关键词 Top 20",-1)])]),default:qt(()=>[Q("div",dP,[(Tt(!0),Nt(Vr,null,Gr(e.value.hotKeywords,(K,ut)=>(Tt(),Ei(yt,{key:K.keyword,type:f(ut),size:"small",class:"keyword-tag"},{default:qt(()=>[zc(wt(K.keyword),1),Q("sup",pP,wt(K.count),1)]),_:2},1032,["type"]))),128)),e.value.hotKeywords.length===0?(Tt(),Ei(J,{key:0,description:"暂无搜索数据","image-size":60})):Oe("",!0)])]),_:1}),$t(N,{class:"insight-card"},{header:qt(()=>[$t(ue,{modelValue:p.value,"onUpdate:modelValue":E[0]||(E[0]=K=>p.value=K),class:"card-tabs",onTabClick:y},{default:qt(()=>[$t(Bt,{label:"🌐 IP Top 10",name:"ip"}),$t(Bt,{label:"🗺️ 地域 Top 10",name:"province"})]),_:1},8,["modelValue"])]),default:qt(()=>{var K;return[ml(Q("div",gP,[(Tt(!0),Nt(Vr,null,Gr(e.value.topIps,(ut,j)=>(Tt(),Nt("div",{key:ut.ip,class:"ip-row"},[Q("span",yP,wt(j+1),1),Q("span",mP,wt(ut.ip),1),ut.ip_location?(Tt(),Nt("span",_P,wt(h(ut.ip_location)),1)):Oe("",!0),Q("span",SP,wt(ut.count)+" 次",1)]))),128)),e.value.topIps.length===0?(Tt(),Ei(J,{key:0,description:"暂无数据","image-size":60})):Oe("",!0)],512),[[_l,p.value==="ip"]]),ml(Q("div",bP,[(Tt(!0),Nt(Vr,null,Gr(e.value.provinceRankings.slice(0,10),(ut,j)=>(Tt(),Nt("div",{key:ut.province,class:"province-row"},[Q("span",wP,wt(j+1),1),Q("span",xP,[Q("span",{class:"province-bar",style:J_({width:ut.count/c.value*100+"%",background:d(j)})},null,4)]),Q("span",TP,wt(ut.province),1),Q("span",CP,wt(ut.count)+" 次",1)]))),128)),(K=e.value.provinceRankings)!=null&&K.length?Oe("",!0):(Tt(),Ei(J,{key:0,description:"暂无数据","image-size":60}))],512),[[_l,p.value==="province"]])]}),_:1})])],512),[[_l,x.value==="dashboard"]]),k.value?(Tt(),Nt("div",MP,[$t(N,{class:"config-card"},{header:qt(()=>[...E[8]||(E[8]=[Q("span",null,"📂 网盘设置及授权",-1)])]),default:qt(()=>[Q("div",DP,[(Tt(!0),Nt(Vr,null,Gr(n.value,K=>(Tt(),Nt("div",{key:K.type,class:"cloud-toggle-chip"},[Q("img",{src:K.icon,class:"cloud-icon-img"},null,8,AP),Q("span",LP,wt(K.label),1),K.type==="others"?(Tt(),Ei(yt,{key:0,size:"small",type:"info"},{default:qt(()=>[...E[9]||(E[9]=[zc("关",-1)])]),_:1})):Oe("",!0),$t(xe,{"model-value":K.enabled,size:"small",onChange:ut=>H(K.type,ut)},null,8,["model-value","onChange"])]))),128))]),E[10]||(E[10]=Q("div",{class:"form-tip",style:{"margin-top":"12px"}}," 关闭的网盘类型在搜索结果中不会展示。修改后立即生效,无需点击保存。 ",-1))]),_:1}),$t(s1)])):Oe("",!0),B.value?(Tt(),Nt("div",IP,[$t(l1,{section:C.value},null,8,["section"])])):Oe("",!0),x.value==="save-records"?(Tt(),Nt("div",PP,[$t(u1)])):Oe("",!0)])}}}),GP=o1(kP,[["__scopeId","data-v-64f399c4"]]);export{GP as default}; diff --git a/source_clean/src/main.ts b/source_clean/src/main.ts index ca5f6b8..9f2dfb4 100755 --- a/source_clean/src/main.ts +++ b/source_clean/src/main.ts @@ -38,8 +38,6 @@ app.use(morgan(':method :url :status :res[content-length] - :response-time ms')) app.use(express.json({ limit: '10mb' })); app.use(express.urlencoded({ extended: true, limit: '10mb' })); -app.use(rateLimiter); - // ============ 前端静态文件 ============ const frontendDist = path.join(__dirname, 'frontend'); // Cache control: HTML no-cache, hashed assets immutable @@ -53,6 +51,9 @@ app.use((req, res, next) => { }); app.use(express.static(frontendDist)); +// ============ Rate Limiting (after static files — only API routes are limited) +app.use(rateLimiter); + // ============ Routes ============ app.use('/api/uploads', express.static('/app/uploads')); app.use('/api', routes); diff --git a/source_clean/src/middleware/rate-limit.ts b/source_clean/src/middleware/rate-limit.ts index 5fe9c41..4110c54 100755 --- a/source_clean/src/middleware/rate-limit.ts +++ b/source_clean/src/middleware/rate-limit.ts @@ -6,7 +6,7 @@ export const searchLimiter = rateLimit({ max: 150, standardHeaders: true, legacyHeaders: false, - keyGenerator: (req) => req.socket.remoteAddress ?? 'unknown', + keyGenerator: (req) => req.ip ?? 'unknown', message: { error: '搜索请求过于频繁,请稍后再试', code: 429 }, }); @@ -16,7 +16,7 @@ export const adminLimiter = rateLimit({ max: 30, standardHeaders: true, legacyHeaders: false, - keyGenerator: (req) => req.socket.remoteAddress ?? 'unknown', + keyGenerator: (req) => req.ip ?? 'unknown', message: { error: '操作过于频繁,请稍后再试', code: 429 }, }); @@ -26,7 +26,7 @@ export const loginLimiter = rateLimit({ max: 5, standardHeaders: true, legacyHeaders: false, - keyGenerator: (req) => req.socket.remoteAddress ?? 'unknown', + keyGenerator: (req) => req.ip ?? 'unknown', message: { error: '登录尝试次数过多,请一分钟后重试', code: 429 }, }); @@ -36,7 +36,7 @@ export const saveLimiter = rateLimit({ max: 30, standardHeaders: true, legacyHeaders: false, - keyGenerator: (req) => req.socket.remoteAddress ?? 'unknown', + keyGenerator: (req) => req.ip ?? 'unknown', message: { error: '转存操作过于频繁,请稍后再试', code: 429 }, }); @@ -46,11 +46,11 @@ const defaultLimiter = rateLimit({ max: 100, standardHeaders: true, legacyHeaders: false, - keyGenerator: (req) => req.socket.remoteAddress ?? 'unknown', + keyGenerator: (req) => req.ip ?? 'unknown', message: { error: 'Too many requests, please try again later.', code: 429 }, }); export default defaultLimiter; -// NOTE v0.2.8: Fixed keyGenerator to use getClientIP() instead of req.socket.remoteAddress +// v0.3.2: Fixed keyGenerator to use req.ip (Express trust proxy reads X-Forwarded-For) // This ensures rate limiting works correctly behind reverse proxy (OpenResty)