import{d as e,n as t,p as n}from"./analysisRulesConfig-CcWGfATn.js";var r=864e5;function i(e){if(e==null||!Number.isFinite(e))return 1;let t=Date.now()-e;return t<=0?1:Math.max(1,Math.round(t/r))}function a(e){if(e==null||!Number.isFinite(e))return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString(`zh-CN`,{dateStyle:`short`,timeStyle:`short`})}function o(e,t){if(e==null||!Number.isFinite(e))return!1;let n=t.recentPublishDays*r;return Date.now()-e<=n}function s(e){return Math.round(e).toLocaleString(`zh-CN`)}function c(e){return e.toLocaleString(`zh-CN`,{maximumFractionDigits:1,minimumFractionDigits:0})}function l(e,t,n,r){return!(!o(e,r)||t==null||t<=r.burstMinDailyExposure||n==null||n<=r.burstMinWantCount)}function u(e,t,n,r,i){if(!l(e,n,r,i))return null;let a=t;return a<=i.burstMaxDays3?`【${i.burstMaxDays3}日内爆品】`:a<=i.burstMaxDays7?`【${i.burstMaxDays7}日内爆品】`:a<=i.burstMaxDays14?`【2周内稳定爆品】`:a<=i.burstMaxDays30?`【1月内稳定爆品】`:null}function d(e,t,n){return e==null||o(e,n)||t==null?null:t>n.longTermExposureHigh?`【稳定长期爆品】`:t>n.longTermExposureMid?`【长期爆品】`:null}function f(e){return e===`【2周内稳定爆品】`||e===`【1月内稳定爆品】`}function p(r,l){let p=r.wantCount!=null&&Number.isFinite(r.wantCount),m=r.browseCount!=null&&Number.isFinite(r.browseCount)&&r.browseCount>0;if(r.publishTimeMs==null&&!p&&!m)return null;let h=r.publishTimeMs,g=p?r.wantCount:null,_=(r.wantTagLine??``).trim(),v=m?r.browseCount:null,y=m,b=i(h),x=t(l),S=n(l),C,w;y&&v!=null&&x>0?(C=v/x,w=C/b):(C=g!=null&&S>0?g/S:null,w=C==null?null:C/b);let T=g==null?null:g/b,E=o(h,l),D=w!=null&&w>l.burstMinDailyExposure,O=E&&D,k=u(h,b,w,g,l)??d(h,w,l),A=l.dailyOrdersFromWantRate/100,j=e(l),M=null,N=null,P=!1;return y&&v!=null?(M=c(v/b),N=c(T==null?0:T*A),P=!0):f(k)&&T!=null&&j>0&&(M=c(T/j),N=c(T*A),P=!0),{publishTimeMs:h,publishTimeLabel:a(h),wantTagLine:_,wantCount:g,daysSincePublish:b,estimatedExposure:C,dailyWant:T,dailyEstimatedExposure:w,recent:E,hotDaily:D,barHot:O,burstLabel:k,showLine3:P,browseMode:y,estimatedExposureStr:C==null?`—`:s(C),dailyWantStr:T==null?`—`:c(T),dailyEstimatedExposureStr:w==null?`—`:c(w),dailyBrowseStr:M,dailyOrdersStr:N}}export{p as t};