@rfkit/charts 1.17.1 → 1.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -150,6 +150,8 @@ dialRef.current?.({
|
|
|
150
150
|
|
|
151
151
|
`PublishSpectrum` 支持推送内置频谱数据线,包括 `data`、`maxData`、`minData`、`avgData`、`thresholdData`、`templateData`、`backgroundNoiseData` 和 `extraData`。`thresholdData` 不传 `segmentOffset` / `offset` 时按整条门限替换;传入 `segmentOffset` 或 `offset` 时按局部门限写入。
|
|
152
152
|
|
|
153
|
+
频率规划数据 `FrequencyAllocationItem` 的 `startFrequency`、`stopFrequency`、`centerFrequency` 单位为 MHz,`stepFrequency` 和 `bandwidth` 单位为 kHz。`bandwidth` 表示信道带宽,不是整个频段跨度;例如 400~470 MHz 频段的 `bandwidth: 25` 在悬停详情中显示为 `25 kHz`,频段绘制与游标匹配仍使用完整起止频率范围。
|
|
154
|
+
|
|
153
155
|
`extraData` 默认保持完整数组设置语义;设置 `segmentedExtraData: true` 后,同一次推送中的每条额外频谱线会独立使用 `segmentOffset + offset` 拼接,并随主实时值同步缩放。
|
|
154
156
|
|
|
155
157
|
## 信号标注接入
|
package/index.js
CHANGED
|
@@ -3777,4 +3777,4 @@ ${ta(` ${t.systemDark}`,n)}
|
|
|
3777
3777
|
*
|
|
3778
3778
|
* This source code is licensed under the ISC license.
|
|
3779
3779
|
* See the LICENSE file in the root directory of this source tree.
|
|
3780
|
-
*/let FB={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};FB.node;let FW=Mr(FB),FG={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};FG.node;let FY=Mr(FG),FU=/*#__PURE__*/$.forwardRef(({className:e,...t},n)=>/*#__PURE__*/r(FP,{ref:n,"data-slot":"checkbox",className:oW("peer inline-flex size-4 shrink-0 items-center justify-center rounded-[var(--radius-micro)] border border-border bg-background text-primary shadow-xs transition-colors outline-none","focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground","data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground",e),...t,children:/*#__PURE__*/r(FO,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:"indeterminate"===t.checked?/*#__PURE__*/r(FW,{className:"size-3.5"}):/*#__PURE__*/r(FY,{className:"size-3.5"})})}));FU.displayName=FP.displayName;let FX=e=>"checked"===e||"indeterminate"===e&&"indeterminate",FK=({count:e,show:t,testId:r})=>t?/*#__PURE__*/n("span",{className:"shrink-0 tabular-nums text-[11px] font-normal text-muted-foreground","data-testid":r,children:["(",e,")"]}):null,FV=({source:e,type:t,leafKeysWithData:a,hiddenKeys:o,showCount:i,expanded:l,onToggleExpanded:s,onToggleNode:c})=>{let u=kA(a,o,t.leafKeys),d=`signal-tree-type-checkbox-${e.source}-${t.signalType}`,h=t.levels.length>0,p=h?void 0:t.color??kf[t.signalType].color;return /*#__PURE__*/n("div",{children:[/*#__PURE__*/n("div",{className:"group flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-type-${e.source}-${t.signalType}`,children:[h?/*#__PURE__*/r("button",{type:"button","aria-label":l?"折叠信号类型":"展开信号类型",className:"flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:s,children:l?/*#__PURE__*/r(Fk,{className:"size-3.5"}):/*#__PURE__*/r(FM,{className:"size-3.5"})}):/*#__PURE__*/r("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/n("label",{htmlFor:d,className:oW("flex min-w-0 flex-1 items-center gap-1.5","disabled"===u?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(FU,{id:d,"aria-label":`${e.label} ${t.label}`,checked:FX(u),disabled:"disabled"===u,onCheckedChange:()=>c(t.leafKeys)}),/*#__PURE__*/r("span",{className:oW("min-w-0 truncate text-xs font-medium","disabled"===u?"text-muted-foreground":"text-foreground/90"),"data-testid":`signal-tree-type-color-${e.source}-${t.signalType}`,style:"disabled"===u||null==p?void 0:{color:it(p)},children:t.label}),/*#__PURE__*/r(FK,{count:t.count,show:i,testId:`signal-tree-type-count-${e.source}-${t.signalType}`})]})]}),l&&h?/*#__PURE__*/r("div",{className:"relative ml-6 border-l border-border/60 pl-1",children:t.levels.map(n=>/*#__PURE__*/r(FQ,{source:e.source,signalType:t.signalType,level:n,leafKeysWithData:a,hiddenKeys:o,showCount:i,onToggleNode:c},n.leafKey))}):null]},t.signalType)},FQ=({source:e,signalType:t,level:a,leafKeysWithData:o,hiddenKeys:i,showCount:l,onToggleNode:s})=>{let c=kA(o,i,[a.leafKey]),u=`signal-tree-level-checkbox-${e}-${t}-${a.level}`;return /*#__PURE__*/r("div",{className:"group flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-level-${e}-${t}-${a.level}`,children:/*#__PURE__*/n("label",{htmlFor:u,className:oW("flex min-w-0 flex-1 items-center gap-1.5","disabled"===c?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(FU,{id:u,"aria-label":`${t} ${a.label}`,checked:FX(c),disabled:"disabled"===c,onCheckedChange:()=>s([a.leafKey])}),/*#__PURE__*/r("span",{className:oW("text-xs font-medium","disabled"===c?"text-muted-foreground":"text-foreground/80"),"data-testid":`signal-tree-level-color-${e}-${t}-${a.level}`,style:"disabled"===c?void 0:{color:it(a.color??kS[a.level].color)},children:a.label}),/*#__PURE__*/r(FK,{count:a.count,show:l,testId:`signal-tree-level-count-${e}-${t}-${a.level}`})]})})},FZ=({tree:e,leafKeysWithData:t,hiddenKeys:a,showCount:o,onToggleNode:i})=>{let[l,s]=b(()=>new Set),[c,d]=b(()=>new Set),h=u(e=>{s(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),p=u(e=>{d(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]);return /*#__PURE__*/r(g4,{viewportClassName:"h-auto max-h-[var(--radix-dropdown-menu-content-available-height)]",children:/*#__PURE__*/r("div",{className:"p-[calc(var(--size-gap-base)/2)]",children:e.sources.map((e,s)=>{let u=kA(t,a,e.leafKeys),d=`signal-tree-source-checkbox-${e.source}`;return /*#__PURE__*/n("div",{className:oW(s>0&&"mt-[calc(var(--size-gap-base)/2)] border-t border-border/60 pt-[calc(var(--size-gap-base)/2)]"),"data-testid":`signal-tree-source-${e.source}`,children:[/*#__PURE__*/n("div",{className:"flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-source-row-${e.source}`,children:[e.types.length>0?/*#__PURE__*/r("button",{type:"button","aria-label":c.has(e.source)?"展开数据来源":"折叠数据来源",className:"flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:()=>p(e.source),children:c.has(e.source)?/*#__PURE__*/r(FM,{className:"size-3.5"}):/*#__PURE__*/r(Fk,{className:"size-3.5"})}):/*#__PURE__*/r("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/n("label",{htmlFor:d,className:oW("flex min-w-0 flex-1 items-center gap-1.5","disabled"===u?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(FU,{id:d,"aria-label":`${e.label}筛选`,checked:FX(u),disabled:"disabled"===u,onCheckedChange:()=>i(e.leafKeys)}),/*#__PURE__*/r("span",{className:"text-xs font-medium text-foreground",children:e.label}),/*#__PURE__*/r(FK,{count:e.count,show:o,testId:`signal-tree-source-count-${e.source}`})]})]}),c.has(e.source)?null:/*#__PURE__*/r("div",{className:"ml-4 divide-y divide-border/40 border-l border-border/60 pl-1",children:e.types.map(n=>/*#__PURE__*/r(FV,{source:e,type:n,leafKeysWithData:t,hiddenKeys:a,showCount:o,expanded:!l.has(`${e.source}:${n.signalType}`),onToggleExpanded:()=>h(`${e.source}:${n.signalType}`),onToggleNode:i},n.signalType))})]},e.source)})})})},FJ=()=>{let{state:{signal:e},dispatch:t}=n9(),n=e.display,a=e.show,o=k8({respectVisibility:!1,filterHidden:!1}),i=m(()=>kR(o),[o]),l=m(()=>new Set(i.sources.flatMap(e=>e.dataLeafKeys)),[i]),s=m(()=>new Set(e.hiddenCategoryKeys??[]),[e.hiddenCategoryKeys]),c=(e.hiddenCategoryKeys?.length??0)>0,d=u(r=>{t({payload:{signal:{...e,display:r}}})},[e,t]),h=u(r=>{let n=kI(e.hiddenCategoryKeys??[],r,l);t({payload:{signal:{...e,hiddenCategoryKeys:n}}})},[e,l,t]);return a?/*#__PURE__*/r(vz,{leading:/*#__PURE__*/r(vN,{active:n,tone:"primary",onClick:()=>{d(!n)},title:`全部信号标注:${n?"显示":"隐藏"}`,children:/*#__PURE__*/r("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/r("path",{fill:"currentColor",d:"M563.072 376.48a79.456 79.456 0 0 0 28.928-61.12 80 80 0 1 0-160 0c0 24.672 11.392 46.432 28.928 61.12l-202.88 540.256a32 32 0 1 0 59.904 22.496l49.28-131.264h289.504l49.28 131.264a32.064 32.064 0 0 0 41.248 18.752c16.544-6.208 24.896-24.672 18.72-41.216l-202.912-540.288z m-1.312 178.624h-99.552L512 422.56l49.76 132.544z m-170.464 188.896l46.912-124.896h147.616l46.912 124.896h-241.44zM662.464 417.408a32 32 0 1 0 53.12 35.648 254.72 254.72 0 0 0 43.136-142.304 255.04 255.04 0 0 0-43.136-142.304 32 32 0 1 0-53.12 35.68 190.944 190.944 0 0 1 32.288 106.624 190.816 190.816 0 0 1-32.288 106.656zM289.888 453.024a32 32 0 1 0 53.184-35.616 191.36 191.36 0 0 1-32.32-106.656 191.328 191.328 0 0 1 32.32-106.656 32.064 32.064 0 0 0-8.768-44.416 32.096 32.096 0 0 0-44.416 8.768 254.976 254.976 0 0 0-43.136 142.304 254.976 254.976 0 0 0 43.136 142.272zM210.656 117.12A32 32 0 1 0 157.44 81.536a420.032 420.032 0 0 0-70.848 233.824 419.744 419.744 0 0 0 70.88 233.856 31.936 31.936 0 0 0 44.416 8.768 32 32 0 0 0 8.768-44.416 355.168 355.168 0 0 1-60.032-198.24A355.36 355.36 0 0 1 210.656 117.12zM896.224 154.304a416.96 416.96 0 0 0-38.912-72.768 32 32 0 1 0-53.184 35.584 354.912 354.912 0 0 1 60.064 198.24 355.2 355.2 0 0 1-60.064 198.208 32.032 32.032 0 0 0 53.184 35.648 418.816 418.816 0 0 0 70.88-233.856c0-55.68-10.752-109.856-31.968-161.056z"})})}),value:null,options:[],triggerTitle:`筛选信号标注类别${c?"(已应用筛选)":""}`,triggerTestId:"signal-tree-trigger",triggerContent:/*#__PURE__*/r("span",{className:"sr-only",children:c?"信号标注类别筛选(已应用)":"信号标注类别筛选"}),customContent:/*#__PURE__*/r("div",{"data-testid":"signal-tree-popover",children:/*#__PURE__*/r(FZ,{tree:i,leafKeysWithData:l,hiddenKeys:s,showCount:!1!==e.showCount,onToggleNode:h})}),contentClassName:"w-max max-w-[calc(100vw-1rem)] p-0",triggerClassName:oW("justify-center [&>span:last-child]:ml-0",c&&"bg-accent/72 shadow-[inset_0_0_0_1px_var(--mix-primary-28)] [&>span:last-child]:text-primary")}):null},F0=FJ,F1=[{component:yR,toolType:rl.AutorangingSwitch,supportedCharts:[],excludedCharts:[re.Heatmap,re.ScanDF360,re.LevelStream,re.LiteNormalized]},{component:y$,toolType:rl.UnitSwitch,supportedCharts:[],excludedCharts:[re.ScanDF360,re.LevelStream]},{component:vO,toolType:rl.GradientRibbon,supportedCharts:[re.Heatmap]},{component:vq,toolType:rl.SpacerLine,supportedCharts:[],excludedCharts:[re.ScanDF360,re.LevelStream]},{component:CI,toolType:rl.Reset,supportedCharts:[],excludedCharts:[re.LiteNormalized]},{component:FJ,toolType:rl.StationAllocationSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan,re.DDC]},{component:Cq,toolType:rl.SeriesControl,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan],props:{type:"dynamic"}},{component:C5,toolType:rl.FrequencyAllocationSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan,re.LiteNormalized]},{component:CH,toolType:rl.ZoomSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan,re.LiteNormalized]},{component:C6,toolType:rl.LimitSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan]},{component:Fy,toolType:rl.MarkersSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan]},{component:CL,toolType:rl.SegmentsDisplayControl,supportedCharts:[re.Scan]},{component:CK,toolType:rl.HeatmapCaptureSwitch,supportedCharts:[re.Heatmap]},{component:C0,toolType:rl.TimeRangeSwitch,supportedCharts:[re.Heatmap]},{component:C_,toolType:rl.SeriesDisplayControl,supportedCharts:[re.SingleFrequency,re.Scan,re.LiteNormalized,re.MScan]},{component:CW,toolType:rl.FluorescenceSwitch,supportedCharts:[re.SingleFrequency]},{component:C1,toolType:rl.DeltaMeasurementSwitch,supportedCharts:[re.SingleFrequency,re.Scan]}],F2=(e,t,r=[])=>!new Set(r).has(e.toolType)&&(e.supportedCharts.length>0?!!t&&e.supportedCharts.includes(t):!e.excludedCharts||!(e.excludedCharts.length>0)||!t||!e.excludedCharts.includes(t)),F5=(e,t)=>e.props?"dynamic"===e.props.type?{...e.props,type:t}:e.props:{},F4=({type:e})=>{let t=n7(e=>e.toolbar.show),n=n7(e=>e.toolbar.hiddenTools??[]),{width:a,pluginBoxWidth:o}=yt(),i=m(()=>({marginLeft:a,width:o,...iq}),[a,o]),l=m(()=>F1.filter(t=>F2(t,e,n)).map(t=>/*#__PURE__*/r(t.component,{...F5(t,e)},t.toolType)),[n,e]);return e!==re.Occupancy&&t?/*#__PURE__*/r("div",{className:"relative flex h-10 min-w-0 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground",style:i,children:/*#__PURE__*/r("div",{className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:/*#__PURE__*/r("div",{className:"flex h-full w-max min-w-full items-center gap-[var(--size-gap-base)]",children:l})})}):null},F3=/*#__PURE__*/c(F4);function F6(){let{state:{globalID:e,axisY:t,levelStream:r}}=n9(),n=t.range??ni,{cacheTime:a=2e4,granularity:o=1,maxPoints:i=500}=r??{},l=g(null),s=g(e),c=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(s.current,rt.Spectrum)({pstype:rr.Render,data:{[t3]:e.spectrumData}}),((e,t,r="0")=>tI(e,t,void 0,r))(s.current,rt.LevelStream)({pstype:rr.Render,data:e.probabilityRangeData})},[]),d=u(e=>{let{probabilityRangeData:t,spectrumData:r}=e;tO(s.current).getAllRawData=t=>({...tL().getAllRawData(t),levelStreamData:e}),c({probabilityRangeData:t,spectrumData:r})},[c]);if(h(()=>{s.current=e},[e]),!l.current&&e){l.current=new P({range:n,cacheTime:a,granularity:o,maxPoints:i,onLevelStreamUpdate:d});let{line:t}=t0("levelStream");((e,t,r="0")=>tI(e,t,void 0,r))(e,rt.Spectrum)({pstype:rr.Series,name:t3,color:t})}return h(()=>{l.current?.setConfig({range:n})},[n]),h(()=>{l.current?.setConfig({cacheTime:a})},[a]),h(()=>{l.current?.setConfig({granularity:o})},[o]),h(()=>{l.current?.setConfig({onLevelStreamUpdate:d})},[d]),{analyzer:l.current,updateLevelStreamData:c}}class F8 extends id{constructor(e){super({id:e.id,chart:null,orientation:e.orientation??z.Vertical})}init(){let{id:e,orientation:t}=this.state,r=[...t2()].reverse().map(e=>E(e));this.state.chart=new N({id:e,series:[{name:"bar",type:M.Bar,display:!0,color:t0("bar"),orientation:t}],range:[0,100],barValue2Color:!0,colors:r})}updateSeries(e){this.state.chart?.render({name:"bar",data:e})}}let F9=e=>{let{opacity:t}=e,{chart:n,Chart:a}=oY({Render:F8,params:{orientation:z.Horizontal}});return o1({moduleType:rt.LevelStream,chart:n,extractData:e=>e.data}),/*#__PURE__*/r(a,{style:m(()=>({opacity:t,zIndex:1}),[t])})},F7=F9,De=6,Dt=4,Dr=8,Dn=({axisLineWidth:e,inside:t,width:r})=>t?{axisX:e,majorTickEndX:6,majorTickStartX:0,minorTickEndX:4,minorTickStartX:0,textAlign:"left",textX:8}:{axisX:r-e,majorTickEndX:r,majorTickStartX:r-6,minorTickEndX:r,minorTickStartX:r-4,textAlign:"right",textX:r-8},Da=.5,Do=2,Di=4,Dl=100,Ds=1,Dc=.5,Du=.5;function Dd(e){let{ranging:t}=e,{range:r,disabled:n,placement:a,show:o}=n7(e=>e.axisY),i="inside"===a,l=g(null),s=g(null),[c,d]=b(0),[p,f]=b(window.devicePixelRatio||1),[v,y]=b(!1),[w,x]=b(0),k=u((e,t)=>{let r=.5*(Math.max(1,Math.round(t*p))%2!=0);return(Math.round(e*p-r)+r)/p},[p]),S=u((e,t,r)=>{let n=r/2;return Math.min(t-n,Math.max(n,e))},[]),M=m(()=>{let[e,t]=r;return{min:e,max:t}},[r]);h(()=>{let e=window.matchMedia(`(resolution: ${p}dppx)`),t=()=>f(window.devicePixelRatio||1);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[p]),h(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];t&&d(t.contentRect.height)});return t.observe(e),()=>t.disconnect()},[o]);let C=u((e,t)=>{if(t.useScientific)return e.toExponential(1);if(t.useKFormat){let r=e/1e3;return t.useDecimals?`${r.toFixed(1)}k`:`${Math.round(r)}k`}return t.useDecimals?e.toFixed(1):Math.round(e).toString()},[]),F=m(()=>{if(0===c)return{majorTicks:[],minorTicks:[]};let e=M.max-M.min,{interval:t,majorTickValues:r}=Cf([M.min,M.max]);if(!t||0===r.length)return{majorTicks:[],minorTicks:[]};let n=r.some(e=>Math.abs(e)>=1e3),a=r.some(e=>.01>Math.abs(e)&&0!==e),o={useScientific:a,useKFormat:n&&!a,useDecimals:r.some(e=>e%1!=0)},i=[];for(let t of r){let r=(M.max-t)/e*c,n=r,a=!0,l=!1,s=c-6,u=.3*c;r<-u||r>c+u?a=!1:r<6?(n=6,l=!0):r>s&&(n=s,l=!0),a&&i.push({value:t,position:r,textPosition:n,label:C(t,o),isAdjusted:l})}let l=[],s=t/2,u=s/e*c,d=e<1;if(u>=(d?8:4)&&c>100&&!d){let r=Math.ceil(M.min/s)*s;for(let n=r;n<=M.max;n+=s){if(Math.abs(n%t)<.1*s)continue;let r=(M.max-n)/e*c;r>=0&&r<=c&&l.push({value:n,position:r,textPosition:r,label:""})}}return{majorTicks:i,minorTicks:l}},[M,c,C]),D=u(()=>{let e=l.current;if(!e||0===c)return;let t=e.getContext("2d");if(!t)return;let r=e.getBoundingClientRect().width,n=Dn({axisLineWidth:.5,inside:i,width:r});e.width=r*p,e.height=c*p,e.style.width=`${r}px`,e.style.height=`${c}px`,t.setTransform(p,0,0,p,0,0),t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.clearRect(0,0,r,c),t.font="12px -apple-system, BlinkMacSystemFont, sans-serif",t.textAlign=n.textAlign,t.textBaseline="middle",t.lineWidth=Ds;let a=ia("--foreground",.5,s.current);F.majorTicks.forEach(e=>{t.fillStyle=a,t.strokeStyle=a,t.fillText(e.label,n.textX,e.textPosition),t.beginPath();let r=k(S(e.position,c,Ds),Ds);t.moveTo(n.majorTickStartX,r),t.lineTo(n.majorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=.5,F.minorTicks.forEach(e=>{t.beginPath();let r=k(S(e.position,c,.5),.5);t.moveTo(n.minorTickStartX,r),t.lineTo(n.minorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=.5,t.beginPath();let o=k(n.axisX,.5);t.moveTo(o,0),t.lineTo(o,c),t.stroke()},[F,c,p,i,k,S]);h(()=>{!1!==o&&D()},[D,o]),h(()=>ic(()=>{D()}),[D]);let z=u(e=>{n||(y(!0),x(e.clientY))},[n]),N=u(e=>{n||t.moveWheel?.(e)},[t,n]),E=u(e=>{if(n||!v||!s.current)return;let r=(e.clientY-w)/s.current.offsetHeight;Math.abs(r)>(M.max-M.min<1?.005:.01)&&(t.move?.(r),x(e.clientY))},[n,v,w,t,M]);return{canvasRef:l,containerRef:s,isDragging:v,range:M,handleMouseDown:z,handleMouseMove:E,handleMouseUp:u(()=>{n||y(!1)},[n]),handleMouseLeave:u(()=>{n||y(!1)},[n]),handleWheel:N,ticksData:F}}function Dh(e){let{chart:t}=e,{state:{axisY:n,globalID:a}}=n9(),{show:o}=n,i=nW({chart:t}),{axisYWidth:l,inside:s,marginLeft:c}=yt(),{canvasRef:u,containerRef:d,isDragging:h,handleMouseDown:p,handleMouseMove:f,handleMouseUp:m,handleMouseLeave:g,handleWheel:b}=Dd({ranging:i});return!1===o?null:/*#__PURE__*/r("div",{ref:d,className:oW("h-full select-none",s?"absolute left-0 top-0 z-[7]":"relative",h?"cursor-grabbing":"cursor-ns-resize"),style:{width:l,marginLeft:c},onMouseDown:p,onMouseMove:f,onMouseUp:m,onMouseLeave:g,onWheel:b,onDoubleClick:()=>{let{realRange:e}=nT({range:n.defaultRange??ni,unit:n.unit,step:n.step,globalID:a}),t=yz(n.restrict,e);i.setAxisY?.({realRange:t}),i.onChange?.()},children:/*#__PURE__*/r("canvas",{ref:u,className:"pointer-events-none absolute left-0 top-0 h-full w-full"})})}let Dp=(e,t,r)=>{let[n,a]=r;return e<=0||t.end<t.start||!Number.isFinite(n)||!Number.isFinite(a)||a<=n?null:{x:[100*t.start/e,(t.end+1)*100/e],y:[n,a]}},Df=(e,t)=>{let r=t.x[1]-t.x[0],n=t.y[1]-t.y[0],a=e=>Math.max(0,Math.min(100,t.x[0]+e*r/100));return{x:[a(e.leftPosition),a(e.leftPosition+e.width)],y:[t.y[1]-(e.position+e.height)*n/100,t.y[1]-e.position*n/100]}},Dm=(e,t)=>{let r=t.x[1]-t.x[0],n=t.y[1]-t.y[0];return{leftPosition:(e.x[0]-t.x[0])*100/r,width:(e.x[1]-e.x[0])*100/r,position:(t.y[1]-e.y[1])*100/n,height:(e.y[1]-e.y[0])*100/n}},Dg=(e,t)=>{let r=t.x[1]-t.x[0];return{left:-(100*t.x[0])/r,right:(100-t.x[0])*100/r,top:Math.min(0,100-e.height,e.position),bottom:Math.max(100,e.height,e.position+e.height)}},Db=(e,t,r=0)=>{let n=t(e.x[0]),a=t(e.x[1]),o=Number(n),i=Number(a);return n&&a&&Number.isFinite(o)&&Number.isFinite(i)?{deltaX:Math.abs(i-o),deltaY:Math.abs(e.y[1]-e.y[0]),centerFrequency:(o+i)/2,startFrequency:o,endFrequency:i,startAmplitude:e.y[0]+r,endAmplitude:e.y[1]+r}:null},Dv=1e-9,Dy=(e,t,r,n,a)=>{for(let o=n;o<=a;o+=1)if(r(e,o)!==r(t,o))return o;return a},Dw={position:40,height:20,leftPosition:40,width:20},Dx=()=>{let{state:{deltaMeasurement:{show:e,display:t,onChange:a},axisX:{frequencyFormat:o},axisY:{unit:i,range:l,renderRange:s},segments:c,zoom:{interval:d}}}=n9(),p=e&&t,[f,v]=b(null),y=g(null),w=g(a);w.current=a;let x=s??l??[-120,0],k=(l?.[0]??x[0])-x[0],S=m(()=>Dp(c.totalPoints??0,d,x),[c.totalPoints,d.start,d.end,x[0],x[1]]),M=m(()=>f&&S?Dm(f,S):null,[f,S]),C=m(()=>f&&o&&c.length?Db(f,o,k):null,[f,o,c,k]);h(()=>{p&&S&&v(e=>e??Df(Dw,S))},[p,S]),h(()=>{p||(y.current=null,v(null),w.current?.(null))},[p]);let F=u(e=>{let t=y.current??S;t&&v(Df(e,t))},[S]),D=u(e=>{let t=y.current??S;if(y.current=null,!t||!o||!c.length)return;let r=Df(e,t);v(r);let n=Db(r,o,k);n&&a?.(n)},[S,o,c,k,a]),z=(e,t=3)=>rF(e,t).formatted,N=(e,t=2)=>{let r=Number.parseFloat(e.toFixed(t));return`${r} ${i}`},E=m(()=>{if(!C)return{labels:void 0,middleContent:null};let e=C.deltaX<=1e-9,t=C.deltaY<=1e-9,a=e?3:Dy(C.startFrequency,C.endFrequency,z,3,6),o=t?2:Dy(C.startAmplitude,C.endAmplitude,N,2,4),l=z(C.startFrequency,a),s=z(C.endFrequency,a),c=N(C.endAmplitude,o),u=N(C.startAmplitude,o),d=z(C.deltaX,a),h=`${Number.parseFloat(C.deltaY.toFixed(o))} ${i}`,p=z(C.centerFrequency,a);return{labels:{left:e?void 0:l,right:e?void 0:s,top:t?void 0:c,bottom:t?void 0:u},middleContent:/*#__PURE__*/n("div",{className:"grid gap-0.5",children:[/*#__PURE__*/r("div",{children:e?`频点: ${l}`:`ΔX: ${d}`}),/*#__PURE__*/r("div",{children:t?`幅度: ${u}`:`ΔY: ${h}`}),!e&&/*#__PURE__*/n("div",{children:["中心: ",p]})]})}},[C,i]);if(!M||!S)return null;let T=y.current??S,R=f?Dm(f,T):M;return /*#__PURE__*/r(MF,{enabled:p,defaultRect:M,minSize:0,minWidth:0,minHeight:0,variant:"projected",interactionBounds:Dg(R,T),onDragStart:()=>{y.current=S},onChange:F,onDragEnd:D,zIndex:7,labels:E.labels,children:E.middleContent})},Dk=Dx,DS=({frequencyLeft:e,segments:t})=>rv(t)(e),DM=({e,zoom:t,segments:r,onChange:n,globalID:a})=>{let{realData:o}=tO(a).getAllRawData();if(!o)return;let i=o.length,{interval:{start:l,end:s}}=t,{left:c}=e,u=e.left+e.width,d=wL({coord:e,segments:r,zoom:t}),h=wL({coord:{left:u},segments:r,zoom:t}),p=Math.max(0,Math.ceil(i*d/100)-1),f=Math.ceil(i*h/100),{maxIndex:m}=tU(Array.from(o.slice(p,f)));n({frequency:(({frequencyLeft:e,segments:t})=>rv(t)(e))({frequencyLeft:(l+(p+m+1)/i*(s-l))*100/r.totalPoints,segments:r}),bandwidth:Math.round(1e3*rx({segments:r,endLeft:u,startLeft:c})),left:d,right:h})},DC=ri.DragFrame,DF=({id:e})=>{let{state:{zoom:a,segments:o,signalAnalysis:i,globalID:l},dispatch:s}=n9(),[c,d]=b(null),p=u((e,t=!1)=>{i.show&&i.display&&t?DM({e,zoom:a,segments:o,onChange:i.onChange,globalID:l}):s({payload:{zoom:{...a,interval:e.interval,isScanSegmentsUpdateMagnify:e.isScanSegmentsUpdateMagnify}}})},[i,a,o,l]),f=u((e,t,r,n)=>{if(e&&t&&n){let r=e.left,n=t.left,a=n-r;d({diffX:a,left:a>0?r:n,width:Math.abs(a),isScanSegmentsUpdateMagnify:a>0})}},[]),m=u(()=>{if(!c)return;let{left:e,width:t,isScanSegmentsUpdateMagnify:r,diffX:n}=c,{totalPoints:a}=o;if(r&&n>0){let n=SA({startPercent:e,endPercent:e+t,totalPoints:a}),o=n?n.end-n.start+1:0;n&&o>tV.ZOOM_MIN_RANGE&&p({interval:n,isScanSegmentsUpdateMagnify:r,left:e,width:t},!0)}n<0&&p({interval:{start:0,end:a-1},isScanSegmentsUpdateMagnify:r,left:e,width:t})},[c,o,a.interval.end,p]);return(h(()=>{if(a.show){let t=()=>{d(null),w8(e,DC)};wB(e,DC,t),wG(e,DC,()=>{m(),t()}),wY(e,DC,t),wK(e,DC,(...t)=>{w3(e,DC)&&f(t[0],t[1],t[2],t[3])})}},[a.show,e,m,f]),h(()=>{c||w8(e,DC)},[c,e]),a.show)?/*#__PURE__*/r(yn,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"absolute left-[-100%] top-0 h-full w-0 box-border border-2 border-dashed border-chart-grid-strong bg-chart-surface opacity-40",style:c?{left:`${c.left}%`,width:`${c.width}%`}:{},children:c&&!c.isScanSegmentsUpdateMagnify&&/*#__PURE__*/n(t,{children:[/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 opacity-20",style:{background:"linear-gradient(to top right, transparent, transparent calc(50% - 1px), var(--chart-grid-strong), transparent calc(50% + 1px), transparent)"}}),/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 opacity-20",style:{background:"linear-gradient(to bottom right, transparent, transparent calc(50% - 1px), var(--chart-grid-strong), transparent calc(50% + 1px), transparent)"}})]})})}):null},DD=/*#__PURE__*/c(DF),Dz=14,DN=5,DE=4,DT=({density:e="auto",channelCount:t})=>{let r="compact"===e||"auto"===e&&t>4;return{compact:r,laneHeight:r?5:14,showLabels:!r}},DR=null,DA=["#B22222","#CD5C5C","#FF6347","#FA8072","#F08080","#A0522D","#FF4500","#FF7F50","#B8860B","#FFA500","#808000","#9ACD32","#32CD32","#8FBC8F","#2E8B57","#3CB371","#00FA9A","#66CDAA","#7FFFD4","#2F4F4F","#008080","#00CED1","#20B2AA","#48D1CC","#4682B4","#778899","#87CEFA","#4169E1","#4169E1","#6495ED","#483D8B","#6A5ACD","#7B68EE","#9370DB","#9370DB","#9932CC","#8A2BE2","#BA55D3","#800080","#DDA0DD","#C71585","#DC143C"];function DI(e){let t=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,n=parseInt(e.slice(5,7),16)/255,a=Math.max(t,r,n),o=Math.min(t,r,n),i=0,l=0,s=(a+o)/2;if(a!==o){let e=a-o;switch(l=s>.5?e/(2-a-o):e/(a+o),a){case t:i=(r-n)/e+6*(r<n);break;case r:i=(n-t)/e+2;break;case n:i=(t-r)/e+4}i/=6}return{h:360*i,s:100*l,l:100*s}}let DP=[...DA].map(e=>({color:e,hsl:DI(e)})).sort((e,t)=>Math.abs(e.hsl.h-t.hsl.h)>10?e.hsl.h-t.hsl.h:e.hsl.l-t.hsl.l).map(e=>e.color);function DL(e){let t=[...e].sort((e,t)=>Number(e.startFrequency)-Number(t.startFrequency));return t.map((e,r)=>{let n=t.length,a=DP.length,o=Math.floor(r/n*a),i=Math.floor((r+1)/n*a),l=DP[Math.min(o,a-1)],s=DP[Math.min(i,a-1)],c=r===n-1?DP[a-1]:s;return{...e,color:l,gradientColors:[l,c]}})}let DO=[{startFrequency:87,stopFrequency:108,stepFrequency:100,bandwidth:150,modulation:"AM",demodulation:"不解调",status:"合法",title:"FM广播",description:"FM调频广播频段,用于音频广播服务"},{startFrequency:108,stopFrequency:118,stepFrequency:50,bandwidth:100,modulation:"FM",demodulation:"解调",status:"合法",title:"航空导航",description:"航空无线电导航频段,用于仪表着陆系统等"},{startFrequency:118,stopFrequency:137,stepFrequency:25,bandwidth:50,modulation:"AM",demodulation:"解调",status:"合法",title:"航空语音通信",description:"民用航空语音通信频段"},{startFrequency:121,stopFrequency:122,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"紧急通信",description:"紧急情况通信专用频段"},{startFrequency:136,stopFrequency:174,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"对讲通信",description:"专业无线对讲通信频段"},{startFrequency:161,stopFrequency:162,stepFrequency:25,bandwidth:50,modulation:"GMSK",demodulation:"解调",status:"合法",title:"AIS船舶通信",description:"船舶自动识别系统(AIS)专用频段"},{startFrequency:351,stopFrequency:400,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"集群通信",description:"专业集群通信系统频段"},{startFrequency:400,stopFrequency:470,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"专业对讲",description:"专业无线对讲通信频段"},{startFrequency:534,stopFrequency:542,stepFrequency:100,bandwidth:8e3,modulation:"OFDM",demodulation:"解调",status:"合法",title:"数字电视",description:"数字电视广播频段"},{startFrequency:622,stopFrequency:630,stepFrequency:100,bandwidth:8e3,modulation:"OFDM",demodulation:"解调",status:"合法",title:"数字电视",description:"数字电视广播频段"},{startFrequency:703,stopFrequency:733,stepFrequency:100,bandwidth:3e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G上行(广电/移动)",description:"广电和移动5G网络上行频段"},{startFrequency:758,stopFrequency:788,stepFrequency:100,bandwidth:3e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G下行(广电/移动)",description:"广电和移动5G网络下行频段"},{startFrequency:806,stopFrequency:821,stepFrequency:25,bandwidth:50,modulation:"π/4DQPSK",demodulation:"解调",status:"合法",title:"数字集群上行",description:"数字集群通信系统(TETRA)上行频段"},{startFrequency:824,stopFrequency:835,stepFrequency:100,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"电信3G/4G/5G上行",description:"中国电信3G/4G/5G网络上行频段"},{startFrequency:851,stopFrequency:866,stepFrequency:25,bandwidth:50,modulation:"π/4DQPSK",demodulation:"解调",status:"合法",title:"数字集群下行",description:"数字集群通信系统(TETRA)下行频段"},{startFrequency:869,stopFrequency:880,stepFrequency:100,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"电信3G/4G/5G下行",description:"中国电信3G/4G/5G网络下行频段"},{startFrequency:885,stopFrequency:889,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"GSM-R上行",description:"铁路专用GSM-R网络上行频段"},{startFrequency:889,stopFrequency:904,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"移动2G/4G上行",description:"中国移动2G/4G网络上行频段"},{startFrequency:904,stopFrequency:915,stepFrequency:200,bandwidth:200,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/3/4/5G上行",description:"中国联通2G/3G/4G/5G网络上行频段"},{startFrequency:930,stopFrequency:934,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"GSM-R下行",description:"铁路专用GSM-R网络下行频段"},{startFrequency:934,stopFrequency:949,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"移动2G/4G下行",description:"中国移动2G/4G网络下行频段"},{startFrequency:949,stopFrequency:960,stepFrequency:200,bandwidth:200,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/3/4/5G下行",description:"中国联通2G/3G/4G/5G网络下行频段"},{startFrequency:1164,stopFrequency:1189,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L5频段",description:"全球定位系统GPS L5频段"},{startFrequency:1215,stopFrequency:1234,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L2频段",description:"全球定位系统GPS L2频段"},{startFrequency:1447,stopFrequency:1467,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"政务公安专网",description:"政务和公安专用LTE网络频段"},{startFrequency:1563,stopFrequency:1587,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L1频段",description:"全球定位系统GPS L1频段"},{startFrequency:1710,stopFrequency:1735,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"移动2G/4G上行",description:"中国移动2G/4G网络上行频段"},{startFrequency:1735,stopFrequency:1765,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/4G上行",description:"中国联通2G/4G网络上行频段"},{startFrequency:1805,stopFrequency:1830,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"移动2G/4G下行",description:"中国移动2G/4G网络下行频段"},{startFrequency:1830,stopFrequency:1860,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/4G下行",description:"中国联通2G/4G网络下行频段"},{startFrequency:1885,stopFrequency:1915,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动4G",description:"中国移动4G网络频段"},{startFrequency:1920,stopFrequency:1940,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"电信/联通5G上行",description:"中国电信/联通5G网络上行频段"},{startFrequency:1940,stopFrequency:1965,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"联通3/4/5G上行",description:"中国联通3G/4G/5G网络上行频段"},{startFrequency:2110,stopFrequency:2130,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"电信/联通5G下行",description:"中国电信/联通5G网络下行频段"},{startFrequency:2300,stopFrequency:2320,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"联通4G",description:"中国联通4G网络频段"},{startFrequency:2320,stopFrequency:2370,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动4G",description:"中国移动4G网络频段"},{startFrequency:2400,stopFrequency:2500,stepFrequency:1,bandwidth:20,modulation:"OFDM",demodulation:"解调",status:"合法",title:"ISM 2.4GHz",description:"WIFI、蓝牙、无人机等使用频段"},{startFrequency:2515,stopFrequency:2675,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动5G/4G",description:"中国移动5G和4G网络频段"},{startFrequency:3300,stopFrequency:3600,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G频段",description:"电信、联通、广电5G网络频段"},{startFrequency:4800,stopFrequency:4900,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动5G",description:"中国移动5G网络频段"},{startFrequency:4900,stopFrequency:4960,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"广电5G",description:"中国广电5G网络频段"},{startFrequency:5725,stopFrequency:5875.5,stepFrequency:5,bandwidth:20,modulation:"OFDM",demodulation:"解调",status:"合法",title:"ISM 5GHz",description:"WIFI、无人机等使用频段"}],Dq="rfkit-charts-frequency-allocation",D$=e=>!!e&&"object"==typeof e&&2===e.version&&Array.isArray(e.channels),D_=()=>{let e=localStorage.getItem(Dq);if(!e)return null;let t=JSON.parse(e);return Array.isArray(t)||D$(t)?t:null},Dj=()=>{let e=D_();return Array.isArray(e)?e:null},DH=()=>{let e=D_();return D$(e)?e.channels:null},DB=e=>{localStorage.setItem(Dq,JSON.stringify(e))},DW=e=>{localStorage.setItem(Dq,JSON.stringify({version:2,channels:e}))},DG=()=>{localStorage.removeItem(Dq)},DY=()=>null!==localStorage.getItem(Dq),DU="default",DX=(e,t)=>e.id||e.title||`${DU}-${t}`,DK=e=>e.id?`channel:id:${e.id}`:e.title?`channel:title:${e.title}`:"channel:anonymous",DV=(e,t,r)=>{let n=t.get(e)??0,a=0===n?e:`${e}#${n+1}`;for(;r.has(a);)n+=1,a=`${e}#${n+1}`;return t.set(e,n+1),r.add(a),a},DQ=(e,t)=>{let r=new Map,n=new Set;return e.map((e,r)=>({id:DX(e,r),renderKeyBase:DK(e),title:e.title,data:t(e.data??[])})).filter(e=>e.data.length>0).map(({renderKeyBase:e,...t})=>({...t,renderKey:DV(e,r,n)}))},DZ=(e,t)=>[{id:DU,renderKey:`channel:id:${DU}`,data:t(e)}];function DJ({data:e,channels:t,cachedData:r,cachedChannels:n,presetData:a,normalizeData:o}){if(t)return t.length?DQ(t,o):DZ(e?.length?e:a,o);if(n?.length)return DQ(n,o);let i=e??[];return DZ(r&&r.length>0?r:i.length>0?i:a,o)}function D0({data:e,channels:t}){return DJ({data:e,channels:t,cachedData:Dj(),cachedChannels:DH(),presetData:DO,normalizeData:DL})}function D1(e){return D0({data:e})[0]?.data??[]}let D2=e=>{if(null!=e.startFrequency&&null!=e.stopFrequency){let t=rE({startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)});if(t)return{start:t.startFreq,stop:t.stopFreq,type:"range"}}return null},D5=e=>JSON.stringify([e.title,e.startFrequency,e.stopFrequency,e.centerFrequency,e.bandwidth,e.stepFrequency,e.modulation,e.description,e.demodulation,e.status]),D4=e=>e.id?`band:id:${e.id}`:`band:fingerprint:${D5(e)}`,D3=(e,t,r)=>{let n=t.get(e)??0,a=0===n?e:`${e}#${n+1}`;for(;r.has(a);)n+=1,a=`${e}#${n+1}`;return t.set(e,n+1),r.add(a),a},D6=({segments:e,allocations:t,channelIndex:r,channelTitle:n})=>{if(!e.length||!t.length)return[];let a=e.reduce((e,t)=>e+t.point,0),o=new Map,i=new Set,l=t.map(e=>({band:e,renderKey:D3(D4(e),o,i)}));return e.map((t,o)=>{let i=l.map(({band:e,renderKey:a})=>{let o=D2(e);if(!o||o.stop<t.start||o.start>t.stop)return null;let{left:i,width:l}=rI({startFreq:o.start,stopFreq:o.stop},t);return{band:e,renderKey:a,range:o,channelIndex:r??0,channelTitle:n,position:{left:`${i}%`,width:`${l}%`}}}).filter(e=>null!==e),s=t.point/a*100,c=e.slice(0,o).reduce((e,t)=>e+t.point/a*100,0);return{segment:t,segmentIndex:o,bandPositions:i,style:{left:`${c}%`,width:`${s}%`}}})},D8=({segments:e,channels:t})=>t.map((t,r)=>({channel:t,channelIndex:r,segmentData:D6({segments:e,allocations:t.data,channelIndex:r,channelTitle:t.title})})).filter(e=>e.segmentData.some(e=>e.bandPositions.length>0)),D9=e=>e.map(e=>{let t=calculateFrequencyRange({frequency:null!=e.centerFrequency?Number(e.centerFrequency):void 0,bandwidth:null!=e.bandwidth?Number(e.bandwidth):void 0,startFrequency:null!=e.startFrequency?Number(e.startFrequency):void 0,stopFrequency:null!=e.stopFrequency?Number(e.stopFrequency):void 0});return t?{item:e,range:t,width:Math.abs(t.stopFreq-t.startFreq),center:(t.startFreq+t.stopFreq)/2,title:String(e.title??"")}:null}).filter(e=>null!==e),D7=({rangeIndex:e,frequency:t})=>{let r;if(Number.isFinite(t)&&e.length){for(let n of e){let{range:e}=n;if(t<e.startFreq||t>e.stopFreq)continue;if(!r){r=n;continue}let a=n.width-r.width;if(a<0){r=n;continue}if(a>0)continue;let o=Math.abs(n.center-t)-Math.abs(r.center-t);if(o<0){r=n;continue}!(o>0)&&0>n.title.localeCompare(r.title)&&(r=n)}return r?.item}},ze=({allocations:e,frequency:t})=>D7({rangeIndex:D9(e),frequency:t});function zt(){let e=useSelector(e=>e.frequencyAllocation.data);return useMemo(()=>resolveFrequencyAllocationData(e),[e])}function zr(){let e=n7(e=>e.frequencyAllocation.data),t=n7(e=>e.frequencyAllocation.channels);return m(()=>D0({data:e,channels:t}),[e,t])}function zn({frequency:e,cursorSample:t}){let r=useSelector(e=>e.cursor),n=useSelector(e=>e.segments),a=useSelector(e=>e.frequencyAllocation.display),o=useSelector(e=>e.frequencyAllocation.show),i=t?.coord.left??r.coord.left,l=useFrequencyAllocationData(),s=useMemo(()=>createFrequencyAllocationRangeIndex(l),[l]),c=useMemo(()=>!!t||hasActiveSpectrumCursor(r),[r,t]),u=useMemo(()=>c&&"number"==typeof i?calculateCursorPosition(i,n):{segmentIndex:-1,pointIndex:-1},[c,i,n]);return useMemo(()=>{if(!o||!a||!e||!n?.length||!c||!n[u.segmentIndex])return;let t=getCursorFrequencyAtPosition(n,u),r=Number.isFinite(t)?t:Number(e);if(Number.isFinite(r))return findFrequencyAllocationInRangeIndex({rangeIndex:s,frequency:r})},[s,u.segmentIndex,a,e,c,n,o])}let za=null,zo=({allocationInfo:e,variant:t="default"})=>{if(!e)return null;let{title:a,description:o,startFrequency:i,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:u,modulation:d,channelTitle:h}=e;return /*#__PURE__*/n("div",{className:oW("text-xs leading-5 text-popover-foreground","board"===t&&"mt-[calc(var(--size-gap-base)/2)] border-t border-dashed border-border pt-[calc(var(--size-gap-base)/2)]"),children:[a?/*#__PURE__*/r("div",{className:"mb-1 font-bold",children:a}):null,/*#__PURE__*/n("div",{className:"mb-1 text-primary",children:[h?/*#__PURE__*/n("div",{children:["通道:",h]}):null,i&&l&&/*#__PURE__*/n("div",{children:["频率范围:",i," - ",l]}),s?/*#__PURE__*/n("div",{children:["中心频率:",s," MHz"]}):null,c?/*#__PURE__*/n("div",{children:["步进:",c," kHz"]}):null,u?/*#__PURE__*/n("div",{children:["带宽:",u," MHz"]}):null,d?/*#__PURE__*/n("div",{children:["调制方式:",d]}):null]}),o?/*#__PURE__*/r("div",{className:"leading-5 opacity-85",children:o}):null]})},zi=/*#__PURE__*/a.memo(zo),zl=/*#__PURE__*/c(({style:e,bandPositions:t,showLabels:n,onMouseEnter:a,onMouseMove:o,onMouseLeave:i})=>/*#__PURE__*/r("div",{className:"absolute top-0 h-full [contain:layout]",style:e,children:t.map(e=>{let{band:t,position:l,renderKey:s}=e;return /*#__PURE__*/r("div",{className:"pointer-events-auto absolute flex h-full items-center justify-center overflow-hidden px-1 text-xs text-foreground/90 opacity-60 backdrop-blur-sm transition-[opacity,box-shadow] duration-200 hover:z-[1] hover:opacity-100 hover:shadow-lg",style:{...t.gradientColors?{backgroundImage:`linear-gradient(to right, ${t.gradientColors[0]}, ${t.gradientColors[1]})`}:{backgroundColor:t.color||"var(--primary)"},left:l.left,width:l.width},onMouseEnter:a(e),onMouseMove:o,onMouseLeave:i,children:n?/*#__PURE__*/r("span",{className:"truncate",children:t.title}):null},s)})})),zs=zl,zc=({title:e,description:t,visible:n,x:a,y:o,startFrequency:i,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:d,modulation:p,channelTitle:f,positionRef:m,scheduleRef:b})=>{let v=g(null),y=g(null),w=gn("tooltip"),x=u(()=>{if(!n||!v.current)return;let e=v.current,t=e.offsetWidth,r=e.offsetHeight,i=window.innerWidth,l=window.innerHeight,s=m.current??{x:a,y:o},c=s.x,u=s.y,d=Math.max(12,Math.min(c+t>i-12?c-t-10:c,i-t-12)),h=Math.max(12,Math.min(u+r>l-12?u-r-10:u,l-r-12));e.style.transform=`translate3d(${d}px, ${h}px, 0)`},[m,n,a,o]),k=u(()=>{n&&null===y.current&&(y.current=requestAnimationFrame(()=>{y.current=null,x()}))},[x,n]);return(h(()=>(b.current=k,()=>{b.current===k&&(b.current=null)}),[k,b]),h(()=>{if(n)return k(),()=>{null!==y.current&&(cancelAnimationFrame(y.current),y.current=null)}},[w,k,n]),n&&w)?/*#__PURE__*/R(/*#__PURE__*/r("div",{ref:v,"data-rfkit-frequency-allocation-tooltip":"true",className:"pointer-events-none fixed z-[1] max-w-[300px] rounded-[var(--radius-surface)] border border-border/70 bg-chart-panel/95 p-[var(--size-gap-base)] text-chart-panel-foreground shadow-lg backdrop-blur-md",style:{left:0,top:0,transform:`translate3d(${a}px, ${o}px, 0)`},children:/*#__PURE__*/r(zi,{allocationInfo:{title:e,description:t,startFrequency:i,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:d,modulation:p,channelTitle:f}})}),w):null},zu=zc,zd=()=>{let e=n7(e=>e.axisX.unit),t=n7(e=>e.segments),a=n7(e=>e.frequencyAllocation.display),o=n7(e=>e.frequencyAllocation.show),i=n7(e=>e.frequencyAllocation.density),l=n7(e=>e.zoom.style),s=zr(),[c,d]=b({visible:!1,x:0,y:0}),h=g({x:0,y:0}),p=g(null),f=u(e=>{h.current={x:e.clientX+10,y:e.clientY+10},p.current?.()},[]),v=m(()=>D8({segments:t,channels:s}),[t,s]),{laneHeight:y,showLabels:w}=DT({density:i,channelCount:v.length}),x=Math.max(y,v.length*y),k=u(e=>{d(t=>({...t,...e}))},[]),S=u(({band:t,channelTitle:r,range:n})=>a=>{f(a);let o={...t,visible:!0,x:h.current.x,y:h.current.y,channelTitle:r,startFrequency:`${n.start}${e}`,stopFrequency:`${n.stop}${e}`};"centerBandwidth"===n.type&&null!=n.frequency&&null!=n.bandwidth&&(o.centerFrequency=`${n.frequency}${e}`,o.bandwidth=`${n.bandwidth}${e}`),k(o)},[e,k,f]),M=u(e=>{f(e)},[f]),C=u(()=>{k({visible:!1})},[k]);return o&&a&&0!==v.length?/*#__PURE__*/n("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] flex w-full select-none items-center overflow-hidden",style:{height:x,backgroundColor:"var(--mix-chart-surface-12)"},children:[/*#__PURE__*/r("div",{className:"absolute right-0 top-0 h-full w-full will-change-transform",style:l??void 0,children:v.map(({channel:e,channelIndex:t,segmentData:n})=>/*#__PURE__*/r("div",{className:"absolute left-0 w-full",style:{bottom:t*y,height:y},children:n.map(({segmentIndex:t,bandPositions:n,style:a})=>/*#__PURE__*/r(zl,{style:a,bandPositions:n,showLabels:w,onMouseEnter:S,onMouseMove:M,onMouseLeave:C},`${e.renderKey}-segment-${t}`))},e.renderKey))}),/*#__PURE__*/r(zc,{...c,positionRef:h,scheduleRef:p})]}):null},zh=zd,zp=e=>{let[t,r]=b(0);return h(()=>{if(!e)return;let t=tq(e,"FrequencyTagLineBoard",()=>{r(e=>e+1)});return()=>{t?.()}},[e]),t},zf=({id:e})=>{let{state:{frequencyTagLine:t,cursor:n}}=n9(),{show:a,display:o,left:i,onChange:l}=t,s=zp(e),c=n.show&&n.active&&n.event?.sourceType===rt.Spectrum,d=u(e=>{if(!e)return;let{index:t,frequency:r}=e;tY(r)&&l({index:t,frequency:r})},[l]);return a&&o&&!c?/*#__PURE__*/r("div",{className:"absolute bottom-5 right-[34px] z-[6] h-auto w-auto",children:/*#__PURE__*/r(Ss,{left:i,updateKey:s,onChange:d,showSignalInfo:!1})}):null},zm=/*#__PURE__*/a.memo(zf),zg=()=>{let{state:{frequencyTagLine:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{frequencyTagLine:{...e,display:!!r}}})},[e]),o=useMemo(()=>/*#__PURE__*/_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:/*#__PURE__*/_jsx("path",{d:"M288 128H896l-120 256L896 640H288v320H192v-896h96V128z",fillOpacity:".65",fill:"currentColor",style:{transition:"fill 0.2s ease"}})}),[r]);return n?/*#__PURE__*/_jsx(IconBox,{active:r,tone:"primary",onClick:()=>a(!r),title:"频率标记线显示控制",children:o}):null},zb=/*#__PURE__*/null,zv=ri.FrequencyTagLine,zy=e=>{let{state:{frequencyTagLine:t},dispatch:n}=n9(),{show:a,display:o,left:i,onChange:l}=t,{id:s}=e,c=g(t);return(h(()=>{c.current=t},[t]),h(()=>{let e=wG(s,zv,()=>{a&&o&&w8(s,zv)}),t=wY(s,zv,()=>{a&&o&&w8(s,zv)});return()=>{e?.(),t?.()}},[s,a,o,l]),h(()=>{let e=wB(s,zv,e=>{a&&o&&n({payload:{frequencyTagLine:{...c.current,...e,id:s}}})}),t=wK(s,zv,(e,t)=>{a&&o&&(w3(s,zv),n({payload:{frequencyTagLine:{...c.current,...t,id:s}}}))});return()=>{e?.(),t?.()}},[s,a,o,n]),h(()=>{n({payload:{frequencyTagLine:{...t,left:-100}}})},[a]),a&&o)?/*#__PURE__*/r(yn,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"relative flex h-full w-px border-l border-dashed border-chart-highlight/80 opacity-80",style:{left:`${i}%`}})}):null},zw=/*#__PURE__*/a.memo(zy),zx={color:tQ},zk={borderColor:tQ},zS=({value:e,onChange:t,dragging:a})=>{let{state:{axisY:o,limit:i}}=n9(),{label:l,disabled:s}=i,{unit:c="",range:d=ni,step:h=na}=o,[p,f]=d,v=m(()=>rm(c)?nb(0):0,[c]),y=u(e=>(f-e-v)/(f-p)*100,[f,v,p]),w=m(()=>y(e),[y,e]),x=m(()=>Math.round(v+e),[v,e]),[k,S]=b(!1),M=g(null),C=u(e=>{switch(e.key){case"Enter":{if(!M.current){S(!1);break}let e=Number(M.current.value);!Number.isNaN(e)&&e>=p&&e<=f&&(t?.(Math.floor(e-v)),M.current.blur()),S(!1);break}case"Escape":S(!1)}},[M,d,v,t]);return /*#__PURE__*/r("div",{className:"relative h-full w-full",children:/*#__PURE__*/n("div",{className:"absolute right-0 h-0 w-full",style:{top:`${w}%`},children:[!k||s?/*#__PURE__*/n("button",{type:"button",disabled:s,className:`${a?"pointer-events-none":"pointer-events-auto"} absolute right-7 top-[-28px] z-[8] flex h-6 appearance-none items-center justify-center rounded-[var(--radius-control)] border-0 bg-secondary px-2 text-xs text-foreground`,style:zx,onClick:()=>S(!0),children:[l," ",x,c]}):/*#__PURE__*/n("div",{className:"pointer-events-auto absolute right-7 top-[-28px] z-[8] flex h-6 items-center justify-between bg-secondary px-2 text-xs text-foreground",style:zx,children:[l," ",/*#__PURE__*/r("input",{ref:M,type:"number","aria-label":`${l}${c}门限值`,defaultValue:x,min:p,max:f,step:h/5,className:"h-auto w-14 border-none bg-transparent p-0 text-center outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",style:zx,onKeyDown:C}),/*#__PURE__*/r("div",{className:"flex items-center",children:c})]}),/*#__PURE__*/r("div",{className:"absolute right-0 top-[-0.5px] z-[8] h-0 w-full border-b border-dashed",style:zk})]})})},zM=zS,zC=ri.Limit,zF=10,zD=({id:e})=>{let{state:{limit:t,segments:n,axisY:a,system:o},dispatch:i}=n9(),{show:l,active:s,disabled:c,value:d,onChange:p,unified:f}=t,[v,y]=a.range,{totalPoints:w}=n,x=m(()=>l&&s,[l,s]),[k,S]=b(0/0),M=g(null),C=g(!1),F=g(t);h(()=>{F.current=t},[t]);let D=u((e,t)=>{let r,n=f?[t]:((r=[...F.current.value])[e]=t,r);i({payload:{limit:{...F.current,value:n}}})},[i,f]),z=u(()=>{p(f?Array.from({length:n.length},()=>F.current.value[0]):F.current.value)},[p,f,n.length]);return(h(()=>{wB(e,zC,e=>{if(!x||c||!e?.left||!e?.top)return;let t=e.left,r=f?0:n.findIndex(e=>e.progress[0]<=t&&t<e.progress[1]);if(!Number.isFinite(r)||r<0){S(0/0),M.current=null,C.current=!1;return}let i=y-v;if(!Number.isFinite(i)||0===i)return;let l=rm(a.unit)?nb(0):0,s=F.current.value[r],u=(y-s-l)/i*100,d=Math.max(1.2,10/Math.max(1,o.height||1)*100);if(Math.abs(e.top-u)>d){S(0/0),M.current=null,C.current=!1;return}S(r),M.current=s,C.current=!0}),wY(e,zC,()=>{x&&!c&&(C.current&&z(),S(0/0),M.current=null,C.current=!1,w8(e,zC))}),wG(e,zC,()=>{x&&!c&&(C.current&&z(),S(0/0),M.current=null,C.current=!1,w8(e,zC))}),wK(e,zC,(t,r,n)=>{if(x&&!c&&tY(k)&&w3(e,zC)&&n?.top){let e=y-v;if(!Number.isFinite(e)||0===e)return;let t=(M.current??F.current.value[k])-n.top*e;M.current=t,D(k,t)}})},[x,c,k,n,e,D,z,f,v,y,a.unit,o.height]),x)?f?/*#__PURE__*/r(yn,{className:"z-[7]",children:/*#__PURE__*/r("div",{className:"h-full w-full",style:{opacity:+!!tY(d[0])},children:/*#__PURE__*/r(zS,{id:e,value:d[0],onChange:e=>D(0,e),dragging:tY(k)})})}):/*#__PURE__*/r(yn,{className:"z-[7]",children:n?.map((t,n)=>/*#__PURE__*/r("div",{style:{width:`${100*t.point/w}%`,opacity:+!!tY(d[n])},className:"h-full w-[30%]",children:/*#__PURE__*/r(zS,{id:e,value:d[n],onChange:e=>D(n,e),dragging:tY(k)},t.index)},t.index))}):null},zz=zD,zN=ri.Markers,zE=6,zT=8,zR=e=>{let{id:t,markers:r,display:n,fixed:a,readonly:o,onCreateMarker:i,onDeleteMarker:l,onUpdateMarker:s,onToggleSelect:c,onHover:d,onResetHover:p}=e,f=g({isDown:null,dragStart:null,isHover:"",hoverId:null}),m=u(()=>document.getElementById(w_(t))??document.getElementById(t),[t]),b=u(e=>{if(!e||!r||0===r.length)return null;let{left:t}=e;if(void 0===t)return null;let n=m();if(!n)return null;let{width:a}=n.getBoundingClientRect();for(let e=0;e<r.length;e+=1){let n=r[e];if(n&&Math.abs(t-n.left)*a/100<=6)return{...n,index:e}}return null},[m,r]),v=u(e=>{let t=m();if(!t)return"";let n=t.getBoundingClientRect().width,a="";for(let t=0;t<r.length;t+=1){let o=r[t];if(o&&Math.abs(e.left-o.left)*n/100<=8){a={...o,index:t};break}}return a},[m,r]);return h(()=>{if(o)return;let e=wH(t,zN,(e,t)=>{if(n&&void 0!==t.left){let e=v({left:t.left}),r="object"==typeof e?e.id:null;if(f.current.hoverId===r){f.current.isHover=e;return}f.current.isHover=e,f.current.hoverId=r,d({left:t.left})}}),r=wK(t,zN,(e,r)=>{let{isDown:o}=f.current;n&&o&&w3(t,zN)&&!a&&s(o.id,{left:r.left,top:r.top})}),u=wB(t,zN,e=>{if(!n)return;let t=b(e)||("object"==typeof f.current.isHover?f.current.isHover:null);t&&!a&&(f.current.isDown=t)}),h=wG(t,zN,()=>{n&&(f.current.isDown=null,w8(t,zN))}),m=wY(t,zN,()=>{if(!n)return;let e=null!==f.current.hoverId;f.current.isDown=null,f.current.isHover="",f.current.hoverId=null,w8(t,zN),e&&p()}),g=wQ(t,zN,(e,r)=>{if(!n||!w3(t,zN))return;let a=b(r)||("object"==typeof f.current.isHover?f.current.isHover:null);a?.id&&c(a.id)}),y=wW(t,zN,(e,r)=>{if(!n||!w3(t,zN)||void 0===r.left)return!1;let a=v({left:r.left});return a&&"object"==typeof a&&a.id?l(a.id):i({left:r.left}),!0});return()=>{e?.(),r?.(),u?.(),h?.(),m?.(),g?.(),y?.()}},[t,n,r,a,o,i,l,s,c,d,p,b,v]),{isDown:f.current.isDown}},zA=t0("marker"),zI=e=>C7(e);function zP(e,t,r){let{needsMaxPeak:n=!1,needsTopPeaks:a=!1}=r||{},o=null,i=null;try{let t=tO(e).getAllRawData()[t3];if(t?.peaks?.peaks&&Array.isArray(t.peaks.peaks)){let e=t.peaks.peaks;return n&&e.length>0&&(o=e[0]),a&&(i=e),{maxPeak:o,topPeaks:i}}}catch(e){console.warn("[useMarkers] Failed to get precomputed peaks:",e)}return n&&(o=Fu(t)),a&&(i=Fh(t,2)),{maxPeak:o,topPeaks:i}}let zL=e=>{let{id:t,globalID:r,onChange:n}=e,[a,o]=b({markers:[],colorIndex:0,isDown:null,isHover:"",peak:null,hasPeak:!1}),i=g(new Float32Array),l=u((e,t)=>{let{axisY:{unit:n},axisX:{frequencyFormat:a}}=C7(r),o=e.left,{peak:l}=e,s=t?.data??i.current;s&&0!==s.length||(s=tO(r).getAllRawData()[t3]),i.current=s;let c=Fc({left:o,globalID:r}),{outsideLeft:u,multiple:d}=c,{insideLeft:h}=c,p=s.length,f=Math.floor(p*h/100);if(100===h&&(f=p-1),"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank){let n=t?.topPeaks;n||(n=zP(r,s,{needsTopPeaks:!0}).topPeaks);let a=n?.[e.peakRank];a&&(h=((f=a.index)+.5)*100/p)}else if(l){let e=t?.maxPeak;e||(e=zP(r,s,{needsMaxPeak:!0}).maxPeak),e&&(h=((f=e.index)+.5)*100/p)}let m=parseFloat(a(o=u+h/d)),g=s[f];return void 0===g||Number.isNaN(g)||(e.level=parseFloat(nR(n,g).toFixed(1))),{...e,left:o,frequency:m}},[r]),s=u((e,t=!1)=>{0!==i.current.length&&o(a=>{let{marker:{maxCount:o,fifo:i}}=C7(r),s=Ft(a.markers,[e],o,i);if(!s.allowed)return a;let c=rK(),u=zA[a.colorIndex%20],d={...l({...e,id:c,color:u,select:!1,peak:!1,frequency:0,hover:!1}),id:c,color:u,select:!t,peak:!1,hover:!1},h=[...t?s.keptMarkers:s.keptMarkers.map(e=>({...e,select:!1})),d];return t||setTimeout(()=>{n?.(ro.Add,h)},0),{...a,markers:h,colorIndex:a.colorIndex+1}})},[l,n]),c=u(({event:e,marker:t,frequencies:a,silent:s=!1})=>{o(o=>{let c=[...o.markers],u=ro.Update,{id:d,peak:h,select:p,frequency:f,left:m,top:g}=t||{},b=m;if(e===ro.Update&&void 0!==f){let e=C7(r),t=(e?.segments||{totalPoints:0})[0];if(t&&d){let{start:e,stop:r}=t,n=r-e;if(void 0!==n&&f<r&&f>e)b=(f-e)*100/n;else{let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=ro.Del)}}}if(e===ro.Add&&a?.length){let e=C7(r),t=(e?.segments||{totalPoints:0})[0];if(t){let{start:e,stop:r}=t,n=r-e;if(void 0!==n){let t=[];for(let o=0;o<a.length;o+=1){let i=a[o];i>=e&&i<=r&&t.push((i-e)*100/n)}t.length>0&&(a=t)}}}if(e===ro.Add&&a?.length){let{marker:{maxCount:e,fifo:t}}=C7(r),n=Ft(c,a,e,t);if(n.allowed&&n.itemsToAdd.length>0){c=n.keptMarkers.map(e=>({...e,select:!1}));let e=n.itemsToAdd;for(let t=0;t<e.length;t+=1){let r=rK(),n=zA[(o.colorIndex+t)%20],a=!1;if(i.current&&i.current.length>0){let r=-1/0,n=0;for(let e=0;e<i.current.length;e++)i.current[e]>r&&(r=i.current[e],n=e);Math.abs(Math.floor(i.current.length*e[t]/100)-n)<=Math.max(1,Math.floor(.01*i.current.length))&&(a=!0)}let s=l({left:e[t],id:r,color:n,select:!1,peak:a,frequency:0,hover:!1});c.push({...s,id:r,color:n,select:t===e.length-1,peak:a,hover:!1})}u=ro.Add}}if(e===ro.Del){let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=ro.Del)}return e===ro.Clear&&(c=[],u=ro.Clear),e===ro.Update&&(u=ro.Update,c=c.map(e=>(void 0!==h&&(e.peak=!1),void 0!==p&&e.id!==d&&(e.select=!1),e.id===d&&(void 0!==b&&(e=l({...e,left:b,top:g||e.top})),void 0!==p&&(e.select=p),void 0!==h&&(e.peak=h,h&&void 0===p&&(e.select=!0))),e.peak,e))),s||setTimeout(()=>{n?.(u,c)},0),{...o,markers:c,colorIndex:e===ro.Clear?0:o.colorIndex}})},[l,n]),d=u(()=>{o(e=>({...e,markers:[],colorIndex:0})),setTimeout(()=>{n?.(ro.Clear,[])},0)},[n]),h=u(e=>{e&&(i.current=e),o(t=>{if(0===t.markers.length)return t;let a=t.markers.some(e=>e.peak&&"mainSecondary"!==e.peakTracking),o=t.markers.some(e=>"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank),s=e??i.current??new Float32Array,{maxPeak:c,topPeaks:u}=zP(r,s,{needsMaxPeak:a,needsTopPeaks:o}),d=t.markers.map(e=>l(e,{data:s,maxPeak:c,topPeaks:u}));return d.some((e,r)=>{let n=t.markers[r];return n&&(Math.abs(e.frequency-n.frequency)>.001||Math.abs(e.level-n.level)>.001)})&&setTimeout(()=>{n?.(ro.Update,d)},0),{...t,markers:d}})},[l,n]),p=u(e=>{let a=document.getElementById(t);if(!a)return"";let i=a.getBoundingClientRect(),{zoom:{interval:{start:l,end:s}},segments:c}=C7(r),u=c.totalPoints/(s-l+1),d=i.width*u/100,h="",p=!1;return o(t=>{let r=t.markers.map((t,r)=>{let n=Math.abs(e.left-t.left)*d<=16;return t.hover!==n&&(p=!0),n&&(h={...t,index:r}),{...t,hover:n}});return p&&setTimeout(()=>{n?.(ro.Update,r)},0),{...t,markers:r,isHover:h}}),h},[t,r,n]),f=u(()=>{o(e=>{let t=!1,r=e.markers.map(e=>(e.hover&&(t=!0),{...e,hover:!1}));return t&&setTimeout(()=>{n?.(ro.Update,r)},0),{...e,markers:r,isHover:""}})},[n]),m=g(null),v=g(null),y=u(()=>{o(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking),r=m.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return m.current=null,setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}}let{marker:t}=C7(r),a=t.maxCount,o=t.fifo,s=Ft(e.markers,[0,1],a,o);if(!s.allowed||s.itemsToAdd.length<2)return e;m.current=e.markers.find(e=>e.select)?.id??null;let c=[],u=e.colorIndex,d=e=>{let t=rK(),r=zA[u%20];u+=1;let n=l({left:50,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,frequency:0,hover:!1});c.push({...n,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,hover:!1})};d(0),d(1);let h=[...s.keptMarkers,...c.map(e=>({...e,select:!1}))].map(e=>l(e,{data:i.current}));return setTimeout(()=>{n?.(ro.Update,h)},0),{...e,markers:h,colorIndex:u}})},[l,r,n]),w=u(()=>{o(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking&&0===e.peakRank)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking||0!==e.peakRank),r=v.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return v.current=null,setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}}let{marker:t}=C7(r),a=t.maxCount,o=t.fifo,s=Ft(e.markers,[0],a,o);if(!s.allowed||s.itemsToAdd.length<1)return e;v.current=e.markers.find(e=>e.select)?.id??null;let c=rK(),u=zA[e.colorIndex%20],d={...l({left:50,id:c,color:u,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,frequency:0,hover:!1}),id:c,color:u,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,hover:!1},h=[...s.keptMarkers,d].map(e=>l(e,{data:i.current}));return setTimeout(()=>{n?.(ro.Update,h)},0),{...e,markers:h,colorIndex:e.colorIndex+1}})},[l,r,n]),x=u((e,t)=>{o(a=>{let o=a.markers.find(e=>e.id===t);if(!o)return a;let s=tO(r).getAllRawData()[t3];if(!s||s.length<3)return a;i.current=s;let{zoom:c,segments:u}=C7(r),d=s.length,h=u.totalPoints||d,p=c.interval.end-c.interval.start+1,f=(o.left*h/100-c.interval.start)*100/p,m=Math.floor(d*f/100);100===f&&(m=d-1);let g=-1;if(s.peaks?.peaks&&Array.isArray(s.peaks.peaks)){let t=s.peaks.peaks;if("left"===e){let e=1/0;for(let r of t)if(r.index<m){let t=m-r.index;t<e&&(e=t,g=r.index)}}else{let e=1/0;for(let r of t)if(r.index>m){let t=r.index-m;t<e&&(e=t,g=r.index)}}}if(-1===g){let t=e=>{if(e<=0||e>=d-1)return!1;let t=s[e];return t>s[e-1]&&t>s[e+1]};if("left"===e){for(let e=m-1;e>0;e-=1)if(t(e)){g=e;break}}else for(let e=m+1;e<d-1;e+=1)if(t(e)){g=e;break}}if(-1===g)return a;let b=((g+.5)*100/d*p/100+c.interval.start)*(100/h),v=a.markers.map(e=>{if(e.id!==t)return{...e,select:!1};let{peakTracking:r,peakRank:n,...a}=e;return l({...a,left:b,select:!0,peak:!1},{data:s})});return setTimeout(()=>{n?.(ro.Update,v)},0),{...a,markers:v}})},[l,r,n]),k=u(e=>{o(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=tO(r).getAllRawData()[t3];if(!a||a.length<1)return t;i.current=a;let{zoom:o,segments:s}=C7(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=(100*d/(c-1)*(o.interval.end-o.interval.start+1)/100+o.interval.start)*(100/u),f=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...o}=t;return l({...o,left:p,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(ro.Update,f)},0),{...t,markers:f}})},[l,r,n]),S=u(e=>{o(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=tO(r).getAllRawData()[t3];if(!a||a.length<3)return t;i.current=a;let{zoom:o,segments:s}=C7(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=Math.max(2,Math.floor(.1*c)),f=-1,m=-1/0;for(let e=1;e<c-1;e+=1){if(Math.abs(e-d)<p)continue;let t=a[e],r=a[e-1],n=a[e+1];t>r&&t>n&&t>m&&(m=t,f=e)}if(-1===f)return t;let g=(100*f/(c-1)*(o.interval.end-o.interval.start+1)/100+o.interval.start)*(100/u),b=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...o}=t;return l({...o,left:g,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(ro.Update,b)},0),{...t,markers:b}})},[l,r,n]),M=u((e,t)=>{o(a=>{let o,s=a.markers.find(e=>e.id===t);if(!s)return a;let c=tO(r).getAllRawData()[t3];if(!c||c.length<2)return a;i.current=c;let{zoom:u,segments:d}=C7(r),h=c.length,p=d.totalPoints||h,f=u.interval.end-u.interval.start+1,m=Math.round((h-1)*((s.left*p/100-u.interval.start)*100/f)/100);if((o="left"===e?Math.max(0,m-1):Math.min(h-1,m+1))===m)return a;let g=(100*o/(h-1)*f/100+u.interval.start)*(100/p),b=a.markers.map(e=>{if(e.id!==t)return{...e,select:!1};let{peakTracking:r,peakRank:n,...a}=e;return l({...a,left:g,select:!0,peak:!1},{data:c})});return setTimeout(()=>{n?.(ro.Update,b)},0),{...a,markers:b}})},[l,r,n]),C="#F98116",F="#AA74E8",D=u(()=>{o(e=>{let t,a=tO(r).getAllRawData()[t3];if(!a||a.length<1)return e;i.current=a;let{zoom:o,segments:s}=C7(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=(100*d/(c-1)*(o.interval.end-o.interval.start+1)/100+o.interval.start)*(100/u),f=e.markers.find(e=>e.color===C);if(f)t=e.markers.map(e=>e.id===f.id?l({...e,left:p},{data:a}):e);else{let{marker:n}=C7(r),o=n.maxCount,i=n.fifo,s=Ft(e.markers,[p],o,i);if(!s.allowed)return e;let c=l({left:p,id:rK(),color:C,select:!1,peak:!1,hover:!1},{data:a});t=[...s.keptMarkers,c]}return setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}})},[l,r,n]),z=u(()=>{o(e=>{let t,a=tO(r).getAllRawData()[t3];if(!a||a.length<3)return e;i.current=a;let{zoom:o,segments:s}=C7(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=Math.max(2,Math.floor(.1*c)),f=-1,m=-1/0;for(let e=1;e<c-1;e+=1){if(Math.abs(e-d)<p)continue;let t=a[e],r=a[e-1],n=a[e+1];t>r&&t>n&&t>m&&(m=t,f=e)}if(-1===f)return e;let g=(100*f/(c-1)*(o.interval.end-o.interval.start+1)/100+o.interval.start)*(100/u),b=e.markers.find(e=>e.color===F);if(b)t=e.markers.map(e=>e.id===b.id?l({...e,left:g},{data:a}):e);else{let{marker:n}=C7(r),o=n.maxCount,i=n.fifo,s=Ft(e.markers,[g],o,i);if(!s.allowed)return e;let c=l({left:g,id:rK(),color:F,select:!1,peak:!1,hover:!1},{data:a});t=[...s.keptMarkers,c]}return setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}})},[l,r,n]);return{markers:a.markers,isDown:a.isDown,isHover:a.isHover,createMarker:s,updateMarkerAttribute:c,resetMarkers:d,updateByData:h,handleHover:p,resetHover:f,toggleMainSecondaryPeaks:y,toggleMainPeak:w,moveToAdjacentPeak:x,findMainPeak:k,findSecondaryPeak:S,moveToStep:M,createMainPeakMarker:D,createSecondaryPeakMarker:z,setState:o}},zO=e=>{let{top:a,left:o,color:i="transparent",x:l=!0,y:s=!0,lineWidth:c=1}=e;return /*#__PURE__*/n(t,{children:[l&&/*#__PURE__*/r("div",{className:"absolute left-0 top-[-200%] z-[5] w-full border-t border-dashed",style:{top:a,borderColor:i,borderTopWidth:`${c}px`}}),s&&/*#__PURE__*/r("div",{className:"absolute left-[-200%] top-0 z-[5] h-full border-l border-dashed",style:{left:o,borderColor:i,borderLeftWidth:`${c}px`}})]})},zq=zO,z$=({marker:e})=>{let{state:{axisX:t,axisY:a}}=n9(),o=g(null),i=g(null),[l,s]=b(0),[c,u]=b(0);h(()=>{let e=()=>{o.current&&s(o.current.offsetWidth),i.current&&u(i.current.offsetWidth)};e();let t=new ResizeObserver(()=>{e()});return o.current&&t.observe(o.current),i.current&&t.observe(i.current),()=>{t.disconnect()}},[e.frequency,e.level]);let d=m(()=>{let t=e.left/100*l,r=l>0&&c>0&&t+c+10>l-20;return{left:`${e.left}%`,color:e.color,opacity:e.hover?1:.68,fontWeight:e.hover?500:"normal",transform:r?"translateX(-100%)":"translateX(0)",marginLeft:r?"-10px":"10px"}},[e.left,e.hover,e.color,l,c]);return /*#__PURE__*/n("div",{ref:o,className:"absolute left-0 top-0 h-full w-full",id:e.id,title:`${e.frequency}${t.unit} / ${e.level}${a.unit}`,children:[/*#__PURE__*/n("div",{ref:i,className:"absolute top-[10px] z-[5] whitespace-nowrap text-[12px] leading-4 transition-[opacity,font-weight,transform,margin-left,color]",style:d,children:[/*#__PURE__*/n("div",{children:[e.frequency,t.unit]}),void 0!==e.level&&/*#__PURE__*/n("div",{children:[e.level,a.unit]})]}),/*#__PURE__*/r(zO,{x:!1,left:`${e.left}%`,top:`${e.top}%`,color:e.color,lineWidth:e.select?2:1})]},e.id)},z_=/*#__PURE__*/a.memo(z$),zj=({id:e})=>{let{state:{marker:t,globalID:n}}=n9(),{enabled:a,visible:o,fixed:i,readonly:l,maxCount:s,onChange:c}=t,d=u((e,t)=>{c?.(e,t),Fa(n)({count:t.length,maxCount:s});let r=t.find(e=>e.select)?.id??null;Fo(n)({selectedId:r})},[c,n,s]),p=m(()=>a&&o,[a,o,t.enabled,t.visible]),f=m(()=>w_(e),[e]),{markers:b,createMarker:v,updateMarkerAttribute:y,resetMarkers:w,updateByData:x,handleHover:k,resetHover:S,toggleMainSecondaryPeaks:M,toggleMainPeak:C,moveToAdjacentPeak:F,findMainPeak:D,findSecondaryPeak:z,createMainPeakMarker:N,createSecondaryPeakMarker:E}=zL({id:e,globalID:n,display:o,onChange:d});h(()=>{if(!n||!f||!p||l)return;let e=nA(n,f,e=>{let t=e.key.toLowerCase();if(!["a","d","w","s"].includes(t))return;if("w"===t){if(e.repeat)return;e.preventDefault(),N();return}if("s"===t){if(e.repeat)return;e.preventDefault(),E();return}let r=b.find(e=>e.select)?.id;r&&(e.preventDefault(),F("a"===t?"left":"right",r))});return()=>{e?.()}},[f,n,b,F,p,l,N,E]);let T=u(e=>{let t=b.find(t=>t.id===e),r=!t?.select;y({event:ro.Update,marker:{id:e,select:r}})},[b,y]),R=u((e,t)=>{y({event:ro.Update,marker:{id:e,left:t.left,top:t.top}})},[y]);zR({id:e,markers:b,display:p,fixed:i,readonly:l,onCreateMarker:v,onDeleteMarker:u(e=>{y({event:ro.Del,marker:{id:e}})},[y]),onUpdateMarker:R,onToggleSelect:T,onHover:k,onResetHover:S});let A=g(null);return(h(()=>{n&&e&&tq(e,"Marker",()=>{let{realData:e}=tO(n).getAllRawData();A.current=e??null,x(e)})},[n,e,x]),h(()=>{n&&e&&Fr(n,e=>{y(e)})},[n,e,y,w]),h(()=>{n&&e&&Fi(n,e=>{if(e?.type){if("main-secondary-peaks"===e.type)return void M();if("main-peak"===e.type)return void C();if("left-peak"===e.type)return void F("left",e.selectedId);if("right-peak"===e.type)return void F("right",e.selectedId);if("find-main-peak"===e.type)return void D(e.selectedId);if("find-secondary-peak"===e.type)return void z(e.selectedId);if("create-main-peak"===e.type)return void N();if("create-secondary-peak"===e.type)return void E();if("clear-all"===e.type)return void w()}})},[n,e,F,M,C,D,z,N,E,w]),p)?/*#__PURE__*/r(yn,{className:"z-[5]",children:b.map(e=>/*#__PURE__*/r(z_,{marker:e},e.id))}):null},zH=zj,zB=({segments:e,index:t,frequency:r,bandwidth:n})=>{if(!r||!n||!e||!e[t])return{left:0,width:0};let a=e[t],o=e.reduce((e,t)=>e+t.point,0),{left:i,width:l}=rI({startFreq:r-n/2e3,stopFreq:r+n/2e3},a),s=e.slice(0,t).reduce((e,t)=>e+t.point/o*100,0),c=a.point/o*100;return{left:s+i/100*c,width:l/100*c}};function zW(){let{state:{scope:e,segments:t},dispatch:r}=n9();return u(n=>{let{frequency:a,bandwidth:o,index:i=0}=n,{left:l,width:s}=zB({segments:t,index:i,frequency:a,bandwidth:o});r({payload:{scope:{...e,left:l,width:s}}})},[t,e])}let zG=()=>{let{state:{scope:{show:e,left:t,width:n}}}=n9();return e?/*#__PURE__*/r(yn,{children:/*#__PURE__*/r("div",{className:"relative flex h-full w-0 box-border border-y border-dashed border-chart-grid bg-chart-surface opacity-50",style:{width:`${n}%`,left:`${t}%`}})}):null},zY=zG,zU=/*#__PURE__*/c(({style:e,signalPositions:t,activeSignalKey:n,segmentIndex:a})=>/*#__PURE__*/r("div",{className:"absolute h-full box-border",style:e,children:t.map(({item:e,key:t,position:o,color:i,tooltip:l})=>{let s=n===t,c={left:o.left,width:o.width,minWidth:"1px",backgroundColor:i,height:s?"100%":"8px",opacity:s?.5:1};return /*#__PURE__*/r("div",{className:"pointer-events-none absolute top-0 flex min-w-px items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs text-foreground","data-signal-active":s?"true":"false","data-signal-key":t,"data-signal-source":kN(e),"data-testid":"signal-annotation",style:c,title:l},`segment-${a}-signal-${t}`)})})),zX=zU;function zK(){let{state:e,dispatch:t}=n9(),r=g(e.globalID),n=g(e.signal),a=g({});return h(()=>{r.current=e.globalID,n.current=e.signal},[e.globalID,e.signal]),h(()=>{if(!e.globalID)return;let r=a.current.station,o=a.current.simple;void 0!==r&&(k6(e.globalID,r),a.current.station=void 0),void 0!==o&&(t({payload:{signal:{...n.current,data:o}}}),a.current.simple=void 0)},[t,e.globalID]),{updateSignalData:u(e=>{let{type:o,data:i}=e;if(Array.isArray(i)){if("station"===o){if(!r.current){a.current.station=i;return}k6(r.current,i)}else if("simple"===o){if(!r.current){a.current.simple=i;return}t({payload:{signal:{...n.current,data:i}}})}}},[t])}}let zV=({id:e,show:t=!0,display:n=!0})=>{let a=n7(e=>e.segments),o=n7(e=>e.zoom.style),i=n7(e=>e.signal),l=xr(e),s=l?.coord.left,c=k8({respectVisibility:!0}),u=i.show&&i.display&&n,d=!!l,h=m(()=>d&&"number"==typeof s?rP(s,a):{segmentIndex:-1,pointIndex:-1},[d,a,s]),p=m(()=>d?rL(a,h):0/0,[h,d,a]),f=m(()=>kQ({segments:a,signalItems:c}),[a,c]),g=m(()=>kZ({segmentData:f,isCursorActive:d,currentFrequency:p,currentPosition:h}),[p,h,d,f]);return t&&u?/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 z-[4] flex h-full w-full select-none items-center overflow-hidden bg-transparent",children:/*#__PURE__*/r("div",{className:"absolute right-0 top-0 flex h-full w-full",style:o??void 0,children:f.map(({segmentIndex:e,signalPositions:t,style:n})=>/*#__PURE__*/r(zU,{style:n,signalPositions:t,activeSignalKey:h.segmentIndex===e?g:void 0,segmentIndex:e},`segment-${e}`))})}):null},zQ=zV,zZ=()=>{let{state:{stripe:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{stripe:{...e,display:!!r}}})},[e]);return n?/*#__PURE__*/_jsx(IconBox,{active:r,tone:"primary",onClick:()=>{a(!r)},title:"频谱框选",children:/*#__PURE__*/_jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/_jsx("path",{d:"M835.4 757.7h-69.9v-51h18.9v-18.8h51zM713.1 757.7h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0H220v-51h83.9v51zM167.5 757.7H97.6v-69.8h51v18.8h18.9zM148.6 637.5h-51V557h51v80.5z m0-130.7h-51v-80.5h51v80.5z m0-130.8h-51v-80.5h51V376zM148.6 245.2h-51v-69.9h69.9v51h-18.9zM713.1 226.3h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0H220v-51h83.9v51zM835.4 245.2h-51v-18.9h-18.9v-51h69.9zM835.4 637.5h-51V557h51v80.5z m0-130.7h-51v-80.5h51v80.5z m0-130.8h-51v-80.5h51V376z",fill:"currentColor"}),/*#__PURE__*/_jsx("path",{d:"M784.4 615.7h51v233h-51z",fill:"currentColor"}),/*#__PURE__*/_jsx("path",{d:"M693.4 706.7h233v51h-233z",fill:"currentColor"})]})}):null},zJ=null,z0=ri.Stripe,z1=1.5,z2=e=>Math.max(0,Math.min(100,e)),z5=({cursor:e,left:t,right:r})=>{let n=Math.abs(e-t),a=Math.abs(e-r);return n<=1.5?"left":a<=1.5?"right":e>t&&e<r?"move":n<=a?"left":"right"},z4=({id:e})=>{let{state:{stripe:t,axisX:{frequencyFormat:n,unit:a}},dispatch:o}=n9(),{show:i,display:l,left:s,right:c,defaultLeft:d,defaultRight:p,onChange:f}=t,m=g(t),b=g(null),v=g(n),y=g(a),w=g(f);h(()=>{m.current=t,v.current=n,y.current=a,w.current=f},[t,n,a,f]),h(()=>{o({payload:{stripe:{...t,left:d,right:p}}})},[d,p]);let x=u(e=>{let t=b.current;if(!t||!Number.isFinite(e?.left))return;let r=z2(e.left),n=m.current,{mode:a,startCursor:i,startLeft:l,startRight:s}=t,c=l,u=s;if("move"===a){let e=s-l;(u=(c=z2(l+(r-i)))+e)>100&&(c=Math.max(0,(u=100)-e))}"left"===a&&(c=Math.min(r,s)),"right"===a&&(u=Math.max(r,l)),o({payload:{stripe:{...n,left:c,right:u}}})},[o]),k=u(()=>{let{left:e,right:t}=m.current,r=Math.round(10*e)/10,n=Math.round(10*t)/10,a=v.current?.(r)??"",o=v.current?.(n)??"",i=n-r,l=Number(o)-Number(a);w.current({left:r,right:n,width:i,start:a,end:o,bandwidth:l,unit:y.current})},[]);return(h(()=>{wB(e,z0,t=>{if(!i||!l||!Number.isFinite(t?.left))return;let r=m.current,n=z2(t.left);b.current={mode:z5({cursor:n,left:r.left,right:r.right}),startCursor:n,startLeft:r.left,startRight:r.right},w3(e,z0)}),wG(e,z0,()=>{i&&l&&b.current&&(b.current=null,w8(e,z0),k())}),wY(e,z0,()=>{i&&l&&b.current&&(b.current=null,w8(e,z0),k())}),wH(e,z0,(e,t)=>{i&&l&&b.current&&x(t)})},[e,i,l,x,k]),i&&s-c!=0&&l)?/*#__PURE__*/r(yn,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"relative flex h-full w-px box-border border-x-2 border-dashed border-y-0 border-chart-grid-strong bg-chart-surface opacity-40",style:{left:`${s}%`,width:`${c-s}%`}})}):null},z3=z4;function z6(){let{dispatch:e,store:t}=ae();return u(r=>{let n=t.getState().band,a=r6(r,n,"replace");a!==n&&e({payload:{band:a}})},[e,t])}let z8=()=>{let e=n7(e=>e.band),t=n7(e=>e.segments),n=m(()=>kc(e,t),[e,t]);return n.length?/*#__PURE__*/r(yn,{children:n.map(t=>/*#__PURE__*/r("div",{"data-testid":"spectrum-band","data-band-kind":e.kind,"data-band-key":t.key,className:"absolute flex h-full w-0 box-border border-y border-dashed opacity-50",style:{left:`${t.left}%`,width:`${t.width}%`,backgroundColor:e.color?`${e.color}40`:void 0,borderColor:e.color}},t.key))}):null},z9=z8,z7=10,Ne=300,Nt=300,Nr=30,Nn=60,Na=()=>({mode:"idle",startX:0,startY:0,startTime:0,lastX:0,lastY:0,startCoord:null,pinchBase:null}),No=(e,t,r)=>Math.max(t,Math.min(e,r)),Ni=({id:e})=>{let{state:{zoom:t,segments:n,axisY:a,globalID:o},dispatch:i}=n9(),l=w_(e),s=g(null),c=g(Na()),d=g(t),p=g(n.totalPoints),f=g(a),m=g(null);h(()=>{d.current=t},[t]),h(()=>{p.current=n.totalPoints},[n]),h(()=>{f.current=a},[a]);let b=u((e,t,r)=>({currentTarget:e,clientX:t,clientY:r}),[]),v=u(e=>{let t=Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY})),r=t.length,n=0,a=0,o=0;if(2===r){let[e,r]=t;n=Math.hypot(r.x-e.x,r.y-e.y),a=(e.x+r.x)/2,o=(e.y+r.y)/2}else 1===r&&(a=t[0].x,o=t[0].y);return{count:r,points:t,distance:n,midX:a,midY:o}},[]),y=u((e,t,r)=>{let n=b(e,t,r),a=w$(n);wU(l)(),wH(l)(n,a)},[l,b]),w=u(e=>{let t=c.current.pinchBase,r=p.current;if(!t||t.distance<=0||e<=0)return;let n=e/t.distance;if(("x"===t.axisMode||"xy"===t.axisMode)&&d.current.show&&r){let e=ST({anchorPercent:t.anchorPercent,interval:t.interval,scale:1/n,totalPoints:r});i({payload:t=>t.zoom.interval.start===e.start&&t.zoom.interval.end===e.end?null:{zoom:{...t.zoom,interval:e,isScanSegmentsUpdateMagnify:!1}}})}("y"===t.axisMode||"xy"===t.axisMode)&&o&&(nj(o)(t.lastScale/n,t.yAnchorValue),t.lastScale=n)},[i,o]),x=g(w);x.current=w;let k=u(e=>{let t=s.current,r=c.current;if(t&&0!==e.touches.length){if(1===e.touches.length){let{clientX:n,clientY:a}=e.touches[0];r.mode="pending",r.startX=n,r.startY=a,r.startTime=Date.now(),r.lastX=n,r.lastY=a,r.startCoord=w$(b(t,n,a));return}if(2===e.touches.length){m.current?.flush(),r.mode="pinch",r.startTime=Date.now();let n=d.current,a=v(e),[o,i]=a.points,l=Math.abs(i.x-o.x),s=180*Math.atan2(Math.abs(i.y-o.y),l)/Math.PI,{start:c,end:u}=n.interval,h=w$(b(t,a.midX,a.midY)).left??0,p=t.getBoundingClientRect();if(p.height<=0||a.distance<=0){r.pinchBase=null;return}let[g,y]=f.current.realRange??[0,1],w=No((a.midY-p.top)/p.height,0,1);r.pinchBase={distance:a.distance,lastScale:1,interval:{start:c,end:u},anchorPercent:No(h,0,100),axisMode:s<30?"x":s>60?"y":"xy",yAnchorValue:y-w*(y-g),startPoints:a.points,pinchMoved:!1}}}},[v,b]),S=g(rB(e=>{if(!e||!("count"in e))return;let t=s.current,r=c.current;if(!t)return;let{count:n,points:a,distance:o}=e;if(2===n){if("pinch"===r.mode&&r.pinchBase){let e=r.pinchBase;if(!e.pinchMoved){let t={x:(a[0].x+a[1].x)/2,y:(a[0].y+a[1].y)/2},r={x:(e.startPoints[0].x+e.startPoints[1].x)/2,y:(e.startPoints[0].y+e.startPoints[1].y)/2};(Math.abs(o-e.distance)>10||Math.hypot(t.x-r.x,t.y-r.y)>10)&&(e.pinchMoved=!0)}x.current(o)}return}if(1!==n)return;let i=a[0];if("pending"===r.mode){let e=i.x-r.startX,t=i.y-r.startY;if(e*e+t*t<=100)return;r.mode="drag"}if("drag"!==r.mode)return;let u=t.getBoundingClientRect(),d={left:(i.x-r.lastX)/u.width,top:(i.y-r.lastY)/u.height},h=b(t,i.x,i.y),p=w$(h);wH(l)(h,p),wK(l)(r.startCoord,p,d,!1),r.lastX=i.x,r.lastY=i.y})).current;m.current=S;let M=u(e=>{S(v(e))},[v,S]),C=u(e=>{S.flush();let t=s.current,r=c.current;if(!t)return;let n=e.changedTouches[0],a=n?.clientX??r.lastX,o=n?.clientY??r.lastY;if("pending"===r.mode){let e=Date.now()-r.startTime,n=a-r.startX,i=o-r.startY;n*n+i*i<=100&&e<=300&&y(t,a,o)}if(1===e.touches.length){let n=e.touches[0],a="pinch"===r.mode&&null!==r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=300;r.mode=a?"pinch":"drag",r.startX=n.clientX,r.startY=n.clientY,r.lastX=n.clientX,r.lastY=n.clientY,a||(r.pinchBase=null),r.startCoord=w$(b(t,n.clientX,n.clientY))}else 0===e.touches.length&&("pinch"===r.mode&&r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=300&&wY(l)(),r.mode="idle",r.pinchBase=null,wG(l)())},[l,y,b,S]),F=u(()=>{S.cancel();let e=c.current;e.mode="idle",e.pinchBase=null,wY(l)()},[l,S]),D=u(e=>{e.preventDefault()},[]);return h(()=>()=>{S.cancel(),wY(l)()},[l,S]),h(()=>{s.current&&(s.current.id=l)},[l]),/*#__PURE__*/r(yn,{className:"z-[5] pointer-events-auto",children:/*#__PURE__*/r("button",{ref:s,type:"button",className:oW("absolute right-0 top-0 h-full w-full appearance-none border-0 bg-transparent p-0 outline-none","touch-none select-none"),"aria-label":"Touch bus",onContextMenu:D,onTouchStart:k,onTouchMove:M,onTouchEnd:C,onTouchCancel:F})})},Nl=Ni,Ns=e=>{let{children:t,touch:a}=e,{state:{axisY:{autoranging:o},series:{enableLengthSyncFastMode:i},globalID:l}}=n9(),{id:s,chart:c,Chart:u}=oY({Render:Ck,params:{autoranging:o,enableLengthSyncFastMode:i}});SP(s,rt.Spectrum);let d=z6(),p=zW(),f=wb();return h(()=>{if(l&&c)return t$(l,e=>{c?.setDisabledClearRect(e)})},[l,c]),o1({moduleType:rt.Spectrum,chart:c,handleRender:(e,t)=>{t.updateSeries?.({data:e.data,extraData:e.extraData}),tq(s)()},eventHandlers:{autoranging:(e,t)=>{t.useRangeAutoFocus?.()},points:e=>{f(e.data)},[rr.Series]:(e,t)=>{t.setSeries?.(e)},band:e=>{d(e)},scope:e=>{p(e)}}}),/*#__PURE__*/n(yF,{children:[/*#__PURE__*/r(Dh,{chart:c}),/*#__PURE__*/n(SD,{children:[/*#__PURE__*/r(Cx,{}),/*#__PURE__*/r(u,{}),t,/*#__PURE__*/r(zm,{id:s}),/*#__PURE__*/r(zj,{id:s}),a?/*#__PURE__*/r(Ni,{id:s}):/*#__PURE__*/r(Sk,{id:s}),/*#__PURE__*/r(zD,{id:s}),/*#__PURE__*/r(Sv,{id:s,type:rt.Spectrum}),/*#__PURE__*/r(zV,{id:s}),/*#__PURE__*/r(DD,{id:s}),/*#__PURE__*/r(z8,{}),/*#__PURE__*/r(zG,{}),/*#__PURE__*/r(z4,{id:s}),/*#__PURE__*/r(zw,{id:s}),/*#__PURE__*/r(zd,{}),/*#__PURE__*/r(Dx,{})]})]})},Nc=Ns,Nu=e=>{let{state:{cursor:t},dispatch:a}=n9(),{publish:o}=e,{analyzer:i}=F6();return al({publish:o,subscribe:e=>{let{pstype:t}=e;t===rr.Reset&&i?.reset(),t===rr.LevelStream&&i?.process(e.data,rX(e.timestamp))}}),h(()=>{t.mode!==rt.LevelStream&&a({payload:{cursor:{...t,mode:rt.LevelStream}}})},[t,a]),/*#__PURE__*/n(ap,{children:[/*#__PURE__*/r(F3,{type:re.LevelStream}),/*#__PURE__*/r(yF,{children:/*#__PURE__*/r(Ns,{children:/*#__PURE__*/r(SD,{children:/*#__PURE__*/r(F9,{opacity:.5})})})})]})},Nd=Nu,Nh=e=>/*#__PURE__*/r(ar,{...e,cursor:{show:!0},zoom:{show:!1},signal:{show:!1},children:/*#__PURE__*/r(Nu,{...e})}),Np=tB(Nh,"LevelStream"),Nf=Np,Nm=["100%","75%","50%","25%","0%"],Ng=e=>{let{inside:t=!1}=e;return /*#__PURE__*/r("div",{className:"pointer-events-none relative z-[2] flex h-full w-full flex-col justify-between text-xs text-foreground opacity-50",style:{alignItems:t?"flex-start":"flex-end"},children:Nm.map(e=>/*#__PURE__*/r("div",{className:oW("flex justify-start box-border",t?"pl-0.5 pr-0":"pr-0.5"),children:e},e))})},Nb=Ng,Nv=e=>{let{inside:t=!1}=e,{axisYWidth:n,marginLeft:a}=yt();return /*#__PURE__*/r("div",{className:"relative flex h-full w-auto",style:{width:n,marginLeft:a,justifyContent:t?"flex-start":"flex-end"},children:/*#__PURE__*/r(Ng,{inside:t})})},Ny=/*#__PURE__*/a.memo(Nv),Nw=e=>{let{disabled:t,inside:n}=e,{state:{axisY:a}}=n9(),{show:o}=a;return!1===o||t?null:/*#__PURE__*/r(Ny,{inside:n})},Nx=Nw,Nk=()=>/*#__PURE__*/r("div",{className:"h-0 w-full flex-1 border-t [border-color:var(--chart-grid)] first:border-t-0"}),NS=()=>{let{state:{gridLines:e}}=n9();return e&&/*#__PURE__*/n("div",{className:"pointer-events-none absolute right-0 top-0 z-[1] flex h-full w-full select-none flex-col border [border-color:var(--chart-grid)] bg-transparent",children:[/*#__PURE__*/r(Nk,{}),/*#__PURE__*/r(Nk,{}),/*#__PURE__*/r(Nk,{}),/*#__PURE__*/r(Nk,{})]})},NM=NS,NC=-200,NF=e=>`occupancy-total-line-${e}`,ND=(e,t,r=0)=>{e&&t&&(e.style.bottom=`${r||-200}%`,t.textContent=String(r))},Nz=(e,t,r)=>tC(NF(e),t,r,e),NN=(e,t=0)=>{Nz(e)(t)},NE=({id:e})=>{let t=g(null),a=g(null),o=g(`OccupancyTotalLine-${Math.random().toString(36).slice(2)}`);return h(()=>(ND(t.current,a.current),Nz(e,o.current,e=>{ND(t.current,a.current,e)})),[e]),/*#__PURE__*/r("div",{className:"pointer-events-none absolute z-[4] h-full w-full",children:/*#__PURE__*/n("div",{ref:t,className:"absolute left-0 w-full opacity-50",style:{bottom:"-200%"},children:[/*#__PURE__*/r("div",{className:"absolute h-0 w-full border-b border-dashed border-foreground/80",style:{marginTop:"-0.5px"}}),/*#__PURE__*/r("div",{ref:a,className:"absolute right-7 -mt-7 flex h-6 items-center justify-center rounded-[var(--radius-control)] bg-secondary px-2 text-xs text-foreground",children:"0"})]})})},NT=NE,NR=e=>{let{occupancyAxisYDisabled:t}=e,{id:a,chart:o,Chart:i}=oY({Render:F8});return(o1({moduleType:rt.Occupancy,chart:o,handleRender:(e,t)=>{let{data:r,totalOccupancy:n}=e;r&&t.updateSeries?.(r),void 0!==n&&NN(a,n)},eventHandlers:{[rr.Reset]:(e,t)=>{t.reset(),NN(a)}}}),SP(a,rt.Occupancy),t)?/*#__PURE__*/r("div",{className:"h-full w-full",style:{...eA},[ez]:"true",children:/*#__PURE__*/n("div",{className:"relative z-[0] h-full w-full",children:[/*#__PURE__*/r(i,{}),/*#__PURE__*/r(Sk,{id:a}),/*#__PURE__*/r(NE,{id:a})]})}):/*#__PURE__*/n(yF,{children:[/*#__PURE__*/r(Nw,{disabled:t}),/*#__PURE__*/n(SD,{children:[/*#__PURE__*/r(NS,{}),/*#__PURE__*/r(i,{}),/*#__PURE__*/r(Sk,{id:a}),/*#__PURE__*/r(NE,{id:a}),/*#__PURE__*/r(Sv,{id:a,type:rt.Occupancy})]})]})},NA=NR,NI=e=>{let{publish:t}=e,{state:{globalID:a}}=n9(),o=ww(re.Scan);return al({publish:t,subscribe:e=>{o(e),e.pstype===rr.Occupancy&&(e.data&&(tO(a).getAllRawData=t=>({...tL().getAllRawData(t),occupancyData:e.data})),((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Occupancy)({...e,pstype:rr.Render}))}}),/*#__PURE__*/n(ap,{children:[/*#__PURE__*/r(yF,{children:/*#__PURE__*/r(NR,{})}),/*#__PURE__*/r(yC,{type:re.Scan})]})},NP=NI,NL=e=>/*#__PURE__*/r(ar,{...e,zoom:{show:!1},children:/*#__PURE__*/r(NI,{...e})}),NO=tB(NL,"Occupancy"),Nq=NO,N$=()=>{let e=at(),t=n7(e=>e.zoom),r=n7(e=>e.segments.totalPoints)??0,n=n7(e=>e.axisX.frequencyFormat),{interval:{start:a,end:o},onChange:i}=t,l=m(()=>r&&n?[n((100*a+1)/r),n((100*o+1)/r)]:["",""],[a,o,r,n]);return h(()=>{r&&void 0!==l[0]&&void 0!==l[1]&&i(l,{start:a,end:o})},[l,i,r]),h(()=>{if(!r)return;let t=o-a+1,n=r/t,i=`-${a/t*100}%`,l=`${100*n}%`;e({payload:e=>({zoom:{...e.zoom,style:{left:i,width:l}}})})},[e,o,a,r]),null},N_=N$;class Nj extends v_{constructor(e){super({id:e.id,globalID:e.globalID,chart:null,renderer:e.renderer,renderMode:e.renderMode})}init(){let{id:e,renderer:t,renderMode:r}=this.state;e&&(this.state.chart=new x({id:e,colors:this.getInitialColors(),ignoreValue:0,renderer:t,fluorescenceRenderMode:r}),this.subscribeToColor("Fluorescence-Render"))}updateProps(e){void 0!==e.renderMode&&(this.state.renderMode=e.renderMode),this.state.chart?.updateProps(e)}updateSeries(e){this.state.chart&&e&&this.state.chart.render(e)}setRenderMode(e){this.state.renderMode=e,this.state.chart?.setRenderMode(e)}}let NH=()=>{let{state:{axisY:{range:e},fluorescence:{display:t,renderer:n,renderMode:a}}}=n9(),{chart:o,Chart:i}=oY({Render:Nj,params:{renderer:n,renderMode:a}});h(()=>{o?.updateProps({range:e})},[o,e]),h(()=>{o&&o.setRenderMode(a)},[a]),o1({moduleType:rt.Fluorescence,chart:o,renderPSTypes:[rr.Fluorescence],extractData:e=>e.data});let l=m(()=>({height:"100%",width:"100%",display:"flex",visibility:t?"visible":"hidden"}),[t]);return h(()=>{o&&o.updateProps({display:t})},[o,t]),/*#__PURE__*/r("div",{style:l,children:/*#__PURE__*/r(yF,{children:/*#__PURE__*/r(i,{})})})},NB=NH,NW=e=>{let{type:t,heatmapElementID:a,renderer:o}=e;return /*#__PURE__*/r(va,{id:a,children:/*#__PURE__*/n(ao,{children:[/*#__PURE__*/r(F3,{type:re.Heatmap}),/*#__PURE__*/r(M2,{renderer:o,zoomMode:"linked-x"}),/*#__PURE__*/r(yC,{type:t})]})})},NG=NW,NY=e=>{let{occupancyElementID:a,occupancyAxisYElementID:o,type:i}=e;return /*#__PURE__*/n(t,{children:[/*#__PURE__*/r(va,{id:a,children:o?/*#__PURE__*/r(NR,{occupancyAxisYDisabled:!0}):/*#__PURE__*/n(ao,{children:[/*#__PURE__*/r(F3,{type:re.Occupancy}),/*#__PURE__*/r(NR,{}),/*#__PURE__*/r(yC,{type:i})]})}),/*#__PURE__*/r(va,{id:o,children:/*#__PURE__*/r(Nw,{inside:!0})})]})},NU=NY,NX=(e,t)=>tC(`BLAZE_PROGRESS-${e}`,"0",t,e),NK=()=>{let{state:{blaze:{show:e},segments:t,globalID:a}}=n9(),[o,i]=b(""),l=m(()=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];n.progress&&e.push(...n.progress)}return e},[t]);return(h(()=>{e&&a&&NX(a,e=>{i(l.includes(e)?void 0:`${100*e}%`)})},[e,a]),e)?/*#__PURE__*/r(yn,{children:/*#__PURE__*/n("div",{className:"absolute left-[-100%] top-0 flex h-full w-0 opacity-50",style:{left:o},children:[/*#__PURE__*/r("div",{className:"ml-[-0.5px] opacity-50",style:{borderRight:"0.5px solid var(--chart-grid-strong)"}}),/*#__PURE__*/r("div",{className:"ml-[-31px] w-[30px] opacity-20",style:{background:"linear-gradient(90deg, transparent, var(--chart-grid-strong))"}})]})}):null},NV=/*#__PURE__*/a.memo(NK),NQ=()=>{let{state:{legend:{children:e}}}=n9();return /*#__PURE__*/r("div",{className:"absolute left-5 top-5 z-[6] flex h-auto w-auto items-center",children:e})},NZ=NQ,NJ=()=>{let{state:{segments:e}}=n9(),t=e.totalPoints??0;return /*#__PURE__*/r(yn,{className:"z-[0]",children:e.map((e,n)=>/*#__PURE__*/r("div",{className:"h-full border-x",style:{width:t>0?`${100*e.point/t}%`:0,borderColor:n%2==1?"var(--chart-grid)":"transparent",background:n%2==1?"var(--chart-surface)":"transparent",opacity:n%2==1?.4:1}},`${e.start}_${e.stop}_${e.index}`))})},N0=NJ,N1=({globalID:e})=>({handleMarkerPublish:u(t=>{if(e)switch(t.pstype){case rr.Marker:Fr(e)(t);break;case rr.Reset:Fr(e)({type:ro.Clear})}},[e])}),N2=N1;function N5(){let e=at();return u(()=>{e({payload:e=>e.axisY.fieldStrengthUnitAvailable?null:{axisY:{...e.axisY,fieldStrengthUnitAvailable:!0}}})},[e])}function N4({segmentOffset:e,offset:t}){let r={};return void 0!==e&&(r.segmentOffset=e),void 0!==t&&(r.offset=t),void 0!==r.segmentOffset||void 0!==r.offset?r:void 0}function N3(e,t){"thresholdData"in t&&e.setThresholdData(t.thresholdData,N4(t))}function N6(){let e=n7(e=>e.signal.onChange),t=g(e);return f(()=>{t.current=e},[e]),u(e=>{let r=t.current;r&&r(e.regions.map(t=>({...t,frequency:t.centerFrequency,timestamp:e.timestamp})),e)},[])}function N8(e){let{state:{globalID:t,series:{enableMetrics:r,enableWaterfall:n},fluorescence:{show:a},axisY:{unit:o},zoom:{interval:i},heatmapCapture:{display:l},system:{width:s},marker:c,signal:d}}=n9(),p=g(null),f=g(t),m=g(i),b=g(0),v=N6(),y=d.templateDetection??e?.processing?.enableTemplateDetection??!1;h(()=>{p.current?.updateProcessing({enableTemplateDetection:y})},[y]);let w=g(null),{updateSignalData:x}=zK(),k=N5(),S=g(l);h(()=>{S.current=l},[l]);let M=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Spectrum)({pstype:rr.Render,data:e})},[]),C=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Heatmap)({pstype:rr.Render,data:e})},[]),F=u(e=>{NX(f.current)?.(e)},[]),D=u(e=>{(e.realData||e.templateData||e.backgroundNoiseData||"thresholdData"in e)&&M({minData:e.minData,maxData:e.maxData,avgData:e.avgData,thresholdData:e.thresholdData,backgroundNoiseData:e.backgroundNoiseData,realData:e.realData,templateData:e.templateData}),e.scanProgress&&F(e.scanProgress),e.templateDetection&&v(e.templateDetection),e.waterfallData&&C(e.waterfallData),e.fluorescenceData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Fluorescence)({pstype:rr.Fluorescence,data:{fluorescenceData:e.fluorescenceData,fluorescenceMaxCount:e.fluorescenceMaxCount}}),e.occupancyData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Occupancy)({pstype:rr.Render,data:e.occupancyData,totalOccupancy:b.current}),e.extraData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Spectrum)({pstype:rr.Render,extraData:e.extraData})},[M,C,F,v]);h(()=>{f.current=t},[t]);let z=(e,t)=>!1!==e&&(t??!0);if(!p.current&&t){let o=Math.min(1|Math.floor(2*s),1001);p.current=new O({...e,outputPoints:o,processing:{...e?.processing,enableMetrics:z(r,e?.processing?.enableMetrics),enableWaterfall:z(n,e?.processing?.enableWaterfall),enableTemplateDetection:y,enableFluorescence:a,enablePeakStats:!!c?.enabled},onSpectrumUpdate:D});let i=tO(t),l=p.current;i.getAllRawData=e=>l.getAllRawData(e),t_(t,p.current)}h(()=>{let e=Math.floor(i.start),t=Math.ceil(i.end),r=Math.floor(m.current.start),n=Math.ceil(m.current.end);(e!==r||t!==n)&&p.current&&(m.current=i,p.current.updateSamplingRange(e,t+1))},[i]);let N=u(async(e=!1)=>{setTimeout(()=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Heatmap)({pstype:rr.Reset}),((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Spectrum)({pstype:rr.Reset}),((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Occupancy)({pstype:rr.Reset}),e&&ws(f.current)},1)},[]),E=u(async e=>{if(p.current)switch(e.pstype){case rr.AntennaFactor:p.current.setAntennaFactor(e.data),e.data.length>0&&k();break;case rr.Signal:x({type:e.type,data:e.data});break;case rr.Spectrum:e.data&&p.current.process(e),N3(p.current,e),e.maxData&&p.current.setMaxData(e.maxData),e.minData&&p.current.setMinData(e.minData),e.avgData&&p.current.setAvgData(e.avgData),e.templateData&&p.current.setTemplateData(e.templateData,e.templateTolerance),e.backgroundNoiseData&&p.current.setBackgroundNoiseData(e.backgroundNoiseData),e.extraData&&p.current.setExtraData(e.extraData,I.MERGE,e.segmentedExtraData?{segmentOffset:e.segmentOffset,offset:e.offset}:void 0);break;case rr.Fluorescence:e.data&&p.current&&p.current.setFluorescenceData(e.data.fluorescenceData,e.data.fluorescenceMaxCount);break;case rr.Heatmap:if(e.data){let{data:t,timestamps:r}=e,n=rZ(t,r);p.current.setWaterfallData(n)}break;case rr.Occupancy:p.current?.setOccupancyData(e.data),b.current=e.totalOccupancy;break;case rr.Segments:p.current.initializeSegments(e.data),await N(),e.onFinally?.();break;case rr.SpectrumBandwidth:p.current.reset();break;case rr.Series:wl(f.current,e);break;case rr.Reset:p.current.reset(),await N(!0),e.onFinally?.();break;case rr.Clear:p.current.reset(),await N(!1),e.onFinally?.()}},[k,x,wl,N]);return h(()=>{let e=o.includes("/m");p.current?.setAntennaFactorSwitch(e)},[o]),h(()=>{if(!p.current)return;let t=z(r,e?.processing?.enableMetrics);t!==w.current&&(p.current.updateProcessing({enableMetrics:t}),w.current=t)},[r,e?.processing?.enableMetrics]),E}let N9=e=>{let{state:{globalID:a}}=n9(),o=g([]),i=g(""),{type:l=re.SingleFrequency,publish:s,heatmapElementID:c,occupancyElementID:u,occupancyAxisYElementID:d,touch:h,children:p,processing:f,renderer:m}=e,{enableMetrics:b,enableWaterfall:v}=wm({type:l,heatmapElementID:c}),y=N8({processing:{enableWaterfall:v,enableMetrics:b,...f}}),w=ww(l);wx(h);let{handleMarkerPublish:x}=N1({globalID:a});return al({publish:s,subscribe:e=>{if(y(e),x(e),w(e),e.pstype===rr.Heatmap){let{data:t,timestamps:r}=e;if(o.current=rZ(t,r),i.current!==a){let e=tO(a),t=e.getAllRawData;e.getAllRawData=e=>({...t(e),waterfallData:o.current}),i.current=a}}((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Spectrum)(e),((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Heatmap)(e),((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Occupancy)(e),e.pstype!==rr.Fluorescence&&((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Fluorescence)(e)}}),/*#__PURE__*/n(ap,{children:[/*#__PURE__*/r(F3,{type:l}),/*#__PURE__*/n(yF,{children:[/*#__PURE__*/r(Ns,{touch:h,children:p||/*#__PURE__*/r(NH,{})}),/*#__PURE__*/r(NW,{type:l,heatmapElementID:c,renderer:m}),/*#__PURE__*/r(NY,{type:l,occupancyElementID:u,occupancyAxisYElementID:d}),/*#__PURE__*/n(SD,{children:[/*#__PURE__*/r(N$,{}),l===re.Scan&&/*#__PURE__*/n(t,{children:[/*#__PURE__*/r(NJ,{}),/*#__PURE__*/r(NV,{})]}),/*#__PURE__*/r(NQ,{})]})]}),/*#__PURE__*/r(yC,{type:l})]})},N7=N9,Ee="singleFrequency",Et="slider",Er=e=>"slider"===e?"deltaMeasurement":"default",En=e=>{let t=e.type??Ee;if(!e.heatmapElementID||t!==Ee&&"scan"!==t&&"mscan"!==t)return e;let r=e.heatmapCapture?.type??"slider",n=e.heatmapCapture?.toolbarVariant??Er(r);return{...e,heatmapCapture:{show:!0,display:!1,...e.heatmapCapture,type:r,toolbarVariant:n}}},Ea=e=>{let t=En(e);return /*#__PURE__*/r(ar,{...t,children:/*#__PURE__*/r(N9,{...t})})},Eo=tB(Ea,"Spectrum"),Ei=Eo;function El(e={}){let{onChange:t,sizes:r,tokens:n}=e;th({sizes:r,tokens:n});let a=is();return{cleanup:t?ic(e=>t(e)):void 0,...a}}var Es=/*#__PURE__*/function(e){return e.Station="station",e.Simple="simple",e}({});th();export{w as DialDirectionLabelMode,iE as AudioWaveform,vV as Dial,v9 as Gauge,Cs as Heatmap,CR as IQ,Nf as LevelStream,Nq as Occupancy,Ei as Spectrum,t7 as AxisPlacement,re as ChartType,t9 as FrequencyUnit,ro as MarkerEventType,rt as ModuleType,rn as OptionKey,rr as PSType,ra as SegmentsEvent,rs as SeriesType,ri as ToolType,rl as ToolbarItemType,rC as formatFrequencyUnit,rD as formatFrequencyUnitFromHz,rF as formatFrequencyUnitFromMHz,is as getChartsThemeState,nt as HeatmapCaptureType,El as initChartsTheme,r7 as MarkerMode,DW as setFrequencyAllocationChannelsToCache,DB as setFrequencyAllocationToCache,Es as SignalDataType,ic as subscribeChartsThemeChange,ac as useSafePublish,tB as withChartPublisher};
|
|
3780
|
+
*/let FB={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};FB.node;let FW=Mr(FB),FG={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};FG.node;let FY=Mr(FG),FU=/*#__PURE__*/$.forwardRef(({className:e,...t},n)=>/*#__PURE__*/r(FP,{ref:n,"data-slot":"checkbox",className:oW("peer inline-flex size-4 shrink-0 items-center justify-center rounded-[var(--radius-micro)] border border-border bg-background text-primary shadow-xs transition-colors outline-none","focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground","data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground",e),...t,children:/*#__PURE__*/r(FO,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:"indeterminate"===t.checked?/*#__PURE__*/r(FW,{className:"size-3.5"}):/*#__PURE__*/r(FY,{className:"size-3.5"})})}));FU.displayName=FP.displayName;let FX=e=>"checked"===e||"indeterminate"===e&&"indeterminate",FK=({count:e,show:t,testId:r})=>t?/*#__PURE__*/n("span",{className:"shrink-0 tabular-nums text-[11px] font-normal text-muted-foreground","data-testid":r,children:["(",e,")"]}):null,FV=({source:e,type:t,leafKeysWithData:a,hiddenKeys:o,showCount:i,expanded:l,onToggleExpanded:s,onToggleNode:c})=>{let u=kA(a,o,t.leafKeys),d=`signal-tree-type-checkbox-${e.source}-${t.signalType}`,h=t.levels.length>0,p=h?void 0:t.color??kf[t.signalType].color;return /*#__PURE__*/n("div",{children:[/*#__PURE__*/n("div",{className:"group flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-type-${e.source}-${t.signalType}`,children:[h?/*#__PURE__*/r("button",{type:"button","aria-label":l?"折叠信号类型":"展开信号类型",className:"flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:s,children:l?/*#__PURE__*/r(Fk,{className:"size-3.5"}):/*#__PURE__*/r(FM,{className:"size-3.5"})}):/*#__PURE__*/r("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/n("label",{htmlFor:d,className:oW("flex min-w-0 flex-1 items-center gap-1.5","disabled"===u?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(FU,{id:d,"aria-label":`${e.label} ${t.label}`,checked:FX(u),disabled:"disabled"===u,onCheckedChange:()=>c(t.leafKeys)}),/*#__PURE__*/r("span",{className:oW("min-w-0 truncate text-xs font-medium","disabled"===u?"text-muted-foreground":"text-foreground/90"),"data-testid":`signal-tree-type-color-${e.source}-${t.signalType}`,style:"disabled"===u||null==p?void 0:{color:it(p)},children:t.label}),/*#__PURE__*/r(FK,{count:t.count,show:i,testId:`signal-tree-type-count-${e.source}-${t.signalType}`})]})]}),l&&h?/*#__PURE__*/r("div",{className:"relative ml-6 border-l border-border/60 pl-1",children:t.levels.map(n=>/*#__PURE__*/r(FQ,{source:e.source,signalType:t.signalType,level:n,leafKeysWithData:a,hiddenKeys:o,showCount:i,onToggleNode:c},n.leafKey))}):null]},t.signalType)},FQ=({source:e,signalType:t,level:a,leafKeysWithData:o,hiddenKeys:i,showCount:l,onToggleNode:s})=>{let c=kA(o,i,[a.leafKey]),u=`signal-tree-level-checkbox-${e}-${t}-${a.level}`;return /*#__PURE__*/r("div",{className:"group flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-level-${e}-${t}-${a.level}`,children:/*#__PURE__*/n("label",{htmlFor:u,className:oW("flex min-w-0 flex-1 items-center gap-1.5","disabled"===c?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(FU,{id:u,"aria-label":`${t} ${a.label}`,checked:FX(c),disabled:"disabled"===c,onCheckedChange:()=>s([a.leafKey])}),/*#__PURE__*/r("span",{className:oW("text-xs font-medium","disabled"===c?"text-muted-foreground":"text-foreground/80"),"data-testid":`signal-tree-level-color-${e}-${t}-${a.level}`,style:"disabled"===c?void 0:{color:it(a.color??kS[a.level].color)},children:a.label}),/*#__PURE__*/r(FK,{count:a.count,show:l,testId:`signal-tree-level-count-${e}-${t}-${a.level}`})]})})},FZ=({tree:e,leafKeysWithData:t,hiddenKeys:a,showCount:o,onToggleNode:i})=>{let[l,s]=b(()=>new Set),[c,d]=b(()=>new Set),h=u(e=>{s(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),p=u(e=>{d(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]);return /*#__PURE__*/r(g4,{viewportClassName:"h-auto max-h-[var(--radix-dropdown-menu-content-available-height)]",children:/*#__PURE__*/r("div",{className:"p-[calc(var(--size-gap-base)/2)]",children:e.sources.map((e,s)=>{let u=kA(t,a,e.leafKeys),d=`signal-tree-source-checkbox-${e.source}`;return /*#__PURE__*/n("div",{className:oW(s>0&&"mt-[calc(var(--size-gap-base)/2)] border-t border-border/60 pt-[calc(var(--size-gap-base)/2)]"),"data-testid":`signal-tree-source-${e.source}`,children:[/*#__PURE__*/n("div",{className:"flex items-center gap-1.5 rounded-[var(--radius-control)] px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] transition-colors hover:bg-accent/80","data-testid":`signal-tree-source-row-${e.source}`,children:[e.types.length>0?/*#__PURE__*/r("button",{type:"button","aria-label":c.has(e.source)?"展开数据来源":"折叠数据来源",className:"flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:()=>p(e.source),children:c.has(e.source)?/*#__PURE__*/r(FM,{className:"size-3.5"}):/*#__PURE__*/r(Fk,{className:"size-3.5"})}):/*#__PURE__*/r("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/n("label",{htmlFor:d,className:oW("flex min-w-0 flex-1 items-center gap-1.5","disabled"===u?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/r(FU,{id:d,"aria-label":`${e.label}筛选`,checked:FX(u),disabled:"disabled"===u,onCheckedChange:()=>i(e.leafKeys)}),/*#__PURE__*/r("span",{className:"text-xs font-medium text-foreground",children:e.label}),/*#__PURE__*/r(FK,{count:e.count,show:o,testId:`signal-tree-source-count-${e.source}`})]})]}),c.has(e.source)?null:/*#__PURE__*/r("div",{className:"ml-4 divide-y divide-border/40 border-l border-border/60 pl-1",children:e.types.map(n=>/*#__PURE__*/r(FV,{source:e,type:n,leafKeysWithData:t,hiddenKeys:a,showCount:o,expanded:!l.has(`${e.source}:${n.signalType}`),onToggleExpanded:()=>h(`${e.source}:${n.signalType}`),onToggleNode:i},n.signalType))})]},e.source)})})})},FJ=()=>{let{state:{signal:e},dispatch:t}=n9(),n=e.display,a=e.show,o=k8({respectVisibility:!1,filterHidden:!1}),i=m(()=>kR(o),[o]),l=m(()=>new Set(i.sources.flatMap(e=>e.dataLeafKeys)),[i]),s=m(()=>new Set(e.hiddenCategoryKeys??[]),[e.hiddenCategoryKeys]),c=(e.hiddenCategoryKeys?.length??0)>0,d=u(r=>{t({payload:{signal:{...e,display:r}}})},[e,t]),h=u(r=>{let n=kI(e.hiddenCategoryKeys??[],r,l);t({payload:{signal:{...e,hiddenCategoryKeys:n}}})},[e,l,t]);return a?/*#__PURE__*/r(vz,{leading:/*#__PURE__*/r(vN,{active:n,tone:"primary",onClick:()=>{d(!n)},title:`全部信号标注:${n?"显示":"隐藏"}`,children:/*#__PURE__*/r("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/r("path",{fill:"currentColor",d:"M563.072 376.48a79.456 79.456 0 0 0 28.928-61.12 80 80 0 1 0-160 0c0 24.672 11.392 46.432 28.928 61.12l-202.88 540.256a32 32 0 1 0 59.904 22.496l49.28-131.264h289.504l49.28 131.264a32.064 32.064 0 0 0 41.248 18.752c16.544-6.208 24.896-24.672 18.72-41.216l-202.912-540.288z m-1.312 178.624h-99.552L512 422.56l49.76 132.544z m-170.464 188.896l46.912-124.896h147.616l46.912 124.896h-241.44zM662.464 417.408a32 32 0 1 0 53.12 35.648 254.72 254.72 0 0 0 43.136-142.304 255.04 255.04 0 0 0-43.136-142.304 32 32 0 1 0-53.12 35.68 190.944 190.944 0 0 1 32.288 106.624 190.816 190.816 0 0 1-32.288 106.656zM289.888 453.024a32 32 0 1 0 53.184-35.616 191.36 191.36 0 0 1-32.32-106.656 191.328 191.328 0 0 1 32.32-106.656 32.064 32.064 0 0 0-8.768-44.416 32.096 32.096 0 0 0-44.416 8.768 254.976 254.976 0 0 0-43.136 142.304 254.976 254.976 0 0 0 43.136 142.272zM210.656 117.12A32 32 0 1 0 157.44 81.536a420.032 420.032 0 0 0-70.848 233.824 419.744 419.744 0 0 0 70.88 233.856 31.936 31.936 0 0 0 44.416 8.768 32 32 0 0 0 8.768-44.416 355.168 355.168 0 0 1-60.032-198.24A355.36 355.36 0 0 1 210.656 117.12zM896.224 154.304a416.96 416.96 0 0 0-38.912-72.768 32 32 0 1 0-53.184 35.584 354.912 354.912 0 0 1 60.064 198.24 355.2 355.2 0 0 1-60.064 198.208 32.032 32.032 0 0 0 53.184 35.648 418.816 418.816 0 0 0 70.88-233.856c0-55.68-10.752-109.856-31.968-161.056z"})})}),value:null,options:[],triggerTitle:`筛选信号标注类别${c?"(已应用筛选)":""}`,triggerTestId:"signal-tree-trigger",triggerContent:/*#__PURE__*/r("span",{className:"sr-only",children:c?"信号标注类别筛选(已应用)":"信号标注类别筛选"}),customContent:/*#__PURE__*/r("div",{"data-testid":"signal-tree-popover",children:/*#__PURE__*/r(FZ,{tree:i,leafKeysWithData:l,hiddenKeys:s,showCount:!1!==e.showCount,onToggleNode:h})}),contentClassName:"w-max max-w-[calc(100vw-1rem)] p-0",triggerClassName:oW("justify-center [&>span:last-child]:ml-0",c&&"bg-accent/72 shadow-[inset_0_0_0_1px_var(--mix-primary-28)] [&>span:last-child]:text-primary")}):null},F0=FJ,F1=[{component:yR,toolType:rl.AutorangingSwitch,supportedCharts:[],excludedCharts:[re.Heatmap,re.ScanDF360,re.LevelStream,re.LiteNormalized]},{component:y$,toolType:rl.UnitSwitch,supportedCharts:[],excludedCharts:[re.ScanDF360,re.LevelStream]},{component:vO,toolType:rl.GradientRibbon,supportedCharts:[re.Heatmap]},{component:vq,toolType:rl.SpacerLine,supportedCharts:[],excludedCharts:[re.ScanDF360,re.LevelStream]},{component:CI,toolType:rl.Reset,supportedCharts:[],excludedCharts:[re.LiteNormalized]},{component:FJ,toolType:rl.StationAllocationSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan,re.DDC]},{component:Cq,toolType:rl.SeriesControl,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan],props:{type:"dynamic"}},{component:C5,toolType:rl.FrequencyAllocationSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan,re.LiteNormalized]},{component:CH,toolType:rl.ZoomSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan,re.LiteNormalized]},{component:C6,toolType:rl.LimitSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan]},{component:Fy,toolType:rl.MarkersSwitch,supportedCharts:[re.SingleFrequency,re.Scan,re.MScan]},{component:CL,toolType:rl.SegmentsDisplayControl,supportedCharts:[re.Scan]},{component:CK,toolType:rl.HeatmapCaptureSwitch,supportedCharts:[re.Heatmap]},{component:C0,toolType:rl.TimeRangeSwitch,supportedCharts:[re.Heatmap]},{component:C_,toolType:rl.SeriesDisplayControl,supportedCharts:[re.SingleFrequency,re.Scan,re.LiteNormalized,re.MScan]},{component:CW,toolType:rl.FluorescenceSwitch,supportedCharts:[re.SingleFrequency]},{component:C1,toolType:rl.DeltaMeasurementSwitch,supportedCharts:[re.SingleFrequency,re.Scan]}],F2=(e,t,r=[])=>!new Set(r).has(e.toolType)&&(e.supportedCharts.length>0?!!t&&e.supportedCharts.includes(t):!e.excludedCharts||!(e.excludedCharts.length>0)||!t||!e.excludedCharts.includes(t)),F5=(e,t)=>e.props?"dynamic"===e.props.type?{...e.props,type:t}:e.props:{},F4=({type:e})=>{let t=n7(e=>e.toolbar.show),n=n7(e=>e.toolbar.hiddenTools??[]),{width:a,pluginBoxWidth:o}=yt(),i=m(()=>({marginLeft:a,width:o,...iq}),[a,o]),l=m(()=>F1.filter(t=>F2(t,e,n)).map(t=>/*#__PURE__*/r(t.component,{...F5(t,e)},t.toolType)),[n,e]);return e!==re.Occupancy&&t?/*#__PURE__*/r("div",{className:"relative flex h-10 min-w-0 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground",style:i,children:/*#__PURE__*/r("div",{className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:/*#__PURE__*/r("div",{className:"flex h-full w-max min-w-full items-center gap-[var(--size-gap-base)]",children:l})})}):null},F3=/*#__PURE__*/c(F4);function F6(){let{state:{globalID:e,axisY:t,levelStream:r}}=n9(),n=t.range??ni,{cacheTime:a=2e4,granularity:o=1,maxPoints:i=500}=r??{},l=g(null),s=g(e),c=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(s.current,rt.Spectrum)({pstype:rr.Render,data:{[t3]:e.spectrumData}}),((e,t,r="0")=>tI(e,t,void 0,r))(s.current,rt.LevelStream)({pstype:rr.Render,data:e.probabilityRangeData})},[]),d=u(e=>{let{probabilityRangeData:t,spectrumData:r}=e;tO(s.current).getAllRawData=t=>({...tL().getAllRawData(t),levelStreamData:e}),c({probabilityRangeData:t,spectrumData:r})},[c]);if(h(()=>{s.current=e},[e]),!l.current&&e){l.current=new P({range:n,cacheTime:a,granularity:o,maxPoints:i,onLevelStreamUpdate:d});let{line:t}=t0("levelStream");((e,t,r="0")=>tI(e,t,void 0,r))(e,rt.Spectrum)({pstype:rr.Series,name:t3,color:t})}return h(()=>{l.current?.setConfig({range:n})},[n]),h(()=>{l.current?.setConfig({cacheTime:a})},[a]),h(()=>{l.current?.setConfig({granularity:o})},[o]),h(()=>{l.current?.setConfig({onLevelStreamUpdate:d})},[d]),{analyzer:l.current,updateLevelStreamData:c}}class F8 extends id{constructor(e){super({id:e.id,chart:null,orientation:e.orientation??z.Vertical})}init(){let{id:e,orientation:t}=this.state,r=[...t2()].reverse().map(e=>E(e));this.state.chart=new N({id:e,series:[{name:"bar",type:M.Bar,display:!0,color:t0("bar"),orientation:t}],range:[0,100],barValue2Color:!0,colors:r})}updateSeries(e){this.state.chart?.render({name:"bar",data:e})}}let F9=e=>{let{opacity:t}=e,{chart:n,Chart:a}=oY({Render:F8,params:{orientation:z.Horizontal}});return o1({moduleType:rt.LevelStream,chart:n,extractData:e=>e.data}),/*#__PURE__*/r(a,{style:m(()=>({opacity:t,zIndex:1}),[t])})},F7=F9,De=6,Dt=4,Dr=8,Dn=({axisLineWidth:e,inside:t,width:r})=>t?{axisX:e,majorTickEndX:6,majorTickStartX:0,minorTickEndX:4,minorTickStartX:0,textAlign:"left",textX:8}:{axisX:r-e,majorTickEndX:r,majorTickStartX:r-6,minorTickEndX:r,minorTickStartX:r-4,textAlign:"right",textX:r-8},Da=.5,Do=2,Di=4,Dl=100,Ds=1,Dc=.5,Du=.5;function Dd(e){let{ranging:t}=e,{range:r,disabled:n,placement:a,show:o}=n7(e=>e.axisY),i="inside"===a,l=g(null),s=g(null),[c,d]=b(0),[p,f]=b(window.devicePixelRatio||1),[v,y]=b(!1),[w,x]=b(0),k=u((e,t)=>{let r=.5*(Math.max(1,Math.round(t*p))%2!=0);return(Math.round(e*p-r)+r)/p},[p]),S=u((e,t,r)=>{let n=r/2;return Math.min(t-n,Math.max(n,e))},[]),M=m(()=>{let[e,t]=r;return{min:e,max:t}},[r]);h(()=>{let e=window.matchMedia(`(resolution: ${p}dppx)`),t=()=>f(window.devicePixelRatio||1);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[p]),h(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];t&&d(t.contentRect.height)});return t.observe(e),()=>t.disconnect()},[o]);let C=u((e,t)=>{if(t.useScientific)return e.toExponential(1);if(t.useKFormat){let r=e/1e3;return t.useDecimals?`${r.toFixed(1)}k`:`${Math.round(r)}k`}return t.useDecimals?e.toFixed(1):Math.round(e).toString()},[]),F=m(()=>{if(0===c)return{majorTicks:[],minorTicks:[]};let e=M.max-M.min,{interval:t,majorTickValues:r}=Cf([M.min,M.max]);if(!t||0===r.length)return{majorTicks:[],minorTicks:[]};let n=r.some(e=>Math.abs(e)>=1e3),a=r.some(e=>.01>Math.abs(e)&&0!==e),o={useScientific:a,useKFormat:n&&!a,useDecimals:r.some(e=>e%1!=0)},i=[];for(let t of r){let r=(M.max-t)/e*c,n=r,a=!0,l=!1,s=c-6,u=.3*c;r<-u||r>c+u?a=!1:r<6?(n=6,l=!0):r>s&&(n=s,l=!0),a&&i.push({value:t,position:r,textPosition:n,label:C(t,o),isAdjusted:l})}let l=[],s=t/2,u=s/e*c,d=e<1;if(u>=(d?8:4)&&c>100&&!d){let r=Math.ceil(M.min/s)*s;for(let n=r;n<=M.max;n+=s){if(Math.abs(n%t)<.1*s)continue;let r=(M.max-n)/e*c;r>=0&&r<=c&&l.push({value:n,position:r,textPosition:r,label:""})}}return{majorTicks:i,minorTicks:l}},[M,c,C]),D=u(()=>{let e=l.current;if(!e||0===c)return;let t=e.getContext("2d");if(!t)return;let r=e.getBoundingClientRect().width,n=Dn({axisLineWidth:.5,inside:i,width:r});e.width=r*p,e.height=c*p,e.style.width=`${r}px`,e.style.height=`${c}px`,t.setTransform(p,0,0,p,0,0),t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.clearRect(0,0,r,c),t.font="12px -apple-system, BlinkMacSystemFont, sans-serif",t.textAlign=n.textAlign,t.textBaseline="middle",t.lineWidth=Ds;let a=ia("--foreground",.5,s.current);F.majorTicks.forEach(e=>{t.fillStyle=a,t.strokeStyle=a,t.fillText(e.label,n.textX,e.textPosition),t.beginPath();let r=k(S(e.position,c,Ds),Ds);t.moveTo(n.majorTickStartX,r),t.lineTo(n.majorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=.5,F.minorTicks.forEach(e=>{t.beginPath();let r=k(S(e.position,c,.5),.5);t.moveTo(n.minorTickStartX,r),t.lineTo(n.minorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=.5,t.beginPath();let o=k(n.axisX,.5);t.moveTo(o,0),t.lineTo(o,c),t.stroke()},[F,c,p,i,k,S]);h(()=>{!1!==o&&D()},[D,o]),h(()=>ic(()=>{D()}),[D]);let z=u(e=>{n||(y(!0),x(e.clientY))},[n]),N=u(e=>{n||t.moveWheel?.(e)},[t,n]),E=u(e=>{if(n||!v||!s.current)return;let r=(e.clientY-w)/s.current.offsetHeight;Math.abs(r)>(M.max-M.min<1?.005:.01)&&(t.move?.(r),x(e.clientY))},[n,v,w,t,M]);return{canvasRef:l,containerRef:s,isDragging:v,range:M,handleMouseDown:z,handleMouseMove:E,handleMouseUp:u(()=>{n||y(!1)},[n]),handleMouseLeave:u(()=>{n||y(!1)},[n]),handleWheel:N,ticksData:F}}function Dh(e){let{chart:t}=e,{state:{axisY:n,globalID:a}}=n9(),{show:o}=n,i=nW({chart:t}),{axisYWidth:l,inside:s,marginLeft:c}=yt(),{canvasRef:u,containerRef:d,isDragging:h,handleMouseDown:p,handleMouseMove:f,handleMouseUp:m,handleMouseLeave:g,handleWheel:b}=Dd({ranging:i});return!1===o?null:/*#__PURE__*/r("div",{ref:d,className:oW("h-full select-none",s?"absolute left-0 top-0 z-[7]":"relative",h?"cursor-grabbing":"cursor-ns-resize"),style:{width:l,marginLeft:c},onMouseDown:p,onMouseMove:f,onMouseUp:m,onMouseLeave:g,onWheel:b,onDoubleClick:()=>{let{realRange:e}=nT({range:n.defaultRange??ni,unit:n.unit,step:n.step,globalID:a}),t=yz(n.restrict,e);i.setAxisY?.({realRange:t}),i.onChange?.()},children:/*#__PURE__*/r("canvas",{ref:u,className:"pointer-events-none absolute left-0 top-0 h-full w-full"})})}let Dp=(e,t,r)=>{let[n,a]=r;return e<=0||t.end<t.start||!Number.isFinite(n)||!Number.isFinite(a)||a<=n?null:{x:[100*t.start/e,(t.end+1)*100/e],y:[n,a]}},Df=(e,t)=>{let r=t.x[1]-t.x[0],n=t.y[1]-t.y[0],a=e=>Math.max(0,Math.min(100,t.x[0]+e*r/100));return{x:[a(e.leftPosition),a(e.leftPosition+e.width)],y:[t.y[1]-(e.position+e.height)*n/100,t.y[1]-e.position*n/100]}},Dm=(e,t)=>{let r=t.x[1]-t.x[0],n=t.y[1]-t.y[0];return{leftPosition:(e.x[0]-t.x[0])*100/r,width:(e.x[1]-e.x[0])*100/r,position:(t.y[1]-e.y[1])*100/n,height:(e.y[1]-e.y[0])*100/n}},Dg=(e,t)=>{let r=t.x[1]-t.x[0];return{left:-(100*t.x[0])/r,right:(100-t.x[0])*100/r,top:Math.min(0,100-e.height,e.position),bottom:Math.max(100,e.height,e.position+e.height)}},Db=(e,t,r=0)=>{let n=t(e.x[0]),a=t(e.x[1]),o=Number(n),i=Number(a);return n&&a&&Number.isFinite(o)&&Number.isFinite(i)?{deltaX:Math.abs(i-o),deltaY:Math.abs(e.y[1]-e.y[0]),centerFrequency:(o+i)/2,startFrequency:o,endFrequency:i,startAmplitude:e.y[0]+r,endAmplitude:e.y[1]+r}:null},Dv=1e-9,Dy=(e,t,r,n,a)=>{for(let o=n;o<=a;o+=1)if(r(e,o)!==r(t,o))return o;return a},Dw={position:40,height:20,leftPosition:40,width:20},Dx=()=>{let{state:{deltaMeasurement:{show:e,display:t,onChange:a},axisX:{frequencyFormat:o},axisY:{unit:i,range:l,renderRange:s},segments:c,zoom:{interval:d}}}=n9(),p=e&&t,[f,v]=b(null),y=g(null),w=g(a);w.current=a;let x=s??l??[-120,0],k=(l?.[0]??x[0])-x[0],S=m(()=>Dp(c.totalPoints??0,d,x),[c.totalPoints,d.start,d.end,x[0],x[1]]),M=m(()=>f&&S?Dm(f,S):null,[f,S]),C=m(()=>f&&o&&c.length?Db(f,o,k):null,[f,o,c,k]);h(()=>{p&&S&&v(e=>e??Df(Dw,S))},[p,S]),h(()=>{p||(y.current=null,v(null),w.current?.(null))},[p]);let F=u(e=>{let t=y.current??S;t&&v(Df(e,t))},[S]),D=u(e=>{let t=y.current??S;if(y.current=null,!t||!o||!c.length)return;let r=Df(e,t);v(r);let n=Db(r,o,k);n&&a?.(n)},[S,o,c,k,a]),z=(e,t=3)=>rF(e,t).formatted,N=(e,t=2)=>{let r=Number.parseFloat(e.toFixed(t));return`${r} ${i}`},E=m(()=>{if(!C)return{labels:void 0,middleContent:null};let e=C.deltaX<=1e-9,t=C.deltaY<=1e-9,a=e?3:Dy(C.startFrequency,C.endFrequency,z,3,6),o=t?2:Dy(C.startAmplitude,C.endAmplitude,N,2,4),l=z(C.startFrequency,a),s=z(C.endFrequency,a),c=N(C.endAmplitude,o),u=N(C.startAmplitude,o),d=z(C.deltaX,a),h=`${Number.parseFloat(C.deltaY.toFixed(o))} ${i}`,p=z(C.centerFrequency,a);return{labels:{left:e?void 0:l,right:e?void 0:s,top:t?void 0:c,bottom:t?void 0:u},middleContent:/*#__PURE__*/n("div",{className:"grid gap-0.5",children:[/*#__PURE__*/r("div",{children:e?`频点: ${l}`:`ΔX: ${d}`}),/*#__PURE__*/r("div",{children:t?`幅度: ${u}`:`ΔY: ${h}`}),!e&&/*#__PURE__*/n("div",{children:["中心: ",p]})]})}},[C,i]);if(!M||!S)return null;let T=y.current??S,R=f?Dm(f,T):M;return /*#__PURE__*/r(MF,{enabled:p,defaultRect:M,minSize:0,minWidth:0,minHeight:0,variant:"projected",interactionBounds:Dg(R,T),onDragStart:()=>{y.current=S},onChange:F,onDragEnd:D,zIndex:7,labels:E.labels,children:E.middleContent})},Dk=Dx,DS=({frequencyLeft:e,segments:t})=>rv(t)(e),DM=({e,zoom:t,segments:r,onChange:n,globalID:a})=>{let{realData:o}=tO(a).getAllRawData();if(!o)return;let i=o.length,{interval:{start:l,end:s}}=t,{left:c}=e,u=e.left+e.width,d=wL({coord:e,segments:r,zoom:t}),h=wL({coord:{left:u},segments:r,zoom:t}),p=Math.max(0,Math.ceil(i*d/100)-1),f=Math.ceil(i*h/100),{maxIndex:m}=tU(Array.from(o.slice(p,f)));n({frequency:(({frequencyLeft:e,segments:t})=>rv(t)(e))({frequencyLeft:(l+(p+m+1)/i*(s-l))*100/r.totalPoints,segments:r}),bandwidth:Math.round(1e3*rx({segments:r,endLeft:u,startLeft:c})),left:d,right:h})},DC=ri.DragFrame,DF=({id:e})=>{let{state:{zoom:a,segments:o,signalAnalysis:i,globalID:l},dispatch:s}=n9(),[c,d]=b(null),p=u((e,t=!1)=>{i.show&&i.display&&t?DM({e,zoom:a,segments:o,onChange:i.onChange,globalID:l}):s({payload:{zoom:{...a,interval:e.interval,isScanSegmentsUpdateMagnify:e.isScanSegmentsUpdateMagnify}}})},[i,a,o,l]),f=u((e,t,r,n)=>{if(e&&t&&n){let r=e.left,n=t.left,a=n-r;d({diffX:a,left:a>0?r:n,width:Math.abs(a),isScanSegmentsUpdateMagnify:a>0})}},[]),m=u(()=>{if(!c)return;let{left:e,width:t,isScanSegmentsUpdateMagnify:r,diffX:n}=c,{totalPoints:a}=o;if(r&&n>0){let n=SA({startPercent:e,endPercent:e+t,totalPoints:a}),o=n?n.end-n.start+1:0;n&&o>tV.ZOOM_MIN_RANGE&&p({interval:n,isScanSegmentsUpdateMagnify:r,left:e,width:t},!0)}n<0&&p({interval:{start:0,end:a-1},isScanSegmentsUpdateMagnify:r,left:e,width:t})},[c,o,a.interval.end,p]);return(h(()=>{if(a.show){let t=()=>{d(null),w8(e,DC)};wB(e,DC,t),wG(e,DC,()=>{m(),t()}),wY(e,DC,t),wK(e,DC,(...t)=>{w3(e,DC)&&f(t[0],t[1],t[2],t[3])})}},[a.show,e,m,f]),h(()=>{c||w8(e,DC)},[c,e]),a.show)?/*#__PURE__*/r(yn,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"absolute left-[-100%] top-0 h-full w-0 box-border border-2 border-dashed border-chart-grid-strong bg-chart-surface opacity-40",style:c?{left:`${c.left}%`,width:`${c.width}%`}:{},children:c&&!c.isScanSegmentsUpdateMagnify&&/*#__PURE__*/n(t,{children:[/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 opacity-20",style:{background:"linear-gradient(to top right, transparent, transparent calc(50% - 1px), var(--chart-grid-strong), transparent calc(50% + 1px), transparent)"}}),/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 opacity-20",style:{background:"linear-gradient(to bottom right, transparent, transparent calc(50% - 1px), var(--chart-grid-strong), transparent calc(50% + 1px), transparent)"}})]})})}):null},DD=/*#__PURE__*/c(DF),Dz=14,DN=5,DE=4,DT=({density:e="auto",channelCount:t})=>{let r="compact"===e||"auto"===e&&t>4;return{compact:r,laneHeight:r?5:14,showLabels:!r}},DR=null,DA=["#B22222","#CD5C5C","#FF6347","#FA8072","#F08080","#A0522D","#FF4500","#FF7F50","#B8860B","#FFA500","#808000","#9ACD32","#32CD32","#8FBC8F","#2E8B57","#3CB371","#00FA9A","#66CDAA","#7FFFD4","#2F4F4F","#008080","#00CED1","#20B2AA","#48D1CC","#4682B4","#778899","#87CEFA","#4169E1","#4169E1","#6495ED","#483D8B","#6A5ACD","#7B68EE","#9370DB","#9370DB","#9932CC","#8A2BE2","#BA55D3","#800080","#DDA0DD","#C71585","#DC143C"];function DI(e){let t=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,n=parseInt(e.slice(5,7),16)/255,a=Math.max(t,r,n),o=Math.min(t,r,n),i=0,l=0,s=(a+o)/2;if(a!==o){let e=a-o;switch(l=s>.5?e/(2-a-o):e/(a+o),a){case t:i=(r-n)/e+6*(r<n);break;case r:i=(n-t)/e+2;break;case n:i=(t-r)/e+4}i/=6}return{h:360*i,s:100*l,l:100*s}}let DP=[...DA].map(e=>({color:e,hsl:DI(e)})).sort((e,t)=>Math.abs(e.hsl.h-t.hsl.h)>10?e.hsl.h-t.hsl.h:e.hsl.l-t.hsl.l).map(e=>e.color);function DL(e){let t=[...e].sort((e,t)=>Number(e.startFrequency)-Number(t.startFrequency));return t.map((e,r)=>{let n=t.length,a=DP.length,o=Math.floor(r/n*a),i=Math.floor((r+1)/n*a),l=DP[Math.min(o,a-1)],s=DP[Math.min(i,a-1)],c=r===n-1?DP[a-1]:s;return{...e,color:l,gradientColors:[l,c]}})}let DO=[{startFrequency:87,stopFrequency:108,stepFrequency:100,bandwidth:150,modulation:"AM",demodulation:"不解调",status:"合法",title:"FM广播",description:"FM调频广播频段,用于音频广播服务"},{startFrequency:108,stopFrequency:118,stepFrequency:50,bandwidth:100,modulation:"FM",demodulation:"解调",status:"合法",title:"航空导航",description:"航空无线电导航频段,用于仪表着陆系统等"},{startFrequency:118,stopFrequency:137,stepFrequency:25,bandwidth:50,modulation:"AM",demodulation:"解调",status:"合法",title:"航空语音通信",description:"民用航空语音通信频段"},{startFrequency:121,stopFrequency:122,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"紧急通信",description:"紧急情况通信专用频段"},{startFrequency:136,stopFrequency:174,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"对讲通信",description:"专业无线对讲通信频段"},{startFrequency:161,stopFrequency:162,stepFrequency:25,bandwidth:50,modulation:"GMSK",demodulation:"解调",status:"合法",title:"AIS船舶通信",description:"船舶自动识别系统(AIS)专用频段"},{startFrequency:351,stopFrequency:400,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"集群通信",description:"专业集群通信系统频段"},{startFrequency:400,stopFrequency:470,stepFrequency:25,bandwidth:50,modulation:"FM",demodulation:"解调",status:"合法",title:"专业对讲",description:"专业无线对讲通信频段"},{startFrequency:534,stopFrequency:542,stepFrequency:100,bandwidth:8e3,modulation:"OFDM",demodulation:"解调",status:"合法",title:"数字电视",description:"数字电视广播频段"},{startFrequency:622,stopFrequency:630,stepFrequency:100,bandwidth:8e3,modulation:"OFDM",demodulation:"解调",status:"合法",title:"数字电视",description:"数字电视广播频段"},{startFrequency:703,stopFrequency:733,stepFrequency:100,bandwidth:3e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G上行(广电/移动)",description:"广电和移动5G网络上行频段"},{startFrequency:758,stopFrequency:788,stepFrequency:100,bandwidth:3e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G下行(广电/移动)",description:"广电和移动5G网络下行频段"},{startFrequency:806,stopFrequency:821,stepFrequency:25,bandwidth:50,modulation:"π/4DQPSK",demodulation:"解调",status:"合法",title:"数字集群上行",description:"数字集群通信系统(TETRA)上行频段"},{startFrequency:824,stopFrequency:835,stepFrequency:100,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"电信3G/4G/5G上行",description:"中国电信3G/4G/5G网络上行频段"},{startFrequency:851,stopFrequency:866,stepFrequency:25,bandwidth:50,modulation:"π/4DQPSK",demodulation:"解调",status:"合法",title:"数字集群下行",description:"数字集群通信系统(TETRA)下行频段"},{startFrequency:869,stopFrequency:880,stepFrequency:100,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"电信3G/4G/5G下行",description:"中国电信3G/4G/5G网络下行频段"},{startFrequency:885,stopFrequency:889,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"GSM-R上行",description:"铁路专用GSM-R网络上行频段"},{startFrequency:889,stopFrequency:904,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"移动2G/4G上行",description:"中国移动2G/4G网络上行频段"},{startFrequency:904,stopFrequency:915,stepFrequency:200,bandwidth:200,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/3/4/5G上行",description:"中国联通2G/3G/4G/5G网络上行频段"},{startFrequency:930,stopFrequency:934,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"GSM-R下行",description:"铁路专用GSM-R网络下行频段"},{startFrequency:934,stopFrequency:949,stepFrequency:200,bandwidth:200,modulation:"GMSK",demodulation:"解调",status:"合法",title:"移动2G/4G下行",description:"中国移动2G/4G网络下行频段"},{startFrequency:949,stopFrequency:960,stepFrequency:200,bandwidth:200,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/3/4/5G下行",description:"中国联通2G/3G/4G/5G网络下行频段"},{startFrequency:1164,stopFrequency:1189,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L5频段",description:"全球定位系统GPS L5频段"},{startFrequency:1215,stopFrequency:1234,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L2频段",description:"全球定位系统GPS L2频段"},{startFrequency:1447,stopFrequency:1467,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"政务公安专网",description:"政务和公安专用LTE网络频段"},{startFrequency:1563,stopFrequency:1587,stepFrequency:1e3,bandwidth:1e4,modulation:"BPSK",demodulation:"解调",status:"合法",title:"GPS L1频段",description:"全球定位系统GPS L1频段"},{startFrequency:1710,stopFrequency:1735,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"移动2G/4G上行",description:"中国移动2G/4G网络上行频段"},{startFrequency:1735,stopFrequency:1765,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/4G上行",description:"中国联通2G/4G网络上行频段"},{startFrequency:1805,stopFrequency:1830,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"移动2G/4G下行",description:"中国移动2G/4G网络下行频段"},{startFrequency:1830,stopFrequency:1860,stepFrequency:200,bandwidth:5e3,modulation:"QPSK",demodulation:"解调",status:"合法",title:"联通2/4G下行",description:"中国联通2G/4G网络下行频段"},{startFrequency:1885,stopFrequency:1915,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动4G",description:"中国移动4G网络频段"},{startFrequency:1920,stopFrequency:1940,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"电信/联通5G上行",description:"中国电信/联通5G网络上行频段"},{startFrequency:1940,stopFrequency:1965,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"联通3/4/5G上行",description:"中国联通3G/4G/5G网络上行频段"},{startFrequency:2110,stopFrequency:2130,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"电信/联通5G下行",description:"中国电信/联通5G网络下行频段"},{startFrequency:2300,stopFrequency:2320,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"联通4G",description:"中国联通4G网络频段"},{startFrequency:2320,stopFrequency:2370,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动4G",description:"中国移动4G网络频段"},{startFrequency:2400,stopFrequency:2500,stepFrequency:1,bandwidth:20,modulation:"OFDM",demodulation:"解调",status:"合法",title:"ISM 2.4GHz",description:"WIFI、蓝牙、无人机等使用频段"},{startFrequency:2515,stopFrequency:2675,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动5G/4G",description:"中国移动5G和4G网络频段"},{startFrequency:3300,stopFrequency:3600,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"5G频段",description:"电信、联通、广电5G网络频段"},{startFrequency:4800,stopFrequency:4900,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"移动5G",description:"中国移动5G网络频段"},{startFrequency:4900,stopFrequency:4960,stepFrequency:100,bandwidth:1e4,modulation:"OFDMA",demodulation:"解调",status:"合法",title:"广电5G",description:"中国广电5G网络频段"},{startFrequency:5725,stopFrequency:5875.5,stepFrequency:5,bandwidth:20,modulation:"OFDM",demodulation:"解调",status:"合法",title:"ISM 5GHz",description:"WIFI、无人机等使用频段"}],Dq="rfkit-charts-frequency-allocation",D$=e=>!!e&&"object"==typeof e&&2===e.version&&Array.isArray(e.channels),D_=()=>{let e=localStorage.getItem(Dq);if(!e)return null;let t=JSON.parse(e);return Array.isArray(t)||D$(t)?t:null},Dj=()=>{let e=D_();return Array.isArray(e)?e:null},DH=()=>{let e=D_();return D$(e)?e.channels:null},DB=e=>{localStorage.setItem(Dq,JSON.stringify(e))},DW=e=>{localStorage.setItem(Dq,JSON.stringify({version:2,channels:e}))},DG=()=>{localStorage.removeItem(Dq)},DY=()=>null!==localStorage.getItem(Dq),DU="default",DX=(e,t)=>e.id||e.title||`${DU}-${t}`,DK=e=>e.id?`channel:id:${e.id}`:e.title?`channel:title:${e.title}`:"channel:anonymous",DV=(e,t,r)=>{let n=t.get(e)??0,a=0===n?e:`${e}#${n+1}`;for(;r.has(a);)n+=1,a=`${e}#${n+1}`;return t.set(e,n+1),r.add(a),a},DQ=(e,t)=>{let r=new Map,n=new Set;return e.map((e,r)=>({id:DX(e,r),renderKeyBase:DK(e),title:e.title,data:t(e.data??[])})).filter(e=>e.data.length>0).map(({renderKeyBase:e,...t})=>({...t,renderKey:DV(e,r,n)}))},DZ=(e,t)=>[{id:DU,renderKey:`channel:id:${DU}`,data:t(e)}];function DJ({data:e,channels:t,cachedData:r,cachedChannels:n,presetData:a,normalizeData:o}){if(t)return t.length?DQ(t,o):DZ(e?.length?e:a,o);if(n?.length)return DQ(n,o);let i=e??[];return DZ(r&&r.length>0?r:i.length>0?i:a,o)}function D0({data:e,channels:t}){return DJ({data:e,channels:t,cachedData:Dj(),cachedChannels:DH(),presetData:DO,normalizeData:DL})}function D1(e){return D0({data:e})[0]?.data??[]}let D2=e=>{if(null!=e.startFrequency&&null!=e.stopFrequency){let t=rE({startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)});if(t)return{start:t.startFreq,stop:t.stopFreq,type:"range"}}return null},D5=e=>JSON.stringify([e.title,e.startFrequency,e.stopFrequency,e.centerFrequency,e.bandwidth,e.stepFrequency,e.modulation,e.description,e.demodulation,e.status]),D4=e=>e.id?`band:id:${e.id}`:`band:fingerprint:${D5(e)}`,D3=(e,t,r)=>{let n=t.get(e)??0,a=0===n?e:`${e}#${n+1}`;for(;r.has(a);)n+=1,a=`${e}#${n+1}`;return t.set(e,n+1),r.add(a),a},D6=({segments:e,allocations:t,channelIndex:r,channelTitle:n})=>{if(!e.length||!t.length)return[];let a=e.reduce((e,t)=>e+t.point,0),o=new Map,i=new Set,l=t.map(e=>({band:e,renderKey:D3(D4(e),o,i)}));return e.map((t,o)=>{let i=l.map(({band:e,renderKey:a})=>{let o=D2(e);if(!o||o.stop<t.start||o.start>t.stop)return null;let{left:i,width:l}=rI({startFreq:o.start,stopFreq:o.stop},t);return{band:e,renderKey:a,range:o,channelIndex:r??0,channelTitle:n,position:{left:`${i}%`,width:`${l}%`}}}).filter(e=>null!==e),s=t.point/a*100,c=e.slice(0,o).reduce((e,t)=>e+t.point/a*100,0);return{segment:t,segmentIndex:o,bandPositions:i,style:{left:`${c}%`,width:`${s}%`}}})},D8=({segments:e,channels:t})=>t.map((t,r)=>({channel:t,channelIndex:r,segmentData:D6({segments:e,allocations:t.data,channelIndex:r,channelTitle:t.title})})).filter(e=>e.segmentData.some(e=>e.bandPositions.length>0)),D9=e=>e.map(e=>{let t=calculateFrequencyRange(null!=e.startFrequency&&null!=e.stopFrequency?{startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)}:{frequency:null!=e.centerFrequency?Number(e.centerFrequency):void 0,bandwidth:null!=e.bandwidth?Number(e.bandwidth):void 0});return t?{item:e,range:t,width:Math.abs(t.stopFreq-t.startFreq),center:(t.startFreq+t.stopFreq)/2,title:String(e.title??"")}:null}).filter(e=>null!==e),D7=({rangeIndex:e,frequency:t})=>{let r;if(Number.isFinite(t)&&e.length){for(let n of e){let{range:e}=n;if(t<e.startFreq||t>e.stopFreq)continue;if(!r){r=n;continue}let a=n.width-r.width;if(a<0){r=n;continue}if(a>0)continue;let o=Math.abs(n.center-t)-Math.abs(r.center-t);if(o<0){r=n;continue}!(o>0)&&0>n.title.localeCompare(r.title)&&(r=n)}return r?.item}},ze=({allocations:e,frequency:t})=>D7({rangeIndex:D9(e),frequency:t});function zt(){let e=useSelector(e=>e.frequencyAllocation.data);return useMemo(()=>resolveFrequencyAllocationData(e),[e])}function zr(){let e=n7(e=>e.frequencyAllocation.data),t=n7(e=>e.frequencyAllocation.channels);return m(()=>D0({data:e,channels:t}),[e,t])}function zn({frequency:e,cursorSample:t}){let r=useSelector(e=>e.cursor),n=useSelector(e=>e.segments),a=useSelector(e=>e.frequencyAllocation.display),o=useSelector(e=>e.frequencyAllocation.show),i=t?.coord.left??r.coord.left,l=useFrequencyAllocationData(),s=useMemo(()=>createFrequencyAllocationRangeIndex(l),[l]),c=useMemo(()=>!!t||hasActiveSpectrumCursor(r),[r,t]),u=useMemo(()=>c&&"number"==typeof i?calculateCursorPosition(i,n):{segmentIndex:-1,pointIndex:-1},[c,i,n]);return useMemo(()=>{if(!o||!a||!e||!n?.length||!c||!n[u.segmentIndex])return;let t=getCursorFrequencyAtPosition(n,u),r=Number.isFinite(t)?t:Number(e);if(Number.isFinite(r))return findFrequencyAllocationInRangeIndex({rangeIndex:s,frequency:r})},[s,u.segmentIndex,a,e,c,n,o])}let za=null,zo=({allocationInfo:e,variant:t="default"})=>{if(!e)return null;let{title:a,description:o,startFrequency:i,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:u,modulation:d,channelTitle:h}=e;return /*#__PURE__*/n("div",{className:oW("text-xs leading-5 text-popover-foreground","board"===t&&"mt-[calc(var(--size-gap-base)/2)] border-t border-dashed border-border pt-[calc(var(--size-gap-base)/2)]"),children:[a?/*#__PURE__*/r("div",{className:"mb-1 font-bold",children:a}):null,/*#__PURE__*/n("div",{className:"mb-1 text-primary",children:[h?/*#__PURE__*/n("div",{children:["通道:",h]}):null,i&&l&&/*#__PURE__*/n("div",{children:["频率范围:",i," - ",l]}),s?/*#__PURE__*/n("div",{children:["中心频率:",s," MHz"]}):null,c?/*#__PURE__*/n("div",{children:["步进:",c," kHz"]}):null,u?/*#__PURE__*/n("div",{children:["带宽:",u," kHz"]}):null,d?/*#__PURE__*/n("div",{children:["调制方式:",d]}):null]}),o?/*#__PURE__*/r("div",{className:"leading-5 opacity-85",children:o}):null]})},zi=/*#__PURE__*/a.memo(zo),zl=/*#__PURE__*/c(({style:e,bandPositions:t,showLabels:n,onMouseEnter:a,onMouseMove:o,onMouseLeave:i})=>/*#__PURE__*/r("div",{className:"absolute top-0 h-full [contain:layout]",style:e,children:t.map(e=>{let{band:t,position:l,renderKey:s}=e;return /*#__PURE__*/r("div",{className:"pointer-events-auto absolute flex h-full items-center justify-center overflow-hidden px-1 text-xs text-foreground/90 opacity-60 backdrop-blur-sm transition-[opacity,box-shadow] duration-200 hover:z-[1] hover:opacity-100 hover:shadow-lg",style:{...t.gradientColors?{backgroundImage:`linear-gradient(to right, ${t.gradientColors[0]}, ${t.gradientColors[1]})`}:{backgroundColor:t.color||"var(--primary)"},left:l.left,width:l.width},onMouseEnter:a(e),onMouseMove:o,onMouseLeave:i,children:n?/*#__PURE__*/r("span",{className:"truncate",children:t.title}):null},s)})})),zs=zl,zc=({title:e,description:t,visible:n,x:a,y:o,startFrequency:i,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:d,modulation:p,channelTitle:f,positionRef:m,scheduleRef:b})=>{let v=g(null),y=g(null),w=gn("tooltip"),x=u(()=>{if(!n||!v.current)return;let e=v.current,t=e.offsetWidth,r=e.offsetHeight,i=window.innerWidth,l=window.innerHeight,s=m.current??{x:a,y:o},c=s.x,u=s.y,d=Math.max(12,Math.min(c+t>i-12?c-t-10:c,i-t-12)),h=Math.max(12,Math.min(u+r>l-12?u-r-10:u,l-r-12));e.style.transform=`translate3d(${d}px, ${h}px, 0)`},[m,n,a,o]),k=u(()=>{n&&null===y.current&&(y.current=requestAnimationFrame(()=>{y.current=null,x()}))},[x,n]);return(h(()=>(b.current=k,()=>{b.current===k&&(b.current=null)}),[k,b]),h(()=>{if(n)return k(),()=>{null!==y.current&&(cancelAnimationFrame(y.current),y.current=null)}},[w,k,n]),n&&w)?/*#__PURE__*/R(/*#__PURE__*/r("div",{ref:v,"data-rfkit-frequency-allocation-tooltip":"true",className:"pointer-events-none fixed z-[1] max-w-[300px] rounded-[var(--radius-surface)] border border-border/70 bg-chart-panel/95 p-[var(--size-gap-base)] text-chart-panel-foreground shadow-lg backdrop-blur-md",style:{left:0,top:0,transform:`translate3d(${a}px, ${o}px, 0)`},children:/*#__PURE__*/r(zi,{allocationInfo:{title:e,description:t,startFrequency:i,stopFrequency:l,centerFrequency:s,stepFrequency:c,bandwidth:d,modulation:p,channelTitle:f}})}),w):null},zu=zc,zd=()=>{let e=n7(e=>e.axisX.unit),t=n7(e=>e.segments),a=n7(e=>e.frequencyAllocation.display),o=n7(e=>e.frequencyAllocation.show),i=n7(e=>e.frequencyAllocation.density),l=n7(e=>e.zoom.style),s=zr(),[c,d]=b({visible:!1,x:0,y:0}),h=g({x:0,y:0}),p=g(null),f=u(e=>{h.current={x:e.clientX+10,y:e.clientY+10},p.current?.()},[]),v=m(()=>D8({segments:t,channels:s}),[t,s]),{laneHeight:y,showLabels:w}=DT({density:i,channelCount:v.length}),x=Math.max(y,v.length*y),k=u(e=>{d(t=>({...t,...e}))},[]),S=u(({band:t,channelTitle:r,range:n})=>a=>{f(a);let o={...t,visible:!0,x:h.current.x,y:h.current.y,channelTitle:r,startFrequency:`${n.start}${e}`,stopFrequency:`${n.stop}${e}`};"centerBandwidth"===n.type&&null!=n.frequency&&null!=n.bandwidth&&(o.centerFrequency=`${n.frequency}${e}`),k(o)},[e,k,f]),M=u(e=>{f(e)},[f]),C=u(()=>{k({visible:!1})},[k]);return o&&a&&0!==v.length?/*#__PURE__*/n("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] flex w-full select-none items-center overflow-hidden",style:{height:x,backgroundColor:"var(--mix-chart-surface-12)"},children:[/*#__PURE__*/r("div",{className:"absolute right-0 top-0 h-full w-full will-change-transform",style:l??void 0,children:v.map(({channel:e,channelIndex:t,segmentData:n})=>/*#__PURE__*/r("div",{className:"absolute left-0 w-full",style:{bottom:t*y,height:y},children:n.map(({segmentIndex:t,bandPositions:n,style:a})=>/*#__PURE__*/r(zl,{style:a,bandPositions:n,showLabels:w,onMouseEnter:S,onMouseMove:M,onMouseLeave:C},`${e.renderKey}-segment-${t}`))},e.renderKey))}),/*#__PURE__*/r(zc,{...c,positionRef:h,scheduleRef:p})]}):null},zh=zd,zp=e=>{let[t,r]=b(0);return h(()=>{if(!e)return;let t=tq(e,"FrequencyTagLineBoard",()=>{r(e=>e+1)});return()=>{t?.()}},[e]),t},zf=({id:e})=>{let{state:{frequencyTagLine:t,cursor:n}}=n9(),{show:a,display:o,left:i,onChange:l}=t,s=zp(e),c=n.show&&n.active&&n.event?.sourceType===rt.Spectrum,d=u(e=>{if(!e)return;let{index:t,frequency:r}=e;tY(r)&&l({index:t,frequency:r})},[l]);return a&&o&&!c?/*#__PURE__*/r("div",{className:"absolute bottom-5 right-[34px] z-[6] h-auto w-auto",children:/*#__PURE__*/r(Ss,{left:i,updateKey:s,onChange:d,showSignalInfo:!1})}):null},zm=/*#__PURE__*/a.memo(zf),zg=()=>{let{state:{frequencyTagLine:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{frequencyTagLine:{...e,display:!!r}}})},[e]),o=useMemo(()=>/*#__PURE__*/_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:/*#__PURE__*/_jsx("path",{d:"M288 128H896l-120 256L896 640H288v320H192v-896h96V128z",fillOpacity:".65",fill:"currentColor",style:{transition:"fill 0.2s ease"}})}),[r]);return n?/*#__PURE__*/_jsx(IconBox,{active:r,tone:"primary",onClick:()=>a(!r),title:"频率标记线显示控制",children:o}):null},zb=/*#__PURE__*/null,zv=ri.FrequencyTagLine,zy=e=>{let{state:{frequencyTagLine:t},dispatch:n}=n9(),{show:a,display:o,left:i,onChange:l}=t,{id:s}=e,c=g(t);return(h(()=>{c.current=t},[t]),h(()=>{let e=wG(s,zv,()=>{a&&o&&w8(s,zv)}),t=wY(s,zv,()=>{a&&o&&w8(s,zv)});return()=>{e?.(),t?.()}},[s,a,o,l]),h(()=>{let e=wB(s,zv,e=>{a&&o&&n({payload:{frequencyTagLine:{...c.current,...e,id:s}}})}),t=wK(s,zv,(e,t)=>{a&&o&&(w3(s,zv),n({payload:{frequencyTagLine:{...c.current,...t,id:s}}}))});return()=>{e?.(),t?.()}},[s,a,o,n]),h(()=>{n({payload:{frequencyTagLine:{...t,left:-100}}})},[a]),a&&o)?/*#__PURE__*/r(yn,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"relative flex h-full w-px border-l border-dashed border-chart-highlight/80 opacity-80",style:{left:`${i}%`}})}):null},zw=/*#__PURE__*/a.memo(zy),zx={color:tQ},zk={borderColor:tQ},zS=({value:e,onChange:t,dragging:a})=>{let{state:{axisY:o,limit:i}}=n9(),{label:l,disabled:s}=i,{unit:c="",range:d=ni,step:h=na}=o,[p,f]=d,v=m(()=>rm(c)?nb(0):0,[c]),y=u(e=>(f-e-v)/(f-p)*100,[f,v,p]),w=m(()=>y(e),[y,e]),x=m(()=>Math.round(v+e),[v,e]),[k,S]=b(!1),M=g(null),C=u(e=>{switch(e.key){case"Enter":{if(!M.current){S(!1);break}let e=Number(M.current.value);!Number.isNaN(e)&&e>=p&&e<=f&&(t?.(Math.floor(e-v)),M.current.blur()),S(!1);break}case"Escape":S(!1)}},[M,d,v,t]);return /*#__PURE__*/r("div",{className:"relative h-full w-full",children:/*#__PURE__*/n("div",{className:"absolute right-0 h-0 w-full",style:{top:`${w}%`},children:[!k||s?/*#__PURE__*/n("button",{type:"button",disabled:s,className:`${a?"pointer-events-none":"pointer-events-auto"} absolute right-7 top-[-28px] z-[8] flex h-6 appearance-none items-center justify-center rounded-[var(--radius-control)] border-0 bg-secondary px-2 text-xs text-foreground`,style:zx,onClick:()=>S(!0),children:[l," ",x,c]}):/*#__PURE__*/n("div",{className:"pointer-events-auto absolute right-7 top-[-28px] z-[8] flex h-6 items-center justify-between bg-secondary px-2 text-xs text-foreground",style:zx,children:[l," ",/*#__PURE__*/r("input",{ref:M,type:"number","aria-label":`${l}${c}门限值`,defaultValue:x,min:p,max:f,step:h/5,className:"h-auto w-14 border-none bg-transparent p-0 text-center outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",style:zx,onKeyDown:C}),/*#__PURE__*/r("div",{className:"flex items-center",children:c})]}),/*#__PURE__*/r("div",{className:"absolute right-0 top-[-0.5px] z-[8] h-0 w-full border-b border-dashed",style:zk})]})})},zM=zS,zC=ri.Limit,zF=10,zD=({id:e})=>{let{state:{limit:t,segments:n,axisY:a,system:o},dispatch:i}=n9(),{show:l,active:s,disabled:c,value:d,onChange:p,unified:f}=t,[v,y]=a.range,{totalPoints:w}=n,x=m(()=>l&&s,[l,s]),[k,S]=b(0/0),M=g(null),C=g(!1),F=g(t);h(()=>{F.current=t},[t]);let D=u((e,t)=>{let r,n=f?[t]:((r=[...F.current.value])[e]=t,r);i({payload:{limit:{...F.current,value:n}}})},[i,f]),z=u(()=>{p(f?Array.from({length:n.length},()=>F.current.value[0]):F.current.value)},[p,f,n.length]);return(h(()=>{wB(e,zC,e=>{if(!x||c||!e?.left||!e?.top)return;let t=e.left,r=f?0:n.findIndex(e=>e.progress[0]<=t&&t<e.progress[1]);if(!Number.isFinite(r)||r<0){S(0/0),M.current=null,C.current=!1;return}let i=y-v;if(!Number.isFinite(i)||0===i)return;let l=rm(a.unit)?nb(0):0,s=F.current.value[r],u=(y-s-l)/i*100,d=Math.max(1.2,10/Math.max(1,o.height||1)*100);if(Math.abs(e.top-u)>d){S(0/0),M.current=null,C.current=!1;return}S(r),M.current=s,C.current=!0}),wY(e,zC,()=>{x&&!c&&(C.current&&z(),S(0/0),M.current=null,C.current=!1,w8(e,zC))}),wG(e,zC,()=>{x&&!c&&(C.current&&z(),S(0/0),M.current=null,C.current=!1,w8(e,zC))}),wK(e,zC,(t,r,n)=>{if(x&&!c&&tY(k)&&w3(e,zC)&&n?.top){let e=y-v;if(!Number.isFinite(e)||0===e)return;let t=(M.current??F.current.value[k])-n.top*e;M.current=t,D(k,t)}})},[x,c,k,n,e,D,z,f,v,y,a.unit,o.height]),x)?f?/*#__PURE__*/r(yn,{className:"z-[7]",children:/*#__PURE__*/r("div",{className:"h-full w-full",style:{opacity:+!!tY(d[0])},children:/*#__PURE__*/r(zS,{id:e,value:d[0],onChange:e=>D(0,e),dragging:tY(k)})})}):/*#__PURE__*/r(yn,{className:"z-[7]",children:n?.map((t,n)=>/*#__PURE__*/r("div",{style:{width:`${100*t.point/w}%`,opacity:+!!tY(d[n])},className:"h-full w-[30%]",children:/*#__PURE__*/r(zS,{id:e,value:d[n],onChange:e=>D(n,e),dragging:tY(k)},t.index)},t.index))}):null},zz=zD,zN=ri.Markers,zE=6,zT=8,zR=e=>{let{id:t,markers:r,display:n,fixed:a,readonly:o,onCreateMarker:i,onDeleteMarker:l,onUpdateMarker:s,onToggleSelect:c,onHover:d,onResetHover:p}=e,f=g({isDown:null,dragStart:null,isHover:"",hoverId:null}),m=u(()=>document.getElementById(w_(t))??document.getElementById(t),[t]),b=u(e=>{if(!e||!r||0===r.length)return null;let{left:t}=e;if(void 0===t)return null;let n=m();if(!n)return null;let{width:a}=n.getBoundingClientRect();for(let e=0;e<r.length;e+=1){let n=r[e];if(n&&Math.abs(t-n.left)*a/100<=6)return{...n,index:e}}return null},[m,r]),v=u(e=>{let t=m();if(!t)return"";let n=t.getBoundingClientRect().width,a="";for(let t=0;t<r.length;t+=1){let o=r[t];if(o&&Math.abs(e.left-o.left)*n/100<=8){a={...o,index:t};break}}return a},[m,r]);return h(()=>{if(o)return;let e=wH(t,zN,(e,t)=>{if(n&&void 0!==t.left){let e=v({left:t.left}),r="object"==typeof e?e.id:null;if(f.current.hoverId===r){f.current.isHover=e;return}f.current.isHover=e,f.current.hoverId=r,d({left:t.left})}}),r=wK(t,zN,(e,r)=>{let{isDown:o}=f.current;n&&o&&w3(t,zN)&&!a&&s(o.id,{left:r.left,top:r.top})}),u=wB(t,zN,e=>{if(!n)return;let t=b(e)||("object"==typeof f.current.isHover?f.current.isHover:null);t&&!a&&(f.current.isDown=t)}),h=wG(t,zN,()=>{n&&(f.current.isDown=null,w8(t,zN))}),m=wY(t,zN,()=>{if(!n)return;let e=null!==f.current.hoverId;f.current.isDown=null,f.current.isHover="",f.current.hoverId=null,w8(t,zN),e&&p()}),g=wQ(t,zN,(e,r)=>{if(!n||!w3(t,zN))return;let a=b(r)||("object"==typeof f.current.isHover?f.current.isHover:null);a?.id&&c(a.id)}),y=wW(t,zN,(e,r)=>{if(!n||!w3(t,zN)||void 0===r.left)return!1;let a=v({left:r.left});return a&&"object"==typeof a&&a.id?l(a.id):i({left:r.left}),!0});return()=>{e?.(),r?.(),u?.(),h?.(),m?.(),g?.(),y?.()}},[t,n,r,a,o,i,l,s,c,d,p,b,v]),{isDown:f.current.isDown}},zA=t0("marker"),zI=e=>C7(e);function zP(e,t,r){let{needsMaxPeak:n=!1,needsTopPeaks:a=!1}=r||{},o=null,i=null;try{let t=tO(e).getAllRawData()[t3];if(t?.peaks?.peaks&&Array.isArray(t.peaks.peaks)){let e=t.peaks.peaks;return n&&e.length>0&&(o=e[0]),a&&(i=e),{maxPeak:o,topPeaks:i}}}catch(e){console.warn("[useMarkers] Failed to get precomputed peaks:",e)}return n&&(o=Fu(t)),a&&(i=Fh(t,2)),{maxPeak:o,topPeaks:i}}let zL=e=>{let{id:t,globalID:r,onChange:n}=e,[a,o]=b({markers:[],colorIndex:0,isDown:null,isHover:"",peak:null,hasPeak:!1}),i=g(new Float32Array),l=u((e,t)=>{let{axisY:{unit:n},axisX:{frequencyFormat:a}}=C7(r),o=e.left,{peak:l}=e,s=t?.data??i.current;s&&0!==s.length||(s=tO(r).getAllRawData()[t3]),i.current=s;let c=Fc({left:o,globalID:r}),{outsideLeft:u,multiple:d}=c,{insideLeft:h}=c,p=s.length,f=Math.floor(p*h/100);if(100===h&&(f=p-1),"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank){let n=t?.topPeaks;n||(n=zP(r,s,{needsTopPeaks:!0}).topPeaks);let a=n?.[e.peakRank];a&&(h=((f=a.index)+.5)*100/p)}else if(l){let e=t?.maxPeak;e||(e=zP(r,s,{needsMaxPeak:!0}).maxPeak),e&&(h=((f=e.index)+.5)*100/p)}let m=parseFloat(a(o=u+h/d)),g=s[f];return void 0===g||Number.isNaN(g)||(e.level=parseFloat(nR(n,g).toFixed(1))),{...e,left:o,frequency:m}},[r]),s=u((e,t=!1)=>{0!==i.current.length&&o(a=>{let{marker:{maxCount:o,fifo:i}}=C7(r),s=Ft(a.markers,[e],o,i);if(!s.allowed)return a;let c=rK(),u=zA[a.colorIndex%20],d={...l({...e,id:c,color:u,select:!1,peak:!1,frequency:0,hover:!1}),id:c,color:u,select:!t,peak:!1,hover:!1},h=[...t?s.keptMarkers:s.keptMarkers.map(e=>({...e,select:!1})),d];return t||setTimeout(()=>{n?.(ro.Add,h)},0),{...a,markers:h,colorIndex:a.colorIndex+1}})},[l,n]),c=u(({event:e,marker:t,frequencies:a,silent:s=!1})=>{o(o=>{let c=[...o.markers],u=ro.Update,{id:d,peak:h,select:p,frequency:f,left:m,top:g}=t||{},b=m;if(e===ro.Update&&void 0!==f){let e=C7(r),t=(e?.segments||{totalPoints:0})[0];if(t&&d){let{start:e,stop:r}=t,n=r-e;if(void 0!==n&&f<r&&f>e)b=(f-e)*100/n;else{let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=ro.Del)}}}if(e===ro.Add&&a?.length){let e=C7(r),t=(e?.segments||{totalPoints:0})[0];if(t){let{start:e,stop:r}=t,n=r-e;if(void 0!==n){let t=[];for(let o=0;o<a.length;o+=1){let i=a[o];i>=e&&i<=r&&t.push((i-e)*100/n)}t.length>0&&(a=t)}}}if(e===ro.Add&&a?.length){let{marker:{maxCount:e,fifo:t}}=C7(r),n=Ft(c,a,e,t);if(n.allowed&&n.itemsToAdd.length>0){c=n.keptMarkers.map(e=>({...e,select:!1}));let e=n.itemsToAdd;for(let t=0;t<e.length;t+=1){let r=rK(),n=zA[(o.colorIndex+t)%20],a=!1;if(i.current&&i.current.length>0){let r=-1/0,n=0;for(let e=0;e<i.current.length;e++)i.current[e]>r&&(r=i.current[e],n=e);Math.abs(Math.floor(i.current.length*e[t]/100)-n)<=Math.max(1,Math.floor(.01*i.current.length))&&(a=!0)}let s=l({left:e[t],id:r,color:n,select:!1,peak:a,frequency:0,hover:!1});c.push({...s,id:r,color:n,select:t===e.length-1,peak:a,hover:!1})}u=ro.Add}}if(e===ro.Del){let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=ro.Del)}return e===ro.Clear&&(c=[],u=ro.Clear),e===ro.Update&&(u=ro.Update,c=c.map(e=>(void 0!==h&&(e.peak=!1),void 0!==p&&e.id!==d&&(e.select=!1),e.id===d&&(void 0!==b&&(e=l({...e,left:b,top:g||e.top})),void 0!==p&&(e.select=p),void 0!==h&&(e.peak=h,h&&void 0===p&&(e.select=!0))),e.peak,e))),s||setTimeout(()=>{n?.(u,c)},0),{...o,markers:c,colorIndex:e===ro.Clear?0:o.colorIndex}})},[l,n]),d=u(()=>{o(e=>({...e,markers:[],colorIndex:0})),setTimeout(()=>{n?.(ro.Clear,[])},0)},[n]),h=u(e=>{e&&(i.current=e),o(t=>{if(0===t.markers.length)return t;let a=t.markers.some(e=>e.peak&&"mainSecondary"!==e.peakTracking),o=t.markers.some(e=>"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank),s=e??i.current??new Float32Array,{maxPeak:c,topPeaks:u}=zP(r,s,{needsMaxPeak:a,needsTopPeaks:o}),d=t.markers.map(e=>l(e,{data:s,maxPeak:c,topPeaks:u}));return d.some((e,r)=>{let n=t.markers[r];return n&&(Math.abs(e.frequency-n.frequency)>.001||Math.abs(e.level-n.level)>.001)})&&setTimeout(()=>{n?.(ro.Update,d)},0),{...t,markers:d}})},[l,n]),p=u(e=>{let a=document.getElementById(t);if(!a)return"";let i=a.getBoundingClientRect(),{zoom:{interval:{start:l,end:s}},segments:c}=C7(r),u=c.totalPoints/(s-l+1),d=i.width*u/100,h="",p=!1;return o(t=>{let r=t.markers.map((t,r)=>{let n=Math.abs(e.left-t.left)*d<=16;return t.hover!==n&&(p=!0),n&&(h={...t,index:r}),{...t,hover:n}});return p&&setTimeout(()=>{n?.(ro.Update,r)},0),{...t,markers:r,isHover:h}}),h},[t,r,n]),f=u(()=>{o(e=>{let t=!1,r=e.markers.map(e=>(e.hover&&(t=!0),{...e,hover:!1}));return t&&setTimeout(()=>{n?.(ro.Update,r)},0),{...e,markers:r,isHover:""}})},[n]),m=g(null),v=g(null),y=u(()=>{o(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking),r=m.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return m.current=null,setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}}let{marker:t}=C7(r),a=t.maxCount,o=t.fifo,s=Ft(e.markers,[0,1],a,o);if(!s.allowed||s.itemsToAdd.length<2)return e;m.current=e.markers.find(e=>e.select)?.id??null;let c=[],u=e.colorIndex,d=e=>{let t=rK(),r=zA[u%20];u+=1;let n=l({left:50,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,frequency:0,hover:!1});c.push({...n,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,hover:!1})};d(0),d(1);let h=[...s.keptMarkers,...c.map(e=>({...e,select:!1}))].map(e=>l(e,{data:i.current}));return setTimeout(()=>{n?.(ro.Update,h)},0),{...e,markers:h,colorIndex:u}})},[l,r,n]),w=u(()=>{o(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking&&0===e.peakRank)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking||0!==e.peakRank),r=v.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return v.current=null,setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}}let{marker:t}=C7(r),a=t.maxCount,o=t.fifo,s=Ft(e.markers,[0],a,o);if(!s.allowed||s.itemsToAdd.length<1)return e;v.current=e.markers.find(e=>e.select)?.id??null;let c=rK(),u=zA[e.colorIndex%20],d={...l({left:50,id:c,color:u,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,frequency:0,hover:!1}),id:c,color:u,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,hover:!1},h=[...s.keptMarkers,d].map(e=>l(e,{data:i.current}));return setTimeout(()=>{n?.(ro.Update,h)},0),{...e,markers:h,colorIndex:e.colorIndex+1}})},[l,r,n]),x=u((e,t)=>{o(a=>{let o=a.markers.find(e=>e.id===t);if(!o)return a;let s=tO(r).getAllRawData()[t3];if(!s||s.length<3)return a;i.current=s;let{zoom:c,segments:u}=C7(r),d=s.length,h=u.totalPoints||d,p=c.interval.end-c.interval.start+1,f=(o.left*h/100-c.interval.start)*100/p,m=Math.floor(d*f/100);100===f&&(m=d-1);let g=-1;if(s.peaks?.peaks&&Array.isArray(s.peaks.peaks)){let t=s.peaks.peaks;if("left"===e){let e=1/0;for(let r of t)if(r.index<m){let t=m-r.index;t<e&&(e=t,g=r.index)}}else{let e=1/0;for(let r of t)if(r.index>m){let t=r.index-m;t<e&&(e=t,g=r.index)}}}if(-1===g){let t=e=>{if(e<=0||e>=d-1)return!1;let t=s[e];return t>s[e-1]&&t>s[e+1]};if("left"===e){for(let e=m-1;e>0;e-=1)if(t(e)){g=e;break}}else for(let e=m+1;e<d-1;e+=1)if(t(e)){g=e;break}}if(-1===g)return a;let b=((g+.5)*100/d*p/100+c.interval.start)*(100/h),v=a.markers.map(e=>{if(e.id!==t)return{...e,select:!1};let{peakTracking:r,peakRank:n,...a}=e;return l({...a,left:b,select:!0,peak:!1},{data:s})});return setTimeout(()=>{n?.(ro.Update,v)},0),{...a,markers:v}})},[l,r,n]),k=u(e=>{o(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=tO(r).getAllRawData()[t3];if(!a||a.length<1)return t;i.current=a;let{zoom:o,segments:s}=C7(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=(100*d/(c-1)*(o.interval.end-o.interval.start+1)/100+o.interval.start)*(100/u),f=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...o}=t;return l({...o,left:p,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(ro.Update,f)},0),{...t,markers:f}})},[l,r,n]),S=u(e=>{o(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=tO(r).getAllRawData()[t3];if(!a||a.length<3)return t;i.current=a;let{zoom:o,segments:s}=C7(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=Math.max(2,Math.floor(.1*c)),f=-1,m=-1/0;for(let e=1;e<c-1;e+=1){if(Math.abs(e-d)<p)continue;let t=a[e],r=a[e-1],n=a[e+1];t>r&&t>n&&t>m&&(m=t,f=e)}if(-1===f)return t;let g=(100*f/(c-1)*(o.interval.end-o.interval.start+1)/100+o.interval.start)*(100/u),b=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...o}=t;return l({...o,left:g,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(ro.Update,b)},0),{...t,markers:b}})},[l,r,n]),M=u((e,t)=>{o(a=>{let o,s=a.markers.find(e=>e.id===t);if(!s)return a;let c=tO(r).getAllRawData()[t3];if(!c||c.length<2)return a;i.current=c;let{zoom:u,segments:d}=C7(r),h=c.length,p=d.totalPoints||h,f=u.interval.end-u.interval.start+1,m=Math.round((h-1)*((s.left*p/100-u.interval.start)*100/f)/100);if((o="left"===e?Math.max(0,m-1):Math.min(h-1,m+1))===m)return a;let g=(100*o/(h-1)*f/100+u.interval.start)*(100/p),b=a.markers.map(e=>{if(e.id!==t)return{...e,select:!1};let{peakTracking:r,peakRank:n,...a}=e;return l({...a,left:g,select:!0,peak:!1},{data:c})});return setTimeout(()=>{n?.(ro.Update,b)},0),{...a,markers:b}})},[l,r,n]),C="#F98116",F="#AA74E8",D=u(()=>{o(e=>{let t,a=tO(r).getAllRawData()[t3];if(!a||a.length<1)return e;i.current=a;let{zoom:o,segments:s}=C7(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=(100*d/(c-1)*(o.interval.end-o.interval.start+1)/100+o.interval.start)*(100/u),f=e.markers.find(e=>e.color===C);if(f)t=e.markers.map(e=>e.id===f.id?l({...e,left:p},{data:a}):e);else{let{marker:n}=C7(r),o=n.maxCount,i=n.fifo,s=Ft(e.markers,[p],o,i);if(!s.allowed)return e;let c=l({left:p,id:rK(),color:C,select:!1,peak:!1,hover:!1},{data:a});t=[...s.keptMarkers,c]}return setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}})},[l,r,n]),z=u(()=>{o(e=>{let t,a=tO(r).getAllRawData()[t3];if(!a||a.length<3)return e;i.current=a;let{zoom:o,segments:s}=C7(r),c=a.length,u=s.totalPoints||c,d=0,h=a[0];for(let e=1;e<c;e+=1)a[e]>h&&(h=a[e],d=e);let p=Math.max(2,Math.floor(.1*c)),f=-1,m=-1/0;for(let e=1;e<c-1;e+=1){if(Math.abs(e-d)<p)continue;let t=a[e],r=a[e-1],n=a[e+1];t>r&&t>n&&t>m&&(m=t,f=e)}if(-1===f)return e;let g=(100*f/(c-1)*(o.interval.end-o.interval.start+1)/100+o.interval.start)*(100/u),b=e.markers.find(e=>e.color===F);if(b)t=e.markers.map(e=>e.id===b.id?l({...e,left:g},{data:a}):e);else{let{marker:n}=C7(r),o=n.maxCount,i=n.fifo,s=Ft(e.markers,[g],o,i);if(!s.allowed)return e;let c=l({left:g,id:rK(),color:F,select:!1,peak:!1,hover:!1},{data:a});t=[...s.keptMarkers,c]}return setTimeout(()=>{n?.(ro.Update,t)},0),{...e,markers:t}})},[l,r,n]);return{markers:a.markers,isDown:a.isDown,isHover:a.isHover,createMarker:s,updateMarkerAttribute:c,resetMarkers:d,updateByData:h,handleHover:p,resetHover:f,toggleMainSecondaryPeaks:y,toggleMainPeak:w,moveToAdjacentPeak:x,findMainPeak:k,findSecondaryPeak:S,moveToStep:M,createMainPeakMarker:D,createSecondaryPeakMarker:z,setState:o}},zO=e=>{let{top:a,left:o,color:i="transparent",x:l=!0,y:s=!0,lineWidth:c=1}=e;return /*#__PURE__*/n(t,{children:[l&&/*#__PURE__*/r("div",{className:"absolute left-0 top-[-200%] z-[5] w-full border-t border-dashed",style:{top:a,borderColor:i,borderTopWidth:`${c}px`}}),s&&/*#__PURE__*/r("div",{className:"absolute left-[-200%] top-0 z-[5] h-full border-l border-dashed",style:{left:o,borderColor:i,borderLeftWidth:`${c}px`}})]})},zq=zO,z$=({marker:e})=>{let{state:{axisX:t,axisY:a}}=n9(),o=g(null),i=g(null),[l,s]=b(0),[c,u]=b(0);h(()=>{let e=()=>{o.current&&s(o.current.offsetWidth),i.current&&u(i.current.offsetWidth)};e();let t=new ResizeObserver(()=>{e()});return o.current&&t.observe(o.current),i.current&&t.observe(i.current),()=>{t.disconnect()}},[e.frequency,e.level]);let d=m(()=>{let t=e.left/100*l,r=l>0&&c>0&&t+c+10>l-20;return{left:`${e.left}%`,color:e.color,opacity:e.hover?1:.68,fontWeight:e.hover?500:"normal",transform:r?"translateX(-100%)":"translateX(0)",marginLeft:r?"-10px":"10px"}},[e.left,e.hover,e.color,l,c]);return /*#__PURE__*/n("div",{ref:o,className:"absolute left-0 top-0 h-full w-full",id:e.id,title:`${e.frequency}${t.unit} / ${e.level}${a.unit}`,children:[/*#__PURE__*/n("div",{ref:i,className:"absolute top-[10px] z-[5] whitespace-nowrap text-[12px] leading-4 transition-[opacity,font-weight,transform,margin-left,color]",style:d,children:[/*#__PURE__*/n("div",{children:[e.frequency,t.unit]}),void 0!==e.level&&/*#__PURE__*/n("div",{children:[e.level,a.unit]})]}),/*#__PURE__*/r(zO,{x:!1,left:`${e.left}%`,top:`${e.top}%`,color:e.color,lineWidth:e.select?2:1})]},e.id)},z_=/*#__PURE__*/a.memo(z$),zj=({id:e})=>{let{state:{marker:t,globalID:n}}=n9(),{enabled:a,visible:o,fixed:i,readonly:l,maxCount:s,onChange:c}=t,d=u((e,t)=>{c?.(e,t),Fa(n)({count:t.length,maxCount:s});let r=t.find(e=>e.select)?.id??null;Fo(n)({selectedId:r})},[c,n,s]),p=m(()=>a&&o,[a,o,t.enabled,t.visible]),f=m(()=>w_(e),[e]),{markers:b,createMarker:v,updateMarkerAttribute:y,resetMarkers:w,updateByData:x,handleHover:k,resetHover:S,toggleMainSecondaryPeaks:M,toggleMainPeak:C,moveToAdjacentPeak:F,findMainPeak:D,findSecondaryPeak:z,createMainPeakMarker:N,createSecondaryPeakMarker:E}=zL({id:e,globalID:n,display:o,onChange:d});h(()=>{if(!n||!f||!p||l)return;let e=nA(n,f,e=>{let t=e.key.toLowerCase();if(!["a","d","w","s"].includes(t))return;if("w"===t){if(e.repeat)return;e.preventDefault(),N();return}if("s"===t){if(e.repeat)return;e.preventDefault(),E();return}let r=b.find(e=>e.select)?.id;r&&(e.preventDefault(),F("a"===t?"left":"right",r))});return()=>{e?.()}},[f,n,b,F,p,l,N,E]);let T=u(e=>{let t=b.find(t=>t.id===e),r=!t?.select;y({event:ro.Update,marker:{id:e,select:r}})},[b,y]),R=u((e,t)=>{y({event:ro.Update,marker:{id:e,left:t.left,top:t.top}})},[y]);zR({id:e,markers:b,display:p,fixed:i,readonly:l,onCreateMarker:v,onDeleteMarker:u(e=>{y({event:ro.Del,marker:{id:e}})},[y]),onUpdateMarker:R,onToggleSelect:T,onHover:k,onResetHover:S});let A=g(null);return(h(()=>{n&&e&&tq(e,"Marker",()=>{let{realData:e}=tO(n).getAllRawData();A.current=e??null,x(e)})},[n,e,x]),h(()=>{n&&e&&Fr(n,e=>{y(e)})},[n,e,y,w]),h(()=>{n&&e&&Fi(n,e=>{if(e?.type){if("main-secondary-peaks"===e.type)return void M();if("main-peak"===e.type)return void C();if("left-peak"===e.type)return void F("left",e.selectedId);if("right-peak"===e.type)return void F("right",e.selectedId);if("find-main-peak"===e.type)return void D(e.selectedId);if("find-secondary-peak"===e.type)return void z(e.selectedId);if("create-main-peak"===e.type)return void N();if("create-secondary-peak"===e.type)return void E();if("clear-all"===e.type)return void w()}})},[n,e,F,M,C,D,z,N,E,w]),p)?/*#__PURE__*/r(yn,{className:"z-[5]",children:b.map(e=>/*#__PURE__*/r(z_,{marker:e},e.id))}):null},zH=zj,zB=({segments:e,index:t,frequency:r,bandwidth:n})=>{if(!r||!n||!e||!e[t])return{left:0,width:0};let a=e[t],o=e.reduce((e,t)=>e+t.point,0),{left:i,width:l}=rI({startFreq:r-n/2e3,stopFreq:r+n/2e3},a),s=e.slice(0,t).reduce((e,t)=>e+t.point/o*100,0),c=a.point/o*100;return{left:s+i/100*c,width:l/100*c}};function zW(){let{state:{scope:e,segments:t},dispatch:r}=n9();return u(n=>{let{frequency:a,bandwidth:o,index:i=0}=n,{left:l,width:s}=zB({segments:t,index:i,frequency:a,bandwidth:o});r({payload:{scope:{...e,left:l,width:s}}})},[t,e])}let zG=()=>{let{state:{scope:{show:e,left:t,width:n}}}=n9();return e?/*#__PURE__*/r(yn,{children:/*#__PURE__*/r("div",{className:"relative flex h-full w-0 box-border border-y border-dashed border-chart-grid bg-chart-surface opacity-50",style:{width:`${n}%`,left:`${t}%`}})}):null},zY=zG,zU=/*#__PURE__*/c(({style:e,signalPositions:t,activeSignalKey:n,segmentIndex:a})=>/*#__PURE__*/r("div",{className:"absolute h-full box-border",style:e,children:t.map(({item:e,key:t,position:o,color:i,tooltip:l})=>{let s=n===t,c={left:o.left,width:o.width,minWidth:"1px",backgroundColor:i,height:s?"100%":"8px",opacity:s?.5:1};return /*#__PURE__*/r("div",{className:"pointer-events-none absolute top-0 flex min-w-px items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap text-center text-xs text-foreground","data-signal-active":s?"true":"false","data-signal-key":t,"data-signal-source":kN(e),"data-testid":"signal-annotation",style:c,title:l},`segment-${a}-signal-${t}`)})})),zX=zU;function zK(){let{state:e,dispatch:t}=n9(),r=g(e.globalID),n=g(e.signal),a=g({});return h(()=>{r.current=e.globalID,n.current=e.signal},[e.globalID,e.signal]),h(()=>{if(!e.globalID)return;let r=a.current.station,o=a.current.simple;void 0!==r&&(k6(e.globalID,r),a.current.station=void 0),void 0!==o&&(t({payload:{signal:{...n.current,data:o}}}),a.current.simple=void 0)},[t,e.globalID]),{updateSignalData:u(e=>{let{type:o,data:i}=e;if(Array.isArray(i)){if("station"===o){if(!r.current){a.current.station=i;return}k6(r.current,i)}else if("simple"===o){if(!r.current){a.current.simple=i;return}t({payload:{signal:{...n.current,data:i}}})}}},[t])}}let zV=({id:e,show:t=!0,display:n=!0})=>{let a=n7(e=>e.segments),o=n7(e=>e.zoom.style),i=n7(e=>e.signal),l=xr(e),s=l?.coord.left,c=k8({respectVisibility:!0}),u=i.show&&i.display&&n,d=!!l,h=m(()=>d&&"number"==typeof s?rP(s,a):{segmentIndex:-1,pointIndex:-1},[d,a,s]),p=m(()=>d?rL(a,h):0/0,[h,d,a]),f=m(()=>kQ({segments:a,signalItems:c}),[a,c]),g=m(()=>kZ({segmentData:f,isCursorActive:d,currentFrequency:p,currentPosition:h}),[p,h,d,f]);return t&&u?/*#__PURE__*/r("div",{className:"pointer-events-none absolute inset-0 z-[4] flex h-full w-full select-none items-center overflow-hidden bg-transparent",children:/*#__PURE__*/r("div",{className:"absolute right-0 top-0 flex h-full w-full",style:o??void 0,children:f.map(({segmentIndex:e,signalPositions:t,style:n})=>/*#__PURE__*/r(zU,{style:n,signalPositions:t,activeSignalKey:h.segmentIndex===e?g:void 0,segmentIndex:e},`segment-${e}`))})}):null},zQ=zV,zZ=()=>{let{state:{stripe:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{stripe:{...e,display:!!r}}})},[e]);return n?/*#__PURE__*/_jsx(IconBox,{active:r,tone:"primary",onClick:()=>{a(!r)},title:"频谱框选",children:/*#__PURE__*/_jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/_jsx("path",{d:"M835.4 757.7h-69.9v-51h18.9v-18.8h51zM713.1 757.7h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0H220v-51h83.9v51zM167.5 757.7H97.6v-69.8h51v18.8h18.9zM148.6 637.5h-51V557h51v80.5z m0-130.7h-51v-80.5h51v80.5z m0-130.8h-51v-80.5h51V376zM148.6 245.2h-51v-69.9h69.9v51h-18.9zM713.1 226.3h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0h-83.9v-51h83.9v51z m-136.4 0H220v-51h83.9v51zM835.4 245.2h-51v-18.9h-18.9v-51h69.9zM835.4 637.5h-51V557h51v80.5z m0-130.7h-51v-80.5h51v80.5z m0-130.8h-51v-80.5h51V376z",fill:"currentColor"}),/*#__PURE__*/_jsx("path",{d:"M784.4 615.7h51v233h-51z",fill:"currentColor"}),/*#__PURE__*/_jsx("path",{d:"M693.4 706.7h233v51h-233z",fill:"currentColor"})]})}):null},zJ=null,z0=ri.Stripe,z1=1.5,z2=e=>Math.max(0,Math.min(100,e)),z5=({cursor:e,left:t,right:r})=>{let n=Math.abs(e-t),a=Math.abs(e-r);return n<=1.5?"left":a<=1.5?"right":e>t&&e<r?"move":n<=a?"left":"right"},z4=({id:e})=>{let{state:{stripe:t,axisX:{frequencyFormat:n,unit:a}},dispatch:o}=n9(),{show:i,display:l,left:s,right:c,defaultLeft:d,defaultRight:p,onChange:f}=t,m=g(t),b=g(null),v=g(n),y=g(a),w=g(f);h(()=>{m.current=t,v.current=n,y.current=a,w.current=f},[t,n,a,f]),h(()=>{o({payload:{stripe:{...t,left:d,right:p}}})},[d,p]);let x=u(e=>{let t=b.current;if(!t||!Number.isFinite(e?.left))return;let r=z2(e.left),n=m.current,{mode:a,startCursor:i,startLeft:l,startRight:s}=t,c=l,u=s;if("move"===a){let e=s-l;(u=(c=z2(l+(r-i)))+e)>100&&(c=Math.max(0,(u=100)-e))}"left"===a&&(c=Math.min(r,s)),"right"===a&&(u=Math.max(r,l)),o({payload:{stripe:{...n,left:c,right:u}}})},[o]),k=u(()=>{let{left:e,right:t}=m.current,r=Math.round(10*e)/10,n=Math.round(10*t)/10,a=v.current?.(r)??"",o=v.current?.(n)??"",i=n-r,l=Number(o)-Number(a);w.current({left:r,right:n,width:i,start:a,end:o,bandwidth:l,unit:y.current})},[]);return(h(()=>{wB(e,z0,t=>{if(!i||!l||!Number.isFinite(t?.left))return;let r=m.current,n=z2(t.left);b.current={mode:z5({cursor:n,left:r.left,right:r.right}),startCursor:n,startLeft:r.left,startRight:r.right},w3(e,z0)}),wG(e,z0,()=>{i&&l&&b.current&&(b.current=null,w8(e,z0),k())}),wY(e,z0,()=>{i&&l&&b.current&&(b.current=null,w8(e,z0),k())}),wH(e,z0,(e,t)=>{i&&l&&b.current&&x(t)})},[e,i,l,x,k]),i&&s-c!=0&&l)?/*#__PURE__*/r(yn,{className:"z-[3]",children:/*#__PURE__*/r("div",{className:"relative flex h-full w-px box-border border-x-2 border-dashed border-y-0 border-chart-grid-strong bg-chart-surface opacity-40",style:{left:`${s}%`,width:`${c-s}%`}})}):null},z3=z4;function z6(){let{dispatch:e,store:t}=ae();return u(r=>{let n=t.getState().band,a=r6(r,n,"replace");a!==n&&e({payload:{band:a}})},[e,t])}let z8=()=>{let e=n7(e=>e.band),t=n7(e=>e.segments),n=m(()=>kc(e,t),[e,t]);return n.length?/*#__PURE__*/r(yn,{children:n.map(t=>/*#__PURE__*/r("div",{"data-testid":"spectrum-band","data-band-kind":e.kind,"data-band-key":t.key,className:"absolute flex h-full w-0 box-border border-y border-dashed opacity-50",style:{left:`${t.left}%`,width:`${t.width}%`,backgroundColor:e.color?`${e.color}40`:void 0,borderColor:e.color}},t.key))}):null},z9=z8,z7=10,Ne=300,Nt=300,Nr=30,Nn=60,Na=()=>({mode:"idle",startX:0,startY:0,startTime:0,lastX:0,lastY:0,startCoord:null,pinchBase:null}),No=(e,t,r)=>Math.max(t,Math.min(e,r)),Ni=({id:e})=>{let{state:{zoom:t,segments:n,axisY:a,globalID:o},dispatch:i}=n9(),l=w_(e),s=g(null),c=g(Na()),d=g(t),p=g(n.totalPoints),f=g(a),m=g(null);h(()=>{d.current=t},[t]),h(()=>{p.current=n.totalPoints},[n]),h(()=>{f.current=a},[a]);let b=u((e,t,r)=>({currentTarget:e,clientX:t,clientY:r}),[]),v=u(e=>{let t=Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY})),r=t.length,n=0,a=0,o=0;if(2===r){let[e,r]=t;n=Math.hypot(r.x-e.x,r.y-e.y),a=(e.x+r.x)/2,o=(e.y+r.y)/2}else 1===r&&(a=t[0].x,o=t[0].y);return{count:r,points:t,distance:n,midX:a,midY:o}},[]),y=u((e,t,r)=>{let n=b(e,t,r),a=w$(n);wU(l)(),wH(l)(n,a)},[l,b]),w=u(e=>{let t=c.current.pinchBase,r=p.current;if(!t||t.distance<=0||e<=0)return;let n=e/t.distance;if(("x"===t.axisMode||"xy"===t.axisMode)&&d.current.show&&r){let e=ST({anchorPercent:t.anchorPercent,interval:t.interval,scale:1/n,totalPoints:r});i({payload:t=>t.zoom.interval.start===e.start&&t.zoom.interval.end===e.end?null:{zoom:{...t.zoom,interval:e,isScanSegmentsUpdateMagnify:!1}}})}("y"===t.axisMode||"xy"===t.axisMode)&&o&&(nj(o)(t.lastScale/n,t.yAnchorValue),t.lastScale=n)},[i,o]),x=g(w);x.current=w;let k=u(e=>{let t=s.current,r=c.current;if(t&&0!==e.touches.length){if(1===e.touches.length){let{clientX:n,clientY:a}=e.touches[0];r.mode="pending",r.startX=n,r.startY=a,r.startTime=Date.now(),r.lastX=n,r.lastY=a,r.startCoord=w$(b(t,n,a));return}if(2===e.touches.length){m.current?.flush(),r.mode="pinch",r.startTime=Date.now();let n=d.current,a=v(e),[o,i]=a.points,l=Math.abs(i.x-o.x),s=180*Math.atan2(Math.abs(i.y-o.y),l)/Math.PI,{start:c,end:u}=n.interval,h=w$(b(t,a.midX,a.midY)).left??0,p=t.getBoundingClientRect();if(p.height<=0||a.distance<=0){r.pinchBase=null;return}let[g,y]=f.current.realRange??[0,1],w=No((a.midY-p.top)/p.height,0,1);r.pinchBase={distance:a.distance,lastScale:1,interval:{start:c,end:u},anchorPercent:No(h,0,100),axisMode:s<30?"x":s>60?"y":"xy",yAnchorValue:y-w*(y-g),startPoints:a.points,pinchMoved:!1}}}},[v,b]),S=g(rB(e=>{if(!e||!("count"in e))return;let t=s.current,r=c.current;if(!t)return;let{count:n,points:a,distance:o}=e;if(2===n){if("pinch"===r.mode&&r.pinchBase){let e=r.pinchBase;if(!e.pinchMoved){let t={x:(a[0].x+a[1].x)/2,y:(a[0].y+a[1].y)/2},r={x:(e.startPoints[0].x+e.startPoints[1].x)/2,y:(e.startPoints[0].y+e.startPoints[1].y)/2};(Math.abs(o-e.distance)>10||Math.hypot(t.x-r.x,t.y-r.y)>10)&&(e.pinchMoved=!0)}x.current(o)}return}if(1!==n)return;let i=a[0];if("pending"===r.mode){let e=i.x-r.startX,t=i.y-r.startY;if(e*e+t*t<=100)return;r.mode="drag"}if("drag"!==r.mode)return;let u=t.getBoundingClientRect(),d={left:(i.x-r.lastX)/u.width,top:(i.y-r.lastY)/u.height},h=b(t,i.x,i.y),p=w$(h);wH(l)(h,p),wK(l)(r.startCoord,p,d,!1),r.lastX=i.x,r.lastY=i.y})).current;m.current=S;let M=u(e=>{S(v(e))},[v,S]),C=u(e=>{S.flush();let t=s.current,r=c.current;if(!t)return;let n=e.changedTouches[0],a=n?.clientX??r.lastX,o=n?.clientY??r.lastY;if("pending"===r.mode){let e=Date.now()-r.startTime,n=a-r.startX,i=o-r.startY;n*n+i*i<=100&&e<=300&&y(t,a,o)}if(1===e.touches.length){let n=e.touches[0],a="pinch"===r.mode&&null!==r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=300;r.mode=a?"pinch":"drag",r.startX=n.clientX,r.startY=n.clientY,r.lastX=n.clientX,r.lastY=n.clientY,a||(r.pinchBase=null),r.startCoord=w$(b(t,n.clientX,n.clientY))}else 0===e.touches.length&&("pinch"===r.mode&&r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=300&&wY(l)(),r.mode="idle",r.pinchBase=null,wG(l)())},[l,y,b,S]),F=u(()=>{S.cancel();let e=c.current;e.mode="idle",e.pinchBase=null,wY(l)()},[l,S]),D=u(e=>{e.preventDefault()},[]);return h(()=>()=>{S.cancel(),wY(l)()},[l,S]),h(()=>{s.current&&(s.current.id=l)},[l]),/*#__PURE__*/r(yn,{className:"z-[5] pointer-events-auto",children:/*#__PURE__*/r("button",{ref:s,type:"button",className:oW("absolute right-0 top-0 h-full w-full appearance-none border-0 bg-transparent p-0 outline-none","touch-none select-none"),"aria-label":"Touch bus",onContextMenu:D,onTouchStart:k,onTouchMove:M,onTouchEnd:C,onTouchCancel:F})})},Nl=Ni,Ns=e=>{let{children:t,touch:a}=e,{state:{axisY:{autoranging:o},series:{enableLengthSyncFastMode:i},globalID:l}}=n9(),{id:s,chart:c,Chart:u}=oY({Render:Ck,params:{autoranging:o,enableLengthSyncFastMode:i}});SP(s,rt.Spectrum);let d=z6(),p=zW(),f=wb();return h(()=>{if(l&&c)return t$(l,e=>{c?.setDisabledClearRect(e)})},[l,c]),o1({moduleType:rt.Spectrum,chart:c,handleRender:(e,t)=>{t.updateSeries?.({data:e.data,extraData:e.extraData}),tq(s)()},eventHandlers:{autoranging:(e,t)=>{t.useRangeAutoFocus?.()},points:e=>{f(e.data)},[rr.Series]:(e,t)=>{t.setSeries?.(e)},band:e=>{d(e)},scope:e=>{p(e)}}}),/*#__PURE__*/n(yF,{children:[/*#__PURE__*/r(Dh,{chart:c}),/*#__PURE__*/n(SD,{children:[/*#__PURE__*/r(Cx,{}),/*#__PURE__*/r(u,{}),t,/*#__PURE__*/r(zm,{id:s}),/*#__PURE__*/r(zj,{id:s}),a?/*#__PURE__*/r(Ni,{id:s}):/*#__PURE__*/r(Sk,{id:s}),/*#__PURE__*/r(zD,{id:s}),/*#__PURE__*/r(Sv,{id:s,type:rt.Spectrum}),/*#__PURE__*/r(zV,{id:s}),/*#__PURE__*/r(DD,{id:s}),/*#__PURE__*/r(z8,{}),/*#__PURE__*/r(zG,{}),/*#__PURE__*/r(z4,{id:s}),/*#__PURE__*/r(zw,{id:s}),/*#__PURE__*/r(zd,{}),/*#__PURE__*/r(Dx,{})]})]})},Nc=Ns,Nu=e=>{let{state:{cursor:t},dispatch:a}=n9(),{publish:o}=e,{analyzer:i}=F6();return al({publish:o,subscribe:e=>{let{pstype:t}=e;t===rr.Reset&&i?.reset(),t===rr.LevelStream&&i?.process(e.data,rX(e.timestamp))}}),h(()=>{t.mode!==rt.LevelStream&&a({payload:{cursor:{...t,mode:rt.LevelStream}}})},[t,a]),/*#__PURE__*/n(ap,{children:[/*#__PURE__*/r(F3,{type:re.LevelStream}),/*#__PURE__*/r(yF,{children:/*#__PURE__*/r(Ns,{children:/*#__PURE__*/r(SD,{children:/*#__PURE__*/r(F9,{opacity:.5})})})})]})},Nd=Nu,Nh=e=>/*#__PURE__*/r(ar,{...e,cursor:{show:!0},zoom:{show:!1},signal:{show:!1},children:/*#__PURE__*/r(Nu,{...e})}),Np=tB(Nh,"LevelStream"),Nf=Np,Nm=["100%","75%","50%","25%","0%"],Ng=e=>{let{inside:t=!1}=e;return /*#__PURE__*/r("div",{className:"pointer-events-none relative z-[2] flex h-full w-full flex-col justify-between text-xs text-foreground opacity-50",style:{alignItems:t?"flex-start":"flex-end"},children:Nm.map(e=>/*#__PURE__*/r("div",{className:oW("flex justify-start box-border",t?"pl-0.5 pr-0":"pr-0.5"),children:e},e))})},Nb=Ng,Nv=e=>{let{inside:t=!1}=e,{axisYWidth:n,marginLeft:a}=yt();return /*#__PURE__*/r("div",{className:"relative flex h-full w-auto",style:{width:n,marginLeft:a,justifyContent:t?"flex-start":"flex-end"},children:/*#__PURE__*/r(Ng,{inside:t})})},Ny=/*#__PURE__*/a.memo(Nv),Nw=e=>{let{disabled:t,inside:n}=e,{state:{axisY:a}}=n9(),{show:o}=a;return!1===o||t?null:/*#__PURE__*/r(Ny,{inside:n})},Nx=Nw,Nk=()=>/*#__PURE__*/r("div",{className:"h-0 w-full flex-1 border-t [border-color:var(--chart-grid)] first:border-t-0"}),NS=()=>{let{state:{gridLines:e}}=n9();return e&&/*#__PURE__*/n("div",{className:"pointer-events-none absolute right-0 top-0 z-[1] flex h-full w-full select-none flex-col border [border-color:var(--chart-grid)] bg-transparent",children:[/*#__PURE__*/r(Nk,{}),/*#__PURE__*/r(Nk,{}),/*#__PURE__*/r(Nk,{}),/*#__PURE__*/r(Nk,{})]})},NM=NS,NC=-200,NF=e=>`occupancy-total-line-${e}`,ND=(e,t,r=0)=>{e&&t&&(e.style.bottom=`${r||-200}%`,t.textContent=String(r))},Nz=(e,t,r)=>tC(NF(e),t,r,e),NN=(e,t=0)=>{Nz(e)(t)},NE=({id:e})=>{let t=g(null),a=g(null),o=g(`OccupancyTotalLine-${Math.random().toString(36).slice(2)}`);return h(()=>(ND(t.current,a.current),Nz(e,o.current,e=>{ND(t.current,a.current,e)})),[e]),/*#__PURE__*/r("div",{className:"pointer-events-none absolute z-[4] h-full w-full",children:/*#__PURE__*/n("div",{ref:t,className:"absolute left-0 w-full opacity-50",style:{bottom:"-200%"},children:[/*#__PURE__*/r("div",{className:"absolute h-0 w-full border-b border-dashed border-foreground/80",style:{marginTop:"-0.5px"}}),/*#__PURE__*/r("div",{ref:a,className:"absolute right-7 -mt-7 flex h-6 items-center justify-center rounded-[var(--radius-control)] bg-secondary px-2 text-xs text-foreground",children:"0"})]})})},NT=NE,NR=e=>{let{occupancyAxisYDisabled:t}=e,{id:a,chart:o,Chart:i}=oY({Render:F8});return(o1({moduleType:rt.Occupancy,chart:o,handleRender:(e,t)=>{let{data:r,totalOccupancy:n}=e;r&&t.updateSeries?.(r),void 0!==n&&NN(a,n)},eventHandlers:{[rr.Reset]:(e,t)=>{t.reset(),NN(a)}}}),SP(a,rt.Occupancy),t)?/*#__PURE__*/r("div",{className:"h-full w-full",style:{...eA},[ez]:"true",children:/*#__PURE__*/n("div",{className:"relative z-[0] h-full w-full",children:[/*#__PURE__*/r(i,{}),/*#__PURE__*/r(Sk,{id:a}),/*#__PURE__*/r(NE,{id:a})]})}):/*#__PURE__*/n(yF,{children:[/*#__PURE__*/r(Nw,{disabled:t}),/*#__PURE__*/n(SD,{children:[/*#__PURE__*/r(NS,{}),/*#__PURE__*/r(i,{}),/*#__PURE__*/r(Sk,{id:a}),/*#__PURE__*/r(NE,{id:a}),/*#__PURE__*/r(Sv,{id:a,type:rt.Occupancy})]})]})},NA=NR,NI=e=>{let{publish:t}=e,{state:{globalID:a}}=n9(),o=ww(re.Scan);return al({publish:t,subscribe:e=>{o(e),e.pstype===rr.Occupancy&&(e.data&&(tO(a).getAllRawData=t=>({...tL().getAllRawData(t),occupancyData:e.data})),((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Occupancy)({...e,pstype:rr.Render}))}}),/*#__PURE__*/n(ap,{children:[/*#__PURE__*/r(yF,{children:/*#__PURE__*/r(NR,{})}),/*#__PURE__*/r(yC,{type:re.Scan})]})},NP=NI,NL=e=>/*#__PURE__*/r(ar,{...e,zoom:{show:!1},children:/*#__PURE__*/r(NI,{...e})}),NO=tB(NL,"Occupancy"),Nq=NO,N$=()=>{let e=at(),t=n7(e=>e.zoom),r=n7(e=>e.segments.totalPoints)??0,n=n7(e=>e.axisX.frequencyFormat),{interval:{start:a,end:o},onChange:i}=t,l=m(()=>r&&n?[n((100*a+1)/r),n((100*o+1)/r)]:["",""],[a,o,r,n]);return h(()=>{r&&void 0!==l[0]&&void 0!==l[1]&&i(l,{start:a,end:o})},[l,i,r]),h(()=>{if(!r)return;let t=o-a+1,n=r/t,i=`-${a/t*100}%`,l=`${100*n}%`;e({payload:e=>({zoom:{...e.zoom,style:{left:i,width:l}}})})},[e,o,a,r]),null},N_=N$;class Nj extends v_{constructor(e){super({id:e.id,globalID:e.globalID,chart:null,renderer:e.renderer,renderMode:e.renderMode})}init(){let{id:e,renderer:t,renderMode:r}=this.state;e&&(this.state.chart=new x({id:e,colors:this.getInitialColors(),ignoreValue:0,renderer:t,fluorescenceRenderMode:r}),this.subscribeToColor("Fluorescence-Render"))}updateProps(e){void 0!==e.renderMode&&(this.state.renderMode=e.renderMode),this.state.chart?.updateProps(e)}updateSeries(e){this.state.chart&&e&&this.state.chart.render(e)}setRenderMode(e){this.state.renderMode=e,this.state.chart?.setRenderMode(e)}}let NH=()=>{let{state:{axisY:{range:e},fluorescence:{display:t,renderer:n,renderMode:a}}}=n9(),{chart:o,Chart:i}=oY({Render:Nj,params:{renderer:n,renderMode:a}});h(()=>{o?.updateProps({range:e})},[o,e]),h(()=>{o&&o.setRenderMode(a)},[a]),o1({moduleType:rt.Fluorescence,chart:o,renderPSTypes:[rr.Fluorescence],extractData:e=>e.data});let l=m(()=>({height:"100%",width:"100%",display:"flex",visibility:t?"visible":"hidden"}),[t]);return h(()=>{o&&o.updateProps({display:t})},[o,t]),/*#__PURE__*/r("div",{style:l,children:/*#__PURE__*/r(yF,{children:/*#__PURE__*/r(i,{})})})},NB=NH,NW=e=>{let{type:t,heatmapElementID:a,renderer:o}=e;return /*#__PURE__*/r(va,{id:a,children:/*#__PURE__*/n(ao,{children:[/*#__PURE__*/r(F3,{type:re.Heatmap}),/*#__PURE__*/r(M2,{renderer:o,zoomMode:"linked-x"}),/*#__PURE__*/r(yC,{type:t})]})})},NG=NW,NY=e=>{let{occupancyElementID:a,occupancyAxisYElementID:o,type:i}=e;return /*#__PURE__*/n(t,{children:[/*#__PURE__*/r(va,{id:a,children:o?/*#__PURE__*/r(NR,{occupancyAxisYDisabled:!0}):/*#__PURE__*/n(ao,{children:[/*#__PURE__*/r(F3,{type:re.Occupancy}),/*#__PURE__*/r(NR,{}),/*#__PURE__*/r(yC,{type:i})]})}),/*#__PURE__*/r(va,{id:o,children:/*#__PURE__*/r(Nw,{inside:!0})})]})},NU=NY,NX=(e,t)=>tC(`BLAZE_PROGRESS-${e}`,"0",t,e),NK=()=>{let{state:{blaze:{show:e},segments:t,globalID:a}}=n9(),[o,i]=b(""),l=m(()=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];n.progress&&e.push(...n.progress)}return e},[t]);return(h(()=>{e&&a&&NX(a,e=>{i(l.includes(e)?void 0:`${100*e}%`)})},[e,a]),e)?/*#__PURE__*/r(yn,{children:/*#__PURE__*/n("div",{className:"absolute left-[-100%] top-0 flex h-full w-0 opacity-50",style:{left:o},children:[/*#__PURE__*/r("div",{className:"ml-[-0.5px] opacity-50",style:{borderRight:"0.5px solid var(--chart-grid-strong)"}}),/*#__PURE__*/r("div",{className:"ml-[-31px] w-[30px] opacity-20",style:{background:"linear-gradient(90deg, transparent, var(--chart-grid-strong))"}})]})}):null},NV=/*#__PURE__*/a.memo(NK),NQ=()=>{let{state:{legend:{children:e}}}=n9();return /*#__PURE__*/r("div",{className:"absolute left-5 top-5 z-[6] flex h-auto w-auto items-center",children:e})},NZ=NQ,NJ=()=>{let{state:{segments:e}}=n9(),t=e.totalPoints??0;return /*#__PURE__*/r(yn,{className:"z-[0]",children:e.map((e,n)=>/*#__PURE__*/r("div",{className:"h-full border-x",style:{width:t>0?`${100*e.point/t}%`:0,borderColor:n%2==1?"var(--chart-grid)":"transparent",background:n%2==1?"var(--chart-surface)":"transparent",opacity:n%2==1?.4:1}},`${e.start}_${e.stop}_${e.index}`))})},N0=NJ,N1=({globalID:e})=>({handleMarkerPublish:u(t=>{if(e)switch(t.pstype){case rr.Marker:Fr(e)(t);break;case rr.Reset:Fr(e)({type:ro.Clear})}},[e])}),N2=N1;function N5(){let e=at();return u(()=>{e({payload:e=>e.axisY.fieldStrengthUnitAvailable?null:{axisY:{...e.axisY,fieldStrengthUnitAvailable:!0}}})},[e])}function N4({segmentOffset:e,offset:t}){let r={};return void 0!==e&&(r.segmentOffset=e),void 0!==t&&(r.offset=t),void 0!==r.segmentOffset||void 0!==r.offset?r:void 0}function N3(e,t){"thresholdData"in t&&e.setThresholdData(t.thresholdData,N4(t))}function N6(){let e=n7(e=>e.signal.onChange),t=g(e);return f(()=>{t.current=e},[e]),u(e=>{let r=t.current;r&&r(e.regions.map(t=>({...t,frequency:t.centerFrequency,timestamp:e.timestamp})),e)},[])}function N8(e){let{state:{globalID:t,series:{enableMetrics:r,enableWaterfall:n},fluorescence:{show:a},axisY:{unit:o},zoom:{interval:i},heatmapCapture:{display:l},system:{width:s},marker:c,signal:d}}=n9(),p=g(null),f=g(t),m=g(i),b=g(0),v=N6(),y=d.templateDetection??e?.processing?.enableTemplateDetection??!1;h(()=>{p.current?.updateProcessing({enableTemplateDetection:y})},[y]);let w=g(null),{updateSignalData:x}=zK(),k=N5(),S=g(l);h(()=>{S.current=l},[l]);let M=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Spectrum)({pstype:rr.Render,data:e})},[]),C=u(e=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Heatmap)({pstype:rr.Render,data:e})},[]),F=u(e=>{NX(f.current)?.(e)},[]),D=u(e=>{(e.realData||e.templateData||e.backgroundNoiseData||"thresholdData"in e)&&M({minData:e.minData,maxData:e.maxData,avgData:e.avgData,thresholdData:e.thresholdData,backgroundNoiseData:e.backgroundNoiseData,realData:e.realData,templateData:e.templateData}),e.scanProgress&&F(e.scanProgress),e.templateDetection&&v(e.templateDetection),e.waterfallData&&C(e.waterfallData),e.fluorescenceData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Fluorescence)({pstype:rr.Fluorescence,data:{fluorescenceData:e.fluorescenceData,fluorescenceMaxCount:e.fluorescenceMaxCount}}),e.occupancyData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Occupancy)({pstype:rr.Render,data:e.occupancyData,totalOccupancy:b.current}),e.extraData&&((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Spectrum)({pstype:rr.Render,extraData:e.extraData})},[M,C,F,v]);h(()=>{f.current=t},[t]);let z=(e,t)=>!1!==e&&(t??!0);if(!p.current&&t){let o=Math.min(1|Math.floor(2*s),1001);p.current=new O({...e,outputPoints:o,processing:{...e?.processing,enableMetrics:z(r,e?.processing?.enableMetrics),enableWaterfall:z(n,e?.processing?.enableWaterfall),enableTemplateDetection:y,enableFluorescence:a,enablePeakStats:!!c?.enabled},onSpectrumUpdate:D});let i=tO(t),l=p.current;i.getAllRawData=e=>l.getAllRawData(e),t_(t,p.current)}h(()=>{let e=Math.floor(i.start),t=Math.ceil(i.end),r=Math.floor(m.current.start),n=Math.ceil(m.current.end);(e!==r||t!==n)&&p.current&&(m.current=i,p.current.updateSamplingRange(e,t+1))},[i]);let N=u(async(e=!1)=>{setTimeout(()=>{((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Heatmap)({pstype:rr.Reset}),((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Spectrum)({pstype:rr.Reset}),((e,t,r="0")=>tI(e,t,void 0,r))(f.current,rt.Occupancy)({pstype:rr.Reset}),e&&ws(f.current)},1)},[]),E=u(async e=>{if(p.current)switch(e.pstype){case rr.AntennaFactor:p.current.setAntennaFactor(e.data),e.data.length>0&&k();break;case rr.Signal:x({type:e.type,data:e.data});break;case rr.Spectrum:e.data&&p.current.process(e),N3(p.current,e),e.maxData&&p.current.setMaxData(e.maxData),e.minData&&p.current.setMinData(e.minData),e.avgData&&p.current.setAvgData(e.avgData),e.templateData&&p.current.setTemplateData(e.templateData,e.templateTolerance),e.backgroundNoiseData&&p.current.setBackgroundNoiseData(e.backgroundNoiseData),e.extraData&&p.current.setExtraData(e.extraData,I.MERGE,e.segmentedExtraData?{segmentOffset:e.segmentOffset,offset:e.offset}:void 0);break;case rr.Fluorescence:e.data&&p.current&&p.current.setFluorescenceData(e.data.fluorescenceData,e.data.fluorescenceMaxCount);break;case rr.Heatmap:if(e.data){let{data:t,timestamps:r}=e,n=rZ(t,r);p.current.setWaterfallData(n)}break;case rr.Occupancy:p.current?.setOccupancyData(e.data),b.current=e.totalOccupancy;break;case rr.Segments:p.current.initializeSegments(e.data),await N(),e.onFinally?.();break;case rr.SpectrumBandwidth:p.current.reset();break;case rr.Series:wl(f.current,e);break;case rr.Reset:p.current.reset(),await N(!0),e.onFinally?.();break;case rr.Clear:p.current.reset(),await N(!1),e.onFinally?.()}},[k,x,wl,N]);return h(()=>{let e=o.includes("/m");p.current?.setAntennaFactorSwitch(e)},[o]),h(()=>{if(!p.current)return;let t=z(r,e?.processing?.enableMetrics);t!==w.current&&(p.current.updateProcessing({enableMetrics:t}),w.current=t)},[r,e?.processing?.enableMetrics]),E}let N9=e=>{let{state:{globalID:a}}=n9(),o=g([]),i=g(""),{type:l=re.SingleFrequency,publish:s,heatmapElementID:c,occupancyElementID:u,occupancyAxisYElementID:d,touch:h,children:p,processing:f,renderer:m}=e,{enableMetrics:b,enableWaterfall:v}=wm({type:l,heatmapElementID:c}),y=N8({processing:{enableWaterfall:v,enableMetrics:b,...f}}),w=ww(l);wx(h);let{handleMarkerPublish:x}=N1({globalID:a});return al({publish:s,subscribe:e=>{if(y(e),x(e),w(e),e.pstype===rr.Heatmap){let{data:t,timestamps:r}=e;if(o.current=rZ(t,r),i.current!==a){let e=tO(a),t=e.getAllRawData;e.getAllRawData=e=>({...t(e),waterfallData:o.current}),i.current=a}}((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Spectrum)(e),((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Heatmap)(e),((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Occupancy)(e),e.pstype!==rr.Fluorescence&&((e,t,r="0")=>tI(e,t,void 0,r))(a,rt.Fluorescence)(e)}}),/*#__PURE__*/n(ap,{children:[/*#__PURE__*/r(F3,{type:l}),/*#__PURE__*/n(yF,{children:[/*#__PURE__*/r(Ns,{touch:h,children:p||/*#__PURE__*/r(NH,{})}),/*#__PURE__*/r(NW,{type:l,heatmapElementID:c,renderer:m}),/*#__PURE__*/r(NY,{type:l,occupancyElementID:u,occupancyAxisYElementID:d}),/*#__PURE__*/n(SD,{children:[/*#__PURE__*/r(N$,{}),l===re.Scan&&/*#__PURE__*/n(t,{children:[/*#__PURE__*/r(NJ,{}),/*#__PURE__*/r(NV,{})]}),/*#__PURE__*/r(NQ,{})]})]}),/*#__PURE__*/r(yC,{type:l})]})},N7=N9,Ee="singleFrequency",Et="slider",Er=e=>"slider"===e?"deltaMeasurement":"default",En=e=>{let t=e.type??Ee;if(!e.heatmapElementID||t!==Ee&&"scan"!==t&&"mscan"!==t)return e;let r=e.heatmapCapture?.type??"slider",n=e.heatmapCapture?.toolbarVariant??Er(r);return{...e,heatmapCapture:{show:!0,display:!1,...e.heatmapCapture,type:r,toolbarVariant:n}}},Ea=e=>{let t=En(e);return /*#__PURE__*/r(ar,{...t,children:/*#__PURE__*/r(N9,{...t})})},Eo=tB(Ea,"Spectrum"),Ei=Eo;function El(e={}){let{onChange:t,sizes:r,tokens:n}=e;th({sizes:r,tokens:n});let a=is();return{cleanup:t?ic(e=>t(e)):void 0,...a}}var Es=/*#__PURE__*/function(e){return e.Station="station",e.Simple="simple",e}({});th();export{w as DialDirectionLabelMode,iE as AudioWaveform,vV as Dial,v9 as Gauge,Cs as Heatmap,CR as IQ,Nf as LevelStream,Nq as Occupancy,Ei as Spectrum,t7 as AxisPlacement,re as ChartType,t9 as FrequencyUnit,ro as MarkerEventType,rt as ModuleType,rn as OptionKey,rr as PSType,ra as SegmentsEvent,rs as SeriesType,ri as ToolType,rl as ToolbarItemType,rC as formatFrequencyUnit,rD as formatFrequencyUnitFromHz,rF as formatFrequencyUnitFromMHz,is as getChartsThemeState,nt as HeatmapCaptureType,El as initChartsTheme,r7 as MarkerMode,DW as setFrequencyAllocationChannelsToCache,DB as setFrequencyAllocationToCache,Es as SignalDataType,ic as subscribeChartsThemeChange,ac as useSafePublish,tB as withChartPublisher};
|