@extend-ai/react-xlsx 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chart-renderer-LHXMRBGR.cjs → chart-renderer-AAVZ34BF.cjs} +43 -38
- package/dist/chart-renderer-AAVZ34BF.cjs.map +1 -0
- package/dist/{chart-renderer-R2B4I2HL.js → chart-renderer-KGLAI4DN.js} +25 -20
- package/dist/chart-renderer-KGLAI4DN.js.map +1 -0
- package/dist/{chart-renderer-HVOEAQXK.cjs → chart-renderer-NM5UVCTO.cjs} +43 -38
- package/dist/chart-renderer-NM5UVCTO.cjs.map +1 -0
- package/dist/{chart-renderer-3K2VKB5I.js → chart-renderer-RXO7WP4Q.js} +25 -20
- package/dist/chart-renderer-RXO7WP4Q.js.map +1 -0
- package/dist/{chunk-TYJLNPNE.cjs → chunk-2YBG7XQ3.cjs} +17 -8
- package/dist/chunk-2YBG7XQ3.cjs.map +1 -0
- package/dist/{chunk-3O2QY6LA.js → chunk-3JTCYAUX.js} +3 -3
- package/dist/{chunk-4VX5HTCF.cjs → chunk-6K3NSKDJ.cjs} +3 -3
- package/dist/{chunk-4VX5HTCF.cjs.map → chunk-6K3NSKDJ.cjs.map} +1 -1
- package/dist/{chunk-ZIO47YMT.cjs → chunk-MCFUTO4J.cjs} +3 -3
- package/dist/{chunk-ZIO47YMT.cjs.map → chunk-MCFUTO4J.cjs.map} +1 -1
- package/dist/{chunk-E2VSYCP2.cjs → chunk-O3V2MCOC.cjs} +18 -2
- package/dist/chunk-O3V2MCOC.cjs.map +1 -0
- package/dist/{chunk-Y737JKUG.js → chunk-QN3D3JS2.js} +14 -5
- package/dist/chunk-QN3D3JS2.js.map +1 -0
- package/dist/{chunk-BAAMDEDS.js → chunk-VXBNYHW5.js} +18 -2
- package/dist/{chunk-BAAMDEDS.js.map → chunk-VXBNYHW5.js.map} +1 -1
- package/dist/{chunk-O7S3Y6II.js → chunk-WSQDFXDW.js} +3 -3
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/{internal-DSz8QMhK.d.cts → internal-DrXSHYJZ.d.cts} +2 -0
- package/dist/{internal-DSz8QMhK.d.ts → internal-DrXSHYJZ.d.ts} +2 -0
- package/dist/internal.cjs +3 -3
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -2
- package/dist/{surface-regl-PWTZWQQS.cjs → surface-regl-5Z6IVOID.cjs} +17 -14
- package/dist/surface-regl-5Z6IVOID.cjs.map +1 -0
- package/dist/{surface-regl-NWR5ZZ5D.js → surface-regl-7CDGGVDG.js} +10 -7
- package/dist/surface-regl-7CDGGVDG.js.map +1 -0
- package/dist/{surface-regl-MAPCPD7W.cjs → surface-regl-AY7JZVYY.cjs} +17 -14
- package/dist/surface-regl-AY7JZVYY.cjs.map +1 -0
- package/dist/{surface-regl-KW4JL325.js → surface-regl-TJUWTLAZ.js} +10 -7
- package/dist/surface-regl-TJUWTLAZ.js.map +1 -0
- package/dist/vanilla.cjs +3 -3
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +2 -2
- package/package.json +1 -1
- package/dist/chart-renderer-3K2VKB5I.js.map +0 -1
- package/dist/chart-renderer-HVOEAQXK.cjs.map +0 -1
- package/dist/chart-renderer-LHXMRBGR.cjs.map +0 -1
- package/dist/chart-renderer-R2B4I2HL.js.map +0 -1
- package/dist/chunk-E2VSYCP2.cjs.map +0 -1
- package/dist/chunk-TYJLNPNE.cjs.map +0 -1
- package/dist/chunk-Y737JKUG.js.map +0 -1
- package/dist/surface-regl-KW4JL325.js.map +0 -1
- package/dist/surface-regl-MAPCPD7W.cjs.map +0 -1
- package/dist/surface-regl-NWR5ZZ5D.js.map +0 -1
- package/dist/surface-regl-PWTZWQQS.cjs.map +0 -1
- /package/dist/{chunk-3O2QY6LA.js.map → chunk-3JTCYAUX.js.map} +0 -0
- /package/dist/{chunk-O7S3Y6II.js.map → chunk-WSQDFXDW.js.map} +0 -0
|
@@ -992,6 +992,8 @@ interface XlsxViewerController {
|
|
|
992
992
|
chartsheets: XlsxChartsheet[];
|
|
993
993
|
exportCsv: () => void;
|
|
994
994
|
exportXlsx: () => void;
|
|
995
|
+
/** The current workbook as XLSX bytes, the same bytes `exportXlsx()` downloads; `null` before a workbook loads. */
|
|
996
|
+
getXlsxBytes: () => Uint8Array | null;
|
|
995
997
|
error: Error | null;
|
|
996
998
|
file?: ArrayBuffer;
|
|
997
999
|
fillSelection: (targetRange: XlsxCellRange) => void;
|
|
@@ -992,6 +992,8 @@ interface XlsxViewerController {
|
|
|
992
992
|
chartsheets: XlsxChartsheet[];
|
|
993
993
|
exportCsv: () => void;
|
|
994
994
|
exportXlsx: () => void;
|
|
995
|
+
/** The current workbook as XLSX bytes, the same bytes `exportXlsx()` downloads; `null` before a workbook loads. */
|
|
996
|
+
getXlsxBytes: () => Uint8Array | null;
|
|
995
997
|
error: Error | null;
|
|
996
998
|
file?: ArrayBuffer;
|
|
997
999
|
fillSelection: (targetRange: XlsxCellRange) => void;
|
package/dist/internal.cjs
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('./chunk-
|
|
10
|
+
var _chunk2YBG7XQ3cjs = require('./chunk-2YBG7XQ3.cjs');
|
|
11
|
+
require('./chunk-MCFUTO4J.cjs');
|
|
12
12
|
require('./chunk-CJBI5F6V.cjs');
|
|
13
13
|
require('./chunk-T5WZHPIN.cjs');
|
|
14
14
|
|
|
@@ -20,5 +20,5 @@ require('./chunk-T5WZHPIN.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
exports.XlsxFileSizeLimitExceededError =
|
|
23
|
+
exports.XlsxFileSizeLimitExceededError = _chunk2YBG7XQ3cjs.XlsxFileSizeLimitExceededError; exports.__createContentNode = _chunk2YBG7XQ3cjs.__createContentNode; exports.__createContentRoot = _chunk2YBG7XQ3cjs.__createContentRoot; exports.__createControlledViewer = _chunk2YBG7XQ3cjs.__createControlledViewer; exports.canUseConfiguredWasmSourceInWorker = _chunk2YBG7XQ3cjs.canUseConfiguredWasmSourceInWorker; exports.formatBinaryBytes = _chunk2YBG7XQ3cjs.formatBinaryBytes; exports.getConfiguredWorkerWasmSource = _chunk2YBG7XQ3cjs.getConfiguredWorkerWasmSource; exports.getSheetsWasmModule = _chunk2YBG7XQ3cjs.getSheetsWasmModule;
|
|
24
24
|
//# sourceMappingURL=internal.cjs.map
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { aR as WorkerWasmSource, N as XlsxFileSizeLimitExceededError, aS as __createContentNode, aT as __createContentRoot, aU as __createControlledViewer, aV as canUseConfiguredWasmSourceInWorker, aW as formatBinaryBytes, aX as getConfiguredWorkerWasmSource, aY as getSheetsWasmModule } from './internal-
|
|
1
|
+
export { aR as WorkerWasmSource, N as XlsxFileSizeLimitExceededError, aS as __createContentNode, aT as __createContentRoot, aU as __createControlledViewer, aV as canUseConfiguredWasmSourceInWorker, aW as formatBinaryBytes, aX as getConfiguredWorkerWasmSource, aY as getSheetsWasmModule } from './internal-DrXSHYJZ.cjs';
|
|
2
2
|
import '@dukelib/sheets-wasm';
|
|
3
3
|
import 'csstype';
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { aR as WorkerWasmSource, N as XlsxFileSizeLimitExceededError, aS as __createContentNode, aT as __createContentRoot, aU as __createControlledViewer, aV as canUseConfiguredWasmSourceInWorker, aW as formatBinaryBytes, aX as getConfiguredWorkerWasmSource, aY as getSheetsWasmModule } from './internal-
|
|
1
|
+
export { aR as WorkerWasmSource, N as XlsxFileSizeLimitExceededError, aS as __createContentNode, aT as __createContentRoot, aU as __createControlledViewer, aV as canUseConfiguredWasmSourceInWorker, aW as formatBinaryBytes, aX as getConfiguredWorkerWasmSource, aY as getSheetsWasmModule } from './internal-DrXSHYJZ.js';
|
|
2
2
|
import '@dukelib/sheets-wasm';
|
|
3
3
|
import 'csstype';
|
package/dist/internal.js
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
formatBinaryBytes,
|
|
8
8
|
getConfiguredWorkerWasmSource,
|
|
9
9
|
getSheetsWasmModule
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-QN3D3JS2.js";
|
|
11
|
+
import "./chunk-WSQDFXDW.js";
|
|
12
12
|
import "./chunk-NBH72POD.js";
|
|
13
13
|
export {
|
|
14
14
|
XlsxFileSizeLimitExceededError,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkO3V2MCOCcjs = require('./chunk-O3V2MCOC.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -160,7 +160,7 @@ function normalizeSurfaceY(row, rows) {
|
|
|
160
160
|
return rows <= 1 ? 0 : (row / (rows - 1) - 0.5) * 2;
|
|
161
161
|
}
|
|
162
162
|
function normalizeSurfaceZ(value, domain, heightExtent, axis) {
|
|
163
|
-
return -(
|
|
163
|
+
return -(_chunkO3V2MCOCcjs.normalizeSurfaceValue.call(void 0, value, domain.minValue, domain.safeMax, axis) - 0.5) * heightExtent;
|
|
164
164
|
}
|
|
165
165
|
function projectCartesian3dPoint(x, y, z, rotXRad, rotYRad, usePerspective, perspectiveStrength, rightAngleAxes) {
|
|
166
166
|
if (rightAngleAxes) {
|
|
@@ -224,7 +224,7 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
224
224
|
const rotY = (_nullishCoalesce(_optionalChain([chart, 'access', _33 => _33.view3d, 'optionalAccess', _34 => _34.rotY]), () => ( 30))) * (Math.PI / 180);
|
|
225
225
|
const usePerspective = !isContour && _optionalChain([chart, 'access', _35 => _35.view3d, 'optionalAccess', _36 => _36.rAngAx]) === false;
|
|
226
226
|
const perspectiveStrength = clamp((_nullishCoalesce(_optionalChain([chart, 'access', _37 => _37.view3d, 'optionalAccess', _38 => _38.perspective]), () => ( (usePerspective ? 30 : 0)))) / 100, 0, 1);
|
|
227
|
-
const ratios =
|
|
227
|
+
const ratios = _chunkO3V2MCOCcjs.surfaceDataRatios.call(void 0, rows, cols, _optionalChain([chart, 'access', _39 => _39.valueAxis, 'optionalAccess', _40 => _40.crossBetween]) !== "midCat", _optionalChain([chart, 'access', _41 => _41.view3d, 'optionalAccess', _42 => _42.heightPercent]), _optionalChain([chart, 'access', _43 => _43.view3d, 'optionalAccess', _44 => _44.depthPercent]), layout);
|
|
228
228
|
const depthScale = ratios.depth;
|
|
229
229
|
const heightExtent = 2 * ratios.height;
|
|
230
230
|
const usesFlatMaterial = chart.surfaceMaterial === "flat";
|
|
@@ -274,7 +274,7 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
274
274
|
if (p00 == null || p10 == null || p01 == null || p11 == null) {
|
|
275
275
|
continue;
|
|
276
276
|
}
|
|
277
|
-
const triangles =
|
|
277
|
+
const triangles = _chunkO3V2MCOCcjs.triangulateSurfaceQuad.call(void 0, [
|
|
278
278
|
{ value: p00, x: columnIndex, y: rowIndex },
|
|
279
279
|
{ value: p10, x: columnIndex + 1, y: rowIndex },
|
|
280
280
|
{ value: p11, x: columnIndex + 1, y: rowIndex + 1 },
|
|
@@ -284,7 +284,7 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
284
284
|
for (let band = 0; band < domain.ticks.length - 1; band += 1) {
|
|
285
285
|
const lower = domain.ticks[band];
|
|
286
286
|
const upper = domain.ticks[band + 1];
|
|
287
|
-
const polygon =
|
|
287
|
+
const polygon = _chunkO3V2MCOCcjs.clipSurfaceBand.call(void 0, _chunkO3V2MCOCcjs.clipSurfaceBand.call(void 0, triangle, lower, true, chart.valueAxis, band === 0), upper, false, chart.valueAxis);
|
|
288
288
|
if (polygon.length < 3) continue;
|
|
289
289
|
const bandColor = resolveSurfaceBandColor(chart, palette, domain, (lower + upper) / 2);
|
|
290
290
|
if (!isWireframe && bandColor !== "transparent") {
|
|
@@ -295,10 +295,13 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
298
|
+
for (const group of _chunkO3V2MCOCcjs.groupSurfaceBandEdges.call(void 0, polygon, triangle, band, lower, isWireframe)) {
|
|
299
|
+
const edgeMidpoint = (domain.ticks[group.band] + domain.ticks[group.band + 1]) / 2;
|
|
300
|
+
const color = resolveSurfaceWireframeColor(chart, palette, domain, edgeMidpoint);
|
|
301
|
+
if (color !== "transparent") {
|
|
302
|
+
for (const [from, to] of group.edges) {
|
|
303
|
+
contourLines.push({ color, from: projectPoint(from.x, from.y, from.value), to: projectPoint(to.x, to.y, to.value) });
|
|
304
|
+
}
|
|
302
305
|
}
|
|
303
306
|
}
|
|
304
307
|
}
|
|
@@ -426,8 +429,8 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
426
429
|
const wallColors = [];
|
|
427
430
|
for (const triangle of wallTriangles) {
|
|
428
431
|
const world = triangle.points.map((point) => ({ x: point.worldX, y: point.worldY, z: -point.worldZ }));
|
|
429
|
-
const normal =
|
|
430
|
-
const rgba = colorToRgba(usesFlatMaterial ? triangle.color :
|
|
432
|
+
const normal = _chunkO3V2MCOCcjs.transformSurfaceNormal.call(void 0, _chunkO3V2MCOCcjs.surfaceNormal.call(void 0, world[0], world[1], world[2]), _nullishCoalesce(_optionalChain([chart, 'access', _101 => _101.view3d, 'optionalAccess', _102 => _102.rotX]), () => ( 25)), _nullishCoalesce(_optionalChain([chart, 'access', _103 => _103.view3d, 'optionalAccess', _104 => _104.rotY]), () => ( 30)), _optionalChain([chart, 'access', _105 => _105.view3d, 'optionalAccess', _106 => _106.rAngAx]) !== false);
|
|
433
|
+
const rgba = colorToRgba(usesFlatMaterial ? triangle.color : _chunkO3V2MCOCcjs.shadeSurfaceMatteColor.call(void 0, triangle.color, normal), 1);
|
|
431
434
|
for (const point of triangle.points) {
|
|
432
435
|
const clip = toClipPoint(point);
|
|
433
436
|
wallPositions.push(clip.x, clip.y, clip.z);
|
|
@@ -442,8 +445,8 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
442
445
|
continue;
|
|
443
446
|
}
|
|
444
447
|
const world = [left, middle, right].map((vertex) => ({ x: vertex.point.worldX, y: vertex.point.worldY, z: -vertex.point.worldZ }));
|
|
445
|
-
const normal =
|
|
446
|
-
const shaded = colorToRgba(usesFlatMaterial ? left.bandColor :
|
|
448
|
+
const normal = _chunkO3V2MCOCcjs.transformSurfaceNormal.call(void 0, _chunkO3V2MCOCcjs.surfaceNormal.call(void 0, world[0], world[1], world[2]), _nullishCoalesce(_optionalChain([chart, 'access', _107 => _107.view3d, 'optionalAccess', _108 => _108.rotX]), () => ( 25)), _nullishCoalesce(_optionalChain([chart, 'access', _109 => _109.view3d, 'optionalAccess', _110 => _110.rotY]), () => ( 30)), _optionalChain([chart, 'access', _111 => _111.view3d, 'optionalAccess', _112 => _112.rAngAx]) !== false);
|
|
449
|
+
const shaded = colorToRgba(usesFlatMaterial ? left.bandColor : _chunkO3V2MCOCcjs.shadeSurfaceMatteColor.call(void 0, left.bandColor, normal), 1);
|
|
447
450
|
[left, middle, right].forEach((vertex) => {
|
|
448
451
|
const clip = toClipPoint(vertex.point);
|
|
449
452
|
fillPositions.push(clip.x, clip.y, clip.z);
|
|
@@ -718,4 +721,4 @@ var MemoSurfaceChartComposite = React.memo(function MemoSurfaceChartComposite2({
|
|
|
718
721
|
|
|
719
722
|
|
|
720
723
|
exports.MemoSurfaceChartComposite = MemoSurfaceChartComposite;
|
|
721
|
-
//# sourceMappingURL=surface-regl-
|
|
724
|
+
//# sourceMappingURL=surface-regl-5Z6IVOID.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/surface-regl-5Z6IVOID.cjs","../src/surface-regl.tsx"],"names":["MemoSurfaceChartComposite"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACA;AChBA,wEAAuB;AACvB,2EAAuB;AAw0BjB,+CAAA;AAhwBN,SAAS,KAAA,CAAM,KAAA,EAAe,GAAA,EAAa,GAAA,EAAa;AACtD,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,KAAK,CAAC,CAAA;AAC3C;AAEA,SAAS,UAAA,CAAW,KAAA,EAAgB;AAClC,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,SAAA,GAAY,MAAA,CAAO,QAAA,CAAS,KAAK,CAAA,EAAG;AACvD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,QAAA,EAAU;AAC7B,IAAA,MAAM,WAAA,EAAa,KAAA,CAAM,IAAA,CAAK,CAAA,CAAE,OAAA,CAAQ,IAAA,EAAM,EAAE,CAAA;AAChD,IAAA,GAAA,CAAI,CAAC,UAAA,EAAY;AACf,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,MAAM,OAAA,EAAS,MAAA,CAAO,UAAU,CAAA;AAChC,IAAA,OAAO,MAAA,CAAO,QAAA,CAAS,MAAM,EAAA,EAAI,OAAA,EAAS,IAAA;AAAA,EAC5C;AACA,EAAA,OAAO,IAAA;AACT;AAEA,SAAS,aAAA,CAAc,KAAA,EAAe;AACpC,EAAA,MAAM,MAAA,EAAQ,oBAAA,CAAqB,IAAA,CAAK,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/react-xlsx/react-xlsx/packages/react-xlsx/dist/surface-regl-5Z6IVOID.cjs","sourcesContent":[null,"import { getBuiltinChartColor, getBuiltinChartSurfaceLine, resolveBuiltinChartColor } from \"./builtin-chart-styles\";\nimport createREGL from \"regl\";\nimport * as React from \"react\";\nimport { shadeSurfaceMatteColor, surfaceNormal, transformSurfaceNormal } from \"./surface-lighting\";\nimport { clipSurfaceBand, groupSurfaceBandEdges, normalizeSurfaceValue, surfaceDataRatios, triangulateSurfaceQuad } from \"./surface-geometry\";\nimport type { XlsxChart } from \"./types\";\n\ntype SurfacePalette = {\n border: string;\n mutedText: string;\n surface: string;\n text: string;\n};\n\ntype SurfaceLayout = {\n height: number;\n plot: {\n height: number;\n left: number;\n top: number;\n width: number;\n };\n width: number;\n};\n\ntype SurfaceCompositeProps = {\n background: string;\n borderColor: string;\n chart: XlsxChart;\n fontFamily: string;\n layout: SurfaceLayout;\n onDoubleClick?: React.MouseEventHandler<SVGSVGElement>;\n onPointerDown?: React.PointerEventHandler<SVGSVGElement>;\n overlay: React.ReactNode;\n palette: SurfacePalette;\n fallback: React.ReactNode;\n};\n\ntype SurfaceDomain = {\n maxValue: number;\n minValue: number;\n safeMax: number;\n ticks: number[];\n};\n\ntype SurfacePoint3D = {\n depth: number;\n worldX: number;\n worldY: number;\n worldZ: number;\n x: number;\n y: number;\n};\n\ntype SurfaceVertex = {\n bandColor: string;\n point: SurfacePoint3D;\n value: number;\n};\n\ntype SolidSurfaceTriangle = {\n color: string;\n points: [SurfacePoint3D, SurfacePoint3D, SurfacePoint3D];\n};\n\ntype SurfaceScene = {\n fillColors: Float32Array;\n fillPositions: Float32Array;\n lineColors: Float32Array;\n linePositions: Float32Array;\n wallColors: Float32Array;\n wallPositions: Float32Array;\n};\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.max(min, Math.min(max, value));\n}\n\nfunction safeNumber(value: unknown) {\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return value;\n }\n if (typeof value === \"string\") {\n const normalized = value.trim().replace(/,/g, \"\");\n if (!normalized) {\n return null;\n }\n const parsed = Number(normalized);\n return Number.isFinite(parsed) ? parsed : null;\n }\n return null;\n}\n\nfunction parseRgbColor(color: string) {\n const match = /^#?([0-9a-f]{6})$/i.exec(color);\n if (!match) {\n return null;\n }\n return {\n blue: Number.parseInt(match[1].slice(4, 6), 16),\n green: Number.parseInt(match[1].slice(2, 4), 16),\n red: Number.parseInt(match[1].slice(0, 2), 16)\n };\n}\n\nfunction mixRgbColor(color: string, mixWith: string, ratio: number) {\n const base = parseRgbColor(color);\n const target = parseRgbColor(mixWith);\n if (!base || !target) {\n return color;\n }\n const clamped = clamp(ratio, 0, 1);\n const mixChannel = (left: number, right: number) => Math.round(left + (right - left) * clamped);\n return `#${[\n mixChannel(base.red, target.red),\n mixChannel(base.green, target.green),\n mixChannel(base.blue, target.blue)\n ].map((value) => value.toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\nfunction lightenColor(color: string, ratio: number) {\n return mixRgbColor(color, \"#ffffff\", ratio);\n}\n\nfunction darkenColor(color: string, ratio: number) {\n return mixRgbColor(color, \"#000000\", ratio);\n}\n\nfunction resolveSurfaceBaseColor(chart: XlsxChart, palette: Pick<SurfacePalette, \"text\">) {\n return chart.chartColorPalette?.[0]\n ?? chart.series[0]?.color\n ?? chart.series[0]?.lineColor\n ?? chart.axisLineColor\n ?? chart.textColor\n ?? palette.text;\n}\n\nfunction normalizeSurfaceRendererHexColor(value: unknown) {\n if (typeof value !== \"string\") {\n return null;\n }\n const trimmed = value.trim();\n if (!trimmed) {\n return null;\n }\n const normalized = trimmed.startsWith(\"#\") ? trimmed.slice(1) : trimmed;\n return /^[0-9a-f]{6}$/i.test(normalized) ? `#${normalized.toLowerCase()}` : null;\n}\n\nfunction resolveExplicitSurfaceSeriesColor(chart: XlsxChart, kind: \"fill\" | \"line\") {\n const shape = chart.series[0]?.shapeProperties;\n if (kind === \"fill\" ? shape?.xmlFillHidden === true : shape?.xmlLineHidden === true) return \"transparent\";\n const color = kind === \"fill\"\n ? shape?.xmlFillColor ?? shape?.solidFillHex\n : shape?.xmlLineColor ?? shape?.lineColorHex;\n return normalizeSurfaceRendererHexColor(color);\n}\n\nfunction getSurfaceColorStops(chart: XlsxChart, palette: SurfacePalette) {\n const explicitFill = resolveExplicitSurfaceSeriesColor(chart, \"fill\");\n if (explicitFill) return [explicitFill];\n const colors = (chart.chartColorPalette ?? []).filter((value): value is string => typeof value === \"string\" && value.length > 0);\n return colors.length > 0 ? colors : [resolveSurfaceBaseColor(chart, palette)];\n}\n\nfunction getSurfaceDomain(chart: XlsxChart): SurfaceDomain | null {\n const numericValues = chart.series.flatMap((series) => (\n series.values\n .map((value) => safeNumber(value))\n .filter((value): value is number => value != null)\n ));\n if (numericValues.length === 0) {\n return null;\n }\n const explicitMin = typeof chart.valueAxis?.min === \"number\" && Number.isFinite(chart.valueAxis.min)\n ? chart.valueAxis.min\n : null;\n const explicitMax = typeof chart.valueAxis?.max === \"number\" && Number.isFinite(chart.valueAxis.max)\n ? chart.valueAxis.max\n : null;\n const rawMin = Math.min(...numericValues);\n const rawMax = Math.max(...numericValues);\n const spanBase = Math.max(1e-6, rawMax - Math.min(0, rawMin));\n const roughStep = spanBase / 5;\n const magnitude = Math.pow(10, Math.floor(Math.log10(Math.max(roughStep, 1e-6))));\n const normalized = roughStep / magnitude;\n const niceStep = normalized <= 1 ? 1 : normalized <= 2 ? 2 : normalized <= 5 ? 5 : 10;\n const step = typeof chart.valueAxis?.majorUnit === \"number\" && chart.valueAxis.majorUnit > 0\n ? chart.valueAxis.majorUnit\n : niceStep * magnitude;\n const minValue = explicitMin ?? (rawMin >= 0 ? 0 : Math.floor(rawMin / step) * step);\n const maxValue = explicitMax ?? Math.ceil(rawMax / step) * step;\n const safeMax = maxValue <= minValue ? minValue + step : maxValue;\n const ticks: number[] = [];\n for (let current = minValue; current <= safeMax + step * 0.001; current += step) {\n ticks.push(Number(current.toFixed(8)));\n }\n const boundedTicks = [...new Set([...ticks.filter((tick) => tick < safeMax), safeMax])];\n return {\n maxValue,\n minValue,\n safeMax,\n ticks: boundedTicks.length >= 2 ? boundedTicks : [minValue, safeMax]\n };\n}\n\nfunction resolveSurfaceBandPaletteColor(chart: XlsxChart, palette: SurfacePalette, domain: SurfaceDomain, value: number) {\n const bandIndex = resolveSurfaceBandIndex(domain, value);\n const explicitColor = resolveSurfaceBandFormatColor(chart, \"bandFormatColors\", bandIndex);\n if (explicitColor) return explicitColor;\n const explicitFill = resolveExplicitSurfaceSeriesColor(chart, \"fill\");\n if (explicitFill) return explicitFill;\n const themeColors = chart.raw?.builtinThemeColors as Record<number, string> | undefined;\n const paletteCount = Math.trunc((domain.safeMax - domain.minValue) / (domain.ticks[1] - domain.ticks[0])) + 1;\n const builtinColor = themeColors ? resolveBuiltinChartColor(getBuiltinChartColor(chart.chartStyleId, bandIndex % paletteCount, paletteCount), themeColors) : undefined;\n if (builtinColor) return builtinColor;\n const stops = getSurfaceColorStops(chart, palette);\n if (stops.length === 0) {\n return resolveSurfaceBaseColor(chart, palette);\n }\n return stops[Math.min(stops.length - 1, Math.max(0, bandIndex))] ?? stops[stops.length - 1] ?? resolveSurfaceBaseColor(chart, palette);\n}\n\nfunction resolveSurfaceBandIndex(domain: SurfaceDomain, value: number) {\n const ticks = domain.ticks;\n for (let index = 0; index < ticks.length - 1; index += 1) {\n const end = ticks[index + 1] ?? domain.safeMax;\n if (value <= end || index === ticks.length - 2) {\n return index;\n }\n }\n return Math.max(0, ticks.length - 2);\n}\n\nfunction resolveSurfaceBandColor(chart: XlsxChart, palette: SurfacePalette, domain: SurfaceDomain, value: number) {\n return resolveSurfaceBandPaletteColor(chart, palette, domain, value);\n}\n\nfunction resolveSurfaceBandFormatColor(chart: XlsxChart, key: \"bandFormatColors\" | \"bandFormatLineColors\", index: number) {\n const colors = chart.raw?.[key];\n if (!colors || typeof colors !== \"object\" || !Object.prototype.hasOwnProperty.call(colors, index)) return null;\n const color = (colors as Record<number, unknown>)[index];\n return typeof color === \"string\" && color.length > 0 ? color : null;\n}\n\nfunction resolveSurfaceWireframeColor(chart: XlsxChart, palette: SurfacePalette, domain: SurfaceDomain, value: number) {\n const bandIndex = resolveSurfaceBandIndex(domain, value);\n const themeColors = chart.raw?.builtinThemeColors as Record<number, string> | undefined;\n const paletteCount = Math.trunc((domain.safeMax - domain.minValue) / (domain.ticks[1] - domain.ticks[0])) + 1;\n const builtinLine = themeColors ? resolveBuiltinChartColor(getBuiltinChartSurfaceLine(chart.chartStyleId, bandIndex, paletteCount), themeColors) : undefined;\n return resolveSurfaceBandFormatColor(chart, \"bandFormatLineColors\", bandIndex)\n ?? resolveExplicitSurfaceSeriesColor(chart, \"line\")\n ?? builtinLine\n ?? resolveSurfaceBandPaletteColor(chart, palette, domain, value);\n}\n\nfunction colorToRgba(color: string, alpha = 1) {\n if (color === \"transparent\") return [0, 0, 0, 0] as const;\n const rgb = parseRgbColor(color);\n if (!rgb) {\n return [0.1, 0.1, 0.1, alpha] as const;\n }\n return [rgb.red / 255, rgb.green / 255, rgb.blue / 255, alpha] as const;\n}\n\nfunction normalizeSurfaceX(column: number, cols: number) {\n return cols <= 1 ? 0 : ((column / (cols - 1)) - 0.5) * 2;\n}\n\nfunction normalizeSurfaceY(row: number, rows: number) {\n return rows <= 1 ? 0 : ((row / (rows - 1)) - 0.5) * 2;\n}\n\nfunction normalizeSurfaceZ(value: number, domain: SurfaceDomain, heightExtent: number, axis?: XlsxChart[\"valueAxis\"]) {\n return -(normalizeSurfaceValue(value, domain.minValue, domain.safeMax, axis) - 0.5) * heightExtent;\n}\n\nfunction projectCartesian3dPoint(\n x: number,\n y: number,\n z: number,\n rotXRad: number,\n rotYRad: number,\n usePerspective: boolean,\n perspectiveStrength: number,\n rightAngleAxes: boolean\n) {\n if (rightAngleAxes) {\n return { depth: z, x: x + z * Math.sin(rotYRad), y: y - z * Math.sin(rotXRad) };\n }\n const cosX = Math.cos(rotXRad);\n const sinX = Math.sin(rotXRad);\n const cosY = Math.cos(rotYRad);\n const sinY = Math.sin(rotYRad);\n const x1 = x * cosY + z * sinY;\n const z1 = -x * sinY + z * cosY;\n const y1 = y * cosX - z1 * sinX;\n const z2 = y * sinX + z1 * cosX;\n const perspective = usePerspective\n ? 1 / Math.max(0.18, 1 + z2 * (0.24 + perspectiveStrength * 0.5))\n : 1;\n return {\n depth: z2,\n x: x1 * perspective,\n y: y1 * perspective\n };\n}\n\nfunction withProjectedDepth(point: SurfacePoint3D, depth: number): SurfacePoint3D {\n return {\n ...point,\n depth\n };\n}\n\nfunction nudgeProjectedDepth(point: SurfacePoint3D, delta: number): SurfacePoint3D {\n return {\n ...point,\n depth: point.depth + delta\n };\n}\n\nfunction isContourSurfaceChart(chart: XlsxChart) {\n const rawChartType = chart.raw && typeof chart.raw === \"object\" && typeof chart.raw.xmlChartType === \"string\"\n ? chart.raw.xmlChartType\n : \"\";\n if (rawChartType === \"surfaceChart\") {\n return true;\n }\n if (rawChartType === \"surface3DChart\") {\n return false;\n }\n return chart.chartType === \"Surface\" && chart.is3d !== true;\n}\n\nfunction buildSurfaceMesh(chart: XlsxChart, palette: SurfacePalette, layout: SurfaceLayout): SurfaceScene | null {\n const rows = chart.series.length;\n const cols = chart.series.reduce((max, series) => Math.max(max, series.values.length), 0);\n if (rows < 2 || cols < 2) {\n return null;\n }\n const matrix = chart.series.map((series) => (\n Array.from({ length: cols }, (_, columnIndex) => safeNumber(series.values[columnIndex]))\n ));\n const domain = getSurfaceDomain(chart);\n if (!domain) {\n return null;\n }\n const isContour = isContourSurfaceChart(chart);\n const isWireframe = chart.wireframe === true;\n const fillVertices: SurfaceVertex[] = [];\n const wallTriangles: SolidSurfaceTriangle[] = [];\n const contourLines: Array<{ color: string; from: SurfacePoint3D; to: SurfacePoint3D }> = [];\n const meshLines: Array<{ color: string; from: SurfacePoint3D; to: SurfacePoint3D }> = [];\n const rotX = (chart.view3d?.rotX ?? 25) * (Math.PI / 180);\n const rotY = (chart.view3d?.rotY ?? 30) * (Math.PI / 180);\n const usePerspective = !isContour && chart.view3d?.rAngAx === false;\n const perspectiveStrength = clamp((chart.view3d?.perspective ?? (usePerspective ? 30 : 0)) / 100, 0, 1);\n const ratios = surfaceDataRatios(rows, cols, chart.valueAxis?.crossBetween !== \"midCat\", chart.view3d?.heightPercent, chart.view3d?.depthPercent, layout);\n const depthScale = ratios.depth;\n const heightExtent = 2 * ratios.height;\n const usesFlatMaterial = chart.surfaceMaterial === \"flat\";\n const wallLineColor = chart.valueAxis?.majorGridlineColor ?? chart.backWall?.lineColor ?? chart.sideWall?.lineColor ?? chart.floor?.lineColor ?? chart.axisLineColor ?? \"#a6a6a6\";\n const backWallFill = chart.backWall?.fillColor ?? \"#d9d9df\";\n const sideWallFill = chart.sideWall?.fillColor ?? \"#d5d7dc\";\n const floorFill = chart.floor?.fillColor ?? \"#d0d2d8\";\n const projectPoint = (column: number, row: number, value: number): SurfacePoint3D => {\n const worldX = normalizeSurfaceX(column, cols);\n if (isContour) {\n return {\n depth: 0,\n worldX,\n worldY: normalizeSurfaceY(row, rows),\n worldZ: 0,\n x: worldX,\n y: normalizeSurfaceY(row, rows)\n };\n }\n const worldY = normalizeSurfaceZ(value, domain, heightExtent, chart.valueAxis);\n const worldZ = normalizeSurfaceY(row, rows) * depthScale;\n const projected = projectCartesian3dPoint(worldX, worldY, worldZ, rotX, rotY, usePerspective, perspectiveStrength, chart.view3d?.rAngAx !== false);\n return {\n depth: projected.depth,\n worldX,\n worldY,\n worldZ,\n x: projected.x,\n y: projected.y\n };\n };\n const addWallQuad = (a: SurfacePoint3D, b: SurfacePoint3D, c: SurfacePoint3D, d: SurfacePoint3D, color: string) => {\n wallTriangles.push(\n { color, points: [a, b, c] },\n { color, points: [a, c, d] }\n );\n };\n const addMeshLine = (from: SurfacePoint3D, to: SurfacePoint3D, color: string) => {\n meshLines.push({ color, from, to });\n };\n\n for (let rowIndex = 0; rowIndex < rows - 1; rowIndex += 1) {\n for (let columnIndex = 0; columnIndex < cols - 1; columnIndex += 1) {\n const p00 = matrix[rowIndex]?.[columnIndex];\n const p10 = matrix[rowIndex]?.[columnIndex + 1];\n const p01 = matrix[rowIndex + 1]?.[columnIndex];\n const p11 = matrix[rowIndex + 1]?.[columnIndex + 1];\n if (p00 == null || p10 == null || p01 == null || p11 == null) {\n continue;\n }\n const triangles = triangulateSurfaceQuad([\n { value: p00, x: columnIndex, y: rowIndex },\n { value: p10, x: columnIndex + 1, y: rowIndex },\n { value: p11, x: columnIndex + 1, y: rowIndex + 1 },\n { value: p01, x: columnIndex, y: rowIndex + 1 }\n ], chart.valueAxis);\n for (const triangle of triangles) {\n for (let band = 0; band < domain.ticks.length - 1; band += 1) {\n const lower = domain.ticks[band];\n const upper = domain.ticks[band + 1];\n const polygon = clipSurfaceBand(clipSurfaceBand(triangle, lower, true, chart.valueAxis, band === 0), upper, false, chart.valueAxis);\n if (polygon.length < 3) continue;\n const bandColor = resolveSurfaceBandColor(chart, palette, domain, (lower + upper) / 2);\n if (!isWireframe && bandColor !== \"transparent\") {\n for (let index = 1; index < polygon.length - 1; index += 1) {\n for (const vertex of [polygon[0], polygon[index], polygon[index + 1]]) {\n const point = projectPoint(vertex.x, vertex.y, vertex.value);\n fillVertices.push({ bandColor, point: isContour ? withProjectedDepth(point, 0.08) : point, value: vertex.value });\n }\n }\n }\n for (const group of groupSurfaceBandEdges(polygon, triangle, band, lower, isWireframe)) {\n const edgeMidpoint = (domain.ticks[group.band] + domain.ticks[group.band + 1]) / 2;\n const color = resolveSurfaceWireframeColor(chart, palette, domain, edgeMidpoint);\n if (color !== \"transparent\") {\n for (const [from, to] of group.edges) {\n contourLines.push({ color, from: projectPoint(from.x, from.y, from.value), to: projectPoint(to.x, to.y, to.value) });\n }\n }\n }\n }\n }\n }\n }\n\n const columnSkip = Math.max(1, chart.categoryAxis?.tickMarkSkip ?? 1);\n const rowSkip = Math.max(1, chart.seriesAxis?.tickMarkSkip ?? 1);\n if (isContour) {\n const topLeft = withProjectedDepth(projectPoint(0, 0, domain.minValue), -0.12);\n const topRight = withProjectedDepth(projectPoint(cols - 1, 0, domain.minValue), -0.12);\n const bottomRight = withProjectedDepth(projectPoint(cols - 1, rows - 1, domain.minValue), -0.12);\n const bottomLeft = withProjectedDepth(projectPoint(0, rows - 1, domain.minValue), -0.12);\n if (chart.backWall?.hidden !== true && backWallFill !== \"transparent\") {\n addWallQuad(topLeft, topRight, bottomRight, bottomLeft, backWallFill);\n }\n for (let columnIndex = 0; columnIndex < cols; columnIndex += columnSkip) {\n addMeshLine(\n withProjectedDepth(projectPoint(columnIndex, 0, domain.minValue), 0.04),\n withProjectedDepth(projectPoint(columnIndex, rows - 1, domain.minValue), 0.04),\n wallLineColor\n );\n }\n for (let rowIndex = 0; rowIndex < rows; rowIndex += rowSkip) {\n addMeshLine(\n withProjectedDepth(projectPoint(0, rowIndex, domain.minValue), 0.04),\n withProjectedDepth(projectPoint(cols - 1, rowIndex, domain.minValue), 0.04),\n wallLineColor\n );\n }\n } else {\n const minPlaneValue = domain.minValue;\n const wallDepthOffset = 0;\n const backRow = chart.view3d?.rAngAx !== false || Math.cos(rotX) * Math.cos(rotY) >= 0 ? rows - 1 : 0;\n const sideColumn = Math.sin(rotY) >= 0 ? 0 : cols - 1;\n if (chart.floor?.hidden !== true && floorFill !== \"transparent\") {\n addWallQuad(\n nudgeProjectedDepth(projectPoint(0, 0, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(cols - 1, 0, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(cols - 1, rows - 1, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(0, rows - 1, minPlaneValue), wallDepthOffset),\n floorFill\n );\n }\n if (chart.backWall?.hidden !== true && backWallFill !== \"transparent\") {\n addWallQuad(\n nudgeProjectedDepth(projectPoint(0, backRow, domain.safeMax), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(cols - 1, backRow, domain.safeMax), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(cols - 1, backRow, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(0, backRow, minPlaneValue), wallDepthOffset),\n backWallFill\n );\n }\n if (chart.sideWall?.hidden !== true && sideWallFill !== \"transparent\") {\n addWallQuad(\n nudgeProjectedDepth(projectPoint(sideColumn, 0, domain.safeMax), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(sideColumn, rows - 1, domain.safeMax), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(sideColumn, rows - 1, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(sideColumn, 0, minPlaneValue), wallDepthOffset),\n sideWallFill\n );\n }\n for (const tick of chart.valueAxis?.majorGridlines ? domain.ticks : []) {\n if (chart.backWall?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(0, backRow, tick), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(cols - 1, backRow, tick), wallDepthOffset * 0.75), wallLineColor);\n }\n if (chart.sideWall?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(sideColumn, 0, tick), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(sideColumn, rows - 1, tick), wallDepthOffset * 0.75), wallLineColor);\n }\n }\n for (let columnIndex = 0; chart.categoryAxis?.majorGridlines && columnIndex < cols; columnIndex += columnSkip) {\n if (chart.floor?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(columnIndex, 0, minPlaneValue), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(columnIndex, rows - 1, minPlaneValue), wallDepthOffset * 0.75), wallLineColor);\n }\n if (chart.backWall?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(columnIndex, backRow, minPlaneValue), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(columnIndex, backRow, domain.safeMax), wallDepthOffset * 0.75), wallLineColor);\n }\n }\n for (let rowIndex = 0; chart.seriesAxis?.majorGridlines && rowIndex < rows; rowIndex += rowSkip) {\n if (chart.floor?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(0, rowIndex, minPlaneValue), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(cols - 1, rowIndex, minPlaneValue), wallDepthOffset * 0.75), wallLineColor);\n }\n if (chart.sideWall?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(sideColumn, rowIndex, minPlaneValue), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(sideColumn, rowIndex, domain.safeMax), wallDepthOffset * 0.75), wallLineColor);\n }\n }\n }\n\n const allPoints = [\n ...fillVertices.map((vertex) => vertex.point),\n ...wallTriangles.flatMap((triangle) => triangle.points),\n ...meshLines.flatMap((line) => [line.from, line.to]),\n ...contourLines.flatMap((line) => [line.from, line.to])\n ];\n if (allPoints.length === 0) {\n return null;\n }\n\n const minX = Math.min(...allPoints.map((point) => point.x));\n const maxX = Math.max(...allPoints.map((point) => point.x));\n const minY = Math.min(...allPoints.map((point) => point.y));\n const maxY = Math.max(...allPoints.map((point) => point.y));\n const minDepth = Math.min(...allPoints.map((point) => point.depth));\n const maxDepth = Math.max(...allPoints.map((point) => point.depth));\n const scale = Math.min(\n layout.plot.width / Math.max(0.25, maxX - minX),\n layout.plot.height / Math.max(0.25, maxY - minY)\n );\n const centerX = layout.plot.left + layout.plot.width / 2;\n const centerY = layout.plot.top + layout.plot.height / 2;\n const centerRawX = (minX + maxX) / 2;\n const centerRawY = (minY + maxY) / 2;\n const toScreenX = (x: number) => centerX + (x - centerRawX) * scale;\n const toScreenY = (y: number) => centerY + (y - centerRawY) * scale;\n const toClipPoint = (point: SurfacePoint3D) => {\n const screenX = toScreenX(point.x);\n const screenY = toScreenY(point.y);\n return {\n x: (screenX / layout.width) * 2 - 1,\n y: 1 - (screenY / layout.height) * 2,\n z: clamp(((point.depth - minDepth) / Math.max(1e-6, maxDepth - minDepth)) * 2 - 1, -1, 1)\n };\n };\n\n const fillPositions: number[] = [];\n const fillColors: number[] = [];\n const wallPositions: number[] = [];\n const wallColors: number[] = [];\n for (const triangle of wallTriangles) {\n const world = triangle.points.map(point => ({ x: point.worldX, y: point.worldY, z: -point.worldZ }));\n const normal = transformSurfaceNormal(surfaceNormal(world[0], world[1], world[2]), chart.view3d?.rotX ?? 25, chart.view3d?.rotY ?? 30, chart.view3d?.rAngAx !== false);\n const rgba = colorToRgba(usesFlatMaterial ? triangle.color : shadeSurfaceMatteColor(triangle.color, normal), 1);\n for (const point of triangle.points) {\n const clip = toClipPoint(point);\n wallPositions.push(clip.x, clip.y, clip.z);\n wallColors.push(rgba[0], rgba[1], rgba[2], rgba[3]);\n }\n }\n for (let index = 0; index < fillVertices.length; index += 3) {\n const left = fillVertices[index];\n const middle = fillVertices[index + 1];\n const right = fillVertices[index + 2];\n if (!left || !middle || !right) {\n continue;\n }\n const world = [left, middle, right].map(vertex => ({ x: vertex.point.worldX, y: vertex.point.worldY, z: -vertex.point.worldZ }));\n const normal = transformSurfaceNormal(surfaceNormal(world[0], world[1], world[2]), chart.view3d?.rotX ?? 25, chart.view3d?.rotY ?? 30, chart.view3d?.rAngAx !== false);\n const shaded = colorToRgba(usesFlatMaterial ? left.bandColor : shadeSurfaceMatteColor(left.bandColor, normal), 1);\n [left, middle, right].forEach((vertex) => {\n const clip = toClipPoint(vertex.point);\n fillPositions.push(clip.x, clip.y, clip.z);\n fillColors.push(shaded[0], shaded[1], shaded[2], shaded[3]);\n });\n }\n\n const linePositions: number[] = [];\n const lineColors: number[] = [];\n meshLines.forEach((line) => {\n const from = toClipPoint(line.from);\n const to = toClipPoint(line.to);\n const rgba = colorToRgba(line.color, 1);\n linePositions.push(from.x, from.y, from.z - 0.00001, to.x, to.y, to.z - 0.00001);\n lineColors.push(rgba[0], rgba[1], rgba[2], rgba[3], rgba[0], rgba[1], rgba[2], rgba[3]);\n });\n contourLines.forEach((line) => {\n const from = toClipPoint(line.from);\n const to = toClipPoint(line.to);\n const rgba = colorToRgba(line.color, 1);\n linePositions.push(from.x, from.y, from.z - 0.00001, to.x, to.y, to.z - 0.00001);\n lineColors.push(rgba[0], rgba[1], rgba[2], rgba[3], rgba[0], rgba[1], rgba[2], rgba[3]);\n });\n\n return {\n fillColors: new Float32Array(fillColors),\n fillPositions: new Float32Array(fillPositions),\n lineColors: new Float32Array(lineColors),\n linePositions: new Float32Array(linePositions),\n wallColors: new Float32Array(wallColors),\n wallPositions: new Float32Array(wallPositions)\n };\n}\n\nexport const MemoSurfaceChartComposite = React.memo(function MemoSurfaceChartComposite({\n background,\n borderColor,\n chart,\n fontFamily,\n layout,\n onDoubleClick,\n onPointerDown,\n overlay,\n palette,\n fallback\n}: SurfaceCompositeProps) {\n const canvasRef = React.useRef<HTMLCanvasElement | null>(null);\n const [ready, setReady] = React.useState(false);\n const [failed, setFailed] = React.useState(false);\n const isContour = isContourSurfaceChart(chart);\n\n React.useEffect(() => {\n if (isContour) {\n setReady(false);\n setFailed(false);\n return;\n }\n const canvas = canvasRef.current;\n if (!canvas) {\n return;\n }\n let cancelled = false;\n let reglInstance: ReturnType<typeof createREGL> | null = null;\n\n const drawSurface = () => {\n try {\n const scene = buildSurfaceMesh(chart, palette, layout);\n if (!scene) {\n if (!cancelled) {\n setFailed(true);\n setReady(false);\n }\n return;\n }\n const dpr = window.devicePixelRatio || 1;\n canvas.width = Math.max(1, Math.round(layout.width * dpr));\n canvas.height = Math.max(1, Math.round(layout.height * dpr));\n reglInstance = createREGL({\n attributes: {\n alpha: true,\n antialias: true,\n depth: true,\n premultipliedAlpha: true\n },\n canvas\n });\n const fillCommand = scene.fillPositions.length > 0\n ? reglInstance({\n attributes: {\n color: scene.fillColors,\n position: scene.fillPositions\n },\n blend: {\n enable: true,\n func: {\n dstRGB: \"one minus src alpha\",\n dstAlpha: \"one minus src alpha\",\n srcRGB: \"src alpha\",\n srcAlpha: \"src alpha\"\n }\n },\n count: scene.fillPositions.length / 3,\n depth: {\n enable: true\n },\n frag: `\n precision mediump float;\n varying vec4 vColor;\n void main() {\n gl_FragColor = vColor;\n }\n `,\n primitive: \"triangles\",\n vert: `\n precision mediump float;\n attribute vec3 position;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(position, 1.0);\n vColor = color;\n }\n `\n })\n : null;\n const wallCommand = scene.wallPositions.length > 0\n ? reglInstance({\n attributes: {\n color: scene.wallColors,\n position: scene.wallPositions\n },\n blend: {\n enable: true,\n func: {\n dstRGB: \"one minus src alpha\",\n dstAlpha: \"one minus src alpha\",\n srcRGB: \"src alpha\",\n srcAlpha: \"src alpha\"\n }\n },\n count: scene.wallPositions.length / 3,\n depth: {\n enable: true,\n func: \"lequal\"\n },\n frag: `\n precision mediump float;\n varying vec4 vColor;\n void main() {\n gl_FragColor = vColor;\n }\n `,\n primitive: \"triangles\",\n vert: `\n precision mediump float;\n attribute vec3 position;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(position, 1.0);\n vColor = color;\n }\n `\n })\n : null;\n const lineCommand = scene.linePositions.length > 0\n ? reglInstance({\n attributes: {\n color: scene.lineColors,\n position: scene.linePositions\n },\n blend: {\n enable: true,\n func: {\n dstRGB: \"one minus src alpha\",\n dstAlpha: \"one minus src alpha\",\n srcRGB: \"src alpha\",\n srcAlpha: \"src alpha\"\n }\n },\n count: scene.linePositions.length / 3,\n depth: {\n enable: true,\n func: \"lequal\"\n },\n frag: `\n precision mediump float;\n varying vec4 vColor;\n void main() {\n gl_FragColor = vColor;\n }\n `,\n lineWidth: 1,\n primitive: \"lines\",\n vert: `\n precision mediump float;\n attribute vec3 position;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(position, 1.0);\n vColor = color;\n }\n `\n })\n : null;\n\n reglInstance.clear({ color: [0, 0, 0, 0], depth: 1 });\n wallCommand?.();\n fillCommand?.();\n lineCommand?.();\n if (!cancelled) {\n setReady(true);\n setFailed(false);\n }\n } catch {\n if (!cancelled) {\n setReady(false);\n setFailed(true);\n }\n }\n };\n\n setReady(false);\n setFailed(false);\n drawSurface();\n\n return () => {\n cancelled = true;\n reglInstance?.destroy();\n };\n }, [\n chart,\n isContour,\n layout,\n palette\n ]);\n\n const shouldRenderFallback = isContour || failed || !ready;\n\n return (\n <div\n aria-label={chart.title ?? chart.name ?? \"Chart\"}\n role=\"img\"\n style={{\n background,\n border: borderColor.trim().toLowerCase() === \"transparent\" ? \"none\" : `1px solid ${borderColor}`,\n boxSizing: \"border-box\",\n fontFamily,\n height: \"100%\",\n overflow: \"hidden\",\n pointerEvents: \"auto\",\n position: \"relative\",\n width: \"100%\"\n }}\n >\n <canvas\n ref={canvasRef}\n style={{\n display: shouldRenderFallback ? \"none\" : \"block\",\n height: \"100%\",\n inset: 0,\n position: \"absolute\",\n width: \"100%\"\n }}\n />\n <svg\n onDoubleClick={onDoubleClick}\n onPointerDown={onPointerDown}\n style={{ display: \"block\", height: \"100%\", inset: 0, position: \"absolute\", width: \"100%\" }}\n viewBox={`0 0 ${layout.width} ${layout.height}`}\n >\n {shouldRenderFallback ? fallback : null}\n {overlay}\n </svg>\n </div>\n );\n}, (prev, next) => (\n prev.chart === next.chart\n && prev.palette === next.palette\n && prev.background === next.background\n && prev.borderColor === next.borderColor\n && prev.fontFamily === next.fontFamily\n && prev.onDoubleClick === next.onDoubleClick\n && prev.onPointerDown === next.onPointerDown\n && prev.layout.width === next.layout.width\n && prev.layout.height === next.layout.height\n && prev.layout.plot.left === next.layout.plot.left\n && prev.layout.plot.top === next.layout.plot.top\n && prev.layout.plot.width === next.layout.plot.width\n && prev.layout.plot.height === next.layout.plot.height\n && prev.overlay === next.overlay\n && prev.fallback === next.fallback\n));\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clipSurfaceBand,
|
|
3
|
+
groupSurfaceBandEdges,
|
|
3
4
|
normalizeSurfaceValue,
|
|
4
5
|
shadeSurfaceMatteColor,
|
|
5
|
-
surfaceBandEdges,
|
|
6
6
|
surfaceDataRatios,
|
|
7
7
|
surfaceNormal,
|
|
8
8
|
transformSurfaceNormal,
|
|
9
9
|
triangulateSurfaceQuad
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VXBNYHW5.js";
|
|
11
11
|
import {
|
|
12
12
|
getBuiltinChartColor,
|
|
13
13
|
getBuiltinChartSurfaceLine,
|
|
@@ -294,10 +294,13 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
for (const group of groupSurfaceBandEdges(polygon, triangle, band, lower, isWireframe)) {
|
|
298
|
+
const edgeMidpoint = (domain.ticks[group.band] + domain.ticks[group.band + 1]) / 2;
|
|
299
|
+
const color = resolveSurfaceWireframeColor(chart, palette, domain, edgeMidpoint);
|
|
300
|
+
if (color !== "transparent") {
|
|
301
|
+
for (const [from, to] of group.edges) {
|
|
302
|
+
contourLines.push({ color, from: projectPoint(from.x, from.y, from.value), to: projectPoint(to.x, to.y, to.value) });
|
|
303
|
+
}
|
|
301
304
|
}
|
|
302
305
|
}
|
|
303
306
|
}
|
|
@@ -717,4 +720,4 @@ var MemoSurfaceChartComposite = React.memo(function MemoSurfaceChartComposite2({
|
|
|
717
720
|
export {
|
|
718
721
|
MemoSurfaceChartComposite
|
|
719
722
|
};
|
|
720
|
-
//# sourceMappingURL=surface-regl-
|
|
723
|
+
//# sourceMappingURL=surface-regl-7CDGGVDG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/surface-regl.tsx"],"sourcesContent":["import { getBuiltinChartColor, getBuiltinChartSurfaceLine, resolveBuiltinChartColor } from \"./builtin-chart-styles\";\nimport createREGL from \"regl\";\nimport * as React from \"react\";\nimport { shadeSurfaceMatteColor, surfaceNormal, transformSurfaceNormal } from \"./surface-lighting\";\nimport { clipSurfaceBand, groupSurfaceBandEdges, normalizeSurfaceValue, surfaceDataRatios, triangulateSurfaceQuad } from \"./surface-geometry\";\nimport type { XlsxChart } from \"./types\";\n\ntype SurfacePalette = {\n border: string;\n mutedText: string;\n surface: string;\n text: string;\n};\n\ntype SurfaceLayout = {\n height: number;\n plot: {\n height: number;\n left: number;\n top: number;\n width: number;\n };\n width: number;\n};\n\ntype SurfaceCompositeProps = {\n background: string;\n borderColor: string;\n chart: XlsxChart;\n fontFamily: string;\n layout: SurfaceLayout;\n onDoubleClick?: React.MouseEventHandler<SVGSVGElement>;\n onPointerDown?: React.PointerEventHandler<SVGSVGElement>;\n overlay: React.ReactNode;\n palette: SurfacePalette;\n fallback: React.ReactNode;\n};\n\ntype SurfaceDomain = {\n maxValue: number;\n minValue: number;\n safeMax: number;\n ticks: number[];\n};\n\ntype SurfacePoint3D = {\n depth: number;\n worldX: number;\n worldY: number;\n worldZ: number;\n x: number;\n y: number;\n};\n\ntype SurfaceVertex = {\n bandColor: string;\n point: SurfacePoint3D;\n value: number;\n};\n\ntype SolidSurfaceTriangle = {\n color: string;\n points: [SurfacePoint3D, SurfacePoint3D, SurfacePoint3D];\n};\n\ntype SurfaceScene = {\n fillColors: Float32Array;\n fillPositions: Float32Array;\n lineColors: Float32Array;\n linePositions: Float32Array;\n wallColors: Float32Array;\n wallPositions: Float32Array;\n};\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.max(min, Math.min(max, value));\n}\n\nfunction safeNumber(value: unknown) {\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return value;\n }\n if (typeof value === \"string\") {\n const normalized = value.trim().replace(/,/g, \"\");\n if (!normalized) {\n return null;\n }\n const parsed = Number(normalized);\n return Number.isFinite(parsed) ? parsed : null;\n }\n return null;\n}\n\nfunction parseRgbColor(color: string) {\n const match = /^#?([0-9a-f]{6})$/i.exec(color);\n if (!match) {\n return null;\n }\n return {\n blue: Number.parseInt(match[1].slice(4, 6), 16),\n green: Number.parseInt(match[1].slice(2, 4), 16),\n red: Number.parseInt(match[1].slice(0, 2), 16)\n };\n}\n\nfunction mixRgbColor(color: string, mixWith: string, ratio: number) {\n const base = parseRgbColor(color);\n const target = parseRgbColor(mixWith);\n if (!base || !target) {\n return color;\n }\n const clamped = clamp(ratio, 0, 1);\n const mixChannel = (left: number, right: number) => Math.round(left + (right - left) * clamped);\n return `#${[\n mixChannel(base.red, target.red),\n mixChannel(base.green, target.green),\n mixChannel(base.blue, target.blue)\n ].map((value) => value.toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\nfunction lightenColor(color: string, ratio: number) {\n return mixRgbColor(color, \"#ffffff\", ratio);\n}\n\nfunction darkenColor(color: string, ratio: number) {\n return mixRgbColor(color, \"#000000\", ratio);\n}\n\nfunction resolveSurfaceBaseColor(chart: XlsxChart, palette: Pick<SurfacePalette, \"text\">) {\n return chart.chartColorPalette?.[0]\n ?? chart.series[0]?.color\n ?? chart.series[0]?.lineColor\n ?? chart.axisLineColor\n ?? chart.textColor\n ?? palette.text;\n}\n\nfunction normalizeSurfaceRendererHexColor(value: unknown) {\n if (typeof value !== \"string\") {\n return null;\n }\n const trimmed = value.trim();\n if (!trimmed) {\n return null;\n }\n const normalized = trimmed.startsWith(\"#\") ? trimmed.slice(1) : trimmed;\n return /^[0-9a-f]{6}$/i.test(normalized) ? `#${normalized.toLowerCase()}` : null;\n}\n\nfunction resolveExplicitSurfaceSeriesColor(chart: XlsxChart, kind: \"fill\" | \"line\") {\n const shape = chart.series[0]?.shapeProperties;\n if (kind === \"fill\" ? shape?.xmlFillHidden === true : shape?.xmlLineHidden === true) return \"transparent\";\n const color = kind === \"fill\"\n ? shape?.xmlFillColor ?? shape?.solidFillHex\n : shape?.xmlLineColor ?? shape?.lineColorHex;\n return normalizeSurfaceRendererHexColor(color);\n}\n\nfunction getSurfaceColorStops(chart: XlsxChart, palette: SurfacePalette) {\n const explicitFill = resolveExplicitSurfaceSeriesColor(chart, \"fill\");\n if (explicitFill) return [explicitFill];\n const colors = (chart.chartColorPalette ?? []).filter((value): value is string => typeof value === \"string\" && value.length > 0);\n return colors.length > 0 ? colors : [resolveSurfaceBaseColor(chart, palette)];\n}\n\nfunction getSurfaceDomain(chart: XlsxChart): SurfaceDomain | null {\n const numericValues = chart.series.flatMap((series) => (\n series.values\n .map((value) => safeNumber(value))\n .filter((value): value is number => value != null)\n ));\n if (numericValues.length === 0) {\n return null;\n }\n const explicitMin = typeof chart.valueAxis?.min === \"number\" && Number.isFinite(chart.valueAxis.min)\n ? chart.valueAxis.min\n : null;\n const explicitMax = typeof chart.valueAxis?.max === \"number\" && Number.isFinite(chart.valueAxis.max)\n ? chart.valueAxis.max\n : null;\n const rawMin = Math.min(...numericValues);\n const rawMax = Math.max(...numericValues);\n const spanBase = Math.max(1e-6, rawMax - Math.min(0, rawMin));\n const roughStep = spanBase / 5;\n const magnitude = Math.pow(10, Math.floor(Math.log10(Math.max(roughStep, 1e-6))));\n const normalized = roughStep / magnitude;\n const niceStep = normalized <= 1 ? 1 : normalized <= 2 ? 2 : normalized <= 5 ? 5 : 10;\n const step = typeof chart.valueAxis?.majorUnit === \"number\" && chart.valueAxis.majorUnit > 0\n ? chart.valueAxis.majorUnit\n : niceStep * magnitude;\n const minValue = explicitMin ?? (rawMin >= 0 ? 0 : Math.floor(rawMin / step) * step);\n const maxValue = explicitMax ?? Math.ceil(rawMax / step) * step;\n const safeMax = maxValue <= minValue ? minValue + step : maxValue;\n const ticks: number[] = [];\n for (let current = minValue; current <= safeMax + step * 0.001; current += step) {\n ticks.push(Number(current.toFixed(8)));\n }\n const boundedTicks = [...new Set([...ticks.filter((tick) => tick < safeMax), safeMax])];\n return {\n maxValue,\n minValue,\n safeMax,\n ticks: boundedTicks.length >= 2 ? boundedTicks : [minValue, safeMax]\n };\n}\n\nfunction resolveSurfaceBandPaletteColor(chart: XlsxChart, palette: SurfacePalette, domain: SurfaceDomain, value: number) {\n const bandIndex = resolveSurfaceBandIndex(domain, value);\n const explicitColor = resolveSurfaceBandFormatColor(chart, \"bandFormatColors\", bandIndex);\n if (explicitColor) return explicitColor;\n const explicitFill = resolveExplicitSurfaceSeriesColor(chart, \"fill\");\n if (explicitFill) return explicitFill;\n const themeColors = chart.raw?.builtinThemeColors as Record<number, string> | undefined;\n const paletteCount = Math.trunc((domain.safeMax - domain.minValue) / (domain.ticks[1] - domain.ticks[0])) + 1;\n const builtinColor = themeColors ? resolveBuiltinChartColor(getBuiltinChartColor(chart.chartStyleId, bandIndex % paletteCount, paletteCount), themeColors) : undefined;\n if (builtinColor) return builtinColor;\n const stops = getSurfaceColorStops(chart, palette);\n if (stops.length === 0) {\n return resolveSurfaceBaseColor(chart, palette);\n }\n return stops[Math.min(stops.length - 1, Math.max(0, bandIndex))] ?? stops[stops.length - 1] ?? resolveSurfaceBaseColor(chart, palette);\n}\n\nfunction resolveSurfaceBandIndex(domain: SurfaceDomain, value: number) {\n const ticks = domain.ticks;\n for (let index = 0; index < ticks.length - 1; index += 1) {\n const end = ticks[index + 1] ?? domain.safeMax;\n if (value <= end || index === ticks.length - 2) {\n return index;\n }\n }\n return Math.max(0, ticks.length - 2);\n}\n\nfunction resolveSurfaceBandColor(chart: XlsxChart, palette: SurfacePalette, domain: SurfaceDomain, value: number) {\n return resolveSurfaceBandPaletteColor(chart, palette, domain, value);\n}\n\nfunction resolveSurfaceBandFormatColor(chart: XlsxChart, key: \"bandFormatColors\" | \"bandFormatLineColors\", index: number) {\n const colors = chart.raw?.[key];\n if (!colors || typeof colors !== \"object\" || !Object.prototype.hasOwnProperty.call(colors, index)) return null;\n const color = (colors as Record<number, unknown>)[index];\n return typeof color === \"string\" && color.length > 0 ? color : null;\n}\n\nfunction resolveSurfaceWireframeColor(chart: XlsxChart, palette: SurfacePalette, domain: SurfaceDomain, value: number) {\n const bandIndex = resolveSurfaceBandIndex(domain, value);\n const themeColors = chart.raw?.builtinThemeColors as Record<number, string> | undefined;\n const paletteCount = Math.trunc((domain.safeMax - domain.minValue) / (domain.ticks[1] - domain.ticks[0])) + 1;\n const builtinLine = themeColors ? resolveBuiltinChartColor(getBuiltinChartSurfaceLine(chart.chartStyleId, bandIndex, paletteCount), themeColors) : undefined;\n return resolveSurfaceBandFormatColor(chart, \"bandFormatLineColors\", bandIndex)\n ?? resolveExplicitSurfaceSeriesColor(chart, \"line\")\n ?? builtinLine\n ?? resolveSurfaceBandPaletteColor(chart, palette, domain, value);\n}\n\nfunction colorToRgba(color: string, alpha = 1) {\n if (color === \"transparent\") return [0, 0, 0, 0] as const;\n const rgb = parseRgbColor(color);\n if (!rgb) {\n return [0.1, 0.1, 0.1, alpha] as const;\n }\n return [rgb.red / 255, rgb.green / 255, rgb.blue / 255, alpha] as const;\n}\n\nfunction normalizeSurfaceX(column: number, cols: number) {\n return cols <= 1 ? 0 : ((column / (cols - 1)) - 0.5) * 2;\n}\n\nfunction normalizeSurfaceY(row: number, rows: number) {\n return rows <= 1 ? 0 : ((row / (rows - 1)) - 0.5) * 2;\n}\n\nfunction normalizeSurfaceZ(value: number, domain: SurfaceDomain, heightExtent: number, axis?: XlsxChart[\"valueAxis\"]) {\n return -(normalizeSurfaceValue(value, domain.minValue, domain.safeMax, axis) - 0.5) * heightExtent;\n}\n\nfunction projectCartesian3dPoint(\n x: number,\n y: number,\n z: number,\n rotXRad: number,\n rotYRad: number,\n usePerspective: boolean,\n perspectiveStrength: number,\n rightAngleAxes: boolean\n) {\n if (rightAngleAxes) {\n return { depth: z, x: x + z * Math.sin(rotYRad), y: y - z * Math.sin(rotXRad) };\n }\n const cosX = Math.cos(rotXRad);\n const sinX = Math.sin(rotXRad);\n const cosY = Math.cos(rotYRad);\n const sinY = Math.sin(rotYRad);\n const x1 = x * cosY + z * sinY;\n const z1 = -x * sinY + z * cosY;\n const y1 = y * cosX - z1 * sinX;\n const z2 = y * sinX + z1 * cosX;\n const perspective = usePerspective\n ? 1 / Math.max(0.18, 1 + z2 * (0.24 + perspectiveStrength * 0.5))\n : 1;\n return {\n depth: z2,\n x: x1 * perspective,\n y: y1 * perspective\n };\n}\n\nfunction withProjectedDepth(point: SurfacePoint3D, depth: number): SurfacePoint3D {\n return {\n ...point,\n depth\n };\n}\n\nfunction nudgeProjectedDepth(point: SurfacePoint3D, delta: number): SurfacePoint3D {\n return {\n ...point,\n depth: point.depth + delta\n };\n}\n\nfunction isContourSurfaceChart(chart: XlsxChart) {\n const rawChartType = chart.raw && typeof chart.raw === \"object\" && typeof chart.raw.xmlChartType === \"string\"\n ? chart.raw.xmlChartType\n : \"\";\n if (rawChartType === \"surfaceChart\") {\n return true;\n }\n if (rawChartType === \"surface3DChart\") {\n return false;\n }\n return chart.chartType === \"Surface\" && chart.is3d !== true;\n}\n\nfunction buildSurfaceMesh(chart: XlsxChart, palette: SurfacePalette, layout: SurfaceLayout): SurfaceScene | null {\n const rows = chart.series.length;\n const cols = chart.series.reduce((max, series) => Math.max(max, series.values.length), 0);\n if (rows < 2 || cols < 2) {\n return null;\n }\n const matrix = chart.series.map((series) => (\n Array.from({ length: cols }, (_, columnIndex) => safeNumber(series.values[columnIndex]))\n ));\n const domain = getSurfaceDomain(chart);\n if (!domain) {\n return null;\n }\n const isContour = isContourSurfaceChart(chart);\n const isWireframe = chart.wireframe === true;\n const fillVertices: SurfaceVertex[] = [];\n const wallTriangles: SolidSurfaceTriangle[] = [];\n const contourLines: Array<{ color: string; from: SurfacePoint3D; to: SurfacePoint3D }> = [];\n const meshLines: Array<{ color: string; from: SurfacePoint3D; to: SurfacePoint3D }> = [];\n const rotX = (chart.view3d?.rotX ?? 25) * (Math.PI / 180);\n const rotY = (chart.view3d?.rotY ?? 30) * (Math.PI / 180);\n const usePerspective = !isContour && chart.view3d?.rAngAx === false;\n const perspectiveStrength = clamp((chart.view3d?.perspective ?? (usePerspective ? 30 : 0)) / 100, 0, 1);\n const ratios = surfaceDataRatios(rows, cols, chart.valueAxis?.crossBetween !== \"midCat\", chart.view3d?.heightPercent, chart.view3d?.depthPercent, layout);\n const depthScale = ratios.depth;\n const heightExtent = 2 * ratios.height;\n const usesFlatMaterial = chart.surfaceMaterial === \"flat\";\n const wallLineColor = chart.valueAxis?.majorGridlineColor ?? chart.backWall?.lineColor ?? chart.sideWall?.lineColor ?? chart.floor?.lineColor ?? chart.axisLineColor ?? \"#a6a6a6\";\n const backWallFill = chart.backWall?.fillColor ?? \"#d9d9df\";\n const sideWallFill = chart.sideWall?.fillColor ?? \"#d5d7dc\";\n const floorFill = chart.floor?.fillColor ?? \"#d0d2d8\";\n const projectPoint = (column: number, row: number, value: number): SurfacePoint3D => {\n const worldX = normalizeSurfaceX(column, cols);\n if (isContour) {\n return {\n depth: 0,\n worldX,\n worldY: normalizeSurfaceY(row, rows),\n worldZ: 0,\n x: worldX,\n y: normalizeSurfaceY(row, rows)\n };\n }\n const worldY = normalizeSurfaceZ(value, domain, heightExtent, chart.valueAxis);\n const worldZ = normalizeSurfaceY(row, rows) * depthScale;\n const projected = projectCartesian3dPoint(worldX, worldY, worldZ, rotX, rotY, usePerspective, perspectiveStrength, chart.view3d?.rAngAx !== false);\n return {\n depth: projected.depth,\n worldX,\n worldY,\n worldZ,\n x: projected.x,\n y: projected.y\n };\n };\n const addWallQuad = (a: SurfacePoint3D, b: SurfacePoint3D, c: SurfacePoint3D, d: SurfacePoint3D, color: string) => {\n wallTriangles.push(\n { color, points: [a, b, c] },\n { color, points: [a, c, d] }\n );\n };\n const addMeshLine = (from: SurfacePoint3D, to: SurfacePoint3D, color: string) => {\n meshLines.push({ color, from, to });\n };\n\n for (let rowIndex = 0; rowIndex < rows - 1; rowIndex += 1) {\n for (let columnIndex = 0; columnIndex < cols - 1; columnIndex += 1) {\n const p00 = matrix[rowIndex]?.[columnIndex];\n const p10 = matrix[rowIndex]?.[columnIndex + 1];\n const p01 = matrix[rowIndex + 1]?.[columnIndex];\n const p11 = matrix[rowIndex + 1]?.[columnIndex + 1];\n if (p00 == null || p10 == null || p01 == null || p11 == null) {\n continue;\n }\n const triangles = triangulateSurfaceQuad([\n { value: p00, x: columnIndex, y: rowIndex },\n { value: p10, x: columnIndex + 1, y: rowIndex },\n { value: p11, x: columnIndex + 1, y: rowIndex + 1 },\n { value: p01, x: columnIndex, y: rowIndex + 1 }\n ], chart.valueAxis);\n for (const triangle of triangles) {\n for (let band = 0; band < domain.ticks.length - 1; band += 1) {\n const lower = domain.ticks[band];\n const upper = domain.ticks[band + 1];\n const polygon = clipSurfaceBand(clipSurfaceBand(triangle, lower, true, chart.valueAxis, band === 0), upper, false, chart.valueAxis);\n if (polygon.length < 3) continue;\n const bandColor = resolveSurfaceBandColor(chart, palette, domain, (lower + upper) / 2);\n if (!isWireframe && bandColor !== \"transparent\") {\n for (let index = 1; index < polygon.length - 1; index += 1) {\n for (const vertex of [polygon[0], polygon[index], polygon[index + 1]]) {\n const point = projectPoint(vertex.x, vertex.y, vertex.value);\n fillVertices.push({ bandColor, point: isContour ? withProjectedDepth(point, 0.08) : point, value: vertex.value });\n }\n }\n }\n for (const group of groupSurfaceBandEdges(polygon, triangle, band, lower, isWireframe)) {\n const edgeMidpoint = (domain.ticks[group.band] + domain.ticks[group.band + 1]) / 2;\n const color = resolveSurfaceWireframeColor(chart, palette, domain, edgeMidpoint);\n if (color !== \"transparent\") {\n for (const [from, to] of group.edges) {\n contourLines.push({ color, from: projectPoint(from.x, from.y, from.value), to: projectPoint(to.x, to.y, to.value) });\n }\n }\n }\n }\n }\n }\n }\n\n const columnSkip = Math.max(1, chart.categoryAxis?.tickMarkSkip ?? 1);\n const rowSkip = Math.max(1, chart.seriesAxis?.tickMarkSkip ?? 1);\n if (isContour) {\n const topLeft = withProjectedDepth(projectPoint(0, 0, domain.minValue), -0.12);\n const topRight = withProjectedDepth(projectPoint(cols - 1, 0, domain.minValue), -0.12);\n const bottomRight = withProjectedDepth(projectPoint(cols - 1, rows - 1, domain.minValue), -0.12);\n const bottomLeft = withProjectedDepth(projectPoint(0, rows - 1, domain.minValue), -0.12);\n if (chart.backWall?.hidden !== true && backWallFill !== \"transparent\") {\n addWallQuad(topLeft, topRight, bottomRight, bottomLeft, backWallFill);\n }\n for (let columnIndex = 0; columnIndex < cols; columnIndex += columnSkip) {\n addMeshLine(\n withProjectedDepth(projectPoint(columnIndex, 0, domain.minValue), 0.04),\n withProjectedDepth(projectPoint(columnIndex, rows - 1, domain.minValue), 0.04),\n wallLineColor\n );\n }\n for (let rowIndex = 0; rowIndex < rows; rowIndex += rowSkip) {\n addMeshLine(\n withProjectedDepth(projectPoint(0, rowIndex, domain.minValue), 0.04),\n withProjectedDepth(projectPoint(cols - 1, rowIndex, domain.minValue), 0.04),\n wallLineColor\n );\n }\n } else {\n const minPlaneValue = domain.minValue;\n const wallDepthOffset = 0;\n const backRow = chart.view3d?.rAngAx !== false || Math.cos(rotX) * Math.cos(rotY) >= 0 ? rows - 1 : 0;\n const sideColumn = Math.sin(rotY) >= 0 ? 0 : cols - 1;\n if (chart.floor?.hidden !== true && floorFill !== \"transparent\") {\n addWallQuad(\n nudgeProjectedDepth(projectPoint(0, 0, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(cols - 1, 0, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(cols - 1, rows - 1, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(0, rows - 1, minPlaneValue), wallDepthOffset),\n floorFill\n );\n }\n if (chart.backWall?.hidden !== true && backWallFill !== \"transparent\") {\n addWallQuad(\n nudgeProjectedDepth(projectPoint(0, backRow, domain.safeMax), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(cols - 1, backRow, domain.safeMax), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(cols - 1, backRow, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(0, backRow, minPlaneValue), wallDepthOffset),\n backWallFill\n );\n }\n if (chart.sideWall?.hidden !== true && sideWallFill !== \"transparent\") {\n addWallQuad(\n nudgeProjectedDepth(projectPoint(sideColumn, 0, domain.safeMax), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(sideColumn, rows - 1, domain.safeMax), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(sideColumn, rows - 1, minPlaneValue), wallDepthOffset),\n nudgeProjectedDepth(projectPoint(sideColumn, 0, minPlaneValue), wallDepthOffset),\n sideWallFill\n );\n }\n for (const tick of chart.valueAxis?.majorGridlines ? domain.ticks : []) {\n if (chart.backWall?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(0, backRow, tick), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(cols - 1, backRow, tick), wallDepthOffset * 0.75), wallLineColor);\n }\n if (chart.sideWall?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(sideColumn, 0, tick), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(sideColumn, rows - 1, tick), wallDepthOffset * 0.75), wallLineColor);\n }\n }\n for (let columnIndex = 0; chart.categoryAxis?.majorGridlines && columnIndex < cols; columnIndex += columnSkip) {\n if (chart.floor?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(columnIndex, 0, minPlaneValue), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(columnIndex, rows - 1, minPlaneValue), wallDepthOffset * 0.75), wallLineColor);\n }\n if (chart.backWall?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(columnIndex, backRow, minPlaneValue), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(columnIndex, backRow, domain.safeMax), wallDepthOffset * 0.75), wallLineColor);\n }\n }\n for (let rowIndex = 0; chart.seriesAxis?.majorGridlines && rowIndex < rows; rowIndex += rowSkip) {\n if (chart.floor?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(0, rowIndex, minPlaneValue), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(cols - 1, rowIndex, minPlaneValue), wallDepthOffset * 0.75), wallLineColor);\n }\n if (chart.sideWall?.hidden !== true && wallLineColor !== \"transparent\") {\n addMeshLine(nudgeProjectedDepth(projectPoint(sideColumn, rowIndex, minPlaneValue), wallDepthOffset * 0.75), nudgeProjectedDepth(projectPoint(sideColumn, rowIndex, domain.safeMax), wallDepthOffset * 0.75), wallLineColor);\n }\n }\n }\n\n const allPoints = [\n ...fillVertices.map((vertex) => vertex.point),\n ...wallTriangles.flatMap((triangle) => triangle.points),\n ...meshLines.flatMap((line) => [line.from, line.to]),\n ...contourLines.flatMap((line) => [line.from, line.to])\n ];\n if (allPoints.length === 0) {\n return null;\n }\n\n const minX = Math.min(...allPoints.map((point) => point.x));\n const maxX = Math.max(...allPoints.map((point) => point.x));\n const minY = Math.min(...allPoints.map((point) => point.y));\n const maxY = Math.max(...allPoints.map((point) => point.y));\n const minDepth = Math.min(...allPoints.map((point) => point.depth));\n const maxDepth = Math.max(...allPoints.map((point) => point.depth));\n const scale = Math.min(\n layout.plot.width / Math.max(0.25, maxX - minX),\n layout.plot.height / Math.max(0.25, maxY - minY)\n );\n const centerX = layout.plot.left + layout.plot.width / 2;\n const centerY = layout.plot.top + layout.plot.height / 2;\n const centerRawX = (minX + maxX) / 2;\n const centerRawY = (minY + maxY) / 2;\n const toScreenX = (x: number) => centerX + (x - centerRawX) * scale;\n const toScreenY = (y: number) => centerY + (y - centerRawY) * scale;\n const toClipPoint = (point: SurfacePoint3D) => {\n const screenX = toScreenX(point.x);\n const screenY = toScreenY(point.y);\n return {\n x: (screenX / layout.width) * 2 - 1,\n y: 1 - (screenY / layout.height) * 2,\n z: clamp(((point.depth - minDepth) / Math.max(1e-6, maxDepth - minDepth)) * 2 - 1, -1, 1)\n };\n };\n\n const fillPositions: number[] = [];\n const fillColors: number[] = [];\n const wallPositions: number[] = [];\n const wallColors: number[] = [];\n for (const triangle of wallTriangles) {\n const world = triangle.points.map(point => ({ x: point.worldX, y: point.worldY, z: -point.worldZ }));\n const normal = transformSurfaceNormal(surfaceNormal(world[0], world[1], world[2]), chart.view3d?.rotX ?? 25, chart.view3d?.rotY ?? 30, chart.view3d?.rAngAx !== false);\n const rgba = colorToRgba(usesFlatMaterial ? triangle.color : shadeSurfaceMatteColor(triangle.color, normal), 1);\n for (const point of triangle.points) {\n const clip = toClipPoint(point);\n wallPositions.push(clip.x, clip.y, clip.z);\n wallColors.push(rgba[0], rgba[1], rgba[2], rgba[3]);\n }\n }\n for (let index = 0; index < fillVertices.length; index += 3) {\n const left = fillVertices[index];\n const middle = fillVertices[index + 1];\n const right = fillVertices[index + 2];\n if (!left || !middle || !right) {\n continue;\n }\n const world = [left, middle, right].map(vertex => ({ x: vertex.point.worldX, y: vertex.point.worldY, z: -vertex.point.worldZ }));\n const normal = transformSurfaceNormal(surfaceNormal(world[0], world[1], world[2]), chart.view3d?.rotX ?? 25, chart.view3d?.rotY ?? 30, chart.view3d?.rAngAx !== false);\n const shaded = colorToRgba(usesFlatMaterial ? left.bandColor : shadeSurfaceMatteColor(left.bandColor, normal), 1);\n [left, middle, right].forEach((vertex) => {\n const clip = toClipPoint(vertex.point);\n fillPositions.push(clip.x, clip.y, clip.z);\n fillColors.push(shaded[0], shaded[1], shaded[2], shaded[3]);\n });\n }\n\n const linePositions: number[] = [];\n const lineColors: number[] = [];\n meshLines.forEach((line) => {\n const from = toClipPoint(line.from);\n const to = toClipPoint(line.to);\n const rgba = colorToRgba(line.color, 1);\n linePositions.push(from.x, from.y, from.z - 0.00001, to.x, to.y, to.z - 0.00001);\n lineColors.push(rgba[0], rgba[1], rgba[2], rgba[3], rgba[0], rgba[1], rgba[2], rgba[3]);\n });\n contourLines.forEach((line) => {\n const from = toClipPoint(line.from);\n const to = toClipPoint(line.to);\n const rgba = colorToRgba(line.color, 1);\n linePositions.push(from.x, from.y, from.z - 0.00001, to.x, to.y, to.z - 0.00001);\n lineColors.push(rgba[0], rgba[1], rgba[2], rgba[3], rgba[0], rgba[1], rgba[2], rgba[3]);\n });\n\n return {\n fillColors: new Float32Array(fillColors),\n fillPositions: new Float32Array(fillPositions),\n lineColors: new Float32Array(lineColors),\n linePositions: new Float32Array(linePositions),\n wallColors: new Float32Array(wallColors),\n wallPositions: new Float32Array(wallPositions)\n };\n}\n\nexport const MemoSurfaceChartComposite = React.memo(function MemoSurfaceChartComposite({\n background,\n borderColor,\n chart,\n fontFamily,\n layout,\n onDoubleClick,\n onPointerDown,\n overlay,\n palette,\n fallback\n}: SurfaceCompositeProps) {\n const canvasRef = React.useRef<HTMLCanvasElement | null>(null);\n const [ready, setReady] = React.useState(false);\n const [failed, setFailed] = React.useState(false);\n const isContour = isContourSurfaceChart(chart);\n\n React.useEffect(() => {\n if (isContour) {\n setReady(false);\n setFailed(false);\n return;\n }\n const canvas = canvasRef.current;\n if (!canvas) {\n return;\n }\n let cancelled = false;\n let reglInstance: ReturnType<typeof createREGL> | null = null;\n\n const drawSurface = () => {\n try {\n const scene = buildSurfaceMesh(chart, palette, layout);\n if (!scene) {\n if (!cancelled) {\n setFailed(true);\n setReady(false);\n }\n return;\n }\n const dpr = window.devicePixelRatio || 1;\n canvas.width = Math.max(1, Math.round(layout.width * dpr));\n canvas.height = Math.max(1, Math.round(layout.height * dpr));\n reglInstance = createREGL({\n attributes: {\n alpha: true,\n antialias: true,\n depth: true,\n premultipliedAlpha: true\n },\n canvas\n });\n const fillCommand = scene.fillPositions.length > 0\n ? reglInstance({\n attributes: {\n color: scene.fillColors,\n position: scene.fillPositions\n },\n blend: {\n enable: true,\n func: {\n dstRGB: \"one minus src alpha\",\n dstAlpha: \"one minus src alpha\",\n srcRGB: \"src alpha\",\n srcAlpha: \"src alpha\"\n }\n },\n count: scene.fillPositions.length / 3,\n depth: {\n enable: true\n },\n frag: `\n precision mediump float;\n varying vec4 vColor;\n void main() {\n gl_FragColor = vColor;\n }\n `,\n primitive: \"triangles\",\n vert: `\n precision mediump float;\n attribute vec3 position;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(position, 1.0);\n vColor = color;\n }\n `\n })\n : null;\n const wallCommand = scene.wallPositions.length > 0\n ? reglInstance({\n attributes: {\n color: scene.wallColors,\n position: scene.wallPositions\n },\n blend: {\n enable: true,\n func: {\n dstRGB: \"one minus src alpha\",\n dstAlpha: \"one minus src alpha\",\n srcRGB: \"src alpha\",\n srcAlpha: \"src alpha\"\n }\n },\n count: scene.wallPositions.length / 3,\n depth: {\n enable: true,\n func: \"lequal\"\n },\n frag: `\n precision mediump float;\n varying vec4 vColor;\n void main() {\n gl_FragColor = vColor;\n }\n `,\n primitive: \"triangles\",\n vert: `\n precision mediump float;\n attribute vec3 position;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(position, 1.0);\n vColor = color;\n }\n `\n })\n : null;\n const lineCommand = scene.linePositions.length > 0\n ? reglInstance({\n attributes: {\n color: scene.lineColors,\n position: scene.linePositions\n },\n blend: {\n enable: true,\n func: {\n dstRGB: \"one minus src alpha\",\n dstAlpha: \"one minus src alpha\",\n srcRGB: \"src alpha\",\n srcAlpha: \"src alpha\"\n }\n },\n count: scene.linePositions.length / 3,\n depth: {\n enable: true,\n func: \"lequal\"\n },\n frag: `\n precision mediump float;\n varying vec4 vColor;\n void main() {\n gl_FragColor = vColor;\n }\n `,\n lineWidth: 1,\n primitive: \"lines\",\n vert: `\n precision mediump float;\n attribute vec3 position;\n attribute vec4 color;\n varying vec4 vColor;\n void main() {\n gl_Position = vec4(position, 1.0);\n vColor = color;\n }\n `\n })\n : null;\n\n reglInstance.clear({ color: [0, 0, 0, 0], depth: 1 });\n wallCommand?.();\n fillCommand?.();\n lineCommand?.();\n if (!cancelled) {\n setReady(true);\n setFailed(false);\n }\n } catch {\n if (!cancelled) {\n setReady(false);\n setFailed(true);\n }\n }\n };\n\n setReady(false);\n setFailed(false);\n drawSurface();\n\n return () => {\n cancelled = true;\n reglInstance?.destroy();\n };\n }, [\n chart,\n isContour,\n layout,\n palette\n ]);\n\n const shouldRenderFallback = isContour || failed || !ready;\n\n return (\n <div\n aria-label={chart.title ?? chart.name ?? \"Chart\"}\n role=\"img\"\n style={{\n background,\n border: borderColor.trim().toLowerCase() === \"transparent\" ? \"none\" : `1px solid ${borderColor}`,\n boxSizing: \"border-box\",\n fontFamily,\n height: \"100%\",\n overflow: \"hidden\",\n pointerEvents: \"auto\",\n position: \"relative\",\n width: \"100%\"\n }}\n >\n <canvas\n ref={canvasRef}\n style={{\n display: shouldRenderFallback ? \"none\" : \"block\",\n height: \"100%\",\n inset: 0,\n position: \"absolute\",\n width: \"100%\"\n }}\n />\n <svg\n onDoubleClick={onDoubleClick}\n onPointerDown={onPointerDown}\n style={{ display: \"block\", height: \"100%\", inset: 0, position: \"absolute\", width: \"100%\" }}\n viewBox={`0 0 ${layout.width} ${layout.height}`}\n >\n {shouldRenderFallback ? fallback : null}\n {overlay}\n </svg>\n </div>\n );\n}, (prev, next) => (\n prev.chart === next.chart\n && prev.palette === next.palette\n && prev.background === next.background\n && prev.borderColor === next.borderColor\n && prev.fontFamily === next.fontFamily\n && prev.onDoubleClick === next.onDoubleClick\n && prev.onPointerDown === next.onPointerDown\n && prev.layout.width === next.layout.width\n && prev.layout.height === next.layout.height\n && prev.layout.plot.left === next.layout.plot.left\n && prev.layout.plot.top === next.layout.plot.top\n && prev.layout.plot.width === next.layout.plot.width\n && prev.layout.plot.height === next.layout.plot.height\n && prev.overlay === next.overlay\n && prev.fallback === next.fallback\n));\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,OAAO,gBAAgB;AACvB,YAAY,WAAW;AAw0BjB,cAUA,YAVA;AAhwBN,SAAS,MAAM,OAAe,KAAa,KAAa;AACtD,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;AAEA,SAAS,WAAW,OAAgB;AAClC,MAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,GAAG;AACvD,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,aAAa,MAAM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K,UAAU,KAAK,OAAO,KAAK,SAC5C,KAAK,OAAO,KAAK,WAAW,KAAK,OAAO,KAAK,UAC7C,KAAK,YAAY,KAAK,WACtB,KAAK,aAAa,KAAK,QAC3B;","names":["MemoSurfaceChartComposite"]}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkO3V2MCOCcjs = require('./chunk-O3V2MCOC.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -163,7 +163,7 @@ function normalizeSurfaceY(row, rows) {
|
|
|
163
163
|
return rows <= 1 ? 0 : (row / (rows - 1) - 0.5) * 2;
|
|
164
164
|
}
|
|
165
165
|
function normalizeSurfaceZ(value, domain, heightExtent, axis) {
|
|
166
|
-
return -(
|
|
166
|
+
return -(_chunkO3V2MCOCcjs.normalizeSurfaceValue.call(void 0, value, domain.minValue, domain.safeMax, axis) - 0.5) * heightExtent;
|
|
167
167
|
}
|
|
168
168
|
function projectCartesian3dPoint(x, y, z, rotXRad, rotYRad, usePerspective, perspectiveStrength, rightAngleAxes) {
|
|
169
169
|
if (rightAngleAxes) {
|
|
@@ -227,7 +227,7 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
227
227
|
const rotY = (_nullishCoalesce(_optionalChain([chart, 'access', _33 => _33.view3d, 'optionalAccess', _34 => _34.rotY]), () => ( 30))) * (Math.PI / 180);
|
|
228
228
|
const usePerspective = !isContour && _optionalChain([chart, 'access', _35 => _35.view3d, 'optionalAccess', _36 => _36.rAngAx]) === false;
|
|
229
229
|
const perspectiveStrength = clamp((_nullishCoalesce(_optionalChain([chart, 'access', _37 => _37.view3d, 'optionalAccess', _38 => _38.perspective]), () => ( (usePerspective ? 30 : 0)))) / 100, 0, 1);
|
|
230
|
-
const ratios =
|
|
230
|
+
const ratios = _chunkO3V2MCOCcjs.surfaceDataRatios.call(void 0, rows, cols, _optionalChain([chart, 'access', _39 => _39.valueAxis, 'optionalAccess', _40 => _40.crossBetween]) !== "midCat", _optionalChain([chart, 'access', _41 => _41.view3d, 'optionalAccess', _42 => _42.heightPercent]), _optionalChain([chart, 'access', _43 => _43.view3d, 'optionalAccess', _44 => _44.depthPercent]), layout);
|
|
231
231
|
const depthScale = ratios.depth;
|
|
232
232
|
const heightExtent = 2 * ratios.height;
|
|
233
233
|
const usesFlatMaterial = chart.surfaceMaterial === "flat";
|
|
@@ -277,7 +277,7 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
277
277
|
if (p00 == null || p10 == null || p01 == null || p11 == null) {
|
|
278
278
|
continue;
|
|
279
279
|
}
|
|
280
|
-
const triangles =
|
|
280
|
+
const triangles = _chunkO3V2MCOCcjs.triangulateSurfaceQuad.call(void 0, [
|
|
281
281
|
{ value: p00, x: columnIndex, y: rowIndex },
|
|
282
282
|
{ value: p10, x: columnIndex + 1, y: rowIndex },
|
|
283
283
|
{ value: p11, x: columnIndex + 1, y: rowIndex + 1 },
|
|
@@ -287,7 +287,7 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
287
287
|
for (let band = 0; band < domain.ticks.length - 1; band += 1) {
|
|
288
288
|
const lower = domain.ticks[band];
|
|
289
289
|
const upper = domain.ticks[band + 1];
|
|
290
|
-
const polygon =
|
|
290
|
+
const polygon = _chunkO3V2MCOCcjs.clipSurfaceBand.call(void 0, _chunkO3V2MCOCcjs.clipSurfaceBand.call(void 0, triangle, lower, true, chart.valueAxis, band === 0), upper, false, chart.valueAxis);
|
|
291
291
|
if (polygon.length < 3) continue;
|
|
292
292
|
const bandColor = resolveSurfaceBandColor(chart, palette, domain, (lower + upper) / 2);
|
|
293
293
|
if (!isWireframe && bandColor !== "transparent") {
|
|
@@ -298,10 +298,13 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
for (const group of _chunkO3V2MCOCcjs.groupSurfaceBandEdges.call(void 0, polygon, triangle, band, lower, isWireframe)) {
|
|
302
|
+
const edgeMidpoint = (domain.ticks[group.band] + domain.ticks[group.band + 1]) / 2;
|
|
303
|
+
const color = resolveSurfaceWireframeColor(chart, palette, domain, edgeMidpoint);
|
|
304
|
+
if (color !== "transparent") {
|
|
305
|
+
for (const [from, to] of group.edges) {
|
|
306
|
+
contourLines.push({ color, from: projectPoint(from.x, from.y, from.value), to: projectPoint(to.x, to.y, to.value) });
|
|
307
|
+
}
|
|
305
308
|
}
|
|
306
309
|
}
|
|
307
310
|
}
|
|
@@ -429,8 +432,8 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
429
432
|
const wallColors = [];
|
|
430
433
|
for (const triangle of wallTriangles) {
|
|
431
434
|
const world = triangle.points.map((point) => ({ x: point.worldX, y: point.worldY, z: -point.worldZ }));
|
|
432
|
-
const normal =
|
|
433
|
-
const rgba = colorToRgba(usesFlatMaterial ? triangle.color :
|
|
435
|
+
const normal = _chunkO3V2MCOCcjs.transformSurfaceNormal.call(void 0, _chunkO3V2MCOCcjs.surfaceNormal.call(void 0, world[0], world[1], world[2]), _nullishCoalesce(_optionalChain([chart, 'access', _101 => _101.view3d, 'optionalAccess', _102 => _102.rotX]), () => ( 25)), _nullishCoalesce(_optionalChain([chart, 'access', _103 => _103.view3d, 'optionalAccess', _104 => _104.rotY]), () => ( 30)), _optionalChain([chart, 'access', _105 => _105.view3d, 'optionalAccess', _106 => _106.rAngAx]) !== false);
|
|
436
|
+
const rgba = colorToRgba(usesFlatMaterial ? triangle.color : _chunkO3V2MCOCcjs.shadeSurfaceMatteColor.call(void 0, triangle.color, normal), 1);
|
|
434
437
|
for (const point of triangle.points) {
|
|
435
438
|
const clip = toClipPoint(point);
|
|
436
439
|
wallPositions.push(clip.x, clip.y, clip.z);
|
|
@@ -445,8 +448,8 @@ function buildSurfaceMesh(chart, palette, layout) {
|
|
|
445
448
|
continue;
|
|
446
449
|
}
|
|
447
450
|
const world = [left, middle, right].map((vertex) => ({ x: vertex.point.worldX, y: vertex.point.worldY, z: -vertex.point.worldZ }));
|
|
448
|
-
const normal =
|
|
449
|
-
const shaded = colorToRgba(usesFlatMaterial ? left.bandColor :
|
|
451
|
+
const normal = _chunkO3V2MCOCcjs.transformSurfaceNormal.call(void 0, _chunkO3V2MCOCcjs.surfaceNormal.call(void 0, world[0], world[1], world[2]), _nullishCoalesce(_optionalChain([chart, 'access', _107 => _107.view3d, 'optionalAccess', _108 => _108.rotX]), () => ( 25)), _nullishCoalesce(_optionalChain([chart, 'access', _109 => _109.view3d, 'optionalAccess', _110 => _110.rotY]), () => ( 30)), _optionalChain([chart, 'access', _111 => _111.view3d, 'optionalAccess', _112 => _112.rAngAx]) !== false);
|
|
452
|
+
const shaded = colorToRgba(usesFlatMaterial ? left.bandColor : _chunkO3V2MCOCcjs.shadeSurfaceMatteColor.call(void 0, left.bandColor, normal), 1);
|
|
450
453
|
[left, middle, right].forEach((vertex) => {
|
|
451
454
|
const clip = toClipPoint(vertex.point);
|
|
452
455
|
fillPositions.push(clip.x, clip.y, clip.z);
|
|
@@ -721,4 +724,4 @@ var MemoSurfaceChartComposite = _chunkCJBI5F6Vcjs.N.call(void 0, function MemoSu
|
|
|
721
724
|
|
|
722
725
|
|
|
723
726
|
exports.MemoSurfaceChartComposite = MemoSurfaceChartComposite;
|
|
724
|
-
//# sourceMappingURL=surface-regl-
|
|
727
|
+
//# sourceMappingURL=surface-regl-AY7JZVYY.cjs.map
|