semiotic 3.13.0 → 3.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -41
- package/ai/artifact-surface-inventory.json +1 -1
- package/ai/dist/mcp-server.js +132 -106
- package/ai/reference.md +12 -4
- package/ai/schema.json +16 -2
- package/ai/surface-manifest.json +1 -1
- package/ai/task-packets/compare-category-totals.json +5 -5
- package/ai/task-packets/compare-category-totals.md +2 -2
- package/ai/task-packets/correct-published-chart.json +5 -5
- package/ai/task-packets/correct-published-chart.md +2 -2
- package/ai/task-packets/index.json +6 -6
- package/ai/task-packets/update-live-chart.json +5 -5
- package/ai/task-packets/update-live-chart.md +2 -2
- package/dist/{c-CRKR5M42.min.js → c-2M2OPWVA.min.js} +37 -37
- package/dist/c-3GIPT46Z.min.js +1 -0
- package/dist/c-3UXQGCQT.min.js +1 -0
- package/dist/{c-MHNU6KYQ.min.js → c-4P2EM44G.min.js} +3 -3
- package/dist/c-4RVDKSMQ.min.js +1 -0
- package/dist/{c-6MEEA5VY.min.js → c-4YPPVFZH.min.js} +1 -1
- package/dist/{c-6MPP6QF5.min.js → c-62JIVHK5.min.js} +1 -1
- package/dist/{c-KYRH3XKJ.min.js → c-6QCSRJSC.min.js} +1 -1
- package/dist/c-6WJKNYIG.min.js +1 -0
- package/dist/c-7BVQDXFU.min.js +1 -0
- package/dist/c-7UN2WUMI.min.js +1 -0
- package/dist/c-AQUX6L2O.min.js +1 -0
- package/dist/c-BR5QDUCR.min.js +1 -0
- package/dist/c-C3YQVUB6.min.js +1 -0
- package/dist/{c-RQ2XZHWY.min.js → c-COP4OISO.min.js} +1 -1
- package/dist/c-ENRZPF5E.min.js +1 -0
- package/dist/c-HBLICBM6.min.js +1 -0
- package/dist/{c-EQVM754Z.min.js → c-HGWITEJI.min.js} +1 -1
- package/dist/{c-3K2FJDLE.min.js → c-I54V24WG.min.js} +1 -1
- package/dist/c-IDCFMBA4.min.js +2 -0
- package/dist/{c-TPL7X32J.min.js → c-ISHYKYII.min.js} +1 -1
- package/dist/c-KSSS3HSA.min.js +1 -0
- package/dist/c-LEICSI5V.min.js +1 -0
- package/dist/c-LJ4XY3Z3.min.js +1 -0
- package/dist/c-MBE6PPHN.min.js +1 -0
- package/dist/c-MOK4RWNO.min.js +1 -0
- package/dist/c-N2TVSOYL.min.js +2 -0
- package/dist/{c-EAAKQIUZ.min.js → c-NHZ2E3CI.min.js} +1 -1
- package/dist/{c-MDY3ULP6.min.js → c-OBA7XSLH.min.js} +1 -1
- package/dist/c-OIJL2WZH.min.js +1 -0
- package/dist/c-ONOWKUUZ.min.js +1 -0
- package/dist/{c-CPJR4LHF.min.js → c-OSLNYZ3Q.min.js} +17 -17
- package/dist/c-PBFRYNKM.min.js +1 -0
- package/dist/c-QUAEYF34.min.js +1 -0
- package/dist/c-RDFFLRKC.min.js +1 -0
- package/dist/c-SDGGMIYI.min.js +1 -0
- package/dist/c-SQQZPFVY.min.js +1 -0
- package/dist/c-SU6Z75M2.min.js +1 -0
- package/dist/{c-BWM7MU2Y.min.js → c-SX4TPG3Z.min.js} +1 -1
- package/dist/{c-DTYG34WG.min.js → c-VGHU2LTF.min.js} +2 -2
- package/dist/c-VLWWXOM5.min.js +1 -0
- package/dist/c-VZNIIKL6.min.js +1 -0
- package/dist/{c-GBO32OML.min.js → c-W5ATXREF.min.js} +1 -1
- package/dist/c-WSWMQDFZ.min.js +1 -0
- package/dist/{c-3SDC7AQQ.min.js → c-XM76UG3P.min.js} +1 -1
- package/dist/c-XORVM6C5.min.js +1 -0
- package/dist/{c-MYRI7NF2.min.js → c-XZJWL7UL.min.js} +1 -1
- package/dist/c-Y43GTKGR.min.js +1 -0
- package/dist/c-YGTMWEEF.min.js +1 -0
- package/dist/c-ZFIURPZA.min.js +1 -0
- package/dist/c-ZWJDTDEV.min.js +1 -0
- package/dist/c-ZYMXDR42.min.js +1 -0
- package/dist/components/ai/chartClinic.d.ts +4 -0
- package/dist/components/ai/evaluateChart.d.ts +3 -1
- package/dist/components/ai/generativeChart.d.ts +13 -0
- package/dist/components/ai/renderEvidenceMemoKey.d.ts +9 -0
- package/dist/components/ai/reportRenderError.d.ts +2 -0
- package/dist/components/charts/physics/eventDropSources.d.ts +1 -1
- package/dist/components/evidence/claimReferences.d.ts +9 -0
- package/dist/components/realtime/BinAccumulator.d.ts +5 -0
- package/dist/components/recipes/atlas/dependencyEvidence.d.ts +5 -0
- package/dist/components/recipes/atlas/support.d.ts +5 -0
- package/dist/components/server/staticXYAxisTicks.d.ts +1 -1
- package/dist/components/stream/MarginalGraphics.d.ts +4 -2
- package/dist/components/stream/PipelineStore.d.ts +6 -18
- package/dist/components/stream/axisTickUtils.d.ts +1 -1
- package/dist/components/stream/countNoun.d.ts +2 -0
- package/dist/components/stream/heatmapBandTicks.d.ts +68 -0
- package/dist/components/stream/pipelineDomainResolution.d.ts +52 -3
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +8 -0
- package/dist/components/stream/uniqueRegionLabel.d.ts +6 -0
- package/dist/components/stream/xyAxisTicks.d.ts +8 -1
- package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -0
- package/dist/geo.min.js +152 -152
- package/dist/geo.module.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/processSankeyLayoutWorker.js +1 -1
- package/dist/semiotic-access.module.min.js +2 -2
- package/dist/semiotic-ai-core.min.js +5 -5
- package/dist/semiotic-ai-core.module.min.js +4 -4
- package/dist/semiotic-ai.module.min.js +2 -2
- package/dist/semiotic-artifact.min.js +6 -6
- package/dist/semiotic-artifact.module.min.js +2 -2
- package/dist/semiotic-atlas-core.min.js +1 -1
- package/dist/semiotic-atlas-core.module.min.js +1 -1
- package/dist/semiotic-atlas-selection.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +1023 -1023
- package/dist/semiotic-evidence.min.js +4 -4
- package/dist/semiotic-evidence.module.min.js +3 -3
- package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-line.module.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +101 -101
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-server-edge-node.module.min.js +3 -3
- package/dist/semiotic-server-edge.min.js +397 -397
- package/dist/semiotic-server-edge.module.min.js +3 -3
- package/dist/semiotic-server-node.min.js +397 -397
- package/dist/semiotic-utils-core.min.js +11 -11
- package/dist/semiotic-utils-core.module.min.js +3 -3
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +397 -397
- package/dist/server.module.min.js +3 -3
- package/dist/xy.module.min.js +1 -1
- package/package.json +2 -2
- package/dist/c-3OBJLOXI.min.js +0 -1
- package/dist/c-4VFGNUWG.min.js +0 -1
- package/dist/c-5BN7GWJH.min.js +0 -1
- package/dist/c-65GMYND6.min.js +0 -1
- package/dist/c-AGRMJIUH.min.js +0 -1
- package/dist/c-BJKGYOPX.min.js +0 -1
- package/dist/c-C332PFY6.min.js +0 -1
- package/dist/c-DDZ5TZ7P.min.js +0 -1
- package/dist/c-F4DZ3NMI.min.js +0 -1
- package/dist/c-GZJ2XEQ5.min.js +0 -1
- package/dist/c-HFQ3Z65X.min.js +0 -1
- package/dist/c-HNW73MXJ.min.js +0 -1
- package/dist/c-HWFZB7SD.min.js +0 -1
- package/dist/c-IIV4DB7T.min.js +0 -1
- package/dist/c-J2QH3PEI.min.js +0 -1
- package/dist/c-JZNWRFVJ.min.js +0 -2
- package/dist/c-KHLBCSIO.min.js +0 -1
- package/dist/c-L7FQHKGH.min.js +0 -1
- package/dist/c-LYPOBMKC.min.js +0 -1
- package/dist/c-NGMMPKNJ.min.js +0 -1
- package/dist/c-NOME4L5M.min.js +0 -1
- package/dist/c-OKIJBK5K.min.js +0 -2
- package/dist/c-OXV4W7YX.min.js +0 -1
- package/dist/c-P73SQZEP.min.js +0 -1
- package/dist/c-PD5EZI24.min.js +0 -1
- package/dist/c-RAL7HCTV.min.js +0 -1
- package/dist/c-S4OGXAVO.min.js +0 -1
- package/dist/c-UWE3VZEO.min.js +0 -1
- package/dist/c-VP7WX6QI.min.js +0 -1
- package/dist/c-VW7ZSLDC.min.js +0 -1
- package/dist/c-WDVYLMCM.min.js +0 -1
- package/dist/c-XEACLH4B.min.js +0 -1
- package/dist/c-YJDGSPNB.min.js +0 -1
- package/dist/c-ZYBEKQCT.min.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as E,E as T,F as B,G as _,H as z,b as V,c as H,e as q,f as G,g as U,h as K,i as J,n as W,q as Q,y as X,z as Z}from"./c-2AURU3I6.min.js";import{a as Y}from"./c-5H6IMPPV.min.js";function ee(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function te(e,t={}){let r="number"==typeof t.maxDepth&&Number.isFinite(t.maxDepth)?Math.max(1,Math.floor(t.maxDepth)):10,n="number"==typeof t.maxArrayLength&&Number.isFinite(t.maxArrayLength)?Math.max(1,Math.floor(t.maxArrayLength)):1e3,a= new WeakSet,i=(e,t)=>{if(null==e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e)return Number.isFinite(e)?e:String(e);if("bigint"==typeof e)return e.toString();if("function"==typeof e||"symbol"==typeof e||typeof e>"u")return;if(e instanceof Date)return Number.isFinite(e.getTime())?e.toISOString():null;if(t>=r)return"[depth limit]";if("object"!=typeof e)return String(e);if("$$typeof"in e)return;if(a.has(e))return"[circular]";if(a.add(e),Array.isArray(e)){let r=e.slice(0,n).map(e=>i(e,t+1)).filter(e=>void 0!==e);return a.delete(e),r}if(e instanceof Set){let r=Array.from(e).slice(0,n).map(e=>i(e,t+1)).filter(e=>void 0!==e);return a.delete(e),r}if(e instanceof Map){let r= Object.create(null),o=0;for(let[a,l]of e){if(o++>=n)break;let e=i(l,t+1);void 0!==e&&(r[String(a)]=e)}return a.delete(e),r}let o= Object.create(null);for(let r of Object.keys(e).sort()){let n=i(e[r],t+1);void 0!==n&&(o[r]=n)}return a.delete(e),o};return i(e,0)}function re(e){let t=te(e);return ee(t)?t:{}}function ne(e){if(Array.isArray(e))return e.map(ne);if(!ee(e))return e;let t= Object.create(null);for(let r of Object.keys(e).sort())t[r]=ne(e[r]);return t}function ae(e){return JSON.stringify(ne(te(e)))}function ie(e){let t=BigInt("14695981039346656037"),r=BigInt("1099511628211"),n=BigInt("0xffffffffffffffff");for(let a=0;a<e.length;a++)t^=BigInt(e.charCodeAt(a)),t=t*r&n;return t.toString(16).padStart(16,"0")}function oe(e){return ie(ae(e))}function le(e){return`st_${oe({state:e.state,...e.summary?{summary:e.summary}:{}})}`}function se(e){if(!e?.length)return;let t=Array.from(new Set(e.filter(e=>"string"==typeof e&&e.length))).sort();return t.length?t:void 0}function ce(e,t){return t.some(t=>e===t||e.startsWith(`${t}/`))}function ue(e,t){let r=se(t.refs),n=!1!==t.includeSummary;if(!r)return{snapshot:{version:e.version,createdAt:e.createdAt,state:e.state,...n&&e.summary?{summary:e.summary}:{}}};let a={};for(let[t,n]of Object.entries(e.state))ce(t,r)&&(a[t]=n);let i={};if(n&&e.summary)for(let[t,n]of Object.entries(e.summary))ce(t,r)&&(i[t]=n);return{snapshot:{version:e.version,createdAt:e.createdAt,state:a,...Object.keys(i).length?{summary:i}:{}},refs:r}}function de(e,t){let r={},n=[];for(let[n,a]of Object.entries(t.state))(!Object.prototype.hasOwnProperty.call(e.state,n)||ae(e.state[n])!==ae(a))&&(r[n]=a);for(let r of Object.keys(e.state))Object.prototype.hasOwnProperty.call(t.state,r)||n.push(r);let a={},i=[],o=e.summary??{},l=t.summary??{};for(let[e,t]of Object.entries(l))(!Object.prototype.hasOwnProperty.call(o,e)||ae(o[e])!==ae(t))&&(a[e]=t);for(let e of Object.keys(o))Object.prototype.hasOwnProperty.call(l,e)||i.push(e);return{changed:r,removed:n.sort(),...Object.keys(a).length?{summaryChanged:a}:{},...i.length?{summaryRemoved:i.sort()}:{}}}function fe(e){return{refs:se(e.refs),prefixes:se(e.prefixes),kinds:e.kinds?.length?new Set(e.kinds):void 0,layers:e.layers?.length?new Set(e.layers):void 0,includeActions:!1!==e.includeActions,includeEdges:!1!==e.includeEdges,includeNodeData:!1!==e.includeNodeData}}function he(e,t){return!((t.refs?.length||t.prefixes?.length)&&!t.refs?.includes(e.ref)&&!t.prefixes?.some(t=>e.ref===t||e.ref.startsWith(`${t}/`)))&&(!t.kinds||t.kinds.has(e.kind))&&(!t.layers||t.layers.has(e.layer))}function me(e,t){let r=fe(t),n=e.graph.nodes.filter(e=>he(e,r)).map(e=>{if(r.includeNodeData)return e;let{data:t,...n}=e;return n}),a=new Set(n.map(e=>e.ref)),i=r.includeActions?e.graph.actions.filter(e=>{if(!e.targetRef||a.has(e.targetRef))return!0;for(let t of a)if(t.startsWith(`${e.targetRef}/`))return!0;return!1}):[];return{version:e.version,createdAt:e.createdAt,graph:{version:e.graph.version,nodes:n,edges:r.includeEdges?e.graph.edges.filter(e=>a.has(e.from)&&a.has(e.to)):[],actions:i}}}function pe(e){return null==e?"NULL":"number"==typeof e?"DOUBLE":"string"==typeof e?"VARCHAR":"boolean"==typeof e?"BOOLEAN":e instanceof Date?"TIMESTAMP":Array.isArray(e)?"ARRAY":"OBJECT"}function ge(e){let t= new Map;for(let r of e)if(ee(r))for(let[e,n]of Object.entries(r)){let r=t.get(e)?? new Set;r.add(pe(n)),t.set(e,r)}return Array.from(t).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>{let r=Array.from(t).filter(e=>"NULL"!==e);return{name:e,type:0===r.length?"NULL":1===new Set(r).size?r[0]:"MIXED"}})}function ye(e,t){let r= Object.create(null);for(let n of t){let t=[];for(let r of e){if(!ee(r)||!Object.prototype.hasOwnProperty.call(r,n))continue;let e=r[n];"number"==typeof e&&Number.isFinite(e)&&t.push(e)}if(!t.length)continue;let a=t[0],i=t[0],o=0;for(let e of t)a=Math.min(a,e),i=Math.max(i,e),o+=e;r[n]={min:a,max:i,avg:o/t.length}}return Object.keys(r).length?r:void 0}function be(e,t){let r= Object.create(null);for(let n of t){let t=[];for(let r of e){if(!ee(r)||!Object.prototype.hasOwnProperty.call(r,n))continue;let e=r[n];e instanceof Date&&Number.isFinite(e.getTime())&&t.push(e.getTime())}if(!t.length)continue;let[a,i]=Y(t);r[n]={minIso:new Date(a).toISOString(),maxIso:new Date(i).toISOString(),minEpochMs:a,maxEpochMs:i}}return Object.keys(r).length?r:void 0}function ve(e,t){let r= Object.create(null);for(let n of t){if(n.replace(/([a-z\d])([A-Z])/g,"$1 $2").split(/[^a-z\d]+/i).some(e=>/^(id|uuid|guid|identifier|email|phone|ssn|token|password)$/i.test(e)))continue;let t= new Map,a=0;for(let r of e){if(!ee(r)||!Object.prototype.hasOwnProperty.call(r,n))continue;let e=r[n];if("string"!=typeof e&&"boolean"!=typeof e)continue;let i=String(e);t.set(i,(t.get(i)??0)+1),a++}!t.size||t.size/a>.5||(r[n]=Array.from(t).sort(([e,t],[r,n])=>n-t||e.localeCompare(r)).slice(0,10).map(([e,t])=>({value:e,n:t})))}return Object.keys(r).length?r:void 0}function $e(e){let t=e.rows.slice(0,Math.max(0,e.sampleRows)),r=ge(e.rows),n=r.map(e=>e.name);if("columns"===e.detail)return{handleRef:e.handleRef,detail:e.detail,table:null,rowCount:e.rows.length,columns:r};let a=ye(t,n),i=be(t,n),o=ve(t,n);return{handleRef:e.handleRef,detail:e.detail,table:null,rowCount:e.rows.length,columns:r,...a?{numeric:a}:{},...i?{temporal:i}:{},...o?{categoricalTopValues:o}:{},sampledRows:t.length}}function we(e,t){if(!t.descriptor.name.trim())throw new Error("VACP action names must be non-empty.");if(e.some(e=>e.descriptor.name===t.descriptor.name))throw new Error(`Duplicate VACP action "${t.descriptor.name}".`);e.push(t)}function Ce(e,t){if(!ee(e))throw new Error(`${t} expects an object parameter payload.`);return e}function Ae(e,t){return"number"==typeof e&&Number.isFinite(e)?Math.max(1,Math.floor(e)):t}function Se(e,t,r){if("string"!=typeof e.selectionRef)throw new Error("params.selectionRef must be a VACP selection ref.");let n=t.find(t=>t.ref===e.selectionRef);if(!n)throw new Error(`Unknown selection ref "${e.selectionRef}".`);if(r&&!n.modes.has(r))throw new Error(`Selection "${n.name}" does not accept ${r} state.`);return n}function ke(e,t){if(!ee(e)||!Object.keys(e).length)throw new Error("params.fields must be a non-empty object.");let r= Object.create(null);for(let[n,a]of Object.entries(e)){if(!t.includes(n))throw new Error(`Field "${n}" is not allowed for this selection.`);if(!Array.isArray(a)||!a.length)throw new Error(`Point selection field "${n}" requires values[].`);for(let e of a)if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&("number"!=typeof e||!Number.isFinite(e)))throw new Error(`Point selection field "${n}" only accepts JSON primitive values.`);r[n]=[...a]}return r}function xe(e,t){if(!ee(e)||!Object.keys(e).length)throw new Error("params.fields must be a non-empty object.");let r= Object.create(null);for(let[n,a]of Object.entries(e)){if(!t.includes(n))throw new Error(`Field "${n}" is not allowed for this selection.`);if(!Array.isArray(a)||2!==a.length||"number"!=typeof a[0]||"number"!=typeof a[1]||!Number.isFinite(a[0])||!Number.isFinite(a[1]))throw new Error(`Interval selection field "${n}" requires [min,max].`);r[n]=[Math.min(a[0],a[1]),Math.max(a[0],a[1])]}return r}function Pe(e){return null==e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e||e instanceof Date&&Number.isFinite(e.getTime())}function je(e,t){if(!ee(e))throw new Error("params.match must be an object.");for(let r of Object.keys(e))if(!t.includes(r))throw new Error(`params.match includes undeclared field "${r}".`);let r= Object.create(null);for(let n of t){if(!Object.prototype.hasOwnProperty.call(e,n)||!Pe(e[n]))throw new Error(`params.match requires a primitive value for "${n}".`);r[n]=e[n]instanceof Date?e[n].toISOString():e[n]}return r}function Oe(i,l,s){let c=[],u=i.dataHandles.map(e=>e.ref),d=!0===l.dataAccess?.summaries||!0===l.dataAccess?.sample;u.length&&we(c,{descriptor:{name:o,title:"Describe Semiotic data",description:"Return columns, types, row count, and optional bounded summaries for a chart DataHandle.",targetRef:s.view,parameters:{type:"object",properties:{handleRef:{type:"string",enum:u},detail:{type:"string",enum:d?["columns","full"]:["columns"]},sampleRows:{type:"number",minimum:1}},required:["handleRef"]}},execute(e){let t=Ce(e,o);if("string"!=typeof t.handleRef)throw new Error("params.handleRef must be a DataHandle ref.");let r=i.dataHandles.find(e=>e.ref===t.handleRef);if(!r)throw new Error(`Unknown DataHandle "${t.handleRef}".`);let n=void 0===t.detail||"columns"===t.detail?"columns":"full"===t.detail?"full":(()=>{throw new Error('params.detail must be "columns" or "full".')})();if("full"===n&&!d)throw new Error("Full data schema summaries require dataAccess.summaries or dataAccess.sample.");let a="number"==typeof t.sampleRows&&Number.isFinite(t.sampleRows)?Math.max(1,Math.floor(t.sampleRows)):"full"===n?1e3:Math.min(r.rows.length,1e3),s=Ae(l.dataAccess?.maxSchemaRows,5e3);return $e({handleRef:r.ref,rows:r.rows,detail:n,sampleRows:Math.min(a,s)})}}),u.length&&!0===l.dataAccess?.sample&&we(c,{descriptor:{name:a,title:"Inspect bounded Semiotic rows",description:"Return a bounded JSON sample from a chart DataHandle. This action is opt-in.",targetRef:s.view,parameters:{type:"object",properties:{handleRef:{type:"string",enum:u},offset:{type:"number",minimum:0},limit:{type:"number",minimum:1}},required:["handleRef"]}},execute(e){let t=Ce(e,a);if("string"!=typeof t.handleRef)throw new Error("params.handleRef must be a DataHandle ref.");let r=i.dataHandles.find(e=>e.ref===t.handleRef);if(!r)throw new Error(`Unknown DataHandle "${t.handleRef}".`);let n="number"==typeof t.offset&&Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Ae(l.dataAccess?.maxSampleRows,50),s="number"==typeof t.limit&&Number.isFinite(t.limit)?Math.max(1,Math.floor(t.limit)):Math.min(20,o),c=Math.min(s,o),u=r.rows.slice(n,n+c);return{handleRef:r.ref,offset:n,limit:c,rowCount:r.rows.length,rows:te(u,{maxArrayLength:o}),truncated:n+u.length<r.rows.length}}});let f=i.selections.map(e=>e.ref),h=i.selections.filter(e=>e.modes.has("point"));h.length&&l.selectionActions?.setPointSelection&&we(c,{descriptor:{name:e,title:"Set point selection",description:"Set a named LinkedCharts point-selection clause with allowlisted fields.",targetRef:s.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:h.map(e=>e.ref)},fields:{type:"object"}},required:["selectionRef","fields"]}},async execute(t){let r=Ce(t,e),n=Se(r,i.selections,"point"),a=ke(r.fields,n.fields);return await(l.selectionActions?.setPointSelection?.(n.name,n.clientId,a)),{selectionRef:n.ref,fields:a}}});let m=i.selections.filter(e=>e.modes.has("interval"));m.length&&l.selectionActions?.setIntervalSelection&&we(c,{descriptor:{name:t,title:"Set interval selection",description:"Set a named LinkedCharts interval-selection clause in data units.",targetRef:s.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:m.map(e=>e.ref)},fields:{type:"object"}},required:["selectionRef","fields"]}},async execute(e){let r=Ce(e,t),n=Se(r,i.selections,"interval"),a=xe(r.fields,n.fields);return await(l.selectionActions?.setIntervalSelection?.(n.name,n.clientId,a)),{selectionRef:n.ref,fields:a}}}),f.length&&l.selectionActions?.clearSelection&&we(c,{descriptor:{name:r,title:"Clear selection",description:"Clear every active clause from one named LinkedCharts selection.",targetRef:s.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:f}},required:["selectionRef"]}},async execute(e){let t=Se(Ce(e,r),i.selections);return await(l.selectionActions?.clearSelection?.(t.name)),{selectionRef:t.ref,cleared:!0}}});let p=i.charts.map(e=>e.navigation).filter(e=>!!e&&e.index.valid&&!!e.binding.onActiveChange);p.length&&we(c,{descriptor:{name:n,title:"Activate chart navigation target",description:"Move an accessible chart navigation tree to a uniquely identified datum.",targetRef:s.view,parameters:{type:"object",properties:{navigationRef:{type:"string",enum:p.map(e=>e.ref)},match:{type:"object"}},required:["navigationRef","match"]}},execute(e){let t=Ce(e,n);if("string"!=typeof t.navigationRef)throw new Error("params.navigationRef must be a navigation ref.");let r=p.find(e=>e.ref===t.navigationRef);if(!r)throw new Error(`Unknown navigation ref "${t.navigationRef}".`);let a=je(t.match,r.index.matchFields),i=r.index.byKey.get(oe(a));if(!i)throw new Error("No navigation datum matches params.match.");return r.binding.onActiveChange?.(i),{navigationRef:r.ref,targetRef:r.index.targetRef(a),match:a}}});let g="function"==typeof l.actions?l.actions():l.actions;for(let e of g??[])e.available&&!e.available()||we(c,{descriptor:{...e.descriptor,...e.descriptor.parameters?{parameters:re(e.descriptor.parameters)}:{}},async execute(t){let r=e.validate?.(t);if("string"==typeof r&&r)throw new Error(r);return e.execute(t)}});return c}function Ie(e){return s.has(e)}function Me(){let e=globalThis;return e[c]||(e[c]={recipes: new Map,capabilities: new Map,layouts: new Map}),e[c]}function Re(e){return Me().recipes.get(e)}function Fe(e){let t=Me().layouts.get(e)?.identity;return t?{...t}:void 0}function De(e){return"string"==typeof e?Re(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function Le(e){return!(null===e||"object"!=typeof e||Array.isArray(e)||e instanceof Date||e instanceof Map||e instanceof Set)}function Ne(e){if(!Array.isArray(e))return[];for(let t of e)if(!Le(t))return e.filter(Le);return e}function Ee(e){let t=e;for(let r of["data","nodes","edges","points","areas","lines","flows","spawns","projectionRows","annotations"]){if(!Array.isArray(e[r]))continue;let n=Ne(e[r]);n!==e[r]&&(t===e&&(t={...e}),t[r]=n)}return t}function Te(e){return e instanceof Date?e.getTime():"number"==typeof e?e:"string"==typeof e&&""!==e.trim()?Number(e):NaN}function Be(e){return e instanceof Date?Number.isFinite(e.getTime())?e.toISOString():void 0:null!=e&&"object"!=typeof e&&"function"!=typeof e?String(e):void 0}function _e(e,t){let r=Q(e,t);return e=>Te(r(e))}function ze(e,t,r){return"function"==typeof t?t(e):e["string"==typeof t&&t?t:r]}function Ve(e,t="—"){let r;for(;null!==e&&"object"==typeof e&&!(e instanceof Date);){if(r??(r= new Set),r.has(e))return t;r.add(e);let n=e;e=n.id??n.name??n.label}return Be(e)||t}function He(e){let t=Te(e);return Number.isFinite(t)?t:void 0}function qe(e){return(Ve(e,"unknown").toLowerCase().match(/[a-z0-9]+/g)||[]).join("-")||"unknown"}function Ge(e,t){return`${e.linkedHover||e.selection||e.linkedBrush?` ${t}`:""}${e.enableHover||e.tooltip?" Hover or focus a mark for its details.":""}`}function Ue(e,t){return Ne(ze(e,t,"children"))}function Ke(e){return"string"==typeof e?e:e.id??e.name}function Je(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function We(e){return Array.isArray(e.data)?Ne(e.data):Array.isArray(e.nodes)?Ne(e.nodes):Array.isArray(e.points)?Ne(e.points):Array.isArray(e.areas)?Ne(e.areas):[]}function Qe(e,t,r){return r??De(t.recipe)??De(t.recipeId)??Re(e)}function Xe(e,t,r=[]){let n=e.accessor?t[e.accessor]:void 0;if("string"==typeof n&&n)return n;if(e.field)return e.field;let a=r.find(e=>e&&"object"==typeof e);if(!a)return;let i=Object.entries(a).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?i.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>Object.prototype.hasOwnProperty.call(a,e)):i.find(([,e])=>"string"==typeof e)?.[0]}function Ze(e,t){return e.dataRoles.find(e=>e.role===t)}function Ye(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function et(e,t,r,n,a,i={}){let o=Object.assign( Object.create(null),i);if(t)for(let[e,r]of Object.entries(t))o[e]=r;for(let e of r.dataRoles){let r=Xe(e,n,a),i=t&&r?t[r]:r;void 0!==i&&(o[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>Ve(o[t],`{${t}}`))}function tt(e,t,r){let n=J(e,t,r);return{mismatchPaths:[...n.mismatchPaths,...void 0!==r&&n.unknownPaths.includes("artifact.component")?["artifact.component"]:[]]}}function rt(e,t){return[... new Set([...Object.keys(e),...Object.keys(t)])].filter(r=>{if(Object.prototype.hasOwnProperty.call(e,r)!==Object.prototype.hasOwnProperty.call(t,r))return!0;let n=V(e[r]),a=V(t[r]);return n.excludedPaths.length>0||n.fingerprint!==a.fingerprint}).map(e=>`props.${e}`).sort()}function nt(e,t,r,n){let a={component:t,version:n.version,createdAt:n.createdAt,...void 0!==n.recipeId?{recipeId:n.recipeId}:{},...void 0!==n.portable?{portable:n.portable}:{},...void 0!==n.manifest?{manifest:n.manifest}:{},...void 0!==n.reason?{reason:n.reason}:{},...void 0!==n.warnings?{warnings:n.warnings}:{},...void 0!==n.selections?{selections:n.selections}:{},artifactContract:r,status:e.status,omittedPaths:e.omittedPaths,warnings:e.warnings,...void 0!==e.serializedConfigFingerprint?{serializedConfigFingerprint:e.serializedConfigFingerprint}:{},...Object.prototype.hasOwnProperty.call(e,"serializedDataFingerprint")?{serializedDataFingerprint:e.serializedDataFingerprint}:{}};return V(a).fingerprint}function at(e,t,r,n,a){let i=U(r),o={...e,serializedConfigFingerprint:V(K(r)).fingerprint,serializedDataFingerprint:void 0===i?null:V(i).fingerprint};return{...o,transferFingerprint:nt(o,t,n,a)}}function it(e,t,r,n,a){if(!t)return{};let i=q(t),o=a.recipeId??e,l=tt(t,r,o),s=rt(r,n),c=tt(t,n,o);return l.mismatchPaths.length>0?{artifactContract:i.contract,artifactTransfer:at({status:"invalid",omittedPaths:l.mismatchPaths,warnings:["The artifact contract fingerprints do not match the supplied chart props or data."]},e,n,i.contract,a)}:s.length>0?{artifactContract:i.contract,artifactTransfer:at({status:"excluded",omittedPaths:s,warnings:["Chart props or data were excluded from the serialized configuration."]},e,n,i.contract,a)}:c.mismatchPaths.length>0?{artifactContract:i.contract,artifactTransfer:at({status:"invalid",omittedPaths:c.mismatchPaths,warnings:["Serialized chart props or data differ from the values bound to the artifact contract."]},e,n,i.contract,a)}:{artifactContract:i.contract,artifactTransfer:at(i.transfer,e,n,i.contract,a)}}function ot(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function lt(e,t){return!(!G(e,t)||"areas"===e&&"string"==typeof t)}function st(e,t,r){if(r?.selections&&H(r.selections).length>0)throw new TypeError("Serialized selection state must contain only values that survive JSON serialization unchanged.");let n=Re(e)??De(t.recipe)??De(t.recipeId);if(n)return ut(n,t,r);if(!Ie(e))throw new Error(`Unknown component "${e}". Known components: ${l.join(", ")}`);let a=!1!==r?.includeData,i={};for(let[e,r]of Object.entries(t))if(null!=r&&!d.has(e)&&(a||!lt(e,r))&&"function"!=typeof r&&!(H(r).length>0))try{ot(i,e,f(r))}catch{}let o= (new Date).toISOString(),s={version:u,createdAt:o,...r?.selections?{selections:r.selections}:{}};return{component:e,props:i,version:u,createdAt:o,...it(e,r?.artifactContract,t,i,s),...r?.selections?{selections:r.selections}:{}}}function ct(e,t,r){let n={};for(let[a,i]of Object.entries(e))if(null!=i&&!d.has(a)&&"recipeId"!==a&&(t||!lt(a,i))){if("function"==typeof i){if(r)throw new Error(`Portable recipe prop "${a}" is not JSON-safe.`);continue}if(H(i).length>0){if(r)throw new Error(`Portable recipe prop "${a}" is not JSON-safe.`);continue}ot(n,a,f(i))}return n}function ut(e,t,r){let n=!1!==r?.includeData,a=H(e);if("portable"===e.portability&&a.length>0)throw new Error(`Portable recipe "${e.id}" has non-JSON definition values at: ${a.join(", ")}.`);let i=ct(t,n,"portable"===e.portability),o=e.intents.map(Ke).filter(e=>!!e),l=e.layout&&"object"==typeof e.layout&&"string"==typeof e.layout.id?e.layout.id:void 0,s=l?Fe(l):void 0,c=e.layout&&"object"==typeof e.layout&&"string"==typeof e.layout.version&&e.layout.version?{version:e.layout.version,...e.layout.fingerprint?{fingerprint:e.layout.fingerprint}:{}}:void 0;if(s&&c&&(s.version!==c.version||s.fingerprint!==c.fingerprint))throw new Error(`Recipe layout "${l}" registry identity does not match its portable declaration.`);let d=s??c;if("portable"===e.portability&&l&&!d)throw new Error(`Portable recipe layout "${l}" must be registered with an explicit version identity.`);let f={name:e.name,intents:o,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily,...e.version?{recipeVersion:e.version}:{},...0===a.length?{definitionFingerprint:V(e).fingerprint}:{},...l?{layoutId:l}:{},...d?{layoutVersion:d.version}:{},...d?.fingerprint?{layoutFingerprint:d.fingerprint}:{}},h= (new Date).toISOString();if("portable"===e.portability){if(H(i).length>0)throw new Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);let n={version:u,createdAt:h,recipeId:e.id,portable:!0,manifest:f,...r?.selections?{selections:r.selections}:{}};return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:i,manifest:f,version:u,createdAt:h,...it("ChartRecipe",r?.artifactContract,t,i,n),...r?.selections?{selections:r.selections}:{}}}let m="Recipe contains or may depend on non-serializable local layout callbacks.",p=["This config is inspectable but cannot be rendered remotely by CLI or MCP."],g={version:u,createdAt:h,recipeId:e.id,portable:!1,manifest:f,reason:m,warnings:p,...r?.selections?{selections:r.selections}:{}};return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:m,warnings:p,props:i,manifest:f,version:u,createdAt:h,...it("ChartRecipe",r?.artifactContract,t,i,g),...r?.selections?{selections:r.selections}:{}}}function dt(e,t){return m.has(e)||p.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 ft(e){for(let t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){let r=e[t];if("string"==typeof r&&r)return r}}function ht(e,t){return null==e?"—":e instanceof Date?Be(e)?.slice(0,10)??"—":"number"==typeof e?t(e):Be(e)??"—"}function mt(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function pt(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})}}}function gt(e,t,r,n){let a=Ye(e,["nominal","ordinal"]),i=Ye(e,["quantitative"]),o=a?Xe(a,r,t):void 0,l=i?Xe(i,r,t):void 0,s=a?.role??o??"category",c=i?.role??l??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${s} and ${c} are mapped through the recipe's declared visual semantics`,{number:f,percent:h}=pt(n),m= new Map;if(o&&l)for(let e of t){let t=Ve(e[o],"Uncategorized"),r=Te(e[l]);Number.isFinite(r)&&m.set(t,(m.get(t)??0)+r)}let p=[...m].sort((e,t)=>t[1]-e[1]),g=p.reduce((e,[,t])=>e+t,0),y=p[0],b=p[1],v=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,$=e.intents.map(e=>({id:Ke(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,w=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${s} and ${c}. ${mt(d)}.`,l2:p.length>0?`${p.length} categories total ${f.format(g)}. ${y[0]} accounts for ${f.format(y[1])}${g>0?` (${h.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${f.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:p.length>=2?v>=.5?`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${h.format(v)}.`:`The total is distributed across ${p.length} categories without the first two forming a majority.`:y?`${y[0]} is the only represented category.`:"No quantitative pattern can be derived from the available data.",l4:`The chart is intended for ${$??"explanation"}${w?` with a ${w} audience`:""}: ${e.designContract.whyCustom}`}}function yt(e,t,r={}){let n=We(t),a=Je(t),i=r.locale??"en",o=("function"==typeof e.description?e.description({data:n,config:a,locale:i}):void 0)?.levels??gt(e,n,a,i),l=r.levels??["l1","l2","l3","l4"],s={};for(let e of l)o[e]&&(s[e]=o[e]);let c=["l1","l2","l3","l4"].map(e=>s[e]).filter(e=>!!e).join(" "),u=r.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>`Misuse: ${e}`)]:void 0;return{text:c,levels:s,...u?.length?{caveats:u}:{}}}function bt(e,t){let r="mechanical"===(t.simulationMode??t.mode)&&("GaltonBoardChart"===e||"UnitPileChart"===e);if(!Array.isArray(t.data)&&!r)return null;let n=Array.isArray(t.data)?t.data:[],a=Math.max(2,Math.round(Z(t.bins)??21)),i=Math.max(1,Math.round(Z(t.pegRows)??a-1));if(r&&(n="GaltonBoardChart"===e?T({bins:a,count:t.mechanicalCount,pegRows:i,branchProbability:t.branchProbability,seed:t.seed}):z({count:t.mechanicalCount,categories:t.mechanicalCategories,unitValue:t.unitValue,seed:t.seed})),n=B(n,"UnitPileChart"===e?"pile":"GaltonBoardChart"===e?"galton":"EventDropChart"===e?"event":"collision-swarm").rows,"UnitPileChart"===e){let e= new Map,a=t.valueAccessor??(r?"value":void 0);return n.forEach((r,n)=>{let i=Ve(X(r,n,t.categoryAccessor??"category"),"unknown"),o=a?Z(X(r,n,a)):1;e.set(i,(e.get(i)??0)+Math.max(0,o??0))}),{generated:r,rows:Array.from(e,([e,t])=>({label:e,value:t}))}}if("GaltonBoardChart"===e){let e=n.map((e,r)=>Z(X(e,r,t.valueAccessor??"value"))).filter(e=>null!=e),o=r?[0,i]:E(t.valueExtent),[l,s]=o??(e.length?Y(e):[0,1]),c=l===s?1:s-l,u=Array.from({length:a},(e,t)=>({label:String(t+1),value:0}));for(let t of e)u[Math.max(0,Math.min(a-1,Math.floor((t-l)/c*a)))].value+=1;return{generated:r,rows:u}}if("CollisionSwarmChart"===e){let e= new Map;return n.forEach((r,n)=>{if(null==Z(X(r,n,t.xAccessor??"x")))return;let a=t.groupAccessor?Ve(X(r,n,t.groupAccessor),"All"):"All";e.set(a,(e.get(a)??0)+1)}),{generated:r,rows:Array.from(e,([e,t])=>({label:e,value:t}))}}if("EventDropChart"===e){let e=Z(t.windows?.size??10);if(null==e||e<=0)return null;let{events:a}=_({data:n,timeAccessor:t.timeAccessor??"time",arrivalAccessor:t.arrivalAccessor??"arrivalTime",windowSize:e,watermark:t.watermark,watermarkAtArrivalAccessor:t.watermarkAtArrivalAccessor}),i=a.map(e=>e.eventTime),[o,l]=i.length?Y(i):[0,e],s=Math.min(Z(t.timeExtent?.[0])??o,o),c=Math.max(Z(t.timeExtent?.[1])??l,l),u=Math.floor(s/e)*e,d=Math.max(1,Math.ceil((c-u+e)/e)),f=Array.from({length:d},(t,r)=>({label:`${u+r*e}-${u+(r+1)*e}`,value:0,secondary:0,secondaryLabel:"late"}));for(let t of a){let r=f[Math.max(0,Math.min(d-1,Math.floor((t.eventTime-u)/e)))];t.late?r.secondary+=1:r.value+=1}return{generated:r,rows:f}}return null}function vt(e){let t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}function $t(e,t){let r=e.physics&&"object"==typeof e.physics?e.physics:null,n=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,a=[e.settledProjectionRows,e.projectionRows,n?.rows,r?.settledProjectionRows,r?.projectionRows,r?.settledProjection&&"object"==typeof r.settledProjection?r.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(a)?a.map((e,r)=>{if(!e||"object"!=typeof e)return null;let n=e,a=vt(n.count??n.value??n.total??n.bodies??n.events);if(null==a)return null;let i=n.label??n.id??n.name??`container ${r+1}`,o=vt(n.secondary??n.secondaryCount),l=vt(n.observed??n.observedCount);return{label:ht(i,t),count:a,...null!=o?{secondary:o}:{},..."string"==typeof n.secondaryLabel&&n.secondaryLabel?{secondaryLabel:n.secondaryLabel}:{},...null!=l?{observed:l}:{}}}).filter(e=>null!=e):null}function wt(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}function Ct(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"UnitPileChart"===e?"unit":"body"}function At(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.`}function St(e,t){if(!(t>0))return"0%";let r=e/t*100;return`${r>=10?Math.round(r):Math.round(10*r)/10}%`}function kt(e,t,r,n,a,i,o=null){let l=wt(e),s=o&&"EventDropChart"===e?"accepted event":Ct(e),c=o?o.generated?"The generated sample projection":"The source projection":"The settled projection";if(a.has("l1")&&(n.l1=At(e,t)),!a.has("l2")&&!a.has("l3"))return;if(!r||0===r.length)return void(a.has("l2")&&(n.l2=o?"No valid source records are available.":"No settled projection is loaded yet."));let u=r.reduce((e,t)=>e+t.count,0),d=r.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),f=d[0]??r.slice().sort((e,t)=>t.count-e.count)[0];if(!f)return;let h=r.reduce((e,t)=>e+(t.secondary??0),0),m=r.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(a.has("l2"))if(o&&"EventDropChart"===e)n.l2=`${c} classifies ${i(u+h)} ${xt(u+h,"event")} across ${r.length} ${xt(r.length,l)}: ${i(u)} accepted and ${i(h)} late.`;else if(0===d.length)n.l2=`${c} contains ${i(u)} ${xt(u,s)} across ${r.length} ${xt(r.length,l)}; no ${xt(2,l)} are non-empty yet.`;else{let e=h>0?` ${i(h)} ${xt(h,s)} ${1===h?"is":"are"} marked ${m}.`:"";n.l2=`${c} contains ${i(u)} ${xt(u,s)} across ${r.length} ${xt(r.length,l)}; ${d.length} ${xt(d.length,l)} ${1===d.length?"is":"are"} non-empty. The largest ${l} is ${f.label} with ${i(f.count)} ${xt(f.count,s)}.${e}`}if(a.has("l3")&&u>0&&d.length>0){let e=d.find(e=>e!==f),t=St(f.count,u);n.l3=e?`${c} is most concentrated in ${f.label}, which holds ${i(f.count)} ${xt(f.count,s)} (${t}); ${e.label} follows with ${i(e.count)} ${xt(e.count,s)}.`:`${c} is concentrated in ${f.label}, which holds all ${i(f.count)} ${xt(f.count,s)}.`}}function xt(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:`${t}s`}function Pt(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()}function jt(e){return Object.prototype.hasOwnProperty.call(y,e)?y[e]:`${Pt(e)} chart`}function Ot(e){let t,r=0;for(let[n,a]of Object.entries(e))if("number"==typeof a&&a>0){if(a>r){t=n,r=a;continue}if(a===r&&void 0!==t){let e=A.indexOf(n),r=A.indexOf(t);-1!==e&&(-1===r||e<r)&&(t=n)}}return t}function It(e){return"BumpChart"===e?"ranking":p.has(e)||"StackedAreaChart"===e?"apportioning":$.has(e)?"relating":m.has(e)?"comparing":g.has(e)?"characterizing":h.has(e)?"tracking":b.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}function Mt(e){if(e){if("fits"in e||"buildProps"in e){let t=e,r={};for(let[e,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(r[e]=n);return{family:t.family,intentScores:Object.keys(r).length?r:void 0}}return e}}function Rt(e,t){let r=Mt(t);if(r?.act)return r.act;if(r?.intentScores){let e=Ot(r.intentScores);if(e&&Object.prototype.hasOwnProperty.call(w,e)&&(r.intentScores[e]??0)>=3)return w[e]}return r?.family&&Object.prototype.hasOwnProperty.call(C,r.family)?C[r.family]:It(e)}function Ft(e){let t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;let t=e;if("string"!=typeof t.type||!k.has(t.type))return!1;let r=t.provenance;return!(!r||"object"!=typeof r)&&(x.has(r.authorKind)||P.has(r.source)||j.has(r.basis))})}function Dt(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)?Math.abs(e)>=1e4?t.format(e):r.format(e):String(e)}function Lt(e,t,r,n){let a=0,i=0,o=1/0,l=-1/0,s=null,c=null,u=0,d=0,f=null,h=null,m=NaN,p=NaN;for(let r of e){let e=t(r);Number.isFinite(e)&&(0===a&&(m=e,f=r),p=e,h=r,e<o&&(o=e,s=r,u=a),e>l&&(l=e,c=r,d=a),a++,i+=e)}return 0===a?null:{count:a,min:o,max:l,mean:i/a,minLabel:ht(null!=s?r(s):null,n),maxLabel:ht(null!=c?r(c):null,n),first:m,last:p,firstLabel:ht(null!=f?r(f):null,n),lastLabel:ht(null!=h?r(h):null,n),minIndex:u,maxIndex:d}}function Nt(e){return e.length<=1?e[0]??"":2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}function Et(e){let 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 ":""}function Tt(e){let t="string"==typeof e.type?e.type:"annotation",r=Object.prototype.hasOwnProperty.call(O,t)?O[t]:"an annotation",n=Et(e),a=n?n+r.replace(/^an? /,""):r,i="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return i?`${a} labeled "${i}"`:a}function Bt(e){let t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;let r=W(t.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;let n=r.map(Tt),a=n.slice(0,5),i=n.length-a.length,o=Nt(a)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":`${l} features`} on this chart: ${o}.`}function _t(e,t,r={}){t=Ee(t);let n=void 0!==r.levels,a=new Set(r.levels??["l1","l2","l3"]);!n&&(r.capability||Ft(t))&&a.add("l4");let i=Qe(e,t,r.recipe);if(i){let e=["l1","l2","l3","l4"].filter(e=>a.has(e));!n&&!e.includes("l4")&&e.push("l4");let o=yt(i,t,{levels:e,locale:r.locale,audience:r.audience,includeCaveats:r.includeCaveats}),l=Bt(t);return{...o,text:l?`${l} ${o.text}`.trim():o.text,...l?{annotations:l}:{}}}let o=Dt(r.locale??"en"),l=jt(e),s=Array.isArray(t.data)?t.data:null,c=ft(t),u=v.has(e)?$t(t,o):null,d=v.has(e)&&null===u?bt(e,t):null,{measure:f,measureFallback:y,dimension:$,dimensionFallback:w}=dt(e,t),C="string"==typeof f&&f?f:y,A="string"==typeof $&&$?$:w,S={};if(v.has(e)&&kt(e,l,u??(d?$t({projectionRows:d.rows},o):null),S,a,o,d),a.has("l1")&&!v.has(e))if("BumpChart"===e)S.l1=`A ${l} ranking ${c??"series"} by ${C} across ${A}.`;else if(h.has(e)||m.has(e))S.l1=`A ${l} of ${C} by ${A}`+(c?`, split by ${c}.`:".");else if(p.has(e))S.l1=`A ${l} showing ${C} across ${A} categories.`;else if(g.has(e))S.l1=`A ${l} of the distribution of ${C}`+(c?` by ${c}.`:".");else if(b.has(e)){let e=Array.isArray(t.nodes)?t.nodes.length:void 0,r=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${Wt(e,"node")}`:null,null!=r?`${r} ${Wt(r,"edge")}`:null].filter(Boolean);S.l1=`A ${l}${n.length?` with ${n.join(" and ")}`:""}.`}else if("BigNumber"===e){let e="string"==typeof t.label?t.label:C;S.l1=`A single value${e?` for ${e}`:""}.`}else S.l1=`A ${l}.`;let k=h.has(e)||"BumpChart"===e||m.has(e)||p.has(e)||g.has(e),x=null;if((a.has("l2")||a.has("l3")||a.has("l4"))&&k&&s&&s.length>0&&(x=Lt(s,_e(f,y),Q($,w),o)),a.has("l2")&&k&&(s&&0!==s.length?x&&(p.has(e)?S.l2=`${x.count} segments totaling ${o(zt(x))}. Largest is ${x.maxLabel} at ${o(x.max)}; smallest is ${x.minLabel} at ${o(x.min)}.`:S.l2=`${C} ranges from ${o(x.min)} (${x.minLabel}) to ${o(x.max)} (${x.maxLabel}), with a mean of ${o(x.mean)} across ${x.count} points.`):S.l2="No data is loaded yet."),a.has("l3")&&x&&!c&&h.has(e)?S.l3=Vt(x,C,o):a.has("l3")&&x&&!c&&m.has(e)&&(S.l3=`The highest ${A} is ${x.maxLabel} and the lowest is ${x.minLabel}.`),a.has("l4")){let n=Ft(t)?"alerting":Rt(e,r.capability);if(n){let a=c?null:x;S.l4=Ht(n,e,t,a,C,A,o,r.audience)}}let P=["l1","l2","l3","l4"].filter(e=>a.has(e)&&S[e]).map(e=>S[e]).join(" "),j=Bt(t);return{text:j?`${j} ${P}`.trim():P,levels:S,...j?{annotations:j}:{}}}function zt(e){return e.mean*e.count}function Vt(e,t,r){let{first:n,last:a,min:i,max:o,maxLabel:l,minLabel:s,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:f,count:h}=e,m=o-i,p=a-n;if(0===m)return`${Jt(t)} is constant at ${r(n)} across the series.`;if(m/(Math.abs(e.mean)||1)<.04)return`${Jt(t)} ends roughly where it started (${r(n)} at ${c} to ${r(a)} at ${u}), ranging between ${r(i)} and ${r(o)}.`;let g=f>0&&f<h-1,y=d>0&&d<h-1,b=(o-Math.max(n,a))/m,v=(Math.min(n,a)-i)/m;return g&&b>.15?`Overall ${t} climbs to a peak of ${r(o)} (${l}), then falls to ${r(a)} (${u}).`:y&&v>.15?`Overall ${t} drops to a low of ${r(i)} (${s}), then recovers to ${r(a)} (${u}).`:Math.abs(p)/m<.05?`${Jt(t)} ends roughly where it started (${r(n)} at ${c} to ${r(a)} at ${u}), ranging between ${r(i)} and ${r(o)}.`:p>0?f===h-1?`Overall ${t} rises from ${r(n)} (${c}) to a peak of ${r(a)} (${u}).`:`Overall ${t} rises from ${r(n)} (${c}) to ${r(a)} (${u}), after peaking at ${r(o)} (${l}).`:d===h-1?`Overall ${t} falls from ${r(n)} (${c}) to a low of ${r(a)} (${u}).`:`Overall ${t} falls from ${r(n)} (${c}) to ${r(a)} (${u}), after dipping to ${r(i)} (${s}).`}function Ht(e,t,r,n,a,i,o,l){let s,c,u=S[e],d=/^[aeiou]/i.test(u)?"an":"a";switch(e){case"locating":s="This is a map",c="read values by location";break;case"presenting":s="This is a single-value display",c=`read ${"string"==typeof r.label&&r.label?r.label:a} as the headline number`;break;case"tracing":s=`This is ${d} ${u} chart`,c="follow the movement between states";break;case"nesting":s=`This is ${d} ${u} chart`,c="read it for nested structure and how children sum into their parents";break;case"relating":s=`This is ${d} ${u} chart`,c=`read it for whether ${i} and ${a} move together`;break;default:s=`This is ${d} ${u} chart`,c=qt(e,n,a,i,o,t)}return`${s}; ${c}.${Kt(t,l)}`}function qt(e,t,r,n,a,i){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 ${n}`;case"ranking":return`read it top to bottom by ${r}`;case"apportioning":return`read each ${n}'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 Gt(t,a,i);case"tracking":return`read it for the trajectory of ${r}, which ${Ut(t)} from ${a(t.first)} (${t.firstLabel}) to ${a(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${r} across ${n}; ${t.maxLabel} leads at ${a(t.max)}`;case"ranking":return`read it top to bottom by ${r}; ${t.maxLabel} ranks highest at ${a(t.max)}`;case"apportioning":{let e=t.mean*t.count,r=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${a(e)} total; ${t.maxLabel} is the largest at ${a(t.max)}${null!=r?` (${r}%)`:""}`}case"characterizing":return`read it for the spread of ${r}, from ${a(t.min)} to ${a(t.max)}`;default:return"read the highlighted features"}}function Gt(e,t,r){if(m.has(r)||p.has(r))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;let{first:n,last:a,min:i,max:o,minLabel:l,maxLabel:s,lastLabel:c,minIndex:u,maxIndex:d,count:f}=e,h=o-i;if(h>0){let e=d>0&&d<f-1,r=u>0&&u<f-1,m=(o-Math.max(n,a))/h,p=(Math.min(n,a)-i)/h;if(e&&m>.15)return`the peak of ${t(o)} at ${s} is the point to investigate`;if(r&&p>.15)return`the dip to ${t(i)} at ${l} is the point to investigate`;if(a>=o)return`the climb to ${t(a)} at ${c} warrants a closer look`;if(a<=i)return`the drop to ${t(a)} at ${c} warrants a closer look`}return`the extremes — ${s} (${t(o)}) and ${l} (${t(i)}) — are the points to check`}function Ut(e){let t=e.max-e.min,r=e.last-e.first;return 0===t||Math.abs(r)/t<.05?"holds roughly steady":r>0?"rises":"falls"}function Kt(e,t){if(!t)return"";let r=t.familiarity?.[e];return"number"==typeof r&&r<=2?` This ${jt(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`:""}function Jt(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Wt(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:`${t}s`}function Qt(e){return qe(e)}function Xt(e){return!!e&&"object"==typeof e}function Zt(e,t,r,n){let a=Ye(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),o=a?Xe(a,r,n):void 0,l=[];o&&null!=e[o]&&l.push(Ve(e[o]));for(let t of i){let a=Xe(t,r,n);a&&null!=e[a]&&l.push(`${t.role}: ${Ve(e[a])}`)}return l.length>0?l.join(", "):"Data item"}function Yt(e,t,r={}){let n=We(t),a=Je(t),i=Math.max(1,r.maxLeaves??200),o=r.locale??"en";if("function"==typeof e.navigation)return e.navigation({data:n,config:a,locale:o});let l=Xt(e.navigation)?e.navigation:void 0,s=(l?.groupByRole?Ze(e,l.groupByRole):void 0)??(l?.groupBy?.[0]?Ze(e,l.groupBy[0])??e.dataRoles.find(e=>e.field===l.groupBy?.[0]):void 0)??Ye(e,["nominal","ordinal"]),c=s?Xe(s,a,n):void 0,u=(l?.idRole?Ze(e,l.idRole):void 0)??Ye(e,["identifier"]),d=u?Xe(u,a,n):void 0,f={id:"root",role:"chart",label:l?.summaryTemplate?et(l.summaryTemplate,void 0,e,a,n,{count:n.length}):`${e.name}: ${n.length} ${1===n.length?"item":"items"} represented.`,level:1,children:[]},h=0,m=(t,r,i)=>{let o=d?t[d]:void 0,s=l?.itemLabelTemplate?et(l.itemLabelTemplate,t,e,a,n,{count:n.length}):Zt(t,e,a,n);return{id:`datum-${Qt(o??r)}`,role:"datum",label:s,level:i,datum:t}};if(c){let e= new Map;for(let t of n){let r=Ve(t[c],"Uncategorized"),n=e.get(r);n?n.push(t):e.set(r,[t])}f.children=[...e].map(([e,t],r)=>{let n=Math.max(0,i-h),a=t.slice(0,n);h+=a.length;let o=a.map((e,t)=>m(e,1e5*r+t,3));return a.length<t.length&&o.push({id:`more-${Qt(e)}`,role:"datum",label:`…and ${t.length-a.length} more items`,level:3}),{id:`group-${Qt(e)}`,role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:o}})}else{let e=n.slice(0,i);f.children=e.map((e,t)=>m(e,t,2)),e.length<n.length&&f.children.push({id:"more",role:"datum",label:`…and ${n.length-e.length} more items`,level:2})}return f}function er(e,t,r){return`${e} ${1===e?t:r}`}function tr(e,t){if(0===e.numericLeaves)return"";let r=t(e.leafTotal);return e.numericLeaves===e.leaves?`, leaf total ${r}`:`, known leaf total ${r} across ${er(e.numericLeaves,"valued leaf","valued leaves")}`}function rr(e){return"TreeDiagram"===e?"tree":"Treemap"===e?"treemap":"CirclePack"===e?"circle-packing":"orbit"}function nr(e,t,r,n){let a=Le(t.data)?t.data:null,i=t.childrenAccessor,o=t.valueAccessor,l=t.nodeLabel??t.nodeIdAccessor,s= new WeakMap,c=e=>{let t=s.get(e);if(void 0!==t)return t??{descendants:0,depth:0,leaves:0,numericLeaves:0,leafTotal:0};s.set(e,null);let r=Ue(e,i),n=0===r.length,a=n?He(ze(e,o,"value")):void 0,l={descendants:0,depth:1,leaves:n?1:0,numericLeaves:null==a?0:1,leafTotal:a??0};for(let e of r){let t=c(e);l.descendants+=1+t.descendants,l.depth=Math.max(l.depth,t.depth+1),l.leaves+=t.leaves,l.numericLeaves+=t.numericLeaves,l.leafTotal+=t.leafTotal}return s.set(e,l),l},u=0,d= new WeakSet,f=(e,t,a)=>{let s=Ve(ze(e,l,"name"),`item ${a}`);if(d.has(e))return{id:`hierarchy-${qe(a)}-cycle`,role:"datum",level:t,label:`Repeated hierarchy reference to ${s}; branch omitted.`};let h=Ue(e,i),m=c(e);if(0===h.length){if(u>=r)return null;u+=1;let i=He(ze(e,o,"value"));return{id:`hierarchy-${qe(a)}-${qe(s)}`,role:"datum",level:t,label:`${s}${null==i?"":`: ${n(i)}`}.`,...null==i?{}:{value:i},datum:e}}d.add(e);let p=[],g=0;for(let[e,n]of h.entries()){if(u>=r){g+=c(n).leaves;continue}let i=f(n,t+1,`${a}-${e}`);i&&p.push(i)}return d.delete(e),g>0&&p.push({id:`hierarchy-${qe(a)}-more`,role:"datum",level:t+1,label:`${er(g,"more leaf","more leaves")} in ${s} not shown; navigation is capped at ${r}.`}),{id:`hierarchy-${qe(a)}-${qe(s)}`,role:"series",level:t,label:`${s}: ${er(h.length,"direct child","direct children")}, ${er(m.descendants,"total descendant","total descendants")}, ${er(m.leaves,"leaf","leaves")}${tr(m,n)}.`,datum:e,children:p}},h=a?c(a):null,m={id:"root",role:"chart",level:1,label:a?`A ${rr(e)} chart with ${er(h.leaves,"leaf","leaves")} and ${er(h.descendants,"total descendant","total descendants")} across ${er(h.depth,"hierarchy level","hierarchy levels")}${tr(h,n)}.`:"A hierarchy chart with no hierarchy data loaded.",children:[]};if(a){let e=f(a,2,"root");if(e){let t=Ve(ze(a,l,"name"),"");m.children="series"===e.role&&""===t?e.children:[e]}}return m}function ar(e){if(Array.isArray(e))return Ne(e);if(!e||"object"!=typeof e)return[];let t=e;return Array.isArray(t.features)?Ne(t.features):"Feature"===t.type?[t]:[]}function ir(e,t,r){let n=ze(e,t,r);if(void 0!==n)return n;let a=e.properties;return a&&"object"==typeof a?ze(a,t,r):void 0}function or(e,t,r){return Ve(ir(e,t,"id")??ir(e,"name","name")??ir(e,"NAME","NAME")??ir(e,"label","label"),r)}function lr(e){let t=0,r=1/0,n=-1/0,a=0;for(let i of e)null!=i.value&&(t+=1,r=Math.min(r,i.value),n=Math.max(n,i.value),a+=i.value);return 0===t?null:{count:t,min:r,max:n,total:a,average:a/t}}function sr(e,t){let r=lr(e);return r?`range ${t(r.min)} to ${t(r.max)}, average ${t(r.average)}, total ${t(r.total)}`:"no numeric values"}function cr(e){let t=e.filter(e=>null!=e.value),r=e.filter(e=>null==e.value),n=[],a=lr(t);if(a)if(a.min===a.max)n.push({id:"equal",label:"Equal values",rows:t});else{let e=a.min+(a.max-a.min)/3,r=a.min+2*(a.max-a.min)/3,i=t.filter(e=>e.value>=r),o=t.filter(t=>t.value>=e&&t.value<r),l=t.filter(t=>t.value<e);i.length>0&&n.push({id:"highest",label:"Highest values",rows:i}),o.length>0&&n.push({id:"middle",label:"Middle values",rows:o}),l.length>0&&n.push({id:"lowest",label:"Lowest values",rows:l})}return r.length>0&&n.push({id:"missing",label:"No numeric value",rows:r}),n}function ur(e,t,r){let n,a=e.filter(e=>null!=e.value).sort((e,t)=>t.value-e.value||e.index-t.index),i= new Map,o=0;for(let[e,t]of a.entries())n!==t.value&&(o=e+1,n=t.value),i.set(t.index,o);let l=0;return cr(e).map(e=>{let n=Math.max(0,t-l),o=e.rows.slice(0,n);l+=o.length;let s=o.map(e=>{let t=i.get(e.index),n=null==t||a.length<2?"":`, rank ${t} of ${a.length}`;return{id:`geo-${qe(e.label)}-${e.index}`,role:"datum",level:3,label:null==e.value?`${e.label}: no numeric value.`:`${e.label}: ${r(e.value)}${n}.`,...null==e.value?{}:{value:e.value},datum:e.datum}}),c=e.rows.length-o.length;return c>0&&s.push({id:`geo-${e.id}-more`,role:"datum",level:3,label:`${c} more ${1===c?"region":"regions"} in ${e.label.toLowerCase()} not shown; navigation is capped at ${t}.`}),{id:`regions-${e.id}`,role:"series",level:2,label:`${e.label}: ${e.rows.length} ${1===e.rows.length?"region":"regions"}, ${sr(e.rows,r)}.`,children:s}})}function dr(e,t,r,n){let a=ar(t.areas),i="FlowMap"===e&&Array.isArray(t.nodes)?t.nodes:Array.isArray(t.points)?t.points:[],o=Array.isArray(t.flows)?t.flows:[],l=Array.isArray(t.lines)?t.lines:[],s=t.valueAccessor??t.sizeBy??t.costAccessor??"value",c=t.pointIdAccessor??t.nodeIdAccessor??"id",u=("ChoroplethMap"===e?a:i).map((r,n)=>({datum:r,index:n,label:or(r,"ChoroplethMap"===e?t.idAccessor:c,`${"ChoroplethMap"===e?"region":"location"} ${n+1}`),value:He(ir(r,s,"value"))})),d=u.filter(e=>null!=e.value),f={id:"root",role:"chart",level:1,label:`${"ChoroplethMap"===e?`A choropleth map with ${a.length} regions.${d.length>0?` Values are available for ${d.length} of ${a.length} regions; ${sr(d,n)}.`:" No regions have numeric values."}`:"FlowMap"===e?`A flow map with ${o.length} flows and ${i.length} locations.`:"DistanceCartogram"===e?`A distance cartogram with ${i.length} locations and ${l.length} routes.`:`A proportional-symbol map with ${i.length} locations.`}${Ge(t,"Use linked highlighting to compare related locations.")}`,children:[]};if("ChoroplethMap"===e)f.children=ur(u,r,n);else if(u.length>0){let e=u.slice(0,r).map(e=>({id:`geo-${qe(e.label)}-${e.index}`,role:"datum",level:3,label:`${e.label}${null==e.value?"":`: ${n(e.value)}`}.`,...null==e.value?{}:{value:e.value},datum:e.datum}));u.length>r&&e.push({id:"geo-more",role:"datum",level:3,label:`…and ${u.length-r} more locations.`}),f.children?.push({id:"locations",role:"series",level:2,label:`Locations: ${u.length} marks.`,children:e})}let h="FlowMap"===e?o:l;if(h.length>0){let e=h.slice(0,r).map((e,t)=>{let r=Ve(e.source,"unknown"),a=Ve(e.target,"unknown"),i=He(ze(e,s,"value"));return{id:`route-${qe(r)}-${qe(a)}-${t}`,role:"datum",level:3,label:`${r} to ${a}${null==i?"":`: ${n(i)}`}.`,...null==i?{}:{value:i},datum:e}});f.children?.push({id:"routes",role:"series",level:2,label:`Routes: ${h.length} ${1===h.length?"route":"routes"}.`,children:e})}return f}function fr(e,t={},r={}){return!!Qe(e,t,r.recipe)||I.has(e)||M.has(e)||R.has(e)||h.has(e)||m.has(e)||p.has(e)||g.has(e)}function hr(e,t){t&&e.children?.push(t)}function mr(e,t,r,n){t=Ee(t);let a=Array.isArray(t.nodes)?t.nodes:[],i=Array.isArray(t.edges)?t.edges:Array.isArray(t.flows)?t.flows:[],o=t.nodeIdAccessor??t.nodeIDAccessor,l=t.sourceAccessor??"source",s=t.targetAccessor??"target",c=t.valueAccessor??"value",u=e=>Ve(ze(e,o,"id"),"unknown"),d=(e,t)=>Ve(ze(e,t,""),"unknown"),f= new Set;for(let e of i)f.add(d(e,l)),f.add(d(e,s));let h=a.length>0?a:[...f].map(e=>({id:e})),m= new Map;for(let e of h)m.set(u(e),{links:0,value:0});for(let e of i){let t=d(e,l),r=d(e,s),n=He(ze(e,c,"value"))??0;for(let e of[t,r]){let t=m.get(e)??{links:0,value:0};t.links+=1,t.value+=n,m.set(e,t)}}let p={id:"root",role:"chart",level:1,label:`A ${"SankeyDiagram"===e||"ProcessSankey"===e?"flow diagram":"ChordDiagram"===e?"chord diagram":"network graph"} with ${h.length} nodes and ${i.length} links.${Ge(t,"Use linked highlighting to trace related marks.")}`,children:[]},g=0,y= new Map,b=t.colorBy??"group";for(let e of h){let t=Ve(ze(e,b,"group"),"Ungrouped"),r=y.get(t);r?r.push(e):y.set(t,[e])}let v=[...y].map(([e,t],a)=>{let i=[];for(let[e,o]of t.entries()){if(g>=r)break;g+=1;let t=u(o),l=m.get(t)??{links:0,value:0},s=l.value>0?`, ${n(l.value)} total flow`:"";i.push({id:`node-${a}-${e}-${qe(t)}`,role:"datum",level:3,label:`${t}: ${l.links} ${1===l.links?"link":"links"}${s}.`,value:l.value>0?l.value:void 0,datum:o})}return{id:`nodes-${a}-${qe(e)}`,role:"series",level:2,label:`${e}: ${t.length} ${1===t.length?"node":"nodes"}.`,children:i}});v.length>0&&p.children?.push(...v);let $=i.slice(0,r).map((e,t)=>{let r=d(e,l),a=d(e,s),i=He(ze(e,c,"value"));return{id:`link-${qe(r)}-${qe(a)}-${t}`,role:"datum",level:3,label:`${r} to ${a}${null==i?"":`: ${n(i)}`}.`,value:i,datum:e}});return i.length>r&&$.push({id:"links-more",role:"datum",level:3,label:`…and ${i.length-r} more links.`,value:void 0}),$.length>0&&p.children?.push({id:"links",role:"series",level:2,label:`Links: ${i.length} ${1===i.length?"connection":"connections"}.`,children:$}),p}function pr(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function gr(e,t){let r=Array.isArray(e.annotations)?e.annotations:null;if(!r)return null;let n=W(r.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let a=0,i=n.slice(0,t).map(e=>{let t=e.lifecycle?.status,r=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+a++,role:"annotation",level:3,label:`${pr(Tt(e))}${r}.`,datum:e}});n.length>t&&i.push({id:"annotation-"+a++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});let o=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===o?"one marked feature":`${o} marked features`}.`,children:i}}function yr(e,t,r={}){t=Ee(t);let n=r.locale??"en",a=Math.max(1,r.maxLeaves??200),i=Dt(n),o=Qe(e,t,r.recipe);if(o)return Yt(o,t,{maxLeaves:a,locale:n});let l={id:"root",role:"chart",label:_t(e,t,{locale:n}).text||"Chart.",level:1,children:[]},s=gr(t,a);if(I.has(e)){let r=mr(e,t,a,i);return hr(r,s),r}if(M.has(e)){let r=nr(e,t,a,i);return hr(r,s),r}if(R.has(e)){let r=dr(e,t,a,i);return hr(r,s),r}let c=Array.isArray(t.data)?t.data:null,u=fr(e,t,r);if(!c||0===c.length||!u)return s&&(l.children=[s]),l;let{measure:d,measureFallback:f,dimension:p,dimensionFallback:g}=dt(e,t),y=_e(d,f),b=Q(p,g),v="string"==typeof d&&d?d:f,$="string"==typeof p&&p?p:g,w=ft(t),C=0,A=e=>`${e}-${C++}`,S=(e,t)=>{let r=y(e),n=ht(b(e),i);return{id:A("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(r)?i(r):"—"}`,value:Number.isFinite(r)?r:void 0,datum:e}},k=(e,t)=>{let r=e.slice(0,a).map(e=>S(e,t));return e.length>a&&r.push({id:A("more"),role:"datum",level:t,label:`…and ${e.length-a} more points`}),r},x=[];if(h.has(e)||m.has(e)){let t=1/0,r=-1/0,n=1/0,a=-1/0,o=[],l=!0;for(let e of c){let i=y(e);Number.isFinite(i)&&(i<t&&(t=i),i>r&&(r=i));let s=b(e);o.push(s),"number"==typeof s&&Number.isFinite(s)?(s<n&&(n=s),s>a&&(a=s)):l=!1}let s= new Set,u=[];for(let e of o){let t=Ve(e);s.has(t)||(s.add(t),u.push(e))}let d=l?`${i(n)} to ${i(a)}`:`${ht(u[0],i)} to ${ht(u[u.length-1],i)} (${m.has(e)?`${u.length} categories`:`${c.length} points`})`;x.push({id:A("axis"),role:"axis",level:2,label:`${m.has(e)?"Category axis":"X axis"}: ${$}, ${d}.`}),r>=t&&x.push({id:A("axis"),role:"axis",level:2,label:`Value axis: ${v}, ${i(t)} to ${i(r)}.`})}if(w){let r=Q(w,w),a= new Map;for(let e of c){let t=Ve(r(e)),n=a.get(t);n?n.push(e):a.set(t,[e])}let i=[];for(let[r,o]of a){let a=_t(e,{...t,data:o},{levels:["l2","l3"],locale:n}).text;i.push({id:A("series"),role:"series",level:2,label:`Series ${r}: ${a}`,children:k(o,3)})}l.children=[...x,...i]}else l.children=[...x,...k(c,2)];return s&&l.children.push(s),l}function br(e){return Le(e)?e:void 0}function vr(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:void 0}function $r(e){let t=vr(e);return null==t?void 0:Math.max(0,Math.floor(t))}function wr(...e){return e.map(br).find(Boolean)}function Cr(...e){return e.find(Array.isArray)}function Ar(e){let t={};for(let[r,n]of Object.entries(e))void 0!==n&&(t[r]=n);return t}function Sr(e,t,r){return e["string"==typeof t&&t?t:r]}function kr(e){return"number"==typeof e?Number.isInteger(e)?String(e):String(Math.round(1e3*e)/1e3):Ve(e)}function xr(e,t,r){let n=[];if("GaugeChart"===e){"number"==typeof t.value&&Number.isFinite(t.value)&&n.push(`Current value is ${kr(t.value)}.`);let e="number"==typeof t.min&&Number.isFinite(t.min)?t.min:0,r="number"==typeof t.max&&Number.isFinite(t.max)?t.max:100;n.push(`The gauge scale runs from ${kr(e)} to ${kr(r)}.`)}if("SankeyDiagram"===e||"ProcessSankey"===e){let a=Array.isArray(t.edges)?t.edges:[];if("ProcessSankey"===e&&Array.isArray(t.domain)&&2===t.domain.length&&n.push(`The ProcessSankey time domain runs from ${kr(t.domain[0])} to ${kr(t.domain[1])}.`),a.length>0){n.push(`${a.length} source flow${1===a.length?"":"s"} are supplied.`);for(let i of a.slice(0,r)){let r=Sr(i,t.sourceAccessor,"source"),a=Sr(i,t.targetAccessor,"target"),o=Sr(i,t.valueAccessor,"value"),l="ProcessSankey"===e&&(null!=i.startTime||null!=i.endTime);n.push(l?`${kr(r)} to ${kr(a)} has value ${kr(o)} over ${kr(i.startTime)}–${kr(i.endTime)}.`:`${kr(r)} to ${kr(a)} has value ${kr(o)}.`)}}}if("Treemap"===e||"CirclePack"===e||"TreeDiagram"===e||"OrbitDiagram"===e){let e=Le(t.data)?t.data:void 0,a="string"==typeof t.valueAccessor&&t.valueAccessor?t.valueAccessor:"value",i="string"==typeof t.nodeIdAccessor&&t.nodeIdAccessor?t.nodeIdAccessor:"string"==typeof t.nodeIDAccessor&&t.nodeIDAccessor?t.nodeIDAccessor:"name",o=[],l= new WeakSet,s=e=>{if(l.has(e))return;let r=Ue(e,t.childrenAccessor);if(0!==r.length){l.add(e);for(let e of r)s(e);l.delete(e)}else o.push(e)};if(e&&s(e),o.length>0){n.push(`${o.length} hierarchy leaves are supplied.`);for(let e of o.slice(0,r))n.push(`${kr(e[i])} has value ${kr(e[a])}.`)}}if(F.has(e)&&Array.isArray(t.data)){let r=t.data;n.push(`${r.length} observed source row${1===r.length?"":"s"} are supplied.`);let a="CollisionSwarmChart"===e?t.xAccessor:t.valueAccessor,i="CollisionSwarmChart"===e?"x":"value",o=r.map(e=>vr(Sr(e,a,i))).filter(e=>null!=e);if(o.length>0){let[e,t]=Y(o);n.push(`Observed ${"string"==typeof a?a:i} ranges from ${kr(e)} to ${kr(t)}.`)}}if(0!==n.length)return{source:"chart-props",statements:n,text:`Exact chart-prop facts: ${n.join(" ")}`}}function Pr(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:`${t}s`}function jr(e){return Number.isInteger(e)?String(e):String(Math.round(1e3*e)/1e3)}function Or(e,t,r,n){let a=br(e.settledProjection),i=br(t?.settledProjection);return Cr(r?.projectionRows,r?.aggregates,e.settledProjectionRows,e.projectionRows,a?.rows,t?.settledProjectionRows,t?.projectionRows,i?.rows,n?.binCounts)}function Ir(e){if(!e||0===e.length)return;let t=e.map((e,t)=>{let r=br(e);if(!r)return;let n=vr(r.count??r.value??r.total??r.bodies??r.events);if(null==n)return;let a=Ve(r.label??r.id??r.name,`container ${t+1}`),i=null==r.id?void 0:Ve(r.id),o=vr(r.secondary??r.secondaryCount),l=vr(r.observed??r.observedCount);return Ar({id:i,label:a,count:n,secondary:o,secondaryLabel:"string"==typeof r.secondaryLabel?r.secondaryLabel:void 0,observed:l})}).filter(e=>null!=e);if(0===t.length)return;let r=t.reduce((e,t)=>e+t.count,0),n=t.filter(e=>e.count>0).length,a=t.slice().sort((e,t)=>t.count-e.count)[0];return{rows:t,totalCount:r,populatedCount:n,...a?{leader:a}:{}}}function Mr(e,t){let r=e?.map((e,t)=>{let r=br(e);if(!r)return;let n=vr(r.count)??0,a=vr(r.total),i={label:Ve(r.label??r.id,`sediment ${t+1}`),count:n};return null!=r.id&&(i.id=Ve(r.id)),null!=a&&(i.total=a),i}).filter(e=>null!=e),n=$r(t?.bins)??r?.length??0,a=vr(t?.count)??r?.reduce((e,t)=>e+t.count,0)??0,i=vr(t?.total)??r?.reduce((e,t)=>e+(t.total??0),0),o=r?.slice().sort((e,t)=>t.count-e.count)[0];if(0!==n||0!==a||i)return{bins:n,count:a,...null!=i&&i>0?{total:i}:{},...o?{leader:o}:{}}}function Rr(e){let t=br(e);return!!t&&(Le(t.world)||"simulationState"in t||"liveBodyOrder"in t)}function Fr(e){if(e)return e.filter(e=>!0===br(e)?.sleeping).length}function Dr(e,t,r){let n=e?.filter(e=>!0===br(e)?.sensor).length,a=br(t?.observation),i=br(a?.sensors),o=Cr(r?.activeSensors);return Math.max(n??0,i?Object.keys(i).length:0,o?.length??0)||void 0}function Lr(e){let t=[],r=e.simulation,n=[r.state??(r.settled?"settled":void 0),null!=r.liveBodies?`${r.liveBodies} live ${Pr(r.liveBodies,"body")}`:void 0,null!=r.sleepingBodies?`${r.sleepingBodies} sleeping`:void 0,null!=r.queued?`${r.queued} queued`:void 0,null!=r.seed?`seed ${jr(r.seed)}`:void 0,r.gravity?`gravity (${jr(r.gravity.x)}, ${jr(r.gravity.y)})`:void 0,null!=r.fixedDt?`fixed step ${jr(r.fixedDt)}s`:void 0,null!=r.timeScale?`${jr(r.timeScale)}x time`:void 0].filter(Boolean);n.length>0&&t.push(`Physics simulation: ${n.join("; ")}.`);let a=e.geometry;if(a){let e=[null!=a.colliders?`${a.colliders} ${Pr(a.colliders,"collider")}`:void 0,null!=a.sensors?`${a.sensors} ${Pr(a.sensors,"sensor")}`:void 0,null!=a.springs?`${a.springs} ${Pr(a.springs,"spring")}`:void 0,null!=a.activeSensorPairs?`${a.activeSensorPairs} active sensor ${Pr(a.activeSensorPairs,"pair")}`:void 0].filter(Boolean);e.length>0&&t.push(`Physics geometry: ${e.join("; ")}.`)}let i=e.aggregates;if(i){let e=i.leader,r=e?` Largest is ${e.label} with ${jr(e.count)}.`:"";t.push(`Physics aggregates: ${jr(i.totalCount)} settled ${Pr(i.totalCount,"body")} across ${i.rows.length} ${Pr(i.rows.length,"container")}; ${i.populatedCount} populated.${r}`)}let o=e.sediment;if(o){let e=null!=o.total?`, value total ${jr(o.total)}`:"",r=o.leader?`; largest sediment bin is ${o.leader.label} with ${jr(o.leader.count)}`:"";t.push(`Physics sediment: ${o.count} retained ${Pr(o.count,"body")} in ${o.bins} ${Pr(o.bins,"bin")}${e}${r}.`)}return t.join(" ")}function Nr(e,t,r){if(!1===r)return;let n=br(r),a=br(t.physics),i=wr(n?.snapshot,a?.snapshot,t.physicsSnapshot,Rr(t.snapshot)?t.snapshot:void 0),o=wr(n?.evidence,a?.evidence,t.physicsEvidence,t.settledEvidence),l=wr(n?.config,a?.config,i?.config,t.config),s=wr(br(i?.world),br(a?.world)),c=wr(br(l?.kernel),br(s?.options)),u=Cr(s?.bodies),d=Cr(s?.colliders,l?.colliders),f=Cr(i?.queue,a?.queue),h=Cr(i?.liveBodyOrder),m=Cr(s?.springs),p=Cr(i?.activeSensorPairs),g=Ir(Or(t,a,n,o)),y=Mr(Cr(n?.sediment,a?.sediment,i?.sediment),wr(n?.sedimentTotals,a?.sedimentTotals)),b=h?.length??u?.length??$r(o?.bodyCount),v=Fr(u)??$r(o?.sleepingCount),$=f?.length,w="string"==typeof i?.simulationState?i.simulationState:void 0,C="boolean"==typeof o?.settled?o.settled:w?"settled"===w:null!=b||null!=v||null!=$?null!=b&&v===b&&0===($??0):void 0,A=br(c?.gravity),S=vr(A?.x),k=vr(A?.y),x=Ar({state:w,settled:C,elapsedSeconds:vr(i?.elapsedSeconds),paused:"boolean"==typeof i?.paused?i.paused:void 0,visible:"boolean"==typeof i?.visible?i.visible:void 0,seed:vr(c?.seed),gravity:null!=S&&null!=k?{x:S,y:k}:void 0,fixedDt:vr(l?.fixedDt??c?.fixedDt),timeScale:vr(l?.timeScale),maxSubsteps:$r(l?.maxSubsteps),liveBodies:b,sleepingBodies:v,queued:$,bodyLimit:vr(l?.bodyLimit),eviction:"string"==typeof l?.eviction?l.eviction:void 0}),P=Ar({colliders:d?.length,sensors:Dr(d,l,s),springs:m?.length,activeSensorPairs:p?.length}),j=Object.keys(P).length>0,O=F.has(e);if(!(Object.keys(x).length>0||j||g||y)||!O&&null==r)return;let I={simulation:x,...j?{geometry:P}:{},...g?{aggregates:g}:{},...y?{sediment:y}:{}},M=Lr(I);return{...I,text:M}}function Er(e){if(!e)return{};if("fits"in e||"buildProps"in e)return{family:e.family};let t=e;return{family:t.family,intentScores:t.intentScores}}function Tr(e,t,r={}){t=Ee(t);let n,{capability:a,audience:i,locale:o}=r,l=r.levels??["l1","l2","l3"],s=!1!==r.includeStructure,c=Rt(e,a),u=_t(e,t,{levels:c?[...l,"l4"]:l,locale:o,capability:a,audience:i}),{l4:d,...f}=u.levels,h=["l1","l2","l3"].map(e=>u.levels[e]).filter(Boolean).join(" "),m={levels:f,text:u.annotations?`${u.annotations} ${h}`.trim():h,...u.annotations?{annotations:u.annotations}:{}};if(c&&d){let e=Er(a);n={act:c,sentence:d,family:e.family,intentScores:e.intentScores}}let p=s?yr(e,t,{maxLeaves:r.maxLeaves,locale:o}):void 0,g=Nr(e,t,r.physics),y=xr(e,t,Math.max(1,r.maxLeaves??200)),b=[m.text,n?.sentence,g?.text,y?.text].filter(Boolean).join(" ");return{component:e,description:m,intent:n,structure:p,physics:g,facts:y,text:b}}function Br(e,t){let r=e.trim();if(!r)throw new Error(`${t} must be a non-empty string.`);return encodeURIComponent(r)}function _r(e,...t){return`${e}/${t.map(e=>Br(e,"VACP ref segment")).join("/")}`}function zr(e,t){let r=`vacp://${Br(e,"appId")}`,n=_r(r,"view",t),a=e=>_r(n,"visualization",e);return{app:r,view:n,visualization:a,config:e=>_r(a(e),"config"),data:(e,t="data")=>_r(a(e),"data",t),selection:e=>_r(n,"selection",e),navigation:e=>_r(a(e),"navigation"),observation:e=>_r(a(e),"interaction","latest-observation")}}function Vr(e){let t=e.now?.()?? new Date,r=t instanceof Date?t:new Date(t);if(!Number.isFinite(r.getTime()))throw new Error("VACP bridge clock returned an invalid date.");return r.toISOString()}function Hr(e){let t="function"==typeof e?e():e,r= new Set;for(let e of t){let t=e.chartId.trim();if(!t)throw new Error("Every VACP chart requires a non-empty chartId.");if(r.has(t))throw new Error(`Duplicate VACP chartId "${t}".`);r.add(t)}return t}function qr(e){try{let{createdAt:t,...r}=st(e.component,e.props,{includeData:!1});return re(r)}catch(t){let r= Object.create(null);for(let[t,n]of Object.entries(e.props)){if(D.includes(t)||"function"==typeof n)continue;let e=te(n);void 0!==e&&(r[t]=e)}return{component:e.component,props:r,version:"unregistered",warning:t instanceof Error?t.message:"Chart config could not be serialized by toConfig."}}}function Gr(e){return Tr(e.component,e.props,{...e.grounding,audience:e.audience,includeStructure:!0,maxLeaves:N})}function Ur(e,t){let r=[];for(let n of D){let a=e.props[n];Array.isArray(a)&&r.push({ref:t.data(e.chartId,n),chartId:e.chartId,collection:n,rows:a})}return r}function Kr(e,t){t(e);for(let r of e.children??[])Kr(r,t)}function Jr(e,t){if(!t)return;let r;return Kr(e,e=>{!r&&e.id===t&&(r=e)}),r}function Wr(e){return null==e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e||e instanceof Date&&Number.isFinite(e.getTime())}function Qr(e,t){if("datum"!==e.role||!e.datum)return;let r= Object.create(null);for(let n of t){if(!Object.prototype.hasOwnProperty.call(e.datum,n)||!Wr(e.datum[n]))return;r[n]=e.datum[n]instanceof Date?e.datum[n].toISOString():e.datum[n]}return r}function Xr(e,t){let r=Array.from(new Set(e.matchFields.map(e=>e.trim()).filter(Boolean))),n= new Map;if(!r.length)return{valid:!1,diagnostic:"Navigation actions require at least one durable match field.",byKey:n,matchFields:r,targetRef:()=>_r(t,"target","invalid")};let a,i=0,o=0,l=!1;return Kr(e.tree,e=>{if("datum"!==e.role)return;i++;let t=Qr(e,r);if(!t)return void o++;let a=oe(t);n.has(a)?l=!0:n.set(a,e)}),i?o?a=`${o} navigation leaves lack durable primitive match-field values.`:l&&(a="Navigation match fields do not uniquely identify every datum leaf."):a="Navigation tree has no datum leaves.",{valid:!a,...a?{diagnostic:a}:{},byKey:n,matchFields:r,targetRef:e=>_r(t,"target",oe(e))}}function Zr(e,t){let r= new Map;for(let t of e)for(let e of t.chart.selections??[]){let n=e.name.trim();if(!n)throw new Error("VACP selection names must be non-empty.");let a=r.get(n)??{fields: new Set,modes: new Set,chartRefs: new Set};for(let t of e.fields.map(e=>e.trim()))t&&a.fields.add(t);if("interval"!==e.mode&&a.modes.add("point"),"point"!==e.mode&&a.modes.add("interval"),e.clientId){if(a.clientId&&a.clientId!==e.clientId)throw new Error(`Selection "${n}" declares conflicting VACP clientIds.`);a.clientId=e.clientId}a.chartRefs.add(t.ref),r.set(n,a)}return Array.from(r).sort(([e],[t])=>e.localeCompare(t)).map(([e,r])=>{if(0===r.fields.size)throw new Error(`Selection "${e}" requires at least one allowlisted field.`);return{ref:t.selection(e),name:e,fields:Array.from(r.fields).sort(),modes:r.modes,clientId:r.clientId??`__semiotic-vacp__:${e}`,chartRefs:Array.from(r.chartRefs)}})}function Yr(e,t){let{chart:r,ref:n,configRef:i,grounding:l}=e,s=[{ref:n,kind:"Visualization",layer:"VisualizationLayer",title:r.title??String(r.props.title??r.component),description:r.description??l.text,data:re({component:r.component,grounding:{description:l.description,intent:l.intent,physics:l.physics,text:l.text},audience:r.audience})},{ref:i,kind:"Param",layer:"ConfigLayer",title:`${r.component} configuration`,description:"Serializable Semiotic chart configuration with raw data collections omitted.",data:e.config}],c=[{from:e.ref,to:i,kind:"contains"}],u=(l.structure?.children??[]).filter(e=>"axis"===e.role).map(e=>e.label),d=0;for(let[e,t]of L){let a=r.props[e];if("string"!=typeof a||!a.trim())continue;let i=_r(n,"encoding",t);if(s.push({ref:i,kind:"EncodingChannel",layer:"VisualizationLayer",title:`${t} → ${a}`,data:{channel:t,field:a,accessorProp:e}}),c.push({from:n,to:i,kind:"contains"}),"x"===t||"y"===t||"category"===t||"value"===t||"ordinal"===t||"radial"===t){let e=_r(n,"axis",t);s.push({ref:e,kind:"Axis",layer:"VisualizationLayer",title:u[d++]??`${t} axis: ${a}`,data:{channel:t,field:a}}),c.push({from:n,to:e,kind:"contains"}),c.push({from:e,to:i,kind:"derivedFrom"})}}for(let i of e.dataHandles)s.push({ref:i.ref,kind:"DataHandle",layer:"DataLayer",title:`${r.chartId}.${i.collection}`,description:"Bounded details-on-demand handle. Use vacp.data_schema before requesting an opt-in sample.",data:{collection:i.collection,rowCount:i.rows.length,schemaAction:o,...t.dataAccess?.sample?{inspectAction:a}:{}}}),c.push({from:n,to:i.ref,kind:"contains"});if(e.navigation){let{navigation:t}=e;s.push({ref:t.ref,kind:"Selection",layer:"InteractionFeedbackLayer",title:`${r.title??r.component} structured navigation`,description:t.index.diagnostic??"Active accessible-navigation target identified by durable datum fields.",data:{matchFields:t.index.matchFields,targetCount:t.index.byKey.size,status:t.index.valid?t.binding.onActiveChange?"actionable":"read-only":"ambiguous"}}),c.push({from:n,to:t.ref,kind:"contains"})}if(t.getObservations){let e=_r(n,"interaction","latest-observation");s.push({ref:e,kind:"InteractionTarget",layer:"InteractionFeedbackLayer",title:`${r.title??r.component} latest observation`,description:"Latest semantic hover, focus, selection, brush, activation, or control observation."}),c.push({from:n,to:e,kind:"contains"})}let f=Array.isArray(r.props.annotations)?r.props.annotations:[],h= new Set;for(let e of f){if(!ee(e))continue;let t=ee(e.provenance)?e.provenance:void 0,a=e.id??e.stableId??t?.stableId,i=null==a||""===a?void 0:String(a);if(!i)continue;let o=ee(e.note)?e.note:void 0,l=ee(e.noteData)?e.noteData:void 0,u=_r(n,"annotation",i);if(h.has(u))throw new Error(`Duplicate stable annotation id "${i.trim()}" in VACP chart "${r.chartId}".`);h.add(u),s.push({ref:u,kind:"InteractionTarget",layer:"VisualizationLayer",title:String(e.label??o?.label??l?.label??`Annotation ${i}`),description:"string"==typeof e.note?e.note:"string"==typeof e.description?e.description:void 0,data:re({id:i,provenance:t,lifecycle:e.lifecycle})}),c.push({from:n,to:u,kind:"contains"})}return{nodes:s,edges:c}}function en(e,t){let r=Hr(e.charts).map(e=>{let r=t.visualization(e.chartId),n=e.navigation?{ref:t.navigation(e.chartId),chartRef:r,chartId:e.chartId,binding:e.navigation,index:Xr(e.navigation,t.navigation(e.chartId))}:void 0;return{chart:e,ref:r,configRef:t.config(e.chartId),grounding:Gr(e),config:qr(e),dataHandles:Ur(e,t),...n?{navigation:n}:{}}}),n=Zr(r,t),a=r.flatMap(e=>e.dataHandles),o=[{ref:t.app,kind:"App",layer:"ViewLayer",title:e.title??e.appId,description:"Semiotic application state exposed through the experimental VACP 0.1.0 bridge.",data:{provider:"semiotic",protocol:i}},{ref:t.view,kind:"View",layer:"ViewLayer",title:e.title??e.viewId??"Semiotic charts"}],l=[{from:t.app,to:t.view,kind:"contains"}];for(let n of r){let r=Yr(n,e);o.push(...r.nodes),l.push(...r.edges),l.push({from:t.view,to:n.ref,kind:"contains"})}for(let e of n){o.push({ref:e.ref,kind:"Selection",layer:"InteractionFeedbackLayer",title:`Selection: ${e.name}`,description:"Named LinkedCharts selection. Agent mutations are restricted to declared fields and modes.",data:{name:e.name,fields:e.fields,modes:Array.from(e.modes).sort()}}),l.push({from:t.view,to:e.ref,kind:"contains"});for(let t of e.chartRefs)l.push({from:e.ref,to:t,kind:"controls"})}return{charts:r,selections:n,dataHandles:a,nodes:o,edges:l}}function tn(e,t){for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.chartId===t)return n}}function rn(e,t,r){let n={},a={},o=t.getSelections?.()??{},l=t.getObservations?.()??[];for(let i of e.charts){n[i.ref]=re({component:i.chart.component,description:i.grounding.description,intent:i.grounding.intent,physics:i.grounding.physics,audience:i.chart.audience}),n[i.configRef]=i.config,a[i.ref]={component:i.chart.component,dataHandles:i.dataHandles.length};for(let e of i.dataHandles)n[e.ref]={kind:"DataHandle",collection:e.collection,rowCount:e.rows.length},a[e.ref]={rowCount:e.rows.length};if(i.navigation){let e=Jr(i.navigation.binding.tree,i.navigation.binding.activeId),t=e?Qr(e,i.navigation.index.matchFields):void 0;n[i.navigation.ref]=re({kind:"Selection",status:i.navigation.index.valid?"ready":"ambiguous",activeRole:e?.role,activeLabel:e?.label,activeMatch:t,activeTargetRef:t?i.navigation.index.targetRef(t):void 0,diagnostic:i.navigation.index.diagnostic}),a[i.navigation.ref]={targetCount:i.navigation.index.byKey.size}}if(t.getObservations){let e=tn(l,i.chart.chartId);n[r.observation(i.chart.chartId)]=e?re(e):null,e&&(a[r.observation(i.chart.chartId)]={type:e.type,timestamp:e.timestamp})}}for(let t of e.selections){let e=o[t.name];n[t.ref]=(e?re(e):void 0)??{name:t.name,resolution:"union",clauses:[]},a[t.ref]={active:!!e?.clauses.length,clauseCount:e?.clauses.length??0,fields:t.fields}}return{version:i,createdAt:Vr(t),state:n,...Object.keys(a).length?{summary:a}:{}}}function nn(e,t){let r=en(e,t);return{...r,actions:Oe(r,e,t)}}function an(e){let t=e.viewId?.trim()||"main",r=zr(e.appId,t),n="number"==typeof e.stateCacheSize&&Number.isFinite(e.stateCacheSize)?Math.max(1,Math.floor(e.stateCacheSize)):64,a= new Map,o=(e,t)=>{for(a.has(e)&&a.delete(e),a.set(e,t);a.size>n;){let e=a.keys().next().value;if("string"!=typeof e)break;a.delete(e)}};return{version:i,refs:r,getCapabilities:t=>{let n=nn(e,r),a={version:i,createdAt:Vr(e),graph:{version:i,nodes:n.nodes,edges:n.edges,actions:n.actions.map(e=>e.descriptor)}};return t?me(a,t):a},getState:async function(t){let n=rn(nn(e,r),e,r);if(!t)return n;let l,{snapshot:s,refs:c}=ue(n,t),u=le(s),d=t.since?a.get(t.since):void 0;if("full"!==t.mode&&t.since&&d){let e=ue(d,t).snapshot;l={version:i,createdAt:s.createdAt,mode:"delta",token:u,baseToken:t.since,...c?{scope:{refs:c}}:{},delta:de(e,s)}}else l={version:i,createdAt:s.createdAt,mode:"full",token:u,...c?{scope:{refs:c}}:{},snapshot:s};return o(u,n),l},execute:async t=>{let n=t&&"string"==typeof t.callId?t.callId:"";try{if(!t||"string"!=typeof t.name||!t.name.trim())throw new Error("VACP action call requires a non-empty name.");if(!n)throw new Error("VACP action call requires a callId.");let a=nn(e,r),i=a.actions.find(e=>e.descriptor.name===t.name);if(!i)return{callId:n,ok:!1,error:{message:`Unknown or currently unavailable VACP action "${t.name}".`,details:{available:a.actions.map(e=>e.descriptor.name)}}};let o=te(await i.execute(t.params));return{callId:n,ok:!0,...void 0!==o?{result:o}:{}}}catch(e){return{callId:n,ok:!1,error:{message:e instanceof Error?e.message:"VACP action failed."}}}}}}function on(e,t={}){let r=t.globalKey?.trim()||"__vacp",n=t.target??(typeof window<"u"?window:void 0);if(!n)return{installed:!1,globalKey:r,bridge:e,reason:`Refused to install "${r}" without a browser window or an explicit target.`,cleanup:()=>!1};if("__proto__"===r||"prototype"===r||"constructor"===r)return{installed:!1,globalKey:r,bridge:e,reason:`Refused unsafe global key "${r}".`,cleanup:()=>!1};let a=n[r];if(void 0!==a&&a!==e)return{installed:!1,globalKey:r,bridge:e,reason:`Refused to replace existing global "${r}".`,cleanup:()=>!1};try{n[r]=e}catch(t){return{installed:!1,globalKey:r,bridge:e,reason:t instanceof Error?`Could not install "${r}": ${t.message}`:`Could not install "${r}".`,cleanup:()=>!1}}return{installed:!0,globalKey:r,bridge:e,cleanup:()=>{if(n[r]!==e)return!1;try{return delete n[r]}catch{return!1}}}}var e="semiotic.set_point_selection",t="semiotic.set_interval_selection",r="semiotic.clear_selection",n="semiotic.activate_navigation_node",a="semiotic.inspect_data",i="0.1.0",o="vacp.data_schema",l=["MotifBraidChart","DependencyForestChart","FlowCircuitChart","BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","RadarChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","WaterfallChart","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"],s=/*#__PURE__*/new Set(l),c=/*#__PURE__*/Symbol.for("semiotic.chartRecipeRegistry"),u="1",d=/*#__PURE__*/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","interactiveGraphics","legend","recipe","layout"]),f="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e)),h=/*#__PURE__*/new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),m=/*#__PURE__*/new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),p=/*#__PURE__*/new Set(["PieChart","DonutChart","FunnelChart"]),g=/*#__PURE__*/new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]),y={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",BumpChart:"bump 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"},b=/*#__PURE__*/new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),v=/*#__PURE__*/new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]),$=/*#__PURE__*/new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),w={"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"},C={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},A=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],S={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"},k=/*#__PURE__*/new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),x=/*#__PURE__*/new Set(["system","agent","watcher"]),P=/*#__PURE__*/new Set(["ai","agent","system","computed","dbt","great-expectations"]),j=/*#__PURE__*/new Set(["rule","statistical-test","llm-inference","computed"]),O={"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"},I=/*#__PURE__*/new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),M=/*#__PURE__*/new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),R=/*#__PURE__*/new Set(["ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram"]),F=/*#__PURE__*/new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]),D=["data","nodes","edges","points","areas","lines","flows"],L=[["xAccessor","x"],["yAccessor","y"],["categoryAccessor","category"],["valueAccessor","value"],["colorBy","color"],["sizeAccessor","size"],["lineBy","series"],["groupAccessor","group"],["oAccessor","ordinal"],["rAccessor","radial"],["sourceAccessor","source"],["targetAccessor","target"],["nodeIDAccessor","id"]],N=1;export{n as unstable_SEMIOTIC_VACP_ACTIVATE_NAVIGATION_ACTION,r as unstable_SEMIOTIC_VACP_CLEAR_SELECTION_ACTION,a as unstable_SEMIOTIC_VACP_INSPECT_DATA_ACTION,t as unstable_SEMIOTIC_VACP_SET_INTERVAL_SELECTION_ACTION,e as unstable_SEMIOTIC_VACP_SET_POINT_SELECTION_ACTION,o as unstable_VACP_DATA_SCHEMA_ACTION,i as unstable_VACP_SCHEMA_VERSION,an as unstable_createSemioticVACPBridge,on as unstable_installSemioticVACPBridge};
|
|
1
|
+
import{C as E,E as T,F as B,G as _,H as z,b as V,c as H,e as q,f as G,g as U,h as K,i as J,n as W,q as Q,y as X,z as Z}from"./c-2AURU3I6.min.js";import{a as Y}from"./c-5H6IMPPV.min.js";function ee(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function te(e,t={}){let r="number"==typeof t.maxDepth&&Number.isFinite(t.maxDepth)?Math.max(1,Math.floor(t.maxDepth)):10,n="number"==typeof t.maxArrayLength&&Number.isFinite(t.maxArrayLength)?Math.max(1,Math.floor(t.maxArrayLength)):1e3,a= new WeakSet,i=(e,t)=>{if(null==e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e)return Number.isFinite(e)?e:String(e);if("bigint"==typeof e)return e.toString();if("function"==typeof e||"symbol"==typeof e||typeof e>"u")return;if(e instanceof Date)return Number.isFinite(e.getTime())?e.toISOString():null;if(t>=r)return"[depth limit]";if("object"!=typeof e)return String(e);if("$$typeof"in e)return;if(a.has(e))return"[circular]";if(a.add(e),Array.isArray(e)){let r=e.slice(0,n).map(e=>i(e,t+1)).filter(e=>void 0!==e);return a.delete(e),r}if(e instanceof Set){let r=Array.from(e).slice(0,n).map(e=>i(e,t+1)).filter(e=>void 0!==e);return a.delete(e),r}if(e instanceof Map){let r= Object.create(null),o=0;for(let[a,l]of e){if(o++>=n)break;let e=i(l,t+1);void 0!==e&&(r[String(a)]=e)}return a.delete(e),r}let o= Object.create(null);for(let r of Object.keys(e).sort()){let n=i(e[r],t+1);void 0!==n&&(o[r]=n)}return a.delete(e),o};return i(e,0)}function re(e){let t=te(e);return ee(t)?t:{}}function ne(e){if(Array.isArray(e))return e.map(ne);if(!ee(e))return e;let t= Object.create(null);for(let r of Object.keys(e).sort())t[r]=ne(e[r]);return t}function ae(e){return JSON.stringify(ne(te(e)))}function ie(e){let t=BigInt("14695981039346656037"),r=BigInt("1099511628211"),n=BigInt("0xffffffffffffffff");for(let a=0;a<e.length;a++)t^=BigInt(e.charCodeAt(a)),t=t*r&n;return t.toString(16).padStart(16,"0")}function oe(e){return ie(ae(e))}function le(e){return`st_${oe({state:e.state,...e.summary?{summary:e.summary}:{}})}`}function se(e){if(!e?.length)return;let t=Array.from(new Set(e.filter(e=>"string"==typeof e&&e.length))).sort();return t.length?t:void 0}function ce(e,t){return t.some(t=>e===t||e.startsWith(`${t}/`))}function ue(e,t){let r=se(t.refs),n=!1!==t.includeSummary;if(!r)return{snapshot:{version:e.version,createdAt:e.createdAt,state:e.state,...n&&e.summary?{summary:e.summary}:{}}};let a={};for(let[t,n]of Object.entries(e.state))ce(t,r)&&(a[t]=n);let i={};if(n&&e.summary)for(let[t,n]of Object.entries(e.summary))ce(t,r)&&(i[t]=n);return{snapshot:{version:e.version,createdAt:e.createdAt,state:a,...Object.keys(i).length?{summary:i}:{}},refs:r}}function de(e,t){let r={},n=[];for(let[n,a]of Object.entries(t.state))(!Object.prototype.hasOwnProperty.call(e.state,n)||ae(e.state[n])!==ae(a))&&(r[n]=a);for(let r of Object.keys(e.state))Object.prototype.hasOwnProperty.call(t.state,r)||n.push(r);let a={},i=[],o=e.summary??{},l=t.summary??{};for(let[e,t]of Object.entries(l))(!Object.prototype.hasOwnProperty.call(o,e)||ae(o[e])!==ae(t))&&(a[e]=t);for(let e of Object.keys(o))Object.prototype.hasOwnProperty.call(l,e)||i.push(e);return{changed:r,removed:n.sort(),...Object.keys(a).length?{summaryChanged:a}:{},...i.length?{summaryRemoved:i.sort()}:{}}}function fe(e){return{refs:se(e.refs),prefixes:se(e.prefixes),kinds:e.kinds?.length?new Set(e.kinds):void 0,layers:e.layers?.length?new Set(e.layers):void 0,includeActions:!1!==e.includeActions,includeEdges:!1!==e.includeEdges,includeNodeData:!1!==e.includeNodeData}}function he(e,t){return!((t.refs?.length||t.prefixes?.length)&&!t.refs?.includes(e.ref)&&!t.prefixes?.some(t=>e.ref===t||e.ref.startsWith(`${t}/`)))&&(!t.kinds||t.kinds.has(e.kind))&&(!t.layers||t.layers.has(e.layer))}function me(e,t){let r=fe(t),n=e.graph.nodes.filter(e=>he(e,r)).map(e=>{if(r.includeNodeData)return e;let{data:t,...n}=e;return n}),a=new Set(n.map(e=>e.ref)),i=r.includeActions?e.graph.actions.filter(e=>{if(!e.targetRef||a.has(e.targetRef))return!0;for(let t of a)if(t.startsWith(`${e.targetRef}/`))return!0;return!1}):[];return{version:e.version,createdAt:e.createdAt,graph:{version:e.graph.version,nodes:n,edges:r.includeEdges?e.graph.edges.filter(e=>a.has(e.from)&&a.has(e.to)):[],actions:i}}}function pe(e){return null==e?"NULL":"number"==typeof e?"DOUBLE":"string"==typeof e?"VARCHAR":"boolean"==typeof e?"BOOLEAN":e instanceof Date?"TIMESTAMP":Array.isArray(e)?"ARRAY":"OBJECT"}function ge(e){let t= new Map;for(let r of e)if(ee(r))for(let[e,n]of Object.entries(r)){let r=t.get(e)?? new Set;r.add(pe(n)),t.set(e,r)}return Array.from(t).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>{let r=Array.from(t).filter(e=>"NULL"!==e);return{name:e,type:0===r.length?"NULL":1===new Set(r).size?r[0]:"MIXED"}})}function ye(e,t){let r= Object.create(null);for(let n of t){let t=[];for(let r of e){if(!ee(r)||!Object.prototype.hasOwnProperty.call(r,n))continue;let e=r[n];"number"==typeof e&&Number.isFinite(e)&&t.push(e)}if(!t.length)continue;let a=t[0],i=t[0],o=0;for(let e of t)a=Math.min(a,e),i=Math.max(i,e),o+=e;r[n]={min:a,max:i,avg:o/t.length}}return Object.keys(r).length?r:void 0}function be(e,t){let r= Object.create(null);for(let n of t){let t=[];for(let r of e){if(!ee(r)||!Object.prototype.hasOwnProperty.call(r,n))continue;let e=r[n];e instanceof Date&&Number.isFinite(e.getTime())&&t.push(e.getTime())}if(!t.length)continue;let[a,i]=Y(t);r[n]={minIso:new Date(a).toISOString(),maxIso:new Date(i).toISOString(),minEpochMs:a,maxEpochMs:i}}return Object.keys(r).length?r:void 0}function ve(e,t){let r= Object.create(null);for(let n of t){if(n.replace(/([a-z\d])([A-Z])/g,"$1 $2").split(/[^a-z\d]+/i).some(e=>/^(id|uuid|guid|identifier|email|phone|ssn|token|password)$/i.test(e)))continue;let t= new Map,a=0;for(let r of e){if(!ee(r)||!Object.prototype.hasOwnProperty.call(r,n))continue;let e=r[n];if("string"!=typeof e&&"boolean"!=typeof e)continue;let i=String(e);t.set(i,(t.get(i)??0)+1),a++}!t.size||t.size/a>.5||(r[n]=Array.from(t).sort(([e,t],[r,n])=>n-t||e.localeCompare(r)).slice(0,10).map(([e,t])=>({value:e,n:t})))}return Object.keys(r).length?r:void 0}function $e(e){let t=e.rows.slice(0,Math.max(0,e.sampleRows)),r=ge(e.rows),n=r.map(e=>e.name);if("columns"===e.detail)return{handleRef:e.handleRef,detail:e.detail,table:null,rowCount:e.rows.length,columns:r};let a=ye(t,n),i=be(t,n),o=ve(t,n);return{handleRef:e.handleRef,detail:e.detail,table:null,rowCount:e.rows.length,columns:r,...a?{numeric:a}:{},...i?{temporal:i}:{},...o?{categoricalTopValues:o}:{},sampledRows:t.length}}function we(e,t){if(!t.descriptor.name.trim())throw new Error("VACP action names must be non-empty.");if(e.some(e=>e.descriptor.name===t.descriptor.name))throw new Error(`Duplicate VACP action "${t.descriptor.name}".`);e.push(t)}function Ce(e,t){if(!ee(e))throw new Error(`${t} expects an object parameter payload.`);return e}function Ae(e,t){return"number"==typeof e&&Number.isFinite(e)?Math.max(1,Math.floor(e)):t}function Se(e,t,r){if("string"!=typeof e.selectionRef)throw new Error("params.selectionRef must be a VACP selection ref.");let n=t.find(t=>t.ref===e.selectionRef);if(!n)throw new Error(`Unknown selection ref "${e.selectionRef}".`);if(r&&!n.modes.has(r))throw new Error(`Selection "${n.name}" does not accept ${r} state.`);return n}function ke(e,t){if(!ee(e)||!Object.keys(e).length)throw new Error("params.fields must be a non-empty object.");let r= Object.create(null);for(let[n,a]of Object.entries(e)){if(!t.includes(n))throw new Error(`Field "${n}" is not allowed for this selection.`);if(!Array.isArray(a)||!a.length)throw new Error(`Point selection field "${n}" requires values[].`);for(let e of a)if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&("number"!=typeof e||!Number.isFinite(e)))throw new Error(`Point selection field "${n}" only accepts JSON primitive values.`);r[n]=[...a]}return r}function xe(e,t){if(!ee(e)||!Object.keys(e).length)throw new Error("params.fields must be a non-empty object.");let r= Object.create(null);for(let[n,a]of Object.entries(e)){if(!t.includes(n))throw new Error(`Field "${n}" is not allowed for this selection.`);if(!Array.isArray(a)||2!==a.length||"number"!=typeof a[0]||"number"!=typeof a[1]||!Number.isFinite(a[0])||!Number.isFinite(a[1]))throw new Error(`Interval selection field "${n}" requires [min,max].`);r[n]=[Math.min(a[0],a[1]),Math.max(a[0],a[1])]}return r}function Pe(e){return null==e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e||e instanceof Date&&Number.isFinite(e.getTime())}function je(e,t){if(!ee(e))throw new Error("params.match must be an object.");for(let r of Object.keys(e))if(!t.includes(r))throw new Error(`params.match includes undeclared field "${r}".`);let r= Object.create(null);for(let n of t){if(!Object.prototype.hasOwnProperty.call(e,n)||!Pe(e[n]))throw new Error(`params.match requires a primitive value for "${n}".`);r[n]=e[n]instanceof Date?e[n].toISOString():e[n]}return r}function Oe(i,l,s){let c=[],u=i.dataHandles.map(e=>e.ref),d=!0===l.dataAccess?.summaries||!0===l.dataAccess?.sample;u.length&&we(c,{descriptor:{name:o,title:"Describe Semiotic data",description:"Return columns, types, row count, and optional bounded summaries for a chart DataHandle.",targetRef:s.view,parameters:{type:"object",properties:{handleRef:{type:"string",enum:u},detail:{type:"string",enum:d?["columns","full"]:["columns"]},sampleRows:{type:"number",minimum:1}},required:["handleRef"]}},execute(e){let t=Ce(e,o);if("string"!=typeof t.handleRef)throw new Error("params.handleRef must be a DataHandle ref.");let r=i.dataHandles.find(e=>e.ref===t.handleRef);if(!r)throw new Error(`Unknown DataHandle "${t.handleRef}".`);let n=void 0===t.detail||"columns"===t.detail?"columns":"full"===t.detail?"full":(()=>{throw new Error('params.detail must be "columns" or "full".')})();if("full"===n&&!d)throw new Error("Full data schema summaries require dataAccess.summaries or dataAccess.sample.");let a="number"==typeof t.sampleRows&&Number.isFinite(t.sampleRows)?Math.max(1,Math.floor(t.sampleRows)):"full"===n?1e3:Math.min(r.rows.length,1e3),s=Ae(l.dataAccess?.maxSchemaRows,5e3);return $e({handleRef:r.ref,rows:r.rows,detail:n,sampleRows:Math.min(a,s)})}}),u.length&&!0===l.dataAccess?.sample&&we(c,{descriptor:{name:a,title:"Inspect bounded Semiotic rows",description:"Return a bounded JSON sample from a chart DataHandle. This action is opt-in.",targetRef:s.view,parameters:{type:"object",properties:{handleRef:{type:"string",enum:u},offset:{type:"number",minimum:0},limit:{type:"number",minimum:1}},required:["handleRef"]}},execute(e){let t=Ce(e,a);if("string"!=typeof t.handleRef)throw new Error("params.handleRef must be a DataHandle ref.");let r=i.dataHandles.find(e=>e.ref===t.handleRef);if(!r)throw new Error(`Unknown DataHandle "${t.handleRef}".`);let n="number"==typeof t.offset&&Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,o=Ae(l.dataAccess?.maxSampleRows,50),s="number"==typeof t.limit&&Number.isFinite(t.limit)?Math.max(1,Math.floor(t.limit)):Math.min(20,o),c=Math.min(s,o),u=r.rows.slice(n,n+c);return{handleRef:r.ref,offset:n,limit:c,rowCount:r.rows.length,rows:te(u,{maxArrayLength:o}),truncated:n+u.length<r.rows.length}}});let f=i.selections.map(e=>e.ref),h=i.selections.filter(e=>e.modes.has("point"));h.length&&l.selectionActions?.setPointSelection&&we(c,{descriptor:{name:e,title:"Set point selection",description:"Set a named LinkedCharts point-selection clause with allowlisted fields.",targetRef:s.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:h.map(e=>e.ref)},fields:{type:"object"}},required:["selectionRef","fields"]}},async execute(t){let r=Ce(t,e),n=Se(r,i.selections,"point"),a=ke(r.fields,n.fields);return await(l.selectionActions?.setPointSelection?.(n.name,n.clientId,a)),{selectionRef:n.ref,fields:a}}});let m=i.selections.filter(e=>e.modes.has("interval"));m.length&&l.selectionActions?.setIntervalSelection&&we(c,{descriptor:{name:t,title:"Set interval selection",description:"Set a named LinkedCharts interval-selection clause in data units.",targetRef:s.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:m.map(e=>e.ref)},fields:{type:"object"}},required:["selectionRef","fields"]}},async execute(e){let r=Ce(e,t),n=Se(r,i.selections,"interval"),a=xe(r.fields,n.fields);return await(l.selectionActions?.setIntervalSelection?.(n.name,n.clientId,a)),{selectionRef:n.ref,fields:a}}}),f.length&&l.selectionActions?.clearSelection&&we(c,{descriptor:{name:r,title:"Clear selection",description:"Clear every active clause from one named LinkedCharts selection.",targetRef:s.view,parameters:{type:"object",properties:{selectionRef:{type:"string",enum:f}},required:["selectionRef"]}},async execute(e){let t=Se(Ce(e,r),i.selections);return await(l.selectionActions?.clearSelection?.(t.name)),{selectionRef:t.ref,cleared:!0}}});let p=i.charts.map(e=>e.navigation).filter(e=>!!e&&e.index.valid&&!!e.binding.onActiveChange);p.length&&we(c,{descriptor:{name:n,title:"Activate chart navigation target",description:"Move an accessible chart navigation tree to a uniquely identified datum.",targetRef:s.view,parameters:{type:"object",properties:{navigationRef:{type:"string",enum:p.map(e=>e.ref)},match:{type:"object"}},required:["navigationRef","match"]}},execute(e){let t=Ce(e,n);if("string"!=typeof t.navigationRef)throw new Error("params.navigationRef must be a navigation ref.");let r=p.find(e=>e.ref===t.navigationRef);if(!r)throw new Error(`Unknown navigation ref "${t.navigationRef}".`);let a=je(t.match,r.index.matchFields),i=r.index.byKey.get(oe(a));if(!i)throw new Error("No navigation datum matches params.match.");return r.binding.onActiveChange?.(i),{navigationRef:r.ref,targetRef:r.index.targetRef(a),match:a}}});let g="function"==typeof l.actions?l.actions():l.actions;for(let e of g??[])e.available&&!e.available()||we(c,{descriptor:{...e.descriptor,...e.descriptor.parameters?{parameters:re(e.descriptor.parameters)}:{}},async execute(t){let r=e.validate?.(t);if("string"==typeof r&&r)throw new Error(r);return e.execute(t)}});return c}function Ie(e){return s.has(e)}function Me(){let e=globalThis;return e[c]||(e[c]={recipes: new Map,capabilities: new Map,layouts: new Map}),e[c]}function Re(e){return Me().recipes.get(e)}function Fe(e){let t=Me().layouts.get(e)?.identity;return t?{...t}:void 0}function De(e){return"string"==typeof e?Re(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function Le(e){return!(null===e||"object"!=typeof e||Array.isArray(e)||e instanceof Date||e instanceof Map||e instanceof Set)}function Ne(e){if(!Array.isArray(e))return[];for(let t of e)if(!Le(t))return e.filter(Le);return e}function Ee(e){let t=e;for(let r of["data","nodes","edges","points","areas","lines","flows","spawns","projectionRows","annotations"]){if(!Array.isArray(e[r]))continue;let n=Ne(e[r]);n!==e[r]&&(t===e&&(t={...e}),t[r]=n)}return t}function Te(e){return e instanceof Date?e.getTime():"number"==typeof e?e:"string"==typeof e&&""!==e.trim()?Number(e):NaN}function Be(e){return e instanceof Date?Number.isFinite(e.getTime())?e.toISOString():void 0:null!=e&&"object"!=typeof e&&"function"!=typeof e?String(e):void 0}function _e(e,t){let r=Q(e,t);return e=>Te(r(e))}function ze(e,t,r){return"function"==typeof t?t(e):e["string"==typeof t&&t?t:r]}function Ve(e,t="—"){let r;for(;null!==e&&"object"==typeof e&&!(e instanceof Date);){if(r??(r= new Set),r.has(e))return t;r.add(e);let n=e;e=n.id??n.name??n.label}return Be(e)||t}function He(e){let t=Te(e);return Number.isFinite(t)?t:void 0}function qe(e){return(Ve(e,"unknown").toLowerCase().match(/[a-z0-9]+/g)||[]).join("-")||"unknown"}function Ge(e,t){return`${e.linkedHover||e.selection||e.linkedBrush?` ${t}`:""}${e.enableHover||e.tooltip?" Hover or focus a mark for its details.":""}`}function Ue(e,t){return Ne(ze(e,t,"children"))}function Ke(e){return"string"==typeof e?e:e.id??e.name}function Je(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function We(e){return Array.isArray(e.data)?Ne(e.data):Array.isArray(e.nodes)?Ne(e.nodes):Array.isArray(e.points)?Ne(e.points):Array.isArray(e.areas)?Ne(e.areas):[]}function Qe(e,t,r){return r??De(t.recipe)??De(t.recipeId)??Re(e)}function Xe(e,t,r=[]){let n=e.accessor?t[e.accessor]:void 0;if("string"==typeof n&&n)return n;if(e.field)return e.field;let a=r.find(e=>e&&"object"==typeof e);if(!a)return;let i=Object.entries(a).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?i.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>Object.prototype.hasOwnProperty.call(a,e)):i.find(([,e])=>"string"==typeof e)?.[0]}function Ze(e,t){return e.dataRoles.find(e=>e.role===t)}function Ye(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function et(e,t,r,n,a,i={}){let o=Object.assign( Object.create(null),i);if(t)for(let[e,r]of Object.entries(t))o[e]=r;for(let e of r.dataRoles){let r=Xe(e,n,a),i=t&&r?t[r]:r;void 0!==i&&(o[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>Ve(o[t],`{${t}}`))}function tt(e,t,r){let n=J(e,t,r);return{mismatchPaths:[...n.mismatchPaths,...void 0!==r&&n.unknownPaths.includes("artifact.component")?["artifact.component"]:[]]}}function rt(e,t){return[... new Set([...Object.keys(e),...Object.keys(t)])].filter(r=>{if(Object.prototype.hasOwnProperty.call(e,r)!==Object.prototype.hasOwnProperty.call(t,r))return!0;let n=V(e[r]),a=V(t[r]);return n.excludedPaths.length>0||n.fingerprint!==a.fingerprint}).map(e=>`props.${e}`).sort()}function nt(e,t,r,n){let a={component:t,version:n.version,createdAt:n.createdAt,...void 0!==n.recipeId?{recipeId:n.recipeId}:{},...void 0!==n.portable?{portable:n.portable}:{},...void 0!==n.manifest?{manifest:n.manifest}:{},...void 0!==n.reason?{reason:n.reason}:{},...void 0!==n.warnings?{warnings:n.warnings}:{},...void 0!==n.selections?{selections:n.selections}:{},artifactContract:r,status:e.status,omittedPaths:e.omittedPaths,warnings:e.warnings,...void 0!==e.serializedConfigFingerprint?{serializedConfigFingerprint:e.serializedConfigFingerprint}:{},...Object.prototype.hasOwnProperty.call(e,"serializedDataFingerprint")?{serializedDataFingerprint:e.serializedDataFingerprint}:{}};return V(a).fingerprint}function at(e,t,r,n,a){let i=U(r),o={...e,serializedConfigFingerprint:V(K(r)).fingerprint,serializedDataFingerprint:void 0===i?null:V(i).fingerprint};return{...o,transferFingerprint:nt(o,t,n,a)}}function it(e,t,r,n,a){if(!t)return{};let i=q(t),o=a.recipeId??e,l=tt(t,r,o),s=rt(r,n),c=tt(t,n,o);return l.mismatchPaths.length>0?{artifactContract:i.contract,artifactTransfer:at({status:"invalid",omittedPaths:l.mismatchPaths,warnings:["The artifact contract fingerprints do not match the supplied chart props or data."]},e,n,i.contract,a)}:s.length>0?{artifactContract:i.contract,artifactTransfer:at({status:"excluded",omittedPaths:s,warnings:["Chart props or data were excluded from the serialized configuration."]},e,n,i.contract,a)}:c.mismatchPaths.length>0?{artifactContract:i.contract,artifactTransfer:at({status:"invalid",omittedPaths:c.mismatchPaths,warnings:["Serialized chart props or data differ from the values bound to the artifact contract."]},e,n,i.contract,a)}:{artifactContract:i.contract,artifactTransfer:at(i.transfer,e,n,i.contract,a)}}function ot(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function lt(e,t){return!(!G(e,t)||"areas"===e&&"string"==typeof t)}function st(e,t,r){if(r?.selections&&H(r.selections).length>0)throw new TypeError("Serialized selection state must contain only values that survive JSON serialization unchanged.");let n=Re(e)??De(t.recipe)??De(t.recipeId);if(n)return ut(n,t,r);if(!Ie(e))throw new Error(`Unknown component "${e}". Known components: ${l.join(", ")}`);let a=!1!==r?.includeData,i={};for(let[e,r]of Object.entries(t))if(null!=r&&!d.has(e)&&(a||!lt(e,r))&&"function"!=typeof r&&!(H(r).length>0))try{ot(i,e,f(r))}catch{}let o= (new Date).toISOString(),s={version:u,createdAt:o,...r?.selections?{selections:r.selections}:{}};return{component:e,props:i,version:u,createdAt:o,...it(e,r?.artifactContract,t,i,s),...r?.selections?{selections:r.selections}:{}}}function ct(e,t,r){let n={};for(let[a,i]of Object.entries(e))if(null!=i&&!d.has(a)&&"recipeId"!==a&&(t||!lt(a,i))){if("function"==typeof i){if(r)throw new Error(`Portable recipe prop "${a}" is not JSON-safe.`);continue}if(H(i).length>0){if(r)throw new Error(`Portable recipe prop "${a}" is not JSON-safe.`);continue}ot(n,a,f(i))}return n}function ut(e,t,r){let n=!1!==r?.includeData,a=H(e);if("portable"===e.portability&&a.length>0)throw new Error(`Portable recipe "${e.id}" has non-JSON definition values at: ${a.join(", ")}.`);let i=ct(t,n,"portable"===e.portability),o=e.intents.map(Ke).filter(e=>!!e),l=e.layout&&"object"==typeof e.layout&&"string"==typeof e.layout.id?e.layout.id:void 0,s=l?Fe(l):void 0,c=e.layout&&"object"==typeof e.layout&&"string"==typeof e.layout.version&&e.layout.version?{version:e.layout.version,...e.layout.fingerprint?{fingerprint:e.layout.fingerprint}:{}}:void 0;if(s&&c&&(s.version!==c.version||s.fingerprint!==c.fingerprint))throw new Error(`Recipe layout "${l}" registry identity does not match its portable declaration.`);let d=s??c;if("portable"===e.portability&&l&&!d)throw new Error(`Portable recipe layout "${l}" must be registered with an explicit version identity.`);let f={name:e.name,intents:o,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily,...e.version?{recipeVersion:e.version}:{},...0===a.length?{definitionFingerprint:V(e).fingerprint}:{},...l?{layoutId:l}:{},...d?{layoutVersion:d.version}:{},...d?.fingerprint?{layoutFingerprint:d.fingerprint}:{}},h= (new Date).toISOString();if("portable"===e.portability){if(H(i).length>0)throw new Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);let n={version:u,createdAt:h,recipeId:e.id,portable:!0,manifest:f,...r?.selections?{selections:r.selections}:{}};return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:i,manifest:f,version:u,createdAt:h,...it("ChartRecipe",r?.artifactContract,t,i,n),...r?.selections?{selections:r.selections}:{}}}let m="Recipe contains or may depend on non-serializable local layout callbacks.",p=["This config is inspectable but cannot be rendered remotely by CLI or MCP."],g={version:u,createdAt:h,recipeId:e.id,portable:!1,manifest:f,reason:m,warnings:p,...r?.selections?{selections:r.selections}:{}};return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:m,warnings:p,props:i,manifest:f,version:u,createdAt:h,...it("ChartRecipe",r?.artifactContract,t,i,g),...r?.selections?{selections:r.selections}:{}}}function dt(e,t){return m.has(e)||p.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 ft(e){for(let t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){let r=e[t];if("string"==typeof r&&r)return r}}function ht(e,t){return null==e?"—":e instanceof Date?Be(e)?.slice(0,10)??"—":"number"==typeof e?t(e):Be(e)??"—"}function mt(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function pt(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})}}}function gt(e,t,r,n){let a=Ye(e,["nominal","ordinal"]),i=Ye(e,["quantitative"]),o=a?Xe(a,r,t):void 0,l=i?Xe(i,r,t):void 0,s=a?.role??o??"category",c=i?.role??l??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${s} and ${c} are mapped through the recipe's declared visual semantics`,{number:f,percent:h}=pt(n),m= new Map;if(o&&l)for(let e of t){let t=Ve(e[o],"Uncategorized"),r=Te(e[l]);Number.isFinite(r)&&m.set(t,(m.get(t)??0)+r)}let p=[...m].sort((e,t)=>t[1]-e[1]),g=p.reduce((e,[,t])=>e+t,0),y=p[0],b=p[1],v=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,$=e.intents.map(e=>({id:Ke(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,w=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${s} and ${c}. ${mt(d)}.`,l2:p.length>0?`${p.length} categories total ${f.format(g)}. ${y[0]} accounts for ${f.format(y[1])}${g>0?` (${h.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${f.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:p.length>=2?v>=.5?`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${h.format(v)}.`:`The total is distributed across ${p.length} categories without the first two forming a majority.`:y?`${y[0]} is the only represented category.`:"No quantitative pattern can be derived from the available data.",l4:`The chart is intended for ${$??"explanation"}${w?` with a ${w} audience`:""}: ${e.designContract.whyCustom}`}}function yt(e,t,r={}){let n=We(t),a=Je(t),i=r.locale??"en",o=("function"==typeof e.description?e.description({data:n,config:a,locale:i}):void 0)?.levels??gt(e,n,a,i),l=r.levels??["l1","l2","l3","l4"],s={};for(let e of l)o[e]&&(s[e]=o[e]);let c=["l1","l2","l3","l4"].map(e=>s[e]).filter(e=>!!e).join(" "),u=r.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>`Misuse: ${e}`)]:void 0;return{text:c,levels:s,...u?.length?{caveats:u}:{}}}function bt(e,t){let r="mechanical"===(t.simulationMode??t.mode)&&("GaltonBoardChart"===e||"UnitPileChart"===e);if(!Array.isArray(t.data)&&!r)return null;let n=Array.isArray(t.data)?t.data:[],a=Math.max(2,Math.round(Z(t.bins)??21)),i=Math.max(1,Math.round(Z(t.pegRows)??a-1));if(r&&(n="GaltonBoardChart"===e?T({bins:a,count:t.mechanicalCount,pegRows:i,branchProbability:t.branchProbability,seed:t.seed}):z({count:t.mechanicalCount,categories:t.mechanicalCategories,unitValue:t.unitValue,seed:t.seed})),n=B(n,"UnitPileChart"===e?"pile":"GaltonBoardChart"===e?"galton":"EventDropChart"===e?"event":"collision-swarm").rows,"UnitPileChart"===e){let e= new Map,a=t.valueAccessor??(r?"value":void 0);return n.forEach((r,n)=>{let i=Ve(X(r,n,t.categoryAccessor??"category"),"unknown"),o=a?Z(X(r,n,a)):1;e.set(i,(e.get(i)??0)+Math.max(0,o??0))}),{generated:r,rows:Array.from(e,([e,t])=>({label:e,value:t}))}}if("GaltonBoardChart"===e){let e=n.map((e,r)=>Z(X(e,r,t.valueAccessor??"value"))).filter(e=>null!=e),o=r?[0,i]:E(t.valueExtent),[l,s]=o??(e.length?Y(e):[0,1]),c=l===s?1:s-l,u=Array.from({length:a},(e,t)=>({label:String(t+1),value:0}));for(let t of e)u[Math.max(0,Math.min(a-1,Math.floor((t-l)/c*a)))].value+=1;return{generated:r,rows:u}}if("CollisionSwarmChart"===e){let e= new Map;return n.forEach((r,n)=>{if(null==Z(X(r,n,t.xAccessor??"x")))return;let a=t.groupAccessor?Ve(X(r,n,t.groupAccessor),"All"):"All";e.set(a,(e.get(a)??0)+1)}),{generated:r,rows:Array.from(e,([e,t])=>({label:e,value:t}))}}if("EventDropChart"===e){let e=Z(t.windows?.size??10);if(null==e||e<=0)return null;let{events:a}=_({data:n,timeAccessor:t.timeAccessor??"time",arrivalAccessor:t.arrivalAccessor??"arrivalTime",windowSize:e,watermark:t.watermark,watermarkAtArrivalAccessor:t.watermarkAtArrivalAccessor}),i=a.map(e=>e.eventTime),[o,l]=i.length?Y(i):[0,e],s=Math.min(Z(t.timeExtent?.[0])??o,o),c=Math.max(Z(t.timeExtent?.[1])??l,l),u=Math.floor(s/e)*e,d=Math.max(1,Math.ceil((c-u+e)/e)),f=Array.from({length:d},(t,r)=>({label:`${u+r*e}-${u+(r+1)*e}`,value:0,secondary:0,secondaryLabel:"late"}));for(let t of a){let r=f[Math.max(0,Math.min(d-1,Math.floor((t.eventTime-u)/e)))];t.late?r.secondary+=1:r.value+=1}return{generated:r,rows:f}}return null}function vt(e){let t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}function $t(e,t){let r=e.physics&&"object"==typeof e.physics?e.physics:null,n=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,a=[e.settledProjectionRows,e.projectionRows,n?.rows,r?.settledProjectionRows,r?.projectionRows,r?.settledProjection&&"object"==typeof r.settledProjection?r.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(a)?a.map((e,r)=>{if(!e||"object"!=typeof e)return null;let n=e,a=vt(n.count??n.value??n.total??n.bodies??n.events);if(null==a)return null;let i=n.label??n.id??n.name??`container ${r+1}`,o=vt(n.secondary??n.secondaryCount),l=vt(n.observed??n.observedCount);return{label:ht(i,t),count:a,...null!=o?{secondary:o}:{},..."string"==typeof n.secondaryLabel&&n.secondaryLabel?{secondaryLabel:n.secondaryLabel}:{},...null!=l?{observed:l}:{}}}).filter(e=>null!=e):null}function wt(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}function Ct(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"UnitPileChart"===e?"unit":"body"}function At(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.`}function St(e,t){if(!(t>0))return"0%";let r=e/t*100;return`${r>=10?Math.round(r):Math.round(10*r)/10}%`}function kt(e,t,r,n,a,i,o=null){let l=wt(e),s=o&&"EventDropChart"===e?"accepted event":Ct(e),c=o?o.generated?"The generated sample projection":"The source projection":"The settled projection";if(a.has("l1")&&(n.l1=At(e,t)),!a.has("l2")&&!a.has("l3"))return;if(!r||0===r.length)return void(a.has("l2")&&(n.l2=o?"No valid source records are available.":"No settled projection is loaded yet."));let u=r.reduce((e,t)=>e+t.count,0),d=r.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),f=d[0]??r.slice().sort((e,t)=>t.count-e.count)[0];if(!f)return;let h=r.reduce((e,t)=>e+(t.secondary??0),0),m=r.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(a.has("l2"))if(o&&"EventDropChart"===e)n.l2=`${c} classifies ${i(u+h)} ${xt(u+h,"event")} across ${r.length} ${xt(r.length,l)}: ${i(u)} accepted and ${i(h)} late.`;else if(0===d.length)n.l2=`${c} contains ${i(u)} ${xt(u,s)} across ${r.length} ${xt(r.length,l)}; no ${xt(2,l)} are non-empty yet.`;else{let e=h>0?` ${i(h)} ${xt(h,s)} ${1===h?"is":"are"} marked ${m}.`:"";n.l2=`${c} contains ${i(u)} ${xt(u,s)} across ${r.length} ${xt(r.length,l)}; ${d.length} ${xt(d.length,l)} ${1===d.length?"is":"are"} non-empty. The largest ${l} is ${f.label} with ${i(f.count)} ${xt(f.count,s)}.${e}`}if(a.has("l3")&&u>0&&d.length>0){let e=d.find(e=>e!==f),t=St(f.count,u);n.l3=e?`${c} is most concentrated in ${f.label}, which holds ${i(f.count)} ${xt(f.count,s)} (${t}); ${e.label} follows with ${i(e.count)} ${xt(e.count,s)}.`:`${c} is concentrated in ${f.label}, which holds all ${i(f.count)} ${xt(f.count,s)}.`}}function xt(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:`${t}s`}function Pt(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()}function jt(e){return Object.prototype.hasOwnProperty.call(y,e)?y[e]:`${Pt(e)} chart`}function Ot(e){let t,r=0;for(let[n,a]of Object.entries(e))if("number"==typeof a&&a>0){if(a>r){t=n,r=a;continue}if(a===r&&void 0!==t){let e=A.indexOf(n),r=A.indexOf(t);-1!==e&&(-1===r||e<r)&&(t=n)}}return t}function It(e){return"BumpChart"===e?"ranking":p.has(e)||"StackedAreaChart"===e?"apportioning":$.has(e)?"relating":m.has(e)?"comparing":g.has(e)?"characterizing":h.has(e)?"tracking":b.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}function Mt(e){if(e){if("fits"in e||"buildProps"in e){let t=e,r={};for(let[e,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(r[e]=n);return{family:t.family,intentScores:Object.keys(r).length?r:void 0}}return e}}function Rt(e,t){let r=Mt(t);if(r?.act)return r.act;if(r?.intentScores){let e=Ot(r.intentScores);if(e&&Object.prototype.hasOwnProperty.call(w,e)&&(r.intentScores[e]??0)>=3)return w[e]}return r?.family&&Object.prototype.hasOwnProperty.call(C,r.family)?C[r.family]:It(e)}function Ft(e){let t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;let t=e;if("string"!=typeof t.type||!k.has(t.type))return!1;let r=t.provenance;return!(!r||"object"!=typeof r)&&(x.has(r.authorKind)||P.has(r.source)||j.has(r.basis))})}function Dt(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)?Math.abs(e)>=1e4?t.format(e):r.format(e):String(e)}function Lt(e,t,r,n){let a=0,i=0,o=1/0,l=-1/0,s=null,c=null,u=0,d=0,f=null,h=null,m=NaN,p=NaN;for(let r of e){let e=t(r);Number.isFinite(e)&&(0===a&&(m=e,f=r),p=e,h=r,e<o&&(o=e,s=r,u=a),e>l&&(l=e,c=r,d=a),a++,i+=e)}return 0===a?null:{count:a,min:o,max:l,mean:i/a,minLabel:ht(null!=s?r(s):null,n),maxLabel:ht(null!=c?r(c):null,n),first:m,last:p,firstLabel:ht(null!=f?r(f):null,n),lastLabel:ht(null!=h?r(h):null,n),minIndex:u,maxIndex:d}}function Nt(e){return e.length<=1?e[0]??"":2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}function Et(e){let 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 ":""}function Tt(e){let t="string"==typeof e.type?e.type:"annotation",r=Object.prototype.hasOwnProperty.call(O,t)?O[t]:"an annotation",n=Et(e),a=n?n+r.replace(/^an? /,""):r,i="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return i?`${a} labeled "${i}"`:a}function Bt(e){let t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;let r=W(t.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;let n=r.map(Tt),a=n.slice(0,5),i=n.length-a.length,o=Nt(a)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":`${l} features`} on this chart: ${o}.`}function _t(e,t,r={}){t=Ee(t);let n=void 0!==r.levels,a=new Set(r.levels??["l1","l2","l3"]);!n&&(r.capability||Ft(t))&&a.add("l4");let i=Qe(e,t,r.recipe);if(i){let e=["l1","l2","l3","l4"].filter(e=>a.has(e));!n&&!e.includes("l4")&&e.push("l4");let o=yt(i,t,{levels:e,locale:r.locale,audience:r.audience,includeCaveats:r.includeCaveats}),l=Bt(t);return{...o,text:l?`${l} ${o.text}`.trim():o.text,...l?{annotations:l}:{}}}let o=Dt(r.locale??"en"),l=jt(e),s=Array.isArray(t.data)?t.data:null,c=ft(t),u=v.has(e)?$t(t,o):null,d=v.has(e)&&null===u?bt(e,t):null,{measure:f,measureFallback:y,dimension:$,dimensionFallback:w}=dt(e,t),C="string"==typeof f&&f?f:y,A="string"==typeof $&&$?$:w,S={};if(v.has(e)&&kt(e,l,u??(d?$t({projectionRows:d.rows},o):null),S,a,o,d),a.has("l1")&&!v.has(e))if("BumpChart"===e)S.l1=`A ${l} ranking ${c??"series"} by ${C} across ${A}.`;else if(h.has(e)||m.has(e))S.l1=`A ${l} of ${C} by ${A}`+(c?`, split by ${c}.`:".");else if(p.has(e))S.l1=`A ${l} showing ${C} across ${A} categories.`;else if(g.has(e))S.l1=`A ${l} of the distribution of ${C}`+(c?` by ${c}.`:".");else if(b.has(e)){let e=Array.isArray(t.nodes)?t.nodes.length:void 0,r=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${Wt(e,"node")}`:null,null!=r?`${r} ${Wt(r,"edge")}`:null].filter(Boolean);S.l1=`A ${l}${n.length?` with ${n.join(" and ")}`:""}.`}else if("BigNumber"===e){let e="string"==typeof t.label?t.label:C;S.l1=`A single value${e?` for ${e}`:""}.`}else S.l1=`A ${l}.`;let k=h.has(e)||"BumpChart"===e||m.has(e)||p.has(e)||g.has(e),x=null;if((a.has("l2")||a.has("l3")||a.has("l4"))&&k&&s&&s.length>0&&(x=Lt(s,_e(f,y),Q($,w),o)),a.has("l2")&&k&&(s&&0!==s.length?x&&(p.has(e)?S.l2=`${x.count} segments totaling ${o(zt(x))}. Largest is ${x.maxLabel} at ${o(x.max)}; smallest is ${x.minLabel} at ${o(x.min)}.`:S.l2=`${C} ranges from ${o(x.min)} (${x.minLabel}) to ${o(x.max)} (${x.maxLabel}), with a mean of ${o(x.mean)} across ${x.count} ${Wt(x.count,"point")}.`):S.l2="No data is loaded yet."),a.has("l3")&&x&&!c&&h.has(e)?S.l3=Vt(x,C,o):a.has("l3")&&x&&!c&&m.has(e)&&(S.l3=`The highest ${A} is ${x.maxLabel} and the lowest is ${x.minLabel}.`),a.has("l4")){let n=Ft(t)?"alerting":Rt(e,r.capability);if(n){let a=c?null:x;S.l4=Ht(n,e,t,a,C,A,o,r.audience)}}let P=["l1","l2","l3","l4"].filter(e=>a.has(e)&&S[e]).map(e=>S[e]).join(" "),j=Bt(t);return{text:j?`${j} ${P}`.trim():P,levels:S,...j?{annotations:j}:{}}}function zt(e){return e.mean*e.count}function Vt(e,t,r){let{first:n,last:a,min:i,max:o,maxLabel:l,minLabel:s,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:f,count:h}=e,m=o-i,p=a-n;if(0===m)return`${Jt(t)} is constant at ${r(n)} across the series.`;if(m/(Math.abs(e.mean)||1)<.04)return`${Jt(t)} ends roughly where it started (${r(n)} at ${c} to ${r(a)} at ${u}), ranging between ${r(i)} and ${r(o)}.`;let g=f>0&&f<h-1,y=d>0&&d<h-1,b=(o-Math.max(n,a))/m,v=(Math.min(n,a)-i)/m;return g&&b>.15?`Overall ${t} climbs to a peak of ${r(o)} (${l}), then falls to ${r(a)} (${u}).`:y&&v>.15?`Overall ${t} drops to a low of ${r(i)} (${s}), then recovers to ${r(a)} (${u}).`:Math.abs(p)/m<.05?`${Jt(t)} ends roughly where it started (${r(n)} at ${c} to ${r(a)} at ${u}), ranging between ${r(i)} and ${r(o)}.`:p>0?f===h-1?`Overall ${t} rises from ${r(n)} (${c}) to a peak of ${r(a)} (${u}).`:`Overall ${t} rises from ${r(n)} (${c}) to ${r(a)} (${u}), after peaking at ${r(o)} (${l}).`:d===h-1?`Overall ${t} falls from ${r(n)} (${c}) to a low of ${r(a)} (${u}).`:`Overall ${t} falls from ${r(n)} (${c}) to ${r(a)} (${u}), after dipping to ${r(i)} (${s}).`}function Ht(e,t,r,n,a,i,o,l){let s,c,u=S[e],d=/^[aeiou]/i.test(u)?"an":"a";switch(e){case"locating":s="This is a map",c="read values by location";break;case"presenting":s="This is a single-value display",c=`read ${"string"==typeof r.label&&r.label?r.label:a} as the headline number`;break;case"tracing":s=`This is ${d} ${u} chart`,c="follow the movement between states";break;case"nesting":s=`This is ${d} ${u} chart`,c="read it for nested structure and how children sum into their parents";break;case"relating":s=`This is ${d} ${u} chart`,c=`read it for whether ${i} and ${a} move together`;break;default:s=`This is ${d} ${u} chart`,c=qt(e,n,a,i,o,t)}return`${s}; ${c}.${Kt(t,l)}`}function qt(e,t,r,n,a,i){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 ${n}`;case"ranking":return`read it top to bottom by ${r}`;case"apportioning":return`read each ${n}'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 Gt(t,a,i);case"tracking":return`read it for the trajectory of ${r}, which ${Ut(t)} from ${a(t.first)} (${t.firstLabel}) to ${a(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${r} across ${n}; ${t.maxLabel} leads at ${a(t.max)}`;case"ranking":return`read it top to bottom by ${r}; ${t.maxLabel} ranks highest at ${a(t.max)}`;case"apportioning":{let e=t.mean*t.count,r=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${a(e)} total; ${t.maxLabel} is the largest at ${a(t.max)}${null!=r?` (${r}%)`:""}`}case"characterizing":return`read it for the spread of ${r}, from ${a(t.min)} to ${a(t.max)}`;default:return"read the highlighted features"}}function Gt(e,t,r){if(m.has(r)||p.has(r))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;let{first:n,last:a,min:i,max:o,minLabel:l,maxLabel:s,lastLabel:c,minIndex:u,maxIndex:d,count:f}=e,h=o-i;if(h>0){let e=d>0&&d<f-1,r=u>0&&u<f-1,m=(o-Math.max(n,a))/h,p=(Math.min(n,a)-i)/h;if(e&&m>.15)return`the peak of ${t(o)} at ${s} is the point to investigate`;if(r&&p>.15)return`the dip to ${t(i)} at ${l} is the point to investigate`;if(a>=o)return`the climb to ${t(a)} at ${c} warrants a closer look`;if(a<=i)return`the drop to ${t(a)} at ${c} warrants a closer look`}return`the extremes — ${s} (${t(o)}) and ${l} (${t(i)}) — are the points to check`}function Ut(e){let t=e.max-e.min,r=e.last-e.first;return 0===t||Math.abs(r)/t<.05?"holds roughly steady":r>0?"rises":"falls"}function Kt(e,t){if(!t)return"";let r=t.familiarity?.[e];return"number"==typeof r&&r<=2?` This ${jt(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`:""}function Jt(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Wt(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:`${t}s`}function Qt(e){return qe(e)}function Xt(e){return!!e&&"object"==typeof e}function Zt(e,t,r,n){let a=Ye(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),o=a?Xe(a,r,n):void 0,l=[];o&&null!=e[o]&&l.push(Ve(e[o]));for(let t of i){let a=Xe(t,r,n);a&&null!=e[a]&&l.push(`${t.role}: ${Ve(e[a])}`)}return l.length>0?l.join(", "):"Data item"}function Yt(e,t,r={}){let n=We(t),a=Je(t),i=Math.max(1,r.maxLeaves??200),o=r.locale??"en";if("function"==typeof e.navigation)return e.navigation({data:n,config:a,locale:o});let l=Xt(e.navigation)?e.navigation:void 0,s=(l?.groupByRole?Ze(e,l.groupByRole):void 0)??(l?.groupBy?.[0]?Ze(e,l.groupBy[0])??e.dataRoles.find(e=>e.field===l.groupBy?.[0]):void 0)??Ye(e,["nominal","ordinal"]),c=s?Xe(s,a,n):void 0,u=(l?.idRole?Ze(e,l.idRole):void 0)??Ye(e,["identifier"]),d=u?Xe(u,a,n):void 0,f={id:"root",role:"chart",label:l?.summaryTemplate?et(l.summaryTemplate,void 0,e,a,n,{count:n.length}):`${e.name}: ${n.length} ${1===n.length?"item":"items"} represented.`,level:1,children:[]},h=0,m=(t,r,i)=>{let o=d?t[d]:void 0,s=l?.itemLabelTemplate?et(l.itemLabelTemplate,t,e,a,n,{count:n.length}):Zt(t,e,a,n);return{id:`datum-${Qt(o??r)}`,role:"datum",label:s,level:i,datum:t}};if(c){let e= new Map;for(let t of n){let r=Ve(t[c],"Uncategorized"),n=e.get(r);n?n.push(t):e.set(r,[t])}f.children=[...e].map(([e,t],r)=>{let n=Math.max(0,i-h),a=t.slice(0,n);h+=a.length;let o=a.map((e,t)=>m(e,1e5*r+t,3));return a.length<t.length&&o.push({id:`more-${Qt(e)}`,role:"datum",label:`…and ${t.length-a.length} more items`,level:3}),{id:`group-${Qt(e)}`,role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:o}})}else{let e=n.slice(0,i);f.children=e.map((e,t)=>m(e,t,2)),e.length<n.length&&f.children.push({id:"more",role:"datum",label:`…and ${n.length-e.length} more items`,level:2})}return f}function er(e,t,r){return`${e} ${1===e?t:r}`}function tr(e,t){if(0===e.numericLeaves)return"";let r=t(e.leafTotal);return e.numericLeaves===e.leaves?`, leaf total ${r}`:`, known leaf total ${r} across ${er(e.numericLeaves,"valued leaf","valued leaves")}`}function rr(e){return"TreeDiagram"===e?"tree":"Treemap"===e?"treemap":"CirclePack"===e?"circle-packing":"orbit"}function nr(e,t,r,n){let a=Le(t.data)?t.data:null,i=t.childrenAccessor,o=t.valueAccessor,l=t.nodeLabel??t.nodeIdAccessor,s= new WeakMap,c=e=>{let t=s.get(e);if(void 0!==t)return t??{descendants:0,depth:0,leaves:0,numericLeaves:0,leafTotal:0};s.set(e,null);let r=Ue(e,i),n=0===r.length,a=n?He(ze(e,o,"value")):void 0,l={descendants:0,depth:1,leaves:n?1:0,numericLeaves:null==a?0:1,leafTotal:a??0};for(let e of r){let t=c(e);l.descendants+=1+t.descendants,l.depth=Math.max(l.depth,t.depth+1),l.leaves+=t.leaves,l.numericLeaves+=t.numericLeaves,l.leafTotal+=t.leafTotal}return s.set(e,l),l},u=0,d= new WeakSet,f=(e,t,a)=>{let s=Ve(ze(e,l,"name"),`item ${a}`);if(d.has(e))return{id:`hierarchy-${qe(a)}-cycle`,role:"datum",level:t,label:`Repeated hierarchy reference to ${s}; branch omitted.`};let h=Ue(e,i),m=c(e);if(0===h.length){if(u>=r)return null;u+=1;let i=He(ze(e,o,"value"));return{id:`hierarchy-${qe(a)}-${qe(s)}`,role:"datum",level:t,label:`${s}${null==i?"":`: ${n(i)}`}.`,...null==i?{}:{value:i},datum:e}}d.add(e);let p=[],g=0;for(let[e,n]of h.entries()){if(u>=r){g+=c(n).leaves;continue}let i=f(n,t+1,`${a}-${e}`);i&&p.push(i)}return d.delete(e),g>0&&p.push({id:`hierarchy-${qe(a)}-more`,role:"datum",level:t+1,label:`${er(g,"more leaf","more leaves")} in ${s} not shown; navigation is capped at ${r}.`}),{id:`hierarchy-${qe(a)}-${qe(s)}`,role:"series",level:t,label:`${s}: ${er(h.length,"direct child","direct children")}, ${er(m.descendants,"total descendant","total descendants")}, ${er(m.leaves,"leaf","leaves")}${tr(m,n)}.`,datum:e,children:p}},h=a?c(a):null,m={id:"root",role:"chart",level:1,label:a?`A ${rr(e)} chart with ${er(h.leaves,"leaf","leaves")} and ${er(h.descendants,"total descendant","total descendants")} across ${er(h.depth,"hierarchy level","hierarchy levels")}${tr(h,n)}.`:"A hierarchy chart with no hierarchy data loaded.",children:[]};if(a){let e=f(a,2,"root");if(e){let t=Ve(ze(a,l,"name"),"");m.children="series"===e.role&&""===t?e.children:[e]}}return m}function ar(e){if(Array.isArray(e))return Ne(e);if(!e||"object"!=typeof e)return[];let t=e;return Array.isArray(t.features)?Ne(t.features):"Feature"===t.type?[t]:[]}function ir(e,t,r){let n=ze(e,t,r);if(void 0!==n)return n;let a=e.properties;return a&&"object"==typeof a?ze(a,t,r):void 0}function or(e,t,r){return Ve(ir(e,t,"id")??ir(e,"name","name")??ir(e,"NAME","NAME")??ir(e,"label","label"),r)}function lr(e){let t=0,r=1/0,n=-1/0,a=0;for(let i of e)null!=i.value&&(t+=1,r=Math.min(r,i.value),n=Math.max(n,i.value),a+=i.value);return 0===t?null:{count:t,min:r,max:n,total:a,average:a/t}}function sr(e,t){let r=lr(e);return r?`range ${t(r.min)} to ${t(r.max)}, average ${t(r.average)}, total ${t(r.total)}`:"no numeric values"}function cr(e){let t=e.filter(e=>null!=e.value),r=e.filter(e=>null==e.value),n=[],a=lr(t);if(a)if(a.min===a.max)n.push({id:"equal",label:"Equal values",rows:t});else{let e=a.min+(a.max-a.min)/3,r=a.min+2*(a.max-a.min)/3,i=t.filter(e=>e.value>=r),o=t.filter(t=>t.value>=e&&t.value<r),l=t.filter(t=>t.value<e);i.length>0&&n.push({id:"highest",label:"Highest values",rows:i}),o.length>0&&n.push({id:"middle",label:"Middle values",rows:o}),l.length>0&&n.push({id:"lowest",label:"Lowest values",rows:l})}return r.length>0&&n.push({id:"missing",label:"No numeric value",rows:r}),n}function ur(e,t,r){let n,a=e.filter(e=>null!=e.value).sort((e,t)=>t.value-e.value||e.index-t.index),i= new Map,o=0;for(let[e,t]of a.entries())n!==t.value&&(o=e+1,n=t.value),i.set(t.index,o);let l=0;return cr(e).map(e=>{let n=Math.max(0,t-l),o=e.rows.slice(0,n);l+=o.length;let s=o.map(e=>{let t=i.get(e.index),n=null==t||a.length<2?"":`, rank ${t} of ${a.length}`;return{id:`geo-${qe(e.label)}-${e.index}`,role:"datum",level:3,label:null==e.value?`${e.label}: no numeric value.`:`${e.label}: ${r(e.value)}${n}.`,...null==e.value?{}:{value:e.value},datum:e.datum}}),c=e.rows.length-o.length;return c>0&&s.push({id:`geo-${e.id}-more`,role:"datum",level:3,label:`${c} more ${1===c?"region":"regions"} in ${e.label.toLowerCase()} not shown; navigation is capped at ${t}.`}),{id:`regions-${e.id}`,role:"series",level:2,label:`${e.label}: ${e.rows.length} ${1===e.rows.length?"region":"regions"}, ${sr(e.rows,r)}.`,children:s}})}function dr(e,t,r,n){let a=ar(t.areas),i="FlowMap"===e&&Array.isArray(t.nodes)?t.nodes:Array.isArray(t.points)?t.points:[],o=Array.isArray(t.flows)?t.flows:[],l=Array.isArray(t.lines)?t.lines:[],s=t.valueAccessor??t.sizeBy??t.costAccessor??"value",c=t.pointIdAccessor??t.nodeIdAccessor??"id",u=("ChoroplethMap"===e?a:i).map((r,n)=>({datum:r,index:n,label:or(r,"ChoroplethMap"===e?t.idAccessor:c,`${"ChoroplethMap"===e?"region":"location"} ${n+1}`),value:He(ir(r,s,"value"))})),d=u.filter(e=>null!=e.value),f={id:"root",role:"chart",level:1,label:`${"ChoroplethMap"===e?`A choropleth map with ${a.length} regions.${d.length>0?` Values are available for ${d.length} of ${a.length} regions; ${sr(d,n)}.`:" No regions have numeric values."}`:"FlowMap"===e?`A flow map with ${o.length} flows and ${i.length} locations.`:"DistanceCartogram"===e?`A distance cartogram with ${i.length} locations and ${l.length} routes.`:`A proportional-symbol map with ${i.length} locations.`}${Ge(t,"Use linked highlighting to compare related locations.")}`,children:[]};if("ChoroplethMap"===e)f.children=ur(u,r,n);else if(u.length>0){let e=u.slice(0,r).map(e=>({id:`geo-${qe(e.label)}-${e.index}`,role:"datum",level:3,label:`${e.label}${null==e.value?"":`: ${n(e.value)}`}.`,...null==e.value?{}:{value:e.value},datum:e.datum}));u.length>r&&e.push({id:"geo-more",role:"datum",level:3,label:`…and ${u.length-r} more locations.`}),f.children?.push({id:"locations",role:"series",level:2,label:`Locations: ${u.length} marks.`,children:e})}let h="FlowMap"===e?o:l;if(h.length>0){let e=h.slice(0,r).map((e,t)=>{let r=Ve(e.source,"unknown"),a=Ve(e.target,"unknown"),i=He(ze(e,s,"value"));return{id:`route-${qe(r)}-${qe(a)}-${t}`,role:"datum",level:3,label:`${r} to ${a}${null==i?"":`: ${n(i)}`}.`,...null==i?{}:{value:i},datum:e}});f.children?.push({id:"routes",role:"series",level:2,label:`Routes: ${h.length} ${1===h.length?"route":"routes"}.`,children:e})}return f}function fr(e,t={},r={}){return!!Qe(e,t,r.recipe)||I.has(e)||M.has(e)||R.has(e)||h.has(e)||m.has(e)||p.has(e)||g.has(e)}function hr(e,t){t&&e.children?.push(t)}function mr(e,t,r,n){t=Ee(t);let a=Array.isArray(t.nodes)?t.nodes:[],i=Array.isArray(t.edges)?t.edges:Array.isArray(t.flows)?t.flows:[],o=t.nodeIdAccessor??t.nodeIDAccessor,l=t.sourceAccessor??"source",s=t.targetAccessor??"target",c=t.valueAccessor??"value",u=e=>Ve(ze(e,o,"id"),"unknown"),d=(e,t)=>Ve(ze(e,t,""),"unknown"),f= new Set;for(let e of i)f.add(d(e,l)),f.add(d(e,s));let h=a.length>0?a:[...f].map(e=>({id:e})),m= new Map;for(let e of h)m.set(u(e),{links:0,value:0});for(let e of i){let t=d(e,l),r=d(e,s),n=He(ze(e,c,"value"))??0;for(let e of[t,r]){let t=m.get(e)??{links:0,value:0};t.links+=1,t.value+=n,m.set(e,t)}}let p={id:"root",role:"chart",level:1,label:`A ${"SankeyDiagram"===e||"ProcessSankey"===e?"flow diagram":"ChordDiagram"===e?"chord diagram":"network graph"} with ${h.length} nodes and ${i.length} links.${Ge(t,"Use linked highlighting to trace related marks.")}`,children:[]},g=0,y= new Map,b=t.colorBy??"group";for(let e of h){let t=Ve(ze(e,b,"group"),"Ungrouped"),r=y.get(t);r?r.push(e):y.set(t,[e])}let v=[...y].map(([e,t],a)=>{let i=[];for(let[e,o]of t.entries()){if(g>=r)break;g+=1;let t=u(o),l=m.get(t)??{links:0,value:0},s=l.value>0?`, ${n(l.value)} total flow`:"";i.push({id:`node-${a}-${e}-${qe(t)}`,role:"datum",level:3,label:`${t}: ${l.links} ${1===l.links?"link":"links"}${s}.`,value:l.value>0?l.value:void 0,datum:o})}return{id:`nodes-${a}-${qe(e)}`,role:"series",level:2,label:`${e}: ${t.length} ${1===t.length?"node":"nodes"}.`,children:i}});v.length>0&&p.children?.push(...v);let $=i.slice(0,r).map((e,t)=>{let r=d(e,l),a=d(e,s),i=He(ze(e,c,"value"));return{id:`link-${qe(r)}-${qe(a)}-${t}`,role:"datum",level:3,label:`${r} to ${a}${null==i?"":`: ${n(i)}`}.`,value:i,datum:e}});return i.length>r&&$.push({id:"links-more",role:"datum",level:3,label:`…and ${i.length-r} more links.`,value:void 0}),$.length>0&&p.children?.push({id:"links",role:"series",level:2,label:`Links: ${i.length} ${1===i.length?"connection":"connections"}.`,children:$}),p}function pr(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function gr(e,t){let r=Array.isArray(e.annotations)?e.annotations:null;if(!r)return null;let n=W(r.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let a=0,i=n.slice(0,t).map(e=>{let t=e.lifecycle?.status,r=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+a++,role:"annotation",level:3,label:`${pr(Tt(e))}${r}.`,datum:e}});n.length>t&&i.push({id:"annotation-"+a++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});let o=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===o?"one marked feature":`${o} marked features`}.`,children:i}}function yr(e,t,r={}){t=Ee(t);let n=r.locale??"en",a=Math.max(1,r.maxLeaves??200),i=Dt(n),o=Qe(e,t,r.recipe);if(o)return Yt(o,t,{maxLeaves:a,locale:n});let l={id:"root",role:"chart",label:_t(e,t,{locale:n}).text||"Chart.",level:1,children:[]},s=gr(t,a);if(I.has(e)){let r=mr(e,t,a,i);return hr(r,s),r}if(M.has(e)){let r=nr(e,t,a,i);return hr(r,s),r}if(R.has(e)){let r=dr(e,t,a,i);return hr(r,s),r}let c=Array.isArray(t.data)?t.data:null,u=fr(e,t,r);if(!c||0===c.length||!u)return s&&(l.children=[s]),l;let{measure:d,measureFallback:f,dimension:p,dimensionFallback:g}=dt(e,t),y=_e(d,f),b=Q(p,g),v="string"==typeof d&&d?d:f,$="string"==typeof p&&p?p:g,w=ft(t),C=0,A=e=>`${e}-${C++}`,S=(e,t)=>{let r=y(e),n=ht(b(e),i);return{id:A("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(r)?i(r):"—"}`,value:Number.isFinite(r)?r:void 0,datum:e}},k=(e,t)=>{let r=e.slice(0,a).map(e=>S(e,t));return e.length>a&&r.push({id:A("more"),role:"datum",level:t,label:`…and ${e.length-a} more points`}),r},x=[];if(h.has(e)||m.has(e)){let t=1/0,r=-1/0,n=1/0,a=-1/0,o=[],l=!0;for(let e of c){let i=y(e);Number.isFinite(i)&&(i<t&&(t=i),i>r&&(r=i));let s=b(e);o.push(s),"number"==typeof s&&Number.isFinite(s)?(s<n&&(n=s),s>a&&(a=s)):l=!1}let s= new Set,u=[];for(let e of o){let t=Ve(e);s.has(t)||(s.add(t),u.push(e))}let d=l?`${i(n)} to ${i(a)}`:`${ht(u[0],i)} to ${ht(u[u.length-1],i)} (${m.has(e)?`${u.length} categories`:`${c.length} points`})`;x.push({id:A("axis"),role:"axis",level:2,label:`${m.has(e)?"Category axis":"X axis"}: ${$}, ${d}.`}),r>=t&&x.push({id:A("axis"),role:"axis",level:2,label:`Value axis: ${v}, ${i(t)} to ${i(r)}.`})}if(w){let r=Q(w,w),a= new Map;for(let e of c){let t=Ve(r(e)),n=a.get(t);n?n.push(e):a.set(t,[e])}let i=[];for(let[r,o]of a){let a=_t(e,{...t,data:o},{levels:["l2","l3"],locale:n}).text;i.push({id:A("series"),role:"series",level:2,label:`Series ${r}: ${a}`,children:k(o,3)})}l.children=[...x,...i]}else l.children=[...x,...k(c,2)];return s&&l.children.push(s),l}function br(e){return Le(e)?e:void 0}function vr(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:void 0}function $r(e){let t=vr(e);return null==t?void 0:Math.max(0,Math.floor(t))}function wr(...e){return e.map(br).find(Boolean)}function Cr(...e){return e.find(Array.isArray)}function Ar(e){let t={};for(let[r,n]of Object.entries(e))void 0!==n&&(t[r]=n);return t}function Sr(e,t,r){return e["string"==typeof t&&t?t:r]}function kr(e){return"number"==typeof e?Number.isInteger(e)?String(e):String(Math.round(1e3*e)/1e3):Ve(e)}function xr(e,t,r){let n=[];if("GaugeChart"===e){"number"==typeof t.value&&Number.isFinite(t.value)&&n.push(`Current value is ${kr(t.value)}.`);let e="number"==typeof t.min&&Number.isFinite(t.min)?t.min:0,r="number"==typeof t.max&&Number.isFinite(t.max)?t.max:100;n.push(`The gauge scale runs from ${kr(e)} to ${kr(r)}.`)}if("SankeyDiagram"===e||"ProcessSankey"===e){let a=Array.isArray(t.edges)?t.edges:[];if("ProcessSankey"===e&&Array.isArray(t.domain)&&2===t.domain.length&&n.push(`The ProcessSankey time domain runs from ${kr(t.domain[0])} to ${kr(t.domain[1])}.`),a.length>0){n.push(`${a.length} source flow${1===a.length?"":"s"} are supplied.`);for(let i of a.slice(0,r)){let r=Sr(i,t.sourceAccessor,"source"),a=Sr(i,t.targetAccessor,"target"),o=Sr(i,t.valueAccessor,"value"),l="ProcessSankey"===e&&(null!=i.startTime||null!=i.endTime);n.push(l?`${kr(r)} to ${kr(a)} has value ${kr(o)} over ${kr(i.startTime)}–${kr(i.endTime)}.`:`${kr(r)} to ${kr(a)} has value ${kr(o)}.`)}}}if("Treemap"===e||"CirclePack"===e||"TreeDiagram"===e||"OrbitDiagram"===e){let e=Le(t.data)?t.data:void 0,a="string"==typeof t.valueAccessor&&t.valueAccessor?t.valueAccessor:"value",i="string"==typeof t.nodeIdAccessor&&t.nodeIdAccessor?t.nodeIdAccessor:"string"==typeof t.nodeIDAccessor&&t.nodeIDAccessor?t.nodeIDAccessor:"name",o=[],l= new WeakSet,s=e=>{if(l.has(e))return;let r=Ue(e,t.childrenAccessor);if(0!==r.length){l.add(e);for(let e of r)s(e);l.delete(e)}else o.push(e)};if(e&&s(e),o.length>0){n.push(`${o.length} hierarchy leaves are supplied.`);for(let e of o.slice(0,r))n.push(`${kr(e[i])} has value ${kr(e[a])}.`)}}if(F.has(e)&&Array.isArray(t.data)){let r=t.data;n.push(`${r.length} observed source row${1===r.length?"":"s"} are supplied.`);let a="CollisionSwarmChart"===e?t.xAccessor:t.valueAccessor,i="CollisionSwarmChart"===e?"x":"value",o=r.map(e=>vr(Sr(e,a,i))).filter(e=>null!=e);if(o.length>0){let[e,t]=Y(o);n.push(`Observed ${"string"==typeof a?a:i} ranges from ${kr(e)} to ${kr(t)}.`)}}if(0!==n.length)return{source:"chart-props",statements:n,text:`Exact chart-prop facts: ${n.join(" ")}`}}function Pr(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:`${t}s`}function jr(e){return Number.isInteger(e)?String(e):String(Math.round(1e3*e)/1e3)}function Or(e,t,r,n){let a=br(e.settledProjection),i=br(t?.settledProjection);return Cr(r?.projectionRows,r?.aggregates,e.settledProjectionRows,e.projectionRows,a?.rows,t?.settledProjectionRows,t?.projectionRows,i?.rows,n?.binCounts)}function Ir(e){if(!e||0===e.length)return;let t=e.map((e,t)=>{let r=br(e);if(!r)return;let n=vr(r.count??r.value??r.total??r.bodies??r.events);if(null==n)return;let a=Ve(r.label??r.id??r.name,`container ${t+1}`),i=null==r.id?void 0:Ve(r.id),o=vr(r.secondary??r.secondaryCount),l=vr(r.observed??r.observedCount);return Ar({id:i,label:a,count:n,secondary:o,secondaryLabel:"string"==typeof r.secondaryLabel?r.secondaryLabel:void 0,observed:l})}).filter(e=>null!=e);if(0===t.length)return;let r=t.reduce((e,t)=>e+t.count,0),n=t.filter(e=>e.count>0).length,a=t.slice().sort((e,t)=>t.count-e.count)[0];return{rows:t,totalCount:r,populatedCount:n,...a?{leader:a}:{}}}function Mr(e,t){let r=e?.map((e,t)=>{let r=br(e);if(!r)return;let n=vr(r.count)??0,a=vr(r.total),i={label:Ve(r.label??r.id,`sediment ${t+1}`),count:n};return null!=r.id&&(i.id=Ve(r.id)),null!=a&&(i.total=a),i}).filter(e=>null!=e),n=$r(t?.bins)??r?.length??0,a=vr(t?.count)??r?.reduce((e,t)=>e+t.count,0)??0,i=vr(t?.total)??r?.reduce((e,t)=>e+(t.total??0),0),o=r?.slice().sort((e,t)=>t.count-e.count)[0];if(0!==n||0!==a||i)return{bins:n,count:a,...null!=i&&i>0?{total:i}:{},...o?{leader:o}:{}}}function Rr(e){let t=br(e);return!!t&&(Le(t.world)||"simulationState"in t||"liveBodyOrder"in t)}function Fr(e){if(e)return e.filter(e=>!0===br(e)?.sleeping).length}function Dr(e,t,r){let n=e?.filter(e=>!0===br(e)?.sensor).length,a=br(t?.observation),i=br(a?.sensors),o=Cr(r?.activeSensors);return Math.max(n??0,i?Object.keys(i).length:0,o?.length??0)||void 0}function Lr(e){let t=[],r=e.simulation,n=[r.state??(r.settled?"settled":void 0),null!=r.liveBodies?`${r.liveBodies} live ${Pr(r.liveBodies,"body")}`:void 0,null!=r.sleepingBodies?`${r.sleepingBodies} sleeping`:void 0,null!=r.queued?`${r.queued} queued`:void 0,null!=r.seed?`seed ${jr(r.seed)}`:void 0,r.gravity?`gravity (${jr(r.gravity.x)}, ${jr(r.gravity.y)})`:void 0,null!=r.fixedDt?`fixed step ${jr(r.fixedDt)}s`:void 0,null!=r.timeScale?`${jr(r.timeScale)}x time`:void 0].filter(Boolean);n.length>0&&t.push(`Physics simulation: ${n.join("; ")}.`);let a=e.geometry;if(a){let e=[null!=a.colliders?`${a.colliders} ${Pr(a.colliders,"collider")}`:void 0,null!=a.sensors?`${a.sensors} ${Pr(a.sensors,"sensor")}`:void 0,null!=a.springs?`${a.springs} ${Pr(a.springs,"spring")}`:void 0,null!=a.activeSensorPairs?`${a.activeSensorPairs} active sensor ${Pr(a.activeSensorPairs,"pair")}`:void 0].filter(Boolean);e.length>0&&t.push(`Physics geometry: ${e.join("; ")}.`)}let i=e.aggregates;if(i){let e=i.leader,r=e?` Largest is ${e.label} with ${jr(e.count)}.`:"";t.push(`Physics aggregates: ${jr(i.totalCount)} settled ${Pr(i.totalCount,"body")} across ${i.rows.length} ${Pr(i.rows.length,"container")}; ${i.populatedCount} populated.${r}`)}let o=e.sediment;if(o){let e=null!=o.total?`, value total ${jr(o.total)}`:"",r=o.leader?`; largest sediment bin is ${o.leader.label} with ${jr(o.leader.count)}`:"";t.push(`Physics sediment: ${o.count} retained ${Pr(o.count,"body")} in ${o.bins} ${Pr(o.bins,"bin")}${e}${r}.`)}return t.join(" ")}function Nr(e,t,r){if(!1===r)return;let n=br(r),a=br(t.physics),i=wr(n?.snapshot,a?.snapshot,t.physicsSnapshot,Rr(t.snapshot)?t.snapshot:void 0),o=wr(n?.evidence,a?.evidence,t.physicsEvidence,t.settledEvidence),l=wr(n?.config,a?.config,i?.config,t.config),s=wr(br(i?.world),br(a?.world)),c=wr(br(l?.kernel),br(s?.options)),u=Cr(s?.bodies),d=Cr(s?.colliders,l?.colliders),f=Cr(i?.queue,a?.queue),h=Cr(i?.liveBodyOrder),m=Cr(s?.springs),p=Cr(i?.activeSensorPairs),g=Ir(Or(t,a,n,o)),y=Mr(Cr(n?.sediment,a?.sediment,i?.sediment),wr(n?.sedimentTotals,a?.sedimentTotals)),b=h?.length??u?.length??$r(o?.bodyCount),v=Fr(u)??$r(o?.sleepingCount),$=f?.length,w="string"==typeof i?.simulationState?i.simulationState:void 0,C="boolean"==typeof o?.settled?o.settled:w?"settled"===w:null!=b||null!=v||null!=$?null!=b&&v===b&&0===($??0):void 0,A=br(c?.gravity),S=vr(A?.x),k=vr(A?.y),x=Ar({state:w,settled:C,elapsedSeconds:vr(i?.elapsedSeconds),paused:"boolean"==typeof i?.paused?i.paused:void 0,visible:"boolean"==typeof i?.visible?i.visible:void 0,seed:vr(c?.seed),gravity:null!=S&&null!=k?{x:S,y:k}:void 0,fixedDt:vr(l?.fixedDt??c?.fixedDt),timeScale:vr(l?.timeScale),maxSubsteps:$r(l?.maxSubsteps),liveBodies:b,sleepingBodies:v,queued:$,bodyLimit:vr(l?.bodyLimit),eviction:"string"==typeof l?.eviction?l.eviction:void 0}),P=Ar({colliders:d?.length,sensors:Dr(d,l,s),springs:m?.length,activeSensorPairs:p?.length}),j=Object.keys(P).length>0,O=F.has(e);if(!(Object.keys(x).length>0||j||g||y)||!O&&null==r)return;let I={simulation:x,...j?{geometry:P}:{},...g?{aggregates:g}:{},...y?{sediment:y}:{}},M=Lr(I);return{...I,text:M}}function Er(e){if(!e)return{};if("fits"in e||"buildProps"in e)return{family:e.family};let t=e;return{family:t.family,intentScores:t.intentScores}}function Tr(e,t,r={}){t=Ee(t);let n,{capability:a,audience:i,locale:o}=r,l=r.levels??["l1","l2","l3"],s=!1!==r.includeStructure,c=Rt(e,a),u=_t(e,t,{levels:c?[...l,"l4"]:l,locale:o,capability:a,audience:i}),{l4:d,...f}=u.levels,h=["l1","l2","l3"].map(e=>u.levels[e]).filter(Boolean).join(" "),m={levels:f,text:u.annotations?`${u.annotations} ${h}`.trim():h,...u.annotations?{annotations:u.annotations}:{}};if(c&&d){let e=Er(a);n={act:c,sentence:d,family:e.family,intentScores:e.intentScores}}let p=s?yr(e,t,{maxLeaves:r.maxLeaves,locale:o}):void 0,g=Nr(e,t,r.physics),y=xr(e,t,Math.max(1,r.maxLeaves??200)),b=[m.text,n?.sentence,g?.text,y?.text].filter(Boolean).join(" ");return{component:e,description:m,intent:n,structure:p,physics:g,facts:y,text:b}}function Br(e,t){let r=e.trim();if(!r)throw new Error(`${t} must be a non-empty string.`);return encodeURIComponent(r)}function _r(e,...t){return`${e}/${t.map(e=>Br(e,"VACP ref segment")).join("/")}`}function zr(e,t){let r=`vacp://${Br(e,"appId")}`,n=_r(r,"view",t),a=e=>_r(n,"visualization",e);return{app:r,view:n,visualization:a,config:e=>_r(a(e),"config"),data:(e,t="data")=>_r(a(e),"data",t),selection:e=>_r(n,"selection",e),navigation:e=>_r(a(e),"navigation"),observation:e=>_r(a(e),"interaction","latest-observation")}}function Vr(e){let t=e.now?.()?? new Date,r=t instanceof Date?t:new Date(t);if(!Number.isFinite(r.getTime()))throw new Error("VACP bridge clock returned an invalid date.");return r.toISOString()}function Hr(e){let t="function"==typeof e?e():e,r= new Set;for(let e of t){let t=e.chartId.trim();if(!t)throw new Error("Every VACP chart requires a non-empty chartId.");if(r.has(t))throw new Error(`Duplicate VACP chartId "${t}".`);r.add(t)}return t}function qr(e){try{let{createdAt:t,...r}=st(e.component,e.props,{includeData:!1});return re(r)}catch(t){let r= Object.create(null);for(let[t,n]of Object.entries(e.props)){if(D.includes(t)||"function"==typeof n)continue;let e=te(n);void 0!==e&&(r[t]=e)}return{component:e.component,props:r,version:"unregistered",warning:t instanceof Error?t.message:"Chart config could not be serialized by toConfig."}}}function Gr(e){return Tr(e.component,e.props,{...e.grounding,audience:e.audience,includeStructure:!0,maxLeaves:N})}function Ur(e,t){let r=[];for(let n of D){let a=e.props[n];Array.isArray(a)&&r.push({ref:t.data(e.chartId,n),chartId:e.chartId,collection:n,rows:a})}return r}function Kr(e,t){t(e);for(let r of e.children??[])Kr(r,t)}function Jr(e,t){if(!t)return;let r;return Kr(e,e=>{!r&&e.id===t&&(r=e)}),r}function Wr(e){return null==e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e||e instanceof Date&&Number.isFinite(e.getTime())}function Qr(e,t){if("datum"!==e.role||!e.datum)return;let r= Object.create(null);for(let n of t){if(!Object.prototype.hasOwnProperty.call(e.datum,n)||!Wr(e.datum[n]))return;r[n]=e.datum[n]instanceof Date?e.datum[n].toISOString():e.datum[n]}return r}function Xr(e,t){let r=Array.from(new Set(e.matchFields.map(e=>e.trim()).filter(Boolean))),n= new Map;if(!r.length)return{valid:!1,diagnostic:"Navigation actions require at least one durable match field.",byKey:n,matchFields:r,targetRef:()=>_r(t,"target","invalid")};let a,i=0,o=0,l=!1;return Kr(e.tree,e=>{if("datum"!==e.role)return;i++;let t=Qr(e,r);if(!t)return void o++;let a=oe(t);n.has(a)?l=!0:n.set(a,e)}),i?o?a=`${o} navigation leaves lack durable primitive match-field values.`:l&&(a="Navigation match fields do not uniquely identify every datum leaf."):a="Navigation tree has no datum leaves.",{valid:!a,...a?{diagnostic:a}:{},byKey:n,matchFields:r,targetRef:e=>_r(t,"target",oe(e))}}function Zr(e,t){let r= new Map;for(let t of e)for(let e of t.chart.selections??[]){let n=e.name.trim();if(!n)throw new Error("VACP selection names must be non-empty.");let a=r.get(n)??{fields: new Set,modes: new Set,chartRefs: new Set};for(let t of e.fields.map(e=>e.trim()))t&&a.fields.add(t);if("interval"!==e.mode&&a.modes.add("point"),"point"!==e.mode&&a.modes.add("interval"),e.clientId){if(a.clientId&&a.clientId!==e.clientId)throw new Error(`Selection "${n}" declares conflicting VACP clientIds.`);a.clientId=e.clientId}a.chartRefs.add(t.ref),r.set(n,a)}return Array.from(r).sort(([e],[t])=>e.localeCompare(t)).map(([e,r])=>{if(0===r.fields.size)throw new Error(`Selection "${e}" requires at least one allowlisted field.`);return{ref:t.selection(e),name:e,fields:Array.from(r.fields).sort(),modes:r.modes,clientId:r.clientId??`__semiotic-vacp__:${e}`,chartRefs:Array.from(r.chartRefs)}})}function Yr(e,t){let{chart:r,ref:n,configRef:i,grounding:l}=e,s=[{ref:n,kind:"Visualization",layer:"VisualizationLayer",title:r.title??String(r.props.title??r.component),description:r.description??l.text,data:re({component:r.component,grounding:{description:l.description,intent:l.intent,physics:l.physics,text:l.text},audience:r.audience})},{ref:i,kind:"Param",layer:"ConfigLayer",title:`${r.component} configuration`,description:"Serializable Semiotic chart configuration with raw data collections omitted.",data:e.config}],c=[{from:e.ref,to:i,kind:"contains"}],u=(l.structure?.children??[]).filter(e=>"axis"===e.role).map(e=>e.label),d=0;for(let[e,t]of L){let a=r.props[e];if("string"!=typeof a||!a.trim())continue;let i=_r(n,"encoding",t);if(s.push({ref:i,kind:"EncodingChannel",layer:"VisualizationLayer",title:`${t} → ${a}`,data:{channel:t,field:a,accessorProp:e}}),c.push({from:n,to:i,kind:"contains"}),"x"===t||"y"===t||"category"===t||"value"===t||"ordinal"===t||"radial"===t){let e=_r(n,"axis",t);s.push({ref:e,kind:"Axis",layer:"VisualizationLayer",title:u[d++]??`${t} axis: ${a}`,data:{channel:t,field:a}}),c.push({from:n,to:e,kind:"contains"}),c.push({from:e,to:i,kind:"derivedFrom"})}}for(let i of e.dataHandles)s.push({ref:i.ref,kind:"DataHandle",layer:"DataLayer",title:`${r.chartId}.${i.collection}`,description:"Bounded details-on-demand handle. Use vacp.data_schema before requesting an opt-in sample.",data:{collection:i.collection,rowCount:i.rows.length,schemaAction:o,...t.dataAccess?.sample?{inspectAction:a}:{}}}),c.push({from:n,to:i.ref,kind:"contains"});if(e.navigation){let{navigation:t}=e;s.push({ref:t.ref,kind:"Selection",layer:"InteractionFeedbackLayer",title:`${r.title??r.component} structured navigation`,description:t.index.diagnostic??"Active accessible-navigation target identified by durable datum fields.",data:{matchFields:t.index.matchFields,targetCount:t.index.byKey.size,status:t.index.valid?t.binding.onActiveChange?"actionable":"read-only":"ambiguous"}}),c.push({from:n,to:t.ref,kind:"contains"})}if(t.getObservations){let e=_r(n,"interaction","latest-observation");s.push({ref:e,kind:"InteractionTarget",layer:"InteractionFeedbackLayer",title:`${r.title??r.component} latest observation`,description:"Latest semantic hover, focus, selection, brush, activation, or control observation."}),c.push({from:n,to:e,kind:"contains"})}let f=Array.isArray(r.props.annotations)?r.props.annotations:[],h= new Set;for(let e of f){if(!ee(e))continue;let t=ee(e.provenance)?e.provenance:void 0,a=e.id??e.stableId??t?.stableId,i=null==a||""===a?void 0:String(a);if(!i)continue;let o=ee(e.note)?e.note:void 0,l=ee(e.noteData)?e.noteData:void 0,u=_r(n,"annotation",i);if(h.has(u))throw new Error(`Duplicate stable annotation id "${i.trim()}" in VACP chart "${r.chartId}".`);h.add(u),s.push({ref:u,kind:"InteractionTarget",layer:"VisualizationLayer",title:String(e.label??o?.label??l?.label??`Annotation ${i}`),description:"string"==typeof e.note?e.note:"string"==typeof e.description?e.description:void 0,data:re({id:i,provenance:t,lifecycle:e.lifecycle})}),c.push({from:n,to:u,kind:"contains"})}return{nodes:s,edges:c}}function en(e,t){let r=Hr(e.charts).map(e=>{let r=t.visualization(e.chartId),n=e.navigation?{ref:t.navigation(e.chartId),chartRef:r,chartId:e.chartId,binding:e.navigation,index:Xr(e.navigation,t.navigation(e.chartId))}:void 0;return{chart:e,ref:r,configRef:t.config(e.chartId),grounding:Gr(e),config:qr(e),dataHandles:Ur(e,t),...n?{navigation:n}:{}}}),n=Zr(r,t),a=r.flatMap(e=>e.dataHandles),o=[{ref:t.app,kind:"App",layer:"ViewLayer",title:e.title??e.appId,description:"Semiotic application state exposed through the experimental VACP 0.1.0 bridge.",data:{provider:"semiotic",protocol:i}},{ref:t.view,kind:"View",layer:"ViewLayer",title:e.title??e.viewId??"Semiotic charts"}],l=[{from:t.app,to:t.view,kind:"contains"}];for(let n of r){let r=Yr(n,e);o.push(...r.nodes),l.push(...r.edges),l.push({from:t.view,to:n.ref,kind:"contains"})}for(let e of n){o.push({ref:e.ref,kind:"Selection",layer:"InteractionFeedbackLayer",title:`Selection: ${e.name}`,description:"Named LinkedCharts selection. Agent mutations are restricted to declared fields and modes.",data:{name:e.name,fields:e.fields,modes:Array.from(e.modes).sort()}}),l.push({from:t.view,to:e.ref,kind:"contains"});for(let t of e.chartRefs)l.push({from:e.ref,to:t,kind:"controls"})}return{charts:r,selections:n,dataHandles:a,nodes:o,edges:l}}function tn(e,t){for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.chartId===t)return n}}function rn(e,t,r){let n={},a={},o=t.getSelections?.()??{},l=t.getObservations?.()??[];for(let i of e.charts){n[i.ref]=re({component:i.chart.component,description:i.grounding.description,intent:i.grounding.intent,physics:i.grounding.physics,audience:i.chart.audience}),n[i.configRef]=i.config,a[i.ref]={component:i.chart.component,dataHandles:i.dataHandles.length};for(let e of i.dataHandles)n[e.ref]={kind:"DataHandle",collection:e.collection,rowCount:e.rows.length},a[e.ref]={rowCount:e.rows.length};if(i.navigation){let e=Jr(i.navigation.binding.tree,i.navigation.binding.activeId),t=e?Qr(e,i.navigation.index.matchFields):void 0;n[i.navigation.ref]=re({kind:"Selection",status:i.navigation.index.valid?"ready":"ambiguous",activeRole:e?.role,activeLabel:e?.label,activeMatch:t,activeTargetRef:t?i.navigation.index.targetRef(t):void 0,diagnostic:i.navigation.index.diagnostic}),a[i.navigation.ref]={targetCount:i.navigation.index.byKey.size}}if(t.getObservations){let e=tn(l,i.chart.chartId);n[r.observation(i.chart.chartId)]=e?re(e):null,e&&(a[r.observation(i.chart.chartId)]={type:e.type,timestamp:e.timestamp})}}for(let t of e.selections){let e=o[t.name];n[t.ref]=(e?re(e):void 0)??{name:t.name,resolution:"union",clauses:[]},a[t.ref]={active:!!e?.clauses.length,clauseCount:e?.clauses.length??0,fields:t.fields}}return{version:i,createdAt:Vr(t),state:n,...Object.keys(a).length?{summary:a}:{}}}function nn(e,t){let r=en(e,t);return{...r,actions:Oe(r,e,t)}}function an(e){let t=e.viewId?.trim()||"main",r=zr(e.appId,t),n="number"==typeof e.stateCacheSize&&Number.isFinite(e.stateCacheSize)?Math.max(1,Math.floor(e.stateCacheSize)):64,a= new Map,o=(e,t)=>{for(a.has(e)&&a.delete(e),a.set(e,t);a.size>n;){let e=a.keys().next().value;if("string"!=typeof e)break;a.delete(e)}};return{version:i,refs:r,getCapabilities:t=>{let n=nn(e,r),a={version:i,createdAt:Vr(e),graph:{version:i,nodes:n.nodes,edges:n.edges,actions:n.actions.map(e=>e.descriptor)}};return t?me(a,t):a},getState:async function(t){let n=rn(nn(e,r),e,r);if(!t)return n;let l,{snapshot:s,refs:c}=ue(n,t),u=le(s),d=t.since?a.get(t.since):void 0;if("full"!==t.mode&&t.since&&d){let e=ue(d,t).snapshot;l={version:i,createdAt:s.createdAt,mode:"delta",token:u,baseToken:t.since,...c?{scope:{refs:c}}:{},delta:de(e,s)}}else l={version:i,createdAt:s.createdAt,mode:"full",token:u,...c?{scope:{refs:c}}:{},snapshot:s};return o(u,n),l},execute:async t=>{let n=t&&"string"==typeof t.callId?t.callId:"";try{if(!t||"string"!=typeof t.name||!t.name.trim())throw new Error("VACP action call requires a non-empty name.");if(!n)throw new Error("VACP action call requires a callId.");let a=nn(e,r),i=a.actions.find(e=>e.descriptor.name===t.name);if(!i)return{callId:n,ok:!1,error:{message:`Unknown or currently unavailable VACP action "${t.name}".`,details:{available:a.actions.map(e=>e.descriptor.name)}}};let o=te(await i.execute(t.params));return{callId:n,ok:!0,...void 0!==o?{result:o}:{}}}catch(e){return{callId:n,ok:!1,error:{message:e instanceof Error?e.message:"VACP action failed."}}}}}}function on(e,t={}){let r=t.globalKey?.trim()||"__vacp",n=t.target??(typeof window<"u"?window:void 0);if(!n)return{installed:!1,globalKey:r,bridge:e,reason:`Refused to install "${r}" without a browser window or an explicit target.`,cleanup:()=>!1};if("__proto__"===r||"prototype"===r||"constructor"===r)return{installed:!1,globalKey:r,bridge:e,reason:`Refused unsafe global key "${r}".`,cleanup:()=>!1};let a=n[r];if(void 0!==a&&a!==e)return{installed:!1,globalKey:r,bridge:e,reason:`Refused to replace existing global "${r}".`,cleanup:()=>!1};try{n[r]=e}catch(t){return{installed:!1,globalKey:r,bridge:e,reason:t instanceof Error?`Could not install "${r}": ${t.message}`:`Could not install "${r}".`,cleanup:()=>!1}}return{installed:!0,globalKey:r,bridge:e,cleanup:()=>{if(n[r]!==e)return!1;try{return delete n[r]}catch{return!1}}}}var e="semiotic.set_point_selection",t="semiotic.set_interval_selection",r="semiotic.clear_selection",n="semiotic.activate_navigation_node",a="semiotic.inspect_data",i="0.1.0",o="vacp.data_schema",l=["MotifBraidChart","DependencyForestChart","FlowCircuitChart","BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","RadarChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","WaterfallChart","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"],s=/*#__PURE__*/new Set(l),c=/*#__PURE__*/Symbol.for("semiotic.chartRecipeRegistry"),u="1",d=/*#__PURE__*/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","interactiveGraphics","legend","recipe","layout"]),f="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e)),h=/*#__PURE__*/new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),m=/*#__PURE__*/new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),p=/*#__PURE__*/new Set(["PieChart","DonutChart","FunnelChart"]),g=/*#__PURE__*/new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]),y={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",BumpChart:"bump 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"},b=/*#__PURE__*/new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),v=/*#__PURE__*/new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]),$=/*#__PURE__*/new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),w={"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"},C={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},A=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],S={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"},k=/*#__PURE__*/new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),x=/*#__PURE__*/new Set(["system","agent","watcher"]),P=/*#__PURE__*/new Set(["ai","agent","system","computed","dbt","great-expectations"]),j=/*#__PURE__*/new Set(["rule","statistical-test","llm-inference","computed"]),O={"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"},I=/*#__PURE__*/new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),M=/*#__PURE__*/new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),R=/*#__PURE__*/new Set(["ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram"]),F=/*#__PURE__*/new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]),D=["data","nodes","edges","points","areas","lines","flows"],L=[["xAccessor","x"],["yAccessor","y"],["categoryAccessor","category"],["valueAccessor","value"],["colorBy","color"],["sizeAccessor","size"],["lineBy","series"],["groupAccessor","group"],["oAccessor","ordinal"],["rAccessor","radial"],["sourceAccessor","source"],["targetAccessor","target"],["nodeIDAccessor","id"]],N=1;export{n as unstable_SEMIOTIC_VACP_ACTIVATE_NAVIGATION_ACTION,r as unstable_SEMIOTIC_VACP_CLEAR_SELECTION_ACTION,a as unstable_SEMIOTIC_VACP_INSPECT_DATA_ACTION,t as unstable_SEMIOTIC_VACP_SET_INTERVAL_SELECTION_ACTION,e as unstable_SEMIOTIC_VACP_SET_POINT_SELECTION_ACTION,o as unstable_VACP_DATA_SCHEMA_ACTION,i as unstable_VACP_SCHEMA_VERSION,an as unstable_createSemioticVACPBridge,on as unstable_installSemioticVACPBridge};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{e as LineChart}from"./c-
|
|
2
|
+
export{e as LineChart}from"./c-RDFFLRKC.min.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
function t(i,t){if("string"==typeof i.id&&i.id.length>0)return i.id;if(!i.row)return;if("function"==typeof t)return t(i.row);let o=i.row[t];return null==o?void 0:String(o)}function r(i,t){let o=new Set;for(let r of i){let i="function"==typeof t?t(r):r[t];null!=i&&o.add(String(i))}return o}function m(i,o,m){let e=!1!==m.coalesce?Array.from(o.reduce((i,o)=>{let r=t(o,m.key);return r&&(i.delete(r),i.set(r,o)),i},new Map).values()):[...o],s=r(i.getData(),m.key),n=[],a=0,p=0,c=0,j=()=>{0!==n.length&&(i.pushMany(n),c+=n.length,a+=n.length,n.length=0)};for(let o of e){let r=t(o,m.key);if(r){if("delete"===o.op||"retract"===o.op){j(),i.remove(r),s.delete(r),p+=1,c+=1;continue}o.row&&(s.has(r)?(j(),i.update(r,()=>o.row).length>0?(a+=1,c+=1):n.push(o.row)):(n.push(o.row),s.add(r)))}}return j(),{applied:c,upserts:a,retracts:p}}export{a as registerBuiltInXYPlugins}from"./c-
|
|
2
|
+
function t(i,t){if("string"==typeof i.id&&i.id.length>0)return i.id;if(!i.row)return;if("function"==typeof t)return t(i.row);let o=i.row[t];return null==o?void 0:String(o)}function r(i,t){let o=new Set;for(let r of i){let i="function"==typeof t?t(r):r[t];null!=i&&o.add(String(i))}return o}function m(i,o,m){let e=!1!==m.coalesce?Array.from(o.reduce((i,o)=>{let r=t(o,m.key);return r&&(i.delete(r),i.set(r,o)),i},new Map).values()):[...o],s=r(i.getData(),m.key),n=[],a=0,p=0,c=0,j=()=>{0!==n.length&&(i.pushMany(n),c+=n.length,a+=n.length,n.length=0)};for(let o of e){let r=t(o,m.key);if(r){if("delete"===o.op||"retract"===o.op){j(),i.remove(r),s.delete(r),p+=1,c+=1;continue}o.row&&(s.has(r)?(j(),i.update(r,()=>o.row).length>0?(a+=1,c+=1):n.push(o.row)):(n.push(o.row),s.add(r)))}}return j(),{applied:c,upserts:a,retracts:p}}export{a as registerBuiltInXYPlugins}from"./c-AQUX6L2O.min.js";export{b as HyperLogLog,p as RealtimeHeatmap,k as RealtimeHistogram,i as RealtimeLineChart,n as RealtimeSwarmChart,o as RealtimeWaterfallChart,h as ReorderBuffer,a as RunningStats,c as TDigest,l as TemporalHistogram,d as WindowAccumulator,f as bandBounds,j as histogramBinSelectionDatum,g as parseWindowDuration,e as statValue}from"./c-2M2OPWVA.min.js";export{f as StreamXYFrame}from"./c-LEICSI5V.min.js";export{d as IncrementalExtent}from"./c-4YPPVFZH.min.js";export{a as RingBuffer}from"./c-XORVM6C5.min.js";export{b as StreamNetworkFrame}from"./c-WSWMQDFZ.min.js";export{c as DEFAULT_LIFECYCLE_THRESHOLDS,aL as MultiLineTooltip,aQ as MultiPointTooltip,aK as Tooltip,d as bandFromAge,f as compileMotionEncoding,j as deriveMotionVector,h as opacityFromAge,e as resolveMotionAccessor,i as resolveMotionVector}from"./c-SU6Z75M2.min.js";export{w as TooltipRoot,z as hasOwnTooltipChrome,s as hasTooltipContent,y as markTooltipChrome}from"./c-TC47SNSI.min.js";export{c as getSourceRows}from"./c-5PCO2P5Q.min.js";export{m as applyChangelog};
|