semiotic 3.8.8 → 3.8.9
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 +5 -4
- package/README.md +44 -44
- package/ai/schema.json +263 -1
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chunk-2X3FJCME.module.min.js +1 -0
- package/dist/{chunk-chunk-UEZ6SHW5.module.min.js → chunk-chunk-2ZHHWZQM.module.min.js} +1 -1
- package/dist/chunk-chunk-5ZON5NMV.module.min.js +2 -0
- package/dist/{chunk-chunk-L6FFYGYS.module.min.js → chunk-chunk-6S3YGYW7.module.min.js} +1 -1
- package/dist/chunk-chunk-7C5EDZ3Z.module.min.js +2 -0
- package/dist/chunk-chunk-A3I4HBD5.module.min.js +1 -0
- package/dist/{chunk-chunk-4MLLQUGW.module.min.js → chunk-chunk-AFQHURLO.module.min.js} +1 -1
- package/dist/{chunk-chunk-OG3TTJGJ.module.min.js → chunk-chunk-DDB4TLQG.module.min.js} +1 -1
- package/dist/{chunk-chunk-W5HWGQMD.module.min.js → chunk-chunk-DTH3SUOU.module.min.js} +1 -1
- package/dist/{chunk-chunk-H5IFO6CU.module.min.js → chunk-chunk-DVCWU7MT.module.min.js} +1 -1
- package/dist/{chunk-chunk-JRHXQGEV.module.min.js → chunk-chunk-FSIHAW6L.module.min.js} +1 -1
- package/dist/{chunk-chunk-BWV55BZK.module.min.js → chunk-chunk-G2RGVEYY.module.min.js} +1 -1
- package/dist/chunk-chunk-HAJVODLO.module.min.js +2 -0
- package/dist/{chunk-chunk-BZNOAHJV.module.min.js → chunk-chunk-HIV7AW2V.module.min.js} +1 -1
- package/dist/{chunk-chunk-LJDH3WV3.module.min.js → chunk-chunk-JZAMMSQQ.module.min.js} +1 -1
- package/dist/{chunk-chunk-VUWYT7DY.module.min.js → chunk-chunk-MXMRXSCI.module.min.js} +1 -1
- package/dist/chunk-chunk-MXVBXFKW.module.min.js +2 -0
- package/dist/{chunk-chunk-7LE56WAE.module.min.js → chunk-chunk-OFAP623Y.module.min.js} +1 -1
- package/dist/{chunk-chunk-SFLUSZ73.module.min.js → chunk-chunk-OHLRAEQZ.module.min.js} +1 -1
- package/dist/{chunk-chunk-CD6PVVS3.module.min.js → chunk-chunk-PRNXOCYZ.module.min.js} +1 -1
- package/dist/chunk-chunk-RLKZVJMQ.module.min.js +2 -0
- package/dist/chunk-chunk-SK2TQMG4.module.min.js +2 -0
- package/dist/chunk-chunk-SKLYXNYW.module.min.js +2 -0
- package/dist/{chunk-chunk-57RBPDBQ.module.min.js → chunk-chunk-U4NZCU5T.module.min.js} +1 -1
- package/dist/{chunk-chunk-QQJNG23C.module.min.js → chunk-chunk-VKL6DI43.module.min.js} +1 -1
- package/dist/chunk-chunk-W62673ZE.module.min.js +1 -0
- package/dist/{chunk-chunk-WSDJFBKX.module.min.js → chunk-chunk-XCC25CZZ.module.min.js} +1 -1
- package/dist/{chunk-chunk-AF53TBSN.module.min.js → chunk-chunk-XECNOUZY.module.min.js} +1 -1
- package/dist/{chunk-chunk-FC3NZWYR.module.min.js → chunk-chunk-XYZDTYAF.module.min.js} +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +54 -1
- package/dist/components/charts/physics/chainReactionTypes.d.ts +1 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +1 -1
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
- package/dist/components/charts/shared/formatUtils.d.ts +40 -9
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -0
- package/dist/components/charts/shared/types.d.ts +8 -1
- package/dist/components/semiotic-utils-core.d.ts +1 -0
- package/dist/components/semiotic.d.ts +4 -3
- package/dist/components/stream/GeoTileRenderer.d.ts +1 -0
- package/dist/components/stream/canvasSetup.d.ts +15 -4
- package/dist/components/stream/geoTypes.d.ts +2 -0
- package/dist/components/stream/networkFramePaint.d.ts +8 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalTypes.d.ts +2 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -0
- package/dist/components/stream/pipelineConfig.d.ts +2 -0
- package/dist/components/stream/pipelineDomainResolution.d.ts +1 -1
- package/dist/components/stream/types.d.ts +8 -1
- package/dist/components/stream/useCanvasFrameHost.d.ts +9 -0
- package/dist/components/stream/xyFrameAxisTypes.d.ts +5 -0
- 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.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/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-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-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-utils-core.d.ts +1 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.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.d.ts +4 -3
- 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 +1 -1
- package/dist/chunk-chunk-3GCILWPB.module.min.js +0 -2
- package/dist/chunk-chunk-46KRGJQP.module.min.js +0 -1
- package/dist/chunk-chunk-7T25U75Z.module.min.js +0 -2
- package/dist/chunk-chunk-BTZYH2IE.module.min.js +0 -1
- package/dist/chunk-chunk-FRGBMTZR.module.min.js +0 -1
- package/dist/chunk-chunk-HCNDE26Q.module.min.js +0 -2
- package/dist/chunk-chunk-JJ4BSUYL.module.min.js +0 -2
- package/dist/chunk-chunk-N3Q33XCB.module.min.js +0 -2
- package/dist/chunk-chunk-RGJ6TKAH.module.min.js +0 -2
- package/dist/chunk-chunk-WGROBM3I.module.min.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{auditVisualizationControls as e}from"./chunk-chunk-FQPKOAIH.module.min.js";import{resolveAccessor as t,resolveRawAccessor as r}from"./chunk-chunk-NWIGA3UK.module.min.js";import{filterAnnotationsByStatus as a}from"./chunk-chunk-FC3NZWYR.module.min.js";import{getMinMax as n}from"./chunk-chunk-2NVFEB7P.module.min.js";function o(e){return i(e),e}function i(t){if(!t||"object"!=typeof t)throw Error("Chart recipe must be an object.");if("string"!=typeof t.id||""===t.id.trim())throw Error("Chart recipe requires a non-empty id.");if("string"!=typeof t.name||""===t.name.trim())throw Error(`Chart recipe "${t.id}" requires a non-empty name.`);if(!Array.isArray(t.dataRoles)||0===t.dataRoles.length)throw Error(`Chart recipe "${t.id}" requires at least one data role.`);if(!Array.isArray(t.intents)||0===t.intents.length)throw Error(`Chart recipe "${t.id}" requires at least one intent.`);for(const e of t.intents)if("string"!=typeof e&&(!e||"string"!=typeof e.id&&"string"!=typeof e.name))throw Error(`Chart recipe "${t.id}" has an intent without an id or name.`);if(!t.designContract?.whyCustom)throw Error(`Chart recipe "${t.id}" requires designContract.whyCustom.`);if(!t.accessibility||"object"!=typeof t.accessibility)throw Error(`Chart recipe "${t.id}" requires accessibility expectations.`);if(void 0!==t.controls){const r=e({controls:t.controls}).findings.filter(e=>"fail"===e.status);if(r.length>0)throw Error(`Chart recipe "${t.id}" has invalid controls: ${r.map(e=>e.message).join(" ")}`)}if("portable"===t.portability){if(!s(t.layout))throw Error(`Portable chart recipe "${t.id}" must reference a registered layout by id.`);const e=t.layoutConfigSchema??t.portabilityConfig?.schema;if(!e)throw Error(`Portable chart recipe "${t.id}" requires a serializable layout config schema.`);if(!l(e))throw Error(`Portable chart recipe "${t.id}" has a layout config schema that is not JSON-safe.`)}}function s(e){return!!e&&"object"==typeof e&&"string"==typeof e.id}function l(e,t=new Set){if(null===e)return!0;const r=typeof e;if("string"===r||"boolean"===r)return!0;if("number"===r)return Number.isFinite(e);if("object"!==r)return!1;if(t.has(e))return!1;t.add(e);const a=Array.isArray(e)?e.every(e=>l(e,t)):Object.entries(e).every(([,e])=>l(e,t));return t.delete(e),a}function c(e){return"string"==typeof e?e:e.id??e.name}function u(e){return"string"==typeof e?3:"number"==typeof e.score&&Number.isFinite(e.score)?Math.max(0,Math.min(5,e.score>1?e.score:5*e.score)):"primary"===e.strength?5:"secondary"===e.strength?3:"supporting"===e.strength?2:3}function h(e){const t=new Set(e.intents.map(c));return t.has("geo")?"geo":t.has("hierarchy")?"hierarchy":t.has("flow")?"flow":t.has("relationship")?"network":t.has("distribution")?"distribution":t.has("correlation")?"relationship":t.has("trend")||t.has("composition-over-time")?"time-series":t.has("compare-categories")||t.has("rank")||t.has("part-to-whole")?"categorical":"custom"}function d(e){const t=Object.values(e.audience?.familiarity??{}),r=t.find(e=>"number"==typeof e);if(void 0!==r)return Math.max(1,Math.min(5,Math.round(r)));const a=t.filter(e=>"string"==typeof e);return a.includes("high")?4:a.includes("medium")?3:a.includes("low")?2:e.reception?.memorableForm?3:2}function p(e,t){return"nodes"===t?e.network?.nodes??[]:"edges"===t?e.network?.edges??[]:"areas"===t?e.geo?.features??[]:"points"===t?e.geo?.points??[]:"lines"===t?e.geo?.flows??[]:e.data}function f(e,t,r){return p(e,t.source).some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,r))}function m(e,t,r){if(t.field&&f(r,t,t.field))return t.field;if("nodes"===t.source||"edges"===t.source){const e="node-id"===t.role?"id":"edge-source"===t.role?"source":"edge-target"===t.role?"target":void 0;if(e&&f(r,t,e))return e}switch(t.semanticType){case"quantitative":return r.primary.y??r.primary.size??r.primary.x;case"temporal":return r.primary.time??r.primary.x;case"nominal":case"ordinal":return r.primary.category??r.primary.series;case"identifier":{const e=p(r,t.source);return["id","key","name"].find(t=>e.some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,t)))}case"geographic":return r.hasGeo?t.field:void 0;default:return t.field}}function g(e){const t={},r=[];for(const a of e.intents){const e=c(a);e&&(t[e]=u(a),"string"!=typeof a&&a.rationale&&r.push(a.rationale))}r.push(...(e.reception?.strengths??[]).map(e=>"Reception strength: "+e));const a=e.reception?.risks??[],n=e.designContract.misuse??[],o=[...e.designContract.caveats??[],...e.caveats??[]];return{component:e.id,displayName:e.name,candidateKind:"recipe",family:h(e),renderingFamily:e.frameFamily,importPath:"semiotic/ai",rubric:{familiarity:d(e),accuracy:4,precision:a.some(e=>/precis|comparison/i.test(e))?2:3},fits:t=>function(e,t){for(const r of e.dataRoles)if(!1!==r.required&&!m(0,r,t))return`needs data role "${r.role}" (${r.semanticType})`;const r=e.audit?.maxCategories;return"number"==typeof r&&"number"==typeof t.categoryCount&&t.categoryCount>r?`${t.categoryCount} categories exceeds this recipe's declared maximum of ${r}`:null}(e,t),intentScores:t,caveats:()=>[...a,...n,...o],buildProps:t=>function(e,t){const r={};for(const a of e.dataRoles){const e=m(0,a,t);e&&a.accessor&&(r[a.accessor]=e)}const a={recipeId:e.id,layoutConfig:r};e.frameFamily.startsWith("Network")?(a.nodes=t.network?.nodes??t.data,a.edges=t.network?.edges??[]):e.frameFamily.startsWith("Geo")?(a.areas=t.geo?.features??[],a.points=t.geo?.points??t.data,a.lines=t.geo?.flows??[]):a.data=t.data;const n=e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0);return n&&(a.mobileSemantics=n),a}(e,t),mobile:e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0),recipe:e,positiveRationale:r,whyCustom:{defaultAlternative:e.designContract.defaultAlternative,reason:e.designContract.whyNotDefault??e.designContract.whyCustom,tradeoff:e.designContract.tradeoff??(a.length>0?a[0]:void 0)}}}var y=Symbol.for("semiotic.chartRecipeRegistry");function b(){const e=globalThis;return e[y]||(e[y]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[y]}function C(e){i(e),b().recipes.set(e.id,e),b().capabilities.set(e.id,g(e))}function $(e){b().recipes.delete(e),b().capabilities.delete(e)}function v(e){return b().recipes.get(e)}function w(){return Array.from(b().recipes.values())}function k(){return Array.from(b().capabilities.values())}function S(){return b().capabilities.size>0}function x(e,t){if(!e)throw Error("Recipe layout requires a non-empty id.");if("function"!=typeof t)throw Error(`Recipe layout "${e}" must be a function.`);b().layouts.set(e,t)}function A(e){b().layouts.delete(e)}function P(e){return b().layouts.get(e)}function L(e){return"string"==typeof e?v(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}var F=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","GauntletChart","CrucibleChart","ProcessFlowChart","PacketFlowChart","ChainReactionChart","BigNumber"],R=new Set(F);function j(e){return R.has(e)}function D(e){return"string"==typeof e?e:e.id??e.name}function B(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function N(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function O(e,t,r){return r??L(t.recipe)??L(t.recipeId)??v(e)}function I(e,t,r=[]){const a=e.accessor?t[e.accessor]:void 0;if("string"==typeof a&&a)return a;if(e.field)return e.field;const n=r.find(e=>e&&"object"==typeof e);if(!n)return;const o=Object.entries(n).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?o.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in n):o.find(([,e])=>"string"==typeof e)?.[0]}function M(e,t){return e.dataRoles.find(e=>e.role===t)}function T(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function E(e,t,r,a,n,o={}){const i={...o};if(t)for(const[e,r]of Object.entries(t))i[e]=r;for(const e of r.dataRoles){const r=I(e,a,n),o=t&&r?t[r]:r;void 0!==o&&(i[e.role]=o)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const r=i[t];return null==r?`{${t}}`:r+""})}var G=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),U=new Set(["data","nodes","edges","points","areas","lines","flows"]);function H(e){if(null==e)return e;if("function"==typeof e)return;if("object"!=typeof e)return e;if(e.$$typeof)return;if(Array.isArray(e))return e.map(H).filter(e=>void 0!==e);if(e instanceof Date)return e;const t={};for(const[r,a]of Object.entries(e)){if("function"==typeof a)continue;if(a&&"object"==typeof a&&a.$$typeof)continue;const e=H(a);void 0!==e&&(t[r]=e)}return t}function q(e,t){return!!U.has(e)&&("areas"!==e||"string"!=typeof t)}var z="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function V(e,t,r){const a=v(e)??L(t.recipe)??L(t.recipeId);if(a)return function(e,t,r){const a=function(e,t,r){const a={};for(const[n,o]of Object.entries(e))if(null!=o&&!G.has(n)&&"recipeId"!==n&&(t||!q(n,o)))if("function"==typeof o||o?.$$typeof){if(r)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`)}else if(l(o))a[n]=z(o);else if(r)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`);return a}(t,!1!==r?.includeData,"portable"===e.portability),n=e.intents.map(D).filter(e=>!!e),o={name:e.name,intents:n,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!l(a))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:a,manifest:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:a,manifest:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}(a,t,r);if(!j(e))throw Error(`Unknown component "${e}". Known components: ${F.join(", ")}`);const n=!1!==r?.includeData,o={};for(const[e,r]of Object.entries(t))if(null!=r&&!G.has(e)&&(n||!q(e,r))&&"function"!=typeof r&&!r?.$$typeof)try{o[e]=z(H(r))}catch{}return{component:e,props:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}function _(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=v(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...z(e.props),recipeId:e.recipeId}}}if(!j(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:z(e.props)}}function J(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function K(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const r=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(escape(atob(r)));return JSON.parse(a)}async function W(e,t="json"){const r="jsx"===t?Q(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(r)}function Q(e){const{props:t}=e,r=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&r.push(` recipeId="${e.recipeId}"`);for(const[e,a]of Object.entries(t))if("string"==typeof a)r.push(` ${e}="${a}"`);else if("boolean"==typeof a&&!0===a)r.push(" "+e);else if("boolean"==typeof a&&!1===a)r.push(` ${e}={false}`);else if("number"==typeof a)r.push(` ${e}={${a}}`);else{const t=JSON.stringify(a);r.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(a,null,2)}}`)}return r.push("/>"),r.join("\n")}function X(e){const t=Object.create(null);for(const[r,a]of e){const e=[];for(const[,t]of a.clauses){const r=Object.create(null);for(const[e,a]of Object.entries(t.fields))r[e]="point"===a.type?{type:"point",values:Array.from(a.values)}:{type:"interval",range:a.range};e.push({clientId:t.clientId,type:t.type,fields:r})}t[r]={name:a.name,resolution:a.resolution,clauses:e}}return t}function Y(e){const t=new Map;for(const[r,a]of Object.entries(e)){const e=new Map;for(const t of a.clauses){const r=Object.create(null);for(const[e,a]of Object.entries(t.fields))r[e]="point"===a.type?{type:"point",values:new Set(a.values)}:{type:"interval",range:a.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:r})}t.set(r,{name:a.name,resolution:a.resolution,clauses:e})}return t}function Z(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...r}=e;return{type:t,markProps:r}}function ee(e){return"nominal"===e||"ordinal"===e}function te(e){return"quantitative"===e||"temporal"===e}function re(e){return e.usermeta?.idid}function ae(e){if(!re(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:r,...a}=e,{usermeta:n,...o}=t[0];return{...a,...o}}var ne={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},oe={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},ie={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function se(e){e=ae(e);const t=[],{type:r,markProps:a}=Z(e.mark),o=e.encoding||{},i=o.x,s=o.y,l=o.color,c=o.size,u=o.theta,h=o.opacity;let d;e.data?.values?d=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||o.facet||o.row||o.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const p={};e.width&&(p.width=e.width),e.height&&(p.height=e.height);const f=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(f&&(p.title=f),l?.field&&(p.colorBy=l.field,l.scale?.scheme)){const e=ne[l.scale.scheme];e&&(p.colorScheme=e)}void 0!==h?.value&&(p.pointOpacity=h.value);const m=i?.aggregate,g=s?.aggregate;if(d&&(m||g)){const e=g?s:i,t=g?i:s,r=ie[e.aggregate];if(r&&t?.field&&e.field)d=function(e,t){const{groupBy:r,value:a,agg:o="sum"}=t,i=new Map;for(const t of e){const e=t[r]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[a]))}const s=[];for(const[e,t]of i){let a;switch(o){case"count":a=t.length;break;case"mean":a=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":a=n(t)[0];break;case"max":a=n(t)[1];break;default:a=t.reduce((e,t)=>e+t,0)}s.push({[r]:e,value:a})}return s}(d,{groupBy:t.field,value:e.field,agg:r});else if(("count"===r||"count"===e.aggregate)&&t?.field&&d){const e=new Map;for(const r of d){const a=r[t.field]+"";e.set(a,(e.get(a)||0)+1)}d=Array.from(e,([e,r])=>({[t.field]:e,value:r}))}}if(i?.bin||s?.bin){const e="Histogram";d&&(p.data=d),i?.bin?(p.valueAccessor=i.field,s?.field&&(p.categoryAccessor=s.field),i.axis?.title&&(p.valueLabel=i.axis.title)):s?.bin&&(p.valueAccessor=s.field,i?.field&&(p.categoryAccessor=i.field),s.axis?.title&&(p.valueLabel=s.axis.title));const r=i?.bin||s?.bin,a="object"==typeof r?r.maxbins:void 0;return a&&(p.bins=a),ue(e,p,t)}let y;switch(r){case"bar":y=function(e,t,r,a,n,o,i){let s;return r?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(s="StackedBarChart",a.stackBy=r.field):s="BarChart",ee(e?.type)&&te(t?.type)?(a.categoryAccessor=e.field,a.valueAccessor=i?"value":t.field,e?.axis?.title&&(a.categoryLabel=e.axis.title),t?.axis?.title&&(a.valueLabel=t.axis.title)):te(e?.type)&&ee(t?.type)?(a.categoryAccessor=t.field,a.valueAccessor=o?"value":e.field,a.orientation="horizontal",t?.axis?.title&&(a.categoryLabel=t.axis.title),e?.axis?.title&&(a.valueLabel=e.axis.title)):(e?.field&&(a.categoryAccessor=e.field),t?.field&&(a.valueAccessor=i?"value":t.field),e?.axis?.title&&(a.categoryLabel=e.axis.title),t?.axis?.title&&(a.valueLabel=t.axis.title)),n&&(a.data=n),s}(i,s,l,p,d,m,g);break;case"line":if(y="LineChart",ce(i,s,p,m,g),l?.field&&(p.lineBy=l.field),a.interpolate){const e=oe[a.interpolate];e&&(p.curve=e)}!0===a.point&&(p.showPoints=!0),d&&(p.data=d);break;case"area":if(l?.field?(y="StackedAreaChart",p.areaBy=l.field):y="AreaChart",ce(i,s,p,m,g),a.interpolate){const e=oe[a.interpolate];e&&(p.curve=e)}void 0!==a.opacity&&(p.areaOpacity=a.opacity),d&&(p.data=d);break;case"point":case"circle":case"square":c?.field?(y="BubbleChart",p.sizeBy=c.field,c.scale?.range&&(p.sizeRange=c.scale.range)):y="Scatterplot",ce(i,s,p,m,g),d&&(p.data=d);break;case"rect":y="Heatmap",i?.field&&(p.xAccessor=i.field),s?.field&&(p.yAccessor=s.field),l?.field&&(p.valueAccessor=l.field,delete p.colorBy),i?.axis?.title&&(p.xLabel=i.axis.title),s?.axis?.title&&(p.yLabel=s.axis.title),d&&(p.data=d);break;case"arc":a.innerRadius&&a.innerRadius>0?(y="DonutChart",p.innerRadius=a.innerRadius):y="PieChart",u?.field?p.valueAccessor=u.field:s?.field&&(p.valueAccessor=g?"value":s.field),l?.field&&(p.categoryAccessor=l.field),i?.field&&!u?.field&&(p.categoryAccessor=i.field),d&&(p.data=d);break;case"tick":y="DotPlot",ee(i?.type)?(p.categoryAccessor=i.field,s?.field&&(p.valueAccessor=g?"value":s.field),i?.axis?.title&&(p.categoryLabel=i.axis.title),s?.axis?.title&&(p.valueLabel=s.axis.title)):ee(s?.type)?(p.categoryAccessor=s.field,i?.field&&(p.valueAccessor=m?"value":i.field),p.orientation="horizontal",s?.axis?.title&&(p.categoryLabel=s.axis.title),i?.axis?.title&&(p.valueLabel=i.axis.title)):(i?.field&&(p.categoryAccessor=i.field),s?.field&&(p.valueAccessor=g?"value":s.field)),d&&(p.data=d);break;default:t.push(`Unsupported mark type "${r}". Defaulting to Scatterplot.`),y="Scatterplot",ce(i,s,p,m,g),d&&(p.data=d)}return ue(y,p,t)}function le(e,t={}){const r=function(e){const t=e,r=ae(e),a=r,n=[];if(Array.isArray(t.layer)&&r===e&&n.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/layer",message:"Only the single base view in an IDID-enriched annotation layer can be imported."}),void 0===a.mark)n.push({code:"MISSING_MARK",severity:"error",path:"/mark",message:"A Vega-Lite spec needs a supported single-view mark."});else{const{type:e}=Z(a.mark);new Set(["bar","line","area","point","circle","square","rect","arc","tick"]).has(e)||n.push({code:"UNSUPPORTED_MARK",severity:"error",path:"/mark",message:`Vega-Lite mark "${e||"(missing)"}" has no supported Semiotic translation.`})}Array.isArray(a.transform)&&a.transform.length>0&&n.push({code:"UNSUPPORTED_TRANSFORM",severity:"error",path:"/transform",message:"Vega-Lite transforms must be materialized before strict import."});for(const e of["hconcat","vconcat","concat","facet","repeat","params","selection"])void 0!==a[e]&&n.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/"+e,message:`Vega-Lite "${e}" is not part of the supported single-view import subset.`});return"string"==typeof a.data?.url&&n.push({code:"UNSUPPORTED_DATA_URL",severity:"error",path:"/data/url",message:"Strict import accepts inline data.values only; load URL data before importing."}),n}(e),a=r.filter(e=>"error"===e.severity),n=re(e),o={adapter:"semiotic/vega-lite",direction:"import",sourceFormat:"vega-lite",targetFormat:"semiotic-chart-config",..."string"==typeof n?.specVersion?{specVersion:n.specVersion}:{},...n?{metadata:{idid:n}}:{}};if(a.length>0&&"lossy"!==t.mode)return{status:"refused",diagnostics:r,lossReport:a.map(({code:e,message:t,path:r})=>({code:e,message:t,path:r})),provenance:o};const i=se(e),s=(i.warnings||[]).map(e=>({code:"LEGACY_TRANSLATION_WARNING",severity:"warning",message:e})),l=a.map(({code:e,message:t,path:r})=>({code:e,message:t,path:r})),c="lossy"===t.mode?r.map(e=>"error"===e.severity?{...e,severity:"warning"}:e):r;return{status:l.length>0?"lossy":"success",config:i,diagnostics:[...c,...s],lossReport:l,provenance:o}}function ce(e,t,r,a,n){e?.field&&(r.xAccessor=a?"value":e.field),t?.field&&(r.yAccessor=n?"value":t.field),e?.axis?.title&&(r.xLabel=e.axis.title),t?.axis?.title&&(r.yLabel=t.axis.title)}function ue(e,t,r){const a={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(r.length>0){a.warnings=r;for(const e of r)console.warn("[semiotic/fromVegaLite] "+e)}return a}function he(e,t,r={}){const a=N(t),n=B(t),o=r.locale??"en",i="function"==typeof e.description?e.description({data:a,config:n,locale:o}):void 0,s=i?.levels??function(e,t,r,a){const n=T(e,["nominal","ordinal"]),o=T(e,["quantitative"]),i=n?I(n,r,t):void 0,s=o?I(o,r,t):void 0,l=n?.role??i??"category",c=o?.role??s??"value",u=e.encodings??[],h=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:d,percent:p}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(a),f=new Map;if(i&&s)for(const e of t){const t=(e[i]??"Uncategorized")+"",r=Number(e[s]);Number.isFinite(r)&&f.set(t,(f.get(t)??0)+r)}const m=[...f].sort((e,t)=>t[1]-e[1]),g=m.reduce((e,[,t])=>e+t,0),y=m[0],b=m[1],C=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,$=e.intents.map(e=>({id:D(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,v=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${w=h,w?w.charAt(0).toUpperCase()+w.slice(1):w}.`,l2:m.length>0?`${m.length} categories total ${d.format(g)}. ${y[0]} accounts for ${d.format(y[1])}${g>0?` (${p.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${d.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>m.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>C?`The total is distributed across ${m.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${p.format(C)}.`,l4:`The chart is intended for ${$??"explanation"}${v?` with a ${v} audience`:""}: ${e.designContract.whyCustom}`};var w}(e,a,n,o),l=r.levels??["l1","l2","l3","l4"],c={};for(const e of l)s[e]&&(c[e]=s[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),h=r.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...h?.length?{caveats:h}:{}}}var de=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),pe=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),fe=new Set(["PieChart","DonutChart","FunnelChart"]),me=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function ge(e,t){return pe.has(e)||fe.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function ye(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const r=e[t];if("string"==typeof r&&r)return r}}function be(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}var Ce={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",UnitPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PacketFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",CrucibleChart:"crucible physics chart",PhysicsCustomChart:"custom physics chart"},$e=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),ve=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]);function we(e){return Ce[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function ke(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var Se=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),xe={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Ae={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Pe=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Le={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function Fe(e){return xe[e]}function Re(e,t){const r=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,r={};for(const[e,a]of Object.entries(t.intentScores))"number"==typeof a&&Number.isFinite(a)&&(r[e]=a);return{family:t.family,intentScores:Object.keys(r).length?r:void 0}}return e}}(t);if(r?.act)return r.act;if(r?.intentScores){const e=function(e){let t,r=0;for(const[a,n]of Object.entries(e))if("number"==typeof n&&n>0)if(n>r)t=a,r=n;else if(n===r&&void 0!==t){const e=Pe.indexOf(a),r=Pe.indexOf(t);-1===e||-1!==r&&e>=r||(t=a)}return t}(r.intentScores);if(e&&xe[e]&&(r.intentScores[e]??0)>=3)return xe[e]}return r?.family?Ae[r.family]:function(e){return fe.has(e)||"StackedAreaChart"===e?"apportioning":Se.has(e)?"relating":pe.has(e)?"comparing":me.has(e)?"characterizing":de.has(e)?"tracking":$e.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}var je=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),De=new Set(["system","agent","watcher"]),Be=new Set(["ai","agent","system","computed","dbt","great-expectations"]),Ne=new Set(["rule","statistical-test","llm-inference","computed"]);function Oe(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!je.has(t.type))return!1;const r=t.provenance;return!(!r||"object"!=typeof r)&&(De.has(r.authorKind)||Be.has(r.source)||Ne.has(r.basis))})}function Ie(e="en"){let t,r;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?r.format(e):t.format(e):e+""}var Me={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function Te(e){const t=Me["string"==typeof e.type?e.type:"annotation"]||"an annotation",r=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,r=t?.authorKind??t?.source??t?.basis;return"watcher"===r?"a watcher-flagged ":"agent"===r||"ai"===r||"llm-inference"===r?"an AI-suggested ":""}(e),a=r?r+t.replace(/^an? /,""):t,n="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return n?`${a} labeled "${n}"`:a}function Ee(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const r=a(t.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;const n=r.map(Te),o=n.slice(0,5),i=n.length-o.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(o)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":l+" features"} on this chart: ${s}.`}function Ge(e,a,n={}){const o=void 0!==n.levels,i=new Set(n.levels??["l1","l2","l3"]);o||!n.capability&&!Oe(a)||i.add("l4");const s=O(e,a,n.recipe);if(s){const e=["l1","l2","l3","l4"].filter(e=>i.has(e));o||e.includes("l4")||e.push("l4");const t=he(s,a,{levels:e,locale:n.locale,audience:n.audience,includeCaveats:n.includeCaveats}),r=Ee(a);return{...t,text:r?`${r} ${t.text}`.trim():t.text,...r?{annotations:r}:{}}}const l=Ie(n.locale??"en"),c=we(e),u=Array.isArray(a.data)?a.data:null,h=ye(a),d=ve.has(e)?function(e,t){const r=e.physics&&"object"==typeof e.physics?e.physics:null,a=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,n=[e.settledProjectionRows,e.projectionRows,a?.rows,r?.settledProjectionRows,r?.projectionRows,r?.settledProjection&&"object"==typeof r.settledProjection?r.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(n)?n.map((e,r)=>{if(!e||"object"!=typeof e)return null;const a=e,n=ke(a.count??a.value??a.total??a.bodies??a.events);if(null==n)return null;const o=a.label??a.id??a.name??"container "+(r+1),i=ke(a.secondary??a.secondaryCount),s=ke(a.observed??a.observedCount);return{label:be(o,t),count:n,...null!=i?{secondary:i}:{},..."string"==typeof a.secondaryLabel&&a.secondaryLabel?{secondaryLabel:a.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(a,l):null,{measure:p,measureFallback:f,dimension:m,dimensionFallback:g}=ge(e,a),y="string"==typeof p&&p?p:f,b="string"==typeof m&&m?m:g,C={};if(ve.has(e)&&function(e,t,r,a,n,o){const i=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}(e),s=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"body"}(e);if(n.has("l1")&&(a.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"UnitPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PacketFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":"CrucibleChart"===e?"A crucible physics chart that replays authored phases and events into declared products and outlets; the settled ledger, not collisions, determines the result.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!n.has("l2")&&!n.has("l3"))return;if(!r||0===r.length)return void(n.has("l2")&&(a.l2="No settled projection is loaded yet."));const l=r.reduce((e,t)=>e+t.count,0),c=r.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??r.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const h=r.reduce((e,t)=>e+(t.secondary??0),0),d=r.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(n.has("l2"))if(0===c.length)a.l2=`The settled projection contains ${o(l)} ${He(l,s)} across ${r.length} ${He(r.length,i)}; no ${He(2,i)} are non-empty yet.`;else{const e=h>0?` ${o(h)} ${He(h,s)} ${1===h?"is":"are"} marked ${d}.`:"";a.l2=`The settled projection contains ${o(l)} ${He(l,s)} across ${r.length} ${He(r.length,i)}; ${c.length} ${He(c.length,i)} ${1===c.length?"is":"are"} non-empty. The largest ${i} is ${u.label} with ${o(u.count)} ${He(u.count,s)}.${e}`}if(n.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const r=e/t*100;return(10>r?Math.round(10*r)/10:Math.round(r))+"%"}(u.count,l);a.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${o(u.count)} ${He(u.count,s)} (${t}); ${e.label} follows with ${o(e.count)} ${He(e.count,s)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${o(u.count)} ${He(u.count,s)}.`}}(e,c,d,C,i,l),i.has("l1")&&!ve.has(e))if(de.has(e)||pe.has(e))C.l1=`A ${c} of ${y} by ${b}`+(h?`, split by ${h}.`:".");else if(fe.has(e))C.l1=`A ${c} showing ${y} across ${b} categories.`;else if(me.has(e))C.l1=`A ${c} of the distribution of ${y}`+(h?` by ${h}.`:".");else if($e.has(e)){const e=Array.isArray(a.nodes)?a.nodes.length:void 0,t=Array.isArray(a.edges)?a.edges.length:void 0,r=[null!=e?`${e} ${He(e,"node")}`:null,null!=t?`${t} ${He(t,"edge")}`:null].filter(Boolean);C.l1=`A ${c}${r.length?" with "+r.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof a.label?a.label:y;C.l1=`A single value${e?" for "+e:""}.`}else C.l1=`A ${c}.`;const $=de.has(e)||pe.has(e)||fe.has(e)||me.has(e);let v=null;if((i.has("l2")||i.has("l3")||i.has("l4"))&&$&&u&&u.length>0&&(v=function(e,t,r,a){let n=0,o=0,i=1/0,s=-1/0,l=null,c=null,u=0,h=0,d=null,p=null,f=NaN,m=NaN;for(const r of e){const e=t(r);Number.isFinite(e)&&(0===n&&(f=e,d=r),m=e,p=r,i>e&&(i=e,l=r,u=n),e>s&&(s=e,c=r,h=n),n++,o+=e)}return 0===n?null:{count:n,min:i,max:s,mean:o/n,minLabel:be(null!=l?r(l):null,a),maxLabel:be(null!=c?r(c):null,a),first:f,last:m,firstLabel:be(null!=d?r(d):null,a),lastLabel:be(null!=p?r(p):null,a),minIndex:u,maxIndex:h}}(u,t(p,f),r(m,g),l)),i.has("l2")&&$&&(u&&0!==u.length?v&&(C.l2=fe.has(e)?`${v.count} segments totaling ${l(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${l(v.max)}; smallest is ${v.minLabel} at ${l(v.min)}.`:`${y} ranges from ${l(v.min)} (${v.minLabel}) to ${l(v.max)} (${v.maxLabel}), with a mean of ${l(v.mean)} across ${v.count} points.`):C.l2="No data is loaded yet."),i.has("l3")&&v&&!h&&de.has(e)?C.l3=function(e,t,r){const{first:a,last:n,min:o,max:i,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:h,maxIndex:d,count:p}=e,f=i-o,m=n-a;if(0===f)return`${Ue(t)} is constant at ${r(a)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${Ue(t)} ends roughly where it started (${r(a)} at ${c} to ${r(n)} at ${u}), ranging between ${r(o)} and ${r(i)}.`;const g=d>0&&p-1>d,y=h>0&&p-1>h,b=(i-Math.max(a,n))/f,C=(Math.min(a,n)-o)/f;return g&&b>.15?`Overall ${t} climbs to a peak of ${r(i)} (${s}), then falls to ${r(n)} (${u}).`:y&&C>.15?`Overall ${t} drops to a low of ${r(o)} (${l}), then recovers to ${r(n)} (${u}).`:.05>Math.abs(m)/f?`${Ue(t)} ends roughly where it started (${r(a)} at ${c} to ${r(n)} at ${u}), ranging between ${r(o)} and ${r(i)}.`:m>0?d===p-1?`Overall ${t} rises from ${r(a)} (${c}) to a peak of ${r(n)} (${u}).`:`Overall ${t} rises from ${r(a)} (${c}) to ${r(n)} (${u}), after peaking at ${r(i)} (${s}).`:h===p-1?`Overall ${t} falls from ${r(a)} (${c}) to a low of ${r(n)} (${u}).`:`Overall ${t} falls from ${r(a)} (${c}) to ${r(n)} (${u}), after dipping to ${r(o)} (${l}).`}(v,y,l):i.has("l3")&&v&&!h&&pe.has(e)&&(C.l3=`The highest ${b} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),i.has("l4")){const t=Oe(a)?"alerting":Re(e,n.capability);t&&(C.l4=function(e,t,r,a,n,o,i,s){const l=Le[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,h;switch(e){case"locating":u="This is a map",h="read values by location";break;case"presenting":u="This is a single-value display",h=`read ${"string"==typeof r.label&&r.label?r.label:n} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,h="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,h="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,h=`read it for whether ${o} and ${n} move together`;break;default:u=`This is ${c} ${l} chart`,h=function(e,t,r,a,n,o){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+r;case"comparing":return`compare ${r} across ${a}`;case"ranking":return"read it top to bottom by "+r;case"apportioning":return`read each ${a}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+r;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,r){if(pe.has(r)||fe.has(r))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:a,last:n,min:o,max:i,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:h,count:d}=e,p=i-o;if(p>0){const e=h>0&&d-1>h,r=u>0&&d-1>u,f=(i-Math.max(a,n))/p,m=(Math.min(a,n)-o)/p;if(e&&f>.15)return`the peak of ${t(i)} at ${l} is the point to investigate`;if(r&&m>.15)return`the dip to ${t(o)} at ${s} is the point to investigate`;if(n>=i)return`the climb to ${t(n)} at ${c} warrants a closer look`;if(o>=n)return`the drop to ${t(n)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(i)}) and ${s} (${t(o)}) — are the points to check`}(t,n,o);case"tracking":return`read it for the trajectory of ${r}, which ${function(e){const t=e.max-e.min,r=e.last-e.first;return 0===t||.05>Math.abs(r)/t?"holds roughly steady":r>0?"rises":"falls"}(t)} from ${n(t.first)} (${t.firstLabel}) to ${n(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${r} across ${a}; ${t.maxLabel} leads at ${n(t.max)}`;case"ranking":return`read it top to bottom by ${r}; ${t.maxLabel} ranks highest at ${n(t.max)}`;case"apportioning":{const e=t.mean*t.count,r=e>0?Math.round(t.max/e*100):null;return`read each ${a}'s share of the ${n(e)} total; ${t.maxLabel} is the largest at ${n(t.max)}${null!=r?` (${r}%)`:""}`}case"characterizing":return`read it for the spread of ${r}, from ${n(t.min)} to ${n(t.max)}`;default:return"read the highlighted features"}}(e,a,n,o,i,t)}return`${u}; ${h}.${function(e,t){if(!t)return"";const r=t.familiarity?.[e];return"number"!=typeof r||r>2?"":` This ${we(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(t,e,a,h?null:v,y,b,l,n.audience))}const w=["l1","l2","l3","l4"].filter(e=>i.has(e)&&C[e]).map(e=>C[e]).join(" "),k=Ee(a);return{text:k?`${k} ${w}`.trim():w,levels:C,...k?{annotations:k}:{}}}function Ue(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function He(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function qe(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function ze(e,t,r={}){const a=N(t),n=B(t),o=Math.max(1,r.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:a,config:n,locale:r.locale??"en"});const i=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(i?.groupByRole?M(e,i.groupByRole):void 0)??(i?.groupBy?.[0]?M(e,i.groupBy[0])??e.dataRoles.find(e=>e.field===i.groupBy?.[0]):void 0)??T(e,["nominal","ordinal"]),c=l?I(l,n,a):void 0,u=(i?.idRole?M(e,i.idRole):void 0)??T(e,["identifier"]),h=u?I(u,n,a):void 0,d={id:"root",role:"chart",label:i?.summaryTemplate?E(i.summaryTemplate,void 0,e,n,a,{count:a.length}):`${e.name}: ${a.length} ${1===a.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const f=(t,r,o)=>{const s=h?t[h]:void 0,l=i?.itemLabelTemplate?E(i.itemLabelTemplate,t,e,n,a,{count:a.length}):function(e,t,r,a){const n=T(t,["nominal","ordinal"]),o=t.dataRoles.filter(e=>"quantitative"===e.semanticType),i=n?I(n,r,a):void 0,s=[];i&&null!=e[i]&&s.push(e[i]+"");for(const t of o){const n=I(t,r,a);n&&null!=e[n]&&s.push(`${t.role}: ${e[n]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,n,a);return{id:"datum-"+qe(s??r),role:"datum",label:l,level:o,datum:t}};if(c){const e=new Map;for(const t of a){const r=(t[c]??"Uncategorized")+"",a=e.get(r);a?a.push(t):e.set(r,[t])}d.children=[...e].map(([e,t],r)=>{const a=t.slice(0,Math.max(0,o-p));p+=a.length;const n=a.map((e,t)=>f(e,1e5*r+t,3));return t.length>a.length&&n.push({id:"more-"+qe(e),role:"datum",label:`…and ${t.length-a.length} more items`,level:3}),{id:"group-"+qe(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:n}})}else{const e=a.slice(0,o);d.children=e.map((e,t)=>f(e,t,2)),a.length>e.length&&d.children.push({id:"more",role:"datum",label:`…and ${a.length-e.length} more items`,level:2})}return d}function Ve(e,n,o={}){const i=o.locale??"en",s=Math.max(1,o.maxLeaves??200),l=Ie(i),c=O(e,n,o.recipe);if(c)return ze(c,n,{maxLeaves:s,locale:i});const u={id:"root",role:"chart",label:Ge(e,n,{locale:i}).text||"Chart.",level:1,children:[]},h=function(e,t){const r=Array.isArray(e.annotations)?e.annotations:null;if(!r)return null;const n=a(r.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let o=0;const i=n.slice(0,t).map(e=>{const t=e.lifecycle?.status,r=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+o++,role:"annotation",level:3,label:`${a=Te(e),a?a.charAt(0).toUpperCase()+a.slice(1):a}${r}.`,datum:e};var a});n.length>t&&i.push({id:"annotation-"+o++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const s=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(n,s),d=Array.isArray(n.data)?n.data:null,p=de.has(e)||pe.has(e)||fe.has(e)||me.has(e);if(!d||0===d.length||!p)return h&&(u.children=[h]),u;const{measure:f,measureFallback:m,dimension:g,dimensionFallback:y}=ge(e,n),b=t(f,m),C=r(g,y),$="string"==typeof f&&f?f:m,v="string"==typeof g&&g?g:y,w=ye(n);let k=0;const S=e=>`${e}-${k++}`,x=(e,t)=>{const r=e.slice(0,s).map(e=>((e,t)=>{const r=b(e),a=be(C(e),l);return{id:S("datum"),role:"datum",level:t,label:`${a}: ${Number.isFinite(r)?l(r):"—"}`,value:Number.isFinite(r)?r:void 0,datum:e}})(e,t));return e.length>s&&r.push({id:S("more"),role:"datum",level:t,label:`…and ${e.length-s} more points`}),r},A=[];if(de.has(e)||pe.has(e)){let t=1/0,r=-1/0,a=1/0,n=-1/0;const o=[];let i=!0;for(const e of d){const s=b(e);Number.isFinite(s)&&(t>s&&(t=s),s>r&&(r=s));const l=C(e);o.push(l),"number"==typeof l&&Number.isFinite(l)?(a>l&&(a=l),l>n&&(n=l)):i=!1}const s=new Set,c=[];for(const e of o){const t=e+"";s.has(t)||(s.add(t),c.push(e))}const u=i?`${l(a)} to ${l(n)}`:`${be(c[0],l)} to ${be(c[c.length-1],l)} (${pe.has(e)?c.length+" categories":d.length+" points"})`;A.push({id:S("axis"),role:"axis",level:2,label:`${pe.has(e)?"Category axis":"X axis"}: ${v}, ${u}.`}),t>r||A.push({id:S("axis"),role:"axis",level:2,label:`Value axis: ${$}, ${l(t)} to ${l(r)}.`})}if(w){const t=r(w,w),a=new Map;for(const e of d){const r=(t(e)??"—")+"",n=a.get(r);n?n.push(e):a.set(r,[e])}const o=[];for(const[t,r]of a){const a=Ge(e,{...n,data:r},{levels:["l2","l3"],locale:i}).text;o.push({id:S("series"),role:"series",level:2,label:`Series ${t}: ${a}`,children:x(r,3)})}u.children=[...A,...o]}else u.children=[...A,...x(d,2)];return h&&u.children.push(h),u}function _e(e,t){const r=[],a=e=>{if(r.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)a(t)};return a(e),r}function Je(e){let t=1;if(e.children)for(const r of e.children)t+=Je(r);return t}var Ke=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),We=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Qe=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Xe=new Set(["LineChart","AreaChart","StackedAreaChart"]),Ye=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]),Ze=new Set(["LineChart","AreaChart","StackedAreaChart","ConnectedScatterplot"]),et=new Set(["PieChart","DonutChart"]),tt={PieChart:"valueAccessor",DonutChart:"valueAccessor",FunnelChart:"valueAccessor"},rt=new Set(Object.keys(tt)),at={StackedBarChart:"valueAccessor",StackedAreaChart:"yAccessor"},nt=new Set(["BigNumber"]),ot=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart"]),it=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),st=new Set(["StreamPhysicsFrame","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]),lt=new Set(["OrbitDiagram",...st]),ct=new Set(["GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart"]),ut=new Set(["GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]),ht=new Set(["RealtimeLineChart","RealtimeHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","ProcessSankey"]),dt=new Set(["MultiAxisLineChart"]),pt=new Set(["ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram"]),ft={Scatterplot:"pointRadius",BubbleChart:"pointRadius",ConnectedScatterplot:"pointRadius",QuadrantChart:"pointRadius",SwarmPlot:"pointRadius",DotPlot:"dotRadius"};export{o as defineChartRecipe,i as validateChartRecipe,s as isRegisteredRecipeLayout,l as isJsonSafe,m as resolveRecipeRoleField,g as recipeToChartCapability,C as registerChartRecipe,$ as unregisterChartRecipe,v as getChartRecipe,w as listChartRecipes,k as getRegisteredRecipeCapabilities,S as hasRegisteredRecipeCapabilities,x as registerRecipeLayout,A as unregisterRecipeLayout,P as getRecipeLayout,L as resolveChartRecipe,D as recipeIntentId,B as recipeConfig,I as fieldForRole,V as toConfig,_ as fromConfig,J as toURL,K as fromURL,W as copyConfig,Q as configToJSX,X as serializeSelections,Y as deserializeSelections,ae as unwrapIDIDEnrichedVegaLiteSpec,se as fromVegaLite,le as fromVegaLiteResult,he as describeRecipeChart,Fe as communicativeActForIntent,Re as resolveCommunicativeAct,Ge as describeChart,ze as buildRecipeNavigationTree,Ve as buildNavigationTree,_e as flattenVisible,Je as countNodes,Ke as HIERARCHY_CHARTS,We as NETWORK_CHARTS,Qe as BAR_AREA_CHARTS,Xe as TREND_SERIES_CHARTS,Ye as ORDINAL_BAR_CHARTS,Ze as CURVE_CHARTS,et as PIE_CHARTS,tt as PART_TO_WHOLE_ACCESSORS,rt as PART_TO_WHOLE_CHARTS,at as NORMALIZED_STACK_ACCESSORS,nt as VALUE_CHARTS,ot as XY_WITH_AXES_CHARTS,it as ORDINAL_CHARTS,st as PHYSICS_MOTION_CHARTS,lt as CONTINUOUS_MOTION_CHARTS,ct as PHYSICS_SETTLED_CHARTS,ut as PHYSICS_DIAGNOSTIC_CHARTS,ht as REALTIME_CHARTS,dt as DUAL_AXIS_CHARTS,pt as GEO_CHARTS,ft as POINT_TARGET_RADIUS_PROP};
|
|
2
|
+
import{auditVisualizationControls as e}from"./chunk-chunk-FQPKOAIH.module.min.js";import{resolveAccessor as t,resolveRawAccessor as r}from"./chunk-chunk-NWIGA3UK.module.min.js";import{filterAnnotationsByStatus as a}from"./chunk-chunk-XYZDTYAF.module.min.js";import{getMinMax as n}from"./chunk-chunk-2NVFEB7P.module.min.js";function o(e){return i(e),e}function i(t){if(!t||"object"!=typeof t)throw Error("Chart recipe must be an object.");if("string"!=typeof t.id||""===t.id.trim())throw Error("Chart recipe requires a non-empty id.");if("string"!=typeof t.name||""===t.name.trim())throw Error(`Chart recipe "${t.id}" requires a non-empty name.`);if(!Array.isArray(t.dataRoles)||0===t.dataRoles.length)throw Error(`Chart recipe "${t.id}" requires at least one data role.`);if(!Array.isArray(t.intents)||0===t.intents.length)throw Error(`Chart recipe "${t.id}" requires at least one intent.`);for(const e of t.intents)if("string"!=typeof e&&(!e||"string"!=typeof e.id&&"string"!=typeof e.name))throw Error(`Chart recipe "${t.id}" has an intent without an id or name.`);if(!t.designContract?.whyCustom)throw Error(`Chart recipe "${t.id}" requires designContract.whyCustom.`);if(!t.accessibility||"object"!=typeof t.accessibility)throw Error(`Chart recipe "${t.id}" requires accessibility expectations.`);if(void 0!==t.controls){const r=e({controls:t.controls}).findings.filter(e=>"fail"===e.status);if(r.length>0)throw Error(`Chart recipe "${t.id}" has invalid controls: ${r.map(e=>e.message).join(" ")}`)}if("portable"===t.portability){if(!s(t.layout))throw Error(`Portable chart recipe "${t.id}" must reference a registered layout by id.`);const e=t.layoutConfigSchema??t.portabilityConfig?.schema;if(!e)throw Error(`Portable chart recipe "${t.id}" requires a serializable layout config schema.`);if(!l(e))throw Error(`Portable chart recipe "${t.id}" has a layout config schema that is not JSON-safe.`)}}function s(e){return!!e&&"object"==typeof e&&"string"==typeof e.id}function l(e,t=new Set){if(null===e)return!0;const r=typeof e;if("string"===r||"boolean"===r)return!0;if("number"===r)return Number.isFinite(e);if("object"!==r)return!1;if(t.has(e))return!1;t.add(e);const a=Array.isArray(e)?e.every(e=>l(e,t)):Object.entries(e).every(([,e])=>l(e,t));return t.delete(e),a}function c(e){return"string"==typeof e?e:e.id??e.name}function u(e){return"string"==typeof e?3:"number"==typeof e.score&&Number.isFinite(e.score)?Math.max(0,Math.min(5,e.score>1?e.score:5*e.score)):"primary"===e.strength?5:"secondary"===e.strength?3:"supporting"===e.strength?2:3}function h(e){const t=new Set(e.intents.map(c));return t.has("geo")?"geo":t.has("hierarchy")?"hierarchy":t.has("flow")?"flow":t.has("relationship")?"network":t.has("distribution")?"distribution":t.has("correlation")?"relationship":t.has("trend")||t.has("composition-over-time")?"time-series":t.has("compare-categories")||t.has("rank")||t.has("part-to-whole")?"categorical":"custom"}function d(e){const t=Object.values(e.audience?.familiarity??{}),r=t.find(e=>"number"==typeof e);if(void 0!==r)return Math.max(1,Math.min(5,Math.round(r)));const a=t.filter(e=>"string"==typeof e);return a.includes("high")?4:a.includes("medium")?3:a.includes("low")?2:e.reception?.memorableForm?3:2}function p(e,t){return"nodes"===t?e.network?.nodes??[]:"edges"===t?e.network?.edges??[]:"areas"===t?e.geo?.features??[]:"points"===t?e.geo?.points??[]:"lines"===t?e.geo?.flows??[]:e.data}function f(e,t,r){return p(e,t.source).some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,r))}function m(e,t,r){if(t.field&&f(r,t,t.field))return t.field;if("nodes"===t.source||"edges"===t.source){const e="node-id"===t.role?"id":"edge-source"===t.role?"source":"edge-target"===t.role?"target":void 0;if(e&&f(r,t,e))return e}switch(t.semanticType){case"quantitative":return r.primary.y??r.primary.size??r.primary.x;case"temporal":return r.primary.time??r.primary.x;case"nominal":case"ordinal":return r.primary.category??r.primary.series;case"identifier":{const e=p(r,t.source);return["id","key","name"].find(t=>e.some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,t)))}case"geographic":return r.hasGeo?t.field:void 0;default:return t.field}}function g(e){const t={},r=[];for(const a of e.intents){const e=c(a);e&&(t[e]=u(a),"string"!=typeof a&&a.rationale&&r.push(a.rationale))}r.push(...(e.reception?.strengths??[]).map(e=>"Reception strength: "+e));const a=e.reception?.risks??[],n=e.designContract.misuse??[],o=[...e.designContract.caveats??[],...e.caveats??[]];return{component:e.id,displayName:e.name,candidateKind:"recipe",family:h(e),renderingFamily:e.frameFamily,importPath:"semiotic/ai",rubric:{familiarity:d(e),accuracy:4,precision:a.some(e=>/precis|comparison/i.test(e))?2:3},fits:t=>function(e,t){for(const r of e.dataRoles)if(!1!==r.required&&!m(0,r,t))return`needs data role "${r.role}" (${r.semanticType})`;const r=e.audit?.maxCategories;return"number"==typeof r&&"number"==typeof t.categoryCount&&t.categoryCount>r?`${t.categoryCount} categories exceeds this recipe's declared maximum of ${r}`:null}(e,t),intentScores:t,caveats:()=>[...a,...n,...o],buildProps:t=>function(e,t){const r={};for(const a of e.dataRoles){const e=m(0,a,t);e&&a.accessor&&(r[a.accessor]=e)}const a={recipeId:e.id,layoutConfig:r};e.frameFamily.startsWith("Network")?(a.nodes=t.network?.nodes??t.data,a.edges=t.network?.edges??[]):e.frameFamily.startsWith("Geo")?(a.areas=t.geo?.features??[],a.points=t.geo?.points??t.data,a.lines=t.geo?.flows??[]):a.data=t.data;const n=e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0);return n&&(a.mobileSemantics=n),a}(e,t),mobile:e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0),recipe:e,positiveRationale:r,whyCustom:{defaultAlternative:e.designContract.defaultAlternative,reason:e.designContract.whyNotDefault??e.designContract.whyCustom,tradeoff:e.designContract.tradeoff??(a.length>0?a[0]:void 0)}}}var y=Symbol.for("semiotic.chartRecipeRegistry");function b(){const e=globalThis;return e[y]||(e[y]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[y]}function C(e){i(e),b().recipes.set(e.id,e),b().capabilities.set(e.id,g(e))}function $(e){b().recipes.delete(e),b().capabilities.delete(e)}function v(e){return b().recipes.get(e)}function w(){return Array.from(b().recipes.values())}function k(){return Array.from(b().capabilities.values())}function S(){return b().capabilities.size>0}function x(e,t){if(!e)throw Error("Recipe layout requires a non-empty id.");if("function"!=typeof t)throw Error(`Recipe layout "${e}" must be a function.`);b().layouts.set(e,t)}function A(e){b().layouts.delete(e)}function P(e){return b().layouts.get(e)}function L(e){return"string"==typeof e?v(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}var F=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","GauntletChart","CrucibleChart","ProcessFlowChart","PacketFlowChart","ChainReactionChart","BigNumber"],R=new Set(F);function j(e){return R.has(e)}function D(e){return"string"==typeof e?e:e.id??e.name}function B(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function O(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function N(e,t,r){return r??L(t.recipe)??L(t.recipeId)??v(e)}function I(e,t,r=[]){const a=e.accessor?t[e.accessor]:void 0;if("string"==typeof a&&a)return a;if(e.field)return e.field;const n=r.find(e=>e&&"object"==typeof e);if(!n)return;const o=Object.entries(n).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?o.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in n):o.find(([,e])=>"string"==typeof e)?.[0]}function T(e,t){return e.dataRoles.find(e=>e.role===t)}function M(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function E(e,t,r,a,n,o={}){const i={...o};if(t)for(const[e,r]of Object.entries(t))i[e]=r;for(const e of r.dataRoles){const r=I(e,a,n),o=t&&r?t[r]:r;void 0!==o&&(i[e.role]=o)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const r=i[t];return null==r?`{${t}}`:r+""})}var G=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),U=new Set(["data","nodes","edges","points","areas","lines","flows"]);function H(e){if(null==e)return e;if("function"==typeof e)return;if("object"!=typeof e)return e;if(e.$$typeof)return;if(Array.isArray(e))return e.map(H).filter(e=>void 0!==e);if(e instanceof Date)return e;const t={};for(const[r,a]of Object.entries(e)){if("function"==typeof a)continue;if(a&&"object"==typeof a&&a.$$typeof)continue;const e=H(a);void 0!==e&&(t[r]=e)}return t}function q(e,t){return!!U.has(e)&&("areas"!==e||"string"!=typeof t)}var z="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function V(e,t,r){const a=v(e)??L(t.recipe)??L(t.recipeId);if(a)return function(e,t,r){const a=function(e,t,r){const a={};for(const[n,o]of Object.entries(e))if(null!=o&&!G.has(n)&&"recipeId"!==n&&(t||!q(n,o)))if("function"==typeof o||o?.$$typeof){if(r)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`)}else if(l(o))a[n]=z(o);else if(r)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`);return a}(t,!1!==r?.includeData,"portable"===e.portability),n=e.intents.map(D).filter(e=>!!e),o={name:e.name,intents:n,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!l(a))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:a,manifest:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:a,manifest:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}(a,t,r);if(!j(e))throw Error(`Unknown component "${e}". Known components: ${F.join(", ")}`);const n=!1!==r?.includeData,o={};for(const[e,r]of Object.entries(t))if(null!=r&&!G.has(e)&&(n||!q(e,r))&&"function"!=typeof r&&!r?.$$typeof)try{o[e]=z(H(r))}catch{}return{component:e,props:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}function _(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=v(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...z(e.props),recipeId:e.recipeId}}}if(!j(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:z(e.props)}}function J(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function K(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const r=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(escape(atob(r)));return JSON.parse(a)}async function Q(e,t="json"){const r="jsx"===t?W(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(r)}function W(e){const{props:t}=e,r=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&r.push(` recipeId="${e.recipeId}"`);for(const[e,a]of Object.entries(t))if("string"==typeof a)r.push(` ${e}="${a}"`);else if("boolean"==typeof a&&!0===a)r.push(" "+e);else if("boolean"==typeof a&&!1===a)r.push(` ${e}={false}`);else if("number"==typeof a)r.push(` ${e}={${a}}`);else{const t=JSON.stringify(a);r.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(a,null,2)}}`)}return r.push("/>"),r.join("\n")}function X(e){const t=Object.create(null);for(const[r,a]of e){const e=[];for(const[,t]of a.clauses){const r=Object.create(null);for(const[e,a]of Object.entries(t.fields))r[e]="point"===a.type?{type:"point",values:Array.from(a.values)}:{type:"interval",range:a.range};e.push({clientId:t.clientId,type:t.type,fields:r})}t[r]={name:a.name,resolution:a.resolution,clauses:e}}return t}function Y(e){const t=new Map;for(const[r,a]of Object.entries(e)){const e=new Map;for(const t of a.clauses){const r=Object.create(null);for(const[e,a]of Object.entries(t.fields))r[e]="point"===a.type?{type:"point",values:new Set(a.values)}:{type:"interval",range:a.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:r})}t.set(r,{name:a.name,resolution:a.resolution,clauses:e})}return t}function Z(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...r}=e;return{type:t,markProps:r}}function ee(e){return"nominal"===e||"ordinal"===e}function te(e){return"quantitative"===e||"temporal"===e}function re(e){return e.usermeta?.idid}function ae(e){if(!re(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:r,...a}=e,{usermeta:n,...o}=t[0];return{...a,...o}}var ne={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},oe={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},ie={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function se(e){e=ae(e);const t=[],{type:r,markProps:a}=Z(e.mark),o=e.encoding||{},i=o.x,s=o.y,l=o.color,c=o.size,u=o.theta,h=o.opacity;let d;e.data?.values?d=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||o.facet||o.row||o.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const p={};e.width&&(p.width=e.width),e.height&&(p.height=e.height);const f=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(f&&(p.title=f),l?.field&&(p.colorBy=l.field,l.scale?.scheme)){const e=ne[l.scale.scheme];e&&(p.colorScheme=e)}void 0!==h?.value&&(p.pointOpacity=h.value);const m=i?.aggregate,g=s?.aggregate;if(d&&(m||g)){const e=g?s:i,t=g?i:s,r=ie[e.aggregate];if(r&&t?.field&&e.field)d=function(e,t){const{groupBy:r,value:a,agg:o="sum"}=t,i=new Map;for(const t of e){const e=t[r]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[a]))}const s=[];for(const[e,t]of i){let a;switch(o){case"count":a=t.length;break;case"mean":a=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":a=n(t)[0];break;case"max":a=n(t)[1];break;default:a=t.reduce((e,t)=>e+t,0)}s.push({[r]:e,value:a})}return s}(d,{groupBy:t.field,value:e.field,agg:r});else if(("count"===r||"count"===e.aggregate)&&t?.field&&d){const e=new Map;for(const r of d){const a=r[t.field]+"";e.set(a,(e.get(a)||0)+1)}d=Array.from(e,([e,r])=>({[t.field]:e,value:r}))}}if(i?.bin||s?.bin){const e="Histogram";d&&(p.data=d),i?.bin?(p.valueAccessor=i.field,s?.field&&(p.categoryAccessor=s.field),i.axis?.title&&(p.valueLabel=i.axis.title)):s?.bin&&(p.valueAccessor=s.field,i?.field&&(p.categoryAccessor=i.field),s.axis?.title&&(p.valueLabel=s.axis.title));const r=i?.bin||s?.bin,a="object"==typeof r?r.maxbins:void 0;return a&&(p.bins=a),ue(e,p,t)}let y;switch(r){case"bar":y=function(e,t,r,a,n,o,i){let s;return r?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(s="StackedBarChart",a.stackBy=r.field):s="BarChart",ee(e?.type)&&te(t?.type)?(a.categoryAccessor=e.field,a.valueAccessor=i?"value":t.field,e?.axis?.title&&(a.categoryLabel=e.axis.title),t?.axis?.title&&(a.valueLabel=t.axis.title)):te(e?.type)&&ee(t?.type)?(a.categoryAccessor=t.field,a.valueAccessor=o?"value":e.field,a.orientation="horizontal",t?.axis?.title&&(a.categoryLabel=t.axis.title),e?.axis?.title&&(a.valueLabel=e.axis.title)):(e?.field&&(a.categoryAccessor=e.field),t?.field&&(a.valueAccessor=i?"value":t.field),e?.axis?.title&&(a.categoryLabel=e.axis.title),t?.axis?.title&&(a.valueLabel=t.axis.title)),n&&(a.data=n),s}(i,s,l,p,d,m,g);break;case"line":if(y="LineChart",ce(i,s,p,m,g),l?.field&&(p.lineBy=l.field),a.interpolate){const e=oe[a.interpolate];e&&(p.curve=e)}!0===a.point&&(p.showPoints=!0),d&&(p.data=d);break;case"area":if(l?.field?(y="StackedAreaChart",p.areaBy=l.field):y="AreaChart",ce(i,s,p,m,g),a.interpolate){const e=oe[a.interpolate];e&&(p.curve=e)}void 0!==a.opacity&&(p.areaOpacity=a.opacity),d&&(p.data=d);break;case"point":case"circle":case"square":c?.field?(y="BubbleChart",p.sizeBy=c.field,c.scale?.range&&(p.sizeRange=c.scale.range)):y="Scatterplot",ce(i,s,p,m,g),d&&(p.data=d);break;case"rect":y="Heatmap",i?.field&&(p.xAccessor=i.field),s?.field&&(p.yAccessor=s.field),l?.field&&(p.valueAccessor=l.field,delete p.colorBy),i?.axis?.title&&(p.xLabel=i.axis.title),s?.axis?.title&&(p.yLabel=s.axis.title),d&&(p.data=d);break;case"arc":a.innerRadius&&a.innerRadius>0?(y="DonutChart",p.innerRadius=a.innerRadius):y="PieChart",u?.field?p.valueAccessor=u.field:s?.field&&(p.valueAccessor=g?"value":s.field),l?.field&&(p.categoryAccessor=l.field),i?.field&&!u?.field&&(p.categoryAccessor=i.field),d&&(p.data=d);break;case"tick":y="DotPlot",ee(i?.type)?(p.categoryAccessor=i.field,s?.field&&(p.valueAccessor=g?"value":s.field),i?.axis?.title&&(p.categoryLabel=i.axis.title),s?.axis?.title&&(p.valueLabel=s.axis.title)):ee(s?.type)?(p.categoryAccessor=s.field,i?.field&&(p.valueAccessor=m?"value":i.field),p.orientation="horizontal",s?.axis?.title&&(p.categoryLabel=s.axis.title),i?.axis?.title&&(p.valueLabel=i.axis.title)):(i?.field&&(p.categoryAccessor=i.field),s?.field&&(p.valueAccessor=g?"value":s.field)),d&&(p.data=d);break;default:t.push(`Unsupported mark type "${r}". Defaulting to Scatterplot.`),y="Scatterplot",ce(i,s,p,m,g),d&&(p.data=d)}return ue(y,p,t)}function le(e,t={}){const r=function(e){const t=e,r=ae(e),a=r,n=[];if(Array.isArray(t.layer)&&r===e&&n.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/layer",message:"Only the single base view in an IDID-enriched annotation layer can be imported."}),void 0===a.mark)n.push({code:"MISSING_MARK",severity:"error",path:"/mark",message:"A Vega-Lite spec needs a supported single-view mark."});else{const{type:e}=Z(a.mark);new Set(["bar","line","area","point","circle","square","rect","arc","tick"]).has(e)||n.push({code:"UNSUPPORTED_MARK",severity:"error",path:"/mark",message:`Vega-Lite mark "${e||"(missing)"}" has no supported Semiotic translation.`})}Array.isArray(a.transform)&&a.transform.length>0&&n.push({code:"UNSUPPORTED_TRANSFORM",severity:"error",path:"/transform",message:"Vega-Lite transforms must be materialized before strict import."});for(const e of["hconcat","vconcat","concat","facet","repeat","params","selection"])void 0!==a[e]&&n.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/"+e,message:`Vega-Lite "${e}" is not part of the supported single-view import subset.`});return"string"==typeof a.data?.url&&n.push({code:"UNSUPPORTED_DATA_URL",severity:"error",path:"/data/url",message:"Strict import accepts inline data.values only; load URL data before importing."}),n}(e),a=r.filter(e=>"error"===e.severity),n=re(e),o={adapter:"semiotic/vega-lite",direction:"import",sourceFormat:"vega-lite",targetFormat:"semiotic-chart-config",..."string"==typeof n?.specVersion?{specVersion:n.specVersion}:{},...n?{metadata:{idid:n}}:{}};if(a.length>0&&"lossy"!==t.mode)return{status:"refused",diagnostics:r,lossReport:a.map(({code:e,message:t,path:r})=>({code:e,message:t,path:r})),provenance:o};const i=se(e),s=(i.warnings||[]).map(e=>({code:"LEGACY_TRANSLATION_WARNING",severity:"warning",message:e})),l=a.map(({code:e,message:t,path:r})=>({code:e,message:t,path:r})),c="lossy"===t.mode?r.map(e=>"error"===e.severity?{...e,severity:"warning"}:e):r;return{status:l.length>0?"lossy":"success",config:i,diagnostics:[...c,...s],lossReport:l,provenance:o}}function ce(e,t,r,a,n){e?.field&&(r.xAccessor=a?"value":e.field),t?.field&&(r.yAccessor=n?"value":t.field),e?.axis?.title&&(r.xLabel=e.axis.title),t?.axis?.title&&(r.yLabel=t.axis.title)}function ue(e,t,r){const a={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(r.length>0){a.warnings=r;for(const e of r)console.warn("[semiotic/fromVegaLite] "+e)}return a}function he(e,t,r={}){const a=O(t),n=B(t),o=r.locale??"en",i="function"==typeof e.description?e.description({data:a,config:n,locale:o}):void 0,s=i?.levels??function(e,t,r,a){const n=M(e,["nominal","ordinal"]),o=M(e,["quantitative"]),i=n?I(n,r,t):void 0,s=o?I(o,r,t):void 0,l=n?.role??i??"category",c=o?.role??s??"value",u=e.encodings??[],h=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:d,percent:p}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(a),f=new Map;if(i&&s)for(const e of t){const t=(e[i]??"Uncategorized")+"",r=Number(e[s]);Number.isFinite(r)&&f.set(t,(f.get(t)??0)+r)}const m=[...f].sort((e,t)=>t[1]-e[1]),g=m.reduce((e,[,t])=>e+t,0),y=m[0],b=m[1],C=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,$=e.intents.map(e=>({id:D(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,v=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${w=h,w?w.charAt(0).toUpperCase()+w.slice(1):w}.`,l2:m.length>0?`${m.length} categories total ${d.format(g)}. ${y[0]} accounts for ${d.format(y[1])}${g>0?` (${p.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${d.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>m.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>C?`The total is distributed across ${m.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${p.format(C)}.`,l4:`The chart is intended for ${$??"explanation"}${v?` with a ${v} audience`:""}: ${e.designContract.whyCustom}`};var w}(e,a,n,o),l=r.levels??["l1","l2","l3","l4"],c={};for(const e of l)s[e]&&(c[e]=s[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),h=r.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...h?.length?{caveats:h}:{}}}var de=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),pe=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),fe=new Set(["PieChart","DonutChart","FunnelChart"]),me=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function ge(e,t){return pe.has(e)||fe.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function ye(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const r=e[t];if("string"==typeof r&&r)return r}}function be(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}var Ce={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",UnitPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PacketFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",CrucibleChart:"crucible physics chart",PhysicsCustomChart:"custom physics chart"},$e=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),ve=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]);function we(e){return Ce[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function ke(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var Se=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),xe={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Ae={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Pe=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Le={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function Fe(e){return xe[e]}function Re(e,t){const r=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,r={};for(const[e,a]of Object.entries(t.intentScores))"number"==typeof a&&Number.isFinite(a)&&(r[e]=a);return{family:t.family,intentScores:Object.keys(r).length?r:void 0}}return e}}(t);if(r?.act)return r.act;if(r?.intentScores){const e=function(e){let t,r=0;for(const[a,n]of Object.entries(e))if("number"==typeof n&&n>0)if(n>r)t=a,r=n;else if(n===r&&void 0!==t){const e=Pe.indexOf(a),r=Pe.indexOf(t);-1===e||-1!==r&&e>=r||(t=a)}return t}(r.intentScores);if(e&&xe[e]&&(r.intentScores[e]??0)>=3)return xe[e]}return r?.family?Ae[r.family]:function(e){return fe.has(e)||"StackedAreaChart"===e?"apportioning":Se.has(e)?"relating":pe.has(e)?"comparing":me.has(e)?"characterizing":de.has(e)?"tracking":$e.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}var je=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),De=new Set(["system","agent","watcher"]),Be=new Set(["ai","agent","system","computed","dbt","great-expectations"]),Oe=new Set(["rule","statistical-test","llm-inference","computed"]);function Ne(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!je.has(t.type))return!1;const r=t.provenance;return!(!r||"object"!=typeof r)&&(De.has(r.authorKind)||Be.has(r.source)||Oe.has(r.basis))})}function Ie(e="en"){let t,r;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?r.format(e):t.format(e):e+""}var Te={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function Me(e){const t=Te["string"==typeof e.type?e.type:"annotation"]||"an annotation",r=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,r=t?.authorKind??t?.source??t?.basis;return"watcher"===r?"a watcher-flagged ":"agent"===r||"ai"===r||"llm-inference"===r?"an AI-suggested ":""}(e),a=r?r+t.replace(/^an? /,""):t,n="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return n?`${a} labeled "${n}"`:a}function Ee(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const r=a(t.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;const n=r.map(Me),o=n.slice(0,5),i=n.length-o.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(o)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":l+" features"} on this chart: ${s}.`}function Ge(e,a,n={}){const o=void 0!==n.levels,i=new Set(n.levels??["l1","l2","l3"]);o||!n.capability&&!Ne(a)||i.add("l4");const s=N(e,a,n.recipe);if(s){const e=["l1","l2","l3","l4"].filter(e=>i.has(e));o||e.includes("l4")||e.push("l4");const t=he(s,a,{levels:e,locale:n.locale,audience:n.audience,includeCaveats:n.includeCaveats}),r=Ee(a);return{...t,text:r?`${r} ${t.text}`.trim():t.text,...r?{annotations:r}:{}}}const l=Ie(n.locale??"en"),c=we(e),u=Array.isArray(a.data)?a.data:null,h=ye(a),d=ve.has(e)?function(e,t){const r=e.physics&&"object"==typeof e.physics?e.physics:null,a=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,n=[e.settledProjectionRows,e.projectionRows,a?.rows,r?.settledProjectionRows,r?.projectionRows,r?.settledProjection&&"object"==typeof r.settledProjection?r.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(n)?n.map((e,r)=>{if(!e||"object"!=typeof e)return null;const a=e,n=ke(a.count??a.value??a.total??a.bodies??a.events);if(null==n)return null;const o=a.label??a.id??a.name??"container "+(r+1),i=ke(a.secondary??a.secondaryCount),s=ke(a.observed??a.observedCount);return{label:be(o,t),count:n,...null!=i?{secondary:i}:{},..."string"==typeof a.secondaryLabel&&a.secondaryLabel?{secondaryLabel:a.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(a,l):null,{measure:p,measureFallback:f,dimension:m,dimensionFallback:g}=ge(e,a),y="string"==typeof p&&p?p:f,b="string"==typeof m&&m?m:g,C={};if(ve.has(e)&&function(e,t,r,a,n,o){const i=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}(e),s=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"body"}(e);if(n.has("l1")&&(a.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"UnitPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PacketFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":"CrucibleChart"===e?"A crucible physics chart that replays authored phases and events into declared products and outlets; the settled ledger, not collisions, determines the result.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!n.has("l2")&&!n.has("l3"))return;if(!r||0===r.length)return void(n.has("l2")&&(a.l2="No settled projection is loaded yet."));const l=r.reduce((e,t)=>e+t.count,0),c=r.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??r.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const h=r.reduce((e,t)=>e+(t.secondary??0),0),d=r.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(n.has("l2"))if(0===c.length)a.l2=`The settled projection contains ${o(l)} ${He(l,s)} across ${r.length} ${He(r.length,i)}; no ${He(2,i)} are non-empty yet.`;else{const e=h>0?` ${o(h)} ${He(h,s)} ${1===h?"is":"are"} marked ${d}.`:"";a.l2=`The settled projection contains ${o(l)} ${He(l,s)} across ${r.length} ${He(r.length,i)}; ${c.length} ${He(c.length,i)} ${1===c.length?"is":"are"} non-empty. The largest ${i} is ${u.label} with ${o(u.count)} ${He(u.count,s)}.${e}`}if(n.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const r=e/t*100;return(10>r?Math.round(10*r)/10:Math.round(r))+"%"}(u.count,l);a.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${o(u.count)} ${He(u.count,s)} (${t}); ${e.label} follows with ${o(e.count)} ${He(e.count,s)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${o(u.count)} ${He(u.count,s)}.`}}(e,c,d,C,i,l),i.has("l1")&&!ve.has(e))if(de.has(e)||pe.has(e))C.l1=`A ${c} of ${y} by ${b}`+(h?`, split by ${h}.`:".");else if(fe.has(e))C.l1=`A ${c} showing ${y} across ${b} categories.`;else if(me.has(e))C.l1=`A ${c} of the distribution of ${y}`+(h?` by ${h}.`:".");else if($e.has(e)){const e=Array.isArray(a.nodes)?a.nodes.length:void 0,t=Array.isArray(a.edges)?a.edges.length:void 0,r=[null!=e?`${e} ${He(e,"node")}`:null,null!=t?`${t} ${He(t,"edge")}`:null].filter(Boolean);C.l1=`A ${c}${r.length?" with "+r.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof a.label?a.label:y;C.l1=`A single value${e?" for "+e:""}.`}else C.l1=`A ${c}.`;const $=de.has(e)||pe.has(e)||fe.has(e)||me.has(e);let v=null;if((i.has("l2")||i.has("l3")||i.has("l4"))&&$&&u&&u.length>0&&(v=function(e,t,r,a){let n=0,o=0,i=1/0,s=-1/0,l=null,c=null,u=0,h=0,d=null,p=null,f=NaN,m=NaN;for(const r of e){const e=t(r);Number.isFinite(e)&&(0===n&&(f=e,d=r),m=e,p=r,i>e&&(i=e,l=r,u=n),e>s&&(s=e,c=r,h=n),n++,o+=e)}return 0===n?null:{count:n,min:i,max:s,mean:o/n,minLabel:be(null!=l?r(l):null,a),maxLabel:be(null!=c?r(c):null,a),first:f,last:m,firstLabel:be(null!=d?r(d):null,a),lastLabel:be(null!=p?r(p):null,a),minIndex:u,maxIndex:h}}(u,t(p,f),r(m,g),l)),i.has("l2")&&$&&(u&&0!==u.length?v&&(C.l2=fe.has(e)?`${v.count} segments totaling ${l(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${l(v.max)}; smallest is ${v.minLabel} at ${l(v.min)}.`:`${y} ranges from ${l(v.min)} (${v.minLabel}) to ${l(v.max)} (${v.maxLabel}), with a mean of ${l(v.mean)} across ${v.count} points.`):C.l2="No data is loaded yet."),i.has("l3")&&v&&!h&&de.has(e)?C.l3=function(e,t,r){const{first:a,last:n,min:o,max:i,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:h,maxIndex:d,count:p}=e,f=i-o,m=n-a;if(0===f)return`${Ue(t)} is constant at ${r(a)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${Ue(t)} ends roughly where it started (${r(a)} at ${c} to ${r(n)} at ${u}), ranging between ${r(o)} and ${r(i)}.`;const g=d>0&&p-1>d,y=h>0&&p-1>h,b=(i-Math.max(a,n))/f,C=(Math.min(a,n)-o)/f;return g&&b>.15?`Overall ${t} climbs to a peak of ${r(i)} (${s}), then falls to ${r(n)} (${u}).`:y&&C>.15?`Overall ${t} drops to a low of ${r(o)} (${l}), then recovers to ${r(n)} (${u}).`:.05>Math.abs(m)/f?`${Ue(t)} ends roughly where it started (${r(a)} at ${c} to ${r(n)} at ${u}), ranging between ${r(o)} and ${r(i)}.`:m>0?d===p-1?`Overall ${t} rises from ${r(a)} (${c}) to a peak of ${r(n)} (${u}).`:`Overall ${t} rises from ${r(a)} (${c}) to ${r(n)} (${u}), after peaking at ${r(i)} (${s}).`:h===p-1?`Overall ${t} falls from ${r(a)} (${c}) to a low of ${r(n)} (${u}).`:`Overall ${t} falls from ${r(a)} (${c}) to ${r(n)} (${u}), after dipping to ${r(o)} (${l}).`}(v,y,l):i.has("l3")&&v&&!h&&pe.has(e)&&(C.l3=`The highest ${b} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),i.has("l4")){const t=Ne(a)?"alerting":Re(e,n.capability);t&&(C.l4=function(e,t,r,a,n,o,i,s){const l=Le[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,h;switch(e){case"locating":u="This is a map",h="read values by location";break;case"presenting":u="This is a single-value display",h=`read ${"string"==typeof r.label&&r.label?r.label:n} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,h="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,h="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,h=`read it for whether ${o} and ${n} move together`;break;default:u=`This is ${c} ${l} chart`,h=function(e,t,r,a,n,o){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+r;case"comparing":return`compare ${r} across ${a}`;case"ranking":return"read it top to bottom by "+r;case"apportioning":return`read each ${a}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+r;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,r){if(pe.has(r)||fe.has(r))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:a,last:n,min:o,max:i,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:h,count:d}=e,p=i-o;if(p>0){const e=h>0&&d-1>h,r=u>0&&d-1>u,f=(i-Math.max(a,n))/p,m=(Math.min(a,n)-o)/p;if(e&&f>.15)return`the peak of ${t(i)} at ${l} is the point to investigate`;if(r&&m>.15)return`the dip to ${t(o)} at ${s} is the point to investigate`;if(n>=i)return`the climb to ${t(n)} at ${c} warrants a closer look`;if(o>=n)return`the drop to ${t(n)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(i)}) and ${s} (${t(o)}) — are the points to check`}(t,n,o);case"tracking":return`read it for the trajectory of ${r}, which ${function(e){const t=e.max-e.min,r=e.last-e.first;return 0===t||.05>Math.abs(r)/t?"holds roughly steady":r>0?"rises":"falls"}(t)} from ${n(t.first)} (${t.firstLabel}) to ${n(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${r} across ${a}; ${t.maxLabel} leads at ${n(t.max)}`;case"ranking":return`read it top to bottom by ${r}; ${t.maxLabel} ranks highest at ${n(t.max)}`;case"apportioning":{const e=t.mean*t.count,r=e>0?Math.round(t.max/e*100):null;return`read each ${a}'s share of the ${n(e)} total; ${t.maxLabel} is the largest at ${n(t.max)}${null!=r?` (${r}%)`:""}`}case"characterizing":return`read it for the spread of ${r}, from ${n(t.min)} to ${n(t.max)}`;default:return"read the highlighted features"}}(e,a,n,o,i,t)}return`${u}; ${h}.${function(e,t){if(!t)return"";const r=t.familiarity?.[e];return"number"!=typeof r||r>2?"":` This ${we(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(t,e,a,h?null:v,y,b,l,n.audience))}const w=["l1","l2","l3","l4"].filter(e=>i.has(e)&&C[e]).map(e=>C[e]).join(" "),k=Ee(a);return{text:k?`${k} ${w}`.trim():w,levels:C,...k?{annotations:k}:{}}}function Ue(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function He(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function qe(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function ze(e,t,r={}){const a=O(t),n=B(t),o=Math.max(1,r.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:a,config:n,locale:r.locale??"en"});const i=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(i?.groupByRole?T(e,i.groupByRole):void 0)??(i?.groupBy?.[0]?T(e,i.groupBy[0])??e.dataRoles.find(e=>e.field===i.groupBy?.[0]):void 0)??M(e,["nominal","ordinal"]),c=l?I(l,n,a):void 0,u=(i?.idRole?T(e,i.idRole):void 0)??M(e,["identifier"]),h=u?I(u,n,a):void 0,d={id:"root",role:"chart",label:i?.summaryTemplate?E(i.summaryTemplate,void 0,e,n,a,{count:a.length}):`${e.name}: ${a.length} ${1===a.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const f=(t,r,o)=>{const s=h?t[h]:void 0,l=i?.itemLabelTemplate?E(i.itemLabelTemplate,t,e,n,a,{count:a.length}):function(e,t,r,a){const n=M(t,["nominal","ordinal"]),o=t.dataRoles.filter(e=>"quantitative"===e.semanticType),i=n?I(n,r,a):void 0,s=[];i&&null!=e[i]&&s.push(e[i]+"");for(const t of o){const n=I(t,r,a);n&&null!=e[n]&&s.push(`${t.role}: ${e[n]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,n,a);return{id:"datum-"+qe(s??r),role:"datum",label:l,level:o,datum:t}};if(c){const e=new Map;for(const t of a){const r=(t[c]??"Uncategorized")+"",a=e.get(r);a?a.push(t):e.set(r,[t])}d.children=[...e].map(([e,t],r)=>{const a=t.slice(0,Math.max(0,o-p));p+=a.length;const n=a.map((e,t)=>f(e,1e5*r+t,3));return t.length>a.length&&n.push({id:"more-"+qe(e),role:"datum",label:`…and ${t.length-a.length} more items`,level:3}),{id:"group-"+qe(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:n}})}else{const e=a.slice(0,o);d.children=e.map((e,t)=>f(e,t,2)),a.length>e.length&&d.children.push({id:"more",role:"datum",label:`…and ${a.length-e.length} more items`,level:2})}return d}function Ve(e,n,o={}){const i=o.locale??"en",s=Math.max(1,o.maxLeaves??200),l=Ie(i),c=N(e,n,o.recipe);if(c)return ze(c,n,{maxLeaves:s,locale:i});const u={id:"root",role:"chart",label:Ge(e,n,{locale:i}).text||"Chart.",level:1,children:[]},h=function(e,t){const r=Array.isArray(e.annotations)?e.annotations:null;if(!r)return null;const n=a(r.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let o=0;const i=n.slice(0,t).map(e=>{const t=e.lifecycle?.status,r=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+o++,role:"annotation",level:3,label:`${a=Me(e),a?a.charAt(0).toUpperCase()+a.slice(1):a}${r}.`,datum:e};var a});n.length>t&&i.push({id:"annotation-"+o++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const s=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(n,s),d=Array.isArray(n.data)?n.data:null,p=de.has(e)||pe.has(e)||fe.has(e)||me.has(e);if(!d||0===d.length||!p)return h&&(u.children=[h]),u;const{measure:f,measureFallback:m,dimension:g,dimensionFallback:y}=ge(e,n),b=t(f,m),C=r(g,y),$="string"==typeof f&&f?f:m,v="string"==typeof g&&g?g:y,w=ye(n);let k=0;const S=e=>`${e}-${k++}`,x=(e,t)=>{const r=e.slice(0,s).map(e=>((e,t)=>{const r=b(e),a=be(C(e),l);return{id:S("datum"),role:"datum",level:t,label:`${a}: ${Number.isFinite(r)?l(r):"—"}`,value:Number.isFinite(r)?r:void 0,datum:e}})(e,t));return e.length>s&&r.push({id:S("more"),role:"datum",level:t,label:`…and ${e.length-s} more points`}),r},A=[];if(de.has(e)||pe.has(e)){let t=1/0,r=-1/0,a=1/0,n=-1/0;const o=[];let i=!0;for(const e of d){const s=b(e);Number.isFinite(s)&&(t>s&&(t=s),s>r&&(r=s));const l=C(e);o.push(l),"number"==typeof l&&Number.isFinite(l)?(a>l&&(a=l),l>n&&(n=l)):i=!1}const s=new Set,c=[];for(const e of o){const t=e+"";s.has(t)||(s.add(t),c.push(e))}const u=i?`${l(a)} to ${l(n)}`:`${be(c[0],l)} to ${be(c[c.length-1],l)} (${pe.has(e)?c.length+" categories":d.length+" points"})`;A.push({id:S("axis"),role:"axis",level:2,label:`${pe.has(e)?"Category axis":"X axis"}: ${v}, ${u}.`}),t>r||A.push({id:S("axis"),role:"axis",level:2,label:`Value axis: ${$}, ${l(t)} to ${l(r)}.`})}if(w){const t=r(w,w),a=new Map;for(const e of d){const r=(t(e)??"—")+"",n=a.get(r);n?n.push(e):a.set(r,[e])}const o=[];for(const[t,r]of a){const a=Ge(e,{...n,data:r},{levels:["l2","l3"],locale:i}).text;o.push({id:S("series"),role:"series",level:2,label:`Series ${t}: ${a}`,children:x(r,3)})}u.children=[...A,...o]}else u.children=[...A,...x(d,2)];return h&&u.children.push(h),u}function _e(e,t){const r=[],a=e=>{if(r.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)a(t)};return a(e),r}function Je(e){let t=1;if(e.children)for(const r of e.children)t+=Je(r);return t}var Ke=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Qe=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),We=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Xe=new Set(["LineChart","AreaChart","StackedAreaChart"]),Ye=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]),Ze=new Set(["LineChart","AreaChart","StackedAreaChart","ConnectedScatterplot"]),et=new Set(["PieChart","DonutChart"]),tt={PieChart:"valueAccessor",DonutChart:"valueAccessor",FunnelChart:"valueAccessor"},rt=new Set(Object.keys(tt)),at={StackedBarChart:"valueAccessor",StackedAreaChart:"yAccessor"},nt=new Set(["BigNumber"]),ot=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart"]),it=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),st=new Set(["StreamPhysicsFrame","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]),lt=new Set(["OrbitDiagram",...st]),ct=new Set(["GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart"]),ut=new Set(["GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]),ht=new Set(["RealtimeLineChart","RealtimeHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","ProcessSankey"]),dt=new Set(["MultiAxisLineChart"]),pt=new Set(["ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram"]),ft={Scatterplot:"pointRadius",BubbleChart:"pointRadius",ConnectedScatterplot:"pointRadius",QuadrantChart:"pointRadius",SwarmPlot:"pointRadius",DotPlot:"dotRadius"};export{o as defineChartRecipe,i as validateChartRecipe,s as isRegisteredRecipeLayout,l as isJsonSafe,m as resolveRecipeRoleField,g as recipeToChartCapability,C as registerChartRecipe,$ as unregisterChartRecipe,v as getChartRecipe,w as listChartRecipes,k as getRegisteredRecipeCapabilities,S as hasRegisteredRecipeCapabilities,x as registerRecipeLayout,A as unregisterRecipeLayout,P as getRecipeLayout,L as resolveChartRecipe,D as recipeIntentId,B as recipeConfig,I as fieldForRole,V as toConfig,_ as fromConfig,J as toURL,K as fromURL,Q as copyConfig,W as configToJSX,X as serializeSelections,Y as deserializeSelections,ae as unwrapIDIDEnrichedVegaLiteSpec,se as fromVegaLite,le as fromVegaLiteResult,he as describeRecipeChart,Fe as communicativeActForIntent,Re as resolveCommunicativeAct,Ge as describeChart,ze as buildRecipeNavigationTree,Ve as buildNavigationTree,_e as flattenVisible,Je as countNodes,Ke as HIERARCHY_CHARTS,Qe as NETWORK_CHARTS,We as BAR_AREA_CHARTS,Xe as TREND_SERIES_CHARTS,Ye as ORDINAL_BAR_CHARTS,Ze as CURVE_CHARTS,et as PIE_CHARTS,tt as PART_TO_WHOLE_ACCESSORS,rt as PART_TO_WHOLE_CHARTS,at as NORMALIZED_STACK_ACCESSORS,nt as VALUE_CHARTS,ot as XY_WITH_AXES_CHARTS,it as ORDINAL_CHARTS,st as PHYSICS_MOTION_CHARTS,lt as CONTINUOUS_MOTION_CHARTS,ct as PHYSICS_SETTLED_CHARTS,ut as PHYSICS_DIAGNOSTIC_CHARTS,ht as REALTIME_CHARTS,dt as DUAL_AXIS_CHARTS,pt as GEO_CHARTS,ft as POINT_TARGET_RADIUS_PROP};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{buildLinearFillGradient as t,buildThresholdLineSegments as e,resolveCSSColor as l,resolveCanvasFill as o,resolveCurveFactory as n}from"./chunk-chunk-
|
|
2
|
+
import{buildLinearFillGradient as t,buildThresholdLineSegments as e,resolveCSSColor as l,resolveCanvasFill as o,resolveCurveFactory as n}from"./chunk-chunk-SK2TQMG4.module.min.js";import{line as a}from"d3-shape";function i(t,e,l,o,n,a){if(2>e.length)return;const i=[0];for(let t=1;e.length>t;t++){const l=e[t][0]-e[t-1][0],o=e[t][1]-e[t-1][1];i.push(i[t-1]+Math.sqrt(l*l+o*o))}const h=i[i.length-1];if(0===h)return;const s=Math.min(.2*h,40);t.strokeStyle=l,t.lineWidth=o,t.lineCap=a;for(let l=0;e.length-1>l;l++){const o=(i[l]+i[l+1])/2;let a=n;s>o&&(a*=o/s),s>h-o&&(a*=(h-o)/s),t.globalAlpha=Math.max(0,a),t.beginPath(),t.moveTo(e[l][0],e[l][1]),t.lineTo(e[l+1][0],e[l+1][1]),t.stroke()}}var h=(h,s,r,p)=>{const c=s.filter(t=>"line"===t.type);for(const s of c){if(2>s.path.length)continue;const r=s._introClipFraction;void 0!==r&&1>r&&(h.save(),h.beginPath(),h.rect(0,0,p.width*r,p.height),h.clip());const c=s.style.stroke||"#007bff",f=l(h,c)||c,y=s.style.strokeWidth||2,g=s.colorThresholds,u=s.rawValues;if(h.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(h.globalAlpha=s.style.opacity),h.lineWidth=y,h.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){i(h,s.path,f,y,s.style.opacity??1,s.style.strokeLinecap||"butt"),h.globalAlpha=1,h.setLineDash([]),h.lineCap="butt";continue}const k=n(s.curve),b=g&&g.length>0&&u&&u.length===s.path.length,d=s._decayOpacities;if(d&&d.length===s.path.length&&!b){h.strokeStyle=f;const t=s.style.opacity??1;for(let e=0;s.path.length-1>e;e++)h.globalAlpha=.5*(d[e]+d[e+1])*t,h.beginPath(),h.moveTo(s.path[e][0],s.path[e][1]),h.lineTo(s.path[e+1][0],s.path[e+1][1]),h.stroke()}else if(b){const t=e(s.path,u,g,f);for(const e of t){h.beginPath(),h.strokeStyle=l(h,e.color)||e.color,h.moveTo(e.path[0][0],e.path[0][1]);for(let t=1;e.path.length>t;t++)h.lineTo(e.path[t][0],e.path[t][1]);h.stroke()}}else{h.beginPath();const e=s.strokeGradient&&s.path.length>=2?t(h,s.strokeGradient,f,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(h.strokeStyle=e||f,k)a().x(t=>t[0]).y(t=>t[1]).curve(k).context(h)(s.path);else{const[t,e]=s.path[0];h.moveTo(t,e);for(let t=1;s.path.length>t;t++)h.lineTo(s.path[t][0],s.path[t][1])}h.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(h.beginPath(),h.globalAlpha=s.style.fillOpacity,h.fillStyle=o(h,s.style.fill,s.style.fill),k&&!b)a().x(t=>t[0]).y(t=>t[1]).curve(k).context(h)(s.path);else{const[t,e]=s.path[0];h.moveTo(t,e);for(let t=1;s.path.length>t;t++)h.lineTo(s.path[t][0],s.path[t][1])}const t=s.path[0][0];h.lineTo(s.path[s.path.length-1][0],p.height),h.lineTo(t,p.height),h.closePath(),h.fill()}void 0!==r&&1>r&&h.restore(),h.globalAlpha=1,h.setLineDash([]),h.lineCap="butt"}};function s(t){if(!t)return null;if("heatcell"===t.type)return t.fill||null;if("candlestick"===t.type)return t.isUp?t.upColor:t.downColor;const{style:e}=t;if(!e)return null;const l="string"==typeof e.fill?e.fill:null;return"line"===t.type||"area"===t.type?e.stroke||l||null:l||e.stroke||null}export{h as lineCanvasRenderer,s as resolveNodeColor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{bandFromAge as e}from"./chunk-chunk-
|
|
2
|
+
import{bandFromAge as e}from"./chunk-chunk-SK2TQMG4.module.min.js";function n(e,n){const t={...e};return n.provenance&&(t.provenance=n.provenance),n.lifecycle&&(t.lifecycle=n.lifecycle),t}function t(){return(new Date).toISOString()}function r(e,n={}){const r=e.provenance;return{...e,provenance:{...r,...n,createdAt:n.createdAt??r?.createdAt??t()}}}function c(e){if(null==e)return null;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();const n=Date.parse(e);return Number.isFinite(n)?n:null}function l(e){const n=c(e?.now);if(null!=n)return n;const t=e?.dataExtent;if(t)if(Array.isArray(t)){const e=c(t[t.length-1]);if(null!=e)return e}else if("max"in t){const e=c(t.max);if(null!=e)return e}return Date.now()}function o(n,t,r={}){const l=n?.lifecycle?.freshness,o=c(n?.provenance?.createdAt),s=function(e){if(null==e)return null;if("number"==typeof e)return e;const n=function(e){const n=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/.exec(e);return n?1e3*(3600*(24*parseInt(n[1]||"0",10)+parseInt(n[2]||"0",10))+60*parseInt(n[3]||"0",10)+parseInt(n[4]||"0",10)):0}(e);return n>0?n:null}(n?.lifecycle?.ttlHint);return null==o||null==s?l??"fresh":e(t-o,s,r)}function s(e,n={}){const t=l(n);return e.map(e=>{const r=o(e,t,n.thresholds);return{...e,lifecycle:{...e.lifecycle,freshness:r}}})}var a={fresh:null,aging:.55,stale:.35,expired:.2},u={fresh:null,aging:null,stale:"4 4",expired:"2 4"};function i(e,n,t){return e&&t in e?e[t]:n[t]}function f(e,n={}){const t=l(n),r=!0===n.showExpiredAnnotations,c=[];for(const l of e){const e=o(l,t,n.thresholds);if("expired"===e&&!r)continue;const s=i(n.opacity,a,e),f=i(n.strokeDasharray,u,e),p=n.labelSuffix?.[e],d={...l,lifecycle:{...l.lifecycle,freshness:e}};null!=s&&null==d.opacity&&(d.opacity=s),null!=f&&null==d.strokeDasharray&&(d.strokeDasharray=f),p&&"string"==typeof d.label&&(d.label=d.label+p);const y=l.lifecycle?.anchor;y&&null==d.anchor&&(d.anchor=y),c.push(d)}return c}var p={proposed:.7,accepted:null,disputed:.7,retracted:.25},d={proposed:"3 3",accepted:null,disputed:"2 3",retracted:"2 4"},y={proposed:" (proposed)",accepted:"",disputed:" (?)",retracted:""};function h(e,n,t){return e&&t in e?e[t]:n[t]}function b(e,n={}){const t=!0===n.showRetractedAnnotations,r=!0===n.showSupersededAnnotations,c=new Set;for(const n of e){const e=n?.lifecycle?.supersedes;e&&"retracted"!==n?.lifecycle?.status&&c.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!t)return!1;const n=e?.provenance?.stableId;return!(n&&c.has(n)&&!r)})}function m(e,n={}){const t=[];for(const r of b(e,n)){const e=r?.lifecycle?.status;if(!e){t.push(r);continue}const c=h(n.opacity,p,e),l=h(n.strokeDasharray,d,e),o=n.labelSuffix?.[e]??y[e],s={...r};null!=c&&(s.opacity=("number"==typeof s.opacity?s.opacity:1)*c),null!=l&&null==s.strokeDasharray&&(s.strokeDasharray=l),o&&"string"==typeof s.label&&(s.label=s.label+o),t.push(s)}return t}export{n as withProvenance,t as currentTimestamp,r as withCurrentProvenance,o as annotationFreshnessFor,s as computeAnnotationFreshness,f as applyAnnotationLifecycle,b as filterAnnotationsByStatus,m as applyAnnotationStatus};
|
|
@@ -132,15 +132,68 @@ export declare function Tooltip(config?: TooltipConfig): (data: Record<string, u
|
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
134
|
export declare function MultiLineTooltip(config?: MultiLineTooltipConfig): (data: Record<string, unknown>) => React.JSX.Element | null;
|
|
135
|
+
/**
|
|
136
|
+
* First-class multi-series tooltip: enable hover-anywhere multi mode and
|
|
137
|
+
* optionally supply a custom renderer that receives the unwrapped datum
|
|
138
|
+
* with `allSeries` / `xValue` re-attached.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* // Built-in multi renderer
|
|
143
|
+
* <LineChart tooltip="multi" />
|
|
144
|
+
* <LineChart tooltip={{ mode: "multi" }} />
|
|
145
|
+
*
|
|
146
|
+
* // Custom multi renderer (no frameProps.tooltipMode needed)
|
|
147
|
+
* <LineChart
|
|
148
|
+
* tooltip={{
|
|
149
|
+
* mode: "multi",
|
|
150
|
+
* content: (d) => <MyRows series={d.allSeries} x={d.xValue} />,
|
|
151
|
+
* }}
|
|
152
|
+
* />
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
export interface MultiTooltipConfig {
|
|
156
|
+
mode: "multi";
|
|
157
|
+
/**
|
|
158
|
+
* Custom renderer. Receives the raw hover datum with multi-series
|
|
159
|
+
* context (`allSeries`, `xValue`) re-attached after unwrap. When
|
|
160
|
+
* omitted, the built-in multi-series renderer is used.
|
|
161
|
+
*/
|
|
162
|
+
content?: (data: Record<string, unknown>) => React.ReactNode;
|
|
163
|
+
}
|
|
135
164
|
/**
|
|
136
165
|
* Type for tooltip prop that chart components accept
|
|
137
166
|
*/
|
|
138
|
-
export type TooltipProp = boolean | "multi" | ((data: Record<string, unknown>) => React.ReactNode) | ReturnType<typeof Tooltip> | ReturnType<typeof MultiLineTooltip> | TooltipConfig;
|
|
167
|
+
export type TooltipProp = boolean | "multi" | MultiTooltipConfig | ((data: Record<string, unknown>) => React.ReactNode) | ReturnType<typeof Tooltip> | ReturnType<typeof MultiLineTooltip> | TooltipConfig;
|
|
139
168
|
/**
|
|
140
169
|
* The function signature that Stream Frames expect for tooltipContent.
|
|
141
170
|
* Compatible with HoverData and any Record-based hover object.
|
|
142
171
|
*/
|
|
143
172
|
export type TooltipContentFn = (d: Datum) => React.ReactNode;
|
|
173
|
+
/** True when the tooltip prop requests multi-series / hover-anywhere mode. */
|
|
174
|
+
export declare function isMultiTooltip(tooltip: TooltipProp | undefined): boolean;
|
|
175
|
+
export declare function isMultiTooltipConfig(tooltip: TooltipProp | undefined): tooltip is MultiTooltipConfig;
|
|
176
|
+
/**
|
|
177
|
+
* Resolve tooltip content + optional `tooltipMode: "multi"` for charts that
|
|
178
|
+
* support multi-series hover (LineChart, AreaChart, StackedAreaChart, …).
|
|
179
|
+
*
|
|
180
|
+
* Handles `tooltip="multi"`, `tooltip={{ mode: "multi", content? }}`, custom
|
|
181
|
+
* functions, config objects, and `false`/`true`/undefined the same way as
|
|
182
|
+
* the previous per-chart branches.
|
|
183
|
+
*
|
|
184
|
+
* Content functions are typed loosely (`Datum`) so chart-specific defaults
|
|
185
|
+
* that accept `HoverData` (a Datum subtype at runtime) still type-check when
|
|
186
|
+
* spread onto Stream frame props.
|
|
187
|
+
*/
|
|
188
|
+
export declare function resolveMultiCapableTooltip(input: {
|
|
189
|
+
tooltip: TooltipProp | undefined;
|
|
190
|
+
defaultTooltipContent: (d: any) => React.ReactNode;
|
|
191
|
+
/** Used when multi mode is on and no custom content was provided. */
|
|
192
|
+
multiDefaultContent?: (d: any) => React.ReactNode;
|
|
193
|
+
}): {
|
|
194
|
+
tooltipContent: (d: any) => React.ReactNode;
|
|
195
|
+
tooltipMode?: "multi";
|
|
196
|
+
};
|
|
144
197
|
/**
|
|
145
198
|
* Multi-point tooltip: shows all series values at the hovered X position
|
|
146
199
|
* with color swatches (legend-style). Used when tooltipMode="multi".
|
|
@@ -160,7 +160,7 @@ export declare function resolvePhysicsTooltipProps(tooltip: TooltipProp | undefi
|
|
|
160
160
|
* click, chrome (title/legend/annotations), primitive styling, emphasis.
|
|
161
161
|
* Prefer HOC props; frameProps fill gaps.
|
|
162
162
|
*/
|
|
163
|
-
export declare function resolvePhysicsFrameSharedProps(props: Pick<BaseChartProps, "accessibleTable" | "chartId" | "className" | "color" | "description" | "emphasis" | "hoverRadius" | "onClick" | "onObservation" | "opacity" | "stroke" | "strokeWidth" | "summary" | "title"> & {
|
|
163
|
+
export declare function resolvePhysicsFrameSharedProps(props: Pick<BaseChartProps, "accessibleTable" | "chartId" | "className" | "color" | "description" | "emphasis" | "hoverRadius" | "maxDevicePixelRatio" | "onClick" | "onObservation" | "opacity" | "stroke" | "strokeWidth" | "summary" | "title"> & {
|
|
164
164
|
annotations?: StreamPhysicsFrameProps["annotations"];
|
|
165
165
|
autoPlaceAnnotations?: StreamPhysicsFrameProps["autoPlaceAnnotations"];
|
|
166
166
|
background?: StreamPhysicsFrameProps["background"];
|
|
@@ -24,6 +24,8 @@ export interface RealtimeHeatmapProps<TDatum extends Datum = Datum> {
|
|
|
24
24
|
width?: number;
|
|
25
25
|
/** Chart height (alternative to size) */
|
|
26
26
|
height?: number;
|
|
27
|
+
/** Maximum canvas backing-store DPR; defaults to the environment cap. */
|
|
28
|
+
maxDevicePixelRatio?: number;
|
|
27
29
|
/** Chart margins */
|
|
28
30
|
margin?: {
|
|
29
31
|
top?: number;
|
|
@@ -29,6 +29,8 @@ export interface RealtimeHistogramProps<TDatum extends Datum = Datum> {
|
|
|
29
29
|
width?: number;
|
|
30
30
|
/** Chart height (alternative to size) */
|
|
31
31
|
height?: number;
|
|
32
|
+
/** Maximum canvas backing-store DPR; defaults to the environment cap. */
|
|
33
|
+
maxDevicePixelRatio?: number;
|
|
32
34
|
/** Chart margins */
|
|
33
35
|
margin?: PartialMargin;
|
|
34
36
|
/** CSS class name */
|
|
@@ -26,6 +26,8 @@ export interface RealtimeLineChartProps<TDatum extends Datum = Datum> {
|
|
|
26
26
|
width?: number;
|
|
27
27
|
/** Chart height (alternative to size) */
|
|
28
28
|
height?: number;
|
|
29
|
+
/** Maximum canvas backing-store DPR; defaults to the environment cap. */
|
|
30
|
+
maxDevicePixelRatio?: number;
|
|
29
31
|
/** Chart margins */
|
|
30
32
|
margin?: {
|
|
31
33
|
top?: number;
|
|
@@ -24,6 +24,8 @@ export interface RealtimeSwarmChartProps<TDatum extends Datum = Datum> {
|
|
|
24
24
|
width?: number;
|
|
25
25
|
/** Chart height (alternative to size) */
|
|
26
26
|
height?: number;
|
|
27
|
+
/** Maximum canvas backing-store DPR; defaults to the environment cap. */
|
|
28
|
+
maxDevicePixelRatio?: number;
|
|
27
29
|
/** Chart margins */
|
|
28
30
|
margin?: {
|
|
29
31
|
top?: number;
|
|
@@ -24,6 +24,8 @@ export interface RealtimeWaterfallChartProps<TDatum extends Datum = Datum> {
|
|
|
24
24
|
width?: number;
|
|
25
25
|
/** Chart height (alternative to size) */
|
|
26
26
|
height?: number;
|
|
27
|
+
/** Maximum canvas backing-store DPR; defaults to the environment cap. */
|
|
28
|
+
maxDevicePixelRatio?: number;
|
|
27
29
|
/** Chart margins */
|
|
28
30
|
margin?: {
|
|
29
31
|
top?: number;
|
|
@@ -86,13 +86,41 @@ export declare function formatLargeNumber(value: number, decimals?: number): str
|
|
|
86
86
|
* Used as the default axis tickFormat when no explicit format is provided.
|
|
87
87
|
*/
|
|
88
88
|
export declare function smartTickFormat(value: string | number | Date | null | undefined): string;
|
|
89
|
-
type TimeGranularity = "seconds" | "minutes" | "hours" | "days" | "months" | "years";
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
89
|
+
export type TimeGranularity = "seconds" | "minutes" | "hours" | "days" | "months" | "years";
|
|
90
|
+
/**
|
|
91
|
+
* Options for {@link adaptiveTimeTicks}.
|
|
92
|
+
*
|
|
93
|
+
* Timezone resolution (first match wins):
|
|
94
|
+
* 1. `timeZone: "UTC" | "local" | IANA id` (e.g. `"America/Los_Angeles"`)
|
|
95
|
+
* 2. legacy `utc: false` → local wall clock
|
|
96
|
+
* 3. default → UTC (deterministic SSR)
|
|
97
|
+
*/
|
|
93
98
|
export interface AdaptiveTimeTickOptions {
|
|
99
|
+
/**
|
|
100
|
+
* Prefer {@link AdaptiveTimeTickOptions.timeZone}. When `timeZone` is
|
|
101
|
+
* omitted, `utc: false` formats in the runtime's local timezone; the
|
|
102
|
+
* default `utc: true` keeps UTC for deterministic SSR.
|
|
103
|
+
*/
|
|
94
104
|
utc?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Timezone for label formatting and calendar-boundary detection.
|
|
107
|
+
* - `"UTC"` — UTC getters (same as the default)
|
|
108
|
+
* - `"local"` — runtime local zone
|
|
109
|
+
* - IANA id (e.g. `"America/New_York"`, `"Europe/Berlin"`) — via `Intl`
|
|
110
|
+
*/
|
|
111
|
+
timeZone?: "UTC" | "local" | (string & {});
|
|
95
112
|
}
|
|
113
|
+
/** Resolved zone used by the formatter. `"iana"` carries an IANA id. */
|
|
114
|
+
type ZoneMode = {
|
|
115
|
+
kind: "utc";
|
|
116
|
+
} | {
|
|
117
|
+
kind: "local";
|
|
118
|
+
} | {
|
|
119
|
+
kind: "iana";
|
|
120
|
+
id: string;
|
|
121
|
+
};
|
|
122
|
+
/** Resolve timezone options. `timeZone` wins over the legacy `utc` flag. */
|
|
123
|
+
export declare function resolveAdaptiveTimeZone(options?: AdaptiveTimeTickOptions): ZoneMode;
|
|
96
124
|
/**
|
|
97
125
|
* Creates a hierarchical time axis formatter.
|
|
98
126
|
*
|
|
@@ -106,21 +134,24 @@ export interface AdaptiveTimeTickOptions {
|
|
|
106
134
|
*
|
|
107
135
|
* @param granularity - Optional explicit granularity. If omitted,
|
|
108
136
|
* auto-detected from the tick spacing on first call.
|
|
109
|
-
* @param options -
|
|
110
|
-
* UTC for
|
|
137
|
+
* @param options - Timezone: `timeZone: "local" | "UTC" | IANA`, or legacy
|
|
138
|
+
* `utc: false` for local. Default is UTC for deterministic SSR.
|
|
111
139
|
*
|
|
112
140
|
* @example
|
|
113
141
|
* ```tsx
|
|
114
142
|
* import { adaptiveTimeTicks } from "semiotic"
|
|
115
143
|
*
|
|
116
|
-
* // Auto-detect granularity from the data
|
|
144
|
+
* // Auto-detect granularity from the data (UTC labels)
|
|
117
145
|
* <LineChart data={ts} xFormat={adaptiveTimeTicks()} />
|
|
118
146
|
*
|
|
119
147
|
* // Explicit granularity
|
|
120
148
|
* <LineChart data={ts} xFormat={adaptiveTimeTicks("minutes")} />
|
|
121
149
|
*
|
|
122
|
-
* //
|
|
123
|
-
* <LineChart data={ts} xFormat={adaptiveTimeTicks("minutes", {
|
|
150
|
+
* // Viewer local wall-clock time
|
|
151
|
+
* <LineChart data={ts} xFormat={adaptiveTimeTicks("minutes", { timeZone: "local" })} />
|
|
152
|
+
*
|
|
153
|
+
* // Explicit IANA zone (dashboard pinned to a product region)
|
|
154
|
+
* <LineChart data={ts} xFormat={adaptiveTimeTicks("minutes", { timeZone: "America/Los_Angeles" })} />
|
|
124
155
|
* ```
|
|
125
156
|
*/
|
|
126
157
|
export declare function adaptiveTimeTicks(granularity?: TimeGranularity, options?: AdaptiveTimeTickOptions): (value: string | number | Date, index?: number, allTicks?: number[]) => string;
|
|
@@ -44,6 +44,7 @@ export interface BaseMetadataProps {
|
|
|
44
44
|
accessibleTable?: boolean;
|
|
45
45
|
className?: string;
|
|
46
46
|
animate?: AnimateProp;
|
|
47
|
+
maxDevicePixelRatio?: number;
|
|
47
48
|
/** Strictly speaking not "metadata" — but the spread-when-defined
|
|
48
49
|
* pattern is identical, and every XY/ordinal HOC needs to forward
|
|
49
50
|
* this to the frame. Bundling it here avoids a parallel helper
|
|
@@ -114,6 +114,12 @@ export interface BaseChartProps {
|
|
|
114
114
|
responsiveWidth?: boolean;
|
|
115
115
|
/** Auto-match height to parent container (requires parent with explicit height). Default: false */
|
|
116
116
|
responsiveHeight?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Maximum canvas backing-store pixel ratio. Defaults to 3 on desktop and 2
|
|
119
|
+
* on coarse-pointer/small-screen devices. Canvas chart families repaint
|
|
120
|
+
* automatically when browser zoom or display density changes.
|
|
121
|
+
*/
|
|
122
|
+
maxDevicePixelRatio?: number;
|
|
117
123
|
/** Semantic responsive transformations keyed by measured chart slot, not CSS alone. */
|
|
118
124
|
responsiveRules?: ResponsiveRule[];
|
|
119
125
|
/** Phone/mobile contract consumed by audits, recipes, adapters, and agents. */
|
|
@@ -188,7 +194,8 @@ export interface BaseChartProps {
|
|
|
188
194
|
* Useful when a fixed scale (gauge, score band, KPI dial) needs
|
|
189
195
|
* endpoints to read as the actual boundaries.
|
|
190
196
|
*
|
|
191
|
-
*
|
|
197
|
+
* `frameProps.axes[i].extent` can override this independently for an XY
|
|
198
|
+
* axis. Applies to:
|
|
192
199
|
* - XY charts: both x and y axes (linear, time, log).
|
|
193
200
|
* - Ordinal charts: the value (r) axis only — the categorical
|
|
194
201
|
* axis is a band scale and doesn't have a numeric tick set.
|
|
@@ -11,6 +11,7 @@ export { LIGHT_THEME, DARK_THEME, HIGH_CONTRAST_THEME, COLOR_BLIND_SAFE_CATEGORI
|
|
|
11
11
|
export { themeToCSS, themeToTokens, resolveThemePreset, THEME_PRESETS, CARBON_CATEGORICAL_14, CARBON_ALERT, } from "./semiotic-themes";
|
|
12
12
|
export type { ThemePresetName } from "./semiotic-themes";
|
|
13
13
|
export { adaptiveTimeTicks, smartTickFormat } from "./charts/shared/formatUtils";
|
|
14
|
+
export type { AdaptiveTimeTickOptions, TimeGranularity } from "./charts/shared/formatUtils";
|
|
14
15
|
export { darkenColor, lightenColor } from "./charts/shared/colorManipulation";
|
|
15
16
|
export { createHatchPattern } from "./charts/shared/hatchPattern";
|
|
16
17
|
export type { HatchPatternOptions } from "./charts/shared/hatchPattern";
|