efficient-shell 8.25.0 → 8.31.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 (161) hide show
  1. package/README.md +17 -1
  2. package/dist/{Browser-RJEKM63G.js → Browser-CFASYHEO.js} +13 -13
  3. package/dist/Calculator-4JDJKSA7.js +29 -0
  4. package/dist/{CurrencyConverter-LUDRYE35.js → CurrencyConverter-S7LG5PMX.js} +6 -6
  5. package/dist/{Documents-JBPK256V.js → Documents-OHA5LY2W.js} +5 -5
  6. package/dist/{Files-CWO6JJRY.js → Files-7QHP4BLV.js} +87 -87
  7. package/dist/{Notepad-P32DNQV3.js → Notepad-63WDR4UZ.js} +10 -10
  8. package/dist/{PomodoroTimer-773FYTGF.js → PomodoroTimer-ZR2VLO6G.js} +68 -68
  9. package/dist/{Preview-C56RWJL7.js → Preview-GC4TXEJ5.js} +24 -24
  10. package/dist/{Sidebar-3HM646LN.js → Sidebar-YB4OVUG5.js} +34 -34
  11. package/dist/{Spreadsheet-F3UZ7I6T.js → Spreadsheet-XWQZBPUS.js} +13 -13
  12. package/dist/{Stock-US3UN5TD.js → Stock-VNFYS73L.js} +7 -7
  13. package/dist/{Weather-TOY4CXLT.js → Weather-DS4YZ6SH.js} +16 -16
  14. package/dist/{WorldClock-6JV67SYH.js → WorldClock-7S4TITSF.js} +6 -6
  15. package/dist/ai/index.d.ts +44 -3
  16. package/dist/ai/index.js +22 -21
  17. package/dist/ai.css +1 -1
  18. package/dist/apps/index.d.ts +6 -2
  19. package/dist/apps/index.js +1 -1
  20. package/dist/bin/media-host-check.js +1 -1
  21. package/dist/bin/ui-check.js +1 -1
  22. package/dist/charts/BoxPlotChart.js +1 -1
  23. package/dist/charts/CandlestickChart.js +1 -1
  24. package/dist/charts/CartesianPlot.js +1 -1
  25. package/dist/charts/ChordChart.js +1 -1
  26. package/dist/charts/ColumnChart.js +1 -1
  27. package/dist/charts/HeatmapChart.js +1 -1
  28. package/dist/charts/HistogramChart.js +1 -1
  29. package/dist/charts/RadarChart.js +1 -1
  30. package/dist/charts/RangeChart.js +1 -1
  31. package/dist/charts/SankeyChart.js +1 -1
  32. package/dist/charts/ScatterChart.js +1 -1
  33. package/dist/charts/SpecChart.js +1 -1
  34. package/dist/charts/SunburstChart.js +1 -1
  35. package/dist/charts/TimeSeriesChart.js +1 -1
  36. package/dist/charts/TreemapChart.js +1 -1
  37. package/dist/charts/WaterfallChart.js +1 -1
  38. package/dist/chunk-24AL3CDS.js +1 -0
  39. package/dist/chunk-2NRQJ3SC.js +1 -0
  40. package/dist/{chunk-PPFMXLEX.js → chunk-2RBWQVDC.js} +8 -8
  41. package/dist/chunk-37JDUDCO.js +22 -0
  42. package/dist/{chunk-QR6V44P5.js → chunk-3EEA6MWV.js} +1 -1
  43. package/dist/chunk-3JJFBUK6.js +3 -0
  44. package/dist/{chunk-H33Z4ZIY.js → chunk-3WC6ITJ3.js} +6 -6
  45. package/dist/chunk-4AAGZQX7.js +10 -0
  46. package/dist/{chunk-REOSJZED.js → chunk-74TPCYHX.js} +15 -15
  47. package/dist/{chunk-WSODT2L5.js → chunk-AX7KPMDV.js} +2 -2
  48. package/dist/{chunk-53ROHXAV.js → chunk-B55IXYDR.js} +2 -2
  49. package/dist/{chunk-IFDW5QW6.js → chunk-BIYL7CEI.js} +2 -2
  50. package/dist/chunk-CUZQVBPC.js +1 -0
  51. package/dist/{chunk-ATX4N3L4.js → chunk-DCUBOLIR.js} +4 -4
  52. package/dist/{chunk-37CCKGHU.js → chunk-EYX6KLCZ.js} +1 -1
  53. package/dist/{chunk-IFLIGOSU.js → chunk-F64DN4BV.js} +3 -3
  54. package/dist/{chunk-ZNCU3UIW.js → chunk-FRPNTDP4.js} +4 -4
  55. package/dist/{chunk-ETNNJUAX.js → chunk-GWIPZKZJ.js} +3 -3
  56. package/dist/{chunk-MXVJHVVI.js → chunk-JCMP5KMS.js} +5 -5
  57. package/dist/{chunk-Q4TGK2K6.js → chunk-JOIWDQRJ.js} +4 -4
  58. package/dist/{chunk-IYZO6ADE.js → chunk-KNVE7CMS.js} +1 -1
  59. package/dist/{chunk-FOLZVO2Z.js → chunk-KWMMIOHD.js} +1 -1
  60. package/dist/{chunk-WISGY2OI.js → chunk-L3NYH4QV.js} +37 -37
  61. package/dist/{chunk-JUGPTBMS.js → chunk-LBLV64XG.js} +1 -1
  62. package/dist/{chunk-GECH6THP.js → chunk-LLLAIPFX.js} +1 -1
  63. package/dist/{chunk-4SQNLU2Q.js → chunk-MTXTJLFK.js} +1 -1
  64. package/dist/{chunk-ZZNOQQWE.js → chunk-NFR4QZL2.js} +4 -4
  65. package/dist/chunk-NT26CWMZ.js +5 -0
  66. package/dist/{chunk-WSPO4N72.js → chunk-OSA24YH6.js} +14 -14
  67. package/dist/{chunk-O6JX6RDX.js → chunk-PJCVNFWM.js} +7 -7
  68. package/dist/{chunk-6YH7JKRE.js → chunk-QFA5COE6.js} +2 -2
  69. package/dist/{chunk-VV37BGSY.js → chunk-QPX35URZ.js} +12 -12
  70. package/dist/{chunk-I4VD5D43.js → chunk-RSO67DWS.js} +4 -4
  71. package/dist/chunk-S6OB6HJB.js +1 -0
  72. package/dist/{chunk-BKZGI76S.js → chunk-TFMC2WAS.js} +1 -1
  73. package/dist/{chunk-VP3CMJTT.js → chunk-UX6HNRFV.js} +7 -7
  74. package/dist/{chunk-ETF7LAYZ.js → chunk-W5M6P4DZ.js} +5 -5
  75. package/dist/chunk-W7S56JZ7.js +7 -0
  76. package/dist/chunk-WZNGOA4Z.js +1 -0
  77. package/dist/{chunk-OVVXSAGE.js → chunk-X7XJBK2E.js} +4 -4
  78. package/dist/{chunk-K4BEWZBI.js → chunk-XC55NMXR.js} +1 -1
  79. package/dist/{chunk-3IYMTPGR.js → chunk-YGZMD6TZ.js} +12 -12
  80. package/dist/{chunk-2C6IG7LG.js → chunk-Z2YGQBLZ.js} +1 -1
  81. package/dist/{chunk-7IMJJT2K.js → chunk-Z7BZBDOI.js} +3 -3
  82. package/dist/{chunk-M2AIC7IK.js → chunk-ZEKM6HAA.js} +2 -2
  83. package/dist/{chunk-ZNXBKFV7.js → chunk-ZOSIPTXM.js} +5 -5
  84. package/dist/data/ListLoadError.js +1 -1
  85. package/dist/format/index.d.ts +3 -0
  86. package/dist/format/index.js +1 -1
  87. package/dist/forms/BorderInput.js +1 -1
  88. package/dist/forms/BrandAssetEditor.js +1 -1
  89. package/dist/forms/ColorPicker.js +1 -1
  90. package/dist/forms/ComposerAttachments.js +1 -1
  91. package/dist/forms/CornersInput.js +1 -1
  92. package/dist/forms/DisplayChips.js +1 -1
  93. package/dist/forms/IconPicker.js +1 -1
  94. package/dist/forms/InputNumber.js +1 -1
  95. package/dist/forms/LinkPicker.js +1 -1
  96. package/dist/forms/MediaLibrary.js +1 -1
  97. package/dist/forms/MediaUploadField.js +1 -1
  98. package/dist/forms/MediaUsedInList.js +1 -1
  99. package/dist/forms/PositionInput.js +1 -1
  100. package/dist/forms/SidesInput.js +1 -1
  101. package/dist/forms/Slider.js +1 -1
  102. package/dist/forms/Snippet.js +1 -1
  103. package/dist/forms/SplitButton.js +1 -1
  104. package/dist/forms/TextToolbar.js +1 -1
  105. package/dist/forms/WidthsBar.js +1 -1
  106. package/dist/forms/color.d.ts +35 -1
  107. package/dist/forms/color.js +1 -1
  108. package/dist/hooks/useTheme.js +1 -1
  109. package/dist/icons/efficient-glyphs.js +1 -1
  110. package/dist/icons/efficient-looks.js +1 -1
  111. package/dist/icons/efficient.js +1 -1
  112. package/dist/icons/index.js +1 -1
  113. package/dist/icons/looks/map.js +1 -1
  114. package/dist/icons/sets.js +1 -1
  115. package/dist/index.d.ts +4 -2
  116. package/dist/index.js +177 -177
  117. package/dist/map/index.js +1 -1
  118. package/dist/map-site.css +43 -0
  119. package/dist/page-tabs/index.js +5 -5
  120. package/dist/shell/AppUpdateBanner.js +1 -1
  121. package/dist/shell/ContextMenu.js +1 -1
  122. package/dist/shell/DropdownMenu.js +1 -1
  123. package/dist/shell/EditableGrid.js +1 -1
  124. package/dist/shell/HelpCenter.js +1 -1
  125. package/dist/shell/ImageLightbox.js +1 -1
  126. package/dist/shell/LanguageSelect.js +1 -1
  127. package/dist/shell/Markdown.d.ts +33 -2
  128. package/dist/shell/Markdown.js +1 -1
  129. package/dist/shell/PopupMenu.js +1 -1
  130. package/dist/shell/SearchableSelect.js +1 -1
  131. package/dist/shell/SettingReset.js +1 -1
  132. package/dist/shell/SettingRow.js +1 -1
  133. package/dist/shell/TopNav.d.ts +3 -1
  134. package/dist/shell/TopNav.js +1 -1
  135. package/dist/telemetry/index.js +1 -1
  136. package/dist/templates/ChatTemplate.js +1 -1
  137. package/dist/templates/CheckoutTemplate.js +1 -1
  138. package/dist/templates/DashboardTemplate.js +1 -1
  139. package/dist/templates/DataTablePage.js +1 -1
  140. package/dist/templates/EmailTemplate.js +1 -1
  141. package/dist/templates/FormLayoutPage.js +1 -1
  142. package/dist/ui/index.d.ts +4 -2
  143. package/dist/ui/index.js +1 -1
  144. package/dist/utils/escapeHtml.d.ts +14 -0
  145. package/dist/utils/escapeHtml.js +1 -0
  146. package/dist/utils/slugify.d.ts +16 -0
  147. package/dist/utils/slugify.js +1 -0
  148. package/dist/version.js +1 -1
  149. package/package.json +1 -1
  150. package/dist/Calculator-OFKUHJMM.js +0 -29
  151. package/dist/chunk-4DAN4Q6P.js +0 -21
  152. package/dist/chunk-4LXH6DCN.js +0 -1
  153. package/dist/chunk-7FI6NVC7.js +0 -3
  154. package/dist/chunk-BF7NTCLU.js +0 -1
  155. package/dist/chunk-EMXR74QM.js +0 -7
  156. package/dist/chunk-H245LLX4.js +0 -1
  157. package/dist/chunk-KBGC53FI.js +0 -1
  158. package/dist/chunk-Q2YDR6GF.js +0 -7
  159. package/dist/chunk-U6BEF6GQ.js +0 -5
  160. /package/dist/{chunk-A5ALFLWZ.js → chunk-2HDDCXTW.js} +0 -0
  161. /package/dist/{chunk-BR22X7E5.js → chunk-G6DKCCWH.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{execFileSync as e}from"child_process";import{createRequire as t}from"module";import{join as n}from"path";import{existsSync as i,readFileSync as s,writeFileSync as o,readdirSync as r}from"fs";var a=["button","input","range","textarea","select","dialog","title","portal","native","dark","hex","radius","spacing","font-size","z-index","shadow","kit","icon","svg","kit-dep","chart","chart-dep","ellipsis-label"],l=e=>"string"==typeof e&&a.includes(e),c=["kit-dep","chart-dep"],d=e=>c.includes(e),u=a.filter(e=>!d(e)),h={button:{counts:"a raw <button>",instead:"Button or IconButton from efficient-shell/ui"},input:{counts:"a raw <input> (not hidden, not a range)",instead:"Input, InputNumber, Checkbox, Radio or Switch from efficient-shell/ui"},range:{counts:'a raw <input type="range">',instead:"Slider from efficient-shell/ui"},textarea:{counts:"a raw <textarea>",instead:"Textarea from efficient-shell/ui"},select:{counts:"a raw <select>",instead:"Select or SearchableSelect from efficient-shell/ui"},dialog:{counts:'a raw <dialog>, or role="dialog" / role="alertdialog" on a raw element',instead:"Dialog or Modal from efficient-shell"},title:{counts:"a title= on a raw element (the browser's own tooltip)",instead:"Tooltip from efficient-shell/ui (harness UI-17)"},portal:{counts:"a createPortal(…) call (a layer the file floats itself)",instead:"Popover, PopupMenu, DropdownMenu, Tooltip or Dialog from efficient-shell/ui"},native:{counts:"window.confirm / alert / prompt, or a bare call that resolves to one",instead:"confirm, confirmDestructive, prompt or toast from efficient-shell (harness UI-20)"},dark:{counts:"a dark: variant in a class string",instead:"the light Tailwind class alone; the shell remaps it in dark mode (harness UI-7)"},hex:{counts:"a hex colour literal in a .tsx string",instead:"a shell token or a Tailwind palette class (harness FT-1)"},radius:{counts:"a literal corner radius (an arbitrary-value radius class, or an inline borderRadius)",instead:"a radius utility from the scale or a role token such as rounded-(--radius-control); the theme sets how round they are (harness UI-7)"},spacing:{counts:"a padding, margin or gap off the scale (6px, 10px, 14px …) or written as a literal length (an arbitrary-value class, an inline style)",instead:"a step of the scale 2/4/8/12/16/20/24/32/40/48 — a Tailwind step, or a role such as var(--space-control-x) (owner ruling 2026-10-12)"},"font-size":{counts:"a literal font size (an arbitrary-value text class, an inline fontSize)",instead:"a type step 9/11/12/14/16/18/20/24/30 — Tailwind's 3xs … 3xl text steps (owner ruling 2026-10-12)"},"z-index":{counts:"a stack order above 30 written as a number (a z utility, an arbitrary value, an inline zIndex)",instead:"a named layer: Z_LAYERS (efficient-shell/ui) in code, its --z-* custom property in markup"},shadow:{counts:"a literal shadow, or a shadow size that is not an elevation level (md, 2xl, xs)",instead:"an elevation: the sm / lg / xl utilities, or var(--elevation-panel) and its siblings (owner ruling 2026-10-12)"},kit:{counts:"an import of a second UI kit",instead:"the component from efficient-shell/ui, or fold it into the shell (harness FT-3)"},icon:{counts:"an import of an icon package",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24)"},svg:{counts:"an <svg> element written in JSX: an icon drawn in place",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24). A chart, an illustration or a mark a host supplies stays on the baseline"},"kit-dep":{counts:"a UI kit or icon package declared in package.json (not one the shell entries imported here need)",instead:"remove the dependency once nothing imports it (harness FT-3)"},chart:{counts:"an import of a second chart library",instead:"a chart from efficient-shell/ui (ChartFrame, TimeSeriesChart, ColumnChart, RankedBars, PieChart, FunnelChart, ScatterChart, …), or add the chart there: one chart system (harness FT-3)"},"chart-dep":{counts:"a chart library declared in package.json",instead:"remove the dependency once nothing imports it (harness FT-3)"},"ellipsis-label":{counts:'a button, link or menu label that ends in "…" or "..."',instead:'the label without the dots, saying what it does ("Extend trial"): "…" means only "the words are cut" (owner ruling 2026-10-14)'}},p=["@headlessui/","@radix-ui/","@mui/","@chakra-ui/","@mantine/","@floating-ui/","antd","react-aria","react-aria-","react-bootstrap","react-select","react-colorful","react-tooltip","react-hot-toast","react-toastify","sonner"],f=["@heroicons/","@tabler/icons","@tabler/icons-","@phosphor-icons/","@fortawesome/","@iconify/","@radix-ui/react-icons","@mui/icons-material","lucide","lucide-react","simple-icons","react-icons","react-feather"],m=["recharts","chart.js","react-chartjs-2","d3","d3-","@nivo/","victory","victory-","echarts","echarts-for-react","apexcharts","react-apexcharts","@visx/","highcharts","highcharts-react-official","plotly.js","plotly.js-dist","react-plotly.js","lightweight-charts","@antv/g2","@antv/g2plot","chartist","billboard.js","c3","uplot"],g={"efficient-shell":["@headlessui/react"]};function w(e,t){return t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}function k(e){return w(e,f)?"icon":w(e,p)?"kit":w(e,m)?"chart":null}function x(e){const t=k(e);return"kit"===t||"icon"===t?"kit-dep":"chart"===t?"chart-dep":null}var $=/[.+^$()|[\]\\]/g;function b(e){let t="",n=0;for(let i=0;i<e.length;i++){const s=e[i];"*"===s?"*"===e[i+1]?"/"===e[i+2]?(t+="(?:[^/]+/)*",i+=2):(t+=".*",i+=1):t+="[^/]*":"?"===s?t+="[^/]":"{"===s?(t+="(?:",n+=1):"}"===s&&n>0?(t+=")",n-=1):t+=","===s&&n>0?"|":s.replace($,"\\$&")}if(0!==n)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${t}$`)}function y(e){const t=e.map(b);return e=>t.some(t=>t.test(e))}var v=new Set(["node_modules",".git"]),S=new Set(["dist","coverage",".next",".turbo"]);function j(e){const t=e.search(/[*?{]/),n=-1===t?e:e.slice(0,t),i=n.lastIndexOf("/");return-1===i?"":n.slice(0,i)}function I(e,t){const i=y(t),s=[...new Set(t.map(j))].sort(),o=s.filter(e=>!s.some(t=>t!==e&&(""===t||e.startsWith(`${t}/`)))),a=new Set,l=t=>{let s;try{s=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of s){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?v.has(e.name)||""===t&&S.has(e.name)||l(n):e.isFile()&&i(n)&&a.add(n)}};for(const e of o)l(e);return[...a].sort(L)}var L=(e,t)=>e<t?-1:e>t?1:0,z=class extends Error{},R=(e,t)=>`${e}:${t}`;function E(e){const t=e.lastIndexOf(":");return{file:e.slice(0,t),kind:e.slice(t+1)}}var T=e=>a.indexOf(e);function A(e,t){const n=E(e),i=E(t);return L(n.file,i.file)||T(n.kind)-T(i.kind)}function C(e,t="ui-kit.baseline.json"){let n;try{n=JSON.parse(e)}catch(e){throw new z(`${t} is not valid JSON: ${e.message}`)}const i=e=>{throw new z(`${t}: ${e}. The tool writes this file; do not edit it by hand.`)};if("object"!=typeof n||null===n||Array.isArray(n))return i("must be a JSON object");const s=n;if(1!==s.schema)return i("number"==typeof s.schema&&s.schema>1?`"schema": ${s.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');if(!Array.isArray(s.kinds)||s.kinds.some(e=>"string"!=typeof e))return i('"kinds" must be a list');const o=s.kinds.filter(l);if("object"!=typeof s.counts||null===s.counts||Array.isArray(s.counts))return i('"counts" must be an object');const r=new Map;for(const[e,t]of Object.entries(s.counts)){const{file:n,kind:s}=E(e);if(!n||!s)return i(`"${e}" is not "<file>:<kind>"`);if("number"!=typeof t||!Number.isInteger(t)||t<1)return i(`"${e}" must be a whole number, 1 or more (a line that reaches 0 is deleted)`);l(s)&&r.set(e,t)}return{kinds:o,counts:r}}function M(e){const t=a.filter(t=>e.kinds.includes(t)),n=[...e.counts.keys()].filter(t=>(e.counts.get(t)??0)>0).sort(A).map(t=>` ${JSON.stringify(t)}: ${e.counts.get(t)}`);return["{",' "schema": 1,',` "kinds": [${t.map(e=>JSON.stringify(e)).join(", ")}],`,n.length?` "counts": {\n${n.join(",\n")}\n }`:' "counts": {}',"}",""].join("\n")}function B(e){const t={};for(const[n,i]of e){const{kind:e}=E(n);l(e)&&(t[e]=(t[e]??0)+i)}return t}var P=class extends Error{},N=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),D=new Set(["$schema","schema","kinds","include","exclude","includeImporting","output","allow"]);var O="package.json",F=[2,4,8,12,16,20,24,32,40,48];function J(e){if("0"===e||"px"===e)return!0;const t=Number(e);return!!Number.isFinite(t)&&F.includes(4*t)}var U=new Set(["iframe","frame","object","embed"]),W=new Set(["href","xlinkHref","to","id","key","htmlFor"]),q=/(?<![&\w])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,_=/(?<![\w-])rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|ee|es))?-\[([^\]]*)\]/g,G=/^border(?:(?:Top|Bottom)(?:Left|Right)|(?:Start|End)(?:Start|End))?Radius$/,K=/^(?:inherit|initial|unset|revert)$|var\(|^(?:50|100)%$|^(?:999|9999)(?:px)?$/,H=/(?<![\w-])-?(?:p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me|gap|gap-x|gap-y|space-x|space-y)-(\d+(?:\.\d+)?|px|\[[^\]]*\])(?![\w.[/-])/g,Q=/(?<![\w-])text-\[(?:length:)?(\d*\.?\d+(?:px|rem|em|%))\]/g,V=/(?<![\w-])z-(\d+|\[[^\]]*\])(?![\w.[/-])/g,X=/(?<![\w-])shadow-(xs|2xs|md|2xl|\[[^\]]*\])(?![\w.[/-])/g,Y=/var\(|^(?:inherit|initial|unset|revert|revert-layer|none|auto)$/,Z=/^(?:(?:padding|margin)(?:Top|Right|Bottom|Left|Inline|Block|InlineStart|InlineEnd|BlockStart|BlockEnd)?|gap|rowGap|columnGap)$/,ee=new Set([0,...F]),te=/(?<![\w-])dark:(?=[\w[\-!@*(])/g,ne=new Set(["button","a","option","Button","IconButton","SplitButton","Link","NavLink","PopupMenuItem","PopupMenuLabel","DropdownMenuItem","MenuItem","ContextMenuItem"]),ie=/(?:…|\.\.\.|&hellip;)\s*$/,se=new RegExp("\\p{L}","u"),oe=new RegExp("\\p{L}[\\p{L}-]*","u"),re={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"],zhStarts:["正在"],zhEnds:["中"]},placeholder:{},prompt:{}},ae=new Set((re.busy?.words??[]).map(e=>e.toLowerCase())),le=new Set(["label","aria-label",...re.placeholder?[]:["placeholder","searchPlaceholder","emptyOptionLabel","blankLabel"]]),ce=(e,t)=>{if(!ie.test(t)||!se.test(e))return!1;const n=e.match(oe)?.[0]?.toLowerCase();if(n&&ae.has(n))return!1;const i=e.replace(ie,"").trim(),s=re.busy;return!(s&&(s.zhStarts.some(e=>i.startsWith(e))||s.zhEnds.some(e=>i.endsWith(e))))},de=new Set(["confirm","alert","prompt"]),ue=new Set(["window","globalThis","self"]);function he(e,t,n,i,s){const o=new Set(i),r=e.createSourceFile(t,n,e.ScriptTarget.Latest,!0,function(e,t){return t.endsWith(".tsx")?e.ScriptKind.TSX:t.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(t)?e.ScriptKind.JS:e.ScriptKind.TS}(e,t)),a={},l=/\.[jt]sx$/.test(t),c=e=>r.getLineAndCharacterOfPosition(e).line+1,d=(e,t)=>{o.has(e)&&(a[e]??=[]).push(c(t.getStart(r)))},u=(t,n)=>t.attributes.properties.find(t=>e.isJsxAttribute(t)&&t.name.getText(r)===n),h=t=>{const n=t?.initializer;if(n)return e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:void 0},p=new Set;if(o.has("native")){const t=n=>{if(n)if(e.isIdentifier(n))de.has(n.text)&&p.add(n.text);else if(e.isObjectBindingPattern(n)||e.isArrayBindingPattern(n))for(const i of n.elements)e.isBindingElement(i)&&t(i.name)},n=i=>{(e.isImportClause(i)||e.isImportSpecifier(i)||e.isNamespaceImport(i)||e.isVariableDeclaration(i)||e.isParameter(i)||e.isFunctionDeclaration(i))&&t(i.name),e.forEachChild(i,n)};n(r)}const f=t=>t&&e.isStringLiteralLike(t)?t.text:void 0,m=(e,t)=>{e&&("efficient-shell"===e||e.startsWith("efficient-shell/"))&&s?.add(e);const n=e?k(e):null;n&&d(n,t)},g=(e,t,n)=>{if(o.has("dark"))for(const n of e.matchAll(te))d("dark",t);if(o.has("radius"))for(const n of e.matchAll(_))K.test(n[1].trim())||d("radius",t);if(n&&l&&o.has("hex"))for(const n of e.matchAll(q))d("hex",t);if(o.has("spacing"))for(const n of e.matchAll(H)){const e=n[1];(e.startsWith("[")?Y.test(e.slice(1,-1).trim()):J(e))||d("spacing",t)}if(o.has("font-size"))for(const n of e.matchAll(Q))d("font-size",t);if(o.has("z-index"))for(const n of e.matchAll(V)){const e=n[1].startsWith("[")?n[1].slice(1,-1).trim():n[1];/^\d+$/.test(e)&&Number(e)>30&&d("z-index",t)}if(o.has("shadow"))for(const n of e.matchAll(X))n[1].startsWith("[")&&Y.test(n[1].slice(1,-1).trim())||d("shadow",t)},w=(t,n,i)=>{const s=e.isStringLiteralLike(n)?n.text.trim():void 0;if(o.has("spacing")&&Z.test(t))e.isNumericLiteral(n)?ee.has(Number(n.text))||d("spacing",i):void 0!==s&&!Y.test(s)&&(e=>[...e.matchAll(/(-?\d*\.?\d+)(px|rem|em)\b/g)].map(e=>Math.abs(Number(e[1]))*("px"===e[2]?1:16)))(s).some(e=>!ee.has(e))&&d("spacing",i);else if(o.has("font-size")&&"fontSize"===t)(e.isNumericLiteral(n)||void 0!==s&&!Y.test(s)&&!/^(?:smaller|larger)$/.test(s))&&d("font-size",i);else if(o.has("z-index")&&"zIndex"===t){const t=[],s=n=>{e.isNumericLiteral(n)||e.isStringLiteralLike(n)&&/^\d+$/.test(n.text.trim())?t.push(Number(n.text)):e.forEachChild(n,s)};s(n);for(const e of t)e>30&&d("z-index",i)}else o.has("shadow")&&"boxShadow"===t&&(void 0===s||""===s||Y.test(s)||d("shadow",i))},x=(t,n)=>{if(e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)){const e=t.tagName.getText(r);if(/^[a-z]/.test(e)){const n=h(u(t,"type"));"svg"===e&&d("svg",t),"button"===e?d("button",t):"select"===e?d("select",t):"textarea"===e?d("textarea",t):"input"===e&&("range"===n?d("range",t):"hidden"!==n&&d("input",t));const i=h(u(t,"role"));"dialog"!==e&&"dialog"!==i&&"alertdialog"!==i||d("dialog",t),!U.has(e)&&u(t,"title")&&d("title",t)}}else if(e.isCallExpression(t)){const n=t.expression;e.isIdentifier(n)?"createPortal"===n.text?d("portal",t):de.has(n.text)&&!p.has(n.text)?d("native",t):"require"===n.text&&m(f(t.arguments[0]),t):e.isPropertyAccessExpression(n)?"createPortal"===n.name.text?d("portal",t):de.has(n.name.text)&&e.isIdentifier(n.expression)&&ue.has(n.expression.text)&&d("native",t):n.kind===e.SyntaxKind.ImportKeyword&&m(f(t.arguments[0]),t)}else{if(e.isImportDeclaration(t)||e.isExportDeclaration(t))return void m(f(t.moduleSpecifier),t);if(e.isPropertyAssignment(t)){const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"",i=t.initializer;w(n,i,t),o.has("radius")&&G.test(n)&&(e.isNumericLiteral(i)?K.test(i.text)||d("radius",t):e.isStringLiteralLike(i)&&!K.test(i.text.trim())&&d("radius",t))}else if(e.isStringLiteralLike(t))g(t.text,t,n);else if(e.isTemplateExpression(t)){g(t.head.text,t.head,n);for(const e of t.templateSpans)g(e.literal.text,e.literal,n)}}e.isJsxAttribute(t)&&W.has(t.name.getText(r))?e.forEachChild(t,e=>x(e,!1)):e.forEachChild(t,e=>x(e,n))};return x(r,!0),o.has("ellipsis-label")&&function(e,t,n){const i=new Set,s=(e,t)=>{i.has(e)||(i.add(e),n(t))},o=n=>{if(n)if(e.isStringLiteralLike(n))ce(n.text,n.text)&&s(n,n.getStart(t));else if(e.isTemplateExpression(n)){const e=[n.head.text,...n.templateSpans.map(e=>e.literal.text)];ce(e.join(" "),e[e.length-1])&&s(n,n.getStart(t))}else e.isConditionalExpression(n)?(o(n.whenTrue),o(n.whenFalse)):e.isBinaryExpression(n)?(o(n.left),o(n.right)):e.isParenthesizedExpression(n)||e.isAsExpression(n)||e.isJsxExpression(n)?o(n.expression):e.isCallExpression(n)&&pe.has(fe(n.expression))&&n.arguments[0]&&o(n.arguments[0])},r=n=>{for(const i of n)if(e.isJsxText(i)){const e=i.getText(t);ce(e,e)&&s(i,i.getStart(t)+(e.length-e.trimStart().length))}else e.isJsxExpression(i)?o(i.expression):(e.isJsxElement(i)||e.isJsxFragment(i))&&r(i.children)},a=(n,i)=>{const s=n.attributes.properties.find(n=>e.isJsxAttribute(n)&&n.name.getText(t)===i),o=s?.initializer;return o&&e.isStringLiteral(o)?o.text:o&&e.isJsxExpression(o)&&o.expression&&e.isStringLiteralLike(o.expression)?o.expression.text:void 0},l=t=>t.properties.some(t=>e.isPropertyAssignment(t)&&(e.isIdentifier(t.name)||e.isStringLiteralLike(t.name))&&"value"===t.name.text&&e.isStringLiteralLike(t.initializer)&&""===t.initializer.text),c=n=>{if(e.isJsxElement(n)){const e=n.openingElement,i=e.tagName.getText(t),s="option"===i&&re.prompt&&""===a(e,"value");ne.has(i)&&!s&&r(n.children)}else if(e.isJsxAttribute(n))le.has(n.name.getText(t))&&o(n.initializer);else if(e.isPropertyAssignment(n)){const t=e.isIdentifier(n.name)||e.isStringLiteralLike(n.name)?n.name.text:"",i=re.prompt&&e.isObjectLiteralExpression(n.parent)&&l(n.parent);le.has(t)&&!i&&o(n.initializer)}e.forEachChild(n,c)};c(t)}(e,r,e=>(a["ellipsis-label"]??=[]).push(c(e))),a}var pe=new Set(["say","t"]),fe=e=>{const t=e.getText();return t.slice(t.lastIndexOf(".")+1)};function me(e){const t={};for(const[n,i]of Object.entries(e))i.length&&(t[n]=i.length);return t}function ge(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),s=[];for(const t of i.statements)(e.isImportDeclaration(t)||e.isExportDeclaration(t))&&t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&s.push(t.moduleSpecifier.text);return s}var we=(e,t)=>e.some(e=>t.some(t=>t.endsWith("/*")?e.startsWith(t.slice(0,-1)):e===t));var ke=e=>new Map(e.allow.map(e=>[R(e.file,e.kind),e.count]));function xe(e,t){return e.kinds.filter(e=>t.kinds.includes(e))}var $e=(e,t,n)=>{if("kit-dep"===n)return` (${e.kitDeps.join(", ")})`;if("chart-dep"===n)return` (${e.chartDeps.join(", ")})`;const i=e.hits.get(t)?.[n]??[];if(0===i.length)return"";const s=i.slice(0,12).join(", ");return` (line${1===i.length?"":"s"} ${s}${i.length>12?", …":""})`};function be(e,t,n){const i=ke(e),s=new Map;for(const[e,o]of t.counts){const{kind:t}=E(e);if(!l(t)||!n.includes(t))continue;const r=o-(i.get(e)??0);r>0&&s.set(e,r)}return{kinds:a.filter(e=>n.includes(e)),counts:s}}function ye(e,t){let n=0;for(const i of new Set([...e.keys(),...t.keys()]))(e.get(i)??0)!==(t.get(i)??0)&&(n+=1);return n}var ve="\n// <button> in a comment is not a button, and <svg> in one is not a drawing\n/* nor is <input title=\"x\"> in this one, or dark:bg-black, or #fff */\nimport { createPortal } from 'react-dom';\nimport { Dialog } from '@headlessui/react';\nimport { TrashIcon } from '@heroicons/react/24/outline';\nimport type { Icon } from 'lucide-react';\nimport { Button, confirm } from 'efficient-shell';\nexport { Slot } from '@radix-ui/react-slot';\nexport { CheckIcon } from '@radix-ui/react-icons';\nimport { LineChart } from 'recharts';\nimport 'd3-scale';\nexport { VictoryPie } from 'victory';\nimport { BarChart } from '@mui/x-charts';\nimport Tree from 'react-d3-tree';\nimport { TimeSeriesChart } from 'efficient-shell/ui';\n// import 'chart.js' in a comment is not an import, and 'echarts' in a string is not one either\nconst chartLabel = 'd3-array';\n\nconst a = <button title=\"Says what it does\">x</button>;\nconst b = <input type=\"range\" />;\nconst c = <input type=\"text\" />;\nconst c2 = <input type={\"hidden\"} name=\"csrf\" />;\nconst c3 = <input type=\"hidden\" />;\nconst c4 = <input type={kind} />;\nconst d = <select />;\nconst d2 = <textarea />;\nconst e = <div role=\"dialog\" />;\nconst e2 = <dialog open />;\nconst e3 = <section role={'alertdialog'} />;\nconst f = <iframe title=\"Preview\" />;\nconst f2 = <object title=\"Chart\" />;\nconst g = <Button title=\"a prop, not a tooltip\" role=\"dialog\" />;\nconst g2 = (\n <button\n type=\"button\"\n title={hint}\n >\n y\n </button>\n);\nconst h = ReactDOM.createPortal(a, document.body);\nconst i = createPortal(a, document.body);\n\nasync function leave() {\n if (window.confirm('Sure?')) return;\n globalThis.alert('No');\n alert('native: nothing binds the name');\n prompt('native too');\n await confirm('the shell: the import binds it');\n record.confirm('a method, not the popup');\n}\n\nconst j = <div className=\"bg-white dark:bg-black dark:hover:text-white is-dark:no\" />;\nconst k = clsx('text-gray-900', on && 'dark:text-gray-100');\nconst l = <span style={{ color: '#fff', background: \"#12ab34\" }} className={`border-[#0a0b0c80] ${x}`} />;\nconst m = <a href=\"#faded\" id=\"#bad\" key=\"#abc\" to=\"#face\">skip</a>;\nconst n = <label htmlFor={'#dead'}>skip</label>;\nconst o = <span>&#1234; and BG#00340 and #12345 and #added are not colours</span>;\nconst p = 'entity &#x1f; ref BG#00340';\nconst q = <use xlinkHref=\"#abc\" fill=\"url(#fed)\" />;\nconst t = <div className=\"rounded-[4px] rounded-t-[0.5rem] hover:rounded-[2px] rounded-lg rounded-(--radius-card) rounded-[inherit] rounded-[var(--r)]\" />;\nconst u = <div style={{ borderRadius: 6, borderTopLeftRadius: '3px', borderBottomRightRadius: '50%', borderEndEndRadius: 'var(--radius-card)' }} />;\nconst v = <i style={{ borderRadius: 9999 }} />;\nconst w = <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M4 4h16\" /></svg>;\nconst w2 = <Svg viewBox=\"0 0 24 24\" />;\nconst w3 = '<svg viewBox=\"0 0 1 1\"></svg> in a string is not an element';\nconst r = lazy(() => import('@mui/material'));\nconst s = require('react-select');\nconst s2 = require('chart.js/auto');\nconst s3 = import('@nivo/line');\n",Se={button:2,input:2,range:1,textarea:1,select:1,dialog:3,title:2,portal:2,native:4,dark:3,hex:3,radius:5,kit:5,icon:3,svg:1,chart:5},je={kit:1,dark:1,portal:1,radius:2,chart:1},Ie=(...e)=>e.join("-"),Le=`\nconst s1 = <i className="${[Ie("px","2.5"),Ie("py","1.5"),"md:"+Ie("gap","1.5"),"-"+Ie("mt","1.5"),Ie("p","[10px]")].join(" ")}" />;\nconst s2 = <i className="${[Ie("p","0"),Ie("px","px"),Ie("p","0.5"),Ie("p","3"),Ie("gap-x","4"),Ie("p","12"),Ie("p","(--space-12)"),Ie("p","[var(--space-12)]"),Ie("space-x","reverse"),Ie("top","1.5")].join(" ")}" />;\nconst s3 = <i style={{ padding: 6, marginTop: '10px', gap: 8, margin: '0 auto', paddingInline: 'var(--space-12)' }} />;\nconst f1 = <i className="${[Ie("text","[11px]"),Ie("text","[0.8rem]"),Ie("text","xs"),Ie("text","[#fff]"),Ie("text","(--text-2xs)")].join(" ")}" />;\nconst f2 = <i style={{ fontSize: 12 }} />;\nconst f3 = { fontSize: 'var(--x)', font: 'inherit' };\nconst z1 = <i className="${[Ie("z","[9999]"),Ie("z","50"),Ie("z","10"),Ie("z","30"),"-"+Ie("z","10"),Ie("z","auto"),Ie("z","(--z-popup)"),Ie("z","[var(--z-popup)]")].join(" ")}" />;\nconst z2 = { zIndex: on ? 2020 : 2010 };\nconst z3 = { zIndex: Z_LAYERS.popup, top: 9999 };\nconst h1 = <i className="${[Ie("shadow","[0_1px_2px_#000]"),Ie("shadow","md"),"shadow",Ie("shadow","lg"),Ie("shadow","(--elevation-panel)"),Ie("shadow","black/20"),Ie("drop-shadow","md")].join(" ")}" />;\nconst h2 = { boxShadow: '0 1px 2px rgba(0,0,0,.1)' };\nconst h3 = { boxShadow: 'none', outline: 'var(--elevation-raised)' };\n`,ze={spacing:7,"font-size":3,"z-index":4,shadow:3,hex:1},Re={"ellipsis-label":9},Ee=e=>a.filter(t=>e[t]).map(t=>`${t} ${e[t]}`).join(", ")||"nothing";var Te="ui-kit.config.json",Ae="ui-kit.baseline.json",Ce="efficient-shell-ui-check",Me=`${Ce}: every surface a person operates takes its UI from efficient-shell (harness UI-24).\n\n ${Ce} check this repository against ${Ae}\n ${Ce} --print print today's counts as a baseline, and change nothing\n ${Ce} --summary print totals per kind and per folder, as Markdown\n ${Ce} --json print the result as JSON\n ${Ce} --update lower the lines whose counts fell, and delete the ones at zero\n ${Ce} --update --allow-move also follow a renamed or split file (no total may rise)\n ${Ce} --init write the first ${Ae}\n ${Ce} --init --kind <kind> take the baseline for a kind just added to "kinds"\n ${Ce} --no-base do not compare with the pull request's base branch\n\nKinds: ${a.join(", ")}\nReads ${Te} in the current directory.`;var Be=(e,t)=>`${e} ${t}${1===e?"":"s"}`,Pe=(e,t)=>{const n=B(e);return t.map(e=>`${e} ${n[e]??0}`).join(" · ")};process.exitCode=function(e,t){const r=function(e){const t={print:!1,summary:!1,json:!1,update:!1,allowMove:!1,init:!1,noBase:!1,help:!1,version:!1,kinds:[]};for(let n=0;n<e.length;n++){const i=e[n];if("--print"===i)t.print=!0;else if("--summary"===i)t.summary=!0;else if("--json"===i)t.json=!0;else if("--update"===i)t.update=!0;else if("--allow-move"===i)t.allowMove=!0;else if("--init"===i)t.init=!0;else if("--no-base"===i)t.noBase=!0;else if("--help"===i||"-h"===i)t.help=!0;else if("--version"===i||"-v"===i)t.version=!0;else if("--kind"===i){const i=e[++n];if(!i)return"--kind needs a kind after it";t.kinds.push(...i.split(","))}else{if(!i.startsWith("--kind="))return`unknown argument "${i}"`;t.kinds.push(...i.slice(7).split(","))}}return t.allowMove&&!t.update?"--allow-move goes with --update":t.kinds.length&&!t.init?"--kind goes with --init":[t.print,t.summary,t.update,t.init].filter(Boolean).length>1?"choose one of --print, --summary, --update and --init":t}(e);if("string"==typeof r)return t.err(`${Ce}: ${r}\n\n${Me}`),2;if(r.help)return t.out(Me),0;if(r.version)return t.out(t.version),0;const c=e=>(r.json?t.out(JSON.stringify({tool:Ce,version:t.version,ok:!1,failures:[e]},null,2)):t.err(`${Ce}: ${e}`),1),p=n(t.cwd,Te);if(!i(p))return c(`no ${Te} in ${t.cwd}. Run it from the repository root; the harness has the template.`);let f,m;try{f=function(e,t="ui-kit.config.json"){const n=[],i=e=>{n.push(e)},s=(e,t,{required:n=!1}={})=>{if(void 0===e&&!n)return[];if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||""===e))return i(`${t} must be a list of non-empty strings`),[];n&&0===e.length&&i(`${t} must name at least one entry`);for(const n of e)(n.startsWith("/")||n.startsWith("./")||n.includes("\\")||n.split("/").includes(".."))&&i(`${t}: "${n}" must be a path from the repository root, written with / (no ./, .. or \\)`);return e},o=(e,t)=>"string"!=typeof e||e.trim().length<10?(i(`${t} needs a "reason" a reviewer can read (a sentence, not a word)`),""):e,r=(e,t)=>void 0===e?[]:!Array.isArray(e)||e.some(e=>!N(e))?(i(`${t} must be a list of objects`),[]):e;if(!N(e))throw new P(`${t}: must be a JSON object`);for(const t of Object.keys(e))D.has(t)||i(`unknown key "${t}"`);1!==e.schema&&i("number"==typeof e.schema&&e.schema>1?`"schema": ${e.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');const c=[];if(Array.isArray(e.kinds)&&0!==e.kinds.length)for(const t of e.kinds)l(t)?c.includes(t)?i(`"kinds": "${t}" is listed twice`):c.push(t):i(`"kinds": unknown kind ${JSON.stringify(t)} (this efficient-shell knows: ${a.join(", ")})`);else i(`"kinds" must list the kinds this repository checks, from: ${a.join(", ")}`);const d=s(e.include,'"include"'),u=s(e.exclude,'"exclude"'),h=r(e.includeImporting,'"includeImporting"').map((e,t)=>({files:s(e.files,`"includeImporting"[${t}].files`,{required:!0}),modules:s(e.modules,`"includeImporting"[${t}].modules`,{required:!0}),reason:o(e.reason,`"includeImporting"[${t}]`)}));0===d.length&&0===h.length&&i('"include" must name the files that are operator UI (for example ["src/**/*.tsx"])');const p=r(e.output,'"output"').map((e,t)=>({files:s(e.files,`"output"[${t}].files`,{required:!0}),reason:o(e.reason,`"output"[${t}]`)})),f=[],m=new Set;if(r(e.allow,'"allow"').forEach((e,t)=>{const n=`"allow"[${t}]`,[r]=s([e.file],`${n}.file`),d=o(e.reason,n);if(!l(e.kind))return void i(`${n}.kind must be one of: ${a.join(", ")}`);if(c.includes(e.kind)||i(`${n}: kind "${e.kind}" is not in "kinds"`),"number"!=typeof e.count||!Number.isInteger(e.count)||e.count<1)return void i(`${n}.count must be a whole number, 1 or more`);if(!r)return;const u=`${r}:${e.kind}`;m.has(u)&&i(`${n}: ${r} already has an allow entry for "${e.kind}"`),m.add(u),f.push({file:r,kind:e.kind,count:e.count,reason:d})}),n.length)throw new P(`${t}:\n - ${n.join("\n - ")}`);return{schema:1,kinds:a.filter(e=>c.includes(e)),include:d,exclude:u,includeImporting:h,output:p,allow:f}}(JSON.parse(s(p,"utf8")),Te)}catch(e){return c(e instanceof P?e.message:`${Te} is not valid JSON: ${e.message}`)}try{m=t.loadTypeScript()}catch{return c('this check reads the TypeScript AST and found no "typescript" package here. Install it as a devDependency.')}const w=function(e){const t=[],n=u,i=[["fixture.tsx",ve,Se],["fixture.ts","\nimport { toast } from 'sonner';\nimport { extent } from 'd3-array';\nexport const tone = { warn: '#f59e0b' };\nexport const cls = 'ring-1 dark:ring-white rounded-[3px]';\nexport const box = { borderRadius: '0.25rem', radius: 4 };\nexport function ask(confirm: (message: string) => boolean) {\n return confirm('a parameter binds the name');\n}\nexport const mount = (node: unknown) => ReactDOM.createPortal(node, document.body);\n",je],["tokens.tsx",Le,ze],["labels.tsx","\n// <Button>Save…</Button> in a comment is not a label\nconst l1 = <Button>Extend trial…</Button>;\nconst l2 = <PopupMenuItem onClick={go}><span>Read from a PDF...</span></PopupMenuItem>;\nconst l3 = <Button>{busy ? 'Saving…' : 'Duplicate site…'}</Button>;\nconst l4 = <Item label=\"Translate…\" aria-label={'More…'} />;\nconst l5 = [{ label: 'Reject…' }, { value: CUSTOM, label: 'Custom…' }];\nconst l6 = <option value={CUSTOM}>Different address…</option>;\nconst l7 = <PopupMenuLabel>{say(\"Duplicate to page…\")}</PopupMenuLabel>;\nconst n7 = <Button>{t('team:menu.remove')}</Button>;\nconst n1 = <Button>{`${name.slice(0, 9)}…`}</Button>;\nconst n2 = <p>Loading weather…</p>;\nconst n3 = <Input placeholder=\"Search…\" />;\nconst n4 = <option value=\"\">Pick a carrier…</option>;\nconst n5 = [{ value: '', label: 'Select…' }];\nconst n6 = <Button>Extend trial</Button>;\n",Re]];for(const[s,o,r]of i){const i=me(he(e,s,o,n));n.some(e=>(i[e]??0)!==(r[e]??0))&&t.push(`${s}: read ${Ee(i)}; it holds ${Ee(r)}`)}const s=me(he(e,"fixture.tsx",ve,["button"]));return"button"!==Object.keys(s).join()&&t.push(`asked for button alone, the reader reported ${Ee(s)}`),t}(m);if(w.length)return c(`the reader misread its own fixtures with typescript ${m.version}, so nothing it says about this repository can be trusted:\n - `+w.join("\n - "));const k=function(e,t,o){const r=[],a=y(o.exclude),l=y(o.output.flatMap(e=>e.files)),c=new Map,u=e=>{let i=c.get(e);return void 0===i&&c.set(e,i=s(n(t,e),"utf8")),i},h=(e,n)=>{for(const i of e)0===I(t,[i]).length&&r.push(`${n}: "${i}" matches no file. Delete the line, or fix the path.`)};h(o.include,'"include"'),o.output.forEach((e,t)=>h(e.files,`"output"[${t}]`)),o.includeImporting.forEach((e,t)=>h(e.files,`"includeImporting"[${t}]`));const p=new Set,f=e=>(e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"))(e)&&!a(e)&&!l(e);for(const e of I(t,o.include))f(e)&&p.add(e);for(const n of o.includeImporting)for(const i of I(t,n.files))f(i)&&!p.has(i)&&we(ge(e,i,u(i)),n.modules)&&p.add(i);const m=[...p].sort(),w=o.kinds.filter(e=>!d(e)),k=new Map,$=new Map,b=new Set;for(const t of m){const n=he(e,t,u(t),w,b);let i=!1;for(const e of w){const s=n[e]?.length??0;s&&($.set(R(t,e),s),i=!0)}i&&k.set(t,n)}let v=[],S=[],j=[];const L=o.kinds.filter(d);if(L.length){const e=n(t,O);if(i(e)){const t=JSON.parse(s(e,"utf8")),n=["dependencies","peerDependencies","optionalDependencies"].flatMap(e=>Object.keys(t[e]??{})),i=new Set([...b].flatMap(e=>g[e]??[])),r=[...new Set(n)].sort();if(o.kinds.includes("kit-dep")){const e=r.filter(e=>"kit-dep"===x(e));v=e.filter(e=>!i.has(e)),S=e.filter(e=>i.has(e)),v.length&&$.set(R(O,"kit-dep"),v.length)}o.kinds.includes("chart-dep")&&(j=r.filter(e=>"chart-dep"===x(e)),j.length&&$.set(R(O,"chart-dep"),j.length))}else for(const e of L)r.push(`"kinds" includes "${e}", and there is no ${O} here to read.`)}for(const e of o.allow)(d(e.kind)?e.file===O:p.has(e.file))||r.push(`"allow": ${e.file} (${e.kind}) is not a file this check reads. Delete the entry, or fix the path.`);return{files:m,hits:k,counts:$,kitDeps:v,shellPeers:S,chartDeps:j,problems:r}}(m,t.cwd,f);if(0===k.files.length)return c(`read no files. "include" in ${Te} matches nothing, so a pass would mean nothing.`);const $=n(t.cwd,Ae),b=r.json,v=e=>{b||t.out(e)};if(r.print)return t.out(M(be(f,k,f.kinds)).trimEnd()),0;if(r.summary){for(const e of function(e,t){const n=new Map,i=new Map;for(const[e,s]of t.counts){const{file:t,kind:o}=E(e);if(!l(o))continue;const r=n.get(o)??{count:0,files:new Set};r.count+=s,r.files.add(t),n.set(o,r);const a=t.split("/"),c=a.length>2?a.slice(0,2).join("/"):2===a.length?a[0]:".",d=i.get(c)??{};d[o]=(d[o]??0)+s,i.set(c,d)}const s=e.kinds.filter(e=>n.has(e)),o=[`**UI kit check (harness UI-24):** ${new Set([...t.counts.keys()].map(e=>E(e).file)).size} of ${Be(t.files.length,"file")} still draw UI of their own.`,"","| Kind | Count | Files | The shell has |","|---|---:|---:|---|",...e.kinds.map(e=>{const t=n.get(e);return`| \`${e}\` | ${t?.count??0} | ${t?.files.size??0} | ${h[e].instead} |`})];if(s.length&&i.size){const e=e=>s.reduce((t,n)=>t+(e[n]??0),0),t=[...i].sort((t,n)=>e(n[1])-e(t[1])||(t[0]<n[0]?-1:1));o.push("",`| Folder | ${s.map(e=>`\`${e}\``).join(" | ")} | Total |`,`|---|${s.map(()=>"---:").join("|")}|---:|`,...t.map(([t,n])=>`| \`${t}\` | ${s.map(e=>n[e]??0).join(" | ")} | ${e(n)} |`))}return o}(f,k))t.out(e);return 0}let S=null;if(i($))try{S=C(s($,"utf8"),Ae)}catch(e){return c(e instanceof z?e.message:String(e))}if(r.init){const e=r.kinds.filter(e=>!l(e)||!f.kinds.includes(e));if(e.length)return c(`--kind ${e.join(", ")}: not in "kinds" in ${Te}. Add it there first.`);const t=r.kinds;if(S){if(0===t.length)return c(`${Ae} already exists, and --init would overwrite what it holds. It is for the adoption pull request only. To start checking a kind, add it to "kinds" and run --init --kind <kind>.`);const e=t.filter(e=>S.kinds.includes(e));if(e.length)return c(`the baseline was already taken for ${e.join(", ")}. Its lines only go down; use --update.`);const n=be(f,k,t);S={kinds:[...S.kinds,...t],counts:new Map([...S.counts,...n.counts])}}else{if(t.length)return c(`there is no ${Ae} yet. Run --init on its own first.`);S=be(f,k,f.kinds)}o($,M(S)),v(`${Ce}: wrote ${Ae} (${Be(S.counts.size,"line")}: ${Pe(S.counts,S.kinds)})`)}if(!S)return c(`no ${Ae}. This repository has not adopted the check yet: run ${Ce} --init, and commit the file.`);if(r.update){const e=function(e,t,n,{allowMove:i=!1}={}){const s=xe(e,t),o=be(e,n,s),r=new Map([...t.counts].filter(([e])=>s.includes(E(e).kind)));if(i){const e=B(r),n=B(o.counts),i=s.filter(t=>(n[t]??0)>(e[t]??0)).map(t=>`${t}: ${n[t]??0} across the repository, and the baseline holds ${e[t]??0}`);return i.length?{baseline:t,lowered:0,refused:i}:{baseline:o,lowered:ye(r,o.counts),refused:[]}}const a=new Map;for(const[e,t]of r){const n=Math.min(t,o.counts.get(e)??0);n>0&&a.set(e,n)}return{baseline:{kinds:s,counts:a},lowered:ye(r,a),refused:[]}}(f,S,k,{allowMove:r.allowMove});if(e.refused.length)return c(`--allow-move follows code that moved, and this is more of it than before:\n - ${e.refused.join("\n - ")}\nNothing was written.`);S=e.baseline,o($,M(S)),v(`${Ce}: ${e.lowered?`changed ${Be(e.lowered,"line")} in`:"nothing to change in"} ${Ae}`)}const j=function(e,t,n){const i=[],s=[],o=[...n.problems],r=ke(e),a=new Set(xe(e,t)),c=e.kinds.filter(e=>!t.kinds.includes(e));c.length&&o.push(`"kinds" names ${c.map(e=>`"${e}"`).join(", ")}, and the baseline was never taken for ${1===c.length?"it":"them"}. Run: efficient-shell-ui-check --init ${c.map(e=>`--kind ${e}`).join(" ")}`);const d=t.kinds.filter(t=>!e.kinds.includes(t));d.length&&s.push(`the baseline still carries ${d.map(e=>`"${e}"`).join(", ")}, which "kinds" no longer names`);const u=new Set([...n.counts.keys(),...t.counts.keys(),...r.keys()]);for(const e of[...u].sort(A)){const{file:c,kind:d}=E(e);if(!l(d)||!a.has(d))continue;const u=n.counts.get(e)??0,p=r.get(e)??0,f=t.counts.get(e)??0;u>p+f?i.push(`${c}: ${d} ${u}, and its line allows ${p+f}${$e(n,c,d)}. ${h[d].counts} is counted; use ${h[d].instead}.`):u<p?o.push(`${c}: ${d} ${u}, and "allow" in ui-kit.config.json says ${p}. ${0===u?"Delete the entry":`Lower its count to ${u}`}: an exception does not outlive what it excused.`):u<p+f&&s.push(`${c}: ${d} ${u}, and its line says ${p+f}`)}return{grown:i,shrunk:s,other:o,updateFixes:0===i.length&&0===o.length&&s.length>0}}(f,S,k),L=r.noBase?{problems:[],note:""}:function(e,t,n){const i=e.env.GITHUB_BASE_REF;if(!i)return{problems:[],note:""};const s=e.git(["rev-parse","--show-prefix"]);if(null===s)return{problems:[],note:"not a git checkout; the base branch was not compared"};const o=`origin/${i}`;if(null===e.git(["rev-parse","--verify","--quiet",`${o}^{commit}`])&&(e.git(["fetch","--no-tags","--depth=1","origin",`+refs/heads/${i}:refs/remotes/origin/${i}`]),null===e.git(["rev-parse","--verify","--quiet",`${o}^{commit}`])))return{problems:[],note:`${o} could not be fetched; the base branch was not compared`};const r=e.git(["show",`${o}:${s.trim()}${Ae}`]);if(null===r)return{problems:[],note:`${o} has no ${Ae} yet (adoption)`};let a;try{a=C(r,`${o}:${Ae}`)}catch{return{problems:[],note:`${o}'s ${Ae} could not be read; the base branch was not compared`}}const l=B(a.counts),c=B(t.counts);return{problems:n.filter(e=>a.kinds.includes(e)&&(c[e]??0)>(l[e]??0)).map(e=>`${Ae} holds ${c[e]??0} of "${e}", and ${o} holds ${l[e]??0}. The baseline only goes down: use ${h[e].instead}. A count that is meant to stay goes in "allow" in ${Te}, with its reason.`),note:`compared with ${o}`}}(t,S,f.kinds),T=f.kinds.filter(e=>S.kinds.includes(e)),F=`${Ce} --update`,J=[...j.other,...j.grown,...j.shrunk.map(e=>`${e}. Run: ${F}`),...L.problems],U=0===J.length;if(r.json){const e=new Map(f.allow.map(e=>[`${e.file}:${e.kind}`,e.count]));return t.out(JSON.stringify({tool:Ce,version:t.version,ok:U,schema:f.schema,kinds:f.kinds,files:k.files.length,counts:B(k.counts),baseline:B(S.counts),allowed:B(e),kitDeps:k.kitDeps,shellPeers:k.shellPeers,chartDeps:k.chartDeps,failures:J},null,2)),U?0:1}t.out(`UI kit check (harness UI-24), efficient-shell ${t.version}\n`);const W=(e,n,i="")=>{if(0===n.length)return t.out(` ok ${e}`);t.err(` FAIL ${e}`);for(const e of n)t.err(` ${e}`);i&&t.err(` ${i}`)};t.out(` ok the reader reads its own fixtures (typescript ${m.version})`),t.out(` ok read ${Be(k.files.length,"file")}`),W(`${Te} and ${Ae} describe this repository`,j.other),W("no file draws more of its own UI than its line allows",j.grown),W("every line is exact: a count that fell is a line to lower",j.shrunk,`Run: ${F}${j.updateFixes?"":" (after the failures above are fixed)"}`),L.note&&W(`the baseline is no higher than the base branch (${L.note})`,L.problems);const q=new Set([...k.counts.keys()].map(e=>E(e).file));return t.out(` ok PROGRESS: ${q.size} of ${Be(k.files.length,"file")} still draw UI of their own: `+Pe(k.counts,T)),t.out(""),U?t.out("UI kit check: ok"):t.err(`UI kit check: FAILED (${Be(J.length,"problem")})`),U?0:1}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>function(e){for(const i of[n(process.cwd(),"package.json"),e])try{return t(i)("typescript")}catch{}throw new Error("typescript is not installed")}(import.meta.url),git:function(t){try{return e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:6e4,maxBuffer:67108864})}catch{return null}},version:"8.25.0"});
2
+ import{execFileSync as e}from"child_process";import{createRequire as t}from"module";import{join as n}from"path";import{existsSync as i,readFileSync as s,writeFileSync as o,readdirSync as r}from"fs";var a=["button","input","range","textarea","select","dialog","title","portal","native","dark","hex","radius","spacing","font-size","z-index","shadow","kit","icon","svg","kit-dep","chart","chart-dep","ellipsis-label"],l=e=>"string"==typeof e&&a.includes(e),c=["kit-dep","chart-dep"],d=e=>c.includes(e),u=a.filter(e=>!d(e)),h={button:{counts:"a raw <button>",instead:"Button or IconButton from efficient-shell/ui"},input:{counts:"a raw <input> (not hidden, not a range)",instead:"Input, InputNumber, Checkbox, Radio or Switch from efficient-shell/ui"},range:{counts:'a raw <input type="range">',instead:"Slider from efficient-shell/ui"},textarea:{counts:"a raw <textarea>",instead:"Textarea from efficient-shell/ui"},select:{counts:"a raw <select>",instead:"Select or SearchableSelect from efficient-shell/ui"},dialog:{counts:'a raw <dialog>, or role="dialog" / role="alertdialog" on a raw element',instead:"Dialog or Modal from efficient-shell"},title:{counts:"a title= on a raw element (the browser's own tooltip)",instead:"Tooltip from efficient-shell/ui (harness UI-17)"},portal:{counts:"a createPortal(…) call (a layer the file floats itself)",instead:"Popover, PopupMenu, DropdownMenu, Tooltip or Dialog from efficient-shell/ui"},native:{counts:"window.confirm / alert / prompt, or a bare call that resolves to one",instead:"confirm, confirmDestructive, prompt or toast from efficient-shell (harness UI-20)"},dark:{counts:"a dark: variant in a class string",instead:"the light Tailwind class alone; the shell remaps it in dark mode (harness UI-7)"},hex:{counts:"a hex colour literal in a .tsx string",instead:"a shell token or a Tailwind palette class (harness FT-1)"},radius:{counts:"a literal corner radius (an arbitrary-value radius class, or an inline borderRadius)",instead:"a radius utility from the scale or a role token such as rounded-(--radius-control); the theme sets how round they are (harness UI-7)"},spacing:{counts:"a padding, margin or gap off the scale (6px, 10px, 14px …) or written as a literal length (an arbitrary-value class, an inline style)",instead:"a step of the scale 2/4/8/12/16/20/24/32/40/48 — a Tailwind step, or a role such as var(--space-control-x) (owner ruling 2026-10-12)"},"font-size":{counts:"a literal font size (an arbitrary-value text class, an inline fontSize)",instead:"a type step 9/11/12/14/16/18/20/24/30 — Tailwind's 3xs … 3xl text steps (owner ruling 2026-10-12)"},"z-index":{counts:"a stack order above 30 written as a number (a z utility, an arbitrary value, an inline zIndex)",instead:"a named layer: Z_LAYERS (efficient-shell/ui) in code, its --z-* custom property in markup"},shadow:{counts:"a literal shadow, or a shadow size that is not an elevation level (md, 2xl, xs)",instead:"an elevation: the sm / lg / xl utilities, or var(--elevation-panel) and its siblings (owner ruling 2026-10-12)"},kit:{counts:"an import of a second UI kit",instead:"the component from efficient-shell/ui, or fold it into the shell (harness FT-3)"},icon:{counts:"an import of an icon package",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24)"},svg:{counts:"an <svg> element written in JSX: an icon drawn in place",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24). A chart, an illustration or a mark a host supplies stays on the baseline"},"kit-dep":{counts:"a UI kit or icon package declared in package.json (not one the shell entries imported here need)",instead:"remove the dependency once nothing imports it (harness FT-3)"},chart:{counts:"an import of a second chart library",instead:"a chart from efficient-shell/ui (ChartFrame, TimeSeriesChart, ColumnChart, RankedBars, PieChart, FunnelChart, ScatterChart, …), or add the chart there: one chart system (harness FT-3)"},"chart-dep":{counts:"a chart library declared in package.json",instead:"remove the dependency once nothing imports it (harness FT-3)"},"ellipsis-label":{counts:'a button, link or menu label that ends in "…" or "..."',instead:'the label without the dots, saying what it does ("Extend trial"): "…" means only "the words are cut" (owner ruling 2026-10-14)'}},p=["@headlessui/","@radix-ui/","@mui/","@chakra-ui/","@mantine/","@floating-ui/","antd","react-aria","react-aria-","react-bootstrap","react-select","react-colorful","react-tooltip","react-hot-toast","react-toastify","sonner"],f=["@heroicons/","@tabler/icons","@tabler/icons-","@phosphor-icons/","@fortawesome/","@iconify/","@radix-ui/react-icons","@mui/icons-material","lucide","lucide-react","simple-icons","react-icons","react-feather"],m=["recharts","chart.js","react-chartjs-2","d3","d3-","@nivo/","victory","victory-","echarts","echarts-for-react","apexcharts","react-apexcharts","@visx/","highcharts","highcharts-react-official","plotly.js","plotly.js-dist","react-plotly.js","lightweight-charts","@antv/g2","@antv/g2plot","chartist","billboard.js","c3","uplot"],g={"efficient-shell":["@headlessui/react"]};function w(e,t){return t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}function k(e){return w(e,f)?"icon":w(e,p)?"kit":w(e,m)?"chart":null}function x(e){const t=k(e);return"kit"===t||"icon"===t?"kit-dep":"chart"===t?"chart-dep":null}var $=/[.+^$()|[\]\\]/g;function b(e){let t="",n=0;for(let i=0;i<e.length;i++){const s=e[i];"*"===s?"*"===e[i+1]?"/"===e[i+2]?(t+="(?:[^/]+/)*",i+=2):(t+=".*",i+=1):t+="[^/]*":"?"===s?t+="[^/]":"{"===s?(t+="(?:",n+=1):"}"===s&&n>0?(t+=")",n-=1):t+=","===s&&n>0?"|":s.replace($,"\\$&")}if(0!==n)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${t}$`)}function y(e){const t=e.map(b);return e=>t.some(t=>t.test(e))}var v=new Set(["node_modules",".git"]),S=new Set(["dist","coverage",".next",".turbo"]);function j(e){const t=e.search(/[*?{]/),n=-1===t?e:e.slice(0,t),i=n.lastIndexOf("/");return-1===i?"":n.slice(0,i)}function I(e,t){const i=y(t),s=[...new Set(t.map(j))].sort(),o=s.filter(e=>!s.some(t=>t!==e&&(""===t||e.startsWith(`${t}/`)))),a=new Set,l=t=>{let s;try{s=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of s){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?v.has(e.name)||""===t&&S.has(e.name)||l(n):e.isFile()&&i(n)&&a.add(n)}};for(const e of o)l(e);return[...a].sort(L)}var L=(e,t)=>e<t?-1:e>t?1:0,z=class extends Error{},R=(e,t)=>`${e}:${t}`;function E(e){const t=e.lastIndexOf(":");return{file:e.slice(0,t),kind:e.slice(t+1)}}var T=e=>a.indexOf(e);function A(e,t){const n=E(e),i=E(t);return L(n.file,i.file)||T(n.kind)-T(i.kind)}function C(e,t="ui-kit.baseline.json"){let n;try{n=JSON.parse(e)}catch(e){throw new z(`${t} is not valid JSON: ${e.message}`)}const i=e=>{throw new z(`${t}: ${e}. The tool writes this file; do not edit it by hand.`)};if("object"!=typeof n||null===n||Array.isArray(n))return i("must be a JSON object");const s=n;if(1!==s.schema)return i("number"==typeof s.schema&&s.schema>1?`"schema": ${s.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');if(!Array.isArray(s.kinds)||s.kinds.some(e=>"string"!=typeof e))return i('"kinds" must be a list');const o=s.kinds.filter(l);if("object"!=typeof s.counts||null===s.counts||Array.isArray(s.counts))return i('"counts" must be an object');const r=new Map;for(const[e,t]of Object.entries(s.counts)){const{file:n,kind:s}=E(e);if(!n||!s)return i(`"${e}" is not "<file>:<kind>"`);if("number"!=typeof t||!Number.isInteger(t)||t<1)return i(`"${e}" must be a whole number, 1 or more (a line that reaches 0 is deleted)`);l(s)&&r.set(e,t)}return{kinds:o,counts:r}}function M(e){const t=a.filter(t=>e.kinds.includes(t)),n=[...e.counts.keys()].filter(t=>(e.counts.get(t)??0)>0).sort(A).map(t=>` ${JSON.stringify(t)}: ${e.counts.get(t)}`);return["{",' "schema": 1,',` "kinds": [${t.map(e=>JSON.stringify(e)).join(", ")}],`,n.length?` "counts": {\n${n.join(",\n")}\n }`:' "counts": {}',"}",""].join("\n")}function B(e){const t={};for(const[n,i]of e){const{kind:e}=E(n);l(e)&&(t[e]=(t[e]??0)+i)}return t}var P=class extends Error{},N=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),D=new Set(["$schema","schema","kinds","include","exclude","includeImporting","output","allow"]);var O="package.json",F=[2,4,8,12,16,20,24,32,40,48];function J(e){if("0"===e||"px"===e)return!0;const t=Number(e);return!!Number.isFinite(t)&&F.includes(4*t)}var U=new Set(["iframe","frame","object","embed"]),W=new Set(["href","xlinkHref","to","id","key","htmlFor"]),q=/(?<![&\w])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,_=/(?<![\w-])rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|ee|es))?-\[([^\]]*)\]/g,G=/^border(?:(?:Top|Bottom)(?:Left|Right)|(?:Start|End)(?:Start|End))?Radius$/,K=/^(?:inherit|initial|unset|revert)$|var\(|^(?:50|100)%$|^(?:999|9999)(?:px)?$/,H=/(?<![\w-])-?(?:p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me|gap|gap-x|gap-y|space-x|space-y)-(\d+(?:\.\d+)?|px|\[[^\]]*\])(?![\w.[/-])/g,Q=/(?<![\w-])text-\[(?:length:)?(\d*\.?\d+(?:px|rem|em|%))\]/g,V=/(?<![\w-])z-(\d+|\[[^\]]*\])(?![\w.[/-])/g,X=/(?<![\w-])shadow-(xs|2xs|md|2xl|\[[^\]]*\])(?![\w.[/-])/g,Y=/var\(|^(?:inherit|initial|unset|revert|revert-layer|none|auto)$/,Z=/^(?:(?:padding|margin)(?:Top|Right|Bottom|Left|Inline|Block|InlineStart|InlineEnd|BlockStart|BlockEnd)?|gap|rowGap|columnGap)$/,ee=new Set([0,...F]),te=/(?<![\w-])dark:(?=[\w[\-!@*(])/g,ne=new Set(["button","a","option","Button","IconButton","SplitButton","Link","NavLink","PopupMenuItem","PopupMenuLabel","DropdownMenuItem","MenuItem","ContextMenuItem"]),ie=/(?:…|\.\.\.|&hellip;)\s*$/,se=new RegExp("\\p{L}","u"),oe=new RegExp("\\p{L}[\\p{L}-]*","u"),re={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"],zhStarts:["正在"],zhEnds:["中"]},placeholder:{},prompt:{}},ae=new Set((re.busy?.words??[]).map(e=>e.toLowerCase())),le=new Set(["label","aria-label",...re.placeholder?[]:["placeholder","searchPlaceholder","emptyOptionLabel","blankLabel"]]),ce=(e,t)=>{if(!ie.test(t)||!se.test(e))return!1;const n=e.match(oe)?.[0]?.toLowerCase();if(n&&ae.has(n))return!1;const i=e.replace(ie,"").trim(),s=re.busy;return!(s&&(s.zhStarts.some(e=>i.startsWith(e))||s.zhEnds.some(e=>i.endsWith(e))))},de=new Set(["confirm","alert","prompt"]),ue=new Set(["window","globalThis","self"]);function he(e,t,n,i,s){const o=new Set(i),r=e.createSourceFile(t,n,e.ScriptTarget.Latest,!0,function(e,t){return t.endsWith(".tsx")?e.ScriptKind.TSX:t.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(t)?e.ScriptKind.JS:e.ScriptKind.TS}(e,t)),a={},l=/\.[jt]sx$/.test(t),c=e=>r.getLineAndCharacterOfPosition(e).line+1,d=(e,t)=>{o.has(e)&&(a[e]??=[]).push(c(t.getStart(r)))},u=(t,n)=>t.attributes.properties.find(t=>e.isJsxAttribute(t)&&t.name.getText(r)===n),h=t=>{const n=t?.initializer;if(n)return e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:void 0},p=new Set;if(o.has("native")){const t=n=>{if(n)if(e.isIdentifier(n))de.has(n.text)&&p.add(n.text);else if(e.isObjectBindingPattern(n)||e.isArrayBindingPattern(n))for(const i of n.elements)e.isBindingElement(i)&&t(i.name)},n=i=>{(e.isImportClause(i)||e.isImportSpecifier(i)||e.isNamespaceImport(i)||e.isVariableDeclaration(i)||e.isParameter(i)||e.isFunctionDeclaration(i))&&t(i.name),e.forEachChild(i,n)};n(r)}const f=t=>t&&e.isStringLiteralLike(t)?t.text:void 0,m=(e,t)=>{e&&("efficient-shell"===e||e.startsWith("efficient-shell/"))&&s?.add(e);const n=e?k(e):null;n&&d(n,t)},g=(e,t,n)=>{if(o.has("dark"))for(const n of e.matchAll(te))d("dark",t);if(o.has("radius"))for(const n of e.matchAll(_))K.test(n[1].trim())||d("radius",t);if(n&&l&&o.has("hex"))for(const n of e.matchAll(q))d("hex",t);if(o.has("spacing"))for(const n of e.matchAll(H)){const e=n[1];(e.startsWith("[")?Y.test(e.slice(1,-1).trim()):J(e))||d("spacing",t)}if(o.has("font-size"))for(const n of e.matchAll(Q))d("font-size",t);if(o.has("z-index"))for(const n of e.matchAll(V)){const e=n[1].startsWith("[")?n[1].slice(1,-1).trim():n[1];/^\d+$/.test(e)&&Number(e)>30&&d("z-index",t)}if(o.has("shadow"))for(const n of e.matchAll(X))n[1].startsWith("[")&&Y.test(n[1].slice(1,-1).trim())||d("shadow",t)},w=(t,n,i)=>{const s=e.isStringLiteralLike(n)?n.text.trim():void 0;if(o.has("spacing")&&Z.test(t))e.isNumericLiteral(n)?ee.has(Number(n.text))||d("spacing",i):void 0!==s&&!Y.test(s)&&(e=>[...e.matchAll(/(-?\d*\.?\d+)(px|rem|em)\b/g)].map(e=>Math.abs(Number(e[1]))*("px"===e[2]?1:16)))(s).some(e=>!ee.has(e))&&d("spacing",i);else if(o.has("font-size")&&"fontSize"===t)(e.isNumericLiteral(n)||void 0!==s&&!Y.test(s)&&!/^(?:smaller|larger)$/.test(s))&&d("font-size",i);else if(o.has("z-index")&&"zIndex"===t){const t=[],s=n=>{e.isNumericLiteral(n)||e.isStringLiteralLike(n)&&/^\d+$/.test(n.text.trim())?t.push(Number(n.text)):e.forEachChild(n,s)};s(n);for(const e of t)e>30&&d("z-index",i)}else o.has("shadow")&&"boxShadow"===t&&(void 0===s||""===s||Y.test(s)||d("shadow",i))},x=(t,n)=>{if(e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)){const e=t.tagName.getText(r);if(/^[a-z]/.test(e)){const n=h(u(t,"type"));"svg"===e&&d("svg",t),"button"===e?d("button",t):"select"===e?d("select",t):"textarea"===e?d("textarea",t):"input"===e&&("range"===n?d("range",t):"hidden"!==n&&d("input",t));const i=h(u(t,"role"));"dialog"!==e&&"dialog"!==i&&"alertdialog"!==i||d("dialog",t),!U.has(e)&&u(t,"title")&&d("title",t)}}else if(e.isCallExpression(t)){const n=t.expression;e.isIdentifier(n)?"createPortal"===n.text?d("portal",t):de.has(n.text)&&!p.has(n.text)?d("native",t):"require"===n.text&&m(f(t.arguments[0]),t):e.isPropertyAccessExpression(n)?"createPortal"===n.name.text?d("portal",t):de.has(n.name.text)&&e.isIdentifier(n.expression)&&ue.has(n.expression.text)&&d("native",t):n.kind===e.SyntaxKind.ImportKeyword&&m(f(t.arguments[0]),t)}else{if(e.isImportDeclaration(t)||e.isExportDeclaration(t))return void m(f(t.moduleSpecifier),t);if(e.isPropertyAssignment(t)){const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"",i=t.initializer;w(n,i,t),o.has("radius")&&G.test(n)&&(e.isNumericLiteral(i)?K.test(i.text)||d("radius",t):e.isStringLiteralLike(i)&&!K.test(i.text.trim())&&d("radius",t))}else if(e.isStringLiteralLike(t))g(t.text,t,n);else if(e.isTemplateExpression(t)){g(t.head.text,t.head,n);for(const e of t.templateSpans)g(e.literal.text,e.literal,n)}}e.isJsxAttribute(t)&&W.has(t.name.getText(r))?e.forEachChild(t,e=>x(e,!1)):e.forEachChild(t,e=>x(e,n))};return x(r,!0),o.has("ellipsis-label")&&function(e,t,n){const i=new Set,s=(e,t)=>{i.has(e)||(i.add(e),n(t))},o=n=>{if(n)if(e.isStringLiteralLike(n))ce(n.text,n.text)&&s(n,n.getStart(t));else if(e.isTemplateExpression(n)){const e=[n.head.text,...n.templateSpans.map(e=>e.literal.text)];ce(e.join(" "),e[e.length-1])&&s(n,n.getStart(t))}else e.isConditionalExpression(n)?(o(n.whenTrue),o(n.whenFalse)):e.isBinaryExpression(n)?(o(n.left),o(n.right)):e.isParenthesizedExpression(n)||e.isAsExpression(n)||e.isJsxExpression(n)?o(n.expression):e.isCallExpression(n)&&pe.has(fe(n.expression))&&n.arguments[0]&&o(n.arguments[0])},r=n=>{for(const i of n)if(e.isJsxText(i)){const e=i.getText(t);ce(e,e)&&s(i,i.getStart(t)+(e.length-e.trimStart().length))}else e.isJsxExpression(i)?o(i.expression):(e.isJsxElement(i)||e.isJsxFragment(i))&&r(i.children)},a=(n,i)=>{const s=n.attributes.properties.find(n=>e.isJsxAttribute(n)&&n.name.getText(t)===i),o=s?.initializer;return o&&e.isStringLiteral(o)?o.text:o&&e.isJsxExpression(o)&&o.expression&&e.isStringLiteralLike(o.expression)?o.expression.text:void 0},l=t=>t.properties.some(t=>e.isPropertyAssignment(t)&&(e.isIdentifier(t.name)||e.isStringLiteralLike(t.name))&&"value"===t.name.text&&e.isStringLiteralLike(t.initializer)&&""===t.initializer.text),c=n=>{if(e.isJsxElement(n)){const e=n.openingElement,i=e.tagName.getText(t),s="option"===i&&re.prompt&&""===a(e,"value");ne.has(i)&&!s&&r(n.children)}else if(e.isJsxAttribute(n))le.has(n.name.getText(t))&&o(n.initializer);else if(e.isPropertyAssignment(n)){const t=e.isIdentifier(n.name)||e.isStringLiteralLike(n.name)?n.name.text:"",i=re.prompt&&e.isObjectLiteralExpression(n.parent)&&l(n.parent);le.has(t)&&!i&&o(n.initializer)}e.forEachChild(n,c)};c(t)}(e,r,e=>(a["ellipsis-label"]??=[]).push(c(e))),a}var pe=new Set(["say","t"]),fe=e=>{const t=e.getText();return t.slice(t.lastIndexOf(".")+1)};function me(e){const t={};for(const[n,i]of Object.entries(e))i.length&&(t[n]=i.length);return t}function ge(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),s=[];for(const t of i.statements)(e.isImportDeclaration(t)||e.isExportDeclaration(t))&&t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&s.push(t.moduleSpecifier.text);return s}var we=(e,t)=>e.some(e=>t.some(t=>t.endsWith("/*")?e.startsWith(t.slice(0,-1)):e===t));var ke=e=>new Map(e.allow.map(e=>[R(e.file,e.kind),e.count]));function xe(e,t){return e.kinds.filter(e=>t.kinds.includes(e))}var $e=(e,t,n)=>{if("kit-dep"===n)return` (${e.kitDeps.join(", ")})`;if("chart-dep"===n)return` (${e.chartDeps.join(", ")})`;const i=e.hits.get(t)?.[n]??[];if(0===i.length)return"";const s=i.slice(0,12).join(", ");return` (line${1===i.length?"":"s"} ${s}${i.length>12?", …":""})`};function be(e,t,n){const i=ke(e),s=new Map;for(const[e,o]of t.counts){const{kind:t}=E(e);if(!l(t)||!n.includes(t))continue;const r=o-(i.get(e)??0);r>0&&s.set(e,r)}return{kinds:a.filter(e=>n.includes(e)),counts:s}}function ye(e,t){let n=0;for(const i of new Set([...e.keys(),...t.keys()]))(e.get(i)??0)!==(t.get(i)??0)&&(n+=1);return n}var ve="\n// <button> in a comment is not a button, and <svg> in one is not a drawing\n/* nor is <input title=\"x\"> in this one, or dark:bg-black, or #fff */\nimport { createPortal } from 'react-dom';\nimport { Dialog } from '@headlessui/react';\nimport { TrashIcon } from '@heroicons/react/24/outline';\nimport type { Icon } from 'lucide-react';\nimport { Button, confirm } from 'efficient-shell';\nexport { Slot } from '@radix-ui/react-slot';\nexport { CheckIcon } from '@radix-ui/react-icons';\nimport { LineChart } from 'recharts';\nimport 'd3-scale';\nexport { VictoryPie } from 'victory';\nimport { BarChart } from '@mui/x-charts';\nimport Tree from 'react-d3-tree';\nimport { TimeSeriesChart } from 'efficient-shell/ui';\n// import 'chart.js' in a comment is not an import, and 'echarts' in a string is not one either\nconst chartLabel = 'd3-array';\n\nconst a = <button title=\"Says what it does\">x</button>;\nconst b = <input type=\"range\" />;\nconst c = <input type=\"text\" />;\nconst c2 = <input type={\"hidden\"} name=\"csrf\" />;\nconst c3 = <input type=\"hidden\" />;\nconst c4 = <input type={kind} />;\nconst d = <select />;\nconst d2 = <textarea />;\nconst e = <div role=\"dialog\" />;\nconst e2 = <dialog open />;\nconst e3 = <section role={'alertdialog'} />;\nconst f = <iframe title=\"Preview\" />;\nconst f2 = <object title=\"Chart\" />;\nconst g = <Button title=\"a prop, not a tooltip\" role=\"dialog\" />;\nconst g2 = (\n <button\n type=\"button\"\n title={hint}\n >\n y\n </button>\n);\nconst h = ReactDOM.createPortal(a, document.body);\nconst i = createPortal(a, document.body);\n\nasync function leave() {\n if (window.confirm('Sure?')) return;\n globalThis.alert('No');\n alert('native: nothing binds the name');\n prompt('native too');\n await confirm('the shell: the import binds it');\n record.confirm('a method, not the popup');\n}\n\nconst j = <div className=\"bg-white dark:bg-black dark:hover:text-white is-dark:no\" />;\nconst k = clsx('text-gray-900', on && 'dark:text-gray-100');\nconst l = <span style={{ color: '#fff', background: \"#12ab34\" }} className={`border-[#0a0b0c80] ${x}`} />;\nconst m = <a href=\"#faded\" id=\"#bad\" key=\"#abc\" to=\"#face\">skip</a>;\nconst n = <label htmlFor={'#dead'}>skip</label>;\nconst o = <span>&#1234; and BG#00340 and #12345 and #added are not colours</span>;\nconst p = 'entity &#x1f; ref BG#00340';\nconst q = <use xlinkHref=\"#abc\" fill=\"url(#fed)\" />;\nconst t = <div className=\"rounded-[4px] rounded-t-[0.5rem] hover:rounded-[2px] rounded-lg rounded-(--radius-card) rounded-[inherit] rounded-[var(--r)]\" />;\nconst u = <div style={{ borderRadius: 6, borderTopLeftRadius: '3px', borderBottomRightRadius: '50%', borderEndEndRadius: 'var(--radius-card)' }} />;\nconst v = <i style={{ borderRadius: 9999 }} />;\nconst w = <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M4 4h16\" /></svg>;\nconst w2 = <Svg viewBox=\"0 0 24 24\" />;\nconst w3 = '<svg viewBox=\"0 0 1 1\"></svg> in a string is not an element';\nconst r = lazy(() => import('@mui/material'));\nconst s = require('react-select');\nconst s2 = require('chart.js/auto');\nconst s3 = import('@nivo/line');\n",Se={button:2,input:2,range:1,textarea:1,select:1,dialog:3,title:2,portal:2,native:4,dark:3,hex:3,radius:5,kit:5,icon:3,svg:1,chart:5},je={kit:1,dark:1,portal:1,radius:2,chart:1},Ie=(...e)=>e.join("-"),Le=`\nconst s1 = <i className="${[Ie("px","2.5"),Ie("py","1.5"),"md:"+Ie("gap","1.5"),"-"+Ie("mt","1.5"),Ie("p","[10px]")].join(" ")}" />;\nconst s2 = <i className="${[Ie("p","0"),Ie("px","px"),Ie("p","0.5"),Ie("p","3"),Ie("gap-x","4"),Ie("p","12"),Ie("p","(--space-12)"),Ie("p","[var(--space-12)]"),Ie("space-x","reverse"),Ie("top","1.5")].join(" ")}" />;\nconst s3 = <i style={{ padding: 6, marginTop: '10px', gap: 8, margin: '0 auto', paddingInline: 'var(--space-12)' }} />;\nconst f1 = <i className="${[Ie("text","[11px]"),Ie("text","[0.8rem]"),Ie("text","xs"),Ie("text","[#fff]"),Ie("text","(--text-2xs)")].join(" ")}" />;\nconst f2 = <i style={{ fontSize: 12 }} />;\nconst f3 = { fontSize: 'var(--x)', font: 'inherit' };\nconst z1 = <i className="${[Ie("z","[9999]"),Ie("z","50"),Ie("z","10"),Ie("z","30"),"-"+Ie("z","10"),Ie("z","auto"),Ie("z","(--z-popup)"),Ie("z","[var(--z-popup)]")].join(" ")}" />;\nconst z2 = { zIndex: on ? 2020 : 2010 };\nconst z3 = { zIndex: Z_LAYERS.popup, top: 9999 };\nconst h1 = <i className="${[Ie("shadow","[0_1px_2px_#000]"),Ie("shadow","md"),"shadow",Ie("shadow","lg"),Ie("shadow","(--elevation-panel)"),Ie("shadow","black/20"),Ie("drop-shadow","md")].join(" ")}" />;\nconst h2 = { boxShadow: '0 1px 2px rgba(0,0,0,.1)' };\nconst h3 = { boxShadow: 'none', outline: 'var(--elevation-raised)' };\n`,ze={spacing:7,"font-size":3,"z-index":4,shadow:3,hex:1},Re={"ellipsis-label":9},Ee=e=>a.filter(t=>e[t]).map(t=>`${t} ${e[t]}`).join(", ")||"nothing";var Te="ui-kit.config.json",Ae="ui-kit.baseline.json",Ce="efficient-shell-ui-check",Me=`${Ce}: every surface a person operates takes its UI from efficient-shell (harness UI-24).\n\n ${Ce} check this repository against ${Ae}\n ${Ce} --print print today's counts as a baseline, and change nothing\n ${Ce} --summary print totals per kind and per folder, as Markdown\n ${Ce} --json print the result as JSON\n ${Ce} --update lower the lines whose counts fell, and delete the ones at zero\n ${Ce} --update --allow-move also follow a renamed or split file (no total may rise)\n ${Ce} --init write the first ${Ae}\n ${Ce} --init --kind <kind> take the baseline for a kind just added to "kinds"\n ${Ce} --no-base do not compare with the pull request's base branch\n\nKinds: ${a.join(", ")}\nReads ${Te} in the current directory.`;var Be=(e,t)=>`${e} ${t}${1===e?"":"s"}`,Pe=(e,t)=>{const n=B(e);return t.map(e=>`${e} ${n[e]??0}`).join(" · ")};process.exitCode=function(e,t){const r=function(e){const t={print:!1,summary:!1,json:!1,update:!1,allowMove:!1,init:!1,noBase:!1,help:!1,version:!1,kinds:[]};for(let n=0;n<e.length;n++){const i=e[n];if("--print"===i)t.print=!0;else if("--summary"===i)t.summary=!0;else if("--json"===i)t.json=!0;else if("--update"===i)t.update=!0;else if("--allow-move"===i)t.allowMove=!0;else if("--init"===i)t.init=!0;else if("--no-base"===i)t.noBase=!0;else if("--help"===i||"-h"===i)t.help=!0;else if("--version"===i||"-v"===i)t.version=!0;else if("--kind"===i){const i=e[++n];if(!i)return"--kind needs a kind after it";t.kinds.push(...i.split(","))}else{if(!i.startsWith("--kind="))return`unknown argument "${i}"`;t.kinds.push(...i.slice(7).split(","))}}return t.allowMove&&!t.update?"--allow-move goes with --update":t.kinds.length&&!t.init?"--kind goes with --init":[t.print,t.summary,t.update,t.init].filter(Boolean).length>1?"choose one of --print, --summary, --update and --init":t}(e);if("string"==typeof r)return t.err(`${Ce}: ${r}\n\n${Me}`),2;if(r.help)return t.out(Me),0;if(r.version)return t.out(t.version),0;const c=e=>(r.json?t.out(JSON.stringify({tool:Ce,version:t.version,ok:!1,failures:[e]},null,2)):t.err(`${Ce}: ${e}`),1),p=n(t.cwd,Te);if(!i(p))return c(`no ${Te} in ${t.cwd}. Run it from the repository root; the harness has the template.`);let f,m;try{f=function(e,t="ui-kit.config.json"){const n=[],i=e=>{n.push(e)},s=(e,t,{required:n=!1}={})=>{if(void 0===e&&!n)return[];if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||""===e))return i(`${t} must be a list of non-empty strings`),[];n&&0===e.length&&i(`${t} must name at least one entry`);for(const n of e)(n.startsWith("/")||n.startsWith("./")||n.includes("\\")||n.split("/").includes(".."))&&i(`${t}: "${n}" must be a path from the repository root, written with / (no ./, .. or \\)`);return e},o=(e,t)=>"string"!=typeof e||e.trim().length<10?(i(`${t} needs a "reason" a reviewer can read (a sentence, not a word)`),""):e,r=(e,t)=>void 0===e?[]:!Array.isArray(e)||e.some(e=>!N(e))?(i(`${t} must be a list of objects`),[]):e;if(!N(e))throw new P(`${t}: must be a JSON object`);for(const t of Object.keys(e))D.has(t)||i(`unknown key "${t}"`);1!==e.schema&&i("number"==typeof e.schema&&e.schema>1?`"schema": ${e.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');const c=[];if(Array.isArray(e.kinds)&&0!==e.kinds.length)for(const t of e.kinds)l(t)?c.includes(t)?i(`"kinds": "${t}" is listed twice`):c.push(t):i(`"kinds": unknown kind ${JSON.stringify(t)} (this efficient-shell knows: ${a.join(", ")})`);else i(`"kinds" must list the kinds this repository checks, from: ${a.join(", ")}`);const d=s(e.include,'"include"'),u=s(e.exclude,'"exclude"'),h=r(e.includeImporting,'"includeImporting"').map((e,t)=>({files:s(e.files,`"includeImporting"[${t}].files`,{required:!0}),modules:s(e.modules,`"includeImporting"[${t}].modules`,{required:!0}),reason:o(e.reason,`"includeImporting"[${t}]`)}));0===d.length&&0===h.length&&i('"include" must name the files that are operator UI (for example ["src/**/*.tsx"])');const p=r(e.output,'"output"').map((e,t)=>({files:s(e.files,`"output"[${t}].files`,{required:!0}),reason:o(e.reason,`"output"[${t}]`)})),f=[],m=new Set;if(r(e.allow,'"allow"').forEach((e,t)=>{const n=`"allow"[${t}]`,[r]=s([e.file],`${n}.file`),d=o(e.reason,n);if(!l(e.kind))return void i(`${n}.kind must be one of: ${a.join(", ")}`);if(c.includes(e.kind)||i(`${n}: kind "${e.kind}" is not in "kinds"`),"number"!=typeof e.count||!Number.isInteger(e.count)||e.count<1)return void i(`${n}.count must be a whole number, 1 or more`);if(!r)return;const u=`${r}:${e.kind}`;m.has(u)&&i(`${n}: ${r} already has an allow entry for "${e.kind}"`),m.add(u),f.push({file:r,kind:e.kind,count:e.count,reason:d})}),n.length)throw new P(`${t}:\n - ${n.join("\n - ")}`);return{schema:1,kinds:a.filter(e=>c.includes(e)),include:d,exclude:u,includeImporting:h,output:p,allow:f}}(JSON.parse(s(p,"utf8")),Te)}catch(e){return c(e instanceof P?e.message:`${Te} is not valid JSON: ${e.message}`)}try{m=t.loadTypeScript()}catch{return c('this check reads the TypeScript AST and found no "typescript" package here. Install it as a devDependency.')}const w=function(e){const t=[],n=u,i=[["fixture.tsx",ve,Se],["fixture.ts","\nimport { toast } from 'sonner';\nimport { extent } from 'd3-array';\nexport const tone = { warn: '#f59e0b' };\nexport const cls = 'ring-1 dark:ring-white rounded-[3px]';\nexport const box = { borderRadius: '0.25rem', radius: 4 };\nexport function ask(confirm: (message: string) => boolean) {\n return confirm('a parameter binds the name');\n}\nexport const mount = (node: unknown) => ReactDOM.createPortal(node, document.body);\n",je],["tokens.tsx",Le,ze],["labels.tsx","\n// <Button>Save…</Button> in a comment is not a label\nconst l1 = <Button>Extend trial…</Button>;\nconst l2 = <PopupMenuItem onClick={go}><span>Read from a PDF...</span></PopupMenuItem>;\nconst l3 = <Button>{busy ? 'Saving…' : 'Duplicate site…'}</Button>;\nconst l4 = <Item label=\"Translate…\" aria-label={'More…'} />;\nconst l5 = [{ label: 'Reject…' }, { value: CUSTOM, label: 'Custom…' }];\nconst l6 = <option value={CUSTOM}>Different address…</option>;\nconst l7 = <PopupMenuLabel>{say(\"Duplicate to page…\")}</PopupMenuLabel>;\nconst n7 = <Button>{t('team:menu.remove')}</Button>;\nconst n1 = <Button>{`${name.slice(0, 9)}…`}</Button>;\nconst n2 = <p>Loading weather…</p>;\nconst n3 = <Input placeholder=\"Search…\" />;\nconst n4 = <option value=\"\">Pick a carrier…</option>;\nconst n5 = [{ value: '', label: 'Select…' }];\nconst n6 = <Button>Extend trial</Button>;\n",Re]];for(const[s,o,r]of i){const i=me(he(e,s,o,n));n.some(e=>(i[e]??0)!==(r[e]??0))&&t.push(`${s}: read ${Ee(i)}; it holds ${Ee(r)}`)}const s=me(he(e,"fixture.tsx",ve,["button"]));return"button"!==Object.keys(s).join()&&t.push(`asked for button alone, the reader reported ${Ee(s)}`),t}(m);if(w.length)return c(`the reader misread its own fixtures with typescript ${m.version}, so nothing it says about this repository can be trusted:\n - `+w.join("\n - "));const k=function(e,t,o){const r=[],a=y(o.exclude),l=y(o.output.flatMap(e=>e.files)),c=new Map,u=e=>{let i=c.get(e);return void 0===i&&c.set(e,i=s(n(t,e),"utf8")),i},h=(e,n)=>{for(const i of e)0===I(t,[i]).length&&r.push(`${n}: "${i}" matches no file. Delete the line, or fix the path.`)};h(o.include,'"include"'),o.output.forEach((e,t)=>h(e.files,`"output"[${t}]`)),o.includeImporting.forEach((e,t)=>h(e.files,`"includeImporting"[${t}]`));const p=new Set,f=e=>(e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"))(e)&&!a(e)&&!l(e);for(const e of I(t,o.include))f(e)&&p.add(e);for(const n of o.includeImporting)for(const i of I(t,n.files))f(i)&&!p.has(i)&&we(ge(e,i,u(i)),n.modules)&&p.add(i);const m=[...p].sort(),w=o.kinds.filter(e=>!d(e)),k=new Map,$=new Map,b=new Set;for(const t of m){const n=he(e,t,u(t),w,b);let i=!1;for(const e of w){const s=n[e]?.length??0;s&&($.set(R(t,e),s),i=!0)}i&&k.set(t,n)}let v=[],S=[],j=[];const L=o.kinds.filter(d);if(L.length){const e=n(t,O);if(i(e)){const t=JSON.parse(s(e,"utf8")),n=["dependencies","peerDependencies","optionalDependencies"].flatMap(e=>Object.keys(t[e]??{})),i=new Set([...b].flatMap(e=>g[e]??[])),r=[...new Set(n)].sort();if(o.kinds.includes("kit-dep")){const e=r.filter(e=>"kit-dep"===x(e));v=e.filter(e=>!i.has(e)),S=e.filter(e=>i.has(e)),v.length&&$.set(R(O,"kit-dep"),v.length)}o.kinds.includes("chart-dep")&&(j=r.filter(e=>"chart-dep"===x(e)),j.length&&$.set(R(O,"chart-dep"),j.length))}else for(const e of L)r.push(`"kinds" includes "${e}", and there is no ${O} here to read.`)}for(const e of o.allow)(d(e.kind)?e.file===O:p.has(e.file))||r.push(`"allow": ${e.file} (${e.kind}) is not a file this check reads. Delete the entry, or fix the path.`);return{files:m,hits:k,counts:$,kitDeps:v,shellPeers:S,chartDeps:j,problems:r}}(m,t.cwd,f);if(0===k.files.length)return c(`read no files. "include" in ${Te} matches nothing, so a pass would mean nothing.`);const $=n(t.cwd,Ae),b=r.json,v=e=>{b||t.out(e)};if(r.print)return t.out(M(be(f,k,f.kinds)).trimEnd()),0;if(r.summary){for(const e of function(e,t){const n=new Map,i=new Map;for(const[e,s]of t.counts){const{file:t,kind:o}=E(e);if(!l(o))continue;const r=n.get(o)??{count:0,files:new Set};r.count+=s,r.files.add(t),n.set(o,r);const a=t.split("/"),c=a.length>2?a.slice(0,2).join("/"):2===a.length?a[0]:".",d=i.get(c)??{};d[o]=(d[o]??0)+s,i.set(c,d)}const s=e.kinds.filter(e=>n.has(e)),o=[`**UI kit check (harness UI-24):** ${new Set([...t.counts.keys()].map(e=>E(e).file)).size} of ${Be(t.files.length,"file")} still draw UI of their own.`,"","| Kind | Count | Files | The shell has |","|---|---:|---:|---|",...e.kinds.map(e=>{const t=n.get(e);return`| \`${e}\` | ${t?.count??0} | ${t?.files.size??0} | ${h[e].instead} |`})];if(s.length&&i.size){const e=e=>s.reduce((t,n)=>t+(e[n]??0),0),t=[...i].sort((t,n)=>e(n[1])-e(t[1])||(t[0]<n[0]?-1:1));o.push("",`| Folder | ${s.map(e=>`\`${e}\``).join(" | ")} | Total |`,`|---|${s.map(()=>"---:").join("|")}|---:|`,...t.map(([t,n])=>`| \`${t}\` | ${s.map(e=>n[e]??0).join(" | ")} | ${e(n)} |`))}return o}(f,k))t.out(e);return 0}let S=null;if(i($))try{S=C(s($,"utf8"),Ae)}catch(e){return c(e instanceof z?e.message:String(e))}if(r.init){const e=r.kinds.filter(e=>!l(e)||!f.kinds.includes(e));if(e.length)return c(`--kind ${e.join(", ")}: not in "kinds" in ${Te}. Add it there first.`);const t=r.kinds;if(S){if(0===t.length)return c(`${Ae} already exists, and --init would overwrite what it holds. It is for the adoption pull request only. To start checking a kind, add it to "kinds" and run --init --kind <kind>.`);const e=t.filter(e=>S.kinds.includes(e));if(e.length)return c(`the baseline was already taken for ${e.join(", ")}. Its lines only go down; use --update.`);const n=be(f,k,t);S={kinds:[...S.kinds,...t],counts:new Map([...S.counts,...n.counts])}}else{if(t.length)return c(`there is no ${Ae} yet. Run --init on its own first.`);S=be(f,k,f.kinds)}o($,M(S)),v(`${Ce}: wrote ${Ae} (${Be(S.counts.size,"line")}: ${Pe(S.counts,S.kinds)})`)}if(!S)return c(`no ${Ae}. This repository has not adopted the check yet: run ${Ce} --init, and commit the file.`);if(r.update){const e=function(e,t,n,{allowMove:i=!1}={}){const s=xe(e,t),o=be(e,n,s),r=new Map([...t.counts].filter(([e])=>s.includes(E(e).kind)));if(i){const e=B(r),n=B(o.counts),i=s.filter(t=>(n[t]??0)>(e[t]??0)).map(t=>`${t}: ${n[t]??0} across the repository, and the baseline holds ${e[t]??0}`);return i.length?{baseline:t,lowered:0,refused:i}:{baseline:o,lowered:ye(r,o.counts),refused:[]}}const a=new Map;for(const[e,t]of r){const n=Math.min(t,o.counts.get(e)??0);n>0&&a.set(e,n)}return{baseline:{kinds:s,counts:a},lowered:ye(r,a),refused:[]}}(f,S,k,{allowMove:r.allowMove});if(e.refused.length)return c(`--allow-move follows code that moved, and this is more of it than before:\n - ${e.refused.join("\n - ")}\nNothing was written.`);S=e.baseline,o($,M(S)),v(`${Ce}: ${e.lowered?`changed ${Be(e.lowered,"line")} in`:"nothing to change in"} ${Ae}`)}const j=function(e,t,n){const i=[],s=[],o=[...n.problems],r=ke(e),a=new Set(xe(e,t)),c=e.kinds.filter(e=>!t.kinds.includes(e));c.length&&o.push(`"kinds" names ${c.map(e=>`"${e}"`).join(", ")}, and the baseline was never taken for ${1===c.length?"it":"them"}. Run: efficient-shell-ui-check --init ${c.map(e=>`--kind ${e}`).join(" ")}`);const d=t.kinds.filter(t=>!e.kinds.includes(t));d.length&&s.push(`the baseline still carries ${d.map(e=>`"${e}"`).join(", ")}, which "kinds" no longer names`);const u=new Set([...n.counts.keys(),...t.counts.keys(),...r.keys()]);for(const e of[...u].sort(A)){const{file:c,kind:d}=E(e);if(!l(d)||!a.has(d))continue;const u=n.counts.get(e)??0,p=r.get(e)??0,f=t.counts.get(e)??0;u>p+f?i.push(`${c}: ${d} ${u}, and its line allows ${p+f}${$e(n,c,d)}. ${h[d].counts} is counted; use ${h[d].instead}.`):u<p?o.push(`${c}: ${d} ${u}, and "allow" in ui-kit.config.json says ${p}. ${0===u?"Delete the entry":`Lower its count to ${u}`}: an exception does not outlive what it excused.`):u<p+f&&s.push(`${c}: ${d} ${u}, and its line says ${p+f}`)}return{grown:i,shrunk:s,other:o,updateFixes:0===i.length&&0===o.length&&s.length>0}}(f,S,k),L=r.noBase?{problems:[],note:""}:function(e,t,n){const i=e.env.GITHUB_BASE_REF;if(!i)return{problems:[],note:""};const s=e.git(["rev-parse","--show-prefix"]);if(null===s)return{problems:[],note:"not a git checkout; the base branch was not compared"};const o=`origin/${i}`;if(null===e.git(["rev-parse","--verify","--quiet",`${o}^{commit}`])&&(e.git(["fetch","--no-tags","--depth=1","origin",`+refs/heads/${i}:refs/remotes/origin/${i}`]),null===e.git(["rev-parse","--verify","--quiet",`${o}^{commit}`])))return{problems:[],note:`${o} could not be fetched; the base branch was not compared`};const r=e.git(["show",`${o}:${s.trim()}${Ae}`]);if(null===r)return{problems:[],note:`${o} has no ${Ae} yet (adoption)`};let a;try{a=C(r,`${o}:${Ae}`)}catch{return{problems:[],note:`${o}'s ${Ae} could not be read; the base branch was not compared`}}const l=B(a.counts),c=B(t.counts);return{problems:n.filter(e=>a.kinds.includes(e)&&(c[e]??0)>(l[e]??0)).map(e=>`${Ae} holds ${c[e]??0} of "${e}", and ${o} holds ${l[e]??0}. The baseline only goes down: use ${h[e].instead}. A count that is meant to stay goes in "allow" in ${Te}, with its reason.`),note:`compared with ${o}`}}(t,S,f.kinds),T=f.kinds.filter(e=>S.kinds.includes(e)),F=`${Ce} --update`,J=[...j.other,...j.grown,...j.shrunk.map(e=>`${e}. Run: ${F}`),...L.problems],U=0===J.length;if(r.json){const e=new Map(f.allow.map(e=>[`${e.file}:${e.kind}`,e.count]));return t.out(JSON.stringify({tool:Ce,version:t.version,ok:U,schema:f.schema,kinds:f.kinds,files:k.files.length,counts:B(k.counts),baseline:B(S.counts),allowed:B(e),kitDeps:k.kitDeps,shellPeers:k.shellPeers,chartDeps:k.chartDeps,failures:J},null,2)),U?0:1}t.out(`UI kit check (harness UI-24), efficient-shell ${t.version}\n`);const W=(e,n,i="")=>{if(0===n.length)return t.out(` ok ${e}`);t.err(` FAIL ${e}`);for(const e of n)t.err(` ${e}`);i&&t.err(` ${i}`)};t.out(` ok the reader reads its own fixtures (typescript ${m.version})`),t.out(` ok read ${Be(k.files.length,"file")}`),W(`${Te} and ${Ae} describe this repository`,j.other),W("no file draws more of its own UI than its line allows",j.grown),W("every line is exact: a count that fell is a line to lower",j.shrunk,`Run: ${F}${j.updateFixes?"":" (after the failures above are fixed)"}`),L.note&&W(`the baseline is no higher than the base branch (${L.note})`,L.problems);const q=new Set([...k.counts.keys()].map(e=>E(e).file));return t.out(` ok PROGRESS: ${q.size} of ${Be(k.files.length,"file")} still draw UI of their own: `+Pe(k.counts,T)),t.out(""),U?t.out("UI kit check: ok"):t.err(`UI kit check: FAILED (${Be(J.length,"problem")})`),U?0:1}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>function(e){for(const i of[n(process.cwd(),"package.json"),e])try{return t(i)("typescript")}catch{}throw new Error("typescript is not installed")}(import.meta.url),git:function(t){try{return e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:6e4,maxBuffer:67108864})}catch{return null}},version:"8.31.0"});
@@ -1 +1 @@
1
- export{BoxPlotChart as default}from"../chunk-37CCKGHU.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-I4VD5D43.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
1
+ export{BoxPlotChart as default}from"../chunk-EYX6KLCZ.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1 +1 @@
1
- export{CandlestickChart as default}from"../chunk-JUGPTBMS.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-I4VD5D43.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
1
+ export{CandlestickChart as default}from"../chunk-LBLV64XG.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{CartesianPlot as default}from"../chunk-I4VD5D43.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{CartesianPlot as default}from"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{ChordChart as default,foldChord}from"../chunk-DODH46ZQ.js";import"../chunk-CDRXZBVR.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{ChordChart as default,foldChord}from"../chunk-DODH46ZQ.js";import"../chunk-CDRXZBVR.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{ColumnChart as default}from"../chunk-ETF7LAYZ.js";import"../chunk-465RRWBY.js";import"../chunk-Y4MI6NRI.js";import"../chunk-CNYAHYE6.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-I4VD5D43.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{ColumnChart as default}from"../chunk-W5M6P4DZ.js";import"../chunk-465RRWBY.js";import"../chunk-Y4MI6NRI.js";import"../chunk-CNYAHYE6.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{HeatmapChart as default}from"../chunk-H33Z4ZIY.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{HeatmapChart as default}from"../chunk-3WC6ITJ3.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1 +1 @@
1
- export{HistogramChart as default}from"../chunk-IFDW5QW6.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-I4VD5D43.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
1
+ export{HistogramChart as default}from"../chunk-BIYL7CEI.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{RADAR_SERIES_CAP,RadarChart as default}from"../chunk-DITCVBR7.js";import"../chunk-CDRXZBVR.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-2JWPNR2U.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{RADAR_SERIES_CAP,RadarChart as default}from"../chunk-DITCVBR7.js";import"../chunk-CDRXZBVR.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-2JWPNR2U.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1 +1 @@
1
- export{RangeChart as default}from"../chunk-ZNXBKFV7.js";import"../chunk-VFC6QUEN.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-I4VD5D43.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
1
+ export{RangeChart as default}from"../chunk-ZOSIPTXM.js";import"../chunk-VFC6QUEN.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{SankeyChart as default}from"../chunk-CRLSG5AY.js";import"../chunk-CDRXZBVR.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{SankeyChart as default}from"../chunk-CRLSG5AY.js";import"../chunk-CDRXZBVR.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{SCATTER_SERIES_CAP,ScatterChart as default}from"../chunk-ZNCU3UIW.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{SCATTER_SERIES_CAP,ScatterChart as default}from"../chunk-FRPNTDP4.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1 +1 @@
1
- export{SpecChart as default}from"../chunk-BKZGI76S.js";import"../chunk-X2S2XDZI.js";import"../chunk-5OTS2G3M.js";import"../chunk-36BRD5J3.js";import"../chunk-WSPO4N72.js";import"../chunk-EYKUKN32.js";import"../chunk-CK2YOGUS.js";import"../chunk-BRHIRE4D.js";import"../chunk-VFC6QUEN.js";import"../chunk-ETF7LAYZ.js";import"../chunk-465RRWBY.js";import"../chunk-Y4MI6NRI.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-I4VD5D43.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
1
+ export{SpecChart as default}from"../chunk-TFMC2WAS.js";import"../chunk-X2S2XDZI.js";import"../chunk-5OTS2G3M.js";import"../chunk-36BRD5J3.js";import"../chunk-OSA24YH6.js";import"../chunk-CK2YOGUS.js";import"../chunk-BRHIRE4D.js";import"../chunk-VFC6QUEN.js";import"../chunk-W5M6P4DZ.js";import"../chunk-465RRWBY.js";import"../chunk-Y4MI6NRI.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-EYKUKN32.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{SunburstChart as default}from"../chunk-JPP7UWQA.js";import"../chunk-CDRXZBVR.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{SunburstChart as default}from"../chunk-JPP7UWQA.js";import"../chunk-CDRXZBVR.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{TimeSeriesChart as default}from"../chunk-WSPO4N72.js";import"../chunk-EYKUKN32.js";import"../chunk-CK2YOGUS.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-Y4MI6NRI.js";import"../chunk-CNYAHYE6.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{TimeSeriesChart as default}from"../chunk-OSA24YH6.js";import"../chunk-CK2YOGUS.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-Y4MI6NRI.js";import"../chunk-CNYAHYE6.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-EYKUKN32.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{TreemapChart as default}from"../chunk-6NMDKOQA.js";import"../chunk-46BYGPGD.js";import"../chunk-CDRXZBVR.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
2
+ export{TreemapChart as default}from"../chunk-6NMDKOQA.js";import"../chunk-46BYGPGD.js";import"../chunk-CDRXZBVR.js";import"../chunk-CNYAHYE6.js";import"../chunk-6KO5VTL7.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -1 +1 @@
1
- export{WaterfallChart as default}from"../chunk-2C6IG7LG.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-I4VD5D43.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
1
+ export{WaterfallChart as default}from"../chunk-Z2YGQBLZ.js";import"../chunk-P5BOTIJU.js";import"../chunk-DTJRIWFR.js";import"../chunk-RSO67DWS.js";import"../chunk-MG7A3R75.js";import"../chunk-2JWPNR2U.js";import"../chunk-MAFUXCPZ.js";import"../chunk-TWVUQUUD.js";import"../chunk-TZFACUMR.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
@@ -0,0 +1 @@
1
+ function e(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}export{e as slugify};
@@ -0,0 +1 @@
1
+ var r="8.31.0",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,19 +1,19 @@
1
- import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{TH_ONE_LINE as t}from"./chunk-6KO5VTL7.js";import{useBrowserLayoutEffect as n}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-E6UCGCOC.js";import{useRef as o,useState as l,useEffect as c,useCallback as a,useMemo as s}from"react";import{createPortal as i}from"react-dom";import{jsxs as u,jsx as h,Fragment as d}from"react/jsx-runtime";function w(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function g({text:t,...n}){const r=s(()=>({__html:e(t)}),[t]);/* @__PURE__ */
2
- return h("div",{...n,dangerouslySetInnerHTML:r})}function m({columns:e,data:m,onChange:p,onColumnsChange:f,fixedRows:y=!1,minRows:b=15,maxHeight:v="260px",cellStyles:x,onFocusChange:M,onSelectionChange:D}){const k=o(null),C=r().grid,[E,L]=l(null);c(()=>{M?.(E)},[E,M]);const[$,S]=l({}),z=o(null),[N,A]=l({}),O=o(null),[T,K]=l(null),[R,P]=l(null),[F,I]=l(null),[X,j]=l(null),[H,Y]=l(null),q=o(null);n(()=>{const e=q.current;if(!e||e.row!==H?.row||e.col!==H?.col)return;q.current=null;const t=k.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[H]);const[B,W]=l(null),[U,V]=l(null);c(()=>{D?.(B&&U?{anchor:B,end:U}:null)},[B,U,D]);const _=o(!1),[G,J]=l(null),Q=o(!1),Z=o({a:null,e:null});Z.current={a:B,e:U};const ee=B&&U&&(B.row!==U.row||B.col!==U.col),te=[...m];if(!y)for(;te.length<b;)te.push(Array(e.length).fill(""));const ne=a((t,n,r)=>{const o=te.map(e=>[...e]);for(;o.length<=t;)o.push(Array(e.length).fill(""));for(;o[t].length<e.length;)o[t].push("");o[t][n]=r,p(o)},[te,e.length,p]),re=a((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(te[e]?.[t]||"")){const r=te.map(e=>[...e]);r[e]&&(r[e][t]=n,p(r))}}_.current=!0,e.shiftKey&&B||W({row:t,col:n}),V({row:t,col:n})},[te,p,B]),oe=a((e,t)=>{_.current&&V({row:e,col:t})},[]);c(()=>{const e=()=>{_.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),c(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!B||!U)return;const t=window.getSelection();if(t&&t.toString().length>0&&!ee)return;const n=Math.min(B.row,U.row),r=Math.max(B.row,U.row),o=Math.min(B.col,U.col),l=Math.max(B.col,U.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(te[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[B,U,te,ee]),c(()=>{const t=t=>{if(!E)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!k.current?.contains(n))return;const r=t.clipboardData?.getData("text/plain");if(!r)return;t.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=te.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=E.row+t;for(;l.length<=n;)l.push(Array(e.length).fill(""));for(;l[n].length<e.length;)l[n].push("");for(let r=0;r<o[t].length;r++){const c=E.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}p(y?l:w(l,e.length)),W({row:E.row,col:E.col}),V({row:Math.min(E.row+o.length-1,l.length-1),col:Math.min(E.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[E,te,e,p,y]);const le=a((t,n,r)=>{const o=t.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;t.preventDefault();const c=te.map(e=>[...e]);for(let t=0;t<l.length;t++){const o=n+t;for(;c.length<=o;)c.push(Array(e.length).fill(""));for(;c[o].length<e.length;)c[o].push("");for(let n=0;n<l[t].length;n++){const a=r+n;if(a>=e.length)break;e[a].readOnly||(c[o][a]=l[t][n].trim())}}p(y?c:w(c,e.length))},[te,e,p,y]),ce=a((t,n,r)=>{let o=n,l=r;if("Tab"===t.key)t.preventDefault(),l=t.shiftKey?r-1:r+1,l>=e.length&&(l=0,o=n+1),l<0&&(l=e.length-1,o=n-1);else if("Enter"===t.key)t.preventDefault(),o=t.shiftKey?n-1:n+1;else if("ArrowDown"===t.key)t.preventDefault(),o=n+1;else if("ArrowUp"===t.key)t.preventDefault(),o=n-1;else if("ArrowLeft"===t.key)t.preventDefault(),l=r-1;else{if("ArrowRight"!==t.key){if("Delete"===t.key||"Backspace"===t.key){const o=t.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(t.preventDefault(),ne(n,r,"")));if(t.preventDefault(),B&&U){const t=Math.min(B.row,U.row),n=Math.max(B.row,U.row),r=Math.min(B.col,U.col),o=Math.max(B.col,U.col),l=te.map(e=>[...e]);for(let c=t;c<=n;c++)for(let t=r;t<=o;t++)l[c]&&!e[t]?.readOnly&&(l[c][t]="");p(l)}else ne(n,r,"");return}return}t.preventDefault(),l=r+1}for(;l>=0&&l<e.length&&e[l].readOnly;)l+="Tab"===t.key&&t.shiftKey?-1:1;if(o>=0&&o<te.length&&l>=0&&l<e.length){const e=k.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),L({row:o,col:l}),Y(null),W({row:o,col:l}),V({row:o,col:l}))}},[e,te,te.length,ne,B,U,p]),ae=a(t=>{if(!y&&t>=te.length-2){const t=te.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));p(t)}},[y,te,e.length,p]),[se,ie]=l(null);c(()=>{if(!se)return;const e=()=>ie(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[se]);const ue=a(t=>{const n=te.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),p(n)},[te,e.length,p]),he=a(e=>{if(te.length<=1)return;const t=te.filter((t,n)=>n!==e);p(t)},[te,p]),de=a(e=>{const t=te.map(t=>{const n=[...t];return n.splice(e,0,""),n});p(t)},[te,p]),we=a(t=>{if(e.length<=1)return;const n=te.map(e=>{const n=[...e];return n.splice(t,1),n});p(n)},[te,e.length,p]),ge=a((e,t)=>{e.preventDefault(),y||ie({x:e.clientX,y:e.clientY,items:[{label:C.insertRowAbove,onClick:()=>{ue(t),ie(null)}},{label:C.insertRowBelow,onClick:()=>{ue(t+1),ie(null)}},{label:C.deleteRow(t+1),onClick:()=>{he(t),ie(null)}}]})},[y,ue,he,C]),me=a((t,n)=>{t.preventDefault(),y||ie({x:t.clientX,y:t.clientY,items:[{label:C.insertColumnLeft,onClick:()=>{de(n),ie(null)}},{label:C.insertColumnRight,onClick:()=>{de(n+1),ie(null)}},{label:C.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{we(n),ie(null)}}]})},[y,e,de,we,C]),pe=t=>$[t]??e[t]?.width??150;c(()=>{const t=e=>{if(!z.current)return;const t=e.clientX-z.current.startX,n=Math.max(40,z.current.startW+t);S(e=>({...e,[z.current.col]:n}))},n=()=>{if(z.current&&f){const t=e.map((e,t)=>({...e,width:$[t]??e.width}));t[z.current.col]={...t[z.current.col],width:$[z.current.col]??e[z.current.col].width},f(t)}z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)}},[e,$,f]);const fe=e=>N[e]??28;c(()=>{const e=e=>{if(!O.current)return;const t=e.clientY-O.current.startY,n=Math.max(20,O.current.startH+t);A(e=>({...e,[O.current.row]:n}))},t=()=>{O.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const ye=a(t=>{const n=document.createElement("canvas").getContext("2d");if(!n)return;n.font="12px ui-monospace, SFMono-Regular, Menlo, monospace";let r=0;for(const e of te){const o=String(e[t]??"").replace(/<[^>]*>/g,""),l=n.measureText(o).width;l>r&&(r=l)}const o=n.measureText(e[t]?.title??"").width;o>r&&(r=o);const l=Math.max(40,Math.ceil(r+24));if(S(e=>({...e,[t]:l})),f){const n=e.map((e,n)=>({...e,width:n===t?l:$[n]??e.width}));f(n)}},[te,e,$,f]),be=a(e=>{A(t=>{const n={...t};return delete n[e],n})},[]),ve=a(t=>{const{a:n,e:r}=Z.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,h=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?h=t.col:t.col<c&&(u=t.col);const d=l-o+1,w=a-c+1,g=te.map(e=>[...e]);for(;g.length<=i;)g.push(Array(e.length).fill(""));for(const e of g)for(;e.length<=h;)e.push("");function m(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=h;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&h===a){const r=m(Array.from({length:d},(e,n)=>g[o+n]?.[t]??""));if(r){const c=parseFloat(g[l]?.[t]??"0"),a=parseFloat(g[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%d+d)%d;n=g[o+r]?.[t]??""}}else if(1===d&&s===o&&i===l){const r=m(Array.from({length:w},(t,n)=>g[e]?.[c+n]??""));if(r){const o=parseFloat(g[e]?.[a]??"0"),l=parseFloat(g[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=g[e]?.[c+r]??""}}else{const r=((e-o)%d+d)%d,l=((t-c)%w+w)%w;n=g[o+r]?.[c+l]??""}g[e][t]=n}p(g),W({row:s,col:u}),V({row:i,col:h})},[te,e.length,p]);c(()=>{const e=e=>{if(!Q.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);J({row:r,col:o})},t=()=>{Q.current&&G&&ve(G),Q.current=!1,J(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[G,ve]);const xe=e=>{e.preventDefault(),e.stopPropagation(),Q.current=!0,document.body.style.cursor="crosshair"},Me=o(null),[De,ke]=l(0),[Ce,Ee]=l(800);c(()=>{const e=Me.current;if(!e)return;const t=()=>Ee(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Le=te.length>100,$e=Le?Math.max(0,Math.floor(De/28)-20):0,Se=Le?Math.min(te.length,Math.ceil((De+Ce)/28)+20):te.length,ze=s(()=>te.slice($e,Se),[te,$e,Se]),Ne=28*$e,Ae=28*(te.length-Se),Oe="px-2 h-8 text-left text-xs font-medium text-gray-500 uppercase bg-gray-100 border-b border-r border-gray-200 select-none";/* @__PURE__ */
1
+ import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{TH_ONE_LINE as t}from"./chunk-6KO5VTL7.js";import{useBrowserLayoutEffect as n}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-E6UCGCOC.js";import{useRef as o,useState as l,useEffect as c,useCallback as a,useMemo as s}from"react";import{createPortal as i}from"react-dom";import{jsxs as u,jsx as h,Fragment as d}from"react/jsx-runtime";function w(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function g({text:t,...n}){const r=s(()=>({__html:e(t)}),[t]);/* @__PURE__ */
2
+ return h("div",{...n,dangerouslySetInnerHTML:r})}function m({columns:e,data:m,onChange:p,onColumnsChange:f,fixedRows:y=!1,minRows:b=15,maxHeight:v="260px",cellStyles:x,onFocusChange:M,onSelectionChange:D}){const k=o(null),C=r().grid,[E,L]=l(null);c(()=>{M?.(E)},[E,M]);const[$,S]=l({}),z=o(null),[N,A]=l({}),O=o(null),[T,K]=l(null),[R,P]=l(null),[F,H]=l(null),[I,j]=l(null),[X,Y]=l(null),W=o(null);n(()=>{const e=W.current;if(!e||e.row!==X?.row||e.col!==X?.col)return;W.current=null;const t=k.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[X]);const[q,B]=l(null),[G,U]=l(null);c(()=>{D?.(q&&G?{anchor:q,end:G}:null)},[q,G,D]);const V=o(!1),[_,J]=l(null),Q=o(!1),Z=o({a:null,e:null});Z.current={a:q,e:G};const ee=q&&G&&(q.row!==G.row||q.col!==G.col),te=[...m];if(!y)for(;te.length<b;)te.push(Array(e.length).fill(""));const ne=a((t,n,r)=>{const o=te.map(e=>[...e]);for(;o.length<=t;)o.push(Array(e.length).fill(""));for(;o[t].length<e.length;)o[t].push("");o[t][n]=r,p(o)},[te,e.length,p]),re=a((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(te[e]?.[t]||"")){const r=te.map(e=>[...e]);r[e]&&(r[e][t]=n,p(r))}}V.current=!0,e.shiftKey&&q||B({row:t,col:n}),U({row:t,col:n})},[te,p,q]),oe=a((e,t)=>{V.current&&U({row:e,col:t})},[]);c(()=>{const e=()=>{V.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),c(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!q||!G)return;const t=window.getSelection();if(t&&t.toString().length>0&&!ee)return;const n=Math.min(q.row,G.row),r=Math.max(q.row,G.row),o=Math.min(q.col,G.col),l=Math.max(q.col,G.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(te[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q,G,te,ee]),c(()=>{const t=t=>{if(!E)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!k.current?.contains(n))return;const r=t.clipboardData?.getData("text/plain");if(!r)return;t.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=te.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=E.row+t;for(;l.length<=n;)l.push(Array(e.length).fill(""));for(;l[n].length<e.length;)l[n].push("");for(let r=0;r<o[t].length;r++){const c=E.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}p(y?l:w(l,e.length)),B({row:E.row,col:E.col}),U({row:Math.min(E.row+o.length-1,l.length-1),col:Math.min(E.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[E,te,e,p,y]);const le=a((t,n,r)=>{const o=t.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;t.preventDefault();const c=te.map(e=>[...e]);for(let t=0;t<l.length;t++){const o=n+t;for(;c.length<=o;)c.push(Array(e.length).fill(""));for(;c[o].length<e.length;)c[o].push("");for(let n=0;n<l[t].length;n++){const a=r+n;if(a>=e.length)break;e[a].readOnly||(c[o][a]=l[t][n].trim())}}p(y?c:w(c,e.length))},[te,e,p,y]),ce=a((t,n,r)=>{let o=n,l=r;if("Tab"===t.key)t.preventDefault(),l=t.shiftKey?r-1:r+1,l>=e.length&&(l=0,o=n+1),l<0&&(l=e.length-1,o=n-1);else if("Enter"===t.key)t.preventDefault(),o=t.shiftKey?n-1:n+1;else if("ArrowDown"===t.key)t.preventDefault(),o=n+1;else if("ArrowUp"===t.key)t.preventDefault(),o=n-1;else if("ArrowLeft"===t.key)t.preventDefault(),l=r-1;else{if("ArrowRight"!==t.key){if("Delete"===t.key||"Backspace"===t.key){const o=t.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(t.preventDefault(),ne(n,r,"")));if(t.preventDefault(),q&&G){const t=Math.min(q.row,G.row),n=Math.max(q.row,G.row),r=Math.min(q.col,G.col),o=Math.max(q.col,G.col),l=te.map(e=>[...e]);for(let c=t;c<=n;c++)for(let t=r;t<=o;t++)l[c]&&!e[t]?.readOnly&&(l[c][t]="");p(l)}else ne(n,r,"");return}return}t.preventDefault(),l=r+1}for(;l>=0&&l<e.length&&e[l].readOnly;)l+="Tab"===t.key&&t.shiftKey?-1:1;if(o>=0&&o<te.length&&l>=0&&l<e.length){const e=k.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),L({row:o,col:l}),Y(null),B({row:o,col:l}),U({row:o,col:l}))}},[e,te,te.length,ne,q,G,p]),ae=a(t=>{if(!y&&t>=te.length-2){const t=te.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));p(t)}},[y,te,e.length,p]),[se,ie]=l(null);c(()=>{if(!se)return;const e=()=>ie(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[se]);const ue=a(t=>{const n=te.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),p(n)},[te,e.length,p]),he=a(e=>{if(te.length<=1)return;const t=te.filter((t,n)=>n!==e);p(t)},[te,p]),de=a(e=>{const t=te.map(t=>{const n=[...t];return n.splice(e,0,""),n});p(t)},[te,p]),we=a(t=>{if(e.length<=1)return;const n=te.map(e=>{const n=[...e];return n.splice(t,1),n});p(n)},[te,e.length,p]),ge=a((e,t)=>{e.preventDefault(),y||ie({x:e.clientX,y:e.clientY,items:[{label:C.insertRowAbove,onClick:()=>{ue(t),ie(null)}},{label:C.insertRowBelow,onClick:()=>{ue(t+1),ie(null)}},{label:C.deleteRow(t+1),onClick:()=>{he(t),ie(null)}}]})},[y,ue,he,C]),me=a((t,n)=>{t.preventDefault(),y||ie({x:t.clientX,y:t.clientY,items:[{label:C.insertColumnLeft,onClick:()=>{de(n),ie(null)}},{label:C.insertColumnRight,onClick:()=>{de(n+1),ie(null)}},{label:C.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{we(n),ie(null)}}]})},[y,e,de,we,C]),pe=t=>$[t]??e[t]?.width??150;c(()=>{const t=e=>{if(!z.current)return;const t=e.clientX-z.current.startX,n=Math.max(40,z.current.startW+t);S(e=>({...e,[z.current.col]:n}))},n=()=>{if(z.current&&f){const t=e.map((e,t)=>({...e,width:$[t]??e.width}));t[z.current.col]={...t[z.current.col],width:$[z.current.col]??e[z.current.col].width},f(t)}z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)}},[e,$,f]);const fe=e=>N[e]??28;c(()=>{const e=e=>{if(!O.current)return;const t=e.clientY-O.current.startY,n=Math.max(20,O.current.startH+t);A(e=>({...e,[O.current.row]:n}))},t=()=>{O.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const ye=a(t=>{const n=document.createElement("canvas").getContext("2d");if(!n)return;n.font="12px ui-monospace, SFMono-Regular, Menlo, monospace";let r=0;for(const e of te){const o=String(e[t]??"").replace(/<[^>]*>/g,""),l=n.measureText(o).width;l>r&&(r=l)}const o=n.measureText(e[t]?.title??"").width;o>r&&(r=o);const l=Math.max(40,Math.ceil(r+24));if(S(e=>({...e,[t]:l})),f){const n=e.map((e,n)=>({...e,width:n===t?l:$[n]??e.width}));f(n)}},[te,e,$,f]),be=a(e=>{A(t=>{const n={...t};return delete n[e],n})},[]),ve=a(t=>{const{a:n,e:r}=Z.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,h=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?h=t.col:t.col<c&&(u=t.col);const d=l-o+1,w=a-c+1,g=te.map(e=>[...e]);for(;g.length<=i;)g.push(Array(e.length).fill(""));for(const e of g)for(;e.length<=h;)e.push("");function m(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=h;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&h===a){const r=m(Array.from({length:d},(e,n)=>g[o+n]?.[t]??""));if(r){const c=parseFloat(g[l]?.[t]??"0"),a=parseFloat(g[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%d+d)%d;n=g[o+r]?.[t]??""}}else if(1===d&&s===o&&i===l){const r=m(Array.from({length:w},(t,n)=>g[e]?.[c+n]??""));if(r){const o=parseFloat(g[e]?.[a]??"0"),l=parseFloat(g[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=g[e]?.[c+r]??""}}else{const r=((e-o)%d+d)%d,l=((t-c)%w+w)%w;n=g[o+r]?.[c+l]??""}g[e][t]=n}p(g),B({row:s,col:u}),U({row:i,col:h})},[te,e.length,p]);c(()=>{const e=e=>{if(!Q.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);J({row:r,col:o})},t=()=>{Q.current&&_&&ve(_),Q.current=!1,J(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[_,ve]);const xe=e=>{e.preventDefault(),e.stopPropagation(),Q.current=!0,document.body.style.cursor="crosshair"},Me=o(null),[De,ke]=l(0),[Ce,Ee]=l(800);c(()=>{const e=Me.current;if(!e)return;const t=()=>Ee(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Le=te.length>100,$e=Le?Math.max(0,Math.floor(De/28)-20):0,Se=Le?Math.min(te.length,Math.ceil((De+Ce)/28)+20):te.length,ze=s(()=>te.slice($e,Se),[te,$e,Se]),Ne=28*$e,Ae=28*(te.length-Se),Oe="px-2 h-8 text-left text-xs font-medium text-gray-500 uppercase bg-gray-100 border-b border-r border-gray-200 select-none";/* @__PURE__ */
3
3
  return u("div",{ref:Me,className:"border border-gray-300 rounded overflow-scroll grid-scroll",style:{maxHeight:v,height:v},onScroll:e=>ke(e.target.scrollTop),children:[
4
4
  /* @__PURE__ */u("table",{ref:k,className:"border-collapse select-none",style:{tableLayout:"fixed",minWidth:36+e.reduce((t,n)=>t+pe(e.indexOf(n)),0)},children:[
5
5
  /* @__PURE__ */u("colgroup",{children:[
6
6
  /* @__PURE__ */h("col",{style:{width:36}}),e.map((e,t)=>/* @__PURE__ */h("col",{style:{width:pe(t)}},e.key))]}),
7
7
  /* @__PURE__ */h("thead",{className:"sticky top-0 z-10",children:/* @__PURE__ */u("tr",{children:[
8
- /* @__PURE__ */h("th",{className:`${t} ${Oe} text-center w-9 cursor-pointer hover:bg-gray-200`,onClick:()=>{W({row:0,col:0}),V({row:te.length-1,col:e.length-1})},title:C.selectAll,children:"#"}),e.map((n,r)=>{const o=B&&U&&Math.min(B.col,U.col)<=r&&r<=Math.max(B.col,U.col)&&0===Math.min(B.row,U.row)&&Math.max(B.row,U.row)===te.length-1;/* @__PURE__ */
9
- return u("th",{className:`${t} ${Oe} cursor-pointer hover:bg-gray-200 relative${o?" !bg-blue-200":""}${X===r?" !bg-blue-100":""}`,style:{width:pe(r)},draggable:!0,onDragStart:()=>(e=>I(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),j(t)})(e,r),onDrop:()=>(t=>{if(null===F||F===t)return I(null),void j(null);const n=te.map(e=>{const n=[...e],[r]=n.splice(F,1);return n.splice(t,0,r),n});if(p(n),f){const n=[...e],[r]=n.splice(F,1);n.splice(t,0,r),f(n)}I(null),j(null)})(r),onDragEnd:()=>{I(null),j(null)},onClick:e=>{e.shiftKey&&B||W({row:0,col:r}),V({row:te.length-1,col:r})},onContextMenu:e=>me(e,r),children:[n.title,
8
+ /* @__PURE__ */h("th",{className:`${t} ${Oe} text-center w-9 cursor-pointer hover:bg-gray-200`,onClick:()=>{B({row:0,col:0}),U({row:te.length-1,col:e.length-1})},title:C.selectAll,children:"#"}),e.map((n,r)=>{const o=q&&G&&Math.min(q.col,G.col)<=r&&r<=Math.max(q.col,G.col)&&0===Math.min(q.row,G.row)&&Math.max(q.row,G.row)===te.length-1;/* @__PURE__ */
9
+ return u("th",{className:`${t} ${Oe} cursor-pointer hover:bg-gray-200 relative${o?" !bg-blue-200":""}${I===r?" !bg-blue-100":""}`,style:{width:pe(r)},draggable:!0,onDragStart:()=>(e=>H(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),j(t)})(e,r),onDrop:()=>(t=>{if(null===F||F===t)return H(null),void j(null);const n=te.map(e=>{const n=[...e],[r]=n.splice(F,1);return n.splice(t,0,r),n});if(p(n),f){const n=[...e],[r]=n.splice(F,1);n.splice(t,0,r),f(n)}H(null),j(null)})(r),onDragEnd:()=>{H(null),j(null)},onClick:e=>{e.shiftKey&&q||B({row:0,col:r}),U({row:te.length-1,col:r})},onContextMenu:e=>me(e,r),children:[n.title,
10
10
  /* @__PURE__ */h("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),z.current={col:t,startX:e.clientX,startW:pe(t)},document.body.style.cursor="col-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:C.resize})]},n.key)})]})}),
11
- /* @__PURE__ */u("tbody",{children:[Ne>0&&/* @__PURE__ */h("tr",{style:{height:Ne}}),ze.map((t,n)=>{const r=$e+n,o=B&&U&&Math.min(B.row,U.row)<=r&&r<=Math.max(B.row,U.row)&&0===Math.min(B.col,U.col)&&Math.max(B.col,U.col)===e.length-1;/* @__PURE__ */
11
+ /* @__PURE__ */u("tbody",{children:[Ne>0&&/* @__PURE__ */h("tr",{style:{height:Ne}}),ze.map((t,n)=>{const r=$e+n,o=q&&G&&Math.min(q.row,G.row)<=r&&r<=Math.max(q.row,G.row)&&0===Math.min(q.col,G.col)&&Math.max(q.col,G.col)===e.length-1;/* @__PURE__ */
12
12
  return u("tr",{style:{height:fe(r)},children:[
13
- /* @__PURE__ */u("td",{className:`relative px-1 py-1 text-center text-2xs text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${R===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>K(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),P(t)})(e,r),onDrop:()=>(e=>{if(null===T||T===e)return K(null),void P(null);const t=te.map(e=>[...e]),[n]=t.splice(T,1);t.splice(e,0,n),p(t),K(null),P(null)})(r),onDragEnd:()=>{K(null),P(null)},onClick:t=>{t.shiftKey&&B||W({row:r,col:0}),V({row:r,col:e.length-1})},onContextMenu:e=>ge(e,r),children:[r+1,
14
- /* @__PURE__ */h("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),O.current={row:t,startY:e.clientY,startH:fe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),be(r)},title:C.resize})]}),e.map((e,n)=>{const o=B&&U&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(B,U,r,n),l=H?.row===r&&H?.col===n&&!e.readOnly,c=E?.row===r&&E?.col===n,a=x?.[`${r}:${n}`],s=B&&U?Math.max(B.row,U.row):-1,i=B&&U?Math.max(B.col,U.col):-1,d=B&&U&&r===s&&n===i,w=Q.current&&G&&B&&U&&(()=>{const e=Math.min(B.row,U.row),t=Math.max(B.row,U.row),o=Math.min(B.col,U.col),l=Math.max(B.col,U.col);let c=e,a=t,s=o,i=l;return G.row>t?a=G.row:G.row<e&&(c=G.row),G.col>l?i=G.col:G.col<o&&(s=G.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-2xs":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",p=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
13
+ /* @__PURE__ */u("td",{className:`relative px-1 py-1 text-center text-2xs text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${R===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>K(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),P(t)})(e,r),onDrop:()=>(e=>{if(null===T||T===e)return K(null),void P(null);const t=te.map(e=>[...e]),[n]=t.splice(T,1);t.splice(e,0,n),p(t),K(null),P(null)})(r),onDragEnd:()=>{K(null),P(null)},onClick:t=>{t.shiftKey&&q||B({row:r,col:0}),U({row:r,col:e.length-1})},onContextMenu:e=>ge(e,r),children:[r+1,
14
+ /* @__PURE__ */h("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),O.current={row:t,startY:e.clientY,startH:fe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),be(r)},title:C.resize})]}),e.map((e,n)=>{const o=q&&G&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(q,G,r,n),l=X?.row===r&&X?.col===n&&!e.readOnly,c=E?.row===r&&E?.col===n,a=x?.[`${r}:${n}`],s=q&&G?Math.max(q.row,G.row):-1,i=q&&G?Math.max(q.col,G.col):-1,d=q&&G&&r===s&&n===i,w=Q.current&&_&&q&&G&&(()=>{const e=Math.min(q.row,G.row),t=Math.max(q.row,G.row),o=Math.min(q.col,G.col),l=Math.max(q.col,G.col);let c=e,a=t,s=o,i=l;return _.row>t?a=_.row:_.row<e&&(c=_.row),_.col>l?i=_.col:_.col<o&&(s=_.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-2xs":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",p=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
15
15
  return u("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${e.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${w?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){re(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>oe(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:t=>{t.target!==t.currentTarget||e.readOnly||Y({row:r,col:n})},children:[
16
- /* @__PURE__ */h(g,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${p}`,onMouseDown:e=>re(e,r,n),onMouseEnter:()=>oe(r,n),onDoubleClick:()=>{e.readOnly||Y({row:r,col:n})},onFocus:()=>{L({row:r,col:n}),_.current||(W({row:r,col:n}),V({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&ne(r,n,o),Y(null)},onInput:()=>ae(r),onPaste:e=>le(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),ne(r,n,t.key),q.current={row:r,col:n},void Y({row:r,col:n});ce(t,r,n)},text:t[n]||""}),d&&/* @__PURE__ */h("div",{onMouseDown:xe,title:C.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Ae>0&&/* @__PURE__ */h("tr",{style:{height:Ae}})]})]}),se&&i(
16
+ /* @__PURE__ */h(g,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${p}`,onMouseDown:e=>re(e,r,n),onMouseEnter:()=>oe(r,n),onDoubleClick:()=>{e.readOnly||Y({row:r,col:n})},onFocus:()=>{L({row:r,col:n}),V.current||(B({row:r,col:n}),U({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&ne(r,n,o),Y(null)},onInput:()=>ae(r),onPaste:e=>le(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),ne(r,n,t.key),W.current={row:r,col:n},void Y({row:r,col:n});ce(t,r,n)},text:t[n]||""}),d&&/* @__PURE__ */h("div",{onMouseDown:xe,title:C.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Ae>0&&/* @__PURE__ */h("tr",{style:{height:Ae}})]})]}),se&&i(
17
17
  /* @__PURE__ */u(d,{children:[
18
18
  /* @__PURE__ */h("div",{className:"fixed inset-0 z-(--z-popup)",onPointerDown:()=>ie(null)}),
19
19
  /* @__PURE__ */h("div",{className:"fixed z-(--z-popup) bg-white rounded-lg shadow-lg border border-gray-200 py-1 min-w-[160px]",style:{left:se.x,top:se.y},children:se.items.map((e,t)=>/* @__PURE__ */h("button",{onPointerDown:t=>{t.stopPropagation(),e.onClick()},className:"w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-700 hover:bg-gray-100",children:e.label},t))})]}),document.body)]})}export{m as EditableGrid,w as withSpareRow};
@@ -0,0 +1,22 @@
1
+ import{isSafeLinkHref as e}from"./chunk-PJPK2ADX.js";import{Button_default as t}from"./chunk-4IU5BSVE.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{createContext as l,useContext as s}from"react";import{jsx as a,jsxs as c}from"react/jsx-runtime";var o=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,i=l(void 0);function d({href:t,children:r}){const n=s(i),l=(t=>e(t.trim()))(t)?t:void 0;/* @__PURE__ */
2
+ return a("a",{href:l,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",onClick:l&&n?e=>{(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))(e)&&n(l)&&e.preventDefault()}:void 0,children:r})}function m(e){const t=[];let r,n=0,l=0;const s=new RegExp(o.source,"g");for(;null!==(r=s.exec(e));)r.index>n&&t.push(e.slice(n,r.index)),void 0!==r[1]?t.push(
3
+ /* @__PURE__ */c("span",{className:"text-gray-400",children:["[",r[1],"]"]},l++)):void 0!==r[3]?t.push(
4
+ /* @__PURE__ */a(d,{href:r[4],children:r[3]},l++)):void 0!==r[5]?t.push(
5
+ /* @__PURE__ */a("strong",{className:"font-semibold text-gray-900",children:m(r[5])},l++)):void 0!==r[6]?t.push(
6
+ /* @__PURE__ */a("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",children:r[6]},l++)):void 0!==r[7]&&t.push(/* @__PURE__ */a("em",{children:m(r[7])},l++)),n=s.lastIndex;return n<e.length&&t.push(e.slice(n)),t}function u({alt:e}){const t=e.replace(/^screenshot:\s*/i,""),l=n().markdown;/* @__PURE__ */
7
+ return c("div",{className:"my-1 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-3 text-gray-500",children:[
8
+ /* @__PURE__ */a(r,{name:"camera",look:"mini",className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),
9
+ /* @__PURE__ */c("span",{className:"text-xs",children:[
10
+ /* @__PURE__ */a("span",{className:"font-medium text-gray-600",children:`${l.screenshot} — `}),t]})]})}function h(e,t){const r=[];for(const n of e){const e=t.exec(n);e?r.push(e[1]):r.length&&(r[r.length-1]+=" "+n.trim())}return r}var p=e=>e.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(e=>e.trim());function g(e){return e.length>=2&&e[0].includes("|")&&/^\s*\|?[\s:|-]*-[\s:|-]*\|?\s*$/.test(e[1])&&e[1].includes("-")}function f(e){return e.replace(o,(e,t,r,n,l,s,a,c)=>t??n??s??a??c??"").trim()}function x({header:e,rows:t}){const r=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e;return[e,...t].map(e=>e.map(r).join(",")).join("\r\n")}function b(e,n,l){const s=p(e[0]),o=e.slice(2).map(p),i=/* @__PURE__ */a("div",{className:"my-1 overflow-x-auto rounded-lg border border-gray-200",children:/* @__PURE__ */c("table",{className:"w-full border-collapse text-sm",children:[
11
+ /* @__PURE__ */a("thead",{children:/* @__PURE__ */a("tr",{className:"bg-gray-50",children:s.map((e,t)=>/* @__PURE__ */a("th",{className:"border-b border-gray-200 px-3 py-2 text-left font-semibold text-gray-700",children:m(e)},t))})}),
12
+ /* @__PURE__ */a("tbody",{children:o.map((e,t)=>/* @__PURE__ */a("tr",{className:"even:bg-gray-50/50",children:e.map((e,t)=>/* @__PURE__ */a("td",{className:"border-t border-gray-100 px-3 h-8 align-top text-gray-700",children:m(e)},t))},t))})]})},n);return l?.length?/* @__PURE__ */c("div",{children:[i,
13
+ /* @__PURE__ */a("div",{className:"flex flex-wrap justify-end gap-1",children:l.map(e=>/* @__PURE__ */a(t,{size:"sm",variant:"secondary",leftIcon:e.icon?/* @__PURE__ */a(r,{name:e.icon,look:"mini",className:"h-4 w-4","aria-hidden":"true"}):void 0,onClick:()=>e.onSelect({header:s.map(f),rows:o.map(e=>e.map(f))}),children:e.label},e.label))})]},n):i}var y=/^( {0,3})(`{3,}|~{3,})[ \t]*(.*?)[ \t]*$/,v=/^[-*]\s+/,N=/^\d+\.\s+/,k=/^#{2,4}\s+/;function $(e){const t=e.split("\n"),r=[];let n=null;for(let e=0;e<t.length;e+=1){const l=t[e];let s=null;k.test(l)?s="heading":"table"!==n&&g(t.slice(e,e+2))?s="table":"bullet"!==n&&v.test(l)?s="bullet":"ordered"!==n&&N.test(l)&&("text"!==n||/^1\./.test(l))?s="ordered":"table"!==n||l.includes("|")?"heading"===n&&(s="text"):s="text",null!==s||null===n?(r.push([l]),n=s??"text"):r[r.length-1].push(l)}return r.map(e=>e.join("\n"))}function j(e){const t=e.replace(/\r\n/g,"\n").split("\n"),r=[];let n=[];const l=()=>{for(const e of n.join("\n").split(/\n{2,}/))for(const t of $(e.replace(/\s+$/,"")))""!==t.trim()&&r.push({text:t});n=[]};for(let e=0;e<t.length;e+=1){const s=y.exec(t[e]);if(!(null!==s&&!("`"===s[2][0]&&s[3].includes("`")))){n.push(t[e]);continue}l();const[,a,c,o]=s,i=[];let d=!1;for(e+=1;e<t.length;e+=1){const r=y.exec(t[e]);if(null!==r&&r[2][0]===c[0]&&r[2].length>=c.length&&""===r[3]){d=!0;break}i.push(a?t[e].replace(new RegExp(`^ {0,${a.length}}`),""):t[e])}r.push({fence:{lang:o.split(/[ \t]/)[0],code:i.join("\n"),closed:d}})}return l(),r}function w(e,t,r){if(r){let n=null;try{n=r(e)}catch{n=null}if(null!=n)/* @__PURE__ */return a("div",{children:n},t)}return function({lang:e,code:t},r){/* @__PURE__ */
14
+ return a("pre",{"data-language":e||void 0,className:"my-1 overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 p-3 font-mono text-xs text-gray-800",children:/* @__PURE__ */a("code",{children:t})},r)}(e,t)}function C({children:e,className:t,renderFence:r,tableActions:n,onLinkClick:l}){/* @__PURE__ */
15
+ return a(i.Provider,{value:l,children:/* @__PURE__ */a("div",{className:`space-y-3 text-sm leading-relaxed text-gray-700 ${t??""}`.trim(),children:j(e??"").map((e,t)=>"fence"in e?w(e.fence,t,r):function(e,t,r){const n=e.split("\n"),l=n[0],s=/^(#{2,4})\s+(.*)$/.exec(l);if(s&&1===n.length){const e=s[1].length;/* @__PURE__ */
16
+ return a(`h${e}`,{className:2===e?"mt-2 text-sm font-semibold uppercase tracking-wide text-gray-500":3===e?"mt-1 text-base font-semibold text-gray-900":"mt-1 text-sm font-semibold text-gray-900",children:m(s[2])},t)}if(1===n.length&&/^---+$/.test(l))/* @__PURE__ */
17
+ return a("hr",{className:"border-gray-200"},t);if(g(n))return b(n,t,r);if(/^>\s?/.test(l)){const e=n.map(e=>e.replace(/^>\s?/,"")).join(" ");/* @__PURE__ */
18
+ return a("div",{className:"my-1 rounded-r-lg border-l-4 border-blue-300 bg-blue-50/60 px-3 py-2 text-gray-700",children:m(e)},t)}const c=/^!\[([^\]]*)\]\(([^)]+)\)$/.exec(l);if(c&&1===n.length)/* @__PURE__ */
19
+ return a(u,{alt:c[1]},t);if(/^[-*]\s+/.test(l)){const e=h(n,/^[-*]\s+(.*)$/);/* @__PURE__ */
20
+ return a("ul",{className:"list-disc space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */a("li",{children:m(e)},t))},t)}const o=/^(\d+)\.\s+/.exec(l);if(o){const e=h(n,/^\d+\.\s+(.*)$/);/* @__PURE__ */
21
+ return a("ol",{start:Number(o[1]),className:"list-decimal space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */a("li",{className:"pl-1",children:m(e)},t))},t)}/* @__PURE__ */
22
+ return a("p",{children:m(n.join(" "))},t)}(e.text,t,n))})})}export{C as Markdown,f as plainCell,x as tableToCsv};