@allyhub/sdk 0.12.0 → 0.14.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.
Files changed (154) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/node_modules/@allyhub/audio/dist/plan.d.ts +3 -0
  3. package/dist/node_modules/@allyhub/audio/dist/render.js +1 -1
  4. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  5. package/dist/node_modules/@allyhub/chart/dist/chart-file.d.ts +2 -0
  6. package/dist/node_modules/@allyhub/chart/dist/chart-file.js +1 -1
  7. package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +3 -2
  8. package/dist/node_modules/@allyhub/chart/dist/chart.d.ts +5 -12
  9. package/dist/node_modules/@allyhub/chart/dist/chart.js +2 -1
  10. package/dist/node_modules/@allyhub/chart/dist/color.d.ts +37 -0
  11. package/dist/node_modules/@allyhub/chart/dist/color.js +2 -0
  12. package/dist/node_modules/@allyhub/chart/dist/index.d.ts +1 -0
  13. package/dist/node_modules/@allyhub/chart/dist/index.js +1 -1
  14. package/dist/node_modules/@allyhub/chart/dist/svg.js +1 -1
  15. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  16. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  17. package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +130 -0
  18. package/dist/node_modules/@allyhub/formats/dist/data/deck-code.js +1 -1
  19. package/dist/node_modules/@allyhub/formats/dist/data/gen.d.ts +3 -1
  20. package/dist/node_modules/@allyhub/formats/dist/data/gen.js +1 -1
  21. package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +512 -166
  22. package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
  23. package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +2523 -136
  24. package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
  25. package/dist/node_modules/@allyhub/formats/dist/files.d.ts +9 -2
  26. package/dist/node_modules/@allyhub/formats/dist/files.js +1 -1
  27. package/dist/node_modules/@allyhub/formats/dist/note-shape.d.ts +9 -0
  28. package/dist/node_modules/@allyhub/formats/dist/note-shape.js +1 -1
  29. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +931 -87
  30. package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
  31. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  32. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  33. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  34. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  35. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  36. package/dist/node_modules/@allyhub/ooxml/dist/color.d.ts +11 -0
  37. package/dist/node_modules/@allyhub/ooxml/dist/color.js +1 -1
  38. package/dist/node_modules/@allyhub/ooxml/dist/ext.d.ts +43 -0
  39. package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
  40. package/dist/node_modules/@allyhub/ooxml/dist/index.d.ts +2 -1
  41. package/dist/node_modules/@allyhub/ooxml/dist/index.js +1 -1
  42. package/dist/node_modules/@allyhub/ooxml/dist/transform.d.ts +13 -0
  43. package/dist/node_modules/@allyhub/ooxml/dist/transform.js +2 -0
  44. package/dist/node_modules/@allyhub/ooxml/package.json +5 -1
  45. package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +4 -4
  46. package/dist/node_modules/@allyhub/piece/dist/media.d.ts +2 -2
  47. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  48. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +35 -0
  49. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  50. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +19 -0
  51. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  52. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +35 -20
  53. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  54. package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +3 -3
  55. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +28 -2
  56. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  57. package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
  58. package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +73 -10
  59. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  60. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +45 -9
  61. package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
  62. package/dist/node_modules/@allyhub/protocol/package.json +1 -1
  63. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  64. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  65. package/dist/node_modules/@allyhub/sheet/dist/annotations.d.ts +14 -0
  66. package/dist/node_modules/@allyhub/sheet/dist/annotations.js +2 -0
  67. package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
  68. package/dist/node_modules/@allyhub/sheet/dist/api/index.d.ts +1 -1
  69. package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
  70. package/dist/node_modules/@allyhub/sheet/dist/api/rules.d.ts +24 -0
  71. package/dist/node_modules/@allyhub/sheet/dist/api/rules.js +1 -1
  72. package/dist/node_modules/@allyhub/sheet/dist/api/styles.d.ts +12 -0
  73. package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
  74. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.d.ts +3 -1
  75. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
  76. package/dist/node_modules/@allyhub/sheet/dist/arrange.d.ts +28 -1
  77. package/dist/node_modules/@allyhub/sheet/dist/arrange.js +1 -1
  78. package/dist/node_modules/@allyhub/sheet/dist/data-tools.d.ts +42 -0
  79. package/dist/node_modules/@allyhub/sheet/dist/data-tools.js +2 -0
  80. package/dist/node_modules/@allyhub/sheet/dist/edit.d.ts +43 -2
  81. package/dist/node_modules/@allyhub/sheet/dist/edit.js +1 -1
  82. package/dist/node_modules/@allyhub/sheet/dist/fill.d.ts +10 -0
  83. package/dist/node_modules/@allyhub/sheet/dist/fill.js +1 -1
  84. package/dist/node_modules/@allyhub/sheet/dist/filter.js +1 -1
  85. package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.d.ts +14 -0
  86. package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.js +1 -1
  87. package/dist/node_modules/@allyhub/sheet/dist/html.js +10 -10
  88. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +6 -1
  89. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  90. package/dist/node_modules/@allyhub/sheet/dist/outline.d.ts +30 -0
  91. package/dist/node_modules/@allyhub/sheet/dist/outline.js +2 -0
  92. package/dist/node_modules/@allyhub/sheet/dist/rich.d.ts +29 -0
  93. package/dist/node_modules/@allyhub/sheet/dist/rich.js +2 -0
  94. package/dist/node_modules/@allyhub/sheet/dist/rules.js +1 -1
  95. package/dist/node_modules/@allyhub/sheet/dist/table-style.d.ts +6 -0
  96. package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
  97. package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
  98. package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +5 -1
  99. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
  100. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
  101. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
  102. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +17 -1
  103. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
  104. package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.d.ts +56 -0
  105. package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.js +2 -0
  106. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
  107. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
  108. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
  109. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  110. package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +117 -21
  111. package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
  112. package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +181 -30
  113. package/dist/node_modules/@allyhub/slides-core/dist/api.js +3 -3
  114. package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
  115. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.d.ts +28 -2
  116. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
  117. package/dist/node_modules/@allyhub/slides-core/dist/check.js +1 -1
  118. package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +222 -4
  119. package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
  120. package/dist/node_modules/@allyhub/slides-core/dist/file.d.ts +6 -0
  121. package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
  122. package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.d.ts +3 -0
  123. package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.js +2 -0
  124. package/dist/node_modules/@allyhub/slides-core/dist/index.d.ts +3 -0
  125. package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
  126. package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
  127. package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +98 -10
  128. package/dist/node_modules/@allyhub/slides-core/dist/numbering.d.ts +6 -0
  129. package/dist/node_modules/@allyhub/slides-core/dist/numbering.js +2 -0
  130. package/dist/node_modules/@allyhub/slides-core/dist/office.d.ts +53 -0
  131. package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
  132. package/dist/node_modules/@allyhub/slides-core/dist/patterns.d.ts +8 -0
  133. package/dist/node_modules/@allyhub/slides-core/dist/patterns.js +2 -0
  134. package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +36 -6
  135. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
  136. package/dist/node_modules/@allyhub/slides-core/dist/script.d.ts +11 -0
  137. package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
  138. package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +1 -1
  139. package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
  140. package/dist/node_modules/@allyhub/slides-core/dist/table-style.d.ts +48 -0
  141. package/dist/node_modules/@allyhub/slides-core/dist/table-style.js +2 -0
  142. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  143. package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +1 -1
  144. package/dist/node_modules/@allyhub/video-core/dist/timeline.d.ts +4 -0
  145. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  146. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  147. package/docs/defaults.md +78 -4
  148. package/docs/image.md +1 -1
  149. package/docs/pictures.md +1 -1
  150. package/docs/project.md +1 -1
  151. package/docs/sheets.md +19 -9
  152. package/docs/slides.md +30 -16
  153. package/docs/speech.md +1 -1
  154. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- export*from"./address.js";export{patchCsv}from"./patch.js";export{printedFacts,printedLines}from"./printed.js";export*from"./values.js";export*from"./workbook.js";export*from"./calc/remote.js";export*from"./calc/server.js";export{CODE as SHEET_CODE,ENTRY as SHEET_ENTRY,codeOf,dataFilesOf,readSheetFile}from"./file.js";export{GENERATED,ordinarySheet,typedNumbers,withGenerated}from"./generated.js";export{applyScenario,cellOfName,scenarioNames,scenariosByCell}from"./scenario.js";export{fileCells,hasFiles,isPicture,pictureHeight,pictureSize}from"./files.js";export*from"./formula/ast.js";export{parseFormula}from"./formula/parse.js";export{printFormula,sheetPrefix}from"./formula/print.js";export{moveFormula}from"./formula/move.js";export{rewriteFormula}from"./formula/rewrite.js";export{Calc,ITERATION_DEFAULTS,seededRandom}from"./calc/engine.js";export{analyse}from"./calc/analyse.js";export{FUNCTIONS}from"./calc/functions/index.js";export{Reference}from"./calc/types.js";export{checkWorkbook,placeName}from"./check.js";export{csvOf,csvText,dataValue,excelNumber,tableRows}from"./export.js";export{generalForms,generalText,isDateCode,shownColor,shownValue}from"./format.js";export{DEFAULT_COLUMN_WIDTH,DEFAULT_ROW_HEIGHT,headerFooterHtml,sheetHtml,SheetPrint}from"./html.js";export{PAPERS,PRINT_DEFAULTS,paginate}from"./paginate.js";export{DEFAULT_TABLE_STYLE,tableStyleLook,tableStyleOf}from"./table-style.js";export{PROFILE_TOP,profileTable}from"./profile.js";export{importRows}from"./import.js";export{patchYaml,writeYaml}from"./write.js";export*from"./edit.js";export*from"./arrange.js";export{NO_LOOK,autoFill,copyLooks,fillDownTo,moveCells,pasteLooks}from"./fill.js";export{seriesAfter}from"./series.js";export{compareForSort,hasHeader,sortCells,sortedOrder,sortedRows}from"./sort.js";export{filterChoices,filteredRows,regionAround}from"./filter.js";export{Rules,colorBetween,compareValues,holds,iconShape}from"./rules.js";export{choicesIn,invalidCells,joinChoices,listValues,separatorOf,valid}from"./validate.js";export{freeColumn,restructure,tableShape,uniqueColumn,withColumnsUpTo}from"./structure.js";export{SHEET_CHART_DEFAULTS,chartAfter,chartDataRange,chartDef,chartOfRange,chartPlace,chartSize,chartSvg,readDataRange}from"./chart.js";export{INSPECT_DEFAULTS,SHEET_FACT_KINDS,inspectWorkbook}from"./inspect.js";export{DIFF_DEFAULTS,diffWorkbooks}from"./diff.js";
