@rfkit/charts 1.11.0 → 1.12.0

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/index.js CHANGED
@@ -941,6 +941,10 @@ let isWebKitValue;import{Fragment,jsx as jsx_runtime_jsx,jsxs}from"react/jsx-run
941
941
  width: calc(var(--spacing) * 14);
942
942
  }
943
943
 
944
+ [data-rfkit-charts-root] .w-24 {
945
+ width: calc(var(--spacing) * 24);
946
+ }
947
+
944
948
  [data-rfkit-charts-root] .w-28 {
945
949
  width: calc(var(--spacing) * 28);
946
950
  }
@@ -3801,8 +3805,8 @@ let isWebKitValue;import{Fragment,jsx as jsx_runtime_jsx,jsxs}from"react/jsx-run
3801
3805
  ${t}
3802
3806
  }`,buildThemeBridgeCss=(e,t)=>{let r=buildVariableDeclarations(e,theme_contract_ThemeType.Light),n=buildVariableDeclarations(e,theme_contract_ThemeType.Dark);return[buildRule(t.default,r),buildRule(t.light,r),buildRule(t.dark,n),`@media (prefers-color-scheme: dark) {
3803
3807
  ${buildRule(` ${t.systemDark}`,n)}
3804
- }`].join("\n\n")},buildSizeBridgeCss=e=>{let t=buildVariableDeclarations(e,"middle"),r=buildVariableDeclarations(e,"small");return[buildRule(":root",t),buildRule(`:root[size='${DEFAULT_SIZE}']`,t),buildRule(":root[size='small']",r)].join("\n\n")},ensureStyleElement=(e,t)=>{if(!canUseDOM())return;let r=`style[${e}]`,n=document.head.querySelector(r);if(n){n.textContent!==t&&(n.textContent=t);return}let a=document.createElement("style");a.textContent=t,a.setAttribute(e,"true"),document.head.appendChild(a)},ensureRootThemeStyles=({tokens:e}={})=>{ensureStyleElement(ROOT_THEME_STYLE_TARGET,buildThemeBridgeCss(getCanonicalThemeVariableDefinitions(e),{default:":root",light:`:root[theme='${ThemeType.Light}'][${THEME_FOLLOW_OS_KEY}='false']`,dark:`:root[theme='${ThemeType.Dark}'][${THEME_FOLLOW_OS_KEY}='false']`,systemDark:`:root:not([${THEME_FOLLOW_OS_KEY}='false'])`}))},ensureChartsThemeStyles=({tokens:e}={})=>{ensureStyleElement(CHARTS_THEME_STYLE_TARGET,buildThemeBridgeCss(theme_tokens_getCanonicalThemeVariableDefinitions(e),{default:CHARTS_STYLE_SCOPE_SELECTOR,light:`:root[theme='${theme_contract_ThemeType.Light}'][${theme_contract_THEME_FOLLOW_OS_KEY}='false'] ${CHARTS_STYLE_SCOPE_SELECTOR}`,dark:`:root[theme='${theme_contract_ThemeType.Dark}'][${theme_contract_THEME_FOLLOW_OS_KEY}='false'] ${CHARTS_STYLE_SCOPE_SELECTOR}`,systemDark:`:root:not([${theme_contract_THEME_FOLLOW_OS_KEY}='false']) ${CHARTS_STYLE_SCOPE_SELECTOR}`}))},ensureChartsSizeStyles=e=>{ensureStyleElement(CHARTS_SIZE_STYLE_TARGET,buildSizeBridgeCss(getSizeVariableDefinitions(e)))},initializeRootThemeEnvironment=(e={})=>{let{sizes:t,tokens:r}=e;ensureRootThemeStyles({tokens:r}),ensureChartsSizeStyles(t)},initializeChartsThemeEnvironment=(e={})=>{let{sizes:t,tokens:r}=e;ensureChartsThemeStyles({tokens:r}),ensureChartsSizeStyles(t)},CHARTS_RUNTIME_KEY=Symbol.for("rfkit.charts.runtime"),createRuntimeOwnerRecord=()=>({datas:new Set,subscriptions:new Set}),normalizeChartsRuntime=e=>{let t=e?.datas??{},r=e?.subscriptions??{},n=e?.owners??{};for(let e of Object.keys(n)){let t=n[e];t.datas??=new Set,t.subscriptions??=new Set}return{datas:t,subscriptions:r,owners:n}},getRuntimeHost=()=>"u">typeof window?window:globalThis,ensureChartsRuntime=()=>{let e=getRuntimeHost();if("u">typeof window&&window.charts){let t=normalizeChartsRuntime(window.charts);return window.charts=t,e[CHARTS_RUNTIME_KEY]=t,t}e[CHARTS_RUNTIME_KEY]||(e[CHARTS_RUNTIME_KEY]=normalizeChartsRuntime(void 0));let t=normalizeChartsRuntime(e[CHARTS_RUNTIME_KEY]);return e[CHARTS_RUNTIME_KEY]=t,"u">typeof window&&(window.charts=t),t},subscription_c=ensureChartsRuntime();subscription_c.datas||(subscription_c.datas={});let getRuntimeOwnerRecord=e=>(subscription_c.owners[e]||(subscription_c.owners[e]=createRuntimeOwnerRecord()),subscription_c.owners[e]),registerRuntimeOwnership=(e,t,r)=>{e&&t&&getRuntimeOwnerRecord(e)[r].add(t)},cleanupOwnerRecordIfEmpty=e=>{let t=subscription_c.owners[e];t&&0===t.datas.size&&0===t.subscriptions.size&&delete subscription_c.owners[e]},unregisterRuntimeKey=(e,t)=>{for(let r of Object.keys(subscription_c.owners))subscription_c.owners[r][t].delete(e),cleanupOwnerRecordIfEmpty(r)};function subscription_openData(e,t,r,n){let a=subscription_c.datas;return registerRuntimeOwnership(n,e,"datas"),e in a?void 0!==t&&(a[e]=t):a[e]=t??r,a[e]??r}subscription_c.subscriptions||(subscription_c.subscriptions={});let subscription_subscriptions=subscription_c.subscriptions;function subscription_createSubscriptionManager(e,t,r,n){if(!e)throw Error("createSubscriptionManager 订阅失效");return"function"==typeof r&&t?(subscription_subscriptions[e]||(subscription_subscriptions[e]={}),subscription_subscriptions[e][t]=r,registerRuntimeOwnership(n,e,"subscriptions"),()=>{subscription_subscriptions[e]?.[t]===r&&delete subscription_subscriptions[e][t],subscription_subscriptions[e]&&0===Object.keys(subscription_subscriptions[e]).length&&(delete subscription_subscriptions[e],unregisterRuntimeKey(e,"subscriptions"))}):(...t)=>{let r=subscription_subscriptions[e];if(r)for(let e in r)r[e](...t)}}function createConsumableSubscriptionManager(e,t,r,n,a){return"function"==typeof n&&r?subscription_createSubscriptionManager(e,r,n,a):(...r)=>{let n=subscription_subscriptions[e];if(!n)return!1;for(let e of Object.keys(n).sort((e,r)=>t(r)-t(e)))if(!0===n[e](...r))return!0;return!1}}let getPublishSubscriptionKey=e=>`PUB_SUB-${e}`,getModuleSubscriptionKey=(e,t)=>`passThrough-${e}-${t}`,getDatabaseStorageKey=e=>`withDatabase-${e}`,getAnalyzerStorageKey=e=>`withSpectrumAnalyzerSYNC-${e}`,getWaterfallAnalyzerStorageKey=e=>`withWaterfallAnalyzerSYNC-${e}`,getUpdateDataSubscriptionKey=e=>`withUpdateData-${e}`,createPublishSubscriptionManager=(e,t,r="0")=>subscription_createSubscriptionManager(getPublishSubscriptionKey(e),r,t,e),createModuleSubscriptionManager=(e,t,r,n="0")=>subscription_createSubscriptionManager(getModuleSubscriptionKey(e,t),n,r,e);function releaseChartsRuntimeOwners(e){let t=e.filter(e=>"string"==typeof e&&e.length>0);if(0!==t.length)for(let e of t){let t=subscription_c.owners[e];if(t){for(let e of Array.from(t.datas))delete subscription_c.datas[e],unregisterRuntimeKey(e,"datas");for(let e of Array.from(t.subscriptions))delete subscription_subscriptions[e],unregisterRuntimeKey(e,"subscriptions");delete subscription_c.owners[e]}}}let getDefaultData=()=>({getAllRawData:()=>({realData:new Float32Array,maxData:new Float32Array,minData:new Float32Array,avgData:new Float32Array,thresholdData:new Float32Array,templateData:new Float32Array,backgroundNoiseData:new Float32Array,waterfallData:[],levelStreamData:{probabilityRangeData:new Float32Array,spectrumData:new Float32Array,timestampData:new Float32Array},occupancyData:new Float32Array,extraData:{},srcIndexCache:new Uint32Array})});function withDatabase(e,t){return e?subscription_openData(getDatabaseStorageKey(e),t,getDefaultData(),e):getDefaultData()}let withUpdateData=(e,t,r)=>subscription_createSubscriptionManager(getUpdateDataSubscriptionKey(e),t,r,e),setScanDF360Prob=(e,t)=>subscription_createSubscriptionManager(`setScanDF360Prob-${e}`,"0",t,e);function withSpectrumAnalyzerSYNC(e,t){return e?subscription_openData(getAnalyzerStorageKey(e),t,null,e):t??null}function withWaterfallAnalyzerSYNC(e,t){return e?subscription_openData(getWaterfallAnalyzerStorageKey(e),t,null,e):t??null}function createEnhancedPublishController(){let e={current:null},t={current:[]},r={current:!1},n={current:!1},a={current:!1},i={current:[]},o={current:[]},l=()=>{a.current=!1,n.current=!0,c();let e=i.current;for(let t of(i.current=[],e)){if(!t.active)continue;let e=t.callback();"function"==typeof e&&(t.cleanup=e,o.current.push(e))}},s=()=>{if(a.current)return;a.current=!0;let e=()=>{queueMicrotask(l)};"u">typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,0)},c=()=>{if(!e.current||0===t.current.length)return;let r=t.current;for(let n of(t.current=[],r))e.current(n)},u=a=>{e.current&&n.current?e.current(a):(t.current.push(a),r.current&&e.current&&s())};return{attachPublish:t=>{if(e.current=t,r.current){n.current=!1,s();return}r.current=!0,n.current=!1,s()},dispose:()=>{for(let e of o.current)e();o.current=[],t.current=[],i.current=[],e.current=null,r.current=!1,n.current=!1,a.current=!1},enhancedPublish:Object.assign(u,{getSourceData:()=>e.current?.getSourceData?e.current.getSourceData():getDefaultData(),isReady:()=>r.current,onReady:t=>{if(r.current&&e.current&&n.current){let e=t();return"function"==typeof e?(o.current.push(e),e):void 0}let a={callback:t,active:!0};return i.current.push(a),r.current&&e.current&&s(),()=>{a.active=!1,i.current=i.current.filter(e=>e!==a),a.cleanup&&a.cleanup()}},resetViewport:()=>{e.current?.resetViewport?.()}}),publish:u}}function withChartPublisher(e,t){let r=forwardRef((t,r)=>{let n=external_react_useRef(null);n.current||(n.current=createEnhancedPublishController());let a=n.current,i=external_react_useCallback(e=>{a.attachPublish(e)},[a]);external_react_useEffect(()=>()=>a.dispose(),[a]),useImperativeHandle(r,()=>a.enhancedPublish,[a]);let o={...t,publish:i};return react.createElement(e,o)});return r.displayName=`withChartPublisher(${t})`,r}let KEY="DCHARTS_CONFIG",UI_CONFIG={ZOOM_MIN_RANGE:10,POPOVER_MARGIN:16},SPECTRUM_THRESHOLD_COLOR="#A855F7",setting_defaultConfig={line:{realData:{name:"realData",color:"#86c56a",thickness:1,label:"实时值",display:!0},maxData:{name:"maxData",color:"#eb5b5b",thickness:1,label:"最大值",display:!0},minData:{name:"minData",color:"#4a65bf",thickness:1,label:"最小值",display:!1},avgData:{name:"avgData",color:"#f9c14e",thickness:1,label:"平均值",display:!1},thresholdData:{name:"thresholdData",color:SPECTRUM_THRESHOLD_COLOR,thickness:1,label:"门限值",display:!0},templateData:{name:"templateData",color:"#e38888",thickness:1,label:"模板",display:!0},backgroundNoiseData:{name:"backgroundNoiseData",color:"#2bb3cb",thickness:1,label:"背景噪声",display:!0}},gradient:{item:[["#FF0000","#FFEB3B","#2DB333","#00BCD4","#0000FF","#000000"],["#FF3636","#2DF16A","#3B4FFF"],["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],["#d73027","#f46d43","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],["#5e4fa2","#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],["#FFFFFF","#000000"]],index:0},levelStream:{line:"#4a65bf",statisticsTime:10},bar:"rgba(100, 211, 211, 211)",iq:{pointColor:"#ff0000",lineColor:"#00ff00"},marker:["#35E065","#F98116","#FF4325","#3CE5D3","#F64FA1","#AA74E8","#FFE184","#B1E3FF","#C8141F","#FFA3CC","#BACFFF","#45D2FF","#AEDF2F","#E7FF84","#B88AFF","#FF00B4","#FFD0E3","#EEAE94"]},setConfig=(e={})=>{let t=JSON.parse(localStorage.getItem(KEY)||"{}"),r={...setting_defaultConfig,...t,...e};localStorage.setItem(KEY,JSON.stringify(r))};function getConfig(e){let t=setting_defaultConfig??JSON.parse(localStorage.getItem(KEY)||"null");return t||(setConfig(),t=setting_defaultConfig),e?t[e]:t}let getSeriesConfig=()=>getConfig("line"),getGradient=(e=0)=>{let{item:t,index:r}=getConfig("gradient");return t[void 0!==r?r:e]},SERIES=getSeriesConfig(),SERIES_NAMES=Object.keys(SERIES),REAL_DATA_NAME=SERIES.realData.name,ZOOM_MIN_RANGE=UI_CONFIG.ZOOM_MIN_RANGE,POPOVER_MARGIN=UI_CONFIG.POPOVER_MARGIN;var constants_FrequencyUnit=/*#__PURE__*/function(e){return e.Hz="Hz",e.kHz="kHz",e.MHz="MHz",e.GHz="GHz",e}({}),constants_AxisPlacement=/*#__PURE__*/function(e){return e.Outside="outside",e.Inside="inside",e}({}),constants_ChartType=/*#__PURE__*/function(e){return e.SingleFrequency="singleFrequency",e.Scan="scan",e.MScan="mscan",e.ScanDF360="scanDF360",e.DDC="ddc",e.Lite="lite",e.LiteNormalized="liteNormalized",e.LevelStream="levelStream",e.IQEye="iqEye",e.IQLine="iqLine",e.IQPlanisphere="iqPlanisphere",e.IQStream="iqStream",e.Heatmap="heatmap",e.Occupancy="occupancy",e}({}),constants_ModuleType=/*#__PURE__*/function(e){return e.Spectrum="spectrum",e.Heatmap="heatmap",e.Fluorescence="fluorescence",e.Occupancy="occupancy",e.LevelStream="levelStream",e.Dial="dial",e.Gauge="gauge",e.IQStream="iqStream",e.IQPlanisphere="iqPlanisphere",e.IQEye="iqEye",e.IQLine="iqLine",e.SpatialSpectrum="spatialSpectrum",e}({}),constants_PSType=/*#__PURE__*/function(e){return e.Spectrum="spectrum",e.AntennaFactor="antennaFactor",e.Signal="signal",e.Occupancy="occupancy",e.LevelStream="levelStream",e.Heatmap="heatmap",e.Fluorescence="fluorescence",e.IQ="iq",e.Dial="dial",e.Gauge="gauge",e.Series="series",e.SpectrumBandwidth="spectrumBandwidth",e.Segments="segments",e.Channels="channels",e.Marker="marker",e.Reset="reset",e.Resize="resize",e.Clear="clear",e.Option="option",e.Render="render",e}({}),constants_OptionKey=/*#__PURE__*/function(e){return e.HeatmapCapture="heatmapCapture",e}({}),constants_SegmentsEvent=/*#__PURE__*/function(e){return e.Cover="cover",e.Focus="focus",e}({}),constants_MarkerEventType=/*#__PURE__*/function(e){return e.Add="add",e.Del="del",e.Clear="clear",e.Update="update",e}({}),constants_ToolType=/*#__PURE__*/function(e){return e.AxisX="axisX",e.AxisY="axisY",e.Band="band",e.Blaze="blaze",e.Cursor="cursor",e.DragFrame="dragFrame",e.Dropdown="dropdown",e.EventBus="eventBus",e.FrequencyAllocation="frequencyAllocation",e.FrequencyDataBoard="frequencyDataBoard",e.FrequencyTagLine="frequencyTagLine",e.GridLines="gridLines",e.GaugeBox="gaugeBox",e.HeatmapCapture="heatmapCapture",e.Legend="legend",e.Limit="limit",e.Markers="markers",e.Scope="scope",e.SegmentsZebra="segmentsZebra",e.Signal="signal",e.SignalAnalysis="signalAnalysis",e.Square="square",e.Stripe="stripe",e.Zoom="zoom",e.Frame="frame",e.Area="area",e}({}),constants_ToolbarItemType=/*#__PURE__*/function(e){return e.AutorangingSwitch="AutorangingSwitch",e.UnitSwitch="UnitSwitch",e.StepSwitch="StepSwitch",e.GradientRibbon="GradientRibbon",e.HeatmapCaptureSwitch="HeatmapCaptureSwitch",e.TimeRangeSwitch="TimeRangeSwitch",e.SpacerLine="SpacerLine",e.Reset="Reset",e.StationAllocationSwitch="StationAllocationSwitch",e.SeriesControl="SeriesControl",e.FrequencyAllocationSwitch="FrequencyAllocationSwitch",e.ZoomSwitch="ZoomSwitch",e.LimitSwitch="LimitSwitch",e.MarkersSwitch="MarkersSwitch",e.FrequencyTagLineSwitch="FrequencyTagLineSwitch",e.SignalAnalysisSwitch="SignalAnalysisSwitch",e.StripeSwitch="StripeSwitch",e.CursorSwitch="CursorSwitch",e.CursorFindRowSwitch="CursorFindRowSwitch",e.SignalSwitch="SignalSwitch",e.SegmentsDisplayControl="SegmentsDisplayControl",e.SeriesDisplayControl="SeriesDisplayControl",e.FluorescenceSwitch="FluorescenceSwitch",e.DeltaMeasurementSwitch="DeltaMeasurementSwitch",e}({}),constants_SeriesType=/*#__PURE__*/function(e){return e.RealData="realData",e.MaxData="maxData",e.MinData="minData",e.AvgData="avgData",e.ThresholdData="thresholdData",e.TemplateData="templateData",e.BackgroundNoiseData="backgroundNoiseData",e}({});let cursor_hasActiveSpectrumCursor=e=>!!(e.show&&e.active&&e.event?.sourceType===constants_ModuleType.Spectrum),CLIPPING_OVERFLOW_VALUES=new Set(["auto","clip","hidden","overlay","scroll"]),matchesClippingOverflow=e=>e?.split(" ").some(e=>CLIPPING_OVERFLOW_VALUES.has(e.trim()))??!1,createBounds=(e,t,r,n)=>({left:e,top:t,right:r,bottom:n,width:Math.max(0,r-e),height:Math.max(0,n-t)}),resolveCursorVisibleBounds=e=>{let t=e.getBoundingClientRect(),r=t.left,n=t.top,a=t.right,i=t.bottom;"u">typeof window&&(r=Math.max(r,0),n=Math.max(n,0),a=Math.min(a,window.innerWidth),i=Math.min(i,window.innerHeight));let o=e.parentElement;for(;o&&o!==document.body;){let e=window.getComputedStyle(o),t=matchesClippingOverflow(e.overflowX)||matchesClippingOverflow(e.overflow),l=matchesClippingOverflow(e.overflowY)||matchesClippingOverflow(e.overflow);if(t||l){let e=o.getBoundingClientRect();e.width>0&&e.height>0&&(t&&(r=Math.max(r,e.left),a=Math.min(a,e.right)),l&&(n=Math.max(n,e.top),i=Math.min(i,e.bottom)))}o=o.parentElement}return createBounds(r,n,a,i)},getFrequencyToFixed=(e,t=6)=>{if(!e&&0!==e)return"";let r=Number.parseFloat(e.toFixed(t));return Number.isFinite(r)?String(r):""};function isdBm(e){return e?.slice(0,3)==="dBm"}let setTotalPoints=(e,t)=>(Object.defineProperty(e,"totalPoints",{value:t,enumerable:!1,configurable:!0}),e),generateFrequencyCache=e=>{let{totalPoints:t,startFrequency:r,stopFrequency:n,index:a=0}=e,i=n-r;return 1===t?[{frequency:getFrequencyToFixed(r),startLeft:100*a/t,endLeft:(a+1)*100/t}]:Array(t).fill(0).map((e,n)=>({frequency:getFrequencyToFixed(r+n/(t-1)*i),startLeft:(a+n)*100/t,endLeft:(a+n+1)*100/t}))},leftSegments2frequency=e=>{if(!e?.length)return()=>"";let t=e.totalPoints,r=e.map((r,n)=>{let{point:a}=r;return{ll:100*a/t,frequencyCache:r.frequencyCache,startLeft:0===n?0:e.slice(0,n).reduce((e,r)=>e+100*r.point/t,0)}});return t=>{if(t<=0)return String(e[0]?.start);if(t>=100)return String(e[e.length-1]?.stop);let n=0,a=r.length-1;for(;n<=a;){let e=n+a>>>1,{startLeft:i,ll:o}=r[e];if(t>=i&&t<i+o){let{frequencyCache:n}=r[e],a=Math.min(Math.ceil((t-i)/o*n.length)-1,n.length-1);return n[a]?.frequency??""}t<i?a=e-1:n=e+1}return""}},leftToIndex=(e,t)=>t<=1?0:Math.max(0,Math.min(t-1,Math.ceil(Math.max(0,Math.min(100,e))*t/100)-1));function leftPoints2frequency(e){let t=e.length;return r=>{if(0!==t)return e[leftToIndex(r,t)]}}let scopeLeftSegments2bandwidth=e=>{if(!e)return 0;let{segments:t}=e;if(!t)return 0;let r=t.totalPoints,{endLeft:n,startLeft:a}=e,i=n-a,o=Math.abs(i);i<0&&(a=e.endLeft,n=e.startLeft);let l=0,s=!1;for(let e=0;e<t.length;e+=1){let{step:i,start:c,stop:u,point:d}=t[e],h=100*d/r,p=i/1e3,f=a-h<=0,m=n-h<=0;if(!s&&f&&m)return Math.round(o/h*d)*p;if(f&&!s&&(s=!0,l+=Math.round((1-a/h)*d)*p),m)return l+Math.round(n/h*d)*p;a<0&&!m&&(l+=u-c),a-=h,n-=h}return 0},generateFrequencySegments=e=>{let{frequency:t,bandwidth:r,totalPoints:n}=e,a=t-r/2e3,i=t+r/2e3;if(a<=0||i<=0)return[];let o=generateFrequencyCache({totalPoints:n,startFrequency:a,stopFrequency:i,stepFrequency:r/n});return setTotalPoints([{frequency:t,bandwidth:r,step:i-a,start:a,stop:i,index:0,label:"",point:n,percentage:1,progress:[0,100],frequencyCache:o}],n)},generateNormalizedSegments=e=>setTotalPoints([{frequency:0,bandwidth:0,step:1,start:0,stop:e,index:0,label:"Data",point:e,percentage:1,progress:[0,100],frequencyCache:[]}],e),generateGreatSegments=e=>{if(!e?.length)return[];let t=e.reduce((e,{startFrequency:t,stopFrequency:r,stepFrequency:n})=>e+Math.round((r-t)*1e3/n)+1,0),r=0;return setTotalPoints(e.map(({startFrequency:e,stopFrequency:n,stepFrequency:a,label:i})=>{let o=Math.round((n-e)*1e3/a)+1,l=r,s=generateFrequencyCache({totalPoints:o,startFrequency:e,stopFrequency:n,stepFrequency:a,index:l});return r+=o,{start:e,stop:n,step:a,index:l,label:i,point:o,percentage:o/t,progress:[100*l/t,100*r/t],frequencyCache:s}}),t)},formatFrequencyUnit=(e,t=3)=>{let r,n;if(!e&&0!==e)return{value:0,unit:constants_FrequencyUnit.Hz,formatted:`0 ${constants_FrequencyUnit.Hz}`};let a=Math.abs(e);a>=1e6?(r=e/1e6,n=constants_FrequencyUnit.GHz):a>=1e3?(r=e/1e3,n=constants_FrequencyUnit.MHz):a>=1?(r=e,n=constants_FrequencyUnit.kHz):(r=1e3*e,n=constants_FrequencyUnit.Hz);let i=Number.parseFloat(r.toFixed(t)).toString(),o=`${i} ${n}`;return{value:r,unit:n,formatted:o}},formatFrequencyUnitFromMHz=(e,t=3)=>formatFrequencyUnit(1e3*e,t),formatFrequencyUnitFromHz=(e,t=3)=>formatFrequencyUnit(e/1e3,t),SEARCH_RANGE=5,ACTIVE_TOLERANCE=2;function frequencyCalculation_calculateFrequencyRange(e){if(null!=e.frequency&&null!=e.bandwidth){let t=e.bandwidth/1e3/2;return{startFreq:e.frequency-t,stopFreq:e.frequency+t}}return null!=e.startFrequency&&null!=e.stopFrequency?{startFreq:Number(e.startFrequency),stopFreq:Number(e.stopFrequency)}:null}function calculateRoughIndexRange(e,t){let r=t.stop-t.start,n=Math.ceil((e.startFreq-t.start)/r*t.point)-1,a=Math.floor((e.stopFreq-t.start)/r*t.point)-1;return{startIndex:n=Math.max(n,0),stopIndex:a=Math.min(a,t.point-1)}}function findPreciseIndexRange(e,t,r=SEARCH_RANGE){let{startIndex:n,stopIndex:a}=calculateRoughIndexRange(e,t),i=t.frequencyCache,o=n,l=a;for(let a=Math.max(0,n-r);a<=Math.min(t.point-1,n+r);a++)if(Number(i[a]?.frequency)>=e.startFreq){o=a;break}for(let n=Math.max(0,a-r);n<=Math.min(t.point-1,a+r);n++){let t=Number(i[n]?.frequency);if(t<=e.stopFreq&&(l=n),t>e.stopFreq)break}return{startIndex:n=Math.max(o,0),stopIndex:a=Math.min(l,t.point-1)}}function calculatePositionFromIndex(e,t){let r=(e.stopIndex-e.startIndex+1)/t.point*100;return{left:e.startIndex/t.point*100,width:r}}function calculatePositionFromFrequencyRange(e,t){let r=findPreciseIndexRange(e,t);return{...calculatePositionFromIndex(r,t),...r}}function frequencyCalculation_calculateCursorPosition(e,t){if(!t?.length)return{segmentIndex:-1,pointIndex:-1};let r=t.reduce((e,t)=>e+t.point,0),n=0,a=e/100;for(let e=0;e<t.length;e++){let i=t[e].point/r;if(a>=n&&a<=n+i){let r=(a-n)/i,o=Math.max(0,Math.min(t[e].point-1,Math.ceil(r*t[e].point)-1));return{segmentIndex:e,pointIndex:o}}n+=i}return{segmentIndex:-1,pointIndex:-1}}function frequencyCalculation_getCursorFrequencyAtPosition(e,t){let r=e[t.segmentIndex];if(!r?.frequencyCache?.length)return 0/0;let n=Math.max(0,Math.min(r.frequencyCache.length-1,t.pointIndex));return Number(r.frequencyCache[n]?.frequency)}function isInRangeByIndex(e,t,r=ACTIVE_TOLERANCE){return!(e+r<t.startIndex||e-r>t.stopIndex)}function isInRangeByFrequency(e,t){return e>=t.startFreq&&e<=t.stopFreq}function isRangeIntersectSegment(e,t){return!(e.stopFreq<t.start||e.startFreq>t.stop)}let isPlainObject=e=>"[object Object]"===Object.prototype.toString.call(e)&&null!==e,mergeObjects=(e,t)=>{let r={...e};return Object.keys(r).forEach(e=>{let n=t[e];isPlainObject(n)&&isPlainObject(r[e])?r[e]={...r[e],...n}:void 0!==n&&(r[e]=n)}),r};function throttle(e=()=>{},t=1e3/30){let r=0;return(...n)=>{let a=Date.now();a-r>=t&&(e(...n),r=a)}}function throttleRequestAnimationFrame(e=()=>{}){let t=!1,r=null;return n=>{n?.nativeEvent&&n.persist&&n.persist(),r=n?.currentTarget?{currentTarget:n.currentTarget,target:n.target??null,clientX:n.clientX,clientY:n.clientY,buttons:n.buttons,nativeEvent:n.nativeEvent,_originalEvent:n}:n,t||(t=!0,requestAnimationFrame(()=>{e(r),t=!1,r=null}))}}function throttleTimer(e=()=>{},t){let r=null;return n=>{r&&clearTimeout(r),r=setTimeout(()=>{e(n)},t||100)}}let debounce=(e,t=1e3/30)=>{let r=null,n=(...n)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(...n)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function debounceRequestAnimationFrame(e=()=>{}){let t=!1;return(...r)=>{t||(t=!0,requestAnimationFrame(()=>{e(...r),t=!1}))}}let formatTimestamp=(e=Date.now(),t)=>{if(null==e)return"";let r=0;"number"==typeof e?(r=e)>0&&r<1e10&&(r*=1e3):r=e.getTime();let n=new Date(r);if(!Number.isFinite(n.getTime()))return"";let{dateSeparator:a="-",timeSeparator:i=":",timeOnly:o=!1}=t??{},l=n.getFullYear(),s=`${n.getMonth()+1}`.padStart(2,"0"),c=`${n.getDate()}`.padStart(2,"0"),u=`${n.getHours()}`.padStart(2,"0"),d=`${n.getMinutes()}`.padStart(2,"0"),h=`${n.getSeconds()}`.padStart(2,"0"),p=`${u}${i}${d}${i}${h}`;if(o)return p;let f=`${l}${a}${s}${a}${c}`;return`${f} ${p}`},dateTimeToTimestamp=(e,t="-",r=":",n=!1)=>{if("string"!=typeof e)return console.error("dateTimeToTimestamp: 输入必须是字符串"),-1;let a=0,i=0,o=0,l=0,s=0,c=0;if(n){let t=e.split(r);if(3!==t.length)return -1;l=parseInt(t[0],10)||0,s=parseInt(t[1],10)||0,c=parseInt(t[2],10)||0;let n=new Date;return new Date(n.getFullYear(),n.getMonth(),n.getDate(),l,s,c).getTime()}let u=e.split(" ");if(2!==u.length)return -1;let[d,h]=u,p=d.split(t);if(3!==p.length)return -1;a=parseInt(p[0],10)||0,i=parseInt(p[1],10)||0,o=parseInt(p[2],10)||0;let f=h.split(r);return 3!==f.length?-1:(l=parseInt(f[0],10)||0,new Date(a,i-1,o,l,s=parseInt(f[1],10)||0,c=parseInt(f[2],10)||0).getTime())},createGUID=()=>((1+Math.random())*65536|0).toString(16).substring(1),convertToTimestampedArrays=(e,t)=>e&&Array.isArray(e)?Array.from({length:e.length},(r,n)=>{let a=e[n],i=new Float32Array(a.length);return i.set(a),i.timestamp=t?.[n],i}):[],BandKind={Position:"position",CenterBandwidth:"centerBandwidth",FrequencyRange:"frequencyRange"},DEFAULT_BAND_STATE={kind:BandKind.Position,show:!1,left:void 0,width:0,color:""},hasOwn=(e,t)=>Object.hasOwn(e,t),isFiniteNumber=e=>"number"==typeof e&&Number.isFinite(e),hasValidSharedFields=e=>(!hasOwn(e,"show")||"boolean"==typeof e.show)&&(!hasOwn(e,"color")||void 0===e.color||"string"==typeof e.color),resolveSharedState=(e,t,r)=>({show:"boolean"==typeof e.show?e.show:"merge"!==r||t.show,color:hasOwn(e,"color")?e.color:"merge"===r?t.color:void 0});function resolveBandState(e,t=DEFAULT_BAND_STATE,r="replace"){if(!hasValidSharedFields(e))return t;let n=hasOwn(e,"left")||hasOwn(e,"width"),a=hasOwn(e,"frequency")||hasOwn(e,"bandwidth"),i=hasOwn(e,"startFrequency")||hasOwn(e,"stopFrequency");if(Number(n)+Number(a)+Number(i)>1)return t;let o=resolveSharedState(e,t,r);if(a)return isFiniteNumber(e.frequency)&&isFiniteNumber(e.bandwidth)&&!(e.bandwidth<=0)?{kind:BandKind.CenterBandwidth,...o,frequency:e.frequency,bandwidth:e.bandwidth}:t;if(i)return isFiniteNumber(e.startFrequency)&&isFiniteNumber(e.stopFrequency)&&!(e.stopFrequency<=e.startFrequency)?{kind:BandKind.FrequencyRange,...o,startFrequency:e.startFrequency,stopFrequency:e.stopFrequency}:t;if(n){if(hasOwn(e,"left")&&void 0!==e.left&&!isFiniteNumber(e.left)||hasOwn(e,"width")&&void 0!==e.width&&!isFiniteNumber(e.width))return t;let n=t.kind===BandKind.Position?t:void 0;return{kind:BandKind.Position,...o,left:hasOwn(e,"left")?e.left:"merge"===r?n?.left:void 0,width:hasOwn(e,"width")?e.width??0:"merge"===r?n?.width??0:0}}return{...t,...o}}let AppContext=react.createContext(null),store_context=AppContext;var marker_MarkerMode=/*#__PURE__*/function(e){return e.Normal="normal",e.DDC="ddc",e}({}),marker_MarkerAction=/*#__PURE__*/null,heatmap_HeatmapCaptureType=/*#__PURE__*/function(e){return e.Area="area",e.Slider="slider",e.RowIndex="rowIndex",e}({});let constants_restrictList={dBm:[-300,300],dBμV:[-300,300]},constants_stepList=[5,10,20,30],constants_stepDefault=constants_stepList[2],constants_unitList=["dBμV","dBμV/m","dBm","dBm/m"],constants_RANGE_DEFAULT=[-20,100],zoomRuler=null,axisYTypeList={lite:"lite",inside:"inside",default:""},DEFAULT_MAX_POINTS=1001,ZOOM_INTERVAL_DEFAULT={start:0,end:DEFAULT_MAX_POINTS},DATA_RATE_DEFAULT=1;function createParams(){return{globalID:"",config:getConfig(),system:{width:0,height:0,padding:0,border:!0,borderRadius:!0,onChange:()=>{}},eventBus:{onDoubleClick:()=>{}},axisY:{show:!0,placement:constants_AxisPlacement.Outside,disabled:!1,gradientRibbon:!0,realRange:constants_RANGE_DEFAULT,range:constants_RANGE_DEFAULT,renderRange:constants_RANGE_DEFAULT,restrict:constants_restrictList["dBμV"],autoranging:!1,step:constants_stepDefault,unit:constants_unitList["0"],unitList:constants_unitList,unitDisabled:!1,type:axisYTypeList.default,hidden:[],linkage:!0,onChange:()=>{}},axisX:{show:!0,range:[],unit:"MHz",unitKHz:"kHz",ticks:!0,children:null,onChange:()=>{},frequencyFormat:()=>""},toolbar:{show:!0,hiddenTools:[]},series:{maxPoints:1001,zoomMinSimulateWave:!1,dataRate:1,forceDisplay:!1,legendExternal:[constants_SeriesType.ThresholdData,constants_SeriesType.TemplateData,constants_SeriesType.BackgroundNoiseData],enableMetrics:void 0,enableWaterfall:void 0,enableLengthSyncFastMode:!1},segments:[],points:[],marker:{fixed:!1,enabled:!0,visible:!1,mode:marker_MarkerMode.Normal,maxCount:5,onChange:()=>{}},limit:{disabled:!1,show:!1,active:!0,value:[20],range:constants_restrictList["dBμV"],label:"",onChange:()=>{}},heatmapCapture:{type:heatmap_HeatmapCaptureType.Area,show:!1,display:!1,sync:!1,interval:{startIndex:-1,endIndex:-1},dataNow:[],onChange:()=>{}},waterfallViewport:{range:{x:[0,0],y:[0,0]},sourceSize:{width:0,height:0}},cursor:{show:!0,active:!0,event:null,coord:{left:0,top:0},timeout:0,mode:void 0},zoom:{show:!0,xy:!1,overview:{show:!1},select:!1,interval:ZOOM_INTERVAL_DEFAULT,style:null,isScanSegmentsUpdateMagnify:!1,onChange:()=>{},autoCloseTimeout:31536e6},signal:{show:!0,display:!1,data:[],hiddenCategoryKeys:[],showCount:!0,onChange:()=>{}},signalAnalysis:{show:!0,display:!1,onChange:()=>{}},band:{kind:BandKind.Position,show:!1,left:void 0,width:0,color:""},scope:{show:!1,left:0,width:0,onChange:()=>{}},gridLines:!0,legend:{children:null},frequencyTagLine:{show:!0,display:!1,left:-100,onChange:()=>{}},stripe:{show:!0,display:!1,defaultLeft:40,defaultRight:60,left:40,right:60,onChange:()=>{}},blaze:{show:!1},frequencyAllocation:{show:!0,display:!0,data:[]},timeRange:0,levelStream:{cacheTime:2e4,granularity:1,maxPoints:500},fluorescence:{show:!1,display:!1,renderMode:FluorescenceRenderMode.Gaussian},deltaMeasurement:{show:!0,display:!1,onChange:()=>{}}}}let R=50,dBm2dBuV=e=>e+10*Math.log10(R)+90,dBm2V=e=>Math.sqrt(R*10**(e/10-3)),dBm2mW=e=>10**(e/10),dBuV2dBm=e=>e-90-10*Math.log10(R),dBuV2V=e=>10**(e/20-6),dBuV2uV=e=>1e6*dBuV2V(e),dBuV2mW=e=>10**(e/10-9)/R,V2dBm=e=>e<=0?-200:30+20*Math.log10(e)-10*Math.log10(R),V2dBuV=e=>e<=0?-200:20*(Math.log10(e)+6),V2mW=e=>1e3*e**2/R,mW2dBm=e=>e<=0?-50:10*Math.log10(e),mW2dBuV=e=>e<=0?-200:10*Math.log10(e*R)+90,mW2V=e=>(.001*e*R)**.5,spectrum2dBm=e=>e?e.map(e=>+e||0===e?dBuV2dBm(e):void 0):[],tools_defaultData={flaw:0,offset:0,range:[0,0],renderRange:[0,0]},VIRTUAL_RANGE=(e,t)=>subscription_openData(`VIRTUAL_RANGE-${e}`,t,tools_defaultData);function useVirtualRange({unit:e,realRange:t=[0,0],step:r=1,globalID:n}){let{offset:a,flaw:i}=tools_defaultData,o=[t[0]??0,t[1]??0],l=[t[0]??0,t[1]??0];if(e&&isdBm(e)){let e=dBuV2dBm(0);i=e%r,a=e-i,o=[t[0]+a,t[1]+a],l=[t[0]-i,t[1]-i]}let s={offset:a,range:o,renderRange:l,flaw:i};return VIRTUAL_RANGE(n,s),s}function range2realRange({range:e,unit:t,globalID:r}){let n=e,a=e;if(t&&isdBm(t)){let{offset:t,flaw:i}=VIRTUAL_RANGE(r);a=[(n=[e[0]-t,e[1]-t])[0]-i,n[1]-i]}return{realRange:n,renderRange:a}}function getVirtualLevel(e,t){return isdBm(e)?dBuV2dBm(t):t}function useKeyEvent_subscriptionKeyBus(e,t,r){return subscription_createSubscriptionManager(`useKeyEvent-${e}`,t,r,e)}function isEditableTarget(e){if(!e||!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}let useKeyEventFunc=(e,t)=>r=>{if(!r||isEditableTarget(r.target))return;let n=["a","d","w","s","m"].includes(r.key.toLowerCase()),a=r.ctrlKey||r.altKey;if(!n&&!a)return;let i=document.getElementById(t),o=document.activeElement;!i||!o||(o===i||i.contains(o))&&useKeyEvent_subscriptionKeyBus(e,t)(r)};function useKeyEvent(e,t){external_react_useEffect(()=>{if(e&&t){let r=useKeyEventFunc(e,t);return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}}},[e,t])}let array_0=__webpack_require__("19525"),info2step=e=>{let{min:t,max:r}=e,n=r-t,a=10;switch(!0){case n>=90:a=20;break;case n>=45:a=10;break;default:a=5}return{diff:n,step:a,middle:t+n/2}};class RangeController{state={axisY:{step:constants_stepDefault,realRange:constants_RANGE_DEFAULT,restrict:constants_restrictList["dBμV"]},onChange:()=>{}};constructor(e){this.update(e)}update(e){let t={...this.state,...e};this.state={...t}}setAxisY(e){let{axisY:t}=this.state;this.update({axisY:{...t,...e}})}focus({isHand:e,step:t}={}){let{axisY:r,globalID:n}=this.state,{realRange:a}=r;if(!a||!n)return;let i=withDatabase(n).getAllRawData?.(),o=i[SERIES.realData.name]||new Float32Array,l=i[SERIES.maxData.name]||new Float32Array,s=i[SERIES.minData.name]||new Float32Array,c=[...Array.from(o),...Array.from(l),...Array.from(s)],u=(0,array_0.jy)(c),{avg:d}=u;void 0===d&&(d=10);let h=t||r.step,p=info2step(u),{min:f=0,max:m=0}=u,[g,b]=a,{middle:v}=p;!t&&(e||f<g||b<m)&&(h=p.step);let w=(Math.round(v/h)-5)*h;Number.isNaN(w)&&(w=-20);let y=w+10*h;this.setAxisY({step:h,realRange:[w,y]}),this.onChange()}move(e){let{axisY:{realRange:[t,r],restrict:n}}=this.state;if(r>=n[1]&&e>0||t<=n[0]&&e<0)return;let a=e*(r-t),[i,o]=[t+a,r+a];this.setAxisY({realRange:[i,o]}),this.onChange()}moveBoundary(e,t){let{axisY:{realRange:[r,n],step:a}}=this.state,[i,o]=[r,n];!e&&t&&(o+=a),e&&t&&(o-=a),e||t||(i+=a),e&&!t&&(i-=a),o<=i+1&&(t&&(o=i+1),t||(i=o-1));let l=20*a;o-i>=l&&(t&&(o=i+l),t||(i=o-l)),this.setAxisY({realRange:[i,o]}),this.onChange()}moveWheel(e){let{axisY:{realRange:[t,r]}}=this.state,n=e.currentTarget.getBoundingClientRect(),a=e.clientY-n.top,i=n.height,o=e.deltaY>0?1.1:.9;this.zoom(o,r-a/i*(r-t))}zoom(e,t){let{axisY:{realRange:[r,n],step:a,restrict:i}}=this.state,o={min:t-(t-r)*e,max:t+(n-t)*e},[l,s]=i,c=Math.abs(s-l),u=Math.max(l,o.min),d=Math.min(s,o.max),h=Math.max(Number.EPSILON,Math.min(a/100,c/100));if(d-u<h){let e=(u+d)/2;u=Math.max(l,e-h/2),d=Math.min(s,e+h/2)}this.setAxisY({realRange:[u,d]}),this.onChange()}moveStep(e){let{axisY:{realRange:[t,r],step:n,restrict:a}}=this.state,i=e?n:-n,[o,l]=[t+i,r+i];(e?l>a[1]:o<a[0])&&(o=t,l=r),this.setAxisY({realRange:[o,l]}),this.onChange()}onChange(){let{axisY:{realRange:[e,t],restrict:r,unit:n}}=this.state,a=useVirtualRange({realRange:this.state.axisY.realRange,unit:this.state.axisY.unit,step:this.state.axisY.step,globalID:this.state.globalID}),i=isdBm(n)?a.offset:0,o=e<r[0]-i,l=t>r[1],s=e,c=t;o&&(c=(s=r[0]-i)+(t-e)),l&&([,c]=r),this.setAxisY({realRange:[s,c]}),this.state.onChange(this.state.axisY)}}let useRangeAutoFocus=(e,t)=>subscription_createSubscriptionManager(`useRangeAutoFocus-${e}`,"0",t,e),useRangeMove=(e,t)=>subscription_createSubscriptionManager(`useRangeMove-${e}`,"0",t,e),useRangeZoom=(e,t)=>subscription_createSubscriptionManager(`useRangeZoom-${e}`,"0",t,e),useRangeSet=(e,t)=>subscription_createSubscriptionManager(`useRangeSet-${e}`,"0",t,e),useRanging_ranging=RangeController,useRange=({chart:e})=>{let{state:{axisY:t,series:r,globalID:n},dispatch:a}=useStore_useStore(),{realRange:i,renderRange:o,step:l,unit:s,onChange:c,autoranging:u,disabled:d}=t,h=external_react_useMemo(()=>new useRanging_ranging({axisY:t}),[t]);external_react_useEffect(()=>{n&&h.update?.({globalID:n})},[n,h]),external_react_useEffect(()=>{h.update?.({axisY:t})},[h,JSON.stringify(t)]),external_react_useEffect(()=>{h.update?.({series:r})},[h,JSON.stringify(r)]);let p=external_react_useCallback(e=>{if(n){let t=useVirtualRange({unit:s,...e,globalID:n});a({payload:r=>({axisY:{...r.axisY,realRange:e.realRange,step:e.step,range:t.range,renderRange:t.renderRange}})}),c?.({range:t.range,step:e.step})}},[s,c,n,a]);return external_react_useEffect(()=>{h.state.onChange=e=>{p(e)}},[h,p]),external_react_useEffect(()=>{p({realRange:i,step:l}),h?.update({unit:s})},[s]),external_react_useEffect(()=>{o&&e?.setRange?.(o)},[e,o]),external_react_useEffect(()=>{n&&useRangeAutoFocus(n,()=>{h?.focus()})},[n,h]),external_react_useEffect(()=>{h?.focus({step:l})},[l]),external_react_useEffect(()=>{e?.updateParams?.({autoranging:u})},[u]),external_react_useEffect(()=>{n&&useRangeMove(n,e=>{d||h.move?.(e)})},[h,n,d]),external_react_useEffect(()=>{if(n)return useRangeZoom(n,(e,t)=>{d||h.zoom?.(e,t)})},[h,n,d]),external_react_useEffect(()=>{n&&useKeyEvent_subscriptionKeyBus(n,"ticks",e=>{"ArrowUp"===e.code&&h.move?.(.1),"ArrowDown"===e.code&&h.move?.(-.1)})},[h,n]),h},spectrum_useRanging=useRange;function mergeParameter(e,t,r){let n=(r||createParams())[e];return t?"object"!=typeof t||null===t?t:mergeObjects(n,t):n}function normalizeAxisYProps(e){return e&&void 0!==e.unit&&void 0===e.unitDisabled?{...e,unitDisabled:!0}:e}let PARAM_NAMES=["axisX","legend","marker","limit","heatmapCapture","zoom","cursor","signal","scope","eventBus","blaze","stripe","signalAnalysis","series","frequencyTagLine","frequencyAllocation","toolbar","gauge","band","levelStream","fluorescence","onChannelChange"],Params=e=>{let t=useContext(store_context);if(!t)throw Error("Params must be used within a StoreProvider");let{dispatch:r,store:n}=t,a=useSyncExternalStore(n.subscribe,()=>n.getState().globalID,()=>n.getState().globalID),i=external_react_useRef({});return external_react_useEffect(()=>{let t={},a=!1,o=n.getState();for(let r of PARAM_NAMES){let n=e[r],l=i.current[r];if(void 0!==n&&n!==l){if("band"===r){let e=resolveBandState(n,o.band,"merge");e!==o.band&&(t.band=e,a=!0);continue}t[r]=mergeParameter(r,n,o),a=!0}}i.current={...e},a&&r({payload:t})},[r,e.axisX,e.legend,e.marker,e.limit,e.heatmapCapture,e.zoom,e.cursor,e.signal,e.scope,e.eventBus,e.blaze,e.stripe,e.signalAnalysis,e.series,e.frequencyTagLine,e.frequencyAllocation,e.toolbar,e.gauge,e.band,e.levelStream,e.fluorescence,e.onChannelChange,n]),external_react_useEffect(()=>{void 0!==e.gridLines&&r({payload:{gridLines:e.gridLines}})},[e.gridLines]),external_react_useEffect(()=>{let t=normalizeAxisYProps(e.axisY);if(t&&a){let e=n.getState(),{range:i,unit:o}=t,l=e.axisY.range,s=e.axisY.unit;if(i?.[0]!==void 0&&(o&&isdBm(o)&&s!==o||i[0]!==l[0]&&isdBm(s))){let{realRange:n,renderRange:l}=range2realRange({range:i,unit:o,globalID:a});r({payload:{axisY:mergeParameter("axisY",{...t,realRange:n,renderRange:l},e)}})}else o||isdBm(e.axisY.unit)||!i?r({payload:{axisY:mergeParameter("axisY",t,e)}}):r({payload:{axisY:mergeParameter("axisY",{...t,realRange:i,renderRange:i},e)}})}},[r,a,e.axisY,n]),null},store_Params=Params,resolvePayload=(e,t)=>"function"==typeof t?t(e):t,reducer_reducer=(e,t)=>{let r=resolvePayload(e,t.payload);if(!r)return e;if(t.replace)return r;let n=Object.keys(r);return n.length>0&&n.every(t=>Object.is(e[t],r[t]))?e:{...e,...r}};function createChartStore(e){let t=e,r=new Set,n=e=>{if(Object.is(e,t))return t;for(let n of(t=e,Array.from(r)))n();return t},a=e=>n(e(t));return{dispatch:e=>a(t=>reducer_reducer(t,e)),getState:()=>t,setState:n,subscribe:e=>(r.add(e),()=>{r.delete(e)}),updateState:a}}let runtimeRegistry=new Map,runtime_getChartRuntime=e=>e?runtimeRegistry.get(e)??null:null;function createChartRuntime(e){let t=createChartStore(e),r=new Set,n=e.globalID,a=!1,i={destroy:()=>{if(!a){for(let e of(a=!0,Array.from(r)))e();r.clear(),n&&runtimeRegistry.get(n)===i&&runtimeRegistry.delete(n)}},dispatch:e=>t.dispatch(e),getGlobalID:()=>n,getState:()=>t.getState(),registerCleanup:e=>{if(!e)return null;let t=!1,n=()=>{t||(t=!0,r.delete(n),e())};return r.add(n),n},setGlobalID:e=>{!a&&e!==n&&(n&&runtimeRegistry.get(n)===i&&runtimeRegistry.delete(n),(n=e)&&runtimeRegistry.set(n,i))},store:t,subscribe:t.subscribe};return n&&runtimeRegistry.set(n,i),i}let scheduleRuntimeCleanup=e=>{let t=!1;return queueMicrotask(()=>{t||e()}),()=>{t=!0}};function useAppContext(){let e=useContext(store_context);if(!e)throw Error("useStore must be used within a StoreProvider");return e}function useStore_useStore(){let{dispatch:e,runtime:t,store:r}=useAppContext();return{dispatch:e,runtime:t,state:useSyncExternalStore(r.subscribe,r.getState,r.getState),store:r}}function useStore_useSelector(e){let{store:t}=useAppContext();return useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getState()))}function useStoreApi(){return useAppContext()}function useStoreDispatch(){return useAppContext().dispatch}let Store=e=>{let{children:t}=e,r=external_react_useRef(null);if(!r.current){let t=createParams(),n=mergeObjects(t,{...e,axisY:normalizeAxisYProps(e.axisY)});e.band&&(n.band=resolveBandState(e.band,t.band,"merge")),r.current=n}let n=external_react_useRef(null);if(!n.current&&r.current&&(n.current=createChartRuntime(r.current)),!n.current)throw Error("Failed to initialize chart runtime");let a=n.current,{dispatch:i,store:o}=a,l=useSyncExternalStore(o.subscribe,()=>o.getState().globalID,()=>o.getState().globalID),s=external_react_useRef(l),c=external_react_useRef(null);external_react_useEffect(()=>{s.current=l,a.setGlobalID(l)},[l,a]),external_react_useEffect(()=>(c.current?.(),c.current=null,()=>{c.current=scheduleRuntimeCleanup(()=>{a.destroy(),releaseChartsRuntimeOwners([s.current]),c.current=null})}),[a]);let u=external_react_useMemo(()=>({dispatch:i,runtime:a,store:o}),[i,a,o]);return /*#__PURE__*/jsxs(store_context.Provider,{value:u,children:[/*#__PURE__*/jsx_runtime_jsx(store_Params,{...e}),t]})},src_store=Store,Background=({children:e})=>{let{state:{system:{padding:t}}}=useStore_useStore();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full w-full",style:{...CHARTS_SCOPE_STYLE_VARS},[CHARTS_STYLE_SCOPE_ATTRIBUTE]:"true",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-full select-none flex-col overflow-hidden bg-background pt-0 text-foreground",style:{padding:t?"calc(var(--size-gap-base) * 2)":0},children:e})})},components_Background=/*#__PURE__*/react.memo(Background),PUB_SUB=(e,t)=>createPublishSubscriptionManager(e,t),usePublish=({publish:e,resetViewport:t,subscribe:r=()=>{}})=>{let{state:{globalID:n},dispatch:a}=useStore_useStore(),i=external_react_useRef(r),o=external_react_useRef(e),l=external_react_useRef(t);i.current=r,o.current=e,l.current=t;let s=external_react_useCallback(()=>withDatabase(n),[n]);external_react_useEffect(()=>{if(n)return PUB_SUB(n,i.current)},[n]),external_react_useEffect(()=>{if(n){let e=PUB_SUB(n);e.getSourceData=s,e.resetViewport=()=>l.current?.(),a({payload:{publish:e}}),o.current?.(e)}},[n,s,a])},publish_usePublish=usePublish;function useSafePublish(){let e=external_react_useRef(null);e.current||(e.current=createEnhancedPublishController());let t=e.current,r=external_react_useMemo(()=>({get current(){return t.enhancedPublish},set current(value){value&&"function"==typeof value&&t.attachPublish(value)}}),[t]);return external_react_useEffect(()=>()=>t.dispose(),[t]),{publish:t.publish,chartRef:r}}let readContainerSize=e=>e?{height:e.offsetHeight,width:e.offsetWidth}:null,hasContainerSizeChanged=(e,t)=>e&&t?e.width!==t.width||e.height!==t.height:e!==t,createNextSystemConfig=(e,t)=>({...e,height:t.height,width:t.width}),Container_Container=e=>{let{children:t,style:r}=e,n=useStoreDispatch(),a=useStore_useSelector(e=>e.system),i=external_react_useMemo(()=>createGUID(),[]),o=external_react_useRef(null),l=external_react_useRef(a),s=external_react_useRef(null),c=external_react_useRef(()=>{});l.current=a,c.current=()=>{i&&PUB_SUB(i)({pstype:constants_PSType.Resize})},external_react_useEffect(()=>{i&&n({payload:{globalID:i}})},[n,i]);let u=external_react_useRef(throttleRequestAnimationFrame(()=>{c.current()}));return external_react_useEffect(()=>{if(!i||!o.current)return;let e=e=>{let t=readContainerSize(o.current);if(!t||!hasContainerSizeChanged(s.current,t))return;s.current=t;let r=createNextSystemConfig(l.current,t);n({payload:{system:r}}),r.onChange(r),e&&t.width>0&&t.height>0&&u.current()};if(e(!1),"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>{e(!0)});return t.observe(o.current),()=>{t?.disconnect()}},[n,i]),/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative h-full w-full select-none",style:r,ref:o,children:/*#__PURE__*/jsx_runtime_jsx(components_Background,{children:t})})},components_Container=Container_Container,RENDER_PSTYPE="render",normalizeRenderPublishEvent=(e,t={})=>{let{allowImplicitRender:r=!1,renderPSTypes:n=[]}=t;return e.pstype===RENDER_PSTYPE?e:void 0===e.pstype?r?{...e,pstype:RENDER_PSTYPE}:e:n.includes(e.pstype)?{...e,pstype:RENDER_PSTYPE}:e},useIsomorphicLayoutEffect="u">typeof window?useLayoutEffect:external_react_useEffect,Square=({children:e})=>{let t=external_react_useRef(null),r=external_react_useRef(null),n=external_react_useRef(null),a=external_react_useCallback(()=>{if(r.current&&t.current){let e=Math.min(t.current.clientWidth,t.current.clientHeight);n.current!==e&&(n.current=e,r.current.style.width=`${e}px`,r.current.style.height=`${e}px`)}},[]);return useIsomorphicLayoutEffect(()=>{if(!t.current)return;a();let e=new ResizeObserver(()=>{t.current&&a()});return e.observe(t.current),()=>{e.disconnect()}},[a]),/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative h-full min-h-0 w-full min-w-0 overflow-hidden",ref:t,children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute inset-0 m-auto flex box-border items-center justify-center",ref:r,children:/*#__PURE__*/jsx_runtime_jsx(components_Background,{children:e})})})},components_Square=Square;function clsx_r(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=clsx_r(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function clsx(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}let dist_clsx=null,concatArrays=(e,t)=>{let r=Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},createClassValidatorObject=(e,t)=>({classGroupId:e,validator:t}),createClassPartObject=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),CLASS_PART_SEPARATOR="-",EMPTY_CONFLICTS=[],ARBITRARY_PROPERTY_PREFIX="arbitrary..",createClassGroupUtils=e=>{let t=createClassMap(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return getGroupIdForArbitraryProperty(e);let r=e.split(CLASS_PART_SEPARATOR),n=+(""===r[0]&&r.length>1);return getGroupRecursive(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=n[e],a=r[e];return t?a?concatArrays(a,t):t:a||EMPTY_CONFLICTS}return r[e]||EMPTY_CONFLICTS}}},getGroupRecursive=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let n=e[t],a=r.nextPart.get(n);if(a){let r=getGroupRecursive(e,t+1,a);if(r)return r}let i=r.validators;if(null===i)return;let o=0===t?e.join(CLASS_PART_SEPARATOR):e.slice(t).join(CLASS_PART_SEPARATOR),l=i.length;for(let e=0;e<l;e++){let t=i[e];if(t.validator(o))return t.classGroupId}},getGroupIdForArbitraryProperty=e=>{let t,r,n;return -1===e.slice(1,-1).indexOf(":")?void 0:(r=(t=e.slice(1,-1)).indexOf(":"),(n=t.slice(0,r))?ARBITRARY_PROPERTY_PREFIX+n:void 0)},createClassMap=e=>{let{theme:t,classGroups:r}=e;return processClassGroups(r,t)},processClassGroups=(e,t)=>{let r=createClassPartObject();for(let n in e)processClassesRecursively(e[n],r,n,t);return r},processClassesRecursively=(e,t,r,n)=>{let a=e.length;for(let i=0;i<a;i++)processClassDefinition(e[i],t,r,n)},processClassDefinition=(e,t,r,n)=>{"string"==typeof e?processStringDefinition(e,t,r):"function"==typeof e?processFunctionDefinition(e,t,r,n):processObjectDefinition(e,t,r,n)},processStringDefinition=(e,t,r)=>{(""===e?t:getPart(t,e)).classGroupId=r},processFunctionDefinition=(e,t,r,n)=>{isThemeGetter(e)?processClassesRecursively(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(createClassValidatorObject(r,e)))},processObjectDefinition=(e,t,r,n)=>{let a=Object.entries(e),i=a.length;for(let e=0;e<i;e++){let[i,o]=a[e];processClassesRecursively(o,getPart(t,i),r,n)}},getPart=(e,t)=>{let r=e,n=t.split(CLASS_PART_SEPARATOR),a=n.length;for(let e=0;e<a;e++){let t=n[e],a=r.nextPart.get(t);a||(a=createClassPartObject(),r.nextPart.set(t,a)),r=a}return r},isThemeGetter=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,createLruCache=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),a=(a,i)=>{r[a]=i,++t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},IMPORTANT_MODIFIER="!",MODIFIER_SEPARATOR=":",EMPTY_MODIFIERS=[],createResultObject=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),createParseClassName=e=>{let{prefix:t,experimentalParseClassName:r}=e,n=e=>{let t,r=[],n=0,a=0,i=0,o=e.length;for(let l=0;l<o;l++){let o=e[l];if(0===n&&0===a){if(o===MODIFIER_SEPARATOR){r.push(e.slice(i,l)),i=l+1;continue}if("/"===o){t=l;continue}}"["===o?n++:"]"===o?n--:"("===o?a++:")"===o&&a--}let l=0===r.length?e:e.slice(i),s=l,c=!1;return l.endsWith(IMPORTANT_MODIFIER)?(s=l.slice(0,-1),c=!0):l.startsWith(IMPORTANT_MODIFIER)&&(s=l.slice(1),c=!0),createResultObject(r,c,s,t&&t>i?t-i:void 0)};if(t){let e=t+MODIFIER_SEPARATOR,r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):createResultObject(EMPTY_MODIFIERS,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n},createSortModifiers=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{let r=[],n=[];for(let a=0;a<e.length;a++){let i=e[a],o="["===i[0],l=t.has(i);o||l?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(i)):n.push(i)}return n.length>0&&(n.sort(),r.push(...n)),r}},createConfigUtils=e=>({cache:createLruCache(e.cacheSize),parseClassName:createParseClassName(e),sortModifiers:createSortModifiers(e),postfixLookupClassGroupIds:createPostfixLookupClassGroupIds(e),...createClassGroupUtils(e)}),createPostfixLookupClassGroupIds=e=>{let t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let e=0;e<r.length;e++)t[r[e]]=!0;return t},SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i,postfixLookupClassGroupIds:o}=t,l=[],s=e.trim().split(SPLIT_CLASSES_REGEX),c="";for(let e=s.length-1;e>=0;e-=1){let t,u=s[e],{isExternal:d,modifiers:h,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:m}=r(u);if(d){c=u+(c.length>0?" "+c:c);continue}let g=!!m;if(g){let e=(t=n(f.substring(0,m)))&&o[t]?n(f):void 0;e&&e!==t&&(t=e,g=!1)}else t=n(f);if(!t){if(!g||!(t=n(f))){c=u+(c.length>0?" "+c:c);continue}g=!1}let b=0===h.length?"":1===h.length?h[0]:i(h).join(":"),v=p?b+IMPORTANT_MODIFIER:b,w=v+t;if(l.indexOf(w)>-1)continue;l.push(w);let y=a(t,g);for(let e=0;e<y.length;++e){let t=y[e];l.push(v+t)}c=u+(c.length>0?" "+c:c)}return c},twJoin=(...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=toValue(t))&&(a&&(a+=" "),a+=r);return a},toValue=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=toValue(e[n]))&&(r&&(r+=" "),r+=t);return r},createTailwindMerge=(e,...t)=>{let r,n,a,i,o=e=>{let t=n(e);if(t)return t;let i=mergeClassList(e,r);return a(e,i),i};return i=l=>(n=(r=createConfigUtils(t.reduce((e,t)=>t(e),e()))).cache.get,a=r.cache.set,i=o,o(l)),(...e)=>i(twJoin(...e))},fallbackThemeArr=[],fromTheme=e=>{let t=t=>t[e]||fallbackThemeArr;return t.isThemeGetter=!0,t},arbitraryValueRegex=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,arbitraryVariableRegex=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fractionRegex=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,tshirtUnitRegex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lengthUnitRegex=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,colorFunctionRegex=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,shadowRegex=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,imageRegex=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,isFraction=e=>fractionRegex.test(e),isNumber=e=>!!e&&!Number.isNaN(Number(e)),isInteger=e=>!!e&&Number.isInteger(Number(e)),isPercent=e=>e.endsWith("%")&&isNumber(e.slice(0,-1)),isTshirtSize=e=>tshirtUnitRegex.test(e),isAny=()=>!0,isLengthOnly=e=>lengthUnitRegex.test(e)&&!colorFunctionRegex.test(e),isNever=()=>!1,isShadow=e=>shadowRegex.test(e),isImage=e=>imageRegex.test(e),isAnyNonArbitrary=e=>!isArbitraryValue(e)&&!isArbitraryVariable(e),isNamedContainerQuery=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),isArbitrarySize=e=>getIsArbitraryValue(e,isLabelSize,isNever),isArbitraryValue=e=>arbitraryValueRegex.test(e),isArbitraryLength=e=>getIsArbitraryValue(e,isLabelLength,isLengthOnly),isArbitraryNumber=e=>getIsArbitraryValue(e,isLabelNumber,isNumber),isArbitraryWeight=e=>getIsArbitraryValue(e,isLabelWeight,isAny),isArbitraryFamilyName=e=>getIsArbitraryValue(e,isLabelFamilyName,isNever),isArbitraryPosition=e=>getIsArbitraryValue(e,isLabelPosition,isNever),isArbitraryImage=e=>getIsArbitraryValue(e,isLabelImage,isImage),isArbitraryShadow=e=>getIsArbitraryValue(e,isLabelShadow,isShadow),isArbitraryVariable=e=>arbitraryVariableRegex.test(e),isArbitraryVariableLength=e=>getIsArbitraryVariable(e,isLabelLength),isArbitraryVariableFamilyName=e=>getIsArbitraryVariable(e,isLabelFamilyName),isArbitraryVariablePosition=e=>getIsArbitraryVariable(e,isLabelPosition),isArbitraryVariableSize=e=>getIsArbitraryVariable(e,isLabelSize),isArbitraryVariableImage=e=>getIsArbitraryVariable(e,isLabelImage),isArbitraryVariableShadow=e=>getIsArbitraryVariable(e,isLabelShadow,!0),isArbitraryVariableWeight=e=>getIsArbitraryVariable(e,isLabelWeight,!0),getIsArbitraryValue=(e,t,r)=>{let n=arbitraryValueRegex.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},getIsArbitraryVariable=(e,t,r=!1)=>{let n=arbitraryVariableRegex.exec(e);return!!n&&(n[1]?t(n[1]):r)},isLabelPosition=e=>"position"===e||"percentage"===e,isLabelImage=e=>"image"===e||"url"===e,isLabelSize=e=>"length"===e||"size"===e||"bg-size"===e,isLabelLength=e=>"length"===e,isLabelNumber=e=>"number"===e,isLabelFamilyName=e=>"family-name"===e,isLabelWeight=e=>"number"===e||"weight"===e,isLabelShadow=e=>"shadow"===e,bundle_mjs_validators=/*#__PURE__*/Object.defineProperty({__proto__:null,isAny:isAny,isAnyNonArbitrary:isAnyNonArbitrary,isArbitraryFamilyName:isArbitraryFamilyName,isArbitraryImage:isArbitraryImage,isArbitraryLength:isArbitraryLength,isArbitraryNumber:isArbitraryNumber,isArbitraryPosition:isArbitraryPosition,isArbitraryShadow:isArbitraryShadow,isArbitrarySize:isArbitrarySize,isArbitraryValue:isArbitraryValue,isArbitraryVariable:isArbitraryVariable,isArbitraryVariableFamilyName:isArbitraryVariableFamilyName,isArbitraryVariableImage:isArbitraryVariableImage,isArbitraryVariableLength:isArbitraryVariableLength,isArbitraryVariablePosition:isArbitraryVariablePosition,isArbitraryVariableShadow:isArbitraryVariableShadow,isArbitraryVariableSize:isArbitraryVariableSize,isArbitraryVariableWeight:isArbitraryVariableWeight,isArbitraryWeight:isArbitraryWeight,isFraction:isFraction,isInteger:isInteger,isNamedContainerQuery:isNamedContainerQuery,isNumber:isNumber,isPercent:isPercent,isTshirtSize:isTshirtSize},Symbol.toStringTag,{value:"Module"}),getDefaultConfig=()=>{let e=fromTheme("color"),t=fromTheme("font"),r=fromTheme("text"),n=fromTheme("font-weight"),a=fromTheme("tracking"),i=fromTheme("leading"),o=fromTheme("breakpoint"),l=fromTheme("container"),s=fromTheme("spacing"),c=fromTheme("radius"),u=fromTheme("shadow"),d=fromTheme("inset-shadow"),h=fromTheme("text-shadow"),p=fromTheme("drop-shadow"),f=fromTheme("blur"),m=fromTheme("perspective"),g=fromTheme("aspect"),b=fromTheme("ease"),v=fromTheme("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],x=()=>[...y(),isArbitraryVariable,isArbitraryValue],k=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],D=()=>[isArbitraryVariable,isArbitraryValue,s],M=()=>[isFraction,"full","auto",...D()],F=()=>[isInteger,"none","subgrid",isArbitraryVariable,isArbitraryValue],C=()=>["auto",{span:["full",isInteger,isArbitraryVariable,isArbitraryValue]},isInteger,isArbitraryVariable,isArbitraryValue],E=()=>[isInteger,"auto",isArbitraryVariable,isArbitraryValue],A=()=>["auto","min","max","fr",isArbitraryVariable,isArbitraryValue],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],T=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...D()],z=()=>[isFraction,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],P=()=>[isFraction,"screen","full","dvw","lvw","svw","min","max","fit",...D()],_=()=>[isFraction,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],O=()=>[e,isArbitraryVariable,isArbitraryValue],L=()=>[...y(),isArbitraryVariablePosition,isArbitraryPosition,{position:[isArbitraryVariable,isArbitraryValue]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",isArbitraryVariableSize,isArbitrarySize,{size:[isArbitraryVariable,isArbitraryValue]}],j=()=>[isPercent,isArbitraryVariableLength,isArbitraryLength],H=()=>["","none","full",c,isArbitraryVariable,isArbitraryValue],B=()=>["",isNumber,isArbitraryVariableLength,isArbitraryLength],G=()=>["solid","dashed","dotted","double"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[isNumber,isPercent,isArbitraryVariablePosition,isArbitraryPosition],V=()=>["","none",f,isArbitraryVariable,isArbitraryValue],Y=()=>["none",isNumber,isArbitraryVariable,isArbitraryValue],X=()=>["none",isNumber,isArbitraryVariable,isArbitraryValue],K=()=>[isNumber,isArbitraryVariable,isArbitraryValue],Q=()=>[isFraction,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[isTshirtSize],breakpoint:[isTshirtSize],color:[isAny],container:[isTshirtSize],"drop-shadow":[isTshirtSize],ease:["in","out","in-out"],font:[isAnyNonArbitrary],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[isTshirtSize],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[isTshirtSize],shadow:[isTshirtSize],spacing:["px",isNumber],text:[isTshirtSize],"text-shadow":[isTshirtSize],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",isFraction,isArbitraryValue,isArbitraryVariable,g]}],container:["container"],"container-type":[{"@container":["","normal","size",isArbitraryVariable,isArbitraryValue]}],"container-named":[isNamedContainerQuery],columns:[{columns:[isNumber,isArbitraryValue,isArbitraryVariable,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:x()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[isInteger,"auto",isArbitraryVariable,isArbitraryValue]}],basis:[{basis:[isFraction,"full","auto",l,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[isNumber,isFraction,"auto","initial","none",isArbitraryValue]}],grow:[{grow:["",isNumber,isArbitraryVariable,isArbitraryValue]}],shrink:[{shrink:["",isNumber,isArbitraryVariable,isArbitraryValue]}],order:[{order:[isInteger,"first","last","none",isArbitraryVariable,isArbitraryValue]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...T(),"normal"]}],"justify-self":[{"justify-self":["auto",...T()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...T(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...T(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...T(),"baseline"]}],"place-self":[{"place-self":["auto",...T()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...P()]}],"min-inline-size":[{"min-inline":["auto",...P()]}],"max-inline-size":[{"max-inline":["none",...P()]}],"block-size":[{block:["auto",..._()]}],"min-block-size":[{"min-block":["auto",..._()]}],"max-block-size":[{"max-block":["none",..._()]}],w:[{w:[l,"screen",...z()]}],"min-w":[{"min-w":[l,"screen","none",...z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",r,isArbitraryVariableLength,isArbitraryLength]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,isArbitraryVariableWeight,isArbitraryWeight]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",isPercent,isArbitraryValue]}],"font-family":[{font:[isArbitraryVariableFamilyName,isArbitraryFamilyName,t]}],"font-features":[{"font-features":[isArbitraryValue]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,isArbitraryVariable,isArbitraryValue]}],"line-clamp":[{"line-clamp":[isNumber,"none",isArbitraryVariable,isArbitraryNumber]}],leading:[{leading:[i,...D()]}],"list-image":[{"list-image":["none",isArbitraryVariable,isArbitraryValue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",isArbitraryVariable,isArbitraryValue]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[isNumber,"from-font","auto",isArbitraryVariable,isArbitraryLength]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[isNumber,"auto",isArbitraryVariable,isArbitraryValue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[isInteger,isArbitraryVariable,isArbitraryValue]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",isArbitraryVariable,isArbitraryValue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",isArbitraryVariable,isArbitraryValue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},isInteger,isArbitraryVariable,isArbitraryValue],radial:["",isArbitraryVariable,isArbitraryValue],conic:[isInteger,isArbitraryVariable,isArbitraryValue]},isArbitraryVariableImage,isArbitraryImage]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[isNumber,isArbitraryVariable,isArbitraryValue]}],"outline-w":[{outline:["",isNumber,isArbitraryVariableLength,isArbitraryLength]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",u,isArbitraryVariableShadow,isArbitraryShadow]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",d,isArbitraryVariableShadow,isArbitraryShadow]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[isNumber,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",h,isArbitraryVariableShadow,isArbitraryShadow]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[isNumber,isArbitraryVariable,isArbitraryValue]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[isNumber]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[isArbitraryVariable,isArbitraryValue]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":y()}],"mask-image-conic-pos":[{"mask-conic":[isNumber]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",isArbitraryVariable,isArbitraryValue]}],filter:[{filter:["","none",isArbitraryVariable,isArbitraryValue]}],blur:[{blur:V()}],brightness:[{brightness:[isNumber,isArbitraryVariable,isArbitraryValue]}],contrast:[{contrast:[isNumber,isArbitraryVariable,isArbitraryValue]}],"drop-shadow":[{"drop-shadow":["","none",p,isArbitraryVariableShadow,isArbitraryShadow]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",isNumber,isArbitraryVariable,isArbitraryValue]}],"hue-rotate":[{"hue-rotate":[isNumber,isArbitraryVariable,isArbitraryValue]}],invert:[{invert:["",isNumber,isArbitraryVariable,isArbitraryValue]}],saturate:[{saturate:[isNumber,isArbitraryVariable,isArbitraryValue]}],sepia:[{sepia:["",isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-filter":[{"backdrop-filter":["","none",isArbitraryVariable,isArbitraryValue]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-contrast":[{"backdrop-contrast":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-invert":[{"backdrop-invert":["",isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-opacity":[{"backdrop-opacity":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-saturate":[{"backdrop-saturate":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-sepia":[{"backdrop-sepia":["",isNumber,isArbitraryVariable,isArbitraryValue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",isArbitraryVariable,isArbitraryValue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[isNumber,"initial",isArbitraryVariable,isArbitraryValue]}],ease:[{ease:["linear","initial",b,isArbitraryVariable,isArbitraryValue]}],delay:[{delay:[isNumber,isArbitraryVariable,isArbitraryValue]}],animate:[{animate:["none",v,isArbitraryVariable,isArbitraryValue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,isArbitraryVariable,isArbitraryValue]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:Y()}],"rotate-x":[{"rotate-x":Y()}],"rotate-y":[{"rotate-y":Y()}],"rotate-z":[{"rotate-z":Y()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:K()}],"skew-x":[{"skew-x":K()}],"skew-y":[{"skew-y":K()}],transform:[{transform:[isArbitraryVariable,isArbitraryValue,"","none","gpu","cpu"]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Q()}],"translate-x":[{"translate-x":Q()}],"translate-y":[{"translate-y":Q()}],"translate-z":[{"translate-z":Q()}],"translate-none":["translate-none"],zoom:[{zoom:[isInteger,isArbitraryVariable,isArbitraryValue]}],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",isArbitraryVariable,isArbitraryValue]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":O()}],"scrollbar-track-color":[{"scrollbar-track":O()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",isArbitraryVariable,isArbitraryValue]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[isNumber,isArbitraryVariableLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},mergeConfigs=(e,{cacheSize:t,prefix:r,experimentalParseClassName:n,extend:a={},override:i={}})=>(overrideProperty(e,"cacheSize",t),overrideProperty(e,"prefix",r),overrideProperty(e,"experimentalParseClassName",n),overrideConfigProperties(e.theme,i.theme),overrideConfigProperties(e.classGroups,i.classGroups),overrideConfigProperties(e.conflictingClassGroups,i.conflictingClassGroups),overrideConfigProperties(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),overrideProperty(e,"postfixLookupClassGroups",i.postfixLookupClassGroups),overrideProperty(e,"orderSensitiveModifiers",i.orderSensitiveModifiers),mergeConfigProperties(e.theme,a.theme),mergeConfigProperties(e.classGroups,a.classGroups),mergeConfigProperties(e.conflictingClassGroups,a.conflictingClassGroups),mergeConfigProperties(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),mergeArrayProperties(e,a,"postfixLookupClassGroups"),mergeArrayProperties(e,a,"orderSensitiveModifiers"),e),overrideProperty=(e,t,r)=>{void 0!==r&&(e[t]=r)},overrideConfigProperties=(e,t)=>{if(t)for(let r in t)overrideProperty(e,r,t[r])},mergeConfigProperties=(e,t)=>{if(t)for(let r in t)mergeArrayProperties(e,t,r)},mergeArrayProperties=(e,t,r)=>{let n=t[r];void 0!==n&&(e[r]=e[r]?e[r].concat(n):n)},extendTailwindMerge=(e,...t)=>"function"==typeof e?createTailwindMerge(getDefaultConfig,e,...t):createTailwindMerge(()=>mergeConfigs(getDefaultConfig(),e),...t),twMerge=/*#__PURE__*/createTailwindMerge(getDefaultConfig);function cn_cn(...e){return twMerge(clsx(e))}let areParamValuesEqual=(e,t)=>{let r=e??{},n=Object.keys(r),a=Object.keys(t);return n.length===a.length&&n.every(e=>Object.is(r[e],t[e]))},useChart=e=>{let{state:{globalID:t}}=useStore_useStore(),{Render:r,params:n,onIDChange:a}=e,i=external_react_useMemo(()=>createGUID(),[]),[o,l]=external_react_useState(null),[s,c]=external_react_useState(null),u=external_react_useRef(a),d=external_react_useRef(null),h=external_react_useRef(n);u.current=a,external_react_useEffect(()=>{if(!i||!t||!s)return void l(null);let e=new r({id:i,globalID:t,...n});return l(e),u.current?.(i),()=>{e.dispose?.()}},[r,s,t,i]);let p=external_react_useCallback(e=>{c(t=>t===e?t:e)},[]),f=external_react_useCallback(e=>/*#__PURE__*/jsx_runtime_jsx("div",{id:i,...e,ref:p,className:cn_cn("absolute right-0 top-0 z-[2] flex h-full w-full [&>canvas]:h-full [&>canvas]:w-full [&>canvas]:bg-transparent",e.className)}),[p,i]);return external_react_useEffect(()=>()=>{releaseChartsRuntimeOwners([i])},[i]),external_react_useEffect(()=>{if(o){let e=n??{};if(d.current!==o){d.current=o,h.current=e;return}areParamValuesEqual(h.current??{},e)||(h.current=e,o.updateParams(e))}},[n,o]),{id:i,chart:o,Chart:f}},hooks_useChart=useChart,passThrough=(e,t,r,n="0")=>createModuleSubscriptionManager(e,t,r,n),MODULE_RENDER_PSTYPE="render",MODULE_RESET_PSTYPE="reset",MODULE_RESIZE_PSTYPE="resize",DEFAULT_RENDER_PSTYPES=[MODULE_RENDER_PSTYPE],matchesRenderEvent=(e,t,r)=>void 0===e.pstype?r:t.includes(e.pstype),handleModuleSubscriptionEvent=(e,{chart:t,eventHandlers:r,extractData:n,handleRender:a,renderPSTypes:i=DEFAULT_RENDER_PSTYPES,treatMissingPSTypeAsRender:o=!1})=>{let{pstype:l}=e;if(l&&r?.[l])return void r[l]?.(e,t);if(l===MODULE_RESET_PSTYPE)return void t.reset();if(l===MODULE_RESIZE_PSTYPE)return void t.resize();if(!matchesRenderEvent(e,i,o))return;if(a)return void a(e,t);let s=n?n(e):e;t.updateSeries?.(s)};function useModuleSubscription({moduleType:e,chart:t,extractData:r,renderPSTypes:n,treatMissingPSTypeAsRender:a,handleRender:i,eventHandlers:o}){let{state:{globalID:l}}=useStore_useStore(),s=external_react_useRef(r),c=external_react_useRef(i),u=external_react_useRef(o),d=external_react_useRef(n),h=n?.join("|")??"__default_render__",p=t?.state?.id??`${e}-${h}`;s.current=r,c.current=i,u.current=o,d.current=n,external_react_useEffect(()=>{if(t&&l)return passThrough(l,e,e=>{handleModuleSubscriptionEvent(e,{chart:t,eventHandlers:u.current,extractData:s.current,handleRender:c.current,renderPSTypes:d.current,treatMissingPSTypeAsRender:a})},p)},[t,l,e,h,p,a])}let hooks_useModuleSubscription=null;class BaseRenderer{state;resizeTimer=null;resizeObserver=null;destroyed=!1;cleanupTasks=new Set;constructor(e){this.state=e,this.init(),this.observeContainerResize()}updateParams(e){this.state={...this.state,...e},this.onParamsUpdated(e)}onParamsUpdated(e){}reset(){this.resize(),this.clear()}resize(){this.state.chart?this.hasRenderableContainerSize()&&this.state.chart?.resize?.():this.initializeChartWhenReady()}clear(){this.state.chart?.clear?.()}destroy(){this.destroyed||(this.beforeDestroy(),this.clearResizeObserver(),this.clearResizeTimer(),this.disposeChartInstance(),this.destroyed=!0)}dispose(){this.destroy()}scheduleResize(e=0){this.clearResizeTimer(),this.resizeTimer=setTimeout(()=>{this.resize(),this.resizeTimer=null},e)}clearResizeTimer(){this.resizeTimer&&(clearTimeout(this.resizeTimer),this.resizeTimer=null)}trackCleanup(e){if(!e)return null;let t=!1,r=()=>{t||(t=!0,this.cleanupTasks.delete(r),e())};return this.cleanupTasks.add(r),r}getContainerElement(){return"u"<typeof document?null:document.getElementById(this.state.id)}getContainerSize(){let e=this.getContainerElement();return e?{width:e.clientWidth,height:e.clientHeight}:null}getMinimumContainerSize(){return{width:1,height:1}}hasRenderableContainerSize(){let e=this.getContainerSize();if(!e)return!1;let t=this.getMinimumContainerSize();return e.width>=t.width&&e.height>=t.height}observeContainerResize(){if("u"<typeof ResizeObserver)return;let e=this.getContainerElement();e&&(this.resizeObserver=new ResizeObserver(()=>{this.state.chart?this.resize():this.initializeChartWhenReady()}),this.resizeObserver.observe(e))}clearResizeObserver(){this.resizeObserver?.disconnect(),this.resizeObserver=null}runCleanupTasks(){let e=Array.from(this.cleanupTasks);for(let t of(this.cleanupTasks.clear(),e))t()}beforeDestroy(){this.runCleanupTasks()}disposeChartInstance(){this.state.chart?.dispose?.(),this.state.chart=null}initializeChartWhenReady(){!this.state.chart&&this.hasRenderableContainerSize()&&this.init()}}let theme_color_canUseDOM=()=>"u">typeof window&&"u">typeof document,resolveThemeTarget=e=>theme_color_canUseDOM()?e instanceof Element?e.closest(CHARTS_STYLE_SCOPE_SELECTOR)??e??document.documentElement:document.querySelector(CHARTS_STYLE_SCOPE_SELECTOR)??document.documentElement:null,getThemeComputedStyles=e=>{let t=resolveThemeTarget(e);return t?getComputedStyle(t):null},getThemePropertyValue=(e,t,r=[])=>{let n=getThemeComputedStyles(t);if(!n)return"";let a=n.getPropertyValue(e).trim();if(a)return a;for(let e of r){let t=n.getPropertyValue(e).trim();if(t)return t}return""},clampOpacity=e=>Math.min(1,Math.max(0,e)),parseHexColor=e=>{let t=e.replace("#","").trim();if(![3,4,6,8].includes(t.length))return null;let r=t.length<=4?t.split("").map(e=>e+e).join(""):t,n=8===r.length,a=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),o=Number.parseInt(r.slice(4,6),16),l=n?Number.parseInt(r.slice(6,8),16)/255:1;return[a,i,o,l].some(e=>Number.isNaN(e))?null:{r:a,g:i,b:o,alpha:l}},parseRgbColor=e=>{let t=e.trim().match(/^rgba?\(\s*([^)]+)\s*\)$/i);if(!t)return null;let[r,n,a,i="1"]=t[1].split(",").map(e=>e.trim()),o={r:Number.parseFloat(r),g:Number.parseFloat(n),b:Number.parseFloat(a),alpha:Number.parseFloat(i)};return Object.values(o).some(e=>Number.isNaN(e))?null:o},withAlpha=(e,t)=>{let r=clampOpacity(t),n=e.startsWith("#")?parseHexColor(e):null,a=n?null:parseRgbColor(e),i=n??a;return i?`rgba(${i.r}, ${i.g}, ${i.b}, ${Number((i.alpha*r).toFixed(4))})`:e},toOpaqueCssColor=e=>{let t=e.startsWith("#")?parseHexColor(e):null,r=t?null:parseRgbColor(e),n=t??r;return n?`rgb(${n.r}, ${n.g}, ${n.b})`:e};function getThemeFillStyle(e){let t=getThemePropertyValue("--foreground",e),r=getThemePropertyValue("--primary",e);return{fillStyle:withAlpha(t,176/255),fillStylePrimary:r,fillStyleTransparentBase:withAlpha(t,16/255)}}let getThemeColor=(e,t,r)=>{let n=getThemePropertyValue(e,r);return void 0!==t?withAlpha(n,t):n},resolveChartsThemeState=()=>{let e=readThemeContract(),t=e.followOS?getSystemTheme():e.theme;return{contractTheme:e.theme,followOS:e.followOS,preference:e.followOS?"system":e.theme,theme:t}};class ChartsThemeRuntime{listeners=new Set;mediaCleanup=null;rootAttributeObserver=null;lastStateKey=null;getStateKey=e=>[e.followOS,e.preference,e.theme,e.contractTheme].join(":");emit=e=>{for(let t of(this.lastStateKey=this.getStateKey(e),Array.from(this.listeners)))t(e)};emitIfChanged=e=>{this.getStateKey(e)!==this.lastStateKey&&this.emit(e)};teardownIfIdle=()=>{this.listeners.size>0||(this.mediaCleanup?.(),this.mediaCleanup=null,this.rootAttributeObserver?.disconnect(),this.rootAttributeObserver=null,this.lastStateKey=null)};ensureMediaSubscription=()=>{if(this.mediaCleanup||!canUseDOM())return;let e=getThemeMedia();if(!e)return;let t=()=>{readThemeContract().followOS&&this.emitIfChanged(resolveChartsThemeState())};e.addEventListener("change",t),this.mediaCleanup=()=>{e.removeEventListener("change",t)}};ensureRootAttributeSubscription=()=>{!this.rootAttributeObserver&&canUseDOM()&&(this.rootAttributeObserver=new MutationObserver(e=>{for(let t of e)if("attributes"===t.type&&("theme"===t.attributeName||t.attributeName===theme_contract_THEME_FOLLOW_OS_KEY)){this.emitIfChanged(resolveChartsThemeState());break}}),this.rootAttributeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["theme",theme_contract_THEME_FOLLOW_OS_KEY]}))};getState=()=>resolveChartsThemeState();subscribe=e=>{this.listeners.add(e),this.ensureMediaSubscription(),this.ensureRootAttributeSubscription();let t=this.getState();return this.lastStateKey=this.getStateKey(t),e(t),()=>{this.listeners.delete(e),this.teardownIfIdle()}};resetForTests=()=>{this.listeners.clear(),this.teardownIfIdle()}}let chartsThemeRuntime=new ChartsThemeRuntime,getChartsThemeState=()=>chartsThemeRuntime.getState(),subscribeChartsThemeChange=e=>chartsThemeRuntime.subscribe(e),resetChartsThemeRuntimeForTests=()=>{chartsThemeRuntime.resetForTests()};class CircularRenderer extends BaseRenderer{getMinimumContainerSize(){return{width:120,height:120}}subscribeToTheme(){this.trackCleanup(subscribeChartsThemeChange(()=>{let e=this.getContainerElement();if(!e)return;let t=getThemeFillStyle(e);this.state.chart?.updateProps?.(t),this.resize()}))}updateSeries(e){this.state.chart?.render?.(e)}}let TOOLBAR_SHELL_CLASS_NAME="relative flex h-10 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground",TOOLBAR_SHELL_STYLE={background:"linear-gradient(to bottom, color-mix(in srgb, var(--background) 100%, transparent), color-mix(in srgb, var(--background) 86%, transparent))",boxShadow:"0 1px 4px color-mix(in srgb, var(--border) 72%, transparent)"},TOOLBAR_ITEMS_CLASS_NAME="flex h-full items-center gap-[var(--size-gap-base)]",TOOLBAR_SEPARATOR_BASE_CLASS_NAME="self-center",TOOLBAR_SEPARATOR_CLASS_NAME=`${TOOLBAR_SEPARATOR_BASE_CLASS_NAME} h-[18px]`,TOOLBAR_GROUP_SEPARATOR_CLASS_NAME=`${TOOLBAR_SEPARATOR_BASE_CLASS_NAME} h-3.5`,TOOLBAR_SURFACE_CLASS_NAME="pointer-events-auto box-border rounded-[var(--radius-group)] bg-secondary text-inherit transition-[background-color,color,opacity] select-none",TOOLBAR_INTERACTIVE_SURFACE_CLASS_NAME="cursor-pointer appearance-none border-0 hover:bg-accent/72 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70 focus-visible:ring-offset-1 focus-visible:ring-offset-background",TOOLBAR_DISABLED_SURFACE_CLASS_NAME="cursor-not-allowed opacity-45 hover:bg-secondary",TOOLBAR_TONE_CLASS_NAME_MAP=null,TOOLBAR_ACTIVE_SURFACE_CLASS_NAME_MAP={default:"data-[active=true]:bg-accent/72 data-[active=true]:text-foreground data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[active=true]:hover:bg-accent/72",primary:"data-[active=true]:bg-accent/72 data-[active=true]:text-primary data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[active=true]:hover:bg-accent/72",warning:"data-[active=true]:bg-warning/10 data-[active=true]:text-warning data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--warning)_24%,transparent)] data-[active=true]:hover:bg-warning/12",destructive:"data-[active=true]:bg-destructive/10 data-[active=true]:text-destructive data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--destructive)_24%,transparent)] data-[active=true]:hover:bg-destructive/12"},TOOLBAR_ICON_TRIGGER_CLASS_NAME="inline-flex h-[26px] min-w-[26px] shrink-0 items-center justify-center",TOOLBAR_ICON_BOX_CLASS_NAME=`${TOOLBAR_SURFACE_CLASS_NAME} ${TOOLBAR_ICON_TRIGGER_CLASS_NAME} px-1 [&_svg]:size-4 [&_svg]:shrink-0 [&>span]:flex [&>span]:items-center [&>span]:justify-center`,TOOLBAR_OUTLINED_SHELL_CLASS_NAME="inline-flex h-[26px] shrink-0 items-stretch overflow-hidden rounded-[var(--radius-group)] border border-solid border-border/60 transition-colors",TOOLBAR_OUTLINED_TRIGGER_CLASS_NAME=`${TOOLBAR_OUTLINED_SHELL_CLASS_NAME} min-w-10 items-center justify-between gap-1 px-[calc(var(--size-gap-base)/2)] hover:bg-accent/72 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70 focus-visible:ring-offset-1 focus-visible:ring-offset-background`,TOOLBAR_OUTLINED_TRIGGER_OPEN_CLASS_NAME="data-[state=open]:bg-accent/72 data-[state=open]:text-foreground data-[state=open]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[state=open]:hover:bg-accent/72",TOOLBAR_INLINE_TRIGGER_CLASS_NAME="inline-flex h-full min-h-0 min-w-0 items-center gap-1 p-0 text-inherit focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70 focus-visible:ring-offset-1 focus-visible:ring-offset-background",TOOLBAR_INLINE_INSET_CLASS_NAME="inline-flex h-full items-center px-[calc(var(--size-gap-base)/2)] text-primary hover:bg-accent/72 data-[state=open]:bg-accent/72 data-[state=open]:hover:bg-accent/72",TOOLBAR_GROUP_CHILD_CLASS_NAME="h-full rounded-none border-0 bg-transparent shadow-none",TOOLBAR_CONTENT_BOX_CLASS_NAME=`${TOOLBAR_SURFACE_CLASS_NAME} inline-flex h-[26px] min-w-[26px] shrink-0 items-center px-1`,TOOLBAR_CONTENT_BODY_CLASS_NAME="inline-flex h-[14px] min-w-0 items-center justify-center text-xs leading-none",TOOLBAR_CONTENT_ICON_CLASS_NAME="w-4 justify-center",TOOLBAR_CONTENT_VALUE_CLASS_NAME="min-w-8 justify-center text-center",TOOLBAR_CONTENT_GRADIENT_CLASS_NAME="w-[60px] justify-stretch",TOOLBAR_TRIGGER_ICON_CLASS_NAME="inline-flex h-full min-w-4 shrink-0 items-center justify-center text-primary",TOOLBAR_GLYPH_CLASS_NAME="inline-flex size-4 shrink-0 items-center justify-center [&_svg]:size-full [&_svg]:shrink-0",TOOLBAR_DROPDOWN_CONTENT_CLASS_NAME="border-border/80 bg-secondary/92 text-foreground shadow-[0_10px_28px_color-mix(in_srgb,var(--background)_60%,transparent)] backdrop-blur-xl";var __defProp=Object.defineProperty,__name=(e,t)=>__defProp(e,"name",{value:t,configurable:!0}),dist_canUseDOM=!!("u">typeof window&&window.document&&window.document.createElement);function dist_composeEventHandlers(e,t,{checkForDefaultPrevented:r=!0}={}){return /* @__PURE__ */__name(function(n){if(e?.(n),!1===r||!n||!n.defaultPrevented)return t?.(n)},"handleEvent")}function getOwnerWindow(e){if(!dist_canUseDOM)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}function getOwnerDocument(e){if(!dist_canUseDOM)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function getActiveElement(e,t=!1){let{activeElement:r}=getOwnerDocument(e);if(!r?.nodeName)return null;if(isFrame(r)&&r.contentDocument)return getActiveElement(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=getOwnerDocument(r).getElementById(e);if(t)return t}}return r}function isFrame(e){return"IFRAME"===e.tagName}__name(dist_composeEventHandlers,"composeEventHandlers"),__name(getOwnerWindow,"getOwnerWindow"),__name(getOwnerDocument,"getOwnerDocument"),__name(getActiveElement,"getActiveElement"),__name(isFrame,"isFrame");var dist_defProp=Object.defineProperty,dist_name=(e,t)=>dist_defProp(e,"name",{value:t,configurable:!0});function setRef(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function dist_composeRefs(...e){return t=>{let r=!1,n=e.map(e=>{let n=setRef(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():setRef(e[t],null)}}}}function dist_useComposedRefs(...e){return __rspack_external_react.useCallback(dist_composeRefs(...e),e)}dist_name(setRef,"setRef"),dist_name(dist_composeRefs,"composeRefs"),dist_name(dist_useComposedRefs,"useComposedRefs");var react_context_dist_defProp=Object.defineProperty,react_context_dist_name=(e,t)=>react_context_dist_defProp(e,"name",{value:t,configurable:!0});function createContext2(e,t){let r=__rspack_external_react.createContext(t);r.displayName=e+"Context";let n=/* @__PURE__ */react_context_dist_name(e=>{let{children:t,...n}=e,a=__rspack_external_react.useMemo(()=>n,Object.values(n));return /* @__PURE__ */jsx_runtime_jsx(r.Provider,{value:a,children:t})},"Provider");function a(n,i={}){let{optional:o=!1}=i,l=__rspack_external_react.useContext(r);if(l)return l;if(void 0!==t)return t;if(!o)throw Error(`\`${n}\` must be used within \`${e}\``)}return n.displayName=e+"Provider",react_context_dist_name(a,"useContext"),[n,a]}function createContextScope(e,t=[]){let r=[];function n(t,n){let a=__rspack_external_react.createContext(n);a.displayName=t+"Context";let i=r.length;r=[...r,n];let o=/* @__PURE__ */react_context_dist_name(t=>{let{scope:r,children:n,...o}=t,l=r?.[e]?.[i]||a,s=__rspack_external_react.useMemo(()=>o,Object.values(o));return /* @__PURE__ */jsx_runtime_jsx(l.Provider,{value:s,children:n})},"Provider");function l(r,o,s={}){let{optional:c=!1}=s,u=o?.[e]?.[i]||a,d=__rspack_external_react.useContext(u);if(d)return d;if(void 0!==n)return n;if(!c)throw Error(`\`${r}\` must be used within \`${t}\``)}return o.displayName=t+"Provider",react_context_dist_name(l,"useContext"),[o,l]}react_context_dist_name(n,"createContext");let a=/* @__PURE__ */react_context_dist_name(()=>{let t=r.map(e=>__rspack_external_react.createContext(e));return /* @__PURE__ */react_context_dist_name(function(r){let n=r?.[e]||t;return __rspack_external_react.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])},"useScope")},"createScope");return a.scopeName=e,[n,composeContextScopes(a,...t)]}function composeContextScopes(...e){let t=e[0];if(1===e.length)return t;let r=/* @__PURE__ */react_context_dist_name(()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return /* @__PURE__ */react_context_dist_name(function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let a=r(e)[`__scope${n}`];return{...t,...a}},{});return __rspack_external_react.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}react_context_dist_name(createContext2,"createContext"),react_context_dist_name(createContextScope,"createContextScope"),react_context_dist_name(composeContextScopes,"composeContextScopes");var IS_DEVELOPMENT=!1,useLayoutEffect2=globalThis?.document?__rspack_external_react.useLayoutEffect:()=>{},react_use_effect_event_dist_defProp=Object.defineProperty,react_use_effect_event_dist_name=(e,t)=>react_use_effect_event_dist_defProp(e,"name",{value:t,configurable:!0}),useReactEffectEvent=__rspack_external_react[" useEffectEvent ".trim().toString()],useReactInsertionEffect=__rspack_external_react[" useInsertionEffect ".trim().toString()];function useEffectEvent(e){if("function"==typeof useReactEffectEvent)return useReactEffectEvent(e);let t=__rspack_external_react.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});return"function"==typeof useReactInsertionEffect?useReactInsertionEffect(()=>{t.current=e}):useLayoutEffect2(()=>{t.current=e}),__rspack_external_react.useMemo(()=>(...e)=>t.current?.(...e),[])}react_use_effect_event_dist_name(useEffectEvent,"useEffectEvent");var react_use_controllable_state_dist_defProp=Object.defineProperty,react_use_controllable_state_dist_name=(e,t)=>react_use_controllable_state_dist_defProp(e,"name",{value:t,configurable:!0}),useInsertionEffect=__rspack_external_react[" useInsertionEffect ".trim().toString()]||useLayoutEffect2;function dist_useControllableState({prop:e,defaultProp:t,onChange:r=/* @__PURE__ */react_use_controllable_state_dist_name(()=>{},"onChange"),caller:n}){let[a,i,o]=useUncontrolledState({defaultProp:t,onChange:r}),l=void 0!==e,s=l?e:a;if(IS_DEVELOPMENT){let t=__rspack_external_react.useRef(void 0!==e);__rspack_external_react.useEffect(()=>{let e=t.current;if(e!==l){let t=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=l},[l,n])}return[s,__rspack_external_react.useCallback(t=>{if(l){let r=isFunction(t)?t(e):t;r!==e&&o.current?.(r)}else i(t)},[l,e,i,o])]}function useUncontrolledState({defaultProp:e,onChange:t}){let[r,n]=__rspack_external_react.useState(e),a=__rspack_external_react.useRef(r),i=__rspack_external_react.useRef(t);return useInsertionEffect(()=>{i.current=t},[t]),__rspack_external_react.useEffect(()=>{a.current!==r&&(i.current?.(r),a.current=r)},[r,a]),[r,n,i]}function isFunction(e){return"function"==typeof e}react_use_controllable_state_dist_name(dist_useControllableState,"useControllableState"),react_use_controllable_state_dist_name(useUncontrolledState,"useUncontrolledState"),react_use_controllable_state_dist_name(isFunction,"isFunction");var SYNC_STATE=Symbol("RADIX:SYNC_STATE");function useControllableStateReducer(e,t,r,n){let{prop:a,defaultProp:i,onChange:o,caller:l}=t,s=void 0!==a,c=useEffectEvent(o);if(IS_DEVELOPMENT){let e=__rspack_external_react.useRef(void 0!==a);__rspack_external_react.useEffect(()=>{let t=e.current;if(t!==s){let e=s?"controlled":"uncontrolled";console.warn(`${l} is changing from ${t?"controlled":"uncontrolled"} to ${e}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}e.current=s},[s,l])}let u=[{...r,state:i}];n&&u.push(n);let[d,h]=__rspack_external_react.useReducer((t,r)=>{if(r.type===SYNC_STATE)return{...t,state:r.state};let n=e(t,r);return s&&!Object.is(n.state,t.state)&&c(n.state),n},...u),p=d.state,f=__rspack_external_react.useRef(p);__rspack_external_react.useEffect(()=>{f.current!==p&&(f.current=p,s||c(p))},[p,f,s]);let m=__rspack_external_react.useMemo(()=>void 0!==a?{...d,state:a}:d,[d,a]);return __rspack_external_react.useEffect(()=>{s&&!Object.is(a,d.state)&&h({type:SYNC_STATE,state:a})},[a,d.state,s]),[m,h]}react_use_controllable_state_dist_name(useControllableStateReducer,"useControllableStateReducer");var react_slot_dist_defProp=Object.defineProperty,react_slot_dist_name=(e,t)=>react_slot_dist_defProp(e,"name",{value:t,configurable:!0});function createSlot(e){let t=__rspack_external_react.forwardRef((t,r)=>{let{children:n,...a}=t,i=null,o=!1,l=[];isLazyComponent(n)&&"function"==typeof use&&(n=use(n._payload)),__rspack_external_react.Children.forEach(n,e=>{if(isSlottable(e)){o=!0;let t="child"in e.props?e.props.child:e.props.children;isLazyComponent(t)&&"function"==typeof use&&(t=use(t._payload)),i=getSlottableElementFromSlottable(e,t),l.push(i?.props?.children)}else l.push(e)}),i?i=__rspack_external_react.cloneElement(i,void 0,l):!o&&1===__rspack_external_react.Children.count(n)&&__rspack_external_react.isValidElement(n)&&(i=n);let s=i?getElementRef(i):void 0,c=dist_useComposedRefs(r,s);if(!i){if(n||0===n)throw Error(o?createSlottableError(e):createSlotError(e));return n}let u=mergeProps(a,i.props??{});return i.type!==__rspack_external_react.Fragment&&(u.ref=r?c:s),__rspack_external_react.cloneElement(i,u)});return t.displayName=`${e}.Slot`,t}react_slot_dist_name(createSlot,"createSlot");var dist_Slot=/* @__PURE__ */null,SLOTTABLE_IDENTIFIER=Symbol.for("radix.slottable");function createSlottable(e){let t=/* @__PURE__ */react_slot_dist_name(e=>"child"in e?e.children(e.child):e.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=SLOTTABLE_IDENTIFIER,t}react_slot_dist_name(createSlottable,"createSlottable");var Slottable=/* @__PURE__ */null,getSlottableElementFromSlottable=/* @__PURE__ */react_slot_dist_name((e,t)=>{if("child"in e.props){let t=e.props.child;return __rspack_external_react.isValidElement(t)?__rspack_external_react.cloneElement(t,void 0,e.props.children(t.props.children)):null}return __rspack_external_react.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function mergeProps(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function getElementRef(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(r=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}function isSlottable(e){return __rspack_external_react.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===SLOTTABLE_IDENTIFIER}react_slot_dist_name(mergeProps,"mergeProps"),react_slot_dist_name(getElementRef,"getElementRef"),react_slot_dist_name(isSlottable,"isSlottable");var REACT_LAZY_TYPE=Symbol.for("react.lazy");function isLazyComponent(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===REACT_LAZY_TYPE&&"_payload"in e&&isPromiseLike(e._payload)}function isPromiseLike(e){return"object"==typeof e&&null!==e&&"then"in e}react_slot_dist_name(isLazyComponent,"isLazyComponent"),react_slot_dist_name(isPromiseLike,"isPromiseLike");var createSlotError=/* @__PURE__ */react_slot_dist_name(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),createSlottableError=/* @__PURE__ */react_slot_dist_name(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),use=__rspack_external_react[" use ".trim().toString()],react_primitive_dist_defProp=Object.defineProperty,react_primitive_dist_name=(e,t)=>react_primitive_dist_defProp(e,"name",{value:t,configurable:!0}),NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dist_Primitive=NODES.reduce((e,t)=>{let r=createSlot(`Primitive.${t}`),n=__rspack_external_react.forwardRef((e,n)=>{let{asChild:a,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),/* @__PURE__ */jsx_runtime_jsx(a?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function dispatchDiscreteCustomEvent(e,t){e&&__rspack_external_react_dom_20ef40a6.flushSync(()=>e.dispatchEvent(t))}react_primitive_dist_name(dispatchDiscreteCustomEvent,"dispatchDiscreteCustomEvent");var Root=null,react_collection_dist_defProp=Object.defineProperty,react_collection_dist_name=(e,t)=>react_collection_dist_defProp(e,"name",{value:t,configurable:!0});function createCollection(e){let t=e+"CollectionProvider",[r,n]=createContextScope(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:/* @__PURE__ */new Map}),o=/* @__PURE__ */react_collection_dist_name(e=>{let{scope:t,children:r}=e,n=__rspack_external_react.useRef(null);return /* @__PURE__ */jsx_runtime_jsx(a,{scope:t,itemMap:__rspack_external_react.useRef(/* @__PURE__ */new Map).current,collectionRef:n,children:r})},"CollectionProvider");o.displayName=t;let l=e+"CollectionSlot",s=createSlot(l),c=__rspack_external_react.forwardRef((e,t)=>{let{scope:r,children:n}=e;return /* @__PURE__ */jsx_runtime_jsx(s,{ref:dist_useComposedRefs(t,i(l,r).collectionRef),children:n})});c.displayName=l;let u=e+"CollectionItemSlot",d="data-radix-collection-item",h=createSlot(u),p=__rspack_external_react.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,o=__rspack_external_react.useRef(null),l=dist_useComposedRefs(t,o),s=i(u,r);return __rspack_external_react.useEffect(()=>(s.itemMap.set(o,{ref:o,...a}),()=>void s.itemMap.delete(o))),/* @__PURE__ */jsx_runtime_jsx(h,{...{[d]:""},ref:l,children:n})});function f(t){let r=i(e+"CollectionConsumer",t);return __rspack_external_react.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])}return p.displayName=u,react_collection_dist_name(f,"useCollection"),[{Provider:o,Slot:c,ItemSlot:p},f,n]}react_collection_dist_name(createCollection,"createCollection");var __instanciated=/* @__PURE__ */new WeakMap,OrderedDict=class _OrderedDict extends Map{static{react_collection_dist_name(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],__instanciated.set(this,!0)}set(e,t){return __instanciated.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),i=this.#e.length,o=toSafeInteger(e),l=o>=0?o:i+o,s=l<0||l>=i?-1:l;if(s===this.size||a&&s===this.size-1||-1===s)return this.set(t,r),this;let c=this.size+ +!a;o<0&&l++;let u=[...this.#e],d=!1;for(let e=l;e<c;e++)if(l===e){let i=u[e];u[e]===t&&(i=u[e+1]),a&&this.delete(t),n=this.get(i),this.set(t,r)}else{d||u[e-1]!==t||(d=!0);let r=u[d?e:e-1],a=n;n=this.get(r),this.delete(r),this.set(r,a)}return this}with(e,t,r){let n=new _OrderedDict(this);return n.insert(e,t,r),n}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=at(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=at(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return at(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(e,t){let r=[],n=0;for(let a of this)Reflect.apply(e,t,[a,n,this])&&r.push(a),n++;return new _OrderedDict(r)}map(e,t){let r=[],n=0;for(let a of this)r.push([a[0],Reflect.apply(e,t,[a,n,this])]),n++;return new _OrderedDict(r)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(e){return new _OrderedDict([...this.entries()].sort(e))}toReversed(){let e=new _OrderedDict;for(let t=this.size-1;t>=0;t--){let r=this.keyAt(t),n=this.get(r);e.set(r,n)}return e}toSpliced(...e){let t=[...this.entries()];return t.splice(...e),new _OrderedDict(t)}slice(e,t){let r=new _OrderedDict,n=this.size-1;if(void 0===e)return r;e<0&&(e+=this.size),void 0!==t&&t>0&&(n=t-1);for(let t=e;t<=n;t++){let e=this.keyAt(t),n=this.get(e);r.set(e,n)}return r}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}};function at(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let r=toSafeIndex(e,t);return -1===r?void 0:e[r]}function toSafeIndex(e,t){let r=e.length,n=toSafeInteger(t),a=n>=0?n:r+n;return a<0||a>=r?-1:a}function toSafeInteger(e){return e!=e||0===e?0:Math.trunc(e)}function createCollection2(e){let t=e+"CollectionProvider",[r,n]=createContextScope(t),[a,i]=r(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new OrderedDict,setItemMap:/* @__PURE__ */react_collection_dist_name(()=>void 0,"setItemMap")}),o=/* @__PURE__ */react_collection_dist_name(({state:e,...t})=>e?/* @__PURE__ */jsx_runtime_jsx(s,{...t,state:e}):/* @__PURE__ */jsx_runtime_jsx(l,{...t}),"CollectionProvider");o.displayName=t;let l=/* @__PURE__ */react_collection_dist_name(e=>{let t=m();return /* @__PURE__ */jsx_runtime_jsx(s,{...e,state:t})},"CollectionInit");l.displayName=t+"Init";let s=/* @__PURE__ */react_collection_dist_name(e=>{let{scope:t,children:r,state:n}=e,i=__rspack_external_react.useRef(null),[o,l]=__rspack_external_react.useState(null),s=dist_useComposedRefs(i,l),[c,u]=n;return __rspack_external_react.useEffect(()=>{if(!o)return;let e=getChildListObserver(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),/* @__PURE__ */jsx_runtime_jsx(a,{scope:t,itemMap:c,setItemMap:u,collectionRef:s,collectionRefObject:i,collectionElement:o,children:r})},"CollectionProviderImpl");s.displayName=t+"Impl";let c=e+"CollectionSlot",u=createSlot(c),d=__rspack_external_react.forwardRef((e,t)=>{let{scope:r,children:n}=e;return /* @__PURE__ */jsx_runtime_jsx(u,{ref:dist_useComposedRefs(t,i(c,r).collectionRef),children:n})});d.displayName=c;let h=e+"CollectionItemSlot",p=createSlot(h),f=__rspack_external_react.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,o=__rspack_external_react.useRef(null),[l,s]=__rspack_external_react.useState(null),c=dist_useComposedRefs(t,o,s),{setItemMap:u}=i(h,r),d=__rspack_external_react.useRef(a);shallowEqual(d.current,a)||(d.current=a);let f=d.current;return __rspack_external_react.useEffect(()=>(u(e=>l?e.has(l)?e.set(l,{...f,element:l}).toSorted(sortByDocumentPosition):(e.set(l,{...f,element:l}),e.toSorted(sortByDocumentPosition)):e),()=>{u(e=>l&&e.has(l)?(e.delete(l),new OrderedDict(e)):e)}),[l,f,u]),/* @__PURE__ */jsx_runtime_jsx(p,{"data-radix-collection-item":"",ref:c,children:n})});function m(){return __rspack_external_react.useState(new OrderedDict)}function g(t){let{itemMap:r}=i(e+"CollectionConsumer",t);return r}return f.displayName=h,react_collection_dist_name(m,"useInitCollection"),react_collection_dist_name(g,"useCollection"),[{Provider:o,Slot:d,ItemSlot:f},{createCollectionScope:n,useCollection:g,useInitCollection:m}]}function shallowEqual(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null==e||null==t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||e[n]!==t[n])return!1;return!0}function isElementPreceding(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function sortByDocumentPosition(e,t){return e[1].element&&t[1].element?isElementPreceding(e[1].element,t[1].element)?-1:1:0}function getChildListObserver(e){return new MutationObserver(t=>{for(let r of t)if("childList"===r.type)return void e()})}react_collection_dist_name(at,"at"),react_collection_dist_name(toSafeIndex,"toSafeIndex"),react_collection_dist_name(toSafeInteger,"toSafeInteger"),react_collection_dist_name(createCollection2,"createCollection"),react_collection_dist_name(shallowEqual,"shallowEqual"),react_collection_dist_name(isElementPreceding,"isElementPreceding"),react_collection_dist_name(sortByDocumentPosition,"sortByDocumentPosition"),react_collection_dist_name(getChildListObserver,"getChildListObserver");var react_direction_dist_defProp=Object.defineProperty,react_direction_dist_name=(e,t)=>react_direction_dist_defProp(e,"name",{value:t,configurable:!0}),DirectionContext=__rspack_external_react.createContext(void 0),DirectionProvider=/* @__PURE__ */null;function useDirection(e){let t=__rspack_external_react.useContext(DirectionContext);return e||t||"ltr"}react_direction_dist_name(useDirection,"useDirection");var dist_Provider=null,react_use_callback_ref_dist_defProp=Object.defineProperty,react_use_callback_ref_dist_name=(e,t)=>react_use_callback_ref_dist_defProp(e,"name",{value:t,configurable:!0});function dist_useCallbackRef(e){let t=__rspack_external_react.useRef(e);return __rspack_external_react.useEffect(()=>{t.current=e}),__rspack_external_react.useMemo(()=>(...e)=>t.current?.(...e),[])}react_use_callback_ref_dist_name(dist_useCallbackRef,"useCallbackRef");var react_dismissable_layer_dist_defProp=Object.defineProperty,react_dismissable_layer_dist_name=(e,t)=>react_dismissable_layer_dist_defProp(e,"name",{value:t,configurable:!0}),CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",DismissableLayerContext=__rspack_external_react.createContext({layers:/* @__PURE__ */new Set,layersWithOutsidePointerEventsDisabled:/* @__PURE__ */new Set,branches:/* @__PURE__ */new Set,dismissableSurfaces:/* @__PURE__ */new Set}),DismissableLayer=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dismissable_layer_dist_name(function(e,t){let{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:n=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:s,...c}=e,u=__rspack_external_react.useContext(DismissableLayerContext),[d,h]=__rspack_external_react.useState(null),p=d?.ownerDocument??globalThis?.document,[,f]=__rspack_external_react.useState({}),m=dist_useComposedRefs(t,h),g=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b?g.indexOf(b):-1,w=d?g.indexOf(d):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,x=w>=v,k=__rspack_external_react.useRef(!1),S=usePointerDownOutside(e=>{i?.(e),l?.(e),e.defaultPrevented||s?.()},{ownerDocument:p,deferPointerDownOutside:n,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:__rspack_external_react.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),D=useFocusOutside(e=>{if(n&&k.current)return;let t=e.target;![...u.branches].some(e=>e.contains(t))&&(o?.(e),l?.(e),e.defaultPrevented||s?.())},p),M=!!d&&w===g.length-1,F=dist_useCallbackRef(e=>{"Escape"===e.key&&(a?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))});return __rspack_external_react.useEffect(()=>{if(M)return p.addEventListener("keydown",F,{capture:!0}),()=>p.removeEventListener("keydown",F,{capture:!0})},[p,M,F]),__rspack_external_react.useEffect(()=>{if(d)return r&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(originalBodyPointerEvents=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),dispatchUpdate(),()=>{r&&(u.layersWithOutsidePointerEventsDisabled.delete(d),0===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=originalBodyPointerEvents))}},[d,p,r,u]),__rspack_external_react.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),dispatchUpdate())},[d,u]),__rspack_external_react.useEffect(()=>{let e=/* @__PURE__ */react_dismissable_layer_dist_name(()=>f({}),"handleUpdate");return document.addEventListener(CONTEXT_UPDATE,e),()=>document.removeEventListener(CONTEXT_UPDATE,e)},[]),/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{...c,ref:m,style:{pointerEvents:y?x?"auto":"none":void 0,...e.style},onFocusCapture:dist_composeEventHandlers(e.onFocusCapture,D.onFocusCapture),onBlurCapture:dist_composeEventHandlers(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:dist_composeEventHandlers(e.onPointerDownCapture,S.onPointerDownCapture)})},"DismissableLayer")),DismissableLayerBranch=/* @__PURE__ */null;function useDismissableLayerSurface(){let e=__rspack_external_react.useContext(DismissableLayerContext),[t,r]=__rspack_external_react.useState(null);return __rspack_external_react.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}react_dismissable_layer_dist_name(useDismissableLayerSurface,"useDismissableLayerSurface");var IS_TRUE=/* @__PURE__ */react_dismissable_layer_dist_name(()=>!0,"IS_TRUE");function usePointerDownOutside(e,t){let{ownerDocument:r=globalThis?.document,deferPointerDownOutside:n=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=IS_TRUE}=t,l=dist_useCallbackRef(e),s=__rspack_external_react.useRef(!1),c=__rspack_external_react.useRef(!1),u=__rspack_external_react.useRef(/* @__PURE__ */new Map),d=__rspack_external_react.useRef(()=>{});return __rspack_external_react.useEffect(()=>{function e(){c.current=!1,a.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function h(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...i].some(e=>e.contains(t))||u.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{c.current&&d.current()},0)}function p(e){c.current&&u.current.set(e.type,!1)}react_dismissable_layer_dist_name(e,"resetOutsideInteraction"),react_dismissable_layer_dist_name(t,"isOutsideInteractionIntercepted"),react_dismissable_layer_dist_name(h,"handleInteractionCapture"),react_dismissable_layer_dist_name(p,"handleInteractionBubble");let f=/* @__PURE__ */react_dismissable_layer_dist_name(i=>{if(i.target&&!s.current){let h=function(){r.removeEventListener("click",d.current);let n=t();e(),n||handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,l,p,{discrete:!0})};if(react_dismissable_layer_dist_name(h,"handleAndDispatchPointerDownOutsideEvent"),!o(i.target)){r.removeEventListener("click",d.current),e(),s.current=!1;return}let p={originalEvent:i};c.current=!0,a.current=n&&0===i.button,u.current.clear(),n&&0===i.button?(r.removeEventListener("click",d.current),d.current=h,r.addEventListener("click",d.current,{once:!0})):h()}else r.removeEventListener("click",d.current),e();s.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let e of m)r.addEventListener(e,h,!0),r.addEventListener(e,p);let g=window.setTimeout(()=>{r.addEventListener("pointerdown",f)},0);return()=>{for(let e of(window.clearTimeout(g),r.removeEventListener("pointerdown",f),r.removeEventListener("click",d.current),m))r.removeEventListener(e,h,!0),r.removeEventListener(e,p)}},[r,l,n,a,i,o]),{onPointerDownCapture:/* @__PURE__ */react_dismissable_layer_dist_name(()=>s.current=!0,"onPointerDownCapture")}}function useFocusOutside(e,t=globalThis?.document){let r=dist_useCallbackRef(e),n=__rspack_external_react.useRef(!1);return __rspack_external_react.useEffect(()=>{let e=/* @__PURE__ */react_dismissable_layer_dist_name(e=>{e.target&&!n.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,r,{originalEvent:e},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:/* @__PURE__ */react_dismissable_layer_dist_name(()=>n.current=!0,"onFocusCapture"),onBlurCapture:/* @__PURE__ */react_dismissable_layer_dist_name(()=>n.current=!1,"onBlurCapture")}}function dispatchUpdate(){let e=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(e)}function handleAndDispatchCustomEvent(e,t,r,{discrete:n}){let a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?dispatchDiscreteCustomEvent(a,i):a.dispatchEvent(i)}react_dismissable_layer_dist_name(usePointerDownOutside,"usePointerDownOutside"),react_dismissable_layer_dist_name(useFocusOutside,"useFocusOutside"),react_dismissable_layer_dist_name(dispatchUpdate,"dispatchUpdate"),react_dismissable_layer_dist_name(handleAndDispatchCustomEvent,"handleAndDispatchCustomEvent");var dist_Root=null,Branch=null,react_focus_guards_dist_defProp=Object.defineProperty,react_focus_guards_dist_name=(e,t)=>react_focus_guards_dist_defProp(e,"name",{value:t,configurable:!0}),dist_count=0,guards=null;function FocusGuards(e){return useFocusGuards(),e.children}function useFocusGuards(){__rspack_external_react.useEffect(()=>{guards||(guards={start:createFocusGuard(),end:createFocusGuard()});let{start:e,end:t}=guards;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),dist_count++,()=>{1===dist_count&&(guards?.start.remove(),guards?.end.remove(),guards=null),dist_count=Math.max(0,dist_count-1)}},[])}function createFocusGuard(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}react_focus_guards_dist_name(FocusGuards,"FocusGuards"),react_focus_guards_dist_name(useFocusGuards,"useFocusGuards"),react_focus_guards_dist_name(createFocusGuard,"createFocusGuard");var react_focus_scope_dist_defProp=Object.defineProperty,react_focus_scope_dist_name=(e,t)=>react_focus_scope_dist_defProp(e,"name",{value:t,configurable:!0}),AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS={bubbles:!1,cancelable:!0},FocusScope=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_focus_scope_dist_name(function(e,t){let{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,s]=__rspack_external_react.useState(null),c=dist_useCallbackRef(a),u=dist_useCallbackRef(i),d=__rspack_external_react.useRef(null),h=dist_useComposedRefs(t,s),p=__rspack_external_react.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;__rspack_external_react.useEffect(()=>{if(n){let e=function(e){if(p.paused||!l)return;let t=e.target;l.contains(t)?d.current=t:dist_focus(d.current,{select:!0})},t=function(e){if(p.paused||!l)return;let t=e.relatedTarget;null!==t&&(l.contains(t)||dist_focus(d.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&dist_focus(l)};react_focus_scope_dist_name(e,"handleFocusIn"),react_focus_scope_dist_name(t,"handleFocusOut"),react_focus_scope_dist_name(r,"handleMutations"),document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[n,l,p.paused]),__rspack_external_react.useEffect(()=>{if(l){focusScopesStack.add(p);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS);l.addEventListener(AUTOFOCUS_ON_MOUNT,c),l.dispatchEvent(t),t.defaultPrevented||(focusFirst(removeLinks(getTabbableCandidates(l)),{select:!0}),document.activeElement===e&&dist_focus(l))}return()=>{l.removeEventListener(AUTOFOCUS_ON_MOUNT,c),setTimeout(()=>{let t=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS);l.addEventListener(AUTOFOCUS_ON_UNMOUNT,u),l.dispatchEvent(t),t.defaultPrevented||dist_focus(e??document.body,{select:!0}),l.removeEventListener(AUTOFOCUS_ON_UNMOUNT,u),focusScopesStack.remove(p)},0)}}},[l,c,u,p]);let f=__rspack_external_react.useCallback(e=>{if(!r&&!n||p.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){let t=e.currentTarget,[n,i]=getTabbableEdges(t);n&&i?e.shiftKey||a!==i?e.shiftKey&&a===n&&(e.preventDefault(),r&&dist_focus(i,{select:!0})):(e.preventDefault(),r&&dist_focus(n,{select:!0})):a===t&&e.preventDefault()}},[r,n,p.paused]);return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{tabIndex:-1,...o,ref:h,onKeyDown:f})},"FocusScope"));function focusFirst(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(dist_focus(n,{select:t}),document.activeElement!==r)return}function getTabbableEdges(e){let t=getTabbableCandidates(e);return[findVisible(t,e),findVisible(t.reverse(),e)]}function getTabbableCandidates(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:/* @__PURE__ */react_focus_scope_dist_name(e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)t.push(r.currentNode);return t}function findVisible(e,t){let r="function"==typeof t.checkVisibility&&t.checkVisibility({checkVisibilityCSS:!0});for(let n of e)if(!(r?!n.checkVisibility({checkVisibilityCSS:!0}):isHidden(n,{upTo:t})))return n}function isHidden(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function isSelectableInput(e){return e instanceof HTMLInputElement&&"select"in e}function dist_focus(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&isSelectableInput(e)&&t&&e.select()}}react_focus_scope_dist_name(focusFirst,"focusFirst"),react_focus_scope_dist_name(getTabbableEdges,"getTabbableEdges"),react_focus_scope_dist_name(getTabbableCandidates,"getTabbableCandidates"),react_focus_scope_dist_name(findVisible,"findVisible"),react_focus_scope_dist_name(isHidden,"isHidden"),react_focus_scope_dist_name(isSelectableInput,"isSelectableInput"),react_focus_scope_dist_name(dist_focus,"focus");var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),(e=arrayRemove(e,t)).unshift(t)},remove(t){e=arrayRemove(e,t),e[0]?.resume()}}}function arrayRemove(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}function removeLinks(e){return e.filter(e=>"A"!==e.tagName)}react_focus_scope_dist_name(createFocusScopesStack,"createFocusScopesStack"),react_focus_scope_dist_name(arrayRemove,"arrayRemove"),react_focus_scope_dist_name(removeLinks,"removeLinks");var react_focus_scope_dist_Root=null;let floating_ui_utils_sides=["top","right","bottom","left"],alignments=null,floating_ui_utils_placements=/*#__PURE__*/null,floating_ui_utils_min=Math.min,floating_ui_utils_max=Math.max,round=Math.round,floor=Math.floor,createCoords=e=>({x:e,y:e}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"};function clamp(e,t,r){return floating_ui_utils_max(e,floating_ui_utils_min(t,r))}function floating_ui_utils_evaluate(e,t){return"function"==typeof e?e(t):e}function floating_ui_utils_getSide(e){return e.split("-")[0]}function floating_ui_utils_getAlignment(e){return e.split("-")[1]}function getOppositeAxis(e){return"x"===e?"y":"x"}function getAxisLength(e){return"y"===e?"height":"width"}function floating_ui_utils_getSideAxis(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function getAlignmentAxis(e){return getOppositeAxis(floating_ui_utils_getSideAxis(e))}function floating_ui_utils_getAlignmentSides(e,t,r){void 0===r&&(r=!1);let n=floating_ui_utils_getAlignment(e),a=getAlignmentAxis(e),i=getAxisLength(a),o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=getOppositePlacement(o)),[o,getOppositePlacement(o)]}function getExpandedPlacements(e){let t=getOppositePlacement(e);return[floating_ui_utils_getOppositeAlignmentPlacement(e),t,floating_ui_utils_getOppositeAlignmentPlacement(t)]}function floating_ui_utils_getOppositeAlignmentPlacement(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let lrPlacement=["left","right"],rlPlacement=["right","left"],tbPlacement=["top","bottom"],btPlacement=["bottom","top"];function getSideList(e,t,r){switch(e){case"top":case"bottom":if(r)return t?rlPlacement:lrPlacement;return t?lrPlacement:rlPlacement;case"left":case"right":return t?tbPlacement:btPlacement;default:return[]}}function getOppositeAxisPlacements(e,t,r,n){let a=floating_ui_utils_getAlignment(e),i=getSideList(floating_ui_utils_getSide(e),"start"===r,n);return a&&(i=i.map(e=>e+"-"+a),t&&(i=i.concat(i.map(floating_ui_utils_getOppositeAlignmentPlacement)))),i}function getOppositePlacement(e){let t=floating_ui_utils_getSide(e);return oppositeSideMap[t]+e.slice(t.length)}function expandPaddingObject(e){var t,r,n,a;return{top:null!=(t=e.top)?t:0,right:null!=(r=e.right)?r:0,bottom:null!=(n=e.bottom)?n:0,left:null!=(a=e.left)?a:0}}function floating_ui_utils_getPaddingObject(e){return"number"!=typeof e?expandPaddingObject(e):{top:e,right:e,bottom:e,left:e}}function floating_ui_utils_rectToClientRect(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function computeCoordsFromPlacement(e,t,r){let n,{reference:a,floating:i}=e,o=floating_ui_utils_getSideAxis(t),l=getAlignmentAxis(t),s=getAxisLength(l),c=floating_ui_utils_getSide(t),u=a.x+a.width/2-i.width/2,d=a.y+a.height/2-i.height/2,h=a[s]/2-i[s]/2;switch(c){case"top":n={x:u,y:a.y-i.height};break;case"bottom":n={x:u,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:d};break;case"left":n={x:a.x-i.width,y:d};break;default:n={x:a.x,y:a.y}}let p=floating_ui_utils_getAlignment(t);return p&&(n[l]+=h*("end"===p?1:-1)*(r&&"y"===o?-1:1)),n}async function detectOverflow(e,t){var r;void 0===t&&(t={});let{x:n,y:a,platform:i,rects:o,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=floating_ui_utils_evaluate(t,e),f=floating_ui_utils_getPaddingObject(p),m=l[h?"floating"===d?"reference":"floating":d],g=floating_ui_utils_rectToClientRect(await i.getClippingRect({element:null==(r=await (null==i.isElement?void 0:i.isElement(m)))||r?m:m.contextElement||await (null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:s})),b="floating"===d?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,v=await (null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),w=await (null==i.isElement?void 0:i.isElement(v))&&await (null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},y=floating_ui_utils_rectToClientRect(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:v,strategy:s}):b);return{top:(g.top-y.top+f.top)/w.y,bottom:(y.bottom-g.bottom+f.bottom)/w.y,left:(g.left-y.left+f.left)/w.x,right:(y.right-g.right+f.right)/w.x}}let MAX_RESET_COUNT=50,computePosition=async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:i=[],platform:o}=r,l=o.detectOverflow?o:{...o,detectOverflow:detectOverflow},s=await (null==o.isRTL?void 0:o.isRTL(t)),c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:d}=computeCoordsFromPlacement(c,n,s),h=n,p=0,f={};for(let r=0;r<i.length;r++){let m=i[r];if(!m)continue;let{name:g,fn:b}=m,{x:v,y:w,data:y,reset:x}=await b({x:u,y:d,initialPlacement:n,placement:h,strategy:a,middlewareData:f,rects:c,platform:l,elements:{reference:e,floating:t}});u=null!=v?v:u,d=null!=w?w:d,f[g]={...f[g],...y},x&&p<MAX_RESET_COUNT&&(p++,"object"==typeof x&&(x.placement&&(h=x.placement),x.rects&&(c=!0===x.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):x.rects),{x:u,y:d}=computeCoordsFromPlacement(c,h,s)),r=-1)}return{x:u,y:d,placement:h,strategy:a,middlewareData:f}},floating_ui_core_arrow=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:i,platform:o,elements:l,middlewareData:s}=t,{element:c,padding:u=0}=floating_ui_utils_evaluate(e,t)||{};if(null==c)return{};let d=floating_ui_utils_getPaddingObject(u),h={x:r,y:n},p=getAlignmentAxis(a),f=getAxisLength(p),m=await o.getDimensions(c),g="y"===p,b=g?"clientHeight":"clientWidth",v=i.reference[f]+i.reference[p]-h[p]-i.floating[f],w=h[p]-i.reference[p],y=await (null==o.getOffsetParent?void 0:o.getOffsetParent(c)),x=y?y[b]:0;x&&await (null==o.isElement?void 0:o.isElement(y))||(x=l.floating[b]||i.floating[f]);let k=x/2-m[f]/2-1,S=floating_ui_utils_min(d[g?"top":"left"],k),D=floating_ui_utils_min(d[g?"bottom":"right"],k),M=x-m[f]-D,F=x/2-m[f]/2+(v/2-w/2),C=clamp(S,F,M),E=!s.arrow&&null!=floating_ui_utils_getAlignment(a)&&F!==C&&i.reference[f]/2-(F<S?S:D)-m[f]/2<0,A=E?F<S?F-S:F-M:0;return{[p]:h[p]+A,data:{[p]:C,centerOffset:F-C-A,...E&&{alignmentOffset:A}},reset:E}}});function getPlacementList(e,t,r){return(e?[...r.filter(t=>getAlignment(t)===e),...r.filter(t=>getAlignment(t)!==e)]:r.filter(e=>getSide(e)===e)).filter(r=>!e||getAlignment(r)===e||!!t&&getOppositeAlignmentPlacement(r)!==r)}let autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var r,n,a;let{rects:i,middlewareData:o,placement:l,platform:s,elements:c}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:h=placements,autoAlignment:p=!0,...f}=evaluate(e,t),m=void 0!==d||h===placements?getPlacementList(d||null,p,h):h,g=(null==(r=o.autoPlacement)?void 0:r.index)||0,b=m[g];if(null==b)return{};if(l!==b)return{reset:{placement:m[0]}};let v=await s.detectOverflow(t,f),w=getAlignmentSides(b,i,await (null==s.isRTL?void 0:s.isRTL(c.floating))),y=[v[getSide(b)],v[w[0]],v[w[1]]],x=[...(null==(n=o.autoPlacement)?void 0:n.overflows)||[],{placement:b,overflows:y}],k=m[g+1];if(k)return{data:{index:g+1,overflows:x},reset:{placement:k}};let S=x.map(e=>{let t=getAlignment(e.placement);return[e.placement,t&&u?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),D=(null==(a=S.filter(e=>e[2].slice(0,getAlignment(e[0])?2:3).every(e=>e<=0))[0])?void 0:a[0])||S[0][0];return D!==l?{data:{index:g+1,overflows:x},reset:{placement:D}}:{}}}},flip=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n,a,i,o;let{placement:l,middlewareData:s,rects:c,initialPlacement:u,platform:d,elements:h}=t,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...w}=floating_ui_utils_evaluate(e,t);if(null!=(r=s.arrow)&&r.alignmentOffset)return{};let y=floating_ui_utils_getSide(l),x=floating_ui_utils_getSideAxis(u),k=floating_ui_utils_getSide(u)===u,S=await (null==d.isRTL?void 0:d.isRTL(h.floating)),D=m||(k||!v?[getOppositePlacement(u)]:getExpandedPlacements(u)),M="none"!==b;!m&&M&&D.push(...getOppositeAxisPlacements(u,v,b,S));let F=[u,...D],C=await d.detectOverflow(t,w),E=[],A=(null==(n=s.flip)?void 0:n.overflows)||[];if(p&&E.push(C[y]),f){let e=floating_ui_utils_getAlignmentSides(l,c,S);E.push(C[e[0]],C[e[1]])}if(A=[...A,{placement:l,overflows:E}],!E.every(e=>e<=0)){let e=((null==(a=s.flip)?void 0:a.index)||0)+1,t=F[e];if(t&&("alignment"!==f||x===floating_ui_utils_getSideAxis(t)||A.every(e=>floating_ui_utils_getSideAxis(e.placement)!==x||e.overflows[0]>0)))return{data:{index:e,overflows:A},reset:{placement:t}};let r=null==(i=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!r)switch(g){case"bestFit":{let e=null==(o=A.filter(e=>{if(M){let t=floating_ui_utils_getSideAxis(e.placement);return t===x||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=u}if(l!==r)return{reset:{placement:r}}}return{}}}};function getSideOffsets(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function isAnySideFullyClipped(e){return floating_ui_utils_sides.some(t=>e[t]>=0)}let hide=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:r,platform:n}=t,{strategy:a="referenceHidden",...i}=floating_ui_utils_evaluate(e,t);switch(a){case"referenceHidden":{let e=getSideOffsets(await n.detectOverflow(t,{...i,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:isAnySideFullyClipped(e)}}}case"escaped":{let e=getSideOffsets(await n.detectOverflow(t,{...i,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:isAnySideFullyClipped(e)}}}default:return{}}}}};function getBoundingRect(e){let t=min(...e.map(e=>e.left)),r=min(...e.map(e=>e.top));return{x:t,y:r,width:max(...e.map(e=>e.right))-t,height:max(...e.map(e=>e.bottom))-r}}function getRectsByLine(e){let t=e.slice().sort((e,t)=>e.y-t.y),r=[],n=null;for(let e=0;e<t.length;e++){let a=t[e];!n||a.y-n.y>n.height/2?r.push([a]):r[r.length-1].push(a),n=a}return r.map(e=>rectToClientRect(getBoundingRect(e)))}let inline=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){let{placement:r,elements:n,rects:a,platform:i,strategy:o}=t,{padding:l=2,x:s,y:c}=evaluate(e,t),u=Array.from(await (null==i.getClientRects?void 0:i.getClientRects(n.reference))||[]);if(!u.length)return{};let d=getRectsByLine(u),h=rectToClientRect(getBoundingRect(u)),p=getPaddingObject(l),f=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&(d[0].left>d[1].right||d[1].left>d[0].right)&&null!=s&&null!=c)return d.find(e=>s>e.left-p.left&&s<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom)||h;if(d.length>=2){if("y"===getSideAxis(r)){let e=d[0],t=d[d.length-1],n="top"===getSide(r),a=e.top,i=t.bottom,o=n?e.left:t.left;return rectToClientRect({x:o,y:a,width:(n?e.right:t.right)-o,height:i-a})}let e="left"===getSide(r),t=max(...d.map(e=>e.right)),n=min(...d.map(e=>e.left)),a=d.filter(r=>e?r.left===n:r.right===t),i=a[0].top;return rectToClientRect({x:n,y:i,width:t-n,height:a[a.length-1].bottom-i})}return h}},floating:n.floating,strategy:o});return a.reference.x!==f.reference.x||a.reference.y!==f.reference.y||a.reference.width!==f.reference.width||a.reference.height!==f.reference.height?{reset:{rects:f}}:{}}}},originSides=/*#__PURE__*/new Set(["left","top"]);async function convertValueToCoords(e,t){let{placement:r,platform:n,elements:a}=e,i=await (null==n.isRTL?void 0:n.isRTL(a.floating)),o=floating_ui_utils_getSide(r),l=floating_ui_utils_getAlignment(r),s="y"===floating_ui_utils_getSideAxis(r),c=originSides.has(o)?-1:1,u=i&&s?-1:1,d=floating_ui_utils_evaluate(t,e),{mainAxis:h,crossAxis:p,alignmentAxis:f}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&"number"==typeof f&&(p="end"===l?-1*f:f),s?{x:p*u,y:h*c}:{x:h*c,y:p*u}}let floating_ui_core_offset=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;let{x:a,y:i,placement:o,middlewareData:l}=t,s=await convertValueToCoords(t,e);return o===(null==(r=l.offset)?void 0:r.placement)&&null!=(n=l.arrow)&&n.alignmentOffset?{}:{x:a+s.x,y:i+s.y,data:{...s,placement:o}}}}},shift=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:n,placement:a,platform:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=floating_ui_utils_evaluate(e,t),u={x:r,y:n},d=await i.detectOverflow(t,c),h=floating_ui_utils_getSideAxis(a),p=getOppositeAxis(h),f=u[p],m=u[h],g=(e,t)=>clamp(t+d["y"===e?"top":"left"],t,t-d["y"===e?"bottom":"right"]);o&&(f=g(p,f)),l&&(m=g(h,m));let b=s.fn({...t,[p]:f,[h]:m});return{...b,data:{x:b.x-r,y:b.y-n,enabled:{[p]:o,[h]:l}}}}}},limitShift=function(e){return void 0===e&&(e={}),{options:e,fn(t){var r,n,a,i;let{x:o,y:l,placement:s,rects:c,middlewareData:u}=t,{offset:d=0,mainAxis:h=!0,crossAxis:p=!0}=floating_ui_utils_evaluate(e,t),f={x:o,y:l},m=floating_ui_utils_getSideAxis(s),g=getOppositeAxis(m),b=f[g],v=f[m],w=floating_ui_utils_evaluate(d,t),y="number"==typeof w?{mainAxis:w,crossAxis:0}:{mainAxis:null!=(r=w.mainAxis)?r:0,crossAxis:null!=(n=w.crossAxis)?n:0};if(h){let e="y"===g?"height":"width",t=c.reference[g]-c.floating[e]+y.mainAxis,r=c.reference[g]+c.reference[e]-y.mainAxis;b<t?b=t:b>r&&(b=r)}if(p){let e="y"===g?"width":"height",t=originSides.has(floating_ui_utils_getSide(s)),r=c.reference[m]-c.floating[e]+(t&&(null==(a=u.offset)?void 0:a[m])||0)+(t?0:y.crossAxis),n=c.reference[m]+c.reference[e]+(t?0:(null==(i=u.offset)?void 0:i[m])||0)-(t?y.crossAxis:0);v<r?v=r:v>n&&(v=n)}return{[g]:b,[m]:v}}}},floating_ui_core_size=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){let r,n,{placement:a,rects:i,platform:o,elements:l}=t,{apply:s=()=>{},...c}=floating_ui_utils_evaluate(e,t),u=await o.detectOverflow(t,c),d=floating_ui_utils_getSide(a),h=floating_ui_utils_getAlignment(a),p="y"===floating_ui_utils_getSideAxis(a),{width:f,height:m}=i.floating;"top"===d||"bottom"===d?(r=d,n=h===(await (null==o.isRTL?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(n=d,r="end"===h?"top":"bottom");let g=m-u.top-u.bottom,b=f-u.left-u.right,v=floating_ui_utils_min(m-u[r],g),w=floating_ui_utils_min(f-u[n],b),y=t.middlewareData.shift,x=!y,k=v,S=w;null!=y&&y.enabled.x&&(S=b),null!=y&&y.enabled.y&&(k=g),x&&!h&&(p?S=f-2*floating_ui_utils_max(u.left,u.right):k=m-2*floating_ui_utils_max(u.top,u.bottom)),await s({...t,availableWidth:S,availableHeight:k});let D=await o.getDimensions(l.floating);return f!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return"u">typeof window}function getNodeName(e){return isNode(e)?(e.nodeName||"").toLowerCase():"#document"}function getWindow(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(e){var t;return null==(t=(isNode(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function isNode(e){return!!hasWindow()&&(e instanceof Node||e instanceof getWindow(e).Node)}function isElement(e){return!!hasWindow()&&(e instanceof Element||e instanceof getWindow(e).Element)}function isHTMLElement(e){return!!hasWindow()&&(e instanceof HTMLElement||e instanceof getWindow(e).HTMLElement)}function isShadowRoot(e){return!(!hasWindow()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof getWindow(e).ShadowRoot)}function isOverflowElement(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=floating_ui_utils_dom_getComputedStyle(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function isTableElement(e){return/^(table|td|th)$/.test(getNodeName(e))}function isTopLayer(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let willChangeRe=/transform|translate|scale|rotate|perspective|filter/,containRe=/paint|layout|strict|content/,isNotNone=e=>!!e&&"none"!==e;function isContainingBlock(e){let t=isElement(e)?floating_ui_utils_dom_getComputedStyle(e):e;return isNotNone(t.transform)||isNotNone(t.translate)||isNotNone(t.scale)||isNotNone(t.rotate)||isNotNone(t.perspective)||!isWebKit()&&(isNotNone(t.backdropFilter)||isNotNone(t.filter))||willChangeRe.test(t.willChange||"")||containRe.test(t.contain||"")}function getContainingBlock(e){let t=getParentNode(e);for(;isHTMLElement(t)&&!isLastTraversableNode(t);){if(isContainingBlock(t))return t;if(isTopLayer(t))break;t=getParentNode(t)}return null}function isWebKit(){return null==isWebKitValue&&(isWebKitValue="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),isWebKitValue}function isLastTraversableNode(e){return/^(html|body|#document)$/.test(getNodeName(e))}function floating_ui_utils_dom_getComputedStyle(e){return getWindow(e).getComputedStyle(e)}function getNodeScroll(e){return isElement(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function getParentNode(e){if("html"===getNodeName(e))return e;let t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){let t=getParentNode(e);return isLastTraversableNode(t)?(e.ownerDocument||e).body:isHTMLElement(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let a=getNearestOverflowAncestor(e),i=a===(null==(n=e.ownerDocument)?void 0:n.body),o=getWindow(a);if(!i)return t.concat(a,getOverflowAncestors(a,[],r));{let e=getFrameElement(o);return t.concat(o,o.visualViewport||[],isOverflowElement(a)?a:[],e&&r?getOverflowAncestors(e):[])}}function getFrameElement(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function getCssDimensions(e){let t=floating_ui_utils_dom_getComputedStyle(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=isHTMLElement(e),i=a?e.offsetWidth:r,o=a?e.offsetHeight:n,l=round(r)!==i||round(n)!==o;return l&&(r=i,n=o),{width:r,height:n,$:l}}function unwrapElement(e){return isElement(e)?e:e.contextElement}function getScale(e){let t=unwrapElement(e);if(!isHTMLElement(t))return createCoords(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:i}=getCssDimensions(t),o=(i?round(r.width):r.width)/n,l=(i?round(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),l&&Number.isFinite(l)||(l=1),{x:o,y:l}}let noOffsets=/*#__PURE__*/createCoords(0);function getVisualOffsets(e){let t=getWindow(e);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:noOffsets}function shouldAddVisualOffsets(e,t,r){return void 0===t&&(t=!1),!!r&&t&&r===getWindow(e)}function floating_ui_dom_getBoundingClientRect(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),i=unwrapElement(e),o=createCoords(1);t&&(n?isElement(n)&&(o=getScale(n)):o=getScale(e));let l=shouldAddVisualOffsets(i,r,n)?getVisualOffsets(i):createCoords(0),s=(a.left+l.x)/o.x,c=(a.top+l.y)/o.y,u=a.width/o.x,d=a.height/o.y;if(i&&n){let e=getWindow(i),t=isElement(n)?getWindow(n):n,r=e,a=getFrameElement(r);for(;a&&t!==r;){let e=getScale(a),t=a.getBoundingClientRect(),n=floating_ui_utils_dom_getComputedStyle(a),i=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;s*=e.x,c*=e.y,u*=e.x,d*=e.y,s+=i,c+=o,a=getFrameElement(r=getWindow(a))}}return floating_ui_utils_rectToClientRect({width:u,height:d,x:s,y:c})}function getWindowScrollBarX(e,t){let r=getNodeScroll(e).scrollLeft;return t?t.left+r:floating_ui_dom_getBoundingClientRect(getDocumentElement(e)).left+r}function getHTMLOffset(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-getWindowScrollBarX(e,r),y:r.top+t.scrollTop}}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,i="fixed"===a,o=getDocumentElement(n),l=!!t&&isTopLayer(t.floating);if(n===o||l&&i)return r;let s={scrollLeft:0,scrollTop:0},c=createCoords(1),u=createCoords(0),d=isHTMLElement(n);if((d||!i)&&(("body"!==getNodeName(n)||isOverflowElement(o))&&(s=getNodeScroll(n)),d)){let e=floating_ui_dom_getBoundingClientRect(n);c=getScale(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}let h=!o||d||i?createCoords(0):getHTMLOffset(o,s);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-s.scrollLeft*c.x+u.x+h.x,y:r.y*c.y-s.scrollTop*c.y+u.y+h.y}}function getClientRects(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function getDocumentRect(e){let t=getNodeScroll(e),r=e.ownerDocument.body,n=floating_ui_utils_max(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=floating_ui_utils_max(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),i=-t.scrollLeft+getWindowScrollBarX(e),o=-t.scrollTop;return"rtl"===floating_ui_utils_dom_getComputedStyle(r).direction&&(i+=floating_ui_utils_max(e.clientWidth,r.clientWidth)-n),{width:n,height:a,x:i,y:o}}let SCROLLBAR_MAX=25;function getViewportRect(e,t,r){void 0===r&&(r="viewport");let n="layoutViewport"===r,a=getWindow(e),i=getDocumentElement(e),o=a.visualViewport,l=i.clientWidth,s=i.clientHeight,c=0,u=0;if(o){let e=!isWebKit()||"fixed"===t;n?e||(c=-o.offsetLeft,u=-o.offsetTop):(l=o.width,s=o.height,e&&(c=o.offsetLeft,u=o.offsetTop))}if(0>=getWindowScrollBarX(i)){let e=i.ownerDocument,t=e.body,r=getComputedStyle(t),n="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,a=Math.abs(i.clientWidth-t.clientWidth-n),o="stable both-edges"===getComputedStyle(i).scrollbarGutter?a/2:a;o<=SCROLLBAR_MAX&&(l-=o)}return{width:l,height:s,x:c,y:u}}function getInnerBoundingClientRect(e,t){let r=floating_ui_dom_getBoundingClientRect(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,i=getScale(e),o=e.clientWidth*i.x,l=e.clientHeight*i.y;return{width:o,height:l,x:a*i.x,y:n*i.y}}function getClientRectFromClippingAncestor(e,t,r){let n;if("viewport"===t||"layoutViewport"===t)n=getViewportRect(e,r,t);else if("document"===t)n=getDocumentRect(getDocumentElement(e));else if(isElement(t))n=getInnerBoundingClientRect(t,r);else{let r=getVisualOffsets(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return floating_ui_utils_rectToClientRect(n)}function getClippingElementAncestors(e,t){let r=t.get(e);if(r)return r;let n=getOverflowAncestors(e,[],!1).filter(e=>isElement(e)&&"body"!==getNodeName(e)),a=null,i="fixed"===floating_ui_utils_dom_getComputedStyle(e).position,o=i?getParentNode(e):e;for(;isElement(o)&&!isLastTraversableNode(o);){let e=floating_ui_utils_dom_getComputedStyle(o),t=isContainingBlock(o),r=a?a.position:i?"fixed":"";t||"fixed"!==r&&("absolute"!==r||"static"!==e.position)?a=e:n=n.filter(e=>e!==o),o=getParentNode(o)}return t.set(e,n),n}function getClippingRect(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,i=[..."clippingAncestors"===r?isTopLayer(t)?[]:getClippingElementAncestors(t,this._c):[].concat(r),n],o=getClientRectFromClippingAncestor(t,i[0],a),l=o.top,s=o.right,c=o.bottom,u=o.left;for(let e=1;e<i.length;e++){let r=getClientRectFromClippingAncestor(t,i[e],a);l=floating_ui_utils_max(r.top,l),s=floating_ui_utils_min(r.right,s),c=floating_ui_utils_min(r.bottom,c),u=floating_ui_utils_max(r.left,u)}return{width:s-u,height:c-l,x:u,y:l}}function getDimensions(e){let{width:t,height:r}=getCssDimensions(e);return{width:t,height:r}}function getRectRelativeToOffsetParent(e,t,r){let n=isHTMLElement(t),a=getDocumentElement(t),i="fixed"===r,o=floating_ui_dom_getBoundingClientRect(e,!0,i,t),l={scrollLeft:0,scrollTop:0},s=createCoords(0);if((n||!i)&&(("body"!==getNodeName(t)||isOverflowElement(a))&&(l=getNodeScroll(t)),n)){let e=floating_ui_dom_getBoundingClientRect(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}!n&&a&&(s.x=getWindowScrollBarX(a));let c=!a||n||i?createCoords(0):getHTMLOffset(a,l);return{x:o.left+l.scrollLeft-s.x-c.x,y:o.top+l.scrollTop-s.y-c.y,width:o.width,height:o.height}}function isStaticPositioned(e){return"static"===floating_ui_utils_dom_getComputedStyle(e).position}function getTrueOffsetParent(e,t){if(!isHTMLElement(e)||"fixed"===floating_ui_utils_dom_getComputedStyle(e).position)return null;if(t)return t(e);let r=e.offsetParent;return getDocumentElement(e)===r&&(r=r.ownerDocument.body),r}function getOffsetParent(e,t){let r=getWindow(e);if(isTopLayer(e))return r;if(!isHTMLElement(e)){let t=getParentNode(e);for(;t&&!isLastTraversableNode(t);){if(isElement(t)&&!isStaticPositioned(t))return t;t=getParentNode(t)}return r}let n=getTrueOffsetParent(e,t);for(;n&&isTableElement(n)&&isStaticPositioned(n);)n=getTrueOffsetParent(n,t);return n&&isLastTraversableNode(n)&&isStaticPositioned(n)&&!isContainingBlock(n)?r:n||getContainingBlock(e)||r}let getElementRects=async function(e){let t=this.getOffsetParent||getOffsetParent,r=this.getDimensions,n=await r(e.floating);return{reference:getRectRelativeToOffsetParent(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function isRTL(e){return"rtl"===floating_ui_utils_dom_getComputedStyle(e).direction}let floating_ui_dom_platform={convertOffsetParentRelativeRectToViewportRelativeRect:convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement:getDocumentElement,getClippingRect:getClippingRect,getOffsetParent:getOffsetParent,getElementRects:getElementRects,getClientRects:getClientRects,getDimensions:getDimensions,getScale:getScale,isElement:isElement,isRTL:isRTL};function rectsAreEqual(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function observeMove(e,t,r){let n,a=null,i=getDocumentElement(e);function o(){var e;clearTimeout(n),null==(e=a)||e.disconnect(),a=null}function l(r,s){void 0===r&&(r=!1),void 0===s&&(s=1),o();let c=e.getBoundingClientRect(),{left:u,top:d,width:h,height:p}=c;if(r||t(),!h||!p)return;let f={rootMargin:-floor(d)+"px "+-floor(i.clientWidth-(u+h))+"px "+-floor(i.clientHeight-(d+p))+"px "+-floor(u)+"px",threshold:floating_ui_utils_max(0,floating_ui_utils_min(1,s))||1},m=!0;function g(t){let r=t[0].intersectionRatio;if(!rectsAreEqual(c,e.getBoundingClientRect()))return l();if(r!==s){if(!m)return l();r?l(!1,r):n=setTimeout(()=>{l(!1,1e-7)},1e3)}m=!1}try{a=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch(e){a=new IntersectionObserver(g,f)}a.observe(e)}let s=getWindow(e),c=()=>l(r);return s.addEventListener("resize",c),l(!0),()=>{s.removeEventListener("resize",c),o()}}function autoUpdate(e,t,r,n){let a;void 0===n&&(n={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,u=unwrapElement(e),d=i||o?[...u?getOverflowAncestors(u):[],...t?getOverflowAncestors(t):[]]:[];d.forEach(e=>{i&&e.addEventListener("scroll",r),o&&e.addEventListener("resize",r)});let h=u&&s?observeMove(u,r,o):null,p=-1,f=null;l&&(f=new ResizeObserver(e=>{let[n]=e;n&&n.target===u&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),r()}),u&&!c&&f.observe(u),t&&f.observe(t));let m=c?floating_ui_dom_getBoundingClientRect(e):null;return c&&function t(){let n=floating_ui_dom_getBoundingClientRect(e);m&&!rectsAreEqual(m,n)&&r(),m=n,a=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==h||h(),null==(e=f)||e.disconnect(),f=null,c&&cancelAnimationFrame(a)}}let floating_ui_dom_detectOverflow=null,floating_ui_dom_offset=floating_ui_core_offset,floating_ui_dom_autoPlacement=null,floating_ui_dom_shift=shift,floating_ui_dom_flip=flip,floating_ui_dom_size=floating_ui_core_size,floating_ui_dom_hide=hide,floating_ui_dom_arrow=floating_ui_core_arrow,floating_ui_dom_inline=null,floating_ui_dom_limitShift=limitShift,floating_ui_dom_computePosition=(e,t,r)=>{let n=new Map,a=null!=r?r:{},i={...floating_ui_dom_platform,...a.platform,_c:n};return computePosition(e,t,{...a,platform:i})};var isClient="u">typeof document,floating_ui_react_dom_noop=function(){},floating_ui_react_dom_index=isClient?__rspack_external_react.useLayoutEffect:floating_ui_react_dom_noop;function deepEqual(e,t){let r,n,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!deepEqual(e[n],t[n]))return!1;return!0}if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!=n--;){let r=a[n];if(("_owner"!==r||!e.$$typeof)&&!deepEqual(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function getDPR(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function roundByDPR(e,t){let r=getDPR(e);return Math.round(t*r)/r}function useLatestRef(e){let t=__rspack_external_react.useRef(e);return floating_ui_react_dom_index(()=>{t.current=e}),t}function useFloating(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:s,open:c}=e,[u,d]=__rspack_external_react.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=__rspack_external_react.useState(n);deepEqual(h,n)||p(n);let[f,m]=__rspack_external_react.useState(null),[g,b]=__rspack_external_react.useState(null),v=__rspack_external_react.useCallback(e=>{e!==k.current&&(k.current=e,m(e))},[]),w=__rspack_external_react.useCallback(e=>{e!==S.current&&(S.current=e,b(e))},[]),y=i||f,x=o||g,k=__rspack_external_react.useRef(null),S=__rspack_external_react.useRef(null),D=__rspack_external_react.useRef(u),M=null!=s,F=useLatestRef(s),C=useLatestRef(a),E=useLatestRef(c),A=__rspack_external_react.useCallback(()=>{if(!k.current||!S.current)return;let e={placement:t,strategy:r,middleware:h};C.current&&(e.platform=C.current),floating_ui_dom_computePosition(k.current,S.current,e).then(e=>{let t={...e,isPositioned:!1!==E.current};N.current&&!deepEqual(D.current,t)&&(D.current=t,__rspack_external_react_dom_20ef40a6.flushSync(()=>{d(t)}))})},[h,t,r,C,E]);floating_ui_react_dom_index(()=>{!1===c&&D.current.isPositioned&&(D.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);let N=__rspack_external_react.useRef(!1);floating_ui_react_dom_index(()=>(N.current=!0,()=>{N.current=!1}),[]),floating_ui_react_dom_index(()=>{if(y&&(k.current=y),x&&(S.current=x),y&&x){if(F.current)return F.current(y,x,A);A()}},[y,x,A,F,M]);let T=__rspack_external_react.useMemo(()=>({reference:k,floating:S,setReference:v,setFloating:w}),[v,w]),I=__rspack_external_react.useMemo(()=>({reference:y,floating:x}),[y,x]),z=__rspack_external_react.useMemo(()=>{let e={position:r,left:0,top:0};if(!I.floating)return e;let t=roundByDPR(I.floating,u.x),n=roundByDPR(I.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...getDPR(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,I.floating,u.x,u.y]);return __rspack_external_react.useMemo(()=>({...u,update:A,refs:T,elements:I,floatingStyles:z}),[u,A,T,I,z])}let arrow$1=e=>({name:"arrow",options:e,fn(t){let{element:r,padding:n}="function"==typeof e?e(t):e;return r&&({}).hasOwnProperty.call(r,"current")?null!=r.current?floating_ui_dom_arrow({element:r.current,padding:n}).fn(t):{}:r?floating_ui_dom_arrow({element:r,padding:n}).fn(t):{}}}),floating_ui_react_dom_offset=(e,t)=>{let r=floating_ui_dom_offset(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_shift=(e,t)=>{let r=floating_ui_dom_shift(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_limitShift=(e,t)=>({fn:floating_ui_dom_limitShift(e).fn,options:[e,t]}),floating_ui_react_dom_flip=(e,t)=>{let r=floating_ui_dom_flip(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_size=(e,t)=>{let r=floating_ui_dom_size(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_autoPlacement=(e,t)=>{let r=autoPlacement$1(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_hide=(e,t)=>{let r=floating_ui_dom_hide(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_inline=(e,t)=>{let r=inline$1(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_arrow=(e,t)=>{let r=arrow$1(e);return{name:r.name,fn:r.fn,options:[e,t]}};var react_arrow_dist_defProp=Object.defineProperty,react_arrow_dist_name=(e,t)=>react_arrow_dist_defProp(e,"name",{value:t,configurable:!0}),Arrow=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_arrow_dist_name(function(e,t){let{children:r,width:n=10,height:a=5,...i}=e;return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.svg,{...i,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:/* @__PURE__ */jsx_runtime_jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),react_arrow_dist_Root=Arrow,react_use_size_dist_defProp=Object.defineProperty,react_use_size_dist_name=(e,t)=>react_use_size_dist_defProp(e,"name",{value:t,configurable:!0});function useSize(e){let[t,r]=__rspack_external_react.useState(void 0);return useLayoutEffect2(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,a;if(!Array.isArray(t)||!t.length)return;let i=t[0];if("borderBoxSize"in i){let e=i.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}react_use_size_dist_name(useSize,"useSize");var react_popper_dist_defProp=Object.defineProperty,react_popper_dist_name=(e,t)=>react_popper_dist_defProp(e,"name",{value:t,configurable:!0}),SIDE_OPTIONS=null,ALIGN_OPTIONS=null,POPPER_NAME="Popper",[createPopperContext,createPopperScope]=createContextScope(POPPER_NAME),[PopperProvider,usePopperContext]=createPopperContext(POPPER_NAME),Popper=/* @__PURE__ */react_popper_dist_name(e=>{let{__scopePopper:t,children:r}=e,[n,a]=__rspack_external_react.useState(null),[i,o]=__rspack_external_react.useState(void 0);return /* @__PURE__ */jsx_runtime_jsx(PopperProvider,{scope:t,anchor:n,onAnchorChange:a,placementState:i,setPlacementState:o,children:r})},"Popper"),ANCHOR_NAME="PopperAnchor",PopperAnchor=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_popper_dist_name(function(e,t){let{__scopePopper:r,virtualRef:n,...a}=e,i=usePopperContext(ANCHOR_NAME,r),o=__rspack_external_react.useRef(null),l=i.onAnchorChange,s=dist_useComposedRefs(t,__rspack_external_react.useCallback(e=>{o.current=e,e&&l(e)},[l])),c=__rspack_external_react.useRef(null);__rspack_external_react.useEffect(()=>{if(!n)return;let e=c.current;c.current=n.current,e!==c.current&&l(c.current)});let u=i.placementState&&getSideAndAlignFromPlacement(i.placementState),d=u?.[0],h=u?.[1];return n?null:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-radix-popper-side":d,"data-radix-popper-align":h,...a,ref:s})},"PopperAnchor")),CONTENT_NAME="PopperContent",[PopperContentProvider,useContentContext]=createPopperContext(CONTENT_NAME),PopperContent=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_popper_dist_name(function(e,t){let{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:s=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:f,...m}=e,g=usePopperContext(CONTENT_NAME,r),[b,v]=__rspack_external_react.useState(null),w=dist_useComposedRefs(t,v),[y,x]=__rspack_external_react.useState(null),k=useSize(y),S=k?.width??0,D=k?.height??0,M="number"==typeof u?u:{top:0,right:0,bottom:0,left:0,...u},F=Array.isArray(c)?c:[c],C=F.length>0,E={padding:M,boundary:F.filter(isNotNull),altBoundary:C},{refs:A,floatingStyles:N,placement:T,isPositioned:I,middlewareData:z}=useFloating({strategy:"fixed",placement:n+("center"!==i?"-"+i:""),whileElementsMounted:/* @__PURE__ */react_popper_dist_name((...e)=>autoUpdate(...e,{animationFrame:"always"===p}),"whileElementsMounted"),elements:{reference:g.anchor},middleware:[floating_ui_react_dom_offset({mainAxis:a+D,alignmentAxis:o}),s&&floating_ui_react_dom_shift({mainAxis:!0,crossAxis:!1,limiter:"partial"===d?floating_ui_react_dom_limitShift():void 0,...E}),s&&floating_ui_react_dom_flip({...E}),floating_ui_react_dom_size({...E,apply:/* @__PURE__ */react_popper_dist_name(({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:i}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${i}px`)},"apply")}),y&&floating_ui_react_dom_arrow({element:y,padding:l}),transformOrigin({arrowWidth:S,arrowHeight:D}),h&&floating_ui_react_dom_hide({strategy:"referenceHidden",...E,boundary:C?E.boundary:void 0})]}),P=g.setPlacementState;useLayoutEffect2(()=>(P(T),()=>{P(void 0)}),[T,P]);let[_,O]=getSideAndAlignFromPlacement(T),L=dist_useCallbackRef(f);useLayoutEffect2(()=>{I&&L?.()},[I,L]);let q=z.arrow?.x,$=z.arrow?.y,j=z.arrow?.centerOffset!==0,[H,B]=__rspack_external_react.useState();return useLayoutEffect2(()=>{b&&B(window.getComputedStyle(b).zIndex)},[b]),/* @__PURE__ */jsx_runtime_jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:I?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:/* @__PURE__ */jsx_runtime_jsx(PopperContentProvider,{scope:r,placedSide:_,placedAlign:O,onArrowChange:x,arrowX:q,arrowY:$,shouldHideArrow:j,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-side":_,"data-align":O,...m,ref:w,style:{...m.style,animation:I?m.style?.animation:"none"}})})})},"PopperContent")),ARROW_NAME="PopperArrow",OPPOSITE_SIDE={top:"bottom",right:"left",bottom:"top",left:"right"},PopperArrow=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_popper_dist_name(function(e,t){let{__scopePopper:r,...n}=e,a=useContentContext(ARROW_NAME,r),i=OPPOSITE_SIDE[a.placedSide];return /* @__PURE__ */jsx_runtime_jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:/* @__PURE__ */jsx_runtime_jsx(react_arrow_dist_Root,{...n,ref:t,style:{...n.style,display:"block"}})})},"PopperArrow"));function isNotNull(e){return null!==e}react_popper_dist_name(isNotNull,"isNotNull");var transformOrigin=/* @__PURE__ */react_popper_dist_name(e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,o=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[s,c]=getSideAndAlignFromPlacement(r),u={start:"0%",center:"50%",end:"100%"}[c],d=(a.arrow?.x??0)+o/2,h=(a.arrow?.y??0)+l/2,p="",f="";return"bottom"===s?(p=i?u:`${d}px`,f=`${-l}px`):"top"===s?(p=i?u:`${d}px`,f=`${n.floating.height+l}px`):"right"===s?(p=`${-l}px`,f=i?u:`${h}px`):"left"===s&&(p=`${n.floating.width+l}px`,f=i?u:`${h}px`),{data:{x:p,y:f}}}}),"transformOrigin");function getSideAndAlignFromPlacement(e){let[t,r="center"]=e.split("-");return[t,r]}react_popper_dist_name(getSideAndAlignFromPlacement,"getSideAndAlignFromPlacement");var Root2=Popper,Anchor=PopperAnchor,Content=PopperContent,dist_Arrow=PopperArrow,react_portal_dist_defProp=Object.defineProperty,react_portal_dist_name=(e,t)=>react_portal_dist_defProp(e,"name",{value:t,configurable:!0}),Portal=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_portal_dist_name(function(e,t){let{container:r,...n}=e,[a,i]=__rspack_external_react.useState(!1);useLayoutEffect2(()=>i(!0),[]);let o=r||a&&globalThis?.document?.body;return o?__rspack_external_react_dom_20ef40a6.createPortal(/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{...n,ref:t}),o):null},"Portal")),react_portal_dist_Root=null,react_presence_dist_defProp=Object.defineProperty,react_presence_dist_name=(e,t)=>react_presence_dist_defProp(e,"name",{value:t,configurable:!0});function useStateMachine(e,t){return __rspack_external_react.useReducer((e,r)=>t[e][r]??e,e)}react_presence_dist_name(useStateMachine,"useStateMachine");var dist_Presence=/* @__PURE__ */react_presence_dist_name(e=>{let{present:t,children:r}=e,n=usePresence(t),a="function"==typeof r?r({present:n.isPresent}):__rspack_external_react.Children.only(r),i=useStableComposedRefs(n.ref,dist_getElementRef(a));return"function"==typeof r||n.isPresent?__rspack_external_react.cloneElement(a,{ref:i}):null},"Presence");function usePresence(e){let[t,r]=__rspack_external_react.useState(),n=__rspack_external_react.useRef(null),a=__rspack_external_react.useRef(e),i=__rspack_external_react.useRef("none"),o=__rspack_external_react.useRef(void 0),[l,s]=useStateMachine(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return __rspack_external_react.useEffect(()=>{"mounted"===l?(i.current=o.current??getAnimationName(n.current),o.current=void 0):i.current="none"},[l]),useLayoutEffect2(()=>{let t=n.current,r=a.current;if(r!==e){let n=i.current,l=getAnimationName(t);e?(o.current=l,s("MOUNT")):"none"===l||t?.display==="none"?s("UNMOUNT"):r&&n!==l?s("ANIMATION_OUT"):s("UNMOUNT"),a.current=e}},[e,s]),useLayoutEffect2(()=>{if(t){let e,r=t.ownerDocument.defaultView??window,o=/* @__PURE__ */react_presence_dist_name(i=>{let o=getAnimationName(n.current).includes(CSS.escape(i.animationName));if(i.target===t&&o&&(s("ANIMATION_END"),!a.current)){let n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},"handleAnimationEnd"),l=/* @__PURE__ */react_presence_dist_name(e=>{e.target===t&&(i.current=getAnimationName(n.current))},"handleAnimationStart");return t.addEventListener("animationstart",l),t.addEventListener("animationcancel",o),t.addEventListener("animationend",o),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",l),t.removeEventListener("animationcancel",o),t.removeEventListener("animationend",o)}}s("ANIMATION_END")},[t,s]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:__rspack_external_react.useCallback(e=>{if(e){let t=getComputedStyle(e);n.current=t,o.current=getAnimationName(t)}else n.current=null;r(e)},[])}}function dist_setRef(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function useStableComposedRefs(...e){let t=__rspack_external_react.useRef(e);return t.current=e,__rspack_external_react.useCallback(e=>{let r=t.current,n=!1,a=r.map(t=>{let r=dist_setRef(t,e);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let e=0;e<a.length;e++){let t=a[e];"function"==typeof t?t():dist_setRef(r[e],null)}}},[])}function getAnimationName(e){return e?.animationName||"none"}function dist_getElementRef(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(r=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}react_presence_dist_name(usePresence,"usePresence"),react_presence_dist_name(dist_setRef,"setRef"),react_presence_dist_name(useStableComposedRefs,"useStableComposedRefs"),react_presence_dist_name(getAnimationName,"getAnimationName"),react_presence_dist_name(dist_getElementRef,"getElementRef");var react_presence_dist_Root=null,react_id_dist_defProp=Object.defineProperty,react_id_dist_name=(e,t)=>react_id_dist_defProp(e,"name",{value:t,configurable:!0}),useReactId=__rspack_external_react[" useId ".trim().toString()]||(()=>void 0),react_id_dist_count=0;function dist_useId(e){let[t,r]=__rspack_external_react.useState(useReactId());return useLayoutEffect2(()=>{e||r(e=>e??String(react_id_dist_count++))},[e]),e||(t?`radix-${t}`:"")}react_id_dist_name(dist_useId,"useId");var react_use_is_hydrated_dist_defProp=Object.defineProperty,react_use_is_hydrated_dist_name=(e,t)=>react_use_is_hydrated_dist_defProp(e,"name",{value:t,configurable:!0}),_isHydrated=!1;function useIsHydrated(){let[e,t]=__rspack_external_react.useState(_isHydrated);return __rspack_external_react.useEffect(()=>{_isHydrated||(_isHydrated=!0,t(!0))},[]),e}react_use_is_hydrated_dist_name(useIsHydrated,"useIsHydrated");var useReactSyncExternalStore=__rspack_external_react[" useSyncExternalStore ".trim().toString()];function dist_subscribe(){return()=>{}}function useIsHydratedModern(){return useReactSyncExternalStore(dist_subscribe,()=>!0,()=>!1)}react_use_is_hydrated_dist_name(dist_subscribe,"subscribe"),react_use_is_hydrated_dist_name(useIsHydratedModern,"useIsHydratedModern");var useIsHydrated2="function"==typeof useReactSyncExternalStore?useIsHydratedModern:useIsHydrated,react_roving_focus_dist_defProp=Object.defineProperty,react_roving_focus_dist_name=(e,t)=>react_roving_focus_dist_defProp(e,"name",{value:t,configurable:!0}),ENTRY_FOCUS="rovingFocusGroup.onEntryFocus",dist_EVENT_OPTIONS={bubbles:!1,cancelable:!0},GROUP_NAME="RovingFocusGroup",[Collection,dist_useCollection,dist_createCollectionScope]=createCollection(GROUP_NAME),[createRovingFocusGroupContext,createRovingFocusGroupScope]=createContextScope(GROUP_NAME,[dist_createCollectionScope]),[RovingFocusProvider,useRovingFocusContext]=createRovingFocusGroupContext(GROUP_NAME),RovingFocusGroup=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_roving_focus_dist_name(function(e,t){return /* @__PURE__ */jsx_runtime_jsx(Collection.Provider,{scope:e.__scopeRovingFocusGroup,children:/* @__PURE__ */jsx_runtime_jsx(Collection.Slot,{scope:e.__scopeRovingFocusGroup,children:/* @__PURE__ */jsx_runtime_jsx(RovingFocusGroupImpl,{...e,ref:t})})})},"RovingFocusGroup")),RovingFocusGroupImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_roving_focus_dist_name(function(e,t){let{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:s,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=__rspack_external_react.useRef(null),p=dist_useComposedRefs(t,h),f=useDirection(i),[m,g]=dist_useControllableState({prop:o,defaultProp:l??null,onChange:s,caller:GROUP_NAME}),[b,v]=__rspack_external_react.useState(!1),w=dist_useCallbackRef(c),y=dist_useCollection(r),x=__rspack_external_react.useRef(!1),[k,S]=__rspack_external_react.useState(0);return __rspack_external_react.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(ENTRY_FOCUS,w),()=>e.removeEventListener(ENTRY_FOCUS,w)},[w]),/* @__PURE__ */jsx_runtime_jsx(RovingFocusProvider,{scope:r,orientation:n,dir:f,loop:a,currentTabStopId:m,onItemFocus:__rspack_external_react.useCallback(e=>g(e),[g]),onItemShiftTab:__rspack_external_react.useCallback(()=>v(!0),[]),onFocusableItemAdd:__rspack_external_react.useCallback(()=>S(e=>e+1),[]),onFocusableItemRemove:__rspack_external_react.useCallback(()=>S(e=>e-1),[]),children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{tabIndex:b||0===k?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:dist_composeEventHandlers(e.onMouseDown,()=>{x.current=!0}),onFocus:dist_composeEventHandlers(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!b){let t=new CustomEvent(ENTRY_FOCUS,dist_EVENT_OPTIONS);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=y().filter(e=>e.focusable);dist_focusFirst([e.find(e=>e.active),e.find(e=>e.id===m),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:dist_composeEventHandlers(e.onBlur,()=>v(!1))})})},"RovingFocusGroupImpl")),ITEM_NAME="RovingFocusGroupItem",RovingFocusGroupItem=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_roving_focus_dist_name(function(e,t){let{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:i,children:o,...l}=e,s=dist_useId(),c=i||s,u=useRovingFocusContext(ITEM_NAME,r),d=u.currentTabStopId===c,h=dist_useCollection(r),{onFocusableItemAdd:p,onFocusableItemRemove:f,currentTabStopId:m}=u,g=useIsHydrated2();return useLayoutEffect2(()=>{if(g&&n)return p(),()=>f()},[g,n,p,f]),__rspack_external_react.useEffect(()=>{if(!g&&n)return p(),()=>f()},[g,n,p,f]),/* @__PURE__ */jsx_runtime_jsx(Collection.ItemSlot,{scope:r,id:c,focusable:n,active:a,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:dist_composeEventHandlers(e.onMouseDown,e=>{n?u.onItemFocus(c):e.preventDefault()}),onFocus:dist_composeEventHandlers(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:dist_composeEventHandlers(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void u.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=getFocusIntent(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();let n=r.indexOf(e.currentTarget);r=u.loop?wrapArray(r,n+1):r.slice(n+1)}setTimeout(()=>dist_focusFirst(r))}}),children:"function"==typeof o?o({isCurrentTabStop:d,hasTabStop:null!=m}):o})})},"RovingFocusGroupItem")),MAP_KEY_TO_FOCUS_INTENT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function getDirectionAwareKey(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}function getFocusIntent(e,t,r){let n=getDirectionAwareKey(e.key,r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return MAP_KEY_TO_FOCUS_INTENT[n]}function dist_focusFirst(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function wrapArray(e,t){return e.map((r,n)=>e[(t+n)%e.length])}react_roving_focus_dist_name(getDirectionAwareKey,"getDirectionAwareKey"),react_roving_focus_dist_name(getFocusIntent,"getFocusIntent"),react_roving_focus_dist_name(dist_focusFirst,"focusFirst"),react_roving_focus_dist_name(wrapArray,"wrapArray");var react_roving_focus_dist_Root=RovingFocusGroup,Item=RovingFocusGroupItem,getDefaultParent=function(e){return"u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(e){return e&&(e.host||unwrapHost(e.parentNode))},correctTargets=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=unwrapHost(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return!!e})},applyAttributeToOthers=function(e,t,r,n){var a=correctTargets(t,Array.isArray(e)?e:[e]);markerMap[r]||(markerMap[r]=new WeakMap);var i=markerMap[r],o=[],l=new Set,s=new Set(a),c=function(e){!e||l.has(e)||(l.add(e),c(e.parentNode))};a.forEach(c);var u=function(e){!e||s.has(e)||Array.prototype.forEach.call(e.children,function(e){if(l.has(e))u(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,s=(counterMap.get(e)||0)+1,c=(i.get(e)||0)+1;counterMap.set(e,s),i.set(e,c),o.push(e),1===s&&a&&uncontrolledNodes.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return u(t),l.clear(),lockCount++,function(){o.forEach(function(e){var t=counterMap.get(e)-1,a=i.get(e)-1;counterMap.set(e,t),i.set(e,a),t||(uncontrolledNodes.has(e)||e.removeAttribute(n),uncontrolledNodes.delete(e)),a||e.removeAttribute(r)}),--lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=t||getDefaultParent(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),applyAttributeToOthers(n,a,r,"aria-hidden")):function(){return null}},inertOthers=function(e,t,r){void 0===r&&(r="data-inert-ed");var n=t||getDefaultParent(e);return n?applyAttributeToOthers(e,n,r,"inert"):function(){return null}},supportsInert=function(){return"u">typeof HTMLElement&&HTMLElement.prototype.hasOwnProperty("inert")},suppressOthers=function(e,t,r){return void 0===r&&(r="data-suppressed"),(supportsInert()?inertOthers:hideOthers)(e,t,r)},extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var tslib_es6_assign=function(){return(tslib_es6_assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)0>t.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function __decorate(e,t,r,n){var a,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(o=(i<3?a(o):i>3?a(t,r,o):a(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function __param(e,t){return function(r,n){t(r,n,e)}}function __esDecorate(e,t,r,n,a,i){function o(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var l,s=n.kind,c="getter"===s?"get":"setter"===s?"set":"value",u=!t&&e?n.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in n)f[m]="access"===m?{}:n[m];for(var m in n.access)f.access[m]=n.access[m];f.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");i.push(o(e||null))};var g=(0,r[p])("accessor"===s?{get:d.get,set:d.set}:d[c],f);if("accessor"===s){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw TypeError("Object expected");(l=o(g.get))&&(d.get=l),(l=o(g.set))&&(d.set=l),(l=o(g.init))&&a.unshift(l)}else(l=o(g))&&("field"===s?a.unshift(l):d[c]=l)}u&&Object.defineProperty(u,n.name,d),h=!0}function __runInitializers(e,t,r){for(var n=arguments.length>2,a=0;a<t.length;a++)r=n?t[a].call(e,r):t[a].call(e);return n?r:void 0}function __propKey(e){return"symbol"==typeof e?e:"".concat(e)}function __setFunctionName(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(a,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function l(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,l)}s((n=n.apply(e,t||[])).next())})}function __generator(e,t){var r,n,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(s){var c=[l,s];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){i.label=c[1];break}if(6===c[0]&&i.label<a[1]){i.label=a[1],a=c;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(c);break}a[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var __createBinding=Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function __exportStar(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}function __spreadArrays(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),a=0,t=0;t<r;t++)for(var i=arguments[t],o=0,l=i.length;o<l;o++,a++)n[a]=i[o];return n}function __spreadArray(e,t,r){if(r||2==arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}function __await(e){return this instanceof __await?(this.v=e,this):new __await(e)}function __asyncGenerator(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,a=r.apply(e,t||[]),i=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),n[Symbol.asyncIterator]=function(){return this},n;function o(e,t){a[e]&&(n[e]=function(t){return new Promise(function(r,n){i.push([e,t,r,n])>1||l(e,t)})},t&&(n[e]=t(n[e])))}function l(e,t){try{var r;(r=a[e](t)).value instanceof __await?Promise.resolve(r.value.v).then(s,c):u(i[0][2],r)}catch(e){u(i[0][3],e)}}function s(e){l("next",e)}function c(e){l("throw",e)}function u(e,t){e(t),i.shift(),i.length&&l(i[0][0],i[0][1])}}function __asyncDelegator(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,a){t[n]=e[n]?function(t){return(r=!r)?{value:__await(e[n](t)),done:!1}:a?a(t):t}:a}}function __asyncValues(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=__values(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){var i,o,l;i=n,o=a,l=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:l})},o)})}}}function __makeTemplateObject(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var __setModuleDefault=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},ownKeys=function(e){return(ownKeys=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function __importStar(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=ownKeys(e),n=0;n<r.length;n++)"default"!==r[n]&&__createBinding(t,e,r[n]);return __setModuleDefault(t,e),t}function __importDefault(e){return e&&e.__esModule?e:{default:e}}function __classPrivateFieldGet(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function __classPrivateFieldSet(e,t,r,n,a){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,r):a?a.value=r:t.set(e,r),r}function __classPrivateFieldIn(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function __addDisposableResource(e,t,r){if(null!=t){var n,a;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(a=n)}if("function"!=typeof n)throw TypeError("Object not disposable.");a&&(n=function(){try{a.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var _SuppressedError=null;function __disposeResources(e){function t(t){e.error=e.hasError?new _SuppressedError(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,n=0;return function a(){for(;r=e.stack.pop();)try{if(!r.async&&1===n)return n=0,e.stack.push(r),Promise.resolve().then(a);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(a,function(e){return t(e),a()})}else n|=1}catch(e){t(e)}if(1===n)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function __rewriteRelativeImportExtension(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,n,a,i){return r?t?".jsx":".js":!n||a&&i?n+a+"."+i.toLowerCase()+"js":e}):e}let tslib_es6=null;var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}function useRef_useCallbackRef(e,t){var r=external_react_useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(value){var n=r.value;n!==value&&(r.value=value,r.callback(value,n))}}}})[0];return r.callback=t,r.facade}var useMergeRef_useIsomorphicLayoutEffect="u">typeof window?__rspack_external_react.useLayoutEffect:__rspack_external_react.useEffect,currentValues=new WeakMap;function useMergeRefs(e,t){var r=useRef_useCallbackRef(t||null,function(t){return e.forEach(function(e){return assignRef(e,t)})});return useMergeRef_useIsomorphicLayoutEffect(function(){var t=currentValues.get(r);if(t){var n=new Set(t),a=new Set(e),i=r.current;n.forEach(function(e){a.has(e)||assignRef(e,null)}),a.forEach(function(e){n.has(e)||assignRef(e,i)})}currentValues.set(r,e)},[e]),r}function ItoI(e){return e}function innerCreateMedium(e,t){void 0===t&&(t=ItoI);var r=[],n=!1;return{read:function(){if(n)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var i=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(i)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}}}function createMedium(e,t){return void 0===t&&(t=ItoI),innerCreateMedium(e,t)}function createSidecarMedium(e){void 0===e&&(e={});var t=innerCreateMedium(null);return t.options=tslib_es6_assign({async:!0,ssr:!1},e),t}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=__rspack_external_react.forwardRef(function(e,t){var r=__rspack_external_react.useRef(null),n=__rspack_external_react.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),a=n[0],i=n[1],o=e.forwardProps,l=e.children,s=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,h=e.sideCar,p=e.noRelative,f=e.noIsolation,m=e.inert,g=e.allowPinchZoom,b=e.as,v=e.gapMode,w=__rest(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),y=useMergeRefs([r,t]),x=tslib_es6_assign(tslib_es6_assign({},w),a);return __rspack_external_react.createElement(__rspack_external_react.Fragment,null,u&&__rspack_external_react.createElement(h,{sideCar:effectCar,removeScrollBar:c,shards:d,noRelative:p,noIsolation:f,inert:m,setCallbacks:i,allowPinchZoom:!!g,lockRef:r,gapMode:v}),o?__rspack_external_react.cloneElement(__rspack_external_react.Children.only(l),tslib_es6_assign(tslib_es6_assign({},x),{ref:y})):__rspack_external_react.createElement(void 0===b?"div":b,tslib_es6_assign({},x,{className:s,ref:y}),l))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var exports_SideCar=function(e){var t=e.sideCar,r=__rest(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return __rspack_external_react.createElement(n,tslib_es6_assign({},r))};function exportSidecar(e,t){return e.useMedium(t),exports_SideCar}exports_SideCar.isSideCarExport=!0;var setNonce=function(e){currentNonce=e},getNonce=function(){return currentNonce||__webpack_require__.nc};function makeStyleTag(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=getNonce();return t&&e.setAttribute("nonce",t),e}function injectStyles(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function insertStyleTag(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var stylesheetSingleton=function(){var e=0,t=null;return{add:function(r){0==e&&(t=makeStyleTag())&&(injectStyles(t,r),insertStyleTag(t)),e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},styleHookSingleton=function(){var e=stylesheetSingleton();return function(t,r){__rspack_external_react.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},styleSingleton=function(){var e=styleHookSingleton();return function(t){return e(t.styles,t.dynamic),null}},zeroGap={left:0,top:0,right:0,gap:0},parse=function(e){return parseInt(e||"",10)||0},getOffset=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[parse(r),parse(n),parse(a)]},getGapWidth=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return zeroGap;var t=getOffset(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},component_Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(e,t,r,n){var a=e.left,i=e.top,o=e.right,l=e.gap;return void 0===r&&(r="margin"),"\n .".concat(noScrollbarsClassName," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(l,"px ").concat(n,";\n }\n body[").concat(lockAttribute,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(i,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(l,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(zeroRightClassName," {\n right: ").concat(l,"px ").concat(n,";\n }\n \n .").concat(fullWidthClassName," {\n margin-right: ").concat(l,"px ").concat(n,";\n }\n \n .").concat(zeroRightClassName," .").concat(zeroRightClassName," {\n right: 0 ").concat(n,";\n }\n \n .").concat(fullWidthClassName," .").concat(fullWidthClassName," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(lockAttribute,"] {\n ").concat(removedBarSizeVariable,": ").concat(l,"px;\n }\n")},getCurrentUseCounter=function(){var e=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(e)?e:0},useLockAttribute=function(){__rspack_external_react.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var e=getCurrentUseCounter()-1;e<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,e.toString())}},[])},RemoveScrollBar=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=void 0===n?"margin":n;useLockAttribute();var i=__rspack_external_react.useMemo(function(){return getGapWidth(a)},[a]);return __rspack_external_react.createElement(component_Style,{styles:getStyles(i,!t,a,r?"":"!important")})},passiveSupported=!1;if("u">typeof window)try{var aggresiveCapture_options=Object.defineProperty({},"passive",{get:function(){return passiveSupported=!0,!0}});window.addEventListener("test",aggresiveCapture_options,aggresiveCapture_options),window.removeEventListener("test",aggresiveCapture_options,aggresiveCapture_options)}catch(err){passiveSupported=!1}var nonPassive=!!passiveSupported&&{passive:!1},alwaysContainsScroll=function(e){return"TEXTAREA"===e.tagName},elementCanBeScrolled=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!alwaysContainsScroll(e)&&"visible"===r[t])},elementCouldBeVScrolled=function(e){return elementCanBeScrolled(e,"overflowY")},elementCouldBeHScrolled=function(e){return elementCanBeScrolled(e,"overflowX")},locationCouldBeScrolled=function(e,t){var r=t.ownerDocument,n=t;do{if("u">typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),elementCouldBeScrolled(e,n)){var a=getScrollVariables(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body)return!1},getVScrollVariables=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},getHScrollVariables=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},elementCouldBeScrolled=function(e,t){return"v"===e?elementCouldBeVScrolled(t):elementCouldBeHScrolled(t)},getScrollVariables=function(e,t){return"v"===e?getVScrollVariables(t):getHScrollVariables(t)},getDirectionFactor=function(e,t){return"h"===e&&"rtl"===t?-1:1},handleScroll_handleScroll=function(e,t,r,n,a){var i=getDirectionFactor(e,window.getComputedStyle(t).direction),o=i*n,l=r.target,s=t.contains(l),c=!1,u=o>0,d=0,h=0;do{if(!l)break;var p=getScrollVariables(e,l),f=p[0],m=p[1]-p[2]-i*f;(f||m)&&elementCouldBeScrolled(e,l)&&(d+=m,h+=f);var g=l.parentNode;l=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!s&&l!==document.body||s&&(t.contains(l)||t===l))return u&&(a&&1>Math.abs(d)||!a&&o>d)?c=!0:!u&&(a&&1>Math.abs(h)||!a&&-o>h)&&(c=!0),c},getTouchXY=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(e){return[e.deltaX,e.deltaY]},extractRef=function(e){return e&&"current"in e?e.current:e},deltaCompare=function(e,t){return e[0]===t[0]&&e[1]===t[1]},generateStyle=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},idCounter=0,lockStack=[];function RemoveScrollSideCar(e){var t=__rspack_external_react.useRef([]),r=__rspack_external_react.useRef([0,0]),n=__rspack_external_react.useRef(),a=__rspack_external_react.useState(idCounter++)[0],i=__rspack_external_react.useState(styleSingleton)[0],o=__rspack_external_react.useRef(e);__rspack_external_react.useEffect(function(){o.current=e},[e]),__rspack_external_react.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=__spreadArray([e.lockRef.current],(e.shards||[]).map(extractRef),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=__rspack_external_react.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var a,i=getTouchXY(e),l=r.current,s="deltaX"in e?e.deltaX:l[0]-i[0],c="deltaY"in e?e.deltaY:l[1]-i[1],u=e.target,d=Math.abs(s)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var h=window.getSelection(),p=h&&h.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var f=locationCouldBeScrolled(d,u);if(!f)return!0;if(f?a=d:(a="v"===d?"h":"v",f=locationCouldBeScrolled(d,u)),!f)return!1;if(!n.current&&"changedTouches"in e&&(s||c)&&(n.current=a),!a)return!0;var m=n.current||a;return handleScroll_handleScroll(m,t,e,"h"===m?s:c,!0)},[]),s=__rspack_external_react.useCallback(function(e){if(lockStack.length&&lockStack[lockStack.length-1]===i){var r="deltaY"in e?getDeltaXY(e):getTouchXY(e),n=t.current.filter(function(t){return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&deltaCompare(t.delta,r)})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var a=(o.current.shards||[]).map(extractRef).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?l(e,a[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=__rspack_external_react.useCallback(function(e,r,n,a){var i={name:e,delta:r,target:n,should:a,shadowParent:getOutermostShadowParent(n)};t.current.push(i),setTimeout(function(){t.current=t.current.filter(function(e){return e!==i})},1)},[]),u=__rspack_external_react.useCallback(function(e){r.current=getTouchXY(e),n.current=void 0},[]),d=__rspack_external_react.useCallback(function(t){c(t.type,getDeltaXY(t),t.target,l(t,e.lockRef.current))},[]),h=__rspack_external_react.useCallback(function(t){c(t.type,getTouchXY(t),t.target,l(t,e.lockRef.current))},[]);__rspack_external_react.useEffect(function(){return lockStack.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",s,nonPassive),document.addEventListener("touchmove",s,nonPassive),document.addEventListener("touchstart",u,nonPassive),function(){lockStack=lockStack.filter(function(e){return e!==i}),document.removeEventListener("wheel",s,nonPassive),document.removeEventListener("touchmove",s,nonPassive),document.removeEventListener("touchstart",u,nonPassive)}},[]);var p=e.removeScrollBar,f=e.inert;return __rspack_external_react.createElement(__rspack_external_react.Fragment,null,f?__rspack_external_react.createElement(i,{styles:generateStyle(a)}):null,p?__rspack_external_react.createElement(RemoveScrollBar,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function getOutermostShadowParent(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}let sidecar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=__rspack_external_react.forwardRef(function(e,t){return __rspack_external_react.createElement(RemoveScroll,tslib_es6_assign({},e,{ref:t,sideCar:sidecar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;let Combination=ReactRemoveScroll;var react_menu_dist_defProp=Object.defineProperty,react_menu_dist_name=(e,t)=>react_menu_dist_defProp(e,"name",{value:t,configurable:!0}),SELECTION_KEYS=["Enter"," "],FIRST_KEYS=["ArrowDown","PageUp","Home"],LAST_KEYS=["ArrowUp","PageDown","End"],FIRST_LAST_KEYS=[...FIRST_KEYS,...LAST_KEYS],SUB_OPEN_KEYS={ltr:[...SELECTION_KEYS,"ArrowRight"],rtl:[...SELECTION_KEYS,"ArrowLeft"]},SUB_CLOSE_KEYS=null,MENU_NAME="Menu",[dist_Collection,react_menu_dist_useCollection,react_menu_dist_createCollectionScope]=createCollection(MENU_NAME),[createMenuContext,createMenuScope]=createContextScope(MENU_NAME,[react_menu_dist_createCollectionScope,createPopperScope,createRovingFocusGroupScope]),usePopperScope=createPopperScope(),useRovingFocusGroupScope=createRovingFocusGroupScope(),[MenuProvider,useMenuContext]=createMenuContext(MENU_NAME),[MenuRootProvider,useMenuRootContext]=createMenuContext(MENU_NAME),Menu=/* @__PURE__ */react_menu_dist_name(e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:i,modal:o=!0}=e,l=usePopperScope(t),[s,c]=__rspack_external_react.useState(null),u=__rspack_external_react.useRef(!1),d=dist_useCallbackRef(i),h=useDirection(a);return __rspack_external_react.useEffect(()=>{let e=/* @__PURE__ */react_menu_dist_name(()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},"handleKeyDown"),t=/* @__PURE__ */react_menu_dist_name(()=>u.current=!1,"handlePointer");return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),__rspack_external_react.useEffect(()=>{if(!r)return;let e=/* @__PURE__ */react_menu_dist_name(()=>d(!1),"handleBlur");return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[r,d]),/* @__PURE__ */jsx_runtime_jsx(Root2,{...l,children:/* @__PURE__ */jsx_runtime_jsx(MenuProvider,{scope:t,open:r,onOpenChange:d,content:s,onContentChange:c,children:/* @__PURE__ */jsx_runtime_jsx(MenuRootProvider,{scope:t,onClose:__rspack_external_react.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:n})})})},"Menu"),MenuAnchor=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{__scopeMenu:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(Anchor,{...usePopperScope(r),...n,ref:t})},"MenuAnchor")),PORTAL_NAME="MenuPortal",[PortalProvider,usePortalContext]=createMenuContext(PORTAL_NAME,{forceMount:void 0}),MenuPortal=/* @__PURE__ */react_menu_dist_name(e=>{let{__scopeMenu:t,forceMount:r,children:n,container:a}=e,i=useMenuContext(PORTAL_NAME,t);return /* @__PURE__ */jsx_runtime_jsx(PortalProvider,{scope:t,forceMount:r,children:/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||i.open,children:/* @__PURE__ */jsx_runtime_jsx(Portal,{asChild:!0,container:a,children:n})})})},"MenuPortal"),dist_CONTENT_NAME="MenuContent",[MenuContentProvider,useMenuContentContext]=createMenuContext(dist_CONTENT_NAME),MenuContent=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let r=usePortalContext(dist_CONTENT_NAME,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,i=useMenuContext(dist_CONTENT_NAME,e.__scopeMenu),o=useMenuRootContext(dist_CONTENT_NAME,e.__scopeMenu);return /* @__PURE__ */jsx_runtime_jsx(dist_Collection.Provider,{scope:e.__scopeMenu,children:/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:n||i.open,children:/* @__PURE__ */jsx_runtime_jsx(dist_Collection.Slot,{scope:e.__scopeMenu,children:o.modal?/* @__PURE__ */jsx_runtime_jsx(MenuRootContentModal,{...a,ref:t}):/* @__PURE__ */jsx_runtime_jsx(MenuRootContentNonModal,{...a,ref:t})})})})},"MenuContent")),MenuRootContentModal=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let r=useMenuContext(dist_CONTENT_NAME,e.__scopeMenu),n=__rspack_external_react.useRef(null),a=dist_useComposedRefs(t,n);return __rspack_external_react.useEffect(()=>{let e=n.current;if(e)return hideOthers(e)},[]),/* @__PURE__ */jsx_runtime_jsx(MenuContentImpl,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:dist_composeEventHandlers(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),MenuRootContentNonModal=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let r=useMenuContext(dist_CONTENT_NAME,e.__scopeMenu);return /* @__PURE__ */jsx_runtime_jsx(MenuContentImpl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),react_menu_dist_Slot=createSlot("MenuContent.ScrollLock"),MenuContentImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:f,...m}=e,g=useMenuContext(dist_CONTENT_NAME,r),b=useMenuRootContext(dist_CONTENT_NAME,r),v=usePopperScope(r),w=useRovingFocusGroupScope(r),y=react_menu_dist_useCollection(r),[x,k]=__rspack_external_react.useState(null),S=__rspack_external_react.useRef(null),D=dist_useComposedRefs(t,S,g.onContentChange),M=__rspack_external_react.useRef(0),F=__rspack_external_react.useRef(""),C=__rspack_external_react.useRef(0),E=__rspack_external_react.useRef(null),A=__rspack_external_react.useRef("right"),N=__rspack_external_react.useRef(0),T=f?Combination:__rspack_external_react.Fragment,I=/* @__PURE__ */react_menu_dist_name(e=>{let t=F.current+e,r=y().filter(e=>!e.disabled),n=document.activeElement,a=r.find(e=>e.ref.current===n)?.textValue,i=getNextMatch(r.map(e=>e.textValue),t,a),o=r.find(e=>e.textValue===i)?.ref.current;o&&setTimeout(()=>o.focus())},"handleTypeaheadSearch");__rspack_external_react.useEffect(()=>()=>window.clearTimeout(M.current),[]),useFocusGuards();let z=__rspack_external_react.useCallback(e=>A.current===E.current?.side&&isPointerInGraceArea(e,E.current?.area),[]);return /* @__PURE__ */jsx_runtime_jsx(MenuContentProvider,{scope:r,searchRef:F,onItemEnter:__rspack_external_react.useCallback(e=>{z(e)&&e.preventDefault()},[z]),onItemLeave:__rspack_external_react.useCallback(e=>{z(e)||(S.current?.focus(),k(null))},[z]),onTriggerLeave:__rspack_external_react.useCallback(e=>{z(e)&&e.preventDefault()},[z]),pointerGraceTimerRef:C,onPointerGraceIntentChange:__rspack_external_react.useCallback(e=>{E.current=e},[]),children:/* @__PURE__ */jsx_runtime_jsx(T,{...f?{as:react_menu_dist_Slot,allowPinchZoom:!0}:void 0,children:/* @__PURE__ */jsx_runtime_jsx(FocusScope,{asChild:!0,trapped:a,onMountAutoFocus:dist_composeEventHandlers(i,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:/* @__PURE__ */jsx_runtime_jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:/* @__PURE__ */jsx_runtime_jsx(react_roving_focus_dist_Root,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:n,currentTabStopId:x,onCurrentTabStopIdChange:k,onEntryFocus:dist_composeEventHandlers(s,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:/* @__PURE__ */jsx_runtime_jsx(Content,{role:"menu","aria-orientation":"vertical","data-state":getOpenState(g.open),"data-radix-menu-content":"",dir:b.dir,...v,...m,ref:D,style:{outline:"none",...m.style},onKeyDown:dist_composeEventHandlers(m.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&n&&I(e.key));let a=S.current;if(e.target!==a||!FIRST_LAST_KEYS.includes(e.key))return;e.preventDefault();let i=y().filter(e=>!e.disabled).map(e=>e.ref.current);LAST_KEYS.includes(e.key)&&i.reverse(),react_menu_dist_focusFirst(i)}),onBlur:dist_composeEventHandlers(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(M.current),F.current="")}),onPointerMove:dist_composeEventHandlers(e.onPointerMove,whenMouse(e=>{let t=e.target,r=N.current!==e.clientX;e.currentTarget.contains(t)&&r&&(A.current=e.clientX>N.current?"right":"left",N.current=e.clientX)}))})})})})})})},"MenuContentImpl")),MenuGroup=/* @__PURE__ */null,MenuLabel=/* @__PURE__ */null,dist_ITEM_NAME="MenuItem",ITEM_SELECT="menu.itemSelect",MenuItem=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{disabled:r=!1,onSelect:n,...a}=e,i=__rspack_external_react.useRef(null),o=useMenuRootContext(dist_ITEM_NAME,e.__scopeMenu),l=useMenuContentContext(dist_ITEM_NAME,e.__scopeMenu),s=dist_useComposedRefs(t,i),c=__rspack_external_react.useRef(!1),u=/* @__PURE__ */react_menu_dist_name(()=>{let e=i.current;if(!r&&e){let t=new CustomEvent(ITEM_SELECT,{bubbles:!0,cancelable:!0});e.addEventListener(ITEM_SELECT,e=>n?.(e),{once:!0}),dispatchDiscreteCustomEvent(e,t),t.defaultPrevented?c.current=!1:o.onClose()}},"handleSelect");return /* @__PURE__ */jsx_runtime_jsx(MenuItemImpl,{...a,ref:s,disabled:r,onClick:dist_composeEventHandlers(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:dist_composeEventHandlers(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:dist_composeEventHandlers(e.onKeyDown,e=>{r||e.target!==e.currentTarget||(""===l.searchRef.current||" "!==e.key)&&SELECTION_KEYS.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},"MenuItem")),MenuItemImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{__scopeMenu:r,disabled:n=!1,textValue:a,...i}=e,o=useMenuContentContext(dist_ITEM_NAME,r),l=useRovingFocusGroupScope(r),s=__rspack_external_react.useRef(null),c=dist_useComposedRefs(t,s),[u,d]=__rspack_external_react.useState(!1),[h,p]=__rspack_external_react.useState("");return __rspack_external_react.useEffect(()=>{let e=s.current;e&&p((e.textContent??"").trim())},[i.children]),/* @__PURE__ */jsx_runtime_jsx(dist_Collection.ItemSlot,{scope:r,disabled:n,textValue:a??h,children:/* @__PURE__ */jsx_runtime_jsx(Item,{asChild:!0,...l,focusable:!n,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:c,onPointerMove:dist_composeEventHandlers(e.onPointerMove,whenMouse(e=>{n?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:dist_composeEventHandlers(e.onPointerLeave,whenMouse(e=>o.onItemLeave(e))),onFocus:dist_composeEventHandlers(e.onFocus,()=>d(!0)),onBlur:dist_composeEventHandlers(e.onBlur,()=>d(!1))})})})},"MenuItemImpl")),MenuCheckboxItem=/* @__PURE__ */null,RADIO_GROUP_NAME="MenuRadioGroup",[RadioGroupProvider,useRadioGroupContext]=createMenuContext(RADIO_GROUP_NAME,{value:void 0,onValueChange:/* @__PURE__ */react_menu_dist_name(()=>{},"onValueChange")}),MenuRadioGroup=/* @__PURE__ */null,RADIO_ITEM_NAME="MenuRadioItem",MenuRadioItem=/* @__PURE__ */null,ITEM_INDICATOR_NAME="MenuItemIndicator",[ItemIndicatorProvider,useItemIndicatorContext]=createMenuContext(ITEM_INDICATOR_NAME,{checked:!1}),MenuItemIndicator=/* @__PURE__ */null,MenuSeparator=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{__scopeMenu:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})},"MenuSeparator")),MenuArrow=/* @__PURE__ */null,SUB_NAME="MenuSub",[MenuSubProvider,useMenuSubContext]=createMenuContext(SUB_NAME),MenuSub=/* @__PURE__ */null,SUB_TRIGGER_NAME="MenuSubTrigger",MenuSubTrigger=/* @__PURE__ */null,SUB_CONTENT_NAME="MenuSubContent",MenuSubContent=/* @__PURE__ */null;function getOpenState(e){return e?"open":"closed"}function isIndeterminate(e){return"indeterminate"===e}function getCheckedState(e){return isIndeterminate(e)?"indeterminate":e?"checked":"unchecked"}function react_menu_dist_focusFirst(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function dist_wrapArray(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function getNextMatch(e,t,r){let n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1,i=dist_wrapArray(e,Math.max(a,0));1===n.length&&(i=i.filter(e=>e!==r));let o=i.find(e=>e.toLowerCase().startsWith(n.toLowerCase()));return o!==r?o:void 0}function isPointInPolygon(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let o=t[e],l=t[i],s=o.x,c=o.y,u=l.x,d=l.y;c>n!=d>n&&r<(u-s)*(n-c)/(d-c)+s&&(a=!a)}return a}function isPointerInGraceArea(e,t){return!!t&&isPointInPolygon({x:e.clientX,y:e.clientY},t)}function whenMouse(e){return t=>"mouse"===t.pointerType?e(t):void 0}react_menu_dist_name(getOpenState,"getOpenState"),react_menu_dist_name(isIndeterminate,"isIndeterminate"),react_menu_dist_name(getCheckedState,"getCheckedState"),react_menu_dist_name(react_menu_dist_focusFirst,"focusFirst"),react_menu_dist_name(dist_wrapArray,"wrapArray"),react_menu_dist_name(getNextMatch,"getNextMatch"),react_menu_dist_name(isPointInPolygon,"isPointInPolygon"),react_menu_dist_name(isPointerInGraceArea,"isPointerInGraceArea"),react_menu_dist_name(whenMouse,"whenMouse");var Root3=Menu,Anchor2=MenuAnchor,dist_Portal=MenuPortal,Content2=MenuContent,Group=null,Label=null,Item2=MenuItem,CheckboxItem=null,RadioGroup=null,RadioItem=null,ItemIndicator=null,Separator=MenuSeparator,dist_Arrow2=null,Sub=null,SubTrigger=null,SubContent=null,react_dropdown_menu_dist_defProp=Object.defineProperty,react_dropdown_menu_dist_name=(e,t)=>react_dropdown_menu_dist_defProp(e,"name",{value:t,configurable:!0}),DROPDOWN_MENU_NAME="DropdownMenu",[createDropdownMenuContext,createDropdownMenuScope]=createContextScope(DROPDOWN_MENU_NAME,[createMenuScope]),useMenuScope=createMenuScope(),[DropdownMenuProvider,useDropdownMenuContext]=createDropdownMenuContext(DROPDOWN_MENU_NAME),DropdownMenu=/* @__PURE__ */react_dropdown_menu_dist_name(e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:a,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,s=useMenuScope(t),c=__rspack_external_react.useRef(null),[u,d]=dist_useControllableState({prop:a,defaultProp:i??!1,onChange:o,caller:DROPDOWN_MENU_NAME});return /* @__PURE__ */jsx_runtime_jsx(DropdownMenuProvider,{scope:t,triggerId:dist_useId(),triggerRef:c,contentId:dist_useId(),open:u,onOpenChange:d,onOpenToggle:__rspack_external_react.useCallback(()=>d(e=>!e),[d]),modal:l,children:/* @__PURE__ */jsx_runtime_jsx(Root3,{...s,open:u,onOpenChange:d,dir:n,modal:l,children:r})})},"DropdownMenu"),TRIGGER_NAME="DropdownMenuTrigger",DropdownMenuTrigger=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dropdown_menu_dist_name(function(e,t){let{__scopeDropdownMenu:r,disabled:n=!1,...a}=e,i=useDropdownMenuContext(TRIGGER_NAME,r),o=useMenuScope(r),l=dist_useComposedRefs(t,i.triggerRef);return /* @__PURE__ */jsx_runtime_jsx(Anchor2,{asChild:!0,...o,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:l,onPointerDown:dist_composeEventHandlers(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(i.onOpenToggle(),i.open||e.preventDefault())}),onKeyDown:dist_composeEventHandlers(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&i.onOpenToggle(),"ArrowDown"===e.key&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})},"DropdownMenuTrigger")),DropdownMenuPortal=/* @__PURE__ */react_dropdown_menu_dist_name(e=>{let{__scopeDropdownMenu:t,...r}=e;return /* @__PURE__ */jsx_runtime_jsx(dist_Portal,{...useMenuScope(t),...r})},"DropdownMenuPortal"),react_dropdown_menu_dist_CONTENT_NAME="DropdownMenuContent",DropdownMenuContent=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dropdown_menu_dist_name(function(e,t){let{__scopeDropdownMenu:r,...n}=e,a=useDropdownMenuContext(react_dropdown_menu_dist_CONTENT_NAME,r),i=useMenuScope(r),o=__rspack_external_react.useRef(!1);return /* @__PURE__ */jsx_runtime_jsx(Content2,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...n,ref:t,onCloseAutoFocus:dist_composeEventHandlers(e.onCloseAutoFocus,e=>{o.current||a.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:dist_composeEventHandlers(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!a.modal||n)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),DropdownMenuGroup=/* @__PURE__ */null,DropdownMenuLabel=/* @__PURE__ */null,DropdownMenuItem=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dropdown_menu_dist_name(function(e,t){let{__scopeDropdownMenu:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(Item2,{...useMenuScope(r),...n,ref:t})},"DropdownMenuItem")),DropdownMenuCheckboxItem=/* @__PURE__ */null,DropdownMenuRadioGroup=/* @__PURE__ */null,DropdownMenuRadioItem=/* @__PURE__ */null,DropdownMenuItemIndicator=/* @__PURE__ */null,DropdownMenuSeparator=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dropdown_menu_dist_name(function(e,t){let{__scopeDropdownMenu:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(Separator,{...useMenuScope(r),...n,ref:t})},"DropdownMenuSeparator")),DropdownMenuArrow=/* @__PURE__ */null,DropdownMenuSub=/* @__PURE__ */null,DropdownMenuSubTrigger=/* @__PURE__ */null,DropdownMenuSubContent=/* @__PURE__ */null,dist_Root2=DropdownMenu,Trigger=DropdownMenuTrigger,dist_Portal2=DropdownMenuPortal,dist_Content2=DropdownMenuContent,Group2=null,Label2=null,dist_Item2=DropdownMenuItem,CheckboxItem2=null,RadioGroup2=null,RadioItem2=null,ItemIndicator2=null,dist_Separator2=DropdownMenuSeparator,react_dropdown_menu_dist_Arrow2=null,Sub2=null,SubTrigger2=null,SubContent2=null;let useSafeLayoutEffect="u"<typeof window?external_react_useEffect:useLayoutEffect,incrementPortalUsers=e=>{let t=Number.parseInt(e.getAttribute("data-rfkit-charts-portal-users")??"0",10);e.setAttribute("data-rfkit-charts-portal-users",String(t+1))},decrementPortalUsers=e=>{let t=Number.parseInt(e.getAttribute("data-rfkit-charts-portal-users")??"0",10)-1;t<=0?e.remove():e.setAttribute("data-rfkit-charts-portal-users",String(t))},useChartsPortalContainer=e=>{let[t,r]=external_react_useState(null);return useSafeLayoutEffect(()=>{let t=ensureChartsPortalRoot(e);if(t)return incrementPortalUsers(t),r(t),()=>{decrementPortalUsers(t)}},[e]),t};function dropdown_menu_DropdownMenu({...e}){return /*#__PURE__*/jsx_runtime_jsx(dist_Root2,{"data-slot":"dropdown-menu",...e})}let dropdown_menu_DropdownMenuTrigger=/*#__PURE__*/__rspack_external_react.forwardRef(({...e},t)=>/*#__PURE__*/jsx_runtime_jsx(Trigger,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));function dropdown_menu_DropdownMenuPortal({...e}){let t=useChartsPortalContainer("dropdown-menu");return t?/*#__PURE__*/jsx_runtime_jsx(dist_Portal2,{"data-slot":"dropdown-menu-portal",container:t,...e}):null}function dropdown_menu_DropdownMenuContent({className:e,sideOffset:t=8,...r}){return /*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuPortal,{children:/*#__PURE__*/jsx_runtime_jsx(dist_Content2,{"data-slot":"dropdown-menu-content",sideOffset:t,className:cn_cn("z-50 min-w-[8.75rem] overflow-hidden rounded-[var(--radius-surface)] border border-border/70 bg-background/98 p-[calc(var(--size-gap-base)/2)] text-foreground shadow-lg backdrop-blur-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",e),...r})})}dropdown_menu_DropdownMenuTrigger.displayName=Trigger.displayName;let dropdown_menu_DropdownMenuItem=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,...t},r)=>/*#__PURE__*/jsx_runtime_jsx(dist_Item2,{ref:r,"data-slot":"dropdown-menu-item",className:cn_cn("relative flex w-full cursor-default select-none items-center gap-2 px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] text-xs outline-none transition-colors","rounded-[var(--radius-control)] focus:bg-accent/80 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground data-[disabled]:opacity-40",e),...t}));dropdown_menu_DropdownMenuItem.displayName=dist_Item2.displayName;let dropdown_menu_DropdownMenuSeparator=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,...t},r)=>/*#__PURE__*/jsx_runtime_jsx(dist_Separator2,{ref:r,"data-slot":"dropdown-menu-separator",className:cn_cn("my-[calc(var(--size-gap-base)/2)] h-px bg-border/60",e),...t}));dropdown_menu_DropdownMenuSeparator.displayName=dist_Separator2.displayName;var number_dist_defProp=Object.defineProperty,number_dist_name=(e,t)=>number_dist_defProp(e,"name",{value:t,configurable:!0});function dist_clamp(e,[t,r]){return Math.min(r,Math.max(t,e))}number_dist_name(dist_clamp,"clamp");var react_scroll_area_dist_defProp=Object.defineProperty,react_scroll_area_dist_name=(e,t)=>react_scroll_area_dist_defProp(e,"name",{value:t,configurable:!0});function dist_useStateMachine(e,t){return __rspack_external_react.useReducer((e,r)=>t[e][r]??e,e)}react_scroll_area_dist_name(dist_useStateMachine,"useStateMachine");var SCROLL_AREA_NAME="ScrollArea",[createScrollAreaContext,createScrollAreaScope]=createContextScope(SCROLL_AREA_NAME),[ScrollAreaProvider,useScrollAreaContext]=createScrollAreaContext(SCROLL_AREA_NAME),ScrollArea=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...o}=e,[l,s]=__rspack_external_react.useState(null),[c,u]=__rspack_external_react.useState(null),[d,h]=__rspack_external_react.useState(null),[p,f]=__rspack_external_react.useState(null),[m,g]=__rspack_external_react.useState(null),[b,v]=__rspack_external_react.useState(0),[w,y]=__rspack_external_react.useState(0),[x,k]=__rspack_external_react.useState(!1),[S,D]=__rspack_external_react.useState(!1),M=dist_useComposedRefs(t,s),F=useDirection(a);return /* @__PURE__ */jsx_runtime_jsx(ScrollAreaProvider,{scope:r,type:n,dir:F,scrollHideDelay:i,scrollArea:l,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:p,onScrollbarXChange:f,scrollbarXEnabled:x,onScrollbarXEnabledChange:k,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:S,onScrollbarYEnabledChange:D,onCornerWidthChange:v,onCornerHeightChange:y,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{dir:F,...o,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})},"ScrollArea")),VIEWPORT_NAME="ScrollAreaViewport",ScrollAreaViewport=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,children:n,nonce:a,...i}=e,o=useScrollAreaContext(VIEWPORT_NAME,r),l=dist_useComposedRefs(t,__rspack_external_react.useRef(null),o.onViewportChange);return /* @__PURE__ */jsxs(Fragment,{children:[/* @__PURE__ */jsx_runtime_jsx(ScrollAreaViewportStyle,{nonce:a}),/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:/* @__PURE__ */jsx_runtime_jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})},"ScrollAreaViewport")),ScrollAreaViewportStyle=/* @__PURE__ */__rspack_external_react.memo(/* @__PURE__ */react_scroll_area_dist_name(function({nonce:e}){return /* @__PURE__ */jsx_runtime_jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),SCROLLBAR_NAME="ScrollAreaScrollbar",ScrollAreaScrollbar=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{forceMount:r,...n}=e,a=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,l="horizontal"===e.orientation;return __rspack_external_react.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),"hover"===a.type?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarHover,{...n,ref:t,forceMount:r}):"scroll"===a.type?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarScroll,{...n,ref:t,forceMount:r}):"auto"===a.type?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarAuto,{...n,ref:t,forceMount:r}):"always"===a.type?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarVisible,{...n,ref:t,"data-state":"visible"}):null},"ScrollAreaScrollbar")),ScrollAreaScrollbarHover=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{forceMount:r,...n}=e,a=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),[i,o]=__rspack_external_react.useState(!1);return __rspack_external_react.useEffect(()=>{let e=a.scrollArea,t=0;if(e){let r=/* @__PURE__ */react_scroll_area_dist_name(()=>{window.clearTimeout(t),o(!0)},"handlePointerEnter"),n=/* @__PURE__ */react_scroll_area_dist_name(()=>{t=window.setTimeout(()=>o(!1),a.scrollHideDelay)},"handlePointerLeave");return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[a.scrollArea,a.scrollHideDelay]),/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||i,children:/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarAuto,{"data-state":i?"visible":"hidden",...n,ref:t})})},"ScrollAreaScrollbarHover")),ScrollAreaScrollbarScroll=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{forceMount:r,...n}=e,a=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),i="horizontal"===e.orientation,o=useDebounceCallback(()=>s("SCROLL_END"),100),[l,s]=dist_useStateMachine("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return __rspack_external_react.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>s("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,a.scrollHideDelay,s]),__rspack_external_react.useEffect(()=>{let e=a.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t],n=/* @__PURE__ */react_scroll_area_dist_name(()=>{let n=e[t];r!==n&&(s("SCROLL"),o()),r=n},"handleScroll");return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[a.viewport,i,s,o]),/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||"hidden"!==l,children:/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarVisible,{"data-state":"hidden"===l?"hidden":"visible",...n,ref:t,onPointerEnter:dist_composeEventHandlers(e.onPointerEnter,()=>s("POINTER_ENTER")),onPointerLeave:dist_composeEventHandlers(e.onPointerLeave,()=>s("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),ScrollAreaScrollbarAuto=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let r=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,o]=__rspack_external_react.useState(!1),l="horizontal"===e.orientation,s=useDebounceCallback(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;o(l?e:t)}},10);return useResizeObserver(r.viewport,s),useResizeObserver(r.content,s),/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:n||i,children:/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarVisible,{"data-state":i?"visible":"hidden",...a,ref:t})})},"ScrollAreaScrollbarAuto")),ScrollAreaScrollbarVisible=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{orientation:r="vertical",...n}=e,a=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),i=__rspack_external_react.useRef(null),o=__rspack_external_react.useRef(0),[l,s]=__rspack_external_react.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=getThumbRatio(l.viewport,l.content),u={...n,sizes:l,onSizesChange:s,hasThumb:!!(c>0&&c<1),onThumbChange:/* @__PURE__ */react_scroll_area_dist_name(e=>i.current=e,"onThumbChange"),onThumbPointerUp:/* @__PURE__ */react_scroll_area_dist_name(()=>o.current=0,"onThumbPointerUp"),onThumbPointerDown:/* @__PURE__ */react_scroll_area_dist_name(e=>o.current=e,"onThumbPointerDown")};function d(e,t){return getScrollPositionFromPointer(e,o.current,l,t)}return(react_scroll_area_dist_name(d,"getScrollPosition"),"horizontal"===r)?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarX,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){let e=getThumbOffsetFromScroll(a.viewport.scrollLeft,l,a.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=d(e,a.dir))}}):"vertical"===r?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarY,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){let e=getThumbOffsetFromScroll(a.viewport.scrollTop,l);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=d(e))}}):null},"ScrollAreaScrollbarVisible")),ScrollAreaScrollbarX=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{sizes:r,onSizesChange:n,...a}=e,i=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),[o,l]=__rspack_external_react.useState(),s=__rspack_external_react.useRef(null),c=dist_useComposedRefs(t,s,i.onScrollbarXChange);return __rspack_external_react.useEffect(()=>{s.current&&l(getComputedStyle(s.current))},[s]),/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarImpl,{"data-orientation":"horizontal",...a,ref:c,sizes:r,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":getThumbSize(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(i.viewport){let n=i.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),isScrollingWithinScrollbarBounds(n,r)&&t.preventDefault()}},onResize:()=>{s.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:s.current.clientWidth,paddingStart:toInt(o.paddingLeft),paddingEnd:toInt(o.paddingRight)}})}})},"ScrollAreaScrollbarX")),ScrollAreaScrollbarY=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{sizes:r,onSizesChange:n,...a}=e,i=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),[o,l]=__rspack_external_react.useState(),s=__rspack_external_react.useRef(null),c=dist_useComposedRefs(t,s,i.onScrollbarYChange);return __rspack_external_react.useEffect(()=>{s.current&&l(getComputedStyle(s.current))},[s]),/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarImpl,{"data-orientation":"vertical",...a,ref:c,sizes:r,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":getThumbSize(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(i.viewport){let n=i.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),isScrollingWithinScrollbarBounds(n,r)&&t.preventDefault()}},onResize:()=>{s.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:s.current.clientHeight,paddingStart:toInt(o.paddingTop),paddingEnd:toInt(o.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[ScrollbarProvider,useScrollbarContext]=createScrollAreaContext(SCROLLBAR_NAME),ScrollAreaScrollbarImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:s,onDragScroll:c,onWheelScroll:u,onResize:d,...h}=e,p=useScrollAreaContext(SCROLLBAR_NAME,r),[f,m]=__rspack_external_react.useState(null),g=dist_useComposedRefs(t,m),b=__rspack_external_react.useRef(null),v=__rspack_external_react.useRef(""),w=p.viewport,y=n.content-n.viewport,x=dist_useCallbackRef(u),k=dist_useCallbackRef(s),S=useDebounceCallback(d,10);function D(e){b.current&&c({x:e.clientX-b.current.left,y:e.clientY-b.current.top})}return react_scroll_area_dist_name(D,"handleDragScroll"),__rspack_external_react.useEffect(()=>{let e=/* @__PURE__ */react_scroll_area_dist_name(e=>{let t=e.target;f?.contains(t)&&x(e,y)},"handleWheel");return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,f,y,x]),__rspack_external_react.useEffect(k,[n,k]),useResizeObserver(f,S),useResizeObserver(p.content,S),/* @__PURE__ */jsx_runtime_jsx(ScrollbarProvider,{scope:r,scrollbar:f,hasThumb:a,onThumbChange:dist_useCallbackRef(i),onThumbPointerUp:dist_useCallbackRef(o),onThumbPositionChange:k,onThumbPointerDown:dist_useCallbackRef(l),children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:dist_composeEventHandlers(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),b.current=f.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),D(e))}),onPointerMove:dist_composeEventHandlers(e.onPointerMove,D),onPointerUp:dist_composeEventHandlers(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})},"ScrollAreaScrollbarImpl")),THUMB_NAME="ScrollAreaThumb",ScrollAreaThumb=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{forceMount:r,...n}=e,a=useScrollbarContext(THUMB_NAME,e.__scopeScrollArea);return /* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||a.hasThumb,children:/* @__PURE__ */jsx_runtime_jsx(ScrollAreaThumbImpl,{ref:t,...n})})},"ScrollAreaThumb")),ScrollAreaThumbImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,style:n,...a}=e,i=useScrollAreaContext(THUMB_NAME,r),o=useScrollbarContext(THUMB_NAME,r),{onThumbPositionChange:l}=o,s=dist_useComposedRefs(t,o.onThumbChange),c=__rspack_external_react.useRef(void 0),u=useDebounceCallback(()=>{c.current&&(c.current(),c.current=void 0)},100);return __rspack_external_react.useEffect(()=>{let e=i.viewport;if(e){let t=/* @__PURE__ */react_scroll_area_dist_name(()=>{u(),c.current||(c.current=addUnlinkedScrollListener(e,l),l())},"handleScroll");return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,u,l]),/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:s,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:dist_composeEventHandlers(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;o.onThumbPointerDown({x:r,y:n})}),onPointerUp:dist_composeEventHandlers(e.onPointerUp,o.onThumbPointerUp)})},"ScrollAreaThumbImpl")),CORNER_NAME="ScrollAreaCorner",ScrollAreaCorner=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let r=useScrollAreaContext(CORNER_NAME,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaCornerImpl,{...e,ref:t}):null},"ScrollAreaCorner")),ScrollAreaCornerImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,...n}=e,a=useScrollAreaContext(CORNER_NAME,r),[i,o]=__rspack_external_react.useState(0),[l,s]=__rspack_external_react.useState(0),c=!!(i&&l),{onCornerWidthChange:u,onCornerHeightChange:d}=a;return useResizeObserver(a.scrollbarX,()=>{let e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),s(e)}),useResizeObserver(a.scrollbarY,()=>{let e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),o(e)}),__rspack_external_react.useEffect(()=>()=>{u(0),d(0)},[u,d]),c?/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{...n,ref:t,style:{width:i,height:l,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null},"ScrollAreaCornerImpl"));function toInt(e){return e?parseInt(e,10):0}function getThumbRatio(e,t){let r=e/t;return isNaN(r)?0:r}function getThumbSize(e){let t=getThumbRatio(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function getScrollPositionFromPointer(e,t,r,n="ltr"){let a=getThumbSize(r),i=t||a/2,o=r.scrollbar.paddingStart+i,l=r.scrollbar.size-r.scrollbar.paddingEnd-(a-i),s=r.content-r.viewport;return linearScale([o,l],"ltr"===n?[0,s]:[-1*s,0])(e)}function getThumbOffsetFromScroll(e,t,r="ltr"){let n=getThumbSize(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,o=t.content-t.viewport,l=dist_clamp(e,"ltr"===r?[0,o]:[-1*o,0]);return linearScale([0,o],[0,i-n])(l)}function linearScale(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function isScrollingWithinScrollbarBounds(e,t){return e>0&&e<t}react_scroll_area_dist_name(toInt,"toInt"),react_scroll_area_dist_name(getThumbRatio,"getThumbRatio"),react_scroll_area_dist_name(getThumbSize,"getThumbSize"),react_scroll_area_dist_name(getScrollPositionFromPointer,"getScrollPositionFromPointer"),react_scroll_area_dist_name(getThumbOffsetFromScroll,"getThumbOffsetFromScroll"),react_scroll_area_dist_name(linearScale,"linearScale"),react_scroll_area_dist_name(isScrollingWithinScrollbarBounds,"isScrollingWithinScrollbarBounds");var addUnlinkedScrollListener=/* @__PURE__ */react_scroll_area_dist_name((e,t=()=>{})=>(e.scrollLeft,e.scrollTop,()=>window.cancelAnimationFrame(0)),"addUnlinkedScrollListener");function useDebounceCallback(e,t){let r=dist_useCallbackRef(e),n=__rspack_external_react.useRef(0);return __rspack_external_react.useEffect(()=>()=>window.clearTimeout(n.current),[]),__rspack_external_react.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function useResizeObserver(e,t){let r=dist_useCallbackRef(t);useLayoutEffect2(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}react_scroll_area_dist_name(useDebounceCallback,"useDebounceCallback"),react_scroll_area_dist_name(useResizeObserver,"useResizeObserver");var react_scroll_area_dist_Root=ScrollArea,Viewport=ScrollAreaViewport,Scrollbar=null,Thumb=null,Corner=ScrollAreaCorner;let ScrollBar=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,orientation:t="vertical",...r},n)=>/*#__PURE__*/jsx_runtime_jsx(ScrollAreaScrollbar,{ref:n,orientation:t,className:cn_cn("flex touch-none select-none p-0.5 transition-colors","vertical"===t?"h-full w-2.5 border-l border-l-transparent":"h-2.5 flex-col border-t border-t-transparent",e),...r,children:/*#__PURE__*/jsx_runtime_jsx(ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border/80"})}));ScrollBar.displayName=ScrollAreaScrollbar.displayName;let scroll_area_ScrollArea=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,viewportClassName:t,children:r,...n},a)=>/*#__PURE__*/jsxs(react_scroll_area_dist_Root,{ref:a,"data-slot":"scroll-area",className:cn_cn("relative overflow-hidden",e),...n,children:[/*#__PURE__*/jsx_runtime_jsx(Viewport,{"data-slot":"scroll-area-viewport",className:cn_cn("h-full w-full rounded-[inherit]",t),children:r}),/*#__PURE__*/jsx_runtime_jsx(ScrollBar,{}),/*#__PURE__*/jsx_runtime_jsx(Corner,{})]}));scroll_area_ScrollArea.displayName=react_scroll_area_dist_Root.displayName;let Mask=/*#__PURE__*/forwardRef(({children:e,className:t,style:r},n)=>/*#__PURE__*/jsxs("div",{className:cn_cn("relative z-[8] flex flex-col items-start p-2 text-popover-foreground",t),style:r,ref:n,children:[/*#__PURE__*/jsx_runtime_jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-[7] rounded-[var(--radius-surface)] border border-border/70 bg-chart-panel/95 shadow-lg [backdrop-filter:saturate(2)_blur(20px)]"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative z-[8] h-full w-full",children:e})]})),components_Mask=/*#__PURE__*/react.memo(Mask);var react_visually_hidden_dist_defProp=Object.defineProperty,react_visually_hidden_dist_name=(e,t)=>react_visually_hidden_dist_defProp(e,"name",{value:t,configurable:!0}),VISUALLY_HIDDEN_STYLES=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),VisuallyHidden=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_visually_hidden_dist_name(function(e,t){return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.span,{...e,ref:t,style:{...VISUALLY_HIDDEN_STYLES,...e.style}})},"VisuallyHidden")),react_visually_hidden_dist_Root=VisuallyHidden,react_tooltip_dist_defProp=Object.defineProperty,react_tooltip_dist_name=(e,t)=>react_tooltip_dist_defProp(e,"name",{value:t,configurable:!0}),[createTooltipContext,createTooltipScope]=createContextScope("Tooltip",[createPopperScope]),dist_usePopperScope=createPopperScope(),dist_PROVIDER_NAME="TooltipProvider",DEFAULT_DELAY_DURATION=700,TOOLTIP_OPEN="tooltip.open",[TooltipProviderContextProvider,useTooltipProviderContext]=createTooltipContext(dist_PROVIDER_NAME),TooltipProvider=/* @__PURE__ */react_tooltip_dist_name(e=>{let{__scopeTooltip:t,delayDuration:r=DEFAULT_DELAY_DURATION,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:i}=e,o=__rspack_external_react.useRef(!0),l=__rspack_external_react.useRef(!1),s=__rspack_external_react.useRef(0);return __rspack_external_react.useEffect(()=>{let e=s.current;return()=>window.clearTimeout(e)},[]),/* @__PURE__ */jsx_runtime_jsx(TooltipProviderContextProvider,{scope:t,isOpenDelayedRef:o,delayDuration:r,onOpen:__rspack_external_react.useCallback(()=>{n<=0||(window.clearTimeout(s.current),o.current=!1)},[n]),onClose:__rspack_external_react.useCallback(()=>{n<=0||(window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.current=!0,n))},[n]),isPointerInTransitRef:l,onPointerInTransitChange:__rspack_external_react.useCallback(e=>{l.current=e},[]),disableHoverableContent:a,children:i})},"TooltipProvider"),TOOLTIP_NAME="Tooltip",[TooltipContextProvider,useTooltipContext]=createTooltipContext(TOOLTIP_NAME),dist_Tooltip=/* @__PURE__ */react_tooltip_dist_name(e=>{let{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,s=useTooltipProviderContext(TOOLTIP_NAME,e.__scopeTooltip),c=dist_usePopperScope(t),[u,d]=__rspack_external_react.useState(null),[h,p]=__rspack_external_react.useState(void 0),f=dist_useId(),m=__rspack_external_react.useRef(0),g=o??s.disableHoverableContent,b=l??s.delayDuration,v=__rspack_external_react.useRef(!1),[w,y]=dist_useControllableState({prop:n,defaultProp:a??!1,onChange:/* @__PURE__ */react_tooltip_dist_name(e=>{e?(s.onOpen(),document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))):s.onClose(),i?.(e)},"onChange"),caller:TOOLTIP_NAME}),x=__rspack_external_react.useMemo(()=>w?v.current?"delayed-open":"instant-open":"closed",[w]),k=__rspack_external_react.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,y(!0)},[y]),S=__rspack_external_react.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),D=__rspack_external_react.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,y(!0),m.current=0},b)},[b,y]);return __rspack_external_react.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),/* @__PURE__ */jsx_runtime_jsx(Root2,{...c,children:/* @__PURE__ */jsx_runtime_jsx(TooltipContextProvider,{scope:t,contentId:h??f,setContentId:p,open:w,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:__rspack_external_react.useCallback(()=>{s.isOpenDelayedRef.current?D():k()},[s.isOpenDelayedRef,D,k]),onTriggerLeave:__rspack_external_react.useCallback(()=>{g?S():(window.clearTimeout(m.current),m.current=0)},[S,g]),onOpen:k,onClose:S,disableHoverableContent:g,children:r})})},"Tooltip"),dist_TRIGGER_NAME="TooltipTrigger",TooltipTrigger=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let{__scopeTooltip:r,...n}=e,a=useTooltipContext(dist_TRIGGER_NAME,r),i=useTooltipProviderContext(dist_TRIGGER_NAME,r),o=dist_usePopperScope(r),l=dist_useComposedRefs(t,__rspack_external_react.useRef(null),a.onTriggerChange),s=__rspack_external_react.useRef(!1),c=__rspack_external_react.useRef(!1),u=__rspack_external_react.useCallback(()=>s.current=!1,[]);return __rspack_external_react.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),/* @__PURE__ */jsx_runtime_jsx(Anchor,{asChild:!0,...o,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:l,onPointerMove:dist_composeEventHandlers(e.onPointerMove,e=>{"touch"!==e.pointerType&&(c.current||i.isPointerInTransitRef.current||(a.onTriggerEnter(),c.current=!0))}),onPointerLeave:dist_composeEventHandlers(e.onPointerLeave,()=>{a.onTriggerLeave(),c.current=!1}),onPointerDown:dist_composeEventHandlers(e.onPointerDown,()=>{a.open&&a.onClose(),s.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:dist_composeEventHandlers(e.onFocus,()=>{s.current||a.onOpen()}),onBlur:dist_composeEventHandlers(e.onBlur,a.onClose),onClick:dist_composeEventHandlers(e.onClick,a.onClose)})})},"TooltipTrigger")),dist_PORTAL_NAME="TooltipPortal",[dist_PortalProvider,dist_usePortalContext]=createTooltipContext(dist_PORTAL_NAME,{forceMount:void 0}),TooltipPortal=/* @__PURE__ */react_tooltip_dist_name(e=>{let{__scopeTooltip:t,forceMount:r,children:n,container:a}=e,i=useTooltipContext(dist_PORTAL_NAME,t);return /* @__PURE__ */jsx_runtime_jsx(dist_PortalProvider,{scope:t,forceMount:r,children:/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||i.open,children:/* @__PURE__ */jsx_runtime_jsx(Portal,{asChild:!0,container:a,children:n})})})},"TooltipPortal"),react_tooltip_dist_CONTENT_NAME="TooltipContent",TooltipContent=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let r=dist_usePortalContext(react_tooltip_dist_CONTENT_NAME,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...i}=e,o=useTooltipContext(react_tooltip_dist_CONTENT_NAME,e.__scopeTooltip);return /* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:n||o.open,children:o.disableHoverableContent?/* @__PURE__ */jsx_runtime_jsx(TooltipContentImpl,{side:a,...i,ref:t}):/* @__PURE__ */jsx_runtime_jsx(TooltipContentHoverable,{side:a,...i,ref:t})})},"TooltipContent")),TooltipContentHoverable=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let r=useTooltipContext(react_tooltip_dist_CONTENT_NAME,e.__scopeTooltip),n=useTooltipProviderContext(react_tooltip_dist_CONTENT_NAME,e.__scopeTooltip),a=__rspack_external_react.useRef(null),i=dist_useComposedRefs(t,a),[o,l]=__rspack_external_react.useState(null),{trigger:s,onClose:c}=r,u=a.current,{onPointerInTransitChange:d}=n,h=__rspack_external_react.useCallback(()=>{l(null),d(!1)},[d]),p=__rspack_external_react.useCallback((e,t)=>{let r=e.currentTarget,n={x:e.clientX,y:e.clientY},a=getExitSideFromRect(n,r.getBoundingClientRect());l(getHull([...getPaddedExitPoints(n,a),...getPointsFromRect(t.getBoundingClientRect())])),d(!0)},[d]);return __rspack_external_react.useEffect(()=>()=>h(),[h]),__rspack_external_react.useEffect(()=>{if(s&&u){let e=/* @__PURE__ */react_tooltip_dist_name(e=>p(e,u),"handleTriggerLeave"),t=/* @__PURE__ */react_tooltip_dist_name(e=>p(e,s),"handleContentLeave");return s.addEventListener("pointerleave",e),u.addEventListener("pointerleave",t),()=>{s.removeEventListener("pointerleave",e),u.removeEventListener("pointerleave",t)}}},[s,u,p,h]),__rspack_external_react.useEffect(()=>{if(o){let e=/* @__PURE__ */react_tooltip_dist_name(e=>{let t=e.target,r={x:e.clientX,y:e.clientY},n=s?.contains(t)||u?.contains(t),a=!dist_isPointInPolygon(r,o);n?h():a&&(h(),c())},"handleTrackPointerGrace");return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[s,u,o,c,h]),/* @__PURE__ */jsx_runtime_jsx(TooltipContentImpl,{...e,ref:i})},"TooltipContentHoverable")),dist_Slottable=createSlottable("TooltipContent"),TooltipContentImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let{__scopeTooltip:r,children:n,"aria-label":a,id:i,onEscapeKeyDown:o,onPointerDownOutside:l,...s}=e,c=useTooltipContext(react_tooltip_dist_CONTENT_NAME,r),u=dist_usePopperScope(r),{onClose:d}=c;__rspack_external_react.useEffect(()=>(document.addEventListener(TOOLTIP_OPEN,d),()=>document.removeEventListener(TOOLTIP_OPEN,d)),[d]),__rspack_external_react.useEffect(()=>{if(c.trigger){let e=/* @__PURE__ */react_tooltip_dist_name(e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&d()},"handleScroll");return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[c.trigger,d]);let{setContentId:h}=c;return useLayoutEffect2(()=>(h(i),()=>{h(void 0)}),[i,h]),/* @__PURE__ */jsx_runtime_jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:/* @__PURE__ */jsxs(Content,{"data-state":c.stateAttribute,role:a?void 0:"tooltip",id:a?void 0:c.contentId,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[/* @__PURE__ */jsx_runtime_jsx(dist_Slottable,{children:n}),a?/* @__PURE__ */jsx_runtime_jsx(react_visually_hidden_dist_Root,{id:c.contentId,role:"tooltip",children:a}):null]})})},"TooltipContentImpl")),TooltipArrow=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let{__scopeTooltip:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(dist_Arrow,{...dist_usePopperScope(r),...n,ref:t})},"TooltipArrow"));function getExitSideFromRect(e,t){let r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,a,i)){case i:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw Error("unreachable")}}function getPaddedExitPoints(e,t,r=5){let n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return n}function getPointsFromRect(e){let{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function dist_isPointInPolygon(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let o=t[e],l=t[i],s=o.x,c=o.y,u=l.x,d=l.y;c>n!=d>n&&r<(u-s)*(n-c)/(d-c)+s&&(a=!a)}return a}function getHull(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:1*!!(e.y>t.y)),getHullPresorted(t)}function getHullPresorted(e){if(e.length<=1)return e.slice();let t=[];for(let r=0;r<e.length;r++){let n=e[r];for(;t.length>=2;){let e=t[t.length-1],r=t[t.length-2];if((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x))t.pop();else break}t.push(n)}t.pop();let r=[];for(let t=e.length-1;t>=0;t--){let n=e[t];for(;r.length>=2;){let e=r[r.length-1],t=r[r.length-2];if((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x))r.pop();else break}r.push(n)}return(r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y)?t:t.concat(r)}react_tooltip_dist_name(getExitSideFromRect,"getExitSideFromRect"),react_tooltip_dist_name(getPaddedExitPoints,"getPaddedExitPoints"),react_tooltip_dist_name(getPointsFromRect,"getPointsFromRect"),react_tooltip_dist_name(dist_isPointInPolygon,"isPointInPolygon"),react_tooltip_dist_name(getHull,"getHull"),react_tooltip_dist_name(getHullPresorted,"getHullPresorted");var react_tooltip_dist_Provider=TooltipProvider,dist_Root3=dist_Tooltip,dist_Trigger=TooltipTrigger,react_tooltip_dist_Portal=TooltipPortal,react_tooltip_dist_Content2=TooltipContent,react_tooltip_dist_Arrow2=TooltipArrow;function tooltip_TooltipProvider({delayDuration:e=0,...t}){return /*#__PURE__*/jsx_runtime_jsx(react_tooltip_dist_Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function tooltip_Tooltip({...e}){return /*#__PURE__*/jsx_runtime_jsx(dist_Root3,{"data-slot":"tooltip",...e})}function tooltip_TooltipTrigger({...e}){return /*#__PURE__*/jsx_runtime_jsx(dist_Trigger,{"data-slot":"tooltip-trigger",...e})}function tooltip_TooltipContent({className:e,sideOffset:t=6,children:r,...n}){let a=useChartsPortalContainer("tooltip");return a?/*#__PURE__*/jsx_runtime_jsx(react_tooltip_dist_Portal,{container:a,children:/*#__PURE__*/jsxs(react_tooltip_dist_Content2,{"data-slot":"tooltip-content",sideOffset:t,className:cn_cn("z-50 max-w-52 overflow-hidden rounded-[var(--radius-control)] border border-border/70 bg-popover/95 px-2.5 py-1.5 text-[11px] leading-4 text-popover-foreground shadow-lg backdrop-blur-md","pointer-events-none whitespace-pre-line","origin-[--radix-tooltip-content-transform-origin] data-[state=closed]:animate-out data-[state=open]:animate-in","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",e),...n,children:[r,/*#__PURE__*/jsx_runtime_jsx(react_tooltip_dist_Arrow2,{className:"fill-popover stroke-border/70 stroke-[0.5px]"})]})}):null}let TOOLTIP_MAX_WIDTH=200,TOOLTIP_SIDE_OFFSET=6,TOOLTIP_COLLISION_PADDING=8,Tooltip_Tooltip=({children:e,content:t,delay:r=200,duration:n=3e3,offset:a={x:0,y:0}})=>{let[i,o]=external_react_useState(!1),l=external_react_useRef(null),s=external_react_useCallback(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),c=external_react_useCallback(()=>{s(),n<=0||(l.current=setTimeout(()=>{o(!1),l.current=null},n))},[s,n]),u=external_react_useCallback(e=>{(o(e),e)?c():s()},[s,c]);return(external_react_useEffect(()=>()=>{s()},[s]),null==t||""===t)?e:/*#__PURE__*/jsx_runtime_jsx(tooltip_TooltipProvider,{delayDuration:r,children:/*#__PURE__*/jsxs(tooltip_Tooltip,{open:i,onOpenChange:u,children:[/*#__PURE__*/jsx_runtime_jsx(tooltip_TooltipTrigger,{asChild:!0,children:e}),/*#__PURE__*/jsx_runtime_jsx(tooltip_TooltipContent,{side:"top",align:"center",sideOffset:TOOLTIP_SIDE_OFFSET,collisionPadding:TOOLTIP_COLLISION_PADDING,avoidCollisions:!0,className:"border-0 bg-transparent p-0 text-xs shadow-none",style:{marginLeft:a.x??0,marginTop:a.y??0,maxWidth:TOOLTIP_MAX_WIDTH},children:/*#__PURE__*/jsx_runtime_jsx(components_Mask,{className:"max-w-[200px] whitespace-pre-line",children:t})})]})})},Overlay_Tooltip=Tooltip_Tooltip,Dropdown=({value:e,options:t,onChange:r,placeholder:n="请选择",triggerContent:a,triggerTitle:i,closeOnSelect:o=!0,triggerVariant:l="default",showChevron:s=!0,triggerClassName:c,contentClassName:u,contentAlignOffset:d,customContent:h,triggerTestId:p})=>{let[f,m]=external_react_useState(!1),g=external_react_useCallback(e=>{let t=e.value??null;e.onSelect?.(t),r?.(t),o&&m(!1)},[r,o]),b=external_react_useMemo(()=>t.find(t=>"separator"!==t.type&&t.value===e),[t,e]),v=cn_cn("inline-flex h-full min-w-0 items-center truncate text-xs leading-none text-foreground","default"===l&&"flex-1"),w=a??(b?.label?/*#__PURE__*/jsx_runtime_jsx("span",{className:v,children:b.label}):"string"==typeof n?/*#__PURE__*/jsx_runtime_jsx("span",{className:v,children:n}):/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn("inline-flex h-full min-w-0 items-center","default"===l&&"flex-1"),children:n})),y=/*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuTrigger,{asChild:!0,children:/*#__PURE__*/jsxs("button",{type:"button","data-testid":p,className:cn_cn("cursor-pointer appearance-none select-none border-0 bg-transparent text-left","default"===l&&TOOLBAR_OUTLINED_TRIGGER_CLASS_NAME,"default"===l&&TOOLBAR_OUTLINED_TRIGGER_OPEN_CLASS_NAME,"plain"===l&&TOOLBAR_INLINE_TRIGGER_CLASS_NAME,c),children:[w,s?/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:cn_cn("ml-[calc(var(--size-gap-base)/2)] inline-flex h-full shrink-0 items-center justify-center text-[10px] text-muted-foreground transition-transform",f&&"rotate-180"),children:"▼"}):null]})});return /*#__PURE__*/jsxs(dropdown_menu_DropdownMenu,{open:f,onOpenChange:m,modal:!1,children:[i?/*#__PURE__*/jsx_runtime_jsx(Overlay_Tooltip,{content:i,children:y}):y,/*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuContent,{align:"start",alignOffset:d,collisionPadding:8,className:cn_cn("min-w-[140px] [min-width:var(--radix-dropdown-menu-trigger-width)]",u),children:h??/*#__PURE__*/jsx_runtime_jsx(scroll_area_ScrollArea,{viewportClassName:"h-auto max-h-64",children:/*#__PURE__*/jsx_runtime_jsx("div",{children:t.map((t,r)=>"separator"===t.type?/*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuSeparator,{style:t.style},`separator-${t.label??r}`):/*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuItem,{disabled:t.disabled,className:cn_cn(e===t.value&&"bg-accent text-primary",t.disabled&&"data-[disabled]:text-muted-foreground"),style:t.style,onSelect:e=>{o||e.preventDefault(),g(t)},children:t.render?t.render():t.label},null!==t.value&&void 0!==t.value?t.value:`null-option-${r}`))})})})]})},Overlay_Dropdown=Dropdown,DEFAULT_SAMPLE_INTERVAL_MS=80,DEFAULT_SAMPLE_IDLE_DELAY_MS=80,interaction_createBounds=(e,t,r,n)=>({left:e,top:t,right:r,bottom:n,width:Math.max(0,r-e),height:Math.max(0,n-t)}),toCursorEventSnapshot=e=>({sourceId:e.sourceId,sourceType:e.sourceType,clientX:e.clientX,clientY:e.clientY,bounds:e.bounds}),isSameSample=(e,t)=>e?.sourceId===t.sourceId&&e?.sourceType===t.sourceType&&e?.coord.left===t.coord.left&&e?.coord.top===t.coord.top&&e?.clientX===t.clientX&&e?.clientY===t.clientY&&e?.bounds.left===t.bounds.left&&e?.bounds.top===t.bounds.top&&e?.bounds.right===t.bounds.right&&e?.bounds.bottom===t.bounds.bottom&&e?.sampledIndex===t.sampledIndex&&e?.globalIndex===t.globalIndex&&e?.rowIndex===t.rowIndex;class InteractionRuntime{entries=new Map;sampleIntervalMs;sampleIdleDelayMs;now;requestFrame;cancelFrame;setTimer;clearTimer;constructor(e={}){this.sampleIntervalMs=e.sampleIntervalMs??DEFAULT_SAMPLE_INTERVAL_MS,this.sampleIdleDelayMs=e.sampleIdleDelayMs??DEFAULT_SAMPLE_IDLE_DELAY_MS,this.now=e.now??(()=>Date.now()),this.requestFrame=e.requestFrame??(e=>"u">typeof window?window.requestAnimationFrame(e):Number(setTimeout(e,16))),this.cancelFrame=e.cancelFrame??(e=>{"u">typeof window?window.cancelAnimationFrame(e):clearTimeout(e)}),this.setTimer=e.setTimer??((e,t)=>"u">typeof window?window.setTimeout(e,t):setTimeout(e,t)),this.clearTimer=e.clearTimer??(e=>{"u">typeof window?window.clearTimeout(e):clearTimeout(e)})}updatePointer(e,t){let r=this.ensureEntry(e);r.version+=1,r.pointer={...t,version:r.version,timestamp:this.now()},this.schedulePointerFrame(r),this.scheduleSample(r)}refreshBounds(e,t){let r=this.ensureEntry(e);r.pointer&&(r.version+=1,r.pointer={...r.pointer,bounds:t,version:r.version,timestamp:this.now()},this.schedulePointerFrame(r))}clearPointer(e,t="manual"){let r=this.entries.get(e);r&&(r.pointer=null,r.sample=null,r.lastSampleTimestamp=0,r.hasSampleTimestamp=!1,this.clearEntryTimers(r),this.notifyPointer(r,null),this.notifySample(r,null))}subscribePointer(e,t){let r=this.ensureEntry(e);return r.pointerListeners.add(t),t(r.pointer),()=>{r.pointerListeners.delete(t),this.cleanupEntryIfEmpty(e,r)}}subscribeSample(e,t){let r=this.ensureEntry(e);return r.sampleListeners.add(t),t(r.sample),()=>{r.sampleListeners.delete(t),this.cleanupEntryIfEmpty(e,r)}}getPointer(e){return this.entries.get(e)?.pointer??null}getSample(e){return this.entries.get(e)?.sample??null}dispose(e){if(e){let t=this.entries.get(e);if(!t)return;this.clearPointer(e,"dispose"),t.pointerListeners.clear(),t.sampleListeners.clear(),this.entries.delete(e);return}for(let e of Array.from(this.entries.keys()))this.dispose(e)}ensureEntry(e){let t=this.entries.get(e);if(t)return t;let r={pointer:null,sample:null,pointerListeners:new Set,sampleListeners:new Set,pointerFrame:null,sampleTimer:null,idleTimer:null,lastSampleTimestamp:0,hasSampleTimestamp:!1,version:0};return this.entries.set(e,r),r}schedulePointerFrame(e){null===e.pointerFrame&&(e.pointerFrame=this.requestFrame(()=>{e.pointerFrame=null,this.notifyPointer(e,e.pointer)}))}scheduleSample(e){if(!e.pointer)return;let t=this.now()-e.lastSampleTimestamp;!e.hasSampleTimestamp||t>=this.sampleIntervalMs?this.flushSample(e):e.sampleTimer||(e.sampleTimer=this.setTimer(()=>{e.sampleTimer=null,this.flushSample(e)},this.sampleIntervalMs-t)),e.idleTimer&&this.clearTimer(e.idleTimer),e.idleTimer=this.setTimer(()=>{e.idleTimer=null,this.flushSample(e)},this.sampleIdleDelayMs)}flushSample(e){if(!e.pointer)return;let t={...e.pointer};e.lastSampleTimestamp=this.now(),e.hasSampleTimestamp=!0,isSameSample(e.sample,t)||(e.sample=t,this.notifySample(e,t))}notifyPointer(e,t){for(let r of Array.from(e.pointerListeners))r(t)}notifySample(e,t){for(let r of Array.from(e.sampleListeners))r(t)}clearEntryTimers(e){null!==e.pointerFrame&&(this.cancelFrame(e.pointerFrame),e.pointerFrame=null),e.sampleTimer&&(this.clearTimer(e.sampleTimer),e.sampleTimer=null),e.idleTimer&&(this.clearTimer(e.idleTimer),e.idleTimer=null)}cleanupEntryIfEmpty(e,t){t.pointerListeners.size>0||t.sampleListeners.size>0||t.pointer||t.sample||(this.clearEntryTimers(t),this.entries.delete(e))}}let interactionRuntime=new InteractionRuntime,createInteractionBounds=null,toCursorSnapshotEvent=toCursorEventSnapshot,cursor_follow_layer_useSafeLayoutEffect="u"<typeof window?external_react_useEffect:useLayoutEffect,isValidBounds=e=>Number.isFinite(e.left)&&Number.isFinite(e.top)&&Number.isFinite(e.right)&&Number.isFinite(e.bottom)&&Number.isFinite(e.width)&&Number.isFinite(e.height)&&e.width>0&&e.height>0&&e.right>e.left&&e.bottom>e.top,isPointWithinBounds=(e,t,r)=>e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom,CursorFollowLayer=({children:e,interactionId:t,margin:r=8,className:n})=>{let a=external_react_useRef(null),i=useChartsPortalContainer("cursor-follow"),o=external_react_useMemo(()=>Children.toArray(e),[e]),l=o.length>0,s=external_react_useCallback(()=>{a.current&&(a.current.style.visibility="hidden",a.current.style.transform="translate3d(-100vw, -100vh, 0)")},[]),c=external_react_useRef(null),u=external_react_useCallback((e=c.current)=>{if(!e||!a.current||!l)return void s();c.current=e;let t=a.current,{clientX:n,clientY:i,bounds:o}=e;if(!Number.isFinite(n)||!Number.isFinite(i)||!isValidBounds(o))return void s();let{width:u,height:d}=t.getBoundingClientRect(),h=window.innerWidth,p=window.innerHeight;if(n<0||i<0||n>h||i>p||!isPointWithinBounds(n,i,o))return void s();let f=o.left+r,m=o.top+r,g=o.right-r,b=o.bottom-r,v=Math.max(r,h-u-r),w=Math.max(r,p-d-r),y=Math.max(f,g-u),x=Math.max(m,b-d),k=Math.max(0,o.width-2*r),S=Math.max(0,o.height-2*r),D=i+r,M=n+r;M+u>g&&(M=n-u-r),D+d>b&&(D=i-d-r),M=u<=k?Math.min(Math.max(M,f),y):Math.min(Math.max(M,r),v),D=d<=S?Math.min(Math.max(D,m),x):Math.min(Math.max(D,r),w),t.style.visibility="visible",t.style.transform=`translate3d(${M}px, ${D}px, 0)`},[l,s,r]);return(cursor_follow_layer_useSafeLayoutEffect(()=>l&&t?interactionRuntime.subscribePointer(t,e=>{if(!e){c.current=null,s();return}u(e)}):void s(),[l,s,t,u]),cursor_follow_layer_useSafeLayoutEffect(()=>{if(i)return i.setAttribute("data-rfkit-cursor-layer","true"),()=>{i.removeAttribute("data-rfkit-cursor-layer")}},[i]),cursor_follow_layer_useSafeLayoutEffect(()=>{l?u():s()}),cursor_follow_layer_useSafeLayoutEffect(()=>{if(!a.current||!l)return;let e=()=>{u()},t=new ResizeObserver(()=>{u()});return t.observe(a.current),window.addEventListener("resize",e),()=>{t.disconnect(),window.removeEventListener("resize",e)}},[l,u]),l&&i)?/*#__PURE__*/createPortal(/*#__PURE__*/jsx_runtime_jsx("div",{ref:a,className:cn_cn("pointer-events-none fixed left-0 top-0 z-10 will-change-transform",n),style:{transform:"translate3d(-100vw, -100vh, 0)",visibility:"hidden"},children:o}),i):null},cursor_follow_layer=CursorFollowLayer,Popover=({children:e,id:t})=>/*#__PURE__*/jsx_runtime_jsx(cursor_follow_layer,{interactionId:t,margin:UI_CONFIG.POPOVER_MARGIN,children:e}),Overlay_Popover=Popover,Portal_Portal=({id:e,children:t})=>{let[r,n]=external_react_useState(null);return(external_react_useEffect(()=>{let t;if(e&&((t=document.getElementById(e))&&n(t),!document.getElementById(e))){let t=new MutationObserver(()=>{let r=document.getElementById(e);r&&(n(r),t.disconnect())});return t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()}},[e]),r)?/*#__PURE__*/react_dom.createPortal(t,r):null},Overlay_Portal=Portal_Portal,getAccessibleLabel=e=>"string"==typeof e||"number"==typeof e?String(e).trim()||void 0:Array.isArray(e)?e.map(e=>getAccessibleLabel(e)).filter(Boolean).join(" ").trim()||void 0:/*#__PURE__*/react.isValidElement(e)?getAccessibleLabel(e.props.children):void 0,ToolbarSurface=({style:e,className:t,title:r,active:n=!1,disabled:a=!1,onClick:i,onDoubleClick:o,onWheel:l,children:s})=>{let c=getAccessibleLabel(r),u=i&&(e=>{if(a){e.preventDefault(),e.stopPropagation();return}i(e)}),d=o&&(e=>{if(a){e.preventDefault(),e.stopPropagation();return}o(e)}),h=l&&(e=>{a?e.preventDefault():l(e)}),p=i||o?/*#__PURE__*/jsx_runtime_jsx("button",{type:"button",style:e,"aria-label":c,"aria-pressed":n||void 0,"aria-disabled":a||void 0,"data-active":n?"true":void 0,tabIndex:a?-1:void 0,onClick:u,onDoubleClick:d,onWheel:h,className:t,children:s}):l?/*#__PURE__*/jsx_runtime_jsx("div",{style:e,"aria-disabled":a||void 0,"data-active":n?"true":void 0,onWheel:h,className:t,children:s}):/*#__PURE__*/jsx_runtime_jsx("span",{style:e,"aria-disabled":a||void 0,"data-active":n?"true":void 0,className:t,children:s});return r?/*#__PURE__*/jsx_runtime_jsx(Overlay_Tooltip,{content:r,children:p}):p},primitives_ToolbarSurface=ToolbarSurface,IconBox_IconBox=({style:e,className:t,title:r,children:n,active:a=!1,tone:i="default",disabled:o=!1,onClick:l,onDoubleClick:s})=>{let c=TOOLBAR_ACTIVE_SURFACE_CLASS_NAME_MAP[i];return /*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarSurface,{style:e,className:cn_cn(TOOLBAR_ICON_BOX_CLASS_NAME,!!(l||s)&&TOOLBAR_INTERACTIVE_SURFACE_CLASS_NAME,o&&TOOLBAR_DISABLED_SURFACE_CLASS_NAME,a&&c,t),title:r,active:a,disabled:o,onClick:l,onDoubleClick:s,children:n})},primitives_IconBox=IconBox_IconBox,ToolbarContentBox=({style:e,className:t,contentClassName:r,title:n,active:a=!1,tone:i="default",disabled:o=!1,onClick:l,onDoubleClick:s,onWheel:c,children:u})=>{let d=TOOLBAR_ACTIVE_SURFACE_CLASS_NAME_MAP[i],h=cn_cn(TOOLBAR_CONTENT_BOX_CLASS_NAME,!!(l||s||c)&&TOOLBAR_INTERACTIVE_SURFACE_CLASS_NAME,o&&TOOLBAR_DISABLED_SURFACE_CLASS_NAME,a&&d,t),p=/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn(TOOLBAR_CONTENT_BODY_CLASS_NAME,r),children:u});return /*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarSurface,{style:e,className:h,title:n,active:a,disabled:o,onClick:l,onDoubleClick:s,onWheel:c,children:p})},primitives_ToolbarContentBox=ToolbarContentBox,ToolbarGlyph=({children:e,className:t,opticalOffsetX:r=0,opticalOffsetY:n=0,opticalScale:a=1})=>{let i=[];return(0!==r||0!==n)&&i.push(`translate(${r}px, ${n}px)`),1!==a&&i.push(`scale(${a})`),/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn(TOOLBAR_GLYPH_CLASS_NAME,t),style:i.length>0?{transform:i.join(" ")}:void 0,children:e})},primitives_ToolbarGlyph=ToolbarGlyph;var react_separator_dist_defProp=Object.defineProperty,react_separator_dist_name=(e,t)=>react_separator_dist_defProp(e,"name",{value:t,configurable:!0}),DEFAULT_ORIENTATION="horizontal",ORIENTATIONS=["horizontal","vertical"],dist_Separator=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_separator_dist_name(function(e,t){let{decorative:r,orientation:n=DEFAULT_ORIENTATION,...a}=e,i=isValidOrientation(n)?n:DEFAULT_ORIENTATION;return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-orientation":i,...r?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"},...a,ref:t})},"Separator"));function isValidOrientation(e){return ORIENTATIONS.includes(e)}react_separator_dist_name(isValidOrientation,"isValidOrientation");var react_separator_dist_Root=dist_Separator;function separator_Separator({className:e,orientation:t="horizontal",decorative:r=!0,...n}){return /*#__PURE__*/jsx_runtime_jsx(react_separator_dist_Root,{"data-slot":"separator",decorative:r,orientation:t,className:cn_cn("shrink-0 bg-border/70","horizontal"===t?"h-px w-full":"h-full w-px",e),...n})}let ToolbarGroup=({children:e,className:t,...r})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn(TOOLBAR_OUTLINED_SHELL_CLASS_NAME,"[&>*]:h-full [&>*]:shrink-0",t),...r,children:e}),ToolbarGroupSeparator=({className:e})=>/*#__PURE__*/jsx_runtime_jsx(separator_Separator,{className:cn_cn(TOOLBAR_GROUP_SEPARATOR_CLASS_NAME,e),orientation:"vertical"}),TOOLBAR_DROPDOWN_GROUP_ALIGN_OFFSET=-27,ToolbarDropdown=e=>/*#__PURE__*/jsx_runtime_jsx(Overlay_Dropdown,{...e,triggerVariant:"default",contentClassName:cn_cn(TOOLBAR_DROPDOWN_CONTENT_CLASS_NAME,e.contentClassName)}),ToolbarIconDropdown=({icon:e,title:t,triggerClassName:r,...n})=>{let a=/*#__PURE__*/jsx_runtime_jsx("span",{className:TOOLBAR_TRIGGER_ICON_CLASS_NAME,children:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGlyph,{children:e})});return /*#__PURE__*/jsx_runtime_jsx(Overlay_Dropdown,{...n,triggerVariant:"default",triggerTitle:t,contentClassName:cn_cn(TOOLBAR_DROPDOWN_CONTENT_CLASS_NAME,n.contentClassName),triggerClassName:cn_cn("min-w-0 justify-center gap-0.5 px-1",r),triggerContent:a})},ToolbarDropdownGroup=({leading:e,triggerClassName:t,contentAlignOffset:r=TOOLBAR_DROPDOWN_GROUP_ALIGN_OFFSET,...n})=>/*#__PURE__*/jsxs(ToolbarGroup,{children:[e,/*#__PURE__*/jsx_runtime_jsx(Overlay_Dropdown,{...n,triggerVariant:"plain",contentClassName:cn_cn(TOOLBAR_DROPDOWN_CONTENT_CLASS_NAME,n.contentClassName),contentAlignOffset:r,triggerClassName:cn_cn(TOOLBAR_INLINE_INSET_CLASS_NAME,t)})]}),ToolbarGroupIconBox=({className:e,...t})=>/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{...t,className:cn_cn(TOOLBAR_GROUP_CHILD_CLASS_NAME,e)}),primitives_ToolbarGroupIconBox=ToolbarGroupIconBox,handleColor=(e,t,r)=>subscription_createSubscriptionManager(`handleColor-${e}`,t,r,e),GradientRibbon_config=getConfig(),gradientConfig=GradientRibbon_config.gradient,initialIndex=gradientConfig.index,gradientItems=[...gradientConfig.item],GradientRibbon=()=>{let{state:{axisY:{range:e},globalID:t}}=useStore_useStore(),[r,n]=e??[0,0],[a,i]=external_react_useState(initialIndex),o=external_react_useMemo(()=>[...gradientItems[a]].reverse().map(hexToRGBA),[a]),l=external_react_useCallback(()=>{let e=(a+1)%gradientItems.length;i(e);let r=[...gradientItems[e]].reverse().map(hexToRGBA);t&&handleColor(t)(r)},[a,t]);external_react_useEffect(()=>{if(t)return handleColor(t,"setGradientColors",e=>{let t=gradientItems.findIndex(t=>JSON.stringify([...t].reverse().map(hexToRGBA))===JSON.stringify(e));-1!==t&&i(t)})},[t]);let s=external_react_useMemo(()=>o.map((e,t,r)=>{if(t===r.length-1)return null;let n=r[t+1];return /*#__PURE__*/jsx_runtime_jsx("span",{className:"flex-1",style:{background:`linear-gradient(to right, rgba(${e.r},${e.g},${e.b},${e.a}), rgba(${n.r},${n.g},${n.b},${n.a}))`}},`${e.r}-${e.g}-${e.b}-${e.a}-${n.r}-${n.g}-${n.b}-${n.a}`)}),[o]);return /*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarContentBox,{onClick:l,title:"点击切换瀑布图色阶",contentClassName:TOOLBAR_CONTENT_GRADIENT_CLASS_NAME,children:/*#__PURE__*/jsxs("div",{className:"relative flex h-full w-full select-none",children:[/*#__PURE__*/jsxs("div",{className:"absolute inset-0 flex h-full w-full justify-between text-[9px] text-white",children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex w-full items-center justify-center",children:Math.round(r)}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex w-full items-center justify-center",children:Math.round(n)})]}),s]})})},decorations_GradientRibbon=/*#__PURE__*/react.memo(GradientRibbon),SpacerLine=()=>/*#__PURE__*/jsx_runtime_jsx(separator_Separator,{className:TOOLBAR_SEPARATOR_CLASS_NAME,orientation:"vertical"}),decorations_SpacerLine=SpacerLine;class GradientRenderer extends BaseRenderer{getInitialColors(){return[...getGradient()].reverse().map(e=>hexToRGBA(e))}subscribeToColor(e){this.trackCleanup(handleColor(this.state.globalID,e,e=>{this.state.chart?.updateProps?.({colors:e})}))}updateParams(e){super.updateParams(e)}}let TYPE_CONFIG={iqEye:{Engine:IQEye},iqLine:{Engine:IQ},iqPlanisphere:{Engine:IQ,lineColor:"#ffffff00"},iqStream:{Engine:IQ}};class IQRenderer extends BaseRenderer{constructor(e){super({id:e.id,chart:null,type:e.type})}init(){let{id:e,type:t}=this.state;if(!e)return;let r=TYPE_CONFIG[t],n=getConfig("iq");this.state.chart=new r.Engine({id:e,...n,...r.lineColor&&{lineColor:r.lineColor}}),this.scheduleResize()}updateSeries(e){this.state.chart?.render(e)}}class DialRender extends CircularRenderer{constructor(e){super({id:e.id,chart:null})}init(){let{id:e}=this.state;e&&this.hasRenderableContainerSize()&&(this.state.chart=new Dial({id:e,...getThemeFillStyle(document.getElementById(e))}),this.scheduleResize(),this.subscribeToTheme())}}let Dial_Dial=()=>{let{chart:e,Chart:t}=hooks_useChart({Render:DialRender});return useModuleSubscription({moduleType:constants_ModuleType.Dial,chart:e}),/*#__PURE__*/jsx_runtime_jsx(components_Square,{children:/*#__PURE__*/jsx_runtime_jsx(t,{})})},modules_Dial=Dial_Dial,Chart_Chart=e=>{let{publish:t}=e,{state:{globalID:r}}=useStore_useStore();return publish_usePublish({publish:t,subscribe:e=>{passThrough(r,constants_ModuleType.Dial)(normalizeRenderPublishEvent(e,{allowImplicitRender:!0,renderPSTypes:[constants_PSType.Dial]}))}}),/*#__PURE__*/jsx_runtime_jsx(components_Container,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Dial,{})})},Dial_Chart=Chart_Chart,DialChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,system:{padding:!1,border:!1},children:/*#__PURE__*/jsx_runtime_jsx(Dial_Chart,{...e})}),charts_Dial_Dial=withChartPublisher(DialChart,"Dial"),charts_Dial=charts_Dial_Dial,InteractionSurface=({children:e,padding:t,limit:r,step:n,setLimit:a,onChange:i})=>{let{state:{axisY:{range:o=constants_RANGE_DEFAULT}}}=useStore_useStore(),[l,s]=o,c=external_react_useRef(null),[u,d]=external_react_useState(!1),h=external_react_useCallback(e=>{if(!c.current)return;let t=Math.round((s-l)*((c.current.offsetHeight-(e.clientY-c.current.getBoundingClientRect().top))/c.current.offsetHeight)+l);a(t=Math.max(l,Math.min(s,t)))},[l,s,a]),p=external_react_useCallback(e=>{h(e),d(!0)},[h]),f=external_react_useCallback(()=>{u&&i?.(r),d(!1)},[u,r,i]);return /*#__PURE__*/jsxs("div",{className:"relative h-full w-full",children:[/*#__PURE__*/jsx_runtime_jsx("div",{ref:c,onMouseDown:p,onMouseUp:f,onMouseLeave:f,onMouseMove:external_react_useCallback(e=>{u&&h(e)},[u,h]),onWheel:external_react_useCallback(e=>{let t=r+(e.deltaY>0?-n:n);a(t=Math.max(l,Math.min(s,t))),i?.(t)},[n,r,l,s,a,i]),style:{top:`${t}px`,height:`calc(100% - ${2*t}px)`},className:"absolute left-0 z-[5] w-full"}),e]})},Gauge_InteractionSurface=/*#__PURE__*/react.memo(InteractionSurface);class GaugeRender extends BaseRenderer{constructor(e){super({id:e.id,chart:null,props:e})}init(){let{id:e,props:t}=this.state;e&&(this.state.chart=new Gauge({...getThemeFillStyle(document.getElementById(e)),...t}),this.scheduleResize(),this.trackCleanup(subscribeChartsThemeChange(()=>{let e=this.getContainerElement();if(!e)return;let t=getThemeFillStyle(e);this.state.chart?.updateProps(t),this.resize()})))}updateProps(e){this.state.chart?.updateProps(e)}updateSeries(e){this.state.chart?.render(e)}}let Gauge_padding=20,Gauge_step=2,Gauge_Gauge=({onChange:e})=>{let{state:{globalID:t,axisY:{range:r}}}=useStore_useStore(),{chart:n,Chart:a}=hooks_useChart({Render:GaugeRender,params:{padding:Gauge_padding,step:Gauge_step,range:r}});useModuleSubscription({moduleType:constants_ModuleType.Gauge,chart:n,renderPSTypes:[constants_PSType.Gauge],handleRender:(e,t)=>{t.updateSeries?.(e)}});let[i,o]=external_react_useState(0);return external_react_useEffect(()=>{passThrough(t,constants_ModuleType.Gauge)({pstype:constants_PSType.Gauge,limit:i})},[i,t]),external_react_useEffect(()=>{r&&n?.updateProps({range:r})},[r]),/*#__PURE__*/jsx_runtime_jsx(Gauge_InteractionSurface,{padding:Gauge_padding,limit:i,step:Gauge_step,setLimit:e=>o(e),onChange:e,children:/*#__PURE__*/jsx_runtime_jsx(a,{})})},modules_Gauge=Gauge_Gauge,Gauge_Chart_Chart=e=>{let{publish:t,onChange:r}=e,{state:{globalID:n}}=useStore_useStore();return publish_usePublish({publish:t,subscribe:e=>{passThrough(n,constants_ModuleType.Gauge)(e)}}),/*#__PURE__*/jsx_runtime_jsx(components_Container,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Gauge,{onChange:r})})},Gauge_Chart=Gauge_Chart_Chart,GaugeChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,system:{padding:!1,border:!1},children:/*#__PURE__*/jsx_runtime_jsx(Gauge_Chart,{...e})}),charts_Gauge_Gauge=withChartPublisher(GaugeChart,"Gauge"),charts_Gauge=charts_Gauge_Gauge,LEVEL_STREAM={DEFAULT_CACHE_TIME:15e3,DEFAULT_GRANULARITY:10,DEFAULT_RANGE:[-20,100]},DEFAULT_LEVEL_STREAM_CONFIG={cacheTime:LEVEL_STREAM.DEFAULT_CACHE_TIME,granularity:LEVEL_STREAM.DEFAULT_GRANULARITY,range:LEVEL_STREAM.DEFAULT_RANGE,maxPoints:void 0,onLevelStreamUpdate:e=>{}};class LevelStreamAnalyzer{config;spectrumData=[];probabilityData=new Map;count=0;constructor(e){this.config={...DEFAULT_LEVEL_STREAM_CONFIG,...e}}reset(){this.spectrumData=[],this.probabilityData=new Map,this.count=0}setConfig(e){this.config={...DEFAULT_LEVEL_STREAM_CONFIG,...this.config,...e},(e.cacheTime&&this.config.cacheTime!==e.cacheTime||e.granularity&&this.config.granularity!==e.granularity||void 0!==e.maxPoints&&this.config.maxPoints!==e.maxPoints)&&this.reset(),e.range&&this.outputData()}process(e,t){this.removeExpiredData(),this.addNewData(e,t),this.updateProbability(e),this.outputData()}updateProbability(e){let{granularity:t}=this.config;this.count++;let r=Math.round(e/t)*t,n=this.probabilityData.get(r)||0;n++,this.probabilityData.set(r,n)}getAll(){return this.probabilityData}removeExpiredData(){let{cacheTime:e,maxPoints:t}=this.config;if(0===this.spectrumData.length)return;if(void 0!==t&&t>0){this.spectrumData.length>t&&(this.spectrumData=this.spectrumData.slice(-t));return}let r=Date.now();if(e<=0){this.spectrumData=[];return}let n=0,a=this.spectrumData.length-1;for(;n<=a;){let t=Math.floor((n+a)/2);r-this.spectrumData[t].timestamp>=e?n=t+1:a=t-1}this.spectrumData=this.spectrumData.slice(n)}addNewData(e,t){this.spectrumData.push({value:e,timestamp:t})}outputData(){let{range:e,granularity:t,onLevelStreamUpdate:r}=this.config,n=e[0],a=e[1],i=Array(Math.round((a-n)/t)+1).fill(0);for(let[e,r]of this.probabilityData)if(e>=n&&e<=a){let n=Math.round((a-e)/t);this.count>0&&(i[n]=r/this.count*100)}r?.({probabilityRangeData:new Float32Array(i),spectrumData:new Float32Array(this.spectrumData.map(e=>e.value)),timestampData:new Float64Array(this.spectrumData.map(e=>e.timestamp))})}}let SPECTRUM={INITIAL_VALUE:0/0,WATERFALL_MAX_FRAMES:100,OUTPUT_POINTS:1001},PEAK_DETECTION={MAX_PEAKS:2},RF_UNIT=null,FLUORESCENCE={UPDATE_INTERVAL:1,LEVEL_MIN:-20,LEVEL_MAX:140,LEVEL_RANGE:161},DEFAULT_SPECTRUM_CONFIG={maxPoints:SPECTRUM.OUTPUT_POINTS,waterfallMaxFrames:SPECTRUM.WATERFALL_MAX_FRAMES,initialValue:SPECTRUM.INITIAL_VALUE,processing:{enableWaterfall:!1,enableMetrics:!1,enableFluorescence:!1,enablePeakStats:!1,fluorescenceUpdateInterval:FLUORESCENCE.UPDATE_INTERVAL},peakDetection:{maxPeaks:PEAK_DETECTION.MAX_PEAKS},outputPoints:SPECTRUM.OUTPUT_POINTS,outputRange:{start:0,end:SPECTRUM.OUTPUT_POINTS},templateTolerance:0},ERROR_MESSAGES={EMPTY_SEGMENTS:"频段配置不能为空",INVALID_CONFIG:"必须且只能配置 segments 或 bandwidthConfig 其中之一",EMPTY_BANDWIDTH:"bandwidthConfig 不能为空",INVALID_SEGMENT:e=>`无效的段索引: ${e}`,INDEX_OUT_OF_BOUNDS:e=>`索引超出范围: ${e}`,INVALID_ANTENNA_FACTOR_LENGTH:e=>`天线因子数据长度必须等于实时数据长度 (${e})`,INVALID_ANTENNA_FACTOR:"天线因子数据必须是有效的正数",INVALID_SAMPLING_RANGE:"采样范围无效",INVALID_MAX_POINTS:"点数必须大于0",INVALID_LENGTH:e=>`频率占用度数据长度不匹配,期望长度为 ${e}`};class SpectrumError extends Error{code;details;constructor(e,t,r){super(e),this.code=t,this.details=r,this.name="SpectrumError"}}class DataValidationError extends SpectrumError{constructor(e,t){super(e,"DATA_VALIDATION_ERROR",t)}}class IndexOutOfBoundsError extends SpectrumError{index;constructor(e,t,r){super(e,"INDEX_OUT_OF_BOUNDS_ERROR",{index:t,...r||{}}),this.index=t}}let arrayKeepAttribute=(e,t)=>{void 0!==e.max&&(t.max=e.max),void 0!==e.maxIndex&&(t.maxIndex=e.maxIndex),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.progress&&(t.progress=e.progress)},spectrum_analyzer_clamp=(e,t,r)=>e<=t?t:e>=r?r:e,spectrum_analyzer_leftToIndex=(e,t)=>t<=1?0:Math.max(0,Math.min(t-1,Math.ceil(t*spectrum_analyzer_clamp(e,0,100)/100)-1)),resolveCursorIndexByLeft=(e,t,r)=>{if(!Number.isFinite(e)||t<=0||r<=0)return;let n=spectrum_analyzer_clamp(Number(e),0,100);return{left:n,sampledIndex:spectrum_analyzer_leftToIndex(n,t),globalIndex:spectrum_analyzer_leftToIndex(n,r)}},resample=({realData:e,antennaFactorData:t,antennaFactorSwitch:r=!1,outputPoints:n})=>{let a=e.length,i=a<=n,o=i?a:n,l=new Uint32Array(o),s=new Float32Array(o);if(s.timestamp=e.timestamp,i){if(!r){for(let e=0;e<a;e++)l[e]=e;return s.set(e),{realOutputData:s,srcIndexCache:l}}for(let r=0;r<a;r++)l[r]=r,s[r]=e[r]+t[r];return{realOutputData:s,srcIndexCache:l}}let c=a/n,u=c/2;for(let n=0;n<o;n++){let i=Math.floor(u),o=Math.min(Math.floor(u+c),a),d=e[i],h=i;for(let t=i+1;t<o;t++)e[t]>d&&(d=e[t],h=t);s[n]=r?d+t[h]:d,l[n]=h,u+=c}return{realOutputData:s,srcIndexCache:l}},resampleMultiple=({antennaFactorData:e,antennaFactorSwitch:t=!1,outputPoints:r,realData:n,maxData:a,minData:i,avgData:o,templateData:l,backgroundNoiseData:s,thresholdData:c,fluorescenceData:u,occupancyData:d,enablePeakStats:h=!1,maxPeaks:p=2,outputRangeStart:f=0})=>{let m=n.length,g=m<=r,b=g?m:r,v=a&&a.length>0,w=i&&i.length>0,y=o&&o.length>0,x=l&&l.length>0,k=d&&d.length>0,S=s&&s.length>0,D=c&&c.length>0,M=u&&u.length>0,F=[],C=t?(t,r)=>t+e[r]:e=>e,E=new Float32Array(b);E.timestamp=n.timestamp;let A=new Float32Array(v?b:0),N=new Float32Array(w?b:0),T=new Float32Array(y?b:0),I=new Float32Array(x?b:0),z=new Float32Array(k?b:0),P=new Float32Array(S?b:0),_=new Float32Array(D?b:0),O=Array(M?b:0).fill(null),L=new Uint32Array(b);if(g){for(let e=0;e<m;e++)L[e]=e;if(t)for(let t=0;t<m;t++){let r=e[t];if(E[t]=n[t]+r,v&&(A[t]=a[t]+r),w&&(N[t]=i[t]+r),y&&(T[t]=o[t]+r),x&&(I[t]=l[t]+r),k&&(z[t]=d[t]),S&&(P[t]=s[t]+r),D&&(_[t]=c[t]+r),M){let e=u[t],n=new Map;for(let[t,a]of e)n.set(t+r,a);O[t]=n}}else E.set(n),v&&A.set(a),w&&N.set(i),y&&T.set(o),x&&I.set(l),k&&z.set(d),S&&P.set(s),D&&_.set(c),M&&(O=u);if(h)for(let e=0;e<m;e++){let t=E[e];Number.isFinite(t)&&F.push({index:e,srcIndex:e+f,value:t})}}else{let e=m/r,t=e/2;for(let r=0;r<b;r++){let p=Math.floor(t),g=Math.min(Math.floor(t+e),m),b=n[p],q=p,$=v?a[p]:0,j=p,H=w?i[p]:0,B=p,G=k?d[p]:0;for(let e=p+1;e<g;e++)n[e]>b&&(b=n[e],q=e),v&&a[e]>$&&($=a[e],j=e),w&&i[e]<H&&(H=i[e],B=e),k&&d[e]>G&&(G=d[e]);let U=C(b,q);if(E[r]=U,L[r]=q,h&&Number.isFinite(U)&&F.push({index:r,srcIndex:q+f,value:U}),v&&(A[r]=C($,j)),w&&(N[r]=C(H,B)),y){let e=o[q];T[r]=C(e,q)}if(x){let e=l[q];I[r]=C(e,q)}if(k&&(z[r]=G),S){let e=s[q];P[r]=C(e,q)}if(D){let e=c[q];_[r]=C(e,q)}if(M){let e=u[q],t=new Map;for(let[r,n]of e)t.set(C(r,q),n);O[r]=t}t+=e}}return h&&F.length>0&&(F.sort((e,t)=>t.value-e.value),E.peaks={peaks:F.slice(0,p),timestamp:n.timestamp}),{realOutputData:E,maxOutputData:A,minOutputData:N,avgOutputData:T,templateOutputData:I,occupancyOutputData:z,backgroundNoiseOutputData:P,thresholdOutputData:_,srcIndexCache:L,fluorescenceOutputData:O}},resampleExtraData=(e,t,r,n,a)=>{if(!e||0===Object.keys(e).length)return{};let i={},o=Object.keys(e),l=n.length;for(let e=0;e<o.length;e++)i[o[e]]=new Float32Array(l);for(let s=0;s<o.length;s++){let c=o[s],u=a(e[c]),d=i[c];if(r)for(let e=0;e<l;e++){let r=n[e];d[e]=u[r]+t[r]}else for(let e=0;e<l;e++){let t=n[e];d[e]=u[t]}}return i},findExceedingDatasCore=({realData:e,maxData:t,minData:r,templateData:n,tolerance:a=0,startIndex:i=0,endIndex:o,usePreallocation:l=!1})=>{let{timestamp:s}=e,c=o??e.length,u=[],d=-1,h=0,p=0;if(l&&0===i&&c===e.length){let i=new Uint8Array(e.length);for(let t=0;t<e.length;t++)i[t]=+(e[t]>n[t]+a);for(let n=0;n<e.length;n++)if(i[n])-1===d?(d=n,h=e[n],p=1):(h+=e[n],p++);else if(-1!==d){let e=n-1;if(e-d+1>=2){let n=h/p,a=d+(e-d>>1);u.push({maxValue:t[a],minValue:r[a],avgValue:n,timestamp:s,startIndex:d,endIndex:e})}d=-1}}else for(let o=i;o<Math.min(c,e.length);o++)if(e[o]>n[o]+a)-1===d?(d=o,h=e[o],p=1):(h+=e[o],p++);else if(-1!==d){let e=o-1;if(e-d+1>=2){let n=h/p,a=d+(e-d>>1);u.push({maxValue:t[a],minValue:r[a],avgValue:n,timestamp:s,startIndex:d,endIndex:e})}d=-1}if(-1!==d){let e=c-1;if(e-d+1>=2){let n=h/p,a=d+(e-d>>1);u.push({maxValue:t[a],minValue:r[a],avgValue:n,timestamp:s,startIndex:d,endIndex:e})}}return u},findExceedingDatas=({realData:e,maxData:t,minData:r,templateData:n,tolerance:a=0})=>n&&0!==n.length?findExceedingDatasCore({realData:e,maxData:t,minData:r,templateData:n,tolerance:a,usePreallocation:!0}):[],findExceedingDatasIncremental=({realData:e,maxData:t,minData:r,templateData:n,tolerance:a=0,startIndex:i,endIndex:o,previousSegments:l=[]})=>!n||0===n.length||i>=o?l:[...l,...findExceedingDatasCore({realData:e,maxData:t,minData:r,templateData:n,tolerance:a,startIndex:i,endIndex:o})];function isAllValid(e){for(let t=0;t<e.length;t++)if(!Number.isFinite(e[t]))return!1;return!0}var types_ExtraDataMode=/*#__PURE__*/function(e){return e.REPLACE="replace",e.MERGE="merge",e.CLEAR="clear",e}({}),SpectrumAnalyzer_PendingDataType=/*#__PURE__*/null;class SpectrumAnalyzer{config=DEFAULT_SPECTRUM_CONFIG;segments=[];antennaFactorData;antennaFactorSwitch;realData;maxData;minData;avgData;templateData;occupancyData;backgroundNoiseData;thresholdData;waterfallData;srcIndexCache;realOutputData;maxOutputData;minOutputData;avgOutputData;templateOutputData;occupancyOutputData;backgroundNoiseOutputData;thresholdOutputData;waterfallOutputData;scanProgress;lastIndex;processTimes;lastProcessTime;cachedExceedingDatas=[];fluorescenceData;fluorescenceMaxCount=0;fluorescenceUpdateCounter=0;extraData={};extraOutputData={};pendingDataFlags={occupancy:!1,template:!1,backgroundNoise:!1,threshold:!1,extra:!1};hasPendingData=!1;hasProcessedData=!1;isProcessing=!1;onSpectrumUpdate;constructor(e){let{onSpectrumUpdate:t,maxPoints:r}=e;this.onSpectrumUpdate=t,this.config={...DEFAULT_SPECTRUM_CONFIG,...e,processing:{...DEFAULT_SPECTRUM_CONFIG.processing,...e.processing},peakDetection:{...DEFAULT_SPECTRUM_CONFIG.peakDetection,...e.peakDetection},outputRange:{start:e.outputRange?.start??0,end:e.outputRange?.end??r??SPECTRUM.OUTPUT_POINTS}},this.reset()}process({data:e,timestamp:t,segmentOffset:r=0,offset:n=0,fluorescenceData:a,fluorescenceMaxCount:i}){let o=performance.now();try{if(!e?.length)return;this.isProcessing=!0,this.hasProcessedData=!0;let o=this.resolveGlobalIndex(r,n);this.segments.length?this.scanProgress=(o+e.length)/this.config.maxPoints:e.length!==this.config.maxPoints&&this.updateMaxPoints(e.length),a&&void 0!==i&&(this.fluorescenceData=a,this.fluorescenceMaxCount=i),this.validateInput(e,o);let{maxPoints:l}=this.config,s=o+e.length;this.lastIndex=s;let c=s>=l||s<this.lastIndex;this.realData.set(e,o),this.realData.timestamp=t,this.processDataPoints(e,o,c);let u=this.resampleDataSeries();c&&u.realData&&this.updateWaterfallData(this.realData,u.realData);let d=this.updateTemplateOverData(c,c?void 0:{startIndex:o,endIndex:o+e.length}),h=this.processPendingData();this.notifySpectrumUpdate({...u,...h||{},extraData:this.extraOutputData,waterfallData:this.waterfallOutputData,scanProgress:this.scanProgress,processTimes:this.processTimes,...d&&{templateOverData:d}})}catch(e){throw e instanceof Error?e:Error(String(e))}finally{this.isProcessing=!1,this.lastProcessTime=performance.now()-o}}initializeSegments(e){if(!e?.length)throw new DataValidationError(ERROR_MESSAGES.EMPTY_SEGMENTS);let t=this.config.maxPoints,r=0;this.segments=e.map(e=>{let{startFrequency:t,stopFrequency:n,stepFrequency:a}=e,i=Math.round(1e3*(n-t)/a)+1,o=r;return r+=i,{startFrequency:t,stopFrequency:n,stepFrequency:a,pointCount:i,startIndex:o}}),this.updateMaxPoints(r,!1),t===r&&(this.config={...this.config,outputRange:{start:0,end:r}},this.reset(!1))}setAntennaFactor(e){let{antennaFactorData:t,config:{maxPoints:r}}=this,n=new Float32Array(e);n.length!==r&&(n=new Float32Array(n).subarray(0,r),console.warn(ERROR_MESSAGES.INVALID_ANTENNA_FACTOR_LENGTH(r)));let a=!1;for(let e=0;e<n.length;e++){let r=n[e],i=Number.isFinite(r)&&r>0;i||(a=!0),t[e]=i?r:0}a&&console.warn(ERROR_MESSAGES.INVALID_ANTENNA_FACTOR),this.antennaFactorSwitch&&this.setAntennaFactorSwitch(this.antennaFactorSwitch)}setAntennaFactorSwitch(e){let t=this.antennaFactorSwitch!==e;if(this.antennaFactorSwitch=e,t){let e=this.resampleDataSeries();this.resampleWaterfallOutputData(),this.notifySpectrumUpdate({...e,waterfallData:this.waterfallOutputData})}}updateProcessing(e){let{processing:t}=this.config,r={...t,...void 0!==e.enableMetrics&&{enableMetrics:e.enableMetrics},...void 0!==e.enableFluorescence&&{enableFluorescence:e.enableFluorescence},...void 0!==e.enablePeakStats&&{enablePeakStats:e.enablePeakStats},...void 0!==e.fluorescenceUpdateInterval&&{fluorescenceUpdateInterval:e.fluorescenceUpdateInterval}};if(r.enableMetrics===t.enableMetrics&&r.enableFluorescence===t.enableFluorescence&&r.enablePeakStats===t.enablePeakStats&&r.fluorescenceUpdateInterval===t.fluorescenceUpdateInterval)return;this.config={...this.config,processing:r},r.enableMetrics&&!t.enableMetrics&&(0===this.maxData.length||0===this.minData.length||0===this.avgData.length)&&(this.allocateMetricsBuffers(),this.clearMetricsBuffers()),r.enableFluorescence&&!t.enableFluorescence&&0===this.fluorescenceData.length&&(this.fluorescenceData=new Uint32Array(this.config.maxPoints*FLUORESCENCE.LEVEL_RANGE));let n=this.resampleDataSeries();this.extraOutputData=resampleExtraData(this.extraData,this.antennaFactorData,this.antennaFactorSwitch,this.srcIndexCache,this.getOutputData.bind(this)),this.notifySpectrumUpdate({...n,extraData:this.extraOutputData})}clearMetricsData(){let e=0===this.maxData.length||0===this.minData.length||0===this.avgData.length||0===this.maxOutputData.length||0===this.minOutputData.length||0===this.avgOutputData.length;if(this.config.processing.enableMetrics&&e){let e=this.realOutputData?.length??this.config.outputPoints;this.allocateMetricsBuffers(e)}this.clearMetricsBuffers(),this.processTimes=0,this.notifySpectrumUpdate({maxData:this.maxOutputData,minData:this.minOutputData,avgData:this.avgOutputData,processTimes:0})}allocateMetricsBuffers(e){let{maxPoints:t,outputPoints:r,processing:{enableMetrics:n}}=this.config,a=n?t:0,i=0;n&&(i=Math.min(i=Math.max(0,Math.floor(e??r)),r)),this.maxData=new Float32Array(a),this.minData=new Float32Array(a),this.avgData=new Float32Array(a),this.maxOutputData=new Float32Array(i),this.minOutputData=new Float32Array(i),this.avgOutputData=new Float32Array(i)}clearMetricsBuffers(){this.maxData.fill(SPECTRUM.INITIAL_VALUE),this.minData.fill(SPECTRUM.INITIAL_VALUE),this.avgData.fill(SPECTRUM.INITIAL_VALUE),this.maxData.allValid=!1,this.minData.allValid=!1,this.avgData.allValid=!1,this.maxOutputData.fill(SPECTRUM.INITIAL_VALUE),this.minOutputData.fill(SPECTRUM.INITIAL_VALUE),this.avgOutputData.fill(SPECTRUM.INITIAL_VALUE)}setWaterfallData(e){if(!(e?.[0]?.length>0))return;let{processing:t}=this.config,{waterfallMaxFrames:r}=this.config;t.enableWaterfall&&(r=e.length,this.config={...this.config,waterfallMaxFrames:r},this.waterfallData=e,this.resampleWaterfallOutputData(),this.notifySpectrumUpdate({waterfallData:this.waterfallOutputData}))}setFluorescenceData(e,t){if(!this.config.processing.enableFluorescence||!e||0===e.length)return;let r=this.config.maxPoints*FLUORESCENCE.LEVEL_RANGE;if(e.length!==r)return;this.fluorescenceData=e,this.fluorescenceMaxCount=t;let n=this.config.outputRange.end-this.config.outputRange.start,a=this.getFluorescenceOutputData(n);this.notifySpectrumUpdate({fluorescenceData:a,fluorescenceMaxCount:this.fluorescenceMaxCount})}setRealData(e){if(!(e?.length>0)||e.length!==this.config.maxPoints)return;let t=new Float32Array(e.length);t.set(e),t.timestamp=e.timestamp,this.realData=t;let r=this.resampleDataSeries();this.notifySpectrumUpdate(r)}setMaxData(e){if(!(e?.length>0)||e.length!==this.config.maxPoints)return;let t=new Float32Array(e.length);t.set(e),this.maxData=t,this.maxData.allValid=isAllValid(this.maxData);let r=this.resampleDataSeries();this.notifySpectrumUpdate(r)}setMinData(e){if(!(e?.length>0)||e.length!==this.config.maxPoints)return;let t=new Float32Array(e.length);t.set(e),this.minData=t,this.minData.allValid=isAllValid(this.minData);let r=this.resampleDataSeries();this.notifySpectrumUpdate(r)}setAvgData(e){if(!(e?.length>0)||e.length!==this.config.maxPoints)return;let t=new Float32Array(e.length);t.set(e),this.avgData=t,this.avgData.allValid=isAllValid(this.avgData);let r=this.resampleDataSeries();this.notifySpectrumUpdate(r)}setOccupancyData(e){if(!e||0===e.length){this.occupancyData=new Float32Array(0),this.setPendingFlag("occupancy",!1);return}if(this.occupancyData=new Float32Array(e),!this.hasProcessedData||this.isProcessing)return void this.setPendingFlag("occupancy",!0);let t=this.resampleDataSeries();this.notifySpectrumUpdate({occupancyData:t.occupancyData}),this.setPendingFlag("occupancy",!1)}setExtraData(e,t=types_ExtraDataMode.MERGE,r){if(t===types_ExtraDataMode.CLEAR){this.extraData={},this.extraOutputData={},this.setPendingFlag("extra",!1);return}if(!e){t===types_ExtraDataMode.REPLACE&&(this.extraData={},this.extraOutputData={},this.setPendingFlag("extra",!1));return}let n=Object.entries(e).map(([e,t])=>[e,t?.length?new Float32Array(t):null]),a=r?this.resolveGlobalIndex(r.segmentOffset??0,r.offset??0):0;if(r)for(let[,e]of n)e&&this.validateInput(e,a);for(let[e,i]of(t===types_ExtraDataMode.REPLACE&&(this.extraData={},this.extraOutputData={},this.setPendingFlag("extra",!1)),n)){if(!i){delete this.extraData[e];continue}if(!r){this.extraData[e]=i;continue}let t=this.extraData[e];if(t?.length!==this.config.maxPoints){let r=new Float32Array(this.config.maxPoints);r.fill(SPECTRUM.INITIAL_VALUE),t?.length&&r.set(t.subarray(0,this.config.maxPoints)),t=r,this.extraData[e]=t}t.set(i,a)}!this.hasProcessedData||this.isProcessing?this.setPendingFlag("extra",!0):(this.extraOutputData=resampleExtraData(this.extraData,this.antennaFactorData,this.antennaFactorSwitch,this.srcIndexCache,this.getOutputData.bind(this)),this.notifySpectrumUpdate({extraData:this.extraOutputData}),this.setPendingFlag("extra",!1))}reset(e=!1){let{maxPoints:t,waterfallMaxFrames:r,processing:{enableFluorescence:n}}=this.config;this.antennaFactorData=new Float32Array(t);let a=new Float32Array(t);a.timestamp="",a.fill(SPECTRUM.INITIAL_VALUE),this.realData=a,this.allocateMetricsBuffers(),this.clearMetricsBuffers(),this.templateData=new Float32Array,this.occupancyData=new Float32Array,this.backgroundNoiseData=new Float32Array,this.clearThresholdDataState(),this.waterfallData=Array.from({length:r},()=>{let e=new Float32Array;return e.timestamp="",e.fill(SPECTRUM.INITIAL_VALUE),e}),this.waterfallOutputData=Array.from({length:r},()=>{let e=new Float32Array;return e.timestamp="",e.fill(SPECTRUM.INITIAL_VALUE),e});let i=this.config.outputPoints;this.realOutputData=new Float32Array(i).fill(SPECTRUM.INITIAL_VALUE),this.templateOutputData=new Float32Array,this.occupancyOutputData=new Float32Array,this.backgroundNoiseOutputData=new Float32Array,this.fluorescenceData=new Uint32Array(n?t*FLUORESCENCE.LEVEL_RANGE:0),this.fluorescenceMaxCount=0,this.fluorescenceUpdateCounter=0,this.extraData={},this.extraOutputData={},this.srcIndexCache=new Uint32Array(t),this.scanProgress=0,this.lastIndex=0,this.processTimes=0,this.lastProcessTime=0,this.cachedExceedingDatas=[],this.pendingDataFlags={occupancy:!1,template:!1,backgroundNoise:!1,threshold:!1,extra:!1},this.hasPendingData=!1,e||(this.hasProcessedData=!1),this.notifySpectrumUpdate({realData:this.realData,maxData:this.maxData,minData:this.minData,avgData:this.avgData,templateData:this.templateData,backgroundNoiseData:this.backgroundNoiseData,thresholdData:this.thresholdData,extraData:this.extraData,srcIndexCache:this.srcIndexCache,processTimes:0,scanProgress:0})}getPerformanceMetrics(){return{lastProcessTime:this.lastProcessTime,dataPoints:this.config.maxPoints,waterfallFrames:this.waterfallData.length,isInitialized:this.realData.length>0,memoryUsage:this.calculateMemoryUsage()}}getPeakStats(){if(!this.config.processing.enablePeakStats)return;let{realData:e}=this.resampleDataSeries();if(e)return e.peaks}updateSamplingRange(e,t){if(e<0||e>=t)throw new DataValidationError(ERROR_MESSAGES.INVALID_SAMPLING_RANGE);this.config={...this.config,outputRange:{start:Math.floor(e),end:Math.ceil(t)}};let r=this.resampleDataSeries();return this.resampleWaterfallOutputData(),this.extraOutputData=resampleExtraData(this.extraData,this.antennaFactorData,this.antennaFactorSwitch,this.srcIndexCache,this.getOutputData.bind(this)),this.notifySpectrumUpdate({...r,extraData:this.extraOutputData,waterfallData:this.waterfallOutputData}),this.srcIndexCache}setTemplateData(e,t){if(!e||0===e.length){this.templateData=new Float32Array(0),this.setPendingFlag("template",!1);return}(void 0!==t&&(this.config.templateTolerance=t),this.templateData=new Float32Array(e),!this.hasProcessedData||this.isProcessing)?this.setPendingFlag("template",!0):(this.notifySpectrumUpdate({templateData:this.resampleSingleData(this.templateData),templateOverData:this.updateTemplateOverData(!0)}),this.setPendingFlag("template",!1))}setBackgroundNoiseData(e){if(!e||0===e.length){this.backgroundNoiseData=new Float32Array(0),this.setPendingFlag("backgroundNoise",!1);return}(this.backgroundNoiseData=new Float32Array(e),!this.hasProcessedData||this.isProcessing)?this.setPendingFlag("backgroundNoise",!0):(this.notifySpectrumUpdate({backgroundNoiseData:this.resampleSingleData(this.backgroundNoiseData)}),this.setPendingFlag("backgroundNoise",!1))}setThresholdData(e,t){if(!e||0===e.length)return void this.clearThresholdDataState();let r=e instanceof Float32Array?e:new Float32Array(e);if(t){let e=this.resolveGlobalIndex(t.segmentOffset??0,t.offset??0);if(this.validateInput(r,e),this.thresholdData.length!==this.config.maxPoints){let e=new Float32Array(this.config.maxPoints);e.fill(SPECTRUM.INITIAL_VALUE),this.thresholdData.length>0&&e.set(this.thresholdData.subarray(0,this.config.maxPoints)),this.thresholdData=e}this.thresholdData.set(r,e)}else{let e=new Float32Array(this.config.maxPoints);e.fill(SPECTRUM.INITIAL_VALUE),e.set(r.subarray(0,this.config.maxPoints)),this.thresholdData=e}if(!this.hasProcessedData||this.isProcessing)return void this.setPendingFlag("threshold",!0);let n=this.resampleSingleData(this.thresholdData);this.thresholdOutputData=n,this.notifySpectrumUpdate({thresholdData:n}),this.setPendingFlag("threshold",!1)}updateTemplateOverData(e=!1,t){let r;return this.templateData&&0!==this.templateData.length?(e||!t?(r=findExceedingDatas({realData:this.realData,maxData:this.maxData,minData:this.minData,templateData:this.templateData,tolerance:this.config.templateTolerance}),this.cachedExceedingDatas=r):(this.cachedExceedingDatas=findExceedingDatasIncremental({realData:this.realData,maxData:this.maxData,minData:this.minData,templateData:this.templateData,tolerance:this.config.templateTolerance,startIndex:t.startIndex,endIndex:t.endIndex,previousSegments:this.cachedExceedingDatas}),r=this.cachedExceedingDatas),r):(this.cachedExceedingDatas=[],[])}resolveGlobalIndex(e=0,t=0){if(this.segments.length){let r=this.segments[e];if(!r)throw new DataValidationError(ERROR_MESSAGES.INVALID_SEGMENT(e));return r.startIndex+t}return t}clearThresholdDataState(){this.thresholdData=new Float32Array(0),this.thresholdOutputData=new Float32Array(0),this.setPendingFlag("threshold",!1)}resampleDataSeries(){let{antennaFactorData:e,antennaFactorSwitch:t,maxData:r,minData:n,avgData:a,templateData:i,occupancyData:o,backgroundNoiseData:l,thresholdData:s,config:{maxPoints:c,outputPoints:u}}=this,{realOutputData:d,srcIndexCache:h,maxOutputData:p,minOutputData:f,avgOutputData:m,templateOutputData:g,occupancyOutputData:b,backgroundNoiseOutputData:v,thresholdOutputData:w}=resampleMultiple({antennaFactorData:t?e:new Float32Array(c),antennaFactorSwitch:t,outputPoints:u,realData:this.getOutputData(),maxData:r?.length>0?this.getOutputData(r):void 0,minData:n?.length>0?this.getOutputData(n):void 0,avgData:a&&a.length>0?this.getOutputData(a):void 0,templateData:i&&i.length>0?this.getOutputData(i):void 0,occupancyData:o&&o.length>0?this.getOutputData(o):void 0,backgroundNoiseData:l&&l.length>0?this.getOutputData(l):void 0,thresholdData:s&&s.length>0?this.getOutputData(s):void 0,enablePeakStats:this.config.processing.enablePeakStats,maxPeaks:this.config.peakDetection.maxPeaks,outputRangeStart:this.config.outputRange.start});this.srcIndexCache=h,this.realOutputData=d,this.maxOutputData=p||new Float32Array,this.minOutputData=f||new Float32Array,this.avgOutputData=m||new Float32Array,this.templateOutputData=g||new Float32Array,this.occupancyOutputData=b||new Float32Array,this.backgroundNoiseOutputData=v||new Float32Array,this.thresholdOutputData=w||new Float32Array;let y=this.getFluorescenceOutputData(d.length);return{realData:d,maxData:p,minData:f,avgData:m,templateData:g,occupancyData:b,backgroundNoiseData:v,thresholdData:w,fluorescenceData:y,fluorescenceMaxCount:this.fluorescenceMaxCount,extraData:this.extraOutputData,srcIndexCache:h}}resampleWaterfallOutputData(){let{antennaFactorData:e,antennaFactorSwitch:t,waterfallData:r,config:{maxPoints:n,processing:{enableWaterfall:a},outputPoints:i}}=this;if(!a)return;let o=t?e:new Float32Array(n);this.waterfallOutputData=r.map(e=>{let{realOutputData:r}=resampleMultiple({realData:this.getOutputData(e),antennaFactorData:o,antennaFactorSwitch:t,outputPoints:i});return r})}updateWaterfallData(e,t){let{waterfallMaxFrames:r,processing:n}=this.config;if(!n.enableWaterfall)return;this.waterfallData.length>=r&&(this.waterfallData.shift(),this.waterfallOutputData.shift());let a=new Float32Array(e.length);a.set(e),a.timestamp=e.timestamp,this.waterfallData.push(a),this.waterfallOutputData.push(t)}updateMaxPoints(e,t=!0){this.config.maxPoints!==e&&(this.config={...this.config,maxPoints:e,outputRange:{start:0,end:e}},this.reset(t))}validateInput(e,t){if(t<0||t+e.length>this.config.maxPoints)throw new IndexOutOfBoundsError(ERROR_MESSAGES.INDEX_OUT_OF_BOUNDS(t),t)}processDataPoints(e,t,r){let{maxData:n,minData:a,avgData:i,config:{processing:{enableMetrics:o}}}=this;o&&r&&(this.processTimes+=1,n.allValid||(n.allValid=isAllValid(n)),a.allValid||(a.allValid=isAllValid(a)),i.allValid||(i.allValid=isAllValid(i)));let l=e.length;if(this.config.processing.enableFluorescence)for(let r=0;r<l;r++)this.updateFluorescenceStats(t+r,e[r]);if(!o)return;let s=!0;for(let t=0;t<l;t++)if(!Number.isFinite(e[t])){s=!1;break}for(let r=0;r<l;r++){let o=t+r,l=e[r];if(!s&&!Number.isFinite(l))continue;let c=n[o];(l>c||!n.allValid&&Number.isNaN(c))&&(n[o]=l);let u=a[o];(l<u||!a.allValid&&Number.isNaN(u))&&(a[o]=l);let d=i[o];0===this.processTimes||Number.isNaN(d)?i[o]=l:i[o]=d+(l-d)/(this.processTimes+1)}}updateFluorescenceStats(e,t){if(!this.config.processing.enableFluorescence||!this.fluorescenceData||!Number.isFinite(t))return;let r=Math.round(t);if(r<FLUORESCENCE.LEVEL_MIN||r>FLUORESCENCE.LEVEL_MAX)return;let n=e*FLUORESCENCE.LEVEL_RANGE+(r-FLUORESCENCE.LEVEL_MIN),a=++this.fluorescenceData[n];a>this.fluorescenceMaxCount&&(this.fluorescenceMaxCount=a)}setPendingFlag(e,t){this.pendingDataFlags[e]=t,this.hasPendingData=this.pendingDataFlags.occupancy||this.pendingDataFlags.template||this.pendingDataFlags.backgroundNoise||this.pendingDataFlags.threshold||this.pendingDataFlags.extra}resampleSingleData(e){let{srcIndexCache:t}=this,{outputRange:{start:r,end:n}}=this.config,a=e.subarray(r,n),i=t.length,o=new Float32Array(i);for(let e=0;e<i;e++)o[e]=a[t[e]];return o}processPendingData(){if(!this.hasPendingData)return null;let e={};if(this.pendingDataFlags.occupancy&&this.occupancyData.length>0&&(e.occupancyData=this.resampleDataSeries().occupancyData,this.setPendingFlag("occupancy",!1)),this.pendingDataFlags.template&&this.templateData.length>0&&(e.templateData=this.resampleSingleData(this.templateData),e.templateOverData=this.updateTemplateOverData(!0),this.setPendingFlag("template",!1)),this.pendingDataFlags.backgroundNoise&&this.backgroundNoiseData.length>0&&(e.backgroundNoiseData=this.resampleSingleData(this.backgroundNoiseData),this.setPendingFlag("backgroundNoise",!1)),this.pendingDataFlags.threshold&&this.thresholdData.length>0){let t=this.resampleSingleData(this.thresholdData);this.thresholdOutputData=t,e.thresholdData=t,this.setPendingFlag("threshold",!1)}return this.pendingDataFlags.extra&&Object.keys(this.extraData).length>0&&(this.extraOutputData=resampleExtraData(this.extraData,this.antennaFactorData,this.antennaFactorSwitch,this.srcIndexCache,this.getOutputData.bind(this)),e.extraData=this.extraOutputData,this.setPendingFlag("extra",!1)),e}notifySpectrumUpdate(e){this.onSpectrumUpdate?.(e)}calculateMemoryUsage(){return 4*(this.config.maxPoints*Float32Array.BYTES_PER_ELEMENT)+this.waterfallData.reduce((e,t)=>e+t.length*Float32Array.BYTES_PER_ELEMENT,0)+this.waterfallOutputData.reduce((e,t)=>e+t.length*Float32Array.BYTES_PER_ELEMENT,0)}getOutputData(e){let{outputRange:{start:t,end:r}}=this.config,n=e??this.realData,a=n.subarray(t,r);return a.timestamp=n.timestamp,a}getFluorescenceOutputData(e){let{processing:{enableFluorescence:t},outputRange:{start:r,end:n}}=this.config;if(!t||0===this.fluorescenceData.length||e<=0)return;let a=new Uint32Array(e*FLUORESCENCE.LEVEL_RANGE),i=(n-r)/e;for(let t=0;t<e;t++){let e=Math.floor(r+(t+.5)*i)*FLUORESCENCE.LEVEL_RANGE,n=t*FLUORESCENCE.LEVEL_RANGE;for(let t=0;t<FLUORESCENCE.LEVEL_RANGE;t++)a[n+t]=this.fluorescenceData[e+t]}return a}getAllRawData(e){let{realOutputData:t,maxOutputData:r,minOutputData:n,avgOutputData:a,templateOutputData:i,occupancyOutputData:o,backgroundNoiseOutputData:l,thresholdOutputData:s,waterfallOutputData:c,extraOutputData:u,srcIndexCache:d}=this;t.timestamp=this.realData.timestamp;let h={realData:this.realData,maxData:this.maxData,minData:this.minData,avgData:this.avgData,templateData:this.templateData,occupancyData:this.occupancyData,backgroundNoiseData:this.backgroundNoiseData,thresholdData:this.thresholdData,waterfallData:this.waterfallData,extraData:this.extraData},p=resolveCursorIndexByLeft(e,t.length,this.config.maxPoints);return{realData:t,maxData:r,minData:n,avgData:a,templateData:i,occupancyData:o,backgroundNoiseData:l,thresholdData:s,fluorescenceData:this.getFluorescenceOutputData(t.length),waterfallData:c,extraData:u,srcIndexCache:d,rawData:h,cursorIndex:p}}}let createEmptySnapshot=()=>({data:[],rawData:[],range:{x:[0,0],y:[0,0]},sourceSize:{width:0,height:0},columnIndices:new Uint32Array(0),rowIndices:new Uint32Array(0)}),copyFrame=e=>{let t=new Float32Array(e);return t.timestamp=e.timestamp,void 0!==e.allValid&&(t.allValid=e.allValid),e.peaks&&(t.peaks={...e.peaks,peaks:e.peaks.peaks.map(e=>({...e}))}),t},validateOutputSize=(e,t)=>{if(!Number.isInteger(e)||e<=0)throw new DataValidationError(`${t} 必须是正整数`)},normalizeRange=(e,t,r)=>{let[n,a]=e;if(!Number.isFinite(n)||!Number.isFinite(a)||n>=a)throw new DataValidationError(`${r} 采样范围无效`);let i=Math.max(0,Math.min(t,Math.floor(n))),o=Math.max(0,Math.min(t,Math.ceil(a)));if(i>=o)throw new DataValidationError(`${r} 采样范围超出数据边界`);return[i,o]},reconcileRange=(e,t,r)=>{if(0===e[0]&&e[1]===t)return[0,r];let n=Math.min(e[0],r-1),a=Math.max(n+1,Math.min(e[1],r));return[n,a]},reconcileYRange=(e,t,r)=>{if(0===e[0]&&e[1]===t)return[0,r];if(e[1]===t){let t=Math.min(e[1]-e[0],r);return[r-t,r]}return reconcileRange(e,t,r)},reconcileAppendedRange=(e,t,r,n)=>{if(0===e[0]&&e[1]===t)return[0,r];let a=Math.min(e[1]-e[0],r);if(e[1]===t)return[r-a,r];let i=Math.max(0,Math.min(e[0]-n,r-a));return[i,i+a]},createCenterIndices=(e,t)=>{let[r,n]=e,a=n-r,i=Math.min(a,t),o=new Uint32Array(i);if(a<=t){for(let e=0;e<i;e++)o[e]=r+e;return o}for(let e=0;e<i;e++){let t=Math.floor(e*a/i),n=Math.floor((e+1)*a/i);o[e]=r+Math.min(n-1,Math.floor((t+n)/2))}return o},isSameRange=(e,t)=>e[0]===t[0]&&e[1]===t[1],isSameIndices=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},maxPoolFrame=(e,t,r)=>{let n=e.subarray(t[0],t[1]),a=n.length,i=Math.min(a,r);if(a<=r)return 0===t[0]&&t[1]===e.length?e:(n.timestamp=e.timestamp,n);let o=new Float32Array(i);o.timestamp=e.timestamp;for(let e=0;e<i;e++){let t=Math.floor(e*a/i),r=Math.floor((e+1)*a/i),l=0/0;for(let e=t;e<r;e++){let t=n[e];Number.isFinite(t)&&(!Number.isFinite(l)||t>l)&&(l=t)}o[e]=l}return o};class WaterfallAnalyzer{maxFrames;onWaterfallUpdate;sourceData=[];samplingOptions;snapshot=createEmptySnapshot();constructor(e={}){if(void 0!==e.maxFrames&&(!Number.isInteger(e.maxFrames)||e.maxFrames<=0))throw new DataValidationError("maxFrames 必须是正整数");this.maxFrames=e.maxFrames,this.onWaterfallUpdate=e.onWaterfallUpdate}setData(e){if(0===e.length)return this.sourceData=[],this.samplingOptions=void 0,this.publishSnapshot(createEmptySnapshot());let t=e[0].length;if(0===t)throw new DataValidationError("瀑布图帧不能为空");for(let r of e)if(r.length!==t)throw new DataValidationError("瀑布图数据必须是等宽矩阵");let r=this.snapshot.sourceSize,n=[...e];void 0!==this.maxFrames&&n.length>this.maxFrames&&(n=n.slice(-this.maxFrames));let a=this.samplingOptions;a&&r.width>0&&r.height>0&&(a={...a,x:reconcileRange(a.x,r.width,t),y:reconcileYRange(a.y,r.height,n.length)});let i=this.createSnapshot(n,a);return this.sourceData=n,this.samplingOptions=a,this.publishSnapshot(i)}appendFrame(e){if(0===e.length)throw new DataValidationError("瀑布图帧不能为空");let t=this.sourceData[0]?.length;if(void 0!==t&&e.length!==t)throw new DataValidationError("追加帧宽度必须与现有瀑布图一致");let r=this.sourceData.length,n=[...this.sourceData,copyFrame(e)],a=0;void 0!==this.maxFrames&&n.length>this.maxFrames&&(a=n.length-this.maxFrames,n.splice(0,a));let i=this.samplingOptions;i&&r>0&&(i={...i,y:reconcileAppendedRange(i.y,r,n.length,a)});let o=this.createSnapshot(n,i);return this.sourceData=n,this.samplingOptions=i,this.publishSnapshot(o)}updateSamplingRange(e){let t=this.getSourceSize(this.sourceData);if(0===t.width||0===t.height)throw new DataValidationError("设置采样范围前必须先设置瀑布图数据");validateOutputSize(e.outputWidth,"outputWidth"),validateOutputSize(e.outputHeight,"outputHeight");let r={x:normalizeRange(e.x,t.width,"X"),y:normalizeRange(e.y,t.height,"Y"),outputWidth:e.outputWidth,outputHeight:e.outputHeight},n=this.createSnapshot(this.sourceData,r);return this.samplingOptions=r,this.publishSnapshot(n)}getSnapshot(){return this.snapshot}createSnapshot(e,t){let r=this.getSourceSize(e);if(0===r.width||0===r.height)return createEmptySnapshot();let n=t?.x??[0,r.width],a=t?.y??[0,r.height],i=t?.outputWidth??n[1]-n[0],o=t?.outputHeight??a[1]-a[0],l=createCenterIndices(n,i),s=createCenterIndices(a,o),c=this.createReusableRows(n,l);return{data:Array.from(s,t=>{let r=e[t];return c.get(r)??maxPoolFrame(r,n,i)}),rawData:e,range:{x:n,y:a},sourceSize:r,columnIndices:l,rowIndices:s}}createReusableRows(e,t){let r=this.snapshot;if(!isSameRange(r.range.x,e)||!isSameIndices(r.columnIndices,t))return new Map;let n=new Map;for(let e=0;e<r.rowIndices.length;e++){let t=r.rawData[r.rowIndices[e]],a=r.data[e];t&&a&&n.set(t,a)}return n}getSourceSize(e){return{width:e[0]?.length??0,height:e.length}}publishSnapshot(e){return this.snapshot=e,this.onWaterfallUpdate?.(e),e}}var types_OrientationType=/*#__PURE__*/function(e){return e.Horizontal="horizontal",e.Vertical="vertical",e}({}),types_GraphicType=/*#__PURE__*/function(e){return e.Circle="circle",e.Rect="rect",e.Line="line",e.Stepline="stepline",e.Bar="bar",e.Area="area",e}({}),types_SeriesEventType=/*#__PURE__*/function(e){return e.PropertyChanged="propertyChanged",e.SeriesAdded="seriesAdded",e.SeriesRemoved="seriesRemoved",e.SeriesCleared="seriesCleared",e}({});let DEFAULT_SERIES_CONFIG={thickness:1,orientation:types_OrientationType.Horizontal,display:!0,type:types_GraphicType.Line,color:"#00000000",label:""};class SeriesManager{seriesMap=new Map;changeCallbacks=[];subscribers=new Map;constructor(e=[]){this.initializeSeries(e)}initializeSeries(e){for(let t of e)this.addSeries(t)}addSeries(e){let t={...DEFAULT_SERIES_CONFIG,...e};this.seriesMap.set(e.name,t),this.emitEvent({type:types_SeriesEventType.SeriesAdded,name:e.name,series:t})}getSeries(e){return this.seriesMap.get(e)}getAllSeries(){return Array.from(this.seriesMap.values())}getAllConfigs(){let e={};for(let[t,r]of this.seriesMap)e[t]={...r};return e}setSeriesProperty(e,t,r){let n=this.seriesMap.get(e);if(!n||"name"===t)return!1;let a=n[t],i={...n,[t]:r};return this.seriesMap.set(e,i),this.notifyChange(e,t,r),this.emitEvent({type:types_SeriesEventType.PropertyChanged,name:e,property:t,value:r,oldValue:a,series:i}),!0}removeSeries(e){let t=this.seriesMap.get(e);if(!t)return!1;let r=this.seriesMap.delete(e);return r&&this.emitEvent({type:types_SeriesEventType.SeriesRemoved,name:e,series:t}),r}hasSeries(e){return this.seriesMap.has(e)}onChange(e){this.changeCallbacks.push(e)}offChange(e){let t=this.changeCallbacks.indexOf(e);t>-1&&this.changeCallbacks.splice(t,1)}notifyChange(e,t,r){for(let n of this.changeCallbacks)n(e,t,r)}clear(){this.seriesMap.clear(),this.emitEvent({type:types_SeriesEventType.SeriesCleared})}size(){return this.seriesMap.size}subscribe(e,t={}){if(this.subscribers.set(e,t),t.immediate)for(let t of this.seriesMap.values())this.shouldNotifySubscriber(e,{type:types_SeriesEventType.SeriesAdded,name:t.name,series:t})&&e({type:types_SeriesEventType.SeriesAdded,name:t.name,series:t});return()=>{this.subscribers.delete(e)}}unsubscribe(e){this.subscribers.delete(e)}emitEvent(e){for(let[t]of this.subscribers)this.shouldNotifySubscriber(t,e)&&t(e)}shouldNotifySubscriber(e,t){let r=this.subscribers.get(e);return!!r&&(!r.eventTypes||!!r.eventTypes.includes(t.type))&&(!r.seriesNames||!t.name||!!r.seriesNames.includes(t.name))}}let AXIS_Y_WIDTH=40,resolveAxisYLayout=({padding:e,placement:t,show:r})=>{let n="inside"===t,a=!1===r?0:AXIS_Y_WIDTH,i=n?0:a;return{axisYWidth:`${a+e/2}px`,inside:n,marginLeft:`${0-e/2}px`,pluginBoxWidth:0===i?"100%":`calc(100% - ${i}px)`,width:`${i}px`}};function useAxisYWidth_useAxisYWidth(){let e=useStore_useSelector(e=>e.system.padding);return resolveAxisYLayout({padding:e,placement:useStore_useSelector(e=>e.axisY.placement),show:useStore_useSelector(e=>e.axisY.show)})}let buildZoomFullRange=(e,t)=>({...e,interval:{start:0,end:Math.max(t-1,0)},isScanSegmentsUpdateMagnify:!1}),RulerTicks_RulerTicks=({length:e=10,tickColor:t="var(--chart-grid-strong)",tickHeight:r=8,strokeWidth:n=1,orientation:a="horizontal",split:i=2})=>{let o=external_react_useCallback(o=>{let l=100/e*o,s="horizontal"===a&&o%i==0||"vertical"===a&&o%i!=0?1.68*r:r;return("horizontal"===a&&(s/=.5),l)?"horizontal"===a?/*#__PURE__*/jsx_runtime_jsx("line",{x1:l,y1:"0",x2:l,y2:s,stroke:t,strokeWidth:n,vectorEffect:"non-scaling-stroke"},`tick-${o}`):/*#__PURE__*/jsx_runtime_jsx("line",{x1:"100",y1:l,x2:100-s,y2:l,stroke:t,strokeWidth:n,vectorEffect:"non-scaling-stroke"},`tick-${o}`):null},[e,t,n,a]);return /*#__PURE__*/jsxs("svg",{className:"absolute left-0 top-0 h-full w-full opacity-50",width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 100",children:["horizontal"===a?/*#__PURE__*/jsx_runtime_jsx("line",{x1:"0",y1:"0",x2:"100",y2:"0",stroke:t,strokeWidth:n,vectorEffect:"non-scaling-stroke"}):/*#__PURE__*/jsx_runtime_jsx("line",{x1:"100",y1:"0",x2:"100",y2:"100",stroke:t,strokeWidth:n,vectorEffect:"non-scaling-stroke"}),Array.from({length:e+1}).map((e,t)=>o(t))]})},components_RulerTicks=RulerTicks_RulerTicks,ZoomViewportLayer=/*#__PURE__*/forwardRef(({children:e,className:t,style:r},n)=>{let{state:{zoom:{style:a}}}=useStore_useStore();return /*#__PURE__*/jsx_runtime_jsx("div",{ref:n,className:cn_cn("pointer-events-none absolute right-0 top-0 z-[1] h-full w-full select-none overflow-hidden bg-transparent",t),style:r,children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 flex h-full w-full self-center",style:a??void 0,children:e})})}),Zoom_ZoomViewportLayer=ZoomViewportLayer,AXIS_X_TICKS_LAYER_CLASS_NAME="absolute right-0 top-0 flex h-full w-full items-center justify-between text-xs opacity-50",AXIS_X_TICKS_SHELL_CLASS_NAME="relative h-6 w-full select-none overflow-hidden text-xs leading-6",MSCAN_SEGMENT_CLASS_NAME="flex flex-1 items-center justify-center",ThreeFixedTicks=()=>{let{state:{zoom:{interval:{start:e,end:t}},axisX:{unit:r="",unitKHz:n=""},segments:a}}=useStore_useStore(),i=a.totalPoints??0,o=Math.max(i-1,0),{start:l,bandwidth:s=0}=a[0]??{},c=external_react_useMemo(()=>o&&s&&void 0!==l?getFrequencyToFixed(l+Math.max(0,Math.min((0,array_0.$z)(e,t),o))*s/(1e3*o)):0,[e,t,l,o,s]),u=external_react_useMemo(()=>i&&s?getFrequencyToFixed((t-e+1)*s/(2*i)):0,[e,t,i,s]);return /*#__PURE__*/jsxs("div",{className:AXIS_X_TICKS_LAYER_CLASS_NAME,children:[/*#__PURE__*/jsx_runtime_jsx(FrequencyLabel,{value:u,unit:n,prefix:"-"}),/*#__PURE__*/jsx_runtime_jsx(FrequencyLabel,{value:c,unit:r}),/*#__PURE__*/jsx_runtime_jsx(FrequencyLabel,{value:u,unit:n,prefix:"+"}),/*#__PURE__*/jsx_runtime_jsx(components_RulerTicks,{length:10,split:5})]})},FrequencyLabel=/*#__PURE__*/memo(({value:e,unit:t,prefix:r=""})=>/*#__PURE__*/jsxs("div",{className:"pl-[5px]",children:[r,e,t]})),FrequencyTick=/*#__PURE__*/memo(({value:e,index:t,total:r})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("absolute flex -translate-x-1/2 items-center justify-center text-center",0===t&&"left-0 translate-x-0",t===r&&"left-full -translate-x-full"),style:{left:`${t/r*100}%`},children:/*#__PURE__*/jsx_runtime_jsx("span",{children:e})})),TICK_COUNT=5,DataNFixedTicks=({type:e})=>{let{state:{segments:t,zoom:r,waterfallViewport:n,axisX:{frequencyFormat:a}}}=useStore_useStore(),i=e===constants_ChartType.Heatmap?n.sourceSize.width:0,o=i||t.totalPoints||0,l=e===constants_ChartType.Heatmap&&i>0?n.range.x[0]:r.interval.start,s=e===constants_ChartType.Heatmap&&i>0?n.range.x[1]-1:r.interval.end,c=external_react_useCallback(e=>{if(!o)return 0;let t=Math.min(100*e/o,100);return a?.(t)??""},[o,a]),u=external_react_useMemo(()=>{let e=(s-l+1)/TICK_COUNT;return Array.from({length:TICK_COUNT+1},(t,r)=>{let n=l+e*r;return{key:`tick-${n.toFixed(6)}`,value:c(n)}})},[l,s,c]);return /*#__PURE__*/jsxs("div",{className:AXIS_X_TICKS_LAYER_CLASS_NAME,children:[u.map((e,t)=>/*#__PURE__*/jsx_runtime_jsx(FrequencyTick,{value:e.value,index:t,total:u.length-1},e.key)),/*#__PURE__*/jsx_runtime_jsx(components_RulerTicks,{length:10,split:2})]})},MScanTicks=()=>{let{state:{segments:e}}=useStore_useStore();return /*#__PURE__*/jsxs("div",{className:AXIS_X_TICKS_LAYER_CLASS_NAME,children:[external_react_useMemo(()=>e.map(e=>/*#__PURE__*/jsx_runtime_jsx("div",{className:MSCAN_SEGMENT_CLASS_NAME,children:e.label},e.index)),[e]),/*#__PURE__*/jsx_runtime_jsx(components_RulerTicks,{length:2*e.length,split:2})]})},AxisXTicks=({type:e})=>{let{state:{axisX:{show:t}}}=useStore_useStore();return t?/*#__PURE__*/jsx_runtime_jsx("div",{className:AXIS_X_TICKS_SHELL_CLASS_NAME,children:e===constants_ChartType.Scan||e===constants_ChartType.ScanDF360||e===constants_ChartType.Heatmap?/*#__PURE__*/jsx_runtime_jsx(DataNFixedTicks,{type:e}):e===constants_ChartType.MScan?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:/*#__PURE__*/jsx_runtime_jsx(MScanTicks,{})}):/*#__PURE__*/jsx_runtime_jsx(ThreeFixedTicks,{})}):null},Ticks=/*#__PURE__*/memo(AxisXTicks),DOUBLE_TAP_INTERVAL_MS=300,DOUBLE_TAP_SLOP_PX=20,AxisX=({type:e})=>{let{state:{axisX:t,zoom:r,segments:n},dispatch:a}=useStore_useStore(),{children:i,unit:o,ticks:l}=t,{width:s,pluginBoxWidth:c}=useAxisYWidth_useAxisYWidth(),u=external_react_useRef(null),d=external_react_useMemo(()=>({marginLeft:s,width:c}),[s,c]),h=e!==constants_ChartType.Heatmap,p=n.totalPoints??0,f=external_react_useCallback(()=>{a({payload:{zoom:buildZoomFullRange(r,p)}})},[a,r,p]),m=external_react_useRef({x:0,y:0,time:0}),g=external_react_useCallback(e=>{let t=e.changedTouches[0];if(!t)return;let{clientX:r,clientY:n}=t,a=Date.now(),i=m.current;if(a-i.time<=DOUBLE_TAP_INTERVAL_MS&&Math.abs(r-i.x)<=DOUBLE_TAP_SLOP_PX&&Math.abs(n-i.y)<=DOUBLE_TAP_SLOP_PX){m.current={x:0,y:0,time:0},f();return}m.current={x:r,y:n,time:a}},[f]);return t?/*#__PURE__*/jsx_runtime_jsx(Overlay_Tooltip,{content:`单位${o}`,children:/*#__PURE__*/jsxs("div",{ref:u,className:"relative flex w-full flex-col box-border",style:d,onDoubleClick:h?f:void 0,onTouchEnd:h?g:void 0,children:[l&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute bottom-[-12px] right-0 z-[3] flex items-center justify-end text-[10px] opacity-50",children:o}),/*#__PURE__*/jsx_runtime_jsx(Ticks,{type:e})]}),/*#__PURE__*/jsx_runtime_jsx("div",{children:i})]})}):null},components_AxisX=/*#__PURE__*/memo(AxisX),FlexBox=e=>{let{children:t,className:r,style:n}=e;return /*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("relative flex min-h-0 flex-1 box-border",r),style:n,children:t})},components_FlexBox=FlexBox;function tools_getAxisYDoubleClickResetRange(e){let[t,r]=e??constants_restrictList["dBμV"];return t===constants_restrictList["dBμV"]["0"]&&r===constants_restrictList["dBμV"]["1"]?constants_RANGE_DEFAULT:[t,r]}let TicksPanel_TicksPanel=({ranging:e})=>{let{state:{axisY:t,system:{height:r}}}=useStore(),{range:n=RANGE_DEFAULT,autoranging:a,step:i=stepDefault,restrict:o=restrictList.dBμV}=t,l=useRef(null),[s,c]=o,u=c-s,[d,h]=n,p=u/i+1,f=h-d,m=useMemo(()=>Array.from({length:p},(e,t)=>{let r=(c-t*i).toFixed(0);return isNumberAlias(r)?/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("span",{children:r})},r):null}),[c,i,p]),g=useMemo(()=>{let e=l.current?.offsetHeight??0,t=(u+i)/f*e,r=i/(u+i)*t/2,n=(c-h)/f*e;return{height:`${t}px`,transform:`translateY(-${r+n}px)`}},[o,n,i,r,u,f,h,c]),[b,v]=useState(!1),[w,y]=useState(0),x=useCallback(e=>{v(!0),y(e.clientY)},[]),k=useCallback(()=>{v(!1)},[]),S=useCallback(t=>{if(!b||!l.current)return;let r=(t.clientY-w)/l.current.offsetHeight;Math.abs(r)>.01&&(e.move?.(r),y(t.clientY))},[b,w,e]),D=useCallback((t,r)=>{b||(t.stopPropagation(),e.moveBoundary?.(t.deltaY>0,r))},[b,e]);return /*#__PURE__*/_jsxs("div",{ref:l,className:"relative z-[2] h-full w-full box-border pr-0.5 text-xs text-foreground opacity-50",style:{cursor:b?"ns-resize":"auto",pointerEvents:a?"none":"auto"},onMouseDown:x,onMouseUp:k,onMouseLeave:k,onMouseMove:S,onDoubleClick:()=>{let t=getAxisYDoubleClickResetRange(o);e.setAxisY?.({realRange:t}),e.onChange?.()},children:[/*#__PURE__*/_jsx(Tooltip,{content:"滑动鼠标滚轮以改变边界范围",duration:1500,children:/*#__PURE__*/_jsx("div",{className:cn("absolute left-0 top-0 z-[3] max-h-20 min-h-[30%] w-full cursor-pointer opacity-0 transition-opacity hover:opacity-30"),style:{pointerEvents:b?"none":"auto",background:"linear-gradient(to bottom, var(--chart-highlight), transparent)"},onWheel:e=>D(e,!0)})}),/*#__PURE__*/_jsx(Tooltip,{content:"滑动鼠标滚轮以改变边界范围",duration:1500,children:/*#__PURE__*/_jsx("div",{className:cn("absolute bottom-0 left-0 z-[3] max-h-20 min-h-[30%] w-full cursor-pointer opacity-0 transition-opacity hover:opacity-30"),style:{pointerEvents:b?"none":"auto",background:"linear-gradient(to top, var(--chart-highlight), transparent)"},onWheel:e=>D(e,!1)})}),/*#__PURE__*/_jsxs("div",{className:"absolute z-[2] flex w-full flex-col justify-center box-border pr-2 [&>div]:flex [&>div]:flex-1 [&>div]:items-center [&>div]:justify-center [&>div]:overflow-hidden [&>div>span]:w-full [&>div>span]:text-right",style:g,title:`${a?"范围控制已全自动":"按住鼠标左键上下拖动\n在边界滚动鼠标滚轮以改变视觉范围"}
3805
- 双击回到默认范围${RANGE_DEFAULT}`,children:[m,/*#__PURE__*/_jsx(RulerTicks,{orientation:"vertical",length:2*p,split:2})]})]})},presenters_TicksPanel=null,AutorangingControl=()=>{let{state:{axisY:e,globalID:t},dispatch:r}=useStore_useStore(),{autoranging:n,onChange:a}=e,i=external_react_useCallback(()=>{let t=!n;a?.({autoranging:t}),r({payload:{axisY:{...e,autoranging:t}}})},[e,n,a,r]);return /*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",title:"自动范围",onClick:()=>{useRangeAutoFocus(t)()},onDoubleClick:()=>{i()},children:/*#__PURE__*/jsx_runtime_jsx("span",{children:"A"})})},controls_AutorangingControl=/*#__PURE__*/react.memo(AutorangingControl),StepControl=()=>{let{state:{axisY:e,globalID:t},dispatch:r}=useStore(),{step:n,onChange:a}=e,i=useCallback(()=>{let t=nextItem(n,stepList);a?.({step:t}),r({payload:{axisY:{...e,step:t}}})},[n,e,a,r]);return useEffect(()=>{t&&subscriptionKeyBus(t,"step",e=>{e?.code==="KeyS"&&i()})},[i,t]),/*#__PURE__*/_jsxs(IconBox,{onClick:i,title:"步进",children:[n,"/div"]})},controls_StepControl=/*#__PURE__*/null,tools_nextItem=(e,t)=>{if(void 0===e||void 0===t||0===t.length)return e;let r=e,n=t.indexOf(r);return -1===n||n===t.length-1?[r]=t:r=t[n+1],r};function findNeighbors(e,t,r){let n=t.indexOf(e);if(-1===n)return null;let a=n>0?t[n-1]:t.at(0),i=n<t.length-1?t[n+1]:t.at(-1);return r<0?a:i}let UnitControl=()=>{let{state:{axisY:e,globalID:t},dispatch:r}=useStore_useStore(),{unit:n,unitList:a,unitDisabled:i,autoranging:o,onChange:l}=e,s=o||i,c=external_react_useCallback(()=>{if(s)return;let t=tools_nextItem(n,a);l?.({unit:t}),r({payload:{axisY:{...e,unit:t}}})},[e,n,s,a,l,r]);return external_react_useEffect(()=>{t&&useKeyEvent_subscriptionKeyBus(t,"unit",e=>{e?.code==="KeyU"&&c()})},[c,t]),/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{onClick:c,title:"单位",disabled:s,children:n})},controls_UnitControl=/*#__PURE__*/react.memo(UnitControl),AxisYSpectrum=e=>{let{chart:t}=e,{state:{axisY:r}}=useStore(),{show:n}=r,a=useRanging({chart:t}),{axisYWidth:i,marginLeft:o}=useAxisYWidth();return!1===n?null:/*#__PURE__*/_jsx("div",{className:"relative flex h-full justify-end",style:{width:i,marginLeft:o},children:/*#__PURE__*/_jsx(TicksPanel,{ranging:a})})},spectrum=null,SeriesEventName={UPDATED:"series:updated",ADDED:"series:added",REMOVED:"series:removed",MODE_CHANGED:"series:mode-changed",TYPE_OVERRIDE_CHANGED:"series:type-override-changed",BATCH_UPDATED:"series:batch-updated",RESET:"series:reset"};class EventManager{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set);let r=this.listeners.get(e);if(!r)throw Error(`Failed to get event listeners for ${e}`);return r.add(t),()=>{r.delete(t),0===r.size&&this.listeners.delete(e)}}emit(e,t){let r=this.listeners.get(e);r&&r.forEach(r=>{try{r(t)}catch(t){console.error(`Error in event listener for ${e}:`,t)}})}removeAllListeners(e){e?this.listeners.delete(e):this.listeners.clear()}getListenerCount(e){return this.listeners.get(e)?.size||0}}let globalEventManager=new EventManager,seriesEvents={on:globalEventManager.on.bind(globalEventManager),emit:globalEventManager.emit.bind(globalEventManager),removeAllListeners:globalEventManager.removeAllListeners.bind(globalEventManager),getListenerCount:globalEventManager.getListenerCount.bind(globalEventManager)};function subscribeToSeries(e,t,r){return seriesEvents.on(t,t=>{t.globalID===e&&r(t)})}function emitSeriesEvent(e,t){seriesEvents.emit(e,t)}var modes_SeriesMode=/*#__PURE__*/function(e){return e.Line="line",e.StepLine="stepline",e.Bar="bar",e.Area="area",e}({});let SERIES_MODES={line:{name:"line",label:"线图",icon:"line",realData:renderer_GraphicType.Line,minData:renderer_GraphicType.Line,maxData:renderer_GraphicType.Line,avgData:renderer_GraphicType.Line},stepline:{name:"stepline",label:"阶梯线图",icon:"stepline",realData:renderer_GraphicType.Stepline,minData:renderer_GraphicType.Stepline,maxData:renderer_GraphicType.Stepline,avgData:renderer_GraphicType.Stepline},bar:{name:"bar",label:"柱状图",icon:"bar",realData:renderer_GraphicType.Bar,minData:renderer_GraphicType.Line,maxData:renderer_GraphicType.Line,avgData:renderer_GraphicType.Line},area:{name:"area",label:"面积图",icon:"area",realData:renderer_GraphicType.Area,minData:renderer_GraphicType.Stepline,maxData:renderer_GraphicType.Stepline,avgData:renderer_GraphicType.Stepline}},seriesModes=new Map;function getSeriesMode(e){return seriesModes.get(e)||"line"}function getNextMode(e){let t=Object.values(modes_SeriesMode),r=(t.indexOf(e)+1)%t.length;return t[r]}function setSeriesMode(e,t){seriesModes.set(e,t);let r=SERIES_MODES[t];emitSeriesEvent(SeriesEventName.MODE_CHANGED,{globalID:e,mode:t,config:r})}function toggleSeriesMode(e,t){let r=getNextMode(t||getSeriesMode(e));setSeriesMode(e,r)}function modes_clearSeriesMode(e){seriesModes.delete(e)}function initSeriesSubscription(e){let{globalID:t}=e.state;if(!t)return console.warn("[Series] globalID is required for series subscription"),null;let r=[];return r.push(subscribeToSeries(t,SeriesEventName.UPDATED,r=>{let n=getCorrectSeriesType(t,r.seriesName),a={...r.config,type:n};e.setSeries(a,!0),e.state.chart?.draw()})),r.push(subscribeToSeries(t,SeriesEventName.MODE_CHANGED,()=>{e.initSeries()})),r.push(subscribeToSeries(t,SeriesEventName.TYPE_OVERRIDE_CHANGED,()=>{e.initSeries()})),r.push(subscribeToSeries(t,SeriesEventName.BATCH_UPDATED,r=>{r.configs.forEach(r=>{let n=getCorrectSeriesType(t,r.name),a={...r,type:n};e.setSeries(a,!0)}),e.state.chart?.draw()})),r.push(subscribeToSeries(t,SeriesEventName.RESET,()=>{e.state.series&&(e.state.series={}),e.initSeries()})),()=>{for(let e of r)e()}}let chartTypeSeriesOverrides=new Map;function setChartTypeSeriesOverride(e,t,r){chartTypeSeriesOverrides.has(e)||chartTypeSeriesOverrides.set(e,new Map),chartTypeSeriesOverrides.get(e)?.set(t,r),emitSeriesEvent(SeriesEventName.TYPE_OVERRIDE_CHANGED,{globalID:e,seriesName:t,type:r})}function clearChartTypeSeriesOverrides(e){let t=chartTypeSeriesOverrides.has(e);chartTypeSeriesOverrides.delete(e),t&&emitSeriesEvent(SeriesEventName.TYPE_OVERRIDE_CHANGED,{globalID:e})}function getChartTypeSeriesOverride(e,t){return chartTypeSeriesOverrides.get(e)?.get(t)}function getCorrectSeriesType(e,t){let r=chartTypeSeriesOverrides.get(e)?.get(t);if(r)return r;if("templateData"===t)return renderer_GraphicType.Area;let n=SERIES_MODES[getSeriesMode(e)][t];return n&&"string"==typeof n?n:renderer_GraphicType.Line}let managers=new Map;function getDefaultSeriesConfigs(){return Object.values(getSeriesConfig()).map(e=>({name:e.name,label:e.label,color:e.color,thickness:e.thickness,display:e.display,type:renderer_GraphicType.Line}))}function getSeriesManager(e){if(!e)throw Error("globalID 不能为空");if(!managers.has(e)){let t=new SeriesManager([]);getDefaultSeriesConfigs().forEach(e=>{t.addSeries({name:e.name,label:e.label,color:e.color,display:e.display,type:e.type||renderer_GraphicType.Line,thickness:e.thickness})}),managers.set(e,t)}let t=managers.get(e);if(!t)throw Error(`SeriesManager for globalID "${e}" not found`);return t}function destroySeriesManager(e){let t=managers.get(e);t&&(t.clear(),managers.delete(e),clearSeriesMode(e),chartTypeSeriesOverrides.delete(e))}function hasSeriesManager(e){return managers.has(e)}function getSeriesMap(e){let t=getSeriesManager(e).getAllSeries(),r=new Map;return Array.isArray(t)&&t.forEach(e=>{r.set(e.name,{name:e.name,label:e.label||"",color:e.color,display:void 0===e.display||e.display,type:e.type||renderer_GraphicType.Line,thickness:e.thickness||1})}),r}function mergeSeriesConfig(e,t){let r=getSeriesConfig()[e.name],n={label:r?.label??"",color:r?.color,display:r?.display??!0,type:renderer_GraphicType.Line,thickness:r?.thickness??1};return{name:e.name,label:e.label??t?.label??n.label,color:e.color??t?.color??n.color??(()=>{throw Error(`Series "${e.name}" does not exist and must have a color defined`)})(),display:e.display??t?.display??n.display,type:e.type??t?.type??n.type,thickness:e.thickness??t?.thickness??n.thickness}}function upsertSeriesConfig(e,t,r){r?(e.setSeriesProperty(t.name,"label",t.label),e.setSeriesProperty(t.name,"color",t.color),e.setSeriesProperty(t.name,"thickness",t.thickness),e.setSeriesProperty(t.name,"display",t.display),e.setSeriesProperty(t.name,"type",t.type)):e.addSeries(t)}function updateSeries(e,t){if(!t?.name)return;let r=getSeriesManager(e),n=r.getSeries(t.name),a=mergeSeriesConfig(t,n);upsertSeriesConfig(r,a,n),emitSeriesEvent(SeriesEventName.UPDATED,{globalID:e,seriesName:t.name,config:{name:a.name,label:a.label,color:a.color,thickness:a.thickness,display:a.display,type:a.type}})}function resetSeries(e){let t=getSeriesManager(e);t.clear(),getDefaultSeriesConfigs().forEach(e=>{t.addSeries({name:e.name,label:e.label,color:e.color,display:e.display,type:e.type||renderer_GraphicType.Line,thickness:e.thickness})}),emitSeriesEvent(SeriesEventName.RESET,{globalID:e})}function batchUpdateSeries(e,t){let r=getSeriesManager(e),n=[];t.forEach(e=>{if(!e?.name)return;let t=r.getSeries(e.name),a=mergeSeriesConfig(e,t);upsertSeriesConfig(r,a,t),n.push({name:a.name,label:a.label,color:a.color,thickness:a.thickness,display:a.display,type:a.type})}),n.length>0&&emitSeriesEvent(SeriesEventName.BATCH_UPDATED,{globalID:e,configs:n})}function getSeriesWithGraphicType(e){let t=getSeriesMap(e),r=new Map;return t.forEach(t=>{let n={...t,type:getCorrectSeriesType(e,t.name)};r.set(t.name,n)}),r}let DEFAULT_SPECTRUM_TYPE="singleFrequency",WATERFALL_CAPABLE_SPECTRUM_TYPES=new Set([DEFAULT_SPECTRUM_TYPE,"scan","mscan"]),shouldEnableSpectrumWaterfall=({heatmapElementID:e,type:t})=>!!e&&WATERFALL_CAPABLE_SPECTRUM_TYPES.has(t??DEFAULT_SPECTRUM_TYPE),applyAxisYRange=(e,t)=>{let[r,n]=t,a=e.range??constants_RANGE_DEFAULT,i=e.realRange??constants_RANGE_DEFAULT,o=e.renderRange??constants_RANGE_DEFAULT,l=a[0]!==r||a[1]!==n,s=i[0]!==r||i[1]!==n,c=o[0]!==r||o[1]!==n;return l||s||c?{...e,range:t,realRange:t,renderRange:t}:e};function useSpectrumChartType({type:e,heatmapElementID:t}){let{state:{axisY:r,limit:n,signal:a,marker:i,cursor:o,frequencyAllocation:l,zoom:s,globalID:c},dispatch:u}=useStore_useStore();return external_react_useEffect(()=>{c&&(clearChartTypeSeriesOverrides(c),e===constants_ChartType.MScan&&setChartTypeSeriesOverride(c,REAL_DATA_NAME,renderer_GraphicType.Bar),e===constants_ChartType.ScanDF360&&(setChartTypeSeriesOverride(c,REAL_DATA_NAME,renderer_GraphicType.Rect),setScanDF360Prob(c)(!0)))},[e,c]),external_react_useEffect(()=>{let t=r,c=n,d=a,h=i,p=o,f=l,m=s;if(e===constants_ChartType.DDC&&(!1!==c.show&&(c={...c,show:!1}),!0!==h.visible&&(h={...h,visible:!0})),e===constants_ChartType.Lite&&(!1!==c.show&&(c={...c,show:!1}),!1!==h.enabled&&(h={...h,enabled:!1})),e===constants_ChartType.LiteNormalized){let e=t.restrict??[0,1];!1!==c.show&&(c={...c,show:!1}),!1!==d.show&&(d={...d,show:!1}),(0!==e[0]||1!==e[1])&&(t={...t,restrict:[0,1]}),!1!==f.show&&(f={...f,show:!1})}if(e===constants_ChartType.MScan&&(!1!==h.enabled&&(h={...h,enabled:!1}),!1!==f.show&&(f={...f,show:!1})),e===constants_ChartType.ScanDF360){let e=t.restrict??[0,360];!1!==c.show&&(c={...c,show:!1}),!1!==d.show&&(d={...d,show:!1}),!1!==h.enabled&&(h={...h,enabled:!1}),!1!==m.show&&(m={...m,show:!1}),!1!==p.show&&(p={...p,show:!1}),!1!==f.show&&(f={...f,show:!1}),t="°"!==t.unit||36!==t.step||0!==e[0]||360!==e[1]?{...applyAxisYRange(t,[0,360]),unit:"°",restrict:[0,360],step:36}:applyAxisYRange(t,[0,360])}let g={};c!==n&&(g.limit=c),d!==a&&(g.signal=d),h!==i&&(g.marker=h),p!==o&&(g.cursor=p),f!==l&&(g.frequencyAllocation=f),m!==s&&(g.zoom=m),t!==r&&(g.axisY=t),Object.keys(g).length>0&&u({payload:g})},[r,o,u,l,n,i,a,e,s]),external_react_useEffect(()=>{if(e===constants_ChartType.LiteNormalized&&c){let e=r.range??constants_RANGE_DEFAULT;if(e[0]<0||e[1]>1){let e=applyAxisYRange(r,[0,1]);u({payload:{axisY:e}}),useRangeSet(c)(e.range??[0,1])}}},[r,u,c,e]),external_react_useMemo(()=>{let r=!1,n=shouldEnableSpectrumWaterfall({heatmapElementID:t,type:e});return(e===constants_ChartType.SingleFrequency||e===constants_ChartType.Scan||e===constants_ChartType.MScan)&&(r=!0),{enableMetrics:r,enableWaterfall:n}},[e,t])}function useChannel(){let{state:{marker:e,globalID:t},dispatch:r}=useStore_useStore();return external_react_useEffect(()=>{e?.mode===marker_MarkerMode.DDC&&r({payload:{marker:{...e,enabled:!0,visible:!0}}})},[e?.mode]),external_react_useCallback(()=>{},[t])}function usePoints(){let{dispatch:e,state:{axisX:t}}=useStore_useStore();return external_react_useCallback(r=>{if(r?.length){let n=leftPoints2frequency(r);t.frequencyFormat=e=>String(n(e)??""),e({payload:{points:r,axisX:t}})}},[])}function useSegments(){let{state:{segments:e,zoom:t,points:r,axisX:n},dispatch:a}=useStore_useStore();return external_react_useEffect(()=>{},[e]),[e,external_react_useCallback(e=>{if(e.totalPoints){t.interval={start:0,end:e.totalPoints-1};let i={segments:e,zoom:t,axisX:n};0===r.length&&(i.axisX.frequencyFormat=leftSegments2frequency(e)),a({payload:i})}},[r])]}let SET_SEGMENTS_DISPLAY=(e,t)=>subscription_createSubscriptionManager(`SET_SEGMENTS_DISPLAY-${e}`,"0",t,e);function useSpectrumRule(e){let{state:{zoom:t,globalID:r},dispatch:n}=useStore_useStore(),[a,i]=useSegments(),o=external_react_useCallback(e=>{let{event:r=constants_SegmentsEvent.Cover,index:o}=e,{totalPoints:l}=a,s=0,c=0,u=!1;if(r===constants_SegmentsEvent.Focus&&l)if("number"==typeof o&&o<a.length){for(let e=0;e<o;e+=1)s+=a[e].point+1;let{point:e}=a[o];c=s+e,u=!0}else void 0===o&&(s=0,c=l-1,u=!1);t.interval={start:s,end:c},t.isScanSegmentsUpdateMagnify=u,n({payload:{zoom:t}}),r===constants_SegmentsEvent.Cover&&e.data&&i(generateGreatSegments(e.data))},[a]);external_react_useEffect(()=>SET_SEGMENTS_DISPLAY(r,e=>{o?.({pstype:constants_PSType.Segments,event:constants_SegmentsEvent.Focus,index:e})}),[r,o]);let l=external_react_useRef(3),s=external_react_useRef({frequency:0,bandwidth:0}),c=external_react_useCallback((e,t=s.current)=>{if(t.bandwidth&&t.frequency&&e){let r=generateFrequencySegments({frequency:t?.frequency,bandwidth:t?.bandwidth,totalPoints:e});"function"==typeof i&&i(r)}},[i]),u=external_react_useCallback(e=>{let{frequency:t,bandwidth:r}=e;if(!t||!r)return;let n=s.current;(n.frequency!==t||n.bandwidth!==r)&&(s.current={frequency:t,bandwidth:r},c(l.current,e))},[]),d=external_react_useCallback(t=>{if(!t)return;let r=t?.length;r&&r!==l.current&&(l.current=r,c(r),e===constants_ChartType.LiteNormalized&&i(generateNormalizedSegments(r)))},[c,i,e]);return useChannel(),external_react_useCallback(e=>{switch(e.pstype){case constants_PSType.Spectrum:e.data&&d(e.data);break;case constants_PSType.SpectrumBandwidth:u(e);break;case constants_PSType.Segments:o?.(e)}},[])}function useTouchMode(e){let{dispatch:t}=useStore_useStore(),r=external_react_useRef(!1);external_react_useEffect(()=>{if(!e){r.current=!1;return}r.current||(r.current=!0,t({payload:e=>({limit:{...e.limit,show:!1},marker:{...e.marker,enabled:!1,visible:!1},frequencyAllocation:{...e.frequencyAllocation,show:!1},toolbar:{...e.toolbar,show:!1}})}))},[e,t])}let COMPONENT_KEY="AxisYHeatmapTicks",calcTimeDiffLastTwoDigits=e=>e?.slice?.(-8),HEATMAP_FULL_TICKS=10,Ticks_Ticks=e=>{let{id:t}=e,{state:{globalID:r}}=useStore_useStore(),[n,a]=external_react_useState(Array(HEATMAP_FULL_TICKS).fill("")),i=external_react_useMemo(()=>{let e=[];for(let t=0;t<HEATMAP_FULL_TICKS;t++)e.push(`${100-t/(HEATMAP_FULL_TICKS-1)*100}%`);return e},[]);return external_react_useEffect(()=>{t&&r&&withUpdateData(t,COMPONENT_KEY,()=>{let e=withWaterfallAnalyzerSYNC(r)?.getSnapshot().data??withDatabase(r).getAllRawData().waterfallData??[],t=[],n=e.length;for(let r=0;r<HEATMAP_FULL_TICKS;r++){let a=e[Math.floor((n-1)*r/(HEATMAP_FULL_TICKS-1))],i=calcTimeDiffLastTwoDigits(a?.timestamp);t.push(i)}a(t)})},[t,r]),/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative z-[2] flex h-full w-full flex-col items-end justify-between pr-1 text-xs text-foreground opacity-50",children:i.map((e,t)=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("absolute right-0 flex max-w-full origin-right scale-x-[0.85] items-center justify-end whitespace-nowrap text-right text-[9px] leading-none [font-variant-numeric:tabular-nums]",0===t&&"-translate-y-full",t===i.length-1&&"translate-y-0",t>0&&t<i.length-1&&"-translate-y-1/2"),style:{top:e},children:n[t]},`tick-${e}`))})},components_Ticks=/*#__PURE__*/react.memo(Ticks_Ticks),StandardHeatmapAxisYVariant=e=>{let{axisYWidth:t,marginLeft:r}=useAxisYWidth_useAxisYWidth();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-auto justify-between overflow-hidden",style:{width:t,marginLeft:r},children:/*#__PURE__*/jsx_runtime_jsx(components_Ticks,{...e})})},standard=StandardHeatmapAxisYVariant,rainColors=getGradient(),GradientRibbon_GradientRibbon=()=>{let{state:{axisY:{range:e}}}=useStore(),[t,r]=e;return /*#__PURE__*/_jsxs("div",{className:"relative flex h-full w-4 select-none flex-col",children:[/*#__PURE__*/_jsxs("div",{className:"absolute top-0 flex h-full w-full flex-col justify-between",children:[/*#__PURE__*/_jsx("div",{className:"flex w-full items-center justify-center text-[9px] text-white",children:r.toFixed()}),/*#__PURE__*/_jsx("div",{className:"flex w-full items-center justify-center text-[9px] text-white",children:t.toFixed()})]}),rainColors.map((e,t)=>t===rainColors.length-1?null:/*#__PURE__*/_jsx("span",{className:"w-full flex-1",style:{background:`linear-gradient(to bottom,${e},${rainColors[t+1]})`}},e))]})},standard_GradientRibbon=null,AxisYHeatmap=e=>{let{chart:t}=e,{state:{axisY:r}}=useStore_useStore(),{linkage:n,renderRange:a,show:i}=r;return(external_react_useEffect(()=>{n&&a&&t?.setRange?.(a)},[a]),!1===i)?null:/*#__PURE__*/jsx_runtime_jsx(standard,{...e})},heatmap=AxisYHeatmap,CURSOR_TIMEOUT=(e,t)=>openData(`CURSOR_TIMEOUT-${e}`,t,null,e),CURSOR_SETACTIVE=(e,t)=>subscription_createSubscriptionManager(`CURSOR_SETACTIVE-${e}`,"0",t,e);function convertCoordToVisualLeft({coord:e,zoom:t,segments:r}){let{left:n}=e,{start:a,end:i}=t.interval,{totalPoints:o}=r;return(Math.min(Math.round(Math.max(0,Math.min(100,n))/100*(o-1)),o-1)-a)*100/(i-a+1)}function convertVisualLeftToRealLeft({visualLeft:e,zoom:t,segments:r}){let{start:n,end:a}=t.interval,{totalPoints:i}=r,o=Math.round((a-n+1)*Math.max(0,Math.min(100,e))/100);return 100*Math.min(n+o,i-1)/(i-1)}let hasBounds=e=>"function"==typeof e?.getBoundingClientRect,calculateEventRelativePositionFromSource=e=>{let{clientX:t=0,clientY:r=0}=e,n=e.currentTarget??e.target,{left:a,top:i,width:o,height:l}=hasBounds(n)?n.getBoundingClientRect():{height:0,left:0,top:0,width:0};return o<=0||l<=0?{left:0,top:0}:{left:(t-a)/o*100,top:(r-i)/l*100}};function getEID(e){return`EVENTBUS-${e}`}function generateRecursiveId(e,t){let r=e;return t&&(r=getEID(e)),r}let createMoveEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-createMoveEventManager`,t,r,e),createMouseDownEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-createMouseDownEventManager`,t,r,e),createDoubleClickEventManager=(e,t,r)=>createConsumableSubscriptionManager(`${generateRecursiveId(e,r)}-createDoubleClickEventManager`,getEventPriority,t,r,e),createMouseUpEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-mouse-up`,t,r,e),createMouseLeaveEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-mouse-leave`,t,r,e),createMouseEnterEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-mouse-enter`,t,r,e),createWheelEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-wheel`,t,r,e),createDragEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-drag`,t,r,e),createZoomEventManager=(e,t,r)=>createSubscriptionManager(`${generateRecursiveId(e,r)}-zoom`,t,r,e),createLongPressEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-long-press`,t,r,e),calculateEventRelativePosition=e=>calculateEventRelativePositionFromSource(e),EVENT_PRIORITY_LEVEL_DEFAULT="void",EVENT_PRIORITY_LEVELS={[EVENT_PRIORITY_LEVEL_DEFAULT]:0,[constants_ToolType.EventBus]:1,[constants_ToolType.Signal]:1,[constants_ToolType.Zoom]:2,[constants_ToolType.DragFrame]:2,[constants_ToolType.HeatmapCapture]:3,[constants_ToolType.Markers]:3,[constants_ToolType.Limit]:3,[constants_ToolType.Stripe]:4,[constants_ToolType.FrequencyTagLine]:5},getEventPriority=e=>EVENT_PRIORITY_LEVELS[e]??0,CURSOR_STYLE_MAP={[constants_ToolType.Markers]:"all-scroll",[constants_ToolType.Stripe]:"col-resize",[constants_ToolType.FrequencyTagLine]:"col-resize",[constants_ToolType.Limit]:"n-resize",[constants_ToolType.Frame]:"w-resize",[constants_ToolType.Zoom]:"all-scroll",[constants_ToolType.Area]:"crosshair"},getEventLevel=(e,t)=>subscription_openData(`event-level-${e}`,t,EVENT_PRIORITY_LEVEL_DEFAULT,e),getEventType=(e,t)=>subscription_openData(`event-type-${e}`,t,"",e);function compareEventPriority(e,t,r){getEventType(e,r);let n=EVENT_PRIORITY_LEVELS[getEventLevel(e)];return EVENT_PRIORITY_LEVELS[t]>=n&&(getEventLevel(e,t),!0)}function getEventCursor(e){return CURSOR_STYLE_MAP[getEventLevel(e)]??"default"}function resetEventLevel(e,t){let r=getEventLevel(e);t&&r===t&&getEventLevel(e,EVENT_PRIORITY_LEVEL_DEFAULT)}let POPOVER_ROW_CLASS="mt-1 flex items-center justify-between gap-1 text-xs text-popover-foreground",POPOVER_VALUE_CLASS="inline-flex min-w-9 justify-end",useCursorPopoverUpdateKey=(e,t)=>{let[r,n]=external_react_useState(0);return external_react_useEffect(()=>{if(!t)return;let r=withUpdateData(t,`CursorPopover-${e}`,()=>{n(e=>e+1)});return()=>{"function"==typeof r&&r()}},[t,e]),r},FrequencyDisplay=({frequency:e,unit:t})=>e?/*#__PURE__*/jsxs("div",{className:"text-[14px] font-medium text-popover-foreground",children:[e,t]}):null,useCursorSample=e=>{let t=external_react_useCallback(t=>e?interactionRuntime.subscribeSample(e,()=>{t()}):()=>{},[e]),r=external_react_useCallback(()=>e?interactionRuntime.getSample(e):null,[e]);return useSyncExternalStore(t,r,r)};function useSeriesManager(e,t={}){let{subscribeToMode:r=!0,subscribeToData:n=!0,watchSeries:a}=t,[i,o]=external_react_useState(0),[l,s]=external_react_useState(()=>e?getSeriesMode(e):"line"),c=external_react_useCallback(()=>{o(e=>e+1)},[]),u=external_react_useMemo(()=>e?getSeriesMap(e):new Map,[e,i]),d=external_react_useCallback(t=>{e&&updateSeries(e,t)},[e]),h=external_react_useCallback(e=>u.get(e),[u]);return external_react_useEffect(()=>{if(!e)return;let t=[];if(r){s(getSeriesMode(e));let r=subscribeToSeries(e,SeriesEventName.MODE_CHANGED,e=>{s(e.mode)});t.push(r)}if(n){let r=subscribeToSeries(e,SeriesEventName.UPDATED,e=>{(!a||a.includes(e.seriesName))&&c()});t.push(r);let n=subscribeToSeries(e,SeriesEventName.ADDED,e=>{(!a||a.includes(e.seriesName))&&c()});t.push(n);let i=subscribeToSeries(e,SeriesEventName.REMOVED,e=>{(!a||a.includes(e.seriesName))&&c()});t.push(i);let o=subscribeToSeries(e,SeriesEventName.BATCH_UPDATED,()=>{c()});t.push(o);let l=subscribeToSeries(e,SeriesEventName.RESET,()=>{c()});t.push(l)}return()=>{for(let e of t)e()}},[e,r,n,a,c]),{series:u,mode:l,updateSeries:d,forceUpdate:c,getSeries:h}}function useSeriesForComponent(e){return useSeriesManager(e,{subscribeToMode:!0,subscribeToData:!0})}let DEFAULT_SERIES_ORDER=Object.values(getSeriesConfig()).map(e=>e.name);function getStableOrder(e){return[...DEFAULT_SERIES_ORDER.filter(t=>e.includes(t)),...e.filter(e=>!DEFAULT_SERIES_ORDER.includes(e))]}function useFilteredSeries(e,t){let{series:r}=useSeriesManager(e),n=useStore_useSelector(e=>e.series.legendExternal);return external_react_useMemo(()=>{let e=Array.from(r.values()).filter(e=>!n.includes(e.name)&&e.name!==constants_SeriesType.TemplateData&&(!t||t(e))),a=new Map(getStableOrder(e.map(e=>e.name)).map((e,t)=>[e,t]));return e.sort((e,t)=>(a.get(e.name)??Number.MAX_SAFE_INTEGER)-(a.get(t.name)??Number.MAX_SAFE_INTEGER)).map((e,t)=>({...e,originalIndex:t}))},[r,n,t])}let useSeriesManager_useFilteredSeries=null,viewport_clamp=(e,t,r)=>Math.min(r,Math.max(t,e)),clampHeatmapPercent=e=>viewport_clamp(e,0,100),normalizeHeatmapFrames=e=>{let t=0,r=!1;for(let r of e)t=Math.max(t,r.length);if(0===t)return[];for(let n of e)if(n.length!==t){r=!0;break}return r?e.map(e=>{if(e.length===t)return e;let r=new Float32Array(t);return r.fill(0/0),r.set(e),r.timestamp=e.timestamp,r}):e},resolveHeatmapVisibleRowIndex=(e,t)=>t<=0?-1:1===t?0:viewport_clamp(Math.ceil((100-clampHeatmapPercent(e))*t/100)-1,0,t-1),resolveHeatmapVisibleColumnIndex=(e,t)=>t<=0?-1:1===t?0:viewport_clamp(Math.ceil(clampHeatmapPercent(e)*t/100)-1,0,t-1),resolveHeatmapSourceLeft=(e,t)=>{let{width:r}=t.sourceSize;if(r<=0)return 0;let[n,a]=t.range.x;return viewport_clamp(100*(n+(a-n)*clampHeatmapPercent(e)/100)/r,0,100)},resolveHeatmapSourcePoint=(e,t)=>{let r=resolveHeatmapVisibleRowIndex(t.top,e.rowIndices.length),n=resolveHeatmapVisibleColumnIndex(t.left,e.columnIndices.length);return r<0||n<0?null:{columnIndex:e.columnIndices[n],rowIndex:e.rowIndices[r],sourceLeft:resolveHeatmapSourceLeft(t.left,e),visibleColumnIndex:n,visibleRowIndex:r}},resolveHeatmapSourceRange=(e,t)=>{let r=resolveHeatmapSourcePoint(e,{left:t.startLeft,top:t.startTop}),n=resolveHeatmapSourcePoint(e,{left:t.endLeft,top:t.endTop});return r&&n?{endCol:Math.max(r.columnIndex,n.columnIndex),endIndex:Math.max(r.rowIndex,n.rowIndex),startCol:Math.min(r.columnIndex,n.columnIndex),startIndex:Math.min(r.rowIndex,n.rowIndex)}:null},resolveHeatmapSnapshotRangeData=(e,t)=>e.rawData.slice(t.startIndex,t.endIndex+1).map(e=>Array.from(e.slice(t.startCol,t.endCol+1))),resolveHeatmapSourceRangeScreenRect=(e,t)=>resolveHeatmapContinuousSourceRangeScreenRect(e,{x:[Math.min(t.startCol,t.endCol),Math.max(t.startCol,t.endCol)+1],y:[Math.min(t.startIndex,t.endIndex),Math.max(t.startIndex,t.endIndex)+1]}),resolveHeatmapContinuousSourceRangeScreenRect=(e,t)=>{let[r,n]=e.range.x,[a,i]=e.range.y,o=n-r,l=i-a;if(o<=0||l<=0)return null;let s=Math.min(t.x[0],t.x[1]),c=Math.max(t.x[0],t.x[1]),u=Math.min(t.y[0],t.y[1]),d=Math.max(t.y[0],t.y[1]);return{leftPosition:(s-r)*100/o,width:(c-s)*100/o,position:100-(d-a)*100/l,height:(d-u)*100/l}},SOURCE_EDGE_EPSILON=1e-7,resolveHeatmapProjectedContinuousSourceRange=(e,t)=>{let{sourceSize:r}=e,[n,a]=e.range.x,[i,o]=e.range.y,l=a-n,s=o-i;if(r.width<=0||r.height<=0||l<=0||s<=0)return null;let c=viewport_clamp(n+Math.min(t.startLeft,t.endLeft)*l/100,0,r.width),u=viewport_clamp(n+Math.max(t.startLeft,t.endLeft)*l/100,0,r.width),d=i+(100-t.startTop)*s/100,h=i+(100-t.endTop)*s/100;return{x:[c,u],y:[viewport_clamp(Math.min(d,h),0,r.height),viewport_clamp(Math.max(d,h),0,r.height)]}},resolveHeatmapProjectedSourceRange=(e,t)=>{let r=resolveHeatmapProjectedContinuousSourceRange(e,t);return r?quantizeHeatmapContinuousSourceRange(e,r):null},quantizeHeatmapContinuousSourceRange=(e,t)=>{let{sourceSize:r}=e;if(r.width<=0||r.height<=0)return null;let[n,a]=t.x,[i,o]=t.y,l=viewport_clamp(Math.floor(n+SOURCE_EDGE_EPSILON),0,r.width-1),s=viewport_clamp(Math.max(l,Math.ceil(a-SOURCE_EDGE_EPSILON)-1),l,r.width-1),c=viewport_clamp(Math.floor(i+SOURCE_EDGE_EPSILON),0,r.height-1);return{endCol:s,endIndex:viewport_clamp(Math.max(c,Math.ceil(o-SOURCE_EDGE_EPSILON)-1),c,r.height-1),startCol:l,startIndex:c}},resizeAnchoredRange=(e,t,r,n)=>{let a=viewport_clamp(Math.round(e[0]+(e[1]-e[0])*n-r*n),0,t-r);return[a,a+r]},calculateHeatmapWheelRange=(e,t,r)=>{let{sourceSize:n}=e,a=e.range.x[1]-e.range.x[0],i=e.range.y[1]-e.range.y[0],o=t>0?.5:2,l=Math.min(10,n.width),s=Math.min(2,n.height),c=viewport_clamp(Math.round(a*o),l,n.width),u=viewport_clamp(Math.round(i*o),s,n.height);return{x:resizeAnchoredRange(e.range.x,n.width,c,clampHeatmapPercent(r.left)/100),y:resizeAnchoredRange(e.range.y,n.height,u,(100-clampHeatmapPercent(r.top))/100)}},translateRange=(e,t,r)=>{let n=e[1]-e[0],a=viewport_clamp(e[0]+r,0,t-n);return[a,a+n]},centerRange=(e,t,r)=>{let n=e[1]-e[0],a=viewport_clamp(Math.round(r-n/2),0,t-n);return[a,a+n]},resolveHeatmapOverviewSourcePoint=(e,t)=>({x:viewport_clamp(t.left,0,1)*e.sourceSize.width,y:(1-viewport_clamp(t.top,0,1))*e.sourceSize.height}),resolveHeatmapOverviewViewportRect=e=>{let{range:t,sourceSize:r}=e;return r.width<=0||r.height<=0?{height:0,left:0,top:0,width:0}:{left:t.x[0]/r.width,top:1-t.y[1]/r.height,width:(t.x[1]-t.x[0])/r.width,height:(t.y[1]-t.y[0])/r.height}},toHeatmapContinuousSourceRange=e=>({x:[Math.min(e.startCol,e.endCol),Math.max(e.startCol,e.endCol)+1],y:[Math.min(e.startIndex,e.endIndex),Math.max(e.startIndex,e.endIndex)+1]}),resolveHeatmapOverviewContinuousSourceRangeRect=(e,t)=>{let{sourceSize:r}=e;if(r.width<=0||r.height<=0)return{height:0,left:0,top:0,width:0};let n=viewport_clamp(Math.min(t.x[0],t.x[1]),0,r.width),a=viewport_clamp(Math.max(t.x[0],t.x[1]),n,r.width),i=viewport_clamp(Math.min(t.y[0],t.y[1]),0,r.height),o=viewport_clamp(Math.max(t.y[0],t.y[1]),i,r.height);return{left:n/r.width,top:1-o/r.height,width:(a-n)/r.width,height:(o-i)/r.height}},resolveHeatmapOverviewSourceRangeRect=(e,t)=>resolveHeatmapOverviewContinuousSourceRangeRect(e,toHeatmapContinuousSourceRange(t)),isHeatmapContinuousSourceRangeVisibleInViewport=(e,t)=>Math.min(t.x[0],t.x[1])<e.range.x[1]&&Math.max(t.x[0],t.x[1])>e.range.x[0]&&Math.min(t.y[0],t.y[1])<e.range.y[1]&&Math.max(t.y[0],t.y[1])>e.range.y[0],isHeatmapSourceRangeVisibleInViewport=(e,t)=>isHeatmapContinuousSourceRangeVisibleInViewport(e,toHeatmapContinuousSourceRange(t)),isHeatmapOverviewSourcePointInContinuousRange=(e,t,r={x:0,y:0})=>t.x>=Math.min(e.x[0],e.x[1])-r.x&&t.x<=Math.max(e.x[0],e.x[1])+r.x&&t.y>=Math.min(e.y[0],e.y[1])-r.y&&t.y<=Math.max(e.y[0],e.y[1])+r.y,isHeatmapOverviewSourcePointInRange=(e,t,r={x:0,y:0})=>isHeatmapOverviewSourcePointInContinuousRange(toHeatmapContinuousSourceRange(e),t,r),isHeatmapViewportFullRange=e=>{let{range:t,sourceSize:r}=e;return r.width<=0||r.height<=0||0===t.x[0]&&t.x[1]===r.width&&0===t.y[0]&&t.y[1]===r.height},calculateHeatmapOverviewCenteredRange=(e,t)=>{let r=resolveHeatmapOverviewSourcePoint(e,t);return{x:centerRange(e.range.x,e.sourceSize.width,r.x),y:centerRange(e.range.y,e.sourceSize.height,r.y)}},calculateHeatmapOverviewContinuousSourceRangeCenteredRange=(e,t)=>({x:centerRange(e.range.x,e.sourceSize.width,(Math.min(t.x[0],t.x[1])+Math.max(t.x[0],t.x[1]))/2),y:centerRange(e.range.y,e.sourceSize.height,(Math.min(t.y[0],t.y[1])+Math.max(t.y[0],t.y[1]))/2)}),calculateHeatmapOverviewSourceRangeCenteredRange=(e,t)=>calculateHeatmapOverviewContinuousSourceRangeCenteredRange(e,toHeatmapContinuousSourceRange(t)),calculateHeatmapOverviewDragRange=(e,t,r)=>{let n=resolveHeatmapOverviewSourcePoint(e,t),a=e.range.x[1]-e.range.x[0],i=e.range.y[1]-e.range.y[0],o=viewport_clamp(Math.round(n.x-r.x),0,e.sourceSize.width-a),l=viewport_clamp(Math.round(n.y-r.y),0,e.sourceSize.height-i);return{x:[o,o+a],y:[l,l+i]}},isHeatmapOverviewSourcePointInViewport=(e,t)=>t.x>=e.range.x[0]&&t.x<=e.range.x[1]&&t.y>=e.range.y[0]&&t.y<=e.range.y[1],calculateHeatmapDragRange=(e,t)=>{let r=e.range.x[1]-e.range.x[0],n=e.range.y[1]-e.range.y[0];return{x:translateRange(e.range.x,e.sourceSize.width,-Math.round(t.left*r)),y:translateRange(e.range.y,e.sourceSize.height,Math.round(t.top*n))}},calculateHeatmapDragRangeFromCoordinates=(e,t,r)=>calculateHeatmapDragRange(e,{left:(r.left-t.left)/100,top:(r.top-t.top)/100}),toWaterfallSamplingOptions=e=>({x:e.x,y:e.y,outputWidth:e.x[1]-e.x[0],outputHeight:e.y[1]-e.y[0]}),isHeatmapViewportRangeEqual=(e,t)=>e.range.x[0]===t.x[0]&&e.range.x[1]===t.x[1]&&e.range.y[0]===t.y[0]&&e.range.y[1]===t.y[1],resolveHeatmapSourceRowScreenRange=(e,t,r)=>{let[n,a]=e.range.y,i=a-n;if(i<=0||r<n||t>=a)return null;let o=viewport_clamp(t,n,a-1),l=100-(viewport_clamp(r,n,a-1)+1-n)*100/i;return{height:100-(o-n)*100/i-l,top:l}},clampPercent=e=>Math.max(0,Math.min(100,e)),cursorValue_normalizeRange=(e,t)=>({end:Math.max(e,t),start:Math.min(e,t)}),resolveHeatmapColumnCount=e=>e.reduce((e,t)=>Math.max(e,t?.length??0),0),resolveHeatmapGridInfo=e=>({columnCount:resolveHeatmapColumnCount(e),rowCount:e.length}),resolveHeatmapRowIndex=(e,t)=>t<=0?-1:1===t?0:Math.max(0,Math.min(t-1,Math.ceil((100-clampPercent(e))*t/100)-1)),resolveHeatmapColumnIndex=(e,t)=>t<=0?-1:1===t?0:Math.max(0,Math.min(t-1,Math.ceil(clampPercent(e)*t/100)-1)),resolveHeatmapRowRange=(e,t,r)=>{let n=resolveHeatmapRowIndex(e,r),a=resolveHeatmapRowIndex(t,r);if(n<0||a<0)return null;let{end:i,start:o}=cursorValue_normalizeRange(n,a);return{endIndex:i,startIndex:o}},resolveHeatmapColumnRange=(e,t,r)=>{let n=resolveHeatmapColumnIndex(e,r),a=resolveHeatmapColumnIndex(t,r);if(n<0||a<0)return null;let{end:i,start:o}=cursorValue_normalizeRange(n,a);return{endCol:i,startCol:o}},resolveHeatmapGridRange=(e,t)=>{let{columnCount:r,rowCount:n}=resolveHeatmapGridInfo(e);if(0===n||0===r)return null;let a=resolveHeatmapRowRange(t.startTop,t.endTop,n),i=resolveHeatmapColumnRange(t.startLeft,t.endLeft,r);return a&&i?{...a,...i}:null},resolveHeatmapRangeData=(e,t)=>{let{columnCount:r,rowCount:n}=resolveHeatmapGridInfo(e);if(0===n||0===r)return[];let a=Math.max(0,Math.min(n-1,t.startIndex)),i=Math.max(a,Math.min(n-1,t.endIndex)),o=Math.max(0,Math.min(r-1,t.startCol)),l=Math.max(o,Math.min(r-1,t.endCol));return e.slice(a,i+1).map(e=>{let t=[];for(let r=o;r<=l;r+=1){let n=e?.[r];t.push("number"==typeof n&&Number.isFinite(n)?n:0/0)}return t})},resolveHeatmapCursorValue=(e,t)=>{let{columnCount:r,rowCount:n}=resolveHeatmapGridInfo(e);if(0===n||0===r)return null;let a=resolveHeatmapRowIndex(t.top,n),i=resolveHeatmapColumnIndex(t.left,r);if(a<0||i<0)return null;let o=e[a],l=o?.[i],s="number"==typeof l&&Number.isFinite(l)?l:null;return{columnIndex:i,rowIndex:a,timestamp:o?.timestamp?String(o.timestamp):"",value:s}},resolveHeatmapCursorValueFromSnapshot=(e,t)=>{let r=resolveHeatmapSourcePoint(e,t);if(!r)return null;let n=e.data[r.visibleRowIndex],a=n?.[r.visibleColumnIndex],i="number"==typeof a&&Number.isFinite(a)?a:null;return{columnIndex:r.columnIndex,rowIndex:r.rowIndex,timestamp:n?.timestamp?String(n.timestamp):"",value:i}},resolveHeatmapGridRangeFromSnapshot=(e,t)=>resolveHeatmapSourceRange(e,t),resolveHeatmapRangeDataFromSnapshot=(e,t)=>resolveHeatmapSnapshotRangeData(e,t),getHeatmapWaterfallSnapshot=e=>{let t=withWaterfallAnalyzerSYNC(e)?.getSnapshot();return t?.sourceSize.width&&t.sourceSize.height?t:null},resetHeatmapViewport=e=>{let t=withWaterfallAnalyzerSYNC(e),r=t?.getSnapshot();if(!t||!r?.sourceSize.width||!r.sourceSize.height)return!1;let n={x:[0,r.sourceSize.width],y:[0,r.sourceSize.height]};return isHeatmapViewportRangeEqual(r,n)||t.updateSamplingRange(toWaterfallSamplingOptions(n)),!0},HeatmapCursorPopover=({id:e})=>{let t=useStore_useSelector(e=>e.axisX.frequencyFormat),r=useStore_useSelector(e=>e.axisX.unit??""),n=useStore_useSelector(e=>e.globalID),a=useStore_useSelector(e=>e.axisY.unit),i=useCursorSample(e),o=i?.coord.left,l=i?.coord.top,s=useCursorPopoverUpdateKey("HeatmapPopover",e),[c,u]=external_react_useState(""),[d,h]=external_react_useState(""),{getSeries:p}=useSeriesForComponent(n);external_react_useEffect(()=>{if(!n||"number"!=typeof o||"number"!=typeof l||!Number.isFinite(o)||!Number.isFinite(l)){u(""),h("");return}let e=withDatabase(n).getAllRawData(o).waterfallData;if(!e||0===e.length){u(""),h("");return}let t=getHeatmapWaterfallSnapshot(n),r=t?resolveHeatmapCursorValueFromSnapshot(t,{left:o,top:l}):resolveHeatmapCursorValue(e,{left:o,top:l});if(!r){u(""),h("");return}u(null!==r.value&&Number.isFinite(r.value)?r.value.toFixed(1):""),h(r.timestamp)},[n,o,l,i?.version,s]);let f=external_react_useMemo(()=>{if("number"!=typeof o)return"";let e=getHeatmapWaterfallSnapshot(n),r=e?resolveHeatmapSourceLeft(o,e):o;return t?.(r)??""},[n,o,t,i?.version,s]),m=external_react_useMemo(()=>p(REAL_DATA_NAME),[p]);return /*#__PURE__*/jsxs(components_Mask,{children:[/*#__PURE__*/jsx_runtime_jsx(FrequencyDisplay,{frequency:f,unit:r}),/*#__PURE__*/jsx_runtime_jsx("div",{className:POPOVER_ROW_CLASS,children:/*#__PURE__*/jsx_runtime_jsx("span",{children:d})}),c&&m&&!1!==m.display&&/*#__PURE__*/jsxs("div",{className:POPOVER_ROW_CLASS,style:{color:m.color},children:[/*#__PURE__*/jsx_runtime_jsx("span",{children:m.label}),/*#__PURE__*/jsxs("div",{children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:POPOVER_VALUE_CLASS,children:c}),/*#__PURE__*/jsx_runtime_jsx("span",{children:a})]})]})]})},CursorPopover=HeatmapCursorPopover,LevelCursorPopover=({id:e})=>{let t=useStore_useSelector(e=>e.globalID),r=useStore_useSelector(e=>e.axisY.unit),n=useCursorSample(e),a=n?.coord.left,i=useCursorPopoverUpdateKey("LevelStreamPopover",e),[o,l]=external_react_useState(""),[s,c]=external_react_useState("");return external_react_useEffect(()=>{if(!t||"number"!=typeof a||!Number.isFinite(a)){l(""),c("");return}let{levelStreamData:e}=withDatabase(t).getAllRawData();if(!e?.spectrumData||0===e.spectrumData.length){l(""),c("");return}let r=leftToIndex(a,e.spectrumData.length),n=e.spectrumData[r];if(l("number"==typeof n&&Number.isFinite(n)?n.toFixed(1):""),e.timestampData.length>r){let t=Number(e.timestampData[r]);if(Number.isFinite(t))return void c(formatTimestamp(t))}c("")},[t,a,n?.version,i]),/*#__PURE__*/jsxs(components_Mask,{children:[s&&/*#__PURE__*/jsx_runtime_jsx("div",{className:POPOVER_ROW_CLASS,children:/*#__PURE__*/jsx_runtime_jsx("span",{children:s})}),o&&/*#__PURE__*/jsxs("div",{className:POPOVER_ROW_CLASS,children:[/*#__PURE__*/jsx_runtime_jsx("span",{children:"电平值:"}),/*#__PURE__*/jsxs("div",{children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:POPOVER_VALUE_CLASS,children:o}),/*#__PURE__*/jsx_runtime_jsx("span",{children:r})]})]})]})},Level_CursorPopover=LevelCursorPopover,OccupancyCursorPopover=({id:e})=>{let t=useStore_useSelector(e=>e.axisX.frequencyFormat),r=useStore_useSelector(e=>e.axisX.unit??""),n=useStore_useSelector(e=>e.globalID),a=useCursorSample(e),i=a?.coord.left,o=external_react_useMemo(()=>{if(!n||"number"!=typeof i||!Number.isFinite(i))return"";let e=withDatabase(n).getAllRawData(i),{occupancyData:t}=e;if(t&&t.length>0){let r=e.cursorIndex?.globalIndex,n=e.rawData?.occupancyData,a="number"==typeof r&&Number.isFinite(r)&&n&&n.length>0?n[Math.max(0,Math.min(n.length-1,Math.floor(r)))]:void 0,o=t[leftToIndex(i,t.length)];return Number.parseFloat(Number(Number.isFinite(a)?a:o).toFixed(1))}return""},[n,i,a?.version]);return /*#__PURE__*/jsxs(components_Mask,{children:[/*#__PURE__*/jsx_runtime_jsx(FrequencyDisplay,{frequency:external_react_useMemo(()=>"number"==typeof i?t?.(i)??"":"",[i,t]),unit:r}),/*#__PURE__*/jsxs("div",{className:POPOVER_ROW_CLASS,children:[/*#__PURE__*/jsx_runtime_jsx("span",{children:"占用度"}),/*#__PURE__*/jsxs("div",{children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:POPOVER_VALUE_CLASS,children:o}),/*#__PURE__*/jsx_runtime_jsx("span",{children:"%"})]})]})]})},Occupancy_CursorPopover=OccupancyCursorPopover,SignalType={LEGITIMATE:"Legitimate",UNKNOWN:"UnKnown",KNOWN:"Know",VIOLATION:"Violation",ILLEGAL:"Illegal"},SIGNAL_TYPE_MAP={Legitimate:{name:"合法",color:"var(--success)",isLegitimate:!0},UnKnown:{name:"未知",color:"var(--muted-foreground)",isLegitimate:!1},Know:{name:"已知",color:"var(--primary)",isLegitimate:!0},Violation:{name:"违规",color:"var(--warning)",isLegitimate:!1},Illegal:{name:"非法",color:"var(--destructive)",isLegitimate:!1}},SIGNAL_TYPE_ORDER=[SignalType.LEGITIMATE,SignalType.UNKNOWN,SignalType.KNOWN,SignalType.VIOLATION,SignalType.ILLEGAL],normalizeSignalType=e=>"string"==typeof e&&SIGNAL_TYPE_ORDER.includes(e)?e:SignalType.UNKNOWN,signalTypeMap=null,SIGNAL_LEVEL_UNASSIGNED=-1,SIGNAL_LEVEL_FIRST=0,SIGNAL_LEVEL_SECOND=1,SIGNAL_LEVEL_THIRD=2,SIGNAL_LEVEL_ORDER=[SIGNAL_LEVEL_UNASSIGNED,SIGNAL_LEVEL_FIRST,SIGNAL_LEVEL_SECOND,SIGNAL_LEVEL_THIRD],SIGNAL_LEVEL_MAP={[SIGNAL_LEVEL_UNASSIGNED]:{name:"未分配",color:"color-mix(in oklab, var(--success) 35%, var(--background))"},[SIGNAL_LEVEL_FIRST]:{name:"一级",color:"color-mix(in oklab, var(--success) 55%, var(--background))"},[SIGNAL_LEVEL_SECOND]:{name:"二级",color:"color-mix(in oklab, var(--success) 75%, var(--background))"},[SIGNAL_LEVEL_THIRD]:{name:"三级",color:"var(--success)"}},normalizeSignalLevel=e=>"number"==typeof e&&Number.isInteger(e)&&(e===SIGNAL_LEVEL_UNASSIGNED||e===SIGNAL_LEVEL_FIRST||e===SIGNAL_LEVEL_SECOND||e===SIGNAL_LEVEL_THIRD)?e:SIGNAL_LEVEL_UNASSIGNED,resolveSignalColor=e=>{if(e.color)return e.color;let t=normalizeSignalType(e.signalType);return"simple"===e.source&&t===SignalType.LEGITIMATE?SIGNAL_LEVEL_MAP[normalizeSignalLevel(e.level)].color:SIGNAL_TYPE_MAP[t].color},SIGNAL_SOURCE_ORDER=["station","simple"],SIGNAL_SOURCE_LABEL={station:"台站库",simple:"信号库"};function tree_isStationInfo(e){return"signalName"in e&&"orgName"in e}let resolveSignalSource=e=>tree_isStationInfo(e)?"station":"simple",getSignalLeafKey=e=>`${resolveSignalSource(e)}:${normalizeSignalType(e.signalType)}:${normalizeSignalLevel(e.level)}`;function getUnifiedSignalKey(e){let t=resolveSignalSource(e);return e.id?`${t}:${e.id}`:tree_isStationInfo(e)?`${t}:${e.signalName}-${e.frequency}`:null!=e.startFrequency&&null!=e.stopFrequency?`${t}:${e.startFrequency}-${e.stopFrequency}`:`${t}:${e.frequency}-${e.bandwidth}`}let buildSignalTree=e=>{let t=new Set,r=new Map,n=new Map;for(let a of e){let e=getSignalLeafKey(a),i=resolveSignalSource(a);t.add(e),r.set(e,(r.get(e)??0)+1);let o=n.get(e)??new Set;o.add(resolveSignalColor({...a,source:i})),n.set(e,o)}let a=e=>e.reduce((e,t)=>e+(r.get(t)??0),0),i=e=>{let t=n.get(e);return t?.size===1?[...t][0]:void 0},o=e=>{let t=e.map(i);if(t.some(e=>null==e))return;let r=new Set(t);return 1===r.size?[...r][0]:void 0},l=[];for(let e of SIGNAL_SOURCE_ORDER){let n=[...t].filter(t=>t.startsWith(`${e}:`));if(0===n.length)continue;if("station"===e){l.push({source:e,label:SIGNAL_SOURCE_LABEL[e],leafKeys:n,dataLeafKeys:n,hasData:!0,count:a(n),types:[]});continue}let s=SIGNAL_TYPE_ORDER.flatMap(n=>{let l=SIGNAL_LEVEL_ORDER.map(a=>{let o=`${e}:${n}:${a}`;return{level:a,label:SIGNAL_LEVEL_MAP[a].name,leafKey:o,hasData:t.has(o),count:r.get(o)??0,color:i(o)}}),s=l.map(e=>e.leafKey),c=s.filter(e=>t.has(e));return 0===c.length?[]:{signalType:n,label:SIGNAL_TYPE_MAP[n].name,leafKeys:s,dataLeafKeys:c,hasData:c.length>0,count:a(c),color:o(c),levels:n===SignalType.LEGITIMATE?l.filter(e=>e.hasData):[]}});if(0===s.length)continue;let c=s.flatMap(e=>e.leafKeys),u=c.filter(e=>t.has(e));l.push({source:e,label:SIGNAL_SOURCE_LABEL[e],leafKeys:c,dataLeafKeys:u,hasData:!0,count:a(u),types:s})}return{sources:l}},resolveNodeCheckState=(e,t,r)=>{let n=r.filter(t=>e.has(t));if(0===n.length)return"disabled";let a=n.filter(e=>t.has(e)).length;return 0===a?"checked":a===n.length?"unchecked":"indeterminate"},toggleNodeHiddenKeys=(e,t,r)=>{let n=new Set(e),a=t.filter(e=>r.has(e)),i=a.filter(e=>n.has(e)).length;if(a.length>0&&0===i){for(let e of t)n.add(e);return[...n]}for(let e of t)n.delete(e);return[...n]},filterSignalItemsByHiddenKeys=(e,t)=>{if(!t.length)return e;let r=new Set(t);return e.filter(e=>!r.has(getSignalLeafKey(e)))},SIGNAL_INDEX_MATCH_TOLERANCE=1,getRangeCenter=e=>(e.startFreq+e.stopFreq)/2,getRangeWidth=e=>Math.abs(e.stopFreq-e.startFreq),getIndexDistanceToRange=(e,t,r)=>e<t?t-e:e>r?e-r:0,getFrequencyDistanceToRange=(e,t)=>isInRangeByFrequency(e,t)?0:Math.min(Math.abs(e-t.startFreq),Math.abs(e-t.stopFreq)),compareFrequencyMatchedCandidates=(e,t,r)=>{let n=getRangeWidth(t.range)-getRangeWidth(r.range);if(0!==n)return n;let a=Math.abs(getRangeCenter(t.range)-e)-Math.abs(getRangeCenter(r.range)-e);if(0!==a)return a;let i=Number(tree_isStationInfo(r.item))-Number(tree_isStationInfo(t.item));return 0!==i?i:getUnifiedSignalKey(t.item).localeCompare(getUnifiedSignalKey(r.item))},compareIndexMatchedCandidates=(e,t,r,n)=>{let a=getIndexDistanceToRange(t,r.startIndex,r.stopIndex)-getIndexDistanceToRange(t,n.startIndex,n.stopIndex);if(0!==a)return a;let i=getRangeWidth(r.range)-getRangeWidth(n.range);if(0!==i)return i;let o=getFrequencyDistanceToRange(e,r.range)-getFrequencyDistanceToRange(e,n.range);if(0!==o)return o;let l=Number(tree_isStationInfo(n.item))-Number(tree_isStationInfo(r.item));return 0!==l?l:getUnifiedSignalKey(r.item).localeCompare(getUnifiedSignalKey(n.item))};function toFrequencyRangeInput(e){return{frequency:null!=e.frequency?Number(e.frequency):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}}function match_resolveBestSignalMatch(e,t){let{currentFrequency:r,currentPointIndex:n}=t,a=t.indexTolerance??SIGNAL_INDEX_MATCH_TOLERANCE;if(!Number.isFinite(r)||!Number.isFinite(n)||!e.length)return;let i=e.filter(({range:e})=>isInRangeByFrequency(r,e)).sort((e,t)=>compareFrequencyMatchedCandidates(r,e,t));return i.length>0?i[0]:e.filter(({startIndex:e,stopIndex:t})=>isInRangeByIndex(n,{startIndex:e,stopIndex:t},a)).sort((e,t)=>compareIndexMatchedCandidates(r,n,e,t))[0]}let resolveFrequencyPresentation=e=>null!=e.frequency?`${e.frequency}MHz`:null!=e.startFrequency&&null!=e.stopFrequency?`${e.startFrequency}-${e.stopFrequency}MHz`:void 0,resolveSignalPresentation=e=>{let t=resolveSignalSource(e),r=normalizeSignalType(e.signalType),n=SIGNAL_TYPE_MAP[r].name,a=SIGNAL_LEVEL_MAP[normalizeSignalLevel(e.level)].name,i=resolveSignalColor({...e,source:t}),o=resolveFrequencyPresentation(e),l=null!=e.bandwidth?`带宽: ${e.bandwidth}kHz`:void 0,s=tree_isStationInfo(e)?{name:e.signalName,organization:e.orgName,modulation:e.modulation}:e.details;return tree_isStationInfo(e)?{color:i,tooltip:[e.signalName,o,e.orgName&&`单位: ${e.orgName}`,n&&`类型: ${n}`].filter(Boolean).join(" | ")}:{color:i,tooltip:[s?.name,SIGNAL_SOURCE_LABEL[t],o,s?.organization&&`单位: ${s.organization}`,l,s?.modulation&&`调制: ${s.modulation}`,n&&`类型: ${n}`,r===SignalType.LEGITIMATE&&a&&`等级: ${a}`].filter(Boolean).join(" | ")}},resolveSignalMatchCandidates=(e,t)=>e.flatMap(e=>{let r=frequencyCalculation_calculateFrequencyRange(toFrequencyRangeInput(e));if(!r||!isRangeIntersectSegment(r,t))return[];let{startIndex:n,stopIndex:a}=calculatePositionFromFrequencyRange(r,t);return[{item:e,range:r,startIndex:n,stopIndex:a}]}),resolveSignalPositions=(e,t)=>resolveSignalMatchCandidates(e,t).map(({item:e,range:r,startIndex:n,stopIndex:a})=>{let{left:i,width:o}=calculatePositionFromFrequencyRange(r,t),{color:l,tooltip:s}=resolveSignalPresentation(e);return{item:e,range:r,startIndex:n,stopIndex:a,key:getUnifiedSignalKey(e),position:{left:`${i}%`,width:`${o}%`},color:l,tooltip:s}}),resolveSignalSegments=({segments:e,signalItems:t,isCursorActive:r,currentFrequency:n,currentPosition:a})=>{if(!e.length)return[];let i=e.reduce((e,t)=>e+t.point,0);return e.map((o,l)=>{let s=resolveSignalPositions(t,o),c=r&&a.segmentIndex===l&&Number.isFinite(n)?resolveBestSignalMatch(s,{currentFrequency:n,currentPointIndex:a.pointIndex}):void 0,u=o.point/i*100,d=e.slice(0,l).reduce((e,t)=>e+t.point/i*100,0);return{segment:o,segmentIndex:l,signalPositions:s,activeSignalKey:c?.key,style:{left:`${d}%`,width:`${u}%`}}})},resolveStaticSignalSegments=({segments:e,signalItems:t})=>{if(!e.length)return[];let r=e.reduce((e,t)=>e+t.point,0),n=0;return e.map((e,a)=>{let i=e.point/r*100,o={segment:e,segmentIndex:a,signalPositions:resolveSignalPositions(t,e),style:{left:`${n}%`,width:`${i}%`}};return n+=i,o})},resolveActiveSignalKey=({segmentData:e,isCursorActive:t,currentFrequency:r,currentPosition:n})=>{if(!t||!Number.isFinite(r)||n.segmentIndex<0)return;let a=e[n.segmentIndex];if(a)return match_resolveBestSignalMatch(a.signalPositions,{currentFrequency:r,currentPointIndex:n.pointIndex})?.key},findStationAtCursor=({frequency:e,signalItems:t,segments:r,currentPosition:n})=>{if(!Number.isFinite(e))return;let a=r[n.segmentIndex];if(!a)return;let i=t.filter(isStationInfo);if(!i.length)return;let o=resolveBestSignalMatch(resolveSignalMatchCandidates(i,a),{currentFrequency:e,currentPointIndex:n.pointIndex});return o&&isStationInfo(o.item)?o.item:void 0},findSignalAtCursor=({frequency:e,signalItems:t,segments:r,currentPosition:n})=>{if(!Number.isFinite(e))return;let a=r[n.segmentIndex];if(a)return resolveBestSignalMatch(resolveSignalMatchCandidates(t,a),{currentFrequency:e,currentPointIndex:n.pointIndex})?.item},createSignalRangeIndex=({signalItems:e,segments:t})=>e.length&&t.length?t.map(t=>resolveSignalMatchCandidates(e,t)):[],createStationRangeIndex=({signalItems:e,segments:t})=>{if(!e.length||!t.length)return[];let r=e.filter(isStationInfo);return r.length?t.map(e=>resolveSignalMatchCandidates(r,e)):[]},findStationInRangeIndex=({frequency:e,stationRangeIndex:t,currentPosition:r})=>{if(!Number.isFinite(e))return;let n=t[r.segmentIndex];if(!n?.length)return;let a=resolveBestSignalMatch(n,{currentFrequency:e,currentPointIndex:r.pointIndex});return a&&isStationInfo(a.item)?a.item:void 0},findSignalInRangeIndex=({frequency:e,signalRangeIndex:t,currentPosition:r})=>{if(!Number.isFinite(e))return;let n=t[r.segmentIndex];if(n?.length)return match_resolveBestSignalMatch(n,{currentFrequency:e,currentPointIndex:r.pointIndex})?.item},withStationDataUpdate=(e,t,r)=>{let n=`stationData-update-${e}`;return t&&r?subscription_createSubscriptionManager(n,t,r,e):subscription_createSubscriptionManager(n)},STATION_DATA=(e,t)=>{let r=subscription_openData(`stationData-${e}`,t,[],e);return void 0!==t&&withStationDataUpdate(e)(r),r};function useUnifiedSignals({respectVisibility:e=!1,filterHidden:t=!0}={}){let r=useStore_useSelector(e=>e.globalID),n=useStore_useSelector(e=>e.signal.data),a=useStore_useSelector(e=>e.signal.display),i=useStore_useSelector(e=>e.signal.show),o=useStore_useSelector(e=>e.signal.hiddenCategoryKeys),[l,s]=external_react_useState(0);return external_react_useEffect(()=>{let e=`useUnifiedSignals-${r}-${Date.now()}`,t=withStationDataUpdate(r,e,()=>{s(e=>e+1)}),n=STATION_DATA(r);return n&&n.length>0&&s(e=>e+1),()=>{"function"==typeof t&&t()}},[r]),external_react_useMemo(()=>{if(e&&(!i||!a))return[];let l=[...STATION_DATA(r),...n||[]];return t&&o?.length?filterSignalItemsByHiddenKeys(l,o):l},[r,n,a,i,e,t,o,l])}let useSignalMatchAtCursor=({frequency:e,enabled:t=!0,cursorSample:r},n)=>{let a=useStore_useSelector(e=>e.cursor),i=useStore_useSelector(e=>e.segments),o=r?.coord.left??a.coord.left,l=useUnifiedSignals({respectVisibility:t}),s=external_react_useMemo(()=>t?"station"===n?l.filter(tree_isStationInfo):l:[],[t,l,n]),c=external_react_useMemo(()=>createSignalRangeIndex({signalItems:s,segments:i}),[s,i]),u=external_react_useMemo(()=>t&&(!!r||cursor_hasActiveSpectrumCursor(a)),[a,r,t]),d=external_react_useMemo(()=>u&&"number"==typeof o?frequencyCalculation_calculateCursorPosition(o,i):{segmentIndex:-1,pointIndex:-1},[u,o,i]);return external_react_useMemo(()=>{if(!t||"number"!=typeof o||!Number.isFinite(o)||o<0||!c.length||!i?.length||!u)return;let r=frequencyCalculation_getCursorFrequencyAtPosition(i,d);if(!Number.isFinite(r)){let t=Number(e);if(!Number.isFinite(t))return;return findSignalInRangeIndex({frequency:t,signalRangeIndex:c,currentPosition:d})}return findSignalInRangeIndex({frequency:r,signalRangeIndex:c,currentPosition:d})},[t,e,c,i,d,o,u])};function useSignalInfoAtCursor(e){return useSignalMatchAtCursor(e,"all")}function useStationInfoAtCursor(e){let t=useSignalMatchAtCursor(e,"station");return t&&isStationInfo(t)?t:void 0}let useSignalFinder=null,useStationFinder=null,SignalInfoRow=({label:e,value:t,tabular:r=!1})=>/*#__PURE__*/jsxs("div",{className:`flex gap-2${r?" tabular-nums":""}`,children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:"w-10 shrink-0 text-muted-foreground",children:e}),/*#__PURE__*/jsx_runtime_jsx("span",{className:"min-w-0 break-words",children:t})]}),SignalMetaValue=({color:e,label:t,testId:r})=>/*#__PURE__*/jsx_runtime_jsx("span",{className:"font-medium text-foreground","data-testid":r,style:e?{color:toOpaqueCssColor(e)}:void 0,children:t}),SignalInfoPanel=({signalInfo:e})=>{if(!e)return null;let t=resolveSignalSource(e),r=tree_isStationInfo(e)?{name:e.signalName,organization:e.orgName,modulation:e.modulation,remark:e.remark}:e.details,n=normalizeSignalType(e.signalType),a=SIGNAL_TYPE_MAP[n],i=SIGNAL_LEVEL_MAP[normalizeSignalLevel(e.level)],o="simple"===t&&n===SignalType.LEGITIMATE,l=resolveSignalColor({...e,source:t}),s=o?void 0:l,c=null!=e.startFrequency&&null!=e.stopFrequency;return /*#__PURE__*/jsx_runtime_jsx("div",{className:"mt-2 border-t border-border/60 pt-2 text-xs leading-5 text-foreground","data-signal-source":t,"data-testid":"signal-info-panel",children:/*#__PURE__*/jsxs("div",{className:"space-y-0.5",children:[/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"来源",value:SIGNAL_SOURCE_LABEL[t]}),r?.name?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"名称",value:r.name}):null,r?.organization?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"单位",value:r.organization}):null,null!=e.frequency?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"频率",value:`${e.frequency}MHz`,tabular:!0}):c?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"范围",value:`${e.startFrequency}-${e.stopFrequency}MHz`,tabular:!0}):null,null!=e.bandwidth?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"带宽",value:`${e.bandwidth}kHz`,tabular:!0}):null,r?.modulation?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"调制",value:r.modulation}):null,/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"类型",value:/*#__PURE__*/jsx_runtime_jsx(SignalMetaValue,{color:s,label:a.name,testId:"signal-info-type-color"})}),o?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"等级",value:/*#__PURE__*/jsx_runtime_jsx(SignalMetaValue,{color:l,label:i.name,testId:"signal-info-level-color"})}):null,r?.remark?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"备注",value:r.remark}):null]})})},StationInfoPanel=/*#__PURE__*/react.memo(SignalInfoPanel),FrequencyDataBoard=({left:e,updateKey:t,onChange:r,showSignalInfo:n=!0,cursorSample:a})=>{let i=useStore_useSelector(e=>e.axisY.unit),o=useStore_useSelector(e=>e.axisX.frequencyFormat),l=useStore_useSelector(e=>e.axisX.unit),s=useStore_useSelector(e=>e.globalID),c=external_react_useRef(null),u=useFilteredSeries(s,external_react_useCallback(e=>!1!==e.display,[])),d=external_react_useCallback((e,t,r,n)=>{if(!e||0===e.length)return null;let a=Math.max(0,Math.min(e.length-1,Math.floor(r))),o=Number.isFinite(n)?n:e[a];if("number"!=typeof o)return null;let l=i??"",s=getVirtualLevel(l,o)?.toFixed(1);return(0,array_0.Ub)(s)?/*#__PURE__*/jsxs("div",{className:"grid max-w-[220px] grid-cols-[minmax(0,1fr)_auto] items-center gap-x-1 text-xs",style:{color:t?.color},children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:"min-w-0 truncate",children:t?.label||t.name}),/*#__PURE__*/jsxs("div",{className:"text-right",children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:"inline-flex min-w-9 justify-end",children:s}),/*#__PURE__*/jsx_runtime_jsx("span",{children:l})]})]},t.name):null},[i]),{value:h,currentIndex:p}=external_react_useMemo(()=>{if(!s)return{value:null,currentIndex:0/0};let r=withDatabase(s);if(!r)return{value:null,currentIndex:0/0};let n=a?.version,i=c.current,o=i&&i.globalID===s&&i.left===e&&i.sampleVersion===n&&i.updateKey===t?i.snapshot:r.getAllRawData(e);c.current={globalID:s,left:e,sampleVersion:n,updateKey:t,snapshot:o};let l=o.cursorIndex?.globalIndex,h=o.cursorIndex?.sampledIndex,p={realData:o.realData,maxData:o.maxData,minData:o.minData,avgData:o.avgData,thresholdData:o.thresholdData,templateData:o.templateData,occupancyData:o.occupancyData,backgroundNoiseData:o.backgroundNoiseData,...o.extraData},f={realData:o.rawData?.realData,maxData:o.rawData?.maxData,minData:o.rawData?.minData,avgData:o.rawData?.avgData,thresholdData:o.rawData?.thresholdData,templateData:o.rawData?.templateData,occupancyData:o.rawData?.occupancyData,backgroundNoiseData:o.rawData?.backgroundNoiseData,...o.rawData?.extraData},m=Object.values(p).find(e=>!!e&&e.length>0),g=m?.length??0;if(g<=0)return{value:null,currentIndex:0/0};let b="number"==typeof h&&Number.isFinite(h)?Math.max(0,Math.min(g-1,Math.floor(h))):leftToIndex(e,g),v=Number.isFinite(o.cursorIndex?.globalIndex)?Math.floor(o.cursorIndex?.globalIndex??0):void 0,w=o.rawData?.realData,y=void 0!==v&&w&&w.length>0&&v>=0&&v<w.length?w[v]:void 0;return{value:u.map(e=>{let t=p[e.name];if(!t||0===t.length)return null;let r="realData"===e.name?y:(e=>{if("number"!=typeof l||!Number.isFinite(l))return;let t=f[e];if(!t||0===t.length)return;let r=Math.max(0,Math.min(t.length-1,Math.floor(l)));return t[r]})(e.name);return d(t,e,b,r)}).filter(e=>null!==e),currentIndex:b}},[d,s,u,t,e,a?.version]),f=external_react_useMemo(()=>o?.(e)??"",[e,o]);external_react_useEffect(()=>{r?.({index:p,frequency:f})},[p,f,r]);let m=useSignalInfoAtCursor({frequency:f,enabled:n,cursorSample:a}),g=n&&!!m,b=external_react_useMemo(()=>h&&(!Array.isArray(h)||h.length>0),[h]);return!(e<0)&&(b||g)?/*#__PURE__*/jsxs(components_Mask,{children:[f&&/*#__PURE__*/jsxs("div",{className:"text-[14px] font-medium text-popover-foreground",children:[f,l]}),h?/*#__PURE__*/jsx_runtime_jsx("div",{className:"mt-2 space-y-1",children:h}):null,n?/*#__PURE__*/jsx_runtime_jsx(StationInfoPanel,{signalInfo:m}):null]}):null},Spectrum_FrequencyDataBoard=/*#__PURE__*/react.memo(FrequencyDataBoard),SpectrumCursorPopover=({id:e})=>{let t=useStore_useSelector(e=>e.signal.show),r=useStore_useSelector(e=>e.signal.display),n=useCursorSample(e),a=n?.coord.left;return /*#__PURE__*/jsx_runtime_jsx(Spectrum_FrequencyDataBoard,{left:"number"==typeof a?a:-1,updateKey:useCursorPopoverUpdateKey("SpectrumPopover",e),showSignalInfo:t&&r,cursorSample:n})},Spectrum_CursorPopover=SpectrumCursorPopover,resolveCursorPopover=({id:e,mode:t,type:r})=>t===constants_ModuleType.LevelStream?/*#__PURE__*/jsx_runtime_jsx(Level_CursorPopover,{id:e}):r===constants_ModuleType.Spectrum?/*#__PURE__*/jsx_runtime_jsx(Spectrum_CursorPopover,{id:e}):r===constants_ModuleType.Heatmap?/*#__PURE__*/jsx_runtime_jsx(CursorPopover,{id:e}):r===constants_ModuleType.Occupancy?/*#__PURE__*/jsx_runtime_jsx(Occupancy_CursorPopover,{id:e}):null,Cursor_COMPONENT_KEY="Cursor",CURSOR_BOUNDS_TOLERANCE=1,Cursor_isPointWithinBounds=(e,t,r,n=CURSOR_BOUNDS_TOLERANCE)=>e>=r.left-n&&e<=r.right+n&&t>=r.top-n&&t<=r.bottom+n,buildCursorPointerSnapshot=(e,t,r,n,a)=>{let i=e.currentTarget;if(!(i instanceof HTMLElement))return null;let o=a??resolveCursorVisibleBounds(i);return{sourceId:r,sourceType:n,clientX:e.clientX,clientY:e.clientY,coord:t,bounds:o}},resolveCursorTarget=e=>{let t=e.currentTarget;return t instanceof HTMLElement?t:null},isSameCursorPayload=(e,t,r)=>{let n=e.event;return e.coord.left===t.left&&e.coord.top===t.top&&n?.sourceId===r?.sourceId&&n?.sourceType===r?.sourceType&&n?.clientX===r?.clientX&&n?.clientY===r?.clientY&&n?.bounds.left===r?.bounds.left&&n?.bounds.top===r?.bounds.top&&n?.bounds.right===r?.bounds.right&&n?.bounds.bottom===r?.bounds.bottom},Cursor=({id:e,type:t})=>{let{state:{cursor:r,globalID:n},dispatch:a}=useStore_useStore(),{active:i,show:o,mode:l}=r,[s,c]=external_react_useState(!1),u=external_react_useRef(r),d=external_react_useRef(i),h=external_react_useRef(s),p=external_react_useRef(null),f=external_react_useRef(null),m=external_react_useRef(null),g=external_react_useRef(null);external_react_useEffect(()=>{u.current=r,d.current=i,h.current=s},[r,i,s]);let b=external_react_useMemo(()=>(t="leave")=>{c(!1);let r=interactionRuntime.getPointer(e);if(u.current.event?.sourceId!==e&&r?.sourceId!==e){h.current=!1,p.current=null,f.current=null,interactionRuntime.clearPointer(e,t);return}let n={...u.current,event:null,coord:{left:0,top:0}};u.current=n,h.current=!1,p.current=null,f.current=null,interactionRuntime.clearPointer(e,t),flushSync(()=>{c(!1),a({payload:{cursor:n}})})},[a,e]);external_react_useEffect(()=>{o||(c(!1),h.current=!1,p.current=null,f.current=null,interactionRuntime.clearPointer(e,"manual"))},[e,o]),external_react_useEffect(()=>()=>{interactionRuntime.dispose(e)},[e]),external_react_useEffect(()=>{if(n&&o)return interactionRuntime.subscribeSample(e,t=>{if(!t||t.sourceId!==e)return;let r=toCursorSnapshotEvent(t);if(isSameCursorPayload(u.current,t.coord,r))return;let i={...u.current,event:r,coord:t.coord};u.current=i,a({payload:{cursor:i}}),d.current&&CURSOR_SETACTIVE(n)()})},[a,n,e,o]),external_react_useEffect(()=>{if(o&&i)return interactionRuntime.subscribePointer(e,t=>{let r=m.current,n=g.current;if(!t||t.sourceId!==e){r&&(r.style.left="-200%"),n&&(n.style.top="-200%");return}r&&(r.style.left=`${t.coord.left}%`),n&&(n.style.top=`${t.coord.top}%`)})},[i,e,o]),external_react_useEffect(()=>{if(!n||!o)return;let r=createMouseEnterEventManager(e,Cursor_COMPONENT_KEY,()=>{h.current=!0,c(!0)}),a=createMoveEventManager(e,Cursor_COMPONENT_KEY,(r,n)=>{if(!h.current)return;let a=resolveCursorTarget(r);if(!a)return;if(f.current!==a||!p.current){let t=resolveCursorVisibleBounds(a);f.current=a,p.current=t,interactionRuntime.refreshBounds(e,t)}let i=buildCursorPointerSnapshot(r,n,e,t,p.current);if(i){if(!Cursor_isPointWithinBounds(i.clientX,i.clientY,i.bounds))return void b("bounds");interactionRuntime.updatePointer(e,i)}}),i=createMouseLeaveEventManager(e,Cursor_COMPONENT_KEY,b);return()=>{r?.(),a?.(),i?.()}},[e,n,o,t,b]),external_react_useEffect(()=>{if(!o)return;let t=()=>{let t=f.current;if(!t)return;let r=resolveCursorVisibleBounds(t);p.current=r,interactionRuntime.refreshBounds(e,r)};return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[e,o]),external_react_useEffect(()=>{if(!o)return;let t=t=>{if(!h.current)return;let r=interactionRuntime.getPointer(e),n=r?.bounds??u.current.event?.bounds;r&&r.sourceId===e&&n&&(n.width<=0||n.height<=0||!Cursor_isPointWithinBounds(t.clientX,t.clientY,n))&&b("bounds")};return window.addEventListener("pointermove",t,!0),()=>{window.removeEventListener("pointermove",t,!0)}},[o,e,b]),external_react_useEffect(()=>{if(!o)return;let e=()=>{b("blur")},t=()=>{"hidden"===document.visibilityState&&b("visibility")},r=e=>{null===e.relatedTarget&&b("mouseout")};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",t),document.addEventListener("mouseout",r),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",t),document.removeEventListener("mouseout",r)}},[b,o]);let v=external_react_useMemo(()=>resolveCursorPopover({id:e,mode:l,type:t}),[e,l,t]);return o&&s&&i?/*#__PURE__*/jsxs(Zoom_ZoomViewportLayer,{className:"z-[6]",children:[/*#__PURE__*/jsx_runtime_jsx("div",{ref:m,className:"pointer-events-none absolute left-[-200%] top-0 h-full border-l border-dashed border-chart-highlight/80 opacity-50"}),t===constants_ModuleType.Heatmap&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:g,className:"absolute left-0 top-[-200%] w-full border-t border-dashed border-chart-highlight/80 opacity-50"}),v&&/*#__PURE__*/jsx_runtime_jsx(Overlay_Popover,{id:e,children:v},`${l??t}-${e}`)]}):null},components_Cursor=Cursor,useEventBusCallback_COMPONENT_KEY=constants_ToolType.EventBus;function useEventBusCallback(e){let{state:{segments:t,axisX:{frequencyFormat:r},eventBus:{onDoubleClick:n}}}=useStore_useStore();external_react_useEffect(()=>{let t=createDoubleClickEventManager(e,useEventBusCallback_COMPONENT_KEY,(t,a)=>{if(!compareEventPriority(e,useEventBusCallback_COMPONENT_KEY))return!1;let{left:i}=a;return n(r?.(i)??"",a),!0}),a=createMouseUpEventManager(e,useEventBusCallback_COMPONENT_KEY,()=>{resetEventLevel(e,useEventBusCallback_COMPONENT_KEY)}),i=createMouseLeaveEventManager(e,useEventBusCallback_COMPONENT_KEY,()=>{resetEventLevel(e,useEventBusCallback_COMPONENT_KEY)});return()=>{t?.(),a?.(),i?.()}},[e,t,r,n])}let EventBus=({id:e})=>{let t=useStore_useSelector(e=>e.globalID),r=external_react_useMemo(()=>getEID(e),[e]),[n,a]=external_react_useState(),i=external_react_useRef(null),o=external_react_useRef({isDragging:!1,startPoint:{x:0,y:0,event:null},lastPoint:{x:0,y:0}}),l=external_react_useRef({timerId:null,startPoint:null,fired:!1});useEventBusCallback(e),useKeyEvent(t,r);let s=external_react_useCallback(()=>{a(getEventCursor(e))},[e]),c=external_react_useCallback(()=>{o.current.isDragging=!1,o.current.startPoint.event=null,l.current.timerId&&window.clearTimeout(l.current.timerId),l.current.timerId=null,l.current.startPoint=null,l.current.fired=!1},[]);external_react_useEffect(()=>createMouseUpEventManager(e,"EventBusInteraction",c),[e,c]);let u=external_react_useCallback(e=>{e.preventDefault()},[]),d=external_react_useCallback(e=>{if(!e.defaultPrevented&&(createMouseDownEventManager(r)(calculateEventRelativePosition(e)),i.current?.focus?.(),o.current={isDragging:!0,startPoint:{x:e.clientX,y:e.clientY,event:e},lastPoint:{x:e.clientX,y:e.clientY}},0===e.button)){l.current.timerId&&window.clearTimeout(l.current.timerId),l.current.startPoint={x:e.clientX,y:e.clientY},l.current.fired=!1;let t=window.setTimeout(()=>{o.current.isDragging&&!l.current.fired&&(l.current.fired=!0,createLongPressEventManager(r)(e,calculateEventRelativePosition(e)))},500);l.current.timerId=t}},[r,e,c]),h=external_react_useCallback(throttleRequestAnimationFrame(e=>{if(!e.currentTarget)return;createMoveEventManager(r)(e,calculateEventRelativePosition(e)),s();let t=l.current.startPoint;if(t&&l.current.timerId&&!l.current.fired){let r=e.clientX-t.x,n=e.clientY-t.y;r*r+n*n>25&&(window.clearTimeout(l.current.timerId),l.current.timerId=null)}if(o.current.isDragging&&o.current.startPoint.event){let{height:t,width:n}=e.currentTarget.getBoundingClientRect(),a=o.current.startPoint.event,i=(e.clientX-o.current.lastPoint.x)/n,l=(e.clientY-o.current.lastPoint.y)/t;createDragEventManager(r)(calculateEventRelativePosition(a),calculateEventRelativePosition(e),{left:i,top:l},2===e.buttons),o.current.lastPoint={x:e.clientX,y:e.clientY}}}),[r,e,c,s]),p=external_react_useCallback(()=>{createMouseUpEventManager(r)(),o.current.isDragging=!1,o.current.startPoint.event=null,l.current.timerId&&window.clearTimeout(l.current.timerId),l.current.timerId=null,l.current.startPoint=null,l.current.fired=!1},[r]),f=external_react_useCallback(()=>{createMouseLeaveEventManager(r)(),c()},[r,c]),m=external_react_useCallback(()=>{createMouseEnterEventManager(r)()},[r]),g=external_react_useCallback(e=>{createDoubleClickEventManager(r)(e,calculateEventRelativePosition(e))},[r]),b=external_react_useCallback(throttle(e=>{createWheelEventManager(r)(-1*e.deltaY,calculateEventRelativePosition(e))}),[r]);return external_react_useEffect(()=>{i.current&&(i.current.id=r)},[r]),external_react_useEffect(()=>{let e=()=>{f()},t=()=>{"hidden"===document.visibilityState&&f()},r=e=>{null===e.relatedTarget&&f()};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",t),document.addEventListener("mouseout",r),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",t),document.removeEventListener("mouseout",r)}},[f]),/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[5] pointer-events-auto",children:/*#__PURE__*/jsx_runtime_jsx("button",{ref:i,type:"button",className:cn_cn("absolute right-0 top-0 h-full w-full appearance-none border-0 bg-transparent p-0 outline-none"),style:{cursor:n},"aria-label":"Event bus",onContextMenu:u,onMouseDown:d,onMouseMove:h,onMouseUp:p,onBlur:f,onFocus:m,onMouseLeave:f,onMouseOver:m,onDoubleClick:g,onWheel:b})})},components_EventBus=EventBus,Boundary=()=>{let{state:{gridLines:e}}=useStore_useStore();return e&&/*#__PURE__*/jsx_runtime_jsx("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"})},GridLines_Boundary=Boundary,PluginBox=e=>{let{children:t,onWheelCapture:r}=e,{pluginBoxWidth:n}=useAxisYWidth_useAxisYWidth();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 m-0 h-full overflow-hidden p-0",style:{width:n},onWheelCapture:r,children:t})},components_PluginBox=/*#__PURE__*/react.memo(PluginBox),PRECISION=1e4,defaultAreaInfoResult={startIndex:0,endIndex:0,startCol:0,endCol:0,startTimestamp:"",endTimestamp:"",startFrequency:0,startFrequencyFormat:"",endFrequency:0,endFrequencyFormat:"",bandwidth:0,bandwidthFormat:"",data:[]};function calculateAreaInfo({endLeft:e,startLeft:t,startTop:r,endTop:n,frequencyFormat:a,globalID:i}){let{waterfallData:o}=withDatabase(i).getAllRawData();if(!o?.length)return defaultAreaInfoResult;let l=getHeatmapWaterfallSnapshot(i),s={endLeft:e,endTop:n,startLeft:t,startTop:r},c=l?resolveHeatmapGridRangeFromSnapshot(l,s):resolveHeatmapGridRange(o,s);if(!c)return defaultAreaInfoResult;let u=l?resolveHeatmapSourceLeft(Math.min(t,e),l):Math.min(t,e),d=l?resolveHeatmapSourceLeft(Math.max(t,e),l):Math.max(t,e),h={start:Math.round(Number(a(u))*PRECISION)/PRECISION,end:Math.round(Number(a(d))*PRECISION)/PRECISION},p=Math.abs(h.end-h.start),f=l?.rawData??o,m=f[c.startIndex]?.timestamp||"",g=f[c.endIndex]?.timestamp||"";return{startIndex:c.startIndex,endIndex:c.endIndex,startCol:c.startCol,endCol:c.endCol,startTimestamp:m,endTimestamp:g,startFrequency:h.start,startFrequencyFormat:String(h.start),endFrequency:h.end,endFrequencyFormat:String(h.end),bandwidth:p,bandwidthFormat:getFrequencyToFixed(p),data:l?resolveHeatmapRangeDataFromSnapshot(l,c):resolveHeatmapRangeData(o,c)}}let heatmapCaptureUpdate=(e,t)=>subscription_createSubscriptionManager(`heatmapCaptureUpdate-${e}`,"0",t,e),getHeatmapCaptureSelectionKey=e=>`heatmapCaptureSelection-${e}`,getHeatmapCaptureSelectionSubscriptionKey=e=>`${getHeatmapCaptureSelectionKey(e)}-update`,isSelectionEqual=(e,t)=>e===t||null!==e&&null!==t&&1e-7>=Math.abs(e.x[0]-t.x[0])&&1e-7>=Math.abs(e.x[1]-t.x[1])&&1e-7>=Math.abs(e.y[0]-t.y[0])&&1e-7>=Math.abs(e.y[1]-t.y[1]),getHeatmapCaptureSelection=e=>subscription_openData(getHeatmapCaptureSelectionKey(e),void 0,null,e),setHeatmapCaptureSelection=(e,t)=>{!e||isSelectionEqual(getHeatmapCaptureSelection(e),t)||(subscription_openData(getHeatmapCaptureSelectionKey(e),t,null,e),subscription_createSubscriptionManager(getHeatmapCaptureSelectionSubscriptionKey(e))(t))},subscribeHeatmapCaptureSelection=(e,t)=>subscription_createSubscriptionManager(getHeatmapCaptureSelectionSubscriptionKey(e),"HeatmapOverview",t,e),Area_COMPONENT_KEY=constants_ToolType.HeatmapCapture,Area=e=>{let{state:{heatmapCapture:t,axisX:{frequencyFormat:r,unit:n},system:a,globalID:i}}=useStore_useStore(),{id:o}=e,{type:l,show:s,display:c,onChange:u}=t,d=external_react_useMemo(()=>l===heatmap_HeatmapCaptureType.Area&&s&&c,[l,s,c]),[h,p]=external_react_useState(defaultAreaInfoResult),[f,m]=external_react_useState();return(external_react_useEffect(()=>{if(d){let e=createMouseUpEventManager(o,Area_COMPONENT_KEY,()=>{u(h)}),t=createMouseLeaveEventManager(o,Area_COMPONENT_KEY,()=>{u(h)}),n=createDragEventManager(o,Area_COMPONENT_KEY,(e,t)=>{if(compareEventPriority(o,Area_COMPONENT_KEY)&&e&&t){let{left:n,top:o}=e,{left:l,top:s}=t;if(void 0===n||void 0===o||void 0===l||void 0===s)return;let c=l-n,u=s-o,d=Math.abs(c),h=Math.abs(u);d*a.width/100<=10||h*a.height/100<=10||(m({width:d,height:h,left:c>0?n:l,top:u>0?o:s,endLeft:l,startLeft:n}),p(calculateAreaInfo({startTop:o,endTop:s,endLeft:l,startLeft:n,frequencyFormat:r,globalID:i})))}});return()=>{e?.(),t?.(),n?.()}}},[o,d,h,r,i,u]),external_react_useEffect(()=>{d||(resetEventLevel(o,Area_COMPONENT_KEY),p(defaultAreaInfoResult),u(defaultAreaInfoResult))},[d]),d&&h?.bandwidth!==0)?/*#__PURE__*/jsxs("div",{className:"pointer-events-none absolute inset-0 left-0 top-0 z-[6] h-full w-full overflow-hidden",children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute bottom-5 right-5 h-auto w-auto",children:/*#__PURE__*/jsx_runtime_jsx(components_Mask,{className:"p-1 text-xs text-popover-foreground",children:/*#__PURE__*/jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-[6px] gap-y-0.5",children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"起始频率"}),/*#__PURE__*/jsxs("div",{children:[h?.startFrequencyFormat,n]}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"结束频率"}),/*#__PURE__*/jsxs("div",{children:[h?.endFrequencyFormat,n]}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"带宽"}),/*#__PURE__*/jsx_runtime_jsx("div",{children:formatFrequencyUnitFromMHz(h.bandwidth).formatted}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"起始时间"}),/*#__PURE__*/jsx_runtime_jsx("div",{children:h?.startTimestamp}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"结束时间"}),/*#__PURE__*/jsx_runtime_jsx("div",{children:h?.endTimestamp})]})})}),/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:/*#__PURE__*/jsx_runtime_jsx("div",{style:{left:`${f?.left}%`,top:`${f?.top}%`,width:`${f?.width}%`,height:`${f?.height}%`},className:"absolute z-[3] border-[2px] border-dashed border-foreground opacity-50"})})]}):null},Capture_Area=Area,RowIndex_COMPONENT_KEY=constants_ToolType.HeatmapCapture,RowIndex=({id:e})=>{let{state:{heatmapCapture:t,globalID:r,publish:n}}=useStore_useStore(),{onChange:a,show:i,type:o,display:l}=t,s=external_react_useMemo(()=>o===heatmap_HeatmapCaptureType.RowIndex&&i&&l,[o,i,l]),[c,u]=external_react_useState(null),[d,h]=external_react_useState(null),[p,f]=external_react_useState(!1),m=external_react_useCallback((e,t)=>Math.max(0,Math.min(t-1,Math.ceil((100-e)*t/100)-1)),[]),g=external_react_useRef(null),b=external_react_useCallback(e=>{if(!a||!r)return;let{waterfallData:t}=withDatabase(r).getAllRawData();if(t?.length){let n=getHeatmapWaterfallSnapshot(r),i=n?resolveHeatmapSourcePoint(n,{left:0,top:e.top}):null,o=i?i.rowIndex:m(e.top,t.length),l=t[o]?.timestamp,s={data:t[o],timestamp:l,rowIndex:o};u(s),a(s),withSpectrumAnalyzerSYNC(r)?.setRealData(s.data)}},[r,a,m,n]);return(external_react_useEffect(()=>{if(r&&s)return createMouseDownEventManager(e,RowIndex_COMPONENT_KEY,()=>{f(!0)}),createMouseUpEventManager(e,RowIndex_COMPONENT_KEY,()=>{f(!1),resetEventLevel(e,RowIndex_COMPONENT_KEY)}),createDragEventManager(e,RowIndex_COMPONENT_KEY,(t,r)=>{compareEventPriority(e,RowIndex_COMPONENT_KEY)&&(h(r),b(r))}),()=>{createMouseDownEventManager(e,RowIndex_COMPONENT_KEY,()=>{}),createMouseUpEventManager(e,RowIndex_COMPONENT_KEY,()=>{}),createDragEventManager(e,RowIndex_COMPONENT_KEY,()=>{})}},[e,r,s,b]),s)?/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute left-0 top-0 z-[6] h-full w-full",ref:g,children:d&&c&&/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("absolute left-0 h-0 w-full -translate-y-1/2 border-b-[2px] border-dashed border-b-foreground text-xs text-foreground",p&&"border-b-[4px]"),style:{top:`${d.top}%`},children:/*#__PURE__*/jsxs("div",{className:"absolute left-0 flex w-auto flex-col px-2 text-xs",style:{...(()=>{if(!d)return{};let e=d.top;return e<=10?{top:"0",transform:"translateY(0)"}:e>=90?{bottom:"0",top:"auto",transform:"translateY(0)"}:{top:"50%",transform:"translateY(-50%)"}})()},children:[/*#__PURE__*/jsxs("span",{className:"w-fit backdrop-blur-[10px]",children:["行",c?.rowIndex]}),/*#__PURE__*/jsxs("span",{className:"w-fit backdrop-blur-[10px]",children:["时间",c?.timestamp]})]})})}):null},Capture_RowIndex=RowIndex,mergeClasses=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),toKebabCase=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),toCamelCase=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),toPascalCase=e=>{let t=toCamelCase(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
3808
+ }`].join("\n\n")},buildSizeBridgeCss=e=>{let t=buildVariableDeclarations(e,"middle"),r=buildVariableDeclarations(e,"small");return[buildRule(":root",t),buildRule(`:root[size='${DEFAULT_SIZE}']`,t),buildRule(":root[size='small']",r)].join("\n\n")},ensureStyleElement=(e,t)=>{if(!canUseDOM())return;let r=`style[${e}]`,n=document.head.querySelector(r);if(n){n.textContent!==t&&(n.textContent=t);return}let a=document.createElement("style");a.textContent=t,a.setAttribute(e,"true"),document.head.appendChild(a)},ensureRootThemeStyles=({tokens:e}={})=>{ensureStyleElement(ROOT_THEME_STYLE_TARGET,buildThemeBridgeCss(getCanonicalThemeVariableDefinitions(e),{default:":root",light:`:root[theme='${ThemeType.Light}'][${THEME_FOLLOW_OS_KEY}='false']`,dark:`:root[theme='${ThemeType.Dark}'][${THEME_FOLLOW_OS_KEY}='false']`,systemDark:`:root:not([${THEME_FOLLOW_OS_KEY}='false'])`}))},ensureChartsThemeStyles=({tokens:e}={})=>{ensureStyleElement(CHARTS_THEME_STYLE_TARGET,buildThemeBridgeCss(theme_tokens_getCanonicalThemeVariableDefinitions(e),{default:CHARTS_STYLE_SCOPE_SELECTOR,light:`:root[theme='${theme_contract_ThemeType.Light}'][${theme_contract_THEME_FOLLOW_OS_KEY}='false'] ${CHARTS_STYLE_SCOPE_SELECTOR}`,dark:`:root[theme='${theme_contract_ThemeType.Dark}'][${theme_contract_THEME_FOLLOW_OS_KEY}='false'] ${CHARTS_STYLE_SCOPE_SELECTOR}`,systemDark:`:root:not([${theme_contract_THEME_FOLLOW_OS_KEY}='false']) ${CHARTS_STYLE_SCOPE_SELECTOR}`}))},ensureChartsSizeStyles=e=>{ensureStyleElement(CHARTS_SIZE_STYLE_TARGET,buildSizeBridgeCss(getSizeVariableDefinitions(e)))},initializeRootThemeEnvironment=(e={})=>{let{sizes:t,tokens:r}=e;ensureRootThemeStyles({tokens:r}),ensureChartsSizeStyles(t)},initializeChartsThemeEnvironment=(e={})=>{let{sizes:t,tokens:r}=e;ensureChartsThemeStyles({tokens:r}),ensureChartsSizeStyles(t)},CHARTS_RUNTIME_KEY=Symbol.for("rfkit.charts.runtime"),createRuntimeOwnerRecord=()=>({datas:new Set,subscriptions:new Set}),normalizeChartsRuntime=e=>{let t=e?.datas??{},r=e?.subscriptions??{},n=e?.owners??{};for(let e of Object.keys(n)){let t=n[e];t.datas??=new Set,t.subscriptions??=new Set}return{datas:t,subscriptions:r,owners:n}},getRuntimeHost=()=>"u">typeof window?window:globalThis,ensureChartsRuntime=()=>{let e=getRuntimeHost();if("u">typeof window&&window.charts){let t=normalizeChartsRuntime(window.charts);return window.charts=t,e[CHARTS_RUNTIME_KEY]=t,t}e[CHARTS_RUNTIME_KEY]||(e[CHARTS_RUNTIME_KEY]=normalizeChartsRuntime(void 0));let t=normalizeChartsRuntime(e[CHARTS_RUNTIME_KEY]);return e[CHARTS_RUNTIME_KEY]=t,"u">typeof window&&(window.charts=t),t},subscription_c=ensureChartsRuntime();subscription_c.datas||(subscription_c.datas={});let getRuntimeOwnerRecord=e=>(subscription_c.owners[e]||(subscription_c.owners[e]=createRuntimeOwnerRecord()),subscription_c.owners[e]),registerRuntimeOwnership=(e,t,r)=>{e&&t&&getRuntimeOwnerRecord(e)[r].add(t)},cleanupOwnerRecordIfEmpty=e=>{let t=subscription_c.owners[e];t&&0===t.datas.size&&0===t.subscriptions.size&&delete subscription_c.owners[e]},unregisterRuntimeKey=(e,t)=>{for(let r of Object.keys(subscription_c.owners))subscription_c.owners[r][t].delete(e),cleanupOwnerRecordIfEmpty(r)};function subscription_openData(e,t,r,n){let a=subscription_c.datas;return registerRuntimeOwnership(n,e,"datas"),e in a?void 0!==t&&(a[e]=t):a[e]=t??r,a[e]??r}subscription_c.subscriptions||(subscription_c.subscriptions={});let subscription_subscriptions=subscription_c.subscriptions;function subscription_createSubscriptionManager(e,t,r,n){if(!e)throw Error("createSubscriptionManager 订阅失效");return"function"==typeof r&&t?(subscription_subscriptions[e]||(subscription_subscriptions[e]={}),subscription_subscriptions[e][t]=r,registerRuntimeOwnership(n,e,"subscriptions"),()=>{subscription_subscriptions[e]?.[t]===r&&delete subscription_subscriptions[e][t],subscription_subscriptions[e]&&0===Object.keys(subscription_subscriptions[e]).length&&(delete subscription_subscriptions[e],unregisterRuntimeKey(e,"subscriptions"))}):(...t)=>{let r=subscription_subscriptions[e];if(r)for(let e in r)r[e](...t)}}function createConsumableSubscriptionManager(e,t,r,n,a){return"function"==typeof n&&r?subscription_createSubscriptionManager(e,r,n,a):(...r)=>{let n=subscription_subscriptions[e];if(!n)return!1;for(let e of Object.keys(n).sort((e,r)=>t(r)-t(e)))if(!0===n[e](...r))return!0;return!1}}let getPublishSubscriptionKey=e=>`PUB_SUB-${e}`,getModuleSubscriptionKey=(e,t)=>`passThrough-${e}-${t}`,getDatabaseStorageKey=e=>`withDatabase-${e}`,getAnalyzerStorageKey=e=>`withSpectrumAnalyzerSYNC-${e}`,getWaterfallAnalyzerStorageKey=e=>`withWaterfallAnalyzerSYNC-${e}`,getUpdateDataSubscriptionKey=e=>`withUpdateData-${e}`,createPublishSubscriptionManager=(e,t,r="0")=>subscription_createSubscriptionManager(getPublishSubscriptionKey(e),r,t,e),createModuleSubscriptionManager=(e,t,r,n="0")=>subscription_createSubscriptionManager(getModuleSubscriptionKey(e,t),n,r,e);function releaseChartsRuntimeOwners(e){let t=e.filter(e=>"string"==typeof e&&e.length>0);if(0!==t.length)for(let e of t){let t=subscription_c.owners[e];if(t){for(let e of Array.from(t.datas))delete subscription_c.datas[e],unregisterRuntimeKey(e,"datas");for(let e of Array.from(t.subscriptions))delete subscription_subscriptions[e],unregisterRuntimeKey(e,"subscriptions");delete subscription_c.owners[e]}}}let getDefaultData=()=>({getAllRawData:()=>({realData:new Float32Array,maxData:new Float32Array,minData:new Float32Array,avgData:new Float32Array,thresholdData:new Float32Array,templateData:new Float32Array,backgroundNoiseData:new Float32Array,waterfallData:[],levelStreamData:{probabilityRangeData:new Float32Array,spectrumData:new Float32Array,timestampData:new Float32Array},occupancyData:new Float32Array,extraData:{},srcIndexCache:new Uint32Array})});function withDatabase(e,t){return e?subscription_openData(getDatabaseStorageKey(e),t,getDefaultData(),e):getDefaultData()}let withUpdateData=(e,t,r)=>subscription_createSubscriptionManager(getUpdateDataSubscriptionKey(e),t,r,e),setScanDF360Prob=(e,t)=>subscription_createSubscriptionManager(`setScanDF360Prob-${e}`,"0",t,e);function withSpectrumAnalyzerSYNC(e,t){return e?subscription_openData(getAnalyzerStorageKey(e),t,null,e):t??null}function withWaterfallAnalyzerSYNC(e,t){return e?subscription_openData(getWaterfallAnalyzerStorageKey(e),t,null,e):t??null}function createEnhancedPublishController(){let e={current:null},t={current:[]},r={current:!1},n={current:!1},a={current:!1},i={current:[]},o={current:[]},l=()=>{a.current=!1,n.current=!0,c();let e=i.current;for(let t of(i.current=[],e)){if(!t.active)continue;let e=t.callback();"function"==typeof e&&(t.cleanup=e,o.current.push(e))}},s=()=>{if(a.current)return;a.current=!0;let e=()=>{queueMicrotask(l)};"u">typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,0)},c=()=>{if(!e.current||0===t.current.length)return;let r=t.current;for(let n of(t.current=[],r))e.current(n)},u=a=>{e.current&&n.current?e.current(a):(t.current.push(a),r.current&&e.current&&s())};return{attachPublish:t=>{if(e.current=t,r.current){n.current=!1,s();return}r.current=!0,n.current=!1,s()},dispose:()=>{for(let e of o.current)e();o.current=[],t.current=[],i.current=[],e.current=null,r.current=!1,n.current=!1,a.current=!1},enhancedPublish:Object.assign(u,{getSourceData:()=>e.current?.getSourceData?e.current.getSourceData():getDefaultData(),isReady:()=>r.current,onReady:t=>{if(r.current&&e.current&&n.current){let e=t();return"function"==typeof e?(o.current.push(e),e):void 0}let a={callback:t,active:!0};return i.current.push(a),r.current&&e.current&&s(),()=>{a.active=!1,i.current=i.current.filter(e=>e!==a),a.cleanup&&a.cleanup()}},resetViewport:()=>{e.current?.resetViewport?.()}}),publish:u}}function withChartPublisher(e,t){let r=forwardRef((t,r)=>{let n=external_react_useRef(null);n.current||(n.current=createEnhancedPublishController());let a=n.current,i=external_react_useCallback(e=>{a.attachPublish(e)},[a]);external_react_useEffect(()=>()=>a.dispose(),[a]),useImperativeHandle(r,()=>a.enhancedPublish,[a]);let o={...t,publish:i};return react.createElement(e,o)});return r.displayName=`withChartPublisher(${t})`,r}let KEY="DCHARTS_CONFIG",UI_CONFIG={ZOOM_MIN_RANGE:10,POPOVER_MARGIN:16},SPECTRUM_THRESHOLD_COLOR="#A855F7",setting_defaultConfig={line:{realData:{name:"realData",color:"#86c56a",thickness:1,label:"实时值",display:!0},maxData:{name:"maxData",color:"#eb5b5b",thickness:1,label:"最大值",display:!0},minData:{name:"minData",color:"#4a65bf",thickness:1,label:"最小值",display:!1},avgData:{name:"avgData",color:"#f9c14e",thickness:1,label:"平均值",display:!1},thresholdData:{name:"thresholdData",color:SPECTRUM_THRESHOLD_COLOR,thickness:1,label:"门限值",display:!0},templateData:{name:"templateData",color:"#e38888",thickness:1,label:"模板",display:!0},backgroundNoiseData:{name:"backgroundNoiseData",color:"#2bb3cb",thickness:1,label:"背景噪声",display:!0}},gradient:{item:[["#FF0000","#FFEB3B","#2DB333","#00BCD4","#0000FF","#000000"],["#FF3636","#2DF16A","#3B4FFF"],["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],["#d73027","#f46d43","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],["#5e4fa2","#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],["#FFFFFF","#000000"]],index:0},levelStream:{line:"#4a65bf",statisticsTime:10},bar:"rgba(100, 211, 211, 211)",iq:{pointColor:"#ff0000",lineColor:"#00ff00"},marker:["#35E065","#F98116","#FF4325","#3CE5D3","#F64FA1","#AA74E8","#FFE184","#B1E3FF","#C8141F","#FFA3CC","#BACFFF","#45D2FF","#AEDF2F","#E7FF84","#B88AFF","#FF00B4","#FFD0E3","#EEAE94"]},setConfig=(e={})=>{let t=JSON.parse(localStorage.getItem(KEY)||"{}"),r={...setting_defaultConfig,...t,...e};localStorage.setItem(KEY,JSON.stringify(r))};function getConfig(e){let t=setting_defaultConfig??JSON.parse(localStorage.getItem(KEY)||"null");return t||(setConfig(),t=setting_defaultConfig),e?t[e]:t}let getSeriesConfig=()=>getConfig("line"),getGradient=(e=0)=>{let{item:t,index:r}=getConfig("gradient");return t[void 0!==r?r:e]},SERIES=getSeriesConfig(),SERIES_NAMES=Object.keys(SERIES),REAL_DATA_NAME=SERIES.realData.name,ZOOM_MIN_RANGE=UI_CONFIG.ZOOM_MIN_RANGE,POPOVER_MARGIN=UI_CONFIG.POPOVER_MARGIN;var constants_FrequencyUnit=/*#__PURE__*/function(e){return e.Hz="Hz",e.kHz="kHz",e.MHz="MHz",e.GHz="GHz",e}({}),constants_AxisPlacement=/*#__PURE__*/function(e){return e.Outside="outside",e.Inside="inside",e}({}),constants_ChartType=/*#__PURE__*/function(e){return e.SingleFrequency="singleFrequency",e.Scan="scan",e.MScan="mscan",e.ScanDF360="scanDF360",e.DDC="ddc",e.Lite="lite",e.LiteNormalized="liteNormalized",e.LevelStream="levelStream",e.IQEye="iqEye",e.IQLine="iqLine",e.IQPlanisphere="iqPlanisphere",e.IQStream="iqStream",e.Heatmap="heatmap",e.Occupancy="occupancy",e}({}),constants_ModuleType=/*#__PURE__*/function(e){return e.Spectrum="spectrum",e.Heatmap="heatmap",e.Fluorescence="fluorescence",e.Occupancy="occupancy",e.LevelStream="levelStream",e.Dial="dial",e.Gauge="gauge",e.IQStream="iqStream",e.IQPlanisphere="iqPlanisphere",e.IQEye="iqEye",e.IQLine="iqLine",e.SpatialSpectrum="spatialSpectrum",e}({}),constants_PSType=/*#__PURE__*/function(e){return e.Spectrum="spectrum",e.AntennaFactor="antennaFactor",e.Signal="signal",e.Occupancy="occupancy",e.LevelStream="levelStream",e.Heatmap="heatmap",e.Fluorescence="fluorescence",e.IQ="iq",e.Dial="dial",e.Gauge="gauge",e.Series="series",e.SpectrumBandwidth="spectrumBandwidth",e.Segments="segments",e.Channels="channels",e.Marker="marker",e.Reset="reset",e.Resize="resize",e.Clear="clear",e.Option="option",e.Render="render",e}({}),constants_OptionKey=/*#__PURE__*/function(e){return e.HeatmapCapture="heatmapCapture",e}({}),constants_SegmentsEvent=/*#__PURE__*/function(e){return e.Cover="cover",e.Focus="focus",e}({}),constants_MarkerEventType=/*#__PURE__*/function(e){return e.Add="add",e.Del="del",e.Clear="clear",e.Update="update",e}({}),constants_ToolType=/*#__PURE__*/function(e){return e.AxisX="axisX",e.AxisY="axisY",e.Band="band",e.Blaze="blaze",e.Cursor="cursor",e.DragFrame="dragFrame",e.Dropdown="dropdown",e.EventBus="eventBus",e.FrequencyAllocation="frequencyAllocation",e.FrequencyDataBoard="frequencyDataBoard",e.FrequencyTagLine="frequencyTagLine",e.GridLines="gridLines",e.GaugeBox="gaugeBox",e.HeatmapCapture="heatmapCapture",e.Legend="legend",e.Limit="limit",e.Markers="markers",e.Scope="scope",e.SegmentsZebra="segmentsZebra",e.Signal="signal",e.SignalAnalysis="signalAnalysis",e.Square="square",e.Stripe="stripe",e.Zoom="zoom",e.Frame="frame",e.Area="area",e}({}),constants_ToolbarItemType=/*#__PURE__*/function(e){return e.AutorangingSwitch="AutorangingSwitch",e.UnitSwitch="UnitSwitch",e.StepSwitch="StepSwitch",e.GradientRibbon="GradientRibbon",e.HeatmapCaptureSwitch="HeatmapCaptureSwitch",e.TimeRangeSwitch="TimeRangeSwitch",e.SpacerLine="SpacerLine",e.Reset="Reset",e.StationAllocationSwitch="StationAllocationSwitch",e.SeriesControl="SeriesControl",e.FrequencyAllocationSwitch="FrequencyAllocationSwitch",e.ZoomSwitch="ZoomSwitch",e.LimitSwitch="LimitSwitch",e.MarkersSwitch="MarkersSwitch",e.FrequencyTagLineSwitch="FrequencyTagLineSwitch",e.SignalAnalysisSwitch="SignalAnalysisSwitch",e.StripeSwitch="StripeSwitch",e.CursorSwitch="CursorSwitch",e.CursorFindRowSwitch="CursorFindRowSwitch",e.SignalSwitch="SignalSwitch",e.SegmentsDisplayControl="SegmentsDisplayControl",e.SeriesDisplayControl="SeriesDisplayControl",e.FluorescenceSwitch="FluorescenceSwitch",e.DeltaMeasurementSwitch="DeltaMeasurementSwitch",e}({}),constants_SeriesType=/*#__PURE__*/function(e){return e.RealData="realData",e.MaxData="maxData",e.MinData="minData",e.AvgData="avgData",e.ThresholdData="thresholdData",e.TemplateData="templateData",e.BackgroundNoiseData="backgroundNoiseData",e}({});let cursor_hasActiveSpectrumCursor=e=>!!(e.show&&e.active&&e.event?.sourceType===constants_ModuleType.Spectrum),CLIPPING_OVERFLOW_VALUES=new Set(["auto","clip","hidden","overlay","scroll"]),matchesClippingOverflow=e=>e?.split(" ").some(e=>CLIPPING_OVERFLOW_VALUES.has(e.trim()))??!1,createBounds=(e,t,r,n)=>({left:e,top:t,right:r,bottom:n,width:Math.max(0,r-e),height:Math.max(0,n-t)}),resolveCursorVisibleBounds=e=>{let t=e.getBoundingClientRect(),r=t.left,n=t.top,a=t.right,i=t.bottom;"u">typeof window&&(r=Math.max(r,0),n=Math.max(n,0),a=Math.min(a,window.innerWidth),i=Math.min(i,window.innerHeight));let o=e.parentElement;for(;o&&o!==document.body;){let e=window.getComputedStyle(o),t=matchesClippingOverflow(e.overflowX)||matchesClippingOverflow(e.overflow),l=matchesClippingOverflow(e.overflowY)||matchesClippingOverflow(e.overflow);if(t||l){let e=o.getBoundingClientRect();e.width>0&&e.height>0&&(t&&(r=Math.max(r,e.left),a=Math.min(a,e.right)),l&&(n=Math.max(n,e.top),i=Math.min(i,e.bottom)))}o=o.parentElement}return createBounds(r,n,a,i)},getFrequencyToFixed=(e,t=6)=>{if(!e&&0!==e)return"";let r=Number.parseFloat(e.toFixed(t));return Number.isFinite(r)?String(r):""};function isdBm(e){return e?.slice(0,3)==="dBm"}let setTotalPoints=(e,t)=>(Object.defineProperty(e,"totalPoints",{value:t,enumerable:!1,configurable:!0}),e),generateFrequencyCache=e=>{let{totalPoints:t,startFrequency:r,stopFrequency:n,index:a=0}=e,i=n-r;return 1===t?[{frequency:getFrequencyToFixed(r),startLeft:100*a/t,endLeft:(a+1)*100/t}]:Array(t).fill(0).map((e,n)=>({frequency:getFrequencyToFixed(r+n/(t-1)*i),startLeft:(a+n)*100/t,endLeft:(a+n+1)*100/t}))},leftSegments2frequency=e=>{if(!e?.length)return()=>"";let t=e.totalPoints,r=e.map((r,n)=>{let{point:a}=r;return{ll:100*a/t,frequencyCache:r.frequencyCache,startLeft:0===n?0:e.slice(0,n).reduce((e,r)=>e+100*r.point/t,0)}});return t=>{if(t<=0)return String(e[0]?.start);if(t>=100)return String(e[e.length-1]?.stop);let n=0,a=r.length-1;for(;n<=a;){let e=n+a>>>1,{startLeft:i,ll:o}=r[e];if(t>=i&&t<i+o){let{frequencyCache:n}=r[e],a=Math.min(Math.ceil((t-i)/o*n.length)-1,n.length-1);return n[a]?.frequency??""}t<i?a=e-1:n=e+1}return""}},leftToIndex=(e,t)=>t<=1?0:Math.max(0,Math.min(t-1,Math.ceil(Math.max(0,Math.min(100,e))*t/100)-1));function leftPoints2frequency(e){let t=e.length;return r=>{if(0!==t)return e[leftToIndex(r,t)]}}let scopeLeftSegments2bandwidth=e=>{if(!e)return 0;let{segments:t}=e;if(!t)return 0;let r=t.totalPoints,{endLeft:n,startLeft:a}=e,i=n-a,o=Math.abs(i);i<0&&(a=e.endLeft,n=e.startLeft);let l=0,s=!1;for(let e=0;e<t.length;e+=1){let{step:i,start:c,stop:u,point:d}=t[e],h=100*d/r,p=i/1e3,f=a-h<=0,m=n-h<=0;if(!s&&f&&m)return Math.round(o/h*d)*p;if(f&&!s&&(s=!0,l+=Math.round((1-a/h)*d)*p),m)return l+Math.round(n/h*d)*p;a<0&&!m&&(l+=u-c),a-=h,n-=h}return 0},generateFrequencySegments=e=>{let{frequency:t,bandwidth:r,totalPoints:n}=e,a=t-r/2e3,i=t+r/2e3;if(a<=0||i<=0)return[];let o=generateFrequencyCache({totalPoints:n,startFrequency:a,stopFrequency:i,stepFrequency:r/n});return setTotalPoints([{frequency:t,bandwidth:r,step:i-a,start:a,stop:i,index:0,label:"",point:n,percentage:1,progress:[0,100],frequencyCache:o}],n)},generateNormalizedSegments=e=>setTotalPoints([{frequency:0,bandwidth:0,step:1,start:0,stop:e,index:0,label:"Data",point:e,percentage:1,progress:[0,100],frequencyCache:[]}],e),generateGreatSegments=e=>{if(!e?.length)return[];let t=e.reduce((e,{startFrequency:t,stopFrequency:r,stepFrequency:n})=>e+Math.round((r-t)*1e3/n)+1,0),r=0;return setTotalPoints(e.map(({startFrequency:e,stopFrequency:n,stepFrequency:a,label:i})=>{let o=Math.round((n-e)*1e3/a)+1,l=r,s=generateFrequencyCache({totalPoints:o,startFrequency:e,stopFrequency:n,stepFrequency:a,index:l});return r+=o,{start:e,stop:n,step:a,index:l,label:i,point:o,percentage:o/t,progress:[100*l/t,100*r/t],frequencyCache:s}}),t)},formatFrequencyUnit=(e,t=3)=>{let r,n;if(!e&&0!==e)return{value:0,unit:constants_FrequencyUnit.Hz,formatted:`0 ${constants_FrequencyUnit.Hz}`};let a=Math.abs(e);a>=1e6?(r=e/1e6,n=constants_FrequencyUnit.GHz):a>=1e3?(r=e/1e3,n=constants_FrequencyUnit.MHz):a>=1?(r=e,n=constants_FrequencyUnit.kHz):(r=1e3*e,n=constants_FrequencyUnit.Hz);let i=Number.parseFloat(r.toFixed(t)).toString(),o=`${i} ${n}`;return{value:r,unit:n,formatted:o}},formatFrequencyUnitFromMHz=(e,t=3)=>formatFrequencyUnit(1e3*e,t),formatFrequencyUnitFromHz=(e,t=3)=>formatFrequencyUnit(e/1e3,t),SEARCH_RANGE=5,ACTIVE_TOLERANCE=2;function frequencyCalculation_calculateFrequencyRange(e){if(null!=e.frequency&&null!=e.bandwidth){let t=e.bandwidth/1e3/2;return{startFreq:e.frequency-t,stopFreq:e.frequency+t}}return null!=e.startFrequency&&null!=e.stopFrequency?{startFreq:Number(e.startFrequency),stopFreq:Number(e.stopFrequency)}:null}function calculateRoughIndexRange(e,t){let r=t.stop-t.start,n=Math.ceil((e.startFreq-t.start)/r*t.point)-1,a=Math.floor((e.stopFreq-t.start)/r*t.point)-1;return{startIndex:n=Math.max(n,0),stopIndex:a=Math.min(a,t.point-1)}}function findPreciseIndexRange(e,t,r=SEARCH_RANGE){let{startIndex:n,stopIndex:a}=calculateRoughIndexRange(e,t),i=t.frequencyCache,o=n,l=a;for(let a=Math.max(0,n-r);a<=Math.min(t.point-1,n+r);a++)if(Number(i[a]?.frequency)>=e.startFreq){o=a;break}for(let n=Math.max(0,a-r);n<=Math.min(t.point-1,a+r);n++){let t=Number(i[n]?.frequency);if(t<=e.stopFreq&&(l=n),t>e.stopFreq)break}return{startIndex:n=Math.max(o,0),stopIndex:a=Math.min(l,t.point-1)}}function calculatePositionFromIndex(e,t){let r=(e.stopIndex-e.startIndex+1)/t.point*100;return{left:e.startIndex/t.point*100,width:r}}function calculatePositionFromFrequencyRange(e,t){let r=findPreciseIndexRange(e,t);return{...calculatePositionFromIndex(r,t),...r}}function frequencyCalculation_calculateCursorPosition(e,t){if(!t?.length)return{segmentIndex:-1,pointIndex:-1};let r=t.reduce((e,t)=>e+t.point,0),n=0,a=e/100;for(let e=0;e<t.length;e++){let i=t[e].point/r;if(a>=n&&a<=n+i){let r=(a-n)/i,o=Math.max(0,Math.min(t[e].point-1,Math.ceil(r*t[e].point)-1));return{segmentIndex:e,pointIndex:o}}n+=i}return{segmentIndex:-1,pointIndex:-1}}function frequencyCalculation_getCursorFrequencyAtPosition(e,t){let r=e[t.segmentIndex];if(!r?.frequencyCache?.length)return 0/0;let n=Math.max(0,Math.min(r.frequencyCache.length-1,t.pointIndex));return Number(r.frequencyCache[n]?.frequency)}function isInRangeByIndex(e,t,r=ACTIVE_TOLERANCE){return!(e+r<t.startIndex||e-r>t.stopIndex)}function isInRangeByFrequency(e,t){return e>=t.startFreq&&e<=t.stopFreq}function isRangeIntersectSegment(e,t){return!(e.stopFreq<t.start||e.startFreq>t.stop)}let isPlainObject=e=>"[object Object]"===Object.prototype.toString.call(e)&&null!==e,mergeObjects=(e,t)=>{let r={...e};return Object.keys(r).forEach(e=>{let n=t[e];isPlainObject(n)&&isPlainObject(r[e])?r[e]={...r[e],...n}:void 0!==n&&(r[e]=n)}),r};function throttle(e=()=>{},t=1e3/30){let r=0;return(...n)=>{let a=Date.now();a-r>=t&&(e(...n),r=a)}}function throttleRequestAnimationFrame(e=()=>{}){let t=!1,r=null;return n=>{n?.nativeEvent&&n.persist&&n.persist(),r=n?.currentTarget?{currentTarget:n.currentTarget,target:n.target??null,clientX:n.clientX,clientY:n.clientY,buttons:n.buttons,nativeEvent:n.nativeEvent,_originalEvent:n}:n,t||(t=!0,requestAnimationFrame(()=>{e(r),t=!1,r=null}))}}function throttleTimer(e=()=>{},t){let r=null;return n=>{r&&clearTimeout(r),r=setTimeout(()=>{e(n)},t||100)}}let debounce=(e,t=1e3/30)=>{let r=null,n=(...n)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(...n)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function debounceRequestAnimationFrame(e=()=>{}){let t=!1;return(...r)=>{t||(t=!0,requestAnimationFrame(()=>{e(...r),t=!1}))}}let formatTimestamp=(e=Date.now(),t)=>{if(null==e)return"";let r=0;"number"==typeof e?(r=e)>0&&r<1e10&&(r*=1e3):r=e.getTime();let n=new Date(r);if(!Number.isFinite(n.getTime()))return"";let{dateSeparator:a="-",timeSeparator:i=":",timeOnly:o=!1}=t??{},l=n.getFullYear(),s=`${n.getMonth()+1}`.padStart(2,"0"),c=`${n.getDate()}`.padStart(2,"0"),u=`${n.getHours()}`.padStart(2,"0"),d=`${n.getMinutes()}`.padStart(2,"0"),h=`${n.getSeconds()}`.padStart(2,"0"),p=`${u}${i}${d}${i}${h}`;if(o)return p;let f=`${l}${a}${s}${a}${c}`;return`${f} ${p}`},dateTimeToTimestamp=(e,t="-",r=":",n=!1)=>{if("string"!=typeof e)return console.error("dateTimeToTimestamp: 输入必须是字符串"),-1;let a=0,i=0,o=0,l=0,s=0,c=0;if(n){let t=e.split(r);if(3!==t.length)return -1;l=parseInt(t[0],10)||0,s=parseInt(t[1],10)||0,c=parseInt(t[2],10)||0;let n=new Date;return new Date(n.getFullYear(),n.getMonth(),n.getDate(),l,s,c).getTime()}let u=e.split(" ");if(2!==u.length)return -1;let[d,h]=u,p=d.split(t);if(3!==p.length)return -1;a=parseInt(p[0],10)||0,i=parseInt(p[1],10)||0,o=parseInt(p[2],10)||0;let f=h.split(r);return 3!==f.length?-1:(l=parseInt(f[0],10)||0,new Date(a,i-1,o,l,s=parseInt(f[1],10)||0,c=parseInt(f[2],10)||0).getTime())},createGUID=()=>((1+Math.random())*65536|0).toString(16).substring(1),convertToTimestampedArrays=(e,t)=>e&&Array.isArray(e)?Array.from({length:e.length},(r,n)=>{let a=e[n],i=new Float32Array(a.length);return i.set(a),i.timestamp=t?.[n],i}):[],BandKind={Position:"position",CenterBandwidth:"centerBandwidth",FrequencyRange:"frequencyRange"},DEFAULT_BAND_STATE={kind:BandKind.Position,show:!1,left:void 0,width:0,color:""},hasOwn=(e,t)=>Object.hasOwn(e,t),isFiniteNumber=e=>"number"==typeof e&&Number.isFinite(e),hasValidSharedFields=e=>(!hasOwn(e,"show")||"boolean"==typeof e.show)&&(!hasOwn(e,"color")||void 0===e.color||"string"==typeof e.color),resolveSharedState=(e,t,r)=>({show:"boolean"==typeof e.show?e.show:"merge"!==r||t.show,color:hasOwn(e,"color")?e.color:"merge"===r?t.color:void 0});function resolveBandState(e,t=DEFAULT_BAND_STATE,r="replace"){if(!hasValidSharedFields(e))return t;let n=hasOwn(e,"left")||hasOwn(e,"width"),a=hasOwn(e,"frequency")||hasOwn(e,"bandwidth"),i=hasOwn(e,"startFrequency")||hasOwn(e,"stopFrequency");if(Number(n)+Number(a)+Number(i)>1)return t;let o=resolveSharedState(e,t,r);if(a)return isFiniteNumber(e.frequency)&&isFiniteNumber(e.bandwidth)&&!(e.bandwidth<=0)?{kind:BandKind.CenterBandwidth,...o,frequency:e.frequency,bandwidth:e.bandwidth}:t;if(i)return isFiniteNumber(e.startFrequency)&&isFiniteNumber(e.stopFrequency)&&!(e.stopFrequency<=e.startFrequency)?{kind:BandKind.FrequencyRange,...o,startFrequency:e.startFrequency,stopFrequency:e.stopFrequency}:t;if(n){if(hasOwn(e,"left")&&void 0!==e.left&&!isFiniteNumber(e.left)||hasOwn(e,"width")&&void 0!==e.width&&!isFiniteNumber(e.width))return t;let n=t.kind===BandKind.Position?t:void 0;return{kind:BandKind.Position,...o,left:hasOwn(e,"left")?e.left:"merge"===r?n?.left:void 0,width:hasOwn(e,"width")?e.width??0:"merge"===r?n?.width??0:0}}return{...t,...o}}let AppContext=react.createContext(null),store_context=AppContext;var marker_MarkerMode=/*#__PURE__*/function(e){return e.Normal="normal",e.DDC="ddc",e}({}),marker_MarkerAction=/*#__PURE__*/null,heatmap_HeatmapCaptureType=/*#__PURE__*/function(e){return e.Area="area",e.Slider="slider",e.RowIndex="rowIndex",e}({});let constants_restrictList={dBm:[-300,300],dBμV:[-300,300]},constants_stepList=[5,10,20,30],constants_stepDefault=constants_stepList[2],constants_unitList=["dBμV","dBμV/m","dBm","dBm/m"],constants_RANGE_DEFAULT=[-20,100],zoomRuler=null,axisYTypeList={lite:"lite",inside:"inside",default:""},DEFAULT_MAX_POINTS=1001,ZOOM_INTERVAL_DEFAULT={start:0,end:DEFAULT_MAX_POINTS},DATA_RATE_DEFAULT=1;function createParams(){return{globalID:"",config:getConfig(),system:{width:0,height:0,padding:0,border:!0,borderRadius:!0,onChange:()=>{}},eventBus:{onDoubleClick:()=>{}},axisY:{show:!0,placement:constants_AxisPlacement.Outside,disabled:!1,gradientRibbon:!0,realRange:constants_RANGE_DEFAULT,range:constants_RANGE_DEFAULT,renderRange:constants_RANGE_DEFAULT,restrict:constants_restrictList["dBμV"],autoranging:!1,step:constants_stepDefault,unit:constants_unitList["0"],unitList:constants_unitList,unitDisabled:!1,type:axisYTypeList.default,hidden:[],linkage:!0,onChange:()=>{}},axisX:{show:!0,range:[],unit:"MHz",unitKHz:"kHz",ticks:!0,children:null,onChange:()=>{},frequencyFormat:()=>""},toolbar:{show:!0,hiddenTools:[]},series:{maxPoints:1001,zoomMinSimulateWave:!1,dataRate:1,forceDisplay:!1,legendExternal:[constants_SeriesType.ThresholdData,constants_SeriesType.TemplateData,constants_SeriesType.BackgroundNoiseData],enableMetrics:void 0,enableWaterfall:void 0,enableLengthSyncFastMode:!1},segments:[],points:[],marker:{fixed:!1,readonly:!1,enabled:!0,visible:!1,mode:marker_MarkerMode.Normal,maxCount:5,onChange:()=>{}},limit:{disabled:!1,show:!1,active:!0,value:[20],range:constants_restrictList["dBμV"],label:"",unified:!1,onChange:()=>{}},heatmapCapture:{type:heatmap_HeatmapCaptureType.Area,show:!1,display:!1,sync:!1,interval:{startIndex:-1,endIndex:-1},dataNow:[],onChange:()=>{}},waterfallViewport:{range:{x:[0,0],y:[0,0]},sourceSize:{width:0,height:0}},cursor:{show:!0,active:!0,event:null,coord:{left:0,top:0},timeout:0,mode:void 0},zoom:{show:!0,xy:!1,overview:{show:!1},select:!1,interval:ZOOM_INTERVAL_DEFAULT,style:null,isScanSegmentsUpdateMagnify:!1,onChange:()=>{},autoCloseTimeout:31536e6},signal:{show:!0,display:!1,data:[],hiddenCategoryKeys:[],showCount:!0,onChange:()=>{}},signalAnalysis:{show:!0,display:!1,onChange:()=>{}},band:{kind:BandKind.Position,show:!1,left:void 0,width:0,color:""},scope:{show:!1,left:0,width:0,onChange:()=>{}},gridLines:!0,legend:{children:null},frequencyTagLine:{show:!0,display:!1,left:-100,onChange:()=>{}},stripe:{show:!0,display:!1,defaultLeft:40,defaultRight:60,left:40,right:60,onChange:()=>{}},blaze:{show:!1},frequencyAllocation:{show:!0,display:!0,data:[]},timeRange:0,levelStream:{cacheTime:2e4,granularity:1,maxPoints:500},fluorescence:{show:!1,display:!1,renderMode:FluorescenceRenderMode.Gaussian},deltaMeasurement:{show:!0,display:!1,onChange:()=>{}}}}let R=50,dBm2dBuV=e=>e+10*Math.log10(R)+90,dBm2V=e=>Math.sqrt(R*10**(e/10-3)),dBm2mW=e=>10**(e/10),dBuV2dBm=e=>e-90-10*Math.log10(R),dBuV2V=e=>10**(e/20-6),dBuV2uV=e=>1e6*dBuV2V(e),dBuV2mW=e=>10**(e/10-9)/R,V2dBm=e=>e<=0?-200:30+20*Math.log10(e)-10*Math.log10(R),V2dBuV=e=>e<=0?-200:20*(Math.log10(e)+6),V2mW=e=>1e3*e**2/R,mW2dBm=e=>e<=0?-50:10*Math.log10(e),mW2dBuV=e=>e<=0?-200:10*Math.log10(e*R)+90,mW2V=e=>(.001*e*R)**.5,spectrum2dBm=e=>e?e.map(e=>+e||0===e?dBuV2dBm(e):void 0):[],tools_defaultData={flaw:0,offset:0,range:[0,0],renderRange:[0,0]},VIRTUAL_RANGE=(e,t)=>subscription_openData(`VIRTUAL_RANGE-${e}`,t,tools_defaultData);function useVirtualRange({unit:e,realRange:t=[0,0],step:r=1,globalID:n}){let{offset:a,flaw:i}=tools_defaultData,o=[t[0]??0,t[1]??0],l=[t[0]??0,t[1]??0];if(e&&isdBm(e)){let e=dBuV2dBm(0);i=e%r,a=e-i,o=[t[0]+a,t[1]+a],l=[t[0]-i,t[1]-i]}let s={offset:a,range:o,renderRange:l,flaw:i};return VIRTUAL_RANGE(n,s),s}function range2realRange({range:e,unit:t,globalID:r}){let n=e,a=e;if(t&&isdBm(t)){let{offset:t,flaw:i}=VIRTUAL_RANGE(r);a=[(n=[e[0]-t,e[1]-t])[0]-i,n[1]-i]}return{realRange:n,renderRange:a}}function getVirtualLevel(e,t){return isdBm(e)?dBuV2dBm(t):t}function useKeyEvent_subscriptionKeyBus(e,t,r){return subscription_createSubscriptionManager(`useKeyEvent-${e}`,t,r,e)}function isEditableTarget(e){if(!e||!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}let useKeyEventFunc=(e,t)=>r=>{if(!r||isEditableTarget(r.target))return;let n=["a","d","w","s","m"].includes(r.key.toLowerCase()),a=r.ctrlKey||r.altKey;if(!n&&!a)return;let i=document.getElementById(t),o=document.activeElement;!i||!o||(o===i||i.contains(o))&&useKeyEvent_subscriptionKeyBus(e,t)(r)};function useKeyEvent(e,t){external_react_useEffect(()=>{if(e&&t){let r=useKeyEventFunc(e,t);return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}}},[e,t])}let array_0=__webpack_require__("19525"),info2step=e=>{let{min:t,max:r}=e,n=r-t,a=10;switch(!0){case n>=90:a=20;break;case n>=45:a=10;break;default:a=5}return{diff:n,step:a,middle:t+n/2}};class RangeController{state={axisY:{step:constants_stepDefault,realRange:constants_RANGE_DEFAULT,restrict:constants_restrictList["dBμV"]},onChange:()=>{}};constructor(e){this.update(e)}update(e){let t={...this.state,...e};this.state={...t}}setAxisY(e){let{axisY:t}=this.state;this.update({axisY:{...t,...e}})}focus({isHand:e,step:t}={}){let{axisY:r,globalID:n}=this.state,{realRange:a}=r;if(!a||!n)return;let i=withDatabase(n).getAllRawData?.(),o=i[SERIES.realData.name]||new Float32Array,l=i[SERIES.maxData.name]||new Float32Array,s=i[SERIES.minData.name]||new Float32Array,c=[...Array.from(o),...Array.from(l),...Array.from(s)],u=(0,array_0.jy)(c),{avg:d}=u;void 0===d&&(d=10);let h=t||r.step,p=info2step(u),{min:f=0,max:m=0}=u,[g,b]=a,{middle:v}=p;!t&&(e||f<g||b<m)&&(h=p.step);let w=(Math.round(v/h)-5)*h;Number.isNaN(w)&&(w=-20);let y=w+10*h;this.setAxisY({step:h,realRange:[w,y]}),this.onChange()}move(e){let{axisY:{realRange:[t,r],restrict:n}}=this.state;if(r>=n[1]&&e>0||t<=n[0]&&e<0)return;let a=e*(r-t),[i,o]=[t+a,r+a];this.setAxisY({realRange:[i,o]}),this.onChange()}moveBoundary(e,t){let{axisY:{realRange:[r,n],step:a}}=this.state,[i,o]=[r,n];!e&&t&&(o+=a),e&&t&&(o-=a),e||t||(i+=a),e&&!t&&(i-=a),o<=i+1&&(t&&(o=i+1),t||(i=o-1));let l=20*a;o-i>=l&&(t&&(o=i+l),t||(i=o-l)),this.setAxisY({realRange:[i,o]}),this.onChange()}moveWheel(e){let{axisY:{realRange:[t,r]}}=this.state,n=e.currentTarget.getBoundingClientRect(),a=e.clientY-n.top,i=n.height,o=e.deltaY>0?1.1:.9;this.zoom(o,r-a/i*(r-t))}zoom(e,t){let{axisY:{realRange:[r,n],step:a,restrict:i}}=this.state,o={min:t-(t-r)*e,max:t+(n-t)*e},[l,s]=i,c=Math.abs(s-l),u=Math.max(l,o.min),d=Math.min(s,o.max),h=Math.max(Number.EPSILON,Math.min(a/100,c/100));if(d-u<h){let e=(u+d)/2;u=Math.max(l,e-h/2),d=Math.min(s,e+h/2)}this.setAxisY({realRange:[u,d]}),this.onChange()}moveStep(e){let{axisY:{realRange:[t,r],step:n,restrict:a}}=this.state,i=e?n:-n,[o,l]=[t+i,r+i];(e?l>a[1]:o<a[0])&&(o=t,l=r),this.setAxisY({realRange:[o,l]}),this.onChange()}onChange(){let{axisY:{realRange:[e,t],restrict:r,unit:n}}=this.state,a=useVirtualRange({realRange:this.state.axisY.realRange,unit:this.state.axisY.unit,step:this.state.axisY.step,globalID:this.state.globalID}),i=isdBm(n)?a.offset:0,o=e<r[0]-i,l=t>r[1],s=e,c=t;o&&(c=(s=r[0]-i)+(t-e)),l&&([,c]=r),this.setAxisY({realRange:[s,c]}),this.state.onChange(this.state.axisY)}}let useRangeAutoFocus=(e,t)=>subscription_createSubscriptionManager(`useRangeAutoFocus-${e}`,"0",t,e),useRangeMove=(e,t)=>subscription_createSubscriptionManager(`useRangeMove-${e}`,"0",t,e),useRangeZoom=(e,t)=>subscription_createSubscriptionManager(`useRangeZoom-${e}`,"0",t,e),useRangeSet=(e,t)=>subscription_createSubscriptionManager(`useRangeSet-${e}`,"0",t,e),useRanging_ranging=RangeController,useRange=({chart:e})=>{let{state:{axisY:t,series:r,globalID:n},dispatch:a}=useStore_useStore(),{realRange:i,renderRange:o,step:l,unit:s,onChange:c,autoranging:u,disabled:d}=t,h=external_react_useMemo(()=>new useRanging_ranging({axisY:t}),[t]);external_react_useEffect(()=>{n&&h.update?.({globalID:n})},[n,h]),external_react_useEffect(()=>{h.update?.({axisY:t})},[h,JSON.stringify(t)]),external_react_useEffect(()=>{h.update?.({series:r})},[h,JSON.stringify(r)]);let p=external_react_useCallback(e=>{if(n){let t=useVirtualRange({unit:s,...e,globalID:n});a({payload:r=>({axisY:{...r.axisY,realRange:e.realRange,step:e.step,range:t.range,renderRange:t.renderRange}})}),c?.({range:t.range,step:e.step})}},[s,c,n,a]);return external_react_useEffect(()=>{h.state.onChange=e=>{p(e)}},[h,p]),external_react_useEffect(()=>{p({realRange:i,step:l}),h?.update({unit:s})},[s]),external_react_useEffect(()=>{o&&e?.setRange?.(o)},[e,o]),external_react_useEffect(()=>{n&&useRangeAutoFocus(n,()=>{h?.focus()})},[n,h]),external_react_useEffect(()=>{h?.focus({step:l})},[l]),external_react_useEffect(()=>{e?.updateParams?.({autoranging:u})},[u]),external_react_useEffect(()=>{n&&useRangeMove(n,e=>{d||h.move?.(e)})},[h,n,d]),external_react_useEffect(()=>{if(n)return useRangeZoom(n,(e,t)=>{d||h.zoom?.(e,t)})},[h,n,d]),external_react_useEffect(()=>{n&&useKeyEvent_subscriptionKeyBus(n,"ticks",e=>{"ArrowUp"===e.code&&h.move?.(.1),"ArrowDown"===e.code&&h.move?.(-.1)})},[h,n]),h},spectrum_useRanging=useRange;function mergeParameter(e,t,r){let n=(r||createParams())[e];return t?"object"!=typeof t||null===t?t:mergeObjects(n,t):n}function normalizeAxisYProps(e){return e&&void 0!==e.unit&&void 0===e.unitDisabled?{...e,unitDisabled:!0}:e}let PARAM_NAMES=["axisX","legend","marker","limit","heatmapCapture","zoom","cursor","signal","scope","eventBus","blaze","stripe","signalAnalysis","series","frequencyTagLine","frequencyAllocation","toolbar","gauge","band","levelStream","fluorescence","onChannelChange"],Params=e=>{let t=useContext(store_context);if(!t)throw Error("Params must be used within a StoreProvider");let{dispatch:r,store:n}=t,a=useSyncExternalStore(n.subscribe,()=>n.getState().globalID,()=>n.getState().globalID),i=external_react_useRef({});return external_react_useEffect(()=>{let t={},a=!1,o=n.getState();for(let r of PARAM_NAMES){let n=e[r],l=i.current[r];if(void 0!==n&&n!==l){if("band"===r){let e=resolveBandState(n,o.band,"merge");e!==o.band&&(t.band=e,a=!0);continue}t[r]=mergeParameter(r,n,o),a=!0}}i.current={...e},a&&r({payload:t})},[r,e.axisX,e.legend,e.marker,e.limit,e.heatmapCapture,e.zoom,e.cursor,e.signal,e.scope,e.eventBus,e.blaze,e.stripe,e.signalAnalysis,e.series,e.frequencyTagLine,e.frequencyAllocation,e.toolbar,e.gauge,e.band,e.levelStream,e.fluorescence,e.onChannelChange,n]),external_react_useEffect(()=>{void 0!==e.gridLines&&r({payload:{gridLines:e.gridLines}})},[e.gridLines]),external_react_useEffect(()=>{let t=normalizeAxisYProps(e.axisY);if(t&&a){let e=n.getState(),{range:i,unit:o}=t,l=e.axisY.range,s=e.axisY.unit;if(i?.[0]!==void 0&&(o&&isdBm(o)&&s!==o||i[0]!==l[0]&&isdBm(s))){let{realRange:n,renderRange:l}=range2realRange({range:i,unit:o,globalID:a});r({payload:{axisY:mergeParameter("axisY",{...t,realRange:n,renderRange:l},e)}})}else o||isdBm(e.axisY.unit)||!i?r({payload:{axisY:mergeParameter("axisY",t,e)}}):r({payload:{axisY:mergeParameter("axisY",{...t,realRange:i,renderRange:i},e)}})}},[r,a,e.axisY,n]),null},store_Params=Params,resolvePayload=(e,t)=>"function"==typeof t?t(e):t,reducer_reducer=(e,t)=>{let r=resolvePayload(e,t.payload);if(!r)return e;if(t.replace)return r;let n=Object.keys(r);return n.length>0&&n.every(t=>Object.is(e[t],r[t]))?e:{...e,...r}};function createChartStore(e){let t=e,r=new Set,n=e=>{if(Object.is(e,t))return t;for(let n of(t=e,Array.from(r)))n();return t},a=e=>n(e(t));return{dispatch:e=>a(t=>reducer_reducer(t,e)),getState:()=>t,setState:n,subscribe:e=>(r.add(e),()=>{r.delete(e)}),updateState:a}}let runtimeRegistry=new Map,runtime_getChartRuntime=e=>e?runtimeRegistry.get(e)??null:null;function createChartRuntime(e){let t=createChartStore(e),r=new Set,n=e.globalID,a=!1,i={destroy:()=>{if(!a){for(let e of(a=!0,Array.from(r)))e();r.clear(),n&&runtimeRegistry.get(n)===i&&runtimeRegistry.delete(n)}},dispatch:e=>t.dispatch(e),getGlobalID:()=>n,getState:()=>t.getState(),registerCleanup:e=>{if(!e)return null;let t=!1,n=()=>{t||(t=!0,r.delete(n),e())};return r.add(n),n},setGlobalID:e=>{!a&&e!==n&&(n&&runtimeRegistry.get(n)===i&&runtimeRegistry.delete(n),(n=e)&&runtimeRegistry.set(n,i))},store:t,subscribe:t.subscribe};return n&&runtimeRegistry.set(n,i),i}let scheduleRuntimeCleanup=e=>{let t=!1;return queueMicrotask(()=>{t||e()}),()=>{t=!0}};function useAppContext(){let e=useContext(store_context);if(!e)throw Error("useStore must be used within a StoreProvider");return e}function useStore_useStore(){let{dispatch:e,runtime:t,store:r}=useAppContext();return{dispatch:e,runtime:t,state:useSyncExternalStore(r.subscribe,r.getState,r.getState),store:r}}function useStore_useSelector(e){let{store:t}=useAppContext();return useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getState()))}function useStoreApi(){return useAppContext()}function useStoreDispatch(){return useAppContext().dispatch}let Store=e=>{let{children:t}=e,r=external_react_useRef(null);if(!r.current){let t=createParams(),n=mergeObjects(t,{...e,axisY:normalizeAxisYProps(e.axisY)});e.band&&(n.band=resolveBandState(e.band,t.band,"merge")),r.current=n}let n=external_react_useRef(null);if(!n.current&&r.current&&(n.current=createChartRuntime(r.current)),!n.current)throw Error("Failed to initialize chart runtime");let a=n.current,{dispatch:i,store:o}=a,l=useSyncExternalStore(o.subscribe,()=>o.getState().globalID,()=>o.getState().globalID),s=external_react_useRef(l),c=external_react_useRef(null);external_react_useEffect(()=>{s.current=l,a.setGlobalID(l)},[l,a]),external_react_useEffect(()=>(c.current?.(),c.current=null,()=>{c.current=scheduleRuntimeCleanup(()=>{a.destroy(),releaseChartsRuntimeOwners([s.current]),c.current=null})}),[a]);let u=external_react_useMemo(()=>({dispatch:i,runtime:a,store:o}),[i,a,o]);return /*#__PURE__*/jsxs(store_context.Provider,{value:u,children:[/*#__PURE__*/jsx_runtime_jsx(store_Params,{...e}),t]})},src_store=Store,Background=({children:e})=>{let{state:{system:{padding:t}}}=useStore_useStore();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full w-full",style:{...CHARTS_SCOPE_STYLE_VARS},[CHARTS_STYLE_SCOPE_ATTRIBUTE]:"true",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-full select-none flex-col overflow-hidden bg-background pt-0 text-foreground",style:{padding:t?"calc(var(--size-gap-base) * 2)":0},children:e})})},components_Background=/*#__PURE__*/react.memo(Background),PUB_SUB=(e,t)=>createPublishSubscriptionManager(e,t),usePublish=({publish:e,resetViewport:t,subscribe:r=()=>{}})=>{let{state:{globalID:n},dispatch:a}=useStore_useStore(),i=external_react_useRef(r),o=external_react_useRef(e),l=external_react_useRef(t);i.current=r,o.current=e,l.current=t;let s=external_react_useCallback(()=>withDatabase(n),[n]);external_react_useEffect(()=>{if(n)return PUB_SUB(n,i.current)},[n]),external_react_useEffect(()=>{if(n){let e=PUB_SUB(n);e.getSourceData=s,e.resetViewport=()=>l.current?.(),a({payload:{publish:e}}),o.current?.(e)}},[n,s,a])},publish_usePublish=usePublish;function useSafePublish(){let e=external_react_useRef(null);e.current||(e.current=createEnhancedPublishController());let t=e.current,r=external_react_useMemo(()=>({get current(){return t.enhancedPublish},set current(value){value&&"function"==typeof value&&t.attachPublish(value)}}),[t]);return external_react_useEffect(()=>()=>t.dispose(),[t]),{publish:t.publish,chartRef:r}}let readContainerSize=e=>e?{height:e.offsetHeight,width:e.offsetWidth}:null,hasContainerSizeChanged=(e,t)=>e&&t?e.width!==t.width||e.height!==t.height:e!==t,createNextSystemConfig=(e,t)=>({...e,height:t.height,width:t.width}),Container_Container=e=>{let{children:t,style:r}=e,n=useStoreDispatch(),a=useStore_useSelector(e=>e.system),i=external_react_useMemo(()=>createGUID(),[]),o=external_react_useRef(null),l=external_react_useRef(a),s=external_react_useRef(null),c=external_react_useRef(()=>{});l.current=a,c.current=()=>{i&&PUB_SUB(i)({pstype:constants_PSType.Resize})},external_react_useEffect(()=>{i&&n({payload:{globalID:i}})},[n,i]);let u=external_react_useRef(throttleRequestAnimationFrame(()=>{c.current()}));return external_react_useEffect(()=>{if(!i||!o.current)return;let e=e=>{let t=readContainerSize(o.current);if(!t||!hasContainerSizeChanged(s.current,t))return;s.current=t;let r=createNextSystemConfig(l.current,t);n({payload:{system:r}}),r.onChange(r),e&&t.width>0&&t.height>0&&u.current()};if(e(!1),"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>{e(!0)});return t.observe(o.current),()=>{t?.disconnect()}},[n,i]),/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative h-full w-full select-none",style:r,ref:o,children:/*#__PURE__*/jsx_runtime_jsx(components_Background,{children:t})})},components_Container=Container_Container,RENDER_PSTYPE="render",normalizeRenderPublishEvent=(e,t={})=>{let{allowImplicitRender:r=!1,renderPSTypes:n=[]}=t;return e.pstype===RENDER_PSTYPE?e:void 0===e.pstype?r?{...e,pstype:RENDER_PSTYPE}:e:n.includes(e.pstype)?{...e,pstype:RENDER_PSTYPE}:e},useIsomorphicLayoutEffect="u">typeof window?useLayoutEffect:external_react_useEffect,Square=({children:e})=>{let t=external_react_useRef(null),r=external_react_useRef(null),n=external_react_useRef(null),a=external_react_useCallback(()=>{if(r.current&&t.current){let e=Math.min(t.current.clientWidth,t.current.clientHeight);n.current!==e&&(n.current=e,r.current.style.width=`${e}px`,r.current.style.height=`${e}px`)}},[]);return useIsomorphicLayoutEffect(()=>{if(!t.current)return;a();let e=new ResizeObserver(()=>{t.current&&a()});return e.observe(t.current),()=>{e.disconnect()}},[a]),/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative h-full min-h-0 w-full min-w-0 overflow-hidden",ref:t,children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute inset-0 m-auto flex box-border items-center justify-center",ref:r,children:/*#__PURE__*/jsx_runtime_jsx(components_Background,{children:e})})})},components_Square=Square;function clsx_r(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=clsx_r(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function clsx(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}let dist_clsx=null,concatArrays=(e,t)=>{let r=Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},createClassValidatorObject=(e,t)=>({classGroupId:e,validator:t}),createClassPartObject=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),CLASS_PART_SEPARATOR="-",EMPTY_CONFLICTS=[],ARBITRARY_PROPERTY_PREFIX="arbitrary..",createClassGroupUtils=e=>{let t=createClassMap(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return getGroupIdForArbitraryProperty(e);let r=e.split(CLASS_PART_SEPARATOR),n=+(""===r[0]&&r.length>1);return getGroupRecursive(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=n[e],a=r[e];return t?a?concatArrays(a,t):t:a||EMPTY_CONFLICTS}return r[e]||EMPTY_CONFLICTS}}},getGroupRecursive=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let n=e[t],a=r.nextPart.get(n);if(a){let r=getGroupRecursive(e,t+1,a);if(r)return r}let i=r.validators;if(null===i)return;let o=0===t?e.join(CLASS_PART_SEPARATOR):e.slice(t).join(CLASS_PART_SEPARATOR),l=i.length;for(let e=0;e<l;e++){let t=i[e];if(t.validator(o))return t.classGroupId}},getGroupIdForArbitraryProperty=e=>{let t,r,n;return -1===e.slice(1,-1).indexOf(":")?void 0:(r=(t=e.slice(1,-1)).indexOf(":"),(n=t.slice(0,r))?ARBITRARY_PROPERTY_PREFIX+n:void 0)},createClassMap=e=>{let{theme:t,classGroups:r}=e;return processClassGroups(r,t)},processClassGroups=(e,t)=>{let r=createClassPartObject();for(let n in e)processClassesRecursively(e[n],r,n,t);return r},processClassesRecursively=(e,t,r,n)=>{let a=e.length;for(let i=0;i<a;i++)processClassDefinition(e[i],t,r,n)},processClassDefinition=(e,t,r,n)=>{"string"==typeof e?processStringDefinition(e,t,r):"function"==typeof e?processFunctionDefinition(e,t,r,n):processObjectDefinition(e,t,r,n)},processStringDefinition=(e,t,r)=>{(""===e?t:getPart(t,e)).classGroupId=r},processFunctionDefinition=(e,t,r,n)=>{isThemeGetter(e)?processClassesRecursively(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(createClassValidatorObject(r,e)))},processObjectDefinition=(e,t,r,n)=>{let a=Object.entries(e),i=a.length;for(let e=0;e<i;e++){let[i,o]=a[e];processClassesRecursively(o,getPart(t,i),r,n)}},getPart=(e,t)=>{let r=e,n=t.split(CLASS_PART_SEPARATOR),a=n.length;for(let e=0;e<a;e++){let t=n[e],a=r.nextPart.get(t);a||(a=createClassPartObject(),r.nextPart.set(t,a)),r=a}return r},isThemeGetter=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,createLruCache=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),a=(a,i)=>{r[a]=i,++t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},IMPORTANT_MODIFIER="!",MODIFIER_SEPARATOR=":",EMPTY_MODIFIERS=[],createResultObject=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),createParseClassName=e=>{let{prefix:t,experimentalParseClassName:r}=e,n=e=>{let t,r=[],n=0,a=0,i=0,o=e.length;for(let l=0;l<o;l++){let o=e[l];if(0===n&&0===a){if(o===MODIFIER_SEPARATOR){r.push(e.slice(i,l)),i=l+1;continue}if("/"===o){t=l;continue}}"["===o?n++:"]"===o?n--:"("===o?a++:")"===o&&a--}let l=0===r.length?e:e.slice(i),s=l,c=!1;return l.endsWith(IMPORTANT_MODIFIER)?(s=l.slice(0,-1),c=!0):l.startsWith(IMPORTANT_MODIFIER)&&(s=l.slice(1),c=!0),createResultObject(r,c,s,t&&t>i?t-i:void 0)};if(t){let e=t+MODIFIER_SEPARATOR,r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):createResultObject(EMPTY_MODIFIERS,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n},createSortModifiers=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{let r=[],n=[];for(let a=0;a<e.length;a++){let i=e[a],o="["===i[0],l=t.has(i);o||l?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(i)):n.push(i)}return n.length>0&&(n.sort(),r.push(...n)),r}},createConfigUtils=e=>({cache:createLruCache(e.cacheSize),parseClassName:createParseClassName(e),sortModifiers:createSortModifiers(e),postfixLookupClassGroupIds:createPostfixLookupClassGroupIds(e),...createClassGroupUtils(e)}),createPostfixLookupClassGroupIds=e=>{let t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let e=0;e<r.length;e++)t[r[e]]=!0;return t},SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i,postfixLookupClassGroupIds:o}=t,l=[],s=e.trim().split(SPLIT_CLASSES_REGEX),c="";for(let e=s.length-1;e>=0;e-=1){let t,u=s[e],{isExternal:d,modifiers:h,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:m}=r(u);if(d){c=u+(c.length>0?" "+c:c);continue}let g=!!m;if(g){let e=(t=n(f.substring(0,m)))&&o[t]?n(f):void 0;e&&e!==t&&(t=e,g=!1)}else t=n(f);if(!t){if(!g||!(t=n(f))){c=u+(c.length>0?" "+c:c);continue}g=!1}let b=0===h.length?"":1===h.length?h[0]:i(h).join(":"),v=p?b+IMPORTANT_MODIFIER:b,w=v+t;if(l.indexOf(w)>-1)continue;l.push(w);let y=a(t,g);for(let e=0;e<y.length;++e){let t=y[e];l.push(v+t)}c=u+(c.length>0?" "+c:c)}return c},twJoin=(...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=toValue(t))&&(a&&(a+=" "),a+=r);return a},toValue=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=toValue(e[n]))&&(r&&(r+=" "),r+=t);return r},createTailwindMerge=(e,...t)=>{let r,n,a,i,o=e=>{let t=n(e);if(t)return t;let i=mergeClassList(e,r);return a(e,i),i};return i=l=>(n=(r=createConfigUtils(t.reduce((e,t)=>t(e),e()))).cache.get,a=r.cache.set,i=o,o(l)),(...e)=>i(twJoin(...e))},fallbackThemeArr=[],fromTheme=e=>{let t=t=>t[e]||fallbackThemeArr;return t.isThemeGetter=!0,t},arbitraryValueRegex=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,arbitraryVariableRegex=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fractionRegex=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,tshirtUnitRegex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lengthUnitRegex=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,colorFunctionRegex=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,shadowRegex=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,imageRegex=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,isFraction=e=>fractionRegex.test(e),isNumber=e=>!!e&&!Number.isNaN(Number(e)),isInteger=e=>!!e&&Number.isInteger(Number(e)),isPercent=e=>e.endsWith("%")&&isNumber(e.slice(0,-1)),isTshirtSize=e=>tshirtUnitRegex.test(e),isAny=()=>!0,isLengthOnly=e=>lengthUnitRegex.test(e)&&!colorFunctionRegex.test(e),isNever=()=>!1,isShadow=e=>shadowRegex.test(e),isImage=e=>imageRegex.test(e),isAnyNonArbitrary=e=>!isArbitraryValue(e)&&!isArbitraryVariable(e),isNamedContainerQuery=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),isArbitrarySize=e=>getIsArbitraryValue(e,isLabelSize,isNever),isArbitraryValue=e=>arbitraryValueRegex.test(e),isArbitraryLength=e=>getIsArbitraryValue(e,isLabelLength,isLengthOnly),isArbitraryNumber=e=>getIsArbitraryValue(e,isLabelNumber,isNumber),isArbitraryWeight=e=>getIsArbitraryValue(e,isLabelWeight,isAny),isArbitraryFamilyName=e=>getIsArbitraryValue(e,isLabelFamilyName,isNever),isArbitraryPosition=e=>getIsArbitraryValue(e,isLabelPosition,isNever),isArbitraryImage=e=>getIsArbitraryValue(e,isLabelImage,isImage),isArbitraryShadow=e=>getIsArbitraryValue(e,isLabelShadow,isShadow),isArbitraryVariable=e=>arbitraryVariableRegex.test(e),isArbitraryVariableLength=e=>getIsArbitraryVariable(e,isLabelLength),isArbitraryVariableFamilyName=e=>getIsArbitraryVariable(e,isLabelFamilyName),isArbitraryVariablePosition=e=>getIsArbitraryVariable(e,isLabelPosition),isArbitraryVariableSize=e=>getIsArbitraryVariable(e,isLabelSize),isArbitraryVariableImage=e=>getIsArbitraryVariable(e,isLabelImage),isArbitraryVariableShadow=e=>getIsArbitraryVariable(e,isLabelShadow,!0),isArbitraryVariableWeight=e=>getIsArbitraryVariable(e,isLabelWeight,!0),getIsArbitraryValue=(e,t,r)=>{let n=arbitraryValueRegex.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},getIsArbitraryVariable=(e,t,r=!1)=>{let n=arbitraryVariableRegex.exec(e);return!!n&&(n[1]?t(n[1]):r)},isLabelPosition=e=>"position"===e||"percentage"===e,isLabelImage=e=>"image"===e||"url"===e,isLabelSize=e=>"length"===e||"size"===e||"bg-size"===e,isLabelLength=e=>"length"===e,isLabelNumber=e=>"number"===e,isLabelFamilyName=e=>"family-name"===e,isLabelWeight=e=>"number"===e||"weight"===e,isLabelShadow=e=>"shadow"===e,bundle_mjs_validators=/*#__PURE__*/Object.defineProperty({__proto__:null,isAny:isAny,isAnyNonArbitrary:isAnyNonArbitrary,isArbitraryFamilyName:isArbitraryFamilyName,isArbitraryImage:isArbitraryImage,isArbitraryLength:isArbitraryLength,isArbitraryNumber:isArbitraryNumber,isArbitraryPosition:isArbitraryPosition,isArbitraryShadow:isArbitraryShadow,isArbitrarySize:isArbitrarySize,isArbitraryValue:isArbitraryValue,isArbitraryVariable:isArbitraryVariable,isArbitraryVariableFamilyName:isArbitraryVariableFamilyName,isArbitraryVariableImage:isArbitraryVariableImage,isArbitraryVariableLength:isArbitraryVariableLength,isArbitraryVariablePosition:isArbitraryVariablePosition,isArbitraryVariableShadow:isArbitraryVariableShadow,isArbitraryVariableSize:isArbitraryVariableSize,isArbitraryVariableWeight:isArbitraryVariableWeight,isArbitraryWeight:isArbitraryWeight,isFraction:isFraction,isInteger:isInteger,isNamedContainerQuery:isNamedContainerQuery,isNumber:isNumber,isPercent:isPercent,isTshirtSize:isTshirtSize},Symbol.toStringTag,{value:"Module"}),getDefaultConfig=()=>{let e=fromTheme("color"),t=fromTheme("font"),r=fromTheme("text"),n=fromTheme("font-weight"),a=fromTheme("tracking"),i=fromTheme("leading"),o=fromTheme("breakpoint"),l=fromTheme("container"),s=fromTheme("spacing"),c=fromTheme("radius"),u=fromTheme("shadow"),d=fromTheme("inset-shadow"),h=fromTheme("text-shadow"),p=fromTheme("drop-shadow"),f=fromTheme("blur"),m=fromTheme("perspective"),g=fromTheme("aspect"),b=fromTheme("ease"),v=fromTheme("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],x=()=>[...y(),isArbitraryVariable,isArbitraryValue],k=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],D=()=>[isArbitraryVariable,isArbitraryValue,s],M=()=>[isFraction,"full","auto",...D()],F=()=>[isInteger,"none","subgrid",isArbitraryVariable,isArbitraryValue],C=()=>["auto",{span:["full",isInteger,isArbitraryVariable,isArbitraryValue]},isInteger,isArbitraryVariable,isArbitraryValue],E=()=>[isInteger,"auto",isArbitraryVariable,isArbitraryValue],N=()=>["auto","min","max","fr",isArbitraryVariable,isArbitraryValue],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],T=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...D()],P=()=>[isFraction,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],z=()=>[isFraction,"screen","full","dvw","lvw","svw","min","max","fit",...D()],_=()=>[isFraction,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],O=()=>[e,isArbitraryVariable,isArbitraryValue],L=()=>[...y(),isArbitraryVariablePosition,isArbitraryPosition,{position:[isArbitraryVariable,isArbitraryValue]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",isArbitraryVariableSize,isArbitrarySize,{size:[isArbitraryVariable,isArbitraryValue]}],j=()=>[isPercent,isArbitraryVariableLength,isArbitraryLength],H=()=>["","none","full",c,isArbitraryVariable,isArbitraryValue],B=()=>["",isNumber,isArbitraryVariableLength,isArbitraryLength],G=()=>["solid","dashed","dotted","double"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[isNumber,isPercent,isArbitraryVariablePosition,isArbitraryPosition],V=()=>["","none",f,isArbitraryVariable,isArbitraryValue],Y=()=>["none",isNumber,isArbitraryVariable,isArbitraryValue],X=()=>["none",isNumber,isArbitraryVariable,isArbitraryValue],K=()=>[isNumber,isArbitraryVariable,isArbitraryValue],Q=()=>[isFraction,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[isTshirtSize],breakpoint:[isTshirtSize],color:[isAny],container:[isTshirtSize],"drop-shadow":[isTshirtSize],ease:["in","out","in-out"],font:[isAnyNonArbitrary],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[isTshirtSize],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[isTshirtSize],shadow:[isTshirtSize],spacing:["px",isNumber],text:[isTshirtSize],"text-shadow":[isTshirtSize],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",isFraction,isArbitraryValue,isArbitraryVariable,g]}],container:["container"],"container-type":[{"@container":["","normal","size",isArbitraryVariable,isArbitraryValue]}],"container-named":[isNamedContainerQuery],columns:[{columns:[isNumber,isArbitraryValue,isArbitraryVariable,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:x()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[isInteger,"auto",isArbitraryVariable,isArbitraryValue]}],basis:[{basis:[isFraction,"full","auto",l,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[isNumber,isFraction,"auto","initial","none",isArbitraryValue]}],grow:[{grow:["",isNumber,isArbitraryVariable,isArbitraryValue]}],shrink:[{shrink:["",isNumber,isArbitraryVariable,isArbitraryValue]}],order:[{order:[isInteger,"first","last","none",isArbitraryVariable,isArbitraryValue]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":N()}],"auto-rows":[{"auto-rows":N()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...T(),"normal"]}],"justify-self":[{"justify-self":["auto",...T()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...T(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...T(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...T(),"baseline"]}],"place-self":[{"place-self":["auto",...T()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",..._()]}],"min-block-size":[{"min-block":["auto",..._()]}],"max-block-size":[{"max-block":["none",..._()]}],w:[{w:[l,"screen",...P()]}],"min-w":[{"min-w":[l,"screen","none",...P()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",r,isArbitraryVariableLength,isArbitraryLength]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,isArbitraryVariableWeight,isArbitraryWeight]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",isPercent,isArbitraryValue]}],"font-family":[{font:[isArbitraryVariableFamilyName,isArbitraryFamilyName,t]}],"font-features":[{"font-features":[isArbitraryValue]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,isArbitraryVariable,isArbitraryValue]}],"line-clamp":[{"line-clamp":[isNumber,"none",isArbitraryVariable,isArbitraryNumber]}],leading:[{leading:[i,...D()]}],"list-image":[{"list-image":["none",isArbitraryVariable,isArbitraryValue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",isArbitraryVariable,isArbitraryValue]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[isNumber,"from-font","auto",isArbitraryVariable,isArbitraryLength]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[isNumber,"auto",isArbitraryVariable,isArbitraryValue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[isInteger,isArbitraryVariable,isArbitraryValue]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",isArbitraryVariable,isArbitraryValue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",isArbitraryVariable,isArbitraryValue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},isInteger,isArbitraryVariable,isArbitraryValue],radial:["",isArbitraryVariable,isArbitraryValue],conic:[isInteger,isArbitraryVariable,isArbitraryValue]},isArbitraryVariableImage,isArbitraryImage]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[isNumber,isArbitraryVariable,isArbitraryValue]}],"outline-w":[{outline:["",isNumber,isArbitraryVariableLength,isArbitraryLength]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",u,isArbitraryVariableShadow,isArbitraryShadow]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",d,isArbitraryVariableShadow,isArbitraryShadow]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[isNumber,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",h,isArbitraryVariableShadow,isArbitraryShadow]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[isNumber,isArbitraryVariable,isArbitraryValue]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[isNumber]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[isArbitraryVariable,isArbitraryValue]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":y()}],"mask-image-conic-pos":[{"mask-conic":[isNumber]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",isArbitraryVariable,isArbitraryValue]}],filter:[{filter:["","none",isArbitraryVariable,isArbitraryValue]}],blur:[{blur:V()}],brightness:[{brightness:[isNumber,isArbitraryVariable,isArbitraryValue]}],contrast:[{contrast:[isNumber,isArbitraryVariable,isArbitraryValue]}],"drop-shadow":[{"drop-shadow":["","none",p,isArbitraryVariableShadow,isArbitraryShadow]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",isNumber,isArbitraryVariable,isArbitraryValue]}],"hue-rotate":[{"hue-rotate":[isNumber,isArbitraryVariable,isArbitraryValue]}],invert:[{invert:["",isNumber,isArbitraryVariable,isArbitraryValue]}],saturate:[{saturate:[isNumber,isArbitraryVariable,isArbitraryValue]}],sepia:[{sepia:["",isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-filter":[{"backdrop-filter":["","none",isArbitraryVariable,isArbitraryValue]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-contrast":[{"backdrop-contrast":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-invert":[{"backdrop-invert":["",isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-opacity":[{"backdrop-opacity":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-saturate":[{"backdrop-saturate":[isNumber,isArbitraryVariable,isArbitraryValue]}],"backdrop-sepia":[{"backdrop-sepia":["",isNumber,isArbitraryVariable,isArbitraryValue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",isArbitraryVariable,isArbitraryValue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[isNumber,"initial",isArbitraryVariable,isArbitraryValue]}],ease:[{ease:["linear","initial",b,isArbitraryVariable,isArbitraryValue]}],delay:[{delay:[isNumber,isArbitraryVariable,isArbitraryValue]}],animate:[{animate:["none",v,isArbitraryVariable,isArbitraryValue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,isArbitraryVariable,isArbitraryValue]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:Y()}],"rotate-x":[{"rotate-x":Y()}],"rotate-y":[{"rotate-y":Y()}],"rotate-z":[{"rotate-z":Y()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:K()}],"skew-x":[{"skew-x":K()}],"skew-y":[{"skew-y":K()}],transform:[{transform:[isArbitraryVariable,isArbitraryValue,"","none","gpu","cpu"]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Q()}],"translate-x":[{"translate-x":Q()}],"translate-y":[{"translate-y":Q()}],"translate-z":[{"translate-z":Q()}],"translate-none":["translate-none"],zoom:[{zoom:[isInteger,isArbitraryVariable,isArbitraryValue]}],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",isArbitraryVariable,isArbitraryValue]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":O()}],"scrollbar-track-color":[{"scrollbar-track":O()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",isArbitraryVariable,isArbitraryValue]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[isNumber,isArbitraryVariableLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},mergeConfigs=(e,{cacheSize:t,prefix:r,experimentalParseClassName:n,extend:a={},override:i={}})=>(overrideProperty(e,"cacheSize",t),overrideProperty(e,"prefix",r),overrideProperty(e,"experimentalParseClassName",n),overrideConfigProperties(e.theme,i.theme),overrideConfigProperties(e.classGroups,i.classGroups),overrideConfigProperties(e.conflictingClassGroups,i.conflictingClassGroups),overrideConfigProperties(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),overrideProperty(e,"postfixLookupClassGroups",i.postfixLookupClassGroups),overrideProperty(e,"orderSensitiveModifiers",i.orderSensitiveModifiers),mergeConfigProperties(e.theme,a.theme),mergeConfigProperties(e.classGroups,a.classGroups),mergeConfigProperties(e.conflictingClassGroups,a.conflictingClassGroups),mergeConfigProperties(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),mergeArrayProperties(e,a,"postfixLookupClassGroups"),mergeArrayProperties(e,a,"orderSensitiveModifiers"),e),overrideProperty=(e,t,r)=>{void 0!==r&&(e[t]=r)},overrideConfigProperties=(e,t)=>{if(t)for(let r in t)overrideProperty(e,r,t[r])},mergeConfigProperties=(e,t)=>{if(t)for(let r in t)mergeArrayProperties(e,t,r)},mergeArrayProperties=(e,t,r)=>{let n=t[r];void 0!==n&&(e[r]=e[r]?e[r].concat(n):n)},extendTailwindMerge=(e,...t)=>"function"==typeof e?createTailwindMerge(getDefaultConfig,e,...t):createTailwindMerge(()=>mergeConfigs(getDefaultConfig(),e),...t),twMerge=/*#__PURE__*/createTailwindMerge(getDefaultConfig);function cn_cn(...e){return twMerge(clsx(e))}let areParamValuesEqual=(e,t)=>{let r=e??{},n=Object.keys(r),a=Object.keys(t);return n.length===a.length&&n.every(e=>Object.is(r[e],t[e]))},useChart=e=>{let{state:{globalID:t}}=useStore_useStore(),{Render:r,params:n,onIDChange:a}=e,i=external_react_useMemo(()=>createGUID(),[]),[o,l]=external_react_useState(null),[s,c]=external_react_useState(null),u=external_react_useRef(a),d=external_react_useRef(null),h=external_react_useRef(n);u.current=a,external_react_useEffect(()=>{if(!i||!t||!s)return void l(null);let e=new r({id:i,globalID:t,...n});return l(e),u.current?.(i),()=>{e.dispose?.()}},[r,s,t,i]);let p=external_react_useCallback(e=>{c(t=>t===e?t:e)},[]),f=external_react_useCallback(e=>/*#__PURE__*/jsx_runtime_jsx("div",{id:i,...e,ref:p,className:cn_cn("absolute right-0 top-0 z-[2] flex h-full w-full [&>canvas]:h-full [&>canvas]:w-full [&>canvas]:bg-transparent",e.className)}),[p,i]);return external_react_useEffect(()=>()=>{releaseChartsRuntimeOwners([i])},[i]),external_react_useEffect(()=>{if(o){let e=n??{};if(d.current!==o){d.current=o,h.current=e;return}areParamValuesEqual(h.current??{},e)||(h.current=e,o.updateParams(e))}},[n,o]),{id:i,chart:o,Chart:f}},hooks_useChart=useChart,passThrough=(e,t,r,n="0")=>createModuleSubscriptionManager(e,t,r,n),MODULE_RENDER_PSTYPE="render",MODULE_RESET_PSTYPE="reset",MODULE_RESIZE_PSTYPE="resize",DEFAULT_RENDER_PSTYPES=[MODULE_RENDER_PSTYPE],matchesRenderEvent=(e,t,r)=>void 0===e.pstype?r:t.includes(e.pstype),handleModuleSubscriptionEvent=(e,{chart:t,eventHandlers:r,extractData:n,handleRender:a,renderPSTypes:i=DEFAULT_RENDER_PSTYPES,treatMissingPSTypeAsRender:o=!1})=>{let{pstype:l}=e;if(l&&r?.[l])return void r[l]?.(e,t);if(l===MODULE_RESET_PSTYPE)return void t.reset();if(l===MODULE_RESIZE_PSTYPE)return void t.resize();if(!matchesRenderEvent(e,i,o))return;if(a)return void a(e,t);let s=n?n(e):e;t.updateSeries?.(s)};function useModuleSubscription({moduleType:e,chart:t,extractData:r,renderPSTypes:n,treatMissingPSTypeAsRender:a,handleRender:i,eventHandlers:o}){let{state:{globalID:l}}=useStore_useStore(),s=external_react_useRef(r),c=external_react_useRef(i),u=external_react_useRef(o),d=external_react_useRef(n),h=n?.join("|")??"__default_render__",p=t?.state?.id??`${e}-${h}`;s.current=r,c.current=i,u.current=o,d.current=n,external_react_useEffect(()=>{if(t&&l)return passThrough(l,e,e=>{handleModuleSubscriptionEvent(e,{chart:t,eventHandlers:u.current,extractData:s.current,handleRender:c.current,renderPSTypes:d.current,treatMissingPSTypeAsRender:a})},p)},[t,l,e,h,p,a])}let hooks_useModuleSubscription=null;class BaseRenderer{state;resizeTimer=null;resizeObserver=null;destroyed=!1;cleanupTasks=new Set;constructor(e){this.state=e,this.init(),this.observeContainerResize()}updateParams(e){this.state={...this.state,...e},this.onParamsUpdated(e)}onParamsUpdated(e){}reset(){this.resize(),this.clear()}resize(){this.state.chart?this.hasRenderableContainerSize()&&this.state.chart?.resize?.():this.initializeChartWhenReady()}clear(){this.state.chart?.clear?.()}destroy(){this.destroyed||(this.beforeDestroy(),this.clearResizeObserver(),this.clearResizeTimer(),this.disposeChartInstance(),this.destroyed=!0)}dispose(){this.destroy()}scheduleResize(e=0){this.clearResizeTimer(),this.resizeTimer=setTimeout(()=>{this.resize(),this.resizeTimer=null},e)}clearResizeTimer(){this.resizeTimer&&(clearTimeout(this.resizeTimer),this.resizeTimer=null)}trackCleanup(e){if(!e)return null;let t=!1,r=()=>{t||(t=!0,this.cleanupTasks.delete(r),e())};return this.cleanupTasks.add(r),r}getContainerElement(){return"u"<typeof document?null:document.getElementById(this.state.id)}getContainerSize(){let e=this.getContainerElement();return e?{width:e.clientWidth,height:e.clientHeight}:null}getMinimumContainerSize(){return{width:1,height:1}}hasRenderableContainerSize(){let e=this.getContainerSize();if(!e)return!1;let t=this.getMinimumContainerSize();return e.width>=t.width&&e.height>=t.height}observeContainerResize(){if("u"<typeof ResizeObserver)return;let e=this.getContainerElement();e&&(this.resizeObserver=new ResizeObserver(()=>{this.state.chart?this.resize():this.initializeChartWhenReady()}),this.resizeObserver.observe(e))}clearResizeObserver(){this.resizeObserver?.disconnect(),this.resizeObserver=null}runCleanupTasks(){let e=Array.from(this.cleanupTasks);for(let t of(this.cleanupTasks.clear(),e))t()}beforeDestroy(){this.runCleanupTasks()}disposeChartInstance(){this.state.chart?.dispose?.(),this.state.chart=null}initializeChartWhenReady(){!this.state.chart&&this.hasRenderableContainerSize()&&this.init()}}let theme_color_canUseDOM=()=>"u">typeof window&&"u">typeof document,resolveThemeTarget=e=>theme_color_canUseDOM()?e instanceof Element?e.closest(CHARTS_STYLE_SCOPE_SELECTOR)??e??document.documentElement:document.querySelector(CHARTS_STYLE_SCOPE_SELECTOR)??document.documentElement:null,getThemeComputedStyles=e=>{let t=resolveThemeTarget(e);return t?getComputedStyle(t):null},getThemePropertyValue=(e,t,r=[])=>{let n=getThemeComputedStyles(t);if(!n)return"";let a=n.getPropertyValue(e).trim();if(a)return a;for(let e of r){let t=n.getPropertyValue(e).trim();if(t)return t}return""},clampOpacity=e=>Math.min(1,Math.max(0,e)),parseHexColor=e=>{let t=e.replace("#","").trim();if(![3,4,6,8].includes(t.length))return null;let r=t.length<=4?t.split("").map(e=>e+e).join(""):t,n=8===r.length,a=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),o=Number.parseInt(r.slice(4,6),16),l=n?Number.parseInt(r.slice(6,8),16)/255:1;return[a,i,o,l].some(e=>Number.isNaN(e))?null:{r:a,g:i,b:o,alpha:l}},parseRgbColor=e=>{let t=e.trim().match(/^rgba?\(\s*([^)]+)\s*\)$/i);if(!t)return null;let[r,n,a,i="1"]=t[1].split(",").map(e=>e.trim()),o={r:Number.parseFloat(r),g:Number.parseFloat(n),b:Number.parseFloat(a),alpha:Number.parseFloat(i)};return Object.values(o).some(e=>Number.isNaN(e))?null:o},withAlpha=(e,t)=>{let r=clampOpacity(t),n=e.startsWith("#")?parseHexColor(e):null,a=n?null:parseRgbColor(e),i=n??a;return i?`rgba(${i.r}, ${i.g}, ${i.b}, ${Number((i.alpha*r).toFixed(4))})`:e},toOpaqueCssColor=e=>{let t=e.startsWith("#")?parseHexColor(e):null,r=t?null:parseRgbColor(e),n=t??r;return n?`rgb(${n.r}, ${n.g}, ${n.b})`:e};function getThemeFillStyle(e){let t=getThemePropertyValue("--foreground",e),r=getThemePropertyValue("--primary",e);return{fillStyle:withAlpha(t,176/255),fillStylePrimary:r,fillStyleTransparentBase:withAlpha(t,16/255)}}let getThemeColor=(e,t,r)=>{let n=getThemePropertyValue(e,r);return void 0!==t?withAlpha(n,t):n},resolveChartsThemeState=()=>{let e=readThemeContract(),t=e.followOS?getSystemTheme():e.theme;return{contractTheme:e.theme,followOS:e.followOS,preference:e.followOS?"system":e.theme,theme:t}};class ChartsThemeRuntime{listeners=new Set;mediaCleanup=null;rootAttributeObserver=null;lastStateKey=null;getStateKey=e=>[e.followOS,e.preference,e.theme,e.contractTheme].join(":");emit=e=>{for(let t of(this.lastStateKey=this.getStateKey(e),Array.from(this.listeners)))t(e)};emitIfChanged=e=>{this.getStateKey(e)!==this.lastStateKey&&this.emit(e)};teardownIfIdle=()=>{this.listeners.size>0||(this.mediaCleanup?.(),this.mediaCleanup=null,this.rootAttributeObserver?.disconnect(),this.rootAttributeObserver=null,this.lastStateKey=null)};ensureMediaSubscription=()=>{if(this.mediaCleanup||!canUseDOM())return;let e=getThemeMedia();if(!e)return;let t=()=>{readThemeContract().followOS&&this.emitIfChanged(resolveChartsThemeState())};e.addEventListener("change",t),this.mediaCleanup=()=>{e.removeEventListener("change",t)}};ensureRootAttributeSubscription=()=>{!this.rootAttributeObserver&&canUseDOM()&&(this.rootAttributeObserver=new MutationObserver(e=>{for(let t of e)if("attributes"===t.type&&("theme"===t.attributeName||t.attributeName===theme_contract_THEME_FOLLOW_OS_KEY)){this.emitIfChanged(resolveChartsThemeState());break}}),this.rootAttributeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["theme",theme_contract_THEME_FOLLOW_OS_KEY]}))};getState=()=>resolveChartsThemeState();subscribe=e=>{this.listeners.add(e),this.ensureMediaSubscription(),this.ensureRootAttributeSubscription();let t=this.getState();return this.lastStateKey=this.getStateKey(t),e(t),()=>{this.listeners.delete(e),this.teardownIfIdle()}};resetForTests=()=>{this.listeners.clear(),this.teardownIfIdle()}}let chartsThemeRuntime=new ChartsThemeRuntime,getChartsThemeState=()=>chartsThemeRuntime.getState(),subscribeChartsThemeChange=e=>chartsThemeRuntime.subscribe(e),resetChartsThemeRuntimeForTests=()=>{chartsThemeRuntime.resetForTests()};class CircularRenderer extends BaseRenderer{getMinimumContainerSize(){return{width:120,height:120}}subscribeToTheme(){this.trackCleanup(subscribeChartsThemeChange(()=>{let e=this.getContainerElement();if(!e)return;let t=getThemeFillStyle(e);this.state.chart?.updateProps?.(t),this.resize()}))}updateSeries(e){this.state.chart?.render?.(e)}}let TOOLBAR_SHELL_CLASS_NAME="relative flex h-10 w-full items-center justify-between pl-[var(--size-gap-base)] text-xs text-foreground",TOOLBAR_SHELL_STYLE={background:"linear-gradient(to bottom, color-mix(in srgb, var(--background) 100%, transparent), color-mix(in srgb, var(--background) 86%, transparent))",boxShadow:"0 1px 4px color-mix(in srgb, var(--border) 72%, transparent)"},TOOLBAR_ITEMS_CLASS_NAME="flex h-full items-center gap-[var(--size-gap-base)]",TOOLBAR_SEPARATOR_BASE_CLASS_NAME="self-center",TOOLBAR_SEPARATOR_CLASS_NAME=`${TOOLBAR_SEPARATOR_BASE_CLASS_NAME} h-[18px]`,TOOLBAR_GROUP_SEPARATOR_CLASS_NAME=`${TOOLBAR_SEPARATOR_BASE_CLASS_NAME} h-3.5`,TOOLBAR_SURFACE_CLASS_NAME="pointer-events-auto box-border rounded-[var(--radius-group)] bg-secondary text-inherit transition-[background-color,color,opacity] select-none",TOOLBAR_INTERACTIVE_SURFACE_CLASS_NAME="cursor-pointer appearance-none border-0 hover:bg-accent/72 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70 focus-visible:ring-offset-1 focus-visible:ring-offset-background",TOOLBAR_DISABLED_SURFACE_CLASS_NAME="cursor-not-allowed opacity-45 hover:bg-secondary",TOOLBAR_TONE_CLASS_NAME_MAP=null,TOOLBAR_ACTIVE_SURFACE_CLASS_NAME_MAP={default:"data-[active=true]:bg-accent/72 data-[active=true]:text-foreground data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[active=true]:hover:bg-accent/72",primary:"data-[active=true]:bg-accent/72 data-[active=true]:text-primary data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[active=true]:hover:bg-accent/72",warning:"data-[active=true]:bg-warning/10 data-[active=true]:text-warning data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--warning)_24%,transparent)] data-[active=true]:hover:bg-warning/12",destructive:"data-[active=true]:bg-destructive/10 data-[active=true]:text-destructive data-[active=true]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--destructive)_24%,transparent)] data-[active=true]:hover:bg-destructive/12"},TOOLBAR_ICON_TRIGGER_CLASS_NAME="inline-flex h-[26px] min-w-[26px] shrink-0 items-center justify-center",TOOLBAR_ICON_BOX_CLASS_NAME=`${TOOLBAR_SURFACE_CLASS_NAME} ${TOOLBAR_ICON_TRIGGER_CLASS_NAME} px-1 [&_svg]:size-4 [&_svg]:shrink-0 [&>span]:flex [&>span]:items-center [&>span]:justify-center`,TOOLBAR_OUTLINED_SHELL_CLASS_NAME="inline-flex h-[26px] shrink-0 items-stretch overflow-hidden rounded-[var(--radius-group)] border border-solid border-border/60 transition-colors",TOOLBAR_OUTLINED_TRIGGER_CLASS_NAME=`${TOOLBAR_OUTLINED_SHELL_CLASS_NAME} min-w-10 items-center justify-between gap-1 px-[calc(var(--size-gap-base)/2)] hover:bg-accent/72 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70 focus-visible:ring-offset-1 focus-visible:ring-offset-background`,TOOLBAR_OUTLINED_TRIGGER_OPEN_CLASS_NAME="data-[state=open]:bg-accent/72 data-[state=open]:text-foreground data-[state=open]:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--border)_72%,transparent)] data-[state=open]:hover:bg-accent/72",TOOLBAR_INLINE_TRIGGER_CLASS_NAME="inline-flex h-full min-h-0 min-w-0 items-center gap-1 p-0 text-inherit focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70 focus-visible:ring-offset-1 focus-visible:ring-offset-background",TOOLBAR_INLINE_INSET_CLASS_NAME="inline-flex h-full items-center px-[calc(var(--size-gap-base)/2)] text-primary hover:bg-accent/72 data-[state=open]:bg-accent/72 data-[state=open]:hover:bg-accent/72",TOOLBAR_GROUP_CHILD_CLASS_NAME="h-full rounded-none border-0 bg-transparent shadow-none",TOOLBAR_CONTENT_BOX_CLASS_NAME=`${TOOLBAR_SURFACE_CLASS_NAME} inline-flex h-[26px] min-w-[26px] shrink-0 items-center px-1`,TOOLBAR_CONTENT_BODY_CLASS_NAME="inline-flex h-[14px] min-w-0 items-center justify-center text-xs leading-none",TOOLBAR_CONTENT_ICON_CLASS_NAME="w-4 justify-center",TOOLBAR_CONTENT_VALUE_CLASS_NAME="min-w-8 justify-center text-center",TOOLBAR_CONTENT_GRADIENT_CLASS_NAME="w-[60px] justify-stretch",TOOLBAR_TRIGGER_ICON_CLASS_NAME="inline-flex h-full min-w-4 shrink-0 items-center justify-center text-primary",TOOLBAR_GLYPH_CLASS_NAME="inline-flex size-4 shrink-0 items-center justify-center [&_svg]:size-full [&_svg]:shrink-0",TOOLBAR_DROPDOWN_CONTENT_CLASS_NAME="border-border/80 bg-secondary/92 text-foreground shadow-[0_10px_28px_color-mix(in_srgb,var(--background)_60%,transparent)] backdrop-blur-xl";var __defProp=Object.defineProperty,__name=(e,t)=>__defProp(e,"name",{value:t,configurable:!0}),dist_canUseDOM=!!("u">typeof window&&window.document&&window.document.createElement);function dist_composeEventHandlers(e,t,{checkForDefaultPrevented:r=!0}={}){return /* @__PURE__ */__name(function(n){if(e?.(n),!1===r||!n||!n.defaultPrevented)return t?.(n)},"handleEvent")}function getOwnerWindow(e){if(!dist_canUseDOM)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}function getOwnerDocument(e){if(!dist_canUseDOM)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function getActiveElement(e,t=!1){let{activeElement:r}=getOwnerDocument(e);if(!r?.nodeName)return null;if(isFrame(r)&&r.contentDocument)return getActiveElement(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=getOwnerDocument(r).getElementById(e);if(t)return t}}return r}function isFrame(e){return"IFRAME"===e.tagName}__name(dist_composeEventHandlers,"composeEventHandlers"),__name(getOwnerWindow,"getOwnerWindow"),__name(getOwnerDocument,"getOwnerDocument"),__name(getActiveElement,"getActiveElement"),__name(isFrame,"isFrame");var dist_defProp=Object.defineProperty,dist_name=(e,t)=>dist_defProp(e,"name",{value:t,configurable:!0});function setRef(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function dist_composeRefs(...e){return t=>{let r=!1,n=e.map(e=>{let n=setRef(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():setRef(e[t],null)}}}}function dist_useComposedRefs(...e){return __rspack_external_react.useCallback(dist_composeRefs(...e),e)}dist_name(setRef,"setRef"),dist_name(dist_composeRefs,"composeRefs"),dist_name(dist_useComposedRefs,"useComposedRefs");var react_context_dist_defProp=Object.defineProperty,react_context_dist_name=(e,t)=>react_context_dist_defProp(e,"name",{value:t,configurable:!0});function createContext2(e,t){let r=__rspack_external_react.createContext(t);r.displayName=e+"Context";let n=/* @__PURE__ */react_context_dist_name(e=>{let{children:t,...n}=e,a=__rspack_external_react.useMemo(()=>n,Object.values(n));return /* @__PURE__ */jsx_runtime_jsx(r.Provider,{value:a,children:t})},"Provider");function a(n,i={}){let{optional:o=!1}=i,l=__rspack_external_react.useContext(r);if(l)return l;if(void 0!==t)return t;if(!o)throw Error(`\`${n}\` must be used within \`${e}\``)}return n.displayName=e+"Provider",react_context_dist_name(a,"useContext"),[n,a]}function createContextScope(e,t=[]){let r=[];function n(t,n){let a=__rspack_external_react.createContext(n);a.displayName=t+"Context";let i=r.length;r=[...r,n];let o=/* @__PURE__ */react_context_dist_name(t=>{let{scope:r,children:n,...o}=t,l=r?.[e]?.[i]||a,s=__rspack_external_react.useMemo(()=>o,Object.values(o));return /* @__PURE__ */jsx_runtime_jsx(l.Provider,{value:s,children:n})},"Provider");function l(r,o,s={}){let{optional:c=!1}=s,u=o?.[e]?.[i]||a,d=__rspack_external_react.useContext(u);if(d)return d;if(void 0!==n)return n;if(!c)throw Error(`\`${r}\` must be used within \`${t}\``)}return o.displayName=t+"Provider",react_context_dist_name(l,"useContext"),[o,l]}react_context_dist_name(n,"createContext");let a=/* @__PURE__ */react_context_dist_name(()=>{let t=r.map(e=>__rspack_external_react.createContext(e));return /* @__PURE__ */react_context_dist_name(function(r){let n=r?.[e]||t;return __rspack_external_react.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])},"useScope")},"createScope");return a.scopeName=e,[n,composeContextScopes(a,...t)]}function composeContextScopes(...e){let t=e[0];if(1===e.length)return t;let r=/* @__PURE__ */react_context_dist_name(()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return /* @__PURE__ */react_context_dist_name(function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let a=r(e)[`__scope${n}`];return{...t,...a}},{});return __rspack_external_react.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}react_context_dist_name(createContext2,"createContext"),react_context_dist_name(createContextScope,"createContextScope"),react_context_dist_name(composeContextScopes,"composeContextScopes");var IS_DEVELOPMENT=!1,useLayoutEffect2=globalThis?.document?__rspack_external_react.useLayoutEffect:()=>{},react_use_effect_event_dist_defProp=Object.defineProperty,react_use_effect_event_dist_name=(e,t)=>react_use_effect_event_dist_defProp(e,"name",{value:t,configurable:!0}),useReactEffectEvent=__rspack_external_react[" useEffectEvent ".trim().toString()],useReactInsertionEffect=__rspack_external_react[" useInsertionEffect ".trim().toString()];function useEffectEvent(e){if("function"==typeof useReactEffectEvent)return useReactEffectEvent(e);let t=__rspack_external_react.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});return"function"==typeof useReactInsertionEffect?useReactInsertionEffect(()=>{t.current=e}):useLayoutEffect2(()=>{t.current=e}),__rspack_external_react.useMemo(()=>(...e)=>t.current?.(...e),[])}react_use_effect_event_dist_name(useEffectEvent,"useEffectEvent");var react_use_controllable_state_dist_defProp=Object.defineProperty,react_use_controllable_state_dist_name=(e,t)=>react_use_controllable_state_dist_defProp(e,"name",{value:t,configurable:!0}),useInsertionEffect=__rspack_external_react[" useInsertionEffect ".trim().toString()]||useLayoutEffect2;function dist_useControllableState({prop:e,defaultProp:t,onChange:r=/* @__PURE__ */react_use_controllable_state_dist_name(()=>{},"onChange"),caller:n}){let[a,i,o]=useUncontrolledState({defaultProp:t,onChange:r}),l=void 0!==e,s=l?e:a;if(IS_DEVELOPMENT){let t=__rspack_external_react.useRef(void 0!==e);__rspack_external_react.useEffect(()=>{let e=t.current;if(e!==l){let t=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=l},[l,n])}return[s,__rspack_external_react.useCallback(t=>{if(l){let r=isFunction(t)?t(e):t;r!==e&&o.current?.(r)}else i(t)},[l,e,i,o])]}function useUncontrolledState({defaultProp:e,onChange:t}){let[r,n]=__rspack_external_react.useState(e),a=__rspack_external_react.useRef(r),i=__rspack_external_react.useRef(t);return useInsertionEffect(()=>{i.current=t},[t]),__rspack_external_react.useEffect(()=>{a.current!==r&&(i.current?.(r),a.current=r)},[r,a]),[r,n,i]}function isFunction(e){return"function"==typeof e}react_use_controllable_state_dist_name(dist_useControllableState,"useControllableState"),react_use_controllable_state_dist_name(useUncontrolledState,"useUncontrolledState"),react_use_controllable_state_dist_name(isFunction,"isFunction");var SYNC_STATE=Symbol("RADIX:SYNC_STATE");function useControllableStateReducer(e,t,r,n){let{prop:a,defaultProp:i,onChange:o,caller:l}=t,s=void 0!==a,c=useEffectEvent(o);if(IS_DEVELOPMENT){let e=__rspack_external_react.useRef(void 0!==a);__rspack_external_react.useEffect(()=>{let t=e.current;if(t!==s){let e=s?"controlled":"uncontrolled";console.warn(`${l} is changing from ${t?"controlled":"uncontrolled"} to ${e}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}e.current=s},[s,l])}let u=[{...r,state:i}];n&&u.push(n);let[d,h]=__rspack_external_react.useReducer((t,r)=>{if(r.type===SYNC_STATE)return{...t,state:r.state};let n=e(t,r);return s&&!Object.is(n.state,t.state)&&c(n.state),n},...u),p=d.state,f=__rspack_external_react.useRef(p);__rspack_external_react.useEffect(()=>{f.current!==p&&(f.current=p,s||c(p))},[p,f,s]);let m=__rspack_external_react.useMemo(()=>void 0!==a?{...d,state:a}:d,[d,a]);return __rspack_external_react.useEffect(()=>{s&&!Object.is(a,d.state)&&h({type:SYNC_STATE,state:a})},[a,d.state,s]),[m,h]}react_use_controllable_state_dist_name(useControllableStateReducer,"useControllableStateReducer");var react_slot_dist_defProp=Object.defineProperty,react_slot_dist_name=(e,t)=>react_slot_dist_defProp(e,"name",{value:t,configurable:!0});function createSlot(e){let t=__rspack_external_react.forwardRef((t,r)=>{let{children:n,...a}=t,i=null,o=!1,l=[];isLazyComponent(n)&&"function"==typeof use&&(n=use(n._payload)),__rspack_external_react.Children.forEach(n,e=>{if(isSlottable(e)){o=!0;let t="child"in e.props?e.props.child:e.props.children;isLazyComponent(t)&&"function"==typeof use&&(t=use(t._payload)),i=getSlottableElementFromSlottable(e,t),l.push(i?.props?.children)}else l.push(e)}),i?i=__rspack_external_react.cloneElement(i,void 0,l):!o&&1===__rspack_external_react.Children.count(n)&&__rspack_external_react.isValidElement(n)&&(i=n);let s=i?getElementRef(i):void 0,c=dist_useComposedRefs(r,s);if(!i){if(n||0===n)throw Error(o?createSlottableError(e):createSlotError(e));return n}let u=mergeProps(a,i.props??{});return i.type!==__rspack_external_react.Fragment&&(u.ref=r?c:s),__rspack_external_react.cloneElement(i,u)});return t.displayName=`${e}.Slot`,t}react_slot_dist_name(createSlot,"createSlot");var dist_Slot=/* @__PURE__ */null,SLOTTABLE_IDENTIFIER=Symbol.for("radix.slottable");function createSlottable(e){let t=/* @__PURE__ */react_slot_dist_name(e=>"child"in e?e.children(e.child):e.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=SLOTTABLE_IDENTIFIER,t}react_slot_dist_name(createSlottable,"createSlottable");var Slottable=/* @__PURE__ */null,getSlottableElementFromSlottable=/* @__PURE__ */react_slot_dist_name((e,t)=>{if("child"in e.props){let t=e.props.child;return __rspack_external_react.isValidElement(t)?__rspack_external_react.cloneElement(t,void 0,e.props.children(t.props.children)):null}return __rspack_external_react.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function mergeProps(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function getElementRef(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(r=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}function isSlottable(e){return __rspack_external_react.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===SLOTTABLE_IDENTIFIER}react_slot_dist_name(mergeProps,"mergeProps"),react_slot_dist_name(getElementRef,"getElementRef"),react_slot_dist_name(isSlottable,"isSlottable");var REACT_LAZY_TYPE=Symbol.for("react.lazy");function isLazyComponent(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===REACT_LAZY_TYPE&&"_payload"in e&&isPromiseLike(e._payload)}function isPromiseLike(e){return"object"==typeof e&&null!==e&&"then"in e}react_slot_dist_name(isLazyComponent,"isLazyComponent"),react_slot_dist_name(isPromiseLike,"isPromiseLike");var createSlotError=/* @__PURE__ */react_slot_dist_name(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),createSlottableError=/* @__PURE__ */react_slot_dist_name(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),use=__rspack_external_react[" use ".trim().toString()],react_primitive_dist_defProp=Object.defineProperty,react_primitive_dist_name=(e,t)=>react_primitive_dist_defProp(e,"name",{value:t,configurable:!0}),NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dist_Primitive=NODES.reduce((e,t)=>{let r=createSlot(`Primitive.${t}`),n=__rspack_external_react.forwardRef((e,n)=>{let{asChild:a,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),/* @__PURE__ */jsx_runtime_jsx(a?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function dispatchDiscreteCustomEvent(e,t){e&&__rspack_external_react_dom_20ef40a6.flushSync(()=>e.dispatchEvent(t))}react_primitive_dist_name(dispatchDiscreteCustomEvent,"dispatchDiscreteCustomEvent");var Root=null,react_collection_dist_defProp=Object.defineProperty,react_collection_dist_name=(e,t)=>react_collection_dist_defProp(e,"name",{value:t,configurable:!0});function createCollection(e){let t=e+"CollectionProvider",[r,n]=createContextScope(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:/* @__PURE__ */new Map}),o=/* @__PURE__ */react_collection_dist_name(e=>{let{scope:t,children:r}=e,n=__rspack_external_react.useRef(null);return /* @__PURE__ */jsx_runtime_jsx(a,{scope:t,itemMap:__rspack_external_react.useRef(/* @__PURE__ */new Map).current,collectionRef:n,children:r})},"CollectionProvider");o.displayName=t;let l=e+"CollectionSlot",s=createSlot(l),c=__rspack_external_react.forwardRef((e,t)=>{let{scope:r,children:n}=e;return /* @__PURE__ */jsx_runtime_jsx(s,{ref:dist_useComposedRefs(t,i(l,r).collectionRef),children:n})});c.displayName=l;let u=e+"CollectionItemSlot",d="data-radix-collection-item",h=createSlot(u),p=__rspack_external_react.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,o=__rspack_external_react.useRef(null),l=dist_useComposedRefs(t,o),s=i(u,r);return __rspack_external_react.useEffect(()=>(s.itemMap.set(o,{ref:o,...a}),()=>void s.itemMap.delete(o))),/* @__PURE__ */jsx_runtime_jsx(h,{...{[d]:""},ref:l,children:n})});function f(t){let r=i(e+"CollectionConsumer",t);return __rspack_external_react.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])}return p.displayName=u,react_collection_dist_name(f,"useCollection"),[{Provider:o,Slot:c,ItemSlot:p},f,n]}react_collection_dist_name(createCollection,"createCollection");var __instanciated=/* @__PURE__ */new WeakMap,OrderedDict=class _OrderedDict extends Map{static{react_collection_dist_name(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],__instanciated.set(this,!0)}set(e,t){return __instanciated.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),i=this.#e.length,o=toSafeInteger(e),l=o>=0?o:i+o,s=l<0||l>=i?-1:l;if(s===this.size||a&&s===this.size-1||-1===s)return this.set(t,r),this;let c=this.size+ +!a;o<0&&l++;let u=[...this.#e],d=!1;for(let e=l;e<c;e++)if(l===e){let i=u[e];u[e]===t&&(i=u[e+1]),a&&this.delete(t),n=this.get(i),this.set(t,r)}else{d||u[e-1]!==t||(d=!0);let r=u[d?e:e-1],a=n;n=this.get(r),this.delete(r),this.set(r,a)}return this}with(e,t,r){let n=new _OrderedDict(this);return n.insert(e,t,r),n}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=at(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=at(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return at(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(e,t){let r=[],n=0;for(let a of this)Reflect.apply(e,t,[a,n,this])&&r.push(a),n++;return new _OrderedDict(r)}map(e,t){let r=[],n=0;for(let a of this)r.push([a[0],Reflect.apply(e,t,[a,n,this])]),n++;return new _OrderedDict(r)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(e){return new _OrderedDict([...this.entries()].sort(e))}toReversed(){let e=new _OrderedDict;for(let t=this.size-1;t>=0;t--){let r=this.keyAt(t),n=this.get(r);e.set(r,n)}return e}toSpliced(...e){let t=[...this.entries()];return t.splice(...e),new _OrderedDict(t)}slice(e,t){let r=new _OrderedDict,n=this.size-1;if(void 0===e)return r;e<0&&(e+=this.size),void 0!==t&&t>0&&(n=t-1);for(let t=e;t<=n;t++){let e=this.keyAt(t),n=this.get(e);r.set(e,n)}return r}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}};function at(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let r=toSafeIndex(e,t);return -1===r?void 0:e[r]}function toSafeIndex(e,t){let r=e.length,n=toSafeInteger(t),a=n>=0?n:r+n;return a<0||a>=r?-1:a}function toSafeInteger(e){return e!=e||0===e?0:Math.trunc(e)}function createCollection2(e){let t=e+"CollectionProvider",[r,n]=createContextScope(t),[a,i]=r(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new OrderedDict,setItemMap:/* @__PURE__ */react_collection_dist_name(()=>void 0,"setItemMap")}),o=/* @__PURE__ */react_collection_dist_name(({state:e,...t})=>e?/* @__PURE__ */jsx_runtime_jsx(s,{...t,state:e}):/* @__PURE__ */jsx_runtime_jsx(l,{...t}),"CollectionProvider");o.displayName=t;let l=/* @__PURE__ */react_collection_dist_name(e=>{let t=m();return /* @__PURE__ */jsx_runtime_jsx(s,{...e,state:t})},"CollectionInit");l.displayName=t+"Init";let s=/* @__PURE__ */react_collection_dist_name(e=>{let{scope:t,children:r,state:n}=e,i=__rspack_external_react.useRef(null),[o,l]=__rspack_external_react.useState(null),s=dist_useComposedRefs(i,l),[c,u]=n;return __rspack_external_react.useEffect(()=>{if(!o)return;let e=getChildListObserver(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),/* @__PURE__ */jsx_runtime_jsx(a,{scope:t,itemMap:c,setItemMap:u,collectionRef:s,collectionRefObject:i,collectionElement:o,children:r})},"CollectionProviderImpl");s.displayName=t+"Impl";let c=e+"CollectionSlot",u=createSlot(c),d=__rspack_external_react.forwardRef((e,t)=>{let{scope:r,children:n}=e;return /* @__PURE__ */jsx_runtime_jsx(u,{ref:dist_useComposedRefs(t,i(c,r).collectionRef),children:n})});d.displayName=c;let h=e+"CollectionItemSlot",p=createSlot(h),f=__rspack_external_react.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,o=__rspack_external_react.useRef(null),[l,s]=__rspack_external_react.useState(null),c=dist_useComposedRefs(t,o,s),{setItemMap:u}=i(h,r),d=__rspack_external_react.useRef(a);shallowEqual(d.current,a)||(d.current=a);let f=d.current;return __rspack_external_react.useEffect(()=>(u(e=>l?e.has(l)?e.set(l,{...f,element:l}).toSorted(sortByDocumentPosition):(e.set(l,{...f,element:l}),e.toSorted(sortByDocumentPosition)):e),()=>{u(e=>l&&e.has(l)?(e.delete(l),new OrderedDict(e)):e)}),[l,f,u]),/* @__PURE__ */jsx_runtime_jsx(p,{"data-radix-collection-item":"",ref:c,children:n})});function m(){return __rspack_external_react.useState(new OrderedDict)}function g(t){let{itemMap:r}=i(e+"CollectionConsumer",t);return r}return f.displayName=h,react_collection_dist_name(m,"useInitCollection"),react_collection_dist_name(g,"useCollection"),[{Provider:o,Slot:d,ItemSlot:f},{createCollectionScope:n,useCollection:g,useInitCollection:m}]}function shallowEqual(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null==e||null==t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||e[n]!==t[n])return!1;return!0}function isElementPreceding(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function sortByDocumentPosition(e,t){return e[1].element&&t[1].element?isElementPreceding(e[1].element,t[1].element)?-1:1:0}function getChildListObserver(e){return new MutationObserver(t=>{for(let r of t)if("childList"===r.type)return void e()})}react_collection_dist_name(at,"at"),react_collection_dist_name(toSafeIndex,"toSafeIndex"),react_collection_dist_name(toSafeInteger,"toSafeInteger"),react_collection_dist_name(createCollection2,"createCollection"),react_collection_dist_name(shallowEqual,"shallowEqual"),react_collection_dist_name(isElementPreceding,"isElementPreceding"),react_collection_dist_name(sortByDocumentPosition,"sortByDocumentPosition"),react_collection_dist_name(getChildListObserver,"getChildListObserver");var react_direction_dist_defProp=Object.defineProperty,react_direction_dist_name=(e,t)=>react_direction_dist_defProp(e,"name",{value:t,configurable:!0}),DirectionContext=__rspack_external_react.createContext(void 0),DirectionProvider=/* @__PURE__ */null;function useDirection(e){let t=__rspack_external_react.useContext(DirectionContext);return e||t||"ltr"}react_direction_dist_name(useDirection,"useDirection");var dist_Provider=null,react_use_callback_ref_dist_defProp=Object.defineProperty,react_use_callback_ref_dist_name=(e,t)=>react_use_callback_ref_dist_defProp(e,"name",{value:t,configurable:!0});function dist_useCallbackRef(e){let t=__rspack_external_react.useRef(e);return __rspack_external_react.useEffect(()=>{t.current=e}),__rspack_external_react.useMemo(()=>(...e)=>t.current?.(...e),[])}react_use_callback_ref_dist_name(dist_useCallbackRef,"useCallbackRef");var react_dismissable_layer_dist_defProp=Object.defineProperty,react_dismissable_layer_dist_name=(e,t)=>react_dismissable_layer_dist_defProp(e,"name",{value:t,configurable:!0}),CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",DismissableLayerContext=__rspack_external_react.createContext({layers:/* @__PURE__ */new Set,layersWithOutsidePointerEventsDisabled:/* @__PURE__ */new Set,branches:/* @__PURE__ */new Set,dismissableSurfaces:/* @__PURE__ */new Set}),DismissableLayer=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dismissable_layer_dist_name(function(e,t){let{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:n=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:s,...c}=e,u=__rspack_external_react.useContext(DismissableLayerContext),[d,h]=__rspack_external_react.useState(null),p=d?.ownerDocument??globalThis?.document,[,f]=__rspack_external_react.useState({}),m=dist_useComposedRefs(t,h),g=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b?g.indexOf(b):-1,w=d?g.indexOf(d):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,x=w>=v,k=__rspack_external_react.useRef(!1),S=usePointerDownOutside(e=>{i?.(e),l?.(e),e.defaultPrevented||s?.()},{ownerDocument:p,deferPointerDownOutside:n,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:__rspack_external_react.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),D=useFocusOutside(e=>{if(n&&k.current)return;let t=e.target;![...u.branches].some(e=>e.contains(t))&&(o?.(e),l?.(e),e.defaultPrevented||s?.())},p),M=!!d&&w===g.length-1,F=dist_useCallbackRef(e=>{"Escape"===e.key&&(a?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))});return __rspack_external_react.useEffect(()=>{if(M)return p.addEventListener("keydown",F,{capture:!0}),()=>p.removeEventListener("keydown",F,{capture:!0})},[p,M,F]),__rspack_external_react.useEffect(()=>{if(d)return r&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(originalBodyPointerEvents=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),dispatchUpdate(),()=>{r&&(u.layersWithOutsidePointerEventsDisabled.delete(d),0===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=originalBodyPointerEvents))}},[d,p,r,u]),__rspack_external_react.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),dispatchUpdate())},[d,u]),__rspack_external_react.useEffect(()=>{let e=/* @__PURE__ */react_dismissable_layer_dist_name(()=>f({}),"handleUpdate");return document.addEventListener(CONTEXT_UPDATE,e),()=>document.removeEventListener(CONTEXT_UPDATE,e)},[]),/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{...c,ref:m,style:{pointerEvents:y?x?"auto":"none":void 0,...e.style},onFocusCapture:dist_composeEventHandlers(e.onFocusCapture,D.onFocusCapture),onBlurCapture:dist_composeEventHandlers(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:dist_composeEventHandlers(e.onPointerDownCapture,S.onPointerDownCapture)})},"DismissableLayer")),DismissableLayerBranch=/* @__PURE__ */null;function useDismissableLayerSurface(){let e=__rspack_external_react.useContext(DismissableLayerContext),[t,r]=__rspack_external_react.useState(null);return __rspack_external_react.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}react_dismissable_layer_dist_name(useDismissableLayerSurface,"useDismissableLayerSurface");var IS_TRUE=/* @__PURE__ */react_dismissable_layer_dist_name(()=>!0,"IS_TRUE");function usePointerDownOutside(e,t){let{ownerDocument:r=globalThis?.document,deferPointerDownOutside:n=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=IS_TRUE}=t,l=dist_useCallbackRef(e),s=__rspack_external_react.useRef(!1),c=__rspack_external_react.useRef(!1),u=__rspack_external_react.useRef(/* @__PURE__ */new Map),d=__rspack_external_react.useRef(()=>{});return __rspack_external_react.useEffect(()=>{function e(){c.current=!1,a.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function h(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...i].some(e=>e.contains(t))||u.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{c.current&&d.current()},0)}function p(e){c.current&&u.current.set(e.type,!1)}react_dismissable_layer_dist_name(e,"resetOutsideInteraction"),react_dismissable_layer_dist_name(t,"isOutsideInteractionIntercepted"),react_dismissable_layer_dist_name(h,"handleInteractionCapture"),react_dismissable_layer_dist_name(p,"handleInteractionBubble");let f=/* @__PURE__ */react_dismissable_layer_dist_name(i=>{if(i.target&&!s.current){let h=function(){r.removeEventListener("click",d.current);let n=t();e(),n||handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,l,p,{discrete:!0})};if(react_dismissable_layer_dist_name(h,"handleAndDispatchPointerDownOutsideEvent"),!o(i.target)){r.removeEventListener("click",d.current),e(),s.current=!1;return}let p={originalEvent:i};c.current=!0,a.current=n&&0===i.button,u.current.clear(),n&&0===i.button?(r.removeEventListener("click",d.current),d.current=h,r.addEventListener("click",d.current,{once:!0})):h()}else r.removeEventListener("click",d.current),e();s.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let e of m)r.addEventListener(e,h,!0),r.addEventListener(e,p);let g=window.setTimeout(()=>{r.addEventListener("pointerdown",f)},0);return()=>{for(let e of(window.clearTimeout(g),r.removeEventListener("pointerdown",f),r.removeEventListener("click",d.current),m))r.removeEventListener(e,h,!0),r.removeEventListener(e,p)}},[r,l,n,a,i,o]),{onPointerDownCapture:/* @__PURE__ */react_dismissable_layer_dist_name(()=>s.current=!0,"onPointerDownCapture")}}function useFocusOutside(e,t=globalThis?.document){let r=dist_useCallbackRef(e),n=__rspack_external_react.useRef(!1);return __rspack_external_react.useEffect(()=>{let e=/* @__PURE__ */react_dismissable_layer_dist_name(e=>{e.target&&!n.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,r,{originalEvent:e},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:/* @__PURE__ */react_dismissable_layer_dist_name(()=>n.current=!0,"onFocusCapture"),onBlurCapture:/* @__PURE__ */react_dismissable_layer_dist_name(()=>n.current=!1,"onBlurCapture")}}function dispatchUpdate(){let e=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(e)}function handleAndDispatchCustomEvent(e,t,r,{discrete:n}){let a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?dispatchDiscreteCustomEvent(a,i):a.dispatchEvent(i)}react_dismissable_layer_dist_name(usePointerDownOutside,"usePointerDownOutside"),react_dismissable_layer_dist_name(useFocusOutside,"useFocusOutside"),react_dismissable_layer_dist_name(dispatchUpdate,"dispatchUpdate"),react_dismissable_layer_dist_name(handleAndDispatchCustomEvent,"handleAndDispatchCustomEvent");var dist_Root=null,Branch=null,react_focus_guards_dist_defProp=Object.defineProperty,react_focus_guards_dist_name=(e,t)=>react_focus_guards_dist_defProp(e,"name",{value:t,configurable:!0}),dist_count=0,guards=null;function FocusGuards(e){return useFocusGuards(),e.children}function useFocusGuards(){__rspack_external_react.useEffect(()=>{guards||(guards={start:createFocusGuard(),end:createFocusGuard()});let{start:e,end:t}=guards;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),dist_count++,()=>{1===dist_count&&(guards?.start.remove(),guards?.end.remove(),guards=null),dist_count=Math.max(0,dist_count-1)}},[])}function createFocusGuard(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}react_focus_guards_dist_name(FocusGuards,"FocusGuards"),react_focus_guards_dist_name(useFocusGuards,"useFocusGuards"),react_focus_guards_dist_name(createFocusGuard,"createFocusGuard");var react_focus_scope_dist_defProp=Object.defineProperty,react_focus_scope_dist_name=(e,t)=>react_focus_scope_dist_defProp(e,"name",{value:t,configurable:!0}),AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS={bubbles:!1,cancelable:!0},FocusScope=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_focus_scope_dist_name(function(e,t){let{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,s]=__rspack_external_react.useState(null),c=dist_useCallbackRef(a),u=dist_useCallbackRef(i),d=__rspack_external_react.useRef(null),h=dist_useComposedRefs(t,s),p=__rspack_external_react.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;__rspack_external_react.useEffect(()=>{if(n){let e=function(e){if(p.paused||!l)return;let t=e.target;l.contains(t)?d.current=t:dist_focus(d.current,{select:!0})},t=function(e){if(p.paused||!l)return;let t=e.relatedTarget;null!==t&&(l.contains(t)||dist_focus(d.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&dist_focus(l)};react_focus_scope_dist_name(e,"handleFocusIn"),react_focus_scope_dist_name(t,"handleFocusOut"),react_focus_scope_dist_name(r,"handleMutations"),document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[n,l,p.paused]),__rspack_external_react.useEffect(()=>{if(l){focusScopesStack.add(p);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS);l.addEventListener(AUTOFOCUS_ON_MOUNT,c),l.dispatchEvent(t),t.defaultPrevented||(focusFirst(removeLinks(getTabbableCandidates(l)),{select:!0}),document.activeElement===e&&dist_focus(l))}return()=>{l.removeEventListener(AUTOFOCUS_ON_MOUNT,c),setTimeout(()=>{let t=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS);l.addEventListener(AUTOFOCUS_ON_UNMOUNT,u),l.dispatchEvent(t),t.defaultPrevented||dist_focus(e??document.body,{select:!0}),l.removeEventListener(AUTOFOCUS_ON_UNMOUNT,u),focusScopesStack.remove(p)},0)}}},[l,c,u,p]);let f=__rspack_external_react.useCallback(e=>{if(!r&&!n||p.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){let t=e.currentTarget,[n,i]=getTabbableEdges(t);n&&i?e.shiftKey||a!==i?e.shiftKey&&a===n&&(e.preventDefault(),r&&dist_focus(i,{select:!0})):(e.preventDefault(),r&&dist_focus(n,{select:!0})):a===t&&e.preventDefault()}},[r,n,p.paused]);return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{tabIndex:-1,...o,ref:h,onKeyDown:f})},"FocusScope"));function focusFirst(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(dist_focus(n,{select:t}),document.activeElement!==r)return}function getTabbableEdges(e){let t=getTabbableCandidates(e);return[findVisible(t,e),findVisible(t.reverse(),e)]}function getTabbableCandidates(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:/* @__PURE__ */react_focus_scope_dist_name(e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)t.push(r.currentNode);return t}function findVisible(e,t){let r="function"==typeof t.checkVisibility&&t.checkVisibility({checkVisibilityCSS:!0});for(let n of e)if(!(r?!n.checkVisibility({checkVisibilityCSS:!0}):isHidden(n,{upTo:t})))return n}function isHidden(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function isSelectableInput(e){return e instanceof HTMLInputElement&&"select"in e}function dist_focus(e,{select:t=!1}={}){if(e&&e.focus){let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&isSelectableInput(e)&&t&&e.select()}}react_focus_scope_dist_name(focusFirst,"focusFirst"),react_focus_scope_dist_name(getTabbableEdges,"getTabbableEdges"),react_focus_scope_dist_name(getTabbableCandidates,"getTabbableCandidates"),react_focus_scope_dist_name(findVisible,"findVisible"),react_focus_scope_dist_name(isHidden,"isHidden"),react_focus_scope_dist_name(isSelectableInput,"isSelectableInput"),react_focus_scope_dist_name(dist_focus,"focus");var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let e=[];return{add(t){let r=e[0];t!==r&&r?.pause(),(e=arrayRemove(e,t)).unshift(t)},remove(t){e=arrayRemove(e,t),e[0]?.resume()}}}function arrayRemove(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}function removeLinks(e){return e.filter(e=>"A"!==e.tagName)}react_focus_scope_dist_name(createFocusScopesStack,"createFocusScopesStack"),react_focus_scope_dist_name(arrayRemove,"arrayRemove"),react_focus_scope_dist_name(removeLinks,"removeLinks");var react_focus_scope_dist_Root=null;let floating_ui_utils_sides=["top","right","bottom","left"],alignments=null,floating_ui_utils_placements=/*#__PURE__*/null,floating_ui_utils_min=Math.min,floating_ui_utils_max=Math.max,round=Math.round,floor=Math.floor,createCoords=e=>({x:e,y:e}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"};function clamp(e,t,r){return floating_ui_utils_max(e,floating_ui_utils_min(t,r))}function floating_ui_utils_evaluate(e,t){return"function"==typeof e?e(t):e}function floating_ui_utils_getSide(e){return e.split("-")[0]}function floating_ui_utils_getAlignment(e){return e.split("-")[1]}function getOppositeAxis(e){return"x"===e?"y":"x"}function getAxisLength(e){return"y"===e?"height":"width"}function floating_ui_utils_getSideAxis(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function getAlignmentAxis(e){return getOppositeAxis(floating_ui_utils_getSideAxis(e))}function floating_ui_utils_getAlignmentSides(e,t,r){void 0===r&&(r=!1);let n=floating_ui_utils_getAlignment(e),a=getAlignmentAxis(e),i=getAxisLength(a),o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=getOppositePlacement(o)),[o,getOppositePlacement(o)]}function getExpandedPlacements(e){let t=getOppositePlacement(e);return[floating_ui_utils_getOppositeAlignmentPlacement(e),t,floating_ui_utils_getOppositeAlignmentPlacement(t)]}function floating_ui_utils_getOppositeAlignmentPlacement(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let lrPlacement=["left","right"],rlPlacement=["right","left"],tbPlacement=["top","bottom"],btPlacement=["bottom","top"];function getSideList(e,t,r){switch(e){case"top":case"bottom":if(r)return t?rlPlacement:lrPlacement;return t?lrPlacement:rlPlacement;case"left":case"right":return t?tbPlacement:btPlacement;default:return[]}}function getOppositeAxisPlacements(e,t,r,n){let a=floating_ui_utils_getAlignment(e),i=getSideList(floating_ui_utils_getSide(e),"start"===r,n);return a&&(i=i.map(e=>e+"-"+a),t&&(i=i.concat(i.map(floating_ui_utils_getOppositeAlignmentPlacement)))),i}function getOppositePlacement(e){let t=floating_ui_utils_getSide(e);return oppositeSideMap[t]+e.slice(t.length)}function expandPaddingObject(e){var t,r,n,a;return{top:null!=(t=e.top)?t:0,right:null!=(r=e.right)?r:0,bottom:null!=(n=e.bottom)?n:0,left:null!=(a=e.left)?a:0}}function floating_ui_utils_getPaddingObject(e){return"number"!=typeof e?expandPaddingObject(e):{top:e,right:e,bottom:e,left:e}}function floating_ui_utils_rectToClientRect(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function computeCoordsFromPlacement(e,t,r){let n,{reference:a,floating:i}=e,o=floating_ui_utils_getSideAxis(t),l=getAlignmentAxis(t),s=getAxisLength(l),c=floating_ui_utils_getSide(t),u=a.x+a.width/2-i.width/2,d=a.y+a.height/2-i.height/2,h=a[s]/2-i[s]/2;switch(c){case"top":n={x:u,y:a.y-i.height};break;case"bottom":n={x:u,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:d};break;case"left":n={x:a.x-i.width,y:d};break;default:n={x:a.x,y:a.y}}let p=floating_ui_utils_getAlignment(t);return p&&(n[l]+=h*("end"===p?1:-1)*(r&&"y"===o?-1:1)),n}async function detectOverflow(e,t){var r;void 0===t&&(t={});let{x:n,y:a,platform:i,rects:o,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=floating_ui_utils_evaluate(t,e),f=floating_ui_utils_getPaddingObject(p),m=l[h?"floating"===d?"reference":"floating":d],g=floating_ui_utils_rectToClientRect(await i.getClippingRect({element:null==(r=await (null==i.isElement?void 0:i.isElement(m)))||r?m:m.contextElement||await (null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:s})),b="floating"===d?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,v=await (null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),w=await (null==i.isElement?void 0:i.isElement(v))&&await (null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},y=floating_ui_utils_rectToClientRect(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:v,strategy:s}):b);return{top:(g.top-y.top+f.top)/w.y,bottom:(y.bottom-g.bottom+f.bottom)/w.y,left:(g.left-y.left+f.left)/w.x,right:(y.right-g.right+f.right)/w.x}}let MAX_RESET_COUNT=50,computePosition=async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:i=[],platform:o}=r,l=o.detectOverflow?o:{...o,detectOverflow:detectOverflow},s=await (null==o.isRTL?void 0:o.isRTL(t)),c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:d}=computeCoordsFromPlacement(c,n,s),h=n,p=0,f={};for(let r=0;r<i.length;r++){let m=i[r];if(!m)continue;let{name:g,fn:b}=m,{x:v,y:w,data:y,reset:x}=await b({x:u,y:d,initialPlacement:n,placement:h,strategy:a,middlewareData:f,rects:c,platform:l,elements:{reference:e,floating:t}});u=null!=v?v:u,d=null!=w?w:d,f[g]={...f[g],...y},x&&p<MAX_RESET_COUNT&&(p++,"object"==typeof x&&(x.placement&&(h=x.placement),x.rects&&(c=!0===x.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):x.rects),{x:u,y:d}=computeCoordsFromPlacement(c,h,s)),r=-1)}return{x:u,y:d,placement:h,strategy:a,middlewareData:f}},floating_ui_core_arrow=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:i,platform:o,elements:l,middlewareData:s}=t,{element:c,padding:u=0}=floating_ui_utils_evaluate(e,t)||{};if(null==c)return{};let d=floating_ui_utils_getPaddingObject(u),h={x:r,y:n},p=getAlignmentAxis(a),f=getAxisLength(p),m=await o.getDimensions(c),g="y"===p,b=g?"clientHeight":"clientWidth",v=i.reference[f]+i.reference[p]-h[p]-i.floating[f],w=h[p]-i.reference[p],y=await (null==o.getOffsetParent?void 0:o.getOffsetParent(c)),x=y?y[b]:0;x&&await (null==o.isElement?void 0:o.isElement(y))||(x=l.floating[b]||i.floating[f]);let k=x/2-m[f]/2-1,S=floating_ui_utils_min(d[g?"top":"left"],k),D=floating_ui_utils_min(d[g?"bottom":"right"],k),M=x-m[f]-D,F=x/2-m[f]/2+(v/2-w/2),C=clamp(S,F,M),E=!s.arrow&&null!=floating_ui_utils_getAlignment(a)&&F!==C&&i.reference[f]/2-(F<S?S:D)-m[f]/2<0,N=E?F<S?F-S:F-M:0;return{[p]:h[p]+N,data:{[p]:C,centerOffset:F-C-N,...E&&{alignmentOffset:N}},reset:E}}});function getPlacementList(e,t,r){return(e?[...r.filter(t=>getAlignment(t)===e),...r.filter(t=>getAlignment(t)!==e)]:r.filter(e=>getSide(e)===e)).filter(r=>!e||getAlignment(r)===e||!!t&&getOppositeAlignmentPlacement(r)!==r)}let autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var r,n,a;let{rects:i,middlewareData:o,placement:l,platform:s,elements:c}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:h=placements,autoAlignment:p=!0,...f}=evaluate(e,t),m=void 0!==d||h===placements?getPlacementList(d||null,p,h):h,g=(null==(r=o.autoPlacement)?void 0:r.index)||0,b=m[g];if(null==b)return{};if(l!==b)return{reset:{placement:m[0]}};let v=await s.detectOverflow(t,f),w=getAlignmentSides(b,i,await (null==s.isRTL?void 0:s.isRTL(c.floating))),y=[v[getSide(b)],v[w[0]],v[w[1]]],x=[...(null==(n=o.autoPlacement)?void 0:n.overflows)||[],{placement:b,overflows:y}],k=m[g+1];if(k)return{data:{index:g+1,overflows:x},reset:{placement:k}};let S=x.map(e=>{let t=getAlignment(e.placement);return[e.placement,t&&u?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),D=(null==(a=S.filter(e=>e[2].slice(0,getAlignment(e[0])?2:3).every(e=>e<=0))[0])?void 0:a[0])||S[0][0];return D!==l?{data:{index:g+1,overflows:x},reset:{placement:D}}:{}}}},flip=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n,a,i,o;let{placement:l,middlewareData:s,rects:c,initialPlacement:u,platform:d,elements:h}=t,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...w}=floating_ui_utils_evaluate(e,t);if(null!=(r=s.arrow)&&r.alignmentOffset)return{};let y=floating_ui_utils_getSide(l),x=floating_ui_utils_getSideAxis(u),k=floating_ui_utils_getSide(u)===u,S=await (null==d.isRTL?void 0:d.isRTL(h.floating)),D=m||(k||!v?[getOppositePlacement(u)]:getExpandedPlacements(u)),M="none"!==b;!m&&M&&D.push(...getOppositeAxisPlacements(u,v,b,S));let F=[u,...D],C=await d.detectOverflow(t,w),E=[],N=(null==(n=s.flip)?void 0:n.overflows)||[];if(p&&E.push(C[y]),f){let e=floating_ui_utils_getAlignmentSides(l,c,S);E.push(C[e[0]],C[e[1]])}if(N=[...N,{placement:l,overflows:E}],!E.every(e=>e<=0)){let e=((null==(a=s.flip)?void 0:a.index)||0)+1,t=F[e];if(t&&("alignment"!==f||x===floating_ui_utils_getSideAxis(t)||N.every(e=>floating_ui_utils_getSideAxis(e.placement)!==x||e.overflows[0]>0)))return{data:{index:e,overflows:N},reset:{placement:t}};let r=null==(i=N.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!r)switch(g){case"bestFit":{let e=null==(o=N.filter(e=>{if(M){let t=floating_ui_utils_getSideAxis(e.placement);return t===x||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=u}if(l!==r)return{reset:{placement:r}}}return{}}}};function getSideOffsets(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function isAnySideFullyClipped(e){return floating_ui_utils_sides.some(t=>e[t]>=0)}let hide=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:r,platform:n}=t,{strategy:a="referenceHidden",...i}=floating_ui_utils_evaluate(e,t);switch(a){case"referenceHidden":{let e=getSideOffsets(await n.detectOverflow(t,{...i,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:isAnySideFullyClipped(e)}}}case"escaped":{let e=getSideOffsets(await n.detectOverflow(t,{...i,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:isAnySideFullyClipped(e)}}}default:return{}}}}};function getBoundingRect(e){let t=min(...e.map(e=>e.left)),r=min(...e.map(e=>e.top));return{x:t,y:r,width:max(...e.map(e=>e.right))-t,height:max(...e.map(e=>e.bottom))-r}}function getRectsByLine(e){let t=e.slice().sort((e,t)=>e.y-t.y),r=[],n=null;for(let e=0;e<t.length;e++){let a=t[e];!n||a.y-n.y>n.height/2?r.push([a]):r[r.length-1].push(a),n=a}return r.map(e=>rectToClientRect(getBoundingRect(e)))}let inline=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){let{placement:r,elements:n,rects:a,platform:i,strategy:o}=t,{padding:l=2,x:s,y:c}=evaluate(e,t),u=Array.from(await (null==i.getClientRects?void 0:i.getClientRects(n.reference))||[]);if(!u.length)return{};let d=getRectsByLine(u),h=rectToClientRect(getBoundingRect(u)),p=getPaddingObject(l),f=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&(d[0].left>d[1].right||d[1].left>d[0].right)&&null!=s&&null!=c)return d.find(e=>s>e.left-p.left&&s<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom)||h;if(d.length>=2){if("y"===getSideAxis(r)){let e=d[0],t=d[d.length-1],n="top"===getSide(r),a=e.top,i=t.bottom,o=n?e.left:t.left;return rectToClientRect({x:o,y:a,width:(n?e.right:t.right)-o,height:i-a})}let e="left"===getSide(r),t=max(...d.map(e=>e.right)),n=min(...d.map(e=>e.left)),a=d.filter(r=>e?r.left===n:r.right===t),i=a[0].top;return rectToClientRect({x:n,y:i,width:t-n,height:a[a.length-1].bottom-i})}return h}},floating:n.floating,strategy:o});return a.reference.x!==f.reference.x||a.reference.y!==f.reference.y||a.reference.width!==f.reference.width||a.reference.height!==f.reference.height?{reset:{rects:f}}:{}}}},originSides=/*#__PURE__*/new Set(["left","top"]);async function convertValueToCoords(e,t){let{placement:r,platform:n,elements:a}=e,i=await (null==n.isRTL?void 0:n.isRTL(a.floating)),o=floating_ui_utils_getSide(r),l=floating_ui_utils_getAlignment(r),s="y"===floating_ui_utils_getSideAxis(r),c=originSides.has(o)?-1:1,u=i&&s?-1:1,d=floating_ui_utils_evaluate(t,e),{mainAxis:h,crossAxis:p,alignmentAxis:f}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&"number"==typeof f&&(p="end"===l?-1*f:f),s?{x:p*u,y:h*c}:{x:h*c,y:p*u}}let floating_ui_core_offset=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;let{x:a,y:i,placement:o,middlewareData:l}=t,s=await convertValueToCoords(t,e);return o===(null==(r=l.offset)?void 0:r.placement)&&null!=(n=l.arrow)&&n.alignmentOffset?{}:{x:a+s.x,y:i+s.y,data:{...s,placement:o}}}}},shift=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:n,placement:a,platform:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=floating_ui_utils_evaluate(e,t),u={x:r,y:n},d=await i.detectOverflow(t,c),h=floating_ui_utils_getSideAxis(a),p=getOppositeAxis(h),f=u[p],m=u[h],g=(e,t)=>clamp(t+d["y"===e?"top":"left"],t,t-d["y"===e?"bottom":"right"]);o&&(f=g(p,f)),l&&(m=g(h,m));let b=s.fn({...t,[p]:f,[h]:m});return{...b,data:{x:b.x-r,y:b.y-n,enabled:{[p]:o,[h]:l}}}}}},limitShift=function(e){return void 0===e&&(e={}),{options:e,fn(t){var r,n,a,i;let{x:o,y:l,placement:s,rects:c,middlewareData:u}=t,{offset:d=0,mainAxis:h=!0,crossAxis:p=!0}=floating_ui_utils_evaluate(e,t),f={x:o,y:l},m=floating_ui_utils_getSideAxis(s),g=getOppositeAxis(m),b=f[g],v=f[m],w=floating_ui_utils_evaluate(d,t),y="number"==typeof w?{mainAxis:w,crossAxis:0}:{mainAxis:null!=(r=w.mainAxis)?r:0,crossAxis:null!=(n=w.crossAxis)?n:0};if(h){let e="y"===g?"height":"width",t=c.reference[g]-c.floating[e]+y.mainAxis,r=c.reference[g]+c.reference[e]-y.mainAxis;b<t?b=t:b>r&&(b=r)}if(p){let e="y"===g?"width":"height",t=originSides.has(floating_ui_utils_getSide(s)),r=c.reference[m]-c.floating[e]+(t&&(null==(a=u.offset)?void 0:a[m])||0)+(t?0:y.crossAxis),n=c.reference[m]+c.reference[e]+(t?0:(null==(i=u.offset)?void 0:i[m])||0)-(t?y.crossAxis:0);v<r?v=r:v>n&&(v=n)}return{[g]:b,[m]:v}}}},floating_ui_core_size=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){let r,n,{placement:a,rects:i,platform:o,elements:l}=t,{apply:s=()=>{},...c}=floating_ui_utils_evaluate(e,t),u=await o.detectOverflow(t,c),d=floating_ui_utils_getSide(a),h=floating_ui_utils_getAlignment(a),p="y"===floating_ui_utils_getSideAxis(a),{width:f,height:m}=i.floating;"top"===d||"bottom"===d?(r=d,n=h===(await (null==o.isRTL?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(n=d,r="end"===h?"top":"bottom");let g=m-u.top-u.bottom,b=f-u.left-u.right,v=floating_ui_utils_min(m-u[r],g),w=floating_ui_utils_min(f-u[n],b),y=t.middlewareData.shift,x=!y,k=v,S=w;null!=y&&y.enabled.x&&(S=b),null!=y&&y.enabled.y&&(k=g),x&&!h&&(p?S=f-2*floating_ui_utils_max(u.left,u.right):k=m-2*floating_ui_utils_max(u.top,u.bottom)),await s({...t,availableWidth:S,availableHeight:k});let D=await o.getDimensions(l.floating);return f!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return"u">typeof window}function getNodeName(e){return isNode(e)?(e.nodeName||"").toLowerCase():"#document"}function getWindow(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(e){var t;return null==(t=(isNode(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function isNode(e){return!!hasWindow()&&(e instanceof Node||e instanceof getWindow(e).Node)}function isElement(e){return!!hasWindow()&&(e instanceof Element||e instanceof getWindow(e).Element)}function isHTMLElement(e){return!!hasWindow()&&(e instanceof HTMLElement||e instanceof getWindow(e).HTMLElement)}function isShadowRoot(e){return!(!hasWindow()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof getWindow(e).ShadowRoot)}function isOverflowElement(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=floating_ui_utils_dom_getComputedStyle(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function isTableElement(e){return/^(table|td|th)$/.test(getNodeName(e))}function isTopLayer(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let willChangeRe=/transform|translate|scale|rotate|perspective|filter/,containRe=/paint|layout|strict|content/,isNotNone=e=>!!e&&"none"!==e;function isContainingBlock(e){let t=isElement(e)?floating_ui_utils_dom_getComputedStyle(e):e;return isNotNone(t.transform)||isNotNone(t.translate)||isNotNone(t.scale)||isNotNone(t.rotate)||isNotNone(t.perspective)||!isWebKit()&&(isNotNone(t.backdropFilter)||isNotNone(t.filter))||willChangeRe.test(t.willChange||"")||containRe.test(t.contain||"")}function getContainingBlock(e){let t=getParentNode(e);for(;isHTMLElement(t)&&!isLastTraversableNode(t);){if(isContainingBlock(t))return t;if(isTopLayer(t))break;t=getParentNode(t)}return null}function isWebKit(){return null==isWebKitValue&&(isWebKitValue="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),isWebKitValue}function isLastTraversableNode(e){return/^(html|body|#document)$/.test(getNodeName(e))}function floating_ui_utils_dom_getComputedStyle(e){return getWindow(e).getComputedStyle(e)}function getNodeScroll(e){return isElement(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function getParentNode(e){if("html"===getNodeName(e))return e;let t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){let t=getParentNode(e);return isLastTraversableNode(t)?(e.ownerDocument||e).body:isHTMLElement(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let a=getNearestOverflowAncestor(e),i=a===(null==(n=e.ownerDocument)?void 0:n.body),o=getWindow(a);if(!i)return t.concat(a,getOverflowAncestors(a,[],r));{let e=getFrameElement(o);return t.concat(o,o.visualViewport||[],isOverflowElement(a)?a:[],e&&r?getOverflowAncestors(e):[])}}function getFrameElement(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function getCssDimensions(e){let t=floating_ui_utils_dom_getComputedStyle(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=isHTMLElement(e),i=a?e.offsetWidth:r,o=a?e.offsetHeight:n,l=round(r)!==i||round(n)!==o;return l&&(r=i,n=o),{width:r,height:n,$:l}}function unwrapElement(e){return isElement(e)?e:e.contextElement}function getScale(e){let t=unwrapElement(e);if(!isHTMLElement(t))return createCoords(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:i}=getCssDimensions(t),o=(i?round(r.width):r.width)/n,l=(i?round(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),l&&Number.isFinite(l)||(l=1),{x:o,y:l}}let noOffsets=/*#__PURE__*/createCoords(0);function getVisualOffsets(e){let t=getWindow(e);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:noOffsets}function shouldAddVisualOffsets(e,t,r){return void 0===t&&(t=!1),!!r&&t&&r===getWindow(e)}function floating_ui_dom_getBoundingClientRect(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),i=unwrapElement(e),o=createCoords(1);t&&(n?isElement(n)&&(o=getScale(n)):o=getScale(e));let l=shouldAddVisualOffsets(i,r,n)?getVisualOffsets(i):createCoords(0),s=(a.left+l.x)/o.x,c=(a.top+l.y)/o.y,u=a.width/o.x,d=a.height/o.y;if(i&&n){let e=getWindow(i),t=isElement(n)?getWindow(n):n,r=e,a=getFrameElement(r);for(;a&&t!==r;){let e=getScale(a),t=a.getBoundingClientRect(),n=floating_ui_utils_dom_getComputedStyle(a),i=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;s*=e.x,c*=e.y,u*=e.x,d*=e.y,s+=i,c+=o,a=getFrameElement(r=getWindow(a))}}return floating_ui_utils_rectToClientRect({width:u,height:d,x:s,y:c})}function getWindowScrollBarX(e,t){let r=getNodeScroll(e).scrollLeft;return t?t.left+r:floating_ui_dom_getBoundingClientRect(getDocumentElement(e)).left+r}function getHTMLOffset(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-getWindowScrollBarX(e,r),y:r.top+t.scrollTop}}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,i="fixed"===a,o=getDocumentElement(n),l=!!t&&isTopLayer(t.floating);if(n===o||l&&i)return r;let s={scrollLeft:0,scrollTop:0},c=createCoords(1),u=createCoords(0),d=isHTMLElement(n);if((d||!i)&&(("body"!==getNodeName(n)||isOverflowElement(o))&&(s=getNodeScroll(n)),d)){let e=floating_ui_dom_getBoundingClientRect(n);c=getScale(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}let h=!o||d||i?createCoords(0):getHTMLOffset(o,s);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-s.scrollLeft*c.x+u.x+h.x,y:r.y*c.y-s.scrollTop*c.y+u.y+h.y}}function getClientRects(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function getDocumentRect(e){let t=getNodeScroll(e),r=e.ownerDocument.body,n=floating_ui_utils_max(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=floating_ui_utils_max(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),i=-t.scrollLeft+getWindowScrollBarX(e),o=-t.scrollTop;return"rtl"===floating_ui_utils_dom_getComputedStyle(r).direction&&(i+=floating_ui_utils_max(e.clientWidth,r.clientWidth)-n),{width:n,height:a,x:i,y:o}}let SCROLLBAR_MAX=25;function getViewportRect(e,t,r){void 0===r&&(r="viewport");let n="layoutViewport"===r,a=getWindow(e),i=getDocumentElement(e),o=a.visualViewport,l=i.clientWidth,s=i.clientHeight,c=0,u=0;if(o){let e=!isWebKit()||"fixed"===t;n?e||(c=-o.offsetLeft,u=-o.offsetTop):(l=o.width,s=o.height,e&&(c=o.offsetLeft,u=o.offsetTop))}if(0>=getWindowScrollBarX(i)){let e=i.ownerDocument,t=e.body,r=getComputedStyle(t),n="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,a=Math.abs(i.clientWidth-t.clientWidth-n),o="stable both-edges"===getComputedStyle(i).scrollbarGutter?a/2:a;o<=SCROLLBAR_MAX&&(l-=o)}return{width:l,height:s,x:c,y:u}}function getInnerBoundingClientRect(e,t){let r=floating_ui_dom_getBoundingClientRect(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,i=getScale(e),o=e.clientWidth*i.x,l=e.clientHeight*i.y;return{width:o,height:l,x:a*i.x,y:n*i.y}}function getClientRectFromClippingAncestor(e,t,r){let n;if("viewport"===t||"layoutViewport"===t)n=getViewportRect(e,r,t);else if("document"===t)n=getDocumentRect(getDocumentElement(e));else if(isElement(t))n=getInnerBoundingClientRect(t,r);else{let r=getVisualOffsets(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return floating_ui_utils_rectToClientRect(n)}function getClippingElementAncestors(e,t){let r=t.get(e);if(r)return r;let n=getOverflowAncestors(e,[],!1).filter(e=>isElement(e)&&"body"!==getNodeName(e)),a=null,i="fixed"===floating_ui_utils_dom_getComputedStyle(e).position,o=i?getParentNode(e):e;for(;isElement(o)&&!isLastTraversableNode(o);){let e=floating_ui_utils_dom_getComputedStyle(o),t=isContainingBlock(o),r=a?a.position:i?"fixed":"";t||"fixed"!==r&&("absolute"!==r||"static"!==e.position)?a=e:n=n.filter(e=>e!==o),o=getParentNode(o)}return t.set(e,n),n}function getClippingRect(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,i=[..."clippingAncestors"===r?isTopLayer(t)?[]:getClippingElementAncestors(t,this._c):[].concat(r),n],o=getClientRectFromClippingAncestor(t,i[0],a),l=o.top,s=o.right,c=o.bottom,u=o.left;for(let e=1;e<i.length;e++){let r=getClientRectFromClippingAncestor(t,i[e],a);l=floating_ui_utils_max(r.top,l),s=floating_ui_utils_min(r.right,s),c=floating_ui_utils_min(r.bottom,c),u=floating_ui_utils_max(r.left,u)}return{width:s-u,height:c-l,x:u,y:l}}function getDimensions(e){let{width:t,height:r}=getCssDimensions(e);return{width:t,height:r}}function getRectRelativeToOffsetParent(e,t,r){let n=isHTMLElement(t),a=getDocumentElement(t),i="fixed"===r,o=floating_ui_dom_getBoundingClientRect(e,!0,i,t),l={scrollLeft:0,scrollTop:0},s=createCoords(0);if((n||!i)&&(("body"!==getNodeName(t)||isOverflowElement(a))&&(l=getNodeScroll(t)),n)){let e=floating_ui_dom_getBoundingClientRect(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}!n&&a&&(s.x=getWindowScrollBarX(a));let c=!a||n||i?createCoords(0):getHTMLOffset(a,l);return{x:o.left+l.scrollLeft-s.x-c.x,y:o.top+l.scrollTop-s.y-c.y,width:o.width,height:o.height}}function isStaticPositioned(e){return"static"===floating_ui_utils_dom_getComputedStyle(e).position}function getTrueOffsetParent(e,t){if(!isHTMLElement(e)||"fixed"===floating_ui_utils_dom_getComputedStyle(e).position)return null;if(t)return t(e);let r=e.offsetParent;return getDocumentElement(e)===r&&(r=r.ownerDocument.body),r}function getOffsetParent(e,t){let r=getWindow(e);if(isTopLayer(e))return r;if(!isHTMLElement(e)){let t=getParentNode(e);for(;t&&!isLastTraversableNode(t);){if(isElement(t)&&!isStaticPositioned(t))return t;t=getParentNode(t)}return r}let n=getTrueOffsetParent(e,t);for(;n&&isTableElement(n)&&isStaticPositioned(n);)n=getTrueOffsetParent(n,t);return n&&isLastTraversableNode(n)&&isStaticPositioned(n)&&!isContainingBlock(n)?r:n||getContainingBlock(e)||r}let getElementRects=async function(e){let t=this.getOffsetParent||getOffsetParent,r=this.getDimensions,n=await r(e.floating);return{reference:getRectRelativeToOffsetParent(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function isRTL(e){return"rtl"===floating_ui_utils_dom_getComputedStyle(e).direction}let floating_ui_dom_platform={convertOffsetParentRelativeRectToViewportRelativeRect:convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement:getDocumentElement,getClippingRect:getClippingRect,getOffsetParent:getOffsetParent,getElementRects:getElementRects,getClientRects:getClientRects,getDimensions:getDimensions,getScale:getScale,isElement:isElement,isRTL:isRTL};function rectsAreEqual(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function observeMove(e,t,r){let n,a=null,i=getDocumentElement(e);function o(){var e;clearTimeout(n),null==(e=a)||e.disconnect(),a=null}function l(r,s){void 0===r&&(r=!1),void 0===s&&(s=1),o();let c=e.getBoundingClientRect(),{left:u,top:d,width:h,height:p}=c;if(r||t(),!h||!p)return;let f={rootMargin:-floor(d)+"px "+-floor(i.clientWidth-(u+h))+"px "+-floor(i.clientHeight-(d+p))+"px "+-floor(u)+"px",threshold:floating_ui_utils_max(0,floating_ui_utils_min(1,s))||1},m=!0;function g(t){let r=t[0].intersectionRatio;if(!rectsAreEqual(c,e.getBoundingClientRect()))return l();if(r!==s){if(!m)return l();r?l(!1,r):n=setTimeout(()=>{l(!1,1e-7)},1e3)}m=!1}try{a=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch(e){a=new IntersectionObserver(g,f)}a.observe(e)}let s=getWindow(e),c=()=>l(r);return s.addEventListener("resize",c),l(!0),()=>{s.removeEventListener("resize",c),o()}}function autoUpdate(e,t,r,n){let a;void 0===n&&(n={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,u=unwrapElement(e),d=i||o?[...u?getOverflowAncestors(u):[],...t?getOverflowAncestors(t):[]]:[];d.forEach(e=>{i&&e.addEventListener("scroll",r),o&&e.addEventListener("resize",r)});let h=u&&s?observeMove(u,r,o):null,p=-1,f=null;l&&(f=new ResizeObserver(e=>{let[n]=e;n&&n.target===u&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),r()}),u&&!c&&f.observe(u),t&&f.observe(t));let m=c?floating_ui_dom_getBoundingClientRect(e):null;return c&&function t(){let n=floating_ui_dom_getBoundingClientRect(e);m&&!rectsAreEqual(m,n)&&r(),m=n,a=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==h||h(),null==(e=f)||e.disconnect(),f=null,c&&cancelAnimationFrame(a)}}let floating_ui_dom_detectOverflow=null,floating_ui_dom_offset=floating_ui_core_offset,floating_ui_dom_autoPlacement=null,floating_ui_dom_shift=shift,floating_ui_dom_flip=flip,floating_ui_dom_size=floating_ui_core_size,floating_ui_dom_hide=hide,floating_ui_dom_arrow=floating_ui_core_arrow,floating_ui_dom_inline=null,floating_ui_dom_limitShift=limitShift,floating_ui_dom_computePosition=(e,t,r)=>{let n=new Map,a=null!=r?r:{},i={...floating_ui_dom_platform,...a.platform,_c:n};return computePosition(e,t,{...a,platform:i})};var isClient="u">typeof document,floating_ui_react_dom_noop=function(){},floating_ui_react_dom_index=isClient?__rspack_external_react.useLayoutEffect:floating_ui_react_dom_noop;function deepEqual(e,t){let r,n,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!deepEqual(e[n],t[n]))return!1;return!0}if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!=n--;){let r=a[n];if(("_owner"!==r||!e.$$typeof)&&!deepEqual(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function getDPR(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function roundByDPR(e,t){let r=getDPR(e);return Math.round(t*r)/r}function useLatestRef(e){let t=__rspack_external_react.useRef(e);return floating_ui_react_dom_index(()=>{t.current=e}),t}function useFloating(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:s,open:c}=e,[u,d]=__rspack_external_react.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=__rspack_external_react.useState(n);deepEqual(h,n)||p(n);let[f,m]=__rspack_external_react.useState(null),[g,b]=__rspack_external_react.useState(null),v=__rspack_external_react.useCallback(e=>{e!==k.current&&(k.current=e,m(e))},[]),w=__rspack_external_react.useCallback(e=>{e!==S.current&&(S.current=e,b(e))},[]),y=i||f,x=o||g,k=__rspack_external_react.useRef(null),S=__rspack_external_react.useRef(null),D=__rspack_external_react.useRef(u),M=null!=s,F=useLatestRef(s),C=useLatestRef(a),E=useLatestRef(c),N=__rspack_external_react.useCallback(()=>{if(!k.current||!S.current)return;let e={placement:t,strategy:r,middleware:h};C.current&&(e.platform=C.current),floating_ui_dom_computePosition(k.current,S.current,e).then(e=>{let t={...e,isPositioned:!1!==E.current};A.current&&!deepEqual(D.current,t)&&(D.current=t,__rspack_external_react_dom_20ef40a6.flushSync(()=>{d(t)}))})},[h,t,r,C,E]);floating_ui_react_dom_index(()=>{!1===c&&D.current.isPositioned&&(D.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);let A=__rspack_external_react.useRef(!1);floating_ui_react_dom_index(()=>(A.current=!0,()=>{A.current=!1}),[]),floating_ui_react_dom_index(()=>{if(y&&(k.current=y),x&&(S.current=x),y&&x){if(F.current)return F.current(y,x,N);N()}},[y,x,N,F,M]);let T=__rspack_external_react.useMemo(()=>({reference:k,floating:S,setReference:v,setFloating:w}),[v,w]),I=__rspack_external_react.useMemo(()=>({reference:y,floating:x}),[y,x]),P=__rspack_external_react.useMemo(()=>{let e={position:r,left:0,top:0};if(!I.floating)return e;let t=roundByDPR(I.floating,u.x),n=roundByDPR(I.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...getDPR(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,I.floating,u.x,u.y]);return __rspack_external_react.useMemo(()=>({...u,update:N,refs:T,elements:I,floatingStyles:P}),[u,N,T,I,P])}let arrow$1=e=>({name:"arrow",options:e,fn(t){let{element:r,padding:n}="function"==typeof e?e(t):e;return r&&({}).hasOwnProperty.call(r,"current")?null!=r.current?floating_ui_dom_arrow({element:r.current,padding:n}).fn(t):{}:r?floating_ui_dom_arrow({element:r,padding:n}).fn(t):{}}}),floating_ui_react_dom_offset=(e,t)=>{let r=floating_ui_dom_offset(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_shift=(e,t)=>{let r=floating_ui_dom_shift(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_limitShift=(e,t)=>({fn:floating_ui_dom_limitShift(e).fn,options:[e,t]}),floating_ui_react_dom_flip=(e,t)=>{let r=floating_ui_dom_flip(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_size=(e,t)=>{let r=floating_ui_dom_size(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_autoPlacement=(e,t)=>{let r=autoPlacement$1(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_hide=(e,t)=>{let r=floating_ui_dom_hide(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_inline=(e,t)=>{let r=inline$1(e);return{name:r.name,fn:r.fn,options:[e,t]}},floating_ui_react_dom_arrow=(e,t)=>{let r=arrow$1(e);return{name:r.name,fn:r.fn,options:[e,t]}};var react_arrow_dist_defProp=Object.defineProperty,react_arrow_dist_name=(e,t)=>react_arrow_dist_defProp(e,"name",{value:t,configurable:!0}),Arrow=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_arrow_dist_name(function(e,t){let{children:r,width:n=10,height:a=5,...i}=e;return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.svg,{...i,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:/* @__PURE__ */jsx_runtime_jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),react_arrow_dist_Root=Arrow,react_use_size_dist_defProp=Object.defineProperty,react_use_size_dist_name=(e,t)=>react_use_size_dist_defProp(e,"name",{value:t,configurable:!0});function useSize(e){let[t,r]=__rspack_external_react.useState(void 0);return useLayoutEffect2(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,a;if(!Array.isArray(t)||!t.length)return;let i=t[0];if("borderBoxSize"in i){let e=i.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}react_use_size_dist_name(useSize,"useSize");var react_popper_dist_defProp=Object.defineProperty,react_popper_dist_name=(e,t)=>react_popper_dist_defProp(e,"name",{value:t,configurable:!0}),SIDE_OPTIONS=null,ALIGN_OPTIONS=null,POPPER_NAME="Popper",[createPopperContext,createPopperScope]=createContextScope(POPPER_NAME),[PopperProvider,usePopperContext]=createPopperContext(POPPER_NAME),Popper=/* @__PURE__ */react_popper_dist_name(e=>{let{__scopePopper:t,children:r}=e,[n,a]=__rspack_external_react.useState(null),[i,o]=__rspack_external_react.useState(void 0);return /* @__PURE__ */jsx_runtime_jsx(PopperProvider,{scope:t,anchor:n,onAnchorChange:a,placementState:i,setPlacementState:o,children:r})},"Popper"),ANCHOR_NAME="PopperAnchor",PopperAnchor=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_popper_dist_name(function(e,t){let{__scopePopper:r,virtualRef:n,...a}=e,i=usePopperContext(ANCHOR_NAME,r),o=__rspack_external_react.useRef(null),l=i.onAnchorChange,s=dist_useComposedRefs(t,__rspack_external_react.useCallback(e=>{o.current=e,e&&l(e)},[l])),c=__rspack_external_react.useRef(null);__rspack_external_react.useEffect(()=>{if(!n)return;let e=c.current;c.current=n.current,e!==c.current&&l(c.current)});let u=i.placementState&&getSideAndAlignFromPlacement(i.placementState),d=u?.[0],h=u?.[1];return n?null:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-radix-popper-side":d,"data-radix-popper-align":h,...a,ref:s})},"PopperAnchor")),CONTENT_NAME="PopperContent",[PopperContentProvider,useContentContext]=createPopperContext(CONTENT_NAME),PopperContent=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_popper_dist_name(function(e,t){let{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:s=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:f,...m}=e,g=usePopperContext(CONTENT_NAME,r),[b,v]=__rspack_external_react.useState(null),w=dist_useComposedRefs(t,v),[y,x]=__rspack_external_react.useState(null),k=useSize(y),S=k?.width??0,D=k?.height??0,M="number"==typeof u?u:{top:0,right:0,bottom:0,left:0,...u},F=Array.isArray(c)?c:[c],C=F.length>0,E={padding:M,boundary:F.filter(isNotNull),altBoundary:C},{refs:N,floatingStyles:A,placement:T,isPositioned:I,middlewareData:P}=useFloating({strategy:"fixed",placement:n+("center"!==i?"-"+i:""),whileElementsMounted:/* @__PURE__ */react_popper_dist_name((...e)=>autoUpdate(...e,{animationFrame:"always"===p}),"whileElementsMounted"),elements:{reference:g.anchor},middleware:[floating_ui_react_dom_offset({mainAxis:a+D,alignmentAxis:o}),s&&floating_ui_react_dom_shift({mainAxis:!0,crossAxis:!1,limiter:"partial"===d?floating_ui_react_dom_limitShift():void 0,...E}),s&&floating_ui_react_dom_flip({...E}),floating_ui_react_dom_size({...E,apply:/* @__PURE__ */react_popper_dist_name(({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:i}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${i}px`)},"apply")}),y&&floating_ui_react_dom_arrow({element:y,padding:l}),transformOrigin({arrowWidth:S,arrowHeight:D}),h&&floating_ui_react_dom_hide({strategy:"referenceHidden",...E,boundary:C?E.boundary:void 0})]}),z=g.setPlacementState;useLayoutEffect2(()=>(z(T),()=>{z(void 0)}),[T,z]);let[_,O]=getSideAndAlignFromPlacement(T),L=dist_useCallbackRef(f);useLayoutEffect2(()=>{I&&L?.()},[I,L]);let q=P.arrow?.x,$=P.arrow?.y,j=P.arrow?.centerOffset!==0,[H,B]=__rspack_external_react.useState();return useLayoutEffect2(()=>{b&&B(window.getComputedStyle(b).zIndex)},[b]),/* @__PURE__ */jsx_runtime_jsx("div",{ref:N.setFloating,"data-radix-popper-content-wrapper":"",style:{...A,transform:I?A.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(" "),...P.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:/* @__PURE__ */jsx_runtime_jsx(PopperContentProvider,{scope:r,placedSide:_,placedAlign:O,onArrowChange:x,arrowX:q,arrowY:$,shouldHideArrow:j,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-side":_,"data-align":O,...m,ref:w,style:{...m.style,animation:I?m.style?.animation:"none"}})})})},"PopperContent")),ARROW_NAME="PopperArrow",OPPOSITE_SIDE={top:"bottom",right:"left",bottom:"top",left:"right"},PopperArrow=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_popper_dist_name(function(e,t){let{__scopePopper:r,...n}=e,a=useContentContext(ARROW_NAME,r),i=OPPOSITE_SIDE[a.placedSide];return /* @__PURE__ */jsx_runtime_jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:/* @__PURE__ */jsx_runtime_jsx(react_arrow_dist_Root,{...n,ref:t,style:{...n.style,display:"block"}})})},"PopperArrow"));function isNotNull(e){return null!==e}react_popper_dist_name(isNotNull,"isNotNull");var transformOrigin=/* @__PURE__ */react_popper_dist_name(e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,o=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[s,c]=getSideAndAlignFromPlacement(r),u={start:"0%",center:"50%",end:"100%"}[c],d=(a.arrow?.x??0)+o/2,h=(a.arrow?.y??0)+l/2,p="",f="";return"bottom"===s?(p=i?u:`${d}px`,f=`${-l}px`):"top"===s?(p=i?u:`${d}px`,f=`${n.floating.height+l}px`):"right"===s?(p=`${-l}px`,f=i?u:`${h}px`):"left"===s&&(p=`${n.floating.width+l}px`,f=i?u:`${h}px`),{data:{x:p,y:f}}}}),"transformOrigin");function getSideAndAlignFromPlacement(e){let[t,r="center"]=e.split("-");return[t,r]}react_popper_dist_name(getSideAndAlignFromPlacement,"getSideAndAlignFromPlacement");var Root2=Popper,Anchor=PopperAnchor,Content=PopperContent,dist_Arrow=PopperArrow,react_portal_dist_defProp=Object.defineProperty,react_portal_dist_name=(e,t)=>react_portal_dist_defProp(e,"name",{value:t,configurable:!0}),Portal=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_portal_dist_name(function(e,t){let{container:r,...n}=e,[a,i]=__rspack_external_react.useState(!1);useLayoutEffect2(()=>i(!0),[]);let o=r||a&&globalThis?.document?.body;return o?__rspack_external_react_dom_20ef40a6.createPortal(/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{...n,ref:t}),o):null},"Portal")),react_portal_dist_Root=null,react_presence_dist_defProp=Object.defineProperty,react_presence_dist_name=(e,t)=>react_presence_dist_defProp(e,"name",{value:t,configurable:!0});function useStateMachine(e,t){return __rspack_external_react.useReducer((e,r)=>t[e][r]??e,e)}react_presence_dist_name(useStateMachine,"useStateMachine");var dist_Presence=/* @__PURE__ */react_presence_dist_name(e=>{let{present:t,children:r}=e,n=usePresence(t),a="function"==typeof r?r({present:n.isPresent}):__rspack_external_react.Children.only(r),i=useStableComposedRefs(n.ref,dist_getElementRef(a));return"function"==typeof r||n.isPresent?__rspack_external_react.cloneElement(a,{ref:i}):null},"Presence");function usePresence(e){let[t,r]=__rspack_external_react.useState(),n=__rspack_external_react.useRef(null),a=__rspack_external_react.useRef(e),i=__rspack_external_react.useRef("none"),o=__rspack_external_react.useRef(void 0),[l,s]=useStateMachine(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return __rspack_external_react.useEffect(()=>{"mounted"===l?(i.current=o.current??getAnimationName(n.current),o.current=void 0):i.current="none"},[l]),useLayoutEffect2(()=>{let t=n.current,r=a.current;if(r!==e){let n=i.current,l=getAnimationName(t);e?(o.current=l,s("MOUNT")):"none"===l||t?.display==="none"?s("UNMOUNT"):r&&n!==l?s("ANIMATION_OUT"):s("UNMOUNT"),a.current=e}},[e,s]),useLayoutEffect2(()=>{if(t){let e,r=t.ownerDocument.defaultView??window,o=/* @__PURE__ */react_presence_dist_name(i=>{let o=getAnimationName(n.current).includes(CSS.escape(i.animationName));if(i.target===t&&o&&(s("ANIMATION_END"),!a.current)){let n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},"handleAnimationEnd"),l=/* @__PURE__ */react_presence_dist_name(e=>{e.target===t&&(i.current=getAnimationName(n.current))},"handleAnimationStart");return t.addEventListener("animationstart",l),t.addEventListener("animationcancel",o),t.addEventListener("animationend",o),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",l),t.removeEventListener("animationcancel",o),t.removeEventListener("animationend",o)}}s("ANIMATION_END")},[t,s]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:__rspack_external_react.useCallback(e=>{if(e){let t=getComputedStyle(e);n.current=t,o.current=getAnimationName(t)}else n.current=null;r(e)},[])}}function dist_setRef(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function useStableComposedRefs(...e){let t=__rspack_external_react.useRef(e);return t.current=e,__rspack_external_react.useCallback(e=>{let r=t.current,n=!1,a=r.map(t=>{let r=dist_setRef(t,e);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let e=0;e<a.length;e++){let t=a[e];"function"==typeof t?t():dist_setRef(r[e],null)}}},[])}function getAnimationName(e){return e?.animationName||"none"}function dist_getElementRef(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(r=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}react_presence_dist_name(usePresence,"usePresence"),react_presence_dist_name(dist_setRef,"setRef"),react_presence_dist_name(useStableComposedRefs,"useStableComposedRefs"),react_presence_dist_name(getAnimationName,"getAnimationName"),react_presence_dist_name(dist_getElementRef,"getElementRef");var react_presence_dist_Root=null,react_id_dist_defProp=Object.defineProperty,react_id_dist_name=(e,t)=>react_id_dist_defProp(e,"name",{value:t,configurable:!0}),useReactId=__rspack_external_react[" useId ".trim().toString()]||(()=>void 0),react_id_dist_count=0;function dist_useId(e){let[t,r]=__rspack_external_react.useState(useReactId());return useLayoutEffect2(()=>{e||r(e=>e??String(react_id_dist_count++))},[e]),e||(t?`radix-${t}`:"")}react_id_dist_name(dist_useId,"useId");var react_use_is_hydrated_dist_defProp=Object.defineProperty,react_use_is_hydrated_dist_name=(e,t)=>react_use_is_hydrated_dist_defProp(e,"name",{value:t,configurable:!0}),_isHydrated=!1;function useIsHydrated(){let[e,t]=__rspack_external_react.useState(_isHydrated);return __rspack_external_react.useEffect(()=>{_isHydrated||(_isHydrated=!0,t(!0))},[]),e}react_use_is_hydrated_dist_name(useIsHydrated,"useIsHydrated");var useReactSyncExternalStore=__rspack_external_react[" useSyncExternalStore ".trim().toString()];function dist_subscribe(){return()=>{}}function useIsHydratedModern(){return useReactSyncExternalStore(dist_subscribe,()=>!0,()=>!1)}react_use_is_hydrated_dist_name(dist_subscribe,"subscribe"),react_use_is_hydrated_dist_name(useIsHydratedModern,"useIsHydratedModern");var useIsHydrated2="function"==typeof useReactSyncExternalStore?useIsHydratedModern:useIsHydrated,react_roving_focus_dist_defProp=Object.defineProperty,react_roving_focus_dist_name=(e,t)=>react_roving_focus_dist_defProp(e,"name",{value:t,configurable:!0}),ENTRY_FOCUS="rovingFocusGroup.onEntryFocus",dist_EVENT_OPTIONS={bubbles:!1,cancelable:!0},GROUP_NAME="RovingFocusGroup",[Collection,dist_useCollection,dist_createCollectionScope]=createCollection(GROUP_NAME),[createRovingFocusGroupContext,createRovingFocusGroupScope]=createContextScope(GROUP_NAME,[dist_createCollectionScope]),[RovingFocusProvider,useRovingFocusContext]=createRovingFocusGroupContext(GROUP_NAME),RovingFocusGroup=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_roving_focus_dist_name(function(e,t){return /* @__PURE__ */jsx_runtime_jsx(Collection.Provider,{scope:e.__scopeRovingFocusGroup,children:/* @__PURE__ */jsx_runtime_jsx(Collection.Slot,{scope:e.__scopeRovingFocusGroup,children:/* @__PURE__ */jsx_runtime_jsx(RovingFocusGroupImpl,{...e,ref:t})})})},"RovingFocusGroup")),RovingFocusGroupImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_roving_focus_dist_name(function(e,t){let{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:s,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=__rspack_external_react.useRef(null),p=dist_useComposedRefs(t,h),f=useDirection(i),[m,g]=dist_useControllableState({prop:o,defaultProp:l??null,onChange:s,caller:GROUP_NAME}),[b,v]=__rspack_external_react.useState(!1),w=dist_useCallbackRef(c),y=dist_useCollection(r),x=__rspack_external_react.useRef(!1),[k,S]=__rspack_external_react.useState(0);return __rspack_external_react.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(ENTRY_FOCUS,w),()=>e.removeEventListener(ENTRY_FOCUS,w)},[w]),/* @__PURE__ */jsx_runtime_jsx(RovingFocusProvider,{scope:r,orientation:n,dir:f,loop:a,currentTabStopId:m,onItemFocus:__rspack_external_react.useCallback(e=>g(e),[g]),onItemShiftTab:__rspack_external_react.useCallback(()=>v(!0),[]),onFocusableItemAdd:__rspack_external_react.useCallback(()=>S(e=>e+1),[]),onFocusableItemRemove:__rspack_external_react.useCallback(()=>S(e=>e-1),[]),children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{tabIndex:b||0===k?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:dist_composeEventHandlers(e.onMouseDown,()=>{x.current=!0}),onFocus:dist_composeEventHandlers(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!b){let t=new CustomEvent(ENTRY_FOCUS,dist_EVENT_OPTIONS);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=y().filter(e=>e.focusable);dist_focusFirst([e.find(e=>e.active),e.find(e=>e.id===m),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:dist_composeEventHandlers(e.onBlur,()=>v(!1))})})},"RovingFocusGroupImpl")),ITEM_NAME="RovingFocusGroupItem",RovingFocusGroupItem=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_roving_focus_dist_name(function(e,t){let{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:i,children:o,...l}=e,s=dist_useId(),c=i||s,u=useRovingFocusContext(ITEM_NAME,r),d=u.currentTabStopId===c,h=dist_useCollection(r),{onFocusableItemAdd:p,onFocusableItemRemove:f,currentTabStopId:m}=u,g=useIsHydrated2();return useLayoutEffect2(()=>{if(g&&n)return p(),()=>f()},[g,n,p,f]),__rspack_external_react.useEffect(()=>{if(!g&&n)return p(),()=>f()},[g,n,p,f]),/* @__PURE__ */jsx_runtime_jsx(Collection.ItemSlot,{scope:r,id:c,focusable:n,active:a,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:dist_composeEventHandlers(e.onMouseDown,e=>{n?u.onItemFocus(c):e.preventDefault()}),onFocus:dist_composeEventHandlers(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:dist_composeEventHandlers(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void u.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=getFocusIntent(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();let n=r.indexOf(e.currentTarget);r=u.loop?wrapArray(r,n+1):r.slice(n+1)}setTimeout(()=>dist_focusFirst(r))}}),children:"function"==typeof o?o({isCurrentTabStop:d,hasTabStop:null!=m}):o})})},"RovingFocusGroupItem")),MAP_KEY_TO_FOCUS_INTENT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function getDirectionAwareKey(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}function getFocusIntent(e,t,r){let n=getDirectionAwareKey(e.key,r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return MAP_KEY_TO_FOCUS_INTENT[n]}function dist_focusFirst(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function wrapArray(e,t){return e.map((r,n)=>e[(t+n)%e.length])}react_roving_focus_dist_name(getDirectionAwareKey,"getDirectionAwareKey"),react_roving_focus_dist_name(getFocusIntent,"getFocusIntent"),react_roving_focus_dist_name(dist_focusFirst,"focusFirst"),react_roving_focus_dist_name(wrapArray,"wrapArray");var react_roving_focus_dist_Root=RovingFocusGroup,Item=RovingFocusGroupItem,getDefaultParent=function(e){return"u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(e){return e&&(e.host||unwrapHost(e.parentNode))},correctTargets=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=unwrapHost(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return!!e})},applyAttributeToOthers=function(e,t,r,n){var a=correctTargets(t,Array.isArray(e)?e:[e]);markerMap[r]||(markerMap[r]=new WeakMap);var i=markerMap[r],o=[],l=new Set,s=new Set(a),c=function(e){!e||l.has(e)||(l.add(e),c(e.parentNode))};a.forEach(c);var u=function(e){!e||s.has(e)||Array.prototype.forEach.call(e.children,function(e){if(l.has(e))u(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,s=(counterMap.get(e)||0)+1,c=(i.get(e)||0)+1;counterMap.set(e,s),i.set(e,c),o.push(e),1===s&&a&&uncontrolledNodes.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return u(t),l.clear(),lockCount++,function(){o.forEach(function(e){var t=counterMap.get(e)-1,a=i.get(e)-1;counterMap.set(e,t),i.set(e,a),t||(uncontrolledNodes.has(e)||e.removeAttribute(n),uncontrolledNodes.delete(e)),a||e.removeAttribute(r)}),--lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=t||getDefaultParent(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),applyAttributeToOthers(n,a,r,"aria-hidden")):function(){return null}},inertOthers=function(e,t,r){void 0===r&&(r="data-inert-ed");var n=t||getDefaultParent(e);return n?applyAttributeToOthers(e,n,r,"inert"):function(){return null}},supportsInert=function(){return"u">typeof HTMLElement&&HTMLElement.prototype.hasOwnProperty("inert")},suppressOthers=function(e,t,r){return void 0===r&&(r="data-suppressed"),(supportsInert()?inertOthers:hideOthers)(e,t,r)},extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var tslib_es6_assign=function(){return(tslib_es6_assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)0>t.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function __decorate(e,t,r,n){var a,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(o=(i<3?a(o):i>3?a(t,r,o):a(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function __param(e,t){return function(r,n){t(r,n,e)}}function __esDecorate(e,t,r,n,a,i){function o(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var l,s=n.kind,c="getter"===s?"get":"setter"===s?"set":"value",u=!t&&e?n.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in n)f[m]="access"===m?{}:n[m];for(var m in n.access)f.access[m]=n.access[m];f.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");i.push(o(e||null))};var g=(0,r[p])("accessor"===s?{get:d.get,set:d.set}:d[c],f);if("accessor"===s){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw TypeError("Object expected");(l=o(g.get))&&(d.get=l),(l=o(g.set))&&(d.set=l),(l=o(g.init))&&a.unshift(l)}else(l=o(g))&&("field"===s?a.unshift(l):d[c]=l)}u&&Object.defineProperty(u,n.name,d),h=!0}function __runInitializers(e,t,r){for(var n=arguments.length>2,a=0;a<t.length;a++)r=n?t[a].call(e,r):t[a].call(e);return n?r:void 0}function __propKey(e){return"symbol"==typeof e?e:"".concat(e)}function __setFunctionName(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(a,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function l(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,l)}s((n=n.apply(e,t||[])).next())})}function __generator(e,t){var r,n,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(s){var c=[l,s];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){i.label=c[1];break}if(6===c[0]&&i.label<a[1]){i.label=a[1],a=c;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(c);break}a[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var __createBinding=Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function __exportStar(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}function __spreadArrays(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),a=0,t=0;t<r;t++)for(var i=arguments[t],o=0,l=i.length;o<l;o++,a++)n[a]=i[o];return n}function __spreadArray(e,t,r){if(r||2==arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}function __await(e){return this instanceof __await?(this.v=e,this):new __await(e)}function __asyncGenerator(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,a=r.apply(e,t||[]),i=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),n[Symbol.asyncIterator]=function(){return this},n;function o(e,t){a[e]&&(n[e]=function(t){return new Promise(function(r,n){i.push([e,t,r,n])>1||l(e,t)})},t&&(n[e]=t(n[e])))}function l(e,t){try{var r;(r=a[e](t)).value instanceof __await?Promise.resolve(r.value.v).then(s,c):u(i[0][2],r)}catch(e){u(i[0][3],e)}}function s(e){l("next",e)}function c(e){l("throw",e)}function u(e,t){e(t),i.shift(),i.length&&l(i[0][0],i[0][1])}}function __asyncDelegator(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,a){t[n]=e[n]?function(t){return(r=!r)?{value:__await(e[n](t)),done:!1}:a?a(t):t}:a}}function __asyncValues(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=__values(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){var i,o,l;i=n,o=a,l=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:l})},o)})}}}function __makeTemplateObject(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var __setModuleDefault=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},ownKeys=function(e){return(ownKeys=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function __importStar(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=ownKeys(e),n=0;n<r.length;n++)"default"!==r[n]&&__createBinding(t,e,r[n]);return __setModuleDefault(t,e),t}function __importDefault(e){return e&&e.__esModule?e:{default:e}}function __classPrivateFieldGet(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function __classPrivateFieldSet(e,t,r,n,a){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,r):a?a.value=r:t.set(e,r),r}function __classPrivateFieldIn(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function __addDisposableResource(e,t,r){if(null!=t){var n,a;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(a=n)}if("function"!=typeof n)throw TypeError("Object not disposable.");a&&(n=function(){try{a.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var _SuppressedError=null;function __disposeResources(e){function t(t){e.error=e.hasError?new _SuppressedError(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,n=0;return function a(){for(;r=e.stack.pop();)try{if(!r.async&&1===n)return n=0,e.stack.push(r),Promise.resolve().then(a);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(a,function(e){return t(e),a()})}else n|=1}catch(e){t(e)}if(1===n)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function __rewriteRelativeImportExtension(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,n,a,i){return r?t?".jsx":".js":!n||a&&i?n+a+"."+i.toLowerCase()+"js":e}):e}let tslib_es6=null;var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}function useRef_useCallbackRef(e,t){var r=external_react_useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(value){var n=r.value;n!==value&&(r.value=value,r.callback(value,n))}}}})[0];return r.callback=t,r.facade}var useMergeRef_useIsomorphicLayoutEffect="u">typeof window?__rspack_external_react.useLayoutEffect:__rspack_external_react.useEffect,currentValues=new WeakMap;function useMergeRefs(e,t){var r=useRef_useCallbackRef(t||null,function(t){return e.forEach(function(e){return assignRef(e,t)})});return useMergeRef_useIsomorphicLayoutEffect(function(){var t=currentValues.get(r);if(t){var n=new Set(t),a=new Set(e),i=r.current;n.forEach(function(e){a.has(e)||assignRef(e,null)}),a.forEach(function(e){n.has(e)||assignRef(e,i)})}currentValues.set(r,e)},[e]),r}function ItoI(e){return e}function innerCreateMedium(e,t){void 0===t&&(t=ItoI);var r=[],n=!1;return{read:function(){if(n)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var i=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(i)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}}}function createMedium(e,t){return void 0===t&&(t=ItoI),innerCreateMedium(e,t)}function createSidecarMedium(e){void 0===e&&(e={});var t=innerCreateMedium(null);return t.options=tslib_es6_assign({async:!0,ssr:!1},e),t}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=__rspack_external_react.forwardRef(function(e,t){var r=__rspack_external_react.useRef(null),n=__rspack_external_react.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),a=n[0],i=n[1],o=e.forwardProps,l=e.children,s=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,h=e.sideCar,p=e.noRelative,f=e.noIsolation,m=e.inert,g=e.allowPinchZoom,b=e.as,v=e.gapMode,w=__rest(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),y=useMergeRefs([r,t]),x=tslib_es6_assign(tslib_es6_assign({},w),a);return __rspack_external_react.createElement(__rspack_external_react.Fragment,null,u&&__rspack_external_react.createElement(h,{sideCar:effectCar,removeScrollBar:c,shards:d,noRelative:p,noIsolation:f,inert:m,setCallbacks:i,allowPinchZoom:!!g,lockRef:r,gapMode:v}),o?__rspack_external_react.cloneElement(__rspack_external_react.Children.only(l),tslib_es6_assign(tslib_es6_assign({},x),{ref:y})):__rspack_external_react.createElement(void 0===b?"div":b,tslib_es6_assign({},x,{className:s,ref:y}),l))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var exports_SideCar=function(e){var t=e.sideCar,r=__rest(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return __rspack_external_react.createElement(n,tslib_es6_assign({},r))};function exportSidecar(e,t){return e.useMedium(t),exports_SideCar}exports_SideCar.isSideCarExport=!0;var setNonce=function(e){currentNonce=e},getNonce=function(){return currentNonce||__webpack_require__.nc};function makeStyleTag(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=getNonce();return t&&e.setAttribute("nonce",t),e}function injectStyles(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function insertStyleTag(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var stylesheetSingleton=function(){var e=0,t=null;return{add:function(r){0==e&&(t=makeStyleTag())&&(injectStyles(t,r),insertStyleTag(t)),e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},styleHookSingleton=function(){var e=stylesheetSingleton();return function(t,r){__rspack_external_react.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},styleSingleton=function(){var e=styleHookSingleton();return function(t){return e(t.styles,t.dynamic),null}},zeroGap={left:0,top:0,right:0,gap:0},parse=function(e){return parseInt(e||"",10)||0},getOffset=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[parse(r),parse(n),parse(a)]},getGapWidth=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return zeroGap;var t=getOffset(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},component_Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(e,t,r,n){var a=e.left,i=e.top,o=e.right,l=e.gap;return void 0===r&&(r="margin"),"\n .".concat(noScrollbarsClassName," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(l,"px ").concat(n,";\n }\n body[").concat(lockAttribute,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(i,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(l,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(zeroRightClassName," {\n right: ").concat(l,"px ").concat(n,";\n }\n \n .").concat(fullWidthClassName," {\n margin-right: ").concat(l,"px ").concat(n,";\n }\n \n .").concat(zeroRightClassName," .").concat(zeroRightClassName," {\n right: 0 ").concat(n,";\n }\n \n .").concat(fullWidthClassName," .").concat(fullWidthClassName," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(lockAttribute,"] {\n ").concat(removedBarSizeVariable,": ").concat(l,"px;\n }\n")},getCurrentUseCounter=function(){var e=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(e)?e:0},useLockAttribute=function(){__rspack_external_react.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var e=getCurrentUseCounter()-1;e<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,e.toString())}},[])},RemoveScrollBar=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=void 0===n?"margin":n;useLockAttribute();var i=__rspack_external_react.useMemo(function(){return getGapWidth(a)},[a]);return __rspack_external_react.createElement(component_Style,{styles:getStyles(i,!t,a,r?"":"!important")})},passiveSupported=!1;if("u">typeof window)try{var aggresiveCapture_options=Object.defineProperty({},"passive",{get:function(){return passiveSupported=!0,!0}});window.addEventListener("test",aggresiveCapture_options,aggresiveCapture_options),window.removeEventListener("test",aggresiveCapture_options,aggresiveCapture_options)}catch(err){passiveSupported=!1}var nonPassive=!!passiveSupported&&{passive:!1},alwaysContainsScroll=function(e){return"TEXTAREA"===e.tagName},elementCanBeScrolled=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!alwaysContainsScroll(e)&&"visible"===r[t])},elementCouldBeVScrolled=function(e){return elementCanBeScrolled(e,"overflowY")},elementCouldBeHScrolled=function(e){return elementCanBeScrolled(e,"overflowX")},locationCouldBeScrolled=function(e,t){var r=t.ownerDocument,n=t;do{if("u">typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),elementCouldBeScrolled(e,n)){var a=getScrollVariables(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body)return!1},getVScrollVariables=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},getHScrollVariables=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},elementCouldBeScrolled=function(e,t){return"v"===e?elementCouldBeVScrolled(t):elementCouldBeHScrolled(t)},getScrollVariables=function(e,t){return"v"===e?getVScrollVariables(t):getHScrollVariables(t)},getDirectionFactor=function(e,t){return"h"===e&&"rtl"===t?-1:1},handleScroll_handleScroll=function(e,t,r,n,a){var i=getDirectionFactor(e,window.getComputedStyle(t).direction),o=i*n,l=r.target,s=t.contains(l),c=!1,u=o>0,d=0,h=0;do{if(!l)break;var p=getScrollVariables(e,l),f=p[0],m=p[1]-p[2]-i*f;(f||m)&&elementCouldBeScrolled(e,l)&&(d+=m,h+=f);var g=l.parentNode;l=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!s&&l!==document.body||s&&(t.contains(l)||t===l))return u&&(a&&1>Math.abs(d)||!a&&o>d)?c=!0:!u&&(a&&1>Math.abs(h)||!a&&-o>h)&&(c=!0),c},getTouchXY=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(e){return[e.deltaX,e.deltaY]},extractRef=function(e){return e&&"current"in e?e.current:e},deltaCompare=function(e,t){return e[0]===t[0]&&e[1]===t[1]},generateStyle=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},idCounter=0,lockStack=[];function RemoveScrollSideCar(e){var t=__rspack_external_react.useRef([]),r=__rspack_external_react.useRef([0,0]),n=__rspack_external_react.useRef(),a=__rspack_external_react.useState(idCounter++)[0],i=__rspack_external_react.useState(styleSingleton)[0],o=__rspack_external_react.useRef(e);__rspack_external_react.useEffect(function(){o.current=e},[e]),__rspack_external_react.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=__spreadArray([e.lockRef.current],(e.shards||[]).map(extractRef),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=__rspack_external_react.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var a,i=getTouchXY(e),l=r.current,s="deltaX"in e?e.deltaX:l[0]-i[0],c="deltaY"in e?e.deltaY:l[1]-i[1],u=e.target,d=Math.abs(s)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var h=window.getSelection(),p=h&&h.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var f=locationCouldBeScrolled(d,u);if(!f)return!0;if(f?a=d:(a="v"===d?"h":"v",f=locationCouldBeScrolled(d,u)),!f)return!1;if(!n.current&&"changedTouches"in e&&(s||c)&&(n.current=a),!a)return!0;var m=n.current||a;return handleScroll_handleScroll(m,t,e,"h"===m?s:c,!0)},[]),s=__rspack_external_react.useCallback(function(e){if(lockStack.length&&lockStack[lockStack.length-1]===i){var r="deltaY"in e?getDeltaXY(e):getTouchXY(e),n=t.current.filter(function(t){return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&deltaCompare(t.delta,r)})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var a=(o.current.shards||[]).map(extractRef).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?l(e,a[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=__rspack_external_react.useCallback(function(e,r,n,a){var i={name:e,delta:r,target:n,should:a,shadowParent:getOutermostShadowParent(n)};t.current.push(i),setTimeout(function(){t.current=t.current.filter(function(e){return e!==i})},1)},[]),u=__rspack_external_react.useCallback(function(e){r.current=getTouchXY(e),n.current=void 0},[]),d=__rspack_external_react.useCallback(function(t){c(t.type,getDeltaXY(t),t.target,l(t,e.lockRef.current))},[]),h=__rspack_external_react.useCallback(function(t){c(t.type,getTouchXY(t),t.target,l(t,e.lockRef.current))},[]);__rspack_external_react.useEffect(function(){return lockStack.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",s,nonPassive),document.addEventListener("touchmove",s,nonPassive),document.addEventListener("touchstart",u,nonPassive),function(){lockStack=lockStack.filter(function(e){return e!==i}),document.removeEventListener("wheel",s,nonPassive),document.removeEventListener("touchmove",s,nonPassive),document.removeEventListener("touchstart",u,nonPassive)}},[]);var p=e.removeScrollBar,f=e.inert;return __rspack_external_react.createElement(__rspack_external_react.Fragment,null,f?__rspack_external_react.createElement(i,{styles:generateStyle(a)}):null,p?__rspack_external_react.createElement(RemoveScrollBar,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function getOutermostShadowParent(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}let sidecar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=__rspack_external_react.forwardRef(function(e,t){return __rspack_external_react.createElement(RemoveScroll,tslib_es6_assign({},e,{ref:t,sideCar:sidecar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;let Combination=ReactRemoveScroll;var react_menu_dist_defProp=Object.defineProperty,react_menu_dist_name=(e,t)=>react_menu_dist_defProp(e,"name",{value:t,configurable:!0}),SELECTION_KEYS=["Enter"," "],FIRST_KEYS=["ArrowDown","PageUp","Home"],LAST_KEYS=["ArrowUp","PageDown","End"],FIRST_LAST_KEYS=[...FIRST_KEYS,...LAST_KEYS],SUB_OPEN_KEYS={ltr:[...SELECTION_KEYS,"ArrowRight"],rtl:[...SELECTION_KEYS,"ArrowLeft"]},SUB_CLOSE_KEYS=null,MENU_NAME="Menu",[dist_Collection,react_menu_dist_useCollection,react_menu_dist_createCollectionScope]=createCollection(MENU_NAME),[createMenuContext,createMenuScope]=createContextScope(MENU_NAME,[react_menu_dist_createCollectionScope,createPopperScope,createRovingFocusGroupScope]),usePopperScope=createPopperScope(),useRovingFocusGroupScope=createRovingFocusGroupScope(),[MenuProvider,useMenuContext]=createMenuContext(MENU_NAME),[MenuRootProvider,useMenuRootContext]=createMenuContext(MENU_NAME),Menu=/* @__PURE__ */react_menu_dist_name(e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:i,modal:o=!0}=e,l=usePopperScope(t),[s,c]=__rspack_external_react.useState(null),u=__rspack_external_react.useRef(!1),d=dist_useCallbackRef(i),h=useDirection(a);return __rspack_external_react.useEffect(()=>{let e=/* @__PURE__ */react_menu_dist_name(()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},"handleKeyDown"),t=/* @__PURE__ */react_menu_dist_name(()=>u.current=!1,"handlePointer");return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),__rspack_external_react.useEffect(()=>{if(!r)return;let e=/* @__PURE__ */react_menu_dist_name(()=>d(!1),"handleBlur");return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[r,d]),/* @__PURE__ */jsx_runtime_jsx(Root2,{...l,children:/* @__PURE__ */jsx_runtime_jsx(MenuProvider,{scope:t,open:r,onOpenChange:d,content:s,onContentChange:c,children:/* @__PURE__ */jsx_runtime_jsx(MenuRootProvider,{scope:t,onClose:__rspack_external_react.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:n})})})},"Menu"),MenuAnchor=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{__scopeMenu:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(Anchor,{...usePopperScope(r),...n,ref:t})},"MenuAnchor")),PORTAL_NAME="MenuPortal",[PortalProvider,usePortalContext]=createMenuContext(PORTAL_NAME,{forceMount:void 0}),MenuPortal=/* @__PURE__ */react_menu_dist_name(e=>{let{__scopeMenu:t,forceMount:r,children:n,container:a}=e,i=useMenuContext(PORTAL_NAME,t);return /* @__PURE__ */jsx_runtime_jsx(PortalProvider,{scope:t,forceMount:r,children:/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||i.open,children:/* @__PURE__ */jsx_runtime_jsx(Portal,{asChild:!0,container:a,children:n})})})},"MenuPortal"),dist_CONTENT_NAME="MenuContent",[MenuContentProvider,useMenuContentContext]=createMenuContext(dist_CONTENT_NAME),MenuContent=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let r=usePortalContext(dist_CONTENT_NAME,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,i=useMenuContext(dist_CONTENT_NAME,e.__scopeMenu),o=useMenuRootContext(dist_CONTENT_NAME,e.__scopeMenu);return /* @__PURE__ */jsx_runtime_jsx(dist_Collection.Provider,{scope:e.__scopeMenu,children:/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:n||i.open,children:/* @__PURE__ */jsx_runtime_jsx(dist_Collection.Slot,{scope:e.__scopeMenu,children:o.modal?/* @__PURE__ */jsx_runtime_jsx(MenuRootContentModal,{...a,ref:t}):/* @__PURE__ */jsx_runtime_jsx(MenuRootContentNonModal,{...a,ref:t})})})})},"MenuContent")),MenuRootContentModal=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let r=useMenuContext(dist_CONTENT_NAME,e.__scopeMenu),n=__rspack_external_react.useRef(null),a=dist_useComposedRefs(t,n);return __rspack_external_react.useEffect(()=>{let e=n.current;if(e)return hideOthers(e)},[]),/* @__PURE__ */jsx_runtime_jsx(MenuContentImpl,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:dist_composeEventHandlers(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),MenuRootContentNonModal=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let r=useMenuContext(dist_CONTENT_NAME,e.__scopeMenu);return /* @__PURE__ */jsx_runtime_jsx(MenuContentImpl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),react_menu_dist_Slot=createSlot("MenuContent.ScrollLock"),MenuContentImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:f,...m}=e,g=useMenuContext(dist_CONTENT_NAME,r),b=useMenuRootContext(dist_CONTENT_NAME,r),v=usePopperScope(r),w=useRovingFocusGroupScope(r),y=react_menu_dist_useCollection(r),[x,k]=__rspack_external_react.useState(null),S=__rspack_external_react.useRef(null),D=dist_useComposedRefs(t,S,g.onContentChange),M=__rspack_external_react.useRef(0),F=__rspack_external_react.useRef(""),C=__rspack_external_react.useRef(0),E=__rspack_external_react.useRef(null),N=__rspack_external_react.useRef("right"),A=__rspack_external_react.useRef(0),T=f?Combination:__rspack_external_react.Fragment,I=/* @__PURE__ */react_menu_dist_name(e=>{let t=F.current+e,r=y().filter(e=>!e.disabled),n=document.activeElement,a=r.find(e=>e.ref.current===n)?.textValue,i=getNextMatch(r.map(e=>e.textValue),t,a),o=r.find(e=>e.textValue===i)?.ref.current;o&&setTimeout(()=>o.focus())},"handleTypeaheadSearch");__rspack_external_react.useEffect(()=>()=>window.clearTimeout(M.current),[]),useFocusGuards();let P=__rspack_external_react.useCallback(e=>N.current===E.current?.side&&isPointerInGraceArea(e,E.current?.area),[]);return /* @__PURE__ */jsx_runtime_jsx(MenuContentProvider,{scope:r,searchRef:F,onItemEnter:__rspack_external_react.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:__rspack_external_react.useCallback(e=>{P(e)||(S.current?.focus(),k(null))},[P]),onTriggerLeave:__rspack_external_react.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:C,onPointerGraceIntentChange:__rspack_external_react.useCallback(e=>{E.current=e},[]),children:/* @__PURE__ */jsx_runtime_jsx(T,{...f?{as:react_menu_dist_Slot,allowPinchZoom:!0}:void 0,children:/* @__PURE__ */jsx_runtime_jsx(FocusScope,{asChild:!0,trapped:a,onMountAutoFocus:dist_composeEventHandlers(i,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:/* @__PURE__ */jsx_runtime_jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:/* @__PURE__ */jsx_runtime_jsx(react_roving_focus_dist_Root,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:n,currentTabStopId:x,onCurrentTabStopIdChange:k,onEntryFocus:dist_composeEventHandlers(s,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:/* @__PURE__ */jsx_runtime_jsx(Content,{role:"menu","aria-orientation":"vertical","data-state":getOpenState(g.open),"data-radix-menu-content":"",dir:b.dir,...v,...m,ref:D,style:{outline:"none",...m.style},onKeyDown:dist_composeEventHandlers(m.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&n&&I(e.key));let a=S.current;if(e.target!==a||!FIRST_LAST_KEYS.includes(e.key))return;e.preventDefault();let i=y().filter(e=>!e.disabled).map(e=>e.ref.current);LAST_KEYS.includes(e.key)&&i.reverse(),react_menu_dist_focusFirst(i)}),onBlur:dist_composeEventHandlers(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(M.current),F.current="")}),onPointerMove:dist_composeEventHandlers(e.onPointerMove,whenMouse(e=>{let t=e.target,r=A.current!==e.clientX;e.currentTarget.contains(t)&&r&&(N.current=e.clientX>A.current?"right":"left",A.current=e.clientX)}))})})})})})})},"MenuContentImpl")),MenuGroup=/* @__PURE__ */null,MenuLabel=/* @__PURE__ */null,dist_ITEM_NAME="MenuItem",ITEM_SELECT="menu.itemSelect",MenuItem=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{disabled:r=!1,onSelect:n,...a}=e,i=__rspack_external_react.useRef(null),o=useMenuRootContext(dist_ITEM_NAME,e.__scopeMenu),l=useMenuContentContext(dist_ITEM_NAME,e.__scopeMenu),s=dist_useComposedRefs(t,i),c=__rspack_external_react.useRef(!1),u=/* @__PURE__ */react_menu_dist_name(()=>{let e=i.current;if(!r&&e){let t=new CustomEvent(ITEM_SELECT,{bubbles:!0,cancelable:!0});e.addEventListener(ITEM_SELECT,e=>n?.(e),{once:!0}),dispatchDiscreteCustomEvent(e,t),t.defaultPrevented?c.current=!1:o.onClose()}},"handleSelect");return /* @__PURE__ */jsx_runtime_jsx(MenuItemImpl,{...a,ref:s,disabled:r,onClick:dist_composeEventHandlers(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:dist_composeEventHandlers(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:dist_composeEventHandlers(e.onKeyDown,e=>{r||e.target!==e.currentTarget||(""===l.searchRef.current||" "!==e.key)&&SELECTION_KEYS.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},"MenuItem")),MenuItemImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{__scopeMenu:r,disabled:n=!1,textValue:a,...i}=e,o=useMenuContentContext(dist_ITEM_NAME,r),l=useRovingFocusGroupScope(r),s=__rspack_external_react.useRef(null),c=dist_useComposedRefs(t,s),[u,d]=__rspack_external_react.useState(!1),[h,p]=__rspack_external_react.useState("");return __rspack_external_react.useEffect(()=>{let e=s.current;e&&p((e.textContent??"").trim())},[i.children]),/* @__PURE__ */jsx_runtime_jsx(dist_Collection.ItemSlot,{scope:r,disabled:n,textValue:a??h,children:/* @__PURE__ */jsx_runtime_jsx(Item,{asChild:!0,...l,focusable:!n,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:c,onPointerMove:dist_composeEventHandlers(e.onPointerMove,whenMouse(e=>{n?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:dist_composeEventHandlers(e.onPointerLeave,whenMouse(e=>o.onItemLeave(e))),onFocus:dist_composeEventHandlers(e.onFocus,()=>d(!0)),onBlur:dist_composeEventHandlers(e.onBlur,()=>d(!1))})})})},"MenuItemImpl")),MenuCheckboxItem=/* @__PURE__ */null,RADIO_GROUP_NAME="MenuRadioGroup",[RadioGroupProvider,useRadioGroupContext]=createMenuContext(RADIO_GROUP_NAME,{value:void 0,onValueChange:/* @__PURE__ */react_menu_dist_name(()=>{},"onValueChange")}),MenuRadioGroup=/* @__PURE__ */null,RADIO_ITEM_NAME="MenuRadioItem",MenuRadioItem=/* @__PURE__ */null,ITEM_INDICATOR_NAME="MenuItemIndicator",[ItemIndicatorProvider,useItemIndicatorContext]=createMenuContext(ITEM_INDICATOR_NAME,{checked:!1}),MenuItemIndicator=/* @__PURE__ */null,MenuSeparator=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_menu_dist_name(function(e,t){let{__scopeMenu:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})},"MenuSeparator")),MenuArrow=/* @__PURE__ */null,SUB_NAME="MenuSub",[MenuSubProvider,useMenuSubContext]=createMenuContext(SUB_NAME),MenuSub=/* @__PURE__ */null,SUB_TRIGGER_NAME="MenuSubTrigger",MenuSubTrigger=/* @__PURE__ */null,SUB_CONTENT_NAME="MenuSubContent",MenuSubContent=/* @__PURE__ */null;function getOpenState(e){return e?"open":"closed"}function isIndeterminate(e){return"indeterminate"===e}function getCheckedState(e){return isIndeterminate(e)?"indeterminate":e?"checked":"unchecked"}function react_menu_dist_focusFirst(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function dist_wrapArray(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function getNextMatch(e,t,r){let n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1,i=dist_wrapArray(e,Math.max(a,0));1===n.length&&(i=i.filter(e=>e!==r));let o=i.find(e=>e.toLowerCase().startsWith(n.toLowerCase()));return o!==r?o:void 0}function isPointInPolygon(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let o=t[e],l=t[i],s=o.x,c=o.y,u=l.x,d=l.y;c>n!=d>n&&r<(u-s)*(n-c)/(d-c)+s&&(a=!a)}return a}function isPointerInGraceArea(e,t){return!!t&&isPointInPolygon({x:e.clientX,y:e.clientY},t)}function whenMouse(e){return t=>"mouse"===t.pointerType?e(t):void 0}react_menu_dist_name(getOpenState,"getOpenState"),react_menu_dist_name(isIndeterminate,"isIndeterminate"),react_menu_dist_name(getCheckedState,"getCheckedState"),react_menu_dist_name(react_menu_dist_focusFirst,"focusFirst"),react_menu_dist_name(dist_wrapArray,"wrapArray"),react_menu_dist_name(getNextMatch,"getNextMatch"),react_menu_dist_name(isPointInPolygon,"isPointInPolygon"),react_menu_dist_name(isPointerInGraceArea,"isPointerInGraceArea"),react_menu_dist_name(whenMouse,"whenMouse");var Root3=Menu,Anchor2=MenuAnchor,dist_Portal=MenuPortal,Content2=MenuContent,Group=null,Label=null,Item2=MenuItem,CheckboxItem=null,RadioGroup=null,RadioItem=null,ItemIndicator=null,Separator=MenuSeparator,dist_Arrow2=null,Sub=null,SubTrigger=null,SubContent=null,react_dropdown_menu_dist_defProp=Object.defineProperty,react_dropdown_menu_dist_name=(e,t)=>react_dropdown_menu_dist_defProp(e,"name",{value:t,configurable:!0}),DROPDOWN_MENU_NAME="DropdownMenu",[createDropdownMenuContext,createDropdownMenuScope]=createContextScope(DROPDOWN_MENU_NAME,[createMenuScope]),useMenuScope=createMenuScope(),[DropdownMenuProvider,useDropdownMenuContext]=createDropdownMenuContext(DROPDOWN_MENU_NAME),DropdownMenu=/* @__PURE__ */react_dropdown_menu_dist_name(e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:a,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,s=useMenuScope(t),c=__rspack_external_react.useRef(null),[u,d]=dist_useControllableState({prop:a,defaultProp:i??!1,onChange:o,caller:DROPDOWN_MENU_NAME});return /* @__PURE__ */jsx_runtime_jsx(DropdownMenuProvider,{scope:t,triggerId:dist_useId(),triggerRef:c,contentId:dist_useId(),open:u,onOpenChange:d,onOpenToggle:__rspack_external_react.useCallback(()=>d(e=>!e),[d]),modal:l,children:/* @__PURE__ */jsx_runtime_jsx(Root3,{...s,open:u,onOpenChange:d,dir:n,modal:l,children:r})})},"DropdownMenu"),TRIGGER_NAME="DropdownMenuTrigger",DropdownMenuTrigger=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dropdown_menu_dist_name(function(e,t){let{__scopeDropdownMenu:r,disabled:n=!1,...a}=e,i=useDropdownMenuContext(TRIGGER_NAME,r),o=useMenuScope(r),l=dist_useComposedRefs(t,i.triggerRef);return /* @__PURE__ */jsx_runtime_jsx(Anchor2,{asChild:!0,...o,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:l,onPointerDown:dist_composeEventHandlers(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(i.onOpenToggle(),i.open||e.preventDefault())}),onKeyDown:dist_composeEventHandlers(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&i.onOpenToggle(),"ArrowDown"===e.key&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})},"DropdownMenuTrigger")),DropdownMenuPortal=/* @__PURE__ */react_dropdown_menu_dist_name(e=>{let{__scopeDropdownMenu:t,...r}=e;return /* @__PURE__ */jsx_runtime_jsx(dist_Portal,{...useMenuScope(t),...r})},"DropdownMenuPortal"),react_dropdown_menu_dist_CONTENT_NAME="DropdownMenuContent",DropdownMenuContent=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dropdown_menu_dist_name(function(e,t){let{__scopeDropdownMenu:r,...n}=e,a=useDropdownMenuContext(react_dropdown_menu_dist_CONTENT_NAME,r),i=useMenuScope(r),o=__rspack_external_react.useRef(!1);return /* @__PURE__ */jsx_runtime_jsx(Content2,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...n,ref:t,onCloseAutoFocus:dist_composeEventHandlers(e.onCloseAutoFocus,e=>{o.current||a.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:dist_composeEventHandlers(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!a.modal||n)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),DropdownMenuGroup=/* @__PURE__ */null,DropdownMenuLabel=/* @__PURE__ */null,DropdownMenuItem=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dropdown_menu_dist_name(function(e,t){let{__scopeDropdownMenu:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(Item2,{...useMenuScope(r),...n,ref:t})},"DropdownMenuItem")),DropdownMenuCheckboxItem=/* @__PURE__ */null,DropdownMenuRadioGroup=/* @__PURE__ */null,DropdownMenuRadioItem=/* @__PURE__ */null,DropdownMenuItemIndicator=/* @__PURE__ */null,DropdownMenuSeparator=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_dropdown_menu_dist_name(function(e,t){let{__scopeDropdownMenu:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(Separator,{...useMenuScope(r),...n,ref:t})},"DropdownMenuSeparator")),DropdownMenuArrow=/* @__PURE__ */null,DropdownMenuSub=/* @__PURE__ */null,DropdownMenuSubTrigger=/* @__PURE__ */null,DropdownMenuSubContent=/* @__PURE__ */null,dist_Root2=DropdownMenu,Trigger=DropdownMenuTrigger,dist_Portal2=DropdownMenuPortal,dist_Content2=DropdownMenuContent,Group2=null,Label2=null,dist_Item2=DropdownMenuItem,CheckboxItem2=null,RadioGroup2=null,RadioItem2=null,ItemIndicator2=null,dist_Separator2=DropdownMenuSeparator,react_dropdown_menu_dist_Arrow2=null,Sub2=null,SubTrigger2=null,SubContent2=null;let useSafeLayoutEffect="u"<typeof window?external_react_useEffect:useLayoutEffect,incrementPortalUsers=e=>{let t=Number.parseInt(e.getAttribute("data-rfkit-charts-portal-users")??"0",10);e.setAttribute("data-rfkit-charts-portal-users",String(t+1))},decrementPortalUsers=e=>{let t=Number.parseInt(e.getAttribute("data-rfkit-charts-portal-users")??"0",10)-1;t<=0?e.remove():e.setAttribute("data-rfkit-charts-portal-users",String(t))},useChartsPortalContainer=e=>{let[t,r]=external_react_useState(null);return useSafeLayoutEffect(()=>{let t=ensureChartsPortalRoot(e);if(t)return incrementPortalUsers(t),r(t),()=>{decrementPortalUsers(t)}},[e]),t};function dropdown_menu_DropdownMenu({...e}){return /*#__PURE__*/jsx_runtime_jsx(dist_Root2,{"data-slot":"dropdown-menu",...e})}let dropdown_menu_DropdownMenuTrigger=/*#__PURE__*/__rspack_external_react.forwardRef(({...e},t)=>/*#__PURE__*/jsx_runtime_jsx(Trigger,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));function dropdown_menu_DropdownMenuPortal({...e}){let t=useChartsPortalContainer("dropdown-menu");return t?/*#__PURE__*/jsx_runtime_jsx(dist_Portal2,{"data-slot":"dropdown-menu-portal",container:t,...e}):null}function dropdown_menu_DropdownMenuContent({className:e,sideOffset:t=8,...r}){return /*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuPortal,{children:/*#__PURE__*/jsx_runtime_jsx(dist_Content2,{"data-slot":"dropdown-menu-content",sideOffset:t,className:cn_cn("z-50 min-w-[8.75rem] overflow-hidden rounded-[var(--radius-surface)] border border-border/70 bg-background/98 p-[calc(var(--size-gap-base)/2)] text-foreground shadow-lg backdrop-blur-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",e),...r})})}dropdown_menu_DropdownMenuTrigger.displayName=Trigger.displayName;let dropdown_menu_DropdownMenuItem=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,...t},r)=>/*#__PURE__*/jsx_runtime_jsx(dist_Item2,{ref:r,"data-slot":"dropdown-menu-item",className:cn_cn("relative flex w-full cursor-default select-none items-center gap-2 px-[var(--size-gap-base)] py-[calc(var(--size-gap-base)/2)] text-xs outline-none transition-colors","rounded-[var(--radius-control)] focus:bg-accent/80 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground data-[disabled]:opacity-40",e),...t}));dropdown_menu_DropdownMenuItem.displayName=dist_Item2.displayName;let dropdown_menu_DropdownMenuSeparator=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,...t},r)=>/*#__PURE__*/jsx_runtime_jsx(dist_Separator2,{ref:r,"data-slot":"dropdown-menu-separator",className:cn_cn("my-[calc(var(--size-gap-base)/2)] h-px bg-border/60",e),...t}));dropdown_menu_DropdownMenuSeparator.displayName=dist_Separator2.displayName;var number_dist_defProp=Object.defineProperty,number_dist_name=(e,t)=>number_dist_defProp(e,"name",{value:t,configurable:!0});function dist_clamp(e,[t,r]){return Math.min(r,Math.max(t,e))}number_dist_name(dist_clamp,"clamp");var react_scroll_area_dist_defProp=Object.defineProperty,react_scroll_area_dist_name=(e,t)=>react_scroll_area_dist_defProp(e,"name",{value:t,configurable:!0});function dist_useStateMachine(e,t){return __rspack_external_react.useReducer((e,r)=>t[e][r]??e,e)}react_scroll_area_dist_name(dist_useStateMachine,"useStateMachine");var SCROLL_AREA_NAME="ScrollArea",[createScrollAreaContext,createScrollAreaScope]=createContextScope(SCROLL_AREA_NAME),[ScrollAreaProvider,useScrollAreaContext]=createScrollAreaContext(SCROLL_AREA_NAME),ScrollArea=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...o}=e,[l,s]=__rspack_external_react.useState(null),[c,u]=__rspack_external_react.useState(null),[d,h]=__rspack_external_react.useState(null),[p,f]=__rspack_external_react.useState(null),[m,g]=__rspack_external_react.useState(null),[b,v]=__rspack_external_react.useState(0),[w,y]=__rspack_external_react.useState(0),[x,k]=__rspack_external_react.useState(!1),[S,D]=__rspack_external_react.useState(!1),M=dist_useComposedRefs(t,s),F=useDirection(a);return /* @__PURE__ */jsx_runtime_jsx(ScrollAreaProvider,{scope:r,type:n,dir:F,scrollHideDelay:i,scrollArea:l,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:p,onScrollbarXChange:f,scrollbarXEnabled:x,onScrollbarXEnabledChange:k,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:S,onScrollbarYEnabledChange:D,onCornerWidthChange:v,onCornerHeightChange:y,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{dir:F,...o,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})},"ScrollArea")),VIEWPORT_NAME="ScrollAreaViewport",ScrollAreaViewport=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,children:n,nonce:a,...i}=e,o=useScrollAreaContext(VIEWPORT_NAME,r),l=dist_useComposedRefs(t,__rspack_external_react.useRef(null),o.onViewportChange);return /* @__PURE__ */jsxs(Fragment,{children:[/* @__PURE__ */jsx_runtime_jsx(ScrollAreaViewportStyle,{nonce:a}),/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:/* @__PURE__ */jsx_runtime_jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})},"ScrollAreaViewport")),ScrollAreaViewportStyle=/* @__PURE__ */__rspack_external_react.memo(/* @__PURE__ */react_scroll_area_dist_name(function({nonce:e}){return /* @__PURE__ */jsx_runtime_jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:e})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),SCROLLBAR_NAME="ScrollAreaScrollbar",ScrollAreaScrollbar=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{forceMount:r,...n}=e,a=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,l="horizontal"===e.orientation;return __rspack_external_react.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),"hover"===a.type?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarHover,{...n,ref:t,forceMount:r}):"scroll"===a.type?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarScroll,{...n,ref:t,forceMount:r}):"auto"===a.type?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarAuto,{...n,ref:t,forceMount:r}):"always"===a.type?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarVisible,{...n,ref:t,"data-state":"visible"}):null},"ScrollAreaScrollbar")),ScrollAreaScrollbarHover=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{forceMount:r,...n}=e,a=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),[i,o]=__rspack_external_react.useState(!1);return __rspack_external_react.useEffect(()=>{let e=a.scrollArea,t=0;if(e){let r=/* @__PURE__ */react_scroll_area_dist_name(()=>{window.clearTimeout(t),o(!0)},"handlePointerEnter"),n=/* @__PURE__ */react_scroll_area_dist_name(()=>{t=window.setTimeout(()=>o(!1),a.scrollHideDelay)},"handlePointerLeave");return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[a.scrollArea,a.scrollHideDelay]),/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||i,children:/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarAuto,{"data-state":i?"visible":"hidden",...n,ref:t})})},"ScrollAreaScrollbarHover")),ScrollAreaScrollbarScroll=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{forceMount:r,...n}=e,a=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),i="horizontal"===e.orientation,o=useDebounceCallback(()=>s("SCROLL_END"),100),[l,s]=dist_useStateMachine("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return __rspack_external_react.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>s("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,a.scrollHideDelay,s]),__rspack_external_react.useEffect(()=>{let e=a.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t],n=/* @__PURE__ */react_scroll_area_dist_name(()=>{let n=e[t];r!==n&&(s("SCROLL"),o()),r=n},"handleScroll");return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[a.viewport,i,s,o]),/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||"hidden"!==l,children:/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarVisible,{"data-state":"hidden"===l?"hidden":"visible",...n,ref:t,onPointerEnter:dist_composeEventHandlers(e.onPointerEnter,()=>s("POINTER_ENTER")),onPointerLeave:dist_composeEventHandlers(e.onPointerLeave,()=>s("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),ScrollAreaScrollbarAuto=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let r=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,o]=__rspack_external_react.useState(!1),l="horizontal"===e.orientation,s=useDebounceCallback(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;o(l?e:t)}},10);return useResizeObserver(r.viewport,s),useResizeObserver(r.content,s),/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:n||i,children:/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarVisible,{"data-state":i?"visible":"hidden",...a,ref:t})})},"ScrollAreaScrollbarAuto")),ScrollAreaScrollbarVisible=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{orientation:r="vertical",...n}=e,a=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),i=__rspack_external_react.useRef(null),o=__rspack_external_react.useRef(0),[l,s]=__rspack_external_react.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=getThumbRatio(l.viewport,l.content),u={...n,sizes:l,onSizesChange:s,hasThumb:!!(c>0&&c<1),onThumbChange:/* @__PURE__ */react_scroll_area_dist_name(e=>i.current=e,"onThumbChange"),onThumbPointerUp:/* @__PURE__ */react_scroll_area_dist_name(()=>o.current=0,"onThumbPointerUp"),onThumbPointerDown:/* @__PURE__ */react_scroll_area_dist_name(e=>o.current=e,"onThumbPointerDown")};function d(e,t){return getScrollPositionFromPointer(e,o.current,l,t)}return(react_scroll_area_dist_name(d,"getScrollPosition"),"horizontal"===r)?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarX,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){let e=getThumbOffsetFromScroll(a.viewport.scrollLeft,l,a.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=d(e,a.dir))}}):"vertical"===r?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarY,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){let e=getThumbOffsetFromScroll(a.viewport.scrollTop,l);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=d(e))}}):null},"ScrollAreaScrollbarVisible")),ScrollAreaScrollbarX=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{sizes:r,onSizesChange:n,...a}=e,i=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),[o,l]=__rspack_external_react.useState(),s=__rspack_external_react.useRef(null),c=dist_useComposedRefs(t,s,i.onScrollbarXChange);return __rspack_external_react.useEffect(()=>{s.current&&l(getComputedStyle(s.current))},[s]),/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarImpl,{"data-orientation":"horizontal",...a,ref:c,sizes:r,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":getThumbSize(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(i.viewport){let n=i.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),isScrollingWithinScrollbarBounds(n,r)&&t.preventDefault()}},onResize:()=>{s.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:s.current.clientWidth,paddingStart:toInt(o.paddingLeft),paddingEnd:toInt(o.paddingRight)}})}})},"ScrollAreaScrollbarX")),ScrollAreaScrollbarY=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{sizes:r,onSizesChange:n,...a}=e,i=useScrollAreaContext(SCROLLBAR_NAME,e.__scopeScrollArea),[o,l]=__rspack_external_react.useState(),s=__rspack_external_react.useRef(null),c=dist_useComposedRefs(t,s,i.onScrollbarYChange);return __rspack_external_react.useEffect(()=>{s.current&&l(getComputedStyle(s.current))},[s]),/* @__PURE__ */jsx_runtime_jsx(ScrollAreaScrollbarImpl,{"data-orientation":"vertical",...a,ref:c,sizes:r,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":getThumbSize(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(i.viewport){let n=i.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),isScrollingWithinScrollbarBounds(n,r)&&t.preventDefault()}},onResize:()=>{s.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:s.current.clientHeight,paddingStart:toInt(o.paddingTop),paddingEnd:toInt(o.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[ScrollbarProvider,useScrollbarContext]=createScrollAreaContext(SCROLLBAR_NAME),ScrollAreaScrollbarImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:s,onDragScroll:c,onWheelScroll:u,onResize:d,...h}=e,p=useScrollAreaContext(SCROLLBAR_NAME,r),[f,m]=__rspack_external_react.useState(null),g=dist_useComposedRefs(t,m),b=__rspack_external_react.useRef(null),v=__rspack_external_react.useRef(""),w=p.viewport,y=n.content-n.viewport,x=dist_useCallbackRef(u),k=dist_useCallbackRef(s),S=useDebounceCallback(d,10);function D(e){b.current&&c({x:e.clientX-b.current.left,y:e.clientY-b.current.top})}return react_scroll_area_dist_name(D,"handleDragScroll"),__rspack_external_react.useEffect(()=>{let e=/* @__PURE__ */react_scroll_area_dist_name(e=>{let t=e.target;f?.contains(t)&&x(e,y)},"handleWheel");return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,f,y,x]),__rspack_external_react.useEffect(k,[n,k]),useResizeObserver(f,S),useResizeObserver(p.content,S),/* @__PURE__ */jsx_runtime_jsx(ScrollbarProvider,{scope:r,scrollbar:f,hasThumb:a,onThumbChange:dist_useCallbackRef(i),onThumbPointerUp:dist_useCallbackRef(o),onThumbPositionChange:k,onThumbPointerDown:dist_useCallbackRef(l),children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:dist_composeEventHandlers(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),b.current=f.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),D(e))}),onPointerMove:dist_composeEventHandlers(e.onPointerMove,D),onPointerUp:dist_composeEventHandlers(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})},"ScrollAreaScrollbarImpl")),THUMB_NAME="ScrollAreaThumb",ScrollAreaThumb=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{forceMount:r,...n}=e,a=useScrollbarContext(THUMB_NAME,e.__scopeScrollArea);return /* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||a.hasThumb,children:/* @__PURE__ */jsx_runtime_jsx(ScrollAreaThumbImpl,{ref:t,...n})})},"ScrollAreaThumb")),ScrollAreaThumbImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,style:n,...a}=e,i=useScrollAreaContext(THUMB_NAME,r),o=useScrollbarContext(THUMB_NAME,r),{onThumbPositionChange:l}=o,s=dist_useComposedRefs(t,o.onThumbChange),c=__rspack_external_react.useRef(void 0),u=useDebounceCallback(()=>{c.current&&(c.current(),c.current=void 0)},100);return __rspack_external_react.useEffect(()=>{let e=i.viewport;if(e){let t=/* @__PURE__ */react_scroll_area_dist_name(()=>{u(),c.current||(c.current=addUnlinkedScrollListener(e,l),l())},"handleScroll");return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,u,l]),/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:s,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:dist_composeEventHandlers(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;o.onThumbPointerDown({x:r,y:n})}),onPointerUp:dist_composeEventHandlers(e.onPointerUp,o.onThumbPointerUp)})},"ScrollAreaThumbImpl")),CORNER_NAME="ScrollAreaCorner",ScrollAreaCorner=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let r=useScrollAreaContext(CORNER_NAME,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?/* @__PURE__ */jsx_runtime_jsx(ScrollAreaCornerImpl,{...e,ref:t}):null},"ScrollAreaCorner")),ScrollAreaCornerImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_scroll_area_dist_name(function(e,t){let{__scopeScrollArea:r,...n}=e,a=useScrollAreaContext(CORNER_NAME,r),[i,o]=__rspack_external_react.useState(0),[l,s]=__rspack_external_react.useState(0),c=!!(i&&l),{onCornerWidthChange:u,onCornerHeightChange:d}=a;return useResizeObserver(a.scrollbarX,()=>{let e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),s(e)}),useResizeObserver(a.scrollbarY,()=>{let e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),o(e)}),__rspack_external_react.useEffect(()=>()=>{u(0),d(0)},[u,d]),c?/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{...n,ref:t,style:{width:i,height:l,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null},"ScrollAreaCornerImpl"));function toInt(e){return e?parseInt(e,10):0}function getThumbRatio(e,t){let r=e/t;return isNaN(r)?0:r}function getThumbSize(e){let t=getThumbRatio(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function getScrollPositionFromPointer(e,t,r,n="ltr"){let a=getThumbSize(r),i=t||a/2,o=r.scrollbar.paddingStart+i,l=r.scrollbar.size-r.scrollbar.paddingEnd-(a-i),s=r.content-r.viewport;return linearScale([o,l],"ltr"===n?[0,s]:[-1*s,0])(e)}function getThumbOffsetFromScroll(e,t,r="ltr"){let n=getThumbSize(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,o=t.content-t.viewport,l=dist_clamp(e,"ltr"===r?[0,o]:[-1*o,0]);return linearScale([0,o],[0,i-n])(l)}function linearScale(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function isScrollingWithinScrollbarBounds(e,t){return e>0&&e<t}react_scroll_area_dist_name(toInt,"toInt"),react_scroll_area_dist_name(getThumbRatio,"getThumbRatio"),react_scroll_area_dist_name(getThumbSize,"getThumbSize"),react_scroll_area_dist_name(getScrollPositionFromPointer,"getScrollPositionFromPointer"),react_scroll_area_dist_name(getThumbOffsetFromScroll,"getThumbOffsetFromScroll"),react_scroll_area_dist_name(linearScale,"linearScale"),react_scroll_area_dist_name(isScrollingWithinScrollbarBounds,"isScrollingWithinScrollbarBounds");var addUnlinkedScrollListener=/* @__PURE__ */react_scroll_area_dist_name((e,t=()=>{})=>(e.scrollLeft,e.scrollTop,()=>window.cancelAnimationFrame(0)),"addUnlinkedScrollListener");function useDebounceCallback(e,t){let r=dist_useCallbackRef(e),n=__rspack_external_react.useRef(0);return __rspack_external_react.useEffect(()=>()=>window.clearTimeout(n.current),[]),__rspack_external_react.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function useResizeObserver(e,t){let r=dist_useCallbackRef(t);useLayoutEffect2(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}react_scroll_area_dist_name(useDebounceCallback,"useDebounceCallback"),react_scroll_area_dist_name(useResizeObserver,"useResizeObserver");var react_scroll_area_dist_Root=ScrollArea,Viewport=ScrollAreaViewport,Scrollbar=null,Thumb=null,Corner=ScrollAreaCorner;let ScrollBar=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,orientation:t="vertical",...r},n)=>/*#__PURE__*/jsx_runtime_jsx(ScrollAreaScrollbar,{ref:n,orientation:t,className:cn_cn("flex touch-none select-none p-0.5 transition-colors","vertical"===t?"h-full w-2.5 border-l border-l-transparent":"h-2.5 flex-col border-t border-t-transparent",e),...r,children:/*#__PURE__*/jsx_runtime_jsx(ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border/80"})}));ScrollBar.displayName=ScrollAreaScrollbar.displayName;let scroll_area_ScrollArea=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,viewportClassName:t,children:r,...n},a)=>/*#__PURE__*/jsxs(react_scroll_area_dist_Root,{ref:a,"data-slot":"scroll-area",className:cn_cn("relative overflow-hidden",e),...n,children:[/*#__PURE__*/jsx_runtime_jsx(Viewport,{"data-slot":"scroll-area-viewport",className:cn_cn("h-full w-full rounded-[inherit]",t),children:r}),/*#__PURE__*/jsx_runtime_jsx(ScrollBar,{}),/*#__PURE__*/jsx_runtime_jsx(Corner,{})]}));scroll_area_ScrollArea.displayName=react_scroll_area_dist_Root.displayName;let Mask=/*#__PURE__*/forwardRef(({children:e,className:t,style:r},n)=>/*#__PURE__*/jsxs("div",{className:cn_cn("relative z-[8] flex flex-col items-start p-2 text-popover-foreground",t),style:r,ref:n,children:[/*#__PURE__*/jsx_runtime_jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-[7] rounded-[var(--radius-surface)] border border-border/70 bg-chart-panel/95 shadow-lg [backdrop-filter:saturate(2)_blur(20px)]"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative z-[8] h-full w-full",children:e})]})),components_Mask=/*#__PURE__*/react.memo(Mask);var react_visually_hidden_dist_defProp=Object.defineProperty,react_visually_hidden_dist_name=(e,t)=>react_visually_hidden_dist_defProp(e,"name",{value:t,configurable:!0}),VISUALLY_HIDDEN_STYLES=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),VisuallyHidden=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_visually_hidden_dist_name(function(e,t){return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.span,{...e,ref:t,style:{...VISUALLY_HIDDEN_STYLES,...e.style}})},"VisuallyHidden")),react_visually_hidden_dist_Root=VisuallyHidden,react_tooltip_dist_defProp=Object.defineProperty,react_tooltip_dist_name=(e,t)=>react_tooltip_dist_defProp(e,"name",{value:t,configurable:!0}),[createTooltipContext,createTooltipScope]=createContextScope("Tooltip",[createPopperScope]),dist_usePopperScope=createPopperScope(),dist_PROVIDER_NAME="TooltipProvider",DEFAULT_DELAY_DURATION=700,TOOLTIP_OPEN="tooltip.open",[TooltipProviderContextProvider,useTooltipProviderContext]=createTooltipContext(dist_PROVIDER_NAME),TooltipProvider=/* @__PURE__ */react_tooltip_dist_name(e=>{let{__scopeTooltip:t,delayDuration:r=DEFAULT_DELAY_DURATION,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:i}=e,o=__rspack_external_react.useRef(!0),l=__rspack_external_react.useRef(!1),s=__rspack_external_react.useRef(0);return __rspack_external_react.useEffect(()=>{let e=s.current;return()=>window.clearTimeout(e)},[]),/* @__PURE__ */jsx_runtime_jsx(TooltipProviderContextProvider,{scope:t,isOpenDelayedRef:o,delayDuration:r,onOpen:__rspack_external_react.useCallback(()=>{n<=0||(window.clearTimeout(s.current),o.current=!1)},[n]),onClose:__rspack_external_react.useCallback(()=>{n<=0||(window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.current=!0,n))},[n]),isPointerInTransitRef:l,onPointerInTransitChange:__rspack_external_react.useCallback(e=>{l.current=e},[]),disableHoverableContent:a,children:i})},"TooltipProvider"),TOOLTIP_NAME="Tooltip",[TooltipContextProvider,useTooltipContext]=createTooltipContext(TOOLTIP_NAME),dist_Tooltip=/* @__PURE__ */react_tooltip_dist_name(e=>{let{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,s=useTooltipProviderContext(TOOLTIP_NAME,e.__scopeTooltip),c=dist_usePopperScope(t),[u,d]=__rspack_external_react.useState(null),[h,p]=__rspack_external_react.useState(void 0),f=dist_useId(),m=__rspack_external_react.useRef(0),g=o??s.disableHoverableContent,b=l??s.delayDuration,v=__rspack_external_react.useRef(!1),[w,y]=dist_useControllableState({prop:n,defaultProp:a??!1,onChange:/* @__PURE__ */react_tooltip_dist_name(e=>{e?(s.onOpen(),document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))):s.onClose(),i?.(e)},"onChange"),caller:TOOLTIP_NAME}),x=__rspack_external_react.useMemo(()=>w?v.current?"delayed-open":"instant-open":"closed",[w]),k=__rspack_external_react.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,y(!0)},[y]),S=__rspack_external_react.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),D=__rspack_external_react.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,y(!0),m.current=0},b)},[b,y]);return __rspack_external_react.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),/* @__PURE__ */jsx_runtime_jsx(Root2,{...c,children:/* @__PURE__ */jsx_runtime_jsx(TooltipContextProvider,{scope:t,contentId:h??f,setContentId:p,open:w,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:__rspack_external_react.useCallback(()=>{s.isOpenDelayedRef.current?D():k()},[s.isOpenDelayedRef,D,k]),onTriggerLeave:__rspack_external_react.useCallback(()=>{g?S():(window.clearTimeout(m.current),m.current=0)},[S,g]),onOpen:k,onClose:S,disableHoverableContent:g,children:r})})},"Tooltip"),dist_TRIGGER_NAME="TooltipTrigger",TooltipTrigger=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let{__scopeTooltip:r,...n}=e,a=useTooltipContext(dist_TRIGGER_NAME,r),i=useTooltipProviderContext(dist_TRIGGER_NAME,r),o=dist_usePopperScope(r),l=dist_useComposedRefs(t,__rspack_external_react.useRef(null),a.onTriggerChange),s=__rspack_external_react.useRef(!1),c=__rspack_external_react.useRef(!1),u=__rspack_external_react.useCallback(()=>s.current=!1,[]);return __rspack_external_react.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),/* @__PURE__ */jsx_runtime_jsx(Anchor,{asChild:!0,...o,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:l,onPointerMove:dist_composeEventHandlers(e.onPointerMove,e=>{"touch"!==e.pointerType&&(c.current||i.isPointerInTransitRef.current||(a.onTriggerEnter(),c.current=!0))}),onPointerLeave:dist_composeEventHandlers(e.onPointerLeave,()=>{a.onTriggerLeave(),c.current=!1}),onPointerDown:dist_composeEventHandlers(e.onPointerDown,()=>{a.open&&a.onClose(),s.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:dist_composeEventHandlers(e.onFocus,()=>{s.current||a.onOpen()}),onBlur:dist_composeEventHandlers(e.onBlur,a.onClose),onClick:dist_composeEventHandlers(e.onClick,a.onClose)})})},"TooltipTrigger")),dist_PORTAL_NAME="TooltipPortal",[dist_PortalProvider,dist_usePortalContext]=createTooltipContext(dist_PORTAL_NAME,{forceMount:void 0}),TooltipPortal=/* @__PURE__ */react_tooltip_dist_name(e=>{let{__scopeTooltip:t,forceMount:r,children:n,container:a}=e,i=useTooltipContext(dist_PORTAL_NAME,t);return /* @__PURE__ */jsx_runtime_jsx(dist_PortalProvider,{scope:t,forceMount:r,children:/* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:r||i.open,children:/* @__PURE__ */jsx_runtime_jsx(Portal,{asChild:!0,container:a,children:n})})})},"TooltipPortal"),react_tooltip_dist_CONTENT_NAME="TooltipContent",TooltipContent=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let r=dist_usePortalContext(react_tooltip_dist_CONTENT_NAME,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...i}=e,o=useTooltipContext(react_tooltip_dist_CONTENT_NAME,e.__scopeTooltip);return /* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:n||o.open,children:o.disableHoverableContent?/* @__PURE__ */jsx_runtime_jsx(TooltipContentImpl,{side:a,...i,ref:t}):/* @__PURE__ */jsx_runtime_jsx(TooltipContentHoverable,{side:a,...i,ref:t})})},"TooltipContent")),TooltipContentHoverable=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let r=useTooltipContext(react_tooltip_dist_CONTENT_NAME,e.__scopeTooltip),n=useTooltipProviderContext(react_tooltip_dist_CONTENT_NAME,e.__scopeTooltip),a=__rspack_external_react.useRef(null),i=dist_useComposedRefs(t,a),[o,l]=__rspack_external_react.useState(null),{trigger:s,onClose:c}=r,u=a.current,{onPointerInTransitChange:d}=n,h=__rspack_external_react.useCallback(()=>{l(null),d(!1)},[d]),p=__rspack_external_react.useCallback((e,t)=>{let r=e.currentTarget,n={x:e.clientX,y:e.clientY},a=getExitSideFromRect(n,r.getBoundingClientRect());l(getHull([...getPaddedExitPoints(n,a),...getPointsFromRect(t.getBoundingClientRect())])),d(!0)},[d]);return __rspack_external_react.useEffect(()=>()=>h(),[h]),__rspack_external_react.useEffect(()=>{if(s&&u){let e=/* @__PURE__ */react_tooltip_dist_name(e=>p(e,u),"handleTriggerLeave"),t=/* @__PURE__ */react_tooltip_dist_name(e=>p(e,s),"handleContentLeave");return s.addEventListener("pointerleave",e),u.addEventListener("pointerleave",t),()=>{s.removeEventListener("pointerleave",e),u.removeEventListener("pointerleave",t)}}},[s,u,p,h]),__rspack_external_react.useEffect(()=>{if(o){let e=/* @__PURE__ */react_tooltip_dist_name(e=>{let t=e.target,r={x:e.clientX,y:e.clientY},n=s?.contains(t)||u?.contains(t),a=!dist_isPointInPolygon(r,o);n?h():a&&(h(),c())},"handleTrackPointerGrace");return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[s,u,o,c,h]),/* @__PURE__ */jsx_runtime_jsx(TooltipContentImpl,{...e,ref:i})},"TooltipContentHoverable")),dist_Slottable=createSlottable("TooltipContent"),TooltipContentImpl=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let{__scopeTooltip:r,children:n,"aria-label":a,id:i,onEscapeKeyDown:o,onPointerDownOutside:l,...s}=e,c=useTooltipContext(react_tooltip_dist_CONTENT_NAME,r),u=dist_usePopperScope(r),{onClose:d}=c;__rspack_external_react.useEffect(()=>(document.addEventListener(TOOLTIP_OPEN,d),()=>document.removeEventListener(TOOLTIP_OPEN,d)),[d]),__rspack_external_react.useEffect(()=>{if(c.trigger){let e=/* @__PURE__ */react_tooltip_dist_name(e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&d()},"handleScroll");return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[c.trigger,d]);let{setContentId:h}=c;return useLayoutEffect2(()=>(h(i),()=>{h(void 0)}),[i,h]),/* @__PURE__ */jsx_runtime_jsx(DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:/* @__PURE__ */jsxs(Content,{"data-state":c.stateAttribute,role:a?void 0:"tooltip",id:a?void 0:c.contentId,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[/* @__PURE__ */jsx_runtime_jsx(dist_Slottable,{children:n}),a?/* @__PURE__ */jsx_runtime_jsx(react_visually_hidden_dist_Root,{id:c.contentId,role:"tooltip",children:a}):null]})})},"TooltipContentImpl")),TooltipArrow=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_tooltip_dist_name(function(e,t){let{__scopeTooltip:r,...n}=e;return /* @__PURE__ */jsx_runtime_jsx(dist_Arrow,{...dist_usePopperScope(r),...n,ref:t})},"TooltipArrow"));function getExitSideFromRect(e,t){let r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,a,i)){case i:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw Error("unreachable")}}function getPaddedExitPoints(e,t,r=5){let n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return n}function getPointsFromRect(e){let{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function dist_isPointInPolygon(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let o=t[e],l=t[i],s=o.x,c=o.y,u=l.x,d=l.y;c>n!=d>n&&r<(u-s)*(n-c)/(d-c)+s&&(a=!a)}return a}function getHull(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:1*!!(e.y>t.y)),getHullPresorted(t)}function getHullPresorted(e){if(e.length<=1)return e.slice();let t=[];for(let r=0;r<e.length;r++){let n=e[r];for(;t.length>=2;){let e=t[t.length-1],r=t[t.length-2];if((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x))t.pop();else break}t.push(n)}t.pop();let r=[];for(let t=e.length-1;t>=0;t--){let n=e[t];for(;r.length>=2;){let e=r[r.length-1],t=r[r.length-2];if((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x))r.pop();else break}r.push(n)}return(r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y)?t:t.concat(r)}react_tooltip_dist_name(getExitSideFromRect,"getExitSideFromRect"),react_tooltip_dist_name(getPaddedExitPoints,"getPaddedExitPoints"),react_tooltip_dist_name(getPointsFromRect,"getPointsFromRect"),react_tooltip_dist_name(dist_isPointInPolygon,"isPointInPolygon"),react_tooltip_dist_name(getHull,"getHull"),react_tooltip_dist_name(getHullPresorted,"getHullPresorted");var react_tooltip_dist_Provider=TooltipProvider,dist_Root3=dist_Tooltip,dist_Trigger=TooltipTrigger,react_tooltip_dist_Portal=TooltipPortal,react_tooltip_dist_Content2=TooltipContent,react_tooltip_dist_Arrow2=TooltipArrow;function tooltip_TooltipProvider({delayDuration:e=0,...t}){return /*#__PURE__*/jsx_runtime_jsx(react_tooltip_dist_Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function tooltip_Tooltip({...e}){return /*#__PURE__*/jsx_runtime_jsx(dist_Root3,{"data-slot":"tooltip",...e})}function tooltip_TooltipTrigger({...e}){return /*#__PURE__*/jsx_runtime_jsx(dist_Trigger,{"data-slot":"tooltip-trigger",...e})}function tooltip_TooltipContent({className:e,sideOffset:t=6,children:r,...n}){let a=useChartsPortalContainer("tooltip");return a?/*#__PURE__*/jsx_runtime_jsx(react_tooltip_dist_Portal,{container:a,children:/*#__PURE__*/jsxs(react_tooltip_dist_Content2,{"data-slot":"tooltip-content",sideOffset:t,className:cn_cn("z-50 max-w-52 overflow-hidden rounded-[var(--radius-control)] border border-border/70 bg-popover/95 px-2.5 py-1.5 text-[11px] leading-4 text-popover-foreground shadow-lg backdrop-blur-md","pointer-events-none whitespace-pre-line","origin-[--radix-tooltip-content-transform-origin] data-[state=closed]:animate-out data-[state=open]:animate-in","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",e),...n,children:[r,/*#__PURE__*/jsx_runtime_jsx(react_tooltip_dist_Arrow2,{className:"fill-popover stroke-border/70 stroke-[0.5px]"})]})}):null}let TOOLTIP_MAX_WIDTH=200,TOOLTIP_SIDE_OFFSET=6,TOOLTIP_COLLISION_PADDING=8,Tooltip_Tooltip=({children:e,content:t,delay:r=200,duration:n=3e3,offset:a={x:0,y:0}})=>{let[i,o]=external_react_useState(!1),l=external_react_useRef(null),s=external_react_useCallback(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),c=external_react_useCallback(()=>{s(),n<=0||(l.current=setTimeout(()=>{o(!1),l.current=null},n))},[s,n]),u=external_react_useCallback(e=>{(o(e),e)?c():s()},[s,c]);return(external_react_useEffect(()=>()=>{s()},[s]),null==t||""===t)?e:/*#__PURE__*/jsx_runtime_jsx(tooltip_TooltipProvider,{delayDuration:r,children:/*#__PURE__*/jsxs(tooltip_Tooltip,{open:i,onOpenChange:u,children:[/*#__PURE__*/jsx_runtime_jsx(tooltip_TooltipTrigger,{asChild:!0,children:e}),/*#__PURE__*/jsx_runtime_jsx(tooltip_TooltipContent,{side:"top",align:"center",sideOffset:TOOLTIP_SIDE_OFFSET,collisionPadding:TOOLTIP_COLLISION_PADDING,avoidCollisions:!0,className:"border-0 bg-transparent p-0 text-xs shadow-none",style:{marginLeft:a.x??0,marginTop:a.y??0,maxWidth:TOOLTIP_MAX_WIDTH},children:/*#__PURE__*/jsx_runtime_jsx(components_Mask,{className:"max-w-[200px] whitespace-pre-line",children:t})})]})})},Overlay_Tooltip=Tooltip_Tooltip,Dropdown=({value:e,options:t,onChange:r,placeholder:n="请选择",triggerContent:a,triggerTitle:i,closeOnSelect:o=!0,triggerVariant:l="default",showChevron:s=!0,triggerClassName:c,contentClassName:u,contentAlignOffset:d,customContent:h,triggerTestId:p})=>{let[f,m]=external_react_useState(!1),g=external_react_useCallback(e=>{let t=e.value??null;e.onSelect?.(t),r?.(t),o&&m(!1)},[r,o]),b=external_react_useMemo(()=>t.find(t=>"separator"!==t.type&&t.value===e),[t,e]),v=cn_cn("inline-flex h-full min-w-0 items-center truncate text-xs leading-none text-foreground","default"===l&&"flex-1"),w=a??(b?.label?/*#__PURE__*/jsx_runtime_jsx("span",{className:v,children:b.label}):"string"==typeof n?/*#__PURE__*/jsx_runtime_jsx("span",{className:v,children:n}):/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn("inline-flex h-full min-w-0 items-center","default"===l&&"flex-1"),children:n})),y=/*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuTrigger,{asChild:!0,children:/*#__PURE__*/jsxs("button",{type:"button","data-testid":p,className:cn_cn("cursor-pointer appearance-none select-none border-0 bg-transparent text-left","default"===l&&TOOLBAR_OUTLINED_TRIGGER_CLASS_NAME,"default"===l&&TOOLBAR_OUTLINED_TRIGGER_OPEN_CLASS_NAME,"plain"===l&&TOOLBAR_INLINE_TRIGGER_CLASS_NAME,c),children:[w,s?/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:cn_cn("ml-[calc(var(--size-gap-base)/2)] inline-flex h-full shrink-0 items-center justify-center text-[10px] text-muted-foreground transition-transform",f&&"rotate-180"),children:"▼"}):null]})});return /*#__PURE__*/jsxs(dropdown_menu_DropdownMenu,{open:f,onOpenChange:m,modal:!1,children:[i?/*#__PURE__*/jsx_runtime_jsx(Overlay_Tooltip,{content:i,children:y}):y,/*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuContent,{align:"start",alignOffset:d,collisionPadding:8,className:cn_cn("min-w-[140px] [min-width:var(--radix-dropdown-menu-trigger-width)]",u),children:h??/*#__PURE__*/jsx_runtime_jsx(scroll_area_ScrollArea,{viewportClassName:"h-auto max-h-64",children:/*#__PURE__*/jsx_runtime_jsx("div",{children:t.map((t,r)=>"separator"===t.type?/*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuSeparator,{style:t.style},`separator-${t.label??r}`):/*#__PURE__*/jsx_runtime_jsx(dropdown_menu_DropdownMenuItem,{disabled:t.disabled,className:cn_cn(e===t.value&&"bg-accent text-primary",t.disabled&&"data-[disabled]:text-muted-foreground"),style:t.style,onSelect:e=>{o||e.preventDefault(),g(t)},children:t.render?t.render():t.label},null!==t.value&&void 0!==t.value?t.value:`null-option-${r}`))})})})]})},Overlay_Dropdown=Dropdown,DEFAULT_SAMPLE_INTERVAL_MS=80,DEFAULT_SAMPLE_IDLE_DELAY_MS=80,interaction_createBounds=(e,t,r,n)=>({left:e,top:t,right:r,bottom:n,width:Math.max(0,r-e),height:Math.max(0,n-t)}),toCursorEventSnapshot=e=>({sourceId:e.sourceId,sourceType:e.sourceType,clientX:e.clientX,clientY:e.clientY,bounds:e.bounds}),isSameSample=(e,t)=>e?.sourceId===t.sourceId&&e?.sourceType===t.sourceType&&e?.coord.left===t.coord.left&&e?.coord.top===t.coord.top&&e?.clientX===t.clientX&&e?.clientY===t.clientY&&e?.bounds.left===t.bounds.left&&e?.bounds.top===t.bounds.top&&e?.bounds.right===t.bounds.right&&e?.bounds.bottom===t.bounds.bottom&&e?.sampledIndex===t.sampledIndex&&e?.globalIndex===t.globalIndex&&e?.rowIndex===t.rowIndex;class InteractionRuntime{entries=new Map;sampleIntervalMs;sampleIdleDelayMs;now;requestFrame;cancelFrame;setTimer;clearTimer;constructor(e={}){this.sampleIntervalMs=e.sampleIntervalMs??DEFAULT_SAMPLE_INTERVAL_MS,this.sampleIdleDelayMs=e.sampleIdleDelayMs??DEFAULT_SAMPLE_IDLE_DELAY_MS,this.now=e.now??(()=>Date.now()),this.requestFrame=e.requestFrame??(e=>"u">typeof window?window.requestAnimationFrame(e):Number(setTimeout(e,16))),this.cancelFrame=e.cancelFrame??(e=>{"u">typeof window?window.cancelAnimationFrame(e):clearTimeout(e)}),this.setTimer=e.setTimer??((e,t)=>"u">typeof window?window.setTimeout(e,t):setTimeout(e,t)),this.clearTimer=e.clearTimer??(e=>{"u">typeof window?window.clearTimeout(e):clearTimeout(e)})}updatePointer(e,t){let r=this.ensureEntry(e);r.version+=1,r.pointer={...t,version:r.version,timestamp:this.now()},this.schedulePointerFrame(r),this.scheduleSample(r)}refreshBounds(e,t){let r=this.ensureEntry(e);r.pointer&&(r.version+=1,r.pointer={...r.pointer,bounds:t,version:r.version,timestamp:this.now()},this.schedulePointerFrame(r))}clearPointer(e,t="manual"){let r=this.entries.get(e);r&&(r.pointer=null,r.sample=null,r.lastSampleTimestamp=0,r.hasSampleTimestamp=!1,this.clearEntryTimers(r),this.notifyPointer(r,null),this.notifySample(r,null))}subscribePointer(e,t){let r=this.ensureEntry(e);return r.pointerListeners.add(t),t(r.pointer),()=>{r.pointerListeners.delete(t),this.cleanupEntryIfEmpty(e,r)}}subscribeSample(e,t){let r=this.ensureEntry(e);return r.sampleListeners.add(t),t(r.sample),()=>{r.sampleListeners.delete(t),this.cleanupEntryIfEmpty(e,r)}}getPointer(e){return this.entries.get(e)?.pointer??null}getSample(e){return this.entries.get(e)?.sample??null}dispose(e){if(e){let t=this.entries.get(e);if(!t)return;this.clearPointer(e,"dispose"),t.pointerListeners.clear(),t.sampleListeners.clear(),this.entries.delete(e);return}for(let e of Array.from(this.entries.keys()))this.dispose(e)}ensureEntry(e){let t=this.entries.get(e);if(t)return t;let r={pointer:null,sample:null,pointerListeners:new Set,sampleListeners:new Set,pointerFrame:null,sampleTimer:null,idleTimer:null,lastSampleTimestamp:0,hasSampleTimestamp:!1,version:0};return this.entries.set(e,r),r}schedulePointerFrame(e){null===e.pointerFrame&&(e.pointerFrame=this.requestFrame(()=>{e.pointerFrame=null,this.notifyPointer(e,e.pointer)}))}scheduleSample(e){if(!e.pointer)return;let t=this.now()-e.lastSampleTimestamp;!e.hasSampleTimestamp||t>=this.sampleIntervalMs?this.flushSample(e):e.sampleTimer||(e.sampleTimer=this.setTimer(()=>{e.sampleTimer=null,this.flushSample(e)},this.sampleIntervalMs-t)),e.idleTimer&&this.clearTimer(e.idleTimer),e.idleTimer=this.setTimer(()=>{e.idleTimer=null,this.flushSample(e)},this.sampleIdleDelayMs)}flushSample(e){if(!e.pointer)return;let t={...e.pointer};e.lastSampleTimestamp=this.now(),e.hasSampleTimestamp=!0,isSameSample(e.sample,t)||(e.sample=t,this.notifySample(e,t))}notifyPointer(e,t){for(let r of Array.from(e.pointerListeners))r(t)}notifySample(e,t){for(let r of Array.from(e.sampleListeners))r(t)}clearEntryTimers(e){null!==e.pointerFrame&&(this.cancelFrame(e.pointerFrame),e.pointerFrame=null),e.sampleTimer&&(this.clearTimer(e.sampleTimer),e.sampleTimer=null),e.idleTimer&&(this.clearTimer(e.idleTimer),e.idleTimer=null)}cleanupEntryIfEmpty(e,t){t.pointerListeners.size>0||t.sampleListeners.size>0||t.pointer||t.sample||(this.clearEntryTimers(t),this.entries.delete(e))}}let interactionRuntime=new InteractionRuntime,createInteractionBounds=null,toCursorSnapshotEvent=toCursorEventSnapshot,cursor_follow_layer_useSafeLayoutEffect="u"<typeof window?external_react_useEffect:useLayoutEffect,isValidBounds=e=>Number.isFinite(e.left)&&Number.isFinite(e.top)&&Number.isFinite(e.right)&&Number.isFinite(e.bottom)&&Number.isFinite(e.width)&&Number.isFinite(e.height)&&e.width>0&&e.height>0&&e.right>e.left&&e.bottom>e.top,isPointWithinBounds=(e,t,r)=>e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom,CursorFollowLayer=({children:e,interactionId:t,margin:r=8,className:n})=>{let a=external_react_useRef(null),i=useChartsPortalContainer("cursor-follow"),o=external_react_useMemo(()=>Children.toArray(e),[e]),l=o.length>0,s=external_react_useCallback(()=>{a.current&&(a.current.style.visibility="hidden",a.current.style.transform="translate3d(-100vw, -100vh, 0)")},[]),c=external_react_useRef(null),u=external_react_useCallback((e=c.current)=>{if(!e||!a.current||!l)return void s();c.current=e;let t=a.current,{clientX:n,clientY:i,bounds:o}=e;if(!Number.isFinite(n)||!Number.isFinite(i)||!isValidBounds(o))return void s();let{width:u,height:d}=t.getBoundingClientRect(),h=window.innerWidth,p=window.innerHeight;if(n<0||i<0||n>h||i>p||!isPointWithinBounds(n,i,o))return void s();let f=o.left+r,m=o.top+r,g=o.right-r,b=o.bottom-r,v=Math.max(r,h-u-r),w=Math.max(r,p-d-r),y=Math.max(f,g-u),x=Math.max(m,b-d),k=Math.max(0,o.width-2*r),S=Math.max(0,o.height-2*r),D=i+r,M=n+r;M+u>g&&(M=n-u-r),D+d>b&&(D=i-d-r),M=u<=k?Math.min(Math.max(M,f),y):Math.min(Math.max(M,r),v),D=d<=S?Math.min(Math.max(D,m),x):Math.min(Math.max(D,r),w),t.style.visibility="visible",t.style.transform=`translate3d(${M}px, ${D}px, 0)`},[l,s,r]);return(cursor_follow_layer_useSafeLayoutEffect(()=>l&&t?interactionRuntime.subscribePointer(t,e=>{if(!e){c.current=null,s();return}u(e)}):void s(),[l,s,t,u]),cursor_follow_layer_useSafeLayoutEffect(()=>{if(i)return i.setAttribute("data-rfkit-cursor-layer","true"),()=>{i.removeAttribute("data-rfkit-cursor-layer")}},[i]),cursor_follow_layer_useSafeLayoutEffect(()=>{l?u():s()}),cursor_follow_layer_useSafeLayoutEffect(()=>{if(!a.current||!l)return;let e=()=>{u()},t=new ResizeObserver(()=>{u()});return t.observe(a.current),window.addEventListener("resize",e),()=>{t.disconnect(),window.removeEventListener("resize",e)}},[l,u]),l&&i)?/*#__PURE__*/createPortal(/*#__PURE__*/jsx_runtime_jsx("div",{ref:a,className:cn_cn("pointer-events-none fixed left-0 top-0 z-10 will-change-transform",n),style:{transform:"translate3d(-100vw, -100vh, 0)",visibility:"hidden"},children:o}),i):null},cursor_follow_layer=CursorFollowLayer,Popover=({children:e,id:t})=>/*#__PURE__*/jsx_runtime_jsx(cursor_follow_layer,{interactionId:t,margin:UI_CONFIG.POPOVER_MARGIN,children:e}),Overlay_Popover=Popover,Portal_Portal=({id:e,children:t})=>{let[r,n]=external_react_useState(null);return(external_react_useEffect(()=>{let t;if(e&&((t=document.getElementById(e))&&n(t),!document.getElementById(e))){let t=new MutationObserver(()=>{let r=document.getElementById(e);r&&(n(r),t.disconnect())});return t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()}},[e]),r)?/*#__PURE__*/react_dom.createPortal(t,r):null},Overlay_Portal=Portal_Portal,getAccessibleLabel=e=>"string"==typeof e||"number"==typeof e?String(e).trim()||void 0:Array.isArray(e)?e.map(e=>getAccessibleLabel(e)).filter(Boolean).join(" ").trim()||void 0:/*#__PURE__*/react.isValidElement(e)?getAccessibleLabel(e.props.children):void 0,ToolbarSurface=({style:e,className:t,title:r,active:n=!1,disabled:a=!1,onClick:i,onDoubleClick:o,onWheel:l,children:s})=>{let c=getAccessibleLabel(r),u=i&&(e=>{if(a){e.preventDefault(),e.stopPropagation();return}i(e)}),d=o&&(e=>{if(a){e.preventDefault(),e.stopPropagation();return}o(e)}),h=l&&(e=>{a?e.preventDefault():l(e)}),p=i||o?/*#__PURE__*/jsx_runtime_jsx("button",{type:"button",style:e,"aria-label":c,"aria-pressed":n||void 0,"aria-disabled":a||void 0,"data-active":n?"true":void 0,tabIndex:a?-1:void 0,onClick:u,onDoubleClick:d,onWheel:h,className:t,children:s}):l?/*#__PURE__*/jsx_runtime_jsx("div",{style:e,"aria-disabled":a||void 0,"data-active":n?"true":void 0,onWheel:h,className:t,children:s}):/*#__PURE__*/jsx_runtime_jsx("span",{style:e,"aria-disabled":a||void 0,"data-active":n?"true":void 0,className:t,children:s});return r?/*#__PURE__*/jsx_runtime_jsx(Overlay_Tooltip,{content:r,children:p}):p},primitives_ToolbarSurface=ToolbarSurface,IconBox_IconBox=({style:e,className:t,title:r,children:n,active:a=!1,tone:i="default",disabled:o=!1,onClick:l,onDoubleClick:s})=>{let c=TOOLBAR_ACTIVE_SURFACE_CLASS_NAME_MAP[i];return /*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarSurface,{style:e,className:cn_cn(TOOLBAR_ICON_BOX_CLASS_NAME,!!(l||s)&&TOOLBAR_INTERACTIVE_SURFACE_CLASS_NAME,o&&TOOLBAR_DISABLED_SURFACE_CLASS_NAME,a&&c,t),title:r,active:a,disabled:o,onClick:l,onDoubleClick:s,children:n})},primitives_IconBox=IconBox_IconBox,ToolbarContentBox=({style:e,className:t,contentClassName:r,title:n,active:a=!1,tone:i="default",disabled:o=!1,onClick:l,onDoubleClick:s,onWheel:c,children:u})=>{let d=TOOLBAR_ACTIVE_SURFACE_CLASS_NAME_MAP[i],h=cn_cn(TOOLBAR_CONTENT_BOX_CLASS_NAME,!!(l||s||c)&&TOOLBAR_INTERACTIVE_SURFACE_CLASS_NAME,o&&TOOLBAR_DISABLED_SURFACE_CLASS_NAME,a&&d,t),p=/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn(TOOLBAR_CONTENT_BODY_CLASS_NAME,r),children:u});return /*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarSurface,{style:e,className:h,title:n,active:a,disabled:o,onClick:l,onDoubleClick:s,onWheel:c,children:p})},primitives_ToolbarContentBox=ToolbarContentBox,ToolbarGlyph=({children:e,className:t,opticalOffsetX:r=0,opticalOffsetY:n=0,opticalScale:a=1})=>{let i=[];return(0!==r||0!==n)&&i.push(`translate(${r}px, ${n}px)`),1!==a&&i.push(`scale(${a})`),/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn(TOOLBAR_GLYPH_CLASS_NAME,t),style:i.length>0?{transform:i.join(" ")}:void 0,children:e})},primitives_ToolbarGlyph=ToolbarGlyph;var react_separator_dist_defProp=Object.defineProperty,react_separator_dist_name=(e,t)=>react_separator_dist_defProp(e,"name",{value:t,configurable:!0}),DEFAULT_ORIENTATION="horizontal",ORIENTATIONS=["horizontal","vertical"],dist_Separator=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_separator_dist_name(function(e,t){let{decorative:r,orientation:n=DEFAULT_ORIENTATION,...a}=e,i=isValidOrientation(n)?n:DEFAULT_ORIENTATION;return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.div,{"data-orientation":i,...r?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"},...a,ref:t})},"Separator"));function isValidOrientation(e){return ORIENTATIONS.includes(e)}react_separator_dist_name(isValidOrientation,"isValidOrientation");var react_separator_dist_Root=dist_Separator;function separator_Separator({className:e,orientation:t="horizontal",decorative:r=!0,...n}){return /*#__PURE__*/jsx_runtime_jsx(react_separator_dist_Root,{"data-slot":"separator",decorative:r,orientation:t,className:cn_cn("shrink-0 bg-border/70","horizontal"===t?"h-px w-full":"h-full w-px",e),...n})}let ToolbarGroup=({children:e,className:t,...r})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn(TOOLBAR_OUTLINED_SHELL_CLASS_NAME,"[&>*]:h-full [&>*]:shrink-0",t),...r,children:e}),ToolbarGroupSeparator=({className:e})=>/*#__PURE__*/jsx_runtime_jsx(separator_Separator,{className:cn_cn(TOOLBAR_GROUP_SEPARATOR_CLASS_NAME,e),orientation:"vertical"}),TOOLBAR_DROPDOWN_GROUP_ALIGN_OFFSET=-27,ToolbarDropdown=e=>/*#__PURE__*/jsx_runtime_jsx(Overlay_Dropdown,{...e,triggerVariant:"default",contentClassName:cn_cn(TOOLBAR_DROPDOWN_CONTENT_CLASS_NAME,e.contentClassName)}),ToolbarIconDropdown=({icon:e,title:t,triggerClassName:r,...n})=>{let a=/*#__PURE__*/jsx_runtime_jsx("span",{className:TOOLBAR_TRIGGER_ICON_CLASS_NAME,children:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGlyph,{children:e})});return /*#__PURE__*/jsx_runtime_jsx(Overlay_Dropdown,{...n,triggerVariant:"default",triggerTitle:t,contentClassName:cn_cn(TOOLBAR_DROPDOWN_CONTENT_CLASS_NAME,n.contentClassName),triggerClassName:cn_cn("min-w-0 justify-center gap-0.5 px-1",r),triggerContent:a})},ToolbarDropdownGroup=({leading:e,triggerClassName:t,contentAlignOffset:r=TOOLBAR_DROPDOWN_GROUP_ALIGN_OFFSET,...n})=>/*#__PURE__*/jsxs(ToolbarGroup,{children:[e,/*#__PURE__*/jsx_runtime_jsx(Overlay_Dropdown,{...n,triggerVariant:"plain",contentClassName:cn_cn(TOOLBAR_DROPDOWN_CONTENT_CLASS_NAME,n.contentClassName),contentAlignOffset:r,triggerClassName:cn_cn(TOOLBAR_INLINE_INSET_CLASS_NAME,t)})]}),ToolbarGroupIconBox=({className:e,...t})=>/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{...t,className:cn_cn(TOOLBAR_GROUP_CHILD_CLASS_NAME,e)}),primitives_ToolbarGroupIconBox=ToolbarGroupIconBox,handleColor=(e,t,r)=>subscription_createSubscriptionManager(`handleColor-${e}`,t,r,e),GradientRibbon_config=getConfig(),gradientConfig=GradientRibbon_config.gradient,initialIndex=gradientConfig.index,gradientItems=[...gradientConfig.item],GradientRibbon=()=>{let{state:{axisY:{range:e},globalID:t}}=useStore_useStore(),[r,n]=e??[0,0],[a,i]=external_react_useState(initialIndex),o=external_react_useMemo(()=>[...gradientItems[a]].reverse().map(hexToRGBA),[a]),l=external_react_useCallback(()=>{let e=(a+1)%gradientItems.length;i(e);let r=[...gradientItems[e]].reverse().map(hexToRGBA);t&&handleColor(t)(r)},[a,t]);external_react_useEffect(()=>{if(t)return handleColor(t,"setGradientColors",e=>{let t=gradientItems.findIndex(t=>JSON.stringify([...t].reverse().map(hexToRGBA))===JSON.stringify(e));-1!==t&&i(t)})},[t]);let s=external_react_useMemo(()=>o.map((e,t,r)=>{if(t===r.length-1)return null;let n=r[t+1];return /*#__PURE__*/jsx_runtime_jsx("span",{className:"flex-1",style:{background:`linear-gradient(to right, rgba(${e.r},${e.g},${e.b},${e.a}), rgba(${n.r},${n.g},${n.b},${n.a}))`}},`${e.r}-${e.g}-${e.b}-${e.a}-${n.r}-${n.g}-${n.b}-${n.a}`)}),[o]);return /*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarContentBox,{onClick:l,title:"点击切换瀑布图色阶",contentClassName:TOOLBAR_CONTENT_GRADIENT_CLASS_NAME,children:/*#__PURE__*/jsxs("div",{className:"relative flex h-full w-full select-none",children:[/*#__PURE__*/jsxs("div",{className:"absolute inset-0 flex h-full w-full justify-between text-[9px] text-white",children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex w-full items-center justify-center",children:Math.round(r)}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex w-full items-center justify-center",children:Math.round(n)})]}),s]})})},decorations_GradientRibbon=/*#__PURE__*/react.memo(GradientRibbon),SpacerLine=()=>/*#__PURE__*/jsx_runtime_jsx(separator_Separator,{className:TOOLBAR_SEPARATOR_CLASS_NAME,orientation:"vertical"}),decorations_SpacerLine=SpacerLine;class GradientRenderer extends BaseRenderer{getInitialColors(){return[...getGradient()].reverse().map(e=>hexToRGBA(e))}subscribeToColor(e){this.trackCleanup(handleColor(this.state.globalID,e,e=>{this.state.chart?.updateProps?.({colors:e})}))}updateParams(e){super.updateParams(e)}}let TYPE_CONFIG={iqEye:{Engine:IQEye},iqLine:{Engine:IQ},iqPlanisphere:{Engine:IQ,lineColor:"#ffffff00"},iqStream:{Engine:IQ}};class IQRenderer extends BaseRenderer{constructor(e){super({id:e.id,chart:null,type:e.type})}init(){let{id:e,type:t}=this.state;if(!e)return;let r=TYPE_CONFIG[t],n=getConfig("iq");this.state.chart=new r.Engine({id:e,...n,...r.lineColor&&{lineColor:r.lineColor}}),this.scheduleResize()}updateSeries(e){this.state.chart?.render(e)}}class DialRender extends CircularRenderer{constructor(e){super({id:e.id,chart:null})}init(){let{id:e}=this.state;e&&this.hasRenderableContainerSize()&&(this.state.chart=new Dial({id:e,...getThemeFillStyle(document.getElementById(e))}),this.scheduleResize(),this.subscribeToTheme())}}let Dial_Dial=()=>{let{chart:e,Chart:t}=hooks_useChart({Render:DialRender});return useModuleSubscription({moduleType:constants_ModuleType.Dial,chart:e}),/*#__PURE__*/jsx_runtime_jsx(components_Square,{children:/*#__PURE__*/jsx_runtime_jsx(t,{})})},modules_Dial=Dial_Dial,Chart_Chart=e=>{let{publish:t}=e,{state:{globalID:r}}=useStore_useStore();return publish_usePublish({publish:t,subscribe:e=>{passThrough(r,constants_ModuleType.Dial)(normalizeRenderPublishEvent(e,{allowImplicitRender:!0,renderPSTypes:[constants_PSType.Dial]}))}}),/*#__PURE__*/jsx_runtime_jsx(components_Container,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Dial,{})})},Dial_Chart=Chart_Chart,DialChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,system:{padding:!1,border:!1},children:/*#__PURE__*/jsx_runtime_jsx(Dial_Chart,{...e})}),charts_Dial_Dial=withChartPublisher(DialChart,"Dial"),charts_Dial=charts_Dial_Dial,InteractionSurface=({children:e,padding:t,limit:r,step:n,setLimit:a,onChange:i})=>{let{state:{axisY:{range:o=constants_RANGE_DEFAULT}}}=useStore_useStore(),[l,s]=o,c=external_react_useRef(null),[u,d]=external_react_useState(!1),h=external_react_useCallback(e=>{if(!c.current)return;let t=Math.round((s-l)*((c.current.offsetHeight-(e.clientY-c.current.getBoundingClientRect().top))/c.current.offsetHeight)+l);a(t=Math.max(l,Math.min(s,t)))},[l,s,a]),p=external_react_useCallback(e=>{h(e),d(!0)},[h]),f=external_react_useCallback(()=>{u&&i?.(r),d(!1)},[u,r,i]);return /*#__PURE__*/jsxs("div",{className:"relative h-full w-full",children:[/*#__PURE__*/jsx_runtime_jsx("div",{ref:c,onMouseDown:p,onMouseUp:f,onMouseLeave:f,onMouseMove:external_react_useCallback(e=>{u&&h(e)},[u,h]),onWheel:external_react_useCallback(e=>{let t=r+(e.deltaY>0?-n:n);a(t=Math.max(l,Math.min(s,t))),i?.(t)},[n,r,l,s,a,i]),style:{top:`${t}px`,height:`calc(100% - ${2*t}px)`},className:"absolute left-0 z-[5] w-full"}),e]})},Gauge_InteractionSurface=/*#__PURE__*/react.memo(InteractionSurface);class GaugeRender extends BaseRenderer{constructor(e){super({id:e.id,chart:null,props:e})}init(){let{id:e,props:t}=this.state;e&&(this.state.chart=new Gauge({...getThemeFillStyle(document.getElementById(e)),...t}),this.scheduleResize(),this.trackCleanup(subscribeChartsThemeChange(()=>{let e=this.getContainerElement();if(!e)return;let t=getThemeFillStyle(e);this.state.chart?.updateProps(t),this.resize()})))}updateProps(e){this.state.chart?.updateProps(e)}updateSeries(e){this.state.chart?.render(e)}}let Gauge_padding=20,Gauge_step=2,Gauge_Gauge=({onChange:e})=>{let{state:{globalID:t,axisY:{range:r}}}=useStore_useStore(),{chart:n,Chart:a}=hooks_useChart({Render:GaugeRender,params:{padding:Gauge_padding,step:Gauge_step,range:r}});useModuleSubscription({moduleType:constants_ModuleType.Gauge,chart:n,renderPSTypes:[constants_PSType.Gauge],handleRender:(e,t)=>{t.updateSeries?.(e)}});let[i,o]=external_react_useState(0);return external_react_useEffect(()=>{passThrough(t,constants_ModuleType.Gauge)({pstype:constants_PSType.Gauge,limit:i})},[i,t]),external_react_useEffect(()=>{r&&n?.updateProps({range:r})},[r]),/*#__PURE__*/jsx_runtime_jsx(Gauge_InteractionSurface,{padding:Gauge_padding,limit:i,step:Gauge_step,setLimit:e=>o(e),onChange:e,children:/*#__PURE__*/jsx_runtime_jsx(a,{})})},modules_Gauge=Gauge_Gauge,Gauge_Chart_Chart=e=>{let{publish:t,onChange:r}=e,{state:{globalID:n}}=useStore_useStore();return publish_usePublish({publish:t,subscribe:e=>{passThrough(n,constants_ModuleType.Gauge)(e)}}),/*#__PURE__*/jsx_runtime_jsx(components_Container,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Gauge,{onChange:r})})},Gauge_Chart=Gauge_Chart_Chart,GaugeChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,system:{padding:!1,border:!1},children:/*#__PURE__*/jsx_runtime_jsx(Gauge_Chart,{...e})}),charts_Gauge_Gauge=withChartPublisher(GaugeChart,"Gauge"),charts_Gauge=charts_Gauge_Gauge,LEVEL_STREAM={DEFAULT_CACHE_TIME:15e3,DEFAULT_GRANULARITY:10,DEFAULT_RANGE:[-20,100]},DEFAULT_LEVEL_STREAM_CONFIG={cacheTime:LEVEL_STREAM.DEFAULT_CACHE_TIME,granularity:LEVEL_STREAM.DEFAULT_GRANULARITY,range:LEVEL_STREAM.DEFAULT_RANGE,maxPoints:void 0,onLevelStreamUpdate:e=>{}};class LevelStreamAnalyzer{config;spectrumData=[];probabilityData=new Map;count=0;constructor(e){this.config={...DEFAULT_LEVEL_STREAM_CONFIG,...e}}reset(){this.spectrumData=[],this.probabilityData=new Map,this.count=0}setConfig(e){this.config={...DEFAULT_LEVEL_STREAM_CONFIG,...this.config,...e},(e.cacheTime&&this.config.cacheTime!==e.cacheTime||e.granularity&&this.config.granularity!==e.granularity||void 0!==e.maxPoints&&this.config.maxPoints!==e.maxPoints)&&this.reset(),e.range&&this.outputData()}process(e,t){this.removeExpiredData(),this.addNewData(e,t),this.updateProbability(e),this.outputData()}updateProbability(e){let{granularity:t}=this.config;this.count++;let r=Math.round(e/t)*t,n=this.probabilityData.get(r)||0;n++,this.probabilityData.set(r,n)}getAll(){return this.probabilityData}removeExpiredData(){let{cacheTime:e,maxPoints:t}=this.config;if(0===this.spectrumData.length)return;if(void 0!==t&&t>0){this.spectrumData.length>t&&(this.spectrumData=this.spectrumData.slice(-t));return}let r=Date.now();if(e<=0){this.spectrumData=[];return}let n=0,a=this.spectrumData.length-1;for(;n<=a;){let t=Math.floor((n+a)/2);r-this.spectrumData[t].timestamp>=e?n=t+1:a=t-1}this.spectrumData=this.spectrumData.slice(n)}addNewData(e,t){this.spectrumData.push({value:e,timestamp:t})}outputData(){let{range:e,granularity:t,onLevelStreamUpdate:r}=this.config,n=e[0],a=e[1],i=Array(Math.round((a-n)/t)+1).fill(0);for(let[e,r]of this.probabilityData)if(e>=n&&e<=a){let n=Math.round((a-e)/t);this.count>0&&(i[n]=r/this.count*100)}r?.({probabilityRangeData:new Float32Array(i),spectrumData:new Float32Array(this.spectrumData.map(e=>e.value)),timestampData:new Float64Array(this.spectrumData.map(e=>e.timestamp))})}}let SPECTRUM={INITIAL_VALUE:0/0,WATERFALL_MAX_FRAMES:100,OUTPUT_POINTS:1001},PEAK_DETECTION={MAX_PEAKS:2},RF_UNIT=null,FLUORESCENCE={UPDATE_INTERVAL:1,LEVEL_MIN:-20,LEVEL_MAX:140,LEVEL_RANGE:161},DEFAULT_SPECTRUM_CONFIG={maxPoints:SPECTRUM.OUTPUT_POINTS,waterfallMaxFrames:SPECTRUM.WATERFALL_MAX_FRAMES,initialValue:SPECTRUM.INITIAL_VALUE,processing:{enableWaterfall:!1,enableMetrics:!1,enableFluorescence:!1,enablePeakStats:!1,fluorescenceUpdateInterval:FLUORESCENCE.UPDATE_INTERVAL},peakDetection:{maxPeaks:PEAK_DETECTION.MAX_PEAKS},outputPoints:SPECTRUM.OUTPUT_POINTS,outputRange:{start:0,end:SPECTRUM.OUTPUT_POINTS},templateTolerance:0},ERROR_MESSAGES={EMPTY_SEGMENTS:"频段配置不能为空",INVALID_CONFIG:"必须且只能配置 segments 或 bandwidthConfig 其中之一",EMPTY_BANDWIDTH:"bandwidthConfig 不能为空",INVALID_SEGMENT:e=>`无效的段索引: ${e}`,INDEX_OUT_OF_BOUNDS:e=>`索引超出范围: ${e}`,INVALID_ANTENNA_FACTOR_LENGTH:e=>`天线因子数据长度必须等于实时数据长度 (${e})`,INVALID_ANTENNA_FACTOR:"天线因子数据必须是有效的正数",INVALID_SAMPLING_RANGE:"采样范围无效",INVALID_MAX_POINTS:"点数必须大于0",INVALID_LENGTH:e=>`频率占用度数据长度不匹配,期望长度为 ${e}`};class SpectrumError extends Error{code;details;constructor(e,t,r){super(e),this.code=t,this.details=r,this.name="SpectrumError"}}class DataValidationError extends SpectrumError{constructor(e,t){super(e,"DATA_VALIDATION_ERROR",t)}}class IndexOutOfBoundsError extends SpectrumError{index;constructor(e,t,r){super(e,"INDEX_OUT_OF_BOUNDS_ERROR",{index:t,...r||{}}),this.index=t}}let arrayKeepAttribute=(e,t)=>{void 0!==e.max&&(t.max=e.max),void 0!==e.maxIndex&&(t.maxIndex=e.maxIndex),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.progress&&(t.progress=e.progress)},spectrum_analyzer_clamp=(e,t,r)=>e<=t?t:e>=r?r:e,spectrum_analyzer_leftToIndex=(e,t)=>t<=1?0:Math.max(0,Math.min(t-1,Math.ceil(t*spectrum_analyzer_clamp(e,0,100)/100)-1)),resolveCursorIndexByLeft=(e,t,r)=>{if(!Number.isFinite(e)||t<=0||r<=0)return;let n=spectrum_analyzer_clamp(Number(e),0,100);return{left:n,sampledIndex:spectrum_analyzer_leftToIndex(n,t),globalIndex:spectrum_analyzer_leftToIndex(n,r)}},resample=({realData:e,antennaFactorData:t,antennaFactorSwitch:r=!1,outputPoints:n})=>{let a=e.length,i=a<=n,o=i?a:n,l=new Uint32Array(o),s=new Float32Array(o);if(s.timestamp=e.timestamp,i){if(!r){for(let e=0;e<a;e++)l[e]=e;return s.set(e),{realOutputData:s,srcIndexCache:l}}for(let r=0;r<a;r++)l[r]=r,s[r]=e[r]+t[r];return{realOutputData:s,srcIndexCache:l}}let c=a/n,u=c/2;for(let n=0;n<o;n++){let i=Math.floor(u),o=Math.min(Math.floor(u+c),a),d=e[i],h=i;for(let t=i+1;t<o;t++)e[t]>d&&(d=e[t],h=t);s[n]=r?d+t[h]:d,l[n]=h,u+=c}return{realOutputData:s,srcIndexCache:l}},resampleMultiple=({antennaFactorData:e,antennaFactorSwitch:t=!1,outputPoints:r,realData:n,maxData:a,minData:i,avgData:o,templateData:l,backgroundNoiseData:s,thresholdData:c,fluorescenceData:u,occupancyData:d,enablePeakStats:h=!1,maxPeaks:p=2,outputRangeStart:f=0})=>{let m=n.length,g=m<=r,b=g?m:r,v=a&&a.length>0,w=i&&i.length>0,y=o&&o.length>0,x=l&&l.length>0,k=d&&d.length>0,S=s&&s.length>0,D=c&&c.length>0,M=u&&u.length>0,F=[],C=t?(t,r)=>t+e[r]:e=>e,E=new Float32Array(b);E.timestamp=n.timestamp;let N=new Float32Array(v?b:0),A=new Float32Array(w?b:0),T=new Float32Array(y?b:0),I=new Float32Array(x?b:0),P=new Float32Array(k?b:0),z=new Float32Array(S?b:0),_=new Float32Array(D?b:0),O=Array(M?b:0).fill(null),L=new Uint32Array(b);if(g){for(let e=0;e<m;e++)L[e]=e;if(t)for(let t=0;t<m;t++){let r=e[t];if(E[t]=n[t]+r,v&&(N[t]=a[t]+r),w&&(A[t]=i[t]+r),y&&(T[t]=o[t]+r),x&&(I[t]=l[t]+r),k&&(P[t]=d[t]),S&&(z[t]=s[t]+r),D&&(_[t]=c[t]+r),M){let e=u[t],n=new Map;for(let[t,a]of e)n.set(t+r,a);O[t]=n}}else E.set(n),v&&N.set(a),w&&A.set(i),y&&T.set(o),x&&I.set(l),k&&P.set(d),S&&z.set(s),D&&_.set(c),M&&(O=u);if(h)for(let e=0;e<m;e++){let t=E[e];Number.isFinite(t)&&F.push({index:e,srcIndex:e+f,value:t})}}else{let e=m/r,t=e/2;for(let r=0;r<b;r++){let p=Math.floor(t),g=Math.min(Math.floor(t+e),m),b=n[p],q=p,$=v?a[p]:0,j=p,H=w?i[p]:0,B=p,G=k?d[p]:0;for(let e=p+1;e<g;e++)n[e]>b&&(b=n[e],q=e),v&&a[e]>$&&($=a[e],j=e),w&&i[e]<H&&(H=i[e],B=e),k&&d[e]>G&&(G=d[e]);let U=C(b,q);if(E[r]=U,L[r]=q,h&&Number.isFinite(U)&&F.push({index:r,srcIndex:q+f,value:U}),v&&(N[r]=C($,j)),w&&(A[r]=C(H,B)),y){let e=o[q];T[r]=C(e,q)}if(x){let e=l[q];I[r]=C(e,q)}if(k&&(P[r]=G),S){let e=s[q];z[r]=C(e,q)}if(D){let e=c[q];_[r]=C(e,q)}if(M){let e=u[q],t=new Map;for(let[r,n]of e)t.set(C(r,q),n);O[r]=t}t+=e}}return h&&F.length>0&&(F.sort((e,t)=>t.value-e.value),E.peaks={peaks:F.slice(0,p),timestamp:n.timestamp}),{realOutputData:E,maxOutputData:N,minOutputData:A,avgOutputData:T,templateOutputData:I,occupancyOutputData:P,backgroundNoiseOutputData:z,thresholdOutputData:_,srcIndexCache:L,fluorescenceOutputData:O}},resampleExtraData=(e,t,r,n,a)=>{if(!e||0===Object.keys(e).length)return{};let i={},o=Object.keys(e),l=n.length;for(let e=0;e<o.length;e++)i[o[e]]=new Float32Array(l);for(let s=0;s<o.length;s++){let c=o[s],u=a(e[c]),d=i[c];if(r)for(let e=0;e<l;e++){let r=n[e];d[e]=u[r]+t[r]}else for(let e=0;e<l;e++){let t=n[e];d[e]=u[t]}}return i},findExceedingDatasCore=({realData:e,maxData:t,minData:r,templateData:n,tolerance:a=0,startIndex:i=0,endIndex:o,usePreallocation:l=!1})=>{let{timestamp:s}=e,c=o??e.length,u=[],d=-1,h=0,p=0;if(l&&0===i&&c===e.length){let i=new Uint8Array(e.length);for(let t=0;t<e.length;t++)i[t]=+(e[t]>n[t]+a);for(let n=0;n<e.length;n++)if(i[n])-1===d?(d=n,h=e[n],p=1):(h+=e[n],p++);else if(-1!==d){let e=n-1;if(e-d+1>=2){let n=h/p,a=d+(e-d>>1);u.push({maxValue:t[a],minValue:r[a],avgValue:n,timestamp:s,startIndex:d,endIndex:e})}d=-1}}else for(let o=i;o<Math.min(c,e.length);o++)if(e[o]>n[o]+a)-1===d?(d=o,h=e[o],p=1):(h+=e[o],p++);else if(-1!==d){let e=o-1;if(e-d+1>=2){let n=h/p,a=d+(e-d>>1);u.push({maxValue:t[a],minValue:r[a],avgValue:n,timestamp:s,startIndex:d,endIndex:e})}d=-1}if(-1!==d){let e=c-1;if(e-d+1>=2){let n=h/p,a=d+(e-d>>1);u.push({maxValue:t[a],minValue:r[a],avgValue:n,timestamp:s,startIndex:d,endIndex:e})}}return u},findExceedingDatas=({realData:e,maxData:t,minData:r,templateData:n,tolerance:a=0})=>n&&0!==n.length?findExceedingDatasCore({realData:e,maxData:t,minData:r,templateData:n,tolerance:a,usePreallocation:!0}):[],findExceedingDatasIncremental=({realData:e,maxData:t,minData:r,templateData:n,tolerance:a=0,startIndex:i,endIndex:o,previousSegments:l=[]})=>!n||0===n.length||i>=o?l:[...l,...findExceedingDatasCore({realData:e,maxData:t,minData:r,templateData:n,tolerance:a,startIndex:i,endIndex:o})];function isAllValid(e){for(let t=0;t<e.length;t++)if(!Number.isFinite(e[t]))return!1;return!0}var types_ExtraDataMode=/*#__PURE__*/function(e){return e.REPLACE="replace",e.MERGE="merge",e.CLEAR="clear",e}({}),SpectrumAnalyzer_PendingDataType=/*#__PURE__*/null;class SpectrumAnalyzer{config=DEFAULT_SPECTRUM_CONFIG;segments=[];antennaFactorData;antennaFactorSwitch;realData;maxData;minData;avgData;templateData;occupancyData;backgroundNoiseData;thresholdData;waterfallData;srcIndexCache;realOutputData;maxOutputData;minOutputData;avgOutputData;templateOutputData;occupancyOutputData;backgroundNoiseOutputData;thresholdOutputData;waterfallOutputData;scanProgress;lastIndex;processTimes;lastProcessTime;cachedExceedingDatas=[];fluorescenceData;fluorescenceMaxCount=0;fluorescenceUpdateCounter=0;extraData={};extraOutputData={};pendingDataFlags={occupancy:!1,template:!1,backgroundNoise:!1,threshold:!1,extra:!1};hasPendingData=!1;hasProcessedData=!1;isProcessing=!1;onSpectrumUpdate;constructor(e){let{onSpectrumUpdate:t,maxPoints:r}=e;this.onSpectrumUpdate=t,this.config={...DEFAULT_SPECTRUM_CONFIG,...e,processing:{...DEFAULT_SPECTRUM_CONFIG.processing,...e.processing},peakDetection:{...DEFAULT_SPECTRUM_CONFIG.peakDetection,...e.peakDetection},outputRange:{start:e.outputRange?.start??0,end:e.outputRange?.end??r??SPECTRUM.OUTPUT_POINTS}},this.reset()}process({data:e,timestamp:t,segmentOffset:r=0,offset:n=0,fluorescenceData:a,fluorescenceMaxCount:i}){let o=performance.now();try{if(!e?.length)return;this.isProcessing=!0,this.hasProcessedData=!0;let o=this.resolveGlobalIndex(r,n);this.segments.length?this.scanProgress=(o+e.length)/this.config.maxPoints:e.length!==this.config.maxPoints&&this.updateMaxPoints(e.length),a&&void 0!==i&&(this.fluorescenceData=a,this.fluorescenceMaxCount=i),this.validateInput(e,o);let{maxPoints:l}=this.config,s=o+e.length;this.lastIndex=s;let c=s>=l||s<this.lastIndex;this.realData.set(e,o),this.realData.timestamp=t,this.processDataPoints(e,o,c);let u=this.resampleDataSeries();c&&u.realData&&this.updateWaterfallData(this.realData,u.realData);let d=this.updateTemplateOverData(c,c?void 0:{startIndex:o,endIndex:o+e.length}),h=this.processPendingData();this.notifySpectrumUpdate({...u,...h||{},extraData:this.extraOutputData,waterfallData:this.waterfallOutputData,scanProgress:this.scanProgress,processTimes:this.processTimes,...d&&{templateOverData:d}})}catch(e){throw e instanceof Error?e:Error(String(e))}finally{this.isProcessing=!1,this.lastProcessTime=performance.now()-o}}initializeSegments(e){if(!e?.length)throw new DataValidationError(ERROR_MESSAGES.EMPTY_SEGMENTS);let t=this.config.maxPoints,r=0;this.segments=e.map(e=>{let{startFrequency:t,stopFrequency:n,stepFrequency:a}=e,i=Math.round(1e3*(n-t)/a)+1,o=r;return r+=i,{startFrequency:t,stopFrequency:n,stepFrequency:a,pointCount:i,startIndex:o}}),this.updateMaxPoints(r,!1),t===r&&(this.config={...this.config,outputRange:{start:0,end:r}},this.reset(!1))}setAntennaFactor(e){let{antennaFactorData:t,config:{maxPoints:r}}=this,n=new Float32Array(e);n.length!==r&&(n=new Float32Array(n).subarray(0,r),console.warn(ERROR_MESSAGES.INVALID_ANTENNA_FACTOR_LENGTH(r)));let a=!1;for(let e=0;e<n.length;e++){let r=n[e],i=Number.isFinite(r)&&r>0;i||(a=!0),t[e]=i?r:0}a&&console.warn(ERROR_MESSAGES.INVALID_ANTENNA_FACTOR),this.antennaFactorSwitch&&this.setAntennaFactorSwitch(this.antennaFactorSwitch)}setAntennaFactorSwitch(e){let t=this.antennaFactorSwitch!==e;if(this.antennaFactorSwitch=e,t){let e=this.resampleDataSeries();this.resampleWaterfallOutputData(),this.notifySpectrumUpdate({...e,waterfallData:this.waterfallOutputData})}}updateProcessing(e){let{processing:t}=this.config,r={...t,...void 0!==e.enableMetrics&&{enableMetrics:e.enableMetrics},...void 0!==e.enableFluorescence&&{enableFluorescence:e.enableFluorescence},...void 0!==e.enablePeakStats&&{enablePeakStats:e.enablePeakStats},...void 0!==e.fluorescenceUpdateInterval&&{fluorescenceUpdateInterval:e.fluorescenceUpdateInterval}};if(r.enableMetrics===t.enableMetrics&&r.enableFluorescence===t.enableFluorescence&&r.enablePeakStats===t.enablePeakStats&&r.fluorescenceUpdateInterval===t.fluorescenceUpdateInterval)return;this.config={...this.config,processing:r},r.enableMetrics&&!t.enableMetrics&&(0===this.maxData.length||0===this.minData.length||0===this.avgData.length)&&(this.allocateMetricsBuffers(),this.clearMetricsBuffers()),r.enableFluorescence&&!t.enableFluorescence&&0===this.fluorescenceData.length&&(this.fluorescenceData=new Uint32Array(this.config.maxPoints*FLUORESCENCE.LEVEL_RANGE));let n=this.resampleDataSeries();this.extraOutputData=resampleExtraData(this.extraData,this.antennaFactorData,this.antennaFactorSwitch,this.srcIndexCache,this.getOutputData.bind(this)),this.notifySpectrumUpdate({...n,extraData:this.extraOutputData})}clearMetricsData(){let e=0===this.maxData.length||0===this.minData.length||0===this.avgData.length||0===this.maxOutputData.length||0===this.minOutputData.length||0===this.avgOutputData.length;if(this.config.processing.enableMetrics&&e){let e=this.realOutputData?.length??this.config.outputPoints;this.allocateMetricsBuffers(e)}this.clearMetricsBuffers(),this.processTimes=0,this.notifySpectrumUpdate({maxData:this.maxOutputData,minData:this.minOutputData,avgData:this.avgOutputData,processTimes:0})}allocateMetricsBuffers(e){let{maxPoints:t,outputPoints:r,processing:{enableMetrics:n}}=this.config,a=n?t:0,i=0;n&&(i=Math.min(i=Math.max(0,Math.floor(e??r)),r)),this.maxData=new Float32Array(a),this.minData=new Float32Array(a),this.avgData=new Float32Array(a),this.maxOutputData=new Float32Array(i),this.minOutputData=new Float32Array(i),this.avgOutputData=new Float32Array(i)}clearMetricsBuffers(){this.maxData.fill(SPECTRUM.INITIAL_VALUE),this.minData.fill(SPECTRUM.INITIAL_VALUE),this.avgData.fill(SPECTRUM.INITIAL_VALUE),this.maxData.allValid=!1,this.minData.allValid=!1,this.avgData.allValid=!1,this.maxOutputData.fill(SPECTRUM.INITIAL_VALUE),this.minOutputData.fill(SPECTRUM.INITIAL_VALUE),this.avgOutputData.fill(SPECTRUM.INITIAL_VALUE)}setWaterfallData(e){if(!(e?.[0]?.length>0))return;let{processing:t}=this.config,{waterfallMaxFrames:r}=this.config;t.enableWaterfall&&(r=e.length,this.config={...this.config,waterfallMaxFrames:r},this.waterfallData=e,this.resampleWaterfallOutputData(),this.notifySpectrumUpdate({waterfallData:this.waterfallOutputData}))}setFluorescenceData(e,t){if(!this.config.processing.enableFluorescence||!e||0===e.length)return;let r=this.config.maxPoints*FLUORESCENCE.LEVEL_RANGE;if(e.length!==r)return;this.fluorescenceData=e,this.fluorescenceMaxCount=t;let n=this.config.outputRange.end-this.config.outputRange.start,a=this.getFluorescenceOutputData(n);this.notifySpectrumUpdate({fluorescenceData:a,fluorescenceMaxCount:this.fluorescenceMaxCount})}setRealData(e){if(!(e?.length>0)||e.length!==this.config.maxPoints)return;let t=new Float32Array(e.length);t.set(e),t.timestamp=e.timestamp,this.realData=t;let r=this.resampleDataSeries();this.notifySpectrumUpdate(r)}setMaxData(e){if(!(e?.length>0)||e.length!==this.config.maxPoints)return;let t=new Float32Array(e.length);t.set(e),this.maxData=t,this.maxData.allValid=isAllValid(this.maxData);let r=this.resampleDataSeries();this.notifySpectrumUpdate(r)}setMinData(e){if(!(e?.length>0)||e.length!==this.config.maxPoints)return;let t=new Float32Array(e.length);t.set(e),this.minData=t,this.minData.allValid=isAllValid(this.minData);let r=this.resampleDataSeries();this.notifySpectrumUpdate(r)}setAvgData(e){if(!(e?.length>0)||e.length!==this.config.maxPoints)return;let t=new Float32Array(e.length);t.set(e),this.avgData=t,this.avgData.allValid=isAllValid(this.avgData);let r=this.resampleDataSeries();this.notifySpectrumUpdate(r)}setOccupancyData(e){if(!e||0===e.length){this.occupancyData=new Float32Array(0),this.setPendingFlag("occupancy",!1);return}if(this.occupancyData=new Float32Array(e),!this.hasProcessedData||this.isProcessing)return void this.setPendingFlag("occupancy",!0);let t=this.resampleDataSeries();this.notifySpectrumUpdate({occupancyData:t.occupancyData}),this.setPendingFlag("occupancy",!1)}setExtraData(e,t=types_ExtraDataMode.MERGE,r){if(t===types_ExtraDataMode.CLEAR){this.extraData={},this.extraOutputData={},this.setPendingFlag("extra",!1);return}if(!e){t===types_ExtraDataMode.REPLACE&&(this.extraData={},this.extraOutputData={},this.setPendingFlag("extra",!1));return}let n=Object.entries(e).map(([e,t])=>[e,t?.length?new Float32Array(t):null]),a=r?this.resolveGlobalIndex(r.segmentOffset??0,r.offset??0):0;if(r)for(let[,e]of n)e&&this.validateInput(e,a);for(let[e,i]of(t===types_ExtraDataMode.REPLACE&&(this.extraData={},this.extraOutputData={},this.setPendingFlag("extra",!1)),n)){if(!i){delete this.extraData[e];continue}if(!r){this.extraData[e]=i;continue}let t=this.extraData[e];if(t?.length!==this.config.maxPoints){let r=new Float32Array(this.config.maxPoints);r.fill(SPECTRUM.INITIAL_VALUE),t?.length&&r.set(t.subarray(0,this.config.maxPoints)),t=r,this.extraData[e]=t}t.set(i,a)}!this.hasProcessedData||this.isProcessing?this.setPendingFlag("extra",!0):(this.extraOutputData=resampleExtraData(this.extraData,this.antennaFactorData,this.antennaFactorSwitch,this.srcIndexCache,this.getOutputData.bind(this)),this.notifySpectrumUpdate({extraData:this.extraOutputData}),this.setPendingFlag("extra",!1))}reset(e=!1){let{maxPoints:t,waterfallMaxFrames:r,processing:{enableFluorescence:n}}=this.config;this.antennaFactorData=new Float32Array(t);let a=new Float32Array(t);a.timestamp="",a.fill(SPECTRUM.INITIAL_VALUE),this.realData=a,this.allocateMetricsBuffers(),this.clearMetricsBuffers(),this.templateData=new Float32Array,this.occupancyData=new Float32Array,this.backgroundNoiseData=new Float32Array,this.clearThresholdDataState(),this.waterfallData=Array.from({length:r},()=>{let e=new Float32Array;return e.timestamp="",e.fill(SPECTRUM.INITIAL_VALUE),e}),this.waterfallOutputData=Array.from({length:r},()=>{let e=new Float32Array;return e.timestamp="",e.fill(SPECTRUM.INITIAL_VALUE),e});let i=this.config.outputPoints;this.realOutputData=new Float32Array(i).fill(SPECTRUM.INITIAL_VALUE),this.templateOutputData=new Float32Array,this.occupancyOutputData=new Float32Array,this.backgroundNoiseOutputData=new Float32Array,this.fluorescenceData=new Uint32Array(n?t*FLUORESCENCE.LEVEL_RANGE:0),this.fluorescenceMaxCount=0,this.fluorescenceUpdateCounter=0,this.extraData={},this.extraOutputData={},this.srcIndexCache=new Uint32Array(t),this.scanProgress=0,this.lastIndex=0,this.processTimes=0,this.lastProcessTime=0,this.cachedExceedingDatas=[],this.pendingDataFlags={occupancy:!1,template:!1,backgroundNoise:!1,threshold:!1,extra:!1},this.hasPendingData=!1,e||(this.hasProcessedData=!1),this.notifySpectrumUpdate({realData:this.realData,maxData:this.maxData,minData:this.minData,avgData:this.avgData,templateData:this.templateData,backgroundNoiseData:this.backgroundNoiseData,thresholdData:this.thresholdData,extraData:this.extraData,srcIndexCache:this.srcIndexCache,processTimes:0,scanProgress:0})}getPerformanceMetrics(){return{lastProcessTime:this.lastProcessTime,dataPoints:this.config.maxPoints,waterfallFrames:this.waterfallData.length,isInitialized:this.realData.length>0,memoryUsage:this.calculateMemoryUsage()}}getPeakStats(){if(!this.config.processing.enablePeakStats)return;let{realData:e}=this.resampleDataSeries();if(e)return e.peaks}updateSamplingRange(e,t){if(e<0||e>=t)throw new DataValidationError(ERROR_MESSAGES.INVALID_SAMPLING_RANGE);this.config={...this.config,outputRange:{start:Math.floor(e),end:Math.ceil(t)}};let r=this.resampleDataSeries();return this.resampleWaterfallOutputData(),this.extraOutputData=resampleExtraData(this.extraData,this.antennaFactorData,this.antennaFactorSwitch,this.srcIndexCache,this.getOutputData.bind(this)),this.notifySpectrumUpdate({...r,extraData:this.extraOutputData,waterfallData:this.waterfallOutputData}),this.srcIndexCache}setTemplateData(e,t){if(!e||0===e.length){this.templateData=new Float32Array(0),this.setPendingFlag("template",!1);return}(void 0!==t&&(this.config.templateTolerance=t),this.templateData=new Float32Array(e),!this.hasProcessedData||this.isProcessing)?this.setPendingFlag("template",!0):(this.notifySpectrumUpdate({templateData:this.resampleSingleData(this.templateData),templateOverData:this.updateTemplateOverData(!0)}),this.setPendingFlag("template",!1))}setBackgroundNoiseData(e){if(!e||0===e.length){this.backgroundNoiseData=new Float32Array(0),this.setPendingFlag("backgroundNoise",!1);return}(this.backgroundNoiseData=new Float32Array(e),!this.hasProcessedData||this.isProcessing)?this.setPendingFlag("backgroundNoise",!0):(this.notifySpectrumUpdate({backgroundNoiseData:this.resampleSingleData(this.backgroundNoiseData)}),this.setPendingFlag("backgroundNoise",!1))}setThresholdData(e,t){if(!e||0===e.length)return void this.clearThresholdDataState();let r=e instanceof Float32Array?e:new Float32Array(e);if(t){let e=this.resolveGlobalIndex(t.segmentOffset??0,t.offset??0);if(this.validateInput(r,e),this.thresholdData.length!==this.config.maxPoints){let e=new Float32Array(this.config.maxPoints);e.fill(SPECTRUM.INITIAL_VALUE),this.thresholdData.length>0&&e.set(this.thresholdData.subarray(0,this.config.maxPoints)),this.thresholdData=e}this.thresholdData.set(r,e)}else{let e=new Float32Array(this.config.maxPoints);e.fill(SPECTRUM.INITIAL_VALUE),e.set(r.subarray(0,this.config.maxPoints)),this.thresholdData=e}if(!this.hasProcessedData||this.isProcessing)return void this.setPendingFlag("threshold",!0);let n=this.resampleSingleData(this.thresholdData);this.thresholdOutputData=n,this.notifySpectrumUpdate({thresholdData:n}),this.setPendingFlag("threshold",!1)}updateTemplateOverData(e=!1,t){let r;return this.templateData&&0!==this.templateData.length?(e||!t?(r=findExceedingDatas({realData:this.realData,maxData:this.maxData,minData:this.minData,templateData:this.templateData,tolerance:this.config.templateTolerance}),this.cachedExceedingDatas=r):(this.cachedExceedingDatas=findExceedingDatasIncremental({realData:this.realData,maxData:this.maxData,minData:this.minData,templateData:this.templateData,tolerance:this.config.templateTolerance,startIndex:t.startIndex,endIndex:t.endIndex,previousSegments:this.cachedExceedingDatas}),r=this.cachedExceedingDatas),r):(this.cachedExceedingDatas=[],[])}resolveGlobalIndex(e=0,t=0){if(this.segments.length){let r=this.segments[e];if(!r)throw new DataValidationError(ERROR_MESSAGES.INVALID_SEGMENT(e));return r.startIndex+t}return t}clearThresholdDataState(){this.thresholdData=new Float32Array(0),this.thresholdOutputData=new Float32Array(0),this.setPendingFlag("threshold",!1)}resampleDataSeries(){let{antennaFactorData:e,antennaFactorSwitch:t,maxData:r,minData:n,avgData:a,templateData:i,occupancyData:o,backgroundNoiseData:l,thresholdData:s,config:{maxPoints:c,outputPoints:u}}=this,{realOutputData:d,srcIndexCache:h,maxOutputData:p,minOutputData:f,avgOutputData:m,templateOutputData:g,occupancyOutputData:b,backgroundNoiseOutputData:v,thresholdOutputData:w}=resampleMultiple({antennaFactorData:t?e:new Float32Array(c),antennaFactorSwitch:t,outputPoints:u,realData:this.getOutputData(),maxData:r?.length>0?this.getOutputData(r):void 0,minData:n?.length>0?this.getOutputData(n):void 0,avgData:a&&a.length>0?this.getOutputData(a):void 0,templateData:i&&i.length>0?this.getOutputData(i):void 0,occupancyData:o&&o.length>0?this.getOutputData(o):void 0,backgroundNoiseData:l&&l.length>0?this.getOutputData(l):void 0,thresholdData:s&&s.length>0?this.getOutputData(s):void 0,enablePeakStats:this.config.processing.enablePeakStats,maxPeaks:this.config.peakDetection.maxPeaks,outputRangeStart:this.config.outputRange.start});this.srcIndexCache=h,this.realOutputData=d,this.maxOutputData=p||new Float32Array,this.minOutputData=f||new Float32Array,this.avgOutputData=m||new Float32Array,this.templateOutputData=g||new Float32Array,this.occupancyOutputData=b||new Float32Array,this.backgroundNoiseOutputData=v||new Float32Array,this.thresholdOutputData=w||new Float32Array;let y=this.getFluorescenceOutputData(d.length);return{realData:d,maxData:p,minData:f,avgData:m,templateData:g,occupancyData:b,backgroundNoiseData:v,thresholdData:w,fluorescenceData:y,fluorescenceMaxCount:this.fluorescenceMaxCount,extraData:this.extraOutputData,srcIndexCache:h}}resampleWaterfallOutputData(){let{antennaFactorData:e,antennaFactorSwitch:t,waterfallData:r,config:{maxPoints:n,processing:{enableWaterfall:a},outputPoints:i}}=this;if(!a)return;let o=t?e:new Float32Array(n);this.waterfallOutputData=r.map(e=>{let{realOutputData:r}=resampleMultiple({realData:this.getOutputData(e),antennaFactorData:o,antennaFactorSwitch:t,outputPoints:i});return r})}updateWaterfallData(e,t){let{waterfallMaxFrames:r,processing:n}=this.config;if(!n.enableWaterfall)return;this.waterfallData.length>=r&&(this.waterfallData.shift(),this.waterfallOutputData.shift());let a=new Float32Array(e.length);a.set(e),a.timestamp=e.timestamp,this.waterfallData.push(a),this.waterfallOutputData.push(t)}updateMaxPoints(e,t=!0){this.config.maxPoints!==e&&(this.config={...this.config,maxPoints:e,outputRange:{start:0,end:e}},this.reset(t))}validateInput(e,t){if(t<0||t+e.length>this.config.maxPoints)throw new IndexOutOfBoundsError(ERROR_MESSAGES.INDEX_OUT_OF_BOUNDS(t),t)}processDataPoints(e,t,r){let{maxData:n,minData:a,avgData:i,config:{processing:{enableMetrics:o}}}=this;o&&r&&(this.processTimes+=1,n.allValid||(n.allValid=isAllValid(n)),a.allValid||(a.allValid=isAllValid(a)),i.allValid||(i.allValid=isAllValid(i)));let l=e.length;if(this.config.processing.enableFluorescence)for(let r=0;r<l;r++)this.updateFluorescenceStats(t+r,e[r]);if(!o)return;let s=!0;for(let t=0;t<l;t++)if(!Number.isFinite(e[t])){s=!1;break}for(let r=0;r<l;r++){let o=t+r,l=e[r];if(!s&&!Number.isFinite(l))continue;let c=n[o];(l>c||!n.allValid&&Number.isNaN(c))&&(n[o]=l);let u=a[o];(l<u||!a.allValid&&Number.isNaN(u))&&(a[o]=l);let d=i[o];0===this.processTimes||Number.isNaN(d)?i[o]=l:i[o]=d+(l-d)/(this.processTimes+1)}}updateFluorescenceStats(e,t){if(!this.config.processing.enableFluorescence||!this.fluorescenceData||!Number.isFinite(t))return;let r=Math.round(t);if(r<FLUORESCENCE.LEVEL_MIN||r>FLUORESCENCE.LEVEL_MAX)return;let n=e*FLUORESCENCE.LEVEL_RANGE+(r-FLUORESCENCE.LEVEL_MIN),a=++this.fluorescenceData[n];a>this.fluorescenceMaxCount&&(this.fluorescenceMaxCount=a)}setPendingFlag(e,t){this.pendingDataFlags[e]=t,this.hasPendingData=this.pendingDataFlags.occupancy||this.pendingDataFlags.template||this.pendingDataFlags.backgroundNoise||this.pendingDataFlags.threshold||this.pendingDataFlags.extra}resampleSingleData(e){let{srcIndexCache:t}=this,{outputRange:{start:r,end:n}}=this.config,a=e.subarray(r,n),i=t.length,o=new Float32Array(i);for(let e=0;e<i;e++)o[e]=a[t[e]];return o}processPendingData(){if(!this.hasPendingData)return null;let e={};if(this.pendingDataFlags.occupancy&&this.occupancyData.length>0&&(e.occupancyData=this.resampleDataSeries().occupancyData,this.setPendingFlag("occupancy",!1)),this.pendingDataFlags.template&&this.templateData.length>0&&(e.templateData=this.resampleSingleData(this.templateData),e.templateOverData=this.updateTemplateOverData(!0),this.setPendingFlag("template",!1)),this.pendingDataFlags.backgroundNoise&&this.backgroundNoiseData.length>0&&(e.backgroundNoiseData=this.resampleSingleData(this.backgroundNoiseData),this.setPendingFlag("backgroundNoise",!1)),this.pendingDataFlags.threshold&&this.thresholdData.length>0){let t=this.resampleSingleData(this.thresholdData);this.thresholdOutputData=t,e.thresholdData=t,this.setPendingFlag("threshold",!1)}return this.pendingDataFlags.extra&&Object.keys(this.extraData).length>0&&(this.extraOutputData=resampleExtraData(this.extraData,this.antennaFactorData,this.antennaFactorSwitch,this.srcIndexCache,this.getOutputData.bind(this)),e.extraData=this.extraOutputData,this.setPendingFlag("extra",!1)),e}notifySpectrumUpdate(e){this.onSpectrumUpdate?.(e)}calculateMemoryUsage(){return 4*(this.config.maxPoints*Float32Array.BYTES_PER_ELEMENT)+this.waterfallData.reduce((e,t)=>e+t.length*Float32Array.BYTES_PER_ELEMENT,0)+this.waterfallOutputData.reduce((e,t)=>e+t.length*Float32Array.BYTES_PER_ELEMENT,0)}getOutputData(e){let{outputRange:{start:t,end:r}}=this.config,n=e??this.realData,a=n.subarray(t,r);return a.timestamp=n.timestamp,a}getFluorescenceOutputData(e){let{processing:{enableFluorescence:t},outputRange:{start:r,end:n}}=this.config;if(!t||0===this.fluorescenceData.length||e<=0)return;let a=new Uint32Array(e*FLUORESCENCE.LEVEL_RANGE),i=(n-r)/e;for(let t=0;t<e;t++){let e=Math.floor(r+(t+.5)*i)*FLUORESCENCE.LEVEL_RANGE,n=t*FLUORESCENCE.LEVEL_RANGE;for(let t=0;t<FLUORESCENCE.LEVEL_RANGE;t++)a[n+t]=this.fluorescenceData[e+t]}return a}getAllRawData(e){let{realOutputData:t,maxOutputData:r,minOutputData:n,avgOutputData:a,templateOutputData:i,occupancyOutputData:o,backgroundNoiseOutputData:l,thresholdOutputData:s,waterfallOutputData:c,extraOutputData:u,srcIndexCache:d}=this;t.timestamp=this.realData.timestamp;let h={realData:this.realData,maxData:this.maxData,minData:this.minData,avgData:this.avgData,templateData:this.templateData,occupancyData:this.occupancyData,backgroundNoiseData:this.backgroundNoiseData,thresholdData:this.thresholdData,waterfallData:this.waterfallData,extraData:this.extraData},p=resolveCursorIndexByLeft(e,t.length,this.config.maxPoints);return{realData:t,maxData:r,minData:n,avgData:a,templateData:i,occupancyData:o,backgroundNoiseData:l,thresholdData:s,fluorescenceData:this.getFluorescenceOutputData(t.length),waterfallData:c,extraData:u,srcIndexCache:d,rawData:h,cursorIndex:p}}}let createEmptySnapshot=()=>({data:[],rawData:[],range:{x:[0,0],y:[0,0]},sourceSize:{width:0,height:0},columnIndices:new Uint32Array(0),rowIndices:new Uint32Array(0)}),copyFrame=e=>{let t=new Float32Array(e);return t.timestamp=e.timestamp,void 0!==e.allValid&&(t.allValid=e.allValid),e.peaks&&(t.peaks={...e.peaks,peaks:e.peaks.peaks.map(e=>({...e}))}),t},validateOutputSize=(e,t)=>{if(!Number.isInteger(e)||e<=0)throw new DataValidationError(`${t} 必须是正整数`)},normalizeRange=(e,t,r)=>{let[n,a]=e;if(!Number.isFinite(n)||!Number.isFinite(a)||n>=a)throw new DataValidationError(`${r} 采样范围无效`);let i=Math.max(0,Math.min(t,Math.floor(n))),o=Math.max(0,Math.min(t,Math.ceil(a)));if(i>=o)throw new DataValidationError(`${r} 采样范围超出数据边界`);return[i,o]},reconcileRange=(e,t,r)=>{if(0===e[0]&&e[1]===t)return[0,r];let n=Math.min(e[0],r-1),a=Math.max(n+1,Math.min(e[1],r));return[n,a]},reconcileYRange=(e,t,r)=>{if(0===e[0]&&e[1]===t)return[0,r];if(e[1]===t){let t=Math.min(e[1]-e[0],r);return[r-t,r]}return reconcileRange(e,t,r)},reconcileAppendedRange=(e,t,r,n)=>{if(0===e[0]&&e[1]===t)return[0,r];let a=Math.min(e[1]-e[0],r);if(e[1]===t)return[r-a,r];let i=Math.max(0,Math.min(e[0]-n,r-a));return[i,i+a]},createCenterIndices=(e,t)=>{let[r,n]=e,a=n-r,i=Math.min(a,t),o=new Uint32Array(i);if(a<=t){for(let e=0;e<i;e++)o[e]=r+e;return o}for(let e=0;e<i;e++){let t=Math.floor(e*a/i),n=Math.floor((e+1)*a/i);o[e]=r+Math.min(n-1,Math.floor((t+n)/2))}return o},isSameRange=(e,t)=>e[0]===t[0]&&e[1]===t[1],isSameIndices=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},maxPoolFrame=(e,t,r)=>{let n=e.subarray(t[0],t[1]),a=n.length,i=Math.min(a,r);if(a<=r)return 0===t[0]&&t[1]===e.length?e:(n.timestamp=e.timestamp,n);let o=new Float32Array(i);o.timestamp=e.timestamp;for(let e=0;e<i;e++){let t=Math.floor(e*a/i),r=Math.floor((e+1)*a/i),l=0/0;for(let e=t;e<r;e++){let t=n[e];Number.isFinite(t)&&(!Number.isFinite(l)||t>l)&&(l=t)}o[e]=l}return o};class WaterfallAnalyzer{maxFrames;onWaterfallUpdate;sourceData=[];samplingOptions;snapshot=createEmptySnapshot();constructor(e={}){if(void 0!==e.maxFrames&&(!Number.isInteger(e.maxFrames)||e.maxFrames<=0))throw new DataValidationError("maxFrames 必须是正整数");this.maxFrames=e.maxFrames,this.onWaterfallUpdate=e.onWaterfallUpdate}setData(e){if(0===e.length)return this.sourceData=[],this.samplingOptions=void 0,this.publishSnapshot(createEmptySnapshot());let t=e[0].length;if(0===t)throw new DataValidationError("瀑布图帧不能为空");for(let r of e)if(r.length!==t)throw new DataValidationError("瀑布图数据必须是等宽矩阵");let r=this.snapshot.sourceSize,n=[...e];void 0!==this.maxFrames&&n.length>this.maxFrames&&(n=n.slice(-this.maxFrames));let a=this.samplingOptions;a&&r.width>0&&r.height>0&&(a={...a,x:reconcileRange(a.x,r.width,t),y:reconcileYRange(a.y,r.height,n.length)});let i=this.createSnapshot(n,a);return this.sourceData=n,this.samplingOptions=a,this.publishSnapshot(i)}appendFrame(e){if(0===e.length)throw new DataValidationError("瀑布图帧不能为空");let t=this.sourceData[0]?.length;if(void 0!==t&&e.length!==t)throw new DataValidationError("追加帧宽度必须与现有瀑布图一致");let r=this.sourceData.length,n=[...this.sourceData,copyFrame(e)],a=0;void 0!==this.maxFrames&&n.length>this.maxFrames&&(a=n.length-this.maxFrames,n.splice(0,a));let i=this.samplingOptions;i&&r>0&&(i={...i,y:reconcileAppendedRange(i.y,r,n.length,a)});let o=this.createSnapshot(n,i);return this.sourceData=n,this.samplingOptions=i,this.publishSnapshot(o)}updateSamplingRange(e){let t=this.getSourceSize(this.sourceData);if(0===t.width||0===t.height)throw new DataValidationError("设置采样范围前必须先设置瀑布图数据");validateOutputSize(e.outputWidth,"outputWidth"),validateOutputSize(e.outputHeight,"outputHeight");let r={x:normalizeRange(e.x,t.width,"X"),y:normalizeRange(e.y,t.height,"Y"),outputWidth:e.outputWidth,outputHeight:e.outputHeight},n=this.createSnapshot(this.sourceData,r);return this.samplingOptions=r,this.publishSnapshot(n)}getSnapshot(){return this.snapshot}createSnapshot(e,t){let r=this.getSourceSize(e);if(0===r.width||0===r.height)return createEmptySnapshot();let n=t?.x??[0,r.width],a=t?.y??[0,r.height],i=t?.outputWidth??n[1]-n[0],o=t?.outputHeight??a[1]-a[0],l=createCenterIndices(n,i),s=createCenterIndices(a,o),c=this.createReusableRows(n,l);return{data:Array.from(s,t=>{let r=e[t];return c.get(r)??maxPoolFrame(r,n,i)}),rawData:e,range:{x:n,y:a},sourceSize:r,columnIndices:l,rowIndices:s}}createReusableRows(e,t){let r=this.snapshot;if(!isSameRange(r.range.x,e)||!isSameIndices(r.columnIndices,t))return new Map;let n=new Map;for(let e=0;e<r.rowIndices.length;e++){let t=r.rawData[r.rowIndices[e]],a=r.data[e];t&&a&&n.set(t,a)}return n}getSourceSize(e){return{width:e[0]?.length??0,height:e.length}}publishSnapshot(e){return this.snapshot=e,this.onWaterfallUpdate?.(e),e}}var types_OrientationType=/*#__PURE__*/function(e){return e.Horizontal="horizontal",e.Vertical="vertical",e}({}),types_GraphicType=/*#__PURE__*/function(e){return e.Circle="circle",e.Rect="rect",e.Line="line",e.Stepline="stepline",e.Bar="bar",e.Area="area",e}({}),types_SeriesEventType=/*#__PURE__*/function(e){return e.PropertyChanged="propertyChanged",e.SeriesAdded="seriesAdded",e.SeriesRemoved="seriesRemoved",e.SeriesCleared="seriesCleared",e}({});let DEFAULT_SERIES_CONFIG={thickness:1,orientation:types_OrientationType.Horizontal,display:!0,type:types_GraphicType.Line,color:"#00000000",label:""};class SeriesManager{seriesMap=new Map;changeCallbacks=[];subscribers=new Map;constructor(e=[]){this.initializeSeries(e)}initializeSeries(e){for(let t of e)this.addSeries(t)}addSeries(e){let t={...DEFAULT_SERIES_CONFIG,...e};this.seriesMap.set(e.name,t),this.emitEvent({type:types_SeriesEventType.SeriesAdded,name:e.name,series:t})}getSeries(e){return this.seriesMap.get(e)}getAllSeries(){return Array.from(this.seriesMap.values())}getAllConfigs(){let e={};for(let[t,r]of this.seriesMap)e[t]={...r};return e}setSeriesProperty(e,t,r){let n=this.seriesMap.get(e);if(!n||"name"===t)return!1;let a=n[t],i={...n,[t]:r};return this.seriesMap.set(e,i),this.notifyChange(e,t,r),this.emitEvent({type:types_SeriesEventType.PropertyChanged,name:e,property:t,value:r,oldValue:a,series:i}),!0}removeSeries(e){let t=this.seriesMap.get(e);if(!t)return!1;let r=this.seriesMap.delete(e);return r&&this.emitEvent({type:types_SeriesEventType.SeriesRemoved,name:e,series:t}),r}hasSeries(e){return this.seriesMap.has(e)}onChange(e){this.changeCallbacks.push(e)}offChange(e){let t=this.changeCallbacks.indexOf(e);t>-1&&this.changeCallbacks.splice(t,1)}notifyChange(e,t,r){for(let n of this.changeCallbacks)n(e,t,r)}clear(){this.seriesMap.clear(),this.emitEvent({type:types_SeriesEventType.SeriesCleared})}size(){return this.seriesMap.size}subscribe(e,t={}){if(this.subscribers.set(e,t),t.immediate)for(let t of this.seriesMap.values())this.shouldNotifySubscriber(e,{type:types_SeriesEventType.SeriesAdded,name:t.name,series:t})&&e({type:types_SeriesEventType.SeriesAdded,name:t.name,series:t});return()=>{this.subscribers.delete(e)}}unsubscribe(e){this.subscribers.delete(e)}emitEvent(e){for(let[t]of this.subscribers)this.shouldNotifySubscriber(t,e)&&t(e)}shouldNotifySubscriber(e,t){let r=this.subscribers.get(e);return!!r&&(!r.eventTypes||!!r.eventTypes.includes(t.type))&&(!r.seriesNames||!t.name||!!r.seriesNames.includes(t.name))}}let AXIS_Y_WIDTH=40,resolveAxisYLayout=({padding:e,placement:t,show:r})=>{let n="inside"===t,a=!1===r?0:AXIS_Y_WIDTH,i=n?0:a;return{axisYWidth:`${a+e/2}px`,inside:n,marginLeft:`${0-e/2}px`,pluginBoxWidth:0===i?"100%":`calc(100% - ${i}px)`,width:`${i}px`}};function useAxisYWidth_useAxisYWidth(){let e=useStore_useSelector(e=>e.system.padding);return resolveAxisYLayout({padding:e,placement:useStore_useSelector(e=>e.axisY.placement),show:useStore_useSelector(e=>e.axisY.show)})}let buildZoomFullRange=(e,t)=>({...e,interval:{start:0,end:Math.max(t-1,0)},isScanSegmentsUpdateMagnify:!1}),RulerTicks_RulerTicks=({length:e=10,tickColor:t="var(--chart-grid-strong)",tickHeight:r=8,strokeWidth:n=1,orientation:a="horizontal",split:i=2})=>{let o=external_react_useCallback(o=>{let l=100/e*o,s="horizontal"===a&&o%i==0||"vertical"===a&&o%i!=0?1.68*r:r;return("horizontal"===a&&(s/=.5),l)?"horizontal"===a?/*#__PURE__*/jsx_runtime_jsx("line",{x1:l,y1:"0",x2:l,y2:s,stroke:t,strokeWidth:n,vectorEffect:"non-scaling-stroke"},`tick-${o}`):/*#__PURE__*/jsx_runtime_jsx("line",{x1:"100",y1:l,x2:100-s,y2:l,stroke:t,strokeWidth:n,vectorEffect:"non-scaling-stroke"},`tick-${o}`):null},[e,t,n,a]);return /*#__PURE__*/jsxs("svg",{className:"absolute left-0 top-0 h-full w-full opacity-50",width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 100",children:["horizontal"===a?/*#__PURE__*/jsx_runtime_jsx("line",{x1:"0",y1:"0",x2:"100",y2:"0",stroke:t,strokeWidth:n,vectorEffect:"non-scaling-stroke"}):/*#__PURE__*/jsx_runtime_jsx("line",{x1:"100",y1:"0",x2:"100",y2:"100",stroke:t,strokeWidth:n,vectorEffect:"non-scaling-stroke"}),Array.from({length:e+1}).map((e,t)=>o(t))]})},components_RulerTicks=RulerTicks_RulerTicks,ZoomViewportLayer=/*#__PURE__*/forwardRef(({children:e,className:t,style:r},n)=>{let{state:{zoom:{style:a}}}=useStore_useStore();return /*#__PURE__*/jsx_runtime_jsx("div",{ref:n,className:cn_cn("pointer-events-none absolute right-0 top-0 z-[1] h-full w-full select-none overflow-hidden bg-transparent",t),style:r,children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 flex h-full w-full self-center",style:a??void 0,children:e})})}),Zoom_ZoomViewportLayer=ZoomViewportLayer,AXIS_X_TICKS_LAYER_CLASS_NAME="absolute right-0 top-0 flex h-full w-full items-center justify-between text-xs opacity-50",AXIS_X_TICKS_SHELL_CLASS_NAME="relative h-6 w-full select-none overflow-hidden text-xs leading-6",MSCAN_SEGMENT_CLASS_NAME="flex flex-1 items-center justify-center",ThreeFixedTicks=()=>{let{state:{zoom:{interval:{start:e,end:t}},axisX:{unit:r="",unitKHz:n=""},segments:a}}=useStore_useStore(),i=a.totalPoints??0,o=Math.max(i-1,0),{start:l,bandwidth:s=0}=a[0]??{},c=external_react_useMemo(()=>o&&s&&void 0!==l?getFrequencyToFixed(l+Math.max(0,Math.min((0,array_0.$z)(e,t),o))*s/(1e3*o)):0,[e,t,l,o,s]),u=external_react_useMemo(()=>i&&s?getFrequencyToFixed((t-e+1)*s/(2*i)):0,[e,t,i,s]);return /*#__PURE__*/jsxs("div",{className:AXIS_X_TICKS_LAYER_CLASS_NAME,children:[/*#__PURE__*/jsx_runtime_jsx(FrequencyLabel,{value:u,unit:n,prefix:"-"}),/*#__PURE__*/jsx_runtime_jsx(FrequencyLabel,{value:c,unit:r}),/*#__PURE__*/jsx_runtime_jsx(FrequencyLabel,{value:u,unit:n,prefix:"+"}),/*#__PURE__*/jsx_runtime_jsx(components_RulerTicks,{length:10,split:5})]})},FrequencyLabel=/*#__PURE__*/memo(({value:e,unit:t,prefix:r=""})=>/*#__PURE__*/jsxs("div",{className:"pl-[5px]",children:[r,e,t]})),FrequencyTick=/*#__PURE__*/memo(({value:e,index:t,total:r})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("absolute flex -translate-x-1/2 items-center justify-center text-center",0===t&&"left-0 translate-x-0",t===r&&"left-full -translate-x-full"),style:{left:`${t/r*100}%`},children:/*#__PURE__*/jsx_runtime_jsx("span",{children:e})})),TICK_COUNT=5,DataNFixedTicks=({type:e})=>{let{state:{segments:t,zoom:r,waterfallViewport:n,axisX:{frequencyFormat:a}}}=useStore_useStore(),i=e===constants_ChartType.Heatmap?n.sourceSize.width:0,o=i||t.totalPoints||0,l=e===constants_ChartType.Heatmap&&i>0?n.range.x[0]:r.interval.start,s=e===constants_ChartType.Heatmap&&i>0?n.range.x[1]-1:r.interval.end,c=external_react_useCallback(e=>{if(!o)return 0;let t=Math.min(100*e/o,100);return a?.(t)??""},[o,a]),u=external_react_useMemo(()=>{let e=(s-l+1)/TICK_COUNT;return Array.from({length:TICK_COUNT+1},(t,r)=>{let n=l+e*r;return{key:`tick-${n.toFixed(6)}`,value:c(n)}})},[l,s,c]);return /*#__PURE__*/jsxs("div",{className:AXIS_X_TICKS_LAYER_CLASS_NAME,children:[u.map((e,t)=>/*#__PURE__*/jsx_runtime_jsx(FrequencyTick,{value:e.value,index:t,total:u.length-1},e.key)),/*#__PURE__*/jsx_runtime_jsx(components_RulerTicks,{length:10,split:2})]})},MScanTicks=()=>{let{state:{segments:e}}=useStore_useStore();return /*#__PURE__*/jsxs("div",{className:AXIS_X_TICKS_LAYER_CLASS_NAME,children:[external_react_useMemo(()=>e.map(e=>/*#__PURE__*/jsx_runtime_jsx("div",{className:MSCAN_SEGMENT_CLASS_NAME,children:e.label},e.index)),[e]),/*#__PURE__*/jsx_runtime_jsx(components_RulerTicks,{length:2*e.length,split:2})]})},AxisXTicks=({type:e})=>{let{state:{axisX:{show:t}}}=useStore_useStore();return t?/*#__PURE__*/jsx_runtime_jsx("div",{className:AXIS_X_TICKS_SHELL_CLASS_NAME,children:e===constants_ChartType.Scan||e===constants_ChartType.ScanDF360||e===constants_ChartType.Heatmap?/*#__PURE__*/jsx_runtime_jsx(DataNFixedTicks,{type:e}):e===constants_ChartType.MScan?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:/*#__PURE__*/jsx_runtime_jsx(MScanTicks,{})}):/*#__PURE__*/jsx_runtime_jsx(ThreeFixedTicks,{})}):null},Ticks=/*#__PURE__*/memo(AxisXTicks),DOUBLE_TAP_INTERVAL_MS=300,DOUBLE_TAP_SLOP_PX=20,AxisX=({type:e})=>{let{state:{axisX:t,zoom:r,segments:n},dispatch:a}=useStore_useStore(),{children:i,unit:o,ticks:l}=t,{width:s,pluginBoxWidth:c}=useAxisYWidth_useAxisYWidth(),u=external_react_useRef(null),d=external_react_useMemo(()=>({marginLeft:s,width:c}),[s,c]),h=e!==constants_ChartType.Heatmap,p=n.totalPoints??0,f=external_react_useCallback(()=>{a({payload:{zoom:buildZoomFullRange(r,p)}})},[a,r,p]),m=external_react_useRef({x:0,y:0,time:0}),g=external_react_useCallback(e=>{let t=e.changedTouches[0];if(!t)return;let{clientX:r,clientY:n}=t,a=Date.now(),i=m.current;if(a-i.time<=DOUBLE_TAP_INTERVAL_MS&&Math.abs(r-i.x)<=DOUBLE_TAP_SLOP_PX&&Math.abs(n-i.y)<=DOUBLE_TAP_SLOP_PX){m.current={x:0,y:0,time:0},f();return}m.current={x:r,y:n,time:a}},[f]);return t?/*#__PURE__*/jsx_runtime_jsx(Overlay_Tooltip,{content:`单位${o}`,children:/*#__PURE__*/jsxs("div",{ref:u,className:"relative flex w-full flex-col box-border",style:d,onDoubleClick:h?f:void 0,onTouchEnd:h?g:void 0,children:[l&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute bottom-[-12px] right-0 z-[3] flex items-center justify-end text-[10px] opacity-50",children:o}),/*#__PURE__*/jsx_runtime_jsx(Ticks,{type:e})]}),/*#__PURE__*/jsx_runtime_jsx("div",{children:i})]})}):null},components_AxisX=/*#__PURE__*/memo(AxisX),FlexBox=e=>{let{children:t,className:r,style:n}=e;return /*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("relative flex min-h-0 flex-1 box-border",r),style:n,children:t})},components_FlexBox=FlexBox;function tools_getAxisYDoubleClickResetRange(e){let[t,r]=e??constants_restrictList["dBμV"];return t===constants_restrictList["dBμV"]["0"]&&r===constants_restrictList["dBμV"]["1"]?constants_RANGE_DEFAULT:[t,r]}let TicksPanel_TicksPanel=({ranging:e})=>{let{state:{axisY:t,system:{height:r}}}=useStore(),{range:n=RANGE_DEFAULT,autoranging:a,step:i=stepDefault,restrict:o=restrictList.dBμV}=t,l=useRef(null),[s,c]=o,u=c-s,[d,h]=n,p=u/i+1,f=h-d,m=useMemo(()=>Array.from({length:p},(e,t)=>{let r=(c-t*i).toFixed(0);return isNumberAlias(r)?/*#__PURE__*/_jsx("div",{children:/*#__PURE__*/_jsx("span",{children:r})},r):null}),[c,i,p]),g=useMemo(()=>{let e=l.current?.offsetHeight??0,t=(u+i)/f*e,r=i/(u+i)*t/2,n=(c-h)/f*e;return{height:`${t}px`,transform:`translateY(-${r+n}px)`}},[o,n,i,r,u,f,h,c]),[b,v]=useState(!1),[w,y]=useState(0),x=useCallback(e=>{v(!0),y(e.clientY)},[]),k=useCallback(()=>{v(!1)},[]),S=useCallback(t=>{if(!b||!l.current)return;let r=(t.clientY-w)/l.current.offsetHeight;Math.abs(r)>.01&&(e.move?.(r),y(t.clientY))},[b,w,e]),D=useCallback((t,r)=>{b||(t.stopPropagation(),e.moveBoundary?.(t.deltaY>0,r))},[b,e]);return /*#__PURE__*/_jsxs("div",{ref:l,className:"relative z-[2] h-full w-full box-border pr-0.5 text-xs text-foreground opacity-50",style:{cursor:b?"ns-resize":"auto",pointerEvents:a?"none":"auto"},onMouseDown:x,onMouseUp:k,onMouseLeave:k,onMouseMove:S,onDoubleClick:()=>{let t=getAxisYDoubleClickResetRange(o);e.setAxisY?.({realRange:t}),e.onChange?.()},children:[/*#__PURE__*/_jsx(Tooltip,{content:"滑动鼠标滚轮以改变边界范围",duration:1500,children:/*#__PURE__*/_jsx("div",{className:cn("absolute left-0 top-0 z-[3] max-h-20 min-h-[30%] w-full cursor-pointer opacity-0 transition-opacity hover:opacity-30"),style:{pointerEvents:b?"none":"auto",background:"linear-gradient(to bottom, var(--chart-highlight), transparent)"},onWheel:e=>D(e,!0)})}),/*#__PURE__*/_jsx(Tooltip,{content:"滑动鼠标滚轮以改变边界范围",duration:1500,children:/*#__PURE__*/_jsx("div",{className:cn("absolute bottom-0 left-0 z-[3] max-h-20 min-h-[30%] w-full cursor-pointer opacity-0 transition-opacity hover:opacity-30"),style:{pointerEvents:b?"none":"auto",background:"linear-gradient(to top, var(--chart-highlight), transparent)"},onWheel:e=>D(e,!1)})}),/*#__PURE__*/_jsxs("div",{className:"absolute z-[2] flex w-full flex-col justify-center box-border pr-2 [&>div]:flex [&>div]:flex-1 [&>div]:items-center [&>div]:justify-center [&>div]:overflow-hidden [&>div>span]:w-full [&>div>span]:text-right",style:g,title:`${a?"范围控制已全自动":"按住鼠标左键上下拖动\n在边界滚动鼠标滚轮以改变视觉范围"}
3809
+ 双击回到默认范围${RANGE_DEFAULT}`,children:[m,/*#__PURE__*/_jsx(RulerTicks,{orientation:"vertical",length:2*p,split:2})]})]})},presenters_TicksPanel=null,AutorangingControl=()=>{let{state:{axisY:e,globalID:t},dispatch:r}=useStore_useStore(),{autoranging:n,onChange:a}=e,i=external_react_useCallback(()=>{let t=!n;a?.({autoranging:t}),r({payload:{axisY:{...e,autoranging:t}}})},[e,n,a,r]);return /*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",title:"自动范围",onClick:()=>{useRangeAutoFocus(t)()},onDoubleClick:()=>{i()},children:/*#__PURE__*/jsx_runtime_jsx("span",{children:"A"})})},controls_AutorangingControl=/*#__PURE__*/react.memo(AutorangingControl),StepControl=()=>{let{state:{axisY:e,globalID:t},dispatch:r}=useStore(),{step:n,onChange:a}=e,i=useCallback(()=>{let t=nextItem(n,stepList);a?.({step:t}),r({payload:{axisY:{...e,step:t}}})},[n,e,a,r]);return useEffect(()=>{t&&subscriptionKeyBus(t,"step",e=>{e?.code==="KeyS"&&i()})},[i,t]),/*#__PURE__*/_jsxs(IconBox,{onClick:i,title:"步进",children:[n,"/div"]})},controls_StepControl=/*#__PURE__*/null,tools_nextItem=(e,t)=>{if(void 0===e||void 0===t||0===t.length)return e;let r=e,n=t.indexOf(r);return -1===n||n===t.length-1?[r]=t:r=t[n+1],r};function findNeighbors(e,t,r){let n=t.indexOf(e);if(-1===n)return null;let a=n>0?t[n-1]:t.at(0),i=n<t.length-1?t[n+1]:t.at(-1);return r<0?a:i}let UnitControl=()=>{let{state:{axisY:e,globalID:t},dispatch:r}=useStore_useStore(),{unit:n,unitList:a,unitDisabled:i,autoranging:o,onChange:l}=e,s=o||i,c=external_react_useCallback(()=>{if(s)return;let t=tools_nextItem(n,a);l?.({unit:t}),r({payload:{axisY:{...e,unit:t}}})},[e,n,s,a,l,r]);return external_react_useEffect(()=>{t&&useKeyEvent_subscriptionKeyBus(t,"unit",e=>{e?.code==="KeyU"&&c()})},[c,t]),/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{onClick:c,title:"单位",disabled:s,children:n})},controls_UnitControl=/*#__PURE__*/react.memo(UnitControl),AxisYSpectrum=e=>{let{chart:t}=e,{state:{axisY:r}}=useStore(),{show:n}=r,a=useRanging({chart:t}),{axisYWidth:i,marginLeft:o}=useAxisYWidth();return!1===n?null:/*#__PURE__*/_jsx("div",{className:"relative flex h-full justify-end",style:{width:i,marginLeft:o},children:/*#__PURE__*/_jsx(TicksPanel,{ranging:a})})},spectrum=null,SeriesEventName={UPDATED:"series:updated",ADDED:"series:added",REMOVED:"series:removed",MODE_CHANGED:"series:mode-changed",TYPE_OVERRIDE_CHANGED:"series:type-override-changed",BATCH_UPDATED:"series:batch-updated",RESET:"series:reset"};class EventManager{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set);let r=this.listeners.get(e);if(!r)throw Error(`Failed to get event listeners for ${e}`);return r.add(t),()=>{r.delete(t),0===r.size&&this.listeners.delete(e)}}emit(e,t){let r=this.listeners.get(e);r&&r.forEach(r=>{try{r(t)}catch(t){console.error(`Error in event listener for ${e}:`,t)}})}removeAllListeners(e){e?this.listeners.delete(e):this.listeners.clear()}getListenerCount(e){return this.listeners.get(e)?.size||0}}let globalEventManager=new EventManager,seriesEvents={on:globalEventManager.on.bind(globalEventManager),emit:globalEventManager.emit.bind(globalEventManager),removeAllListeners:globalEventManager.removeAllListeners.bind(globalEventManager),getListenerCount:globalEventManager.getListenerCount.bind(globalEventManager)};function subscribeToSeries(e,t,r){return seriesEvents.on(t,t=>{t.globalID===e&&r(t)})}function emitSeriesEvent(e,t){seriesEvents.emit(e,t)}var modes_SeriesMode=/*#__PURE__*/function(e){return e.Line="line",e.StepLine="stepline",e.Bar="bar",e.Area="area",e}({});let SERIES_MODES={line:{name:"line",label:"线图",icon:"line",realData:renderer_GraphicType.Line,minData:renderer_GraphicType.Line,maxData:renderer_GraphicType.Line,avgData:renderer_GraphicType.Line},stepline:{name:"stepline",label:"阶梯线图",icon:"stepline",realData:renderer_GraphicType.Stepline,minData:renderer_GraphicType.Stepline,maxData:renderer_GraphicType.Stepline,avgData:renderer_GraphicType.Stepline},bar:{name:"bar",label:"柱状图",icon:"bar",realData:renderer_GraphicType.Bar,minData:renderer_GraphicType.Line,maxData:renderer_GraphicType.Line,avgData:renderer_GraphicType.Line},area:{name:"area",label:"面积图",icon:"area",realData:renderer_GraphicType.Area,minData:renderer_GraphicType.Stepline,maxData:renderer_GraphicType.Stepline,avgData:renderer_GraphicType.Stepline}},seriesModes=new Map;function getSeriesMode(e){return seriesModes.get(e)||"line"}function getNextMode(e){let t=Object.values(modes_SeriesMode),r=(t.indexOf(e)+1)%t.length;return t[r]}function setSeriesMode(e,t){seriesModes.set(e,t);let r=SERIES_MODES[t];emitSeriesEvent(SeriesEventName.MODE_CHANGED,{globalID:e,mode:t,config:r})}function toggleSeriesMode(e,t){let r=getNextMode(t||getSeriesMode(e));setSeriesMode(e,r)}function modes_clearSeriesMode(e){seriesModes.delete(e)}function initSeriesSubscription(e){let{globalID:t}=e.state;if(!t)return console.warn("[Series] globalID is required for series subscription"),null;let r=[];return r.push(subscribeToSeries(t,SeriesEventName.UPDATED,r=>{let n=getCorrectSeriesType(t,r.seriesName),a={...r.config,type:n};e.setSeries(a,!0),e.state.chart?.draw()})),r.push(subscribeToSeries(t,SeriesEventName.MODE_CHANGED,()=>{e.initSeries()})),r.push(subscribeToSeries(t,SeriesEventName.TYPE_OVERRIDE_CHANGED,()=>{e.initSeries()})),r.push(subscribeToSeries(t,SeriesEventName.BATCH_UPDATED,r=>{r.configs.forEach(r=>{let n=getCorrectSeriesType(t,r.name),a={...r,type:n};e.setSeries(a,!0)}),e.state.chart?.draw()})),r.push(subscribeToSeries(t,SeriesEventName.RESET,()=>{e.state.series&&(e.state.series={}),e.initSeries()})),()=>{for(let e of r)e()}}let chartTypeSeriesOverrides=new Map;function setChartTypeSeriesOverride(e,t,r){chartTypeSeriesOverrides.has(e)||chartTypeSeriesOverrides.set(e,new Map),chartTypeSeriesOverrides.get(e)?.set(t,r),emitSeriesEvent(SeriesEventName.TYPE_OVERRIDE_CHANGED,{globalID:e,seriesName:t,type:r})}function clearChartTypeSeriesOverrides(e){let t=chartTypeSeriesOverrides.has(e);chartTypeSeriesOverrides.delete(e),t&&emitSeriesEvent(SeriesEventName.TYPE_OVERRIDE_CHANGED,{globalID:e})}function getChartTypeSeriesOverride(e,t){return chartTypeSeriesOverrides.get(e)?.get(t)}function getCorrectSeriesType(e,t){let r=chartTypeSeriesOverrides.get(e)?.get(t);if(r)return r;if("templateData"===t)return renderer_GraphicType.Area;let n=SERIES_MODES[getSeriesMode(e)][t];return n&&"string"==typeof n?n:renderer_GraphicType.Line}let managers=new Map;function getDefaultSeriesConfigs(){return Object.values(getSeriesConfig()).map(e=>({name:e.name,label:e.label,color:e.color,thickness:e.thickness,display:e.display,type:renderer_GraphicType.Line}))}function getSeriesManager(e){if(!e)throw Error("globalID 不能为空");if(!managers.has(e)){let t=new SeriesManager([]);getDefaultSeriesConfigs().forEach(e=>{t.addSeries({name:e.name,label:e.label,color:e.color,display:e.display,type:e.type||renderer_GraphicType.Line,thickness:e.thickness})}),managers.set(e,t)}let t=managers.get(e);if(!t)throw Error(`SeriesManager for globalID "${e}" not found`);return t}function destroySeriesManager(e){let t=managers.get(e);t&&(t.clear(),managers.delete(e),clearSeriesMode(e),chartTypeSeriesOverrides.delete(e))}function hasSeriesManager(e){return managers.has(e)}function getSeriesMap(e){let t=getSeriesManager(e).getAllSeries(),r=new Map;return Array.isArray(t)&&t.forEach(e=>{r.set(e.name,{name:e.name,label:e.label||"",color:e.color,display:void 0===e.display||e.display,type:e.type||renderer_GraphicType.Line,thickness:e.thickness||1})}),r}function mergeSeriesConfig(e,t){let r=getSeriesConfig()[e.name],n={label:r?.label??"",color:r?.color,display:r?.display??!0,type:renderer_GraphicType.Line,thickness:r?.thickness??1};return{name:e.name,label:e.label??t?.label??n.label,color:e.color??t?.color??n.color??(()=>{throw Error(`Series "${e.name}" does not exist and must have a color defined`)})(),display:e.display??t?.display??n.display,type:e.type??t?.type??n.type,thickness:e.thickness??t?.thickness??n.thickness}}function upsertSeriesConfig(e,t,r){r?(e.setSeriesProperty(t.name,"label",t.label),e.setSeriesProperty(t.name,"color",t.color),e.setSeriesProperty(t.name,"thickness",t.thickness),e.setSeriesProperty(t.name,"display",t.display),e.setSeriesProperty(t.name,"type",t.type)):e.addSeries(t)}function updateSeries(e,t){if(!t?.name)return;let r=getSeriesManager(e),n=r.getSeries(t.name),a=mergeSeriesConfig(t,n);upsertSeriesConfig(r,a,n),emitSeriesEvent(SeriesEventName.UPDATED,{globalID:e,seriesName:t.name,config:{name:a.name,label:a.label,color:a.color,thickness:a.thickness,display:a.display,type:a.type}})}function resetSeries(e){let t=getSeriesManager(e);t.clear(),getDefaultSeriesConfigs().forEach(e=>{t.addSeries({name:e.name,label:e.label,color:e.color,display:e.display,type:e.type||renderer_GraphicType.Line,thickness:e.thickness})}),emitSeriesEvent(SeriesEventName.RESET,{globalID:e})}function batchUpdateSeries(e,t){let r=getSeriesManager(e),n=[];t.forEach(e=>{if(!e?.name)return;let t=r.getSeries(e.name),a=mergeSeriesConfig(e,t);upsertSeriesConfig(r,a,t),n.push({name:a.name,label:a.label,color:a.color,thickness:a.thickness,display:a.display,type:a.type})}),n.length>0&&emitSeriesEvent(SeriesEventName.BATCH_UPDATED,{globalID:e,configs:n})}function getSeriesWithGraphicType(e){let t=getSeriesMap(e),r=new Map;return t.forEach(t=>{let n={...t,type:getCorrectSeriesType(e,t.name)};r.set(t.name,n)}),r}let DEFAULT_SPECTRUM_TYPE="singleFrequency",WATERFALL_CAPABLE_SPECTRUM_TYPES=new Set([DEFAULT_SPECTRUM_TYPE,"scan","mscan"]),shouldEnableSpectrumWaterfall=({heatmapElementID:e,type:t})=>!!e&&WATERFALL_CAPABLE_SPECTRUM_TYPES.has(t??DEFAULT_SPECTRUM_TYPE),applyAxisYRange=(e,t)=>{let[r,n]=t,a=e.range??constants_RANGE_DEFAULT,i=e.realRange??constants_RANGE_DEFAULT,o=e.renderRange??constants_RANGE_DEFAULT,l=a[0]!==r||a[1]!==n,s=i[0]!==r||i[1]!==n,c=o[0]!==r||o[1]!==n;return l||s||c?{...e,range:t,realRange:t,renderRange:t}:e};function useSpectrumChartType({type:e,heatmapElementID:t}){let{state:{axisY:r,limit:n,signal:a,marker:i,cursor:o,frequencyAllocation:l,zoom:s,globalID:c},dispatch:u}=useStore_useStore();return external_react_useEffect(()=>{c&&(clearChartTypeSeriesOverrides(c),e===constants_ChartType.MScan&&setChartTypeSeriesOverride(c,REAL_DATA_NAME,renderer_GraphicType.Bar),e===constants_ChartType.ScanDF360&&(setChartTypeSeriesOverride(c,REAL_DATA_NAME,renderer_GraphicType.Rect),setScanDF360Prob(c)(!0)))},[e,c]),external_react_useEffect(()=>{let t=r,c=n,d=a,h=i,p=o,f=l,m=s;if(e===constants_ChartType.DDC&&(!1!==c.show&&(c={...c,show:!1}),!0!==h.visible&&(h={...h,visible:!0})),e===constants_ChartType.Lite&&(!1!==c.show&&(c={...c,show:!1}),!1!==h.enabled&&(h={...h,enabled:!1})),e===constants_ChartType.LiteNormalized){let e=t.restrict??[0,1];!1!==c.show&&(c={...c,show:!1}),!1!==d.show&&(d={...d,show:!1}),(0!==e[0]||1!==e[1])&&(t={...t,restrict:[0,1]}),!1!==f.show&&(f={...f,show:!1})}if(e===constants_ChartType.MScan&&(!1!==h.enabled&&(h={...h,enabled:!1}),!1!==f.show&&(f={...f,show:!1})),e===constants_ChartType.ScanDF360){let e=t.restrict??[0,360];!1!==c.show&&(c={...c,show:!1}),!1!==d.show&&(d={...d,show:!1}),!1!==h.enabled&&(h={...h,enabled:!1}),!1!==m.show&&(m={...m,show:!1}),!1!==p.show&&(p={...p,show:!1}),!1!==f.show&&(f={...f,show:!1}),t="°"!==t.unit||36!==t.step||0!==e[0]||360!==e[1]?{...applyAxisYRange(t,[0,360]),unit:"°",restrict:[0,360],step:36}:applyAxisYRange(t,[0,360])}let g={};c!==n&&(g.limit=c),d!==a&&(g.signal=d),h!==i&&(g.marker=h),p!==o&&(g.cursor=p),f!==l&&(g.frequencyAllocation=f),m!==s&&(g.zoom=m),t!==r&&(g.axisY=t),Object.keys(g).length>0&&u({payload:g})},[r,o,u,l,n,i,a,e,s]),external_react_useEffect(()=>{if(e===constants_ChartType.LiteNormalized&&c){let e=r.range??constants_RANGE_DEFAULT;if(e[0]<0||e[1]>1){let e=applyAxisYRange(r,[0,1]);u({payload:{axisY:e}}),useRangeSet(c)(e.range??[0,1])}}},[r,u,c,e]),external_react_useMemo(()=>{let r=!1,n=shouldEnableSpectrumWaterfall({heatmapElementID:t,type:e});return(e===constants_ChartType.SingleFrequency||e===constants_ChartType.Scan||e===constants_ChartType.MScan)&&(r=!0),{enableMetrics:r,enableWaterfall:n}},[e,t])}function useChannel(){let{state:{marker:e,globalID:t},dispatch:r}=useStore_useStore();return external_react_useEffect(()=>{e?.mode===marker_MarkerMode.DDC&&r({payload:{marker:{...e,enabled:!0,visible:!0}}})},[e?.mode]),external_react_useCallback(()=>{},[t])}function usePoints(){let{dispatch:e,state:{axisX:t}}=useStore_useStore();return external_react_useCallback(r=>{if(r?.length){let n=leftPoints2frequency(r);t.frequencyFormat=e=>String(n(e)??""),e({payload:{points:r,axisX:t}})}},[])}function useSegments(){let{state:{segments:e,zoom:t,points:r,axisX:n},dispatch:a}=useStore_useStore();return external_react_useEffect(()=>{},[e]),[e,external_react_useCallback(e=>{if(e.totalPoints){t.interval={start:0,end:e.totalPoints-1};let i={segments:e,zoom:t,axisX:n};0===r.length&&(i.axisX.frequencyFormat=leftSegments2frequency(e)),a({payload:i})}},[r])]}let SET_SEGMENTS_DISPLAY=(e,t)=>subscription_createSubscriptionManager(`SET_SEGMENTS_DISPLAY-${e}`,"0",t,e);function useSpectrumRule(e){let{state:{zoom:t,globalID:r},dispatch:n}=useStore_useStore(),[a,i]=useSegments(),o=external_react_useCallback(e=>{let{event:r=constants_SegmentsEvent.Cover,index:o}=e,{totalPoints:l}=a,s=0,c=0,u=!1;if(r===constants_SegmentsEvent.Focus&&l)if("number"==typeof o&&o<a.length){for(let e=0;e<o;e+=1)s+=a[e].point+1;let{point:e}=a[o];c=s+e,u=!0}else void 0===o&&(s=0,c=l-1,u=!1);t.interval={start:s,end:c},t.isScanSegmentsUpdateMagnify=u,n({payload:{zoom:t}}),r===constants_SegmentsEvent.Cover&&e.data&&i(generateGreatSegments(e.data))},[a]);external_react_useEffect(()=>SET_SEGMENTS_DISPLAY(r,e=>{o?.({pstype:constants_PSType.Segments,event:constants_SegmentsEvent.Focus,index:e})}),[r,o]);let l=external_react_useRef(3),s=external_react_useRef({frequency:0,bandwidth:0}),c=external_react_useCallback((e,t=s.current)=>{if(t.bandwidth&&t.frequency&&e){let r=generateFrequencySegments({frequency:t?.frequency,bandwidth:t?.bandwidth,totalPoints:e});"function"==typeof i&&i(r)}},[i]),u=external_react_useCallback(e=>{let{frequency:t,bandwidth:r}=e;if(!t||!r)return;let n=s.current;(n.frequency!==t||n.bandwidth!==r)&&(s.current={frequency:t,bandwidth:r},c(l.current,e))},[]),d=external_react_useCallback(t=>{if(!t)return;let r=t?.length;r&&r!==l.current&&(l.current=r,c(r),e===constants_ChartType.LiteNormalized&&i(generateNormalizedSegments(r)))},[c,i,e]);return useChannel(),external_react_useCallback(e=>{switch(e.pstype){case constants_PSType.Spectrum:e.data&&d(e.data);break;case constants_PSType.SpectrumBandwidth:u(e);break;case constants_PSType.Segments:o?.(e)}},[])}function useTouchMode(e){let{dispatch:t}=useStore_useStore(),r=external_react_useRef(!1);external_react_useEffect(()=>{if(!e){r.current=!1;return}r.current||(r.current=!0,t({payload:e=>({limit:{...e.limit,show:!1},marker:{...e.marker,enabled:!1,visible:!1},frequencyAllocation:{...e.frequencyAllocation,show:!1},toolbar:{...e.toolbar,show:!1}})}))},[e,t])}let COMPONENT_KEY="AxisYHeatmapTicks",calcTimeDiffLastTwoDigits=e=>e?.slice?.(-8),HEATMAP_FULL_TICKS=10,Ticks_Ticks=e=>{let{id:t}=e,{state:{globalID:r}}=useStore_useStore(),[n,a]=external_react_useState(Array(HEATMAP_FULL_TICKS).fill("")),i=external_react_useMemo(()=>{let e=[];for(let t=0;t<HEATMAP_FULL_TICKS;t++)e.push(`${100-t/(HEATMAP_FULL_TICKS-1)*100}%`);return e},[]);return external_react_useEffect(()=>{t&&r&&withUpdateData(t,COMPONENT_KEY,()=>{let e=withWaterfallAnalyzerSYNC(r)?.getSnapshot().data??withDatabase(r).getAllRawData().waterfallData??[],t=[],n=e.length;for(let r=0;r<HEATMAP_FULL_TICKS;r++){let a=e[Math.floor((n-1)*r/(HEATMAP_FULL_TICKS-1))],i=calcTimeDiffLastTwoDigits(a?.timestamp);t.push(i)}a(t)})},[t,r]),/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative z-[2] flex h-full w-full flex-col items-end justify-between pr-1 text-xs text-foreground opacity-50",children:i.map((e,t)=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("absolute right-0 flex max-w-full origin-right scale-x-[0.85] items-center justify-end whitespace-nowrap text-right text-[9px] leading-none [font-variant-numeric:tabular-nums]",0===t&&"-translate-y-full",t===i.length-1&&"translate-y-0",t>0&&t<i.length-1&&"-translate-y-1/2"),style:{top:e},children:n[t]},`tick-${e}`))})},components_Ticks=/*#__PURE__*/react.memo(Ticks_Ticks),StandardHeatmapAxisYVariant=e=>{let{axisYWidth:t,marginLeft:r}=useAxisYWidth_useAxisYWidth();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-auto justify-between overflow-hidden",style:{width:t,marginLeft:r},children:/*#__PURE__*/jsx_runtime_jsx(components_Ticks,{...e})})},standard=StandardHeatmapAxisYVariant,rainColors=getGradient(),GradientRibbon_GradientRibbon=()=>{let{state:{axisY:{range:e}}}=useStore(),[t,r]=e;return /*#__PURE__*/_jsxs("div",{className:"relative flex h-full w-4 select-none flex-col",children:[/*#__PURE__*/_jsxs("div",{className:"absolute top-0 flex h-full w-full flex-col justify-between",children:[/*#__PURE__*/_jsx("div",{className:"flex w-full items-center justify-center text-[9px] text-white",children:r.toFixed()}),/*#__PURE__*/_jsx("div",{className:"flex w-full items-center justify-center text-[9px] text-white",children:t.toFixed()})]}),rainColors.map((e,t)=>t===rainColors.length-1?null:/*#__PURE__*/_jsx("span",{className:"w-full flex-1",style:{background:`linear-gradient(to bottom,${e},${rainColors[t+1]})`}},e))]})},standard_GradientRibbon=null,AxisYHeatmap=e=>{let{chart:t}=e,{state:{axisY:r}}=useStore_useStore(),{linkage:n,renderRange:a,show:i}=r;return(external_react_useEffect(()=>{n&&a&&t?.setRange?.(a)},[a]),!1===i)?null:/*#__PURE__*/jsx_runtime_jsx(standard,{...e})},heatmap=AxisYHeatmap,CURSOR_TIMEOUT=(e,t)=>openData(`CURSOR_TIMEOUT-${e}`,t,null,e),CURSOR_SETACTIVE=(e,t)=>subscription_createSubscriptionManager(`CURSOR_SETACTIVE-${e}`,"0",t,e);function convertCoordToVisualLeft({coord:e,zoom:t,segments:r}){let{left:n}=e,{start:a,end:i}=t.interval,{totalPoints:o}=r;return(Math.min(Math.round(Math.max(0,Math.min(100,n))/100*(o-1)),o-1)-a)*100/(i-a+1)}function convertVisualLeftToRealLeft({visualLeft:e,zoom:t,segments:r}){let{start:n,end:a}=t.interval,{totalPoints:i}=r,o=Math.round((a-n+1)*Math.max(0,Math.min(100,e))/100);return 100*Math.min(n+o,i-1)/(i-1)}let hasBounds=e=>"function"==typeof e?.getBoundingClientRect,calculateEventRelativePositionFromSource=e=>{let{clientX:t=0,clientY:r=0}=e,n=e.currentTarget??e.target,{left:a,top:i,width:o,height:l}=hasBounds(n)?n.getBoundingClientRect():{height:0,left:0,top:0,width:0};return o<=0||l<=0?{left:0,top:0}:{left:(t-a)/o*100,top:(r-i)/l*100}};function getEID(e){return`EVENTBUS-${e}`}function generateRecursiveId(e,t){let r=e;return t&&(r=getEID(e)),r}let createMoveEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-createMoveEventManager`,t,r,e),createMouseDownEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-createMouseDownEventManager`,t,r,e),createDoubleClickEventManager=(e,t,r)=>createConsumableSubscriptionManager(`${generateRecursiveId(e,r)}-createDoubleClickEventManager`,getEventPriority,t,r,e),createMouseUpEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-mouse-up`,t,r,e),createMouseLeaveEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-mouse-leave`,t,r,e),createMouseEnterEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-mouse-enter`,t,r,e),createWheelEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-wheel`,t,r,e),createDragEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-drag`,t,r,e),createZoomEventManager=(e,t,r)=>createSubscriptionManager(`${generateRecursiveId(e,r)}-zoom`,t,r,e),createLongPressEventManager=(e,t,r)=>subscription_createSubscriptionManager(`${generateRecursiveId(e,r)}-long-press`,t,r,e),calculateEventRelativePosition=e=>calculateEventRelativePositionFromSource(e),EVENT_PRIORITY_LEVEL_DEFAULT="void",EVENT_PRIORITY_LEVELS={[EVENT_PRIORITY_LEVEL_DEFAULT]:0,[constants_ToolType.EventBus]:1,[constants_ToolType.Signal]:1,[constants_ToolType.Zoom]:2,[constants_ToolType.DragFrame]:2,[constants_ToolType.HeatmapCapture]:3,[constants_ToolType.Markers]:3,[constants_ToolType.Limit]:3,[constants_ToolType.Stripe]:4,[constants_ToolType.FrequencyTagLine]:5},getEventPriority=e=>EVENT_PRIORITY_LEVELS[e]??0,CURSOR_STYLE_MAP={[constants_ToolType.Markers]:"all-scroll",[constants_ToolType.Stripe]:"col-resize",[constants_ToolType.FrequencyTagLine]:"col-resize",[constants_ToolType.Limit]:"n-resize",[constants_ToolType.Frame]:"w-resize",[constants_ToolType.Zoom]:"all-scroll",[constants_ToolType.Area]:"crosshair"},getEventLevel=(e,t)=>subscription_openData(`event-level-${e}`,t,EVENT_PRIORITY_LEVEL_DEFAULT,e),getEventType=(e,t)=>subscription_openData(`event-type-${e}`,t,"",e);function compareEventPriority(e,t,r){getEventType(e,r);let n=EVENT_PRIORITY_LEVELS[getEventLevel(e)];return EVENT_PRIORITY_LEVELS[t]>=n&&(getEventLevel(e,t),!0)}function getEventCursor(e){return CURSOR_STYLE_MAP[getEventLevel(e)]??"default"}function resetEventLevel(e,t){let r=getEventLevel(e);t&&r===t&&getEventLevel(e,EVENT_PRIORITY_LEVEL_DEFAULT)}let POPOVER_ROW_CLASS="mt-1 flex items-center justify-between gap-1 text-xs text-popover-foreground",POPOVER_VALUE_CLASS="inline-flex min-w-9 justify-end",useCursorPopoverUpdateKey=(e,t)=>{let[r,n]=external_react_useState(0);return external_react_useEffect(()=>{if(!t)return;let r=withUpdateData(t,`CursorPopover-${e}`,()=>{n(e=>e+1)});return()=>{"function"==typeof r&&r()}},[t,e]),r},FrequencyDisplay=({frequency:e,unit:t})=>e?/*#__PURE__*/jsxs("div",{className:"text-[14px] font-medium text-popover-foreground",children:[e,t]}):null,useCursorSample=e=>{let t=external_react_useCallback(t=>e?interactionRuntime.subscribeSample(e,()=>{t()}):()=>{},[e]),r=external_react_useCallback(()=>e?interactionRuntime.getSample(e):null,[e]);return useSyncExternalStore(t,r,r)};function useSeriesManager(e,t={}){let{subscribeToMode:r=!0,subscribeToData:n=!0,watchSeries:a}=t,[i,o]=external_react_useState(0),[l,s]=external_react_useState(()=>e?getSeriesMode(e):"line"),c=external_react_useCallback(()=>{o(e=>e+1)},[]),u=external_react_useMemo(()=>e?getSeriesMap(e):new Map,[e,i]),d=external_react_useCallback(t=>{e&&updateSeries(e,t)},[e]),h=external_react_useCallback(e=>u.get(e),[u]);return external_react_useEffect(()=>{if(!e)return;let t=[];if(r){s(getSeriesMode(e));let r=subscribeToSeries(e,SeriesEventName.MODE_CHANGED,e=>{s(e.mode)});t.push(r)}if(n){let r=subscribeToSeries(e,SeriesEventName.UPDATED,e=>{(!a||a.includes(e.seriesName))&&c()});t.push(r);let n=subscribeToSeries(e,SeriesEventName.ADDED,e=>{(!a||a.includes(e.seriesName))&&c()});t.push(n);let i=subscribeToSeries(e,SeriesEventName.REMOVED,e=>{(!a||a.includes(e.seriesName))&&c()});t.push(i);let o=subscribeToSeries(e,SeriesEventName.BATCH_UPDATED,()=>{c()});t.push(o);let l=subscribeToSeries(e,SeriesEventName.RESET,()=>{c()});t.push(l)}return()=>{for(let e of t)e()}},[e,r,n,a,c]),{series:u,mode:l,updateSeries:d,forceUpdate:c,getSeries:h}}function useSeriesForComponent(e){return useSeriesManager(e,{subscribeToMode:!0,subscribeToData:!0})}let DEFAULT_SERIES_ORDER=Object.values(getSeriesConfig()).map(e=>e.name);function getStableOrder(e){return[...DEFAULT_SERIES_ORDER.filter(t=>e.includes(t)),...e.filter(e=>!DEFAULT_SERIES_ORDER.includes(e))]}function useFilteredSeries(e,t){let{series:r}=useSeriesManager(e),n=useStore_useSelector(e=>e.series.legendExternal);return external_react_useMemo(()=>{let e=Array.from(r.values()).filter(e=>!n.includes(e.name)&&e.name!==constants_SeriesType.TemplateData&&(!t||t(e))),a=new Map(getStableOrder(e.map(e=>e.name)).map((e,t)=>[e,t]));return e.sort((e,t)=>(a.get(e.name)??Number.MAX_SAFE_INTEGER)-(a.get(t.name)??Number.MAX_SAFE_INTEGER)).map((e,t)=>({...e,originalIndex:t}))},[r,n,t])}let useSeriesManager_useFilteredSeries=null,viewport_clamp=(e,t,r)=>Math.min(r,Math.max(t,e)),clampHeatmapPercent=e=>viewport_clamp(e,0,100),normalizeHeatmapFrames=e=>{let t=0,r=!1;for(let r of e)t=Math.max(t,r.length);if(0===t)return[];for(let n of e)if(n.length!==t){r=!0;break}return r?e.map(e=>{if(e.length===t)return e;let r=new Float32Array(t);return r.fill(0/0),r.set(e),r.timestamp=e.timestamp,r}):e},resolveHeatmapVisibleRowIndex=(e,t)=>t<=0?-1:1===t?0:viewport_clamp(Math.ceil((100-clampHeatmapPercent(e))*t/100)-1,0,t-1),resolveHeatmapVisibleColumnIndex=(e,t)=>t<=0?-1:1===t?0:viewport_clamp(Math.ceil(clampHeatmapPercent(e)*t/100)-1,0,t-1),resolveHeatmapSourceLeft=(e,t)=>{let{width:r}=t.sourceSize;if(r<=0)return 0;let[n,a]=t.range.x;return viewport_clamp(100*(n+(a-n)*clampHeatmapPercent(e)/100)/r,0,100)},resolveHeatmapSourcePoint=(e,t)=>{let r=resolveHeatmapVisibleRowIndex(t.top,e.rowIndices.length),n=resolveHeatmapVisibleColumnIndex(t.left,e.columnIndices.length);return r<0||n<0?null:{columnIndex:e.columnIndices[n],rowIndex:e.rowIndices[r],sourceLeft:resolveHeatmapSourceLeft(t.left,e),visibleColumnIndex:n,visibleRowIndex:r}},resolveHeatmapSourceRange=(e,t)=>{let r=resolveHeatmapSourcePoint(e,{left:t.startLeft,top:t.startTop}),n=resolveHeatmapSourcePoint(e,{left:t.endLeft,top:t.endTop});return r&&n?{endCol:Math.max(r.columnIndex,n.columnIndex),endIndex:Math.max(r.rowIndex,n.rowIndex),startCol:Math.min(r.columnIndex,n.columnIndex),startIndex:Math.min(r.rowIndex,n.rowIndex)}:null},resolveHeatmapSnapshotRangeData=(e,t)=>e.rawData.slice(t.startIndex,t.endIndex+1).map(e=>Array.from(e.slice(t.startCol,t.endCol+1))),resolveHeatmapSourceRangeScreenRect=(e,t)=>resolveHeatmapContinuousSourceRangeScreenRect(e,{x:[Math.min(t.startCol,t.endCol),Math.max(t.startCol,t.endCol)+1],y:[Math.min(t.startIndex,t.endIndex),Math.max(t.startIndex,t.endIndex)+1]}),resolveHeatmapContinuousSourceRangeScreenRect=(e,t)=>{let[r,n]=e.range.x,[a,i]=e.range.y,o=n-r,l=i-a;if(o<=0||l<=0)return null;let s=Math.min(t.x[0],t.x[1]),c=Math.max(t.x[0],t.x[1]),u=Math.min(t.y[0],t.y[1]),d=Math.max(t.y[0],t.y[1]);return{leftPosition:(s-r)*100/o,width:(c-s)*100/o,position:100-(d-a)*100/l,height:(d-u)*100/l}},SOURCE_EDGE_EPSILON=1e-7,resolveHeatmapProjectedContinuousSourceRange=(e,t)=>{let{sourceSize:r}=e,[n,a]=e.range.x,[i,o]=e.range.y,l=a-n,s=o-i;if(r.width<=0||r.height<=0||l<=0||s<=0)return null;let c=viewport_clamp(n+Math.min(t.startLeft,t.endLeft)*l/100,0,r.width),u=viewport_clamp(n+Math.max(t.startLeft,t.endLeft)*l/100,0,r.width),d=i+(100-t.startTop)*s/100,h=i+(100-t.endTop)*s/100;return{x:[c,u],y:[viewport_clamp(Math.min(d,h),0,r.height),viewport_clamp(Math.max(d,h),0,r.height)]}},resolveHeatmapProjectedSourceRange=(e,t)=>{let r=resolveHeatmapProjectedContinuousSourceRange(e,t);return r?quantizeHeatmapContinuousSourceRange(e,r):null},quantizeHeatmapContinuousSourceRange=(e,t)=>{let{sourceSize:r}=e;if(r.width<=0||r.height<=0)return null;let[n,a]=t.x,[i,o]=t.y,l=viewport_clamp(Math.floor(n+SOURCE_EDGE_EPSILON),0,r.width-1),s=viewport_clamp(Math.max(l,Math.ceil(a-SOURCE_EDGE_EPSILON)-1),l,r.width-1),c=viewport_clamp(Math.floor(i+SOURCE_EDGE_EPSILON),0,r.height-1);return{endCol:s,endIndex:viewport_clamp(Math.max(c,Math.ceil(o-SOURCE_EDGE_EPSILON)-1),c,r.height-1),startCol:l,startIndex:c}},resizeAnchoredRange=(e,t,r,n)=>{let a=viewport_clamp(Math.round(e[0]+(e[1]-e[0])*n-r*n),0,t-r);return[a,a+r]},calculateHeatmapWheelRange=(e,t,r)=>{let{sourceSize:n}=e,a=e.range.x[1]-e.range.x[0],i=e.range.y[1]-e.range.y[0],o=t>0?.5:2,l=Math.min(10,n.width),s=Math.min(2,n.height),c=viewport_clamp(Math.round(a*o),l,n.width),u=viewport_clamp(Math.round(i*o),s,n.height);return{x:resizeAnchoredRange(e.range.x,n.width,c,clampHeatmapPercent(r.left)/100),y:resizeAnchoredRange(e.range.y,n.height,u,(100-clampHeatmapPercent(r.top))/100)}},translateRange=(e,t,r)=>{let n=e[1]-e[0],a=viewport_clamp(e[0]+r,0,t-n);return[a,a+n]},centerRange=(e,t,r)=>{let n=e[1]-e[0],a=viewport_clamp(Math.round(r-n/2),0,t-n);return[a,a+n]},resolveHeatmapOverviewSourcePoint=(e,t)=>({x:viewport_clamp(t.left,0,1)*e.sourceSize.width,y:(1-viewport_clamp(t.top,0,1))*e.sourceSize.height}),resolveHeatmapOverviewViewportRect=e=>{let{range:t,sourceSize:r}=e;return r.width<=0||r.height<=0?{height:0,left:0,top:0,width:0}:{left:t.x[0]/r.width,top:1-t.y[1]/r.height,width:(t.x[1]-t.x[0])/r.width,height:(t.y[1]-t.y[0])/r.height}},toHeatmapContinuousSourceRange=e=>({x:[Math.min(e.startCol,e.endCol),Math.max(e.startCol,e.endCol)+1],y:[Math.min(e.startIndex,e.endIndex),Math.max(e.startIndex,e.endIndex)+1]}),resolveHeatmapOverviewContinuousSourceRangeRect=(e,t)=>{let{sourceSize:r}=e;if(r.width<=0||r.height<=0)return{height:0,left:0,top:0,width:0};let n=viewport_clamp(Math.min(t.x[0],t.x[1]),0,r.width),a=viewport_clamp(Math.max(t.x[0],t.x[1]),n,r.width),i=viewport_clamp(Math.min(t.y[0],t.y[1]),0,r.height),o=viewport_clamp(Math.max(t.y[0],t.y[1]),i,r.height);return{left:n/r.width,top:1-o/r.height,width:(a-n)/r.width,height:(o-i)/r.height}},resolveHeatmapOverviewSourceRangeRect=(e,t)=>resolveHeatmapOverviewContinuousSourceRangeRect(e,toHeatmapContinuousSourceRange(t)),isHeatmapContinuousSourceRangeVisibleInViewport=(e,t)=>Math.min(t.x[0],t.x[1])<e.range.x[1]&&Math.max(t.x[0],t.x[1])>e.range.x[0]&&Math.min(t.y[0],t.y[1])<e.range.y[1]&&Math.max(t.y[0],t.y[1])>e.range.y[0],isHeatmapSourceRangeVisibleInViewport=(e,t)=>isHeatmapContinuousSourceRangeVisibleInViewport(e,toHeatmapContinuousSourceRange(t)),isHeatmapOverviewSourcePointInContinuousRange=(e,t,r={x:0,y:0})=>t.x>=Math.min(e.x[0],e.x[1])-r.x&&t.x<=Math.max(e.x[0],e.x[1])+r.x&&t.y>=Math.min(e.y[0],e.y[1])-r.y&&t.y<=Math.max(e.y[0],e.y[1])+r.y,isHeatmapOverviewSourcePointInRange=(e,t,r={x:0,y:0})=>isHeatmapOverviewSourcePointInContinuousRange(toHeatmapContinuousSourceRange(e),t,r),isHeatmapViewportFullRange=e=>{let{range:t,sourceSize:r}=e;return r.width<=0||r.height<=0||0===t.x[0]&&t.x[1]===r.width&&0===t.y[0]&&t.y[1]===r.height},calculateHeatmapOverviewCenteredRange=(e,t)=>{let r=resolveHeatmapOverviewSourcePoint(e,t);return{x:centerRange(e.range.x,e.sourceSize.width,r.x),y:centerRange(e.range.y,e.sourceSize.height,r.y)}},calculateHeatmapOverviewContinuousSourceRangeCenteredRange=(e,t)=>({x:centerRange(e.range.x,e.sourceSize.width,(Math.min(t.x[0],t.x[1])+Math.max(t.x[0],t.x[1]))/2),y:centerRange(e.range.y,e.sourceSize.height,(Math.min(t.y[0],t.y[1])+Math.max(t.y[0],t.y[1]))/2)}),calculateHeatmapOverviewSourceRangeCenteredRange=(e,t)=>calculateHeatmapOverviewContinuousSourceRangeCenteredRange(e,toHeatmapContinuousSourceRange(t)),calculateHeatmapOverviewDragRange=(e,t,r)=>{let n=resolveHeatmapOverviewSourcePoint(e,t),a=e.range.x[1]-e.range.x[0],i=e.range.y[1]-e.range.y[0],o=viewport_clamp(Math.round(n.x-r.x),0,e.sourceSize.width-a),l=viewport_clamp(Math.round(n.y-r.y),0,e.sourceSize.height-i);return{x:[o,o+a],y:[l,l+i]}},isHeatmapOverviewSourcePointInViewport=(e,t)=>t.x>=e.range.x[0]&&t.x<=e.range.x[1]&&t.y>=e.range.y[0]&&t.y<=e.range.y[1],calculateHeatmapDragRange=(e,t)=>{let r=e.range.x[1]-e.range.x[0],n=e.range.y[1]-e.range.y[0];return{x:translateRange(e.range.x,e.sourceSize.width,-Math.round(t.left*r)),y:translateRange(e.range.y,e.sourceSize.height,Math.round(t.top*n))}},calculateHeatmapDragRangeFromCoordinates=(e,t,r)=>calculateHeatmapDragRange(e,{left:(r.left-t.left)/100,top:(r.top-t.top)/100}),toWaterfallSamplingOptions=e=>({x:e.x,y:e.y,outputWidth:e.x[1]-e.x[0],outputHeight:e.y[1]-e.y[0]}),isHeatmapViewportRangeEqual=(e,t)=>e.range.x[0]===t.x[0]&&e.range.x[1]===t.x[1]&&e.range.y[0]===t.y[0]&&e.range.y[1]===t.y[1],resolveHeatmapSourceRowScreenRange=(e,t,r)=>{let[n,a]=e.range.y,i=a-n;if(i<=0||r<n||t>=a)return null;let o=viewport_clamp(t,n,a-1),l=100-(viewport_clamp(r,n,a-1)+1-n)*100/i;return{height:100-(o-n)*100/i-l,top:l}},clampPercent=e=>Math.max(0,Math.min(100,e)),cursorValue_normalizeRange=(e,t)=>({end:Math.max(e,t),start:Math.min(e,t)}),resolveHeatmapColumnCount=e=>e.reduce((e,t)=>Math.max(e,t?.length??0),0),resolveHeatmapGridInfo=e=>({columnCount:resolveHeatmapColumnCount(e),rowCount:e.length}),resolveHeatmapRowIndex=(e,t)=>t<=0?-1:1===t?0:Math.max(0,Math.min(t-1,Math.ceil((100-clampPercent(e))*t/100)-1)),resolveHeatmapColumnIndex=(e,t)=>t<=0?-1:1===t?0:Math.max(0,Math.min(t-1,Math.ceil(clampPercent(e)*t/100)-1)),resolveHeatmapRowRange=(e,t,r)=>{let n=resolveHeatmapRowIndex(e,r),a=resolveHeatmapRowIndex(t,r);if(n<0||a<0)return null;let{end:i,start:o}=cursorValue_normalizeRange(n,a);return{endIndex:i,startIndex:o}},resolveHeatmapColumnRange=(e,t,r)=>{let n=resolveHeatmapColumnIndex(e,r),a=resolveHeatmapColumnIndex(t,r);if(n<0||a<0)return null;let{end:i,start:o}=cursorValue_normalizeRange(n,a);return{endCol:i,startCol:o}},resolveHeatmapGridRange=(e,t)=>{let{columnCount:r,rowCount:n}=resolveHeatmapGridInfo(e);if(0===n||0===r)return null;let a=resolveHeatmapRowRange(t.startTop,t.endTop,n),i=resolveHeatmapColumnRange(t.startLeft,t.endLeft,r);return a&&i?{...a,...i}:null},resolveHeatmapRangeData=(e,t)=>{let{columnCount:r,rowCount:n}=resolveHeatmapGridInfo(e);if(0===n||0===r)return[];let a=Math.max(0,Math.min(n-1,t.startIndex)),i=Math.max(a,Math.min(n-1,t.endIndex)),o=Math.max(0,Math.min(r-1,t.startCol)),l=Math.max(o,Math.min(r-1,t.endCol));return e.slice(a,i+1).map(e=>{let t=[];for(let r=o;r<=l;r+=1){let n=e?.[r];t.push("number"==typeof n&&Number.isFinite(n)?n:0/0)}return t})},resolveHeatmapCursorValue=(e,t)=>{let{columnCount:r,rowCount:n}=resolveHeatmapGridInfo(e);if(0===n||0===r)return null;let a=resolveHeatmapRowIndex(t.top,n),i=resolveHeatmapColumnIndex(t.left,r);if(a<0||i<0)return null;let o=e[a],l=o?.[i],s="number"==typeof l&&Number.isFinite(l)?l:null;return{columnIndex:i,rowIndex:a,timestamp:o?.timestamp?String(o.timestamp):"",value:s}},resolveHeatmapCursorValueFromSnapshot=(e,t)=>{let r=resolveHeatmapSourcePoint(e,t);if(!r)return null;let n=e.data[r.visibleRowIndex],a=n?.[r.visibleColumnIndex],i="number"==typeof a&&Number.isFinite(a)?a:null;return{columnIndex:r.columnIndex,rowIndex:r.rowIndex,timestamp:n?.timestamp?String(n.timestamp):"",value:i}},resolveHeatmapGridRangeFromSnapshot=(e,t)=>resolveHeatmapSourceRange(e,t),resolveHeatmapRangeDataFromSnapshot=(e,t)=>resolveHeatmapSnapshotRangeData(e,t),setHeatmapWaterfallData=(e,t)=>{let r=normalizeHeatmapFrames(t),n=e.getSnapshot(),a=n.sourceSize.width,i=r[0]?.length??0;return a>0&&i>0&&a!==i&&(0!==n.range.x[0]||n.range.x[1]!==a)&&e.updateSamplingRange(toWaterfallSamplingOptions({x:[0,a],y:n.range.y})),e.setData(r)},getHeatmapWaterfallSnapshot=e=>{let t=withWaterfallAnalyzerSYNC(e)?.getSnapshot();return t?.sourceSize.width&&t.sourceSize.height?t:null},resetHeatmapViewport=e=>{let t=withWaterfallAnalyzerSYNC(e),r=t?.getSnapshot();if(!t||!r?.sourceSize.width||!r.sourceSize.height)return!1;let n={x:[0,r.sourceSize.width],y:[0,r.sourceSize.height]};return isHeatmapViewportRangeEqual(r,n)||t.updateSamplingRange(toWaterfallSamplingOptions(n)),!0},HeatmapCursorPopover=({id:e})=>{let t=useStore_useSelector(e=>e.axisX.frequencyFormat),r=useStore_useSelector(e=>e.axisX.unit??""),n=useStore_useSelector(e=>e.globalID),a=useStore_useSelector(e=>e.axisY.unit),i=useCursorSample(e),o=i?.coord.left,l=i?.coord.top,s=useCursorPopoverUpdateKey("HeatmapPopover",e),[c,u]=external_react_useState(""),[d,h]=external_react_useState(""),{getSeries:p}=useSeriesForComponent(n);external_react_useEffect(()=>{if(!n||"number"!=typeof o||"number"!=typeof l||!Number.isFinite(o)||!Number.isFinite(l)){u(""),h("");return}let e=withDatabase(n).getAllRawData(o).waterfallData;if(!e||0===e.length){u(""),h("");return}let t=getHeatmapWaterfallSnapshot(n),r=t?resolveHeatmapCursorValueFromSnapshot(t,{left:o,top:l}):resolveHeatmapCursorValue(e,{left:o,top:l});if(!r){u(""),h("");return}u(null!==r.value&&Number.isFinite(r.value)?r.value.toFixed(1):""),h(r.timestamp)},[n,o,l,i?.version,s]);let f=external_react_useMemo(()=>{if("number"!=typeof o)return"";let e=getHeatmapWaterfallSnapshot(n),r=e?resolveHeatmapSourceLeft(o,e):o;return t?.(r)??""},[n,o,t,i?.version,s]),m=external_react_useMemo(()=>p(REAL_DATA_NAME),[p]);return /*#__PURE__*/jsxs(components_Mask,{children:[/*#__PURE__*/jsx_runtime_jsx(FrequencyDisplay,{frequency:f,unit:r}),/*#__PURE__*/jsx_runtime_jsx("div",{className:POPOVER_ROW_CLASS,children:/*#__PURE__*/jsx_runtime_jsx("span",{children:d})}),c&&m&&!1!==m.display&&/*#__PURE__*/jsxs("div",{className:POPOVER_ROW_CLASS,style:{color:m.color},children:[/*#__PURE__*/jsx_runtime_jsx("span",{children:m.label}),/*#__PURE__*/jsxs("div",{children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:POPOVER_VALUE_CLASS,children:c}),/*#__PURE__*/jsx_runtime_jsx("span",{children:a})]})]})]})},CursorPopover=HeatmapCursorPopover,LevelCursorPopover=({id:e})=>{let t=useStore_useSelector(e=>e.globalID),r=useStore_useSelector(e=>e.axisY.unit),n=useCursorSample(e),a=n?.coord.left,i=useCursorPopoverUpdateKey("LevelStreamPopover",e),[o,l]=external_react_useState(""),[s,c]=external_react_useState("");return external_react_useEffect(()=>{if(!t||"number"!=typeof a||!Number.isFinite(a)){l(""),c("");return}let{levelStreamData:e}=withDatabase(t).getAllRawData();if(!e?.spectrumData||0===e.spectrumData.length){l(""),c("");return}let r=leftToIndex(a,e.spectrumData.length),n=e.spectrumData[r];if(l("number"==typeof n&&Number.isFinite(n)?n.toFixed(1):""),e.timestampData.length>r){let t=Number(e.timestampData[r]);if(Number.isFinite(t))return void c(formatTimestamp(t))}c("")},[t,a,n?.version,i]),/*#__PURE__*/jsxs(components_Mask,{children:[s&&/*#__PURE__*/jsx_runtime_jsx("div",{className:POPOVER_ROW_CLASS,children:/*#__PURE__*/jsx_runtime_jsx("span",{children:s})}),o&&/*#__PURE__*/jsxs("div",{className:POPOVER_ROW_CLASS,children:[/*#__PURE__*/jsx_runtime_jsx("span",{children:"电平值:"}),/*#__PURE__*/jsxs("div",{children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:POPOVER_VALUE_CLASS,children:o}),/*#__PURE__*/jsx_runtime_jsx("span",{children:r})]})]})]})},Level_CursorPopover=LevelCursorPopover,OccupancyCursorPopover=({id:e})=>{let t=useStore_useSelector(e=>e.axisX.frequencyFormat),r=useStore_useSelector(e=>e.axisX.unit??""),n=useStore_useSelector(e=>e.globalID),a=useCursorSample(e),i=a?.coord.left,o=external_react_useMemo(()=>{if(!n||"number"!=typeof i||!Number.isFinite(i))return"";let e=withDatabase(n).getAllRawData(i),{occupancyData:t}=e;if(t&&t.length>0){let r=e.cursorIndex?.globalIndex,n=e.rawData?.occupancyData,a="number"==typeof r&&Number.isFinite(r)&&n&&n.length>0?n[Math.max(0,Math.min(n.length-1,Math.floor(r)))]:void 0,o=t[leftToIndex(i,t.length)];return Number.parseFloat(Number(Number.isFinite(a)?a:o).toFixed(1))}return""},[n,i,a?.version]);return /*#__PURE__*/jsxs(components_Mask,{children:[/*#__PURE__*/jsx_runtime_jsx(FrequencyDisplay,{frequency:external_react_useMemo(()=>"number"==typeof i?t?.(i)??"":"",[i,t]),unit:r}),/*#__PURE__*/jsxs("div",{className:POPOVER_ROW_CLASS,children:[/*#__PURE__*/jsx_runtime_jsx("span",{children:"占用度"}),/*#__PURE__*/jsxs("div",{children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:POPOVER_VALUE_CLASS,children:o}),/*#__PURE__*/jsx_runtime_jsx("span",{children:"%"})]})]})]})},Occupancy_CursorPopover=OccupancyCursorPopover,SignalType={LEGITIMATE:"Legitimate",UNKNOWN:"UnKnown",KNOWN:"Know",VIOLATION:"Violation",ILLEGAL:"Illegal"},SIGNAL_TYPE_MAP={Legitimate:{name:"合法",color:"var(--success)",isLegitimate:!0},UnKnown:{name:"未知",color:"var(--muted-foreground)",isLegitimate:!1},Know:{name:"已知",color:"var(--primary)",isLegitimate:!0},Violation:{name:"违规",color:"var(--warning)",isLegitimate:!1},Illegal:{name:"非法",color:"var(--destructive)",isLegitimate:!1}},SIGNAL_TYPE_ORDER=[SignalType.LEGITIMATE,SignalType.UNKNOWN,SignalType.KNOWN,SignalType.VIOLATION,SignalType.ILLEGAL],normalizeSignalType=e=>"string"==typeof e&&SIGNAL_TYPE_ORDER.includes(e)?e:SignalType.UNKNOWN,signalTypeMap=null,SIGNAL_LEVEL_UNASSIGNED=-1,SIGNAL_LEVEL_FIRST=0,SIGNAL_LEVEL_SECOND=1,SIGNAL_LEVEL_THIRD=2,SIGNAL_LEVEL_ORDER=[SIGNAL_LEVEL_UNASSIGNED,SIGNAL_LEVEL_FIRST,SIGNAL_LEVEL_SECOND,SIGNAL_LEVEL_THIRD],SIGNAL_LEVEL_MAP={[SIGNAL_LEVEL_UNASSIGNED]:{name:"未分配",color:"color-mix(in oklab, var(--success) 35%, var(--background))"},[SIGNAL_LEVEL_FIRST]:{name:"一级",color:"color-mix(in oklab, var(--success) 55%, var(--background))"},[SIGNAL_LEVEL_SECOND]:{name:"二级",color:"color-mix(in oklab, var(--success) 75%, var(--background))"},[SIGNAL_LEVEL_THIRD]:{name:"三级",color:"var(--success)"}},normalizeSignalLevel=e=>"number"==typeof e&&Number.isInteger(e)&&(e===SIGNAL_LEVEL_UNASSIGNED||e===SIGNAL_LEVEL_FIRST||e===SIGNAL_LEVEL_SECOND||e===SIGNAL_LEVEL_THIRD)?e:SIGNAL_LEVEL_UNASSIGNED,resolveSignalColor=e=>{if(e.color)return e.color;let t=normalizeSignalType(e.signalType);return"simple"===e.source&&t===SignalType.LEGITIMATE?SIGNAL_LEVEL_MAP[normalizeSignalLevel(e.level)].color:SIGNAL_TYPE_MAP[t].color},SIGNAL_SOURCE_ORDER=["station","simple"],SIGNAL_SOURCE_LABEL={station:"台站库",simple:"信号库"};function tree_isStationInfo(e){return"signalName"in e&&"orgName"in e}let resolveSignalSource=e=>tree_isStationInfo(e)?"station":"simple",getSignalLeafKey=e=>`${resolveSignalSource(e)}:${normalizeSignalType(e.signalType)}:${normalizeSignalLevel(e.level)}`;function getUnifiedSignalKey(e){let t=resolveSignalSource(e);return e.id?`${t}:${e.id}`:tree_isStationInfo(e)?`${t}:${e.signalName}-${e.frequency}`:null!=e.startFrequency&&null!=e.stopFrequency?`${t}:${e.startFrequency}-${e.stopFrequency}`:`${t}:${e.frequency}-${e.bandwidth}`}let buildSignalTree=e=>{let t=new Set,r=new Map,n=new Map;for(let a of e){let e=getSignalLeafKey(a),i=resolveSignalSource(a);t.add(e),r.set(e,(r.get(e)??0)+1);let o=n.get(e)??new Set;o.add(resolveSignalColor({...a,source:i})),n.set(e,o)}let a=e=>e.reduce((e,t)=>e+(r.get(t)??0),0),i=e=>{let t=n.get(e);return t?.size===1?[...t][0]:void 0},o=e=>{let t=e.map(i);if(t.some(e=>null==e))return;let r=new Set(t);return 1===r.size?[...r][0]:void 0},l=[];for(let e of SIGNAL_SOURCE_ORDER){let n=[...t].filter(t=>t.startsWith(`${e}:`));if(0===n.length)continue;if("station"===e){l.push({source:e,label:SIGNAL_SOURCE_LABEL[e],leafKeys:n,dataLeafKeys:n,hasData:!0,count:a(n),types:[]});continue}let s=SIGNAL_TYPE_ORDER.flatMap(n=>{let l=SIGNAL_LEVEL_ORDER.map(a=>{let o=`${e}:${n}:${a}`;return{level:a,label:SIGNAL_LEVEL_MAP[a].name,leafKey:o,hasData:t.has(o),count:r.get(o)??0,color:i(o)}}),s=l.map(e=>e.leafKey),c=s.filter(e=>t.has(e));return 0===c.length?[]:{signalType:n,label:SIGNAL_TYPE_MAP[n].name,leafKeys:s,dataLeafKeys:c,hasData:c.length>0,count:a(c),color:o(c),levels:n===SignalType.LEGITIMATE?l.filter(e=>e.hasData):[]}});if(0===s.length)continue;let c=s.flatMap(e=>e.leafKeys),u=c.filter(e=>t.has(e));l.push({source:e,label:SIGNAL_SOURCE_LABEL[e],leafKeys:c,dataLeafKeys:u,hasData:!0,count:a(u),types:s})}return{sources:l}},resolveNodeCheckState=(e,t,r)=>{let n=r.filter(t=>e.has(t));if(0===n.length)return"disabled";let a=n.filter(e=>t.has(e)).length;return 0===a?"checked":a===n.length?"unchecked":"indeterminate"},toggleNodeHiddenKeys=(e,t,r)=>{let n=new Set(e),a=t.filter(e=>r.has(e)),i=a.filter(e=>n.has(e)).length;if(a.length>0&&0===i){for(let e of t)n.add(e);return[...n]}for(let e of t)n.delete(e);return[...n]},filterSignalItemsByHiddenKeys=(e,t)=>{if(!t.length)return e;let r=new Set(t);return e.filter(e=>!r.has(getSignalLeafKey(e)))},SIGNAL_INDEX_MATCH_TOLERANCE=1,getRangeCenter=e=>(e.startFreq+e.stopFreq)/2,getRangeWidth=e=>Math.abs(e.stopFreq-e.startFreq),getIndexDistanceToRange=(e,t,r)=>e<t?t-e:e>r?e-r:0,getFrequencyDistanceToRange=(e,t)=>isInRangeByFrequency(e,t)?0:Math.min(Math.abs(e-t.startFreq),Math.abs(e-t.stopFreq)),compareFrequencyMatchedCandidates=(e,t,r)=>{let n=getRangeWidth(t.range)-getRangeWidth(r.range);if(0!==n)return n;let a=Math.abs(getRangeCenter(t.range)-e)-Math.abs(getRangeCenter(r.range)-e);if(0!==a)return a;let i=Number(tree_isStationInfo(r.item))-Number(tree_isStationInfo(t.item));return 0!==i?i:getUnifiedSignalKey(t.item).localeCompare(getUnifiedSignalKey(r.item))},compareIndexMatchedCandidates=(e,t,r,n)=>{let a=getIndexDistanceToRange(t,r.startIndex,r.stopIndex)-getIndexDistanceToRange(t,n.startIndex,n.stopIndex);if(0!==a)return a;let i=getRangeWidth(r.range)-getRangeWidth(n.range);if(0!==i)return i;let o=getFrequencyDistanceToRange(e,r.range)-getFrequencyDistanceToRange(e,n.range);if(0!==o)return o;let l=Number(tree_isStationInfo(n.item))-Number(tree_isStationInfo(r.item));return 0!==l?l:getUnifiedSignalKey(r.item).localeCompare(getUnifiedSignalKey(n.item))};function toFrequencyRangeInput(e){return{frequency:null!=e.frequency?Number(e.frequency):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}}function match_resolveBestSignalMatch(e,t){let{currentFrequency:r,currentPointIndex:n}=t,a=t.indexTolerance??SIGNAL_INDEX_MATCH_TOLERANCE;if(!Number.isFinite(r)||!Number.isFinite(n)||!e.length)return;let i=e.filter(({range:e})=>isInRangeByFrequency(r,e)).sort((e,t)=>compareFrequencyMatchedCandidates(r,e,t));return i.length>0?i[0]:e.filter(({startIndex:e,stopIndex:t})=>isInRangeByIndex(n,{startIndex:e,stopIndex:t},a)).sort((e,t)=>compareIndexMatchedCandidates(r,n,e,t))[0]}let resolveFrequencyPresentation=e=>null!=e.frequency?`${e.frequency}MHz`:null!=e.startFrequency&&null!=e.stopFrequency?`${e.startFrequency}-${e.stopFrequency}MHz`:void 0,resolveSignalPresentation=e=>{let t=resolveSignalSource(e),r=normalizeSignalType(e.signalType),n=SIGNAL_TYPE_MAP[r].name,a=SIGNAL_LEVEL_MAP[normalizeSignalLevel(e.level)].name,i=resolveSignalColor({...e,source:t}),o=resolveFrequencyPresentation(e),l=null!=e.bandwidth?`带宽: ${e.bandwidth}kHz`:void 0,s=tree_isStationInfo(e)?{name:e.signalName,organization:e.orgName,modulation:e.modulation}:e.details;return tree_isStationInfo(e)?{color:i,tooltip:[e.signalName,o,e.orgName&&`单位: ${e.orgName}`,n&&`类型: ${n}`].filter(Boolean).join(" | ")}:{color:i,tooltip:[s?.name,SIGNAL_SOURCE_LABEL[t],o,s?.organization&&`单位: ${s.organization}`,l,s?.modulation&&`调制: ${s.modulation}`,n&&`类型: ${n}`,r===SignalType.LEGITIMATE&&a&&`等级: ${a}`].filter(Boolean).join(" | ")}},resolveSignalMatchCandidates=(e,t)=>e.flatMap(e=>{let r=frequencyCalculation_calculateFrequencyRange(toFrequencyRangeInput(e));if(!r||!isRangeIntersectSegment(r,t))return[];let{startIndex:n,stopIndex:a}=calculatePositionFromFrequencyRange(r,t);return[{item:e,range:r,startIndex:n,stopIndex:a}]}),resolveSignalPositions=(e,t)=>resolveSignalMatchCandidates(e,t).map(({item:e,range:r,startIndex:n,stopIndex:a})=>{let{left:i,width:o}=calculatePositionFromFrequencyRange(r,t),{color:l,tooltip:s}=resolveSignalPresentation(e);return{item:e,range:r,startIndex:n,stopIndex:a,key:getUnifiedSignalKey(e),position:{left:`${i}%`,width:`${o}%`},color:l,tooltip:s}}),resolveSignalSegments=({segments:e,signalItems:t,isCursorActive:r,currentFrequency:n,currentPosition:a})=>{if(!e.length)return[];let i=e.reduce((e,t)=>e+t.point,0);return e.map((o,l)=>{let s=resolveSignalPositions(t,o),c=r&&a.segmentIndex===l&&Number.isFinite(n)?resolveBestSignalMatch(s,{currentFrequency:n,currentPointIndex:a.pointIndex}):void 0,u=o.point/i*100,d=e.slice(0,l).reduce((e,t)=>e+t.point/i*100,0);return{segment:o,segmentIndex:l,signalPositions:s,activeSignalKey:c?.key,style:{left:`${d}%`,width:`${u}%`}}})},resolveStaticSignalSegments=({segments:e,signalItems:t})=>{if(!e.length)return[];let r=e.reduce((e,t)=>e+t.point,0),n=0;return e.map((e,a)=>{let i=e.point/r*100,o={segment:e,segmentIndex:a,signalPositions:resolveSignalPositions(t,e),style:{left:`${n}%`,width:`${i}%`}};return n+=i,o})},resolveActiveSignalKey=({segmentData:e,isCursorActive:t,currentFrequency:r,currentPosition:n})=>{if(!t||!Number.isFinite(r)||n.segmentIndex<0)return;let a=e[n.segmentIndex];if(a)return match_resolveBestSignalMatch(a.signalPositions,{currentFrequency:r,currentPointIndex:n.pointIndex})?.key},findStationAtCursor=({frequency:e,signalItems:t,segments:r,currentPosition:n})=>{if(!Number.isFinite(e))return;let a=r[n.segmentIndex];if(!a)return;let i=t.filter(isStationInfo);if(!i.length)return;let o=resolveBestSignalMatch(resolveSignalMatchCandidates(i,a),{currentFrequency:e,currentPointIndex:n.pointIndex});return o&&isStationInfo(o.item)?o.item:void 0},findSignalAtCursor=({frequency:e,signalItems:t,segments:r,currentPosition:n})=>{if(!Number.isFinite(e))return;let a=r[n.segmentIndex];if(a)return resolveBestSignalMatch(resolveSignalMatchCandidates(t,a),{currentFrequency:e,currentPointIndex:n.pointIndex})?.item},createSignalRangeIndex=({signalItems:e,segments:t})=>e.length&&t.length?t.map(t=>resolveSignalMatchCandidates(e,t)):[],createStationRangeIndex=({signalItems:e,segments:t})=>{if(!e.length||!t.length)return[];let r=e.filter(isStationInfo);return r.length?t.map(e=>resolveSignalMatchCandidates(r,e)):[]},findStationInRangeIndex=({frequency:e,stationRangeIndex:t,currentPosition:r})=>{if(!Number.isFinite(e))return;let n=t[r.segmentIndex];if(!n?.length)return;let a=resolveBestSignalMatch(n,{currentFrequency:e,currentPointIndex:r.pointIndex});return a&&isStationInfo(a.item)?a.item:void 0},findSignalInRangeIndex=({frequency:e,signalRangeIndex:t,currentPosition:r})=>{if(!Number.isFinite(e))return;let n=t[r.segmentIndex];if(n?.length)return match_resolveBestSignalMatch(n,{currentFrequency:e,currentPointIndex:r.pointIndex})?.item},withStationDataUpdate=(e,t,r)=>{let n=`stationData-update-${e}`;return t&&r?subscription_createSubscriptionManager(n,t,r,e):subscription_createSubscriptionManager(n)},STATION_DATA=(e,t)=>{let r=subscription_openData(`stationData-${e}`,t,[],e);return void 0!==t&&withStationDataUpdate(e)(r),r};function useUnifiedSignals({respectVisibility:e=!1,filterHidden:t=!0}={}){let r=useStore_useSelector(e=>e.globalID),n=useStore_useSelector(e=>e.signal.data),a=useStore_useSelector(e=>e.signal.display),i=useStore_useSelector(e=>e.signal.show),o=useStore_useSelector(e=>e.signal.hiddenCategoryKeys),[l,s]=external_react_useState(0);return external_react_useEffect(()=>{let e=`useUnifiedSignals-${r}-${Date.now()}`,t=withStationDataUpdate(r,e,()=>{s(e=>e+1)}),n=STATION_DATA(r);return n&&n.length>0&&s(e=>e+1),()=>{"function"==typeof t&&t()}},[r]),external_react_useMemo(()=>{if(e&&(!i||!a))return[];let l=[...STATION_DATA(r),...n||[]];return t&&o?.length?filterSignalItemsByHiddenKeys(l,o):l},[r,n,a,i,e,t,o,l])}let useSignalMatchAtCursor=({frequency:e,enabled:t=!0,cursorSample:r},n)=>{let a=useStore_useSelector(e=>e.cursor),i=useStore_useSelector(e=>e.segments),o=r?.coord.left??a.coord.left,l=useUnifiedSignals({respectVisibility:t}),s=external_react_useMemo(()=>t?"station"===n?l.filter(tree_isStationInfo):l:[],[t,l,n]),c=external_react_useMemo(()=>createSignalRangeIndex({signalItems:s,segments:i}),[s,i]),u=external_react_useMemo(()=>t&&(!!r||cursor_hasActiveSpectrumCursor(a)),[a,r,t]),d=external_react_useMemo(()=>u&&"number"==typeof o?frequencyCalculation_calculateCursorPosition(o,i):{segmentIndex:-1,pointIndex:-1},[u,o,i]);return external_react_useMemo(()=>{if(!t||"number"!=typeof o||!Number.isFinite(o)||o<0||!c.length||!i?.length||!u)return;let r=frequencyCalculation_getCursorFrequencyAtPosition(i,d);if(!Number.isFinite(r)){let t=Number(e);if(!Number.isFinite(t))return;return findSignalInRangeIndex({frequency:t,signalRangeIndex:c,currentPosition:d})}return findSignalInRangeIndex({frequency:r,signalRangeIndex:c,currentPosition:d})},[t,e,c,i,d,o,u])};function useSignalInfoAtCursor(e){return useSignalMatchAtCursor(e,"all")}function useStationInfoAtCursor(e){let t=useSignalMatchAtCursor(e,"station");return t&&isStationInfo(t)?t:void 0}let useSignalFinder=null,useStationFinder=null,SignalInfoRow=({label:e,value:t,tabular:r=!1})=>/*#__PURE__*/jsxs("div",{className:`flex gap-2${r?" tabular-nums":""}`,children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:"w-10 shrink-0 text-muted-foreground",children:e}),/*#__PURE__*/jsx_runtime_jsx("span",{className:"min-w-0 break-words",children:t})]}),SignalMetaValue=({color:e,label:t,testId:r})=>/*#__PURE__*/jsx_runtime_jsx("span",{className:"font-medium text-foreground","data-testid":r,style:e?{color:toOpaqueCssColor(e)}:void 0,children:t}),SignalInfoPanel=({signalInfo:e})=>{if(!e)return null;let t=resolveSignalSource(e),r=tree_isStationInfo(e)?{name:e.signalName,organization:e.orgName,modulation:e.modulation,remark:e.remark}:e.details,n=normalizeSignalType(e.signalType),a=SIGNAL_TYPE_MAP[n],i=SIGNAL_LEVEL_MAP[normalizeSignalLevel(e.level)],o="simple"===t&&n===SignalType.LEGITIMATE,l=resolveSignalColor({...e,source:t}),s=o?void 0:l,c=null!=e.startFrequency&&null!=e.stopFrequency;return /*#__PURE__*/jsx_runtime_jsx("div",{className:"mt-2 border-t border-border/60 pt-2 text-xs leading-5 text-foreground","data-signal-source":t,"data-testid":"signal-info-panel",children:/*#__PURE__*/jsxs("div",{className:"space-y-0.5",children:[/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"来源",value:SIGNAL_SOURCE_LABEL[t]}),r?.name?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"名称",value:r.name}):null,r?.organization?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"单位",value:r.organization}):null,null!=e.frequency?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"频率",value:`${e.frequency}MHz`,tabular:!0}):c?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"范围",value:`${e.startFrequency}-${e.stopFrequency}MHz`,tabular:!0}):null,null!=e.bandwidth?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"带宽",value:`${e.bandwidth}kHz`,tabular:!0}):null,r?.modulation?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"调制",value:r.modulation}):null,/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"类型",value:/*#__PURE__*/jsx_runtime_jsx(SignalMetaValue,{color:s,label:a.name,testId:"signal-info-type-color"})}),o?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"等级",value:/*#__PURE__*/jsx_runtime_jsx(SignalMetaValue,{color:l,label:i.name,testId:"signal-info-level-color"})}):null,r?.remark?/*#__PURE__*/jsx_runtime_jsx(SignalInfoRow,{label:"备注",value:r.remark}):null]})})},StationInfoPanel=/*#__PURE__*/react.memo(SignalInfoPanel),FrequencyDataBoard=({left:e,updateKey:t,onChange:r,showSignalInfo:n=!0,cursorSample:a})=>{let i=useStore_useSelector(e=>e.axisY.unit),o=useStore_useSelector(e=>e.axisX.frequencyFormat),l=useStore_useSelector(e=>e.axisX.unit),s=useStore_useSelector(e=>e.globalID),c=external_react_useRef(null),u=useFilteredSeries(s,external_react_useCallback(e=>!1!==e.display,[])),d=external_react_useCallback((e,t,r,n)=>{if(!e||0===e.length)return null;let a=Math.max(0,Math.min(e.length-1,Math.floor(r))),o=Number.isFinite(n)?n:e[a];if("number"!=typeof o)return null;let l=i??"",s=getVirtualLevel(l,o)?.toFixed(1);return(0,array_0.Ub)(s)?/*#__PURE__*/jsxs("div",{className:"grid max-w-[220px] grid-cols-[minmax(0,1fr)_auto] items-center gap-x-1 text-xs",style:{color:t?.color},children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:"min-w-0 truncate",children:t?.label||t.name}),/*#__PURE__*/jsxs("div",{className:"text-right",children:[/*#__PURE__*/jsx_runtime_jsx("span",{className:"inline-flex min-w-9 justify-end",children:s}),/*#__PURE__*/jsx_runtime_jsx("span",{children:l})]})]},t.name):null},[i]),{value:h,currentIndex:p}=external_react_useMemo(()=>{if(!s)return{value:null,currentIndex:0/0};let r=withDatabase(s);if(!r)return{value:null,currentIndex:0/0};let n=a?.version,i=c.current,o=i&&i.globalID===s&&i.left===e&&i.sampleVersion===n&&i.updateKey===t?i.snapshot:r.getAllRawData(e);c.current={globalID:s,left:e,sampleVersion:n,updateKey:t,snapshot:o};let l=o.cursorIndex?.globalIndex,h=o.cursorIndex?.sampledIndex,p={realData:o.realData,maxData:o.maxData,minData:o.minData,avgData:o.avgData,thresholdData:o.thresholdData,templateData:o.templateData,occupancyData:o.occupancyData,backgroundNoiseData:o.backgroundNoiseData,...o.extraData},f={realData:o.rawData?.realData,maxData:o.rawData?.maxData,minData:o.rawData?.minData,avgData:o.rawData?.avgData,thresholdData:o.rawData?.thresholdData,templateData:o.rawData?.templateData,occupancyData:o.rawData?.occupancyData,backgroundNoiseData:o.rawData?.backgroundNoiseData,...o.rawData?.extraData},m=Object.values(p).find(e=>!!e&&e.length>0),g=m?.length??0;if(g<=0)return{value:null,currentIndex:0/0};let b="number"==typeof h&&Number.isFinite(h)?Math.max(0,Math.min(g-1,Math.floor(h))):leftToIndex(e,g),v=Number.isFinite(o.cursorIndex?.globalIndex)?Math.floor(o.cursorIndex?.globalIndex??0):void 0,w=o.rawData?.realData,y=void 0!==v&&w&&w.length>0&&v>=0&&v<w.length?w[v]:void 0;return{value:u.map(e=>{let t=p[e.name];if(!t||0===t.length)return null;let r="realData"===e.name?y:(e=>{if("number"!=typeof l||!Number.isFinite(l))return;let t=f[e];if(!t||0===t.length)return;let r=Math.max(0,Math.min(t.length-1,Math.floor(l)));return t[r]})(e.name);return d(t,e,b,r)}).filter(e=>null!==e),currentIndex:b}},[d,s,u,t,e,a?.version]),f=external_react_useMemo(()=>o?.(e)??"",[e,o]);external_react_useEffect(()=>{r?.({index:p,frequency:f})},[p,f,r]);let m=useSignalInfoAtCursor({frequency:f,enabled:n,cursorSample:a}),g=n&&!!m,b=external_react_useMemo(()=>h&&(!Array.isArray(h)||h.length>0),[h]);return!(e<0)&&(b||g)?/*#__PURE__*/jsxs(components_Mask,{children:[f&&/*#__PURE__*/jsxs("div",{className:"text-[14px] font-medium text-popover-foreground",children:[f,l]}),h?/*#__PURE__*/jsx_runtime_jsx("div",{className:"mt-2 space-y-1",children:h}):null,n?/*#__PURE__*/jsx_runtime_jsx(StationInfoPanel,{signalInfo:m}):null]}):null},Spectrum_FrequencyDataBoard=/*#__PURE__*/react.memo(FrequencyDataBoard),SpectrumCursorPopover=({id:e})=>{let t=useStore_useSelector(e=>e.signal.show),r=useStore_useSelector(e=>e.signal.display),n=useCursorSample(e),a=n?.coord.left;return /*#__PURE__*/jsx_runtime_jsx(Spectrum_FrequencyDataBoard,{left:"number"==typeof a?a:-1,updateKey:useCursorPopoverUpdateKey("SpectrumPopover",e),showSignalInfo:t&&r,cursorSample:n})},Spectrum_CursorPopover=SpectrumCursorPopover,resolveCursorPopover=({id:e,mode:t,type:r})=>t===constants_ModuleType.LevelStream?/*#__PURE__*/jsx_runtime_jsx(Level_CursorPopover,{id:e}):r===constants_ModuleType.Spectrum?/*#__PURE__*/jsx_runtime_jsx(Spectrum_CursorPopover,{id:e}):r===constants_ModuleType.Heatmap?/*#__PURE__*/jsx_runtime_jsx(CursorPopover,{id:e}):r===constants_ModuleType.Occupancy?/*#__PURE__*/jsx_runtime_jsx(Occupancy_CursorPopover,{id:e}):null,Cursor_COMPONENT_KEY="Cursor",CURSOR_BOUNDS_TOLERANCE=1,Cursor_isPointWithinBounds=(e,t,r,n=CURSOR_BOUNDS_TOLERANCE)=>e>=r.left-n&&e<=r.right+n&&t>=r.top-n&&t<=r.bottom+n,buildCursorPointerSnapshot=(e,t,r,n,a)=>{let i=e.currentTarget;if(!(i instanceof HTMLElement))return null;let o=a??resolveCursorVisibleBounds(i);return{sourceId:r,sourceType:n,clientX:e.clientX,clientY:e.clientY,coord:t,bounds:o}},resolveCursorTarget=e=>{let t=e.currentTarget;return t instanceof HTMLElement?t:null},isSameCursorPayload=(e,t,r)=>{let n=e.event;return e.coord.left===t.left&&e.coord.top===t.top&&n?.sourceId===r?.sourceId&&n?.sourceType===r?.sourceType&&n?.clientX===r?.clientX&&n?.clientY===r?.clientY&&n?.bounds.left===r?.bounds.left&&n?.bounds.top===r?.bounds.top&&n?.bounds.right===r?.bounds.right&&n?.bounds.bottom===r?.bounds.bottom},Cursor=({id:e,type:t})=>{let{state:{cursor:r,globalID:n},dispatch:a}=useStore_useStore(),{active:i,show:o,mode:l}=r,[s,c]=external_react_useState(!1),u=external_react_useRef(r),d=external_react_useRef(i),h=external_react_useRef(s),p=external_react_useRef(null),f=external_react_useRef(null),m=external_react_useRef(null),g=external_react_useRef(null);external_react_useEffect(()=>{u.current=r,d.current=i,h.current=s},[r,i,s]);let b=external_react_useMemo(()=>(t="leave")=>{c(!1);let r=interactionRuntime.getPointer(e);if(u.current.event?.sourceId!==e&&r?.sourceId!==e){h.current=!1,p.current=null,f.current=null,interactionRuntime.clearPointer(e,t);return}let n={...u.current,event:null,coord:{left:0,top:0}};u.current=n,h.current=!1,p.current=null,f.current=null,interactionRuntime.clearPointer(e,t),flushSync(()=>{c(!1),a({payload:{cursor:n}})})},[a,e]);external_react_useEffect(()=>{o||(c(!1),h.current=!1,p.current=null,f.current=null,interactionRuntime.clearPointer(e,"manual"))},[e,o]),external_react_useEffect(()=>()=>{interactionRuntime.dispose(e)},[e]),external_react_useEffect(()=>{if(n&&o)return interactionRuntime.subscribeSample(e,t=>{if(!t||t.sourceId!==e)return;let r=toCursorSnapshotEvent(t);if(isSameCursorPayload(u.current,t.coord,r))return;let i={...u.current,event:r,coord:t.coord};u.current=i,a({payload:{cursor:i}}),d.current&&CURSOR_SETACTIVE(n)()})},[a,n,e,o]),external_react_useEffect(()=>{if(o&&i)return interactionRuntime.subscribePointer(e,t=>{let r=m.current,n=g.current;if(!t||t.sourceId!==e){r&&(r.style.left="-200%"),n&&(n.style.top="-200%");return}r&&(r.style.left=`${t.coord.left}%`),n&&(n.style.top=`${t.coord.top}%`)})},[i,e,o]),external_react_useEffect(()=>{if(!n||!o)return;let r=createMouseEnterEventManager(e,Cursor_COMPONENT_KEY,()=>{h.current=!0,c(!0)}),a=createMoveEventManager(e,Cursor_COMPONENT_KEY,(r,n)=>{if(!h.current)return;let a=resolveCursorTarget(r);if(!a)return;if(f.current!==a||!p.current){let t=resolveCursorVisibleBounds(a);f.current=a,p.current=t,interactionRuntime.refreshBounds(e,t)}let i=buildCursorPointerSnapshot(r,n,e,t,p.current);if(i){if(!Cursor_isPointWithinBounds(i.clientX,i.clientY,i.bounds))return void b("bounds");interactionRuntime.updatePointer(e,i)}}),i=createMouseLeaveEventManager(e,Cursor_COMPONENT_KEY,b);return()=>{r?.(),a?.(),i?.()}},[e,n,o,t,b]),external_react_useEffect(()=>{if(!o)return;let t=()=>{let t=f.current;if(!t)return;let r=resolveCursorVisibleBounds(t);p.current=r,interactionRuntime.refreshBounds(e,r)};return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[e,o]),external_react_useEffect(()=>{if(!o)return;let t=t=>{if(!h.current)return;let r=interactionRuntime.getPointer(e),n=r?.bounds??u.current.event?.bounds;r&&r.sourceId===e&&n&&(n.width<=0||n.height<=0||!Cursor_isPointWithinBounds(t.clientX,t.clientY,n))&&b("bounds")};return window.addEventListener("pointermove",t,!0),()=>{window.removeEventListener("pointermove",t,!0)}},[o,e,b]),external_react_useEffect(()=>{if(!o)return;let e=()=>{b("blur")},t=()=>{"hidden"===document.visibilityState&&b("visibility")},r=e=>{null===e.relatedTarget&&b("mouseout")};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",t),document.addEventListener("mouseout",r),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",t),document.removeEventListener("mouseout",r)}},[b,o]);let v=external_react_useMemo(()=>resolveCursorPopover({id:e,mode:l,type:t}),[e,l,t]);return o&&s&&i?/*#__PURE__*/jsxs(Zoom_ZoomViewportLayer,{className:"z-[6]",children:[/*#__PURE__*/jsx_runtime_jsx("div",{ref:m,className:"pointer-events-none absolute left-[-200%] top-0 h-full border-l border-dashed border-chart-highlight/80 opacity-50"}),t===constants_ModuleType.Heatmap&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:g,className:"absolute left-0 top-[-200%] w-full border-t border-dashed border-chart-highlight/80 opacity-50"}),v&&/*#__PURE__*/jsx_runtime_jsx(Overlay_Popover,{id:e,children:v},`${l??t}-${e}`)]}):null},components_Cursor=Cursor,useEventBusCallback_COMPONENT_KEY=constants_ToolType.EventBus;function useEventBusCallback(e){let{state:{segments:t,axisX:{frequencyFormat:r},eventBus:{onDoubleClick:n}}}=useStore_useStore();external_react_useEffect(()=>{let t=createDoubleClickEventManager(e,useEventBusCallback_COMPONENT_KEY,(t,a)=>{if(!compareEventPriority(e,useEventBusCallback_COMPONENT_KEY))return!1;let{left:i}=a;return n(r?.(i)??"",a),!0}),a=createMouseUpEventManager(e,useEventBusCallback_COMPONENT_KEY,()=>{resetEventLevel(e,useEventBusCallback_COMPONENT_KEY)}),i=createMouseLeaveEventManager(e,useEventBusCallback_COMPONENT_KEY,()=>{resetEventLevel(e,useEventBusCallback_COMPONENT_KEY)});return()=>{t?.(),a?.(),i?.()}},[e,t,r,n])}let EventBus=({id:e})=>{let t=useStore_useSelector(e=>e.globalID),r=external_react_useMemo(()=>getEID(e),[e]),[n,a]=external_react_useState(),i=external_react_useRef(null),o=external_react_useRef({isDragging:!1,startPoint:{x:0,y:0,event:null},lastPoint:{x:0,y:0}}),l=external_react_useRef({timerId:null,startPoint:null,fired:!1});useEventBusCallback(e),useKeyEvent(t,r);let s=external_react_useCallback(()=>{a(getEventCursor(e))},[e]),c=external_react_useCallback(()=>{o.current.isDragging=!1,o.current.startPoint.event=null,l.current.timerId&&window.clearTimeout(l.current.timerId),l.current.timerId=null,l.current.startPoint=null,l.current.fired=!1},[]);external_react_useEffect(()=>createMouseUpEventManager(e,"EventBusInteraction",c),[e,c]);let u=external_react_useCallback(e=>{e.preventDefault()},[]),d=external_react_useCallback(e=>{if(!e.defaultPrevented){try{i.current?.setPointerCapture(e.pointerId)}catch{}if(createMouseDownEventManager(r)(calculateEventRelativePosition(e)),i.current?.focus?.(),o.current={isDragging:!0,startPoint:{x:e.clientX,y:e.clientY,event:e},lastPoint:{x:e.clientX,y:e.clientY}},0===e.button){l.current.timerId&&window.clearTimeout(l.current.timerId),l.current.startPoint={x:e.clientX,y:e.clientY},l.current.fired=!1;let t=window.setTimeout(()=>{o.current.isDragging&&!l.current.fired&&(l.current.fired=!0,createLongPressEventManager(r)(e,calculateEventRelativePosition(e)))},500);l.current.timerId=t}}},[r,e,c]),h=external_react_useCallback(throttleRequestAnimationFrame(e=>{if(!e.currentTarget)return;createMoveEventManager(r)(e,calculateEventRelativePosition(e)),s();let t=l.current.startPoint;if(t&&l.current.timerId&&!l.current.fired){let r=e.clientX-t.x,n=e.clientY-t.y;r*r+n*n>25&&(window.clearTimeout(l.current.timerId),l.current.timerId=null)}if(o.current.isDragging&&o.current.startPoint.event){let{height:t,width:n}=e.currentTarget.getBoundingClientRect(),a=o.current.startPoint.event,i=(e.clientX-o.current.lastPoint.x)/n,l=(e.clientY-o.current.lastPoint.y)/t;createDragEventManager(r)(calculateEventRelativePosition(a),calculateEventRelativePosition(e),{left:i,top:l},2===e.buttons),o.current.lastPoint={x:e.clientX,y:e.clientY}}}),[r,e,c,s]),p=external_react_useCallback(()=>{createMouseUpEventManager(r)(),o.current.isDragging=!1,o.current.startPoint.event=null,l.current.timerId&&window.clearTimeout(l.current.timerId),l.current.timerId=null,l.current.startPoint=null,l.current.fired=!1},[r]),f=external_react_useCallback(()=>{createMouseLeaveEventManager(r)(),c()},[r,c]),m=external_react_useCallback(()=>{createMouseEnterEventManager(r)()},[r]),g=external_react_useCallback(e=>{createDoubleClickEventManager(r)(e,calculateEventRelativePosition(e))},[r]),b=external_react_useCallback(throttle(e=>{createWheelEventManager(r)(-1*e.deltaY,calculateEventRelativePosition(e))}),[r]);return external_react_useEffect(()=>{i.current&&(i.current.id=r)},[r]),external_react_useEffect(()=>{let e=()=>{f()},t=()=>{"hidden"===document.visibilityState&&f()},r=e=>{null===e.relatedTarget&&f()};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",t),document.addEventListener("mouseout",r),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",t),document.removeEventListener("mouseout",r)}},[f]),/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[5] pointer-events-auto",children:/*#__PURE__*/jsx_runtime_jsx("button",{ref:i,type:"button",className:cn_cn("absolute right-0 top-0 h-full w-full appearance-none border-0 bg-transparent p-0 outline-none"),style:{cursor:n},"aria-label":"Event bus",onContextMenu:u,onPointerDown:d,onPointerMove:h,onPointerUp:p,onBlur:f,onFocus:m,onPointerLeave:f,onPointerOver:m,onDoubleClick:g,onWheel:b})})},components_EventBus=EventBus,Boundary=()=>{let{state:{gridLines:e}}=useStore_useStore();return e&&/*#__PURE__*/jsx_runtime_jsx("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"})},GridLines_Boundary=Boundary,PluginBox=e=>{let{children:t,onWheelCapture:r}=e,{pluginBoxWidth:n}=useAxisYWidth_useAxisYWidth();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 m-0 h-full overflow-hidden p-0",style:{width:n},onWheelCapture:r,children:t})},components_PluginBox=/*#__PURE__*/react.memo(PluginBox),xRange_clamp=(e,t,r)=>Math.min(r,Math.max(t,e)),normalizeTotalPoints=e=>Number.isFinite(e)?Math.max(0,Math.floor(e)):0,normalizeXZoomInterval=(e,t)=>{let r=normalizeTotalPoints(t);if(0===r)return{start:0,end:0};let n=Math.min(e.start,e.end),a=Math.max(e.start,e.end),i=xRange_clamp(Math.floor(n),0,r-1),o=xRange_clamp(Math.ceil(a),i,r-1);return{start:i,end:o}},calculateAnchoredXZoomInterval=({anchorPercent:e,interval:t,scale:r,totalPoints:n})=>{let a=normalizeTotalPoints(n);if(0===a)return{start:0,end:0};let i=normalizeXZoomInterval(t,a),o=i.end+1,l=o-i.start,s=Math.min(UI_CONFIG.ZOOM_MIN_RANGE,a),c=xRange_clamp(Math.round(l*(Number.isFinite(r)&&r>0?r:1)),s,a),u=xRange_clamp(xRange_clamp(e,0,100)*a/100,i.start,o),d=(u-i.start)/l,h=xRange_clamp(Math.round(u-c*d),0,a-c);return{start:h,end:h+c-1}},translateXZoomInterval=(e,t,r)=>{let n=normalizeTotalPoints(t);if(0===n)return{start:0,end:0};let a=normalizeXZoomInterval(e,n),i=a.end-a.start+1,o=Number.isFinite(r)?Math.round(r):0,l=xRange_clamp(a.start+o,0,n-i);return{start:l,end:l+i-1}},createSelectedXZoomInterval=({endPercent:e,startPercent:t,totalPoints:r})=>{let n=normalizeTotalPoints(r);if(0===n)return null;let a=xRange_clamp(Math.min(t,e),0,100),i=xRange_clamp(Math.max(t,e),0,100),o=xRange_clamp(Math.floor(a*n/100),0,n-1),l=xRange_clamp(Math.ceil(i*n/100),o+1,n);return{start:o,end:l-1}},useZoomEvent_COMPONENT_KEY=constants_ToolType.Zoom;function useZoomEvent(e,t,r=!0){let{state:{zoom:n,segments:a,globalID:i},dispatch:o}=useStore_useStore(),{show:l,interval:{start:s,end:c}}=n,{totalPoints:u}=a,d=external_react_useMemo(()=>t===constants_ModuleType.Spectrum,[t]),h=external_react_useRef(0),p=external_react_useCallback((e,t)=>r&&l&&u?calculateAnchoredXZoomInterval({anchorPercent:t,interval:{start:s,end:c},scale:e>0?.5:2,totalPoints:u}):null,[r,l,u,s,c]);external_react_useEffect(()=>{if(r&&u)return createWheelEventManager(e,t,(e,t)=>{let r=p(e,t.left);r&&(r.start!==n.interval.start||r.end!==n.interval.end)&&o({payload:{zoom:{...n,interval:r,isScanSegmentsUpdateMagnify:!1}}})})},[r,e,t,u,n,p,o]);let f=external_react_useCallback((t,a,l,p)=>{if(!r||!compareEventPriority(e,useZoomEvent_COMPONENT_KEY)||!t||!a||!l||p||!i||!u)return;let f=translateXZoomInterval({start:s,end:c},u,-l.left*u);(f.start!==s||f.end!==c)&&o({payload:{zoom:{...n,interval:f,isScanSegmentsUpdateMagnify:!1}}});let m=l.top;m&&d&&(h.current+=m,Math.abs(h.current)&&(useRangeMove(i)?.(h.current),h.current=0))},[r,e,d,s,c,u,n,i,o]);external_react_useEffect(()=>{if(!r||!l||!e)return;let t=()=>{resetEventLevel(e,useZoomEvent_COMPONENT_KEY),h.current=0},n=createMouseUpEventManager(e,useZoomEvent_COMPONENT_KEY,t),a=createMouseLeaveEventManager(e,useZoomEvent_COMPONENT_KEY,t),i=createDragEventManager(e,useZoomEvent_COMPONENT_KEY,f);return()=>{n?.(),a?.(),i?.(),t()}},[r,l,e,f])}let PRECISION=1e4,defaultAreaInfoResult={startIndex:0,endIndex:0,startCol:0,endCol:0,startTimestamp:"",endTimestamp:"",startFrequency:0,startFrequencyFormat:"",endFrequency:0,endFrequencyFormat:"",bandwidth:0,bandwidthFormat:"",data:[]};function calculateAreaInfo({endLeft:e,startLeft:t,startTop:r,endTop:n,frequencyFormat:a,globalID:i}){let{waterfallData:o}=withDatabase(i).getAllRawData();if(!o?.length)return defaultAreaInfoResult;let l=getHeatmapWaterfallSnapshot(i),s={endLeft:e,endTop:n,startLeft:t,startTop:r},c=l?resolveHeatmapGridRangeFromSnapshot(l,s):resolveHeatmapGridRange(o,s);if(!c)return defaultAreaInfoResult;let u=l?resolveHeatmapSourceLeft(Math.min(t,e),l):Math.min(t,e),d=l?resolveHeatmapSourceLeft(Math.max(t,e),l):Math.max(t,e),h={start:Math.round(Number(a(u))*PRECISION)/PRECISION,end:Math.round(Number(a(d))*PRECISION)/PRECISION},p=Math.abs(h.end-h.start),f=l?.rawData??o,m=f[c.startIndex]?.timestamp||"",g=f[c.endIndex]?.timestamp||"";return{startIndex:c.startIndex,endIndex:c.endIndex,startCol:c.startCol,endCol:c.endCol,startTimestamp:m,endTimestamp:g,startFrequency:h.start,startFrequencyFormat:String(h.start),endFrequency:h.end,endFrequencyFormat:String(h.end),bandwidth:p,bandwidthFormat:getFrequencyToFixed(p),data:l?resolveHeatmapRangeDataFromSnapshot(l,c):resolveHeatmapRangeData(o,c)}}let heatmapCaptureUpdate=(e,t)=>subscription_createSubscriptionManager(`heatmapCaptureUpdate-${e}`,"0",t,e),getHeatmapCaptureSelectionKey=e=>`heatmapCaptureSelection-${e}`,getHeatmapCaptureSelectionSubscriptionKey=e=>`${getHeatmapCaptureSelectionKey(e)}-update`,isSelectionEqual=(e,t)=>e===t||null!==e&&null!==t&&1e-7>=Math.abs(e.x[0]-t.x[0])&&1e-7>=Math.abs(e.x[1]-t.x[1])&&1e-7>=Math.abs(e.y[0]-t.y[0])&&1e-7>=Math.abs(e.y[1]-t.y[1]),getHeatmapCaptureSelection=e=>subscription_openData(getHeatmapCaptureSelectionKey(e),void 0,null,e),setHeatmapCaptureSelection=(e,t)=>{!e||isSelectionEqual(getHeatmapCaptureSelection(e),t)||(subscription_openData(getHeatmapCaptureSelectionKey(e),t,null,e),subscription_createSubscriptionManager(getHeatmapCaptureSelectionSubscriptionKey(e))(t))},subscribeHeatmapCaptureSelection=(e,t)=>subscription_createSubscriptionManager(getHeatmapCaptureSelectionSubscriptionKey(e),"HeatmapOverview",t,e),Area_COMPONENT_KEY=constants_ToolType.HeatmapCapture,Area=e=>{let{state:{heatmapCapture:t,axisX:{frequencyFormat:r,unit:n},system:a,globalID:i}}=useStore_useStore(),{id:o}=e,{type:l,show:s,display:c,onChange:u}=t,d=external_react_useMemo(()=>l===heatmap_HeatmapCaptureType.Area&&s&&c,[l,s,c]),[h,p]=external_react_useState(defaultAreaInfoResult),[f,m]=external_react_useState();return(external_react_useEffect(()=>{if(d){let e=createMouseUpEventManager(o,Area_COMPONENT_KEY,()=>{u(h)}),t=createMouseLeaveEventManager(o,Area_COMPONENT_KEY,()=>{u(h)}),n=createDragEventManager(o,Area_COMPONENT_KEY,(e,t)=>{if(compareEventPriority(o,Area_COMPONENT_KEY)&&e&&t){let{left:n,top:o}=e,{left:l,top:s}=t;if(void 0===n||void 0===o||void 0===l||void 0===s)return;let c=l-n,u=s-o,d=Math.abs(c),h=Math.abs(u);d*a.width/100<=10||h*a.height/100<=10||(m({width:d,height:h,left:c>0?n:l,top:u>0?o:s,endLeft:l,startLeft:n}),p(calculateAreaInfo({startTop:o,endTop:s,endLeft:l,startLeft:n,frequencyFormat:r,globalID:i})))}});return()=>{e?.(),t?.(),n?.()}}},[o,d,h,r,i,u]),external_react_useEffect(()=>{d||(resetEventLevel(o,Area_COMPONENT_KEY),p(defaultAreaInfoResult),u(defaultAreaInfoResult))},[d]),d&&h?.bandwidth!==0)?/*#__PURE__*/jsxs("div",{className:"pointer-events-none absolute inset-0 left-0 top-0 z-[6] h-full w-full overflow-hidden",children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute bottom-5 right-5 h-auto w-auto",children:/*#__PURE__*/jsx_runtime_jsx(components_Mask,{className:"p-1 text-xs text-popover-foreground",children:/*#__PURE__*/jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-[6px] gap-y-0.5",children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"起始频率"}),/*#__PURE__*/jsxs("div",{children:[h?.startFrequencyFormat,n]}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"结束频率"}),/*#__PURE__*/jsxs("div",{children:[h?.endFrequencyFormat,n]}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"带宽"}),/*#__PURE__*/jsx_runtime_jsx("div",{children:formatFrequencyUnitFromMHz(h.bandwidth).formatted}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"起始时间"}),/*#__PURE__*/jsx_runtime_jsx("div",{children:h?.startTimestamp}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"min-w-0 opacity-60",children:"结束时间"}),/*#__PURE__*/jsx_runtime_jsx("div",{children:h?.endTimestamp})]})})}),/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:/*#__PURE__*/jsx_runtime_jsx("div",{style:{left:`${f?.left}%`,top:`${f?.top}%`,width:`${f?.width}%`,height:`${f?.height}%`},className:"absolute z-[3] border-[2px] border-dashed border-foreground opacity-50"})})]}):null},Capture_Area=Area,RowIndex_COMPONENT_KEY=constants_ToolType.HeatmapCapture,RowIndex=({id:e})=>{let{state:{heatmapCapture:t,globalID:r,publish:n}}=useStore_useStore(),{onChange:a,show:i,type:o,display:l}=t,s=external_react_useMemo(()=>o===heatmap_HeatmapCaptureType.RowIndex&&i&&l,[o,i,l]),[c,u]=external_react_useState(null),[d,h]=external_react_useState(null),[p,f]=external_react_useState(!1),m=external_react_useCallback((e,t)=>Math.max(0,Math.min(t-1,Math.ceil((100-e)*t/100)-1)),[]),g=external_react_useRef(null),b=external_react_useCallback(e=>{if(!a||!r)return;let{waterfallData:t}=withDatabase(r).getAllRawData();if(t?.length){let n=getHeatmapWaterfallSnapshot(r),i=n?resolveHeatmapSourcePoint(n,{left:0,top:e.top}):null,o=i?i.rowIndex:m(e.top,t.length),l=t[o]?.timestamp,s={data:t[o],timestamp:l,rowIndex:o};u(s),a(s),withSpectrumAnalyzerSYNC(r)?.setRealData(s.data)}},[r,a,m,n]);return(external_react_useEffect(()=>{if(r&&s)return createMouseDownEventManager(e,RowIndex_COMPONENT_KEY,()=>{f(!0)}),createMouseUpEventManager(e,RowIndex_COMPONENT_KEY,()=>{f(!1),resetEventLevel(e,RowIndex_COMPONENT_KEY)}),createDragEventManager(e,RowIndex_COMPONENT_KEY,(t,r)=>{compareEventPriority(e,RowIndex_COMPONENT_KEY)&&(h(r),b(r))}),()=>{createMouseDownEventManager(e,RowIndex_COMPONENT_KEY,()=>{}),createMouseUpEventManager(e,RowIndex_COMPONENT_KEY,()=>{}),createDragEventManager(e,RowIndex_COMPONENT_KEY,()=>{})}},[e,r,s,b]),s)?/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute left-0 top-0 z-[6] h-full w-full",ref:g,children:d&&c&&/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("absolute left-0 h-0 w-full -translate-y-1/2 border-b-[2px] border-dashed border-b-foreground text-xs text-foreground",p&&"border-b-[4px]"),style:{top:`${d.top}%`},children:/*#__PURE__*/jsxs("div",{className:"absolute left-0 flex w-auto flex-col px-2 text-xs",style:{...(()=>{if(!d)return{};let e=d.top;return e<=10?{top:"0",transform:"translateY(0)"}:e>=90?{bottom:"0",top:"auto",transform:"translateY(0)"}:{top:"50%",transform:"translateY(-50%)"}})()},children:[/*#__PURE__*/jsxs("span",{className:"w-fit backdrop-blur-[10px]",children:["行",c?.rowIndex]}),/*#__PURE__*/jsxs("span",{className:"w-fit backdrop-blur-[10px]",children:["时间",c?.timestamp]})]})})}):null},Capture_RowIndex=RowIndex,mergeClasses=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),toKebabCase=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),toCamelCase=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),toPascalCase=e=>{let t=toCamelCase(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
3806
3810
  * @license lucide-react v1.31.0 - ISC
3807
3811
  *
3808
3812
  * This source code is licensed under the ISC license.
@@ -3812,23 +3816,23 @@ ${buildRule(` ${t.systemDark}`,n)}
3812
3816
  *
3813
3817
  * This source code is licensed under the ISC license.
3814
3818
  * See the LICENSE file in the root directory of this source tree.
3815
- */let hasA11yProp=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},LucideContext=createContext({});function LucideProvider({children:e,size:t,color:r,strokeWidth:n,absoluteStrokeWidth:a,className:i}){let o=useMemo(()=>({size:t,color:r,strokeWidth:n,absoluteStrokeWidth:a,className:i}),[t,r,n,a,i]);return createElement(LucideContext.Provider,{value:o},e)}let useLucideContext=()=>useContext(LucideContext),Icon_Icon=forwardRef(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...l},s)=>{let{size:c=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:h="currentColor",className:p=""}=useLucideContext()??{},f=n??d?24*Number(r??u)/Number(t??c):r??u;return external_react_createElement("svg",{ref:s,...defaultAttributes,width:t??c??defaultAttributes.width,height:t??c??defaultAttributes.height,stroke:e??h,strokeWidth:f,className:mergeClasses("lucide",p,a),...!i&&!hasA11yProp(l)&&{"aria-hidden":"true"},...l},[...o.map(([e,t])=>external_react_createElement(e,t)),...Array.isArray(i)?i:[i]])}),createLucideIcon=(e,t)=>{let r=forwardRef(({className:r,...n},a)=>external_react_createElement(Icon_Icon,{ref:a,iconNode:t,className:mergeClasses(`lucide-${toKebabCase(toPascalCase(e))}`,`lucide-${e}`,r),...n}));return r.displayName=toPascalCase(e),r},__iconNode=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],Move=createLucideIcon("move",__iconNode),DEFAULT_CONFIG={enabled:!0,defaultRect:{position:70,height:30,leftPosition:0,width:100},minSize:0,maxSize:100,snapThreshold:2,onChange:()=>{},onDragEnd:()=>{},preserveDefaultRect:!1,bounds:{bottom:100,left:0,right:100,top:0}},useDragSelect=(e={})=>{let{enabled:t,defaultRect:r,minSize:n,minWidth:a,minHeight:i,maxSize:o,snapThreshold:l,onChange:s,onDragEnd:c,preserveDefaultRect:u,bounds:d}={...DEFAULT_CONFIG,...e},h=a??n,p=i??n,[f,m]=external_react_useState({position:r.position??DEFAULT_CONFIG.defaultRect.position,height:u?r.height??DEFAULT_CONFIG.defaultRect.height:Math.min(r.height??DEFAULT_CONFIG.defaultRect.height,o),leftPosition:r.leftPosition??DEFAULT_CONFIG.defaultRect.leftPosition,width:r.width??DEFAULT_CONFIG.defaultRect.width}),[g,b]=external_react_useState(!1),[v,w]=external_react_useState(null),y=external_react_useRef(null),x=external_react_useRef({x:0,y:0,rect:f}),k=external_react_useRef(f);k.current=f,external_react_useEffect(()=>{if(!g&&r){let e={position:r.position??f.position,height:void 0!==r.height?u?r.height:Math.min(r.height,o):f.height,leftPosition:r.leftPosition??f.leftPosition,width:r.width??f.width};(Math.abs(e.position-f.position)>.01||Math.abs(e.height-f.height)>.01||Math.abs(e.leftPosition-f.leftPosition)>.01||Math.abs(e.width-f.width)>.01)&&m(e)}},[r?.position,r?.height,r?.leftPosition,r?.width,g,o,u]);let S=external_react_useCallback((e,r,n=f)=>{t&&(e.preventDefault(),b(!0),w(r),x.current={x:e.clientX,y:e.clientY,rect:{...n}})},[t,f]),D=external_react_useCallback(e=>{if(!g||!y.current)return;let t=y.current,{x:r,y:n,rect:a}=x.current,i=(e.clientY-n)/t.clientHeight*100,c=(e.clientX-r)/t.clientWidth*100,{position:u,height:f,leftPosition:b,width:w}=a;switch(v){case"top":{let e=a.position+a.height;u=Math.max(d.top,Math.min(a.position+i,e-p)),(f=e-u)>o&&(f=o,u=e-o);break}case"bottom":f=Math.max(p,Math.min(o,a.height+i,d.bottom-a.position));break;case"left":{let e=a.leftPosition+a.width;b=Math.max(d.left,Math.min(a.leftPosition+c,e-h)),(w=e-b)>o&&(w=o,b=e-o);break}case"right":w=Math.max(h,Math.min(o,a.width+c,d.right-a.leftPosition));break;case"middle":u=Math.max(d.top,Math.min(a.position+i,d.bottom-a.height)),b=Math.max(d.left,Math.min(a.leftPosition+c,d.right-a.width))}u<d.top+l&&(u=d.top),u+f>d.bottom-l&&(u=d.bottom-f),b<d.left+l&&(b=d.left),b+w>d.right-l&&(b=d.right-w);let S={position:u,height:f,leftPosition:b,width:w};k.current=S,m(S),s(S)},[g,v,h,p,o,l,d.top,d.bottom,d.left,d.right,s]),M=external_react_useCallback(()=>{g&&c(k.current),b(!1),w(null)},[g,c]);external_react_useEffect(()=>{if(t&&g)return document.addEventListener("mousemove",D),document.addEventListener("mouseup",M),document.addEventListener("mouseleave",M),window.addEventListener("blur",M),()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",M),document.removeEventListener("mouseleave",M),window.removeEventListener("blur",M)}},[t,g,D,M]);let F=external_react_useCallback(e=>{let t={...f,...e};m(t),s(t)},[f,s]);return{rect:f,isDragging:g,dragType:v,containerRef:y,handleMouseDown:S,resetRect:F,setRect:e=>{m(e),s(e)}}},SURFACE_GAP=4,MIN_VISUAL_SPAN=14,HANDLE_HIT_SIZE=10,VIEWPORT_BOUNDS={bottom:100,left:0,right:100,top:0},PROJECTED_EDGE_HANDLE_CLASS="pointer-events-auto absolute z-[2] appearance-none rounded-[3px] border-0 p-0 transition-[background-color,box-shadow] duration-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring [background:color-mix(in_srgb,var(--foreground)_18%,transparent)] [box-shadow:inset_0_0_0_1px_color-mix(in_srgb,var(--background)_72%,transparent),0_1px_3px_color-mix(in_srgb,var(--foreground)_28%,transparent)] hover:[background:color-mix(in_srgb,var(--foreground)_32%,transparent)] hover:[box-shadow:inset_0_0_0_1px_color-mix(in_srgb,var(--background)_86%,transparent),0_1px_4px_color-mix(in_srgb,var(--foreground)_42%,transparent)]",PROJECTED_MOVE_HANDLE_CLASS="pointer-events-auto absolute z-[3] flex size-5 -translate-x-1/2 -translate-y-1/2 cursor-move items-center justify-center appearance-none rounded-sm border-0 p-0 text-foreground outline-none transition-[background-color,box-shadow] duration-100 focus-visible:ring-1 focus-visible:ring-ring [background:color-mix(in_srgb,var(--background)_76%,var(--foreground)_24%)] [box-shadow:0_0_0_1px_color-mix(in_srgb,var(--background)_82%,transparent),0_1px_4px_color-mix(in_srgb,var(--foreground)_32%,transparent)] hover:[background:color-mix(in_srgb,var(--background)_64%,var(--foreground)_36%)]",ProjectedEdgeHandle=({ariaLabel:e,className:t,direction:r,onMouseDown:n,style:a})=>/*#__PURE__*/jsx_runtime_jsx("button",{type:"button",tabIndex:-1,"aria-label":e,className:cn_cn(PROJECTED_EDGE_HANDLE_CLASS,t),style:a,onMouseDown:n,children:/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:cn_cn("pointer-events-none absolute left-1/2 top-1/2 rounded-full bg-foreground/85","horizontal"===r?"h-[2px] -translate-x-1/2 -translate-y-1/2":"w-[2px] -translate-x-1/2 -translate-y-1/2"),style:"horizontal"===r?{width:"clamp(10px, 18%, 24px)"}:{height:"clamp(10px, 18%, 24px)"}})}),DragSelectBox_clamp=(e,t,r)=>Math.min(Math.max(e,t),r),isComparableLabelValue=e=>"string"==typeof e||"number"==typeof e,normalizeLabels=e=>{if(!e)return e;let t={...e};return isComparableLabelValue(t.left)&&isComparableLabelValue(t.right)&&String(t.left)===String(t.right)&&(t.right=void 0),isComparableLabelValue(t.top)&&isComparableLabelValue(t.bottom)&&String(t.top)===String(t.bottom)&&(t.top=void 0),t},getDisplaySpan=({start:e,length:t,minLength:r,maxLength:n})=>{let a=Math.max(0,t),i=Math.min(Math.max(a,r),n),o=e+a/2,l=o-i/2,s=o+i/2;l<0&&(s=Math.min(n,s-l),l=0),s>n&&(l=Math.max(0,l-(s-n)),s=n);let c=s-l;return{start:l,end:s,length:c}},getProjectedDisplaySpan=({start:e,length:t,minLength:r})=>{let n=Math.max(0,t),a=Math.max(n,r),i=e+n/2-a/2;return{start:i,end:i+a,length:a}},getDisplayRectBox=({rect:e,containerWidth:t,containerHeight:r,variant:n="contained"})=>{let a=e.leftPosition/100*t,i=e.position/100*r,o=e.width/100*t,l=e.height/100*r;if("projected"===n){let e=getProjectedDisplaySpan({start:a,length:o,minLength:MIN_VISUAL_SPAN}),t=getProjectedDisplaySpan({start:i,length:l,minLength:MIN_VISUAL_SPAN});return{left:e.start,top:t.start,width:e.length,height:t.length,right:e.end,bottom:t.end,centerX:e.start+e.length/2,centerY:t.start+t.length/2}}let s=getDisplaySpan({start:a,length:o,minLength:MIN_VISUAL_SPAN,maxLength:t}),c=getDisplaySpan({start:i,length:l,minLength:MIN_VISUAL_SPAN,maxLength:r});return{left:s.start,top:c.start,width:s.length,height:c.length,right:s.end,bottom:c.end,centerX:s.start+s.length/2,centerY:c.start+c.length/2}},getOverlapArea=(e,t)=>Math.max(0,Math.min(e.left+e.width,t.left+t.width)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.top+e.height,t.top+t.height)-Math.max(e.top,t.top)),placementsEqual=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(r=>{let n=e[r],a=t[r];return n&&a&&.5>Math.abs(n.left-a.left)&&.5>Math.abs(n.top-a.top)}),createOverlayBox=({left:e,top:t,size:r,containerWidth:n,containerHeight:a,score:i})=>{let o=Math.max(0,n-r.width),l=Math.max(0,a-r.height),s=DragSelectBox_clamp(e,0,o),c=DragSelectBox_clamp(t,0,l),u=Math.abs(s-e)+Math.abs(c-t);return{left:s,top:c,width:r.width,height:r.height,score:i+2*u}},getCandidateBoxes=({key:e,size:t,rectBox:r,containerWidth:n,containerHeight:a})=>{let i=[],o="middle"===e&&(r.width<=t.width+2*SURFACE_GAP||r.height<=t.height+2*SURFACE_GAP),l=(e,r,o)=>{i.push(createOverlayBox({left:e,top:r,size:t,containerWidth:n,containerHeight:a,score:o}))},s=r.left-t.width-SURFACE_GAP,c=r.right+SURFACE_GAP,u=r.top-t.height-SURFACE_GAP,d=r.bottom+SURFACE_GAP,h=r.left+SURFACE_GAP,p=r.right-t.width-SURFACE_GAP,f=r.top+SURFACE_GAP,m=r.bottom-t.height-SURFACE_GAP,g=r.centerX-t.width/2,b=r.centerY-t.height/2;switch(e){case"left":l(s,b,0),l(h,b,6),l(s,r.top,10),l(s,r.bottom-t.height,11),l(h,r.top,16),l(h,r.bottom-t.height,17),l(r.left,u,22),l(r.left,d,24);break;case"right":l(c,b,0),l(p,b,6),l(c,r.top,10),l(c,r.bottom-t.height,11),l(p,r.top,16),l(p,r.bottom-t.height,17),l(r.right-t.width,u,22),l(r.right-t.width,d,24);break;case"top":l(g,u,0),l(g,f,6),l(r.left,u,10),l(r.right-t.width,u,11),l(r.left+SURFACE_GAP,f,16),l(r.right-t.width-SURFACE_GAP,f,17),l(s,r.top,24),l(c,r.top,25);break;case"bottom":l(g,d,0),l(g,m,6),l(r.left,d,10),l(r.right-t.width,d,11),l(r.left+SURFACE_GAP,m,16),l(r.right-t.width-SURFACE_GAP,m,17),l(s,r.bottom-t.height,24),l(c,r.bottom-t.height,25);break;case"middle":o?(l(g,u,0),l(g,d,1),l(c,b,2),l(s,b,3),l(c,u,4),l(c,d,5),l(s,u,6),l(s,d,7),l(g,b,12)):(l(g,b,0),l(g,u,8),l(g,d,9),l(c,b,10),l(s,b,11),l(r.left,u,14),l(r.right-t.width,u,15),l(r.left,d,16),l(r.right-t.width,d,17))}return i},DragSelectBox=({enabled:e,defaultRect:t,minSize:r=0,minWidth:n,minHeight:a,maxSize:i=100,snapThreshold:o=2,onChange:l,onDragStart:s,onDragEnd:c,children:u,labels:d,className:h="",zIndex:p=7,showBoundaryLines:f=!1,variant:m="contained",interactionBounds:g=VIEWPORT_BOUNDS})=>{let b=external_react_useMemo(()=>normalizeLabels(d),[d?.top,d?.bottom,d?.left,d?.right]),{rect:v,containerRef:w,handleMouseDown:y}=useDragSelect({enabled:e,defaultRect:t,minSize:r,minWidth:n,minHeight:a,maxSize:"projected"===m?Math.max(i,g.right-g.left,g.bottom-g.top):i,snapThreshold:o,onChange:l,onDragEnd:c,preserveDefaultRect:"projected"===m,bounds:g}),x=v.leftPosition+Math.max(0,v.width),k=v.position+Math.max(0,v.height),S="projected"!==m||x>0&&v.leftPosition<100&&k>0&&v.position<100,D=DragSelectBox_clamp(v.leftPosition,0,100),M=DragSelectBox_clamp(x,0,100),F=DragSelectBox_clamp(v.position,0,100),C=DragSelectBox_clamp(k,0,100),E=M>D,A=C>F,N="projected"===m&&(v.leftPosition<VIEWPORT_BOUNDS.left||x>VIEWPORT_BOUNDS.right||v.position<VIEWPORT_BOUNDS.top||k>VIEWPORT_BOUNDS.bottom),T={left:(D+M)/2,top:(F+C)/2},[I,z]=external_react_useState(0),[P,_]=external_react_useState({width:0,height:0}),[O,L]=external_react_useState({}),q=external_react_useRef(null),$=external_react_useRef(null),j=external_react_useRef(null),H=external_react_useRef(null),B=external_react_useRef(null);external_react_useEffect(()=>{if(!e||!S||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>{z(e=>e+1)});return[w.current,q.current,$.current,j.current,H.current,B.current].filter(e=>null!==e).forEach(e=>{t.observe(e)}),()=>t.disconnect()},[e,S,!!b?.top,!!b?.bottom,!!b?.left,!!b?.right,!!u]),useLayoutEffect(()=>{let t=w.current;if(!e||!S||!t)return void L(e=>Object.keys(e).length>0?{}:e);let r=t.clientWidth,n=t.clientHeight;if(r<=0||n<=0)return;_(e=>e.width===r&&e.height===n?e:{width:r,height:n});let a=[["top",q.current],["bottom",$.current],["left",j.current],["right",H.current],["middle",B.current]].reduce((e,[t,r])=>(r&&(e[t]={width:r.offsetWidth,height:r.offsetHeight}),e),{}),i=getDisplayRectBox({rect:v,containerWidth:r,containerHeight:n,variant:m}),o={middle:4,bottom:3,left:2,right:2,top:1},l=["top","bottom","left","right","middle"].filter(e=>a[e]).sort((e,t)=>{let r=o[t]-o[e];if(0!==r)return r;let n=(a[e]?.width??0)*(a[e]?.height??0);return(a[t]?.width??0)*(a[t]?.height??0)-n}),s=[],c={};l.forEach(e=>{let t=a[e];if(!t)return;let o=getCandidateBoxes({key:e,size:t,rectBox:i,containerWidth:r,containerHeight:n}).map(e=>{let t=s.reduce((t,r)=>t+getOverlapArea(e,r),0),r=e.score+(t>0?2e4+10*t:0),n=Math.max(1,e.width*e.height);return{...e,overlapArea:t,overlapRatio:t/n,totalScore:r}}),l=o.filter(e=>0===e.overlapArea).sort((e,t)=>e.totalScore-t.totalScore)[0]??null??o.sort((e,t)=>e.totalScore-t.totalScore)[0]??null;!l||"middle"!==e&&l.overlapRatio>.2||(c[e]={left:l.left,top:l.top},s.push(l))}),L(e=>placementsEqual(e,c)?e:c)},[e,S,v.position,v.height,v.leftPosition,v.width,I,!!b?.top,!!b?.bottom,!!b?.left,!!b?.right,!!u,m]);let G={fontSize:"var(--size-font-second)",color:"var(--foreground)",border:"1px solid var(--border)",borderRadius:"var(--radius-control)",background:"color-mix(in srgb, var(--background) 80%, transparent)"},U=e=>{let t=O[e];return{left:t?.left??0,top:t?.top??0,visibility:t?"visible":"hidden"}},W=external_react_useMemo(()=>P.width<=0||P.height<=0?null:getDisplayRectBox({rect:v,containerWidth:P.width,containerHeight:P.height,variant:m}),[v.position,v.height,v.leftPosition,v.width,P.width,P.height,m]),V=W?Math.max(0,Math.min(6,W.width/4)):6,Y=W?Math.max(0,Math.min(6,W.height/4)):6,X=W?{top:W.top,height:W.height,left:W.left,width:W.width}:{top:`${v.position}%`,height:`${v.height}%`,left:`${v.leftPosition}%`,width:`${v.width}%`},K=e=>{let t={...v};switch(e){case"top":v.position<VIEWPORT_BOUNDS.top&&(t.position=VIEWPORT_BOUNDS.top,t.height=Math.max(0,v.position+v.height-VIEWPORT_BOUNDS.top));break;case"bottom":k>VIEWPORT_BOUNDS.bottom&&(t.height=Math.max(0,VIEWPORT_BOUNDS.bottom-v.position));break;case"left":v.leftPosition<VIEWPORT_BOUNDS.left&&(t.leftPosition=VIEWPORT_BOUNDS.left,t.width=Math.max(0,x-VIEWPORT_BOUNDS.left));break;case"right":x>VIEWPORT_BOUNDS.right&&(t.width=Math.max(0,VIEWPORT_BOUNDS.right-v.leftPosition))}return t},Q=(e,t,r)=>{s?.(t)!==!1&&(e.preventDefault(),e.stopPropagation(),y(e,t,r))};return e?/*#__PURE__*/jsxs(Zoom_ZoomViewportLayer,{className:cn_cn("left-0 top-0 h-full w-full overflow-hidden",h),ref:w,style:{zIndex:p},children:[f&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute left-0 right-0 top-0 h-px bg-border"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-px bg-border"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 top-0 w-px bg-border"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute bottom-0 right-0 top-0 w-px bg-border"})]}),S&&/*#__PURE__*/jsxs("div",{className:"group pointer-events-none absolute box-border",style:X,children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute inset-0 border-[2px] border-dashed border-foreground group-hover:border-[4px]"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute left-0 w-full cursor-ns-resize [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_40%,transparent)]",style:{top:-HANDLE_HIT_SIZE/2,height:HANDLE_HIT_SIZE},onMouseDown:e=>Q(e,"top")}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute left-0 w-full cursor-ns-resize [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_40%,transparent)]",style:{bottom:-HANDLE_HIT_SIZE/2,height:HANDLE_HIT_SIZE},onMouseDown:e=>Q(e,"bottom")}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute top-0 h-full cursor-ew-resize [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_40%,transparent)]",style:{left:-HANDLE_HIT_SIZE/2,width:HANDLE_HIT_SIZE},onMouseDown:e=>Q(e,"left")}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute top-0 h-full cursor-ew-resize [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_40%,transparent)]",style:{right:-HANDLE_HIT_SIZE/2,width:HANDLE_HIT_SIZE},onMouseDown:e=>Q(e,"right")}),!N&&/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute cursor-move [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_20%,transparent)]",style:{top:Y,bottom:Y,left:V,right:V},onMouseDown:e=>Q(e,"middle")})]}),N&&S&&E&&A&&/*#__PURE__*/jsx_runtime_jsx("button",{type:"button",tabIndex:-1,"aria-label":"移动框选范围",title:"移动框选范围",className:PROJECTED_MOVE_HANDLE_CLASS,style:{left:`clamp(10px, ${T.left}%, calc(100% - 10px))`,top:`clamp(10px, ${T.top}%, calc(100% - 10px))`},onMouseDown:e=>Q(e,"middle"),children:/*#__PURE__*/jsx_runtime_jsx(Move,{"aria-hidden":"true",className:"pointer-events-none size-3",strokeWidth:1.75})}),"projected"===m&&S&&/*#__PURE__*/jsxs(Fragment,{children:[v.position<0&&E&&/*#__PURE__*/jsx_runtime_jsx(ProjectedEdgeHandle,{ariaLabel:"调整框选上边界",direction:"horizontal",className:"top-0 h-[10px] cursor-ns-resize",style:{left:`${D}%`,minWidth:HANDLE_HIT_SIZE,width:`${M-D}%`},onMouseDown:e=>Q(e,"top",K("top"))}),k>100&&E&&/*#__PURE__*/jsx_runtime_jsx(ProjectedEdgeHandle,{ariaLabel:"调整框选下边界",direction:"horizontal",className:"bottom-0 h-[10px] cursor-ns-resize",style:{left:`${D}%`,minWidth:HANDLE_HIT_SIZE,width:`${M-D}%`},onMouseDown:e=>Q(e,"bottom",K("bottom"))}),v.leftPosition<0&&A&&/*#__PURE__*/jsx_runtime_jsx(ProjectedEdgeHandle,{ariaLabel:"调整框选左边界",direction:"vertical",className:"left-0 w-[10px] cursor-ew-resize",style:{height:`${C-F}%`,minHeight:HANDLE_HIT_SIZE,top:`${F}%`},onMouseDown:e=>Q(e,"left",K("left"))}),x>100&&A&&/*#__PURE__*/jsx_runtime_jsx(ProjectedEdgeHandle,{ariaLabel:"调整框选右边界",direction:"vertical",className:"right-0 w-[10px] cursor-ew-resize",style:{height:`${C-F}%`,minHeight:HANDLE_HIT_SIZE,top:`${F}%`},onMouseDown:e=>Q(e,"right",K("right"))})]}),S&&u&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:B,className:"pointer-events-none absolute",style:U("middle"),children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex items-start gap-0.5 whitespace-nowrap p-[var(--size-gap-base)]",style:{fontSize:"var(--size-font-second)",color:"var(--foreground)",border:"1px solid var(--border)",borderRadius:"var(--radius-control)",background:"color-mix(in srgb, var(--secondary) 80%, transparent)"},children:u})}),S&&b?.left&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:j,className:"pointer-events-none absolute whitespace-nowrap p-[calc(var(--size-gap-base)/2)]",style:{...G,...U("left")},children:b.left}),S&&b?.right&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:H,className:"pointer-events-none absolute whitespace-nowrap p-[calc(var(--size-gap-base)/2)]",style:{...G,...U("right")},children:b.right}),S&&b?.top&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:q,className:"pointer-events-none absolute whitespace-nowrap p-[calc(var(--size-gap-base)/2)]",style:{...G,...U("top")},children:b.top}),S&&b?.bottom&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:$,className:"pointer-events-none absolute whitespace-nowrap p-[calc(var(--size-gap-base)/2)]",style:{...G,...U("bottom")},children:b.bottom})]}):null},components_DragSelectBox=DragSelectBox,sliderInfo_PRECISION=1e6,sliderInfo_clamp=(e,t,r)=>Math.min(r,Math.max(t,e)),resolveFrequencyExtent=e=>{if(!e)return null;let t=Number(e(0)),r=Number(e(100));return Number.isFinite(t)&&Number.isFinite(r)&&t!==r?[t,r]:null},resolveContinuousFrequencyFromSegments=(e,t,r)=>{if(!t?.length)return null;let n=100*sliderInfo_clamp(e,0,1),a=t.length-1;for(let e=0;e<t.length;e+=1){let i=t[e],o=Math.min(i.progress[0],i.progress[1]),l=Math.max(i.progress[0],i.progress[1]);if(!("start"===r?n>=o&&(n<l||e===a&&n<=l):(n>o||0===e)&&n<=l))continue;let s=l-o,c=s?(n-o)/s:0;return i.start+(i.stop-i.start)*c}return null},resolveFrequencyFromRatio=(e,t,r,n)=>{let a=r?.(100*sliderInfo_clamp(e,0,1)),i=void 0===a?0/0:Number(a);return Number.isFinite(i)?i:resolveContinuousFrequencyFromSegments(e,t,n)},resolveRatioFromFrequency=(e,t,r)=>{if(t?.length){let r=null;for(let n of t){let t=n.start,a=n.stop,i=Math.min(t,a),o=Math.max(t,a),l=n.progress[0]/100,s=n.progress[1]/100;if(e>=i&&e<=o){let r=a-t;return sliderInfo_clamp(l+(s-l)*(r?(e-t)/r:0),0,1)}for(let n of[{distance:Math.abs(e-t),ratio:l},{distance:Math.abs(e-a),ratio:s}])(!r||n.distance<r.distance)&&(r=n)}if(r)return sliderInfo_clamp(r.ratio,0,1)}let n=resolveFrequencyExtent(r);return n?sliderInfo_clamp((e-n[0])/(n[1]-n[0]),0,1):null},resolveHeatmapSliderFrequencyRatioRange=({frequencyFormat:e,frequencyRange:t,segments:r})=>{let n=resolveRatioFromFrequency(t[0],r,e),a=resolveRatioFromFrequency(t[1],r,e);return null===n||null===a?null:[Math.min(n,a),Math.max(n,a)]},resolveFrequencyRangeFromRatios=(e,t,r)=>{let n=resolveFrequencyFromRatio(e[0],t,r,"start"),a=resolveFrequencyFromRatio(e[1],t,r,"end");return null===n||null===a?null:[Math.min(n,a),Math.max(n,a)]},resolveHeatmapSliderSelectionFromRect=({frequencyFormat:e,rect:t,segments:r,waterfallSnapshot:n})=>{let a=resolveHeatmapProjectedContinuousSourceRange(n,{startLeft:t.leftPosition,endLeft:t.leftPosition+t.width,startTop:t.position+t.height,endTop:t.position});if(!a||n.sourceSize.width<=0)return null;let i=[a.x[0]/n.sourceSize.width,a.x[1]/n.sourceSize.width];return{frequency:resolveFrequencyRangeFromRatios(i,r,e),x:i,y:a.y}},resolveHeatmapSliderSelectionFromInteraction=({dragType:e,frequencyFormat:t,rect:r,segments:n,startSelection:a,waterfallSnapshot:i})=>{let o=resolveHeatmapSliderSelectionFromRect({frequencyFormat:t,rect:r,segments:n,waterfallSnapshot:i});if(!o||!a)return o;switch(e){case"left":return{frequency:o.frequency&&a.frequency?[o.frequency[0],a.frequency[1]]:o.frequency,x:[o.x[0],a.x[1]],y:a.y};case"right":return{frequency:o.frequency&&a.frequency?[a.frequency[0],o.frequency[1]]:o.frequency,x:[a.x[0],o.x[1]],y:a.y};case"top":return{frequency:a.frequency,x:a.x,y:[a.y[0],o.y[1]]};case"bottom":return{frequency:a.frequency,x:a.x,y:[o.y[0],a.y[1]]};case"middle":return o}},resolveHeatmapSliderSelectionSourceRange=({selection:e,waterfallSnapshot:t})=>{let{sourceSize:r}=t;if(r.width<=0||r.height<=0)return null;let n=sliderInfo_clamp(Math.min(e.x[0],e.x[1]),0,1),a=sliderInfo_clamp(Math.max(e.x[0],e.x[1]),n,1),i=sliderInfo_clamp(Math.min(e.y[0],e.y[1]),0,r.height),o=sliderInfo_clamp(Math.max(e.y[0],e.y[1]),i,r.height);return{x:[n*r.width,a*r.width],y:[i,o]}},calculateHeatmapSliderInfo=({formatBandwidth:e,frequencyFormat:t,heatmapData:r,rect:n,segments:a,selectionOverride:i,sourceRangeOverride:o,waterfallSnapshot:l})=>{let s=r.length;if(s<=0)return null;let{position:c,height:u,leftPosition:d,width:h}=n,p=l&&i?resolveHeatmapSliderSelectionSourceRange({selection:i,waterfallSnapshot:l}):null,f=o??(l&&p?quantizeHeatmapContinuousSourceRange(l,p):null)??(l?resolveHeatmapProjectedSourceRange(l,{startLeft:d,endLeft:d+h,startTop:c+u,endTop:c}):null),m=f??resolveHeatmapRowRange(c+u,c,s);if(!m)return null;let{startIndex:g,endIndex:b}=m,v=String(r[g]?.timestamp??""),w=String(r[b]?.timestamp??""),y=dateTimeToTimestamp(v),x=dateTimeToTimestamp(w),k=y>0&&x>0?Math.abs(x-y):0,S=f??resolveHeatmapColumnRange(d,d+h,resolveHeatmapGridInfo(r).columnCount);if(!S)return null;let{startCol:D,endCol:M}=S,F=l?.sourceSize.width??0,C=resolveFrequencyRangeFromRatios([(i?100*i.x[0]:o&&F>0?100*D/F:l?resolveHeatmapSourceLeft(d,l):d)/100,(i?100*i.x[1]:o&&F>0?(M+1)*100/F:l?resolveHeatmapSourceLeft(d+h,l):d+h)/100],a,t),E=i?.frequency?.[0]??C?.[0],A=i?.frequency?.[1]??C?.[1],N=Number.isFinite(E)?Math.round(Number(E)*sliderInfo_PRECISION)/sliderInfo_PRECISION:0,T=Number.isFinite(A)?Math.round(Number(A)*sliderInfo_PRECISION)/sliderInfo_PRECISION:0,I=Math.abs(T-N);return{startIndex:g,endIndex:b,startTimestamp:v,endTimestamp:w,duration:k,startCol:D,endCol:M,startFrequency:N,startFrequencyFormat:String(N),endFrequency:T,endFrequencyFormat:String(T),bandwidth:I,bandwidthFormat:e(I)}},DEFAULT_HEIGHT=30,DEFAULT_POSITION=100-DEFAULT_HEIGHT,MAX_SIZE=100,MIN_SIZE=0,SNAP_THRESHOLD=2,DEFAULT_RECT={position:DEFAULT_POSITION,height:Math.min(DEFAULT_HEIGHT,MAX_SIZE),leftPosition:0,width:100},isRectEqual=(e,t)=>.01>=Math.abs(e.position-t.position)&&.01>=Math.abs(e.height-t.height)&&.01>=Math.abs(e.leftPosition-t.leftPosition)&&.01>=Math.abs(e.width-t.width),isBoundsEqual=(e,t)=>.01>=Math.abs(e.top-t.top)&&.01>=Math.abs(e.bottom-t.bottom)&&.01>=Math.abs(e.left-t.left)&&.01>=Math.abs(e.right-t.right),isSliderInfoEqual=(e,t)=>e.startIndex===t.startIndex&&e.endIndex===t.endIndex&&e.startTimestamp===t.startTimestamp&&e.endTimestamp===t.endTimestamp&&e.duration===t.duration&&e.startCol===t.startCol&&e.endCol===t.endCol&&e.startFrequency===t.startFrequency&&e.startFrequencyFormat===t.startFrequencyFormat&&e.endFrequency===t.endFrequency&&e.endFrequencyFormat===t.endFrequencyFormat&&e.bandwidth===t.bandwidth&&e.bandwidthFormat===t.bandwidthFormat,Slider=({id:e})=>{let{state:{globalID:t,heatmapCapture:{type:r,show:n,display:a,interval:i,onChange:o},axisX:{frequencyFormat:l,unit:s},segments:c}}=useStore_useStore(),u=external_react_useMemo(()=>r===heatmap_HeatmapCaptureType.Slider&&n&&a,[r,n,a]),[d,h]=external_react_useState(),p=external_react_useRef(void 0),f=external_react_useRef(null),[m,g]=external_react_useState(DEFAULT_RECT),[b,v]=external_react_useState(),w=external_react_useRef(m),y=external_react_useRef(null),x=external_react_useRef(null),k=external_react_useRef(null),S=external_react_useRef(null),D=external_react_useRef(l),M=external_react_useRef(c);D.current=l,M.current=c;let F=external_react_useCallback(e=>{w.current=e,g(t=>isRectEqual(t,e)?t:e)},[]),C=external_react_useCallback(e=>{v(t=>t&&e?isBoundsEqual(t,e)?t:e:t===e?t:e)},[]),E=external_react_useCallback(e=>{let r=getHeatmapWaterfallSnapshot(t),n=y.current,a=r&&n?resolveHeatmapSliderSelectionSourceRange({selection:n,waterfallSnapshot:r}):null;setHeatmapCaptureSelection(t,u&&e&&a?a:null)},[u,t]),A=external_react_useCallback((e,r)=>{p.current=e,h(e),E(e),r&&(f.current=getHeatmapWaterfallSnapshot(t)?.rawData??null,o?.(e))},[t,o,E]);external_react_useEffect(()=>{if(t)return E(u?p.current??null:null),()=>setHeatmapCaptureSelection(t,null)},[u,t,E]);let N=external_react_useCallback(()=>{let e=withDatabase(t).getAllRawData().waterfallData??[];return[e,e.length]},[t]),T=external_react_useCallback((e,r)=>{let[n]=N();return calculateHeatmapSliderInfo({formatBandwidth:getFrequencyToFixed,frequencyFormat:D.current,heatmapData:n,rect:e,segments:M.current,selectionOverride:r,waterfallSnapshot:getHeatmapWaterfallSnapshot(t)})},[N,t]),I=external_react_useCallback((e,r)=>{let n=getHeatmapWaterfallSnapshot(t);if(!n)return null;let a=r?resolveHeatmapSliderSelectionFromInteraction({dragType:r,frequencyFormat:D.current,rect:e,segments:M.current,startSelection:x.current,waterfallSnapshot:n}):resolveHeatmapSliderSelectionFromRect({frequencyFormat:D.current,rect:e,segments:M.current,waterfallSnapshot:n});return a&&(y.current=a),a},[t]),[z,P]=external_react_useState(0);external_react_useEffect(()=>{if(e&&t)return withUpdateData(e,"Slider",()=>P(e=>e+1))},[e,t]);let _=external_react_useCallback(e=>{let t=k.current;if(t&&isRectEqual(t,e))return;F(e);let r=I(e,S.current),n=T(e,r??void 0);n&&A(n,!1)},[T,F,A,I]),O=external_react_useCallback(t=>{let r=compareEventPriority(e,constants_ToolType.HeatmapCapture);return!1!==r&&(S.current=t,x.current=y.current,k.current=w.current,r)},[e]),L=external_react_useCallback(()=>{S.current=null,x.current=null,k.current=null,createMouseUpEventManager(getEID(e))(),resetEventLevel(e,constants_ToolType.HeatmapCapture)},[e]),q=external_react_useCallback(e=>{try{let t=y.current??I(e,null),r=T(e,t??void 0);r&&A(r,!0)}finally{L()}},[T,L,A,I]);external_react_useEffect(()=>L,[u,L]);let $=external_react_useCallback(e=>{let{startIndex:r,endIndex:n,startFrequency:a,endFrequency:i}=e,[o,s]=N(),c=getHeatmapWaterfallSnapshot(t),u=p.current,d=r===u?.startIndex&&n===u.endIndex,h=y.current?.frequency,f=void 0===a||void 0===i||1e-7>=Math.abs(Math.min(a,i)-(h?.[0]??0/0))&&1e-7>=Math.abs(Math.max(a,i)-(h?.[1]??0/0));if(d&&f)return;let m=w.current;if(c){let{sourceSize:e}=c;if(e.width<=0||e.height<=0)return;let t=s>0&&r>=0&&n<s&&n-r>=Math.ceil(MIN_SIZE*s/100),o=y.current??resolveHeatmapSliderSelectionFromRect({frequencyFormat:D.current,rect:m,segments:M.current,waterfallSnapshot:c}),l=void 0!==a&&void 0!==i?[Math.min(a,i),Math.max(a,i)]:null,d=l?resolveHeatmapSliderFrequencyRatioRange({frequencyFormat:D.current,frequencyRange:l,segments:M.current}):null;if(l&&!d)return;let h={frequency:l??o?.frequency??null,x:d??o?.x??[c.range.x[0]/e.width,c.range.x[1]/e.width],y:t?[Math.min(r,n),Math.max(r,n)+1]:o?.y??[u?.startIndex??c.range.y[0],(u?.endIndex??c.range.y[1]-1)+1]},p=resolveHeatmapSliderSelectionSourceRange({selection:h,waterfallSnapshot:c});if(!p)return;let f=resolveHeatmapContinuousSourceRangeScreenRect(c,p);if(!f)return;y.current=h,F(f);let g=T(f,h);g&&A(g,!0);return}let g=!d&&s>0&&r>=0&&n<s&&n-r>=Math.ceil(MIN_SIZE*s/100),b=!1,v=m.leftPosition,x=m.width;if(void 0!==a&&void 0!==i&&l){let e=l(0),t=l(100),r=e?Number(e):0,n=(t?Number(t):0)-r;if(n>0){let e=(a-r)/n*100,t=(i-r)/n*100,o=t-e;e>=0&&t<=100&&o>=MIN_SIZE&&(Math.abs(e-m.leftPosition)>.01||Math.abs(o-m.width)>.01)&&(b=!0,v=e,x=o)}}if(!g&&!b)return;let k={position:g?(1-n/s)*100:m.position,height:g?(n-r)/s*100:m.height,leftPosition:v,width:x};F(k);let S=T(k);S&&A(S,!0)},[N,t,l,T,F,A]);return(external_react_useEffect(()=>{i&&u&&$(i)},[i?.startIndex,i?.endIndex,i?.startFrequency,i?.endFrequency,u,z,$]),external_react_useEffect(()=>{if(!u||!t)return;let e=getHeatmapWaterfallSnapshot(t),r=p.current;if(e?.sourceSize.width&&e.sourceSize.height){let t=resolveHeatmapSourceRangeScreenRect(e,{endCol:e.sourceSize.width-1,endIndex:e.sourceSize.height-1,startCol:0,startIndex:0});C(t?{bottom:t.position+t.height,left:t.leftPosition,right:t.leftPosition+t.width,top:t.position}:void 0)}else C(void 0);if(!e){let e=T(w.current);e&&A(e,!0);return}let n=y.current??resolveHeatmapSliderSelectionFromRect({frequencyFormat:D.current,rect:w.current,segments:M.current,waterfallSnapshot:e});if(!n)return;if(n.frequency){let e=resolveHeatmapSliderFrequencyRatioRange({frequencyFormat:D.current,frequencyRange:n.frequency,segments:M.current});e&&(n={...n,x:e})}y.current=n;let a=resolveHeatmapSliderSelectionSourceRange({selection:n,waterfallSnapshot:e});if(!a)return;let i=resolveHeatmapContinuousSourceRangeScreenRect(e,a);i&&F(i);let o=T(i??w.current,n);if(!o)return;let l=!r||!isSliderInfoEqual(o,r),s=f.current!==e.rawData;(l||s)&&A(o,!0)},[z,l,c,u,t,T,F,C,A]),external_react_useEffect(()=>{t&&heatmapCaptureUpdate(t,e=>{e.interval&&u&&$(e.interval)})},[t,u,$]),u)?/*#__PURE__*/jsxs(components_DragSelectBox,{enabled:u,defaultRect:m,minSize:MIN_SIZE,maxSize:MAX_SIZE,snapThreshold:SNAP_THRESHOLD,onChange:_,onDragStart:O,onDragEnd:q,zIndex:6,showBoundaryLines:!0,variant:"projected",interactionBounds:b,labels:{left:d?.startFrequencyFormat?`${d.startFrequencyFormat}${s}`:"",right:d?.endFrequencyFormat?`${d.endFrequencyFormat}${s}`:"",top:d?.endTimestamp,bottom:d?.startTimestamp},children:[/*#__PURE__*/jsxs("div",{children:["带宽:",d?.bandwidth!==void 0?formatFrequencyUnit(1e3*d.bandwidth).formatted:""]}),/*#__PURE__*/jsxs("div",{children:["时长:",d?.duration!==void 0?(d.duration/1e3).toFixed(3):"","s"]})]}):null},Capture_Slider=Slider,HeatmapCapture=e=>{let{state:{heatmapCapture:t}}=useStore_useStore(),{show:r,type:n}=t;return r?n===heatmap_HeatmapCaptureType.Slider?/*#__PURE__*/jsx_runtime_jsx(Capture_Slider,{...e}):n===heatmap_HeatmapCaptureType.RowIndex?/*#__PURE__*/jsx_runtime_jsx(Capture_RowIndex,{...e}):/*#__PURE__*/jsx_runtime_jsx(Capture_Area,{...e}):null},Capture=HeatmapCapture;class render_Heatmap extends GradientRenderer{lastSeriesData=[];constructor(e){super({id:e.id,globalID:e.globalID,chart:null,realRange:e.realRange??constants_RANGE_DEFAULT,heatmapDefaultData:e.heatmapDefaultData??[]})}init(){let{id:e}=this.state;e&&(this.state.chart=new Heatmap({id:e,colors:this.getInitialColors(),renderer:RendererType.WebGL}),this.subscribeToColor("Heatmap-Render"),this.updateSeries(this.state.heatmapDefaultData),this.setRange())}updateSeries(e){Array.isArray(e)&&(this.lastSeriesData=e,this.state.chart?.render(e))}updateParams(e){let t=this.state.realRange,r=this.state.heatmapDefaultData;super.updateParams(e),e.heatmapDefaultData&&e.heatmapDefaultData!==r&&this.updateSeries(e.heatmapDefaultData),e.realRange&&(e.realRange[0]!==t[0]||e.realRange[1]!==t[1])&&this.setRange(e.realRange)}setRange(e=this.state.realRange){let{chart:t}=this.state,[r,n]=e;e&&void 0!==r&&void 0!==n&&t&&(this.state.realRange=e,t.setRange(e))}reset(){this.lastSeriesData=[],this.clear(),this.resize()}resize(){this.setRange(),this.state.chart?.resize(),this.lastSeriesData.length>0&&this.state.chart?.render(this.lastSeriesData)}}let useWaterfallZoomEvent_COMPONENT_KEY=constants_ToolType.Zoom;function useWaterfallZoomEvent(e,t){let r=useStore_useSelector(e=>e.globalID),n=external_react_useRef(null);external_react_useEffect(()=>{if(!t||!e||!r)return;let a=e=>{let t=withWaterfallAnalyzerSYNC(r),a=t?.getSnapshot();if(!a?.sourceSize.width||!a.sourceSize.height||"number"!=typeof e.left||"number"!=typeof e.top){n.current=null;return}n.current={start:{left:e.left,top:e.top},viewport:{range:a.range,sourceSize:a.sourceSize}}},i=createMouseDownEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,a),o=createWheelEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,(e,t)=>{let n=withWaterfallAnalyzerSYNC(r),a=n?.getSnapshot();if(!n||!a?.sourceSize.width||!a.sourceSize.height||"number"!=typeof t.left||"number"!=typeof t.top)return;let i=calculateHeatmapWheelRange(a,e,{left:t.left,top:t.top});isHeatmapViewportRangeEqual(a,i)||n.updateSamplingRange(toWaterfallSamplingOptions(i))}),l=createDoubleClickEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,()=>{if(!compareEventPriority(e,useWaterfallZoomEvent_COMPONENT_KEY))return!1;let t=resetHeatmapViewport(r);return resetEventLevel(e,useWaterfallZoomEvent_COMPONENT_KEY),t}),s=createDragEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,(t,i,o,l)=>{if(l||!t||!i||"number"!=typeof t.left||"number"!=typeof t.top||"number"!=typeof i.left||"number"!=typeof i.top||!compareEventPriority(e,useWaterfallZoomEvent_COMPONENT_KEY))return;let s=withWaterfallAnalyzerSYNC(r),c=s?.getSnapshot();if(!s||!c?.sourceSize.width||!c.sourceSize.height)return;n.current||a(t);let u=n.current;if(!u)return;if(u.viewport.sourceSize.width!==c.sourceSize.width||u.viewport.sourceSize.height!==c.sourceSize.height){n.current=null;return}let d=calculateHeatmapDragRangeFromCoordinates(u.viewport,u.start,{left:i.left,top:i.top});isHeatmapViewportRangeEqual(c,d)||s.updateSamplingRange(toWaterfallSamplingOptions(d))}),c=()=>{n.current=null,resetEventLevel(e,useWaterfallZoomEvent_COMPONENT_KEY)},u=createMouseUpEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,c),d=createMouseLeaveEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,c);return()=>{i?.(),o?.(),l?.(),s?.(),u?.(),d?.(),c()}},[t,r,e])}let Heatmap_Heatmap=e=>{let{heatmapDefaultData:t,onSubscriptionReadyChange:r,overview:n,xyZoom:a=!1}=e,i=external_react_useRef(r);i.current=r;let{state:{axisY:{realRange:o},globalID:l}}=useStore_useStore(),{id:s,chart:c,Chart:u}=hooks_useChart({Render:render_Heatmap,params:{realRange:o,heatmapDefaultData:t,globalID:l}}),d=external_react_useMemo(()=>{let e=getEID(s);return throttle((t,r)=>{createWheelEventManager(e)(t,r)})},[s]),h=external_react_useCallback(e=>{e.stopPropagation(),d(-1*e.deltaY,calculateEventRelativePosition(e))},[d]);return useWaterfallZoomEvent(s,a),useModuleSubscription({moduleType:constants_ModuleType.Heatmap,chart:c,handleRender:(e,t)=>{t.updateSeries?.(e.data),withUpdateData(s)()},eventHandlers:{[constants_PSType.Option]:e=>{e.key===constants_OptionKey.HeatmapCapture&&heatmapCaptureUpdate(l)(e.data)}}}),external_react_useEffect(()=>{if(c&&l)return i.current?.(!0),()=>{i.current?.(!1)}},[c,l]),/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(heatmap,{id:s,chart:c}),/*#__PURE__*/jsxs(components_PluginBox,{onWheelCapture:a?h:void 0,children:[/*#__PURE__*/jsx_runtime_jsx(GridLines_Boundary,{}),/*#__PURE__*/jsx_runtime_jsx(u,{}),/*#__PURE__*/jsx_runtime_jsx(components_EventBus,{id:s}),/*#__PURE__*/jsx_runtime_jsx(Capture,{id:s}),/*#__PURE__*/jsx_runtime_jsx(components_Cursor,{id:s,type:constants_ModuleType.Heatmap}),n]})]})},modules_Heatmap=Heatmap_Heatmap,DEFAULT_PALETTE=[{r:0,g:0,b:0,a:1},{r:0,g:0,b:255,a:1},{r:0,g:188,b:212,a:1},{r:45,g:179,b:51,a:1},{r:255,g:235,b:59,a:1},{r:255,g:0,b:0,a:1}],DEFAULT_OVERLAY_COLORS={selectionFill:"rgba(255, 210, 64, 0.08)",selectionStroke:"rgba(255, 210, 64, 0.95)",shadow:"rgba(0, 0, 0, 0.8)",viewportFill:"rgba(255, 255, 255, 0.14)",viewportStroke:"rgba(255, 255, 255, 0.95)"},MAX_BACKING_WIDTH=256,MAX_BACKING_HEIGHT=1024,MAX_DEVICE_PIXEL_RATIO=2,Overview_clamp=(e,t,r)=>Math.min(r,Math.max(t,e)),writePaletteColor=(e,t,r,n)=>{let a=Overview_clamp(n,0,1)*(r.length-1),i=Math.floor(a),o=Math.min(i+1,r.length-1),l=a-i,s=r[i],c=r[o];e[t]=Math.round(s.r+(c.r-s.r)*l),e[t+1]=Math.round(s.g+(c.g-s.g)*l),e[t+2]=Math.round(s.b+(c.b-s.b)*l),e[t+3]=Math.round(255*Overview_clamp(s.a+(c.a-s.a)*l,0,1))},normalizePalette=e=>{if(!Array.isArray(e)||e.length<2)return null;let t=[];for(let r of e){if(!r||"object"!=typeof r||!("r"in r)||!("g"in r)||!("b"in r))return null;let{r:e,g:n,b:a}=r,i="a"in r?r.a:1;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof a||"number"!=typeof i||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(a)||!Number.isFinite(i))return null;t.push({r:Number(e),g:Number(n),b:Number(a),a:Number(i)})}return t},HeatmapOverview=/*#__PURE__*/forwardRef(({globalID:e,onResetViewport:t},r)=>{let n=useStore_useSelector(e=>e.axisY.realRange),a=external_react_useRef(null),i=external_react_useRef(null),o=external_react_useRef(null),l=external_react_useRef(null),s=external_react_useRef(null),c=external_react_useRef(DEFAULT_OVERLAY_COLORS),u=external_react_useRef(null),d=external_react_useRef(null),h=external_react_useRef(null),p=external_react_useRef(DEFAULT_PALETTE),f=external_react_useRef(constants_RANGE_DEFAULT),m=external_react_useRef(null),g=external_react_useRef(!0),b=external_react_useRef(null),v=external_react_useRef(void 0),w=external_react_useRef(null);f.current=[n?.[0]??constants_RANGE_DEFAULT["0"],n?.[1]??constants_RANGE_DEFAULT["1"]];let y=external_react_useCallback(()=>{let e=o.current,t=u.current;if(!e)return;let r=e.getContext("2d");if(!r)return;let{width:n,height:a}=e;if(r.clearRect(0,0,n,a),!t?.sourceSize.width||!t.sourceSize.height||n<=0||a<=0){h.current=t?.rawData??null;return}let[i,l]=f.current,c=Math.min(i,l),d=Math.max(i,l)-c||1,m=p.current,g=s.current;g&&g.width===n&&g.height===a||(s.current=g=r.createImageData(n,a));let b=g.data;for(let e=0;e<a;e++){let r=Overview_clamp(Math.floor((a-e-.5)*t.sourceSize.height/a),0,t.sourceSize.height-1),i=t.rawData[r];for(let r=0;r<n;r++){let a=Overview_clamp(Math.floor((r+.5)*t.sourceSize.width/n),0,t.sourceSize.width-1),o=i?.[a],l=(e*n+r)*4;if(!Number.isFinite(o)){b[l]=0,b[l+1]=0,b[l+2]=0,b[l+3]=0;continue}writePaletteColor(b,l,m,(o-c)/d)}}r.putImageData(g,0,0),h.current=t.rawData},[]),x=external_react_useCallback(()=>{let e=i.current??l.current;e&&(c.current={selectionFill:getThemeColor("--warning",.12,e)||DEFAULT_OVERLAY_COLORS.selectionFill,selectionStroke:getThemeColor("--warning",.95,e)||DEFAULT_OVERLAY_COLORS.selectionStroke,shadow:getThemeColor("--background",.86,e)||DEFAULT_OVERLAY_COLORS.shadow,viewportFill:getThemeColor("--background",.16,e)||DEFAULT_OVERLAY_COLORS.viewportFill,viewportStroke:getThemeColor("--foreground",.95,e)||DEFAULT_OVERLAY_COLORS.viewportStroke})},[]),k=external_react_useCallback(()=>{let e=l.current,t=u.current;if(!e)return;let r=e.getContext("2d");if(!r||(r.clearRect(0,0,e.width,e.height),!t?.sourceSize.width||!t.sourceSize.height))return;let{selectionFill:n,selectionStroke:a,shadow:i,viewportFill:o,viewportStroke:s}=c.current,h=resolveHeatmapOverviewViewportRect(t),p=Math.max(1,Math.min(window.devicePixelRatio||1,MAX_DEVICE_PIXEL_RATIO)),f=h.left*e.width,m=h.top*e.height,g=Math.max(h.width*e.width,2*p),b=Math.max(h.height*e.height,2*p);r.save(),r.fillStyle=o,r.strokeStyle=s,r.lineWidth=p,r.shadowColor=i,r.shadowBlur=2*p,r.fillRect(f,m,g,b),r.strokeRect(f+p/2,m+p/2,Math.max(0,Math.min(g-p,e.width-f-p)),Math.max(0,Math.min(b-p,e.height-m-p))),r.restore();let v=d.current;if(!v)return;let w=resolveHeatmapOverviewContinuousSourceRangeRect(t,v),y=w.left*e.width,x=w.top*e.height,k=Math.max(w.width*e.width,2*p),S=Math.max(w.height*e.height,2*p);r.save(),r.fillStyle=n,r.strokeStyle=a,r.lineWidth=p,r.setLineDash([3*p,2*p]),r.shadowColor=i,r.shadowBlur=2*p,r.fillRect(y,x,k,S),r.strokeRect(y+p/2,x+p/2,Math.max(0,Math.min(k-p,e.width-y-p)),Math.max(0,Math.min(S-p,e.height-x-p))),r.restore()},[]),S=external_react_useCallback(e=>{g.current||=e,a.current?.hidden||null===m.current&&(m.current=window.requestAnimationFrame(()=>{m.current=null,g.current&&(g.current=!1,y()),k()}))},[y,k]),D=external_react_useCallback(()=>{let e=i.current,t=o.current,r=l.current;if(!e||!t||!r)return;let n=e.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,MAX_DEVICE_PIXEL_RATIO),s=Math.max(1,Math.min(MAX_BACKING_WIDTH,Math.round(n.width*a))),c=Math.max(1,Math.min(MAX_BACKING_HEIGHT,Math.round(n.height*a)));(t.width!==s||t.height!==c||r.width!==s||r.height!==c)&&(t.width=s,t.height=c,r.width=s,r.height=c,S(!0))},[S]),M=external_react_useCallback(e=>{let t=h.current!==e.rawData;u.current=e;let r=isHeatmapViewportFullRange(e);if(a.current&&(a.current.hidden=r),r){g.current||=t,w.current=null,a.current?.removeAttribute("data-dragging"),v.current=void 0,null!==m.current&&(window.cancelAnimationFrame(m.current),m.current=null),null!==b.current&&(window.cancelAnimationFrame(b.current),b.current=null),l.current&&(l.current.style.cursor="grab");return}D(),S(t)},[D,S]);useImperativeHandle(r,()=>({update:M}),[M]),external_react_useEffect(()=>{let t=withWaterfallAnalyzerSYNC(e)?.getSnapshot();t&&M(t)},[e,M]),external_react_useEffect(()=>{S(!0)},[n,S]),external_react_useEffect(()=>(x(),subscribeChartsThemeChange(()=>{x(),S(!0)})),[S,x]),external_react_useEffect(()=>{let t=e=>{d.current=e,S(!1)},r=subscribeHeatmapCaptureSelection(e,t);return t(getHeatmapCaptureSelection(e)),r},[e,S]),external_react_useEffect(()=>{if(e)return handleColor(e,"HeatmapOverview",e=>{let t=normalizePalette(e);t&&(p.current=t,S(!0))})},[e,S]),external_react_useEffect(()=>{D();let e=i.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(D);return t.observe(e),()=>t.disconnect()},[D]),external_react_useEffect(()=>()=>{null!==m.current&&window.cancelAnimationFrame(m.current),null!==b.current&&window.cancelAnimationFrame(b.current)},[]);let F=external_react_useCallback(t=>{let r=withWaterfallAnalyzerSYNC(e),n=r?.getSnapshot();!r||!n||isHeatmapViewportRangeEqual(n,t)||r.updateSamplingRange(toWaterfallSamplingOptions(t))},[e]),C=external_react_useCallback(e=>{v.current=e,null===b.current&&(b.current=window.requestAnimationFrame(()=>{b.current=null;let e=v.current;v.current=void 0,e&&F(e)}))},[F]),E=external_react_useCallback(e=>{let t=e.currentTarget.getBoundingClientRect();return{left:t.width?(e.clientX-t.left)/t.width:0,top:t.height?(e.clientY-t.top)/t.height:0}},[]),A=external_react_useCallback(e=>{if(0!==e.button)return;let t=u.current;if(!t?.sourceSize.width||!t.sourceSize.height)return;let r=E(e),n=resolveHeatmapOverviewSourcePoint(t,r),i=isHeatmapOverviewSourcePointInViewport(t,n),o=d.current;if(!i&&o&&!isHeatmapContinuousSourceRangeVisibleInViewport(t,o)){let r=e.currentTarget.getBoundingClientRect();if(isHeatmapOverviewSourcePointInContinuousRange(o,n,{x:r.width?6*t.sourceSize.width/r.width:0,y:r.height?6*t.sourceSize.height/r.height:0}))return void C(calculateHeatmapOverviewContinuousSourceRangeCenteredRange(t,o))}i?(w.current={pointerId:e.pointerId,grabOffset:{x:n.x-t.range.x[0],y:n.y-t.range.y[0]}},a.current?.setAttribute("data-dragging","true"),e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.style.cursor="grabbing",e.preventDefault()):C(calculateHeatmapOverviewCenteredRange(t,r))},[E,C]),N=external_react_useCallback(e=>{let t=w.current,r=u.current;t&&t.pointerId===e.pointerId&&r&&C(calculateHeatmapOverviewDragRange(r,E(e),t.grabOffset))},[E,C]),T=external_react_useCallback(e=>{w.current?.pointerId===e.pointerId&&(w.current=null,a.current?.removeAttribute("data-dragging"),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),e.currentTarget.style.cursor="grab")},[]);return /*#__PURE__*/jsx_runtime_jsx("aside",{ref:a,"aria-label":"瀑布图全景导航",className:"group absolute right-2 top-2 z-[6] isolate flex h-[14%] w-[14%] overflow-visible before:pointer-events-none before:absolute before:-inset-1 before:z-0 before:rounded-md before:bg-foreground/20 before:opacity-75 before:shadow-sm before:transition-opacity before:duration-100 hover:before:opacity-90 focus-within:before:opacity-90 data-[dragging=true]:before:opacity-100",hidden:!0,children:/*#__PURE__*/jsxs("div",{ref:i,className:"relative z-[1] h-full min-h-0 w-full overflow-hidden rounded-sm",children:[/*#__PURE__*/jsx_runtime_jsx("canvas",{ref:o,className:"pointer-events-none absolute inset-0 h-full w-full opacity-60 transition-opacity duration-100 group-hover:opacity-90 group-focus-within:opacity-90 group-data-[dragging=true]:opacity-100"}),/*#__PURE__*/jsx_runtime_jsx("canvas",{ref:l,className:"absolute inset-0 h-full w-full touch-none cursor-grab opacity-80 outline-none transition-opacity duration-100 group-hover:opacity-100 group-focus-within:opacity-100 group-data-[dragging=true]:opacity-100 focus-visible:ring-1 focus-visible:ring-ring","aria-label":"瀑布图全景;点击空白区域居中,点击框选范围定位,拖动视口框平移,双击恢复全景",tabIndex:0,onContextMenu:e=>e.preventDefault(),onDoubleClick:e=>{e.preventDefault(),e.stopPropagation(),t()},onLostPointerCapture:T,onPointerCancel:T,onPointerDown:A,onPointerMove:N,onPointerUp:T})]})})});HeatmapOverview.displayName="HeatmapOverview";let Overview=HeatmapOverview,setAnalyzerWaterfallData=(e,t)=>{let r=normalizeHeatmapFrames(t);return e.setData(r)},Heatmap_Chart_Chart=({publish:e,heatmapDefaultData:t})=>{let{state:{globalID:r,zoom:n},dispatch:a}=useStore_useStore(),i=!0===n.xy&&!1!==n.show,o=i&&n.overview?.show===!0,l=external_react_useRef(i),s=external_react_useRef(r),c=external_react_useRef(null),u=external_react_useRef(null),d=external_react_useRef(!1),h=external_react_useRef(!1),p=external_react_useRef(!1),f=external_react_useRef(t),m=external_react_useRef(convertToTimestampedArrays(t??[]));l.current=i,s.current=r;let g=external_react_useCallback(e=>{let t=s.current;if(!t)return;let r={range:{x:e.range.x,y:e.range.y},sourceSize:e.sourceSize},n=e.sourceSize.width>0?{start:e.range.x[0],end:e.range.x[1]-1}:{start:0,end:0};a({payload:t=>{let a=t.waterfallViewport,i=a.sourceSize.width!==e.sourceSize.width||a.sourceSize.height!==e.sourceSize.height||a.range.x[0]!==e.range.x[0]||a.range.x[1]!==e.range.x[1]||a.range.y[0]!==e.range.y[0]||a.range.y[1]!==e.range.y[1],o=t.zoom.interval.start!==n.start||t.zoom.interval.end!==n.end||null!==t.zoom.style;return i||o?{...i?{waterfallViewport:r}:{},...o?{zoom:{...t.zoom,interval:n,style:null,isScanSegmentsUpdateMagnify:!1}}:{}}:null}}),passThrough(t,constants_ModuleType.Heatmap)({pstype:constants_PSType.Render,data:e.data}),u.current?.update(e)},[a]),b=external_react_useCallback(e=>{if(d.current=e,!e||!l.current)return;let t=c.current,r=m.current;t&&r.length>0&&setAnalyzerWaterfallData(t,r)},[]);external_react_useEffect(()=>{r&&(withDatabase(r).getAllRawData=e=>({...getDefaultData().getAllRawData(e),waterfallData:m.current}))},[r]),external_react_useEffect(()=>{if(!r)return;if(!i){if(c.current=null,withWaterfallAnalyzerSYNC(r,null),h.current){h.current=!1;let e=m.current.reduce((e,t)=>Math.max(e,t.length),0);e>0?a({payload:t=>({waterfallViewport:{range:{x:[0,0],y:[0,0]},sourceSize:{width:0,height:0}},zoom:{...t.zoom,interval:{start:0,end:e-1},style:null,isScanSegmentsUpdateMagnify:!1}})}):a({payload:{waterfallViewport:{range:{x:[0,0],y:[0,0]},sourceSize:{width:0,height:0}}}})}m.current.length>0&&passThrough(r,constants_ModuleType.Heatmap)({pstype:constants_PSType.Render,data:m.current});return}let e=new WaterfallAnalyzer({onWaterfallUpdate:g});return c.current=e,h.current=!0,withWaterfallAnalyzerSYNC(r,e),d.current&&m.current.length>0&&setAnalyzerWaterfallData(e,m.current),()=>{c.current===e&&(c.current=null),withWaterfallAnalyzerSYNC(r,null)}},[a,r,g,i]),external_react_useEffect(()=>{if(Object.is(f.current,t))return;f.current=t,p.current=!1;let e=convertToTimestampedArrays(t??[]);m.current=e;let r=c.current;i&&d.current&&r&&setAnalyzerWaterfallData(r,e)},[t,i]);let v=useSpectrumRule(constants_ChartType.Heatmap),w=external_react_useCallback(()=>{let e=s.current;e&&resetHeatmapViewport(e)},[]);publish_usePublish({publish:e,resetViewport:w,subscribe:e=>{v(e);let{pstype:t}=e;if(t===constants_PSType.Heatmap){let{data:t,timestamps:n}=e,a=convertToTimestampedArrays(t,n);m.current=a;let i=c.current;l.current?d.current&&i&&setAnalyzerWaterfallData(i,a):passThrough(r,constants_ModuleType.Heatmap)({pstype:constants_PSType.Render,data:a})}if(t===constants_PSType.Reset||t===constants_PSType.Clear){p.current=!0,m.current=[],c.current?.setData([]),passThrough(r,constants_ModuleType.Heatmap)({pstype:constants_PSType.Reset}),t===constants_PSType.Reset&&passThrough(r,constants_PSType.Reset)(e),e.onFinally?.();return}passThrough(r,constants_ModuleType.Heatmap)(e)}});let y=!Object.is(f.current,t);return /*#__PURE__*/jsxs(components_Container,{children:[/*#__PURE__*/jsx_runtime_jsx(components_FlexBox,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Heatmap,{heatmapDefaultData:i||p.current&&!y?void 0:t,onSubscriptionReadyChange:b,overview:o?/*#__PURE__*/jsx_runtime_jsx(Overview,{ref:u,globalID:r,onResetViewport:w}):null,xyZoom:i})}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:constants_ChartType.Heatmap})]})},Heatmap_Chart=Heatmap_Chart_Chart,HeatmapChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,children:/*#__PURE__*/jsx_runtime_jsx(Heatmap_Chart,{...e})}),charts_Heatmap_Heatmap=withChartPublisher(HeatmapChart,"Heatmap"),charts_Heatmap=charts_Heatmap_Heatmap;function IQEye_IQEye({type:e="iqEye"}){let{chart:t,Chart:r}=hooks_useChart({Render:external_react_useMemo(()=>class extends IQRenderer{constructor(t){super({...t,type:e})}},[e])});return useModuleSubscription({moduleType:constants_ModuleType.IQEye,chart:t}),/*#__PURE__*/jsx_runtime_jsx(r,{})}let GridLinesSVG=({row:e=10,col:t=10,strokeColor:r="var(--chart-grid)",strokeWidth:n=1,strokeDasharray:a=4})=>{let i=external_react_useRef(null),[o,l]=external_react_useState([]),[s,c]=external_react_useState([]),u=()=>{let{width:o,height:s}=i.current?.getBoundingClientRect()??{width:0,height:0};if(o>0&&s>0&&e>0&&t>0){let i=[],u=[],d=o/t,h=s/e;for(let t=0;t<=e;t++){let e=Math.round(t*h);i.push(/*#__PURE__*/jsx_runtime_jsx("line",{x1:0,y1:e,x2:Math.round(o),y2:e,stroke:r,strokeWidth:n,strokeDasharray:a,vectorEffect:"non-scaling-stroke"},`h-${t}`))}for(let e=0;e<=t;e++){let t=Math.round(e*d);u.push(/*#__PURE__*/jsx_runtime_jsx("line",{x1:t,y1:0,x2:t,y2:Math.round(s),stroke:r,strokeWidth:n,strokeDasharray:a,vectorEffect:"non-scaling-stroke"},`v-${e}`))}l(i),c(u)}};return external_react_useEffect(()=>{let e=new ResizeObserver(()=>{u()});return i.current&&(e.observe(i.current),i.current.parentElement&&e.observe(i.current.parentElement)),u(),()=>{e.disconnect()}},[e,t,r,n]),/*#__PURE__*/jsxs("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",style:{width:"100%",height:"100%"},shapeRendering:"crispEdges",imageRendering:"pixelated",children:[o,s]})},GridLines_GridLinesSVG=GridLinesSVG,GridLines=()=>{let{state:{gridLines:e,segments:t,axisY:{range:r,step:n,restrict:a}}}=useStore_useStore(),i=external_react_useRef(null),[o,l]=external_react_useState({height:"0px",transform:"translateY(0px)",row:0,col:0});return(external_react_useEffect(()=>{if(!a||!r||!n)return;let[e,o]=a,s=o-e,[c,u]=r,d=u-c,h=i.current?.offsetHeight??0;l({height:`${s/d*h}px`,transform:`translateY(-${(o-u)/d*h}px)`,row:s/n,col:t.length>1?1:10})},[a,r,n,t.length,i.current]),e)?/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute right-0 top-0 z-[1] h-full w-full select-none overflow-hidden",ref:i,children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 flex h-full w-full items-center",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-0 top-0 h-full w-full box-border border-[color:var(--chart-grid)] [&>svg]:h-full [&>svg]:w-full",style:o,children:/*#__PURE__*/jsx_runtime_jsx(GridLines_GridLinesSVG,{col:o.col,row:o.row})})})}):null},components_GridLines=/*#__PURE__*/react.memo(GridLines);class Spectrum extends BaseRenderer{useRangeAutoFocus=()=>{};firstRenderAutoFocus=!1;constructor(e){super({chart:null,autoranging:!1,prevAutoRangeTime:0,id:"id",renderRange:constants_RANGE_DEFAULT,interval:1,series:{},globalID:"",...e})}init(){if(this.state.chart)return;let{id:e,renderRange:t,globalID:r}=this.state;e&&(this.trackCleanup(initSeriesSubscription(this)),this.state.chart=new Series({id:e,range:t}),this.initSeries(),this.useRangeAutoFocus=()=>{useRangeAutoFocus(r)()},this.trackCleanup(useRangeSet(r,e=>{this.setRange(e)})))}initSeries(){let{globalID:e}=this.state;if(!e)throw Error("globalID is required for series initialization");getSeriesWithGraphicType(e).forEach(e=>{this.setSeries(e,!0)}),this.state.chart?.draw()}updateSeries({data:e,extraData:t}){let{series:r,chart:n}=this.state;if(n){if(e){let t=Object.entries(r);for(let r=0;r<t.length;r+=1){let[a]=t[r],i=e[a];i&&SERIES_NAMES.includes(a)&&(n.render({name:a,data:i}),a===REAL_DATA_NAME&&this.updateMainSeries(i))}}if(t){let e=Object.entries(t);for(let t=0;t<e.length;t+=1){let[a,i]=e[t],o=r[a];i&&n.render({...o,name:a,data:i})}}}}updateMainSeries(e){let{autoranging:t,interval:r,prevAutoRangeTime:n,chart:a}=this.state;if(!a)return;let i=e.length;i!==r&&(this.state.interval=i,a.setIntervel(i));let o=Date.now();t&&o-n>1e3&&(this.state.prevAutoRangeTime=o,this.useRangeAutoFocus()),this.firstRenderAutoFocus||void 0===e.at(0)||(this.firstRenderAutoFocus=!0)}setSeries(e,t=!1){let{chart:r,series:n,globalID:a}=this.state,{name:i}=e;if(!r||!i||!e)return;let o={...n[i],...e},l=o.type;!e.type&&a&&(l=getCorrectSeriesType(a,i));let{color:s=SERIES[i]?.color,thickness:c=1,display:u=!1}=o,d={name:i,label:o.label,type:l||renderer_GraphicType.Line,color:s,thickness:c,display:u};if(this.state.series={...n,[i]:d},r.setSeries(d),!t&&a)try{updateSeries(a,{name:i,label:d.label||i,color:s,thickness:c,display:u,type:d.type})}catch(e){console.warn("Failed to update series in new management system:",e)}}setDisabledClearRect(e){this.state.chart?.updateProps({disabledClearRect:e})}setRange(e=this.state.renderRange){let{chart:t}=this.state,[r,n]=e;void 0!==r&&void 0!==n&&t&&(this.state.renderRange=e,t.setRange(e))}zoom(){let{chart:e,interval:t}=this.state;e&&e.setIntervel(t)}reset(){this.clear(),this.resize()}resize(){this.state.chart?this.hasRenderableContainerSize()&&(this.setRange(),this.zoom(),this.state.chart.resize()):this.initializeChartWhenReady()}clearChart(){this.clear()}}let IQLine=()=>{let{state:{axisY:{autoranging:e}}}=useStore_useStore(),{chart:t,Chart:r}=hooks_useChart({Render:Spectrum,params:{autoranging:e}});return external_react_useEffect(()=>{if(t){let{lineColor:e,pointColor:r}=getConfig("iq");t.setSeries({name:SERIES.realData.name,label:"IData",color:e}),t.setSeries({name:SERIES.maxData.name,label:"QData",color:r})}},[t]),useModuleSubscription({moduleType:constants_ModuleType.IQLine,chart:t,handleRender:(e,t)=>{let{IData:r,QData:n}=e;if(r&&n){let{min:e,max:a}=(0,array_0.jy)([...r,...n]),i=(a-e)/8;t.setRange?.([e-i,a+i]),t.updateSeries?.({data:{[SERIES.realData.name]:r,[SERIES.maxData.name]:n}})}},eventHandlers:{[constants_PSType.Reset]:(e,t)=>{t.reset()}}}),/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(components_GridLines,{}),/*#__PURE__*/jsx_runtime_jsx(r,{})]})},modules_IQLine=IQLine;function IQPlanisphere({type:e="iqPlanisphere"}){let{chart:t,Chart:r}=hooks_useChart({Render:external_react_useMemo(()=>class extends IQRenderer{constructor(t){super({...t,type:e})}},[e])});return useModuleSubscription({moduleType:constants_ModuleType.IQPlanisphere,chart:t}),/*#__PURE__*/jsx_runtime_jsx(components_Square,{children:/*#__PURE__*/jsx_runtime_jsx(r,{})})}let IQStream=({type:e="iqStream"})=>{let{chart:t,Chart:r}=hooks_useChart({Render:external_react_useMemo(()=>class extends IQRenderer{constructor(t){super({...t,type:e})}},[e])});return useModuleSubscription({moduleType:constants_ModuleType.IQStream,chart:t}),/*#__PURE__*/jsx_runtime_jsx(components_Square,{children:/*#__PURE__*/jsx_runtime_jsx(r,{})})},modules_IQStream=IQStream,IQ_Chart_Chart=e=>{let{type:t,publish:r}=e,{state:{globalID:n}}=useStore_useStore();return external_react_useEffect(()=>{n&&t===constants_ChartType.IQEye&&passThrough(n,constants_ModuleType.IQEye)({pstype:constants_PSType.Render})},[]),publish_usePublish({publish:r,subscribe:e=>{let r=normalizeRenderPublishEvent(e,{renderPSTypes:[constants_PSType.IQ]});switch(t){case constants_ChartType.IQEye:passThrough(n,constants_ModuleType.IQEye)(r);break;case constants_ChartType.IQLine:passThrough(n,constants_ModuleType.IQLine)(r);break;case constants_ChartType.IQPlanisphere:passThrough(n,constants_ModuleType.IQPlanisphere)(r);break;case constants_ChartType.IQStream:passThrough(n,constants_ModuleType.IQStream)(r)}}}),/*#__PURE__*/jsx_runtime_jsx(components_Container,{children:/*#__PURE__*/jsx_runtime_jsx(external_react_useMemo(()=>{switch(t){case constants_ChartType.IQEye:return IQEye_IQEye;case constants_ChartType.IQLine:return modules_IQLine;case constants_ChartType.IQPlanisphere:return IQPlanisphere;case constants_ChartType.IQStream:return modules_IQStream;default:return IQPlanisphere}},[t]),{})})},IQ_Chart=IQ_Chart_Chart,IQChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{system:{padding:!1,border:!1},...e,children:/*#__PURE__*/jsx_runtime_jsx(IQ_Chart,{...e})}),IQ_IQ=withChartPublisher(IQChart,"IQ"),charts_IQ=IQ_IQ,Reset_modes=Object.values(constants_ModuleType),Reset=()=>{let{state:{globalID:e,publish:t}}=useStore_useStore();return /*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{onClick:()=>{t?.({pstype:constants_PSType.Reset}),Reset_modes.forEach(t=>{passThrough(e,t)({pstype:constants_PSType.Reset})})},title:"重置",children:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M512 160c-141.6 0-265.6 76.8-332.8 192l-76.8-76.8v224h224l-89.6-89.6C288 307.2 390.4 240 512 240c159.2 0 288 128.8 288 288s-128.8 288-288 288c-115.2 0-214.4-67.2-262.4-164.8l-68.8 36.8C240 800 364.8 880 512 880c194.4 0 352-157.6 352-352S706.4 160 512 160z",fill:"currentColor"})})})},controls_Reset=Reset,SegmentsDisplayControl=()=>{let{state:{segments:e,globalID:t}}=useStore_useStore(),[r,n]=external_react_useState([]),[a,i]=external_react_useState(null),o=e.totalPoints??0;external_react_useEffect(()=>{n(e.map(e=>({display:!1,ratio:o>0?e.point/o:0})))},[e,o]);let l=external_react_useCallback(e=>{let a="number"==typeof e?e:null;n(r.map((e,t)=>({...e,display:t===a}))),i(a),SET_SEGMENTS_DISPLAY(t)(a??void 0)},[r,t]);return /*#__PURE__*/jsx_runtime_jsx(ToolbarDropdown,{value:a,options:[{value:null,label:"所有频段"},...e.map((e,t)=>({value:t,label:`频段 ${e.start} - ${e.stop}`}))],onChange:l})},controls_SegmentsDisplayControl=SegmentsDisplayControl,SeriesControl=({type:e})=>{let{state:{globalID:t}}=useStore_useStore(),{mode:r}=useSeriesManager(t),n=external_react_useCallback(()=>{e===constants_ChartType.MScan||e===constants_ChartType.ScanDF360||t&&toggleSeriesMode(t)},[t,e]),a=external_react_useMemo(()=>e===constants_ChartType.MScan||e===constants_ChartType.ScanDF360?"图形模式切换已禁用":`当前图形模式:${SERIES_MODES[r]?.label||r}`,[r,e]),i=e===constants_ChartType.MScan||e===constants_ChartType.ScanDF360,o=external_react_useMemo(()=>()=>{switch(r){case"bar":return /*#__PURE__*/jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("rect",{x:"2",y:"8",width:"2",height:"6",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"5",y:"4",width:"2",height:"10",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"8",y:"6",width:"2",height:"8",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"11",y:"2",width:"2",height:"12",fill:"currentColor"})]});case"stepline":return /*#__PURE__*/jsx_runtime_jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M2 12H4V8H6V8H8V4H10V4H12V2H14",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})});case"line":return /*#__PURE__*/jsx_runtime_jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M2 12L5 8L8 10L11 4L14 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})});case"area":return /*#__PURE__*/jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M2 12L5 8L8 10L11 4L14 6V14H2V12Z",fill:"currentColor",opacity:"0.6"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M2 12L5 8L8 10L11 4L14 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]});default:return null}},[r]);return /*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{title:a,disabled:i,onClick:i?void 0:n,className:cn_cn(i&&"text-muted-foreground"),children:o()})},controls_SeriesControl=SeriesControl,SeriesDisplayControl=()=>{let{state:{globalID:e,series:t}}=useStore_useStore(),r=useFilteredSeries(e);external_react_useEffect(()=>{if(!e||!t?.forceDisplay)return;let n=r.filter(e=>!e.display);n.length>0&&batchUpdateSeries(e,n.map(({name:e})=>({name:e,display:!0})))},[e,t?.forceDisplay,r.length]);let n=external_react_useCallback(t=>{e&&0!==t.length&&batchUpdateSeries(e,t)},[e]),a=external_react_useCallback((e,t)=>{n([{name:e,display:t}])},[n]),i=external_react_useCallback(e=>{let t=r.filter(t=>t.display!==e).map(t=>({name:t.name,display:e}));t.length>0&&n(t)},[r,n]),o=external_react_useMemo(()=>{let e=r.every(e=>e.display);return[{label:e?"全不选":"全选",value:"__toggle_all__",onSelect:()=>i(!e),render:()=>/*#__PURE__*/jsx_runtime_jsx("span",{className:"inline-flex w-full text-xs font-medium",children:e?"全不选":"全选"})},...r.map(e=>{let t=e.display?"text-foreground opacity-100":"font-normal text-muted-foreground opacity-70";return{label:e.label||e.name,value:e.name,onSelect:()=>a(e.name,!e.display),render:()=>/*#__PURE__*/jsxs("div",{className:"flex w-full min-w-0 items-center gap-[var(--size-gap-base)]",children:[/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:cn_cn("inline-flex h-3.5 w-3.5 shrink-0 rounded-[var(--radius-micro)] border transition-colors",e.display?"border-transparent":"border-border/70 bg-transparent opacity-55"),style:{backgroundColor:e.display?e.color:"transparent"}}),/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn("min-w-0 truncate text-xs",t),children:e.label||e.name})]})}})]},[r,a,i]);return /*#__PURE__*/jsx_runtime_jsx(ToolbarIconDropdown,{value:external_react_useMemo(()=>{let e=r.filter(e=>e.display).length,t=r.length;return 0===e?"无选择":e===t?"全部":`${e}/${t}`},[r]),options:o,title:"系列显示控制",icon:/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M930.909091 896H93.090909c-18.618182 0-34.909091-16.290909-34.909091-34.909091V162.909091c0-18.618182 16.290909-34.909091 34.909091-34.909091h837.818182c18.618182 0 34.909091 16.290909 34.909091 34.909091v698.181818c0 18.618182-16.290909 34.909091-34.909091 34.909091z m-802.909091-69.818182h770.327273v-628.363636H128v628.363636z",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M232.727273 640c-4.654545 0-9.309091 0-13.963637-2.327273-16.290909-6.981818-25.6-27.927273-18.618181-44.218182l116.363636-279.272727c4.654545-11.636364 16.290909-20.945455 30.254545-20.945454 13.963636 0 25.6 4.654545 32.581819 16.290909l83.781818 146.618182H814.545455c18.618182 0 34.909091 16.290909 34.90909 34.90909s-16.290909 34.909091-34.90909 34.909091H442.181818c-11.636364 0-23.272727-6.981818-30.254545-16.290909l-58.181818-102.4-90.763637 216.436364c-4.654545 6.981818-16.290909 16.290909-30.254545 16.290909zM814.545455 663.272727H488.727273c-18.618182 0-34.909091-16.290909-34.909091-34.909091s16.290909-34.909091 34.909091-34.909091h325.818182c18.618182 0 34.909091 16.290909 34.90909 34.909091s-16.290909 34.909091-34.90909 34.909091z",fill:"currentColor"})]}),closeOnSelect:!1})},controls_SeriesDisplayControl=SeriesDisplayControl,ZoomSwitch=()=>{let{state:{zoom:e,segments:t},dispatch:r}=useStore_useStore(),{show:n,autoCloseTimeout:a,interval:{start:i,end:o}}=e,l=t.totalPoints??0,s=Math.max(l-1,0),[c,u]=external_react_useState(!0),d=external_react_useRef(null);external_react_useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),external_react_useEffect(()=>{d.current&&clearTimeout(d.current),u(!1),d.current=setTimeout(()=>{h()},a)},[i,o,a]);let h=external_react_useCallback(()=>{r({payload:{zoom:buildZoomFullRange(e,l)}}),u(!0)},[e,l,r]),p=external_react_useMemo(()=>l?{background:`linear-gradient(to right,
3819
+ */let hasA11yProp=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},LucideContext=createContext({});function LucideProvider({children:e,size:t,color:r,strokeWidth:n,absoluteStrokeWidth:a,className:i}){let o=useMemo(()=>({size:t,color:r,strokeWidth:n,absoluteStrokeWidth:a,className:i}),[t,r,n,a,i]);return createElement(LucideContext.Provider,{value:o},e)}let useLucideContext=()=>useContext(LucideContext),Icon_Icon=forwardRef(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...l},s)=>{let{size:c=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:h="currentColor",className:p=""}=useLucideContext()??{},f=n??d?24*Number(r??u)/Number(t??c):r??u;return external_react_createElement("svg",{ref:s,...defaultAttributes,width:t??c??defaultAttributes.width,height:t??c??defaultAttributes.height,stroke:e??h,strokeWidth:f,className:mergeClasses("lucide",p,a),...!i&&!hasA11yProp(l)&&{"aria-hidden":"true"},...l},[...o.map(([e,t])=>external_react_createElement(e,t)),...Array.isArray(i)?i:[i]])}),createLucideIcon=(e,t)=>{let r=forwardRef(({className:r,...n},a)=>external_react_createElement(Icon_Icon,{ref:a,iconNode:t,className:mergeClasses(`lucide-${toKebabCase(toPascalCase(e))}`,`lucide-${e}`,r),...n}));return r.displayName=toPascalCase(e),r},__iconNode=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],Move=createLucideIcon("move",__iconNode),DEFAULT_CONFIG={enabled:!0,defaultRect:{position:70,height:30,leftPosition:0,width:100},minSize:0,maxSize:100,snapThreshold:2,onChange:()=>{},onDragEnd:()=>{},preserveDefaultRect:!1,bounds:{bottom:100,left:0,right:100,top:0}},useDragSelect=(e={})=>{let{enabled:t,defaultRect:r,minSize:n,minWidth:a,minHeight:i,maxSize:o,snapThreshold:l,onChange:s,onDragEnd:c,preserveDefaultRect:u,bounds:d}={...DEFAULT_CONFIG,...e},h=a??n,p=i??n,[f,m]=external_react_useState({position:r.position??DEFAULT_CONFIG.defaultRect.position,height:u?r.height??DEFAULT_CONFIG.defaultRect.height:Math.min(r.height??DEFAULT_CONFIG.defaultRect.height,o),leftPosition:r.leftPosition??DEFAULT_CONFIG.defaultRect.leftPosition,width:r.width??DEFAULT_CONFIG.defaultRect.width}),[g,b]=external_react_useState(!1),[v,w]=external_react_useState(null),y=external_react_useRef(null),x=external_react_useRef({x:0,y:0,rect:f}),k=external_react_useRef(f);k.current=f,external_react_useEffect(()=>{if(!g&&r){let e={position:r.position??f.position,height:void 0!==r.height?u?r.height:Math.min(r.height,o):f.height,leftPosition:r.leftPosition??f.leftPosition,width:r.width??f.width};(Math.abs(e.position-f.position)>.01||Math.abs(e.height-f.height)>.01||Math.abs(e.leftPosition-f.leftPosition)>.01||Math.abs(e.width-f.width)>.01)&&m(e)}},[r?.position,r?.height,r?.leftPosition,r?.width,g,o,u]);let S=external_react_useCallback((e,r,n=f)=>{t&&(e.preventDefault(),b(!0),w(r),x.current={x:e.clientX,y:e.clientY,rect:{...n}})},[t,f]),D=external_react_useCallback(e=>{if(!g||!y.current)return;let t=y.current,{x:r,y:n,rect:a}=x.current,i=(e.clientY-n)/t.clientHeight*100,c=(e.clientX-r)/t.clientWidth*100,{position:u,height:f,leftPosition:b,width:w}=a;switch(v){case"top":{let e=a.position+a.height;u=Math.max(d.top,Math.min(a.position+i,e-p)),(f=e-u)>o&&(f=o,u=e-o);break}case"bottom":f=Math.max(p,Math.min(o,a.height+i,d.bottom-a.position));break;case"left":{let e=a.leftPosition+a.width;b=Math.max(d.left,Math.min(a.leftPosition+c,e-h)),(w=e-b)>o&&(w=o,b=e-o);break}case"right":w=Math.max(h,Math.min(o,a.width+c,d.right-a.leftPosition));break;case"middle":u=Math.max(d.top,Math.min(a.position+i,d.bottom-a.height)),b=Math.max(d.left,Math.min(a.leftPosition+c,d.right-a.width))}u<d.top+l&&(u=d.top),u+f>d.bottom-l&&(u=d.bottom-f),b<d.left+l&&(b=d.left),b+w>d.right-l&&(b=d.right-w);let S={position:u,height:f,leftPosition:b,width:w};k.current=S,m(S),s(S)},[g,v,h,p,o,l,d.top,d.bottom,d.left,d.right,s]),M=external_react_useCallback(()=>{g&&c(k.current),b(!1),w(null)},[g,c]);external_react_useEffect(()=>{if(t&&g)return document.addEventListener("mousemove",D),document.addEventListener("mouseup",M),document.addEventListener("mouseleave",M),window.addEventListener("blur",M),()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",M),document.removeEventListener("mouseleave",M),window.removeEventListener("blur",M)}},[t,g,D,M]);let F=external_react_useCallback(e=>{let t={...f,...e};m(t),s(t)},[f,s]);return{rect:f,isDragging:g,dragType:v,containerRef:y,handleMouseDown:S,resetRect:F,setRect:e=>{m(e),s(e)}}},SURFACE_GAP=4,MIN_VISUAL_SPAN=14,HANDLE_HIT_SIZE=10,VIEWPORT_BOUNDS={bottom:100,left:0,right:100,top:0},PROJECTED_EDGE_HANDLE_CLASS="pointer-events-auto absolute z-[2] appearance-none rounded-[3px] border-0 p-0 transition-[background-color,box-shadow] duration-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring [background:color-mix(in_srgb,var(--foreground)_18%,transparent)] [box-shadow:inset_0_0_0_1px_color-mix(in_srgb,var(--background)_72%,transparent),0_1px_3px_color-mix(in_srgb,var(--foreground)_28%,transparent)] hover:[background:color-mix(in_srgb,var(--foreground)_32%,transparent)] hover:[box-shadow:inset_0_0_0_1px_color-mix(in_srgb,var(--background)_86%,transparent),0_1px_4px_color-mix(in_srgb,var(--foreground)_42%,transparent)]",PROJECTED_MOVE_HANDLE_CLASS="pointer-events-auto absolute z-[3] flex size-5 -translate-x-1/2 -translate-y-1/2 cursor-move items-center justify-center appearance-none rounded-sm border-0 p-0 text-foreground outline-none transition-[background-color,box-shadow] duration-100 focus-visible:ring-1 focus-visible:ring-ring [background:color-mix(in_srgb,var(--background)_76%,var(--foreground)_24%)] [box-shadow:0_0_0_1px_color-mix(in_srgb,var(--background)_82%,transparent),0_1px_4px_color-mix(in_srgb,var(--foreground)_32%,transparent)] hover:[background:color-mix(in_srgb,var(--background)_64%,var(--foreground)_36%)]",ProjectedEdgeHandle=({ariaLabel:e,className:t,direction:r,onMouseDown:n,style:a})=>/*#__PURE__*/jsx_runtime_jsx("button",{type:"button",tabIndex:-1,"aria-label":e,className:cn_cn(PROJECTED_EDGE_HANDLE_CLASS,t),style:a,onMouseDown:n,children:/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:cn_cn("pointer-events-none absolute left-1/2 top-1/2 rounded-full bg-foreground/85","horizontal"===r?"h-[2px] -translate-x-1/2 -translate-y-1/2":"w-[2px] -translate-x-1/2 -translate-y-1/2"),style:"horizontal"===r?{width:"clamp(10px, 18%, 24px)"}:{height:"clamp(10px, 18%, 24px)"}})}),DragSelectBox_clamp=(e,t,r)=>Math.min(Math.max(e,t),r),isComparableLabelValue=e=>"string"==typeof e||"number"==typeof e,normalizeLabels=e=>{if(!e)return e;let t={...e};return isComparableLabelValue(t.left)&&isComparableLabelValue(t.right)&&String(t.left)===String(t.right)&&(t.right=void 0),isComparableLabelValue(t.top)&&isComparableLabelValue(t.bottom)&&String(t.top)===String(t.bottom)&&(t.top=void 0),t},getDisplaySpan=({start:e,length:t,minLength:r,maxLength:n})=>{let a=Math.max(0,t),i=Math.min(Math.max(a,r),n),o=e+a/2,l=o-i/2,s=o+i/2;l<0&&(s=Math.min(n,s-l),l=0),s>n&&(l=Math.max(0,l-(s-n)),s=n);let c=s-l;return{start:l,end:s,length:c}},getProjectedDisplaySpan=({start:e,length:t,minLength:r})=>{let n=Math.max(0,t),a=Math.max(n,r),i=e+n/2-a/2;return{start:i,end:i+a,length:a}},getDisplayRectBox=({rect:e,containerWidth:t,containerHeight:r,variant:n="contained"})=>{let a=e.leftPosition/100*t,i=e.position/100*r,o=e.width/100*t,l=e.height/100*r;if("projected"===n){let e=getProjectedDisplaySpan({start:a,length:o,minLength:MIN_VISUAL_SPAN}),t=getProjectedDisplaySpan({start:i,length:l,minLength:MIN_VISUAL_SPAN});return{left:e.start,top:t.start,width:e.length,height:t.length,right:e.end,bottom:t.end,centerX:e.start+e.length/2,centerY:t.start+t.length/2}}let s=getDisplaySpan({start:a,length:o,minLength:MIN_VISUAL_SPAN,maxLength:t}),c=getDisplaySpan({start:i,length:l,minLength:MIN_VISUAL_SPAN,maxLength:r});return{left:s.start,top:c.start,width:s.length,height:c.length,right:s.end,bottom:c.end,centerX:s.start+s.length/2,centerY:c.start+c.length/2}},getOverlapArea=(e,t)=>Math.max(0,Math.min(e.left+e.width,t.left+t.width)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.top+e.height,t.top+t.height)-Math.max(e.top,t.top)),placementsEqual=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(r=>{let n=e[r],a=t[r];return n&&a&&.5>Math.abs(n.left-a.left)&&.5>Math.abs(n.top-a.top)}),createOverlayBox=({left:e,top:t,size:r,containerWidth:n,containerHeight:a,score:i})=>{let o=Math.max(0,n-r.width),l=Math.max(0,a-r.height),s=DragSelectBox_clamp(e,0,o),c=DragSelectBox_clamp(t,0,l),u=Math.abs(s-e)+Math.abs(c-t);return{left:s,top:c,width:r.width,height:r.height,score:i+2*u}},getCandidateBoxes=({key:e,size:t,rectBox:r,containerWidth:n,containerHeight:a})=>{let i=[],o="middle"===e&&(r.width<=t.width+2*SURFACE_GAP||r.height<=t.height+2*SURFACE_GAP),l=(e,r,o)=>{i.push(createOverlayBox({left:e,top:r,size:t,containerWidth:n,containerHeight:a,score:o}))},s=r.left-t.width-SURFACE_GAP,c=r.right+SURFACE_GAP,u=r.top-t.height-SURFACE_GAP,d=r.bottom+SURFACE_GAP,h=r.left+SURFACE_GAP,p=r.right-t.width-SURFACE_GAP,f=r.top+SURFACE_GAP,m=r.bottom-t.height-SURFACE_GAP,g=r.centerX-t.width/2,b=r.centerY-t.height/2;switch(e){case"left":l(s,b,0),l(h,b,6),l(s,r.top,10),l(s,r.bottom-t.height,11),l(h,r.top,16),l(h,r.bottom-t.height,17),l(r.left,u,22),l(r.left,d,24);break;case"right":l(c,b,0),l(p,b,6),l(c,r.top,10),l(c,r.bottom-t.height,11),l(p,r.top,16),l(p,r.bottom-t.height,17),l(r.right-t.width,u,22),l(r.right-t.width,d,24);break;case"top":l(g,u,0),l(g,f,6),l(r.left,u,10),l(r.right-t.width,u,11),l(r.left+SURFACE_GAP,f,16),l(r.right-t.width-SURFACE_GAP,f,17),l(s,r.top,24),l(c,r.top,25);break;case"bottom":l(g,d,0),l(g,m,6),l(r.left,d,10),l(r.right-t.width,d,11),l(r.left+SURFACE_GAP,m,16),l(r.right-t.width-SURFACE_GAP,m,17),l(s,r.bottom-t.height,24),l(c,r.bottom-t.height,25);break;case"middle":o?(l(g,u,0),l(g,d,1),l(c,b,2),l(s,b,3),l(c,u,4),l(c,d,5),l(s,u,6),l(s,d,7),l(g,b,12)):(l(g,b,0),l(g,u,8),l(g,d,9),l(c,b,10),l(s,b,11),l(r.left,u,14),l(r.right-t.width,u,15),l(r.left,d,16),l(r.right-t.width,d,17))}return i},DragSelectBox=({enabled:e,defaultRect:t,minSize:r=0,minWidth:n,minHeight:a,maxSize:i=100,snapThreshold:o=2,onChange:l,onDragStart:s,onDragEnd:c,children:u,labels:d,className:h="",zIndex:p=7,showBoundaryLines:f=!1,variant:m="contained",interactionBounds:g=VIEWPORT_BOUNDS})=>{let b=external_react_useMemo(()=>normalizeLabels(d),[d?.top,d?.bottom,d?.left,d?.right]),{rect:v,containerRef:w,handleMouseDown:y}=useDragSelect({enabled:e,defaultRect:t,minSize:r,minWidth:n,minHeight:a,maxSize:"projected"===m?Math.max(i,g.right-g.left,g.bottom-g.top):i,snapThreshold:o,onChange:l,onDragEnd:c,preserveDefaultRect:"projected"===m,bounds:g}),x=v.leftPosition+Math.max(0,v.width),k=v.position+Math.max(0,v.height),S="projected"!==m||x>0&&v.leftPosition<100&&k>0&&v.position<100,D=DragSelectBox_clamp(v.leftPosition,0,100),M=DragSelectBox_clamp(x,0,100),F=DragSelectBox_clamp(v.position,0,100),C=DragSelectBox_clamp(k,0,100),E=M>D,N=C>F,A="projected"===m&&(v.leftPosition<VIEWPORT_BOUNDS.left||x>VIEWPORT_BOUNDS.right||v.position<VIEWPORT_BOUNDS.top||k>VIEWPORT_BOUNDS.bottom),T={left:(D+M)/2,top:(F+C)/2},[I,P]=external_react_useState(0),[z,_]=external_react_useState({width:0,height:0}),[O,L]=external_react_useState({}),q=external_react_useRef(null),$=external_react_useRef(null),j=external_react_useRef(null),H=external_react_useRef(null),B=external_react_useRef(null);external_react_useEffect(()=>{if(!e||!S||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>{P(e=>e+1)});return[w.current,q.current,$.current,j.current,H.current,B.current].filter(e=>null!==e).forEach(e=>{t.observe(e)}),()=>t.disconnect()},[e,S,!!b?.top,!!b?.bottom,!!b?.left,!!b?.right,!!u]),useLayoutEffect(()=>{let t=w.current;if(!e||!S||!t)return void L(e=>Object.keys(e).length>0?{}:e);let r=t.clientWidth,n=t.clientHeight;if(r<=0||n<=0)return;_(e=>e.width===r&&e.height===n?e:{width:r,height:n});let a=[["top",q.current],["bottom",$.current],["left",j.current],["right",H.current],["middle",B.current]].reduce((e,[t,r])=>(r&&(e[t]={width:r.offsetWidth,height:r.offsetHeight}),e),{}),i=getDisplayRectBox({rect:v,containerWidth:r,containerHeight:n,variant:m}),o={middle:4,bottom:3,left:2,right:2,top:1},l=["top","bottom","left","right","middle"].filter(e=>a[e]).sort((e,t)=>{let r=o[t]-o[e];if(0!==r)return r;let n=(a[e]?.width??0)*(a[e]?.height??0);return(a[t]?.width??0)*(a[t]?.height??0)-n}),s=[],c={};l.forEach(e=>{let t=a[e];if(!t)return;let o=getCandidateBoxes({key:e,size:t,rectBox:i,containerWidth:r,containerHeight:n}).map(e=>{let t=s.reduce((t,r)=>t+getOverlapArea(e,r),0),r=e.score+(t>0?2e4+10*t:0),n=Math.max(1,e.width*e.height);return{...e,overlapArea:t,overlapRatio:t/n,totalScore:r}}),l=o.filter(e=>0===e.overlapArea).sort((e,t)=>e.totalScore-t.totalScore)[0]??null??o.sort((e,t)=>e.totalScore-t.totalScore)[0]??null;!l||"middle"!==e&&l.overlapRatio>.2||(c[e]={left:l.left,top:l.top},s.push(l))}),L(e=>placementsEqual(e,c)?e:c)},[e,S,v.position,v.height,v.leftPosition,v.width,I,!!b?.top,!!b?.bottom,!!b?.left,!!b?.right,!!u,m]);let G={fontSize:"var(--size-font-second)",color:"var(--foreground)",border:"1px solid var(--border)",borderRadius:"var(--radius-control)",background:"color-mix(in srgb, var(--background) 80%, transparent)"},U=e=>{let t=O[e];return{left:t?.left??0,top:t?.top??0,visibility:t?"visible":"hidden"}},W=external_react_useMemo(()=>z.width<=0||z.height<=0?null:getDisplayRectBox({rect:v,containerWidth:z.width,containerHeight:z.height,variant:m}),[v.position,v.height,v.leftPosition,v.width,z.width,z.height,m]),V=W?Math.max(0,Math.min(6,W.width/4)):6,Y=W?Math.max(0,Math.min(6,W.height/4)):6,X=W?{top:W.top,height:W.height,left:W.left,width:W.width}:{top:`${v.position}%`,height:`${v.height}%`,left:`${v.leftPosition}%`,width:`${v.width}%`},K=e=>{let t={...v};switch(e){case"top":v.position<VIEWPORT_BOUNDS.top&&(t.position=VIEWPORT_BOUNDS.top,t.height=Math.max(0,v.position+v.height-VIEWPORT_BOUNDS.top));break;case"bottom":k>VIEWPORT_BOUNDS.bottom&&(t.height=Math.max(0,VIEWPORT_BOUNDS.bottom-v.position));break;case"left":v.leftPosition<VIEWPORT_BOUNDS.left&&(t.leftPosition=VIEWPORT_BOUNDS.left,t.width=Math.max(0,x-VIEWPORT_BOUNDS.left));break;case"right":x>VIEWPORT_BOUNDS.right&&(t.width=Math.max(0,VIEWPORT_BOUNDS.right-v.leftPosition))}return t},Q=(e,t,r)=>{s?.(t)!==!1&&(e.preventDefault(),e.stopPropagation(),y(e,t,r))};return e?/*#__PURE__*/jsxs(Zoom_ZoomViewportLayer,{className:cn_cn("left-0 top-0 h-full w-full overflow-hidden",h),ref:w,style:{zIndex:p},children:[f&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute left-0 right-0 top-0 h-px bg-border"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-px bg-border"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 top-0 w-px bg-border"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute bottom-0 right-0 top-0 w-px bg-border"})]}),S&&/*#__PURE__*/jsxs("div",{className:"group pointer-events-none absolute box-border",style:X,children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute inset-0 border-[2px] border-dashed border-foreground group-hover:border-[4px]"}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute left-0 w-full cursor-ns-resize [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_40%,transparent)]",style:{top:-HANDLE_HIT_SIZE/2,height:HANDLE_HIT_SIZE},onMouseDown:e=>Q(e,"top")}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute left-0 w-full cursor-ns-resize [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_40%,transparent)]",style:{bottom:-HANDLE_HIT_SIZE/2,height:HANDLE_HIT_SIZE},onMouseDown:e=>Q(e,"bottom")}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute top-0 h-full cursor-ew-resize [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_40%,transparent)]",style:{left:-HANDLE_HIT_SIZE/2,width:HANDLE_HIT_SIZE},onMouseDown:e=>Q(e,"left")}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute top-0 h-full cursor-ew-resize [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_40%,transparent)]",style:{right:-HANDLE_HIT_SIZE/2,width:HANDLE_HIT_SIZE},onMouseDown:e=>Q(e,"right")}),!A&&/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-auto absolute cursor-move [background:color-mix(in_srgb,var(--secondary)_15%,transparent)] hover:[background:color-mix(in_srgb,var(--secondary)_20%,transparent)]",style:{top:Y,bottom:Y,left:V,right:V},onMouseDown:e=>Q(e,"middle")})]}),A&&S&&E&&N&&/*#__PURE__*/jsx_runtime_jsx("button",{type:"button",tabIndex:-1,"aria-label":"移动框选范围",title:"移动框选范围",className:PROJECTED_MOVE_HANDLE_CLASS,style:{left:`clamp(10px, ${T.left}%, calc(100% - 10px))`,top:`clamp(10px, ${T.top}%, calc(100% - 10px))`},onMouseDown:e=>Q(e,"middle"),children:/*#__PURE__*/jsx_runtime_jsx(Move,{"aria-hidden":"true",className:"pointer-events-none size-3",strokeWidth:1.75})}),"projected"===m&&S&&/*#__PURE__*/jsxs(Fragment,{children:[v.position<0&&E&&/*#__PURE__*/jsx_runtime_jsx(ProjectedEdgeHandle,{ariaLabel:"调整框选上边界",direction:"horizontal",className:"top-0 h-[10px] cursor-ns-resize",style:{left:`${D}%`,minWidth:HANDLE_HIT_SIZE,width:`${M-D}%`},onMouseDown:e=>Q(e,"top",K("top"))}),k>100&&E&&/*#__PURE__*/jsx_runtime_jsx(ProjectedEdgeHandle,{ariaLabel:"调整框选下边界",direction:"horizontal",className:"bottom-0 h-[10px] cursor-ns-resize",style:{left:`${D}%`,minWidth:HANDLE_HIT_SIZE,width:`${M-D}%`},onMouseDown:e=>Q(e,"bottom",K("bottom"))}),v.leftPosition<0&&N&&/*#__PURE__*/jsx_runtime_jsx(ProjectedEdgeHandle,{ariaLabel:"调整框选左边界",direction:"vertical",className:"left-0 w-[10px] cursor-ew-resize",style:{height:`${C-F}%`,minHeight:HANDLE_HIT_SIZE,top:`${F}%`},onMouseDown:e=>Q(e,"left",K("left"))}),x>100&&N&&/*#__PURE__*/jsx_runtime_jsx(ProjectedEdgeHandle,{ariaLabel:"调整框选右边界",direction:"vertical",className:"right-0 w-[10px] cursor-ew-resize",style:{height:`${C-F}%`,minHeight:HANDLE_HIT_SIZE,top:`${F}%`},onMouseDown:e=>Q(e,"right",K("right"))})]}),S&&u&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:B,className:"pointer-events-none absolute",style:U("middle"),children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex items-start gap-0.5 whitespace-nowrap p-[var(--size-gap-base)]",style:{fontSize:"var(--size-font-second)",color:"var(--foreground)",border:"1px solid var(--border)",borderRadius:"var(--radius-control)",background:"color-mix(in srgb, var(--secondary) 80%, transparent)"},children:u})}),S&&b?.left&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:j,className:"pointer-events-none absolute whitespace-nowrap p-[calc(var(--size-gap-base)/2)]",style:{...G,...U("left")},children:b.left}),S&&b?.right&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:H,className:"pointer-events-none absolute whitespace-nowrap p-[calc(var(--size-gap-base)/2)]",style:{...G,...U("right")},children:b.right}),S&&b?.top&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:q,className:"pointer-events-none absolute whitespace-nowrap p-[calc(var(--size-gap-base)/2)]",style:{...G,...U("top")},children:b.top}),S&&b?.bottom&&/*#__PURE__*/jsx_runtime_jsx("div",{ref:$,className:"pointer-events-none absolute whitespace-nowrap p-[calc(var(--size-gap-base)/2)]",style:{...G,...U("bottom")},children:b.bottom})]}):null},components_DragSelectBox=DragSelectBox,sliderInfo_PRECISION=1e6,sliderInfo_clamp=(e,t,r)=>Math.min(r,Math.max(t,e)),resolveFrequencyExtent=e=>{if(!e)return null;let t=Number(e(0)),r=Number(e(100));return Number.isFinite(t)&&Number.isFinite(r)&&t!==r?[t,r]:null},resolveContinuousFrequencyFromSegments=(e,t,r)=>{if(!t?.length)return null;let n=100*sliderInfo_clamp(e,0,1),a=t.length-1;for(let e=0;e<t.length;e+=1){let i=t[e],o=Math.min(i.progress[0],i.progress[1]),l=Math.max(i.progress[0],i.progress[1]);if(!("start"===r?n>=o&&(n<l||e===a&&n<=l):(n>o||0===e)&&n<=l))continue;let s=l-o,c=s?(n-o)/s:0;return i.start+(i.stop-i.start)*c}return null},resolveFrequencyFromRatio=(e,t,r,n)=>{let a=r?.(100*sliderInfo_clamp(e,0,1)),i=void 0===a?0/0:Number(a);return Number.isFinite(i)?i:resolveContinuousFrequencyFromSegments(e,t,n)},resolveRatioFromFrequency=(e,t,r)=>{if(t?.length){let r=null;for(let n of t){let t=n.start,a=n.stop,i=Math.min(t,a),o=Math.max(t,a),l=n.progress[0]/100,s=n.progress[1]/100;if(e>=i&&e<=o){let r=a-t;return sliderInfo_clamp(l+(s-l)*(r?(e-t)/r:0),0,1)}for(let n of[{distance:Math.abs(e-t),ratio:l},{distance:Math.abs(e-a),ratio:s}])(!r||n.distance<r.distance)&&(r=n)}if(r)return sliderInfo_clamp(r.ratio,0,1)}let n=resolveFrequencyExtent(r);return n?sliderInfo_clamp((e-n[0])/(n[1]-n[0]),0,1):null},resolveHeatmapSliderFrequencyRatioRange=({frequencyFormat:e,frequencyRange:t,segments:r})=>{let n=resolveRatioFromFrequency(t[0],r,e),a=resolveRatioFromFrequency(t[1],r,e);return null===n||null===a?null:[Math.min(n,a),Math.max(n,a)]},resolveFrequencyRangeFromRatios=(e,t,r)=>{let n=resolveFrequencyFromRatio(e[0],t,r,"start"),a=resolveFrequencyFromRatio(e[1],t,r,"end");return null===n||null===a?null:[Math.min(n,a),Math.max(n,a)]},resolveHeatmapSliderSelectionFromRect=({frequencyFormat:e,rect:t,segments:r,waterfallSnapshot:n})=>{let a=resolveHeatmapProjectedContinuousSourceRange(n,{startLeft:t.leftPosition,endLeft:t.leftPosition+t.width,startTop:t.position+t.height,endTop:t.position});if(!a||n.sourceSize.width<=0)return null;let i=[a.x[0]/n.sourceSize.width,a.x[1]/n.sourceSize.width];return{frequency:resolveFrequencyRangeFromRatios(i,r,e),x:i,y:a.y}},resolveHeatmapSliderSelectionFromInteraction=({dragType:e,frequencyFormat:t,rect:r,segments:n,startSelection:a,waterfallSnapshot:i})=>{let o=resolveHeatmapSliderSelectionFromRect({frequencyFormat:t,rect:r,segments:n,waterfallSnapshot:i});if(!o||!a)return o;switch(e){case"left":return{frequency:o.frequency&&a.frequency?[o.frequency[0],a.frequency[1]]:o.frequency,x:[o.x[0],a.x[1]],y:a.y};case"right":return{frequency:o.frequency&&a.frequency?[a.frequency[0],o.frequency[1]]:o.frequency,x:[a.x[0],o.x[1]],y:a.y};case"top":return{frequency:a.frequency,x:a.x,y:[a.y[0],o.y[1]]};case"bottom":return{frequency:a.frequency,x:a.x,y:[o.y[0],a.y[1]]};case"middle":return o}},resolveHeatmapSliderSelectionSourceRange=({selection:e,waterfallSnapshot:t})=>{let{sourceSize:r}=t;if(r.width<=0||r.height<=0)return null;let n=sliderInfo_clamp(Math.min(e.x[0],e.x[1]),0,1),a=sliderInfo_clamp(Math.max(e.x[0],e.x[1]),n,1),i=sliderInfo_clamp(Math.min(e.y[0],e.y[1]),0,r.height),o=sliderInfo_clamp(Math.max(e.y[0],e.y[1]),i,r.height);return{x:[n*r.width,a*r.width],y:[i,o]}},calculateHeatmapSliderInfo=({formatBandwidth:e,frequencyFormat:t,heatmapData:r,rect:n,segments:a,selectionOverride:i,sourceRangeOverride:o,waterfallSnapshot:l})=>{let s=r.length;if(s<=0)return null;let{position:c,height:u,leftPosition:d,width:h}=n,p=l&&i?resolveHeatmapSliderSelectionSourceRange({selection:i,waterfallSnapshot:l}):null,f=o??(l&&p?quantizeHeatmapContinuousSourceRange(l,p):null)??(l?resolveHeatmapProjectedSourceRange(l,{startLeft:d,endLeft:d+h,startTop:c+u,endTop:c}):null),m=f??resolveHeatmapRowRange(c+u,c,s);if(!m)return null;let{startIndex:g,endIndex:b}=m,v=String(r[g]?.timestamp??""),w=String(r[b]?.timestamp??""),y=dateTimeToTimestamp(v),x=dateTimeToTimestamp(w),k=y>0&&x>0?Math.abs(x-y):0,S=f??resolveHeatmapColumnRange(d,d+h,resolveHeatmapGridInfo(r).columnCount);if(!S)return null;let{startCol:D,endCol:M}=S,F=l?.sourceSize.width??0,C=resolveFrequencyRangeFromRatios([(i?100*i.x[0]:o&&F>0?100*D/F:l?resolveHeatmapSourceLeft(d,l):d)/100,(i?100*i.x[1]:o&&F>0?(M+1)*100/F:l?resolveHeatmapSourceLeft(d+h,l):d+h)/100],a,t),E=i?.frequency?.[0]??C?.[0],N=i?.frequency?.[1]??C?.[1],A=Number.isFinite(E)?Math.round(Number(E)*sliderInfo_PRECISION)/sliderInfo_PRECISION:0,T=Number.isFinite(N)?Math.round(Number(N)*sliderInfo_PRECISION)/sliderInfo_PRECISION:0,I=Math.abs(T-A);return{startIndex:g,endIndex:b,startTimestamp:v,endTimestamp:w,duration:k,startCol:D,endCol:M,startFrequency:A,startFrequencyFormat:String(A),endFrequency:T,endFrequencyFormat:String(T),bandwidth:I,bandwidthFormat:e(I)}},DEFAULT_HEIGHT=30,DEFAULT_POSITION=100-DEFAULT_HEIGHT,MAX_SIZE=100,MIN_SIZE=0,SNAP_THRESHOLD=2,DEFAULT_RECT={position:DEFAULT_POSITION,height:Math.min(DEFAULT_HEIGHT,MAX_SIZE),leftPosition:0,width:100},isRectEqual=(e,t)=>.01>=Math.abs(e.position-t.position)&&.01>=Math.abs(e.height-t.height)&&.01>=Math.abs(e.leftPosition-t.leftPosition)&&.01>=Math.abs(e.width-t.width),isBoundsEqual=(e,t)=>.01>=Math.abs(e.top-t.top)&&.01>=Math.abs(e.bottom-t.bottom)&&.01>=Math.abs(e.left-t.left)&&.01>=Math.abs(e.right-t.right),isSliderInfoEqual=(e,t)=>e.startIndex===t.startIndex&&e.endIndex===t.endIndex&&e.startTimestamp===t.startTimestamp&&e.endTimestamp===t.endTimestamp&&e.duration===t.duration&&e.startCol===t.startCol&&e.endCol===t.endCol&&e.startFrequency===t.startFrequency&&e.startFrequencyFormat===t.startFrequencyFormat&&e.endFrequency===t.endFrequency&&e.endFrequencyFormat===t.endFrequencyFormat&&e.bandwidth===t.bandwidth&&e.bandwidthFormat===t.bandwidthFormat,Slider=({id:e})=>{let{state:{globalID:t,heatmapCapture:{type:r,show:n,display:a,interval:i,onChange:o},axisX:{frequencyFormat:l,unit:s},segments:c}}=useStore_useStore(),u=external_react_useMemo(()=>r===heatmap_HeatmapCaptureType.Slider&&n&&a,[r,n,a]),[d,h]=external_react_useState(),p=external_react_useRef(void 0),f=external_react_useRef(null),[m,g]=external_react_useState(DEFAULT_RECT),[b,v]=external_react_useState(),w=external_react_useRef(m),y=external_react_useRef(null),x=external_react_useRef(null),k=external_react_useRef(null),S=external_react_useRef(null),D=external_react_useRef(l),M=external_react_useRef(c);D.current=l,M.current=c;let F=external_react_useCallback(e=>{w.current=e,g(t=>isRectEqual(t,e)?t:e)},[]),C=external_react_useCallback(e=>{v(t=>t&&e?isBoundsEqual(t,e)?t:e:t===e?t:e)},[]),E=external_react_useCallback(e=>{let r=getHeatmapWaterfallSnapshot(t),n=y.current,a=r&&n?resolveHeatmapSliderSelectionSourceRange({selection:n,waterfallSnapshot:r}):null;setHeatmapCaptureSelection(t,u&&e&&a?a:null)},[u,t]),N=external_react_useCallback((e,r)=>{p.current=e,h(e),E(e),r&&(f.current=getHeatmapWaterfallSnapshot(t)?.rawData??null,o?.(e))},[t,o,E]);external_react_useEffect(()=>{if(t)return E(u?p.current??null:null),()=>setHeatmapCaptureSelection(t,null)},[u,t,E]);let A=external_react_useCallback(()=>{let e=withDatabase(t).getAllRawData().waterfallData??[];return[e,e.length]},[t]),T=external_react_useCallback((e,r)=>{let[n]=A();return calculateHeatmapSliderInfo({formatBandwidth:getFrequencyToFixed,frequencyFormat:D.current,heatmapData:n,rect:e,segments:M.current,selectionOverride:r,waterfallSnapshot:getHeatmapWaterfallSnapshot(t)})},[A,t]),I=external_react_useCallback((e,r)=>{let n=getHeatmapWaterfallSnapshot(t);if(!n)return null;let a=r?resolveHeatmapSliderSelectionFromInteraction({dragType:r,frequencyFormat:D.current,rect:e,segments:M.current,startSelection:x.current,waterfallSnapshot:n}):resolveHeatmapSliderSelectionFromRect({frequencyFormat:D.current,rect:e,segments:M.current,waterfallSnapshot:n});return a&&(y.current=a),a},[t]),[P,z]=external_react_useState(0);external_react_useEffect(()=>{if(e&&t)return withUpdateData(e,"Slider",()=>z(e=>e+1))},[e,t]);let _=external_react_useCallback(e=>{let t=k.current;if(t&&isRectEqual(t,e))return;F(e);let r=I(e,S.current),n=T(e,r??void 0);n&&N(n,!1)},[T,F,N,I]),O=external_react_useCallback(t=>{let r=compareEventPriority(e,constants_ToolType.HeatmapCapture);return!1!==r&&(S.current=t,x.current=y.current,k.current=w.current,r)},[e]),L=external_react_useCallback(()=>{S.current=null,x.current=null,k.current=null,createMouseUpEventManager(getEID(e))(),resetEventLevel(e,constants_ToolType.HeatmapCapture)},[e]),q=external_react_useCallback(e=>{try{let t=y.current??I(e,null),r=T(e,t??void 0);r&&N(r,!0)}finally{L()}},[T,L,N,I]);external_react_useEffect(()=>L,[u,L]);let $=external_react_useCallback(e=>{let{startIndex:r,endIndex:n,startFrequency:a,endFrequency:i}=e,[o,s]=A(),c=getHeatmapWaterfallSnapshot(t),u=p.current,d=r===u?.startIndex&&n===u.endIndex,h=y.current?.frequency,f=void 0===a||void 0===i||1e-7>=Math.abs(Math.min(a,i)-(h?.[0]??0/0))&&1e-7>=Math.abs(Math.max(a,i)-(h?.[1]??0/0));if(d&&f)return;let m=w.current;if(c){let{sourceSize:e}=c;if(e.width<=0||e.height<=0)return;let t=s>0&&r>=0&&n<s&&n-r>=Math.ceil(MIN_SIZE*s/100),o=y.current??resolveHeatmapSliderSelectionFromRect({frequencyFormat:D.current,rect:m,segments:M.current,waterfallSnapshot:c}),l=void 0!==a&&void 0!==i?[Math.min(a,i),Math.max(a,i)]:null,d=l?resolveHeatmapSliderFrequencyRatioRange({frequencyFormat:D.current,frequencyRange:l,segments:M.current}):null;if(l&&!d)return;let h={frequency:l??o?.frequency??null,x:d??o?.x??[c.range.x[0]/e.width,c.range.x[1]/e.width],y:t?[Math.min(r,n),Math.max(r,n)+1]:o?.y??[u?.startIndex??c.range.y[0],(u?.endIndex??c.range.y[1]-1)+1]},p=resolveHeatmapSliderSelectionSourceRange({selection:h,waterfallSnapshot:c});if(!p)return;let f=resolveHeatmapContinuousSourceRangeScreenRect(c,p);if(!f)return;y.current=h,F(f);let g=T(f,h);g&&N(g,!0);return}let g=!d&&s>0&&r>=0&&n<s&&n-r>=Math.ceil(MIN_SIZE*s/100),b=!1,v=m.leftPosition,x=m.width;if(void 0!==a&&void 0!==i&&l){let e=l(0),t=l(100),r=e?Number(e):0,n=(t?Number(t):0)-r;if(n>0){let e=(a-r)/n*100,t=(i-r)/n*100,o=t-e;e>=0&&t<=100&&o>=MIN_SIZE&&(Math.abs(e-m.leftPosition)>.01||Math.abs(o-m.width)>.01)&&(b=!0,v=e,x=o)}}if(!g&&!b)return;let k={position:g?(1-n/s)*100:m.position,height:g?(n-r)/s*100:m.height,leftPosition:v,width:x};F(k);let S=T(k);S&&N(S,!0)},[A,t,l,T,F,N]);return(external_react_useEffect(()=>{i&&u&&$(i)},[i?.startIndex,i?.endIndex,i?.startFrequency,i?.endFrequency,u,P,$]),external_react_useEffect(()=>{if(!u||!t)return;let e=getHeatmapWaterfallSnapshot(t),r=p.current;if(e?.sourceSize.width&&e.sourceSize.height){let t=resolveHeatmapSourceRangeScreenRect(e,{endCol:e.sourceSize.width-1,endIndex:e.sourceSize.height-1,startCol:0,startIndex:0});C(t?{bottom:t.position+t.height,left:t.leftPosition,right:t.leftPosition+t.width,top:t.position}:void 0)}else C(void 0);if(!e){let e=T(w.current);e&&N(e,!0);return}let n=y.current??resolveHeatmapSliderSelectionFromRect({frequencyFormat:D.current,rect:w.current,segments:M.current,waterfallSnapshot:e});if(!n)return;if(n.frequency){let e=resolveHeatmapSliderFrequencyRatioRange({frequencyFormat:D.current,frequencyRange:n.frequency,segments:M.current});e&&(n={...n,x:e})}y.current=n;let a=resolveHeatmapSliderSelectionSourceRange({selection:n,waterfallSnapshot:e});if(!a)return;let i=resolveHeatmapContinuousSourceRangeScreenRect(e,a);i&&F(i);let o=T(i??w.current,n);if(!o)return;let l=!r||!isSliderInfoEqual(o,r),s=f.current!==e.rawData;(l||s)&&N(o,!0)},[P,l,c,u,t,T,F,C,N]),external_react_useEffect(()=>{t&&heatmapCaptureUpdate(t,e=>{e.interval&&u&&$(e.interval)})},[t,u,$]),u)?/*#__PURE__*/jsxs(components_DragSelectBox,{enabled:u,defaultRect:m,minSize:MIN_SIZE,maxSize:MAX_SIZE,snapThreshold:SNAP_THRESHOLD,onChange:_,onDragStart:O,onDragEnd:q,zIndex:6,showBoundaryLines:!0,variant:"projected",interactionBounds:b,labels:{left:d?.startFrequencyFormat?`${d.startFrequencyFormat}${s}`:"",right:d?.endFrequencyFormat?`${d.endFrequencyFormat}${s}`:"",top:d?.endTimestamp,bottom:d?.startTimestamp},children:[/*#__PURE__*/jsxs("div",{children:["带宽:",d?.bandwidth!==void 0?formatFrequencyUnit(1e3*d.bandwidth).formatted:""]}),/*#__PURE__*/jsxs("div",{children:["时长:",d?.duration!==void 0?(d.duration/1e3).toFixed(3):"","s"]})]}):null},Capture_Slider=Slider,HeatmapCapture=e=>{let{state:{heatmapCapture:t}}=useStore_useStore(),{show:r,type:n}=t;return r?n===heatmap_HeatmapCaptureType.Slider?/*#__PURE__*/jsx_runtime_jsx(Capture_Slider,{...e}):n===heatmap_HeatmapCaptureType.RowIndex?/*#__PURE__*/jsx_runtime_jsx(Capture_RowIndex,{...e}):/*#__PURE__*/jsx_runtime_jsx(Capture_Area,{...e}):null},Capture=HeatmapCapture;class render_Heatmap extends GradientRenderer{lastSeriesData=[];constructor(e){super({id:e.id,globalID:e.globalID,chart:null,realRange:e.realRange??constants_RANGE_DEFAULT,heatmapDefaultData:e.heatmapDefaultData??[]})}init(){let{id:e}=this.state;e&&(this.state.chart=new Heatmap({id:e,colors:this.getInitialColors(),renderer:RendererType.WebGL}),this.subscribeToColor("Heatmap-Render"),this.updateSeries(this.state.heatmapDefaultData),this.setRange())}updateSeries(e){Array.isArray(e)&&(this.lastSeriesData=e,this.state.chart?.render(e))}updateParams(e){let t=this.state.realRange,r=this.state.heatmapDefaultData;super.updateParams(e),e.heatmapDefaultData&&e.heatmapDefaultData!==r&&this.updateSeries(e.heatmapDefaultData),e.realRange&&(e.realRange[0]!==t[0]||e.realRange[1]!==t[1])&&this.setRange(e.realRange)}setRange(e=this.state.realRange){let{chart:t}=this.state,[r,n]=e;e&&void 0!==r&&void 0!==n&&t&&(this.state.realRange=e,t.setRange(e))}reset(){this.lastSeriesData=[],this.clear(),this.resize()}resize(){this.setRange(),this.state.chart?.resize(),this.lastSeriesData.length>0&&this.state.chart?.render(this.lastSeriesData)}}let useWaterfallZoomEvent_COMPONENT_KEY=constants_ToolType.Zoom;function useWaterfallZoomEvent(e,t){let r=useStore_useSelector(e=>e.globalID),n=external_react_useRef(null);external_react_useEffect(()=>{if(!t||!e||!r)return;let a=e=>{let t=withWaterfallAnalyzerSYNC(r),a=t?.getSnapshot();if(!a?.sourceSize.width||!a.sourceSize.height||"number"!=typeof e.left||"number"!=typeof e.top){n.current=null;return}n.current={start:{left:e.left,top:e.top},viewport:{range:a.range,sourceSize:a.sourceSize}}},i=createMouseDownEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,a),o=createWheelEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,(e,t)=>{let n=withWaterfallAnalyzerSYNC(r),a=n?.getSnapshot();if(!n||!a?.sourceSize.width||!a.sourceSize.height||"number"!=typeof t.left||"number"!=typeof t.top)return;let i=calculateHeatmapWheelRange(a,e,{left:t.left,top:t.top});isHeatmapViewportRangeEqual(a,i)||n.updateSamplingRange(toWaterfallSamplingOptions(i))}),l=createDoubleClickEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,()=>{if(!compareEventPriority(e,useWaterfallZoomEvent_COMPONENT_KEY))return!1;let t=resetHeatmapViewport(r);return resetEventLevel(e,useWaterfallZoomEvent_COMPONENT_KEY),t}),s=createDragEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,(t,i,o,l)=>{if(l||!t||!i||"number"!=typeof t.left||"number"!=typeof t.top||"number"!=typeof i.left||"number"!=typeof i.top||!compareEventPriority(e,useWaterfallZoomEvent_COMPONENT_KEY))return;let s=withWaterfallAnalyzerSYNC(r),c=s?.getSnapshot();if(!s||!c?.sourceSize.width||!c.sourceSize.height)return;n.current||a(t);let u=n.current;if(!u)return;if(u.viewport.sourceSize.width!==c.sourceSize.width||u.viewport.sourceSize.height!==c.sourceSize.height){n.current=null;return}let d=calculateHeatmapDragRangeFromCoordinates(u.viewport,u.start,{left:i.left,top:i.top});isHeatmapViewportRangeEqual(c,d)||s.updateSamplingRange(toWaterfallSamplingOptions(d))}),c=()=>{n.current=null,resetEventLevel(e,useWaterfallZoomEvent_COMPONENT_KEY)},u=createMouseUpEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,c),d=createMouseLeaveEventManager(e,useWaterfallZoomEvent_COMPONENT_KEY,c);return()=>{i?.(),o?.(),l?.(),s?.(),u?.(),d?.(),c()}},[t,r,e])}let Heatmap_Heatmap=e=>{let{heatmapDefaultData:t,onSubscriptionReadyChange:r,overview:n,zoomMode:a="disabled"}=e,i="independent-xy"===a,o=external_react_useRef(r);o.current=r;let{state:{axisY:{realRange:l},globalID:s}}=useStore_useStore(),{id:c,chart:u,Chart:d}=hooks_useChart({Render:render_Heatmap,params:{realRange:l,heatmapDefaultData:t,globalID:s}}),h=external_react_useMemo(()=>{let e=getEID(c);return throttle((t,r)=>{createWheelEventManager(e)(t,r)})},[c]),p=external_react_useCallback(e=>{e.stopPropagation(),h(-1*e.deltaY,calculateEventRelativePosition(e))},[h]);return useZoomEvent(c,constants_ModuleType.Heatmap,"linked-x"===a),useWaterfallZoomEvent(c,i),useModuleSubscription({moduleType:constants_ModuleType.Heatmap,chart:u,handleRender:(e,t)=>{t.updateSeries?.(e.data),withUpdateData(c)()},eventHandlers:{[constants_PSType.Option]:e=>{e.key===constants_OptionKey.HeatmapCapture&&heatmapCaptureUpdate(s)(e.data)}}}),external_react_useEffect(()=>{if(u&&s)return o.current?.(!0),()=>{o.current?.(!1)}},[u,s]),/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(heatmap,{id:c,chart:u}),/*#__PURE__*/jsxs(components_PluginBox,{onWheelCapture:i?p:void 0,children:[/*#__PURE__*/jsx_runtime_jsx(GridLines_Boundary,{}),/*#__PURE__*/jsx_runtime_jsx(d,{}),/*#__PURE__*/jsx_runtime_jsx(components_EventBus,{id:c}),/*#__PURE__*/jsx_runtime_jsx(Capture,{id:c}),/*#__PURE__*/jsx_runtime_jsx(components_Cursor,{id:c,type:constants_ModuleType.Heatmap}),n]})]})},modules_Heatmap=Heatmap_Heatmap,DEFAULT_PALETTE=[{r:0,g:0,b:0,a:1},{r:0,g:0,b:255,a:1},{r:0,g:188,b:212,a:1},{r:45,g:179,b:51,a:1},{r:255,g:235,b:59,a:1},{r:255,g:0,b:0,a:1}],DEFAULT_OVERLAY_COLORS={selectionFill:"rgba(255, 210, 64, 0.08)",selectionStroke:"rgba(255, 210, 64, 0.95)",shadow:"rgba(0, 0, 0, 0.8)",viewportFill:"rgba(255, 255, 255, 0.14)",viewportStroke:"rgba(255, 255, 255, 0.95)"},MAX_BACKING_WIDTH=256,MAX_BACKING_HEIGHT=1024,MAX_DEVICE_PIXEL_RATIO=2,Overview_clamp=(e,t,r)=>Math.min(r,Math.max(t,e)),writePaletteColor=(e,t,r,n)=>{let a=Overview_clamp(n,0,1)*(r.length-1),i=Math.floor(a),o=Math.min(i+1,r.length-1),l=a-i,s=r[i],c=r[o];e[t]=Math.round(s.r+(c.r-s.r)*l),e[t+1]=Math.round(s.g+(c.g-s.g)*l),e[t+2]=Math.round(s.b+(c.b-s.b)*l),e[t+3]=Math.round(255*Overview_clamp(s.a+(c.a-s.a)*l,0,1))},normalizePalette=e=>{if(!Array.isArray(e)||e.length<2)return null;let t=[];for(let r of e){if(!r||"object"!=typeof r||!("r"in r)||!("g"in r)||!("b"in r))return null;let{r:e,g:n,b:a}=r,i="a"in r?r.a:1;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof a||"number"!=typeof i||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(a)||!Number.isFinite(i))return null;t.push({r:Number(e),g:Number(n),b:Number(a),a:Number(i)})}return t},HeatmapOverview=/*#__PURE__*/forwardRef(({globalID:e,onResetViewport:t},r)=>{let n=useStore_useSelector(e=>e.axisY.realRange),a=external_react_useRef(null),i=external_react_useRef(null),o=external_react_useRef(null),l=external_react_useRef(null),s=external_react_useRef(null),c=external_react_useRef(DEFAULT_OVERLAY_COLORS),u=external_react_useRef(null),d=external_react_useRef(null),h=external_react_useRef(null),p=external_react_useRef(DEFAULT_PALETTE),f=external_react_useRef(constants_RANGE_DEFAULT),m=external_react_useRef(null),g=external_react_useRef(!0),b=external_react_useRef(null),v=external_react_useRef(void 0),w=external_react_useRef(null);f.current=[n?.[0]??constants_RANGE_DEFAULT["0"],n?.[1]??constants_RANGE_DEFAULT["1"]];let y=external_react_useCallback(()=>{let e=o.current,t=u.current;if(!e)return;let r=e.getContext("2d");if(!r)return;let{width:n,height:a}=e;if(r.clearRect(0,0,n,a),!t?.sourceSize.width||!t.sourceSize.height||n<=0||a<=0){h.current=t?.rawData??null;return}let[i,l]=f.current,c=Math.min(i,l),d=Math.max(i,l)-c||1,m=p.current,g=s.current;g&&g.width===n&&g.height===a||(s.current=g=r.createImageData(n,a));let b=g.data;for(let e=0;e<a;e++){let r=Overview_clamp(Math.floor((a-e-.5)*t.sourceSize.height/a),0,t.sourceSize.height-1),i=t.rawData[r];for(let r=0;r<n;r++){let a=Overview_clamp(Math.floor((r+.5)*t.sourceSize.width/n),0,t.sourceSize.width-1),o=i?.[a],l=(e*n+r)*4;if(!Number.isFinite(o)){b[l]=0,b[l+1]=0,b[l+2]=0,b[l+3]=0;continue}writePaletteColor(b,l,m,(o-c)/d)}}r.putImageData(g,0,0),h.current=t.rawData},[]),x=external_react_useCallback(()=>{let e=i.current??l.current;e&&(c.current={selectionFill:getThemeColor("--warning",.12,e)||DEFAULT_OVERLAY_COLORS.selectionFill,selectionStroke:getThemeColor("--warning",.95,e)||DEFAULT_OVERLAY_COLORS.selectionStroke,shadow:getThemeColor("--background",.86,e)||DEFAULT_OVERLAY_COLORS.shadow,viewportFill:getThemeColor("--background",.16,e)||DEFAULT_OVERLAY_COLORS.viewportFill,viewportStroke:getThemeColor("--foreground",.95,e)||DEFAULT_OVERLAY_COLORS.viewportStroke})},[]),k=external_react_useCallback(()=>{let e=l.current,t=u.current;if(!e)return;let r=e.getContext("2d");if(!r||(r.clearRect(0,0,e.width,e.height),!t?.sourceSize.width||!t.sourceSize.height))return;let{selectionFill:n,selectionStroke:a,shadow:i,viewportFill:o,viewportStroke:s}=c.current,h=resolveHeatmapOverviewViewportRect(t),p=Math.max(1,Math.min(window.devicePixelRatio||1,MAX_DEVICE_PIXEL_RATIO)),f=h.left*e.width,m=h.top*e.height,g=Math.max(h.width*e.width,2*p),b=Math.max(h.height*e.height,2*p);r.save(),r.fillStyle=o,r.strokeStyle=s,r.lineWidth=p,r.shadowColor=i,r.shadowBlur=2*p,r.fillRect(f,m,g,b),r.strokeRect(f+p/2,m+p/2,Math.max(0,Math.min(g-p,e.width-f-p)),Math.max(0,Math.min(b-p,e.height-m-p))),r.restore();let v=d.current;if(!v)return;let w=resolveHeatmapOverviewContinuousSourceRangeRect(t,v),y=w.left*e.width,x=w.top*e.height,k=Math.max(w.width*e.width,2*p),S=Math.max(w.height*e.height,2*p);r.save(),r.fillStyle=n,r.strokeStyle=a,r.lineWidth=p,r.setLineDash([3*p,2*p]),r.shadowColor=i,r.shadowBlur=2*p,r.fillRect(y,x,k,S),r.strokeRect(y+p/2,x+p/2,Math.max(0,Math.min(k-p,e.width-y-p)),Math.max(0,Math.min(S-p,e.height-x-p))),r.restore()},[]),S=external_react_useCallback(e=>{g.current||=e,a.current?.hidden||null===m.current&&(m.current=window.requestAnimationFrame(()=>{m.current=null,g.current&&(g.current=!1,y()),k()}))},[y,k]),D=external_react_useCallback(()=>{let e=i.current,t=o.current,r=l.current;if(!e||!t||!r)return;let n=e.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,MAX_DEVICE_PIXEL_RATIO),s=Math.max(1,Math.min(MAX_BACKING_WIDTH,Math.round(n.width*a))),c=Math.max(1,Math.min(MAX_BACKING_HEIGHT,Math.round(n.height*a)));(t.width!==s||t.height!==c||r.width!==s||r.height!==c)&&(t.width=s,t.height=c,r.width=s,r.height=c,S(!0))},[S]),M=external_react_useCallback(e=>{let t=h.current!==e.rawData;u.current=e;let r=isHeatmapViewportFullRange(e);if(a.current&&(a.current.hidden=r),r){g.current||=t,w.current=null,a.current?.removeAttribute("data-dragging"),v.current=void 0,null!==m.current&&(window.cancelAnimationFrame(m.current),m.current=null),null!==b.current&&(window.cancelAnimationFrame(b.current),b.current=null),l.current&&(l.current.style.cursor="grab");return}D(),S(t)},[D,S]);useImperativeHandle(r,()=>({update:M}),[M]),external_react_useEffect(()=>{let t=withWaterfallAnalyzerSYNC(e)?.getSnapshot();t&&M(t)},[e,M]),external_react_useEffect(()=>{S(!0)},[n,S]),external_react_useEffect(()=>(x(),subscribeChartsThemeChange(()=>{x(),S(!0)})),[S,x]),external_react_useEffect(()=>{let t=e=>{d.current=e,S(!1)},r=subscribeHeatmapCaptureSelection(e,t);return t(getHeatmapCaptureSelection(e)),r},[e,S]),external_react_useEffect(()=>{if(e)return handleColor(e,"HeatmapOverview",e=>{let t=normalizePalette(e);t&&(p.current=t,S(!0))})},[e,S]),external_react_useEffect(()=>{D();let e=i.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(D);return t.observe(e),()=>t.disconnect()},[D]),external_react_useEffect(()=>()=>{null!==m.current&&window.cancelAnimationFrame(m.current),null!==b.current&&window.cancelAnimationFrame(b.current)},[]);let F=external_react_useCallback(t=>{let r=withWaterfallAnalyzerSYNC(e),n=r?.getSnapshot();!r||!n||isHeatmapViewportRangeEqual(n,t)||r.updateSamplingRange(toWaterfallSamplingOptions(t))},[e]),C=external_react_useCallback(e=>{v.current=e,null===b.current&&(b.current=window.requestAnimationFrame(()=>{b.current=null;let e=v.current;v.current=void 0,e&&F(e)}))},[F]),E=external_react_useCallback(e=>{let t=e.currentTarget.getBoundingClientRect();return{left:t.width?(e.clientX-t.left)/t.width:0,top:t.height?(e.clientY-t.top)/t.height:0}},[]),N=external_react_useCallback(e=>{if(0!==e.button)return;let t=u.current;if(!t?.sourceSize.width||!t.sourceSize.height)return;let r=E(e),n=resolveHeatmapOverviewSourcePoint(t,r),i=isHeatmapOverviewSourcePointInViewport(t,n),o=d.current;if(!i&&o&&!isHeatmapContinuousSourceRangeVisibleInViewport(t,o)){let r=e.currentTarget.getBoundingClientRect();if(isHeatmapOverviewSourcePointInContinuousRange(o,n,{x:r.width?6*t.sourceSize.width/r.width:0,y:r.height?6*t.sourceSize.height/r.height:0}))return void C(calculateHeatmapOverviewContinuousSourceRangeCenteredRange(t,o))}i?(w.current={pointerId:e.pointerId,grabOffset:{x:n.x-t.range.x[0],y:n.y-t.range.y[0]}},a.current?.setAttribute("data-dragging","true"),e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.style.cursor="grabbing",e.preventDefault()):C(calculateHeatmapOverviewCenteredRange(t,r))},[E,C]),A=external_react_useCallback(e=>{let t=w.current,r=u.current;t&&t.pointerId===e.pointerId&&r&&C(calculateHeatmapOverviewDragRange(r,E(e),t.grabOffset))},[E,C]),T=external_react_useCallback(e=>{w.current?.pointerId===e.pointerId&&(w.current=null,a.current?.removeAttribute("data-dragging"),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),e.currentTarget.style.cursor="grab")},[]);return /*#__PURE__*/jsx_runtime_jsx("aside",{ref:a,"aria-label":"瀑布图全景导航",className:"group absolute right-2 top-2 z-[6] isolate flex h-[14%] w-[14%] overflow-visible before:pointer-events-none before:absolute before:-inset-1 before:z-0 before:rounded-md before:bg-foreground/20 before:opacity-75 before:shadow-sm before:transition-opacity before:duration-100 hover:before:opacity-90 focus-within:before:opacity-90 data-[dragging=true]:before:opacity-100",hidden:!0,children:/*#__PURE__*/jsxs("div",{ref:i,className:"relative z-[1] h-full min-h-0 w-full overflow-hidden rounded-sm",children:[/*#__PURE__*/jsx_runtime_jsx("canvas",{ref:o,className:"pointer-events-none absolute inset-0 h-full w-full opacity-60 transition-opacity duration-100 group-hover:opacity-90 group-focus-within:opacity-90 group-data-[dragging=true]:opacity-100"}),/*#__PURE__*/jsx_runtime_jsx("canvas",{ref:l,className:"absolute inset-0 h-full w-full touch-none cursor-grab opacity-80 outline-none transition-opacity duration-100 group-hover:opacity-100 group-focus-within:opacity-100 group-data-[dragging=true]:opacity-100 focus-visible:ring-1 focus-visible:ring-ring","aria-label":"瀑布图全景;点击空白区域居中,点击框选范围定位,拖动视口框平移,双击恢复全景",tabIndex:0,onContextMenu:e=>e.preventDefault(),onDoubleClick:e=>{e.preventDefault(),e.stopPropagation(),t()},onLostPointerCapture:T,onPointerCancel:T,onPointerDown:N,onPointerMove:A,onPointerUp:T})]})})});HeatmapOverview.displayName="HeatmapOverview";let Overview=HeatmapOverview,Heatmap_Chart_Chart=({publish:e,heatmapDefaultData:t})=>{let{state:{globalID:r,zoom:n},dispatch:a}=useStore_useStore(),i=!0===n.xy&&!1!==n.show,o=i&&n.overview?.show===!0,l=external_react_useRef(i),s=external_react_useRef(r),c=external_react_useRef(null),u=external_react_useRef(null),d=external_react_useRef(!1),h=external_react_useRef(!1),p=external_react_useRef(!1),f=external_react_useRef(t),m=external_react_useRef(convertToTimestampedArrays(t??[]));l.current=i,s.current=r;let g=external_react_useCallback(e=>{let t=s.current;if(!t)return;let r={range:{x:e.range.x,y:e.range.y},sourceSize:e.sourceSize},n=e.sourceSize.width>0?{start:e.range.x[0],end:e.range.x[1]-1}:{start:0,end:0};a({payload:t=>{let a=t.waterfallViewport,i=a.sourceSize.width!==e.sourceSize.width||a.sourceSize.height!==e.sourceSize.height||a.range.x[0]!==e.range.x[0]||a.range.x[1]!==e.range.x[1]||a.range.y[0]!==e.range.y[0]||a.range.y[1]!==e.range.y[1],o=t.zoom.interval.start!==n.start||t.zoom.interval.end!==n.end||null!==t.zoom.style;return i||o?{...i?{waterfallViewport:r}:{},...o?{zoom:{...t.zoom,interval:n,style:null,isScanSegmentsUpdateMagnify:!1}}:{}}:null}}),passThrough(t,constants_ModuleType.Heatmap)({pstype:constants_PSType.Render,data:e.data}),u.current?.update(e)},[a]),b=external_react_useCallback(e=>{if(d.current=e,!e||!l.current)return;let t=c.current,r=m.current;t&&r.length>0&&setHeatmapWaterfallData(t,r)},[]);external_react_useEffect(()=>{r&&(withDatabase(r).getAllRawData=e=>({...getDefaultData().getAllRawData(e),waterfallData:m.current}))},[r]),external_react_useEffect(()=>{if(!r)return;if(!i){if(c.current=null,withWaterfallAnalyzerSYNC(r,null),h.current){h.current=!1;let e=m.current.reduce((e,t)=>Math.max(e,t.length),0);e>0?a({payload:t=>({waterfallViewport:{range:{x:[0,0],y:[0,0]},sourceSize:{width:0,height:0}},zoom:{...t.zoom,interval:{start:0,end:e-1},style:null,isScanSegmentsUpdateMagnify:!1}})}):a({payload:{waterfallViewport:{range:{x:[0,0],y:[0,0]},sourceSize:{width:0,height:0}}}})}m.current.length>0&&passThrough(r,constants_ModuleType.Heatmap)({pstype:constants_PSType.Render,data:m.current});return}let e=new WaterfallAnalyzer({onWaterfallUpdate:g});return c.current=e,h.current=!0,withWaterfallAnalyzerSYNC(r,e),d.current&&m.current.length>0&&setHeatmapWaterfallData(e,m.current),()=>{c.current===e&&(c.current=null),withWaterfallAnalyzerSYNC(r,null)}},[a,r,g,i]),external_react_useEffect(()=>{if(Object.is(f.current,t))return;f.current=t,p.current=!1;let e=convertToTimestampedArrays(t??[]);m.current=e;let r=c.current;i&&d.current&&r&&setHeatmapWaterfallData(r,e)},[t,i]);let v=useSpectrumRule(constants_ChartType.Heatmap),w=external_react_useCallback(()=>{let e=s.current;e&&resetHeatmapViewport(e)},[]);publish_usePublish({publish:e,resetViewport:w,subscribe:e=>{v(e);let{pstype:t}=e;if(t===constants_PSType.Heatmap){let{data:t,timestamps:n}=e,a=convertToTimestampedArrays(t,n);m.current=a;let i=c.current;l.current?d.current&&i&&setHeatmapWaterfallData(i,a):passThrough(r,constants_ModuleType.Heatmap)({pstype:constants_PSType.Render,data:a})}if(t===constants_PSType.Reset||t===constants_PSType.Clear){p.current=!0,m.current=[],c.current?.setData([]),passThrough(r,constants_ModuleType.Heatmap)({pstype:constants_PSType.Reset}),t===constants_PSType.Reset&&passThrough(r,constants_PSType.Reset)(e),e.onFinally?.();return}passThrough(r,constants_ModuleType.Heatmap)(e)}});let y=!Object.is(f.current,t);return /*#__PURE__*/jsxs(components_Container,{children:[/*#__PURE__*/jsx_runtime_jsx(components_FlexBox,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Heatmap,{heatmapDefaultData:i||p.current&&!y?void 0:t,onSubscriptionReadyChange:b,overview:o?/*#__PURE__*/jsx_runtime_jsx(Overview,{ref:u,globalID:r,onResetViewport:w}):null,zoomMode:i?"independent-xy":"disabled"})}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:constants_ChartType.Heatmap})]})},Heatmap_Chart=Heatmap_Chart_Chart,HeatmapChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,children:/*#__PURE__*/jsx_runtime_jsx(Heatmap_Chart,{...e})}),charts_Heatmap_Heatmap=withChartPublisher(HeatmapChart,"Heatmap"),charts_Heatmap=charts_Heatmap_Heatmap;function IQEye_IQEye({type:e="iqEye"}){let{chart:t,Chart:r}=hooks_useChart({Render:external_react_useMemo(()=>class extends IQRenderer{constructor(t){super({...t,type:e})}},[e])});return useModuleSubscription({moduleType:constants_ModuleType.IQEye,chart:t}),/*#__PURE__*/jsx_runtime_jsx(r,{})}let GridLinesSVG=({row:e=10,col:t=10,strokeColor:r="var(--chart-grid)",strokeWidth:n=1,strokeDasharray:a=4})=>{let i=external_react_useRef(null),[o,l]=external_react_useState([]),[s,c]=external_react_useState([]),u=()=>{let{width:o,height:s}=i.current?.getBoundingClientRect()??{width:0,height:0};if(o>0&&s>0&&e>0&&t>0){let i=[],u=[],d=o/t,h=s/e;for(let t=0;t<=e;t++){let e=Math.round(t*h);i.push(/*#__PURE__*/jsx_runtime_jsx("line",{x1:0,y1:e,x2:Math.round(o),y2:e,stroke:r,strokeWidth:n,strokeDasharray:a,vectorEffect:"non-scaling-stroke"},`h-${t}`))}for(let e=0;e<=t;e++){let t=Math.round(e*d);u.push(/*#__PURE__*/jsx_runtime_jsx("line",{x1:t,y1:0,x2:t,y2:Math.round(s),stroke:r,strokeWidth:n,strokeDasharray:a,vectorEffect:"non-scaling-stroke"},`v-${e}`))}l(i),c(u)}};return external_react_useEffect(()=>{let e=new ResizeObserver(()=>{u()});return i.current&&(e.observe(i.current),i.current.parentElement&&e.observe(i.current.parentElement)),u(),()=>{e.disconnect()}},[e,t,r,n]),/*#__PURE__*/jsxs("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",style:{width:"100%",height:"100%"},shapeRendering:"crispEdges",imageRendering:"pixelated",children:[o,s]})},GridLines_GridLinesSVG=GridLinesSVG,GridLines=()=>{let{state:{gridLines:e,segments:t,axisY:{range:r,step:n,restrict:a}}}=useStore_useStore(),i=external_react_useRef(null),[o,l]=external_react_useState({height:"0px",transform:"translateY(0px)",row:0,col:0});return(external_react_useEffect(()=>{if(!a||!r||!n)return;let[e,o]=a,s=o-e,[c,u]=r,d=u-c,h=i.current?.offsetHeight??0;l({height:`${s/d*h}px`,transform:`translateY(-${(o-u)/d*h}px)`,row:s/n,col:t.length>1?1:10})},[a,r,n,t.length,i.current]),e)?/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute right-0 top-0 z-[1] h-full w-full select-none overflow-hidden",ref:i,children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 flex h-full w-full items-center",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-0 top-0 h-full w-full box-border border-[color:var(--chart-grid)] [&>svg]:h-full [&>svg]:w-full",style:o,children:/*#__PURE__*/jsx_runtime_jsx(GridLines_GridLinesSVG,{col:o.col,row:o.row})})})}):null},components_GridLines=/*#__PURE__*/react.memo(GridLines);class Spectrum extends BaseRenderer{useRangeAutoFocus=()=>{};firstRenderAutoFocus=!1;constructor(e){super({chart:null,autoranging:!1,prevAutoRangeTime:0,id:"id",renderRange:constants_RANGE_DEFAULT,interval:1,series:{},globalID:"",...e})}init(){if(this.state.chart)return;let{id:e,renderRange:t,globalID:r}=this.state;e&&(this.trackCleanup(initSeriesSubscription(this)),this.state.chart=new Series({id:e,range:t}),this.initSeries(),this.useRangeAutoFocus=()=>{useRangeAutoFocus(r)()},this.trackCleanup(useRangeSet(r,e=>{this.setRange(e)})))}initSeries(){let{globalID:e}=this.state;if(!e)throw Error("globalID is required for series initialization");getSeriesWithGraphicType(e).forEach(e=>{this.setSeries(e,!0)}),this.state.chart?.draw()}updateSeries({data:e,extraData:t}){let{series:r,chart:n}=this.state;if(n){if(e){let t=Object.entries(r);for(let r=0;r<t.length;r+=1){let[a]=t[r],i=e[a];i&&SERIES_NAMES.includes(a)&&(n.render({name:a,data:i}),a===REAL_DATA_NAME&&this.updateMainSeries(i))}}if(t){let e=Object.entries(t);for(let t=0;t<e.length;t+=1){let[a,i]=e[t],o=r[a];i&&n.render({...o,name:a,data:i})}}}}updateMainSeries(e){let{autoranging:t,interval:r,prevAutoRangeTime:n,chart:a}=this.state;if(!a)return;let i=e.length;i!==r&&(this.state.interval=i,a.setIntervel(i));let o=Date.now();t&&o-n>1e3&&(this.state.prevAutoRangeTime=o,this.useRangeAutoFocus()),this.firstRenderAutoFocus||void 0===e.at(0)||(this.firstRenderAutoFocus=!0)}setSeries(e,t=!1){let{chart:r,series:n,globalID:a}=this.state,{name:i}=e;if(!r||!i||!e)return;let o={...n[i],...e},l=o.type;!e.type&&a&&(l=getCorrectSeriesType(a,i));let{color:s=SERIES[i]?.color,thickness:c=1,display:u=!1}=o,d={name:i,label:o.label,type:l||renderer_GraphicType.Line,color:s,thickness:c,display:u};if(this.state.series={...n,[i]:d},r.setSeries(d),!t&&a)try{updateSeries(a,{name:i,label:d.label||i,color:s,thickness:c,display:u,type:d.type})}catch(e){console.warn("Failed to update series in new management system:",e)}}setDisabledClearRect(e){this.state.chart?.updateProps({disabledClearRect:e})}setRange(e=this.state.renderRange){let{chart:t}=this.state,[r,n]=e;void 0!==r&&void 0!==n&&t&&(this.state.renderRange=e,t.setRange(e))}zoom(){let{chart:e,interval:t}=this.state;e&&e.setIntervel(t)}reset(){this.clear(),this.resize()}resize(){this.state.chart?this.hasRenderableContainerSize()&&(this.setRange(),this.zoom(),this.state.chart.resize()):this.initializeChartWhenReady()}clearChart(){this.clear()}}let IQLine=()=>{let{state:{axisY:{autoranging:e}}}=useStore_useStore(),{chart:t,Chart:r}=hooks_useChart({Render:Spectrum,params:{autoranging:e}});return external_react_useEffect(()=>{if(t){let{lineColor:e,pointColor:r}=getConfig("iq");t.setSeries({name:SERIES.realData.name,label:"IData",color:e}),t.setSeries({name:SERIES.maxData.name,label:"QData",color:r})}},[t]),useModuleSubscription({moduleType:constants_ModuleType.IQLine,chart:t,handleRender:(e,t)=>{let{IData:r,QData:n}=e;if(r&&n){let{min:e,max:a}=(0,array_0.jy)([...r,...n]),i=(a-e)/8;t.setRange?.([e-i,a+i]),t.updateSeries?.({data:{[SERIES.realData.name]:r,[SERIES.maxData.name]:n}})}},eventHandlers:{[constants_PSType.Reset]:(e,t)=>{t.reset()}}}),/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(components_GridLines,{}),/*#__PURE__*/jsx_runtime_jsx(r,{})]})},modules_IQLine=IQLine;function IQPlanisphere({type:e="iqPlanisphere"}){let{chart:t,Chart:r}=hooks_useChart({Render:external_react_useMemo(()=>class extends IQRenderer{constructor(t){super({...t,type:e})}},[e])});return useModuleSubscription({moduleType:constants_ModuleType.IQPlanisphere,chart:t}),/*#__PURE__*/jsx_runtime_jsx(components_Square,{children:/*#__PURE__*/jsx_runtime_jsx(r,{})})}let IQStream=({type:e="iqStream"})=>{let{chart:t,Chart:r}=hooks_useChart({Render:external_react_useMemo(()=>class extends IQRenderer{constructor(t){super({...t,type:e})}},[e])});return useModuleSubscription({moduleType:constants_ModuleType.IQStream,chart:t}),/*#__PURE__*/jsx_runtime_jsx(components_Square,{children:/*#__PURE__*/jsx_runtime_jsx(r,{})})},modules_IQStream=IQStream,IQ_Chart_Chart=e=>{let{type:t,publish:r}=e,{state:{globalID:n}}=useStore_useStore();return external_react_useEffect(()=>{n&&t===constants_ChartType.IQEye&&passThrough(n,constants_ModuleType.IQEye)({pstype:constants_PSType.Render})},[]),publish_usePublish({publish:r,subscribe:e=>{let r=normalizeRenderPublishEvent(e,{renderPSTypes:[constants_PSType.IQ]});switch(t){case constants_ChartType.IQEye:passThrough(n,constants_ModuleType.IQEye)(r);break;case constants_ChartType.IQLine:passThrough(n,constants_ModuleType.IQLine)(r);break;case constants_ChartType.IQPlanisphere:passThrough(n,constants_ModuleType.IQPlanisphere)(r);break;case constants_ChartType.IQStream:passThrough(n,constants_ModuleType.IQStream)(r)}}}),/*#__PURE__*/jsx_runtime_jsx(components_Container,{children:/*#__PURE__*/jsx_runtime_jsx(external_react_useMemo(()=>{switch(t){case constants_ChartType.IQEye:return IQEye_IQEye;case constants_ChartType.IQLine:return modules_IQLine;case constants_ChartType.IQPlanisphere:return IQPlanisphere;case constants_ChartType.IQStream:return modules_IQStream;default:return IQPlanisphere}},[t]),{})})},IQ_Chart=IQ_Chart_Chart,IQChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{system:{padding:!1,border:!1},...e,children:/*#__PURE__*/jsx_runtime_jsx(IQ_Chart,{...e})}),IQ_IQ=withChartPublisher(IQChart,"IQ"),charts_IQ=IQ_IQ,Reset_modes=Object.values(constants_ModuleType),Reset=()=>{let{state:{globalID:e,publish:t}}=useStore_useStore();return /*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{onClick:()=>{t?.({pstype:constants_PSType.Reset}),Reset_modes.forEach(t=>{passThrough(e,t)({pstype:constants_PSType.Reset})})},title:"重置",children:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M512 160c-141.6 0-265.6 76.8-332.8 192l-76.8-76.8v224h224l-89.6-89.6C288 307.2 390.4 240 512 240c159.2 0 288 128.8 288 288s-128.8 288-288 288c-115.2 0-214.4-67.2-262.4-164.8l-68.8 36.8C240 800 364.8 880 512 880c194.4 0 352-157.6 352-352S706.4 160 512 160z",fill:"currentColor"})})})},controls_Reset=Reset,SegmentsDisplayControl=()=>{let{state:{segments:e,globalID:t}}=useStore_useStore(),[r,n]=external_react_useState([]),[a,i]=external_react_useState(null),o=e.totalPoints??0;external_react_useEffect(()=>{n(e.map(e=>({display:!1,ratio:o>0?e.point/o:0})))},[e,o]);let l=external_react_useCallback(e=>{let a="number"==typeof e?e:null;n(r.map((e,t)=>({...e,display:t===a}))),i(a),SET_SEGMENTS_DISPLAY(t)(a??void 0)},[r,t]);return /*#__PURE__*/jsx_runtime_jsx(ToolbarDropdown,{value:a,options:[{value:null,label:"所有频段"},...e.map((e,t)=>({value:t,label:`频段 ${e.start} - ${e.stop}`}))],onChange:l})},controls_SegmentsDisplayControl=SegmentsDisplayControl,SeriesControl=({type:e})=>{let{state:{globalID:t}}=useStore_useStore(),{mode:r}=useSeriesManager(t),n=external_react_useCallback(()=>{e===constants_ChartType.MScan||e===constants_ChartType.ScanDF360||t&&toggleSeriesMode(t)},[t,e]),a=external_react_useMemo(()=>e===constants_ChartType.MScan||e===constants_ChartType.ScanDF360?"图形模式切换已禁用":`当前图形模式:${SERIES_MODES[r]?.label||r}`,[r,e]),i=e===constants_ChartType.MScan||e===constants_ChartType.ScanDF360,o=external_react_useMemo(()=>()=>{switch(r){case"bar":return /*#__PURE__*/jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("rect",{x:"2",y:"8",width:"2",height:"6",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"5",y:"4",width:"2",height:"10",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"8",y:"6",width:"2",height:"8",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"11",y:"2",width:"2",height:"12",fill:"currentColor"})]});case"stepline":return /*#__PURE__*/jsx_runtime_jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M2 12H4V8H6V8H8V4H10V4H12V2H14",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})});case"line":return /*#__PURE__*/jsx_runtime_jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M2 12L5 8L8 10L11 4L14 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})});case"area":return /*#__PURE__*/jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M2 12L5 8L8 10L11 4L14 6V14H2V12Z",fill:"currentColor",opacity:"0.6"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M2 12L5 8L8 10L11 4L14 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]});default:return null}},[r]);return /*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{title:a,disabled:i,onClick:i?void 0:n,className:cn_cn(i&&"text-muted-foreground"),children:o()})},controls_SeriesControl=SeriesControl,SeriesDisplayControl=()=>{let{state:{globalID:e,series:t}}=useStore_useStore(),r=useFilteredSeries(e);external_react_useEffect(()=>{if(!e||!t?.forceDisplay)return;let n=r.filter(e=>!e.display);n.length>0&&batchUpdateSeries(e,n.map(({name:e})=>({name:e,display:!0})))},[e,t?.forceDisplay,r.length]);let n=external_react_useCallback(t=>{e&&0!==t.length&&batchUpdateSeries(e,t)},[e]),a=external_react_useCallback((e,t)=>{n([{name:e,display:t}])},[n]),i=external_react_useCallback(e=>{let t=r.filter(t=>t.display!==e).map(t=>({name:t.name,display:e}));t.length>0&&n(t)},[r,n]),o=external_react_useMemo(()=>{let e=r.every(e=>e.display);return[{label:e?"全不选":"全选",value:"__toggle_all__",onSelect:()=>i(!e),render:()=>/*#__PURE__*/jsx_runtime_jsx("span",{className:"inline-flex w-full text-xs font-medium",children:e?"全不选":"全选"})},...r.map(e=>{let t=e.display?"text-foreground opacity-100":"font-normal text-muted-foreground opacity-70";return{label:e.label||e.name,value:e.name,onSelect:()=>a(e.name,!e.display),render:()=>/*#__PURE__*/jsxs("div",{className:"flex w-full min-w-0 items-center gap-[var(--size-gap-base)]",children:[/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:cn_cn("inline-flex h-3.5 w-3.5 shrink-0 rounded-[var(--radius-micro)] border transition-colors",e.display?"border-transparent":"border-border/70 bg-transparent opacity-55"),style:{backgroundColor:e.display?e.color:"transparent"}}),/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn("min-w-0 truncate text-xs",t),children:e.label||e.name})]})}})]},[r,a,i]);return /*#__PURE__*/jsx_runtime_jsx(ToolbarIconDropdown,{value:external_react_useMemo(()=>{let e=r.filter(e=>e.display).length,t=r.length;return 0===e?"无选择":e===t?"全部":`${e}/${t}`},[r]),options:o,title:"系列显示控制",icon:/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M930.909091 896H93.090909c-18.618182 0-34.909091-16.290909-34.909091-34.909091V162.909091c0-18.618182 16.290909-34.909091 34.909091-34.909091h837.818182c18.618182 0 34.909091 16.290909 34.909091 34.909091v698.181818c0 18.618182-16.290909 34.909091-34.909091 34.909091z m-802.909091-69.818182h770.327273v-628.363636H128v628.363636z",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M232.727273 640c-4.654545 0-9.309091 0-13.963637-2.327273-16.290909-6.981818-25.6-27.927273-18.618181-44.218182l116.363636-279.272727c4.654545-11.636364 16.290909-20.945455 30.254545-20.945454 13.963636 0 25.6 4.654545 32.581819 16.290909l83.781818 146.618182H814.545455c18.618182 0 34.909091 16.290909 34.90909 34.90909s-16.290909 34.909091-34.90909 34.909091H442.181818c-11.636364 0-23.272727-6.981818-30.254545-16.290909l-58.181818-102.4-90.763637 216.436364c-4.654545 6.981818-16.290909 16.290909-30.254545 16.290909zM814.545455 663.272727H488.727273c-18.618182 0-34.909091-16.290909-34.909091-34.909091s16.290909-34.909091 34.909091-34.909091h325.818182c18.618182 0 34.909091 16.290909 34.90909 34.909091s-16.290909 34.909091-34.90909 34.909091z",fill:"currentColor"})]}),closeOnSelect:!1})},controls_SeriesDisplayControl=SeriesDisplayControl,ZoomSwitch=()=>{let{state:{zoom:e,segments:t},dispatch:r}=useStore_useStore(),{show:n,autoCloseTimeout:a,interval:{start:i,end:o}}=e,l=t.totalPoints??0,s=Math.max(l-1,0),[c,u]=external_react_useState(!0),d=external_react_useRef(null);external_react_useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),external_react_useEffect(()=>{d.current&&clearTimeout(d.current),u(!1),d.current=setTimeout(()=>{h()},a)},[i,o,a]);let h=external_react_useCallback(()=>{r({payload:{zoom:buildZoomFullRange(e,l)}}),u(!0)},[e,l,r]),p=external_react_useMemo(()=>l?{background:`linear-gradient(to right,
3816
3820
  transparent ${(i+1)/l*100}%,
3817
3821
  var(--chart-grid-strong) ${(i+1)/l*100}%,
3818
3822
  var(--chart-grid-strong) ${(o+1)/l*100}%,
3819
3823
  transparent ${(o+1)/l*100}%
3820
- )`}:{background:"transparent"},[i,o,l]),f=external_react_useMemo(()=>0===i&&o===s,[i,o,s]);return n?/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarContentBox,{active:!c&&!f,tone:"primary",disabled:c,onClick:c?void 0:h,title:"缩放:左键按住移动,滚轮缩放,右键框选,点击全景展示",contentClassName:TOOLBAR_CONTENT_ICON_CLASS_NAME,children:c||f?/*#__PURE__*/jsx_runtime_jsx("svg",{width:"16",height:"16",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M388.266667 512L290.133333 413.866667l29.866667-29.866667 149.333333 149.333333L320 682.666667l-29.866667-29.866667L388.266667 554.666667H128v-42.666667h260.266667z m290.133333 0H938.666667v42.666667h-260.266667l98.133333 98.133333-29.866666 29.866667-149.333334-149.333334L746.666667 384l29.866666 29.866667-98.133333 98.133333z",fill:"currentColor"})}):/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex h-full w-4 bg-chart-surface",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full w-full opacity-30",style:p})})}):null},Switch=ZoomSwitch,FluorescenceSwitch=()=>{let{state:{fluorescence:e},dispatch:t}=useStore_useStore(),{show:r,display:n,renderMode:a=FluorescenceRenderMode.Gaussian}=e,i=external_react_useCallback(()=>{t({payload:{fluorescence:{...e,display:!n}}})},[e,n,t]),o=external_react_useCallback(r=>{null!==r&&t({payload:{fluorescence:{...e,renderMode:r}}})},[e,t]),l=external_react_useMemo(()=>`荧光谱:${n?"显示":"隐藏"}`,[n]),s=a===FluorescenceRenderMode.Gaussian?()=>/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{fill:"currentColor",d:"M905.7 588.2C760 439.5 774.8 382.9 796.2 323.6c21.5-59.3-30.6-320.6-223.6-219C379.5 206.2 437 342.1 299.3 336c-137.7-6-306.9 67.8-206 340.2 39.5 106.4 114.5 209.7 230.6 224.6s306.8-23 422.9 34.7c116.2 57.6 304.5-198.6 158.9-347.3zM715.5 867c-98-45.6-258.3-18.8-356.8-29.7S184.3 757.8 152 671.8C69.2 452 229.3 389.9 346.2 393.5 463 397 413.5 260.9 578.3 176.7c164.9-84.2 175.4 133.9 156.6 182.2C713.1 414.7 715 467.7 842.5 592c122.3 119.1-28.9 320.7-127 275z"}),/*#__PURE__*/jsx_runtime_jsx("path",{fill:"currentColor",d:"M433.4 501c-88.1 41.2-99.5-56.2-207.6 36.8-53 45.6-7.5 153.6 60.8 175.7 68.4 22.2 135.9-2.3 189-48.4 53-46.3 46-205.5-42.2-164.1zM665.8 464.6c-4.3-103.8 47.5-259.5-55.4-233-63.3 16.3-122.9 122.4-97.3 169.7 25.6 47.1 80.7 130.9 62.6 191.6-18 60.6-4.6 134.2 55.7 156 60.4 21.8 189.4 14.5 191.1-49.1 1.6-63.6-152.3-131.3-156.7-235.2z"})]}):()=>/*#__PURE__*/jsxs("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("rect",{x:"1.9",y:"1.9",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.6"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"6.6",y:"1.9",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.75"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"11.3",y:"1.9",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.85"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"1.9",y:"6.6",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.7"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",fill:"currentColor",opacity:"1"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"11.3",y:"6.6",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.9"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"1.9",y:"11.3",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.8"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"6.6",y:"11.3",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.95"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"11.3",y:"11.3",width:"2.8",height:"2.8",fill:"currentColor",opacity:"1"})]}),c=a===FluorescenceRenderMode.Grid?-.5:0,u=a===FluorescenceRenderMode.Grid?.94:1,d=external_react_useMemo(()=>[{value:FluorescenceRenderMode.Grid,label:"栅格",render:()=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("text-xs text-foreground",a===FluorescenceRenderMode.Grid&&"text-primary"),children:"栅格渲染"})},{value:FluorescenceRenderMode.Gaussian,label:"高斯",render:()=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("text-xs text-foreground",a===FluorescenceRenderMode.Gaussian&&"text-primary"),children:"高斯渲染"})}],[a]);return r?n?/*#__PURE__*/jsx_runtime_jsx(ToolbarDropdownGroup,{leading:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:n,tone:"primary",onClick:i,title:l,children:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGlyph,{opticalOffsetY:c,opticalScale:u,children:/*#__PURE__*/jsx_runtime_jsx(s,{})})}),value:a,options:d,onChange:o}):/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",onClick:i,title:l,children:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGlyph,{opticalOffsetY:c,opticalScale:u,children:/*#__PURE__*/jsx_runtime_jsx(s,{})})}):null},Fluorescence_Switch=FluorescenceSwitch,DeltaMeasurementIcon=()=>/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",style:{transition:"transform 0.2s ease"},children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M512 200 L812 824 L212 824 Z",fill:"none",stroke:"currentColor",strokeWidth:"60",strokeLinejoin:"miter"}),/*#__PURE__*/jsx_runtime_jsx("line",{x1:"350",y1:"650",x2:"674",y2:"650",stroke:"currentColor",strokeWidth:"40",strokeDasharray:"10,10"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M 360 650 L 390 630 L 390 670 Z",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M 664 650 L 634 630 L 634 670 Z",fill:"currentColor"})]}),icons_DeltaMeasurementIcon=DeltaMeasurementIcon,Switch_Switch=()=>{let{state:{heatmapCapture:e},dispatch:t}=useStore_useStore(),{show:r,display:n,type:a,toolbarVariant:i}=e,{title:o,icon:l}=external_react_useMemo(()=>{if("deltaMeasurement"===i)return{title:n?"退出Δ测量模式":"进入Δ测量模式",icon:/*#__PURE__*/jsx_runtime_jsx(icons_DeltaMeasurementIcon,{})};let e="瀑布图捕获-区域测量",t=/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_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_runtime_jsx("path",{d:"M784.4 615.7h51v233h-51z",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M693.4 706.7h233v51h-233z",fill:"currentColor"})]});return a===heatmap_HeatmapCaptureType.Slider&&(e="瀑布图捕获-滑块",t=/*#__PURE__*/jsx_runtime_jsx("path",{d:"M800 124H224c-55 0-100 45-100 100v576c0 55 45 100 100 100h576c55 0 100-45 100-100V224c0-55-45-100-100-100zM224 224h576v576H224V224z M700 324v376H324V324h376z",fill:"currentColor",stroke:"currentColor",strokeWidth:"2"})),a===heatmap_HeatmapCaptureType.RowIndex&&(e="瀑布图捕获-行选中",t=/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M800 124H224c-55 0-100 45-100 100v576c0 55 45 100 100 100h576c55 0 100-45 100-100V224c0-55-45-100-100-100zM224 224h576v576H224V224z",fill:"none",stroke:"currentColor",strokeWidth:"30"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M224 512h576",stroke:"currentColor",strokeWidth:"30"})]})),{title:e,icon:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:t})}},[a,n,i]),s=external_react_useCallback(r=>{t({payload:{heatmapCapture:{...e,display:!!r}}})},[e]);return r?/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",onClick:()=>{s(!n)},title:o,children:l}):null},Capture_Switch=/*#__PURE__*/react.memo(Switch_Switch),MIN_TIME=500,MAX_TIME=5e3,STEP=100,TimeRange_Switch_Switch=()=>{let{state:{timeRange:e},dispatch:t}=useStore_useStore(),r=external_react_useCallback(r=>{if(!e)return;let n=r.deltaY<0?e+STEP:e-STEP;t({payload:{timeRange:n=Math.max(MIN_TIME,Math.min(MAX_TIME,n))}})},[e,t]);return e?/*#__PURE__*/jsxs(primitives_ToolbarContentBox,{title:"瀑布图时间控制",onWheel:r,contentClassName:TOOLBAR_CONTENT_VALUE_CLASS_NAME,children:[(e/1e3).toFixed(1),"s"]}):null},TimeRange_Switch=/*#__PURE__*/react.memo(TimeRange_Switch_Switch),DeltaMeasurementSwitch=()=>{let{state:{deltaMeasurement:e},dispatch:t}=useStore_useStore(),{show:r,display:n}=e,a=external_react_useCallback(r=>{t({payload:{deltaMeasurement:{...e,display:r}}})},[e,t]);return r?/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",onClick:()=>a(!n),title:n?"退出Δ测量模式":"进入Δ测量模式",children:/*#__PURE__*/jsx_runtime_jsx(icons_DeltaMeasurementIcon,{})}):null},DeltaMeasurement_Switch=DeltaMeasurementSwitch,FrequencyAllocation_Switch_Switch=()=>{let{state:{frequencyAllocation:e},dispatch:t}=useStore_useStore(),{display:r,show:n}=e,a=external_react_useCallback(r=>{t({payload:{frequencyAllocation:{...e,display:!!r}}})},[e]);return n?/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:r,tone:"primary",onClick:()=>{a(!r)},title:"频率划分",children:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{fill:"currentColor",opacity:"0.75",d:"M64 192h896v96H64zM64 736h896v96H64zM192 352h192v320H192zM448 352h192v320H448zM704 352h192v320H704z"})})}):null},FrequencyAllocation_Switch=FrequencyAllocation_Switch_Switch,Limit_Switch_Switch=()=>{let{state:{limit:e},dispatch:t}=useStore_useStore(),{show:r,active:n}=e,a=external_react_useCallback(r=>{t({payload:{limit:{...e,active:!!r}}})},[e]);return r?/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",onClick:()=>{a(!n)},title:"门限",children:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",style:{transform:"scaleX(-1) scale(1, 0.75)"},children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M256 384l0-384 768 0 0 384-64 0 0-320-640 0 0 320zM1024 576l0 448-768 0 0-448 64 0 0 384 640 0 0-384zM512 448l128 0 0 64-128 0zM320 448l128 0 0 64-128 0zM704 448l128 0 0 64-128 0zM896 448l128 0 0 64-128 0zM0 288l192 192-192 192z",fillOpacity:".65",fill:"currentColor"})})}):null},Limit_Switch=/*#__PURE__*/react.memo(Limit_Switch_Switch),globalStoreStates=new Map,setGlobalStoreState=(e,t)=>{let r=getChartRuntime(e);r?r.store.setState(t):globalStoreStates.set(e,t)},getGlobalStoreState=e=>{let t=runtime_getChartRuntime(e);return t?t.getState():globalStoreStates.get(e)||null},clearGlobalStoreState=e=>{e&&globalStoreStates.delete(e)},MARKER_UPDATE_ATTRIBUTE=(e,t)=>subscription_createSubscriptionManager(`MARKER_UPDATE_ATTRIBUTE-${e}`,"0",t,e),MARKER_UPDATE_RESET=(e,t)=>createSubscriptionManager(`MARKER_UPDATE_RESET-${e}`,"0",t,e),MARKER_COUNT_CHANGE=(e,t)=>subscription_createSubscriptionManager(`MARKER_COUNT_CHANGE-${e}`,"0",t,e),MARKER_SELECTION_CHANGE=(e,t)=>subscription_createSubscriptionManager(`MARKER_SELECTION_CHANGE-${e}`,"0",t,e),MARKER_COMMAND=(e,t)=>subscription_createSubscriptionManager(`MARKER_COMMAND-${e}`,"0",t,e),leftDataSelectMax=(e,t)=>{let r=t?.length,n=Math.round(r*e/100)-1;if(!n&&0!==n||r<=1||n>r-1)return e;let a=0,i=r-1,o=n-1,l=n+1;o>=0&&(a=o),l<=i&&(i=l);let s=n,c=t[s];for(let e=a;e<=i;e+=1){let r=t[e];r>c&&(c=r,s=e)}return(s+1)*100/r};function fixLocation(e,t){let r=1/t;return 100===e?100:(Math.floor(e/100/r)*r+r/2)*100}function splitZoomLeft({left:e,globalID:t}){let{zoom:r,segments:n}=getGlobalStoreState(t),{start:a,end:i}=r.interval,o=n.totalPoints,l=i-a+1;return{insideLeft:(e*o/100-a)*100/l,outsideLeft:100*a/o,multiple:o/l}}function findMaxPeak(e){let t=e?.length;if(!t)return null;let r=-1/0,n=0;for(let a=0;a<t;a+=1){let t=e[a];t>r&&(r=t,n=a)}return{value:r,index:n}}function findPeaks(e){let t=findMaxPeak(e);return t?[t]:null}function findTopPeaks(e,t=2,r=.1,n=10){let a=e?.length;if(!a||t<=0)return[];let i=findMaxPeak(e);if(!i)return[];let o=i.value*r,l=[],s=e=>{for(let t=0;t<l.length;t+=1){let r=l[t];if(Math.abs(r.index-e.index)<n){e.value>r.value&&(l[t]=e);return}}if(l.length<t){l.push(e),l.sort((e,t)=>t.value-e.value);return}let r=l[l.length-1];e.value>r.value&&(l[l.length-1]=e,l.sort((e,t)=>t.value-e.value))};for(let t=1;t<a-1;t+=1){let r=e[t];if(r<o)continue;let n=e[t-1],a=e[t+1];r>n&&r>a&&s({value:r,index:t})}return l}function findMultiplePeaks(e,t=.1,r=10){let n=e?.length;if(!n)return[];let a=[],i=-1/0;for(let t=0;t<n;t+=1){let r=e[t];r>i&&(i=r)}let o=i*t;for(let t=1;t<n-1;t++){let n=e[t],i=e[t-1],l=e[t+1];n>i&&n>l&&n>=o&&(a.some(e=>Math.abs(e.index-t)<r)||a.push({value:n,index:t}))}return a.sort((e,t)=>t.value-e.value)}function findNearbyPeak(e,t,r=5){let n=e?.length;if(!n||t<0||t>=n)return null;let a=Math.max(0,t-r),i=Math.min(n-1,t+r),o=-1/0,l=t;for(let t=a;t<=i;t++)e[t]>o&&(o=e[t],l=t);return{value:o,index:l}}let setMarkerMove=(e,t,r)=>{let{frequency:n,id:a}=e,i=t[0];if(void 0!==n&&i){let{start:e,stop:t}=i,o=t-e;void 0!==o&&n<t&&n>e&&r?.({pstype:PSType.Marker,event:MarkerEventType.Update,id:a,left:(n-e)*100/o})}},setMarkerBatchAdd=(e,t,r)=>{let{data:n,...a}=e,i=t[0];if(n?.length&&i){let{start:e,stop:t}=i,o=t-e;if(void 0!==o){let i=[];for(let r=0;r<n.length;r+=1){let a=n[r];a<=t&&a>=e&&i.push((a-e)*100/o)}i.length>0&&r?.({...a,pstype:PSType.Marker,event:MarkerEventType.Add,data:i})}}},validateMarkerPosition=(e,t)=>{if(e<0||e>100)return!1;let r=t[0];if(!r)return!1;let{start:n,stop:a}=r,i=n+e*(a-n)/100;return i>=n&&i<=a},calculateMarkerFrequency=(e,t)=>{let r=t[0];if(!r)return null;let{start:n,stop:a}=r;return n+e*(a-n)/100},Markers_Switch_Switch=()=>{let{state:{globalID:e,marker:t},dispatch:r}=useStore_useStore(),{enabled:n,visible:a,maxCount:i}=t,[o,l]=external_react_useState(0),[s,c]=external_react_useState(null);external_react_useEffect(()=>{if(e){let t=MARKER_COUNT_CHANGE(e,e=>{e&&l(t=>t===e.count?t:e.count)});return()=>{t?.()}}},[e]),external_react_useEffect(()=>{if(e){let t=MARKER_SELECTION_CHANGE(e,e=>{c(e?.selectedId??null)});return()=>{t?.()}}},[e]);let u=external_react_useCallback(e=>{r({payload:{marker:{...t,visible:!!e}}})},[t,r]);external_react_useEffect(()=>{if(!n)return;let e=e=>{if("m"!==e.key.toLowerCase()||e.repeat)return;let t=e.target;t?.tagName==="INPUT"||t?.tagName==="TEXTAREA"||t?.isContentEditable||(e.preventDefault(),u(!a))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[n,a,u]);let d=i>0?i:5,h=o>=d,p=!!s,f=external_react_useMemo(()=>/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M643.657143 241.956571L913.700571 512 643.657143 782.043429 373.613714 512z",fill:"currentColor",opacity:"0.5"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M380.342857 241.956571L650.386286 512 380.342857 782.043429 110.299429 512z",fill:"currentColor"})]}),[]),m=external_react_useCallback(()=>{e&&s&&MARKER_COMMAND(e)({type:"left-peak",selectedId:s})},[e,s]),g=external_react_useCallback(()=>{e&&s&&MARKER_COMMAND(e)({type:"right-peak",selectedId:s})},[e,s]),b=external_react_useCallback(()=>{e&&MARKER_COMMAND(e)({type:"create-main-peak"})},[e]),v=external_react_useCallback(()=>{e&&MARKER_COMMAND(e)({type:"create-secondary-peak"})},[e]),w=external_react_useCallback(()=>{e&&MARKER_COMMAND(e)({type:"clear-all"})},[e]);if(!n)return null;let y=o>0,x=/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M724 218L512 430 300 218l-82 82 294 294 294-294z",fill:"currentColor",transform:"rotate(90 512 512)"})}),k=/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M724 218L512 430 300 218l-82 82 294 294 294-294z",fill:"currentColor",transform:"rotate(-90 512 512)"})}),S=/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M200 750L400 450 512 200 624 450 824 750",stroke:"currentColor",strokeWidth:"80",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),/*#__PURE__*/jsx_runtime_jsx("circle",{cx:"512",cy:"200",r:"60",fill:"currentColor"})]}),D=/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M150 750L300 400 450 550 600 250 750 500 900 750",stroke:"currentColor",strokeWidth:"70",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),/*#__PURE__*/jsx_runtime_jsx("circle",{cx:"450",cy:"550",r:"50",fill:"currentColor"})]}),M=/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",style:{transform:"scale(0.9)"},children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72z",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M864 256H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h466c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z",fill:"currentColor"})]}),F=`标记点控制 (M键切换)
3824
+ )`}:{background:"transparent"},[i,o,l]),f=external_react_useMemo(()=>0===i&&o===s,[i,o,s]);return n?/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarContentBox,{active:!c&&!f,tone:"primary",disabled:c,onClick:c?void 0:h,title:"缩放:左键按住移动,滚轮缩放,右键框选,点击全景展示",contentClassName:TOOLBAR_CONTENT_ICON_CLASS_NAME,children:c||f?/*#__PURE__*/jsx_runtime_jsx("svg",{width:"16",height:"16",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M388.266667 512L290.133333 413.866667l29.866667-29.866667 149.333333 149.333333L320 682.666667l-29.866667-29.866667L388.266667 554.666667H128v-42.666667h260.266667z m290.133333 0H938.666667v42.666667h-260.266667l98.133333 98.133333-29.866666 29.866667-149.333334-149.333334L746.666667 384l29.866666 29.866667-98.133333 98.133333z",fill:"currentColor"})}):/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex h-full w-4 bg-chart-surface",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full w-full opacity-30",style:p})})}):null},Switch=ZoomSwitch,FluorescenceSwitch=()=>{let{state:{fluorescence:e},dispatch:t}=useStore_useStore(),{show:r,display:n,renderMode:a=FluorescenceRenderMode.Gaussian}=e,i=external_react_useCallback(()=>{t({payload:{fluorescence:{...e,display:!n}}})},[e,n,t]),o=external_react_useCallback(r=>{null!==r&&t({payload:{fluorescence:{...e,renderMode:r}}})},[e,t]),l=external_react_useMemo(()=>`荧光谱:${n?"显示":"隐藏"}`,[n]),s=a===FluorescenceRenderMode.Gaussian?()=>/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{fill:"currentColor",d:"M905.7 588.2C760 439.5 774.8 382.9 796.2 323.6c21.5-59.3-30.6-320.6-223.6-219C379.5 206.2 437 342.1 299.3 336c-137.7-6-306.9 67.8-206 340.2 39.5 106.4 114.5 209.7 230.6 224.6s306.8-23 422.9 34.7c116.2 57.6 304.5-198.6 158.9-347.3zM715.5 867c-98-45.6-258.3-18.8-356.8-29.7S184.3 757.8 152 671.8C69.2 452 229.3 389.9 346.2 393.5 463 397 413.5 260.9 578.3 176.7c164.9-84.2 175.4 133.9 156.6 182.2C713.1 414.7 715 467.7 842.5 592c122.3 119.1-28.9 320.7-127 275z"}),/*#__PURE__*/jsx_runtime_jsx("path",{fill:"currentColor",d:"M433.4 501c-88.1 41.2-99.5-56.2-207.6 36.8-53 45.6-7.5 153.6 60.8 175.7 68.4 22.2 135.9-2.3 189-48.4 53-46.3 46-205.5-42.2-164.1zM665.8 464.6c-4.3-103.8 47.5-259.5-55.4-233-63.3 16.3-122.9 122.4-97.3 169.7 25.6 47.1 80.7 130.9 62.6 191.6-18 60.6-4.6 134.2 55.7 156 60.4 21.8 189.4 14.5 191.1-49.1 1.6-63.6-152.3-131.3-156.7-235.2z"})]}):()=>/*#__PURE__*/jsxs("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("rect",{x:"1.9",y:"1.9",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.6"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"6.6",y:"1.9",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.75"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"11.3",y:"1.9",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.85"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"1.9",y:"6.6",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.7"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",fill:"currentColor",opacity:"1"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"11.3",y:"6.6",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.9"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"1.9",y:"11.3",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.8"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"6.6",y:"11.3",width:"2.8",height:"2.8",fill:"currentColor",opacity:"0.95"}),/*#__PURE__*/jsx_runtime_jsx("rect",{x:"11.3",y:"11.3",width:"2.8",height:"2.8",fill:"currentColor",opacity:"1"})]}),c=a===FluorescenceRenderMode.Grid?-.5:0,u=a===FluorescenceRenderMode.Grid?.94:1,d=external_react_useMemo(()=>[{value:FluorescenceRenderMode.Grid,label:"栅格",render:()=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("text-xs text-foreground",a===FluorescenceRenderMode.Grid&&"text-primary"),children:"栅格渲染"})},{value:FluorescenceRenderMode.Gaussian,label:"高斯",render:()=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("text-xs text-foreground",a===FluorescenceRenderMode.Gaussian&&"text-primary"),children:"高斯渲染"})}],[a]);return r?n?/*#__PURE__*/jsx_runtime_jsx(ToolbarDropdownGroup,{leading:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:n,tone:"primary",onClick:i,title:l,children:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGlyph,{opticalOffsetY:c,opticalScale:u,children:/*#__PURE__*/jsx_runtime_jsx(s,{})})}),value:a,options:d,onChange:o}):/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",onClick:i,title:l,children:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGlyph,{opticalOffsetY:c,opticalScale:u,children:/*#__PURE__*/jsx_runtime_jsx(s,{})})}):null},Fluorescence_Switch=FluorescenceSwitch,DeltaMeasurementIcon=()=>/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",style:{transition:"transform 0.2s ease"},children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M512 200 L812 824 L212 824 Z",fill:"none",stroke:"currentColor",strokeWidth:"60",strokeLinejoin:"miter"}),/*#__PURE__*/jsx_runtime_jsx("line",{x1:"350",y1:"650",x2:"674",y2:"650",stroke:"currentColor",strokeWidth:"40",strokeDasharray:"10,10"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M 360 650 L 390 630 L 390 670 Z",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M 664 650 L 634 630 L 634 670 Z",fill:"currentColor"})]}),icons_DeltaMeasurementIcon=DeltaMeasurementIcon,Switch_Switch=()=>{let{state:{heatmapCapture:e},dispatch:t}=useStore_useStore(),{show:r,display:n,type:a,toolbarVariant:i}=e,{title:o,icon:l}=external_react_useMemo(()=>{if("deltaMeasurement"===i)return{title:n?"退出Δ测量模式":"进入Δ测量模式",icon:/*#__PURE__*/jsx_runtime_jsx(icons_DeltaMeasurementIcon,{})};let e="瀑布图捕获-区域测量",t=/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_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_runtime_jsx("path",{d:"M784.4 615.7h51v233h-51z",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M693.4 706.7h233v51h-233z",fill:"currentColor"})]});return a===heatmap_HeatmapCaptureType.Slider&&(e="瀑布图捕获-滑块",t=/*#__PURE__*/jsx_runtime_jsx("path",{d:"M800 124H224c-55 0-100 45-100 100v576c0 55 45 100 100 100h576c55 0 100-45 100-100V224c0-55-45-100-100-100zM224 224h576v576H224V224z M700 324v376H324V324h376z",fill:"currentColor",stroke:"currentColor",strokeWidth:"2"})),a===heatmap_HeatmapCaptureType.RowIndex&&(e="瀑布图捕获-行选中",t=/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M800 124H224c-55 0-100 45-100 100v576c0 55 45 100 100 100h576c55 0 100-45 100-100V224c0-55-45-100-100-100zM224 224h576v576H224V224z",fill:"none",stroke:"currentColor",strokeWidth:"30"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M224 512h576",stroke:"currentColor",strokeWidth:"30"})]})),{title:e,icon:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:t})}},[a,n,i]),s=external_react_useCallback(r=>{t({payload:{heatmapCapture:{...e,display:!!r}}})},[e]);return r?/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",onClick:()=>{s(!n)},title:o,children:l}):null},Capture_Switch=/*#__PURE__*/react.memo(Switch_Switch),MIN_TIME=500,MAX_TIME=5e3,STEP=100,TimeRange_Switch_Switch=()=>{let{state:{timeRange:e},dispatch:t}=useStore_useStore(),r=external_react_useCallback(r=>{if(!e)return;let n=r.deltaY<0?e+STEP:e-STEP;t({payload:{timeRange:n=Math.max(MIN_TIME,Math.min(MAX_TIME,n))}})},[e,t]);return e?/*#__PURE__*/jsxs(primitives_ToolbarContentBox,{title:"瀑布图时间控制",onWheel:r,contentClassName:TOOLBAR_CONTENT_VALUE_CLASS_NAME,children:[(e/1e3).toFixed(1),"s"]}):null},TimeRange_Switch=/*#__PURE__*/react.memo(TimeRange_Switch_Switch),DeltaMeasurementSwitch=()=>{let{state:{deltaMeasurement:e},dispatch:t}=useStore_useStore(),{show:r,display:n}=e,a=external_react_useCallback(r=>{t({payload:{deltaMeasurement:{...e,display:r}}})},[e,t]);return r?/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",onClick:()=>a(!n),title:n?"退出Δ测量模式":"进入Δ测量模式",children:/*#__PURE__*/jsx_runtime_jsx(icons_DeltaMeasurementIcon,{})}):null},DeltaMeasurement_Switch=DeltaMeasurementSwitch,FrequencyAllocation_Switch_Switch=()=>{let{state:{frequencyAllocation:e},dispatch:t}=useStore_useStore(),{display:r,show:n}=e,a=external_react_useCallback(r=>{t({payload:{frequencyAllocation:{...e,display:!!r}}})},[e]);return n?/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:r,tone:"primary",onClick:()=>{a(!r)},title:"频率划分",children:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{fill:"currentColor",opacity:"0.75",d:"M64 192h896v96H64zM64 736h896v96H64zM192 352h192v320H192zM448 352h192v320H448zM704 352h192v320H704z"})})}):null},FrequencyAllocation_Switch=FrequencyAllocation_Switch_Switch,Limit_Switch_Switch=()=>{let{state:{limit:e},dispatch:t}=useStore_useStore(),{show:r,active:n}=e,a=external_react_useCallback(r=>{t({payload:{limit:{...e,active:!!r}}})},[e]);return r?/*#__PURE__*/jsx_runtime_jsx(primitives_IconBox,{active:n,tone:"primary",onClick:()=>{a(!n)},title:"门限",children:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",style:{transform:"scaleX(-1) scale(1, 0.75)"},children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M256 384l0-384 768 0 0 384-64 0 0-320-640 0 0 320zM1024 576l0 448-768 0 0-448 64 0 0 384 640 0 0-384zM512 448l128 0 0 64-128 0zM320 448l128 0 0 64-128 0zM704 448l128 0 0 64-128 0zM896 448l128 0 0 64-128 0zM0 288l192 192-192 192z",fillOpacity:".65",fill:"currentColor"})})}):null},Limit_Switch=/*#__PURE__*/react.memo(Limit_Switch_Switch),globalStoreStates=new Map,setGlobalStoreState=(e,t)=>{let r=getChartRuntime(e);r?r.store.setState(t):globalStoreStates.set(e,t)},getGlobalStoreState=e=>{let t=runtime_getChartRuntime(e);return t?t.getState():globalStoreStates.get(e)||null},clearGlobalStoreState=e=>{e&&globalStoreStates.delete(e)},MARKER_UPDATE_ATTRIBUTE=(e,t)=>subscription_createSubscriptionManager(`MARKER_UPDATE_ATTRIBUTE-${e}`,"0",t,e),MARKER_UPDATE_RESET=(e,t)=>createSubscriptionManager(`MARKER_UPDATE_RESET-${e}`,"0",t,e),MARKER_COUNT_CHANGE=(e,t)=>subscription_createSubscriptionManager(`MARKER_COUNT_CHANGE-${e}`,"0",t,e),MARKER_SELECTION_CHANGE=(e,t)=>subscription_createSubscriptionManager(`MARKER_SELECTION_CHANGE-${e}`,"0",t,e),MARKER_COMMAND=(e,t)=>subscription_createSubscriptionManager(`MARKER_COMMAND-${e}`,"0",t,e),leftDataSelectMax=(e,t)=>{let r=t?.length,n=Math.round(r*e/100)-1;if(!n&&0!==n||r<=1||n>r-1)return e;let a=0,i=r-1,o=n-1,l=n+1;o>=0&&(a=o),l<=i&&(i=l);let s=n,c=t[s];for(let e=a;e<=i;e+=1){let r=t[e];r>c&&(c=r,s=e)}return(s+1)*100/r};function fixLocation(e,t){let r=1/t;return 100===e?100:(Math.floor(e/100/r)*r+r/2)*100}function splitZoomLeft({left:e,globalID:t}){let{zoom:r,segments:n}=getGlobalStoreState(t),{start:a,end:i}=r.interval,o=n.totalPoints,l=i-a+1;return{insideLeft:(e*o/100-a)*100/l,outsideLeft:100*a/o,multiple:o/l}}function findMaxPeak(e){let t=e?.length;if(!t)return null;let r=-1/0,n=0;for(let a=0;a<t;a+=1){let t=e[a];t>r&&(r=t,n=a)}return{value:r,index:n}}function findPeaks(e){let t=findMaxPeak(e);return t?[t]:null}function findTopPeaks(e,t=2,r=.1,n=10){let a=e?.length;if(!a||t<=0)return[];let i=findMaxPeak(e);if(!i)return[];let o=i.value*r,l=[],s=e=>{for(let t=0;t<l.length;t+=1){let r=l[t];if(Math.abs(r.index-e.index)<n){e.value>r.value&&(l[t]=e);return}}if(l.length<t){l.push(e),l.sort((e,t)=>t.value-e.value);return}let r=l[l.length-1];e.value>r.value&&(l[l.length-1]=e,l.sort((e,t)=>t.value-e.value))};for(let t=1;t<a-1;t+=1){let r=e[t];if(r<o)continue;let n=e[t-1],a=e[t+1];r>n&&r>a&&s({value:r,index:t})}return l}function findMultiplePeaks(e,t=.1,r=10){let n=e?.length;if(!n)return[];let a=[],i=-1/0;for(let t=0;t<n;t+=1){let r=e[t];r>i&&(i=r)}let o=i*t;for(let t=1;t<n-1;t++){let n=e[t],i=e[t-1],l=e[t+1];n>i&&n>l&&n>=o&&(a.some(e=>Math.abs(e.index-t)<r)||a.push({value:n,index:t}))}return a.sort((e,t)=>t.value-e.value)}function findNearbyPeak(e,t,r=5){let n=e?.length;if(!n||t<0||t>=n)return null;let a=Math.max(0,t-r),i=Math.min(n-1,t+r),o=-1/0,l=t;for(let t=a;t<=i;t++)e[t]>o&&(o=e[t],l=t);return{value:o,index:l}}let setMarkerMove=(e,t,r)=>{let{frequency:n,id:a}=e,i=t[0];if(void 0!==n&&i){let{start:e,stop:t}=i,o=t-e;void 0!==o&&n<t&&n>e&&r?.({pstype:PSType.Marker,event:MarkerEventType.Update,id:a,left:(n-e)*100/o})}},setMarkerBatchAdd=(e,t,r)=>{let{data:n,...a}=e,i=t[0];if(n?.length&&i){let{start:e,stop:t}=i,o=t-e;if(void 0!==o){let i=[];for(let r=0;r<n.length;r+=1){let a=n[r];a<=t&&a>=e&&i.push((a-e)*100/o)}i.length>0&&r?.({...a,pstype:PSType.Marker,event:MarkerEventType.Add,data:i})}}},validateMarkerPosition=(e,t)=>{if(e<0||e>100)return!1;let r=t[0];if(!r)return!1;let{start:n,stop:a}=r,i=n+e*(a-n)/100;return i>=n&&i<=a},calculateMarkerFrequency=(e,t)=>{let r=t[0];if(!r)return null;let{start:n,stop:a}=r;return n+e*(a-n)/100},Markers_Switch_Switch=()=>{let{state:{globalID:e,marker:t},dispatch:r}=useStore_useStore(),{enabled:n,visible:a,maxCount:i,readonly:o}=t,l=n&&!o,[s,c]=external_react_useState(0),[u,d]=external_react_useState(null);external_react_useEffect(()=>{if(e&&l){let t=MARKER_COUNT_CHANGE(e,e=>{e&&c(t=>t===e.count?t:e.count)});return()=>{t?.()}}},[e,l]),external_react_useEffect(()=>{if(e&&l){let t=MARKER_SELECTION_CHANGE(e,e=>{d(e?.selectedId??null)});return()=>{t?.()}}},[e,l]);let h=external_react_useCallback(e=>{r({payload:{marker:{...t,visible:!!e}}})},[t,r]);external_react_useEffect(()=>{if(!l)return;let e=e=>{if("m"!==e.key.toLowerCase()||e.repeat)return;let t=e.target;t?.tagName==="INPUT"||t?.tagName==="TEXTAREA"||t?.isContentEditable||(e.preventDefault(),h(!a))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[l,a,h]);let p=i>0?i:5,f=s>=p,m=!!u,g=external_react_useMemo(()=>/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M643.657143 241.956571L913.700571 512 643.657143 782.043429 373.613714 512z",fill:"currentColor",opacity:"0.5"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M380.342857 241.956571L650.386286 512 380.342857 782.043429 110.299429 512z",fill:"currentColor"})]}),[]),b=external_react_useCallback(()=>{e&&u&&MARKER_COMMAND(e)({type:"left-peak",selectedId:u})},[e,u]),v=external_react_useCallback(()=>{e&&u&&MARKER_COMMAND(e)({type:"right-peak",selectedId:u})},[e,u]),w=external_react_useCallback(()=>{e&&MARKER_COMMAND(e)({type:"create-main-peak"})},[e]),y=external_react_useCallback(()=>{e&&MARKER_COMMAND(e)({type:"create-secondary-peak"})},[e]),x=external_react_useCallback(()=>{e&&MARKER_COMMAND(e)({type:"clear-all"})},[e]);if(!l)return null;let k=s>0,S=/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M724 218L512 430 300 218l-82 82 294 294 294-294z",fill:"currentColor",transform:"rotate(90 512 512)"})}),D=/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("path",{d:"M724 218L512 430 300 218l-82 82 294 294 294-294z",fill:"currentColor",transform:"rotate(-90 512 512)"})}),M=/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M200 750L400 450 512 200 624 450 824 750",stroke:"currentColor",strokeWidth:"80",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),/*#__PURE__*/jsx_runtime_jsx("circle",{cx:"512",cy:"200",r:"60",fill:"currentColor"})]}),F=/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M150 750L300 400 450 550 600 250 750 500 900 750",stroke:"currentColor",strokeWidth:"70",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),/*#__PURE__*/jsx_runtime_jsx("circle",{cx:"450",cy:"550",r:"50",fill:"currentColor"})]}),C=/*#__PURE__*/jsxs("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",style:{transform:"scale(0.9)"},children:[/*#__PURE__*/jsx_runtime_jsx("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72z",fill:"currentColor"}),/*#__PURE__*/jsx_runtime_jsx("path",{d:"M864 256H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h466c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z",fill:"currentColor"})]}),E=`标记点控制 (M键切换)
3821
3825
  ━━━━━━━━━━━━━━━━
3822
3826
  • 点击图表:添加标记
3823
3827
  • 点击标记:删除标记
3824
3828
  • 长按标记:选中/取消
3825
3829
  • 拖拽标记:移动位置
3826
3830
  • A/D:左/右峰值
3827
- • W/S:主/次峰值${h?`
3831
+ • W/S:主/次峰值${f?`
3828
3832
  ━━━━━━━━━━━━━━━━
3829
- ⚠ 已达最大数量 ${d}`:""}`;return /*#__PURE__*/jsx_runtime_jsx("div",{className:"relative select-none",children:/*#__PURE__*/jsxs(ToolbarGroup,{children:[/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:a||y||h,tone:h?"warning":"primary",onClick:()=>u(!a),title:F,children:f}),a&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx(ToolbarGroupSeparator,{}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:p,tone:"primary",className:cn_cn(!p&&"opacity-40"),onClick:p?m:void 0,title:"左峰值",children:x}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:p,tone:"primary",className:cn_cn(!p&&"opacity-40"),onClick:p?g:void 0,title:"右峰值",children:k}),/*#__PURE__*/jsx_runtime_jsx(ToolbarGroupSeparator,{}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:!0,tone:"primary",onClick:b,title:"主峰值",children:S}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:!0,tone:"primary",onClick:v,title:"次峰值",children:D}),/*#__PURE__*/jsx_runtime_jsx(ToolbarGroupSeparator,{}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:y,tone:"destructive",className:cn_cn(!y&&"opacity-40"),onClick:y?w:void 0,title:"清除所有",children:M})]})]})})},Markers_Switch=Markers_Switch_Switch,chevron_down_iconNode=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ChevronDown=createLucideIcon("chevron-down",chevron_down_iconNode),chevron_right_iconNode=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ChevronRight=createLucideIcon("chevron-right",chevron_right_iconNode);var react_checkbox_dist_defProp=Object.defineProperty,react_checkbox_dist_name=(e,t)=>react_checkbox_dist_defProp(e,"name",{value:t,configurable:!0}),CHECKBOX_NAME="Checkbox",[createCheckboxContext,createCheckboxScope]=createContextScope(CHECKBOX_NAME),[CheckboxProviderImpl,useCheckboxContext]=createCheckboxContext(CHECKBOX_NAME);function CheckboxProvider(e){let{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:i,form:o,name:l,onCheckedChange:s,required:c,value:u="on",internal_do_not_use_render:d}=e,[h,p]=dist_useControllableState({prop:r,defaultProp:a??!1,onChange:s,caller:CHECKBOX_NAME}),[f,m]=__rspack_external_react.useState(null),[g,b]=__rspack_external_react.useState(null),v=__rspack_external_react.useRef(!1),[w,y]=__rspack_external_react.useReducer(e=>e+1,0),x=!f||!!o||!!f.closest("form"),k={checked:h,disabled:i,setChecked:p,control:f,setControl:m,name:l,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:w,onUserInteraction:y,required:c,defaultChecked:!dist_isIndeterminate(a)&&a,isFormControl:x,bubbleInput:g,setBubbleInput:b};return /* @__PURE__ */jsx_runtime_jsx(CheckboxProviderImpl,{scope:t,...k,children:dist_isFunction(d)?d(k):n})}react_checkbox_dist_name(CheckboxProvider,"CheckboxProvider");var react_checkbox_dist_TRIGGER_NAME="CheckboxTrigger",CheckboxTrigger=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_checkbox_dist_name(function({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a){let{control:i,value:o,disabled:l,checked:s,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:h,onUserInteraction:p,isFormControl:f,bubbleInput:m}=useCheckboxContext(react_checkbox_dist_TRIGGER_NAME,e),g=dist_useComposedRefs(a,u),b=__rspack_external_react.useRef(s);return __rspack_external_react.useEffect(()=>{let e=i?.form;if(e){let t=/* @__PURE__ */react_checkbox_dist_name(()=>d(b.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[i,d]),/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.button,{type:"button",role:"checkbox","aria-checked":dist_isIndeterminate(s)?"mixed":s,"aria-required":c,"data-state":getState(s),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:g,onKeyDown:dist_composeEventHandlers(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:dist_composeEventHandlers(r,e=>{p(),d(e=>!!dist_isIndeterminate(e)||!e),m&&f&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})},"CheckboxTrigger")),Checkbox=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_checkbox_dist_name(function(e,t){let{__scopeCheckbox:r,name:n,checked:a,defaultChecked:i,required:o,disabled:l,value:s,onCheckedChange:c,form:u,...d}=e;return /* @__PURE__ */jsx_runtime_jsx(CheckboxProvider,{__scopeCheckbox:r,checked:a,defaultChecked:i,disabled:l,required:o,onCheckedChange:c,name:n,form:u,value:s,internal_do_not_use_render:({isFormControl:e})=>/* @__PURE__ */jsxs(Fragment,{children:[/* @__PURE__ */jsx_runtime_jsx(CheckboxTrigger,{...d,ref:t,__scopeCheckbox:r}),e&&/* @__PURE__ */jsx_runtime_jsx(CheckboxBubbleInput,{__scopeCheckbox:r})]})})},"Checkbox")),INDICATOR_NAME="CheckboxIndicator",CheckboxIndicator=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_checkbox_dist_name(function(e,t){let{__scopeCheckbox:r,forceMount:n,...a}=e,i=useCheckboxContext(INDICATOR_NAME,r);return /* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:n||dist_isIndeterminate(i.checked)||!0===i.checked,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.span,{"data-state":getState(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),BUBBLE_INPUT_NAME="CheckboxBubbleInput",CheckboxBubbleInput=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_checkbox_dist_name(function({__scopeCheckbox:e,onClick:t,...r},n){let{control:a,hasConsumerStoppedPropagationRef:i,userInteractionCount:o,checked:l,defaultChecked:s,required:c,disabled:u,name:d,value:h,form:p,bubbleInput:f,setBubbleInput:m}=useCheckboxContext(BUBBLE_INPUT_NAME,e),g=dist_useComposedRefs(n,m),b=useSize(a),v=__rspack_external_react.useRef(!1),w=__rspack_external_react.useRef(l),y=__rspack_external_react.useRef(o);__rspack_external_react.useEffect(()=>{if(!f)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=o!==y.current;y.current=o;let r=w.current!==l;w.current=l;let n=!(t&&i.current);if(r&&e){v.current=!t;let r=new Event("click",{bubbles:n});f.indeterminate=dist_isIndeterminate(l),e.call(f,!dist_isIndeterminate(l)&&l),f.dispatchEvent(r),v.current=!1}},[f,l,i,o]);let x=__rspack_external_react.useRef(!dist_isIndeterminate(l)&&l);return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:c,disabled:u,name:d,value:h,form:p,...r,tabIndex:-1,ref:g,onClick:dist_composeEventHandlers(t,e=>{v.current&&e.stopPropagation()}),style:{...r.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function dist_isFunction(e){return"function"==typeof e}function dist_isIndeterminate(e){return"indeterminate"===e}function getState(e){return dist_isIndeterminate(e)?"indeterminate":e?"checked":"unchecked"}react_checkbox_dist_name(dist_isFunction,"isFunction"),react_checkbox_dist_name(dist_isIndeterminate,"isIndeterminate"),react_checkbox_dist_name(getState,"getState");/**
3833
+ ⚠ 已达最大数量 ${p}`:""}`;return /*#__PURE__*/jsx_runtime_jsx("div",{className:"relative select-none",children:/*#__PURE__*/jsxs(ToolbarGroup,{children:[/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:a||k||f,tone:f?"warning":"primary",onClick:()=>h(!a),title:E,children:g}),a&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx(ToolbarGroupSeparator,{}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:m,tone:"primary",className:cn_cn(!m&&"opacity-40"),onClick:m?b:void 0,title:"左峰值",children:S}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:m,tone:"primary",className:cn_cn(!m&&"opacity-40"),onClick:m?v:void 0,title:"右峰值",children:D}),/*#__PURE__*/jsx_runtime_jsx(ToolbarGroupSeparator,{}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:!0,tone:"primary",onClick:w,title:"主峰值",children:M}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:!0,tone:"primary",onClick:y,title:"次峰值",children:F}),/*#__PURE__*/jsx_runtime_jsx(ToolbarGroupSeparator,{}),/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:k,tone:"destructive",className:cn_cn(!k&&"opacity-40"),onClick:k?x:void 0,title:"清除所有",children:C})]})]})})},Markers_Switch=Markers_Switch_Switch,chevron_down_iconNode=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ChevronDown=createLucideIcon("chevron-down",chevron_down_iconNode),chevron_right_iconNode=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ChevronRight=createLucideIcon("chevron-right",chevron_right_iconNode);var react_checkbox_dist_defProp=Object.defineProperty,react_checkbox_dist_name=(e,t)=>react_checkbox_dist_defProp(e,"name",{value:t,configurable:!0}),CHECKBOX_NAME="Checkbox",[createCheckboxContext,createCheckboxScope]=createContextScope(CHECKBOX_NAME),[CheckboxProviderImpl,useCheckboxContext]=createCheckboxContext(CHECKBOX_NAME);function CheckboxProvider(e){let{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:i,form:o,name:l,onCheckedChange:s,required:c,value:u="on",internal_do_not_use_render:d}=e,[h,p]=dist_useControllableState({prop:r,defaultProp:a??!1,onChange:s,caller:CHECKBOX_NAME}),[f,m]=__rspack_external_react.useState(null),[g,b]=__rspack_external_react.useState(null),v=__rspack_external_react.useRef(!1),[w,y]=__rspack_external_react.useReducer(e=>e+1,0),x=!f||!!o||!!f.closest("form"),k={checked:h,disabled:i,setChecked:p,control:f,setControl:m,name:l,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:w,onUserInteraction:y,required:c,defaultChecked:!dist_isIndeterminate(a)&&a,isFormControl:x,bubbleInput:g,setBubbleInput:b};return /* @__PURE__ */jsx_runtime_jsx(CheckboxProviderImpl,{scope:t,...k,children:dist_isFunction(d)?d(k):n})}react_checkbox_dist_name(CheckboxProvider,"CheckboxProvider");var react_checkbox_dist_TRIGGER_NAME="CheckboxTrigger",CheckboxTrigger=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_checkbox_dist_name(function({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a){let{control:i,value:o,disabled:l,checked:s,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:h,onUserInteraction:p,isFormControl:f,bubbleInput:m}=useCheckboxContext(react_checkbox_dist_TRIGGER_NAME,e),g=dist_useComposedRefs(a,u),b=__rspack_external_react.useRef(s);return __rspack_external_react.useEffect(()=>{let e=i?.form;if(e){let t=/* @__PURE__ */react_checkbox_dist_name(()=>d(b.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[i,d]),/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.button,{type:"button",role:"checkbox","aria-checked":dist_isIndeterminate(s)?"mixed":s,"aria-required":c,"data-state":getState(s),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:g,onKeyDown:dist_composeEventHandlers(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:dist_composeEventHandlers(r,e=>{p(),d(e=>!!dist_isIndeterminate(e)||!e),m&&f&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})},"CheckboxTrigger")),Checkbox=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_checkbox_dist_name(function(e,t){let{__scopeCheckbox:r,name:n,checked:a,defaultChecked:i,required:o,disabled:l,value:s,onCheckedChange:c,form:u,...d}=e;return /* @__PURE__ */jsx_runtime_jsx(CheckboxProvider,{__scopeCheckbox:r,checked:a,defaultChecked:i,disabled:l,required:o,onCheckedChange:c,name:n,form:u,value:s,internal_do_not_use_render:({isFormControl:e})=>/* @__PURE__ */jsxs(Fragment,{children:[/* @__PURE__ */jsx_runtime_jsx(CheckboxTrigger,{...d,ref:t,__scopeCheckbox:r}),e&&/* @__PURE__ */jsx_runtime_jsx(CheckboxBubbleInput,{__scopeCheckbox:r})]})})},"Checkbox")),INDICATOR_NAME="CheckboxIndicator",CheckboxIndicator=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_checkbox_dist_name(function(e,t){let{__scopeCheckbox:r,forceMount:n,...a}=e,i=useCheckboxContext(INDICATOR_NAME,r);return /* @__PURE__ */jsx_runtime_jsx(dist_Presence,{present:n||dist_isIndeterminate(i.checked)||!0===i.checked,children:/* @__PURE__ */jsx_runtime_jsx(dist_Primitive.span,{"data-state":getState(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),BUBBLE_INPUT_NAME="CheckboxBubbleInput",CheckboxBubbleInput=/* @__PURE__ */__rspack_external_react.forwardRef(/* @__PURE__ */react_checkbox_dist_name(function({__scopeCheckbox:e,onClick:t,...r},n){let{control:a,hasConsumerStoppedPropagationRef:i,userInteractionCount:o,checked:l,defaultChecked:s,required:c,disabled:u,name:d,value:h,form:p,bubbleInput:f,setBubbleInput:m}=useCheckboxContext(BUBBLE_INPUT_NAME,e),g=dist_useComposedRefs(n,m),b=useSize(a),v=__rspack_external_react.useRef(!1),w=__rspack_external_react.useRef(l),y=__rspack_external_react.useRef(o);__rspack_external_react.useEffect(()=>{if(!f)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=o!==y.current;y.current=o;let r=w.current!==l;w.current=l;let n=!(t&&i.current);if(r&&e){v.current=!t;let r=new Event("click",{bubbles:n});f.indeterminate=dist_isIndeterminate(l),e.call(f,!dist_isIndeterminate(l)&&l),f.dispatchEvent(r),v.current=!1}},[f,l,i,o]);let x=__rspack_external_react.useRef(!dist_isIndeterminate(l)&&l);return /* @__PURE__ */jsx_runtime_jsx(dist_Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:c,disabled:u,name:d,value:h,form:p,...r,tabIndex:-1,ref:g,onClick:dist_composeEventHandlers(t,e=>{v.current&&e.stopPropagation()}),style:{...r.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function dist_isFunction(e){return"function"==typeof e}function dist_isIndeterminate(e){return"indeterminate"===e}function getState(e){return dist_isIndeterminate(e)?"indeterminate":e?"checked":"unchecked"}react_checkbox_dist_name(dist_isFunction,"isFunction"),react_checkbox_dist_name(dist_isIndeterminate,"isIndeterminate"),react_checkbox_dist_name(getState,"getState");/**
3830
3834
  * @license lucide-react v1.31.0 - ISC
3831
3835
  *
3832
3836
  * This source code is licensed under the ISC license.
3833
3837
  * See the LICENSE file in the root directory of this source tree.
3834
- */let minus_iconNode=[["path",{d:"M5 12h14",key:"1ays0h"}]],Minus=createLucideIcon("minus",minus_iconNode),check_iconNode=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Check=createLucideIcon("check",check_iconNode),checkbox_Checkbox=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,...t},r)=>/*#__PURE__*/jsx_runtime_jsx(Checkbox,{ref:r,"data-slot":"checkbox",className:cn_cn("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__*/jsx_runtime_jsx(CheckboxIndicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:"indeterminate"===t.checked?/*#__PURE__*/jsx_runtime_jsx(Minus,{className:"size-3.5"}):/*#__PURE__*/jsx_runtime_jsx(Check,{className:"size-3.5"})})}));checkbox_Checkbox.displayName=Checkbox.displayName;let toCheckboxValue=e=>"checked"===e||"indeterminate"===e&&"indeterminate",SignalNodeCount=({count:e,show:t,testId:r})=>t?/*#__PURE__*/jsxs("span",{className:"shrink-0 tabular-nums text-[11px] font-normal text-muted-foreground","data-testid":r,children:["(",e,")"]}):null,SignalTypeRow=({source:e,type:t,leafKeysWithData:r,hiddenKeys:n,showCount:a,expanded:i,onToggleExpanded:o,onToggleNode:l})=>{let s=resolveNodeCheckState(r,n,t.leafKeys),c=`signal-tree-type-checkbox-${e.source}-${t.signalType}`,u=t.levels.length>0,d=u?void 0:t.color??SIGNAL_TYPE_MAP[t.signalType].color;return /*#__PURE__*/jsxs("div",{children:[/*#__PURE__*/jsxs("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:[u?/*#__PURE__*/jsx_runtime_jsx("button",{type:"button","aria-label":i?"折叠信号类型":"展开信号类型",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:o,children:i?/*#__PURE__*/jsx_runtime_jsx(ChevronDown,{className:"size-3.5"}):/*#__PURE__*/jsx_runtime_jsx(ChevronRight,{className:"size-3.5"})}):/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/jsxs("label",{htmlFor:c,className:cn_cn("flex min-w-0 flex-1 items-center gap-1.5","disabled"===s?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/jsx_runtime_jsx(checkbox_Checkbox,{id:c,"aria-label":`${e.label} ${t.label}`,checked:toCheckboxValue(s),disabled:"disabled"===s,onCheckedChange:()=>l(t.leafKeys)}),/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn("min-w-0 truncate text-xs font-medium","disabled"===s?"text-muted-foreground":"text-foreground/90"),"data-testid":`signal-tree-type-color-${e.source}-${t.signalType}`,style:"disabled"===s||null==d?void 0:{color:toOpaqueCssColor(d)},children:t.label}),/*#__PURE__*/jsx_runtime_jsx(SignalNodeCount,{count:t.count,show:a,testId:`signal-tree-type-count-${e.source}-${t.signalType}`})]})]}),i&&u?/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative ml-6 border-l border-border/60 pl-1",children:t.levels.map(i=>/*#__PURE__*/jsx_runtime_jsx(SignalLevelRow,{source:e.source,signalType:t.signalType,level:i,leafKeysWithData:r,hiddenKeys:n,showCount:a,onToggleNode:l},i.leafKey))}):null]},t.signalType)},SignalLevelRow=({source:e,signalType:t,level:r,leafKeysWithData:n,hiddenKeys:a,showCount:i,onToggleNode:o})=>{let l=resolveNodeCheckState(n,a,[r.leafKey]),s=`signal-tree-level-checkbox-${e}-${t}-${r.level}`;return /*#__PURE__*/jsx_runtime_jsx("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}-${r.level}`,children:/*#__PURE__*/jsxs("label",{htmlFor:s,className:cn_cn("flex min-w-0 flex-1 items-center gap-1.5","disabled"===l?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/jsx_runtime_jsx(checkbox_Checkbox,{id:s,"aria-label":`${t} ${r.label}`,checked:toCheckboxValue(l),disabled:"disabled"===l,onCheckedChange:()=>o([r.leafKey])}),/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn("text-xs font-medium","disabled"===l?"text-muted-foreground":"text-foreground/80"),"data-testid":`signal-tree-level-color-${e}-${t}-${r.level}`,style:"disabled"===l?void 0:{color:toOpaqueCssColor(r.color??SIGNAL_LEVEL_MAP[r.level].color)},children:r.label}),/*#__PURE__*/jsx_runtime_jsx(SignalNodeCount,{count:r.count,show:i,testId:`signal-tree-level-count-${e}-${t}-${r.level}`})]})})},SignalAnnotationTree=({tree:e,leafKeysWithData:t,hiddenKeys:r,showCount:n,onToggleNode:a})=>{let[i,o]=external_react_useState(()=>new Set),[l,s]=external_react_useState(()=>new Set),c=external_react_useCallback(e=>{o(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),u=external_react_useCallback(e=>{s(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]);return /*#__PURE__*/jsx_runtime_jsx(scroll_area_ScrollArea,{viewportClassName:"h-auto max-h-[var(--radix-dropdown-menu-content-available-height)]",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"p-[calc(var(--size-gap-base)/2)]",children:e.sources.map((e,o)=>{let s=resolveNodeCheckState(t,r,e.leafKeys),d=`signal-tree-source-checkbox-${e.source}`;return /*#__PURE__*/jsxs("div",{className:cn_cn(o>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__*/jsxs("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__*/jsx_runtime_jsx("button",{type:"button","aria-label":l.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:()=>u(e.source),children:l.has(e.source)?/*#__PURE__*/jsx_runtime_jsx(ChevronRight,{className:"size-3.5"}):/*#__PURE__*/jsx_runtime_jsx(ChevronDown,{className:"size-3.5"})}):/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/jsxs("label",{htmlFor:d,className:cn_cn("flex min-w-0 flex-1 items-center gap-1.5","disabled"===s?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/jsx_runtime_jsx(checkbox_Checkbox,{id:d,"aria-label":`${e.label}筛选`,checked:toCheckboxValue(s),disabled:"disabled"===s,onCheckedChange:()=>a(e.leafKeys)}),/*#__PURE__*/jsx_runtime_jsx("span",{className:"text-xs font-medium text-foreground",children:e.label}),/*#__PURE__*/jsx_runtime_jsx(SignalNodeCount,{count:e.count,show:n,testId:`signal-tree-source-count-${e.source}`})]})]}),l.has(e.source)?null:/*#__PURE__*/jsx_runtime_jsx("div",{className:"ml-4 divide-y divide-border/40 border-l border-border/60 pl-1",children:e.types.map(o=>/*#__PURE__*/jsx_runtime_jsx(SignalTypeRow,{source:e,type:o,leafKeysWithData:t,hiddenKeys:r,showCount:n,expanded:!i.has(`${e.source}:${o.signalType}`),onToggleExpanded:()=>c(`${e.source}:${o.signalType}`),onToggleNode:a},o.signalType))})]},e.source)})})})},Signal_Switch_Switch=()=>{let{state:{signal:e},dispatch:t}=useStore_useStore(),r=e.display,n=e.show,a=useUnifiedSignals({respectVisibility:!1,filterHidden:!1}),i=external_react_useMemo(()=>buildSignalTree(a),[a]),o=external_react_useMemo(()=>new Set(i.sources.flatMap(e=>e.dataLeafKeys)),[i]),l=external_react_useMemo(()=>new Set(e.hiddenCategoryKeys??[]),[e.hiddenCategoryKeys]),s=(e.hiddenCategoryKeys?.length??0)>0,c=external_react_useCallback(r=>{t({payload:{signal:{...e,display:r}}})},[e,t]),u=external_react_useCallback(r=>{let n=toggleNodeHiddenKeys(e.hiddenCategoryKeys??[],r,o);t({payload:{signal:{...e,hiddenCategoryKeys:n}}})},[e,o,t]);return n?/*#__PURE__*/jsx_runtime_jsx(ToolbarDropdownGroup,{leading:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:r,tone:"primary",onClick:()=>{c(!r)},title:`全部信号标注:${r?"显示":"隐藏"}`,children:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("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:`筛选信号标注类别${s?"(已应用筛选)":""}`,triggerTestId:"signal-tree-trigger",triggerContent:/*#__PURE__*/jsx_runtime_jsx("span",{className:"sr-only",children:s?"信号标注类别筛选(已应用)":"信号标注类别筛选"}),customContent:/*#__PURE__*/jsx_runtime_jsx("div",{"data-testid":"signal-tree-popover",children:/*#__PURE__*/jsx_runtime_jsx(SignalAnnotationTree,{tree:i,leafKeysWithData:o,hiddenKeys:l,showCount:!1!==e.showCount,onToggleNode:u})}),contentClassName:"w-max max-w-[calc(100vw-1rem)] p-0",triggerClassName:cn_cn("justify-center [&>span:last-child]:ml-0",s&&"bg-accent/72 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--primary)_28%,transparent)] [&>span:last-child]:text-primary")}):null},Signal_Switch=Signal_Switch_Switch,TOOLBAR_ITEM_CONFIGS=[{component:controls_AutorangingControl,toolType:constants_ToolbarItemType.AutorangingSwitch,supportedCharts:[],excludedCharts:[constants_ChartType.Heatmap,constants_ChartType.ScanDF360,constants_ChartType.LevelStream,constants_ChartType.LiteNormalized]},{component:controls_UnitControl,toolType:constants_ToolbarItemType.UnitSwitch,supportedCharts:[],excludedCharts:[constants_ChartType.ScanDF360,constants_ChartType.LevelStream]},{component:decorations_GradientRibbon,toolType:constants_ToolbarItemType.GradientRibbon,supportedCharts:[constants_ChartType.Heatmap]},{component:decorations_SpacerLine,toolType:constants_ToolbarItemType.SpacerLine,supportedCharts:[],excludedCharts:[constants_ChartType.ScanDF360,constants_ChartType.LevelStream]},{component:controls_Reset,toolType:constants_ToolbarItemType.Reset,supportedCharts:[],excludedCharts:[constants_ChartType.LiteNormalized]},{component:Signal_Switch,toolType:constants_ToolbarItemType.StationAllocationSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan,constants_ChartType.DDC]},{component:controls_SeriesControl,toolType:constants_ToolbarItemType.SeriesControl,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan],props:{type:"dynamic"}},{component:FrequencyAllocation_Switch,toolType:constants_ToolbarItemType.FrequencyAllocationSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan,constants_ChartType.LiteNormalized]},{component:Switch,toolType:constants_ToolbarItemType.ZoomSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan,constants_ChartType.LiteNormalized]},{component:Limit_Switch,toolType:constants_ToolbarItemType.LimitSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan]},{component:Markers_Switch,toolType:constants_ToolbarItemType.MarkersSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan]},{component:controls_SegmentsDisplayControl,toolType:constants_ToolbarItemType.SegmentsDisplayControl,supportedCharts:[constants_ChartType.Scan]},{component:Capture_Switch,toolType:constants_ToolbarItemType.HeatmapCaptureSwitch,supportedCharts:[constants_ChartType.Heatmap]},{component:TimeRange_Switch,toolType:constants_ToolbarItemType.TimeRangeSwitch,supportedCharts:[constants_ChartType.Heatmap]},{component:controls_SeriesDisplayControl,toolType:constants_ToolbarItemType.SeriesDisplayControl,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.LiteNormalized,constants_ChartType.MScan]},{component:Fluorescence_Switch,toolType:constants_ToolbarItemType.FluorescenceSwitch,supportedCharts:[constants_ChartType.SingleFrequency]},{component:DeltaMeasurement_Switch,toolType:constants_ToolbarItemType.DeltaMeasurementSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan]}],isToolbarItemVisible=(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)),resolveToolbarItemProps=(e,t)=>e.props?"dynamic"===e.props.type?{...e.props,type:t}:e.props:{},Toolbar=({type:e})=>{let t=useStore_useSelector(e=>e.toolbar.show),r=useStore_useSelector(e=>e.toolbar.hiddenTools??[]),{width:n,pluginBoxWidth:a}=useAxisYWidth_useAxisYWidth(),i=external_react_useMemo(()=>({marginLeft:n,width:a,...TOOLBAR_SHELL_STYLE}),[n,a]),o=external_react_useMemo(()=>TOOLBAR_ITEM_CONFIGS.filter(t=>isToolbarItemVisible(t,e,r)).map(t=>/*#__PURE__*/jsx_runtime_jsx(t.component,{...resolveToolbarItemProps(t,e)},t.toolType)),[r,e]);return e!==constants_ChartType.Occupancy&&t?/*#__PURE__*/jsx_runtime_jsx("div",{className:TOOLBAR_SHELL_CLASS_NAME,style:i,children:/*#__PURE__*/jsx_runtime_jsx("div",{className:TOOLBAR_ITEMS_CLASS_NAME,children:o})}):null},components_Toolbar=/*#__PURE__*/memo(Toolbar);function useLevelStreamAnalyzer(){let{state:{globalID:e,axisY:t,levelStream:r}}=useStore_useStore(),n=t.range??constants_RANGE_DEFAULT,{cacheTime:a=2e4,granularity:i=1,maxPoints:o=500}=r??{},l=external_react_useRef(null),s=external_react_useRef(e),c=external_react_useCallback(e=>{passThrough(s.current,constants_ModuleType.Spectrum)({pstype:constants_PSType.Render,data:{[REAL_DATA_NAME]:e.spectrumData}}),passThrough(s.current,constants_ModuleType.LevelStream)({pstype:constants_PSType.Render,data:e.probabilityRangeData})},[]),u=external_react_useCallback(e=>{let{probabilityRangeData:t,spectrumData:r}=e;withDatabase(s.current).getAllRawData=t=>({...getDefaultData().getAllRawData(t),levelStreamData:e}),c({probabilityRangeData:t,spectrumData:r})},[c]);if(external_react_useEffect(()=>{s.current=e},[e]),!l.current&&e){l.current=new LevelStreamAnalyzer({range:n,cacheTime:a,granularity:i,maxPoints:o,onLevelStreamUpdate:u});let{line:t}=getConfig("levelStream");passThrough(e,constants_ModuleType.Spectrum)({pstype:constants_PSType.Series,name:REAL_DATA_NAME,color:t})}return external_react_useEffect(()=>{l.current?.setConfig({range:n})},[n]),external_react_useEffect(()=>{l.current?.setConfig({cacheTime:a})},[a]),external_react_useEffect(()=>{l.current?.setConfig({granularity:i})},[i]),external_react_useEffect(()=>{l.current?.setConfig({onLevelStreamUpdate:u})},[u]),{analyzer:l.current,updateLevelStreamData:c}}class Occupancy extends BaseRenderer{constructor(e){super({id:e.id,chart:null,orientation:e.orientation??renderer_OrientationType.Vertical})}init(){let{id:e,orientation:t}=this.state,r=[...getGradient()].reverse().map(e=>hexToRGBA(e));this.state.chart=new Series({id:e,series:[{name:"bar",type:renderer_GraphicType.Bar,display:!0,color:getConfig("bar"),orientation:t}],range:[0,100],barValue2Color:!0,colors:r})}updateSeries(e){this.state.chart?.render({name:"bar",data:e})}}let Level=e=>{let{opacity:t}=e,{chart:r,Chart:n}=hooks_useChart({Render:Occupancy,params:{orientation:renderer_OrientationType.Horizontal}});return useModuleSubscription({moduleType:constants_ModuleType.LevelStream,chart:r,extractData:e=>e.data}),/*#__PURE__*/jsx_runtime_jsx(n,{style:external_react_useMemo(()=>({opacity:t,zIndex:1}),[t])})},modules_Level=Level,useZoomEvent_COMPONENT_KEY=constants_ToolType.Zoom;function useZoomEvent(e,t){let{state:{zoom:r,segments:n,globalID:a},dispatch:i}=useStore_useStore(),{show:o,interval:{start:l,end:s}}=r,{totalPoints:c}=n,u=external_react_useMemo(()=>t===constants_ModuleType.Spectrum,[t]),d=external_react_useRef(0),h=external_react_useCallback((e,t)=>{if(!o||!c)return null;let r=c-1,n=s-l+1,a=Math.max(0,Math.min(100,t))*c/100-1,i=((a=Math.max(0,Math.min(a,r)))-l)/n,u=e>0?Math.round(Math.max(UI_CONFIG.ZOOM_MIN_RANGE,n/2)):Math.min(c,2*n),d=Math.round(a-u*i),h=(d=Math.max(0,Math.min(d,c-u)))+u-1;return{newStart:d,newEnd:h}},[o,c,l,s]);external_react_useEffect(()=>{if(c)return createWheelEventManager(e,t,(e,t)=>{let n=h(e,t.left);if(!n)return;let{newStart:a,newEnd:o}=n;i({payload:{zoom:{...r,interval:{start:a,end:o},isScanSegmentsUpdateMagnify:!1}}})}),()=>{}},[e,t,c,r,h,i]);let p=external_react_useCallback((t,n,o,h)=>{if(!compareEventPriority(e,useZoomEvent_COMPONENT_KEY)||!t||!n||!o||h||!a||!c)return;let p=c-1,f=Math.round(o.left*c),m=s-l,g=l-f,b=g+m;g<0?(g=0,b=Math.min(m,p)):b>p&&(b=p,g=Math.max(0,p-m)),i({payload:{zoom:{...r,interval:{start:g,end:b},isScanSegmentsUpdateMagnify:!1}}});let v=o.top;v&&u&&(d.current+=v,Math.abs(d.current)&&(useRangeMove(a)?.(d.current),d.current=0))},[e,u,l,s,c,r,a,i]);external_react_useEffect(()=>{if(!o||!e)return;let t=()=>{resetEventLevel(e,useZoomEvent_COMPONENT_KEY),d.current=0};return createMouseUpEventManager(e,useZoomEvent_COMPONENT_KEY,t),createMouseLeaveEventManager(e,useZoomEvent_COMPONENT_KEY,t),createDragEventManager(e,useZoomEvent_COMPONENT_KEY,p),()=>{}},[o,e,p])}let MAJOR_TICK_LENGTH=6,MINOR_TICK_LENGTH=4,TEXT_OFFSET=8,resolveAxisYCanvasHorizontalLayout=({axisLineWidth:e,inside:t,width:r})=>t?{axisX:e,majorTickEndX:MAJOR_TICK_LENGTH,majorTickStartX:0,minorTickEndX:MINOR_TICK_LENGTH,minorTickStartX:0,textAlign:"left",textX:TEXT_OFFSET}:{axisX:r-e,majorTickEndX:r,majorTickStartX:r-MAJOR_TICK_LENGTH,minorTickEndX:r,minorTickStartX:r-MINOR_TICK_LENGTH,textAlign:"right",textX:r-TEXT_OFFSET},LINE_WIDTH_BASE=.5,MINOR_TICK_DIVISIONS=2,MIN_TICK_SPACING=4,MIN_CONTAINER_HEIGHT=100,IDEAL_TICK_COUNT=7,MIN_RANGE_SPAN=.5,MAJOR_TICK_LINE_WIDTH=2*LINE_WIDTH_BASE,MINOR_TICK_LINE_WIDTH=LINE_WIDTH_BASE,AXIS_LINE_WIDTH=LINE_WIDTH_BASE;function useCanvasAxisY(e){let{ranging:t}=e,{range:r,disabled:n,placement:a,show:i}=useStore_useSelector(e=>e.axisY),o="inside"===a,l=external_react_useRef(null),s=external_react_useRef(null),[c,u]=external_react_useState(0),[d,h]=external_react_useState(window.devicePixelRatio||1),[p,f]=external_react_useState(!1),[m,g]=external_react_useState(0),b=external_react_useCallback((e,t)=>{let r=.5*(Math.max(1,Math.round(t*d))%2!=0);return(Math.round(e*d-r)+r)/d},[d]),v=external_react_useCallback((e,t,r)=>{let n=r/2;return Math.min(t-n,Math.max(n,e))},[]),w=external_react_useMemo(()=>{let[e,t]=r;return{min:e,max:t}},[r]);external_react_useEffect(()=>{let e=window.matchMedia(`(resolution: ${d}dppx)`),t=()=>h(window.devicePixelRatio||1);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[d]),external_react_useEffect(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];t&&u(t.contentRect.height)});return t.observe(e),()=>t.disconnect()},[i]);let y=external_react_useCallback((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()},[]),x=external_react_useMemo(()=>{let e;if(0===c)return{majorTicks:[],minorTicks:[]};let t=w.max-w.min,r=t/IDEAL_TICK_COUNT,n=10**Math.floor(Math.log10(r)),a=r/n;e=Math.max(e=a<=1?n:a<=2?2*n:a<=5?5*n:a<=6?6*n:10*n,MIN_RANGE_SPAN/(2*IDEAL_TICK_COUNT));let i=[],o=Math.ceil(w.min/e)*e,l=w.max+1e-6*e;for(let t=o;t<=l;t+=e)i.push(t);let s=i.some(e=>Math.abs(e)>=1e3),u=i.some(e=>.01>Math.abs(e)&&0!==e),d={useScientific:u,useKFormat:s&&!u,useDecimals:i.some(e=>e%1!=0)},h=[];for(let r=o;r<=l;r+=e){let e=(w.max-r)/t*c,n=e,a=!0,i=!1,o=c-5,l=.3*c;e<-l||e>c+l?a=!1:e<5?(n=5,i=!0):e>o&&(n=o,i=!0),a&&h.push({value:r,position:e,textPosition:n,label:y(r,d),isAdjusted:i})}let p=[],f=e/MINOR_TICK_DIVISIONS,m=f/t*c,g=t<1;if(m>=(g?2*MIN_TICK_SPACING:MIN_TICK_SPACING)&&c>MIN_CONTAINER_HEIGHT&&!g){let r=Math.ceil(w.min/f)*f;for(let n=r;n<=w.max;n+=f){if(Math.abs(n%e)<.1*f)continue;let r=(w.max-n)/t*c;r>=0&&r<=c&&p.push({value:n,position:r,textPosition:r,label:""})}}return{majorTicks:h,minorTicks:p}},[w,c,y]),k=external_react_useCallback(()=>{let e=l.current;if(!e||0===c)return;let t=e.getContext("2d");if(!t)return;let r=e.getBoundingClientRect().width,n=resolveAxisYCanvasHorizontalLayout({axisLineWidth:AXIS_LINE_WIDTH,inside:o,width:r});e.width=r*d,e.height=c*d,e.style.width=`${r}px`,e.style.height=`${c}px`,t.setTransform(d,0,0,d,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=MAJOR_TICK_LINE_WIDTH;let a=getThemeColor("--foreground",.5,s.current);x.majorTicks.forEach(e=>{t.fillStyle=a,t.strokeStyle=a,t.fillText(e.label,n.textX,e.textPosition),t.beginPath();let r=b(v(e.position,c,MAJOR_TICK_LINE_WIDTH),MAJOR_TICK_LINE_WIDTH);t.moveTo(n.majorTickStartX,r),t.lineTo(n.majorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=MINOR_TICK_LINE_WIDTH,x.minorTicks.forEach(e=>{t.beginPath();let r=b(v(e.position,c,MINOR_TICK_LINE_WIDTH),MINOR_TICK_LINE_WIDTH);t.moveTo(n.minorTickStartX,r),t.lineTo(n.minorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=AXIS_LINE_WIDTH,t.beginPath();let i=b(n.axisX,AXIS_LINE_WIDTH);t.moveTo(i,0),t.lineTo(i,c),t.stroke()},[x,c,d,o,b,v]);external_react_useEffect(()=>{!1!==i&&k()},[k,i]),external_react_useEffect(()=>subscribeChartsThemeChange(()=>{k()}),[k]);let S=external_react_useCallback(e=>{n||(f(!0),g(e.clientY))},[n]),D=external_react_useCallback(e=>{n||t.moveWheel?.(e)},[t,n]),M=external_react_useCallback(e=>{if(n||!p||!s.current)return;let r=(e.clientY-m)/s.current.offsetHeight;Math.abs(r)>(w.max-w.min<1?.005:.01)&&(t.move?.(r),g(e.clientY))},[n,p,m,t,w]);return{canvasRef:l,containerRef:s,isDragging:p,range:w,handleMouseDown:S,handleMouseMove:M,handleMouseUp:external_react_useCallback(()=>{n||f(!1)},[n]),handleMouseLeave:external_react_useCallback(()=>{n||f(!1)},[n]),handleWheel:D,ticksData:x}}function AxisYCanvas(e){let{chart:t}=e,{state:{axisY:r}}=useStore_useStore(),{show:n}=r,a=spectrum_useRanging({chart:t}),{axisYWidth:i,inside:o,marginLeft:l}=useAxisYWidth_useAxisYWidth(),{canvasRef:s,containerRef:c,isDragging:u,handleMouseDown:d,handleMouseMove:h,handleMouseUp:p,handleMouseLeave:f,handleWheel:m}=useCanvasAxisY({ranging:a});return!1===n?null:/*#__PURE__*/jsx_runtime_jsx("div",{ref:c,className:cn_cn("h-full select-none",o?"absolute left-0 top-0 z-[7]":"relative",u?"cursor-grabbing":"cursor-ns-resize"),style:{width:i,marginLeft:l},onMouseDown:d,onMouseMove:h,onMouseUp:p,onMouseLeave:f,onWheel:m,onDoubleClick:()=>{let e=tools_getAxisYDoubleClickResetRange(r.restrict);a.setAxisY?.({realRange:e}),a.onChange?.()},children:/*#__PURE__*/jsx_runtime_jsx("canvas",{ref:s,className:"pointer-events-none absolute left-0 top-0 h-full w-full"})})}let EPSILON=1e-9,getDistinctPrecision=(e,t,r,n,a)=>{for(let i=n;i<=a;i+=1)if(r(e,i)!==r(t,i))return i;return a},DEFAULT_MEASUREMENT_RECT={position:40,height:20,leftPosition:40,width:20},DeltaMeasurement=()=>{let{state:{deltaMeasurement:{show:e,display:t,onChange:r},axisX:{frequencyFormat:n},axisY:{unit:a,range:i},segments:o}}=useStore_useStore(),[l,s]=external_react_useState(null),[c,u]=external_react_useState(DEFAULT_MEASUREMENT_RECT),d=external_react_useCallback(e=>{if(!n||!o?.length)return null;let{leftPosition:t,width:r,position:a,height:l}=e,s=n(t),c=n(t+r),u=s?Number(s):0,d=c?Number(c):0,[h,p]=i||[-120,0],f=p-h,m=p-a/100*f,g=p-(a+l)/100*f;return{deltaX:Math.abs(d-u),deltaY:Math.abs(m-g),centerFrequency:(u+d)/2,startFrequency:u,endFrequency:d,startAmplitude:g,endAmplitude:m}},[n,o,i]),h=external_react_useCallback(e=>{u(e);let t=d(e);t&&s(t)},[d]),p=external_react_useCallback(e=>{u(e);let t=d(e);t&&(s(t),r?.(t))},[d,r]);external_react_useEffect(()=>{if(t){u(DEFAULT_MEASUREMENT_RECT);let e=d(DEFAULT_MEASUREMENT_RECT);e&&s(e)}else s(null),r?.(null)},[t,d,r]);let f=(e,t=3)=>formatFrequencyUnitFromMHz(e,t).formatted,m=(e,t=2)=>{let r=Number.parseFloat(e.toFixed(t));return`${r} ${a}`},g=external_react_useMemo(()=>{if(!l)return{labels:void 0,middleContent:null};let e=l.deltaX<=EPSILON,t=l.deltaY<=EPSILON,r=e?3:getDistinctPrecision(l.startFrequency,l.endFrequency,f,3,6),n=t?2:getDistinctPrecision(l.startAmplitude,l.endAmplitude,m,2,4),i=f(l.startFrequency,r),o=f(l.endFrequency,r),s=m(l.endAmplitude,n),c=m(l.startAmplitude,n),u=f(l.deltaX,r),d=`${Number.parseFloat(l.deltaY.toFixed(n))} ${a}`,h=f(l.centerFrequency,r);return{labels:{left:e?void 0:i,right:e?void 0:o,top:t?void 0:s,bottom:t?void 0:c},middleContent:/*#__PURE__*/jsxs("div",{className:"grid gap-0.5",children:[/*#__PURE__*/jsx_runtime_jsx("div",{children:e?`频点: ${i}`:`ΔX: ${u}`}),/*#__PURE__*/jsx_runtime_jsx("div",{children:t?`幅度: ${c}`:`ΔY: ${d}`}),!e&&/*#__PURE__*/jsxs("div",{children:["中心: ",h]})]})}},[l,a]);return /*#__PURE__*/jsx_runtime_jsx(components_DragSelectBox,{enabled:e&&t,defaultRect:c,minSize:0,minWidth:0,minHeight:0,onChange:h,onDragEnd:p,zIndex:7,labels:g.labels,children:g.middleContent})},Spectrum_DeltaMeasurement=DeltaMeasurement,maxIndexSegments2FrequencyBandwidth=({frequencyLeft:e,segments:t})=>leftSegments2frequency(t)(e),startEnd2AnalyseFrequencyBandwidth=({e,zoom:t,segments:r,onChange:n,globalID:a})=>{let{realData:i}=withDatabase(a).getAllRawData();if(!i)return;let o=i.length,{interval:{start:l,end:s}}=t,{left:c}=e,u=e.left+e.width,d=convertCoordToVisualLeft({coord:e,segments:r,zoom:t}),h=convertCoordToVisualLeft({coord:{left:u},segments:r,zoom:t}),p=Math.max(0,Math.ceil(o*d/100)-1),f=Math.ceil(o*h/100),{maxIndex:m}=(0,array_0.jy)(Array.from(i.slice(p,f)));n({frequency:maxIndexSegments2FrequencyBandwidth({frequencyLeft:(l+(p+m+1)/o*(s-l))*100/r.totalPoints,segments:r}),bandwidth:Math.round(1e3*scopeLeftSegments2bandwidth({segments:r,endLeft:u,startLeft:c})),left:d,right:h})},DragFrame_COMPONENT_KEY=constants_ToolType.DragFrame,DragFrame=({id:e})=>{let{state:{zoom:t,segments:r,signalAnalysis:n,globalID:a},dispatch:i}=useStore_useStore(),[o,l]=external_react_useState(null),s=external_react_useCallback((e,o=!1)=>{n.show&&n.display&&o?startEnd2AnalyseFrequencyBandwidth({e,zoom:t,segments:r,onChange:n.onChange,globalID:a}):i({payload:{zoom:{...t,interval:e.interval,isScanSegmentsUpdateMagnify:e.isScanSegmentsUpdateMagnify}}})},[n,t,r,a]),c=external_react_useCallback((e,t,r,n)=>{if(e&&t&&n){let r=e.left,n=t.left,a=n-r;l({diffX:a,left:a>0?r:n,width:Math.abs(a),isScanSegmentsUpdateMagnify:a>0})}},[]),u=external_react_useCallback(()=>{if(!o)return;let{left:e,width:t,isScanSegmentsUpdateMagnify:n,diffX:a}=o,{totalPoints:i}=r;if(n&&a>0){let r=2*Math.ceil(t/100*i/2),a=Math.round(i*e/100)-1;r>10&&s({interval:{start:a,end:r+a-1},isScanSegmentsUpdateMagnify:n,left:e,width:t},!0)}a<0&&s({interval:{start:0,end:i-1},isScanSegmentsUpdateMagnify:n,left:e,width:t})},[o,r,t.interval.end,s]);return(external_react_useEffect(()=>{if(t.show){let t=()=>{l(null),resetEventLevel(e,DragFrame_COMPONENT_KEY)};createMouseDownEventManager(e,DragFrame_COMPONENT_KEY,t),createMouseUpEventManager(e,DragFrame_COMPONENT_KEY,()=>{u(),t()}),createMouseLeaveEventManager(e,DragFrame_COMPONENT_KEY,t),createDragEventManager(e,DragFrame_COMPONENT_KEY,(...t)=>{compareEventPriority(e,DragFrame_COMPONENT_KEY)&&c(t[0],t[1],t[2],t[3])})}},[t.show,e,u,c]),external_react_useEffect(()=>{o||resetEventLevel(e,DragFrame_COMPONENT_KEY)},[o,e]),t.show)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[3]",children:/*#__PURE__*/jsx_runtime_jsx("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:o?{left:`${o.left}%`,width:`${o.width}%`}:{},children:o&&!o.isScanSegmentsUpdateMagnify&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx("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__*/jsx_runtime_jsx("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},Spectrum_DragFrame=/*#__PURE__*/memo(DragFrame),FREQUENCY_ALLOCATION_LANE_HEIGHT=14,FREQUENCY_ALLOCATION_COMPACT_LANE_HEIGHT=5,FREQUENCY_ALLOCATION_COMPACT_THRESHOLD=4,resolveFrequencyAllocationDensity=({density:e="auto",channelCount:t})=>{let r="compact"===e||"auto"===e&&t>FREQUENCY_ALLOCATION_COMPACT_THRESHOLD;return{compact:r,laneHeight:r?FREQUENCY_ALLOCATION_COMPACT_LANE_HEIGHT:FREQUENCY_ALLOCATION_LANE_HEIGHT,showLabels:!r}},optimizedColors=null,originalColors=["#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 hexToHsl(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),i=Math.min(t,r,n),o=0,l=0,s=(a+i)/2;if(a!==i){let e=a-i;switch(l=s>.5?e/(2-a-i):e/(a+i),a){case t:o=(r-n)/e+6*(r<n);break;case r:o=(n-t)/e+2;break;case n:o=(t-r)/e+4}o/=6}return{h:360*o,s:100*l,l:100*s}}let sortedColors=[...originalColors].map(e=>({color:e,hsl:hexToHsl(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 sortAndRecolorFrequencyAllocationData(e){let t=[...e].sort((e,t)=>Number(e.startFrequency)-Number(t.startFrequency));return t.map((e,r)=>{let n=t.length,a=sortedColors.length,i=Math.floor(r/n*a),o=Math.floor((r+1)/n*a),l=sortedColors[Math.min(i,a-1)],s=sortedColors[Math.min(o,a-1)],c=r===n-1?sortedColors[a-1]:s;return{...e,color:l,gradientColors:[l,c]}})}let FrequencyAllocation_data=[{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、无人机等使用频段"}],STORAGE_KEY="rfkit-charts-frequency-allocation",isFrequencyAllocationChannelCache=e=>!!e&&"object"==typeof e&&2===e.version&&Array.isArray(e.channels),readFrequencyAllocationCache=()=>{let e=localStorage.getItem(STORAGE_KEY);if(!e)return null;let t=JSON.parse(e);return Array.isArray(t)||isFrequencyAllocationChannelCache(t)?t:null},getFrequencyAllocationFromCache=()=>{let e=readFrequencyAllocationCache();return Array.isArray(e)?e:null},getFrequencyAllocationChannelsFromCache=()=>{let e=readFrequencyAllocationCache();return isFrequencyAllocationChannelCache(e)?e.channels:null},setFrequencyAllocationToCache=e=>{localStorage.setItem(STORAGE_KEY,JSON.stringify(e))},setFrequencyAllocationChannelsToCache=e=>{localStorage.setItem(STORAGE_KEY,JSON.stringify({version:2,channels:e}))},clearFrequencyAllocationCache=()=>{localStorage.removeItem(STORAGE_KEY)},hasFrequencyAllocationCache=()=>null!==localStorage.getItem(STORAGE_KEY),DEFAULT_FREQUENCY_ALLOCATION_CHANNEL_ID="default",resolveChannelId=(e,t)=>e.id||e.title||`${DEFAULT_FREQUENCY_ALLOCATION_CHANNEL_ID}-${t}`,normalizeChannels=(e,t)=>e.map((e,r)=>({id:resolveChannelId(e,r),title:e.title,data:t(e.data??[])})).filter(e=>e.data.length>0),normalizeSingleChannel=(e,t)=>[{id:DEFAULT_FREQUENCY_ALLOCATION_CHANNEL_ID,data:t(e)}];function resolveFrequencyAllocationChannelModel({data:e,channels:t,cachedData:r,cachedChannels:n,presetData:a,normalizeData:i}){if(t)return t.length?normalizeChannels(t,i):normalizeSingleChannel(e?.length?e:a,i);if(n?.length)return normalizeChannels(n,i);let o=e??[];return normalizeSingleChannel(r&&r.length>0?r:o.length>0?o:a,i)}function resolveFrequencyAllocationChannels({data:e,channels:t}){return resolveFrequencyAllocationChannelModel({data:e,channels:t,cachedData:getFrequencyAllocationFromCache(),cachedChannels:getFrequencyAllocationChannelsFromCache(),presetData:FrequencyAllocation_data,normalizeData:sortAndRecolorFrequencyAllocationData})}function resolveFrequencyAllocationData_resolveFrequencyAllocationData(e){return resolveFrequencyAllocationChannels({data:e})[0]?.data??[]}let resolveFrequencyAllocationRange=e=>{if(null!=e.startFrequency&&null!=e.stopFrequency){let t=frequencyCalculation_calculateFrequencyRange({startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)});if(t)return{start:t.startFreq,stop:t.stopFreq,type:"range"}}return null},resolveFrequencyAllocationSegments=({segments:e,allocations:t,channelIndex:r,channelTitle:n})=>{if(!e.length||!t.length)return[];let a=e.reduce((e,t)=>e+t.point,0);return e.map((i,o)=>{let l=t.map(e=>{let t=resolveFrequencyAllocationRange(e);if(!t||t.stop<i.start||t.start>i.stop)return null;let{left:a,width:o}=calculatePositionFromFrequencyRange({startFreq:t.start,stopFreq:t.stop},i);return{band:e,range:t,channelIndex:r??0,channelTitle:n,position:{left:`${a}%`,width:`${o}%`}}}).filter(e=>null!==e),s=i.point/a*100,c=e.slice(0,o).reduce((e,t)=>e+t.point/a*100,0);return{segment:i,segmentIndex:o,bandPositions:l,style:{left:`${c}%`,width:`${s}%`}}})},resolveFrequencyAllocationLanes=({segments:e,channels:t})=>t.map((t,r)=>({channel:t,channelIndex:r,segmentData:resolveFrequencyAllocationSegments({segments:e,allocations:t.data,channelIndex:r,channelTitle:t.title})})).filter(e=>e.segmentData.some(e=>e.bandPositions.length>0)),resolver_createFrequencyAllocationRangeIndex=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),resolver_findFrequencyAllocationInRangeIndex=({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 i=Math.abs(n.center-t)-Math.abs(r.center-t);if(i<0){r=n;continue}!(i>0)&&0>n.title.localeCompare(r.title)&&(r=n)}return r?.item}},findFrequencyAllocationAtCursor=({allocations:e,frequency:t})=>resolver_findFrequencyAllocationInRangeIndex({rangeIndex:resolver_createFrequencyAllocationRangeIndex(e),frequency:t});function useFrequencyAllocationData_useFrequencyAllocationData(){let e=useSelector(e=>e.frequencyAllocation.data);return useMemo(()=>resolveFrequencyAllocationData(e),[e])}function useFrequencyAllocationChannels(){let e=useStore_useSelector(e=>e.frequencyAllocation.data),t=useStore_useSelector(e=>e.frequencyAllocation.channels);return external_react_useMemo(()=>resolveFrequencyAllocationChannels({data:e,channels:t}),[e,t])}function useAllocationAtCursor({frequency:e,cursorSample:t}){let r=useSelector(e=>e.cursor),n=useSelector(e=>e.segments),a=useSelector(e=>e.frequencyAllocation.display),i=useSelector(e=>e.frequencyAllocation.show),o=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 o?calculateCursorPosition(o,n):{segmentIndex:-1,pointIndex:-1},[c,o,n]);return useMemo(()=>{if(!i||!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,i])}let useAllocationFinder=null,AllocationInfo=({allocationInfo:e,variant:t="default"})=>{if(!e)return null;let{title:r,description:n,startFrequency:a,stopFrequency:i,centerFrequency:o,stepFrequency:l,bandwidth:s,modulation:c,channelTitle:u}=e;return /*#__PURE__*/jsxs("div",{className:cn_cn("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:[r?/*#__PURE__*/jsx_runtime_jsx("div",{className:"mb-1 font-bold",children:r}):null,/*#__PURE__*/jsxs("div",{className:"mb-1 text-primary",children:[u?/*#__PURE__*/jsxs("div",{children:["通道:",u]}):null,a&&i&&/*#__PURE__*/jsxs("div",{children:["频率范围:",a," - ",i]}),o?/*#__PURE__*/jsxs("div",{children:["中心频率:",o," MHz"]}):null,l?/*#__PURE__*/jsxs("div",{children:["步进:",l," kHz"]}):null,s?/*#__PURE__*/jsxs("div",{children:["带宽:",s," MHz"]}):null,c?/*#__PURE__*/jsxs("div",{children:["调制方式:",c]}):null]}),n?/*#__PURE__*/jsx_runtime_jsx("div",{className:"leading-5 opacity-85",children:n}):null]})},presenters_AllocationInfo=/*#__PURE__*/react.memo(AllocationInfo),AllocationSegments=/*#__PURE__*/memo(({style:e,bandPositions:t,showLabels:r,onMouseEnter:n,onMouseMove:a,onMouseLeave:i})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute top-0 h-full [contain:layout]",style:e,children:t.map(e=>{let{band:t,channelIndex:o,range:l,position:s}=e;return /*#__PURE__*/jsx_runtime_jsx("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:s.left,width:s.width},onMouseEnter:n(e),onMouseMove:a,onMouseLeave:i,children:r?/*#__PURE__*/jsx_runtime_jsx("span",{className:"truncate",children:t.title}):null},`band-${o??0}-${t.title}-${l.start}-${l.stop}-${s.left}`)})})),presenters_AllocationSegments=AllocationSegments,overlays_Tooltip_Tooltip=({title:e,description:t,visible:r,x:n,y:a,startFrequency:i,stopFrequency:o,centerFrequency:l,stepFrequency:s,bandwidth:c,modulation:u,channelTitle:d,positionRef:h,scheduleRef:p})=>{let f=external_react_useRef(null),m=external_react_useRef(null),g=external_react_useCallback(()=>{if(!r||!f.current)return;let e=f.current,t=e.offsetWidth,i=e.offsetHeight,o=window.innerWidth,l=window.innerHeight,s=h.current??{x:n,y:a},c=s.x,u=s.y,d=Math.max(12,Math.min(c+t>o-12?c-t-10:c,o-t-12)),p=Math.max(12,Math.min(u+i>l-12?u-i-10:u,l-i-12));e.style.transform=`translate3d(${d}px, ${p}px, 0)`},[h,r,n,a]),b=external_react_useCallback(()=>{r&&null===m.current&&(m.current=requestAnimationFrame(()=>{m.current=null,g()}))},[g,r]);return(external_react_useEffect(()=>(p.current=b,()=>{p.current===b&&(p.current=null)}),[b,p]),external_react_useEffect(()=>{if(r)return b(),()=>{null!==m.current&&(cancelAnimationFrame(m.current),m.current=null)}},[b,r]),r)?/*#__PURE__*/jsx_runtime_jsx("div",{ref:f,className:"pointer-events-none fixed z-[1000] 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(${n}px, ${a}px, 0)`},children:/*#__PURE__*/jsx_runtime_jsx(presenters_AllocationInfo,{allocationInfo:{title:e,description:t,startFrequency:i,stopFrequency:o,centerFrequency:l,stepFrequency:s,bandwidth:c,modulation:u,channelTitle:d}})}):null},overlays_Tooltip=overlays_Tooltip_Tooltip,FrequencyAllocation=()=>{let e=useStore_useSelector(e=>e.axisX.unit),t=useStore_useSelector(e=>e.segments),r=useStore_useSelector(e=>e.frequencyAllocation.display),n=useStore_useSelector(e=>e.frequencyAllocation.show),a=useStore_useSelector(e=>e.frequencyAllocation.density),i=useStore_useSelector(e=>e.zoom.style),o=useFrequencyAllocationChannels(),[l,s]=external_react_useState({visible:!1,x:0,y:0}),c=external_react_useRef({x:0,y:0}),u=external_react_useRef(null),d=external_react_useCallback(e=>{c.current={x:e.clientX+10,y:e.clientY+10},u.current?.()},[]),h=external_react_useMemo(()=>resolveFrequencyAllocationLanes({segments:t,channels:o}),[t,o]),{laneHeight:p,showLabels:f}=resolveFrequencyAllocationDensity({density:a,channelCount:h.length}),m=Math.max(p,h.length*p),g=external_react_useCallback(e=>{s(t=>({...t,...e}))},[]),b=external_react_useCallback(({band:t,channelTitle:r,range:n})=>a=>{d(a);let i={...t,visible:!0,x:c.current.x,y:c.current.y,channelTitle:r,startFrequency:`${n.start}${e}`,stopFrequency:`${n.stop}${e}`};"centerBandwidth"===n.type&&null!=n.frequency&&null!=n.bandwidth&&(i.centerFrequency=`${n.frequency}${e}`,i.bandwidth=`${n.bandwidth}${e}`),g(i)},[e,g,d]),v=external_react_useCallback(e=>{d(e)},[d]),w=external_react_useCallback(()=>{g({visible:!1})},[g]);return n&&r&&0!==h.length?/*#__PURE__*/jsxs("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] flex w-full select-none items-center overflow-hidden",style:{height:m,backgroundColor:"color-mix(in srgb, var(--chart-surface) 12%, transparent)"},children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 h-full w-full will-change-transform",style:i??void 0,children:h.map(({channel:e,channelIndex:t,segmentData:r})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-0 w-full",style:{bottom:t*p,height:p},children:r.map(({segmentIndex:t,bandPositions:r,style:n})=>/*#__PURE__*/jsx_runtime_jsx(presenters_AllocationSegments,{style:n,bandPositions:r,showLabels:f,onMouseEnter:b,onMouseMove:v,onMouseLeave:w},`channel-${e.id}-segment-${t}`))},`channel-${e.id}`))}),/*#__PURE__*/jsx_runtime_jsx(overlays_Tooltip,{...l,positionRef:c,scheduleRef:u})]}):null},Spectrum_FrequencyAllocation=FrequencyAllocation,useUpdateKey=e=>{let[t,r]=external_react_useState(0);return external_react_useEffect(()=>{if(!e)return;let t=withUpdateData(e,"FrequencyTagLineBoard",()=>{r(e=>e+1)});return()=>{t?.()}},[e]),t},Board=({id:e})=>{let{state:{frequencyTagLine:t,cursor:r}}=useStore_useStore(),{show:n,display:a,left:i,onChange:o}=t,l=useUpdateKey(e),s=r.show&&r.active&&r.event?.sourceType===constants_ModuleType.Spectrum,c=external_react_useCallback(e=>{if(!e)return;let{index:t,frequency:r}=e;(0,array_0.Ub)(r)&&o({index:t,frequency:r})},[o]);return n&&a&&!s?/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute bottom-5 right-[34px] z-[6] h-auto w-auto",children:/*#__PURE__*/jsx_runtime_jsx(Spectrum_FrequencyDataBoard,{left:i,updateKey:l,onChange:c,showSignalInfo:!1})}):null},FrequencyTagLine_Board=/*#__PURE__*/react.memo(Board),FrequencyTagLine_Switch_Switch=()=>{let{state:{frequencyTagLine:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{frequencyTagLine:{...e,display:!!r}}})},[e]),i=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:i}):null},FrequencyTagLine_Switch=/*#__PURE__*/null,FrequencyTagLine_COMPONENT_KEY=constants_ToolType.FrequencyTagLine,FrequencyTagLine=e=>{let{state:{frequencyTagLine:t},dispatch:r}=useStore_useStore(),{show:n,display:a,left:i,onChange:o}=t,{id:l}=e,s=external_react_useRef(t);return(external_react_useEffect(()=>{s.current=t},[t]),external_react_useEffect(()=>{let e=createMouseUpEventManager(l,FrequencyTagLine_COMPONENT_KEY,()=>{n&&a&&resetEventLevel(l,FrequencyTagLine_COMPONENT_KEY)}),t=createMouseLeaveEventManager(l,FrequencyTagLine_COMPONENT_KEY,()=>{n&&a&&resetEventLevel(l,FrequencyTagLine_COMPONENT_KEY)});return()=>{e?.(),t?.()}},[l,n,a,o]),external_react_useEffect(()=>{let e=createMouseDownEventManager(l,FrequencyTagLine_COMPONENT_KEY,e=>{n&&a&&r({payload:{frequencyTagLine:{...s.current,...e,id:l}}})}),t=createDragEventManager(l,FrequencyTagLine_COMPONENT_KEY,(e,t)=>{n&&a&&(compareEventPriority(l,FrequencyTagLine_COMPONENT_KEY),r({payload:{frequencyTagLine:{...s.current,...t,id:l}}}))});return()=>{e?.(),t?.()}},[l,n,a,r]),external_react_useEffect(()=>{r({payload:{frequencyTagLine:{...t,left:-100}}})},[n]),n&&a)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[3]",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-px border-l border-dashed border-chart-highlight/80 opacity-80",style:{left:`${i}%`}})}):null},Spectrum_FrequencyTagLine=/*#__PURE__*/react.memo(FrequencyTagLine),LIMIT_THRESHOLD_TEXT_STYLE={color:SPECTRUM_THRESHOLD_COLOR},LIMIT_THRESHOLD_LINE_STYLE={borderColor:SPECTRUM_THRESHOLD_COLOR},Item_Item=({value:e,onChange:t})=>{let{state:{axisY:r,limit:n}}=useStore_useStore(),{label:a,disabled:i}=n,{unit:o="",range:l=constants_RANGE_DEFAULT,step:s=constants_stepDefault}=r,[c,u]=l,d=external_react_useMemo(()=>isdBm(o)?dBuV2dBm(0):0,[o]),h=external_react_useCallback(e=>(u-e-d)/(u-c)*100,[u,d,c]),p=external_react_useMemo(()=>h(e),[h,e]),f=external_react_useMemo(()=>Math.round(d+e),[d,e]),[m,g]=external_react_useState(!1),b=external_react_useRef(null),v=external_react_useCallback(e=>{switch(e.key){case"Enter":{if(!b.current){g(!1);break}let e=Number(b.current.value);!Number.isNaN(e)&&e>=c&&e<=u&&(t?.(Math.floor(e-d)),b.current.blur()),g(!1);break}case"Escape":g(!1)}},[b,l,d,t]);return /*#__PURE__*/jsx_runtime_jsx("div",{className:"relative h-full w-full",children:/*#__PURE__*/jsxs("div",{className:"absolute right-0 h-0 w-full",style:{top:`${p}%`},children:[!m||i?/*#__PURE__*/jsxs("button",{type:"button",disabled:i,className:"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:LIMIT_THRESHOLD_TEXT_STYLE,onClick:()=>g(!0),children:[a," ",f,o]}):/*#__PURE__*/jsxs("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:LIMIT_THRESHOLD_TEXT_STYLE,children:[a," ",/*#__PURE__*/jsx_runtime_jsx("input",{ref:b,type:"number","aria-label":`${a}${o}门限值`,defaultValue:f,min:c,max:u,step:s/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:LIMIT_THRESHOLD_TEXT_STYLE,onKeyDown:v}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex items-center",children:o})]}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-[-0.5px] z-[8] h-0 w-full border-b border-dashed",style:LIMIT_THRESHOLD_LINE_STYLE})]})})},Limit_Item=Item_Item,COMPONENT_NAME=constants_ToolType.Limit,HIT_SLOP_PX=10,Limit=({id:e})=>{let{state:{limit:t,segments:r,axisY:n,system:a},dispatch:i}=useStore_useStore(),{show:o,active:l,disabled:s,value:c,onChange:u}=t,[d,h]=n.range,{totalPoints:p}=r,f=external_react_useMemo(()=>o&&l,[o,l]),[m,g]=external_react_useState(0/0),b=external_react_useRef(null),v=external_react_useRef(!1),w=external_react_useRef(t);external_react_useEffect(()=>{w.current=t},[t]);let y=external_react_useCallback((e,t)=>{let r=[...w.current.value];r[e]=t,i({payload:{limit:{...w.current,value:r}}})},[i]);return(external_react_useEffect(()=>{createMouseDownEventManager(e,COMPONENT_NAME,e=>{if(!f||s||!e?.left||!e?.top)return;let t=e.left,i=r.findIndex(e=>e.progress[0]<=t&&t<e.progress[1]);if(!Number.isFinite(i)||i<0){g(0/0),b.current=null,v.current=!1;return}let o=h-d;if(!Number.isFinite(o)||0===o)return;let l=isdBm(n.unit)?dBuV2dBm(0):0,c=w.current.value[i],u=(h-c-l)/o*100,p=Math.max(1.2,HIT_SLOP_PX/Math.max(1,a.height||1)*100);if(Math.abs(e.top-u)>p){g(0/0),b.current=null,v.current=!1;return}g(i),b.current=c,v.current=!0}),createMouseLeaveEventManager(e,COMPONENT_NAME,()=>{f&&!s&&(v.current&&u(w.current.value),g(0/0),b.current=null,v.current=!1,resetEventLevel(e,COMPONENT_NAME))}),createMouseUpEventManager(e,COMPONENT_NAME,()=>{f&&!s&&(v.current&&u(w.current.value),g(0/0),b.current=null,v.current=!1,resetEventLevel(e,COMPONENT_NAME))}),createDragEventManager(e,COMPONENT_NAME,(t,r,n)=>{if(f&&!s&&(0,array_0.Ub)(m)&&compareEventPriority(e,COMPONENT_NAME)&&n?.top){let e=h-d;if(!Number.isFinite(e)||0===e)return;let t=(b.current??w.current.value[m])-n.top*e;b.current=t,y(m,t)}})},[f,s,m,r,e,y,u,d,h,n.unit,a.height]),f)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[2]",children:r?.map((t,r)=>/*#__PURE__*/jsx_runtime_jsx("div",{style:{width:`${100*t.point/p}%`,opacity:+!!(0,array_0.Ub)(c[r])},className:"h-full w-[30%]",children:/*#__PURE__*/jsx_runtime_jsx(Limit_Item,{id:e,value:c[r],onChange:e=>y(r,e)},t.index)},t.index))}):null},Spectrum_Limit=Limit,useMarkerEvents_COMPONENT_KEY=constants_ToolType.Markers,MARKER_HIT_PX=6,MARKER_HOVER_PX=8,useMarkerEvents=e=>{let{id:t,markers:r,display:n,fixed:a,onCreateMarker:i,onDeleteMarker:o,onUpdateMarker:l,onToggleSelect:s,onHover:c,onResetHover:u}=e,d=external_react_useRef({isDown:null,dragStart:null,isHover:"",hoverId:null}),h=external_react_useCallback(()=>document.getElementById(getEID(t))??document.getElementById(t),[t]),p=external_react_useCallback(e=>{if(!e||!r||0===r.length)return null;let{left:t}=e;if(void 0===t)return null;let n=h();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<=MARKER_HIT_PX)return{...n,index:e}}return null},[h,r]),f=external_react_useCallback(e=>{let t=h();if(!t)return"";let n=t.getBoundingClientRect().width,a="";for(let t=0;t<r.length;t+=1){let i=r[t];if(i&&Math.abs(e.left-i.left)*n/100<=MARKER_HOVER_PX){a={...i,index:t};break}}return a},[h,r]);return external_react_useEffect(()=>{let e=createMoveEventManager(t,useMarkerEvents_COMPONENT_KEY,(e,t)=>{if(n&&void 0!==t.left){let e=f({left:t.left}),r="object"==typeof e?e.id:null;if(d.current.hoverId===r){d.current.isHover=e;return}d.current.isHover=e,d.current.hoverId=r,c({left:t.left})}}),r=createDragEventManager(t,useMarkerEvents_COMPONENT_KEY,(e,r)=>{let{isDown:i}=d.current;n&&i&&compareEventPriority(t,useMarkerEvents_COMPONENT_KEY)&&!a&&l(i.id,{left:r.left,top:r.top})}),h=createMouseDownEventManager(t,useMarkerEvents_COMPONENT_KEY,e=>{if(!n)return;let t=p(e)||("object"==typeof d.current.isHover?d.current.isHover:null);t&&!a&&(d.current.isDown=t)}),m=createMouseUpEventManager(t,useMarkerEvents_COMPONENT_KEY,()=>{n&&(d.current.isDown=null,resetEventLevel(t,useMarkerEvents_COMPONENT_KEY))}),g=createMouseLeaveEventManager(t,useMarkerEvents_COMPONENT_KEY,()=>{if(!n)return;let e=null!==d.current.hoverId;d.current.isDown=null,d.current.isHover="",d.current.hoverId=null,resetEventLevel(t,useMarkerEvents_COMPONENT_KEY),e&&u()}),b=createLongPressEventManager(t,useMarkerEvents_COMPONENT_KEY,(e,r)=>{if(!n||!compareEventPriority(t,useMarkerEvents_COMPONENT_KEY))return;let a=p(r)||("object"==typeof d.current.isHover?d.current.isHover:null);a?.id&&s(a.id)}),v=createDoubleClickEventManager(t,useMarkerEvents_COMPONENT_KEY,(e,r)=>{if(!n||!compareEventPriority(t,useMarkerEvents_COMPONENT_KEY)||void 0===r.left)return!1;let a=f({left:r.left});return a&&"object"==typeof a&&a.id?o(a.id):i({left:r.left}),!0});return()=>{e?.(),r?.(),h?.(),m?.(),g?.(),b?.(),v?.()}},[t,n,r,a,i,o,l,s,c,u,p,f]),{isDown:d.current.isDown}},markerColors=getConfig("marker"),getRequiredGlobalStoreState=e=>getGlobalStoreState(e);function getPeaksFromDatabase(e,t,r){let{needsMaxPeak:n=!1,needsTopPeaks:a=!1}=r||{},i=null,o=null;try{let t=withDatabase(e).getAllRawData()[REAL_DATA_NAME];if(t?.peaks?.peaks&&Array.isArray(t.peaks.peaks)){let e=t.peaks.peaks;return n&&e.length>0&&(i=e[0]),a&&(o=e),{maxPeak:i,topPeaks:o}}}catch(e){console.warn("[useMarkers] Failed to get precomputed peaks:",e)}return n&&(i=findMaxPeak(t)),a&&(o=findTopPeaks(t,2)),{maxPeak:i,topPeaks:o}}let useMarkers=e=>{let{id:t,globalID:r,onChange:n}=e,[a,i]=external_react_useState({markers:[],colorIndex:0,isDown:null,isHover:"",peak:null,hasPeak:!1}),o=external_react_useRef(new Float32Array),l=external_react_useCallback((e,t)=>{let{axisY:{unit:n},axisX:{frequencyFormat:a}}=getRequiredGlobalStoreState(r),i=e.left,{peak:l}=e,s=t?.data??o.current;s&&0!==s.length||(s=withDatabase(r).getAllRawData()[REAL_DATA_NAME]),o.current=s;let c=splitZoomLeft({left:i,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=getPeaksFromDatabase(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=getPeaksFromDatabase(r,s,{needsMaxPeak:!0}).maxPeak),e&&(h=((f=e.index)+.5)*100/p)}let m=parseFloat(a(i=u+h/d)),g=s[f];return void 0===g||Number.isNaN(g)||(e.level=parseFloat(getVirtualLevel(n,g).toFixed(1))),{...e,left:i,frequency:m}},[r]),s=external_react_useCallback((e,t=!1)=>{0!==o.current.length&&i(a=>{let{marker:{maxCount:i}}=getRequiredGlobalStoreState(r);if(a.markers.length>=i)return a;let o=createGUID(),s=markerColors[a.colorIndex%20],c={...l({...e,id:o,color:s,select:!1,peak:!1,frequency:0,hover:!1}),id:o,color:s,select:!t,peak:!1,hover:!1},u=[...t?a.markers:a.markers.map(e=>({...e,select:!1})),c];return t||setTimeout(()=>{n?.(constants_MarkerEventType.Add,u)},0),{...a,markers:u,colorIndex:a.colorIndex+1}})},[l,n]),c=external_react_useCallback(({event:e,marker:t,frequencies:a,silent:s=!1})=>{i(i=>{let c=[...i.markers],u=constants_MarkerEventType.Update,{id:d,peak:h,select:p,frequency:f,left:m,top:g}=t||{},b=m;if(e===constants_MarkerEventType.Update&&void 0!==f){let e=getGlobalStoreState(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=constants_MarkerEventType.Del)}}}if(e===constants_MarkerEventType.Add&&a?.length){let e=getGlobalStoreState(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 i=0;i<a.length;i+=1){let o=a[i];o>=e&&o<=r&&t.push((o-e)*100/n)}t.length>0&&(a=t)}}}if(e===constants_MarkerEventType.Add&&a?.length){let{marker:{maxCount:e}}=getRequiredGlobalStoreState(r),t=e-c.length,n=Math.min(a.length,t);c=c.map(e=>({...e,select:!1}));for(let e=0;e<n;e+=1){let t=createGUID(),r=markerColors[(i.colorIndex+e)%20],s=!1;if(o.current&&o.current.length>0){let t=-1/0,r=0;for(let e=0;e<o.current.length;e++)o.current[e]>t&&(t=o.current[e],r=e);Math.abs(Math.floor(o.current.length*a[e]/100)-r)<=Math.max(1,Math.floor(.01*o.current.length))&&(s=!0)}let u=l({left:a[e],id:t,color:r,select:!1,peak:s,frequency:0,hover:!1});c.push({...u,id:t,color:r,select:e===n-1,peak:s,hover:!1})}u=constants_MarkerEventType.Add}if(e===constants_MarkerEventType.Del){let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=constants_MarkerEventType.Del)}return e===constants_MarkerEventType.Clear&&(c=[],u=constants_MarkerEventType.Clear),e===constants_MarkerEventType.Update&&(u=constants_MarkerEventType.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),{...i,markers:c,colorIndex:e===constants_MarkerEventType.Clear?0:i.colorIndex}})},[l,n]),u=external_react_useCallback(()=>{i(e=>({...e,markers:[],colorIndex:0})),setTimeout(()=>{n?.(constants_MarkerEventType.Clear,[])},0)},[n]),d=external_react_useCallback(e=>{e&&(o.current=e),i(t=>{if(0===t.markers.length)return t;let a=t.markers.some(e=>e.peak&&"mainSecondary"!==e.peakTracking),i=t.markers.some(e=>"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank),s=e??o.current??new Float32Array,{maxPeak:c,topPeaks:u}=getPeaksFromDatabase(r,s,{needsMaxPeak:a,needsTopPeaks:i}),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?.(constants_MarkerEventType.Update,d)},0),{...t,markers:d}})},[l,n]),h=external_react_useCallback(e=>{let a=document.getElementById(t);if(!a)return"";let o=a.getBoundingClientRect(),{zoom:{interval:{start:l,end:s}},segments:c}=getRequiredGlobalStoreState(r),u=c.totalPoints/(s-l+1),d=o.width*u/100,h="",p=!1;return i(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?.(constants_MarkerEventType.Update,r)},0),{...t,markers:r,isHover:h}}),h},[t,r,n]),p=external_react_useCallback(()=>{i(e=>{let t=!1,r=e.markers.map(e=>(e.hover&&(t=!0),{...e,hover:!1}));return t&&setTimeout(()=>{n?.(constants_MarkerEventType.Update,r)},0),{...e,markers:r,isHover:""}})},[n]),f=external_react_useRef(null),m=external_react_useRef(null),g=external_react_useCallback(()=>{i(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking),r=f.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return f.current=null,setTimeout(()=>{n?.(constants_MarkerEventType.Update,t)},0),{...e,markers:t}}let{marker:t}=getRequiredGlobalStoreState(r);if(t.maxCount-e.markers.length<2)return e;f.current=e.markers.find(e=>e.select)?.id??null;let a=[],i=e.colorIndex,s=e=>{let t=createGUID(),r=markerColors[i%20];i+=1;let n=l({left:50,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,frequency:0,hover:!1});a.push({...n,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,hover:!1})};s(0),s(1);let c=[...e.markers,...a.map(e=>({...e,select:!1}))].map(e=>l(e,{data:o.current}));return setTimeout(()=>{n?.(constants_MarkerEventType.Update,c)},0),{...e,markers:c,colorIndex:i}})},[l,r,n]),b=external_react_useCallback(()=>{i(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=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?.(constants_MarkerEventType.Update,t)},0),{...e,markers:t}}let{marker:t}=getRequiredGlobalStoreState(r);if(t.maxCount-e.markers.length<1)return e;m.current=e.markers.find(e=>e.select)?.id??null;let a=createGUID(),i=markerColors[e.colorIndex%20],s={...l({left:50,id:a,color:i,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,frequency:0,hover:!1}),id:a,color:i,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,hover:!1},c=[...e.markers,s].map(e=>l(e,{data:o.current}));return setTimeout(()=>{n?.(constants_MarkerEventType.Update,c)},0),{...e,markers:c,colorIndex:e.colorIndex+1}})},[l,r,n]),v=external_react_useCallback((e,t)=>{i(a=>{let i=a.markers.find(e=>e.id===t);if(!i)return a;let s=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!s||s.length<3)return a;o.current=s;let{zoom:c,segments:u}=getRequiredGlobalStoreState(r),d=s.length,h=u.totalPoints||d,p=c.interval.end-c.interval.start+1,f=(i.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?.(constants_MarkerEventType.Update,v)},0),{...a,markers:v}})},[l,r,n]),w=external_react_useCallback(e=>{i(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!a||a.length<1)return t;o.current=a;let{zoom:i,segments:s}=getRequiredGlobalStoreState(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)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),f=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...i}=t;return l({...i,left:p,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(constants_MarkerEventType.Update,f)},0),{...t,markers:f}})},[l,r,n]),y=external_react_useCallback(e=>{i(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!a||a.length<3)return t;o.current=a;let{zoom:i,segments:s}=getRequiredGlobalStoreState(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)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),b=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...i}=t;return l({...i,left:g,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(constants_MarkerEventType.Update,b)},0),{...t,markers:b}})},[l,r,n]),x=external_react_useCallback((e,t)=>{i(a=>{let i,s=a.markers.find(e=>e.id===t);if(!s)return a;let c=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!c||c.length<2)return a;o.current=c;let{zoom:u,segments:d}=getRequiredGlobalStoreState(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((i="left"===e?Math.max(0,m-1):Math.min(h-1,m+1))===m)return a;let g=(100*i/(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?.(constants_MarkerEventType.Update,b)},0),{...a,markers:b}})},[l,r,n]),k="#F98116",S="#AA74E8",D=external_react_useCallback(()=>{i(e=>{let t,a=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!a||a.length<1)return e;o.current=a;let{zoom:i,segments:s}=getRequiredGlobalStoreState(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)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),f=e.markers.find(e=>e.color===k);if(f)t=e.markers.map(e=>e.id===f.id?l({...e,left:p},{data:a}):e);else{let{marker:n}=getRequiredGlobalStoreState(r),i=n.maxCount;if(e.markers.length>=i)return e;let o=l({left:p,id:createGUID(),color:k,select:!1,peak:!1,hover:!1},{data:a});t=[...e.markers,o]}return setTimeout(()=>{n?.(constants_MarkerEventType.Update,t)},0),{...e,markers:t}})},[l,r,n]),M=external_react_useCallback(()=>{i(e=>{let t,a=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!a||a.length<3)return e;o.current=a;let{zoom:i,segments:s}=getRequiredGlobalStoreState(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)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),b=e.markers.find(e=>e.color===S);if(b)t=e.markers.map(e=>e.id===b.id?l({...e,left:g},{data:a}):e);else{let{marker:n}=getRequiredGlobalStoreState(r),i=n.maxCount;if(e.markers.length>=i)return e;let o=l({left:g,id:createGUID(),color:S,select:!1,peak:!1,hover:!1},{data:a});t=[...e.markers,o]}return setTimeout(()=>{n?.(constants_MarkerEventType.Update,t)},0),{...e,markers:t}})},[l,r,n]);return{markers:a.markers,isDown:a.isDown,isHover:a.isHover,createMarker:s,updateMarkerAttribute:c,resetMarkers:u,updateByData:d,handleHover:h,resetHover:p,toggleMainSecondaryPeaks:g,toggleMainPeak:b,moveToAdjacentPeak:v,findMainPeak:w,findSecondaryPeak:y,moveToStep:x,createMainPeakMarker:D,createSecondaryPeakMarker:M,setState:i}},Dashed=e=>{let{top:t,left:r,color:n="transparent",x:a=!0,y:i=!0,lineWidth:o=1}=e;return /*#__PURE__*/jsxs(Fragment,{children:[a&&/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-0 top-[-200%] z-[5] w-full border-t border-dashed",style:{top:t,borderColor:n,borderTopWidth:`${o}px`}}),i&&/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-[-200%] top-0 z-[5] h-full border-l border-dashed",style:{left:r,borderColor:n,borderLeftWidth:`${o}px`}})]})},components_Dashed=Dashed,MarkerItem=({marker:e})=>{let{state:{axisX:t,axisY:r}}=useStore_useStore(),n=external_react_useRef(null),a=external_react_useRef(null),[i,o]=external_react_useState(0),[l,s]=external_react_useState(0);external_react_useEffect(()=>{let e=()=>{n.current&&o(n.current.offsetWidth),a.current&&s(a.current.offsetWidth)};e();let t=new ResizeObserver(()=>{e()});return n.current&&t.observe(n.current),a.current&&t.observe(a.current),()=>{t.disconnect()}},[e.frequency,e.level]);let c=external_react_useMemo(()=>{let t=e.left/100*i,r=i>0&&l>0&&t+l+10>i-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,i,l]);return /*#__PURE__*/jsxs("div",{ref:n,className:"absolute left-0 top-0 h-full w-full",id:e.id,title:`${e.frequency}${t.unit} / ${e.level}${r.unit}`,children:[/*#__PURE__*/jsxs("div",{ref:a,className:"absolute top-[10px] z-[5] whitespace-nowrap text-[12px] leading-4 transition-[opacity,font-weight,transform,margin-left,color]",style:c,children:[/*#__PURE__*/jsxs("div",{children:[e.frequency,t.unit]}),void 0!==e.level&&/*#__PURE__*/jsxs("div",{children:[e.level,r.unit]})]}),/*#__PURE__*/jsx_runtime_jsx(components_Dashed,{x:!1,left:`${e.left}%`,top:`${e.top}%`,color:e.color,lineWidth:e.select?2:1})]},e.id)},Markers_MarkerItem=/*#__PURE__*/react.memo(MarkerItem),Markers=({id:e})=>{let{state:{marker:t,globalID:r}}=useStore_useStore(),{enabled:n,visible:a,fixed:i,maxCount:o,onChange:l}=t,s=external_react_useCallback((e,t)=>{l?.(e,t),MARKER_COUNT_CHANGE(r)({count:t.length,maxCount:o});let n=t.find(e=>e.select)?.id??null;MARKER_SELECTION_CHANGE(r)({selectedId:n})},[l,r,o]),c=external_react_useMemo(()=>n&&a,[n,a,t.enabled,t.visible]),u=external_react_useMemo(()=>getEID(e),[e]),{markers:d,createMarker:h,updateMarkerAttribute:p,resetMarkers:f,updateByData:m,handleHover:g,resetHover:b,toggleMainSecondaryPeaks:v,toggleMainPeak:w,moveToAdjacentPeak:y,findMainPeak:x,findSecondaryPeak:k,createMainPeakMarker:S,createSecondaryPeakMarker:D}=useMarkers({id:e,globalID:r,display:a,onChange:s});external_react_useEffect(()=>{if(!r||!u||!c)return;let e=useKeyEvent_subscriptionKeyBus(r,u,e=>{let t=e.key.toLowerCase();if(!["a","d","w","s"].includes(t))return;if("w"===t){if(e.repeat)return;e.preventDefault(),S();return}if("s"===t){if(e.repeat)return;e.preventDefault(),D();return}let r=d.find(e=>e.select)?.id;r&&(e.preventDefault(),y("a"===t?"left":"right",r))});return()=>{e?.()}},[u,r,d,y,c,S,D]);let M=external_react_useCallback(e=>{let t=d.find(t=>t.id===e),r=!t?.select;p({event:constants_MarkerEventType.Update,marker:{id:e,select:r}})},[d,p]),F=external_react_useCallback((e,t)=>{p({event:constants_MarkerEventType.Update,marker:{id:e,left:t.left,top:t.top}})},[p]);useMarkerEvents({id:e,markers:d,display:c,fixed:i,onCreateMarker:h,onDeleteMarker:external_react_useCallback(e=>{p({event:constants_MarkerEventType.Del,marker:{id:e}})},[p]),onUpdateMarker:F,onToggleSelect:M,onHover:g,onResetHover:b});let C=external_react_useRef(null);return(external_react_useEffect(()=>{r&&e&&withUpdateData(e,"Marker",()=>{let{realData:e}=withDatabase(r).getAllRawData();C.current=e??null,m(e)})},[r,e,m]),external_react_useEffect(()=>{r&&e&&MARKER_UPDATE_ATTRIBUTE(r,e=>{p(e)})},[r,e,p,f]),external_react_useEffect(()=>{r&&e&&MARKER_COMMAND(r,e=>{if(e?.type){if("main-secondary-peaks"===e.type)return void v();if("main-peak"===e.type)return void w();if("left-peak"===e.type)return void y("left",e.selectedId);if("right-peak"===e.type)return void y("right",e.selectedId);if("find-main-peak"===e.type)return void x(e.selectedId);if("find-secondary-peak"===e.type)return void k(e.selectedId);if("create-main-peak"===e.type)return void S();if("create-secondary-peak"===e.type)return void D();if("clear-all"===e.type)return void f()}})},[r,e,y,v,w,x,k,S,D,f]),c)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[5]",children:d.map(e=>/*#__PURE__*/jsx_runtime_jsx(Markers_MarkerItem,{marker:e},e.id))}):null},Spectrum_Markers=Markers,infoSegments2Scope=({segments:e,index:t,frequency:r,bandwidth:n})=>{if(!r||!n||!e||!e[t])return{left:0,width:0};let a=e[t],i=e.reduce((e,t)=>e+t.point,0),{left:o,width:l}=calculatePositionFromFrequencyRange({startFreq:r-n/2e3,stopFreq:r+n/2e3},a),s=e.slice(0,t).reduce((e,t)=>e+t.point/i*100,0),c=a.point/i*100;return{left:s+o/100*c,width:l/100*c}};function useScope_useScope(){let{state:{scope:e,segments:t},dispatch:r}=useStore_useStore();return external_react_useCallback(n=>{let{frequency:a,bandwidth:i,index:o=0}=n,{left:l,width:s}=infoSegments2Scope({segments:t,index:o,frequency:a,bandwidth:i});r({payload:{scope:{...e,left:l,width:s}}})},[t,e])}let Scope=()=>{let{state:{scope:{show:e,left:t,width:r}}}=useStore_useStore();return e?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-0 box-border border-y border-dashed border-chart-grid bg-chart-surface opacity-50",style:{width:`${r}%`,left:`${t}%`}})}):null},Spectrum_Scope=Scope,SignalSegments=/*#__PURE__*/memo(({style:e,signalPositions:t,activeSignalKey:r,segmentIndex:n})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute h-full box-border",style:e,children:t.map(({item:e,key:t,position:a,color:i,tooltip:o})=>{let l=r===t,s={left:a.left,width:a.width,minWidth:"1px",backgroundColor:i,height:l?"100%":"8px",opacity:l?.5:1};return /*#__PURE__*/jsx_runtime_jsx("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":l?"true":"false","data-signal-key":t,"data-signal-source":resolveSignalSource(e),"data-testid":"signal-annotation",style:s,title:o},`segment-${n}-signal-${t}`)})})),presenters_SignalSegments=SignalSegments;function useSignalDataManager(){let{state:e,dispatch:t}=useStore_useStore(),r=external_react_useRef(e.globalID),n=external_react_useRef(e.signal),a=external_react_useRef({});return external_react_useEffect(()=>{r.current=e.globalID,n.current=e.signal},[e.globalID,e.signal]),external_react_useEffect(()=>{if(!e.globalID)return;let r=a.current.station,i=a.current.simple;void 0!==r&&(STATION_DATA(e.globalID,r),a.current.station=void 0),void 0!==i&&(t({payload:{signal:{...n.current,data:i}}}),a.current.simple=void 0)},[t,e.globalID]),{updateSignalData:external_react_useCallback(e=>{let{type:i,data:o}=e;if(Array.isArray(o)){if("station"===i){if(!r.current){a.current.station=o;return}STATION_DATA(r.current,o)}else if("simple"===i){if(!r.current){a.current.simple=o;return}t({payload:{signal:{...n.current,data:o}}})}}},[t])}}let Signal=({id:e,show:t=!0,display:r=!0})=>{let n=useStore_useSelector(e=>e.segments),a=useStore_useSelector(e=>e.zoom.style),i=useStore_useSelector(e=>e.signal),o=useCursorSample(e),l=o?.coord.left,s=useUnifiedSignals({respectVisibility:!0}),c=i.show&&i.display&&r,u=!!o,d=external_react_useMemo(()=>u&&"number"==typeof l?frequencyCalculation_calculateCursorPosition(l,n):{segmentIndex:-1,pointIndex:-1},[u,n,l]),h=external_react_useMemo(()=>u?frequencyCalculation_getCursorFrequencyAtPosition(n,d):0/0,[d,u,n]),p=external_react_useMemo(()=>resolveStaticSignalSegments({segments:n,signalItems:s}),[n,s]),f=external_react_useMemo(()=>resolveActiveSignalKey({segmentData:p,isCursorActive:u,currentFrequency:h,currentPosition:d}),[h,d,u,p]);return t&&c?/*#__PURE__*/jsx_runtime_jsx("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__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 flex h-full w-full",style:a??void 0,children:p.map(({segmentIndex:e,signalPositions:t,style:r})=>/*#__PURE__*/jsx_runtime_jsx(presenters_SignalSegments,{style:r,signalPositions:t,activeSignalKey:d.segmentIndex===e?f:void 0,segmentIndex:e},`segment-${e}`))})}):null},Spectrum_Signal=Signal,StripeSwitch=()=>{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},Stripe_Switch=null,Stripe_COMPONENT_KEY=constants_ToolType.Stripe,EDGE_HIT_SLOP=1.5,Stripe_clampPercent=e=>Math.max(0,Math.min(100,e)),resolveDragMode=({cursor:e,left:t,right:r})=>{let n=Math.abs(e-t),a=Math.abs(e-r);return n<=EDGE_HIT_SLOP?"left":a<=EDGE_HIT_SLOP?"right":e>t&&e<r?"move":n<=a?"left":"right"},Stripe=({id:e})=>{let{state:{stripe:t,axisX:{frequencyFormat:r,unit:n}},dispatch:a}=useStore_useStore(),{show:i,display:o,left:l,right:s,defaultLeft:c,defaultRight:u,onChange:d}=t,h=external_react_useRef(t),p=external_react_useRef(null),f=external_react_useRef(r),m=external_react_useRef(n),g=external_react_useRef(d);external_react_useEffect(()=>{h.current=t,f.current=r,m.current=n,g.current=d},[t,r,n,d]),external_react_useEffect(()=>{a({payload:{stripe:{...t,left:c,right:u}}})},[c,u]);let b=external_react_useCallback(e=>{let t=p.current;if(!t||!Number.isFinite(e?.left))return;let r=Stripe_clampPercent(e.left),n=h.current,{mode:i,startCursor:o,startLeft:l,startRight:s}=t,c=l,u=s;if("move"===i){let e=s-l;(u=(c=Stripe_clampPercent(l+(r-o)))+e)>100&&(c=Math.max(0,(u=100)-e))}"left"===i&&(c=Math.min(r,s)),"right"===i&&(u=Math.max(r,l)),a({payload:{stripe:{...n,left:c,right:u}}})},[a]),v=external_react_useCallback(()=>{let{left:e,right:t}=h.current,r=Math.round(10*e)/10,n=Math.round(10*t)/10,a=f.current?.(r)??"",i=f.current?.(n)??"",o=n-r,l=Number(i)-Number(a);g.current({left:r,right:n,width:o,start:a,end:i,bandwidth:l,unit:m.current})},[]);return(external_react_useEffect(()=>{createMouseDownEventManager(e,Stripe_COMPONENT_KEY,t=>{if(!i||!o||!Number.isFinite(t?.left))return;let r=h.current,n=Stripe_clampPercent(t.left);p.current={mode:resolveDragMode({cursor:n,left:r.left,right:r.right}),startCursor:n,startLeft:r.left,startRight:r.right},compareEventPriority(e,Stripe_COMPONENT_KEY)}),createMouseUpEventManager(e,Stripe_COMPONENT_KEY,()=>{i&&o&&p.current&&(p.current=null,resetEventLevel(e,Stripe_COMPONENT_KEY),v())}),createMouseLeaveEventManager(e,Stripe_COMPONENT_KEY,()=>{i&&o&&p.current&&(p.current=null,resetEventLevel(e,Stripe_COMPONENT_KEY),v())}),createMoveEventManager(e,Stripe_COMPONENT_KEY,(e,t)=>{i&&o&&p.current&&b(t)})},[e,i,o,b,v]),i&&l-s!=0&&o)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[3]",children:/*#__PURE__*/jsx_runtime_jsx("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:`${l}%`,width:`${s-l}%`}})}):null},Spectrum_Stripe=Stripe;function resolveBandPositions(e,t){if(!e.show)return[];if(e.kind===BandKind.Position)return[{key:BandKind.Position,left:e.left??50-e.width/2,width:e.width}];let r=frequencyCalculation_calculateFrequencyRange(e);if(!r||!t.length)return[];let n=t.reduce((e,t)=>e+Math.max(0,t.point),0);if(n<=0)return[];let a=[],i=0;return t.forEach((e,t)=>{let o=Math.max(0,e.point)/n*100;if(e.point>0&&e.frequencyCache?.length&&isRangeIntersectSegment(r,e)){let n=calculatePositionFromFrequencyRange(r,e);a.push({key:`frequency-${t}`,left:i+n.left/100*o,width:n.width/100*o})}i+=o}),a}function useBandLayerController(){let{dispatch:e,store:t}=useStoreApi();return external_react_useCallback(r=>{let n=t.getState().band,a=resolveBandState(r,n,"replace");a!==n&&e({payload:{band:a}})},[e,t])}let BandLayer=()=>{let e=useStore_useSelector(e=>e.band),t=useStore_useSelector(e=>e.segments),r=external_react_useMemo(()=>resolveBandPositions(e,t),[e,t]);return r.length?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:r.map(t=>/*#__PURE__*/jsx_runtime_jsx("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},Spectrum_BandLayer=BandLayer,TAP_SLOP_PX=10,TAP_MAX_DURATION_MS=300,TWO_FINGER_TAP_MS=300,PINCH_AXIS_X_DEG=30,PINCH_AXIS_Y_DEG=60,createIdleGesture=()=>({mode:"idle",startX:0,startY:0,startTime:0,lastX:0,lastY:0,startCoord:null,pinchBase:null}),TouchBus_clamp=(e,t,r)=>Math.max(t,Math.min(e,r)),TouchBus=({id:e})=>{let{state:{zoom:t,segments:r,axisY:n,globalID:a},dispatch:i}=useStore_useStore(),o=getEID(e),l=external_react_useRef(null),s=external_react_useRef(createIdleGesture()),c=external_react_useRef(t),u=external_react_useRef(r.totalPoints),d=external_react_useRef(n);external_react_useEffect(()=>{c.current=t},[t]),external_react_useEffect(()=>{u.current=r.totalPoints},[r]),external_react_useEffect(()=>{d.current=n},[n]);let h=external_react_useCallback((e,t,r)=>({currentTarget:e,clientX:t,clientY:r}),[]),p=external_react_useCallback(e=>{let t=Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY})),r=t.length,n=0,a=0,i=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,i=(e.y+r.y)/2}else 1===r&&(a=t[0].x,i=t[0].y);return{count:r,points:t,distance:n,midX:a,midY:i}},[]),f=external_react_useCallback((e,t,r)=>{let n=h(e,t,r),a=calculateEventRelativePosition(n);createMouseEnterEventManager(o)(),createMoveEventManager(o)(n,a)},[o,h]),m=external_react_useCallback(e=>{let t=s.current.pinchBase,r=u.current;if(!t||t.distance<=0||e<=0)return;let n=e/t.distance;if(("x"===t.axisMode||"xy"===t.axisMode)&&c.current.show&&r){let e=TouchBus_clamp(Math.round(t.range/n),UI_CONFIG.ZOOM_MIN_RANGE,r),a=Math.round(t.anchorIndex-t.anchorRatio*e),o=(a=TouchBus_clamp(a,0,r-e))+e-1;i({payload:e=>({zoom:{...e.zoom,interval:{start:a,end:o},isScanSegmentsUpdateMagnify:!1}})})}("y"===t.axisMode||"xy"===t.axisMode)&&a&&(useRangeZoom(a)(t.lastScale/n,t.yAnchorValue),t.lastScale=n)},[i,a]),g=external_react_useRef(m);g.current=m;let b=external_react_useCallback(e=>{let t=l.current,r=s.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=calculateEventRelativePosition(h(t,n,a));return}if(2===e.touches.length){r.mode="pinch",r.startTime=Date.now();let n=c.current,a=u.current,i=p(e),[o,l]=i.points,s=Math.abs(l.x-o.x),f=180*Math.atan2(Math.abs(l.y-o.y),s)/Math.PI,m=a||1,{start:g,end:b}=n.interval,v=TouchBus_clamp((calculateEventRelativePosition(h(t,i.midX,i.midY)).left??0)*m/100-1,0,m-1),w=Math.max(1,b-g+1),y=t.getBoundingClientRect();if(y.height<=0||i.distance<=0){r.pinchBase=null;return}let[x,k]=d.current.realRange??[0,1],S=TouchBus_clamp((i.midY-y.top)/y.height,0,1);r.pinchBase={distance:i.distance,lastScale:1,range:w,anchorIndex:v,anchorRatio:TouchBus_clamp((v-g)/w,0,1),axisMode:f<PINCH_AXIS_X_DEG?"x":f>PINCH_AXIS_Y_DEG?"y":"xy",yAnchorValue:k-S*(k-x),startPoints:i.points,pinchMoved:!1}}}},[p,h]),v=external_react_useRef(throttleRequestAnimationFrame(e=>{if(!e||!("count"in e))return;let t=l.current,r=s.current;if(!t)return;let{count:n,points:a,distance:i}=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(i-e.distance)>TAP_SLOP_PX||Math.hypot(t.x-r.x,t.y-r.y)>TAP_SLOP_PX)&&(e.pinchMoved=!0)}g.current(i)}return}if(1!==n)return;let c=a[0];if("pending"===r.mode){let e=c.x-r.startX,t=c.y-r.startY;if(e*e+t*t<=TAP_SLOP_PX**2)return;r.mode="drag"}if("drag"!==r.mode)return;let u=t.getBoundingClientRect(),d={left:(c.x-r.lastX)/u.width,top:(c.y-r.lastY)/u.height},p=h(t,c.x,c.y),f=calculateEventRelativePosition(p);createMoveEventManager(o)(p,f),createDragEventManager(o)(r.startCoord,f,d,!1),r.lastX=c.x,r.lastY=c.y})).current,w=external_react_useCallback(e=>{v(p(e))},[p,v]),y=external_react_useCallback(e=>{let t=l.current,r=s.current;if(!t)return;let n=e.changedTouches[0],a=n?.clientX??r.lastX,i=n?.clientY??r.lastY;if("pending"===r.mode){let e=Date.now()-r.startTime,n=a-r.startX,o=i-r.startY;n*n+o*o<=TAP_SLOP_PX**2&&e<=TAP_MAX_DURATION_MS&&f(t,a,i)}if(1===e.touches.length){let n=e.touches[0];r.mode="drag",r.startX=n.clientX,r.startY=n.clientY,r.lastX=n.clientX,r.lastY=n.clientY,r.pinchBase=null,r.startCoord=calculateEventRelativePosition(h(t,n.clientX,n.clientY))}else 0===e.touches.length&&("pinch"===r.mode&&r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=TWO_FINGER_TAP_MS&&createMouseLeaveEventManager(o)(),r.mode="idle",r.pinchBase=null,createMouseUpEventManager(o)())},[o,f,h]),x=external_react_useCallback(()=>{let e=s.current;e.mode="idle",e.pinchBase=null,createMouseLeaveEventManager(o)()},[o]),k=external_react_useCallback(e=>{e.preventDefault()},[]);return external_react_useEffect(()=>()=>{createMouseLeaveEventManager(o)()},[o]),external_react_useEffect(()=>{l.current&&(l.current.id=o)},[o]),/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[5] pointer-events-auto",children:/*#__PURE__*/jsx_runtime_jsx("button",{ref:l,type:"button",className:cn_cn("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:k,onTouchStart:b,onTouchMove:w,onTouchEnd:y,onTouchCancel:x})})},Spectrum_TouchBus=TouchBus,Spectrum_Spectrum=e=>{let{children:t,touch:r}=e,{state:{axisY:{autoranging:n},series:{enableLengthSyncFastMode:a},globalID:i}}=useStore_useStore(),{id:o,chart:l,Chart:s}=hooks_useChart({Render:Spectrum,params:{autoranging:n,enableLengthSyncFastMode:a}});useZoomEvent(o,constants_ModuleType.Spectrum);let c=useBandLayerController(),u=useScope_useScope(),d=usePoints();return external_react_useEffect(()=>{if(i&&l)return setScanDF360Prob(i,e=>{l?.setDisabledClearRect(e)})},[i,l]),useModuleSubscription({moduleType:constants_ModuleType.Spectrum,chart:l,handleRender:(e,t)=>{t.updateSeries?.({data:e.data,extraData:e.extraData}),withUpdateData(o)()},eventHandlers:{autoranging:(e,t)=>{t.useRangeAutoFocus?.()},points:e=>{d(e.data)},[constants_PSType.Series]:(e,t)=>{t.setSeries?.(e)},band:e=>{c(e)},scope:e=>{u(e)}}}),/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(AxisYCanvas,{chart:l}),/*#__PURE__*/jsxs(components_PluginBox,{children:[/*#__PURE__*/jsx_runtime_jsx(components_GridLines,{}),/*#__PURE__*/jsx_runtime_jsx(s,{}),t,/*#__PURE__*/jsx_runtime_jsx(FrequencyTagLine_Board,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Markers,{id:o}),r?/*#__PURE__*/jsx_runtime_jsx(Spectrum_TouchBus,{id:o}):/*#__PURE__*/jsx_runtime_jsx(components_EventBus,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Limit,{id:o}),/*#__PURE__*/jsx_runtime_jsx(components_Cursor,{id:o,type:constants_ModuleType.Spectrum}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Signal,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_DragFrame,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_BandLayer,{}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Scope,{}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Stripe,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_FrequencyTagLine,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_FrequencyAllocation,{}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_DeltaMeasurement,{})]})]})},modules_Spectrum=Spectrum_Spectrum,LevelStream_Chart_Chart=e=>{let{state:{cursor:t},dispatch:r}=useStore_useStore(),{publish:n}=e,{analyzer:a}=useLevelStreamAnalyzer();return publish_usePublish({publish:n,subscribe:e=>{let{pstype:t}=e;t===constants_PSType.Reset&&a?.reset(),t===constants_PSType.LevelStream&&a?.process(e.data,dateTimeToTimestamp(e.timestamp))}}),external_react_useEffect(()=>{t.mode!==constants_ModuleType.LevelStream&&r({payload:{cursor:{...t,mode:constants_ModuleType.LevelStream}}})},[t,r]),/*#__PURE__*/jsxs(components_Container,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Toolbar,{type:constants_ChartType.LevelStream}),/*#__PURE__*/jsx_runtime_jsx(components_FlexBox,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Spectrum,{children:/*#__PURE__*/jsx_runtime_jsx(components_PluginBox,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Level,{opacity:.5})})})})]})},LevelStream_Chart=LevelStream_Chart_Chart,LevelStreamChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,cursor:{show:!0},zoom:{show:!1},signal:{show:!1},children:/*#__PURE__*/jsx_runtime_jsx(LevelStream_Chart,{...e})}),LevelStream=withChartPublisher(LevelStreamChart,"LevelStream"),charts_LevelStream=LevelStream,Ticks_ticks=["100%","75%","50%","25%","0%"],components_Ticks_Ticks=e=>{let{inside:t=!1}=e;return /*#__PURE__*/jsx_runtime_jsx("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:Ticks_ticks.map(e=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("flex justify-start box-border",t?"pl-0.5 pr-0":"pr-0.5"),children:e},e))})},occupancy_components_Ticks=components_Ticks_Ticks,StandardOccupancyAxisYVariant=e=>{let{inside:t=!1}=e,{axisYWidth:r,marginLeft:n}=useAxisYWidth_useAxisYWidth();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-auto",style:{width:r,marginLeft:n,justifyContent:t?"flex-start":"flex-end"},children:/*#__PURE__*/jsx_runtime_jsx(occupancy_components_Ticks,{inside:t})})},variants_standard=/*#__PURE__*/react.memo(StandardOccupancyAxisYVariant),AxisYOccupancy=e=>{let{disabled:t,inside:r}=e,{state:{axisY:n}}=useStore_useStore(),{show:a}=n;return!1===a||t?null:/*#__PURE__*/jsx_runtime_jsx(variants_standard,{inside:r})},occupancy=AxisYOccupancy,OccupancyDashed_Dashed=()=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-0 w-full flex-1 border-t [border-color:var(--chart-grid)] first:border-t-0"}),OccupancyDashed=()=>{let{state:{gridLines:e}}=useStore_useStore();return e&&/*#__PURE__*/jsxs("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__*/jsx_runtime_jsx(OccupancyDashed_Dashed,{}),/*#__PURE__*/jsx_runtime_jsx(OccupancyDashed_Dashed,{}),/*#__PURE__*/jsx_runtime_jsx(OccupancyDashed_Dashed,{}),/*#__PURE__*/jsx_runtime_jsx(OccupancyDashed_Dashed,{})]})},GridLines_OccupancyDashed=OccupancyDashed,TOTAL_LINE_HIDDEN_OFFSET=-200,getOccupancyTotalLineRuntimeId=e=>`occupancy-total-line-${e}`,applyOccupancyTotalLineValue=(e,t,r=0)=>{e&&t&&(e.style.bottom=`${r||TOTAL_LINE_HIDDEN_OFFSET}%`,t.textContent=String(r))},withOccupancyTotalLine=(e,t,r)=>subscription_createSubscriptionManager(getOccupancyTotalLineRuntimeId(e),t,r,e),publishOccupancyTotalLine=(e,t=0)=>{withOccupancyTotalLine(e)(t)},TotalLine=({id:e})=>{let t=external_react_useRef(null),r=external_react_useRef(null),n=external_react_useRef(`OccupancyTotalLine-${Math.random().toString(36).slice(2)}`);return external_react_useEffect(()=>(applyOccupancyTotalLineValue(t.current,r.current),withOccupancyTotalLine(e,n.current,e=>{applyOccupancyTotalLineValue(t.current,r.current,e)})),[e]),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute z-[4] h-full w-full",children:/*#__PURE__*/jsxs("div",{ref:t,className:"absolute left-0 w-full opacity-50",style:{bottom:"-200%"},children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute h-0 w-full border-b border-dashed border-foreground/80",style:{marginTop:"-0.5px"}}),/*#__PURE__*/jsx_runtime_jsx("div",{ref:r,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"})]})})},Occupancy_TotalLine=TotalLine,Occupancy_Occupancy=e=>{let{occupancyAxisYDisabled:t}=e,{id:r,chart:n,Chart:a}=hooks_useChart({Render:Occupancy});return(useModuleSubscription({moduleType:constants_ModuleType.Occupancy,chart:n,handleRender:(e,t)=>{let{data:n,totalOccupancy:a}=e;n&&t.updateSeries?.(n),void 0!==a&&publishOccupancyTotalLine(r,a)},eventHandlers:{[constants_PSType.Reset]:(e,t)=>{t.reset(),publishOccupancyTotalLine(r)}}}),useZoomEvent(r,constants_ModuleType.Occupancy),t)?/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full w-full",style:{...CHARTS_SCOPE_STYLE_VARS},[CHARTS_STYLE_SCOPE_ATTRIBUTE]:"true",children:/*#__PURE__*/jsxs("div",{className:"relative z-[0] h-full w-full",children:[/*#__PURE__*/jsx_runtime_jsx(a,{}),/*#__PURE__*/jsx_runtime_jsx(components_EventBus,{id:r}),/*#__PURE__*/jsx_runtime_jsx(Occupancy_TotalLine,{id:r})]})}):/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(occupancy,{disabled:t}),/*#__PURE__*/jsxs(components_PluginBox,{children:[/*#__PURE__*/jsx_runtime_jsx(GridLines_OccupancyDashed,{}),/*#__PURE__*/jsx_runtime_jsx(a,{}),/*#__PURE__*/jsx_runtime_jsx(components_EventBus,{id:r}),/*#__PURE__*/jsx_runtime_jsx(Occupancy_TotalLine,{id:r}),/*#__PURE__*/jsx_runtime_jsx(components_Cursor,{id:r,type:constants_ModuleType.Occupancy})]})]})},modules_Occupancy=Occupancy_Occupancy,Occupancy_Chart_Chart=e=>{let{publish:t}=e,{state:{globalID:r}}=useStore_useStore(),n=useSpectrumRule(constants_ChartType.Scan);return publish_usePublish({publish:t,subscribe:e=>{n(e),e.pstype===constants_PSType.Occupancy&&(e.data&&(withDatabase(r).getAllRawData=t=>({...getDefaultData().getAllRawData(t),occupancyData:e.data})),passThrough(r,constants_ModuleType.Occupancy)({...e,pstype:constants_PSType.Render}))}}),/*#__PURE__*/jsxs(components_Container,{children:[/*#__PURE__*/jsx_runtime_jsx(components_FlexBox,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Occupancy,{})}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:constants_ChartType.Scan})]})},Occupancy_Chart=Occupancy_Chart_Chart,OccupancyChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,zoom:{show:!1},children:/*#__PURE__*/jsx_runtime_jsx(Occupancy_Chart,{...e})}),charts_Occupancy_Occupancy=withChartPublisher(OccupancyChart,"Occupancy"),charts_Occupancy=charts_Occupancy_Occupancy,Zoom=()=>{let e=useStoreDispatch(),t=useStore_useSelector(e=>e.zoom),r=useStore_useSelector(e=>e.segments.totalPoints)??0,n=useStore_useSelector(e=>e.axisX.frequencyFormat),{interval:{start:a,end:i},onChange:o}=t,l=external_react_useMemo(()=>r&&n?[n((100*a+1)/r),n((100*i+1)/r)]:["",""],[a,i,r,n]);return external_react_useEffect(()=>{r&&void 0!==l[0]&&void 0!==l[1]&&o(l,{start:a,end:i})},[l,o,r]),external_react_useEffect(()=>{if(!r)return;let t=i-a+1,n=r/t,o=`-${a/t*100}%`,l=`${100*n}%`;e({payload:e=>({zoom:{...e.zoom,style:{left:o,width:l}}})})},[e,i,a,r]),null},components_Zoom=Zoom;class FluorescenceRender extends GradientRenderer{constructor(e){super({id:e.id,globalID:e.globalID,chart:null,renderMode:e.renderMode})}init(){let{id:e,renderMode:t}=this.state;e&&(this.state.chart=new Fluorescence({id:e,colors:this.getInitialColors(),ignoreValue:0,fluorescenceRenderMode:t}),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 Fluorescence_Fluorescence=()=>{let{state:{axisY:{range:e},fluorescence:{display:t,renderMode:r}}}=useStore_useStore(),{chart:n,Chart:a}=hooks_useChart({Render:FluorescenceRender,params:{renderMode:r}});external_react_useEffect(()=>{n?.updateProps({range:e})},[n,e]),external_react_useEffect(()=>{n&&n.setRenderMode(r)},[r]),useModuleSubscription({moduleType:constants_ModuleType.Fluorescence,chart:n,renderPSTypes:[constants_PSType.Fluorescence],extractData:e=>e.data});let i=external_react_useMemo(()=>({height:"100%",width:"100%",display:"flex",visibility:t?"visible":"hidden"}),[t]);return external_react_useEffect(()=>{n&&n.updateProps({display:t})},[n,t]),/*#__PURE__*/jsx_runtime_jsx("div",{style:i,children:/*#__PURE__*/jsx_runtime_jsx(components_FlexBox,{children:/*#__PURE__*/jsx_runtime_jsx(a,{})})})},modules_Fluorescence=Fluorescence_Fluorescence,HeatmapPortal_Chart=e=>{let{type:t,heatmapElementID:r}=e;return /*#__PURE__*/jsx_runtime_jsx(Overlay_Portal,{id:r,children:/*#__PURE__*/jsxs(components_Background,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Toolbar,{type:constants_ChartType.Heatmap}),/*#__PURE__*/jsx_runtime_jsx(modules_Heatmap,{}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:t})]})})},HeatmapPortal=HeatmapPortal_Chart,OccupancyPortal_Chart=e=>{let{occupancyElementID:t,occupancyAxisYElementID:r,type:n}=e;return /*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx(Overlay_Portal,{id:t,children:r?/*#__PURE__*/jsx_runtime_jsx(modules_Occupancy,{occupancyAxisYDisabled:!0}):/*#__PURE__*/jsxs(components_Background,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Toolbar,{type:constants_ChartType.Occupancy}),/*#__PURE__*/jsx_runtime_jsx(modules_Occupancy,{}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:n})]})}),/*#__PURE__*/jsx_runtime_jsx(Overlay_Portal,{id:r,children:/*#__PURE__*/jsx_runtime_jsx(occupancy,{inside:!0})})]})},OccupancyPortal=OccupancyPortal_Chart,BLAZE_PROGRESS=(e,t)=>subscription_createSubscriptionManager(`BLAZE_PROGRESS-${e}`,"0",t,e),Blaze=()=>{let{state:{blaze:{show:e},segments:t,globalID:r}}=useStore_useStore(),[n,a]=external_react_useState(""),i=external_react_useMemo(()=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];n.progress&&e.push(...n.progress)}return e},[t]);return(external_react_useEffect(()=>{e&&r&&BLAZE_PROGRESS(r,e=>{a(i.includes(e)?void 0:`${100*e}%`)})},[e,r]),e)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:/*#__PURE__*/jsxs("div",{className:"absolute left-[-100%] top-0 flex h-full w-0 opacity-50",style:{left:n},children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"ml-[-0.5px] opacity-50",style:{borderRight:"0.5px solid var(--chart-grid-strong)"}}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"ml-[-31px] w-[30px] opacity-20",style:{background:"linear-gradient(90deg, transparent, var(--chart-grid-strong))"}})]})}):null},Spectrum_Blaze=/*#__PURE__*/react.memo(Blaze),Legend=()=>{let{state:{legend:{children:e}}}=useStore_useStore();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-5 top-5 z-[6] flex h-auto w-auto items-center",children:e})},Spectrum_Legend=Legend,SegmentsZebra=()=>{let{state:{segments:e}}=useStore_useStore(),t=e.totalPoints??0;return /*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[0]",children:e.map((e,r)=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full border-x",style:{width:t>0?`${100*e.point/t}%`:0,borderColor:r%2==1?"var(--chart-grid)":"transparent",background:r%2==1?"var(--chart-surface)":"transparent",opacity:r%2==1?.4:1}},`${e.start}_${e.stop}_${e.index}`))})},Spectrum_SegmentsZebra=SegmentsZebra,useMarkerPublish=({globalID:e})=>({handleMarkerPublish:external_react_useCallback(t=>{if(e)switch(t.pstype){case constants_PSType.Marker:MARKER_UPDATE_ATTRIBUTE(e)(t);break;case constants_PSType.Reset:MARKER_UPDATE_ATTRIBUTE(e)({type:constants_MarkerEventType.Clear})}},[e])}),Spectrum_useMarkerPublish=useMarkerPublish;function resolveThresholdDataOptions({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 setAnalyzerThresholdData(e,t){"thresholdData"in t&&e.setThresholdData(t.thresholdData,resolveThresholdDataOptions(t))}function useTemplateComparison(){let{state:{globalID:e,axisX:{frequencyFormat:t},signal:{onChange:r}}}=useStore_useStore(),n=external_react_useRef(t),a=external_react_useRef(r);external_react_useEffect(()=>{n.current=t,a.current=r},[e,t,r]);let i=external_react_useCallback(e=>{if(!e||0===e.length)return[];let t=[],r=Date.now();return e.forEach(a=>{let i=n.current,{startIndex:o,endIndex:l}=a,s=e.length,c=i((o+.5)*100/s),u=i((l+.5)*100/s),d=i((o+l)/2*100/s);c!==u&&t.push({...a,frequency:d,bandwidth:(u-c)*1e3,timestamp:r})}),t},[]);return{updateTemplateOverData:external_react_useCallback(e=>{if(e){let t=i(e);a.current(t)}},[i])}}function useSpectrumAnalyzer(e){let{state:{globalID:t,series:{enableMetrics:r,enableWaterfall:n},fluorescence:{show:a},axisY:{unit:i},zoom:{interval:o},heatmapCapture:{display:l},system:{width:s},marker:c}}=useStore_useStore(),u=external_react_useRef(null),d=external_react_useRef(t),h=external_react_useRef(o),p=external_react_useRef(0),f=external_react_useRef(null),{updateSignalData:m}=useSignalDataManager(),g=external_react_useRef(l);external_react_useEffect(()=>{g.current=l},[l]);let b=external_react_useCallback(e=>{passThrough(d.current,constants_ModuleType.Spectrum)({pstype:constants_PSType.Render,data:e})},[]),v=external_react_useCallback(e=>{passThrough(d.current,constants_ModuleType.Heatmap)({pstype:constants_PSType.Render,data:e})},[]),w=external_react_useCallback(e=>{BLAZE_PROGRESS(d.current)?.(e)},[]),{updateTemplateOverData:y}=useTemplateComparison(),x=external_react_useCallback(e=>{(e.realData||e.templateData||e.backgroundNoiseData||"thresholdData"in e)&&b({minData:e.minData,maxData:e.maxData,avgData:e.avgData,thresholdData:e.thresholdData,backgroundNoiseData:e.backgroundNoiseData,realData:e.realData,templateData:e.templateData}),e.scanProgress&&w(e.scanProgress),e.templateOverData&&y(e.templateOverData),e.waterfallData&&v(e.waterfallData),e.fluorescenceData&&passThrough(d.current,constants_ModuleType.Fluorescence)({pstype:constants_PSType.Fluorescence,data:{fluorescenceData:e.fluorescenceData,fluorescenceMaxCount:e.fluorescenceMaxCount}}),e.occupancyData&&passThrough(d.current,constants_ModuleType.Occupancy)({pstype:constants_PSType.Render,data:e.occupancyData,totalOccupancy:p.current}),e.extraData&&passThrough(d.current,constants_ModuleType.Spectrum)({pstype:constants_PSType.Render,extraData:e.extraData})},[b,v,w,y]);external_react_useEffect(()=>{d.current=t},[t]);let k=(e,t)=>!1!==e&&(t??!0);if(!u.current&&t){let i=Math.min(1|Math.floor(2*s),1001);u.current=new SpectrumAnalyzer({...e,outputPoints:i,processing:{...e?.processing,enableMetrics:k(r,e?.processing?.enableMetrics),enableWaterfall:k(n,e?.processing?.enableWaterfall),enableFluorescence:a,enablePeakStats:!!c?.enabled},onSpectrumUpdate:x});let o=withDatabase(t),l=u.current;o.getAllRawData=e=>l.getAllRawData(e),withSpectrumAnalyzerSYNC(t,u.current)}external_react_useEffect(()=>{let e=Math.floor(o.start),t=Math.ceil(o.end),r=Math.floor(h.current.start),n=Math.ceil(h.current.end);(e!==r||t!==n)&&u.current&&(h.current=o,u.current.updateSamplingRange(e,t+1))},[o]);let S=external_react_useCallback(async(e=!1)=>{setTimeout(()=>{passThrough(d.current,constants_ModuleType.Heatmap)({pstype:constants_PSType.Reset}),passThrough(d.current,constants_ModuleType.Spectrum)({pstype:constants_PSType.Reset}),passThrough(d.current,constants_ModuleType.Occupancy)({pstype:constants_PSType.Reset}),e&&resetSeries(d.current)},1)},[]),D=external_react_useCallback(async e=>{if(u.current)switch(e.pstype){case constants_PSType.AntennaFactor:u.current.setAntennaFactor(e.data);break;case constants_PSType.Signal:m({type:e.type,data:e.data});break;case constants_PSType.Spectrum:e.data&&u.current.process(e),setAnalyzerThresholdData(u.current,e),e.maxData&&u.current.setMaxData(e.maxData),e.minData&&u.current.setMinData(e.minData),e.avgData&&u.current.setAvgData(e.avgData),e.templateData&&u.current.setTemplateData(e.templateData,e.templateTolerance),e.backgroundNoiseData&&u.current.setBackgroundNoiseData(e.backgroundNoiseData),e.extraData&&u.current.setExtraData(e.extraData,types_ExtraDataMode.MERGE,e.segmentedExtraData?{segmentOffset:e.segmentOffset,offset:e.offset}:void 0);break;case constants_PSType.Fluorescence:e.data&&u.current&&u.current.setFluorescenceData(e.data.fluorescenceData,e.data.fluorescenceMaxCount);break;case constants_PSType.Heatmap:if(e.data){let{data:t,timestamps:r}=e,n=convertToTimestampedArrays(t,r);u.current.setWaterfallData(n)}break;case constants_PSType.Occupancy:u.current?.setOccupancyData(e.data),p.current=e.totalOccupancy;break;case constants_PSType.Segments:u.current.initializeSegments(e.data),await S(),e.onFinally?.();break;case constants_PSType.SpectrumBandwidth:u.current.reset();break;case constants_PSType.Series:updateSeries(d.current,e);break;case constants_PSType.Reset:u.current.reset(),await S(!0),e.onFinally?.();break;case constants_PSType.Clear:u.current.reset(),await S(!1),e.onFinally?.()}},[m,updateSeries,S]);return external_react_useEffect(()=>{let e=i.includes("/m");u.current?.setAntennaFactorSwitch(e)},[i]),external_react_useEffect(()=>{if(!u.current)return;let t=k(r,e?.processing?.enableMetrics);t!==f.current&&(u.current.updateProcessing({enableMetrics:t}),f.current=t)},[r,e?.processing?.enableMetrics]),D}let Spectrum_Chart_Chart=e=>{let{state:{globalID:t}}=useStore_useStore(),r=external_react_useRef([]),n=external_react_useRef(""),{type:a=constants_ChartType.SingleFrequency,publish:i,heatmapElementID:o,occupancyElementID:l,occupancyAxisYElementID:s,touch:c,children:u,processing:d}=e,{enableMetrics:h,enableWaterfall:p}=useSpectrumChartType({type:a,heatmapElementID:o}),f=useSpectrumAnalyzer({processing:{enableWaterfall:p,enableMetrics:h,...d}}),m=useSpectrumRule(a);useTouchMode(c);let{handleMarkerPublish:g}=Spectrum_useMarkerPublish({globalID:t});return publish_usePublish({publish:i,subscribe:e=>{if(f(e),g(e),m(e),e.pstype===constants_PSType.Heatmap){let{data:a,timestamps:i}=e;if(r.current=convertToTimestampedArrays(a,i),n.current!==t){let e=withDatabase(t),a=e.getAllRawData;e.getAllRawData=e=>({...a(e),waterfallData:r.current}),n.current=t}}passThrough(t,constants_ModuleType.Spectrum)(e),passThrough(t,constants_ModuleType.Heatmap)(e),passThrough(t,constants_ModuleType.Occupancy)(e),passThrough(t,constants_ModuleType.Fluorescence)(e)}}),/*#__PURE__*/jsxs(components_Container,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Toolbar,{type:a}),/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(modules_Spectrum,{touch:c,children:u||/*#__PURE__*/jsx_runtime_jsx(modules_Fluorescence,{})}),/*#__PURE__*/jsx_runtime_jsx(HeatmapPortal,{type:a,heatmapElementID:o}),/*#__PURE__*/jsx_runtime_jsx(OccupancyPortal,{type:a,occupancyElementID:l,occupancyAxisYElementID:s}),/*#__PURE__*/jsxs(components_PluginBox,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Zoom,{}),a===constants_ChartType.Scan&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx(Spectrum_SegmentsZebra,{}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Blaze,{})]}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Legend,{})]})]}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:a})]})},Spectrum_Chart=Spectrum_Chart_Chart,heatmapCaptureDefaults_DEFAULT_SPECTRUM_TYPE="singleFrequency",DEFAULT_HEATMAP_CAPTURE_TYPE="slider",withSpectrumHeatmapCaptureDefaults=e=>{let t=e.type??heatmapCaptureDefaults_DEFAULT_SPECTRUM_TYPE;return e.heatmapElementID&&(t===heatmapCaptureDefaults_DEFAULT_SPECTRUM_TYPE||"scan"===t||"mscan"===t)?{...e,heatmapCapture:{show:!0,display:!1,type:DEFAULT_HEATMAP_CAPTURE_TYPE,toolbarVariant:"deltaMeasurement",...e.heatmapCapture}}:e},SpectrumChart=e=>{let t=withSpectrumHeatmapCaptureDefaults(e);return /*#__PURE__*/jsx_runtime_jsx(src_store,{...t,children:/*#__PURE__*/jsx_runtime_jsx(Spectrum_Chart,{...t})})},charts_Spectrum_Spectrum=withChartPublisher(SpectrumChart,"Spectrum"),charts_Spectrum=charts_Spectrum_Spectrum;function initChartsTheme(e={}){let{onChange:t,sizes:r,tokens:n}=e;initializeChartsThemeEnvironment({sizes:r,tokens:n});let a=getChartsThemeState();return{cleanup:t?subscribeChartsThemeChange(e=>t(e)):void 0,...a}}var signal_SignalDataType=/*#__PURE__*/function(e){return e.Station="station",e.Simple="simple",e}({});initializeChartsThemeEnvironment();export{charts_Dial as Dial,charts_Gauge as Gauge,charts_Heatmap as Heatmap,charts_IQ as IQ,charts_LevelStream as LevelStream,charts_Occupancy as Occupancy,charts_Spectrum as Spectrum,constants_AxisPlacement as AxisPlacement,constants_ChartType as ChartType,constants_FrequencyUnit as FrequencyUnit,constants_MarkerEventType as MarkerEventType,constants_ModuleType as ModuleType,constants_OptionKey as OptionKey,constants_PSType as PSType,constants_SegmentsEvent as SegmentsEvent,constants_SeriesType as SeriesType,constants_ToolType as ToolType,constants_ToolbarItemType as ToolbarItemType,formatFrequencyUnit,formatFrequencyUnitFromHz,formatFrequencyUnitFromMHz,getChartsThemeState,heatmap_HeatmapCaptureType as HeatmapCaptureType,initChartsTheme,marker_MarkerMode as MarkerMode,setFrequencyAllocationChannelsToCache,setFrequencyAllocationToCache,signal_SignalDataType as SignalDataType,subscribeChartsThemeChange,useSafePublish,withChartPublisher};
3838
+ */let minus_iconNode=[["path",{d:"M5 12h14",key:"1ays0h"}]],Minus=createLucideIcon("minus",minus_iconNode),check_iconNode=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Check=createLucideIcon("check",check_iconNode),checkbox_Checkbox=/*#__PURE__*/__rspack_external_react.forwardRef(({className:e,...t},r)=>/*#__PURE__*/jsx_runtime_jsx(Checkbox,{ref:r,"data-slot":"checkbox",className:cn_cn("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__*/jsx_runtime_jsx(CheckboxIndicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:"indeterminate"===t.checked?/*#__PURE__*/jsx_runtime_jsx(Minus,{className:"size-3.5"}):/*#__PURE__*/jsx_runtime_jsx(Check,{className:"size-3.5"})})}));checkbox_Checkbox.displayName=Checkbox.displayName;let toCheckboxValue=e=>"checked"===e||"indeterminate"===e&&"indeterminate",SignalNodeCount=({count:e,show:t,testId:r})=>t?/*#__PURE__*/jsxs("span",{className:"shrink-0 tabular-nums text-[11px] font-normal text-muted-foreground","data-testid":r,children:["(",e,")"]}):null,SignalTypeRow=({source:e,type:t,leafKeysWithData:r,hiddenKeys:n,showCount:a,expanded:i,onToggleExpanded:o,onToggleNode:l})=>{let s=resolveNodeCheckState(r,n,t.leafKeys),c=`signal-tree-type-checkbox-${e.source}-${t.signalType}`,u=t.levels.length>0,d=u?void 0:t.color??SIGNAL_TYPE_MAP[t.signalType].color;return /*#__PURE__*/jsxs("div",{children:[/*#__PURE__*/jsxs("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:[u?/*#__PURE__*/jsx_runtime_jsx("button",{type:"button","aria-label":i?"折叠信号类型":"展开信号类型",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:o,children:i?/*#__PURE__*/jsx_runtime_jsx(ChevronDown,{className:"size-3.5"}):/*#__PURE__*/jsx_runtime_jsx(ChevronRight,{className:"size-3.5"})}):/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/jsxs("label",{htmlFor:c,className:cn_cn("flex min-w-0 flex-1 items-center gap-1.5","disabled"===s?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/jsx_runtime_jsx(checkbox_Checkbox,{id:c,"aria-label":`${e.label} ${t.label}`,checked:toCheckboxValue(s),disabled:"disabled"===s,onCheckedChange:()=>l(t.leafKeys)}),/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn("min-w-0 truncate text-xs font-medium","disabled"===s?"text-muted-foreground":"text-foreground/90"),"data-testid":`signal-tree-type-color-${e.source}-${t.signalType}`,style:"disabled"===s||null==d?void 0:{color:toOpaqueCssColor(d)},children:t.label}),/*#__PURE__*/jsx_runtime_jsx(SignalNodeCount,{count:t.count,show:a,testId:`signal-tree-type-count-${e.source}-${t.signalType}`})]})]}),i&&u?/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative ml-6 border-l border-border/60 pl-1",children:t.levels.map(i=>/*#__PURE__*/jsx_runtime_jsx(SignalLevelRow,{source:e.source,signalType:t.signalType,level:i,leafKeysWithData:r,hiddenKeys:n,showCount:a,onToggleNode:l},i.leafKey))}):null]},t.signalType)},SignalLevelRow=({source:e,signalType:t,level:r,leafKeysWithData:n,hiddenKeys:a,showCount:i,onToggleNode:o})=>{let l=resolveNodeCheckState(n,a,[r.leafKey]),s=`signal-tree-level-checkbox-${e}-${t}-${r.level}`;return /*#__PURE__*/jsx_runtime_jsx("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}-${r.level}`,children:/*#__PURE__*/jsxs("label",{htmlFor:s,className:cn_cn("flex min-w-0 flex-1 items-center gap-1.5","disabled"===l?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/jsx_runtime_jsx(checkbox_Checkbox,{id:s,"aria-label":`${t} ${r.label}`,checked:toCheckboxValue(l),disabled:"disabled"===l,onCheckedChange:()=>o([r.leafKey])}),/*#__PURE__*/jsx_runtime_jsx("span",{className:cn_cn("text-xs font-medium","disabled"===l?"text-muted-foreground":"text-foreground/80"),"data-testid":`signal-tree-level-color-${e}-${t}-${r.level}`,style:"disabled"===l?void 0:{color:toOpaqueCssColor(r.color??SIGNAL_LEVEL_MAP[r.level].color)},children:r.label}),/*#__PURE__*/jsx_runtime_jsx(SignalNodeCount,{count:r.count,show:i,testId:`signal-tree-level-count-${e}-${t}-${r.level}`})]})})},SignalAnnotationTree=({tree:e,leafKeysWithData:t,hiddenKeys:r,showCount:n,onToggleNode:a})=>{let[i,o]=external_react_useState(()=>new Set),[l,s]=external_react_useState(()=>new Set),c=external_react_useCallback(e=>{o(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),u=external_react_useCallback(e=>{s(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]);return /*#__PURE__*/jsx_runtime_jsx(scroll_area_ScrollArea,{viewportClassName:"h-auto max-h-[var(--radix-dropdown-menu-content-available-height)]",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"p-[calc(var(--size-gap-base)/2)]",children:e.sources.map((e,o)=>{let s=resolveNodeCheckState(t,r,e.leafKeys),d=`signal-tree-source-checkbox-${e.source}`;return /*#__PURE__*/jsxs("div",{className:cn_cn(o>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__*/jsxs("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__*/jsx_runtime_jsx("button",{type:"button","aria-label":l.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:()=>u(e.source),children:l.has(e.source)?/*#__PURE__*/jsx_runtime_jsx(ChevronRight,{className:"size-3.5"}):/*#__PURE__*/jsx_runtime_jsx(ChevronDown,{className:"size-3.5"})}):/*#__PURE__*/jsx_runtime_jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}),/*#__PURE__*/jsxs("label",{htmlFor:d,className:cn_cn("flex min-w-0 flex-1 items-center gap-1.5","disabled"===s?"cursor-not-allowed":"cursor-pointer"),children:[/*#__PURE__*/jsx_runtime_jsx(checkbox_Checkbox,{id:d,"aria-label":`${e.label}筛选`,checked:toCheckboxValue(s),disabled:"disabled"===s,onCheckedChange:()=>a(e.leafKeys)}),/*#__PURE__*/jsx_runtime_jsx("span",{className:"text-xs font-medium text-foreground",children:e.label}),/*#__PURE__*/jsx_runtime_jsx(SignalNodeCount,{count:e.count,show:n,testId:`signal-tree-source-count-${e.source}`})]})]}),l.has(e.source)?null:/*#__PURE__*/jsx_runtime_jsx("div",{className:"ml-4 divide-y divide-border/40 border-l border-border/60 pl-1",children:e.types.map(o=>/*#__PURE__*/jsx_runtime_jsx(SignalTypeRow,{source:e,type:o,leafKeysWithData:t,hiddenKeys:r,showCount:n,expanded:!i.has(`${e.source}:${o.signalType}`),onToggleExpanded:()=>c(`${e.source}:${o.signalType}`),onToggleNode:a},o.signalType))})]},e.source)})})})},Signal_Switch_Switch=()=>{let{state:{signal:e},dispatch:t}=useStore_useStore(),r=e.display,n=e.show,a=useUnifiedSignals({respectVisibility:!1,filterHidden:!1}),i=external_react_useMemo(()=>buildSignalTree(a),[a]),o=external_react_useMemo(()=>new Set(i.sources.flatMap(e=>e.dataLeafKeys)),[i]),l=external_react_useMemo(()=>new Set(e.hiddenCategoryKeys??[]),[e.hiddenCategoryKeys]),s=(e.hiddenCategoryKeys?.length??0)>0,c=external_react_useCallback(r=>{t({payload:{signal:{...e,display:r}}})},[e,t]),u=external_react_useCallback(r=>{let n=toggleNodeHiddenKeys(e.hiddenCategoryKeys??[],r,o);t({payload:{signal:{...e,hiddenCategoryKeys:n}}})},[e,o,t]);return n?/*#__PURE__*/jsx_runtime_jsx(ToolbarDropdownGroup,{leading:/*#__PURE__*/jsx_runtime_jsx(primitives_ToolbarGroupIconBox,{active:r,tone:"primary",onClick:()=>{c(!r)},title:`全部信号标注:${r?"显示":"隐藏"}`,children:/*#__PURE__*/jsx_runtime_jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:/*#__PURE__*/jsx_runtime_jsx("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:`筛选信号标注类别${s?"(已应用筛选)":""}`,triggerTestId:"signal-tree-trigger",triggerContent:/*#__PURE__*/jsx_runtime_jsx("span",{className:"sr-only",children:s?"信号标注类别筛选(已应用)":"信号标注类别筛选"}),customContent:/*#__PURE__*/jsx_runtime_jsx("div",{"data-testid":"signal-tree-popover",children:/*#__PURE__*/jsx_runtime_jsx(SignalAnnotationTree,{tree:i,leafKeysWithData:o,hiddenKeys:l,showCount:!1!==e.showCount,onToggleNode:u})}),contentClassName:"w-max max-w-[calc(100vw-1rem)] p-0",triggerClassName:cn_cn("justify-center [&>span:last-child]:ml-0",s&&"bg-accent/72 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--primary)_28%,transparent)] [&>span:last-child]:text-primary")}):null},Signal_Switch=Signal_Switch_Switch,TOOLBAR_ITEM_CONFIGS=[{component:controls_AutorangingControl,toolType:constants_ToolbarItemType.AutorangingSwitch,supportedCharts:[],excludedCharts:[constants_ChartType.Heatmap,constants_ChartType.ScanDF360,constants_ChartType.LevelStream,constants_ChartType.LiteNormalized]},{component:controls_UnitControl,toolType:constants_ToolbarItemType.UnitSwitch,supportedCharts:[],excludedCharts:[constants_ChartType.ScanDF360,constants_ChartType.LevelStream]},{component:decorations_GradientRibbon,toolType:constants_ToolbarItemType.GradientRibbon,supportedCharts:[constants_ChartType.Heatmap]},{component:decorations_SpacerLine,toolType:constants_ToolbarItemType.SpacerLine,supportedCharts:[],excludedCharts:[constants_ChartType.ScanDF360,constants_ChartType.LevelStream]},{component:controls_Reset,toolType:constants_ToolbarItemType.Reset,supportedCharts:[],excludedCharts:[constants_ChartType.LiteNormalized]},{component:Signal_Switch,toolType:constants_ToolbarItemType.StationAllocationSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan,constants_ChartType.DDC]},{component:controls_SeriesControl,toolType:constants_ToolbarItemType.SeriesControl,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan],props:{type:"dynamic"}},{component:FrequencyAllocation_Switch,toolType:constants_ToolbarItemType.FrequencyAllocationSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan,constants_ChartType.LiteNormalized]},{component:Switch,toolType:constants_ToolbarItemType.ZoomSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan,constants_ChartType.LiteNormalized]},{component:Limit_Switch,toolType:constants_ToolbarItemType.LimitSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan]},{component:Markers_Switch,toolType:constants_ToolbarItemType.MarkersSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.MScan]},{component:controls_SegmentsDisplayControl,toolType:constants_ToolbarItemType.SegmentsDisplayControl,supportedCharts:[constants_ChartType.Scan]},{component:Capture_Switch,toolType:constants_ToolbarItemType.HeatmapCaptureSwitch,supportedCharts:[constants_ChartType.Heatmap]},{component:TimeRange_Switch,toolType:constants_ToolbarItemType.TimeRangeSwitch,supportedCharts:[constants_ChartType.Heatmap]},{component:controls_SeriesDisplayControl,toolType:constants_ToolbarItemType.SeriesDisplayControl,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan,constants_ChartType.LiteNormalized,constants_ChartType.MScan]},{component:Fluorescence_Switch,toolType:constants_ToolbarItemType.FluorescenceSwitch,supportedCharts:[constants_ChartType.SingleFrequency]},{component:DeltaMeasurement_Switch,toolType:constants_ToolbarItemType.DeltaMeasurementSwitch,supportedCharts:[constants_ChartType.SingleFrequency,constants_ChartType.Scan]}],isToolbarItemVisible=(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)),resolveToolbarItemProps=(e,t)=>e.props?"dynamic"===e.props.type?{...e.props,type:t}:e.props:{},Toolbar=({type:e})=>{let t=useStore_useSelector(e=>e.toolbar.show),r=useStore_useSelector(e=>e.toolbar.hiddenTools??[]),{width:n,pluginBoxWidth:a}=useAxisYWidth_useAxisYWidth(),i=external_react_useMemo(()=>({marginLeft:n,width:a,...TOOLBAR_SHELL_STYLE}),[n,a]),o=external_react_useMemo(()=>TOOLBAR_ITEM_CONFIGS.filter(t=>isToolbarItemVisible(t,e,r)).map(t=>/*#__PURE__*/jsx_runtime_jsx(t.component,{...resolveToolbarItemProps(t,e)},t.toolType)),[r,e]);return e!==constants_ChartType.Occupancy&&t?/*#__PURE__*/jsx_runtime_jsx("div",{className:TOOLBAR_SHELL_CLASS_NAME,style:i,children:/*#__PURE__*/jsx_runtime_jsx("div",{className:TOOLBAR_ITEMS_CLASS_NAME,children:o})}):null},components_Toolbar=/*#__PURE__*/memo(Toolbar);function useLevelStreamAnalyzer(){let{state:{globalID:e,axisY:t,levelStream:r}}=useStore_useStore(),n=t.range??constants_RANGE_DEFAULT,{cacheTime:a=2e4,granularity:i=1,maxPoints:o=500}=r??{},l=external_react_useRef(null),s=external_react_useRef(e),c=external_react_useCallback(e=>{passThrough(s.current,constants_ModuleType.Spectrum)({pstype:constants_PSType.Render,data:{[REAL_DATA_NAME]:e.spectrumData}}),passThrough(s.current,constants_ModuleType.LevelStream)({pstype:constants_PSType.Render,data:e.probabilityRangeData})},[]),u=external_react_useCallback(e=>{let{probabilityRangeData:t,spectrumData:r}=e;withDatabase(s.current).getAllRawData=t=>({...getDefaultData().getAllRawData(t),levelStreamData:e}),c({probabilityRangeData:t,spectrumData:r})},[c]);if(external_react_useEffect(()=>{s.current=e},[e]),!l.current&&e){l.current=new LevelStreamAnalyzer({range:n,cacheTime:a,granularity:i,maxPoints:o,onLevelStreamUpdate:u});let{line:t}=getConfig("levelStream");passThrough(e,constants_ModuleType.Spectrum)({pstype:constants_PSType.Series,name:REAL_DATA_NAME,color:t})}return external_react_useEffect(()=>{l.current?.setConfig({range:n})},[n]),external_react_useEffect(()=>{l.current?.setConfig({cacheTime:a})},[a]),external_react_useEffect(()=>{l.current?.setConfig({granularity:i})},[i]),external_react_useEffect(()=>{l.current?.setConfig({onLevelStreamUpdate:u})},[u]),{analyzer:l.current,updateLevelStreamData:c}}class Occupancy extends BaseRenderer{constructor(e){super({id:e.id,chart:null,orientation:e.orientation??renderer_OrientationType.Vertical})}init(){let{id:e,orientation:t}=this.state,r=[...getGradient()].reverse().map(e=>hexToRGBA(e));this.state.chart=new Series({id:e,series:[{name:"bar",type:renderer_GraphicType.Bar,display:!0,color:getConfig("bar"),orientation:t}],range:[0,100],barValue2Color:!0,colors:r})}updateSeries(e){this.state.chart?.render({name:"bar",data:e})}}let Level=e=>{let{opacity:t}=e,{chart:r,Chart:n}=hooks_useChart({Render:Occupancy,params:{orientation:renderer_OrientationType.Horizontal}});return useModuleSubscription({moduleType:constants_ModuleType.LevelStream,chart:r,extractData:e=>e.data}),/*#__PURE__*/jsx_runtime_jsx(n,{style:external_react_useMemo(()=>({opacity:t,zIndex:1}),[t])})},modules_Level=Level,MAJOR_TICK_LENGTH=6,MINOR_TICK_LENGTH=4,TEXT_OFFSET=8,resolveAxisYCanvasHorizontalLayout=({axisLineWidth:e,inside:t,width:r})=>t?{axisX:e,majorTickEndX:MAJOR_TICK_LENGTH,majorTickStartX:0,minorTickEndX:MINOR_TICK_LENGTH,minorTickStartX:0,textAlign:"left",textX:TEXT_OFFSET}:{axisX:r-e,majorTickEndX:r,majorTickStartX:r-MAJOR_TICK_LENGTH,minorTickEndX:r,minorTickStartX:r-MINOR_TICK_LENGTH,textAlign:"right",textX:r-TEXT_OFFSET},LINE_WIDTH_BASE=.5,MINOR_TICK_DIVISIONS=2,MIN_TICK_SPACING=4,MIN_CONTAINER_HEIGHT=100,IDEAL_TICK_COUNT=7,MIN_RANGE_SPAN=.5,MAJOR_TICK_LINE_WIDTH=2*LINE_WIDTH_BASE,MINOR_TICK_LINE_WIDTH=LINE_WIDTH_BASE,AXIS_LINE_WIDTH=LINE_WIDTH_BASE;function useCanvasAxisY(e){let{ranging:t}=e,{range:r,disabled:n,placement:a,show:i}=useStore_useSelector(e=>e.axisY),o="inside"===a,l=external_react_useRef(null),s=external_react_useRef(null),[c,u]=external_react_useState(0),[d,h]=external_react_useState(window.devicePixelRatio||1),[p,f]=external_react_useState(!1),[m,g]=external_react_useState(0),b=external_react_useCallback((e,t)=>{let r=.5*(Math.max(1,Math.round(t*d))%2!=0);return(Math.round(e*d-r)+r)/d},[d]),v=external_react_useCallback((e,t,r)=>{let n=r/2;return Math.min(t-n,Math.max(n,e))},[]),w=external_react_useMemo(()=>{let[e,t]=r;return{min:e,max:t}},[r]);external_react_useEffect(()=>{let e=window.matchMedia(`(resolution: ${d}dppx)`),t=()=>h(window.devicePixelRatio||1);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[d]),external_react_useEffect(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];t&&u(t.contentRect.height)});return t.observe(e),()=>t.disconnect()},[i]);let y=external_react_useCallback((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()},[]),x=external_react_useMemo(()=>{let e;if(0===c)return{majorTicks:[],minorTicks:[]};let t=w.max-w.min,r=t/IDEAL_TICK_COUNT,n=10**Math.floor(Math.log10(r)),a=r/n;e=Math.max(e=a<=1?n:a<=2?2*n:a<=5?5*n:a<=6?6*n:10*n,MIN_RANGE_SPAN/(2*IDEAL_TICK_COUNT));let i=[],o=Math.ceil(w.min/e)*e,l=w.max+1e-6*e;for(let t=o;t<=l;t+=e)i.push(t);let s=i.some(e=>Math.abs(e)>=1e3),u=i.some(e=>.01>Math.abs(e)&&0!==e),d={useScientific:u,useKFormat:s&&!u,useDecimals:i.some(e=>e%1!=0)},h=[];for(let r=o;r<=l;r+=e){let e=(w.max-r)/t*c,n=e,a=!0,i=!1,o=c-5,l=.3*c;e<-l||e>c+l?a=!1:e<5?(n=5,i=!0):e>o&&(n=o,i=!0),a&&h.push({value:r,position:e,textPosition:n,label:y(r,d),isAdjusted:i})}let p=[],f=e/MINOR_TICK_DIVISIONS,m=f/t*c,g=t<1;if(m>=(g?2*MIN_TICK_SPACING:MIN_TICK_SPACING)&&c>MIN_CONTAINER_HEIGHT&&!g){let r=Math.ceil(w.min/f)*f;for(let n=r;n<=w.max;n+=f){if(Math.abs(n%e)<.1*f)continue;let r=(w.max-n)/t*c;r>=0&&r<=c&&p.push({value:n,position:r,textPosition:r,label:""})}}return{majorTicks:h,minorTicks:p}},[w,c,y]),k=external_react_useCallback(()=>{let e=l.current;if(!e||0===c)return;let t=e.getContext("2d");if(!t)return;let r=e.getBoundingClientRect().width,n=resolveAxisYCanvasHorizontalLayout({axisLineWidth:AXIS_LINE_WIDTH,inside:o,width:r});e.width=r*d,e.height=c*d,e.style.width=`${r}px`,e.style.height=`${c}px`,t.setTransform(d,0,0,d,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=MAJOR_TICK_LINE_WIDTH;let a=getThemeColor("--foreground",.5,s.current);x.majorTicks.forEach(e=>{t.fillStyle=a,t.strokeStyle=a,t.fillText(e.label,n.textX,e.textPosition),t.beginPath();let r=b(v(e.position,c,MAJOR_TICK_LINE_WIDTH),MAJOR_TICK_LINE_WIDTH);t.moveTo(n.majorTickStartX,r),t.lineTo(n.majorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=MINOR_TICK_LINE_WIDTH,x.minorTicks.forEach(e=>{t.beginPath();let r=b(v(e.position,c,MINOR_TICK_LINE_WIDTH),MINOR_TICK_LINE_WIDTH);t.moveTo(n.minorTickStartX,r),t.lineTo(n.minorTickEndX,r),t.stroke()}),t.strokeStyle=a,t.lineWidth=AXIS_LINE_WIDTH,t.beginPath();let i=b(n.axisX,AXIS_LINE_WIDTH);t.moveTo(i,0),t.lineTo(i,c),t.stroke()},[x,c,d,o,b,v]);external_react_useEffect(()=>{!1!==i&&k()},[k,i]),external_react_useEffect(()=>subscribeChartsThemeChange(()=>{k()}),[k]);let S=external_react_useCallback(e=>{n||(f(!0),g(e.clientY))},[n]),D=external_react_useCallback(e=>{n||t.moveWheel?.(e)},[t,n]),M=external_react_useCallback(e=>{if(n||!p||!s.current)return;let r=(e.clientY-m)/s.current.offsetHeight;Math.abs(r)>(w.max-w.min<1?.005:.01)&&(t.move?.(r),g(e.clientY))},[n,p,m,t,w]);return{canvasRef:l,containerRef:s,isDragging:p,range:w,handleMouseDown:S,handleMouseMove:M,handleMouseUp:external_react_useCallback(()=>{n||f(!1)},[n]),handleMouseLeave:external_react_useCallback(()=>{n||f(!1)},[n]),handleWheel:D,ticksData:x}}function AxisYCanvas(e){let{chart:t}=e,{state:{axisY:r}}=useStore_useStore(),{show:n}=r,a=spectrum_useRanging({chart:t}),{axisYWidth:i,inside:o,marginLeft:l}=useAxisYWidth_useAxisYWidth(),{canvasRef:s,containerRef:c,isDragging:u,handleMouseDown:d,handleMouseMove:h,handleMouseUp:p,handleMouseLeave:f,handleWheel:m}=useCanvasAxisY({ranging:a});return!1===n?null:/*#__PURE__*/jsx_runtime_jsx("div",{ref:c,className:cn_cn("h-full select-none",o?"absolute left-0 top-0 z-[7]":"relative",u?"cursor-grabbing":"cursor-ns-resize"),style:{width:i,marginLeft:l},onMouseDown:d,onMouseMove:h,onMouseUp:p,onMouseLeave:f,onWheel:m,onDoubleClick:()=>{let e=tools_getAxisYDoubleClickResetRange(r.restrict);a.setAxisY?.({realRange:e}),a.onChange?.()},children:/*#__PURE__*/jsx_runtime_jsx("canvas",{ref:s,className:"pointer-events-none absolute left-0 top-0 h-full w-full"})})}let EPSILON=1e-9,getDistinctPrecision=(e,t,r,n,a)=>{for(let i=n;i<=a;i+=1)if(r(e,i)!==r(t,i))return i;return a},DEFAULT_MEASUREMENT_RECT={position:40,height:20,leftPosition:40,width:20},DeltaMeasurement=()=>{let{state:{deltaMeasurement:{show:e,display:t,onChange:r},axisX:{frequencyFormat:n},axisY:{unit:a,range:i},segments:o}}=useStore_useStore(),[l,s]=external_react_useState(null),[c,u]=external_react_useState(DEFAULT_MEASUREMENT_RECT),d=external_react_useCallback(e=>{if(!n||!o?.length)return null;let{leftPosition:t,width:r,position:a,height:l}=e,s=n(t),c=n(t+r),u=s?Number(s):0,d=c?Number(c):0,[h,p]=i||[-120,0],f=p-h,m=p-a/100*f,g=p-(a+l)/100*f;return{deltaX:Math.abs(d-u),deltaY:Math.abs(m-g),centerFrequency:(u+d)/2,startFrequency:u,endFrequency:d,startAmplitude:g,endAmplitude:m}},[n,o,i]),h=external_react_useCallback(e=>{u(e);let t=d(e);t&&s(t)},[d]),p=external_react_useCallback(e=>{u(e);let t=d(e);t&&(s(t),r?.(t))},[d,r]);external_react_useEffect(()=>{if(t){u(DEFAULT_MEASUREMENT_RECT);let e=d(DEFAULT_MEASUREMENT_RECT);e&&s(e)}else s(null),r?.(null)},[t,d,r]);let f=(e,t=3)=>formatFrequencyUnitFromMHz(e,t).formatted,m=(e,t=2)=>{let r=Number.parseFloat(e.toFixed(t));return`${r} ${a}`},g=external_react_useMemo(()=>{if(!l)return{labels:void 0,middleContent:null};let e=l.deltaX<=EPSILON,t=l.deltaY<=EPSILON,r=e?3:getDistinctPrecision(l.startFrequency,l.endFrequency,f,3,6),n=t?2:getDistinctPrecision(l.startAmplitude,l.endAmplitude,m,2,4),i=f(l.startFrequency,r),o=f(l.endFrequency,r),s=m(l.endAmplitude,n),c=m(l.startAmplitude,n),u=f(l.deltaX,r),d=`${Number.parseFloat(l.deltaY.toFixed(n))} ${a}`,h=f(l.centerFrequency,r);return{labels:{left:e?void 0:i,right:e?void 0:o,top:t?void 0:s,bottom:t?void 0:c},middleContent:/*#__PURE__*/jsxs("div",{className:"grid gap-0.5",children:[/*#__PURE__*/jsx_runtime_jsx("div",{children:e?`频点: ${i}`:`ΔX: ${u}`}),/*#__PURE__*/jsx_runtime_jsx("div",{children:t?`幅度: ${c}`:`ΔY: ${d}`}),!e&&/*#__PURE__*/jsxs("div",{children:["中心: ",h]})]})}},[l,a]);return /*#__PURE__*/jsx_runtime_jsx(components_DragSelectBox,{enabled:e&&t,defaultRect:c,minSize:0,minWidth:0,minHeight:0,onChange:h,onDragEnd:p,zIndex:7,labels:g.labels,children:g.middleContent})},Spectrum_DeltaMeasurement=DeltaMeasurement,maxIndexSegments2FrequencyBandwidth=({frequencyLeft:e,segments:t})=>leftSegments2frequency(t)(e),startEnd2AnalyseFrequencyBandwidth=({e,zoom:t,segments:r,onChange:n,globalID:a})=>{let{realData:i}=withDatabase(a).getAllRawData();if(!i)return;let o=i.length,{interval:{start:l,end:s}}=t,{left:c}=e,u=e.left+e.width,d=convertCoordToVisualLeft({coord:e,segments:r,zoom:t}),h=convertCoordToVisualLeft({coord:{left:u},segments:r,zoom:t}),p=Math.max(0,Math.ceil(o*d/100)-1),f=Math.ceil(o*h/100),{maxIndex:m}=(0,array_0.jy)(Array.from(i.slice(p,f)));n({frequency:maxIndexSegments2FrequencyBandwidth({frequencyLeft:(l+(p+m+1)/o*(s-l))*100/r.totalPoints,segments:r}),bandwidth:Math.round(1e3*scopeLeftSegments2bandwidth({segments:r,endLeft:u,startLeft:c})),left:d,right:h})},DragFrame_COMPONENT_KEY=constants_ToolType.DragFrame,DragFrame=({id:e})=>{let{state:{zoom:t,segments:r,signalAnalysis:n,globalID:a},dispatch:i}=useStore_useStore(),[o,l]=external_react_useState(null),s=external_react_useCallback((e,o=!1)=>{n.show&&n.display&&o?startEnd2AnalyseFrequencyBandwidth({e,zoom:t,segments:r,onChange:n.onChange,globalID:a}):i({payload:{zoom:{...t,interval:e.interval,isScanSegmentsUpdateMagnify:e.isScanSegmentsUpdateMagnify}}})},[n,t,r,a]),c=external_react_useCallback((e,t,r,n)=>{if(e&&t&&n){let r=e.left,n=t.left,a=n-r;l({diffX:a,left:a>0?r:n,width:Math.abs(a),isScanSegmentsUpdateMagnify:a>0})}},[]),u=external_react_useCallback(()=>{if(!o)return;let{left:e,width:t,isScanSegmentsUpdateMagnify:n,diffX:a}=o,{totalPoints:i}=r;if(n&&a>0){let r=createSelectedXZoomInterval({startPercent:e,endPercent:e+t,totalPoints:i}),a=r?r.end-r.start+1:0;r&&a>UI_CONFIG.ZOOM_MIN_RANGE&&s({interval:r,isScanSegmentsUpdateMagnify:n,left:e,width:t},!0)}a<0&&s({interval:{start:0,end:i-1},isScanSegmentsUpdateMagnify:n,left:e,width:t})},[o,r,t.interval.end,s]);return(external_react_useEffect(()=>{if(t.show){let t=()=>{l(null),resetEventLevel(e,DragFrame_COMPONENT_KEY)};createMouseDownEventManager(e,DragFrame_COMPONENT_KEY,t),createMouseUpEventManager(e,DragFrame_COMPONENT_KEY,()=>{u(),t()}),createMouseLeaveEventManager(e,DragFrame_COMPONENT_KEY,t),createDragEventManager(e,DragFrame_COMPONENT_KEY,(...t)=>{compareEventPriority(e,DragFrame_COMPONENT_KEY)&&c(t[0],t[1],t[2],t[3])})}},[t.show,e,u,c]),external_react_useEffect(()=>{o||resetEventLevel(e,DragFrame_COMPONENT_KEY)},[o,e]),t.show)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[3]",children:/*#__PURE__*/jsx_runtime_jsx("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:o?{left:`${o.left}%`,width:`${o.width}%`}:{},children:o&&!o.isScanSegmentsUpdateMagnify&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx("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__*/jsx_runtime_jsx("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},Spectrum_DragFrame=/*#__PURE__*/memo(DragFrame),FREQUENCY_ALLOCATION_LANE_HEIGHT=14,FREQUENCY_ALLOCATION_COMPACT_LANE_HEIGHT=5,FREQUENCY_ALLOCATION_COMPACT_THRESHOLD=4,resolveFrequencyAllocationDensity=({density:e="auto",channelCount:t})=>{let r="compact"===e||"auto"===e&&t>FREQUENCY_ALLOCATION_COMPACT_THRESHOLD;return{compact:r,laneHeight:r?FREQUENCY_ALLOCATION_COMPACT_LANE_HEIGHT:FREQUENCY_ALLOCATION_LANE_HEIGHT,showLabels:!r}},optimizedColors=null,originalColors=["#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 hexToHsl(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),i=Math.min(t,r,n),o=0,l=0,s=(a+i)/2;if(a!==i){let e=a-i;switch(l=s>.5?e/(2-a-i):e/(a+i),a){case t:o=(r-n)/e+6*(r<n);break;case r:o=(n-t)/e+2;break;case n:o=(t-r)/e+4}o/=6}return{h:360*o,s:100*l,l:100*s}}let sortedColors=[...originalColors].map(e=>({color:e,hsl:hexToHsl(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 sortAndRecolorFrequencyAllocationData(e){let t=[...e].sort((e,t)=>Number(e.startFrequency)-Number(t.startFrequency));return t.map((e,r)=>{let n=t.length,a=sortedColors.length,i=Math.floor(r/n*a),o=Math.floor((r+1)/n*a),l=sortedColors[Math.min(i,a-1)],s=sortedColors[Math.min(o,a-1)],c=r===n-1?sortedColors[a-1]:s;return{...e,color:l,gradientColors:[l,c]}})}let FrequencyAllocation_data=[{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、无人机等使用频段"}],STORAGE_KEY="rfkit-charts-frequency-allocation",isFrequencyAllocationChannelCache=e=>!!e&&"object"==typeof e&&2===e.version&&Array.isArray(e.channels),readFrequencyAllocationCache=()=>{let e=localStorage.getItem(STORAGE_KEY);if(!e)return null;let t=JSON.parse(e);return Array.isArray(t)||isFrequencyAllocationChannelCache(t)?t:null},getFrequencyAllocationFromCache=()=>{let e=readFrequencyAllocationCache();return Array.isArray(e)?e:null},getFrequencyAllocationChannelsFromCache=()=>{let e=readFrequencyAllocationCache();return isFrequencyAllocationChannelCache(e)?e.channels:null},setFrequencyAllocationToCache=e=>{localStorage.setItem(STORAGE_KEY,JSON.stringify(e))},setFrequencyAllocationChannelsToCache=e=>{localStorage.setItem(STORAGE_KEY,JSON.stringify({version:2,channels:e}))},clearFrequencyAllocationCache=()=>{localStorage.removeItem(STORAGE_KEY)},hasFrequencyAllocationCache=()=>null!==localStorage.getItem(STORAGE_KEY),DEFAULT_FREQUENCY_ALLOCATION_CHANNEL_ID="default",resolveChannelId=(e,t)=>e.id||e.title||`${DEFAULT_FREQUENCY_ALLOCATION_CHANNEL_ID}-${t}`,normalizeChannels=(e,t)=>e.map((e,r)=>({id:resolveChannelId(e,r),title:e.title,data:t(e.data??[])})).filter(e=>e.data.length>0),normalizeSingleChannel=(e,t)=>[{id:DEFAULT_FREQUENCY_ALLOCATION_CHANNEL_ID,data:t(e)}];function resolveFrequencyAllocationChannelModel({data:e,channels:t,cachedData:r,cachedChannels:n,presetData:a,normalizeData:i}){if(t)return t.length?normalizeChannels(t,i):normalizeSingleChannel(e?.length?e:a,i);if(n?.length)return normalizeChannels(n,i);let o=e??[];return normalizeSingleChannel(r&&r.length>0?r:o.length>0?o:a,i)}function resolveFrequencyAllocationChannels({data:e,channels:t}){return resolveFrequencyAllocationChannelModel({data:e,channels:t,cachedData:getFrequencyAllocationFromCache(),cachedChannels:getFrequencyAllocationChannelsFromCache(),presetData:FrequencyAllocation_data,normalizeData:sortAndRecolorFrequencyAllocationData})}function resolveFrequencyAllocationData_resolveFrequencyAllocationData(e){return resolveFrequencyAllocationChannels({data:e})[0]?.data??[]}let resolveFrequencyAllocationRange=e=>{if(null!=e.startFrequency&&null!=e.stopFrequency){let t=frequencyCalculation_calculateFrequencyRange({startFrequency:Number(e.startFrequency),stopFrequency:Number(e.stopFrequency)});if(t)return{start:t.startFreq,stop:t.stopFreq,type:"range"}}return null},resolveFrequencyAllocationSegments=({segments:e,allocations:t,channelIndex:r,channelTitle:n})=>{if(!e.length||!t.length)return[];let a=e.reduce((e,t)=>e+t.point,0);return e.map((i,o)=>{let l=t.map(e=>{let t=resolveFrequencyAllocationRange(e);if(!t||t.stop<i.start||t.start>i.stop)return null;let{left:a,width:o}=calculatePositionFromFrequencyRange({startFreq:t.start,stopFreq:t.stop},i);return{band:e,range:t,channelIndex:r??0,channelTitle:n,position:{left:`${a}%`,width:`${o}%`}}}).filter(e=>null!==e),s=i.point/a*100,c=e.slice(0,o).reduce((e,t)=>e+t.point/a*100,0);return{segment:i,segmentIndex:o,bandPositions:l,style:{left:`${c}%`,width:`${s}%`}}})},resolveFrequencyAllocationLanes=({segments:e,channels:t})=>t.map((t,r)=>({channel:t,channelIndex:r,segmentData:resolveFrequencyAllocationSegments({segments:e,allocations:t.data,channelIndex:r,channelTitle:t.title})})).filter(e=>e.segmentData.some(e=>e.bandPositions.length>0)),resolver_createFrequencyAllocationRangeIndex=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),resolver_findFrequencyAllocationInRangeIndex=({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 i=Math.abs(n.center-t)-Math.abs(r.center-t);if(i<0){r=n;continue}!(i>0)&&0>n.title.localeCompare(r.title)&&(r=n)}return r?.item}},findFrequencyAllocationAtCursor=({allocations:e,frequency:t})=>resolver_findFrequencyAllocationInRangeIndex({rangeIndex:resolver_createFrequencyAllocationRangeIndex(e),frequency:t});function useFrequencyAllocationData_useFrequencyAllocationData(){let e=useSelector(e=>e.frequencyAllocation.data);return useMemo(()=>resolveFrequencyAllocationData(e),[e])}function useFrequencyAllocationChannels(){let e=useStore_useSelector(e=>e.frequencyAllocation.data),t=useStore_useSelector(e=>e.frequencyAllocation.channels);return external_react_useMemo(()=>resolveFrequencyAllocationChannels({data:e,channels:t}),[e,t])}function useAllocationAtCursor({frequency:e,cursorSample:t}){let r=useSelector(e=>e.cursor),n=useSelector(e=>e.segments),a=useSelector(e=>e.frequencyAllocation.display),i=useSelector(e=>e.frequencyAllocation.show),o=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 o?calculateCursorPosition(o,n):{segmentIndex:-1,pointIndex:-1},[c,o,n]);return useMemo(()=>{if(!i||!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,i])}let useAllocationFinder=null,AllocationInfo=({allocationInfo:e,variant:t="default"})=>{if(!e)return null;let{title:r,description:n,startFrequency:a,stopFrequency:i,centerFrequency:o,stepFrequency:l,bandwidth:s,modulation:c,channelTitle:u}=e;return /*#__PURE__*/jsxs("div",{className:cn_cn("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:[r?/*#__PURE__*/jsx_runtime_jsx("div",{className:"mb-1 font-bold",children:r}):null,/*#__PURE__*/jsxs("div",{className:"mb-1 text-primary",children:[u?/*#__PURE__*/jsxs("div",{children:["通道:",u]}):null,a&&i&&/*#__PURE__*/jsxs("div",{children:["频率范围:",a," - ",i]}),o?/*#__PURE__*/jsxs("div",{children:["中心频率:",o," MHz"]}):null,l?/*#__PURE__*/jsxs("div",{children:["步进:",l," kHz"]}):null,s?/*#__PURE__*/jsxs("div",{children:["带宽:",s," MHz"]}):null,c?/*#__PURE__*/jsxs("div",{children:["调制方式:",c]}):null]}),n?/*#__PURE__*/jsx_runtime_jsx("div",{className:"leading-5 opacity-85",children:n}):null]})},presenters_AllocationInfo=/*#__PURE__*/react.memo(AllocationInfo),AllocationSegments=/*#__PURE__*/memo(({style:e,bandPositions:t,showLabels:r,onMouseEnter:n,onMouseMove:a,onMouseLeave:i})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute top-0 h-full [contain:layout]",style:e,children:t.map(e=>{let{band:t,channelIndex:o,range:l,position:s}=e;return /*#__PURE__*/jsx_runtime_jsx("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:s.left,width:s.width},onMouseEnter:n(e),onMouseMove:a,onMouseLeave:i,children:r?/*#__PURE__*/jsx_runtime_jsx("span",{className:"truncate",children:t.title}):null},`band-${o??0}-${t.title}-${l.start}-${l.stop}-${s.left}`)})})),presenters_AllocationSegments=AllocationSegments,overlays_Tooltip_Tooltip=({title:e,description:t,visible:r,x:n,y:a,startFrequency:i,stopFrequency:o,centerFrequency:l,stepFrequency:s,bandwidth:c,modulation:u,channelTitle:d,positionRef:h,scheduleRef:p})=>{let f=external_react_useRef(null),m=external_react_useRef(null),g=external_react_useCallback(()=>{if(!r||!f.current)return;let e=f.current,t=e.offsetWidth,i=e.offsetHeight,o=window.innerWidth,l=window.innerHeight,s=h.current??{x:n,y:a},c=s.x,u=s.y,d=Math.max(12,Math.min(c+t>o-12?c-t-10:c,o-t-12)),p=Math.max(12,Math.min(u+i>l-12?u-i-10:u,l-i-12));e.style.transform=`translate3d(${d}px, ${p}px, 0)`},[h,r,n,a]),b=external_react_useCallback(()=>{r&&null===m.current&&(m.current=requestAnimationFrame(()=>{m.current=null,g()}))},[g,r]);return(external_react_useEffect(()=>(p.current=b,()=>{p.current===b&&(p.current=null)}),[b,p]),external_react_useEffect(()=>{if(r)return b(),()=>{null!==m.current&&(cancelAnimationFrame(m.current),m.current=null)}},[b,r]),r)?/*#__PURE__*/jsx_runtime_jsx("div",{ref:f,className:"pointer-events-none fixed z-[1000] 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(${n}px, ${a}px, 0)`},children:/*#__PURE__*/jsx_runtime_jsx(presenters_AllocationInfo,{allocationInfo:{title:e,description:t,startFrequency:i,stopFrequency:o,centerFrequency:l,stepFrequency:s,bandwidth:c,modulation:u,channelTitle:d}})}):null},overlays_Tooltip=overlays_Tooltip_Tooltip,FrequencyAllocation=()=>{let e=useStore_useSelector(e=>e.axisX.unit),t=useStore_useSelector(e=>e.segments),r=useStore_useSelector(e=>e.frequencyAllocation.display),n=useStore_useSelector(e=>e.frequencyAllocation.show),a=useStore_useSelector(e=>e.frequencyAllocation.density),i=useStore_useSelector(e=>e.zoom.style),o=useFrequencyAllocationChannels(),[l,s]=external_react_useState({visible:!1,x:0,y:0}),c=external_react_useRef({x:0,y:0}),u=external_react_useRef(null),d=external_react_useCallback(e=>{c.current={x:e.clientX+10,y:e.clientY+10},u.current?.()},[]),h=external_react_useMemo(()=>resolveFrequencyAllocationLanes({segments:t,channels:o}),[t,o]),{laneHeight:p,showLabels:f}=resolveFrequencyAllocationDensity({density:a,channelCount:h.length}),m=Math.max(p,h.length*p),g=external_react_useCallback(e=>{s(t=>({...t,...e}))},[]),b=external_react_useCallback(({band:t,channelTitle:r,range:n})=>a=>{d(a);let i={...t,visible:!0,x:c.current.x,y:c.current.y,channelTitle:r,startFrequency:`${n.start}${e}`,stopFrequency:`${n.stop}${e}`};"centerBandwidth"===n.type&&null!=n.frequency&&null!=n.bandwidth&&(i.centerFrequency=`${n.frequency}${e}`,i.bandwidth=`${n.bandwidth}${e}`),g(i)},[e,g,d]),v=external_react_useCallback(e=>{d(e)},[d]),w=external_react_useCallback(()=>{g({visible:!1})},[g]);return n&&r&&0!==h.length?/*#__PURE__*/jsxs("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] flex w-full select-none items-center overflow-hidden",style:{height:m,backgroundColor:"color-mix(in srgb, var(--chart-surface) 12%, transparent)"},children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 h-full w-full will-change-transform",style:i??void 0,children:h.map(({channel:e,channelIndex:t,segmentData:r})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-0 w-full",style:{bottom:t*p,height:p},children:r.map(({segmentIndex:t,bandPositions:r,style:n})=>/*#__PURE__*/jsx_runtime_jsx(presenters_AllocationSegments,{style:n,bandPositions:r,showLabels:f,onMouseEnter:b,onMouseMove:v,onMouseLeave:w},`channel-${e.id}-segment-${t}`))},`channel-${e.id}`))}),/*#__PURE__*/jsx_runtime_jsx(overlays_Tooltip,{...l,positionRef:c,scheduleRef:u})]}):null},Spectrum_FrequencyAllocation=FrequencyAllocation,useUpdateKey=e=>{let[t,r]=external_react_useState(0);return external_react_useEffect(()=>{if(!e)return;let t=withUpdateData(e,"FrequencyTagLineBoard",()=>{r(e=>e+1)});return()=>{t?.()}},[e]),t},Board=({id:e})=>{let{state:{frequencyTagLine:t,cursor:r}}=useStore_useStore(),{show:n,display:a,left:i,onChange:o}=t,l=useUpdateKey(e),s=r.show&&r.active&&r.event?.sourceType===constants_ModuleType.Spectrum,c=external_react_useCallback(e=>{if(!e)return;let{index:t,frequency:r}=e;(0,array_0.Ub)(r)&&o({index:t,frequency:r})},[o]);return n&&a&&!s?/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute bottom-5 right-[34px] z-[6] h-auto w-auto",children:/*#__PURE__*/jsx_runtime_jsx(Spectrum_FrequencyDataBoard,{left:i,updateKey:l,onChange:c,showSignalInfo:!1})}):null},FrequencyTagLine_Board=/*#__PURE__*/react.memo(Board),FrequencyTagLine_Switch_Switch=()=>{let{state:{frequencyTagLine:e},dispatch:t}=useStore(),{display:r,show:n}=e,a=useCallback(r=>{t({payload:{frequencyTagLine:{...e,display:!!r}}})},[e]),i=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:i}):null},FrequencyTagLine_Switch=/*#__PURE__*/null,FrequencyTagLine_COMPONENT_KEY=constants_ToolType.FrequencyTagLine,FrequencyTagLine=e=>{let{state:{frequencyTagLine:t},dispatch:r}=useStore_useStore(),{show:n,display:a,left:i,onChange:o}=t,{id:l}=e,s=external_react_useRef(t);return(external_react_useEffect(()=>{s.current=t},[t]),external_react_useEffect(()=>{let e=createMouseUpEventManager(l,FrequencyTagLine_COMPONENT_KEY,()=>{n&&a&&resetEventLevel(l,FrequencyTagLine_COMPONENT_KEY)}),t=createMouseLeaveEventManager(l,FrequencyTagLine_COMPONENT_KEY,()=>{n&&a&&resetEventLevel(l,FrequencyTagLine_COMPONENT_KEY)});return()=>{e?.(),t?.()}},[l,n,a,o]),external_react_useEffect(()=>{let e=createMouseDownEventManager(l,FrequencyTagLine_COMPONENT_KEY,e=>{n&&a&&r({payload:{frequencyTagLine:{...s.current,...e,id:l}}})}),t=createDragEventManager(l,FrequencyTagLine_COMPONENT_KEY,(e,t)=>{n&&a&&(compareEventPriority(l,FrequencyTagLine_COMPONENT_KEY),r({payload:{frequencyTagLine:{...s.current,...t,id:l}}}))});return()=>{e?.(),t?.()}},[l,n,a,r]),external_react_useEffect(()=>{r({payload:{frequencyTagLine:{...t,left:-100}}})},[n]),n&&a)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[3]",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-px border-l border-dashed border-chart-highlight/80 opacity-80",style:{left:`${i}%`}})}):null},Spectrum_FrequencyTagLine=/*#__PURE__*/react.memo(FrequencyTagLine),LIMIT_THRESHOLD_TEXT_STYLE={color:SPECTRUM_THRESHOLD_COLOR},LIMIT_THRESHOLD_LINE_STYLE={borderColor:SPECTRUM_THRESHOLD_COLOR},Item_Item=({value:e,onChange:t,dragging:r})=>{let{state:{axisY:n,limit:a}}=useStore_useStore(),{label:i,disabled:o}=a,{unit:l="",range:s=constants_RANGE_DEFAULT,step:c=constants_stepDefault}=n,[u,d]=s,h=external_react_useMemo(()=>isdBm(l)?dBuV2dBm(0):0,[l]),p=external_react_useCallback(e=>(d-e-h)/(d-u)*100,[d,h,u]),f=external_react_useMemo(()=>p(e),[p,e]),m=external_react_useMemo(()=>Math.round(h+e),[h,e]),[g,b]=external_react_useState(!1),v=external_react_useRef(null),w=external_react_useCallback(e=>{switch(e.key){case"Enter":{if(!v.current){b(!1);break}let e=Number(v.current.value);!Number.isNaN(e)&&e>=u&&e<=d&&(t?.(Math.floor(e-h)),v.current.blur()),b(!1);break}case"Escape":b(!1)}},[v,s,h,t]);return /*#__PURE__*/jsx_runtime_jsx("div",{className:"relative h-full w-full",children:/*#__PURE__*/jsxs("div",{className:"absolute right-0 h-0 w-full",style:{top:`${f}%`},children:[!g||o?/*#__PURE__*/jsxs("button",{type:"button",disabled:o,className:`${r?"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:LIMIT_THRESHOLD_TEXT_STYLE,onClick:()=>b(!0),children:[i," ",m,l]}):/*#__PURE__*/jsxs("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:LIMIT_THRESHOLD_TEXT_STYLE,children:[i," ",/*#__PURE__*/jsx_runtime_jsx("input",{ref:v,type:"number","aria-label":`${i}${l}门限值`,defaultValue:m,min:u,max:d,step:c/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:LIMIT_THRESHOLD_TEXT_STYLE,onKeyDown:w}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"flex items-center",children:l})]}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-[-0.5px] z-[8] h-0 w-full border-b border-dashed",style:LIMIT_THRESHOLD_LINE_STYLE})]})})},Limit_Item=Item_Item,COMPONENT_NAME=constants_ToolType.Limit,HIT_SLOP_PX=10,Limit=({id:e})=>{let{state:{limit:t,segments:r,axisY:n,system:a},dispatch:i}=useStore_useStore(),{show:o,active:l,disabled:s,value:c,onChange:u,unified:d}=t,[h,p]=n.range,{totalPoints:f}=r,m=external_react_useMemo(()=>o&&l,[o,l]),[g,b]=external_react_useState(0/0),v=external_react_useRef(null),w=external_react_useRef(!1),y=external_react_useRef(t);external_react_useEffect(()=>{y.current=t},[t]);let x=external_react_useCallback((e,t)=>{let r,n=d?[t]:((r=[...y.current.value])[e]=t,r);i({payload:{limit:{...y.current,value:n}}})},[i,d]),k=external_react_useCallback(()=>{u(d?Array.from({length:r.length},()=>y.current.value[0]):y.current.value)},[u,d,r.length]);return(external_react_useEffect(()=>{createMouseDownEventManager(e,COMPONENT_NAME,e=>{if(!m||s||!e?.left||!e?.top)return;let t=e.left,i=d?0:r.findIndex(e=>e.progress[0]<=t&&t<e.progress[1]);if(!Number.isFinite(i)||i<0){b(0/0),v.current=null,w.current=!1;return}let o=p-h;if(!Number.isFinite(o)||0===o)return;let l=isdBm(n.unit)?dBuV2dBm(0):0,c=y.current.value[i],u=(p-c-l)/o*100,f=Math.max(1.2,HIT_SLOP_PX/Math.max(1,a.height||1)*100);if(Math.abs(e.top-u)>f){b(0/0),v.current=null,w.current=!1;return}b(i),v.current=c,w.current=!0}),createMouseLeaveEventManager(e,COMPONENT_NAME,()=>{m&&!s&&(w.current&&k(),b(0/0),v.current=null,w.current=!1,resetEventLevel(e,COMPONENT_NAME))}),createMouseUpEventManager(e,COMPONENT_NAME,()=>{m&&!s&&(w.current&&k(),b(0/0),v.current=null,w.current=!1,resetEventLevel(e,COMPONENT_NAME))}),createDragEventManager(e,COMPONENT_NAME,(t,r,n)=>{if(m&&!s&&(0,array_0.Ub)(g)&&compareEventPriority(e,COMPONENT_NAME)&&n?.top){let e=p-h;if(!Number.isFinite(e)||0===e)return;let t=(v.current??y.current.value[g])-n.top*e;v.current=t,x(g,t)}})},[m,s,g,r,e,x,k,d,h,p,n.unit,a.height]),m)?d?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[7]",children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full w-full",style:{opacity:+!!(0,array_0.Ub)(c[0])},children:/*#__PURE__*/jsx_runtime_jsx(Limit_Item,{id:e,value:c[0],onChange:e=>x(0,e),dragging:(0,array_0.Ub)(g)})})}):/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[7]",children:r?.map((t,r)=>/*#__PURE__*/jsx_runtime_jsx("div",{style:{width:`${100*t.point/f}%`,opacity:+!!(0,array_0.Ub)(c[r])},className:"h-full w-[30%]",children:/*#__PURE__*/jsx_runtime_jsx(Limit_Item,{id:e,value:c[r],onChange:e=>x(r,e),dragging:(0,array_0.Ub)(g)},t.index)},t.index))}):null},Spectrum_Limit=Limit,useMarkerEvents_COMPONENT_KEY=constants_ToolType.Markers,MARKER_HIT_PX=6,MARKER_HOVER_PX=8,useMarkerEvents=e=>{let{id:t,markers:r,display:n,fixed:a,readonly:i,onCreateMarker:o,onDeleteMarker:l,onUpdateMarker:s,onToggleSelect:c,onHover:u,onResetHover:d}=e,h=external_react_useRef({isDown:null,dragStart:null,isHover:"",hoverId:null}),p=external_react_useCallback(()=>document.getElementById(getEID(t))??document.getElementById(t),[t]),f=external_react_useCallback(e=>{if(!e||!r||0===r.length)return null;let{left:t}=e;if(void 0===t)return null;let n=p();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<=MARKER_HIT_PX)return{...n,index:e}}return null},[p,r]),m=external_react_useCallback(e=>{let t=p();if(!t)return"";let n=t.getBoundingClientRect().width,a="";for(let t=0;t<r.length;t+=1){let i=r[t];if(i&&Math.abs(e.left-i.left)*n/100<=MARKER_HOVER_PX){a={...i,index:t};break}}return a},[p,r]);return external_react_useEffect(()=>{if(i)return;let e=createMoveEventManager(t,useMarkerEvents_COMPONENT_KEY,(e,t)=>{if(n&&void 0!==t.left){let e=m({left:t.left}),r="object"==typeof e?e.id:null;if(h.current.hoverId===r){h.current.isHover=e;return}h.current.isHover=e,h.current.hoverId=r,u({left:t.left})}}),r=createDragEventManager(t,useMarkerEvents_COMPONENT_KEY,(e,r)=>{let{isDown:i}=h.current;n&&i&&compareEventPriority(t,useMarkerEvents_COMPONENT_KEY)&&!a&&s(i.id,{left:r.left,top:r.top})}),p=createMouseDownEventManager(t,useMarkerEvents_COMPONENT_KEY,e=>{if(!n)return;let t=f(e)||("object"==typeof h.current.isHover?h.current.isHover:null);t&&!a&&(h.current.isDown=t)}),g=createMouseUpEventManager(t,useMarkerEvents_COMPONENT_KEY,()=>{n&&(h.current.isDown=null,resetEventLevel(t,useMarkerEvents_COMPONENT_KEY))}),b=createMouseLeaveEventManager(t,useMarkerEvents_COMPONENT_KEY,()=>{if(!n)return;let e=null!==h.current.hoverId;h.current.isDown=null,h.current.isHover="",h.current.hoverId=null,resetEventLevel(t,useMarkerEvents_COMPONENT_KEY),e&&d()}),v=createLongPressEventManager(t,useMarkerEvents_COMPONENT_KEY,(e,r)=>{if(!n||!compareEventPriority(t,useMarkerEvents_COMPONENT_KEY))return;let a=f(r)||("object"==typeof h.current.isHover?h.current.isHover:null);a?.id&&c(a.id)}),w=createDoubleClickEventManager(t,useMarkerEvents_COMPONENT_KEY,(e,r)=>{if(!n||!compareEventPriority(t,useMarkerEvents_COMPONENT_KEY)||void 0===r.left)return!1;let a=m({left:r.left});return a&&"object"==typeof a&&a.id?l(a.id):o({left:r.left}),!0});return()=>{e?.(),r?.(),p?.(),g?.(),b?.(),v?.(),w?.()}},[t,n,r,a,i,o,l,s,c,u,d,f,m]),{isDown:h.current.isDown}},markerColors=getConfig("marker"),getRequiredGlobalStoreState=e=>getGlobalStoreState(e);function getPeaksFromDatabase(e,t,r){let{needsMaxPeak:n=!1,needsTopPeaks:a=!1}=r||{},i=null,o=null;try{let t=withDatabase(e).getAllRawData()[REAL_DATA_NAME];if(t?.peaks?.peaks&&Array.isArray(t.peaks.peaks)){let e=t.peaks.peaks;return n&&e.length>0&&(i=e[0]),a&&(o=e),{maxPeak:i,topPeaks:o}}}catch(e){console.warn("[useMarkers] Failed to get precomputed peaks:",e)}return n&&(i=findMaxPeak(t)),a&&(o=findTopPeaks(t,2)),{maxPeak:i,topPeaks:o}}let useMarkers=e=>{let{id:t,globalID:r,onChange:n}=e,[a,i]=external_react_useState({markers:[],colorIndex:0,isDown:null,isHover:"",peak:null,hasPeak:!1}),o=external_react_useRef(new Float32Array),l=external_react_useCallback((e,t)=>{let{axisY:{unit:n},axisX:{frequencyFormat:a}}=getRequiredGlobalStoreState(r),i=e.left,{peak:l}=e,s=t?.data??o.current;s&&0!==s.length||(s=withDatabase(r).getAllRawData()[REAL_DATA_NAME]),o.current=s;let c=splitZoomLeft({left:i,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=getPeaksFromDatabase(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=getPeaksFromDatabase(r,s,{needsMaxPeak:!0}).maxPeak),e&&(h=((f=e.index)+.5)*100/p)}let m=parseFloat(a(i=u+h/d)),g=s[f];return void 0===g||Number.isNaN(g)||(e.level=parseFloat(getVirtualLevel(n,g).toFixed(1))),{...e,left:i,frequency:m}},[r]),s=external_react_useCallback((e,t=!1)=>{0!==o.current.length&&i(a=>{let{marker:{maxCount:i}}=getRequiredGlobalStoreState(r);if(a.markers.length>=i)return a;let o=createGUID(),s=markerColors[a.colorIndex%20],c={...l({...e,id:o,color:s,select:!1,peak:!1,frequency:0,hover:!1}),id:o,color:s,select:!t,peak:!1,hover:!1},u=[...t?a.markers:a.markers.map(e=>({...e,select:!1})),c];return t||setTimeout(()=>{n?.(constants_MarkerEventType.Add,u)},0),{...a,markers:u,colorIndex:a.colorIndex+1}})},[l,n]),c=external_react_useCallback(({event:e,marker:t,frequencies:a,silent:s=!1})=>{i(i=>{let c=[...i.markers],u=constants_MarkerEventType.Update,{id:d,peak:h,select:p,frequency:f,left:m,top:g}=t||{},b=m;if(e===constants_MarkerEventType.Update&&void 0!==f){let e=getGlobalStoreState(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=constants_MarkerEventType.Del)}}}if(e===constants_MarkerEventType.Add&&a?.length){let e=getGlobalStoreState(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 i=0;i<a.length;i+=1){let o=a[i];o>=e&&o<=r&&t.push((o-e)*100/n)}t.length>0&&(a=t)}}}if(e===constants_MarkerEventType.Add&&a?.length){let{marker:{maxCount:e}}=getRequiredGlobalStoreState(r),t=e-c.length,n=Math.min(a.length,t);c=c.map(e=>({...e,select:!1}));for(let e=0;e<n;e+=1){let t=createGUID(),r=markerColors[(i.colorIndex+e)%20],s=!1;if(o.current&&o.current.length>0){let t=-1/0,r=0;for(let e=0;e<o.current.length;e++)o.current[e]>t&&(t=o.current[e],r=e);Math.abs(Math.floor(o.current.length*a[e]/100)-r)<=Math.max(1,Math.floor(.01*o.current.length))&&(s=!0)}let u=l({left:a[e],id:t,color:r,select:!1,peak:s,frequency:0,hover:!1});c.push({...u,id:t,color:r,select:e===n-1,peak:s,hover:!1})}u=constants_MarkerEventType.Add}if(e===constants_MarkerEventType.Del){let e=c.findIndex(e=>e.id===d);-1!==e&&(c.splice(e,1),u=constants_MarkerEventType.Del)}return e===constants_MarkerEventType.Clear&&(c=[],u=constants_MarkerEventType.Clear),e===constants_MarkerEventType.Update&&(u=constants_MarkerEventType.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),{...i,markers:c,colorIndex:e===constants_MarkerEventType.Clear?0:i.colorIndex}})},[l,n]),u=external_react_useCallback(()=>{i(e=>({...e,markers:[],colorIndex:0})),setTimeout(()=>{n?.(constants_MarkerEventType.Clear,[])},0)},[n]),d=external_react_useCallback(e=>{e&&(o.current=e),i(t=>{if(0===t.markers.length)return t;let a=t.markers.some(e=>e.peak&&"mainSecondary"!==e.peakTracking),i=t.markers.some(e=>"mainSecondary"===e.peakTracking&&"number"==typeof e.peakRank),s=e??o.current??new Float32Array,{maxPeak:c,topPeaks:u}=getPeaksFromDatabase(r,s,{needsMaxPeak:a,needsTopPeaks:i}),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?.(constants_MarkerEventType.Update,d)},0),{...t,markers:d}})},[l,n]),h=external_react_useCallback(e=>{let a=document.getElementById(t);if(!a)return"";let o=a.getBoundingClientRect(),{zoom:{interval:{start:l,end:s}},segments:c}=getRequiredGlobalStoreState(r),u=c.totalPoints/(s-l+1),d=o.width*u/100,h="",p=!1;return i(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?.(constants_MarkerEventType.Update,r)},0),{...t,markers:r,isHover:h}}),h},[t,r,n]),p=external_react_useCallback(()=>{i(e=>{let t=!1,r=e.markers.map(e=>(e.hover&&(t=!0),{...e,hover:!1}));return t&&setTimeout(()=>{n?.(constants_MarkerEventType.Update,r)},0),{...e,markers:r,isHover:""}})},[n]),f=external_react_useRef(null),m=external_react_useRef(null),g=external_react_useCallback(()=>{i(e=>{if(e.markers.some(e=>"mainSecondary"===e.peakTracking)){let t=e.markers.filter(e=>"mainSecondary"!==e.peakTracking),r=f.current;if(r){let e=t.findIndex(e=>e.id===r);-1!==e&&(t[e]={...t[e],select:!0})}return f.current=null,setTimeout(()=>{n?.(constants_MarkerEventType.Update,t)},0),{...e,markers:t}}let{marker:t}=getRequiredGlobalStoreState(r);if(t.maxCount-e.markers.length<2)return e;f.current=e.markers.find(e=>e.select)?.id??null;let a=[],i=e.colorIndex,s=e=>{let t=createGUID(),r=markerColors[i%20];i+=1;let n=l({left:50,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,frequency:0,hover:!1});a.push({...n,id:t,color:r,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:e,hover:!1})};s(0),s(1);let c=[...e.markers,...a.map(e=>({...e,select:!1}))].map(e=>l(e,{data:o.current}));return setTimeout(()=>{n?.(constants_MarkerEventType.Update,c)},0),{...e,markers:c,colorIndex:i}})},[l,r,n]),b=external_react_useCallback(()=>{i(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=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?.(constants_MarkerEventType.Update,t)},0),{...e,markers:t}}let{marker:t}=getRequiredGlobalStoreState(r);if(t.maxCount-e.markers.length<1)return e;m.current=e.markers.find(e=>e.select)?.id??null;let a=createGUID(),i=markerColors[e.colorIndex%20],s={...l({left:50,id:a,color:i,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,frequency:0,hover:!1}),id:a,color:i,select:!1,peak:!0,peakTracking:"mainSecondary",peakRank:0,hover:!1},c=[...e.markers,s].map(e=>l(e,{data:o.current}));return setTimeout(()=>{n?.(constants_MarkerEventType.Update,c)},0),{...e,markers:c,colorIndex:e.colorIndex+1}})},[l,r,n]),v=external_react_useCallback((e,t)=>{i(a=>{let i=a.markers.find(e=>e.id===t);if(!i)return a;let s=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!s||s.length<3)return a;o.current=s;let{zoom:c,segments:u}=getRequiredGlobalStoreState(r),d=s.length,h=u.totalPoints||d,p=c.interval.end-c.interval.start+1,f=(i.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?.(constants_MarkerEventType.Update,v)},0),{...a,markers:v}})},[l,r,n]),w=external_react_useCallback(e=>{i(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!a||a.length<1)return t;o.current=a;let{zoom:i,segments:s}=getRequiredGlobalStoreState(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)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),f=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...i}=t;return l({...i,left:p,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(constants_MarkerEventType.Update,f)},0),{...t,markers:f}})},[l,r,n]),y=external_react_useCallback(e=>{i(t=>{if(!t.markers.find(t=>t.id===e))return t;let a=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!a||a.length<3)return t;o.current=a;let{zoom:i,segments:s}=getRequiredGlobalStoreState(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)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),b=t.markers.map(t=>{if(t.id!==e)return{...t,select:!1};let{peakTracking:r,peakRank:n,...i}=t;return l({...i,left:g,select:!0,peak:!1},{data:a})});return setTimeout(()=>{n?.(constants_MarkerEventType.Update,b)},0),{...t,markers:b}})},[l,r,n]),x=external_react_useCallback((e,t)=>{i(a=>{let i,s=a.markers.find(e=>e.id===t);if(!s)return a;let c=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!c||c.length<2)return a;o.current=c;let{zoom:u,segments:d}=getRequiredGlobalStoreState(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((i="left"===e?Math.max(0,m-1):Math.min(h-1,m+1))===m)return a;let g=(100*i/(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?.(constants_MarkerEventType.Update,b)},0),{...a,markers:b}})},[l,r,n]),k="#F98116",S="#AA74E8",D=external_react_useCallback(()=>{i(e=>{let t,a=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!a||a.length<1)return e;o.current=a;let{zoom:i,segments:s}=getRequiredGlobalStoreState(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)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),f=e.markers.find(e=>e.color===k);if(f)t=e.markers.map(e=>e.id===f.id?l({...e,left:p},{data:a}):e);else{let{marker:n}=getRequiredGlobalStoreState(r),i=n.maxCount;if(e.markers.length>=i)return e;let o=l({left:p,id:createGUID(),color:k,select:!1,peak:!1,hover:!1},{data:a});t=[...e.markers,o]}return setTimeout(()=>{n?.(constants_MarkerEventType.Update,t)},0),{...e,markers:t}})},[l,r,n]),M=external_react_useCallback(()=>{i(e=>{let t,a=withDatabase(r).getAllRawData()[REAL_DATA_NAME];if(!a||a.length<3)return e;o.current=a;let{zoom:i,segments:s}=getRequiredGlobalStoreState(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)*(i.interval.end-i.interval.start+1)/100+i.interval.start)*(100/u),b=e.markers.find(e=>e.color===S);if(b)t=e.markers.map(e=>e.id===b.id?l({...e,left:g},{data:a}):e);else{let{marker:n}=getRequiredGlobalStoreState(r),i=n.maxCount;if(e.markers.length>=i)return e;let o=l({left:g,id:createGUID(),color:S,select:!1,peak:!1,hover:!1},{data:a});t=[...e.markers,o]}return setTimeout(()=>{n?.(constants_MarkerEventType.Update,t)},0),{...e,markers:t}})},[l,r,n]);return{markers:a.markers,isDown:a.isDown,isHover:a.isHover,createMarker:s,updateMarkerAttribute:c,resetMarkers:u,updateByData:d,handleHover:h,resetHover:p,toggleMainSecondaryPeaks:g,toggleMainPeak:b,moveToAdjacentPeak:v,findMainPeak:w,findSecondaryPeak:y,moveToStep:x,createMainPeakMarker:D,createSecondaryPeakMarker:M,setState:i}},Dashed=e=>{let{top:t,left:r,color:n="transparent",x:a=!0,y:i=!0,lineWidth:o=1}=e;return /*#__PURE__*/jsxs(Fragment,{children:[a&&/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-0 top-[-200%] z-[5] w-full border-t border-dashed",style:{top:t,borderColor:n,borderTopWidth:`${o}px`}}),i&&/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-[-200%] top-0 z-[5] h-full border-l border-dashed",style:{left:r,borderColor:n,borderLeftWidth:`${o}px`}})]})},components_Dashed=Dashed,MarkerItem=({marker:e})=>{let{state:{axisX:t,axisY:r}}=useStore_useStore(),n=external_react_useRef(null),a=external_react_useRef(null),[i,o]=external_react_useState(0),[l,s]=external_react_useState(0);external_react_useEffect(()=>{let e=()=>{n.current&&o(n.current.offsetWidth),a.current&&s(a.current.offsetWidth)};e();let t=new ResizeObserver(()=>{e()});return n.current&&t.observe(n.current),a.current&&t.observe(a.current),()=>{t.disconnect()}},[e.frequency,e.level]);let c=external_react_useMemo(()=>{let t=e.left/100*i,r=i>0&&l>0&&t+l+10>i-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,i,l]);return /*#__PURE__*/jsxs("div",{ref:n,className:"absolute left-0 top-0 h-full w-full",id:e.id,title:`${e.frequency}${t.unit} / ${e.level}${r.unit}`,children:[/*#__PURE__*/jsxs("div",{ref:a,className:"absolute top-[10px] z-[5] whitespace-nowrap text-[12px] leading-4 transition-[opacity,font-weight,transform,margin-left,color]",style:c,children:[/*#__PURE__*/jsxs("div",{children:[e.frequency,t.unit]}),void 0!==e.level&&/*#__PURE__*/jsxs("div",{children:[e.level,r.unit]})]}),/*#__PURE__*/jsx_runtime_jsx(components_Dashed,{x:!1,left:`${e.left}%`,top:`${e.top}%`,color:e.color,lineWidth:e.select?2:1})]},e.id)},Markers_MarkerItem=/*#__PURE__*/react.memo(MarkerItem),Markers=({id:e})=>{let{state:{marker:t,globalID:r}}=useStore_useStore(),{enabled:n,visible:a,fixed:i,readonly:o,maxCount:l,onChange:s}=t,c=external_react_useCallback((e,t)=>{s?.(e,t),MARKER_COUNT_CHANGE(r)({count:t.length,maxCount:l});let n=t.find(e=>e.select)?.id??null;MARKER_SELECTION_CHANGE(r)({selectedId:n})},[s,r,l]),u=external_react_useMemo(()=>n&&a,[n,a,t.enabled,t.visible]),d=external_react_useMemo(()=>getEID(e),[e]),{markers:h,createMarker:p,updateMarkerAttribute:f,resetMarkers:m,updateByData:g,handleHover:b,resetHover:v,toggleMainSecondaryPeaks:w,toggleMainPeak:y,moveToAdjacentPeak:x,findMainPeak:k,findSecondaryPeak:S,createMainPeakMarker:D,createSecondaryPeakMarker:M}=useMarkers({id:e,globalID:r,display:a,onChange:c});external_react_useEffect(()=>{if(!r||!d||!u||o)return;let e=useKeyEvent_subscriptionKeyBus(r,d,e=>{let t=e.key.toLowerCase();if(!["a","d","w","s"].includes(t))return;if("w"===t){if(e.repeat)return;e.preventDefault(),D();return}if("s"===t){if(e.repeat)return;e.preventDefault(),M();return}let r=h.find(e=>e.select)?.id;r&&(e.preventDefault(),x("a"===t?"left":"right",r))});return()=>{e?.()}},[d,r,h,x,u,o,D,M]);let F=external_react_useCallback(e=>{let t=h.find(t=>t.id===e),r=!t?.select;f({event:constants_MarkerEventType.Update,marker:{id:e,select:r}})},[h,f]),C=external_react_useCallback((e,t)=>{f({event:constants_MarkerEventType.Update,marker:{id:e,left:t.left,top:t.top}})},[f]);useMarkerEvents({id:e,markers:h,display:u,fixed:i,readonly:o,onCreateMarker:p,onDeleteMarker:external_react_useCallback(e=>{f({event:constants_MarkerEventType.Del,marker:{id:e}})},[f]),onUpdateMarker:C,onToggleSelect:F,onHover:b,onResetHover:v});let E=external_react_useRef(null);return(external_react_useEffect(()=>{r&&e&&withUpdateData(e,"Marker",()=>{let{realData:e}=withDatabase(r).getAllRawData();E.current=e??null,g(e)})},[r,e,g]),external_react_useEffect(()=>{r&&e&&MARKER_UPDATE_ATTRIBUTE(r,e=>{f(e)})},[r,e,f,m]),external_react_useEffect(()=>{r&&e&&MARKER_COMMAND(r,e=>{if(e?.type){if("main-secondary-peaks"===e.type)return void w();if("main-peak"===e.type)return void y();if("left-peak"===e.type)return void x("left",e.selectedId);if("right-peak"===e.type)return void x("right",e.selectedId);if("find-main-peak"===e.type)return void k(e.selectedId);if("find-secondary-peak"===e.type)return void S(e.selectedId);if("create-main-peak"===e.type)return void D();if("create-secondary-peak"===e.type)return void M();if("clear-all"===e.type)return void m()}})},[r,e,x,w,y,k,S,D,M,m]),u)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[5]",children:h.map(e=>/*#__PURE__*/jsx_runtime_jsx(Markers_MarkerItem,{marker:e},e.id))}):null},Spectrum_Markers=Markers,infoSegments2Scope=({segments:e,index:t,frequency:r,bandwidth:n})=>{if(!r||!n||!e||!e[t])return{left:0,width:0};let a=e[t],i=e.reduce((e,t)=>e+t.point,0),{left:o,width:l}=calculatePositionFromFrequencyRange({startFreq:r-n/2e3,stopFreq:r+n/2e3},a),s=e.slice(0,t).reduce((e,t)=>e+t.point/i*100,0),c=a.point/i*100;return{left:s+o/100*c,width:l/100*c}};function useScope_useScope(){let{state:{scope:e,segments:t},dispatch:r}=useStore_useStore();return external_react_useCallback(n=>{let{frequency:a,bandwidth:i,index:o=0}=n,{left:l,width:s}=infoSegments2Scope({segments:t,index:o,frequency:a,bandwidth:i});r({payload:{scope:{...e,left:l,width:s}}})},[t,e])}let Scope=()=>{let{state:{scope:{show:e,left:t,width:r}}}=useStore_useStore();return e?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:/*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-0 box-border border-y border-dashed border-chart-grid bg-chart-surface opacity-50",style:{width:`${r}%`,left:`${t}%`}})}):null},Spectrum_Scope=Scope,SignalSegments=/*#__PURE__*/memo(({style:e,signalPositions:t,activeSignalKey:r,segmentIndex:n})=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute h-full box-border",style:e,children:t.map(({item:e,key:t,position:a,color:i,tooltip:o})=>{let l=r===t,s={left:a.left,width:a.width,minWidth:"1px",backgroundColor:i,height:l?"100%":"8px",opacity:l?.5:1};return /*#__PURE__*/jsx_runtime_jsx("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":l?"true":"false","data-signal-key":t,"data-signal-source":resolveSignalSource(e),"data-testid":"signal-annotation",style:s,title:o},`segment-${n}-signal-${t}`)})})),presenters_SignalSegments=SignalSegments;function useSignalDataManager(){let{state:e,dispatch:t}=useStore_useStore(),r=external_react_useRef(e.globalID),n=external_react_useRef(e.signal),a=external_react_useRef({});return external_react_useEffect(()=>{r.current=e.globalID,n.current=e.signal},[e.globalID,e.signal]),external_react_useEffect(()=>{if(!e.globalID)return;let r=a.current.station,i=a.current.simple;void 0!==r&&(STATION_DATA(e.globalID,r),a.current.station=void 0),void 0!==i&&(t({payload:{signal:{...n.current,data:i}}}),a.current.simple=void 0)},[t,e.globalID]),{updateSignalData:external_react_useCallback(e=>{let{type:i,data:o}=e;if(Array.isArray(o)){if("station"===i){if(!r.current){a.current.station=o;return}STATION_DATA(r.current,o)}else if("simple"===i){if(!r.current){a.current.simple=o;return}t({payload:{signal:{...n.current,data:o}}})}}},[t])}}let Signal=({id:e,show:t=!0,display:r=!0})=>{let n=useStore_useSelector(e=>e.segments),a=useStore_useSelector(e=>e.zoom.style),i=useStore_useSelector(e=>e.signal),o=useCursorSample(e),l=o?.coord.left,s=useUnifiedSignals({respectVisibility:!0}),c=i.show&&i.display&&r,u=!!o,d=external_react_useMemo(()=>u&&"number"==typeof l?frequencyCalculation_calculateCursorPosition(l,n):{segmentIndex:-1,pointIndex:-1},[u,n,l]),h=external_react_useMemo(()=>u?frequencyCalculation_getCursorFrequencyAtPosition(n,d):0/0,[d,u,n]),p=external_react_useMemo(()=>resolveStaticSignalSegments({segments:n,signalItems:s}),[n,s]),f=external_react_useMemo(()=>resolveActiveSignalKey({segmentData:p,isCursorActive:u,currentFrequency:h,currentPosition:d}),[h,d,u,p]);return t&&c?/*#__PURE__*/jsx_runtime_jsx("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__*/jsx_runtime_jsx("div",{className:"absolute right-0 top-0 flex h-full w-full",style:a??void 0,children:p.map(({segmentIndex:e,signalPositions:t,style:r})=>/*#__PURE__*/jsx_runtime_jsx(presenters_SignalSegments,{style:r,signalPositions:t,activeSignalKey:d.segmentIndex===e?f:void 0,segmentIndex:e},`segment-${e}`))})}):null},Spectrum_Signal=Signal,StripeSwitch=()=>{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},Stripe_Switch=null,Stripe_COMPONENT_KEY=constants_ToolType.Stripe,EDGE_HIT_SLOP=1.5,Stripe_clampPercent=e=>Math.max(0,Math.min(100,e)),resolveDragMode=({cursor:e,left:t,right:r})=>{let n=Math.abs(e-t),a=Math.abs(e-r);return n<=EDGE_HIT_SLOP?"left":a<=EDGE_HIT_SLOP?"right":e>t&&e<r?"move":n<=a?"left":"right"},Stripe=({id:e})=>{let{state:{stripe:t,axisX:{frequencyFormat:r,unit:n}},dispatch:a}=useStore_useStore(),{show:i,display:o,left:l,right:s,defaultLeft:c,defaultRight:u,onChange:d}=t,h=external_react_useRef(t),p=external_react_useRef(null),f=external_react_useRef(r),m=external_react_useRef(n),g=external_react_useRef(d);external_react_useEffect(()=>{h.current=t,f.current=r,m.current=n,g.current=d},[t,r,n,d]),external_react_useEffect(()=>{a({payload:{stripe:{...t,left:c,right:u}}})},[c,u]);let b=external_react_useCallback(e=>{let t=p.current;if(!t||!Number.isFinite(e?.left))return;let r=Stripe_clampPercent(e.left),n=h.current,{mode:i,startCursor:o,startLeft:l,startRight:s}=t,c=l,u=s;if("move"===i){let e=s-l;(u=(c=Stripe_clampPercent(l+(r-o)))+e)>100&&(c=Math.max(0,(u=100)-e))}"left"===i&&(c=Math.min(r,s)),"right"===i&&(u=Math.max(r,l)),a({payload:{stripe:{...n,left:c,right:u}}})},[a]),v=external_react_useCallback(()=>{let{left:e,right:t}=h.current,r=Math.round(10*e)/10,n=Math.round(10*t)/10,a=f.current?.(r)??"",i=f.current?.(n)??"",o=n-r,l=Number(i)-Number(a);g.current({left:r,right:n,width:o,start:a,end:i,bandwidth:l,unit:m.current})},[]);return(external_react_useEffect(()=>{createMouseDownEventManager(e,Stripe_COMPONENT_KEY,t=>{if(!i||!o||!Number.isFinite(t?.left))return;let r=h.current,n=Stripe_clampPercent(t.left);p.current={mode:resolveDragMode({cursor:n,left:r.left,right:r.right}),startCursor:n,startLeft:r.left,startRight:r.right},compareEventPriority(e,Stripe_COMPONENT_KEY)}),createMouseUpEventManager(e,Stripe_COMPONENT_KEY,()=>{i&&o&&p.current&&(p.current=null,resetEventLevel(e,Stripe_COMPONENT_KEY),v())}),createMouseLeaveEventManager(e,Stripe_COMPONENT_KEY,()=>{i&&o&&p.current&&(p.current=null,resetEventLevel(e,Stripe_COMPONENT_KEY),v())}),createMoveEventManager(e,Stripe_COMPONENT_KEY,(e,t)=>{i&&o&&p.current&&b(t)})},[e,i,o,b,v]),i&&l-s!=0&&o)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[3]",children:/*#__PURE__*/jsx_runtime_jsx("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:`${l}%`,width:`${s-l}%`}})}):null},Spectrum_Stripe=Stripe;function resolveBandPositions(e,t){if(!e.show)return[];if(e.kind===BandKind.Position)return[{key:BandKind.Position,left:e.left??50-e.width/2,width:e.width}];let r=frequencyCalculation_calculateFrequencyRange(e);if(!r||!t.length)return[];let n=t.reduce((e,t)=>e+Math.max(0,t.point),0);if(n<=0)return[];let a=[],i=0;return t.forEach((e,t)=>{let o=Math.max(0,e.point)/n*100;if(e.point>0&&e.frequencyCache?.length&&isRangeIntersectSegment(r,e)){let n=calculatePositionFromFrequencyRange(r,e);a.push({key:`frequency-${t}`,left:i+n.left/100*o,width:n.width/100*o})}i+=o}),a}function useBandLayerController(){let{dispatch:e,store:t}=useStoreApi();return external_react_useCallback(r=>{let n=t.getState().band,a=resolveBandState(r,n,"replace");a!==n&&e({payload:{band:a}})},[e,t])}let BandLayer=()=>{let e=useStore_useSelector(e=>e.band),t=useStore_useSelector(e=>e.segments),r=external_react_useMemo(()=>resolveBandPositions(e,t),[e,t]);return r.length?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:r.map(t=>/*#__PURE__*/jsx_runtime_jsx("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},Spectrum_BandLayer=BandLayer,TAP_SLOP_PX=10,TAP_MAX_DURATION_MS=300,TWO_FINGER_TAP_MS=300,PINCH_AXIS_X_DEG=30,PINCH_AXIS_Y_DEG=60,createIdleGesture=()=>({mode:"idle",startX:0,startY:0,startTime:0,lastX:0,lastY:0,startCoord:null,pinchBase:null}),TouchBus_clamp=(e,t,r)=>Math.max(t,Math.min(e,r)),TouchBus=({id:e})=>{let{state:{zoom:t,segments:r,axisY:n,globalID:a},dispatch:i}=useStore_useStore(),o=getEID(e),l=external_react_useRef(null),s=external_react_useRef(createIdleGesture()),c=external_react_useRef(t),u=external_react_useRef(r.totalPoints),d=external_react_useRef(n);external_react_useEffect(()=>{c.current=t},[t]),external_react_useEffect(()=>{u.current=r.totalPoints},[r]),external_react_useEffect(()=>{d.current=n},[n]);let h=external_react_useCallback((e,t,r)=>({currentTarget:e,clientX:t,clientY:r}),[]),p=external_react_useCallback(e=>{let t=Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY})),r=t.length,n=0,a=0,i=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,i=(e.y+r.y)/2}else 1===r&&(a=t[0].x,i=t[0].y);return{count:r,points:t,distance:n,midX:a,midY:i}},[]),f=external_react_useCallback((e,t,r)=>{let n=h(e,t,r),a=calculateEventRelativePosition(n);createMouseEnterEventManager(o)(),createMoveEventManager(o)(n,a)},[o,h]),m=external_react_useCallback(e=>{let t=s.current.pinchBase,r=u.current;if(!t||t.distance<=0||e<=0)return;let n=e/t.distance;if(("x"===t.axisMode||"xy"===t.axisMode)&&c.current.show&&r){let e=calculateAnchoredXZoomInterval({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)&&a&&(useRangeZoom(a)(t.lastScale/n,t.yAnchorValue),t.lastScale=n)},[i,a]),g=external_react_useRef(m);g.current=m;let b=external_react_useCallback(e=>{let t=l.current,r=s.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=calculateEventRelativePosition(h(t,n,a));return}if(2===e.touches.length){r.mode="pinch",r.startTime=Date.now();let n=c.current,a=p(e),[i,o]=a.points,l=Math.abs(o.x-i.x),s=180*Math.atan2(Math.abs(o.y-i.y),l)/Math.PI,{start:u,end:f}=n.interval,m=calculateEventRelativePosition(h(t,a.midX,a.midY)).left??0,g=t.getBoundingClientRect();if(g.height<=0||a.distance<=0){r.pinchBase=null;return}let[b,v]=d.current.realRange??[0,1],w=TouchBus_clamp((a.midY-g.top)/g.height,0,1);r.pinchBase={distance:a.distance,lastScale:1,interval:{start:u,end:f},anchorPercent:TouchBus_clamp(m,0,100),axisMode:s<PINCH_AXIS_X_DEG?"x":s>PINCH_AXIS_Y_DEG?"y":"xy",yAnchorValue:v-w*(v-b),startPoints:a.points,pinchMoved:!1}}}},[p,h]),v=external_react_useRef(throttleRequestAnimationFrame(e=>{if(!e||!("count"in e))return;let t=l.current,r=s.current;if(!t)return;let{count:n,points:a,distance:i}=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(i-e.distance)>TAP_SLOP_PX||Math.hypot(t.x-r.x,t.y-r.y)>TAP_SLOP_PX)&&(e.pinchMoved=!0)}g.current(i)}return}if(1!==n)return;let c=a[0];if("pending"===r.mode){let e=c.x-r.startX,t=c.y-r.startY;if(e*e+t*t<=TAP_SLOP_PX**2)return;r.mode="drag"}if("drag"!==r.mode)return;let u=t.getBoundingClientRect(),d={left:(c.x-r.lastX)/u.width,top:(c.y-r.lastY)/u.height},p=h(t,c.x,c.y),f=calculateEventRelativePosition(p);createMoveEventManager(o)(p,f),createDragEventManager(o)(r.startCoord,f,d,!1),r.lastX=c.x,r.lastY=c.y})).current,w=external_react_useCallback(e=>{v(p(e))},[p,v]),y=external_react_useCallback(e=>{let t=l.current,r=s.current;if(!t)return;let n=e.changedTouches[0],a=n?.clientX??r.lastX,i=n?.clientY??r.lastY;if("pending"===r.mode){let e=Date.now()-r.startTime,n=a-r.startX,o=i-r.startY;n*n+o*o<=TAP_SLOP_PX**2&&e<=TAP_MAX_DURATION_MS&&f(t,a,i)}if(1===e.touches.length){let n=e.touches[0];r.mode="drag",r.startX=n.clientX,r.startY=n.clientY,r.lastX=n.clientX,r.lastY=n.clientY,r.pinchBase=null,r.startCoord=calculateEventRelativePosition(h(t,n.clientX,n.clientY))}else 0===e.touches.length&&("pinch"===r.mode&&r.pinchBase&&!r.pinchBase.pinchMoved&&Date.now()-r.startTime<=TWO_FINGER_TAP_MS&&createMouseLeaveEventManager(o)(),r.mode="idle",r.pinchBase=null,createMouseUpEventManager(o)())},[o,f,h]),x=external_react_useCallback(()=>{let e=s.current;e.mode="idle",e.pinchBase=null,createMouseLeaveEventManager(o)()},[o]),k=external_react_useCallback(e=>{e.preventDefault()},[]);return external_react_useEffect(()=>()=>{createMouseLeaveEventManager(o)()},[o]),external_react_useEffect(()=>{l.current&&(l.current.id=o)},[o]),/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[5] pointer-events-auto",children:/*#__PURE__*/jsx_runtime_jsx("button",{ref:l,type:"button",className:cn_cn("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:k,onTouchStart:b,onTouchMove:w,onTouchEnd:y,onTouchCancel:x})})},Spectrum_TouchBus=TouchBus,Spectrum_Spectrum=e=>{let{children:t,touch:r}=e,{state:{axisY:{autoranging:n},series:{enableLengthSyncFastMode:a},globalID:i}}=useStore_useStore(),{id:o,chart:l,Chart:s}=hooks_useChart({Render:Spectrum,params:{autoranging:n,enableLengthSyncFastMode:a}});useZoomEvent(o,constants_ModuleType.Spectrum);let c=useBandLayerController(),u=useScope_useScope(),d=usePoints();return external_react_useEffect(()=>{if(i&&l)return setScanDF360Prob(i,e=>{l?.setDisabledClearRect(e)})},[i,l]),useModuleSubscription({moduleType:constants_ModuleType.Spectrum,chart:l,handleRender:(e,t)=>{t.updateSeries?.({data:e.data,extraData:e.extraData}),withUpdateData(o)()},eventHandlers:{autoranging:(e,t)=>{t.useRangeAutoFocus?.()},points:e=>{d(e.data)},[constants_PSType.Series]:(e,t)=>{t.setSeries?.(e)},band:e=>{c(e)},scope:e=>{u(e)}}}),/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(AxisYCanvas,{chart:l}),/*#__PURE__*/jsxs(components_PluginBox,{children:[/*#__PURE__*/jsx_runtime_jsx(components_GridLines,{}),/*#__PURE__*/jsx_runtime_jsx(s,{}),t,/*#__PURE__*/jsx_runtime_jsx(FrequencyTagLine_Board,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Markers,{id:o}),r?/*#__PURE__*/jsx_runtime_jsx(Spectrum_TouchBus,{id:o}):/*#__PURE__*/jsx_runtime_jsx(components_EventBus,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Limit,{id:o}),/*#__PURE__*/jsx_runtime_jsx(components_Cursor,{id:o,type:constants_ModuleType.Spectrum}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Signal,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_DragFrame,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_BandLayer,{}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Scope,{}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Stripe,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_FrequencyTagLine,{id:o}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_FrequencyAllocation,{}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_DeltaMeasurement,{})]})]})},modules_Spectrum=Spectrum_Spectrum,LevelStream_Chart_Chart=e=>{let{state:{cursor:t},dispatch:r}=useStore_useStore(),{publish:n}=e,{analyzer:a}=useLevelStreamAnalyzer();return publish_usePublish({publish:n,subscribe:e=>{let{pstype:t}=e;t===constants_PSType.Reset&&a?.reset(),t===constants_PSType.LevelStream&&a?.process(e.data,dateTimeToTimestamp(e.timestamp))}}),external_react_useEffect(()=>{t.mode!==constants_ModuleType.LevelStream&&r({payload:{cursor:{...t,mode:constants_ModuleType.LevelStream}}})},[t,r]),/*#__PURE__*/jsxs(components_Container,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Toolbar,{type:constants_ChartType.LevelStream}),/*#__PURE__*/jsx_runtime_jsx(components_FlexBox,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Spectrum,{children:/*#__PURE__*/jsx_runtime_jsx(components_PluginBox,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Level,{opacity:.5})})})})]})},LevelStream_Chart=LevelStream_Chart_Chart,LevelStreamChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,cursor:{show:!0},zoom:{show:!1},signal:{show:!1},children:/*#__PURE__*/jsx_runtime_jsx(LevelStream_Chart,{...e})}),LevelStream=withChartPublisher(LevelStreamChart,"LevelStream"),charts_LevelStream=LevelStream,Ticks_ticks=["100%","75%","50%","25%","0%"],components_Ticks_Ticks=e=>{let{inside:t=!1}=e;return /*#__PURE__*/jsx_runtime_jsx("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:Ticks_ticks.map(e=>/*#__PURE__*/jsx_runtime_jsx("div",{className:cn_cn("flex justify-start box-border",t?"pl-0.5 pr-0":"pr-0.5"),children:e},e))})},occupancy_components_Ticks=components_Ticks_Ticks,StandardOccupancyAxisYVariant=e=>{let{inside:t=!1}=e,{axisYWidth:r,marginLeft:n}=useAxisYWidth_useAxisYWidth();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"relative flex h-full w-auto",style:{width:r,marginLeft:n,justifyContent:t?"flex-start":"flex-end"},children:/*#__PURE__*/jsx_runtime_jsx(occupancy_components_Ticks,{inside:t})})},variants_standard=/*#__PURE__*/react.memo(StandardOccupancyAxisYVariant),AxisYOccupancy=e=>{let{disabled:t,inside:r}=e,{state:{axisY:n}}=useStore_useStore(),{show:a}=n;return!1===a||t?null:/*#__PURE__*/jsx_runtime_jsx(variants_standard,{inside:r})},occupancy=AxisYOccupancy,OccupancyDashed_Dashed=()=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-0 w-full flex-1 border-t [border-color:var(--chart-grid)] first:border-t-0"}),OccupancyDashed=()=>{let{state:{gridLines:e}}=useStore_useStore();return e&&/*#__PURE__*/jsxs("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__*/jsx_runtime_jsx(OccupancyDashed_Dashed,{}),/*#__PURE__*/jsx_runtime_jsx(OccupancyDashed_Dashed,{}),/*#__PURE__*/jsx_runtime_jsx(OccupancyDashed_Dashed,{}),/*#__PURE__*/jsx_runtime_jsx(OccupancyDashed_Dashed,{})]})},GridLines_OccupancyDashed=OccupancyDashed,TOTAL_LINE_HIDDEN_OFFSET=-200,getOccupancyTotalLineRuntimeId=e=>`occupancy-total-line-${e}`,applyOccupancyTotalLineValue=(e,t,r=0)=>{e&&t&&(e.style.bottom=`${r||TOTAL_LINE_HIDDEN_OFFSET}%`,t.textContent=String(r))},withOccupancyTotalLine=(e,t,r)=>subscription_createSubscriptionManager(getOccupancyTotalLineRuntimeId(e),t,r,e),publishOccupancyTotalLine=(e,t=0)=>{withOccupancyTotalLine(e)(t)},TotalLine=({id:e})=>{let t=external_react_useRef(null),r=external_react_useRef(null),n=external_react_useRef(`OccupancyTotalLine-${Math.random().toString(36).slice(2)}`);return external_react_useEffect(()=>(applyOccupancyTotalLineValue(t.current,r.current),withOccupancyTotalLine(e,n.current,e=>{applyOccupancyTotalLineValue(t.current,r.current,e)})),[e]),/*#__PURE__*/jsx_runtime_jsx("div",{className:"pointer-events-none absolute z-[4] h-full w-full",children:/*#__PURE__*/jsxs("div",{ref:t,className:"absolute left-0 w-full opacity-50",style:{bottom:"-200%"},children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute h-0 w-full border-b border-dashed border-foreground/80",style:{marginTop:"-0.5px"}}),/*#__PURE__*/jsx_runtime_jsx("div",{ref:r,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"})]})})},Occupancy_TotalLine=TotalLine,Occupancy_Occupancy=e=>{let{occupancyAxisYDisabled:t}=e,{id:r,chart:n,Chart:a}=hooks_useChart({Render:Occupancy});return(useModuleSubscription({moduleType:constants_ModuleType.Occupancy,chart:n,handleRender:(e,t)=>{let{data:n,totalOccupancy:a}=e;n&&t.updateSeries?.(n),void 0!==a&&publishOccupancyTotalLine(r,a)},eventHandlers:{[constants_PSType.Reset]:(e,t)=>{t.reset(),publishOccupancyTotalLine(r)}}}),useZoomEvent(r,constants_ModuleType.Occupancy),t)?/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full w-full",style:{...CHARTS_SCOPE_STYLE_VARS},[CHARTS_STYLE_SCOPE_ATTRIBUTE]:"true",children:/*#__PURE__*/jsxs("div",{className:"relative z-[0] h-full w-full",children:[/*#__PURE__*/jsx_runtime_jsx(a,{}),/*#__PURE__*/jsx_runtime_jsx(components_EventBus,{id:r}),/*#__PURE__*/jsx_runtime_jsx(Occupancy_TotalLine,{id:r})]})}):/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(occupancy,{disabled:t}),/*#__PURE__*/jsxs(components_PluginBox,{children:[/*#__PURE__*/jsx_runtime_jsx(GridLines_OccupancyDashed,{}),/*#__PURE__*/jsx_runtime_jsx(a,{}),/*#__PURE__*/jsx_runtime_jsx(components_EventBus,{id:r}),/*#__PURE__*/jsx_runtime_jsx(Occupancy_TotalLine,{id:r}),/*#__PURE__*/jsx_runtime_jsx(components_Cursor,{id:r,type:constants_ModuleType.Occupancy})]})]})},modules_Occupancy=Occupancy_Occupancy,Occupancy_Chart_Chart=e=>{let{publish:t}=e,{state:{globalID:r}}=useStore_useStore(),n=useSpectrumRule(constants_ChartType.Scan);return publish_usePublish({publish:t,subscribe:e=>{n(e),e.pstype===constants_PSType.Occupancy&&(e.data&&(withDatabase(r).getAllRawData=t=>({...getDefaultData().getAllRawData(t),occupancyData:e.data})),passThrough(r,constants_ModuleType.Occupancy)({...e,pstype:constants_PSType.Render}))}}),/*#__PURE__*/jsxs(components_Container,{children:[/*#__PURE__*/jsx_runtime_jsx(components_FlexBox,{children:/*#__PURE__*/jsx_runtime_jsx(modules_Occupancy,{})}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:constants_ChartType.Scan})]})},Occupancy_Chart=Occupancy_Chart_Chart,OccupancyChart=e=>/*#__PURE__*/jsx_runtime_jsx(src_store,{...e,zoom:{show:!1},children:/*#__PURE__*/jsx_runtime_jsx(Occupancy_Chart,{...e})}),charts_Occupancy_Occupancy=withChartPublisher(OccupancyChart,"Occupancy"),charts_Occupancy=charts_Occupancy_Occupancy,Zoom=()=>{let e=useStoreDispatch(),t=useStore_useSelector(e=>e.zoom),r=useStore_useSelector(e=>e.segments.totalPoints)??0,n=useStore_useSelector(e=>e.axisX.frequencyFormat),{interval:{start:a,end:i},onChange:o}=t,l=external_react_useMemo(()=>r&&n?[n((100*a+1)/r),n((100*i+1)/r)]:["",""],[a,i,r,n]);return external_react_useEffect(()=>{r&&void 0!==l[0]&&void 0!==l[1]&&o(l,{start:a,end:i})},[l,o,r]),external_react_useEffect(()=>{if(!r)return;let t=i-a+1,n=r/t,o=`-${a/t*100}%`,l=`${100*n}%`;e({payload:e=>({zoom:{...e.zoom,style:{left:o,width:l}}})})},[e,i,a,r]),null},components_Zoom=Zoom;class FluorescenceRender extends GradientRenderer{constructor(e){super({id:e.id,globalID:e.globalID,chart:null,renderMode:e.renderMode})}init(){let{id:e,renderMode:t}=this.state;e&&(this.state.chart=new Fluorescence({id:e,colors:this.getInitialColors(),ignoreValue:0,fluorescenceRenderMode:t}),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 Fluorescence_Fluorescence=()=>{let{state:{axisY:{range:e},fluorescence:{display:t,renderMode:r}}}=useStore_useStore(),{chart:n,Chart:a}=hooks_useChart({Render:FluorescenceRender,params:{renderMode:r}});external_react_useEffect(()=>{n?.updateProps({range:e})},[n,e]),external_react_useEffect(()=>{n&&n.setRenderMode(r)},[r]),useModuleSubscription({moduleType:constants_ModuleType.Fluorescence,chart:n,renderPSTypes:[constants_PSType.Fluorescence],extractData:e=>e.data});let i=external_react_useMemo(()=>({height:"100%",width:"100%",display:"flex",visibility:t?"visible":"hidden"}),[t]);return external_react_useEffect(()=>{n&&n.updateProps({display:t})},[n,t]),/*#__PURE__*/jsx_runtime_jsx("div",{style:i,children:/*#__PURE__*/jsx_runtime_jsx(components_FlexBox,{children:/*#__PURE__*/jsx_runtime_jsx(a,{})})})},modules_Fluorescence=Fluorescence_Fluorescence,HeatmapPortal_Chart=e=>{let{type:t,heatmapElementID:r}=e;return /*#__PURE__*/jsx_runtime_jsx(Overlay_Portal,{id:r,children:/*#__PURE__*/jsxs(components_Background,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Toolbar,{type:constants_ChartType.Heatmap}),/*#__PURE__*/jsx_runtime_jsx(modules_Heatmap,{zoomMode:"linked-x"}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:t})]})})},HeatmapPortal=HeatmapPortal_Chart,OccupancyPortal_Chart=e=>{let{occupancyElementID:t,occupancyAxisYElementID:r,type:n}=e;return /*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx(Overlay_Portal,{id:t,children:r?/*#__PURE__*/jsx_runtime_jsx(modules_Occupancy,{occupancyAxisYDisabled:!0}):/*#__PURE__*/jsxs(components_Background,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Toolbar,{type:constants_ChartType.Occupancy}),/*#__PURE__*/jsx_runtime_jsx(modules_Occupancy,{}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:n})]})}),/*#__PURE__*/jsx_runtime_jsx(Overlay_Portal,{id:r,children:/*#__PURE__*/jsx_runtime_jsx(occupancy,{inside:!0})})]})},OccupancyPortal=OccupancyPortal_Chart,BLAZE_PROGRESS=(e,t)=>subscription_createSubscriptionManager(`BLAZE_PROGRESS-${e}`,"0",t,e),Blaze=()=>{let{state:{blaze:{show:e},segments:t,globalID:r}}=useStore_useStore(),[n,a]=external_react_useState(""),i=external_react_useMemo(()=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];n.progress&&e.push(...n.progress)}return e},[t]);return(external_react_useEffect(()=>{e&&r&&BLAZE_PROGRESS(r,e=>{a(i.includes(e)?void 0:`${100*e}%`)})},[e,r]),e)?/*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{children:/*#__PURE__*/jsxs("div",{className:"absolute left-[-100%] top-0 flex h-full w-0 opacity-50",style:{left:n},children:[/*#__PURE__*/jsx_runtime_jsx("div",{className:"ml-[-0.5px] opacity-50",style:{borderRight:"0.5px solid var(--chart-grid-strong)"}}),/*#__PURE__*/jsx_runtime_jsx("div",{className:"ml-[-31px] w-[30px] opacity-20",style:{background:"linear-gradient(90deg, transparent, var(--chart-grid-strong))"}})]})}):null},Spectrum_Blaze=/*#__PURE__*/react.memo(Blaze),Legend=()=>{let{state:{legend:{children:e}}}=useStore_useStore();return /*#__PURE__*/jsx_runtime_jsx("div",{className:"absolute left-5 top-5 z-[6] flex h-auto w-auto items-center",children:e})},Spectrum_Legend=Legend,SegmentsZebra=()=>{let{state:{segments:e}}=useStore_useStore(),t=e.totalPoints??0;return /*#__PURE__*/jsx_runtime_jsx(Zoom_ZoomViewportLayer,{className:"z-[0]",children:e.map((e,r)=>/*#__PURE__*/jsx_runtime_jsx("div",{className:"h-full border-x",style:{width:t>0?`${100*e.point/t}%`:0,borderColor:r%2==1?"var(--chart-grid)":"transparent",background:r%2==1?"var(--chart-surface)":"transparent",opacity:r%2==1?.4:1}},`${e.start}_${e.stop}_${e.index}`))})},Spectrum_SegmentsZebra=SegmentsZebra,useMarkerPublish=({globalID:e})=>({handleMarkerPublish:external_react_useCallback(t=>{if(e)switch(t.pstype){case constants_PSType.Marker:MARKER_UPDATE_ATTRIBUTE(e)(t);break;case constants_PSType.Reset:MARKER_UPDATE_ATTRIBUTE(e)({type:constants_MarkerEventType.Clear})}},[e])}),Spectrum_useMarkerPublish=useMarkerPublish;function resolveThresholdDataOptions({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 setAnalyzerThresholdData(e,t){"thresholdData"in t&&e.setThresholdData(t.thresholdData,resolveThresholdDataOptions(t))}function useTemplateComparison(){let{state:{globalID:e,axisX:{frequencyFormat:t},signal:{onChange:r}}}=useStore_useStore(),n=external_react_useRef(t),a=external_react_useRef(r);external_react_useEffect(()=>{n.current=t,a.current=r},[e,t,r]);let i=external_react_useCallback(e=>{if(!e||0===e.length)return[];let t=[],r=Date.now();return e.forEach(a=>{let i=n.current,{startIndex:o,endIndex:l}=a,s=e.length,c=i((o+.5)*100/s),u=i((l+.5)*100/s),d=i((o+l)/2*100/s);c!==u&&t.push({...a,frequency:d,bandwidth:(u-c)*1e3,timestamp:r})}),t},[]);return{updateTemplateOverData:external_react_useCallback(e=>{if(e){let t=i(e);a.current(t)}},[i])}}function useSpectrumAnalyzer(e){let{state:{globalID:t,series:{enableMetrics:r,enableWaterfall:n},fluorescence:{show:a},axisY:{unit:i},zoom:{interval:o},heatmapCapture:{display:l},system:{width:s},marker:c}}=useStore_useStore(),u=external_react_useRef(null),d=external_react_useRef(t),h=external_react_useRef(o),p=external_react_useRef(0),f=external_react_useRef(null),{updateSignalData:m}=useSignalDataManager(),g=external_react_useRef(l);external_react_useEffect(()=>{g.current=l},[l]);let b=external_react_useCallback(e=>{passThrough(d.current,constants_ModuleType.Spectrum)({pstype:constants_PSType.Render,data:e})},[]),v=external_react_useCallback(e=>{passThrough(d.current,constants_ModuleType.Heatmap)({pstype:constants_PSType.Render,data:e})},[]),w=external_react_useCallback(e=>{BLAZE_PROGRESS(d.current)?.(e)},[]),{updateTemplateOverData:y}=useTemplateComparison(),x=external_react_useCallback(e=>{(e.realData||e.templateData||e.backgroundNoiseData||"thresholdData"in e)&&b({minData:e.minData,maxData:e.maxData,avgData:e.avgData,thresholdData:e.thresholdData,backgroundNoiseData:e.backgroundNoiseData,realData:e.realData,templateData:e.templateData}),e.scanProgress&&w(e.scanProgress),e.templateOverData&&y(e.templateOverData),e.waterfallData&&v(e.waterfallData),e.fluorescenceData&&passThrough(d.current,constants_ModuleType.Fluorescence)({pstype:constants_PSType.Fluorescence,data:{fluorescenceData:e.fluorescenceData,fluorescenceMaxCount:e.fluorescenceMaxCount}}),e.occupancyData&&passThrough(d.current,constants_ModuleType.Occupancy)({pstype:constants_PSType.Render,data:e.occupancyData,totalOccupancy:p.current}),e.extraData&&passThrough(d.current,constants_ModuleType.Spectrum)({pstype:constants_PSType.Render,extraData:e.extraData})},[b,v,w,y]);external_react_useEffect(()=>{d.current=t},[t]);let k=(e,t)=>!1!==e&&(t??!0);if(!u.current&&t){let i=Math.min(1|Math.floor(2*s),1001);u.current=new SpectrumAnalyzer({...e,outputPoints:i,processing:{...e?.processing,enableMetrics:k(r,e?.processing?.enableMetrics),enableWaterfall:k(n,e?.processing?.enableWaterfall),enableFluorescence:a,enablePeakStats:!!c?.enabled},onSpectrumUpdate:x});let o=withDatabase(t),l=u.current;o.getAllRawData=e=>l.getAllRawData(e),withSpectrumAnalyzerSYNC(t,u.current)}external_react_useEffect(()=>{let e=Math.floor(o.start),t=Math.ceil(o.end),r=Math.floor(h.current.start),n=Math.ceil(h.current.end);(e!==r||t!==n)&&u.current&&(h.current=o,u.current.updateSamplingRange(e,t+1))},[o]);let S=external_react_useCallback(async(e=!1)=>{setTimeout(()=>{passThrough(d.current,constants_ModuleType.Heatmap)({pstype:constants_PSType.Reset}),passThrough(d.current,constants_ModuleType.Spectrum)({pstype:constants_PSType.Reset}),passThrough(d.current,constants_ModuleType.Occupancy)({pstype:constants_PSType.Reset}),e&&resetSeries(d.current)},1)},[]),D=external_react_useCallback(async e=>{if(u.current)switch(e.pstype){case constants_PSType.AntennaFactor:u.current.setAntennaFactor(e.data);break;case constants_PSType.Signal:m({type:e.type,data:e.data});break;case constants_PSType.Spectrum:e.data&&u.current.process(e),setAnalyzerThresholdData(u.current,e),e.maxData&&u.current.setMaxData(e.maxData),e.minData&&u.current.setMinData(e.minData),e.avgData&&u.current.setAvgData(e.avgData),e.templateData&&u.current.setTemplateData(e.templateData,e.templateTolerance),e.backgroundNoiseData&&u.current.setBackgroundNoiseData(e.backgroundNoiseData),e.extraData&&u.current.setExtraData(e.extraData,types_ExtraDataMode.MERGE,e.segmentedExtraData?{segmentOffset:e.segmentOffset,offset:e.offset}:void 0);break;case constants_PSType.Fluorescence:e.data&&u.current&&u.current.setFluorescenceData(e.data.fluorescenceData,e.data.fluorescenceMaxCount);break;case constants_PSType.Heatmap:if(e.data){let{data:t,timestamps:r}=e,n=convertToTimestampedArrays(t,r);u.current.setWaterfallData(n)}break;case constants_PSType.Occupancy:u.current?.setOccupancyData(e.data),p.current=e.totalOccupancy;break;case constants_PSType.Segments:u.current.initializeSegments(e.data),await S(),e.onFinally?.();break;case constants_PSType.SpectrumBandwidth:u.current.reset();break;case constants_PSType.Series:updateSeries(d.current,e);break;case constants_PSType.Reset:u.current.reset(),await S(!0),e.onFinally?.();break;case constants_PSType.Clear:u.current.reset(),await S(!1),e.onFinally?.()}},[m,updateSeries,S]);return external_react_useEffect(()=>{let e=i.includes("/m");u.current?.setAntennaFactorSwitch(e)},[i]),external_react_useEffect(()=>{if(!u.current)return;let t=k(r,e?.processing?.enableMetrics);t!==f.current&&(u.current.updateProcessing({enableMetrics:t}),f.current=t)},[r,e?.processing?.enableMetrics]),D}let Spectrum_Chart_Chart=e=>{let{state:{globalID:t}}=useStore_useStore(),r=external_react_useRef([]),n=external_react_useRef(""),{type:a=constants_ChartType.SingleFrequency,publish:i,heatmapElementID:o,occupancyElementID:l,occupancyAxisYElementID:s,touch:c,children:u,processing:d}=e,{enableMetrics:h,enableWaterfall:p}=useSpectrumChartType({type:a,heatmapElementID:o}),f=useSpectrumAnalyzer({processing:{enableWaterfall:p,enableMetrics:h,...d}}),m=useSpectrumRule(a);useTouchMode(c);let{handleMarkerPublish:g}=Spectrum_useMarkerPublish({globalID:t});return publish_usePublish({publish:i,subscribe:e=>{if(f(e),g(e),m(e),e.pstype===constants_PSType.Heatmap){let{data:a,timestamps:i}=e;if(r.current=convertToTimestampedArrays(a,i),n.current!==t){let e=withDatabase(t),a=e.getAllRawData;e.getAllRawData=e=>({...a(e),waterfallData:r.current}),n.current=t}}passThrough(t,constants_ModuleType.Spectrum)(e),passThrough(t,constants_ModuleType.Heatmap)(e),passThrough(t,constants_ModuleType.Occupancy)(e),passThrough(t,constants_ModuleType.Fluorescence)(e)}}),/*#__PURE__*/jsxs(components_Container,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Toolbar,{type:a}),/*#__PURE__*/jsxs(components_FlexBox,{children:[/*#__PURE__*/jsx_runtime_jsx(modules_Spectrum,{touch:c,children:u||/*#__PURE__*/jsx_runtime_jsx(modules_Fluorescence,{})}),/*#__PURE__*/jsx_runtime_jsx(HeatmapPortal,{type:a,heatmapElementID:o}),/*#__PURE__*/jsx_runtime_jsx(OccupancyPortal,{type:a,occupancyElementID:l,occupancyAxisYElementID:s}),/*#__PURE__*/jsxs(components_PluginBox,{children:[/*#__PURE__*/jsx_runtime_jsx(components_Zoom,{}),a===constants_ChartType.Scan&&/*#__PURE__*/jsxs(Fragment,{children:[/*#__PURE__*/jsx_runtime_jsx(Spectrum_SegmentsZebra,{}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Blaze,{})]}),/*#__PURE__*/jsx_runtime_jsx(Spectrum_Legend,{})]})]}),/*#__PURE__*/jsx_runtime_jsx(components_AxisX,{type:a})]})},Spectrum_Chart=Spectrum_Chart_Chart,heatmapCaptureDefaults_DEFAULT_SPECTRUM_TYPE="singleFrequency",DEFAULT_HEATMAP_CAPTURE_TYPE="slider",withSpectrumHeatmapCaptureDefaults=e=>{let t=e.type??heatmapCaptureDefaults_DEFAULT_SPECTRUM_TYPE;return e.heatmapElementID&&(t===heatmapCaptureDefaults_DEFAULT_SPECTRUM_TYPE||"scan"===t||"mscan"===t)?{...e,heatmapCapture:{show:!0,display:!1,type:DEFAULT_HEATMAP_CAPTURE_TYPE,toolbarVariant:"deltaMeasurement",...e.heatmapCapture}}:e},SpectrumChart=e=>{let t=withSpectrumHeatmapCaptureDefaults(e);return /*#__PURE__*/jsx_runtime_jsx(src_store,{...t,children:/*#__PURE__*/jsx_runtime_jsx(Spectrum_Chart,{...t})})},charts_Spectrum_Spectrum=withChartPublisher(SpectrumChart,"Spectrum"),charts_Spectrum=charts_Spectrum_Spectrum;function initChartsTheme(e={}){let{onChange:t,sizes:r,tokens:n}=e;initializeChartsThemeEnvironment({sizes:r,tokens:n});let a=getChartsThemeState();return{cleanup:t?subscribeChartsThemeChange(e=>t(e)):void 0,...a}}var signal_SignalDataType=/*#__PURE__*/function(e){return e.Station="station",e.Simple="simple",e}({});initializeChartsThemeEnvironment();export{charts_Dial as Dial,charts_Gauge as Gauge,charts_Heatmap as Heatmap,charts_IQ as IQ,charts_LevelStream as LevelStream,charts_Occupancy as Occupancy,charts_Spectrum as Spectrum,constants_AxisPlacement as AxisPlacement,constants_ChartType as ChartType,constants_FrequencyUnit as FrequencyUnit,constants_MarkerEventType as MarkerEventType,constants_ModuleType as ModuleType,constants_OptionKey as OptionKey,constants_PSType as PSType,constants_SegmentsEvent as SegmentsEvent,constants_SeriesType as SeriesType,constants_ToolType as ToolType,constants_ToolbarItemType as ToolbarItemType,formatFrequencyUnit,formatFrequencyUnitFromHz,formatFrequencyUnitFromMHz,getChartsThemeState,heatmap_HeatmapCaptureType as HeatmapCaptureType,initChartsTheme,marker_MarkerMode as MarkerMode,setFrequencyAllocationChannelsToCache,setFrequencyAllocationToCache,signal_SignalDataType as SignalDataType,subscribeChartsThemeChange,useSafePublish,withChartPublisher};