semiotic 3.8.1 → 3.8.3
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/CLAUDE.md +3 -1
- package/README.md +54 -52
- package/ai/behaviorContracts.cjs +9 -0
- package/ai/dist/mcp-server.js +142 -13
- package/ai/schema.json +616 -42
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +5 -2
- package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
- package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
- package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
- package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
- package/dist/chunk-chunk-2CCFBTQC.module.min.js +2 -0
- package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
- package/dist/chunk-chunk-2RXP3FS3.module.min.js +1 -0
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
- package/dist/chunk-chunk-4TMZXLCR.module.min.js +1 -0
- package/dist/chunk-chunk-5APBQXZA.module.min.js +1 -0
- package/dist/chunk-chunk-5RKXZQ2P.module.min.js +1 -0
- package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
- package/dist/chunk-chunk-6HSGDMTA.module.min.js +2 -0
- package/dist/chunk-chunk-7FW6EGLP.module.min.js +2 -0
- package/dist/chunk-chunk-7OEOSCBP.module.min.js +1 -0
- package/dist/chunk-chunk-A63CTACR.module.min.js +2 -0
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +1 -0
- package/dist/chunk-chunk-AZJUDQRM.module.min.js +2 -0
- package/dist/chunk-chunk-B6V35LMY.module.min.js +2 -0
- package/dist/chunk-chunk-BOSVL645.module.min.js +2 -0
- package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
- package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
- package/dist/chunk-chunk-EMO5NUGE.module.min.js +2 -0
- package/dist/chunk-chunk-F25UA5HT.module.min.js +1 -0
- package/dist/chunk-chunk-FRIO6MCV.module.min.js +1 -0
- package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
- package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
- package/dist/chunk-chunk-GWSWSPXN.module.min.js +1 -0
- package/dist/chunk-chunk-I6C3KR5H.module.min.js +2 -0
- package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
- package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
- package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
- package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
- package/dist/chunk-chunk-J5RL6GXU.module.min.js +2 -0
- package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
- package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
- package/dist/chunk-chunk-JNCHKRIR.module.min.js +2 -0
- package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
- package/dist/chunk-chunk-L3H6DQCR.module.min.js +2 -0
- package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
- package/dist/chunk-chunk-M7VYYHCE.module.min.js +2 -0
- package/dist/chunk-chunk-MC35ILYP.module.min.js +2 -0
- package/dist/chunk-chunk-N72SWNBV.module.min.js +1 -0
- package/dist/chunk-chunk-OBQRFTIL.module.min.js +2 -0
- package/dist/chunk-chunk-OQTLSTGI.module.min.js +2 -0
- package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
- package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
- package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
- package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
- package/dist/chunk-chunk-SA3D43RA.module.min.js +2 -0
- package/dist/chunk-chunk-SANERMIZ.module.min.js +2 -0
- package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
- package/dist/chunk-chunk-UHSZEB74.module.min.js +1 -0
- package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
- package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
- package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
- package/dist/chunk-chunk-XQYVEKEJ.module.min.js +2 -0
- package/dist/chunk-chunk-Y6AXCRVO.module.min.js +1 -0
- package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
- package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
- package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -6
- package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +11 -0
- package/dist/components/charts/shared/areaSeriesData.d.ts +15 -0
- package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
- package/dist/components/charts/shared/chartMode.d.ts +67 -0
- package/dist/components/charts/shared/colorUtils.d.ts +8 -0
- package/dist/components/charts/shared/geoStyleDefaults.d.ts +3 -0
- package/dist/components/charts/shared/hooks.d.ts +13 -80
- package/dist/components/charts/shared/useChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useXYLineStyle.d.ts +3 -2
- package/dist/components/charts/shared/xyLineStyle.d.ts +21 -0
- package/dist/components/charts/xy/LineChart.d.ts +3 -0
- package/dist/components/legendLayout.d.ts +31 -0
- package/dist/components/server/serverChartConfigShared.d.ts +29 -0
- package/dist/components/server/serverChartConfigs.d.ts +2 -13
- package/dist/components/server/serverChartConfigsXY.d.ts +3 -0
- package/dist/components/server/serverGaugeOverlay.d.ts +28 -0
- package/dist/components/server/staticLegend.d.ts +7 -1
- package/dist/components/server/staticSVGChrome.d.ts +60 -2
- package/dist/components/stream/GeoPipelineStore.d.ts +2 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +2 -0
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
- package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
- package/dist/components/stream/SceneToSVG.d.ts +8 -6
- package/dist/components/stream/SceneToSVGGeo.d.ts +10 -0
- package/dist/components/stream/SceneToSVGNetwork.d.ts +12 -0
- package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
- package/dist/components/stream/canvasBackground.d.ts +7 -0
- package/dist/components/stream/networkTypes.d.ts +2 -4
- package/dist/components/stream/renderBackend.d.ts +14 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +51 -0
- package/dist/components/types/legendTypes.d.ts +16 -3
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +1 -1
- package/dist/physics-rapier.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-realtime-react.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-recipes-react.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.min.js +1 -1
- package/dist/semiotic-utils-react.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +4 -4
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
- package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semiotic",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.3",
|
|
4
4
|
"mcpName": "io.github.nteract/semiotic",
|
|
5
5
|
"description": "Verified generative visualization for React and agents, with deterministic chart validation, repair, rendering evidence, and MCP.",
|
|
6
6
|
"main": "dist/semiotic.min.js",
|
|
@@ -197,8 +197,6 @@
|
|
|
197
197
|
},
|
|
198
198
|
"files": [
|
|
199
199
|
"dist/*.min.js",
|
|
200
|
-
"dist/*-semiotic-*.js",
|
|
201
|
-
"dist/*-statisticalOverlays-*.js",
|
|
202
200
|
"dist/**/*.d.ts",
|
|
203
201
|
"dist/forceLayoutWorker.js",
|
|
204
202
|
"dist/physicsWorker.js",
|
|
@@ -282,7 +280,8 @@
|
|
|
282
280
|
"typescript:tests": "node scripts/check-test-types.mjs",
|
|
283
281
|
"typescript:tests:raw": "tsc -p tsconfig.tests.json --noEmit --pretty false",
|
|
284
282
|
"typescript:mcp": "tsc -p tsconfig.mcp.json --noEmit",
|
|
285
|
-
"size": "size-limit",
|
|
283
|
+
"size": "size-limit && node scripts/check-multi-import-size.mjs",
|
|
284
|
+
"check:multi-import-size": "node scripts/check-multi-import-size.mjs",
|
|
286
285
|
"check:pack": "node scripts/smoke-pack.mjs",
|
|
287
286
|
"check:api-surface": "node scripts/check-api-surface.mjs",
|
|
288
287
|
"docs:api-surface": "node scripts/generate-api-surface.mjs",
|
|
@@ -310,6 +309,7 @@
|
|
|
310
309
|
"check:cloud-run-manifest": "node scripts/check-cloud-run-manifest.mjs",
|
|
311
310
|
"check:cloud-run-nightly": "node scripts/check-cloud-run-nightly.mjs",
|
|
312
311
|
"check:cloud-run-lock": "node scripts/check-cloud-run-manifest.mjs --require-lockfile",
|
|
312
|
+
"check:cloud-run-release": "node scripts/check-cloud-run-manifest.mjs --require-lockfile --require-root-version",
|
|
313
313
|
"check:ai-schema": "node scripts/check-ai-schema-valid.mjs",
|
|
314
314
|
"docs:chart-specs:schema": "npx tsx scripts/regenerate-schema.ts",
|
|
315
315
|
"check:test-quality": "node scripts/check-test-quality-gate.mjs",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{getMax as t,getMinMax as n}from"./semiotic-ai-chunk-OG7BQUUW.module.min.js";function o(t,n=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!o)return t;const e=Math.round(parseInt(o[1],16)*(1-n)),r=Math.round(parseInt(o[2],16)*(1-n)),a=Math.round(parseInt(o[3],16)*(1-n));return`#${e.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}function e(t,n=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!o)return t;const e=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*n),r=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*n),a=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*n);return`#${e.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}var r="__forecastSegment",a="__forecastOpacity";function s(t,o,e,r){const s=o.uncertaintyOpacity,i=o.confidenceAccessor;if(!s&&!i)return;const l="object"==typeof s?s:{},c=l.min??.15,f=l.max??1;if(i){const n="function"==typeof i?i:t=>t[i];for(const o of t){const t=n(o);null!=t&&Number.isFinite(t)&&(o[a]=c+Math.max(0,Math.min(1,t))*(f-c))}return}const p=t.map(t=>{const n=e(t),o=r(t);return null!=n&&null!=o&&Number.isFinite(n)&&Number.isFinite(o)?Math.abs(n-o):NaN}),u=p.filter(t=>Number.isFinite(t));if(0===u.length)return;const[h,y]=n(u),d=y-h;t.forEach((t,n)=>{const o=p[n];Number.isFinite(o)&&(t[a]=f-(d>0?(o-h)/d:0)*(f-c))})}function i(t,n){return"function"==typeof n?n(t):!!t[n]}function l(t){return[{type:"anomaly-band",threshold:t.threshold??2,showBand:!1!==t.showBand,fill:t.bandColor||"#6366f1",fillOpacity:t.bandOpacity??.1,anomalyColor:t.anomalyColor||"#ef4444",anomalyRadius:t.anomalyRadius??6,label:t.label}]}function c(n,o,e,a,l){return(c=a).isTraining||c.isForecast||c.isAnomaly||c.upperBounds||c.lowerBounds?function(t,n,o,e,a){const{isTraining:l,isForecast:c,isAnomaly:f,upperBounds:p,lowerBounds:u,color:h="#6366f1",bandOpacity:y=.15,anomalyColor:d="#ef4444",anomalyRadius:m=6,label:b}=e,g=t.map(t=>{let n="observed";return c&&i(t,c)?n="forecast":l&&i(t,l)&&(n="training"),{...t,[r]:n}}),_=e._groupBy,k=[];if(_){const t=new Map;for(const n of g){const o=n[_]??"__default";t.has(o)||t.set(o,[]),t.get(o).push(n)}const n=[];for(const[,o]of t)for(let t=0;o.length-1>t;t++)o[t][r]!==o[t+1][r]&&(n.push({...o[t+1],[r]:o[t][r]}),n.push({...o[t],[r]:o[t+1][r]}));k.push(...g,...n)}else for(let t=0;g.length>t;t++)k.push(g[t]),g.length-1>t&&g[t][r]!==g[t+1][r]&&(k.push({...g[t+1],[r]:g[t][r]}),k.push({...g[t],[r]:g[t+1][r]}));if(e.trainUnderline){const t=[];for(const n of k)"training"===n[r]&&t.push({...n,[r]:"training-base"});k.unshift(...t)}const O=[];if(p&&u){const t="string"==typeof p?p:"__envUpper",n="string"==typeof u?u:"__envLower";if("function"==typeof p||"function"==typeof u)for(const o of k)"function"==typeof p&&(o[t]=p(o)),"function"==typeof u&&(o[n]=u(o));O.push({type:"envelope",upperAccessor:t,lowerAccessor:n,fill:h,fillOpacity:y,label:b})}if(e.uncertaintyOpacity||e.confidenceAccessor){const t=p?"function"==typeof p?p:t=>t[p]:()=>{},n=u?"function"==typeof u?u:t=>t[u]:()=>{};s(k.filter(t=>"forecast"===t[r]),e,t,n)}if(f){const t=e.anomalyStyle,n={type:"highlight",filter:t=>i(t,f)};t?(n.style=t,n.r=m):"function"==typeof d?(n.style=t=>{const n=d(t);return{stroke:n,strokeWidth:1.5,fill:n,fillOpacity:.7}},n.r=m):(n.color=d,n.r=m,n.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),O.push(n)}return a&&O.push({type:"anomaly-band",threshold:a.threshold??2,showBand:!1!==a.showBand,fill:a.bandColor||"#6366f1",fillOpacity:a.bandOpacity??.1,anomalyColor:a.anomalyColor||"#ef4444",anomalyRadius:a.anomalyRadius??6,label:a.label}),{processedData:k,annotations:O}}(n,0,0,a,l):function(n,o,e,a,i){const{trainEnd:l,steps:c=10,confidence:f=.95,color:p="#6366f1",bandOpacity:u=.15,label:h}=a;if(null==l)return{processedData:n,annotations:[]};const y=[],d=[];for(const t of n)t[o]>l?d.push({...t,[r]:"observed"}):y.push({...t,[r]:"training"});const m=y.map(t=>[t[o],t[e]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,n)=>t[0]-n[0]),b=[],g=[];if(m.length>=3){const i=m.length;let l=0,y=0,d=0,_=0;for(const[t,n]of m)l+=t,y+=n,d+=t*t,_+=t*n;const k=i*d-l*l;if(Math.abs(k)>1e-12){const d=(i*_-l*y)/k,O=(y-d*l)/i,w=t=>O+d*t,S=m.map(([t,n])=>n-w(t)).reduce((t,n)=>t+n*n,0),M=Math.sqrt(S/Math.max(i-2,1)),B=m.reduce((t,n)=>t+n[0],0)/i,F=m.reduce((t,n)=>t+(n[0]-B)**2,0),v=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,C=n.map(t=>t[o]).filter(t=>null!=t&&isFinite(t)),D=t(C),I=m.length>1?(m[i-1][0]-m[0][0])/(i-1):1;for(let t=1;c>=t;t++){const n=D+t*I,a=w(n),s=M*Math.sqrt(1+1/i+(F>0?(n-B)**2/F:0))*v;g.push({[o]:n,[e]:a,[r]:"forecast",__forecastUpper:a+s,__forecastLower:a-s})}s(g,a,t=>t.__forecastUpper,t=>t.__forecastLower),b.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:p,fillOpacity:u,label:h})}}b.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&b.push({type:"anomaly-band",threshold:i.threshold??2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:i.bandOpacity??.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:i.anomalyRadius??6,label:i.label});const _=[];if(_.push(...y),y.length>0&&d.length>0&&_.push({...y[y.length-1],[r]:"observed"}),_.push(...d),g.length>0){const t=d.length>0?d[d.length-1]:y[y.length-1];t&&_.push({...t,[r]:"forecast"}),_.push(...g)}return{processedData:_,annotations:b}}(n,o,e,a,l);var c}function f(t,n){const s=n.trainDasharray??"8,4",i=n.forecastDasharray??"4,4",l=n.color||"#6366f1",c=n.trainOpacity,f=n.forecastOpacity,p=n.trainStroke,u=n.trainLinecap,h=n.trainUnderline;return n=>{const y=t(n),d=n[r];if("training"===d){let t=y.stroke;return"darken"===p?t=o(y.stroke||"#666",.5):p&&(t=p),{...y,stroke:t,strokeDasharray:s,...u&&{strokeLinecap:u},...null!=c&&{strokeOpacity:c}}}if("training-base"===d){let t=y.stroke||"#666";return"lighten"===h&&(t=e(t,.4)),{...y,stroke:t,strokeDasharray:void 0}}if("forecast"===d){const t=n[a],o=null!=t?t:f;return{...y,stroke:l,strokeDasharray:i,...null!=o&&{strokeOpacity:o}}}return y}}export{a as FORECAST_OPACITY_FIELD,r as SEGMENT_FIELD,l as buildAnomalyAnnotations,c as buildForecast,f as createSegmentLineStyle,o as darkenColor,e as lightenColor,s as stampForecastOpacity};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
function t(t){let n=1/0,r=-1/0;for(const a of t)n>a&&(n=a),a>r&&(r=a);return[n,r]}function n(t,n=1/0){let r=n;for(const n of t)r>n&&(r=n);return r}function r(t,n=-1/0){let r=n;for(const n of t)n>r&&(r=n);return r}function a(t,n=.5){const r=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!r)return t;const a=Math.round(parseInt(r[1],16)*(1-n)),o=Math.round(parseInt(r[2],16)*(1-n)),e=Math.round(parseInt(r[3],16)*(1-n));return`#${a.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}`}function o(t,n=.5){const r=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!r)return t;const a=Math.round(parseInt(r[1],16)+(255-parseInt(r[1],16))*n),o=Math.round(parseInt(r[2],16)+(255-parseInt(r[2],16))*n),e=Math.round(parseInt(r[3],16)+(255-parseInt(r[3],16))*n);return`#${a.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}`}export{t as getMinMax,n as getMin,r as getMax,a as darkenColor,o as lightenColor};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{darkenColor as t,getMax as o,getMinMax as n,lightenColor as e}from"./semiotic-chunk-3FSVZ46U.module.min.js";var r="__forecastSegment",a="__forecastOpacity";function s(t,o,e,r){const s=o.uncertaintyOpacity,i=o.confidenceAccessor;if(!s&&!i)return;const l="object"==typeof s?s:{},c=l.min??.15,f=l.max??1;if(i){const o="function"==typeof i?i:t=>t[i];for(const n of t){const t=o(n);null!=t&&Number.isFinite(t)&&(n[a]=c+Math.max(0,Math.min(1,t))*(f-c))}return}const u=t.map(t=>{const o=e(t),n=r(t);return null!=o&&null!=n&&Number.isFinite(o)&&Number.isFinite(n)?Math.abs(o-n):NaN}),p=u.filter(t=>Number.isFinite(t));if(0===p.length)return;const[h,y]=n(p),d=y-h;t.forEach((t,o)=>{const n=u[o];Number.isFinite(n)&&(t[a]=f-(d>0?(n-h)/d:0)*(f-c))})}function i(t,o){return"function"==typeof o?o(t):!!t[o]}function l(t){return[{type:"anomaly-band",threshold:t.threshold??2,showBand:!1!==t.showBand,fill:t.bandColor||"#6366f1",fillOpacity:t.bandOpacity??.1,anomalyColor:t.anomalyColor||"#ef4444",anomalyRadius:t.anomalyRadius??6,label:t.label}]}function c(t,n,e,a,l){return(c=a).isTraining||c.isForecast||c.isAnomaly||c.upperBounds||c.lowerBounds?function(t,o,n,e,a){const{isTraining:l,isForecast:c,isAnomaly:f,upperBounds:u,lowerBounds:p,color:h="#6366f1",bandOpacity:y=.15,anomalyColor:d="#ef4444",anomalyRadius:m=6,label:b}=e,g=t.map(t=>{let o="observed";return c&&i(t,c)?o="forecast":l&&i(t,l)&&(o="training"),{...t,[r]:o}}),_=e._groupBy,k=[];if(_){const t=new Map;for(const o of g){const n=o[_]??"__default";t.has(n)||t.set(n,[]),t.get(n).push(o)}const o=[];for(const[,n]of t)for(let t=0;n.length-1>t;t++)n[t][r]!==n[t+1][r]&&(o.push({...n[t+1],[r]:n[t][r]}),o.push({...n[t],[r]:n[t+1][r]}));k.push(...g,...o)}else for(let t=0;g.length>t;t++)k.push(g[t]),g.length-1>t&&g[t][r]!==g[t+1][r]&&(k.push({...g[t+1],[r]:g[t][r]}),k.push({...g[t],[r]:g[t+1][r]}));if(e.trainUnderline){const t=[];for(const o of k)"training"===o[r]&&t.push({...o,[r]:"training-base"});k.unshift(...t)}const O=[];if(u&&p){const t="string"==typeof u?u:"__envUpper",o="string"==typeof p?p:"__envLower";if("function"==typeof u||"function"==typeof p)for(const n of k)"function"==typeof u&&(n[t]=u(n)),"function"==typeof p&&(n[o]=p(n));O.push({type:"envelope",upperAccessor:t,lowerAccessor:o,fill:h,fillOpacity:y,label:b})}if(e.uncertaintyOpacity||e.confidenceAccessor){const t=u?"function"==typeof u?u:t=>t[u]:()=>{},o=p?"function"==typeof p?p:t=>t[p]:()=>{};s(k.filter(t=>"forecast"===t[r]),e,t,o)}if(f){const t=e.anomalyStyle,o={type:"highlight",filter:t=>i(t,f)};t?(o.style=t,o.r=m):"function"==typeof d?(o.style=t=>{const o=d(t);return{stroke:o,strokeWidth:1.5,fill:o,fillOpacity:.7}},o.r=m):(o.color=d,o.r=m,o.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),O.push(o)}return a&&O.push({type:"anomaly-band",threshold:a.threshold??2,showBand:!1!==a.showBand,fill:a.bandColor||"#6366f1",fillOpacity:a.bandOpacity??.1,anomalyColor:a.anomalyColor||"#ef4444",anomalyRadius:a.anomalyRadius??6,label:a.label}),{processedData:k,annotations:O}}(t,0,0,a,l):function(t,n,e,a,i){const{trainEnd:l,steps:c=10,confidence:f=.95,color:u="#6366f1",bandOpacity:p=.15,label:h}=a;if(null==l)return{processedData:t,annotations:[]};const y=[],d=[];for(const o of t)o[n]>l?d.push({...o,[r]:"observed"}):y.push({...o,[r]:"training"});const m=y.map(t=>[t[n],t[e]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,o)=>t[0]-o[0]),b=[],g=[];if(m.length>=3){const i=m.length;let l=0,y=0,d=0,_=0;for(const[t,o]of m)l+=t,y+=o,d+=t*t,_+=t*o;const k=i*d-l*l;if(Math.abs(k)>1e-12){const d=(i*_-l*y)/k,O=(y-d*l)/i,w=t=>O+d*t,F=m.map(([t,o])=>o-w(t)).reduce((t,o)=>t+o*o,0),B=Math.sqrt(F/Math.max(i-2,1)),v=m.reduce((t,o)=>t+o[0],0)/i,C=m.reduce((t,o)=>t+(o[0]-v)**2,0),D=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,A=t.map(t=>t[n]).filter(t=>null!=t&&isFinite(t)),M=o(A),N=m.length>1?(m[i-1][0]-m[0][0])/(i-1):1;for(let t=1;c>=t;t++){const o=M+t*N,a=w(o),s=B*Math.sqrt(1+1/i+(C>0?(o-v)**2/C:0))*D;g.push({[n]:o,[e]:a,[r]:"forecast",__forecastUpper:a+s,__forecastLower:a-s})}s(g,a,t=>t.__forecastUpper,t=>t.__forecastLower),b.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:u,fillOpacity:p,label:h})}}b.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&b.push({type:"anomaly-band",threshold:i.threshold??2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:i.bandOpacity??.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:i.anomalyRadius??6,label:i.label});const _=[];if(_.push(...y),y.length>0&&d.length>0&&_.push({...y[y.length-1],[r]:"observed"}),_.push(...d),g.length>0){const t=d.length>0?d[d.length-1]:y[y.length-1];t&&_.push({...t,[r]:"forecast"}),_.push(...g)}return{processedData:_,annotations:b}}(t,n,e,a,l);var c}function f(o,n){const s=n.trainDasharray??"8,4",i=n.forecastDasharray??"4,4",l=n.color||"#6366f1",c=n.trainOpacity,f=n.forecastOpacity,u=n.trainStroke,p=n.trainLinecap,h=n.trainUnderline;return n=>{const y=o(n),d=n[r];if("training"===d){let o=y.stroke;return"darken"===u?o=t(y.stroke||"#666",.5):u&&(o=u),{...y,stroke:o,strokeDasharray:s,...p&&{strokeLinecap:p},...null!=c&&{strokeOpacity:c}}}if("training-base"===d){let t=y.stroke||"#666";return"lighten"===h&&(t=e(t,.4)),{...y,stroke:t,strokeDasharray:void 0}}if("forecast"===d){const t=n[a],o=null!=t?t:f;return{...y,stroke:l,strokeDasharray:i,...null!=o&&{strokeOpacity:o}}}return y}}export{a as FORECAST_OPACITY_FIELD,r as SEGMENT_FIELD,l as buildAnomalyAnnotations,c as buildForecast,f as createSegmentLineStyle,t as darkenColor,e as lightenColor,s as stampForecastOpacity};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{getMax as t,getMinMax as n}from"./xy-chunk-IWD6IB6V.module.min.js";function o(t,n=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!o)return t;const e=Math.round(parseInt(o[1],16)*(1-n)),r=Math.round(parseInt(o[2],16)*(1-n)),a=Math.round(parseInt(o[3],16)*(1-n));return`#${e.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}function e(t,n=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!o)return t;const e=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*n),r=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*n),a=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*n);return`#${e.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}var r="__forecastSegment",a="__forecastOpacity";function s(t,o,e,r){const s=o.uncertaintyOpacity,i=o.confidenceAccessor;if(!s&&!i)return;const l="object"==typeof s?s:{},c=l.min??.15,f=l.max??1;if(i){const n="function"==typeof i?i:t=>t[i];for(const o of t){const t=n(o);null!=t&&Number.isFinite(t)&&(o[a]=c+Math.max(0,Math.min(1,t))*(f-c))}return}const p=t.map(t=>{const n=e(t),o=r(t);return null!=n&&null!=o&&Number.isFinite(n)&&Number.isFinite(o)?Math.abs(n-o):NaN}),u=p.filter(t=>Number.isFinite(t));if(0===u.length)return;const[h,y]=n(u),d=y-h;t.forEach((t,n)=>{const o=p[n];Number.isFinite(o)&&(t[a]=f-(d>0?(o-h)/d:0)*(f-c))})}function i(t,n){return"function"==typeof n?n(t):!!t[n]}function l(t){return[{type:"anomaly-band",threshold:t.threshold??2,showBand:!1!==t.showBand,fill:t.bandColor||"#6366f1",fillOpacity:t.bandOpacity??.1,anomalyColor:t.anomalyColor||"#ef4444",anomalyRadius:t.anomalyRadius??6,label:t.label}]}function c(n,o,e,a,l){return(c=a).isTraining||c.isForecast||c.isAnomaly||c.upperBounds||c.lowerBounds?function(t,n,o,e,a){const{isTraining:l,isForecast:c,isAnomaly:f,upperBounds:p,lowerBounds:u,color:h="#6366f1",bandOpacity:y=.15,anomalyColor:d="#ef4444",anomalyRadius:m=6,label:b}=e,g=t.map(t=>{let n="observed";return c&&i(t,c)?n="forecast":l&&i(t,l)&&(n="training"),{...t,[r]:n}}),_=e._groupBy,k=[];if(_){const t=new Map;for(const n of g){const o=n[_]??"__default";t.has(o)||t.set(o,[]),t.get(o).push(n)}const n=[];for(const[,o]of t)for(let t=0;o.length-1>t;t++)o[t][r]!==o[t+1][r]&&(n.push({...o[t+1],[r]:o[t][r]}),n.push({...o[t],[r]:o[t+1][r]}));k.push(...g,...n)}else for(let t=0;g.length>t;t++)k.push(g[t]),g.length-1>t&&g[t][r]!==g[t+1][r]&&(k.push({...g[t+1],[r]:g[t][r]}),k.push({...g[t],[r]:g[t+1][r]}));if(e.trainUnderline){const t=[];for(const n of k)"training"===n[r]&&t.push({...n,[r]:"training-base"});k.unshift(...t)}const O=[];if(p&&u){const t="string"==typeof p?p:"__envUpper",n="string"==typeof u?u:"__envLower";if("function"==typeof p||"function"==typeof u)for(const o of k)"function"==typeof p&&(o[t]=p(o)),"function"==typeof u&&(o[n]=u(o));O.push({type:"envelope",upperAccessor:t,lowerAccessor:n,fill:h,fillOpacity:y,label:b})}if(e.uncertaintyOpacity||e.confidenceAccessor){const t=p?"function"==typeof p?p:t=>t[p]:()=>{},n=u?"function"==typeof u?u:t=>t[u]:()=>{};s(k.filter(t=>"forecast"===t[r]),e,t,n)}if(f){const t=e.anomalyStyle,n={type:"highlight",filter:t=>i(t,f)};t?(n.style=t,n.r=m):"function"==typeof d?(n.style=t=>{const n=d(t);return{stroke:n,strokeWidth:1.5,fill:n,fillOpacity:.7}},n.r=m):(n.color=d,n.r=m,n.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),O.push(n)}return a&&O.push({type:"anomaly-band",threshold:a.threshold??2,showBand:!1!==a.showBand,fill:a.bandColor||"#6366f1",fillOpacity:a.bandOpacity??.1,anomalyColor:a.anomalyColor||"#ef4444",anomalyRadius:a.anomalyRadius??6,label:a.label}),{processedData:k,annotations:O}}(n,0,0,a,l):function(n,o,e,a,i){const{trainEnd:l,steps:c=10,confidence:f=.95,color:p="#6366f1",bandOpacity:u=.15,label:h}=a;if(null==l)return{processedData:n,annotations:[]};const y=[],d=[];for(const t of n)t[o]>l?d.push({...t,[r]:"observed"}):y.push({...t,[r]:"training"});const m=y.map(t=>[t[o],t[e]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,n)=>t[0]-n[0]),b=[],g=[];if(m.length>=3){const i=m.length;let l=0,y=0,d=0,_=0;for(const[t,n]of m)l+=t,y+=n,d+=t*t,_+=t*n;const k=i*d-l*l;if(Math.abs(k)>1e-12){const d=(i*_-l*y)/k,O=(y-d*l)/i,w=t=>O+d*t,S=m.map(([t,n])=>n-w(t)).reduce((t,n)=>t+n*n,0),M=Math.sqrt(S/Math.max(i-2,1)),B=m.reduce((t,n)=>t+n[0],0)/i,F=m.reduce((t,n)=>t+(n[0]-B)**2,0),I=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,v=n.map(t=>t[o]).filter(t=>null!=t&&isFinite(t)),C=t(v),D=m.length>1?(m[i-1][0]-m[0][0])/(i-1):1;for(let t=1;c>=t;t++){const n=C+t*D,a=w(n),s=M*Math.sqrt(1+1/i+(F>0?(n-B)**2/F:0))*I;g.push({[o]:n,[e]:a,[r]:"forecast",__forecastUpper:a+s,__forecastLower:a-s})}s(g,a,t=>t.__forecastUpper,t=>t.__forecastLower),b.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:p,fillOpacity:u,label:h})}}b.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&b.push({type:"anomaly-band",threshold:i.threshold??2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:i.bandOpacity??.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:i.anomalyRadius??6,label:i.label});const _=[];if(_.push(...y),y.length>0&&d.length>0&&_.push({...y[y.length-1],[r]:"observed"}),_.push(...d),g.length>0){const t=d.length>0?d[d.length-1]:y[y.length-1];t&&_.push({...t,[r]:"forecast"}),_.push(...g)}return{processedData:_,annotations:b}}(n,o,e,a,l);var c}function f(t,n){const s=n.trainDasharray??"8,4",i=n.forecastDasharray??"4,4",l=n.color||"#6366f1",c=n.trainOpacity,f=n.forecastOpacity,p=n.trainStroke,u=n.trainLinecap,h=n.trainUnderline;return n=>{const y=t(n),d=n[r];if("training"===d){let t=y.stroke;return"darken"===p?t=o(y.stroke||"#666",.5):p&&(t=p),{...y,stroke:t,strokeDasharray:s,...u&&{strokeLinecap:u},...null!=c&&{strokeOpacity:c}}}if("training-base"===d){let t=y.stroke||"#666";return"lighten"===h&&(t=e(t,.4)),{...y,stroke:t,strokeDasharray:void 0}}if("forecast"===d){const t=n[a],o=null!=t?t:f;return{...y,stroke:l,strokeDasharray:i,...null!=o&&{strokeOpacity:o}}}return y}}export{a as FORECAST_OPACITY_FIELD,r as SEGMENT_FIELD,l as buildAnomalyAnnotations,c as buildForecast,f as createSegmentLineStyle,o as darkenColor,e as lightenColor,s as stampForecastOpacity};
|