2
+ export*from"./address.js";export{patchCsv}from"./patch.js";export{printedFacts,printedLines}from"./printed.js";export*from"./values.js";export*from"./workbook.js";export*from"./calc/remote.js";export*from"./calc/server.js";export{CODE as SHEET_CODE,ENTRY as SHEET_ENTRY,codeOf,dataFilesOf,readSheetFile}from"./file.js";export{GENERATED,ordinarySheet,typedNumbers,withGenerated}from"./generated.js";export{applyScenario,cellOfName,scenarioNames,scenariosByCell}from"./scenario.js";export{fileCells,hasFiles,isPicture,pictureHeight,pictureSize}from"./files.js";export*from"./formula/ast.js";export{parseFormula}from"./formula/parse.js";export{printFormula,sheetPrefix}from"./formula/print.js";export{moveFormula}from"./formula/move.js";export{rewriteFormula}from"./formula/rewrite.js";export{Calc,ITERATION_DEFAULTS,seededRandom}from"./calc/engine.js";export{analyse}from"./calc/analyse.js";export{FUNCTIONS}from"./calc/functions/index.js";export{Reference}from"./calc/types.js";export{checkWorkbook,placeName}from"./check.js";export{csvOf,csvText,dataValue,excelNumber,tableRows}from"./export.js";export{generalForms,generalText,isDateCode,shownColor,shownValue}from"./format.js";export{DEFAULT_COLUMN_WIDTH,DEFAULT_ROW_HEIGHT,headerFooterHtml,sheetHtml,SheetPrint}from"./html.js";export{PAPERS,PRINT_DEFAULTS,paginate}from"./paginate.js";export{DEFAULT_TABLE_STYLE,tableStyleLook,tableStyleOf}from"./table-style.js";export{TABLE_STYLES}from"./table-styles.js";export{PROFILE_TOP,profileTable}from"./profile.js";export{importRows}from"./import.js";export{patchYaml,writeYaml}from"./write.js";export*from"./edit.js";export*from"./rich.js";export*from"./annotations.js";export*from"./arrange.js";export*from"./outline.js";export*from"./data-tools.js";export{NO_LOOK,autoFill,copyLooks,fillDownTo,moveCells,pasteLooks,shiftCells}from"./fill.js";export{seriesAfter}from"./series.js";export{compareForSort,hasHeader,sortCells,sortedOrder,sortedRows}from"./sort.js";export{filterChoices,filteredRows,regionAround}from"./filter.js";export{Rules,colorBetween,compareValues,holds,iconShape}from"./rules.js";export{choicesIn,invalidCells,joinChoices,listValues,separatorOf,valid}from"./validate.js";export{freeColumn,restructure,tableShape,uniqueColumn,withColumnsUpTo}from"./structure.js";export{SHEET_CHART_DEFAULTS,chartAfter,chartDataRange,chartDef,chartOfRange,chartPlace,chartSize,chartSvg,readDataRange}from"./chart.js";export{INSPECT_DEFAULTS,SHEET_FACT_KINDS,inspectWorkbook}from"./inspect.js";export{DIFF_DEFAULTS,diffWorkbooks}from"./diff.js";
@@ -0,0 +1,30 @@
1
+ import type { SheetWorksheet } from "@allyhub/formats";
2
+ import { type BookEdit, type EditBook } from "./edit.js";
3
+ export type OutlineAxis = "rows" | "columns";
4
+ /** A group: its level and the rows or columns it holds, from 0. */
5
+ export interface OutlineGroup {
6
+ level: number;
7
+ from: number;
8
+ to: number;
9
+ /** Every one of its rows or columns is hidden: Excel draws its button as +. */
10
+ collapsed: boolean;
11
+ }
12
+ /** How deep the sheet's rows or columns are grouped: 0 for none. */
13
+ export declare function outlineDepth(spec: SheetWorksheet, axis: OutlineAxis): number;
14
+ /** Every group of the sheet's rows or columns, each level's in order. */
15
+ export declare function outlineGroups(spec: SheetWorksheet, axis: OutlineAxis): OutlineGroup[];
16
+ /** Where a group's summary is: the row after it or the column right of it, unless the sheet says before. */
17
+ export declare function summaryOf(spec: SheetWorksheet, axis: OutlineAxis, group: {
18
+ from: number;
19
+ to: number;
20
+ }): number;
21
+ /** Group (by 1) and Ungroup (by -1): each row or column one level deeper or shallower, 0 to 7. */
22
+ export declare function groupBands(book: EditBook, sheetName: string, axis: OutlineAxis, from: number, to: number, by: 1 | -1): BookEdit;
23
+ /** Show Detail and Hide Detail, and a group's + and −: its rows or columns shown, or hidden. */
24
+ export declare function showGroup(book: EditBook, sheetName: string, axis: OutlineAxis, group: {
25
+ from: number;
26
+ to: number;
27
+ }, shown: boolean): BookEdit;
28
+ /** A level button: what is grouped deeper than the level hidden, the rest shown. */
29
+ export declare function showLevel(book: EditBook, sheetName: string, axis: OutlineAxis, level: number): BookEdit;
30
+ //# sourceMappingURL=outline.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{columnIndex as y,columnLetter as g}from"./address.js";import{Draft as j,refused as w}from"./edit.js";const k=(e,t)=>e==="rows"?Number(t)-1:y(t),x=(e,t)=>e==="rows"?String(t+1):g(t);function h(e,t){const o=new Map,s=(t==="rows"?e.rows:e.columns)??{};for(const[l,i]of Object.entries(s)){const n=k(t,l);n!==void 0&&Number.isInteger(n)&&n>=0&&o.set(n,i)}return o}export function outlineDepth(e,t){let o=0;for(const s of h(e,t).values())o=Math.max(o,s.level??0);return o}export function outlineGroups(e,t){const o=h(e,t),s=[...o].filter(([,n])=>(n.level??0)>0).map(([n])=>n).sort((n,r)=>n-r),l=[],i=outlineDepth(e,t);for(let n=1;n<=i;n++){let r,u=-2;const c=()=>{if(r===void 0)return;let f=!0;for(let d=r;d<=u;d++)o.get(d)?.hidden!==!0&&(f=!1);l.push({level:n,from:r,to:u,collapsed:f}),r=void 0};for(const f of s)(o.get(f)?.level??0)<n||(f!==u+1&&c(),r??=f,u=f);c()}return l}export function summaryOf(e,t,o){return(t==="rows"?e.outline?.summary_below!==!1:e.outline?.summary_right!==!1)?o.to+1:Math.max(0,o.from-1)}function a(e,t,o,s,l){const i=e.workbook.sheet(t);if(!i)return w("no-sheet");const n=new j(e),r=n.spec(i),u=(o==="rows"?r.rows:r.columns)??{},c=new Map(Object.entries(u));for(const d of l){const m=x(o,d),b=s(d,c.get(m)??{}),p=Object.fromEntries(Object.entries(b).filter(([,O])=>O!==void 0));Object.keys(p).length===0?c.delete(m):c.set(m,p)}const f=c.size===0?void 0:Object.fromEntries(c);return o==="rows"?f?r.rows=f:delete r.rows:f?r.columns=f:delete r.columns,n.finish()}const v=(e,t)=>Array.from({length:t-e+1},(o,s)=>e+s);export function groupBands(e,t,o,s,l,i){return a(e,t,o,(n,r)=>{const u=Math.max(0,Math.min(7,(r.level??0)+i));return{...r,level:u===0?void 0:u,hidden:u===0&&(r.level??0)>0?void 0:r.hidden}},v(s,l))}export function showGroup(e,t,o,s,l){return a(e,t,o,(i,n)=>({...n,hidden:l?void 0:!0}),v(s.from,s.to))}export function showLevel(e,t,o,s){const l=e.workbook.sheet(t);if(!l)return w("no-sheet");const i=[...h(l.spec,o)].filter(([,n])=>(n.level??0)>0).map(([n])=>n);return a(e,t,o,(n,r)=>({...r,hidden:(r.level??0)>=s?!0:void 0}),i)}
@@ -0,0 +1,29 @@
1
+ import type { SheetRun } from "@allyhub/formats";
2
+ /** What a run can say of its font. */
3
+ export type RunLook = Omit<SheetRun, "text">;
4
+ /** A run's fields, in the order sheet.yaml writes them. */
5
+ export declare const RUN_FIELDS: readonly ["bold", "italic", "underline", "strike", "font", "size", "color", "script"];
6
+ /** A run's look alone. */
7
+ export declare function runLook(run: SheetRun): RunLook;
8
+ /** Runs with nothing empty, two alike side by side made one, each in sheet.yaml's order. */
9
+ export declare function joinedRuns(runs: readonly SheetRun[]): SheetRun[];
10
+ /** Whether runs say nothing of their font: a cell's plain text. */
11
+ export declare const plainRuns: (runs: readonly SheetRun[]) => boolean;
12
+ /**
13
+ * A look given to characters `from` to `to` (not included) of a cell's
14
+ * runs: a field set is that run's, a field set to undefined goes, so the
15
+ * cell's holds there again.
16
+ */
17
+ export declare function formatRuns(runs: readonly SheetRun[], from: number, to: number, patch: Partial<Record<keyof RunLook, unknown>>): SheetRun[];
18
+ /** The fields of a look that runs speak over, taken away from them: what a look given to the whole cell does. */
19
+ export declare function runsWithout(runs: readonly SheetRun[], fields: Iterable<string>): SheetRun[];
20
+ /** What holds at a character: the run it is in (the one before it at a boundary, as typing there takes). */
21
+ export declare function runAt(runs: readonly SheetRun[], at: number): SheetRun | undefined;
22
+ /**
23
+ * Runs over a text that has changed: what is the same at its start and its
24
+ * end keeps its runs, what came between takes the look of the first
25
+ * character it replaced, or, typed between two, of the one before it; what
26
+ * went is gone.
27
+ */
28
+ export declare function retextRuns(runs: readonly SheetRun[], text: string): SheetRun[];
29
+ //# sourceMappingURL=rich.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ export const RUN_FIELDS=["bold","italic","underline","strike","font","size","color","script"];export function runLook(o){return Object.fromEntries(Object.entries(o).filter(([t])=>t!=="text"))}const p=(o,t)=>RUN_FIELDS.every(e=>o[e]===t[e]);function a(o){const t={text:o.text};for(const e of RUN_FIELDS)o[e]!==void 0&&(t[e]=o[e]);return t}export function joinedRuns(o){const t=[];for(const e of o){if(e.text==="")continue;const r=t[t.length-1];r&&p(runLook(r),runLook(e))?t[t.length-1]={...r,text:r.text+e.text}:t.push(a(e))}return t}export const plainRuns=o=>o.every(t=>RUN_FIELDS.every(e=>t[e]===void 0));function f(o,t){const e=[];let r=0;for(const n of o){const s=r+n.text.length;t>r&&t<s?(e.push({...n,text:n.text.slice(0,t-r)}),e.push({...n,text:n.text.slice(t-r)})):e.push(n),r=s}return e}export function formatRuns(o,t,e,r){const n=f(f(o,t),e);let s=0;return joinedRuns(n.map(i=>{const c=s+i.text.length,l=s>=t&&c<=e;if(s=c,!l)return i;const x=Object.entries(r).filter(([,u])=>u!==void 0);return Object.fromEntries([...Object.entries(i).filter(([u])=>!(u in r)),...x])}))}export function runsWithout(o,t){const e=new Set(t);return joinedRuns(o.map(r=>Object.fromEntries(Object.entries(r).filter(([n])=>!e.has(n)))))}export function runAt(o,t){let e=0;for(const r of o){const n=e+r.text.length;if(t>e&&t<=n||t===0&&e===0&&r.text!=="")return r;e=n}return o[o.length-1]}function h(o,t,e){const r=[];let n=0;for(const s of o){const i=n+s.text.length,c=Math.max(t,n),l=Math.min(e,i);c<l&&r.push({...s,text:s.text.slice(c-n,l-n)}),n=i}return r}export function retextRuns(o,t){const e=o.map(c=>c.text).join("");if(e===t)return[...o];const r=Math.min(e.length,t.length);let n=0;for(;n<r&&e[n]===t[n];)n+=1;let s=0;for(;s<r-n&&e[e.length-1-s]===t[t.length-1-s];)s+=1;const i=runAt(o,e.length-s>n?n+1:n);return joinedRuns([...h(o,0,n),{...i?runLook(i):{},text:t.slice(n,t.length-s)},...h(o,e.length-s,e.length)])}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{contains as A}from"./address.js";import{toBool as S}from"./calc/coerce.js";import{CellError as l,Matrix as y,readTyped as k}from"./values.js";const d=.1,E=.9,x={3:[0,33,67],4:[0,25,50,75],5:[0,20,40,60,80]},w=s=>{if(!(s===null||s==="")&&!(s instanceof l))return typeof s=="string"?`s${s.toLowerCase()}`:`${typeof s}${String(s)}`},B=s=>Math.round(s).toString(16).padStart(2,"0");export function colorBetween(s,t,r){const i=(e,n)=>Number.parseInt(e.slice(n,n+2),16),o=e=>B(i(s,e)+(i(t,e)-i(s,e))*r);return`#${o(1)}${o(3)}${o(5)}`.toUpperCase()}export function compareValues(s,t){const r=e=>typeof e=="number"||e===null?0:typeof e=="string"?1:typeof e=="boolean"?2:3,i=r(s),o=r(t);if(i!==o)return i-o;if(i===0)return(s??0)-(t??0);if(i===1){const e=s.toLowerCase(),n=t.toLowerCase();return e<n?-1:e>n?1:0}return s===t?0:s===!0?1:-1}export function holds(s,t,r,i){if(t instanceof l)return!1;const o=()=>compareValues(t,r);switch(s){case"equal":return o()===0;case"notEqual":return o()!==0;case"greaterThan":return o()>0;case"lessThan":return o()<0;case"greaterThanOrEqual":return o()>=0;case"lessThanOrEqual":return o()<=0;default:{const e=o()>=0&&compareValues(t,i)<=0;return s==="notBetween"?!e:e}}}const M=s=>s===null||s instanceof l?"":typeof s=="boolean"?s?"TRUE":"FALSE":String(s);function C(s,t,r){if(t instanceof l)return!1;const i=M(t).toLowerCase(),o=r.toLowerCase();switch(s){case"notContains":return!i.includes(o);case"beginsWith":return i.startsWith(o);case"endsWith":return i.endsWith(o);default:return i.includes(o)}}function F(s){if(s.type==="dataBar"||s.type==="colorScale"||s.type==="iconSet")return;const t={};return s.bold!==void 0&&(t.bold=s.bold),s.italic!==void 0&&(t.italic=s.italic),s.underline!==void 0&&(t.underline=s.underline),s.strike!==void 0&&(t.strike=s.strike),s.color!==void 0&&(t.color=s.color),s.fill!==void 0&&(t.fill=s.fill),s.border!==void 0&&(t.border=s.border),t}function L(s,t){const r=(s.length-1)*t,i=Math.floor(r),o=Math.ceil(r),e=s[i]??0,n=s[o]??e;return e+(n-e)*(r-i)}export class Rules{sheet;calc;measured=new Map;constructor(t,r){this.sheet=t,this.calc=r}measure(t){const r=this.measured.get(t);if(r)return r;const i=[],o=new Map;for(const n of t.areas)this.eachIn(n,c=>{typeof c=="number"&&i.push(c);const a=w(c);a!==void 0&&o.set(a,(o.get(a)??0)+1)});const e={numbers:i,sorted:[...i].sort((n,c)=>n-c),counts:o};return this.measured.set(t,e),e}eachIn(t,r){const{sheet:i,calc:o}=this,e=Math.min(t.right,i.columnsUsed-1);for(let n=t.left;n<=e;n++){const[c,a]=i.span(n,t.top,t.bottom);for(let u=c;u<=a;u++){const f=o.value(i,u,n);f!==null&&r(f)}}}boundAt(t,r,i,o){if(r===void 0)return null;if(typeof r=="number")return r;if(!r.startsWith("=")){const c=k(r);return c.formula===void 0?c.value:r}const e=t.formulas.find(c=>c.text===r);if(!e)return null;const n=this.calc.evaluateAt(e,this.sheet,i,o);return n instanceof y?n.at(0,0):n}stopAt(t,r,i,o,e){const{sorted:n}=this.measure(t),c=n[0]??0,a=n[n.length-1]??0,u=this.boundAt(t,r.value,i,o),f=typeof u=="number"?u:void 0;switch(r.at){case"min":return c;case"max":return a;case"percent":return c+(a-c)*(f??e)/100;case"percentile":return L(n,(f??e)/100);default:return f??e}}whether(t,r,i,o){const{spec:e}=t;switch(e.type){case"cellIs":return holds(e.operator,r,this.boundAt(t,e.formula[0],i,o),this.boundAt(t,e.formula[1],i,o));case"containsText":return C(e.operator,r,e.text);case"duplicateValues":case"uniqueValues":{const n=w(r);if(n===void 0)return!1;const c=this.measure(t).counts.get(n)??0;return e.type==="duplicateValues"?c>1:c===1}case"top10":{if(typeof r!="number")return!1;const{sorted:n}=this.measure(t),c=e.percent===!0?Math.max(1,Math.floor(n.length*e.rank/100)):e.rank,a=e.bottom===!0?n[Math.min(c,n.length)-1]:n[Math.max(n.length-c,0)];return a===void 0?!1:e.bottom===!0?r<=a:r>=a}case"aboveAverage":{if(typeof r!="number")return!1;const{numbers:n}=this.measure(t);if(n.length===0)return!1;const c=n.reduce((a,u)=>a+u,0)/n.length;return e.equal===!0&&r===c?!0:e.below===!0?r<c:r>c}case"expression":{const[n]=t.formulas;if(!n)return!1;const c=this.calc.evaluateAt(n,this.sheet,i,o),a=c instanceof y?c.at(0,0):c;return S(a)===!0}default:return!1}}scale(t,r,i,o,e){const n=r.stops.map((u,f)=>({at:this.stopAt(t,u,o,e,f*100/(r.stops.length-1)),color:u.color})),[c]=n,a=n[n.length-1];if(!(!c||!a)){if(i<=c.at)return c.color;if(i>=a.at)return a.color;for(let u=1;u<n.length;u++){const f=n[u-1],h=n[u];if(f&&h&&i<=h.at)return colorBetween(f.color,h.color,h.at===f.at?1:(i-f.at)/(h.at-f.at))}return a.color}}bar(t,r,i,o,e){const n=this.stopAt(t,r.min??{at:"min"},o,e,0),c=this.stopAt(t,r.max??{at:"max"},o,e,100);if(c<=n)return d;const a=Math.min(1,Math.max(0,(i-n)/(c-n)));return d+(E-d)*a}icon(t,r,i,o,e){const n=Number.parseInt(r.icons,10),c=r.stops??(x[n]??[]).map(u=>({at:"percent",value:u}));let a=0;return c.forEach((u,f)=>{i>=this.stopAt(t,u,o,e,0)&&(a=f)}),r.reverse===!0?n-1-a:a}at(t,r){const{sheet:i,calc:o}=this;if(i.conditions.length===0)return;const e=o.value(i,t,r);let n;for(const c of i.conditions){if(!c.areas.some(u=>A(u,t,r)))continue;const{spec:a}=c;if(a.type==="dataBar"||a.type==="colorScale"||a.type==="iconSet"){if(typeof e!="number")continue;if(n??={},a.type==="dataBar")n.bar??={share:this.bar(c,a,e,t,r),color:a.color},a.show===!1&&(n.bare=!0);else if(a.type==="colorScale"){const u=this.scale(c,a,e,t,r);u!==void 0&&(n.scale??=u)}else n.icon??={set:a.icons,index:this.icon(c,a,e,t,r)},a.show===!1&&(n.bare=!0);if(a.stop===!0)break;continue}if(this.whether(c,e,t,r)&&(n??={},n.look={...F(a),...n.look},a.stop===!0))break}return n}}const m="#00A651",g="#FFC000",b="#E03C32",p="#7F7F7F",T="#000000",R="#2F75B5",O=s=>s===3?[b,g,m]:s===4?[T,b,g,m]:[b,"#ED7D31",g,"#92D050",m];export function iconShape(s,t){const r=Number.parseInt(s,10),o=O(r)[t]??p,e=s.slice(1);return e.startsWith("Arrows")?{shape:(r===3?["down","right","up"]:r===4?["down","down-right","up-right","up"]:["down","down-right","right","up-right","up"])[t]??"right",color:e==="ArrowsGray"?p:o}:e==="Flags"?{shape:"flag",color:o}:e==="Signs"?{shape:t===0?"diamond":t===1?"triangle":"circle",color:o}:e.startsWith("Symbols")?{shape:t===0?"cross":t===1?"bang":"check",color:o}:e==="Rating"?{shape:"bars",color:R,level:t+1}:e==="Quarters"?{shape:"quarter",color:p,level:t}:e==="RedToBlack"?{shape:"circle",color:["#000000","#7F7F7F","#F4B6B6","#E03C32"][t]??p}:{shape:"circle",color:o}}
2
+ import{contains as A}from"./address.js";import{toBool as S}from"./calc/coerce.js";import{CellError as l,Matrix as y,readTyped as k}from"./values.js";const d=.1,E=.9,x={3:[0,33,67],4:[0,25,50,75],5:[0,20,40,60,80]},w=s=>{if(!(s===null||s==="")&&!(s instanceof l))return typeof s=="string"?`s${s.toLowerCase()}`:`${typeof s}${String(s)}`},B=s=>Math.round(s).toString(16).padStart(2,"0");export function colorBetween(s,t,r){const i=(e,n)=>Number.parseInt(e.slice(n,n+2),16),o=e=>B(i(s,e)+(i(t,e)-i(s,e))*r);return`#${o(1)}${o(3)}${o(5)}`.toUpperCase()}export function compareValues(s,t){const r=e=>typeof e=="number"||e===null?0:typeof e=="string"?1:typeof e=="boolean"?2:3,i=r(s),o=r(t);if(i!==o)return i-o;if(i===0)return(s??0)-(t??0);if(i===1){const e=s.toLowerCase(),n=t.toLowerCase();return e<n?-1:e>n?1:0}return s===t?0:s===!0?1:-1}export function holds(s,t,r,i){if(t instanceof l)return!1;const o=()=>compareValues(t,r);switch(s){case"equal":return o()===0;case"notEqual":return o()!==0;case"greaterThan":return o()>0;case"lessThan":return o()<0;case"greaterThanOrEqual":return o()>=0;case"lessThanOrEqual":return o()<=0;default:{const e=o()>=0&&compareValues(t,i)<=0;return s==="notBetween"?!e:e}}}const M=s=>s===null||s instanceof l?"":typeof s=="boolean"?s?"TRUE":"FALSE":String(s);function C(s,t,r){if(t instanceof l)return!1;const i=M(t).toLowerCase(),o=r.toLowerCase();switch(s){case"notContains":return!i.includes(o);case"beginsWith":return i.startsWith(o);case"endsWith":return i.endsWith(o);default:return i.includes(o)}}function F(s){if(s.type==="dataBar"||s.type==="colorScale"||s.type==="iconSet")return;const t={};return s.bold!==void 0&&(t.bold=s.bold),s.italic!==void 0&&(t.italic=s.italic),s.underline!==void 0&&(t.underline=s.underline),s.strike!==void 0&&(t.strike=s.strike),s.color!==void 0&&(t.color=s.color),s.fill!==void 0&&(t.fill=s.fill),s.border!==void 0&&(t.border=s.border),s.format!==void 0&&(t.format=s.format),t}function L(s,t){const r=(s.length-1)*t,i=Math.floor(r),o=Math.ceil(r),e=s[i]??0,n=s[o]??e;return e+(n-e)*(r-i)}export class Rules{sheet;calc;measured=new Map;constructor(t,r){this.sheet=t,this.calc=r}measure(t){const r=this.measured.get(t);if(r)return r;const i=[],o=new Map;for(const n of t.areas)this.eachIn(n,c=>{typeof c=="number"&&i.push(c);const a=w(c);a!==void 0&&o.set(a,(o.get(a)??0)+1)});const e={numbers:i,sorted:[...i].sort((n,c)=>n-c),counts:o};return this.measured.set(t,e),e}eachIn(t,r){const{sheet:i,calc:o}=this,e=Math.min(t.right,i.columnsUsed-1);for(let n=t.left;n<=e;n++){const[c,a]=i.span(n,t.top,t.bottom);for(let f=c;f<=a;f++){const u=o.value(i,f,n);u!==null&&r(u)}}}boundAt(t,r,i,o){if(r===void 0)return null;if(typeof r=="number")return r;if(!r.startsWith("=")){const c=k(r);return c.formula===void 0?c.value:r}const e=t.formulas.find(c=>c.text===r);if(!e)return null;const n=this.calc.evaluateAt(e,this.sheet,i,o);return n instanceof y?n.at(0,0):n}stopAt(t,r,i,o,e){const{sorted:n}=this.measure(t),c=n[0]??0,a=n[n.length-1]??0,f=this.boundAt(t,r.value,i,o),u=typeof f=="number"?f:void 0;switch(r.at){case"min":return c;case"max":return a;case"percent":return c+(a-c)*(u??e)/100;case"percentile":return L(n,(u??e)/100);default:return u??e}}whether(t,r,i,o){const{spec:e}=t;switch(e.type){case"cellIs":return holds(e.operator,r,this.boundAt(t,e.formula[0],i,o),this.boundAt(t,e.formula[1],i,o));case"containsText":return C(e.operator,r,e.text);case"duplicateValues":case"uniqueValues":{const n=w(r);if(n===void 0)return!1;const c=this.measure(t).counts.get(n)??0;return e.type==="duplicateValues"?c>1:c===1}case"top10":{if(typeof r!="number")return!1;const{sorted:n}=this.measure(t),c=e.percent===!0?Math.max(1,Math.floor(n.length*e.rank/100)):e.rank,a=e.bottom===!0?n[Math.min(c,n.length)-1]:n[Math.max(n.length-c,0)];return a===void 0?!1:e.bottom===!0?r<=a:r>=a}case"aboveAverage":{if(typeof r!="number")return!1;const{numbers:n}=this.measure(t);if(n.length===0)return!1;const c=n.reduce((a,f)=>a+f,0)/n.length;return e.equal===!0&&r===c?!0:e.below===!0?r<c:r>c}case"expression":{const[n]=t.formulas;if(!n)return!1;const c=this.calc.evaluateAt(n,this.sheet,i,o),a=c instanceof y?c.at(0,0):c;return S(a)===!0}default:return!1}}scale(t,r,i,o,e){const n=r.stops.map((f,u)=>({at:this.stopAt(t,f,o,e,u*100/(r.stops.length-1)),color:f.color})),[c]=n,a=n[n.length-1];if(!(!c||!a)){if(i<=c.at)return c.color;if(i>=a.at)return a.color;for(let f=1;f<n.length;f++){const u=n[f-1],h=n[f];if(u&&h&&i<=h.at)return colorBetween(u.color,h.color,h.at===u.at?1:(i-u.at)/(h.at-u.at))}return a.color}}bar(t,r,i,o,e){const n=this.stopAt(t,r.min??{at:"min"},o,e,0),c=this.stopAt(t,r.max??{at:"max"},o,e,100);if(c<=n)return d;const a=Math.min(1,Math.max(0,(i-n)/(c-n)));return d+(E-d)*a}icon(t,r,i,o,e){const n=Number.parseInt(r.icons,10),c=r.stops??(x[n]??[]).map(f=>({at:"percent",value:f}));let a=0;return c.forEach((f,u)=>{i>=this.stopAt(t,f,o,e,0)&&(a=u)}),r.reverse===!0?n-1-a:a}at(t,r){const{sheet:i,calc:o}=this;if(i.conditions.length===0)return;const e=o.value(i,t,r);let n;for(const c of i.conditions){if(!c.areas.some(f=>A(f,t,r)))continue;const{spec:a}=c;if(a.type==="dataBar"||a.type==="colorScale"||a.type==="iconSet"){if(typeof e!="number")continue;if(n??={},a.type==="dataBar")n.bar??={share:this.bar(c,a,e,t,r),color:a.color},a.show===!1&&(n.bare=!0);else if(a.type==="colorScale"){const f=this.scale(c,a,e,t,r);f!==void 0&&(n.scale??=f)}else n.icon??={set:a.icons,index:this.icon(c,a,e,t,r)},a.show===!1&&(n.bare=!0);if(a.stop===!0)break;continue}if(this.whether(c,e,t,r)&&(n??={},n.look={...F(a),...n.look},a.stop===!0))break}return n}}const m="#00A651",g="#FFC000",b="#E03C32",p="#7F7F7F",T="#000000",R="#2F75B5",O=s=>s===3?[b,g,m]:s===4?[T,b,g,m]:[b,"#ED7D31",g,"#92D050",m];export function iconShape(s,t){const r=Number.parseInt(s,10),o=O(r)[t]??p,e=s.slice(1);return e.startsWith("Arrows")?{shape:(r===3?["down","right","up"]:r===4?["down","down-right","up-right","up"]:["down","down-right","right","up-right","up"])[t]??"right",color:e==="ArrowsGray"?p:o}:e==="Flags"?{shape:"flag",color:o}:e==="Signs"?{shape:t===0?"diamond":t===1?"triangle":"circle",color:o}:e.startsWith("Symbols")?{shape:t===0?"cross":t===1?"bang":"check",color:o}:e==="Rating"?{shape:"bars",color:R,level:t+1}:e==="Quarters"?{shape:"quarter",color:p,level:t}:e==="RedToBlack"?{shape:"circle",color:["#000000","#7F7F7F","#F4B6B6","#E03C32"][t]??p}:{shape:"circle",color:o}}
@@ -18,6 +18,12 @@ export interface TableStyle {
18
18
  header?: TablePart;
19
19
  stripe?: TablePart;
20
20
  stripe2?: TablePart;
21
+ /** Banded Columns' first and second stripes. */
22
+ column?: TablePart;
23
+ column2?: TablePart;
24
+ /** First Column and Last Column. */
25
+ first?: TablePart;
26
+ last?: TablePart;
21
27
  }
22
28
  /** A table's style unless it names one, as Excel's new table. */
23
29
  export declare const DEFAULT_TABLE_STYLE = "TableStyleMedium2";
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{TABLE_STYLES as S}from"./table-styles.js";export const DEFAULT_TABLE_STYLE="TableStyleMedium2",tableStyleOf=e=>e.spec.style==="none"?void 0:S[e.spec.style??DEFAULT_TABLE_STYLE];export function tableStyleLook(e,m,d,u,b){const{area:n}=m,t={},i={},r=(o,p)=>{if(!o)return;o.bold!==void 0&&(t.bold=o.bold),o.color!==void 0&&(t.color=o.color),o.fill!==void 0&&(t.fill=o.fill);const c=o.border;if(!c)return;const l=(s,L)=>{const h=p[s]?c[s]:c[L];h&&(i[s]=h)};l("left","vertical"),l("right","vertical"),l("top","horizontal"),l("bottom","horizontal")},f={left:u===n.left,right:u===n.right};return r(e.whole,{...f,top:d===n.top,bottom:d===n.bottom}),b===void 0?r(e.header,{...f,top:!0,bottom:!0}):r(b%2===0?e.stripe:e.stripe2,{...f,top:!0,bottom:!0}),Object.keys(i).length>0&&(t.border=i),t}
2
+ import{TABLE_STYLES as S}from"./table-styles.js";export const DEFAULT_TABLE_STYLE="TableStyleMedium2",tableStyleOf=o=>o.spec.style==="none"?void 0:S[o.spec.style??DEFAULT_TABLE_STYLE];export function tableStyleLook(o,h,p,i,c){const{area:e}=h,r={},u={},n=(t,g)=>{if(!t)return;t.bold!==void 0&&(r.bold=t.bold),t.color!==void 0&&(r.color=t.color),t.fill!==void 0&&(r.fill=t.fill);const m=t.border;if(!m)return;const l=(b,L)=>{const a=g[b]?m[b]:m[L];a&&(u[b]=a)};l("left","vertical"),l("right","vertical"),l("top","horizontal"),l("bottom","horizontal")},s={left:i===e.left,right:i===e.right},_={top:p===e.top,bottom:p===e.bottom},d={left:!0,right:!0,..._},f=h.spec;return n(o.whole,{...s,..._}),f.banded_columns===!0&&n((i-e.left)%2===0?o.column:o.column2,d),c!==void 0&&f.banded_rows!==!1&&n(c%2===0?o.stripe:o.stripe2,{...s,top:!0,bottom:!0}),f.last_column===!0&&i===e.right&&n(o.last,d),f.first_column===!0&&i===e.left&&n(o.first,d),c===void 0&&n(o.header,{...s,top:!0,bottom:!0}),Object.keys(u).length>0&&(r.border=u),r}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- export const TABLE_STYLES={TableStyleDark1:{whole:{color:"#FFFFFF",fill:"#737373"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#404040"}},TableStyleDark2:{whole:{color:"#FFFFFF",fill:"#4472C4"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#2F5597"}},TableStyleDark3:{whole:{color:"#FFFFFF",fill:"#ED7D31"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#C55A11"}},TableStyleDark4:{whole:{color:"#FFFFFF",fill:"#A5A5A5"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#7C7C7C"}},TableStyleDark5:{whole:{color:"#FFFFFF",fill:"#FFC000"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#BF9000"}},TableStyleDark6:{whole:{color:"#FFFFFF",fill:"#5B9BD5"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#2E75B6"}},TableStyleDark7:{whole:{color:"#FFFFFF",fill:"#70AD47"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#548235"}},TableStyleDark8:{whole:{fill:"#D9D9D9"},header:{color:"#FFFFFF",fill:"#000000"},stripe:{fill:"#A6A6A6"}},TableStyleDark9:{whole:{fill:"#DAE3F3"},header:{color:"#FFFFFF",fill:"#ED7D31"},stripe:{fill:"#B4C7E7"}},TableStyleDark10:{whole:{fill:"#EDEDED"},header:{color:"#FFFFFF",fill:"#FFC000"},stripe:{fill:"#DBDBDB"}},TableStyleDark11:{whole:{fill:"#DEEBF7"},header:{color:"#FFFFFF",fill:"#70AD47"},stripe:{fill:"#BDD7EE"}},TableStyleLight1:{whole:{color:"#000000",border:{top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"thin",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleLight2:{whole:{color:"#2F5597",border:{top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#2F5597",border:{bottom:{style:"thin",color:"#4472C4"}}},stripe:{fill:"#DAE3F3"}},TableStyleLight3:{whole:{color:"#C55A11",border:{top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#C55A11",border:{bottom:{style:"thin",color:"#ED7D31"}}},stripe:{fill:"#FBE5D6"}},TableStyleLight4:{whole:{color:"#7C7C7C",border:{top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#7C7C7C",border:{bottom:{style:"thin",color:"#A5A5A5"}}},stripe:{fill:"#EDEDED"}},TableStyleLight5:{whole:{color:"#BF9000",border:{top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#BF9000",border:{bottom:{style:"thin",color:"#FFC000"}}},stripe:{fill:"#FFF2CC"}},TableStyleLight6:{whole:{color:"#2E75B6",border:{top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#2E75B6",border:{bottom:{style:"thin",color:"#5B9BD5"}}},stripe:{fill:"#DEEBF7"}},TableStyleLight7:{whole:{color:"#548235",border:{top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#548235",border:{bottom:{style:"thin",color:"#70AD47"}}},stripe:{fill:"#E2F0D9"}},TableStyleLight8:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000"},stripe:{border:{top:{style:"thin",color:"#000000"}}},stripe2:{border:{top:{style:"thin",color:"#000000"}}}},TableStyleLight9:{whole:{color:"#000000",border:{left:{style:"thin",color:"#4472C4"},right:{style:"thin",color:"#4472C4"},top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},stripe:{border:{top:{style:"thin",color:"#4472C4"}}},stripe2:{border:{top:{style:"thin",color:"#4472C4"}}}},TableStyleLight10:{whole:{color:"#000000",border:{left:{style:"thin",color:"#ED7D31"},right:{style:"thin",color:"#ED7D31"},top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},stripe:{border:{top:{style:"thin",color:"#ED7D31"}}},stripe2:{border:{top:{style:"thin",color:"#ED7D31"}}}},TableStyleLight11:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A5A5A5"},right:{style:"thin",color:"#A5A5A5"},top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},stripe:{border:{top:{style:"thin",color:"#A5A5A5"}}},stripe2:{border:{top:{style:"thin",color:"#A5A5A5"}}}},TableStyleLight12:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFC000"},right:{style:"thin",color:"#FFC000"},top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},stripe:{border:{top:{style:"thin",color:"#FFC000"}}},stripe2:{border:{top:{style:"thin",color:"#FFC000"}}}},TableStyleLight13:{whole:{color:"#000000",border:{left:{style:"thin",color:"#5B9BD5"},right:{style:"thin",color:"#5B9BD5"},top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},stripe:{border:{top:{style:"thin",color:"#5B9BD5"}}},stripe2:{border:{top:{style:"thin",color:"#5B9BD5"}}}},TableStyleLight14:{whole:{color:"#000000",border:{left:{style:"thin",color:"#70AD47"},right:{style:"thin",color:"#70AD47"},top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},stripe:{border:{top:{style:"thin",color:"#70AD47"}}},stripe2:{border:{top:{style:"thin",color:"#70AD47"}}}},TableStyleLight15:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleLight16:{whole:{color:"#000000",border:{left:{style:"thin",color:"#4472C4"},right:{style:"thin",color:"#4472C4"},top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"},horizontal:{style:"thin",color:"#4472C4"},vertical:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#4472C4"}}},stripe:{fill:"#DAE3F3"}},TableStyleLight17:{whole:{color:"#000000",border:{left:{style:"thin",color:"#ED7D31"},right:{style:"thin",color:"#ED7D31"},top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"},horizontal:{style:"thin",color:"#ED7D31"},vertical:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#ED7D31"}}},stripe:{fill:"#FBE5D6"}},TableStyleLight18:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A5A5A5"},right:{style:"thin",color:"#A5A5A5"},top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"},horizontal:{style:"thin",color:"#A5A5A5"},vertical:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#A5A5A5"}}},stripe:{fill:"#EDEDED"}},TableStyleLight19:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFC000"},right:{style:"thin",color:"#FFC000"},top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"},horizontal:{style:"thin",color:"#FFC000"},vertical:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#FFC000"}}},stripe:{fill:"#FFF2CC"}},TableStyleLight20:{whole:{color:"#000000",border:{left:{style:"thin",color:"#5B9BD5"},right:{style:"thin",color:"#5B9BD5"},top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"},horizontal:{style:"thin",color:"#5B9BD5"},vertical:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#5B9BD5"}}},stripe:{fill:"#DEEBF7"}},TableStyleLight21:{whole:{color:"#000000",border:{left:{style:"thin",color:"#70AD47"},right:{style:"thin",color:"#70AD47"},top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"},horizontal:{style:"thin",color:"#70AD47"},vertical:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#70AD47"}}},stripe:{fill:"#E2F0D9"}},TableStyleMedium1:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000"},stripe:{fill:"#D9D9D9"}},TableStyleMedium2:{whole:{color:"#000000",border:{left:{style:"thin",color:"#8FAADC"},right:{style:"thin",color:"#8FAADC"},top:{style:"thin",color:"#8FAADC"},bottom:{style:"thin",color:"#8FAADC"},horizontal:{style:"thin",color:"#8FAADC"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},stripe:{fill:"#DAE3F3"}},TableStyleMedium3:{whole:{color:"#000000",border:{left:{style:"thin",color:"#F4B183"},right:{style:"thin",color:"#F4B183"},top:{style:"thin",color:"#F4B183"},bottom:{style:"thin",color:"#F4B183"},horizontal:{style:"thin",color:"#F4B183"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},stripe:{fill:"#FBE5D6"}},TableStyleMedium4:{whole:{color:"#000000",border:{left:{style:"thin",color:"#C9C9C9"},right:{style:"thin",color:"#C9C9C9"},top:{style:"thin",color:"#C9C9C9"},bottom:{style:"thin",color:"#C9C9C9"},horizontal:{style:"thin",color:"#C9C9C9"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},stripe:{fill:"#EDEDED"}},TableStyleMedium5:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFD966"},right:{style:"thin",color:"#FFD966"},top:{style:"thin",color:"#FFD966"},bottom:{style:"thin",color:"#FFD966"},horizontal:{style:"thin",color:"#FFD966"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},stripe:{fill:"#FFF2CC"}},TableStyleMedium6:{whole:{color:"#000000",border:{left:{style:"thin",color:"#9DC3E6"},right:{style:"thin",color:"#9DC3E6"},top:{style:"thin",color:"#9DC3E6"},bottom:{style:"thin",color:"#9DC3E6"},horizontal:{style:"thin",color:"#9DC3E6"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},stripe:{fill:"#DEEBF7"}},TableStyleMedium7:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A9D18E"},right:{style:"thin",color:"#A9D18E"},top:{style:"thin",color:"#A9D18E"},bottom:{style:"thin",color:"#A9D18E"},horizontal:{style:"thin",color:"#A9D18E"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},stripe:{fill:"#E2F0D9"}},TableStyleMedium8:{whole:{color:"#000000",fill:"#D9D9D9",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#A6A6A6"}},TableStyleMedium9:{whole:{color:"#000000",fill:"#DAE3F3",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#B4C7E7"}},TableStyleMedium10:{whole:{color:"#000000",fill:"#FBE5D6",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#F8CBAD"}},TableStyleMedium11:{whole:{color:"#000000",fill:"#EDEDED",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#DBDBDB"}},TableStyleMedium12:{whole:{color:"#000000",fill:"#FFF2CC",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#FFE699"}},TableStyleMedium13:{whole:{color:"#000000",fill:"#DEEBF7",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#BDD7EE"}},TableStyleMedium14:{whole:{color:"#000000",fill:"#E2F0D9",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#C5E0B4"}},TableStyleMedium15:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium16:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium17:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium18:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium19:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium20:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium21:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium22:{whole:{color:"#000000",fill:"#D9D9D9",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#A6A6A6"}},TableStyleMedium23:{whole:{color:"#000000",fill:"#DAE3F3",border:{left:{style:"thin",color:"#8FAADC"},right:{style:"thin",color:"#8FAADC"},top:{style:"thin",color:"#8FAADC"},bottom:{style:"thin",color:"#8FAADC"},horizontal:{style:"thin",color:"#8FAADC"},vertical:{style:"thin",color:"#8FAADC"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#B4C7E7"}},TableStyleMedium24:{whole:{color:"#000000",fill:"#FBE5D6",border:{left:{style:"thin",color:"#F4B183"},right:{style:"thin",color:"#F4B183"},top:{style:"thin",color:"#F4B183"},bottom:{style:"thin",color:"#F4B183"},horizontal:{style:"thin",color:"#F4B183"},vertical:{style:"thin",color:"#F4B183"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#F8CBAD"}},TableStyleMedium25:{whole:{color:"#000000",fill:"#EDEDED",border:{left:{style:"thin",color:"#C9C9C9"},right:{style:"thin",color:"#C9C9C9"},top:{style:"thin",color:"#C9C9C9"},bottom:{style:"thin",color:"#C9C9C9"},horizontal:{style:"thin",color:"#C9C9C9"},vertical:{style:"thin",color:"#C9C9C9"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#DBDBDB"}},TableStyleMedium26:{whole:{color:"#000000",fill:"#FFF2CC",border:{left:{style:"thin",color:"#FFD966"},right:{style:"thin",color:"#FFD966"},top:{style:"thin",color:"#FFD966"},bottom:{style:"thin",color:"#FFD966"},horizontal:{style:"thin",color:"#FFD966"},vertical:{style:"thin",color:"#FFD966"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#FFE699"}},TableStyleMedium27:{whole:{color:"#000000",fill:"#DEEBF7",border:{left:{style:"thin",color:"#9DC3E6"},right:{style:"thin",color:"#9DC3E6"},top:{style:"thin",color:"#9DC3E6"},bottom:{style:"thin",color:"#9DC3E6"},horizontal:{style:"thin",color:"#9DC3E6"},vertical:{style:"thin",color:"#9DC3E6"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#BDD7EE"}},TableStyleMedium28:{whole:{color:"#000000",fill:"#E2F0D9",border:{left:{style:"thin",color:"#A9D18E"},right:{style:"thin",color:"#A9D18E"},top:{style:"thin",color:"#A9D18E"},bottom:{style:"thin",color:"#A9D18E"},horizontal:{style:"thin",color:"#A9D18E"},vertical:{style:"thin",color:"#A9D18E"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#C5E0B4"}}};
2
+ export const TABLE_STYLES={TableStyleDark1:{whole:{color:"#FFFFFF",fill:"#737373"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#404040",border:{right:{style:"medium",color:"#FFFFFF"}}},last:{bold:!0,color:"#FFFFFF",fill:"#404040",border:{left:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#404040"},column:{fill:"#404040"}},TableStyleDark2:{whole:{color:"#FFFFFF",fill:"#4472C4"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#2F5597",border:{right:{style:"medium",color:"#FFFFFF"}}},last:{bold:!0,color:"#FFFFFF",fill:"#2F5597",border:{left:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#2F5597"},column:{fill:"#2F5597"}},TableStyleDark3:{whole:{color:"#FFFFFF",fill:"#ED7D31"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#C55A11",border:{right:{style:"medium",color:"#FFFFFF"}}},last:{bold:!0,color:"#FFFFFF",fill:"#C55A11",border:{left:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#C55A11"},column:{fill:"#C55A11"}},TableStyleDark4:{whole:{color:"#FFFFFF",fill:"#A5A5A5"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#7C7C7C",border:{right:{style:"medium",color:"#FFFFFF"}}},last:{bold:!0,color:"#FFFFFF",fill:"#7C7C7C",border:{left:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#7C7C7C"},column:{fill:"#7C7C7C"}},TableStyleDark5:{whole:{color:"#FFFFFF",fill:"#FFC000"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#BF9000",border:{right:{style:"medium",color:"#FFFFFF"}}},last:{bold:!0,color:"#FFFFFF",fill:"#BF9000",border:{left:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#BF9000"},column:{fill:"#BF9000"}},TableStyleDark6:{whole:{color:"#FFFFFF",fill:"#5B9BD5"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#2E75B6",border:{right:{style:"medium",color:"#FFFFFF"}}},last:{bold:!0,color:"#FFFFFF",fill:"#2E75B6",border:{left:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#2E75B6"},column:{fill:"#2E75B6"}},TableStyleDark7:{whole:{color:"#FFFFFF",fill:"#70AD47"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#548235",border:{right:{style:"medium",color:"#FFFFFF"}}},last:{bold:!0,color:"#FFFFFF",fill:"#548235",border:{left:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#548235"},column:{fill:"#548235"}},TableStyleDark8:{whole:{fill:"#D9D9D9"},header:{color:"#FFFFFF",fill:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#A6A6A6"},column:{fill:"#A6A6A6"}},TableStyleDark9:{whole:{fill:"#DAE3F3"},header:{color:"#FFFFFF",fill:"#ED7D31"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#B4C7E7"},column:{fill:"#B4C7E7"}},TableStyleDark10:{whole:{fill:"#EDEDED"},header:{color:"#FFFFFF",fill:"#FFC000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#DBDBDB"},column:{fill:"#DBDBDB"}},TableStyleDark11:{whole:{fill:"#DEEBF7"},header:{color:"#FFFFFF",fill:"#70AD47"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#BDD7EE"},column:{fill:"#BDD7EE"}},TableStyleLight1:{whole:{color:"#000000",border:{top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"thin",color:"#000000"}}},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleLight2:{whole:{color:"#2F5597",border:{top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#2F5597",border:{bottom:{style:"thin",color:"#4472C4"}}},first:{bold:!0,color:"#2F5597"},last:{bold:!0,color:"#2F5597"},stripe:{fill:"#DAE3F3"},column:{fill:"#DAE3F3"}},TableStyleLight3:{whole:{color:"#C55A11",border:{top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#C55A11",border:{bottom:{style:"thin",color:"#ED7D31"}}},first:{bold:!0,color:"#C55A11"},last:{bold:!0,color:"#C55A11"},stripe:{fill:"#FBE5D6"},column:{fill:"#FBE5D6"}},TableStyleLight4:{whole:{color:"#7C7C7C",border:{top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#7C7C7C",border:{bottom:{style:"thin",color:"#A5A5A5"}}},first:{bold:!0,color:"#7C7C7C"},last:{bold:!0,color:"#7C7C7C"},stripe:{fill:"#EDEDED"},column:{fill:"#EDEDED"}},TableStyleLight5:{whole:{color:"#BF9000",border:{top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#BF9000",border:{bottom:{style:"thin",color:"#FFC000"}}},first:{bold:!0,color:"#BF9000"},last:{bold:!0,color:"#BF9000"},stripe:{fill:"#FFF2CC"},column:{fill:"#FFF2CC"}},TableStyleLight6:{whole:{color:"#2E75B6",border:{top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#2E75B6",border:{bottom:{style:"thin",color:"#5B9BD5"}}},first:{bold:!0,color:"#2E75B6"},last:{bold:!0,color:"#2E75B6"},stripe:{fill:"#DEEBF7"},column:{fill:"#DEEBF7"}},TableStyleLight7:{whole:{color:"#548235",border:{top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#548235",border:{bottom:{style:"thin",color:"#70AD47"}}},first:{bold:!0,color:"#548235"},last:{bold:!0,color:"#548235"},stripe:{fill:"#E2F0D9"},column:{fill:"#E2F0D9"}},TableStyleLight8:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{border:{top:{style:"thin",color:"#000000"}}},stripe2:{border:{top:{style:"thin",color:"#000000"}}},column:{border:{left:{style:"thin",color:"#000000"}}},column2:{border:{left:{style:"thin",color:"#000000"}}}},TableStyleLight9:{whole:{color:"#000000",border:{left:{style:"thin",color:"#4472C4"},right:{style:"thin",color:"#4472C4"},top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{border:{top:{style:"thin",color:"#4472C4"}}},stripe2:{border:{top:{style:"thin",color:"#4472C4"}}},column:{border:{left:{style:"thin",color:"#4472C4"}}},column2:{border:{left:{style:"thin",color:"#4472C4"}}}},TableStyleLight10:{whole:{color:"#000000",border:{left:{style:"thin",color:"#ED7D31"},right:{style:"thin",color:"#ED7D31"},top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{border:{top:{style:"thin",color:"#ED7D31"}}},stripe2:{border:{top:{style:"thin",color:"#ED7D31"}}},column:{border:{left:{style:"thin",color:"#ED7D31"}}},column2:{border:{left:{style:"thin",color:"#ED7D31"}}}},TableStyleLight11:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A5A5A5"},right:{style:"thin",color:"#A5A5A5"},top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{border:{top:{style:"thin",color:"#A5A5A5"}}},stripe2:{border:{top:{style:"thin",color:"#A5A5A5"}}},column:{border:{left:{style:"thin",color:"#A5A5A5"}}},column2:{border:{left:{style:"thin",color:"#A5A5A5"}}}},TableStyleLight12:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFC000"},right:{style:"thin",color:"#FFC000"},top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{border:{top:{style:"thin",color:"#FFC000"}}},stripe2:{border:{top:{style:"thin",color:"#FFC000"}}},column:{border:{left:{style:"thin",color:"#FFC000"}}},column2:{border:{left:{style:"thin",color:"#FFC000"}}}},TableStyleLight13:{whole:{color:"#000000",border:{left:{style:"thin",color:"#5B9BD5"},right:{style:"thin",color:"#5B9BD5"},top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{border:{top:{style:"thin",color:"#5B9BD5"}}},stripe2:{border:{top:{style:"thin",color:"#5B9BD5"}}},column:{border:{left:{style:"thin",color:"#5B9BD5"}}},column2:{border:{left:{style:"thin",color:"#5B9BD5"}}}},TableStyleLight14:{whole:{color:"#000000",border:{left:{style:"thin",color:"#70AD47"},right:{style:"thin",color:"#70AD47"},top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{border:{top:{style:"thin",color:"#70AD47"}}},stripe2:{border:{top:{style:"thin",color:"#70AD47"}}},column:{border:{left:{style:"thin",color:"#70AD47"}}},column2:{border:{left:{style:"thin",color:"#70AD47"}}}},TableStyleLight15:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#000000"}}},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleLight16:{whole:{color:"#000000",border:{left:{style:"thin",color:"#4472C4"},right:{style:"thin",color:"#4472C4"},top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"},horizontal:{style:"thin",color:"#4472C4"},vertical:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#4472C4"}}},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#DAE3F3"},column:{fill:"#DAE3F3"}},TableStyleLight17:{whole:{color:"#000000",border:{left:{style:"thin",color:"#ED7D31"},right:{style:"thin",color:"#ED7D31"},top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"},horizontal:{style:"thin",color:"#ED7D31"},vertical:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#ED7D31"}}},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#FBE5D6"},column:{fill:"#FBE5D6"}},TableStyleLight18:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A5A5A5"},right:{style:"thin",color:"#A5A5A5"},top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"},horizontal:{style:"thin",color:"#A5A5A5"},vertical:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#A5A5A5"}}},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#EDEDED"},column:{fill:"#EDEDED"}},TableStyleLight19:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFC000"},right:{style:"thin",color:"#FFC000"},top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"},horizontal:{style:"thin",color:"#FFC000"},vertical:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#FFC000"}}},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#FFF2CC"},column:{fill:"#FFF2CC"}},TableStyleLight20:{whole:{color:"#000000",border:{left:{style:"thin",color:"#5B9BD5"},right:{style:"thin",color:"#5B9BD5"},top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"},horizontal:{style:"thin",color:"#5B9BD5"},vertical:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#5B9BD5"}}},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#DEEBF7"},column:{fill:"#DEEBF7"}},TableStyleLight21:{whole:{color:"#000000",border:{left:{style:"thin",color:"#70AD47"},right:{style:"thin",color:"#70AD47"},top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"},horizontal:{style:"thin",color:"#70AD47"},vertical:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#70AD47"}}},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#E2F0D9"},column:{fill:"#E2F0D9"}},TableStyleMedium1:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleMedium2:{whole:{color:"#000000",border:{left:{style:"thin",color:"#8FAADC"},right:{style:"thin",color:"#8FAADC"},top:{style:"thin",color:"#8FAADC"},bottom:{style:"thin",color:"#8FAADC"},horizontal:{style:"thin",color:"#8FAADC"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#DAE3F3"},column:{fill:"#DAE3F3"}},TableStyleMedium3:{whole:{color:"#000000",border:{left:{style:"thin",color:"#F4B183"},right:{style:"thin",color:"#F4B183"},top:{style:"thin",color:"#F4B183"},bottom:{style:"thin",color:"#F4B183"},horizontal:{style:"thin",color:"#F4B183"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#FBE5D6"},column:{fill:"#FBE5D6"}},TableStyleMedium4:{whole:{color:"#000000",border:{left:{style:"thin",color:"#C9C9C9"},right:{style:"thin",color:"#C9C9C9"},top:{style:"thin",color:"#C9C9C9"},bottom:{style:"thin",color:"#C9C9C9"},horizontal:{style:"thin",color:"#C9C9C9"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#EDEDED"},column:{fill:"#EDEDED"}},TableStyleMedium5:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFD966"},right:{style:"thin",color:"#FFD966"},top:{style:"thin",color:"#FFD966"},bottom:{style:"thin",color:"#FFD966"},horizontal:{style:"thin",color:"#FFD966"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#FFF2CC"},column:{fill:"#FFF2CC"}},TableStyleMedium6:{whole:{color:"#000000",border:{left:{style:"thin",color:"#9DC3E6"},right:{style:"thin",color:"#9DC3E6"},top:{style:"thin",color:"#9DC3E6"},bottom:{style:"thin",color:"#9DC3E6"},horizontal:{style:"thin",color:"#9DC3E6"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#DEEBF7"},column:{fill:"#DEEBF7"}},TableStyleMedium7:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A9D18E"},right:{style:"thin",color:"#A9D18E"},top:{style:"thin",color:"#A9D18E"},bottom:{style:"thin",color:"#A9D18E"},horizontal:{style:"thin",color:"#A9D18E"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#E2F0D9"},column:{fill:"#E2F0D9"}},TableStyleMedium8:{whole:{color:"#000000",fill:"#D9D9D9",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"thick",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#000000"},last:{bold:!0,color:"#FFFFFF",fill:"#000000"},stripe:{fill:"#A6A6A6"},column:{fill:"#A6A6A6"}},TableStyleMedium9:{whole:{color:"#000000",fill:"#DAE3F3",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4",border:{bottom:{style:"thick",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},last:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},stripe:{fill:"#B4C7E7"},column:{fill:"#B4C7E7"}},TableStyleMedium10:{whole:{color:"#000000",fill:"#FBE5D6",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31",border:{bottom:{style:"thick",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},last:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},stripe:{fill:"#F8CBAD"},column:{fill:"#F8CBAD"}},TableStyleMedium11:{whole:{color:"#000000",fill:"#EDEDED",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5",border:{bottom:{style:"thick",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},last:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},stripe:{fill:"#DBDBDB"},column:{fill:"#DBDBDB"}},TableStyleMedium12:{whole:{color:"#000000",fill:"#FFF2CC",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000",border:{bottom:{style:"thick",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},last:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},stripe:{fill:"#FFE699"},column:{fill:"#FFE699"}},TableStyleMedium13:{whole:{color:"#000000",fill:"#DEEBF7",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5",border:{bottom:{style:"thick",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},last:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},stripe:{fill:"#BDD7EE"},column:{fill:"#BDD7EE"}},TableStyleMedium14:{whole:{color:"#000000",fill:"#E2F0D9",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47",border:{bottom:{style:"thick",color:"#FFFFFF"}}},first:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},last:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},stripe:{fill:"#C5E0B4"},column:{fill:"#C5E0B4"}},TableStyleMedium15:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#000000"}}},first:{bold:!0,color:"#FFFFFF",fill:"#000000"},last:{bold:!0,color:"#FFFFFF",fill:"#000000"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleMedium16:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4",border:{bottom:{style:"medium",color:"#000000"}}},first:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},last:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleMedium17:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31",border:{bottom:{style:"medium",color:"#000000"}}},first:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},last:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleMedium18:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5",border:{bottom:{style:"medium",color:"#000000"}}},first:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},last:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleMedium19:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000",border:{bottom:{style:"medium",color:"#000000"}}},first:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},last:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleMedium20:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5",border:{bottom:{style:"medium",color:"#000000"}}},first:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},last:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleMedium21:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47",border:{bottom:{style:"medium",color:"#000000"}}},first:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},last:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},stripe:{fill:"#D9D9D9"},column:{fill:"#D9D9D9"}},TableStyleMedium22:{whole:{color:"#000000",fill:"#D9D9D9",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#A6A6A6"},column:{fill:"#A6A6A6"}},TableStyleMedium23:{whole:{color:"#000000",fill:"#DAE3F3",border:{left:{style:"thin",color:"#8FAADC"},right:{style:"thin",color:"#8FAADC"},top:{style:"thin",color:"#8FAADC"},bottom:{style:"thin",color:"#8FAADC"},horizontal:{style:"thin",color:"#8FAADC"},vertical:{style:"thin",color:"#8FAADC"}}},header:{bold:!0,color:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#B4C7E7"},column:{fill:"#B4C7E7"}},TableStyleMedium24:{whole:{color:"#000000",fill:"#FBE5D6",border:{left:{style:"thin",color:"#F4B183"},right:{style:"thin",color:"#F4B183"},top:{style:"thin",color:"#F4B183"},bottom:{style:"thin",color:"#F4B183"},horizontal:{style:"thin",color:"#F4B183"},vertical:{style:"thin",color:"#F4B183"}}},header:{bold:!0,color:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#F8CBAD"},column:{fill:"#F8CBAD"}},TableStyleMedium25:{whole:{color:"#000000",fill:"#EDEDED",border:{left:{style:"thin",color:"#C9C9C9"},right:{style:"thin",color:"#C9C9C9"},top:{style:"thin",color:"#C9C9C9"},bottom:{style:"thin",color:"#C9C9C9"},horizontal:{style:"thin",color:"#C9C9C9"},vertical:{style:"thin",color:"#C9C9C9"}}},header:{bold:!0,color:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#DBDBDB"},column:{fill:"#DBDBDB"}},TableStyleMedium26:{whole:{color:"#000000",fill:"#FFF2CC",border:{left:{style:"thin",color:"#FFD966"},right:{style:"thin",color:"#FFD966"},top:{style:"thin",color:"#FFD966"},bottom:{style:"thin",color:"#FFD966"},horizontal:{style:"thin",color:"#FFD966"},vertical:{style:"thin",color:"#FFD966"}}},header:{bold:!0,color:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#FFE699"},column:{fill:"#FFE699"}},TableStyleMedium27:{whole:{color:"#000000",fill:"#DEEBF7",border:{left:{style:"thin",color:"#9DC3E6"},right:{style:"thin",color:"#9DC3E6"},top:{style:"thin",color:"#9DC3E6"},bottom:{style:"thin",color:"#9DC3E6"},horizontal:{style:"thin",color:"#9DC3E6"},vertical:{style:"thin",color:"#9DC3E6"}}},header:{bold:!0,color:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#BDD7EE"},column:{fill:"#BDD7EE"}},TableStyleMedium28:{whole:{color:"#000000",fill:"#E2F0D9",border:{left:{style:"thin",color:"#A9D18E"},right:{style:"thin",color:"#A9D18E"},top:{style:"thin",color:"#A9D18E"},bottom:{style:"thin",color:"#A9D18E"},horizontal:{style:"thin",color:"#A9D18E"},vertical:{style:"thin",color:"#A9D18E"}}},header:{bold:!0,color:"#000000"},first:{bold:!0,color:"#000000"},last:{bold:!0,color:"#000000"},stripe:{fill:"#C5E0B4"},column:{fill:"#C5E0B4"}}};
@@ -1,4 +1,4 @@
1
- import type { SheetChart, SheetConditional, SheetFile, SheetFilesColumn, SheetFilterColumn, SheetFormatEntry, SheetTable, SheetTableColumn, SheetValidation, SheetWorksheet } from "@allyhub/formats";
1
+ import type { SheetChart, SheetConditional, SheetFile, SheetFilesColumn, SheetFilterColumn, SheetFormatEntry, SheetRun, SheetTable, SheetTableColumn, SheetValidation, SheetWorksheet } from "@allyhub/formats";
2
2
  import { rangeName, type Area, type Place } from "./address.js";
3
3
  import { type SheetProblem, type YamlPath } from "./file.js";
4
4
  import { type GeneratedSheets } from "@allyhub/formats";
@@ -227,6 +227,8 @@ export declare class Worksheet {
227
227
  }[];
228
228
  /** The format and look that hold for a cell, from the file's less specific places to its own. */
229
229
  lookAt(row: number, col: number): CellLook;
230
+ /** A cell's rich text: its runs, when sheet.yaml gives them. */
231
+ runsAt(row: number, col: number): readonly SheetRun[] | undefined;
230
232
  /** The merge a place is in. */
231
233
  mergeAt(row: number, col: number): Area | undefined;
232
234
  /** The data validation that holds for a place. */
@@ -318,6 +320,8 @@ export declare const MAX_FILL_CELLS = 5000000;
318
320
  export declare function validName(name: string): boolean;
319
321
  /** A chart's reference as a formula. */
320
322
  export declare const chartFormula: (text: string) => string;
323
+ /** A cell's text from its runs. */
324
+ export declare const runsText: (runs: readonly SheetRun[]) => string;
321
325
  /** A workbook from its files, and what is wrong with them that reading can tell. */
322
326
  export declare function readWorkbook(files: WorkbookFiles): ReadWorkbook;
323
327
  /** A workbook from what an editor holds, with no file to read: its CSV rows as they stand. */
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{SHEET_SEPARATOR as P}from"@allyhub/formats";import{MAX_ROWS as B,cellName as U,columnIndex as C,columnLetter as z,contains as y,overlaps as v,rangeName as D,readAddress as E,readArea as $,readAreas as j}from"./address.js";import{readCsv as _}from"@allyhub/formats";import{CODE as R,ENTRY as A,readSheetFile as G}from"./file.js";import{withGenerated as O}from"./generated.js";import"@allyhub/formats";import{moveFormula as H}from"./formula/move.js";import{parseFormula as X}from"./formula/parse.js";import{printFormula as Y}from"./formula/print.js";import{readTyped as x}from"./values.js";export class SharedFormula{node;error;analysis;text;row;col;source;constructor(e,t,s,n){this.text=e,this.row=t,this.col=s,this.source=n;const i=X(e);i.ok?this.node=i.node:this.error=i.error}}export class FormulaCell{value=null;array;spill;blocked;state=1;mark=0;shared;sheet;row;col;constructor(e,t,s,n){this.shared=e,this.sheet=t,this.row=s,this.col=n}get moved(){const{node:e,row:t,col:s}=this.shared;if(!e)throw new Error(`${this.shared.text} does not parse.`);return H(e,this.row-t,this.col-s)}get text(){const{node:e,text:t,row:s,col:n}=this.shared;return!e||s===this.row&&n===this.col?t:Y(this.moved)}}class Z{columns=[];firsts=[];lasts=[];formulas=[];get(e,t){return this.columns[t]?.[e]}set(e,t,s){let n=this.columns[t];n||(n=[],this.columns[t]=n,this.firsts[t]=e,this.lasts[t]=e),n[e]instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??1)-1),s instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??0)+1),n[e]=s,e<(this.firsts[t]??e)&&(this.firsts[t]=e),e>(this.lasts[t]??e)&&(this.lasts[t]=e)}get width(){return this.columns.length}holds(e,t,s){const n=Math.min(e.right,this.columns.length-1);for(let i=e.left;i<=n;i++){const r=this.columns[i];if(!r)continue;const a=Math.min(e.bottom,this.last(i));for(let o=Math.max(e.top,this.first(i));o<=a;o++)if(r[o]!==void 0&&!(o===t&&i===s))return!0}return!1}first(e){return this.firsts[e]??1/0}last(e){return this.lasts[e]??-1}hasFormulas(e){return(this.formulas[e]??0)>0}}export class Table{columns=[];rows=0;lines=[];places=[];records=[];name;sheet;at;file;spec;constructor(e,t,s,n,i){this.name=e,this.sheet=t,this.at=s,this.file=n,this.spec=i}get area(){return{top:this.at.row,left:this.at.col,bottom:this.at.row+this.rows,right:this.at.col+Math.max(this.columns.length,1)-1}}get data(){const e=this.area;return{...e,top:e.top+1}}column(e){const t=e.toLowerCase();return this.columns.find(s=>s.name.toLowerCase()===t)}}export const placeKey=(l,e)=>l*16384+e;function F(l,e){l.bottom=Math.max(l.bottom,e.bottom),l.right=Math.max(l.right,e.right);for(let t=e.left;t<=e.right;t++){const s=l.columns.get(t);l.columns.set(t,[Math.min(s?.[0]??e.top,e.top),Math.max(s?.[1]??e.bottom,e.bottom)])}}export class Worksheet{tables=[];blocks=[];merges=[];formulas=new Set;implied=new Map;keys=new Map;fills=[];blanks=new Set;conditions=[];validations=[];filters=[];charts=[];names=new Map;freeze;generated=!1;grid=new Z;expanded=!1;lowest=-1;ghosts=new Map;spills=new Set;stopped=new Set;reach;lookAreas;name;index;spec;constructor(e,t,s){this.name=e,this.index=t,this.spec=s}respec(e){const t=e.charts!==this.spec.charts;this.spec=e,this.lookAreas=void 0,t&&(this.charts.length=0,e.charts?.forEach((s,n)=>{const i=W(s,n,[],()=>{});i&&this.charts.push(i)}))}put(e,t,s){s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}replace(e,t,s){this.expand();const n=this.grid.get(e,t);n instanceof FormulaCell&&this.formulas.delete(n),s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}expand(){if(!this.expanded){this.expanded=!0;for(let e=this.fills.length-1;e>=0;e--){const t=this.fills[e];if(!t)continue;const{area:s,shared:n,value:i,format:r,start:a}=t;for(let o=s.top;o<=s.bottom;o++)for(let f=s.left;f<=s.right;f++)if(this.grid.get(o,f)===void 0&&!this.blanks.has(placeKey(o,f)))if(n){const h=new FormulaCell(n,this,o,f);a!==void 0&&(h.value=a),this.put(o,f,h)}else i!=null&&(this.put(o,f,i),r!==void 0&&this.implied.set(placeKey(o,f),r))}}}at(e,t){return this.expand(),this.grid.get(e,t)}spillAt(e,t){return this.ghosts.size===0?void 0:this.ghosts.get(placeKey(e,t))}holds(e,t){return this.expand(),this.grid.holds(e,t.row,t.col)}spillsIn(e){if(this.spills.size===0)return[];if((e.bottom-e.top+1)*(e.right-e.left+1)>=this.spills.size)return[...this.spills].filter(n=>n.spill!==void 0&&v(n.spill,e));const s=new Set;for(let n=e.top;n<=e.bottom;n++)for(let i=e.left;i<=e.right;i++){const r=this.ghosts.get(placeKey(n,i));r&&s.add(r)}return[...s]}blockedBy(e){if(this.stopped.size===0)return[];const t=[];for(const s of this.stopped)s.blocked&&v(s.blocked,e)&&t.push(s);return t}placeSpill(e,t){e.spill=t,this.spills.add(e);for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)(s!==e.row||n!==e.col)&&this.ghosts.set(placeKey(s,n),e);this.reach&&F(this.reach,t)}blockSpill(e,t){e.blocked=t,this.stopped.add(e)}clearSpill(e){const t=e.spill;if(t)for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)this.ghosts.get(placeKey(s,n))===e&&this.ghosts.delete(placeKey(s,n));e.spill=void 0,e.blocked=void 0,this.spills.delete(e),this.stopped.delete(e)}clearSpills(){for(const e of[...this.spills,...this.stopped])e.spill=void 0,e.blocked=void 0;this.spills.clear(),this.stopped.clear(),this.ghosts.clear(),this.reach=void 0}tighten(){this.reach=void 0}spillReach(){if(this.reach)return this.reach;const e={columns:new Map,bottom:-1,right:-1};for(const{spill:t}of this.spills)t&&F(e,t);return this.reach=e,e}hasFormulas(e){return this.expand(),this.grid.hasFormulas(e)}span(e,t,s){this.expand();const n=this.grid.first(e),i=this.grid.last(e);if(this.spills.size===0)return[Math.max(t,n),Math.min(s,i)];const[r,a]=this.spillReach().columns.get(e)??[1/0,-1];return[Math.max(t,Math.min(n,r)),Math.min(s,Math.max(i,a))]}get columnsUsed(){return this.expand(),this.spills.size===0?this.grid.width:Math.max(this.grid.width,this.spillReach().right+1)}get lastRow(){return this.expand(),this.spills.size===0?this.lowest:Math.max(this.lowest,this.spillReach().bottom)}get used(){const e=this.lastRow,t=this.columnsUsed-1;return e<0||t<0?void 0:{top:0,left:0,bottom:e,right:t}}tableAt(e,t){return this.tables.find(s=>y(s.area,e,t))}blockAt(e,t){return this.blocks.find(s=>y(s.area,e,t))}looks(){if(this.lookAreas)return this.lookAreas;const e=[];for(const s of this.spec.format??[]){const n=$(s.range);n&&e.push({area:n,entry:s})}const t=[];for(const[s,n]of Object.entries(this.spec.cells??{})){if(!s.includes(":")||n===null||typeof n!="object")continue;const i=$(s);i&&t.push({area:i,entry:n})}return this.lookAreas={formats:e,ranges:t},this.lookAreas}styledAreas(){const{formats:e,ranges:t}=this.looks();return[...e,...t.filter(s=>Object.keys(s.entry).some(n=>N.has(n)))]}lookAt(e,t){const s={},n=c=>{if(c)for(const[b,w]of Object.entries(c))N.has(b)&&w!==void 0&&(s[b]=b==="border"?{...s.border,...w}:w)},i=this.implied.get(placeKey(e,t));i!==void 0&&(s.format=i);const r=this.ghosts.size===0?void 0:this.spillAt(e,t),a=r&&this.lookAt(r.row,r.col).format;a!==void 0&&(s.format=a),this.spec.columns&&n(this.spec.columns[z(t)]),this.spec.rows&&n(this.spec.rows[String(e+1)]);const o=this.tableAt(e,t);o&&e>o.at.row&&n(o.columns[t-o.at.col]?.spec);const{formats:f,ranges:h}=this.looks();for(const c of f)y(c.area,e,t)&&n(c.entry);for(const c of h)y(c.area,e,t)&&n(c.entry);const d=this.keys.get(placeKey(e,t)),g=d===void 0?void 0:this.spec.cells?.[d];if(g!==null&&typeof g=="object"&&n(g),s.border){const c=Object.entries(s.border).filter(([,b])=>b?.style!=="none");c.length===0?delete s.border:s.border=Object.fromEntries(c)}return s}mergeAt(e,t){return this.merges.find(s=>y(s,e,t))}validationAt(e,t){return this.validations.find(s=>s.areas.some(n=>y(n,e,t)))}filterHeadAt(e,t){return this.filters.find(s=>e===s.area.top&&t>=s.area.left&&t<=s.area.right)}filterAt(e,t){return this.filters.find(s=>y(s.area,e,t))}filesAt(e,t){const s=this.tableAt(e,t);if(s&&e>s.at.row){const n=s.columns[t-s.at.col]?.spec?.files;if(n!==void 0)return n}return s?.at.row===e?void 0:this.spec.columns?.[z(t)]?.files}}export const filesSeparator=l=>(typeof l=="object"?l.separator:void 0)??P;export function filesIn(l,e){const t=filesSeparator(e);return l.split(t.trim()===""?t:t.trim()).map(s=>s.trim()).filter(s=>s!=="")}const N=new Set(["bold","italic","underline","strike","font","size","color","fill","align","valign","wrap","shrink","indent","rotation","border","format"]);export class Workbook{title;sheets=[];names=new Map;checks=[];bySheet=new Map;byTable=new Map;file;generated;ordinary=[];constructor(e,t){this.file=e,this.title=e.title,this.generated=t}respec(e){this.file=O(e,this.generated).file,this.title=e.title,this.sheets.forEach(t=>{const s=e.sheets.find(n=>n.name===t.name);s&&t.respec(s)})}sheet(e){return this.bySheet.get(e.toLowerCase())}table(e){return this.byTable.get(e.toLowerCase())}name(e,t){const s=e.toLowerCase();return(t?.names.size?t.names.get(s):void 0)??this.names.get(s)}definitions(e){const t=e.toLowerCase(),s=[],n=this.names.get(t);n&&s.push(n);for(const i of this.sheets){const r=i.names.get(t);r&&s.push(r)}return s}get tables(){return[...this.byTable.values()]}addSheet(e){this.sheets.push(e),this.bySheet.set(e.name.toLowerCase(),e)}addTable(e){e.sheet.tables.push(e),this.byTable.set(e.name.toLowerCase(),e)}sourceOf(e,t,s){if(e.generated)return{file:R};const n=this.sheets.indexOf(e),i=e.tableAt(t,s);if(i){const o=i.columns[s-i.at.col],f=t-i.at.row-1,h=o?.csv!==void 0&&(i.records[f]?.[o.csv]??"")!=="";return f>=0&&o?.formula&&!h?o.formula.source:{file:i.file,line:f<0?1:i.lines[f]??1}}const r=e.blockAt(t,s);if(r)return{file:r.file,line:r.lines[t-r.area.top]??1};const a=e.keys.get(placeKey(t,s));if(a!==void 0)return{file:A,path:["sheets",n,"cells",a]};for(const o of Object.keys(e.spec.cells??{})){if(!o.includes(":"))continue;const f=$(o);if(f&&y(f,t,s))return{file:A,path:["sheets",n,"cells",o]}}}}export const MAX_FILL_CELLS=5e6;const q=/^[\p{L}_\\][\p{L}\p{N}_.\\?]*$/u;export function validName(l){return q.test(l)&&E(l)===void 0&&!/^(?:TRUE|FALSE)$/iu.test(l)&&!/^[Rr](?:\d+)?(?:[Cc]\d*)?$/u.test(l)&&!/^[Cc]\d*$/u.test(l)}const M="made",k=l=>l[0]===M?R:A;class T{problems=[];wb;read_;lineOf;own;madeNames;constructor(e,t,s,n,i){this.wb=e,this.read_=t,this.lineOf=s,this.own=n,this.madeNames=i}yaml(e,t){const s=this.lineOf(e);this.problems.push({file:k(e),...s===void 0?{}:{line:s},message:t})}sheetPath(e){return e<this.own?["sheets",e]:[M,"sheets",e-this.own]}read(){const{file:e}=this.wb;e.sheets.forEach((t,s)=>{const n=this.sheetPath(s);if(this.wb.sheet(t.name)){this.yaml([...n,"name"],`two sheets are named ${t.name}`);return}(/[\\/?*[\]:]/u.test(t.name)||t.name.length>31)&&this.yaml([...n,"name"],`${t.name} cannot be a sheet's name: at most 31 characters, none of \\ / ? * [ ] :`);const i=new Worksheet(t.name,this.wb.sheets.length,t);i.generated=s>=this.own,this.wb.addSheet(i)}),this.names();for(const[t,s]of e.sheets.entries()){const n=this.wb.sheets[t];n?.spec===s&&this.sheet(n,this.sheetPath(t))}e.checks?.forEach((t,s)=>{const n={file:A,path:["checks",s,"formula"]};this.wb.checks.push({name:t.name,formula:new SharedFormula(t.formula,0,0,n),source:n})})}names(){const{file:e}=this.wb;this.namesOf(e.names,e.hidden_names,t=>this.madeNames.has(t)?[M,"names",t]:["names",t],this.wb.names,void 0),e.sheets.forEach((t,s)=>{const n=this.wb.sheets[s];n?.spec===t&&this.namesOf(t.names,t.hidden_names,i=>[...this.sheetPath(s),"names",i],n.names,n)})}namesOf(e,t,s,n,i){const r=new Set(t?.map(a=>a.toLowerCase()));for(const[a,o]of Object.entries(e??{})){const f=s(a);if(!validName(a)){this.yaml(f,`${a} cannot be a name`);continue}const h={file:k(f),path:f},d=typeof o=="string"&&o.startsWith("=")?{name:a,formula:new SharedFormula(o,0,0,h),source:h}:{name:a,value:typeof o=="string"?x(o).value:o,source:h};i&&(d.sheet=i),r.has(a.toLowerCase())&&(d.hidden=!0),n.set(a.toLowerCase(),d)}}sheet(e,t){const{spec:s}=e;if(s.freeze!==void 0){const n=E(s.freeze);n?e.freeze=n:this.yaml([...t,"freeze"],`${s.freeze} is not a cell`)}s.tables?.forEach((n,i)=>{this.table(e,n,[...t,"tables",i])});for(const[n,i]of e.tables.entries())for(const r of e.tables.slice(n+1))v(i.area,r.area)&&this.problems.push({file:A,message:`tables ${i.name} and ${r.name} overlap on ${e.name}`});s.blocks?.forEach((n,i)=>{this.block(e,n.at,n.rows,[...t,"blocks",i])}),this.cells(e,s.cells??{},[...t,"cells"]),s.merges?.forEach((n,i)=>{const r=$(n);r?e.merges.push(r):this.yaml([...t,"merges",i],`${n} is not a range`)}),s.format?.forEach((n,i)=>{$(n.range)||this.yaml([...t,"format",i,"range"],`${n.range} is not a range`)}),s.conditional?.forEach((n,i)=>{this.condition(e,n,[...t,"conditional",i])}),s.validations?.forEach((n,i)=>{this.validation(e,n,[...t,"validations",i])}),this.filters(e,t),s.charts?.forEach((n,i)=>{this.chart(e,n,i,[...t,"charts",i])});for(const n of Object.keys(s.columns??{}))C(n)===void 0&&this.yaml([...t,"columns",n],`${n} is not a column`);for(const n of Object.keys(s.rows??{}))(!/^[1-9]\d*$/u.test(n)||Number(n)>B)&&this.yaml([...t,"rows",n],`${n} is not a row`)}chart(e,t,s,n){const i=W(t,s,n,(r,a)=>{this.yaml(r,a)});i&&e.charts.push(i)}bound(e,t,s){if(!(typeof e!="string"||!e.startsWith("=")||e.length<2))return new SharedFormula(e,t?.top??0,t?.left??0,{file:k(s),path:s})}condition(e,t,s){const n=j(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const[i]=n,r=[],a=(o,f)=>{const h=this.bound(o,i,f);h&&r.push(h)};if(t.type==="expression"){const o=t.formula.startsWith("=")?t.formula:`=${t.formula}`;a(o,[...s,"formula"])}if(t.type==="cellIs"&&t.formula.forEach((o,f)=>{a(o,[...s,"formula",f])}),t.type==="dataBar")for(const o of["min","max"])a(t[o]?.value,[...s,o,"value"]);(t.type==="colorScale"||t.type==="iconSet")&&t.stops?.forEach((o,f)=>{a(o.value,[...s,"stops",f,"value"])}),e.conditions.push({spec:t,areas:n,formulas:r})}validation(e,t,s){const n=j(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const i=(t.formula??[]).map((o,f)=>this.bound(o,n[0],[...s,"formula",f])),r=t.formula?.length??0,a=t.type!=="list"&&t.type!=="custom"&&(t.operator===void 0||t.operator==="between"||t.operator==="notBetween");!(t.type==="list"&&t.values!==void 0)&&r<(a?2:1)&&this.yaml(s,`a ${t.type} validation needs its bounds`),e.validations.push({spec:t,areas:n,formulas:i})}filters(e,t){const{spec:s}=e;if(s.filter){const n=[...t,"filter"],i=$(s.filter.range);if(!i)this.yaml([...n,"range"],`${s.filter.range} is not a range`);else{const r=new Map;for(const[o,f]of Object.entries(s.filter.columns??{})){const h=C(o);h===void 0||h<i.left||h>i.right?this.yaml([...n,"columns",o],`${o} is not a column of ${s.filter.range}`):r.set(h,f)}const a=e.tables.find(o=>v(o.area,i));a&&this.yaml(n,`a filter over table ${a.name}: a table has its own`),e.filters.push({area:i,columns:r})}}e.tables.forEach((n,i)=>{const{filter:r}=n.spec;if(r===!1)return;const a=new Map;for(const[o,f]of Object.entries(r?.columns??{})){const h=n.column(o);h?a.set(n.at.col+h.index,f):this.yaml([...t,"tables",i,"filter","columns",o],`table ${n.name} has no column ${o}`)}e.filters.push({area:n.area,table:n,columns:a})})}csv(e,t,s){const n=this.read_(e);return n||this.yaml(t,`${s}: ${e} is not there`),n}overlapping(e,t){const s=e.tables.find(i=>v(i.area,t));if(s)return`table ${s.name}`;const n=e.blocks.find(i=>v(i.area,t));return n?`the block of ${n.file}`:void 0}typed(e,t,s,n,i){if(n.formula!==void 0){const r=new SharedFormula(n.formula,t,s,i),a=new FormulaCell(r,e,t,s);n.start!==void 0&&(a.value=n.start),e.put(t,s,a);return}n.value!==null&&(e.put(t,s,n.value),n.format!==void 0&&e.implied.set(placeKey(t,s),n.format))}table(e,t,s){const n=E(t.at);if(!n){this.yaml([...s,"at"],`${t.at} is not a cell`);return}if(!validName(t.name)){this.yaml([...s,"name"],`${t.name} cannot be a table's name`);return}if(this.wb.table(t.name)){this.yaml([...s,"name"],`two tables are named ${t.name}`);return}this.wb.name(t.name)&&this.yaml([...s,"name"],`${t.name} is a defined name and a table's`);const i=new Table(t.name,e,n,t.rows,t),r=this.csv(t.rows,[...s,"rows"],`table ${t.name}`),a=r?.rows??[],o=r?.lines??[],f=a[0],h=o[0]??1,d=new Set,g=f?.length===0?[""]:f??[];g.forEach((u,m)=>{const p=u.trim();p===""&&this.problems.push({file:t.rows,line:h,message:`column ${String(m+1)} has no name`}),d.has(p.toLowerCase())&&this.problems.push({file:t.rows,line:h,message:`two columns are named ${p}`}),d.add(p.toLowerCase()),i.columns.push({name:p,index:i.columns.length,csv:m})});for(const[u,m]of Object.entries(t.columns??{})){const p=i.column(u),S=p??{name:u,index:i.columns.length};p||(m.formula===void 0&&this.yaml([...s,"columns",u],`table ${t.name} has no column ${u}`),i.columns.push(S)),S.spec=m}const c=g.length;for(let u=1;u<a.length;u++){const m=a[u];if(!m||m.length===0)continue;const p=o[u]??u+1;i.places.push(u),i.records.push(m),i.lines.push(p),m.length>c&&this.problems.push({file:t.rows,line:p,message:`this row has ${String(m.length)} fields and the header ${String(c)}`})}i.rows=i.records.length;const b=this.overlapping(e,i.area);b&&this.yaml(s,`table ${t.name} overlaps ${b} on ${e.name}`),this.wb.addTable(i),this.tableKey(i,s);const w=n.row+1;i.columns.forEach(u=>{const m=n.col+u.index;e.put(n.row,m,u.name);const p=u.spec?.formula;p!==void 0&&(u.formula=new SharedFormula(p,w,m,{file:k(s),path:[...s,"columns",u.name,"formula"]}),i.rows>0&&e.fills.push({area:{top:w,left:m,bottom:w+i.rows-1,right:m},shared:u.formula})),u.csv!==void 0&&i.records.forEach((S,L)=>{this.typed(e,w+L,m,x(S[u.csv??0]??""),{file:t.rows,line:i.lines[L]??1})})})}tableKey(e,t){const{key:s}=e.spec;if(s===void 0)return;const n=e.column(s);if(n?.csv===void 0){this.yaml([...t,"key"],`table ${e.name} has no column ${s} in ${e.file}`);return}const i=new Set;e.records.forEach((r,a)=>{const o=r[n.csv??0]??"",f=e.lines[a]??1;o===""?this.problems.push({file:e.file,line:f,message:`this row has no ${s}, table ${e.name}'s key`}):i.has(o)&&this.problems.push({file:e.file,line:f,message:`two rows have the key ${o}`}),i.add(o)})}block(e,t,s,n){const i=E(t);if(!i){this.yaml([...n,"at"],`${t} is not a cell`);return}const r=this.csv(s,[...n,"rows"],"a block");if(!r)return;const a=r.rows,o=a.map((g,c)=>r.lines[c]??c+1),f=a.reduce((g,c)=>Math.max(g,c.length),1),h={top:i.row,left:i.col,bottom:i.row+Math.max(a.length,1)-1,right:i.col+f-1},d=this.overlapping(e,h);d&&this.yaml(n,`the block of ${s} overlaps ${d} on ${e.name}`),e.blocks.push({area:h,file:s,lines:o}),a.forEach((g,c)=>{g.forEach((b,w)=>{this.typed(e,i.row+c,i.col+w,x(b),{file:s,line:o[c]??c+1})})})}cells(e,t,s){const n=[];for(const[i,r]of Object.entries(t)){const a=[...s,i],o=$(i);if(!o){this.yaml(a,`${i} is not a cell or a range`);continue}const f=this.overlapping(e,o);if(f&&this.yaml(a,`${i} overlaps ${f}`),i.includes(":")){const h=(o.bottom-o.top+1)*(o.right-o.left+1);h>MAX_FILL_CELLS?this.yaml(a,`${i} is ${String(h)} cells`):this.fill(e,o,r,a)}else n.push([i,r,{row:o.top,col:o.left}])}for(const[i,r,a]of n){const o=[...s,i],f=K(r),h=placeKey(a.row,a.col);e.keys.set(h,i),f.value===null&&f.formula===void 0&&e.blanks.add(h),this.typed(e,a.row,a.col,f,{file:k(o),path:o});const d=r!==null&&typeof r=="object"?r.name:void 0;d!==void 0&&this.cellName(e,a,d,o)}}cellName(e,t,s,n){if(!validName(s)){this.yaml(n,`${s} cannot be a name`);return}if(this.wb.name(s)){this.yaml(n,`two places are named ${s}`);return}const i={file:k(n),path:n},r=U(t).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2"),a=`='${e.name.replaceAll("'","''")}'!${r}`;this.wb.names.set(s.toLowerCase(),{name:s,formula:new SharedFormula(a,0,0,i),source:i})}fill(e,t,s,n){const i=K(s),r={file:k(n),path:n};e.fills.push(i.formula===void 0?{area:t,value:i.value,...i.format===void 0?{}:{format:i.format}}:{area:t,shared:new SharedFormula(i.formula,t.top,t.left,r),...i.start===void 0?{}:{start:i.start}})}}function W(l,e,t,s){const n=E(l.at);if(!n){s([...t,"at"],`${l.at} is not a cell`);return}const i=(o,f)=>{const h=new SharedFormula(chartFormula(o),0,0,{file:k(f),path:f});return h.node&&!I(h.node)&&s(f,`${o} is not a range or a table's column`),h},r=(o,f)=>o?.startsWith("=")===!0?i(o,f):void 0,a=r(l.title,[...t,"title"]);return{spec:l,at:n,index:e,...l.categories===void 0?{}:{categories:i(l.categories,[...t,"categories"])},...a?{title:a}:{},series:l.series.map((o,f)=>{const h=[...t,"series",f],d=r(o.name,[...h,"name"]);return{values:i(o.values,[...h,"values"]),...o.x===void 0?{}:{x:i(o.x,[...h,"x"])},...d?{name:d}:{}}})}}export const chartFormula=l=>l.startsWith("=")?l:`=${l}`;function I(l){switch(l.kind){case"error":case"ref":case"structured":case"name":return!0;case"paren":case"postfix":return I(l.arg);case"binary":return l.op===":"||l.op===",";default:return!1}}function K(l){if(l===null)return{value:null};if(typeof l=="string")return x(l);if(typeof l!="object")return{value:l};if(l.formula!==void 0)return{value:null,formula:l.formula.startsWith("=")?l.formula:`=${l.formula}`,...l.start===void 0?{}:{start:typeof l.start=="string"?x(l.start).value:l.start}};const{value:e}=l;return typeof e=="string"?x(e):{value:e??null}}export function readWorkbook(l){const e=G(l.text),t=a=>a[0]===M?void 0:e.lineOf(a);if(!e.file)return{problems:e.problems,lineOf:t};const s=O(e.file,l.generated),n=new Workbook(s.file,l.generated);n.ordinary=s.ordinary;const i=[],r=new T(n,a=>{const o=l.generated?.csv[a]??l.read(a);if(o===void 0)return;const f=_(o);for(const h of f.problems)i.push({file:a,line:h.line,message:h.message});return{rows:f.records.map(h=>h.end===h.start?[]:h.fields),lines:f.records.map(h=>h.line)}},t,s.own,s.names);return r.read(),{workbook:n,problems:[...i,...r.problems],lineOf:t}}export function workbookOf(l){const e=O(l.file,l.generated),t=new Workbook(e.file,l.generated);return t.ordinary=e.ordinary,new T(t,s=>{const n=l.generated?.csv[s];if(n!==void 0)return{rows:_(n).records.map(r=>r.end===r.start?[]:r.fields),lines:[]};const i=l.rows(s);return i&&{rows:i,lines:[]}},()=>{},e.own,e.names).read(),t}export{D as rangeName};
2
+ import{SHEET_SEPARATOR as P}from"@allyhub/formats";import{MAX_ROWS as B,cellName as U,columnIndex as C,columnLetter as j,contains as y,overlaps as v,rangeName as D,readAddress as A,readArea as $,readAreas as z}from"./address.js";import{readCsv as _}from"@allyhub/formats";import{CODE as R,ENTRY as E,readSheetFile as G}from"./file.js";import{withGenerated as O}from"./generated.js";import"@allyhub/formats";import{moveFormula as H}from"./formula/move.js";import{parseFormula as X}from"./formula/parse.js";import{printFormula as Y}from"./formula/print.js";import{readTyped as x}from"./values.js";export class SharedFormula{node;error;analysis;text;row;col;source;constructor(e,t,s,n){this.text=e,this.row=t,this.col=s,this.source=n;const i=X(e);i.ok?this.node=i.node:this.error=i.error}}export class FormulaCell{value=null;array;spill;blocked;state=1;mark=0;shared;sheet;row;col;constructor(e,t,s,n){this.shared=e,this.sheet=t,this.row=s,this.col=n}get moved(){const{node:e,row:t,col:s}=this.shared;if(!e)throw new Error(`${this.shared.text} does not parse.`);return H(e,this.row-t,this.col-s)}get text(){const{node:e,text:t,row:s,col:n}=this.shared;return!e||s===this.row&&n===this.col?t:Y(this.moved)}}class Z{columns=[];firsts=[];lasts=[];formulas=[];get(e,t){return this.columns[t]?.[e]}set(e,t,s){let n=this.columns[t];n||(n=[],this.columns[t]=n,this.firsts[t]=e,this.lasts[t]=e),n[e]instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??1)-1),s instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??0)+1),n[e]=s,e<(this.firsts[t]??e)&&(this.firsts[t]=e),e>(this.lasts[t]??e)&&(this.lasts[t]=e)}get width(){return this.columns.length}holds(e,t,s){const n=Math.min(e.right,this.columns.length-1);for(let i=e.left;i<=n;i++){const r=this.columns[i];if(!r)continue;const l=Math.min(e.bottom,this.last(i));for(let o=Math.max(e.top,this.first(i));o<=l;o++)if(r[o]!==void 0&&!(o===t&&i===s))return!0}return!1}first(e){return this.firsts[e]??1/0}last(e){return this.lasts[e]??-1}hasFormulas(e){return(this.formulas[e]??0)>0}}export class Table{columns=[];rows=0;lines=[];places=[];records=[];name;sheet;at;file;spec;constructor(e,t,s,n,i){this.name=e,this.sheet=t,this.at=s,this.file=n,this.spec=i}get area(){return{top:this.at.row,left:this.at.col,bottom:this.at.row+this.rows,right:this.at.col+Math.max(this.columns.length,1)-1}}get data(){const e=this.area;return{...e,top:e.top+1}}column(e){const t=e.toLowerCase();return this.columns.find(s=>s.name.toLowerCase()===t)}}export const placeKey=(a,e)=>a*16384+e;function T(a,e){a.bottom=Math.max(a.bottom,e.bottom),a.right=Math.max(a.right,e.right);for(let t=e.left;t<=e.right;t++){const s=a.columns.get(t);a.columns.set(t,[Math.min(s?.[0]??e.top,e.top),Math.max(s?.[1]??e.bottom,e.bottom)])}}export class Worksheet{tables=[];blocks=[];merges=[];formulas=new Set;implied=new Map;keys=new Map;fills=[];blanks=new Set;conditions=[];validations=[];filters=[];charts=[];names=new Map;freeze;generated=!1;grid=new Z;expanded=!1;lowest=-1;ghosts=new Map;spills=new Set;stopped=new Set;reach;lookAreas;name;index;spec;constructor(e,t,s){this.name=e,this.index=t,this.spec=s}respec(e){const t=e.charts!==this.spec.charts;this.spec=e,this.lookAreas=void 0,t&&(this.charts.length=0,e.charts?.forEach((s,n)=>{const i=W(s,n,[],()=>{});i&&this.charts.push(i)}))}put(e,t,s){s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}replace(e,t,s){this.expand();const n=this.grid.get(e,t);n instanceof FormulaCell&&this.formulas.delete(n),s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}expand(){if(!this.expanded){this.expanded=!0;for(let e=this.fills.length-1;e>=0;e--){const t=this.fills[e];if(!t)continue;const{area:s,shared:n,value:i,format:r,start:l}=t;for(let o=s.top;o<=s.bottom;o++)for(let f=s.left;f<=s.right;f++)if(this.grid.get(o,f)===void 0&&!this.blanks.has(placeKey(o,f)))if(n){const h=new FormulaCell(n,this,o,f);l!==void 0&&(h.value=l),this.put(o,f,h)}else i!=null&&(this.put(o,f,i),r!==void 0&&this.implied.set(placeKey(o,f),r))}}}at(e,t){return this.expand(),this.grid.get(e,t)}spillAt(e,t){return this.ghosts.size===0?void 0:this.ghosts.get(placeKey(e,t))}holds(e,t){return this.expand(),this.grid.holds(e,t.row,t.col)}spillsIn(e){if(this.spills.size===0)return[];if((e.bottom-e.top+1)*(e.right-e.left+1)>=this.spills.size)return[...this.spills].filter(n=>n.spill!==void 0&&v(n.spill,e));const s=new Set;for(let n=e.top;n<=e.bottom;n++)for(let i=e.left;i<=e.right;i++){const r=this.ghosts.get(placeKey(n,i));r&&s.add(r)}return[...s]}blockedBy(e){if(this.stopped.size===0)return[];const t=[];for(const s of this.stopped)s.blocked&&v(s.blocked,e)&&t.push(s);return t}placeSpill(e,t){e.spill=t,this.spills.add(e);for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)(s!==e.row||n!==e.col)&&this.ghosts.set(placeKey(s,n),e);this.reach&&T(this.reach,t)}blockSpill(e,t){e.blocked=t,this.stopped.add(e)}clearSpill(e){const t=e.spill;if(t)for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)this.ghosts.get(placeKey(s,n))===e&&this.ghosts.delete(placeKey(s,n));e.spill=void 0,e.blocked=void 0,this.spills.delete(e),this.stopped.delete(e)}clearSpills(){for(const e of[...this.spills,...this.stopped])e.spill=void 0,e.blocked=void 0;this.spills.clear(),this.stopped.clear(),this.ghosts.clear(),this.reach=void 0}tighten(){this.reach=void 0}spillReach(){if(this.reach)return this.reach;const e={columns:new Map,bottom:-1,right:-1};for(const{spill:t}of this.spills)t&&T(e,t);return this.reach=e,e}hasFormulas(e){return this.expand(),this.grid.hasFormulas(e)}span(e,t,s){this.expand();const n=this.grid.first(e),i=this.grid.last(e);if(this.spills.size===0)return[Math.max(t,n),Math.min(s,i)];const[r,l]=this.spillReach().columns.get(e)??[1/0,-1];return[Math.max(t,Math.min(n,r)),Math.min(s,Math.max(i,l))]}get columnsUsed(){return this.expand(),this.spills.size===0?this.grid.width:Math.max(this.grid.width,this.spillReach().right+1)}get lastRow(){return this.expand(),this.spills.size===0?this.lowest:Math.max(this.lowest,this.spillReach().bottom)}get used(){const e=this.lastRow,t=this.columnsUsed-1;return e<0||t<0?void 0:{top:0,left:0,bottom:e,right:t}}tableAt(e,t){return this.tables.find(s=>y(s.area,e,t))}blockAt(e,t){return this.blocks.find(s=>y(s.area,e,t))}looks(){if(this.lookAreas)return this.lookAreas;const e=[];for(const s of this.spec.format??[]){const n=$(s.range);n&&e.push({area:n,entry:s})}const t=[];for(const[s,n]of Object.entries(this.spec.cells??{})){if(!s.includes(":")||n===null||typeof n!="object")continue;const i=$(s);i&&t.push({area:i,entry:n})}return this.lookAreas={formats:e,ranges:t},this.lookAreas}styledAreas(){const{formats:e,ranges:t}=this.looks();return[...e,...t.filter(s=>Object.keys(s.entry).some(n=>F.has(n)))]}lookAt(e,t){const s={},n=c=>{if(c)for(const[b,w]of Object.entries(c))F.has(b)&&w!==void 0&&(s[b]=b==="border"?{...s.border,...w}:w)},i=this.implied.get(placeKey(e,t));i!==void 0&&(s.format=i);const r=this.ghosts.size===0?void 0:this.spillAt(e,t),l=r&&this.lookAt(r.row,r.col).format;l!==void 0&&(s.format=l),this.spec.columns&&n(this.spec.columns[j(t)]),this.spec.rows&&n(this.spec.rows[String(e+1)]);const o=this.tableAt(e,t);o&&e>o.at.row&&n(o.columns[t-o.at.col]?.spec);const{formats:f,ranges:h}=this.looks();for(const c of f)y(c.area,e,t)&&n(c.entry);for(const c of h)y(c.area,e,t)&&n(c.entry);const d=this.keys.get(placeKey(e,t)),g=d===void 0?void 0:this.spec.cells?.[d];if(g!==null&&typeof g=="object"&&n(g),s.border){const c=Object.entries(s.border).filter(([,b])=>b?.style!=="none");c.length===0?delete s.border:s.border=Object.fromEntries(c)}return s}runsAt(e,t){const s=this.keys.get(placeKey(e,t)),n=s===void 0?void 0:this.spec.cells?.[s];return n!==null&&typeof n=="object"?n.runs:void 0}mergeAt(e,t){return this.merges.find(s=>y(s,e,t))}validationAt(e,t){return this.validations.find(s=>s.areas.some(n=>y(n,e,t)))}filterHeadAt(e,t){return this.filters.find(s=>e===s.area.top&&t>=s.area.left&&t<=s.area.right)}filterAt(e,t){return this.filters.find(s=>y(s.area,e,t))}filesAt(e,t){const s=this.tableAt(e,t);if(s&&e>s.at.row){const n=s.columns[t-s.at.col]?.spec?.files;if(n!==void 0)return n}return s?.at.row===e?void 0:this.spec.columns?.[j(t)]?.files}}export const filesSeparator=a=>(typeof a=="object"?a.separator:void 0)??P;export function filesIn(a,e){const t=filesSeparator(e);return a.split(t.trim()===""?t:t.trim()).map(s=>s.trim()).filter(s=>s!=="")}const F=new Set(["bold","italic","underline","strike","font","size","color","fill","align","valign","wrap","shrink","indent","rotation","border","locked","hide_formula","format"]);export class Workbook{title;sheets=[];names=new Map;checks=[];bySheet=new Map;byTable=new Map;file;generated;ordinary=[];constructor(e,t){this.file=e,this.title=e.title,this.generated=t}respec(e){this.file=O(e,this.generated).file,this.title=e.title,this.sheets.forEach(t=>{const s=e.sheets.find(n=>n.name===t.name);s&&t.respec(s)})}sheet(e){return this.bySheet.get(e.toLowerCase())}table(e){return this.byTable.get(e.toLowerCase())}name(e,t){const s=e.toLowerCase();return(t?.names.size?t.names.get(s):void 0)??this.names.get(s)}definitions(e){const t=e.toLowerCase(),s=[],n=this.names.get(t);n&&s.push(n);for(const i of this.sheets){const r=i.names.get(t);r&&s.push(r)}return s}get tables(){return[...this.byTable.values()]}addSheet(e){this.sheets.push(e),this.bySheet.set(e.name.toLowerCase(),e)}addTable(e){e.sheet.tables.push(e),this.byTable.set(e.name.toLowerCase(),e)}sourceOf(e,t,s){if(e.generated)return{file:R};const n=this.sheets.indexOf(e),i=e.tableAt(t,s);if(i){const o=i.columns[s-i.at.col],f=t-i.at.row-1,h=o?.csv!==void 0&&(i.records[f]?.[o.csv]??"")!=="";return f>=0&&o?.formula&&!h?o.formula.source:{file:i.file,line:f<0?1:i.lines[f]??1}}const r=e.blockAt(t,s);if(r)return{file:r.file,line:r.lines[t-r.area.top]??1};const l=e.keys.get(placeKey(t,s));if(l!==void 0)return{file:E,path:["sheets",n,"cells",l]};for(const o of Object.keys(e.spec.cells??{})){if(!o.includes(":"))continue;const f=$(o);if(f&&y(f,t,s))return{file:E,path:["sheets",n,"cells",o]}}}}export const MAX_FILL_CELLS=5e6;const q=/^[\p{L}_\\][\p{L}\p{N}_.\\?]*$/u;export function validName(a){return q.test(a)&&A(a)===void 0&&!/^(?:TRUE|FALSE)$/iu.test(a)&&!/^[Rr](?:\d+)?(?:[Cc]\d*)?$/u.test(a)&&!/^[Cc]\d*$/u.test(a)}const M="made",k=a=>a[0]===M?R:E;class N{problems=[];wb;read_;lineOf;own;madeNames;constructor(e,t,s,n,i){this.wb=e,this.read_=t,this.lineOf=s,this.own=n,this.madeNames=i}yaml(e,t){const s=this.lineOf(e);this.problems.push({file:k(e),...s===void 0?{}:{line:s},message:t})}sheetPath(e){return e<this.own?["sheets",e]:[M,"sheets",e-this.own]}read(){const{file:e}=this.wb;e.sheets.forEach((t,s)=>{const n=this.sheetPath(s);if(this.wb.sheet(t.name)){this.yaml([...n,"name"],`two sheets are named ${t.name}`);return}(/[\\/?*[\]:]/u.test(t.name)||t.name.length>31)&&this.yaml([...n,"name"],`${t.name} cannot be a sheet's name: at most 31 characters, none of \\ / ? * [ ] :`);const i=new Worksheet(t.name,this.wb.sheets.length,t);i.generated=s>=this.own,this.wb.addSheet(i)}),this.names();for(const[t,s]of e.sheets.entries()){const n=this.wb.sheets[t];n?.spec===s&&this.sheet(n,this.sheetPath(t))}e.checks?.forEach((t,s)=>{const n={file:E,path:["checks",s,"formula"]};this.wb.checks.push({name:t.name,formula:new SharedFormula(t.formula,0,0,n),source:n})})}names(){const{file:e}=this.wb;this.namesOf(e.names,e.hidden_names,t=>this.madeNames.has(t)?[M,"names",t]:["names",t],this.wb.names,void 0),e.sheets.forEach((t,s)=>{const n=this.wb.sheets[s];n?.spec===t&&this.namesOf(t.names,t.hidden_names,i=>[...this.sheetPath(s),"names",i],n.names,n)})}namesOf(e,t,s,n,i){const r=new Set(t?.map(l=>l.toLowerCase()));for(const[l,o]of Object.entries(e??{})){const f=s(l);if(!validName(l)){this.yaml(f,`${l} cannot be a name`);continue}const h={file:k(f),path:f},d=typeof o=="string"&&o.startsWith("=")?{name:l,formula:new SharedFormula(o,0,0,h),source:h}:{name:l,value:typeof o=="string"?x(o).value:o,source:h};i&&(d.sheet=i),r.has(l.toLowerCase())&&(d.hidden=!0),n.set(l.toLowerCase(),d)}}sheet(e,t){const{spec:s}=e;if(s.freeze!==void 0){const n=A(s.freeze);n?e.freeze=n:this.yaml([...t,"freeze"],`${s.freeze} is not a cell`)}s.tables?.forEach((n,i)=>{this.table(e,n,[...t,"tables",i])});for(const[n,i]of e.tables.entries())for(const r of e.tables.slice(n+1))v(i.area,r.area)&&this.problems.push({file:E,message:`tables ${i.name} and ${r.name} overlap on ${e.name}`});s.blocks?.forEach((n,i)=>{this.block(e,n.at,n.rows,[...t,"blocks",i])}),this.cells(e,s.cells??{},[...t,"cells"]),s.merges?.forEach((n,i)=>{const r=$(n);r?e.merges.push(r):this.yaml([...t,"merges",i],`${n} is not a range`)}),s.format?.forEach((n,i)=>{$(n.range)||this.yaml([...t,"format",i,"range"],`${n.range} is not a range`)}),s.conditional?.forEach((n,i)=>{this.condition(e,n,[...t,"conditional",i])}),s.validations?.forEach((n,i)=>{this.validation(e,n,[...t,"validations",i])}),this.filters(e,t),s.charts?.forEach((n,i)=>{this.chart(e,n,i,[...t,"charts",i])});for(const n of Object.keys(s.columns??{}))C(n)===void 0&&this.yaml([...t,"columns",n],`${n} is not a column`);for(const n of Object.keys(s.rows??{}))(!/^[1-9]\d*$/u.test(n)||Number(n)>B)&&this.yaml([...t,"rows",n],`${n} is not a row`)}chart(e,t,s,n){const i=W(t,s,n,(r,l)=>{this.yaml(r,l)});i&&e.charts.push(i)}bound(e,t,s){if(!(typeof e!="string"||!e.startsWith("=")||e.length<2))return new SharedFormula(e,t?.top??0,t?.left??0,{file:k(s),path:s})}condition(e,t,s){const n=z(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const[i]=n,r=[],l=(o,f)=>{const h=this.bound(o,i,f);h&&r.push(h)};if(t.type==="expression"){const o=t.formula.startsWith("=")?t.formula:`=${t.formula}`;l(o,[...s,"formula"])}if(t.type==="cellIs"&&t.formula.forEach((o,f)=>{l(o,[...s,"formula",f])}),t.type==="dataBar")for(const o of["min","max"])l(t[o]?.value,[...s,o,"value"]);(t.type==="colorScale"||t.type==="iconSet")&&t.stops?.forEach((o,f)=>{l(o.value,[...s,"stops",f,"value"])}),e.conditions.push({spec:t,areas:n,formulas:r})}validation(e,t,s){const n=z(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const i=(t.formula??[]).map((o,f)=>this.bound(o,n[0],[...s,"formula",f])),r=t.formula?.length??0,l=t.type!=="list"&&t.type!=="custom"&&(t.operator===void 0||t.operator==="between"||t.operator==="notBetween");!(t.type==="list"&&t.values!==void 0)&&r<(l?2:1)&&this.yaml(s,`a ${t.type} validation needs its bounds`),e.validations.push({spec:t,areas:n,formulas:i})}filters(e,t){const{spec:s}=e;if(s.filter){const n=[...t,"filter"],i=$(s.filter.range);if(!i)this.yaml([...n,"range"],`${s.filter.range} is not a range`);else{const r=new Map;for(const[o,f]of Object.entries(s.filter.columns??{})){const h=C(o);h===void 0||h<i.left||h>i.right?this.yaml([...n,"columns",o],`${o} is not a column of ${s.filter.range}`):r.set(h,f)}const l=e.tables.find(o=>v(o.area,i));l&&this.yaml(n,`a filter over table ${l.name}: a table has its own`),e.filters.push({area:i,columns:r})}}e.tables.forEach((n,i)=>{const{filter:r}=n.spec;if(r===!1)return;const l=new Map;for(const[o,f]of Object.entries(r?.columns??{})){const h=n.column(o);h?l.set(n.at.col+h.index,f):this.yaml([...t,"tables",i,"filter","columns",o],`table ${n.name} has no column ${o}`)}e.filters.push({area:n.area,table:n,columns:l})})}csv(e,t,s){const n=this.read_(e);return n||this.yaml(t,`${s}: ${e} is not there`),n}overlapping(e,t){const s=e.tables.find(i=>v(i.area,t));if(s)return`table ${s.name}`;const n=e.blocks.find(i=>v(i.area,t));return n?`the block of ${n.file}`:void 0}typed(e,t,s,n,i){if(n.formula!==void 0){const r=new SharedFormula(n.formula,t,s,i),l=new FormulaCell(r,e,t,s);n.start!==void 0&&(l.value=n.start),e.put(t,s,l);return}n.value!==null&&(e.put(t,s,n.value),n.format!==void 0&&e.implied.set(placeKey(t,s),n.format))}table(e,t,s){const n=A(t.at);if(!n){this.yaml([...s,"at"],`${t.at} is not a cell`);return}if(!validName(t.name)){this.yaml([...s,"name"],`${t.name} cannot be a table's name`);return}if(this.wb.table(t.name)){this.yaml([...s,"name"],`two tables are named ${t.name}`);return}this.wb.name(t.name)&&this.yaml([...s,"name"],`${t.name} is a defined name and a table's`);const i=new Table(t.name,e,n,t.rows,t),r=this.csv(t.rows,[...s,"rows"],`table ${t.name}`),l=r?.rows??[],o=r?.lines??[],f=l[0],h=o[0]??1,d=new Set,g=f?.length===0?[""]:f??[];g.forEach((u,m)=>{const p=u.trim();p===""&&this.problems.push({file:t.rows,line:h,message:`column ${String(m+1)} has no name`}),d.has(p.toLowerCase())&&this.problems.push({file:t.rows,line:h,message:`two columns are named ${p}`}),d.add(p.toLowerCase()),i.columns.push({name:p,index:i.columns.length,csv:m})});for(const[u,m]of Object.entries(t.columns??{})){const p=i.column(u),S=p??{name:u,index:i.columns.length};p||(m.formula===void 0&&this.yaml([...s,"columns",u],`table ${t.name} has no column ${u}`),i.columns.push(S)),S.spec=m}const c=g.length;for(let u=1;u<l.length;u++){const m=l[u];if(!m||m.length===0)continue;const p=o[u]??u+1;i.places.push(u),i.records.push(m),i.lines.push(p),m.length>c&&this.problems.push({file:t.rows,line:p,message:`this row has ${String(m.length)} fields and the header ${String(c)}`})}i.rows=i.records.length;const b=this.overlapping(e,i.area);b&&this.yaml(s,`table ${t.name} overlaps ${b} on ${e.name}`),this.wb.addTable(i),this.tableKey(i,s);const w=n.row+1;i.columns.forEach(u=>{const m=n.col+u.index;e.put(n.row,m,u.name);const p=u.spec?.formula;p!==void 0&&(u.formula=new SharedFormula(p,w,m,{file:k(s),path:[...s,"columns",u.name,"formula"]}),i.rows>0&&e.fills.push({area:{top:w,left:m,bottom:w+i.rows-1,right:m},shared:u.formula})),u.csv!==void 0&&i.records.forEach((S,L)=>{this.typed(e,w+L,m,x(S[u.csv??0]??""),{file:t.rows,line:i.lines[L]??1})})})}tableKey(e,t){const{key:s}=e.spec;if(s===void 0)return;const n=e.column(s);if(n?.csv===void 0){this.yaml([...t,"key"],`table ${e.name} has no column ${s} in ${e.file}`);return}const i=new Set;e.records.forEach((r,l)=>{const o=r[n.csv??0]??"",f=e.lines[l]??1;o===""?this.problems.push({file:e.file,line:f,message:`this row has no ${s}, table ${e.name}'s key`}):i.has(o)&&this.problems.push({file:e.file,line:f,message:`two rows have the key ${o}`}),i.add(o)})}block(e,t,s,n){const i=A(t);if(!i){this.yaml([...n,"at"],`${t} is not a cell`);return}const r=this.csv(s,[...n,"rows"],"a block");if(!r)return;const l=r.rows,o=l.map((g,c)=>r.lines[c]??c+1),f=l.reduce((g,c)=>Math.max(g,c.length),1),h={top:i.row,left:i.col,bottom:i.row+Math.max(l.length,1)-1,right:i.col+f-1},d=this.overlapping(e,h);d&&this.yaml(n,`the block of ${s} overlaps ${d} on ${e.name}`),e.blocks.push({area:h,file:s,lines:o}),l.forEach((g,c)=>{g.forEach((b,w)=>{this.typed(e,i.row+c,i.col+w,x(b),{file:s,line:o[c]??c+1})})})}cells(e,t,s){const n=[];for(const[i,r]of Object.entries(t)){const l=[...s,i],o=$(i);if(!o){this.yaml(l,`${i} is not a cell or a range`);continue}const f=this.overlapping(e,o);if(f&&this.yaml(l,`${i} overlaps ${f}`),i.includes(":")){const h=(o.bottom-o.top+1)*(o.right-o.left+1);h>MAX_FILL_CELLS?this.yaml(l,`${i} is ${String(h)} cells`):(r!==null&&typeof r=="object"&&r.runs&&this.yaml([...l,"runs"],`${i} is a range: runs are one cell's`),this.fill(e,o,r,l))}else n.push([i,r,{row:o.top,col:o.left}])}for(const[i,r,l]of n){const o=[...s,i],f=K(r),h=placeKey(l.row,l.col);e.keys.set(h,i),f.value===null&&f.formula===void 0&&e.blanks.add(h),this.typed(e,l.row,l.col,f,{file:k(o),path:o});const d=r!==null&&typeof r=="object"?r.name:void 0;d!==void 0&&this.cellName(e,l,d,o)}}cellName(e,t,s,n){if(!validName(s)){this.yaml(n,`${s} cannot be a name`);return}if(this.wb.name(s)){this.yaml(n,`two places are named ${s}`);return}const i={file:k(n),path:n},r=U(t).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2"),l=`='${e.name.replaceAll("'","''")}'!${r}`;this.wb.names.set(s.toLowerCase(),{name:s,formula:new SharedFormula(l,0,0,i),source:i})}fill(e,t,s,n){const i=K(s),r={file:k(n),path:n};e.fills.push(i.formula===void 0?{area:t,value:i.value,...i.format===void 0?{}:{format:i.format}}:{area:t,shared:new SharedFormula(i.formula,t.top,t.left,r),...i.start===void 0?{}:{start:i.start}})}}function W(a,e,t,s){const n=A(a.at);if(!n){s([...t,"at"],`${a.at} is not a cell`);return}const i=(o,f)=>{const h=new SharedFormula(chartFormula(o),0,0,{file:k(f),path:f});return h.node&&!I(h.node)&&s(f,`${o} is not a range or a table's column`),h},r=(o,f)=>o?.startsWith("=")===!0?i(o,f):void 0,l=r(a.title,[...t,"title"]);return{spec:a,at:n,index:e,...a.categories===void 0?{}:{categories:i(a.categories,[...t,"categories"])},...l?{title:l}:{},series:a.series.map((o,f)=>{const h=[...t,"series",f],d=r(o.name,[...h,"name"]);return{values:i(o.values,[...h,"values"]),...o.x===void 0?{}:{x:i(o.x,[...h,"x"])},...d?{name:d}:{}}})}}export const chartFormula=a=>a.startsWith("=")?a:`=${a}`;function I(a){switch(a.kind){case"error":case"ref":case"structured":case"name":return!0;case"paren":case"postfix":return I(a.arg);case"binary":return a.op===":"||a.op===",";default:return!1}}export const runsText=a=>a.map(e=>e.text).join("");function K(a){if(a===null)return{value:null};if(typeof a=="string")return x(a);if(typeof a!="object")return{value:a};if(a.formula!==void 0)return{value:null,formula:a.formula.startsWith("=")?a.formula:`=${a.formula}`,...a.start===void 0?{}:{start:typeof a.start=="string"?x(a.start).value:a.start}};if(a.runs!==void 0)return{value:runsText(a.runs)};const{value:e}=a;return typeof e=="string"?x(e):{value:e??null}}export function readWorkbook(a){const e=G(a.text),t=l=>l[0]===M?void 0:e.lineOf(l);if(!e.file)return{problems:e.problems,lineOf:t};const s=O(e.file,a.generated),n=new Workbook(s.file,a.generated);n.ordinary=s.ordinary;const i=[],r=new N(n,l=>{const o=a.generated?.csv[l]??a.read(l);if(o===void 0)return;const f=_(o);for(const h of f.problems)i.push({file:l,line:h.line,message:h.message});return{rows:f.records.map(h=>h.end===h.start?[]:h.fields),lines:f.records.map(h=>h.line)}},t,s.own,s.names);return r.read(),{workbook:n,problems:[...i,...r.problems],lineOf:t}}export function workbookOf(a){const e=O(a.file,a.generated),t=new Workbook(e.file,a.generated);return t.ordinary=e.ordinary,new N(t,s=>{const n=a.generated?.csv[s];if(n!==void 0)return{rows:_(n).records.map(r=>r.end===r.start?[]:r.fields),lines:[]};const i=a.rows(s);return i&&{rows:i,lines:[]}},()=>{},e.own,e.names).read(),t}export{D as rangeName};
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CHART_DEFAULTS as pe,chartSpaceXml as Ce}from"@allyhub/chart";import{columnLetter as xe}from"../address.js";import{Reference as ge,Union as ke}from"../calc/types.js";import{CellError as Pe}from"../values.js";import{categoryNumbers as Se,chartDef as Me,chartSize as Fe}from"../chart.js";import{parseFormula as Re}from"../formula/parse.js";import{sheetPrefix as we}from"../formula/print.js";import{HEAD as De,attr as b,el as d,flag as ye,numberAttr as j,tag as r,tags as O,textOf as P}from"./xml.js";const Ne="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",_e="http://schemas.openxmlformats.org/drawingml/2006/main",be="http://schemas.openxmlformats.org/drawingml/2006/chart",ve="http://schemas.openxmlformats.org/officeDocument/2006/relationships",v=9525,je=(e,t)=>`${we(e.sheet.name)}$${xe(e.left)}$${String(e.top+1)}${e.single?"":`:$${xe(e.right)}$${String(t+1)}`}`;function E(e,t,n){if(!n?.node)return;const o=e.eval(n.node,{sheet:t,row:0,col:0,dr:0,dc:0}),s=l=>je(l,Math.min(l.bottom,Math.max(l.top,l.sheet.lastRow)));if(o instanceof ge)return s(o);if(o instanceof ke)return`(${o.parts.map(s).join(",")})`;const a=n.node;if(a.kind==="name"&&a.sheet!==void 0&&!(o instanceof Pe&&o.code==="#NAME?"))return`${we(a.sheet)}${a.name}`}function Ee(e,t,n){if(!n?.node)return!1;const o=e.eval(n.node,{sheet:t,row:0,col:0,dr:0,dc:0});return o instanceof ge&&typeof e.value(o.sheet,o.top,o.left)=="number"}export function chartPart(e,t,n){const o=Me(e,t,n),s=n.series.map((i,f)=>({s:i,i:f,values:E(e,t,i.values)})).filter(i=>i.values!==void 0),a={...o,series:s.flatMap(i=>o.series[i.i]??[])},l=Ee(e,t,n.categories),h=l?Se(e,t,n):void 0,m={name:i=>E(e,t,s[i]?.s.name),categories:E(e,t,n.categories),numeric:l,...h===void 0?{}:{categoryNumbers:h.values,categoryFormat:h.format},values:i=>s[i]?.values??"",x:i=>E(e,t,s[i]?.s.x??n.categories)},y=E(e,t,n.title);return Ce(a,{refs:m,...y===void 0?{}:{titleRef:y}})}const Le=(e,t,n)=>d("xdr:oneCellAnchor",{},d("xdr:from",{},`<xdr:col>${String(e.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round(e.x*v))}</xdr:colOff>`,`<xdr:row>${String(e.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((e.y??0)*v))}</xdr:rowOff>`),d("xdr:ext",{cx:Math.round(e.width*v),cy:Math.round(e.height*v)}),d("xdr:pic",{},d("xdr:nvPicPr",{},d("xdr:cNvPr",{id:t,name:e.name,descr:e.path}),d("xdr:cNvPicPr",{},d("a:picLocks",{noChangeAspect:!0}))),d("xdr:blipFill",{},d("a:blip",{"xmlns:r":ve,"r:embed":`rId${String(n)}`}),d("a:stretch",{},d("a:fillRect"))),d("xdr:spPr",{},d("a:xfrm",{},d("a:off",{x:0,y:0}),d("a:ext",{cx:Math.round(e.width*v),cy:Math.round(e.height*v)})),d("a:prstGeom",{prst:"rect"},d("a:avLst")))),d("xdr:clientData"));export function drawingPart(e,t=[]){const n=(o,s)=>{const{width:a,height:l}=Fe(o.spec);return d("xdr:oneCellAnchor",{},d("xdr:from",{},`<xdr:col>${String(o.at.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round((o.spec.x??0)*v))}</xdr:colOff>`,`<xdr:row>${String(o.at.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((o.spec.y??0)*v))}</xdr:rowOff>`),d("xdr:ext",{cx:Math.round(a*v),cy:Math.round(l*v)}),d("xdr:graphicFrame",{macro:""},d("xdr:nvGraphicFramePr",{},d("xdr:cNvPr",{id:s+2,name:`Chart ${String(s+1)}`}),d("xdr:cNvGraphicFramePr")),d("xdr:xfrm",{},d("a:off",{x:0,y:0}),d("a:ext",{cx:0,cy:0})),d("a:graphic",{},d("a:graphicData",{uri:be},d("c:chart",{"xmlns:c":be,"xmlns:r":ve,"r:id":`rId${String(s+1)}`})))),d("xdr:clientData"))};return De+d("xdr:wsDr",{"xmlns:xdr":Ne,"xmlns:a":_e},...e.map(n),...t.map((o,s)=>Le(o,e.length+s+2,e.length+s+1)))}function Z(e){if(Array.isArray(e))return e.map(Z).join("");if(typeof e!="object"||e===null)return"";const t=e,n=[];for(const[o,s]of Object.entries(t))o==="t"?n.push(P(s)):typeof s=="object"&&n.push(Z(s));return n.join("")}const ee=e=>{const t=r(e?.solidFill),n=b(r(t?.srgbClr),"val");return n!==void 0?`#${n.toUpperCase()}`:ze[b(r(t?.schemeClr),"val")??""]},ze={accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47"},A=(e,t)=>b(r(e?.[t]),"val"),M=(e,t)=>j(r(e?.[t]),"val"),L=(e,t)=>ye(r(e?.[t]),"val"),Ge=e=>/^"(?:[^"]|"")*"$/u.test(e)?e.slice(1,-1).replaceAll('""','"'):void 0,$e=e=>Ge(e)??`=${e}`;function Oe(e){if(!e)return;const t=r(e.tx),n=r(t?.strRef);if(n)return $e(P(n.f));const o=Z(t?.rich);return o===""?void 0:o}function te(e){if(!e)return;const t=r(e.scaling),n=r(e.numFmt),o=b(n,"formatCode"),s={},a=Oe(r(e.title));a!==void 0&&(s.title=a);const l=M(t,"min"),h=M(t,"max"),m=M(e,"majorUnit");return l!==void 0&&(s.min=l),h!==void 0&&(s.max=h),m!==void 0&&m>0&&(s.major=m),L(e,"delete")===!0&&(s.visible=!1),A(t,"orientation")==="maxMin"&&(s.reverse=!0),o!==void 0&&o!=="General"&&ye(n,"sourceLinked")!==!0&&(s.format=o),s}const G=e=>{const t=r(e?.numRef)??r(e?.strRef),n=t?P(t.f):"";return n===""?void 0:n};function Ie(e,t){const n=G(r(e[t?"yVal":"val"]));if(n===void 0)return"its numbers are written in the chart";const o={values:n},s=r(e.tx),a=G(s);if(a!==void 0)o.name=$e(a);else{const u=P(s?.v);u!==""&&(o.name=u)}const l=r(e.spPr),h=r(l?.ln),m=r(e.marker),y=t||m!==void 0,i=ee(l)??(y?ee(h)??ee(r(m?.spPr)):void 0);i!==void 0&&(o.color=i);const f=j(h,"w");if(y&&f!==void 0&&h?.noFill===void 0){const u=Math.max(.25,Number((f/12700).toFixed(2)));u!==pe.lineWidth&&(o.line_width=u)}L(e,"smooth")===!0&&(o.smooth=!0);const p=M(m,"size");p!==void 0&&p!==pe.marker&&(o.marker_size=p);const $=t?G(r(e.xVal)):void 0;$!==void 0&&(o.x=$);const g=t?void 0:G(r(e.cat));return{series:o,...g===void 0?{}:{categories:g}}}function ne(e,t){const n=O(t.ser),o=a=>r(r(a.spPr)?.ln)?.noFill!==void 0,s=a=>A(r(a.marker),"symbol")==="none";switch(e){case"barChart":return Te(t);case"lineChart":return n.every(s)?"line":"line-markers";case"areaChart":return We(t);case"pieChart":return"pie";case"doughnutChart":return"doughnut";case"scatterChart":return n.every(o)?"scatter":n.some(a=>L(a,"smooth")===!0)?"scatter-smooth":"scatter-lines";default:return}}function Te(e){const t=A(e,"barDir")==="bar"?"bar":"column",n=A(e,"grouping");return n==="stacked"?`${t}-stacked`:n==="percentStacked"?`${t}-stacked-100`:`${t}-clustered`}function We(e){const t=A(e,"grouping");return t==="stacked"?"area-stacked":t==="percentStacked"?"area-stacked-100":"area"}function I(e,t){if(e===void 0)return;const n=e.replace(/^=/u,"");if(/(?:^|[(,])'?\[\d+\]/u.test(n))return"it reads another workbook";if(e.includes("#REF!"))return"its cells were deleted (#REF!)";const o=/^(?:'((?:[^']|'')+)'|([^!'(),]+))!/u.exec(n),s=o?.[1]?.replaceAll("''","'")??o?.[2];if(s!==void 0&&!t(s))return`it reads a sheet the workbook does not have (${s})`;const a=Re(`=${n}`);if(!a.ok||!T(a.node))return`it names no cells (${n})`}function T(e){switch(e.kind){case"ref":case"name":case"structured":return!0;case"paren":return T(e.arg);case"binary":return(e.op===","||e.op===":")&&T(e.left)&&T(e.right);default:return!1}}export function readChart(e,t=[],n=()=>!0){const o=r(e?.chartSpace),s=r(o?.chart),a=r(s?.plotArea);if(!s||!a)return"it has no plot";const l=Object.entries(a).filter(([c])=>c.endsWith("Chart")).flatMap(([c,x])=>O(x).map(k=>({kind:c,plot:k}))),[h]=l;if(!h)return"it has no plot";const m=O(a.valAx),y=c=>O(c.axId).map(x=>b(x,"val")),i=c=>{const x=m.find(k=>y(c).includes(b(r(k.axId),"val")));return x!==void 0&&A(x,"axPos")==="r"},f=l.length>1,p=l.map(({kind:c,plot:x})=>({kind:c,plot:x,type:ne(c,x),secondary:f&&i(x)}));if(f&&p.some(c=>c.type===void 0||!(c.type.startsWith("column")||c.type.startsWith("line")||c.type.startsWith("area"))))return"it combines several kinds of chart, not columns, lines and areas";const $=p.find(c=>!c.secondary)??p[0]??h,{kind:g,plot:u}=$,F=g==="scatterChart",S=[];let R,D;const z=p.flatMap(c=>O(c.plot.ser).map(x=>({s:x,of:c})));for(const[c,{s:x,of:k}]of z.entries()){const w=Ie(x,F);if(typeof w=="string")return w;if(f){const Y=k.type;Y!==void 0&&Y!==ne(g,u)&&(w.series.type=Y),k.secondary&&(w.series.secondary=!0)}const Q=I(w.series.values,n);if(Q!==void 0){t.push(`series ${String(c+1)}, as ${Q}`),D=Q;continue}w.series.name?.startsWith("=")===!0&&I(w.series.name,n)!==void 0&&delete w.series.name,I(w.series.x,n)!==void 0&&delete w.series.x,S.push(w.series),I(w.categories,n)===void 0&&(R??=w.categories)}if(S.length===0)return D===void 0?"it has no series":`every series ${D.replace(/^it /u,"")}`;const _=ne(g,u);if(!_)return`a sheet has no ${g.replace(/Chart$/u,"")} chart`;const re=Oe(r(s.title)),oe=r(s.legend),U=A(oe,"legendPos"),se=r(u.dLbls),C=c=>L(se,c)===!0,Ae=C("showVal")||C("showPercent")||C("showCatName")||C("showSerName"),ie=A(se,"dLblPos"),V=M(u,"gapWidth"),ce=M(u,"overlap"),B=M(u,"holeSize"),ae=L(u,"varyColors"),de=_==="pie"||_==="doughnut",fe=c=>y(u).includes(b(r(c.axId),"val")),ue=[...O(a.catAx),...O(a.dateAx)],N={value:f?m.find(fe)??m[0]:m.find((c,x,k)=>F?x===k.length-1:!0),category:F?m[0]:f?ue.find(fe)??ue[0]:r(a.catAx)??r(a.dateAx),second:p.some(c=>c.secondary)?m.find(c=>A(c,"axPos")==="r"):void 0},H=te(N.value),X=te(N.category);H&&N.value?.majorGridlines===void 0&&(H.gridlines=!1),X&&N.category?.majorGridlines!==void 0&&(X.gridlines=!0);const q=j(r(r(r(r(o?.txPr)?.p)?.pPr)?.defRPr),"sz"),J=c=>c&&Object.keys(c).length>0?c:void 0,le=J(H),me=J(X),K=te(N.second);K&&N.second?.majorGridlines!==void 0&&(K.gridlines=!0);const he=J(K);return{type:_,at:"A1",...re===void 0?{}:{title:re},...R===void 0?{}:{categories:R},series:de?S.slice(0,1):S,...oe?{legend:U==="b"?"bottom":U==="t"?"top":U==="l"?"left":"right"}:{},...Ae?{labels:{...C("showVal")?{value:!0}:{},...C("showPercent")?{percentage:!0}:{},...C("showCatName")?{category:!0}:{},...C("showSerName")?{series:!0}:{},...ie===void 0?{}:{position:ie}}}:{},...V===void 0||V===150?{}:{gap_width:V},...ce===void 0||_.includes("stacked")?{}:{overlap:ce},...B===void 0||B===50?{}:{hole_size:B},...ae===!0&&g==="barChart"?{vary_by_categories:!0}:{},...ae===!1&&de?{vary_by_categories:!1}:{},...le?{value_axis:le}:{},...me?{category_axis:me}:{},...he?{secondary_axis:he}:{},...q===void 0||q===900?{}:{size:q/100}}}const W=e=>Math.round(e/v);export function chartAnchors(e,t,n){const o=r(e?.wsDr),s=[],a=[];let l=0;const h=i=>({col:Number(P(i?.col)),row:Number(P(i?.row)),colOff:W(Number(P(i?.colOff))),rowOff:W(Number(P(i?.rowOff)))}),m=i=>b(r(r(r(r(i.graphicFrame)?.graphic)?.graphicData)?.chart),"id"),y=(i,f,p,$)=>{const g={at:{row:f.row,col:f.col},...f.colOff>0?{x:f.colOff}:{},...f.rowOff>0?{y:f.rowOff}:{},width:p,height:$},u=r(i.pic),F=b(r(r(u?.blipFill)?.blip),"embed");if(u&&F!==void 0){const R=r(r(u.nvPicPr)?.cNvPr),D=b(R,"name"),z=b(R,"descr");a.push({id:F,...g,...D===void 0?{}:{name:D},...z===void 0?{}:{descr:z}});return}const S=m(i);if(S===void 0){l+=1;return}s.push({id:S,...g})};for(const i of O(o?.oneCellAnchor)){const f=r(i.ext);y(i,h(r(i.from)),W(j(f,"cx")??0),W(j(f,"cy")??0))}for(const i of O(o?.twoCellAnchor)){const f=h(r(i.from)),p=h(r(i.to));let $=p.colOff-f.colOff;for(let u=f.col;u<p.col;u++)$+=t(u);let g=p.rowOff-f.rowOff;for(let u=f.row;u<p.row;u++)g+=n(u);y(i,f,$,g)}return{anchors:s,pictures:a,others:l}}
2
+ import{CHART_DEFAULTS as ge,chartSpaceXml as Pe}from"@allyhub/chart";import{columnLetter as we}from"../address.js";import{Reference as ye,Union as Se}from"../calc/types.js";import{CellError as Me}from"../values.js";import{categoryNumbers as Fe,chartDef as Re,chartSize as De}from"../chart.js";import{parseFormula as Ne}from"../formula/parse.js";import{sheetPrefix as be}from"../formula/print.js";import{HEAD as _e,attr as b,el as d,flag as ve,numberAttr as E,tag as r,tags as O,textOf as P}from"./xml.js";const je="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",Ee="http://schemas.openxmlformats.org/drawingml/2006/main",$e="http://schemas.openxmlformats.org/drawingml/2006/chart",Oe="http://schemas.openxmlformats.org/officeDocument/2006/relationships",v=9525,Le=(e,n)=>`${be(e.sheet.name)}$${we(e.left)}$${String(e.top+1)}${e.single?"":`:$${we(e.right)}$${String(n+1)}`}`;function L(e,n,t){if(!t?.node)return;const o=e.eval(t.node,{sheet:n,row:0,col:0,dr:0,dc:0}),s=l=>Le(l,Math.min(l.bottom,Math.max(l.top,l.sheet.lastRow)));if(o instanceof ye)return s(o);if(o instanceof Se)return`(${o.parts.map(s).join(",")})`;const a=t.node;if(a.kind==="name"&&a.sheet!==void 0&&!(o instanceof Me&&o.code==="#NAME?"))return`${be(a.sheet)}${a.name}`}function ze(e,n,t){if(!t?.node)return!1;const o=e.eval(t.node,{sheet:n,row:0,col:0,dr:0,dc:0});return o instanceof ye&&typeof e.value(o.sheet,o.top,o.left)=="number"}export function chartPart(e,n,t){const o=Re(e,n,t),s=t.series.map((c,f)=>({s:c,i:f,values:L(e,n,c.values)})).filter(c=>c.values!==void 0),a={...o,series:s.flatMap(c=>o.series[c.i]??[])},l=ze(e,n,t.categories),h=l?Fe(e,n,t):void 0,m={name:c=>L(e,n,s[c]?.s.name),categories:L(e,n,t.categories),numeric:l,...h===void 0?{}:{categoryNumbers:h.values,categoryFormat:h.format},values:c=>s[c]?.values??"",x:c=>L(e,n,s[c]?.s.x??t.categories)},y=L(e,n,t.title);return Pe(a,{refs:m,...y===void 0?{}:{titleRef:y}})}const Ge=(e,n,t)=>d("xdr:oneCellAnchor",{},d("xdr:from",{},`<xdr:col>${String(e.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round(e.x*v))}</xdr:colOff>`,`<xdr:row>${String(e.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((e.y??0)*v))}</xdr:rowOff>`),d("xdr:ext",{cx:Math.round(e.width*v),cy:Math.round(e.height*v)}),d("xdr:pic",{},d("xdr:nvPicPr",{},d("xdr:cNvPr",{id:n,name:e.name,descr:e.path}),d("xdr:cNvPicPr",{},d("a:picLocks",{noChangeAspect:!0}))),d("xdr:blipFill",{},d("a:blip",{"xmlns:r":Oe,"r:embed":`rId${String(t)}`}),d("a:stretch",{},d("a:fillRect"))),d("xdr:spPr",{},d("a:xfrm",{},d("a:off",{x:0,y:0}),d("a:ext",{cx:Math.round(e.width*v),cy:Math.round(e.height*v)})),d("a:prstGeom",{prst:"rect"},d("a:avLst")))),d("xdr:clientData"));export function drawingPart(e,n=[]){const t=(o,s)=>{const{width:a,height:l}=De(o.spec);return d("xdr:oneCellAnchor",{},d("xdr:from",{},`<xdr:col>${String(o.at.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round((o.spec.x??0)*v))}</xdr:colOff>`,`<xdr:row>${String(o.at.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((o.spec.y??0)*v))}</xdr:rowOff>`),d("xdr:ext",{cx:Math.round(a*v),cy:Math.round(l*v)}),d("xdr:graphicFrame",{macro:""},d("xdr:nvGraphicFramePr",{},d("xdr:cNvPr",{id:s+2,name:`Chart ${String(s+1)}`}),d("xdr:cNvGraphicFramePr")),d("xdr:xfrm",{},d("a:off",{x:0,y:0}),d("a:ext",{cx:0,cy:0})),d("a:graphic",{},d("a:graphicData",{uri:$e},d("c:chart",{"xmlns:c":$e,"xmlns:r":Oe,"r:id":`rId${String(s+1)}`})))),d("xdr:clientData"))};return _e+d("xdr:wsDr",{"xmlns:xdr":je,"xmlns:a":Ee},...e.map(t),...n.map((o,s)=>Ge(o,e.length+s+2,e.length+s+1)))}function ne(e){if(Array.isArray(e))return e.map(ne).join("");if(typeof e!="object"||e===null)return"";const n=e,t=[];for(const[o,s]of Object.entries(n))o==="t"?t.push(P(s)):typeof s=="object"&&t.push(ne(s));return t.join("")}const te=e=>{const n=r(e?.solidFill),t=b(r(n?.srgbClr),"val");return t!==void 0?`#${t.toUpperCase()}`:Ie[b(r(n?.schemeClr),"val")??""]},Ie={accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47"},A=(e,n)=>b(r(e?.[n]),"val"),M=(e,n)=>E(r(e?.[n]),"val"),z=(e,n)=>ve(r(e?.[n]),"val"),Te=e=>/^"(?:[^"]|"")*"$/u.test(e)?e.slice(1,-1).replaceAll('""','"'):void 0,Ae=e=>Te(e)??`=${e}`;function Ce(e){if(!e)return;const n=r(e.tx),t=r(n?.strRef);if(t)return Ae(P(t.f));const o=ne(n?.rich);return o===""?void 0:o}function re(e){if(!e)return;const n=r(e.scaling),t=r(e.numFmt),o=b(t,"formatCode"),s={},a=Ce(r(e.title));a!==void 0&&(s.title=a);const l=M(n,"min"),h=M(n,"max"),m=M(e,"majorUnit");return l!==void 0&&(s.min=l),h!==void 0&&(s.max=h),m!==void 0&&m>0&&(s.major=m),z(e,"delete")===!0&&(s.visible=!1),A(n,"orientation")==="maxMin"&&(s.reverse=!0),o!==void 0&&o!=="General"&&ve(t,"sourceLinked")!==!0&&(s.format=o),s}const G=e=>{const n=r(e?.numRef)??r(e?.strRef),t=n?P(n.f):"";return t===""?void 0:t};function We(e,n){const t=G(r(e[n?"yVal":"val"]));if(t===void 0)return"its numbers are written in the chart";const o={values:t},s=r(e.tx),a=G(s);if(a!==void 0)o.name=Ae(a);else{const u=P(s?.v);u!==""&&(o.name=u)}const l=r(e.spPr),h=r(l?.ln),m=r(e.marker),y=n||m!==void 0,c=te(l)??(y?te(h)??te(r(m?.spPr)):void 0);c!==void 0&&(o.color=c);const f=E(h,"w");if(y&&f!==void 0&&h?.noFill===void 0){const u=Math.max(.25,Number((f/12700).toFixed(2)));u!==ge.lineWidth&&(o.line_width=u)}z(e,"smooth")===!0&&(o.smooth=!0);const p=M(m,"size");p!==void 0&&p!==ge.marker&&(o.marker_size=p);const $=n?G(r(e.xVal)):void 0;$!==void 0&&(o.x=$);const g=n?void 0:G(r(e.cat));return{series:o,...g===void 0?{}:{categories:g}}}function oe(e,n){const t=O(n.ser),o=a=>r(r(a.spPr)?.ln)?.noFill!==void 0,s=a=>A(r(a.marker),"symbol")==="none";switch(e){case"barChart":return Ue(n);case"lineChart":return t.every(s)?"line":"line-markers";case"areaChart":return Be(n);case"pieChart":return"pie";case"doughnutChart":return"doughnut";case"scatterChart":return t.every(o)?"scatter":t.some(a=>z(a,"smooth")===!0)?"scatter-smooth":"scatter-lines";default:return}}function Ue(e){const n=A(e,"barDir")==="bar"?"bar":"column",t=A(e,"grouping");return t==="stacked"?`${n}-stacked`:t==="percentStacked"?`${n}-stacked-100`:`${n}-clustered`}function Be(e){const n=A(e,"grouping");return n==="stacked"?"area-stacked":n==="percentStacked"?"area-stacked-100":"area"}function I(e,n){if(e===void 0)return;const t=e.replace(/^=/u,"");if(/(?:^|[(,])'?\[\d+\]/u.test(t))return"it reads another workbook";if(e.includes("#REF!"))return"its cells were deleted (#REF!)";const o=/^(?:'((?:[^']|'')+)'|([^!'(),]+))!/u.exec(t),s=o?.[1]?.replaceAll("''","'")??o?.[2];if(s!==void 0&&!n(s))return`it reads a sheet the workbook does not have (${s})`;const a=Ne(`=${t}`);if(!a.ok||!T(a.node))return`it names no cells (${t})`}function T(e){switch(e.kind){case"ref":case"name":case"structured":return!0;case"paren":return T(e.arg);case"binary":return(e.op===","||e.op===":")&&T(e.left)&&T(e.right);default:return!1}}export function readChart(e,n=[],t=()=>!0){const o=r(e?.chartSpace),s=r(o?.chart),a=r(s?.plotArea);if(!s||!a)return"it has no plot";const l=Object.entries(a).filter(([i])=>i.endsWith("Chart")).flatMap(([i,x])=>O(x).map(k=>({kind:i,plot:k}))),[h]=l;if(!h)return"it has no plot";const m=O(a.valAx),y=i=>O(i.axId).map(x=>b(x,"val")),c=i=>{const x=m.find(k=>y(i).includes(b(r(k.axId),"val")));return x!==void 0&&A(x,"axPos")==="r"},f=l.length>1,p=l.map(({kind:i,plot:x})=>({kind:i,plot:x,type:oe(i,x),secondary:f&&c(x)}));if(f&&p.some(i=>i.type===void 0||!(i.type.startsWith("column")||i.type.startsWith("line")||i.type.startsWith("area"))))return"it combines several kinds of chart, not columns, lines and areas";const $=p.find(i=>!i.secondary)??p[0]??h,{kind:g,plot:u}=$,F=g==="scatterChart",S=[];let R,D;const N=p.flatMap(i=>O(i.plot.ser).map(x=>({s:x,of:i}))),U=N.filter(({s:i})=>i.trendline!==void 0).length;U>0&&n.push(U===1?"trendline":`trendlines of ${String(U)} series`);const B=N.filter(({s:i})=>i.errBars!==void 0).length;B>0&&n.push(B===1?"error bars":`error bars of ${String(B)} series`);for(const[i,{s:x,of:k}]of N.entries()){const w=We(x,F);if(typeof w=="string")return w;if(f){const ee=k.type;ee!==void 0&&ee!==oe(g,u)&&(w.series.type=ee),k.secondary&&(w.series.secondary=!0)}const Z=I(w.series.values,t);if(Z!==void 0){n.push(`series ${String(i+1)}, as ${Z}`),D=Z;continue}w.series.name?.startsWith("=")===!0&&I(w.series.name,t)!==void 0&&delete w.series.name,I(w.series.x,t)!==void 0&&delete w.series.x,S.push(w.series),I(w.categories,t)===void 0&&(R??=w.categories)}if(S.length===0)return D===void 0?"it has no series":`every series ${D.replace(/^it /u,"")}`;const j=oe(g,u);if(!j)return`a sheet has no ${g.replace(/Chart$/u,"")} chart`;const se=Ce(r(s.title)),ie=r(s.legend),V=A(ie,"legendPos"),ce=r(u.dLbls),C=i=>z(ce,i)===!0,ke=C("showVal")||C("showPercent")||C("showCatName")||C("showSerName"),ae=A(ce,"dLblPos"),H=M(u,"gapWidth"),de=M(u,"overlap"),X=M(u,"holeSize"),fe=z(u,"varyColors"),ue=j==="pie"||j==="doughnut",le=i=>y(u).includes(b(r(i.axId),"val")),me=[...O(a.catAx),...O(a.dateAx)],_={value:f?m.find(le)??m[0]:m.find((i,x,k)=>F?x===k.length-1:!0),category:F?m[0]:f?me.find(le)??me[0]:r(a.catAx)??r(a.dateAx),second:p.some(i=>i.secondary)?m.find(i=>A(i,"axPos")==="r"):void 0},q=re(_.value),J=re(_.category);q&&_.value?.majorGridlines===void 0&&(q.gridlines=!1),J&&_.category?.majorGridlines!==void 0&&(J.gridlines=!0);const K=E(r(r(r(r(o?.txPr)?.p)?.pPr)?.defRPr),"sz"),Q=i=>i&&Object.keys(i).length>0?i:void 0,he=Q(q),pe=Q(J),Y=re(_.second);Y&&_.second?.majorGridlines!==void 0&&(Y.gridlines=!0);const xe=Q(Y);return{type:j,at:"A1",...se===void 0?{}:{title:se},...R===void 0?{}:{categories:R},series:ue?S.slice(0,1):S,...ie?{legend:V==="b"?"bottom":V==="t"?"top":V==="l"?"left":"right"}:{},...ke?{labels:{...C("showVal")?{value:!0}:{},...C("showPercent")?{percentage:!0}:{},...C("showCatName")?{category:!0}:{},...C("showSerName")?{series:!0}:{},...ae===void 0?{}:{position:ae}}}:{},...H===void 0||H===150?{}:{gap_width:H},...de===void 0||j.includes("stacked")?{}:{overlap:de},...X===void 0||X===50?{}:{hole_size:X},...fe===!0&&g==="barChart"?{vary_by_categories:!0}:{},...fe===!1&&ue?{vary_by_categories:!1}:{},...he?{value_axis:he}:{},...pe?{category_axis:pe}:{},...xe?{secondary_axis:xe}:{},...K===void 0||K===900?{}:{size:K/100}}}const W=e=>Math.round(e/v);export function chartAnchors(e,n,t){const o=r(e?.wsDr),s=[],a=[];let l=0;const h=c=>({col:Number(P(c?.col)),row:Number(P(c?.row)),colOff:W(Number(P(c?.colOff))),rowOff:W(Number(P(c?.rowOff)))}),m=c=>b(r(r(r(r(c.graphicFrame)?.graphic)?.graphicData)?.chart),"id"),y=(c,f,p,$)=>{const g={at:{row:f.row,col:f.col},...f.colOff>0?{x:f.colOff}:{},...f.rowOff>0?{y:f.rowOff}:{},width:p,height:$},u=r(c.pic),F=b(r(r(u?.blipFill)?.blip),"embed");if(u&&F!==void 0){const R=r(r(u.nvPicPr)?.cNvPr),D=b(R,"name"),N=b(R,"descr");a.push({id:F,...g,...D===void 0?{}:{name:D},...N===void 0?{}:{descr:N}});return}const S=m(c);if(S===void 0){l+=1;return}s.push({id:S,...g})};for(const c of O(o?.oneCellAnchor)){const f=r(c.ext);y(c,h(r(c.from)),W(E(f,"cx")??0),W(E(f,"cy")??0))}for(const c of O(o?.twoCellAnchor)){const f=h(r(c.from)),p=h(r(c.to));let $=p.colOff-f.colOff;for(let u=f.col;u<p.col;u++)$+=n(u);let g=p.rowOff-f.rowOff;for(let u=f.row;u<p.row;u++)g+=t(u);y(c,f,$,g)}return{anchors:s,pictures:a,others:l}}