@flamingo-stack/openframe-frontend-core 0.0.628 → 0.0.629-2171.6182.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/dist/{chunk-QS2QCXBH.js → chunk-2J7EFH4V.js} +380 -30
  2. package/dist/chunk-2J7EFH4V.js.map +1 -0
  3. package/dist/{chunk-X3LC6R37.js → chunk-32P6KUZP.js} +2 -2
  4. package/dist/{chunk-EHAYNUOL.cjs → chunk-4E7XCEV3.cjs} +77 -2
  5. package/dist/chunk-4E7XCEV3.cjs.map +1 -0
  6. package/dist/{chunk-JONR3BDJ.cjs → chunk-53ARMJHM.cjs} +37 -37
  7. package/dist/{chunk-JONR3BDJ.cjs.map → chunk-53ARMJHM.cjs.map} +1 -1
  8. package/dist/{chunk-OQHFHKUG.cjs → chunk-55X46LKR.cjs} +450 -100
  9. package/dist/chunk-55X46LKR.cjs.map +1 -0
  10. package/dist/{chunk-U4UNC3RP.js → chunk-5BUEB2WQ.js} +12 -12
  11. package/dist/{chunk-6AFJQOT2.js → chunk-65IVNHBS.js} +4 -4
  12. package/dist/{chunk-U7TTQV4N.cjs → chunk-6I3KNDBF.cjs} +3 -3
  13. package/dist/{chunk-U7TTQV4N.cjs.map → chunk-6I3KNDBF.cjs.map} +1 -1
  14. package/dist/{chunk-S6WBBSII.js → chunk-76HB456V.js} +5 -5
  15. package/dist/{chunk-HLZKMYST.js → chunk-7ZDPJ6SW.js} +4 -4
  16. package/dist/{chunk-L6GJV7E7.cjs → chunk-BQ6QZUZ6.cjs} +83 -83
  17. package/dist/{chunk-L6GJV7E7.cjs.map → chunk-BQ6QZUZ6.cjs.map} +1 -1
  18. package/dist/{chunk-MB4IEWLH.js → chunk-BS6ASI3D.js} +3 -3
  19. package/dist/{chunk-Q544C4Z7.cjs → chunk-CHRPZ5PV.cjs} +25 -25
  20. package/dist/{chunk-Q544C4Z7.cjs.map → chunk-CHRPZ5PV.cjs.map} +1 -1
  21. package/dist/{chunk-LLSX5T7X.js → chunk-CIRD5P4U.js} +7 -7
  22. package/dist/{chunk-YQCA4ZEJ.js → chunk-CMUNJZWN.js} +2 -2
  23. package/dist/{chunk-UBX3ATG5.cjs → chunk-CP3R4GRA.cjs} +451 -436
  24. package/dist/chunk-CP3R4GRA.cjs.map +1 -0
  25. package/dist/{chunk-2E543KJD.js → chunk-D7VNHPJB.js} +10 -8
  26. package/dist/{chunk-2E543KJD.js.map → chunk-D7VNHPJB.js.map} +1 -1
  27. package/dist/{chunk-TDKOW2C5.cjs → chunk-DDUG42FK.cjs} +28 -26
  28. package/dist/chunk-DDUG42FK.cjs.map +1 -0
  29. package/dist/{chunk-SWJ6QLD7.cjs → chunk-ELKTBTGR.cjs} +105 -105
  30. package/dist/{chunk-SWJ6QLD7.cjs.map → chunk-ELKTBTGR.cjs.map} +1 -1
  31. package/dist/{chunk-6QLOSGE7.cjs → chunk-F4JGAGI3.cjs} +49 -47
  32. package/dist/chunk-F4JGAGI3.cjs.map +1 -0
  33. package/dist/{chunk-TUUSLED7.js → chunk-FENZRLVO.js} +10 -8
  34. package/dist/{chunk-TUUSLED7.js.map → chunk-FENZRLVO.js.map} +1 -1
  35. package/dist/{chunk-VCY2KHOE.cjs → chunk-FTWVYXNP.cjs} +34 -34
  36. package/dist/{chunk-VCY2KHOE.cjs.map → chunk-FTWVYXNP.cjs.map} +1 -1
  37. package/dist/{chunk-C3DDNRJG.cjs → chunk-FYC3W72E.cjs} +6 -6
  38. package/dist/{chunk-C3DDNRJG.cjs.map → chunk-FYC3W72E.cjs.map} +1 -1
  39. package/dist/{chunk-GH4WLDPS.cjs → chunk-G5FL4QTN.cjs} +18 -18
  40. package/dist/{chunk-GH4WLDPS.cjs.map → chunk-G5FL4QTN.cjs.map} +1 -1
  41. package/dist/{chunk-BND25SXU.cjs → chunk-GUCKPOPQ.cjs} +42 -42
  42. package/dist/{chunk-BND25SXU.cjs.map → chunk-GUCKPOPQ.cjs.map} +1 -1
  43. package/dist/{chunk-HNNR5CGX.js → chunk-HRRKZWFF.js} +10 -8
  44. package/dist/{chunk-HNNR5CGX.js.map → chunk-HRRKZWFF.js.map} +1 -1
  45. package/dist/{chunk-WBZ4HP7D.js → chunk-J6ATJUEE.js} +4 -4
  46. package/dist/{chunk-Y5QXDVPP.cjs → chunk-JQSN7D7X.cjs} +7 -7
  47. package/dist/{chunk-Y5QXDVPP.cjs.map → chunk-JQSN7D7X.cjs.map} +1 -1
  48. package/dist/{chunk-5LIDR7HL.js → chunk-JRYS4VMV.js} +4 -79
  49. package/dist/{chunk-5LIDR7HL.js.map → chunk-JRYS4VMV.js.map} +1 -1
  50. package/dist/{chunk-KTBZJP5J.cjs → chunk-KAG3SX3R.cjs} +22 -20
  51. package/dist/chunk-KAG3SX3R.cjs.map +1 -0
  52. package/dist/{chunk-ON7663OW.js → chunk-L5FEAOGJ.js} +8 -354
  53. package/dist/chunk-L5FEAOGJ.js.map +1 -0
  54. package/dist/{chunk-LCMXGM2P.js → chunk-LUBIWC3N.js} +8 -8
  55. package/dist/{chunk-ZRCWXJDW.js → chunk-LZB2UZJY.js} +4 -4
  56. package/dist/{chunk-JWXEEZKD.js → chunk-MIOE7FYN.js} +3 -3
  57. package/dist/{chunk-K43T7N7O.js → chunk-NBM7ZB6T.js} +12 -12
  58. package/dist/{chunk-YZJL6WGP.js → chunk-NDIPDU36.js} +49 -34
  59. package/dist/chunk-NDIPDU36.js.map +1 -0
  60. package/dist/{chunk-3IXDZI3R.cjs → chunk-P7UT2YSC.cjs} +3 -3
  61. package/dist/{chunk-3IXDZI3R.cjs.map → chunk-P7UT2YSC.cjs.map} +1 -1
  62. package/dist/{chunk-JJUV7Z4L.cjs → chunk-QIVX7F3N.cjs} +27 -27
  63. package/dist/{chunk-JJUV7Z4L.cjs.map → chunk-QIVX7F3N.cjs.map} +1 -1
  64. package/dist/{chunk-WIP5JO2O.cjs → chunk-R46TW4LX.cjs} +9 -9
  65. package/dist/{chunk-WIP5JO2O.cjs.map → chunk-R46TW4LX.cjs.map} +1 -1
  66. package/dist/{chunk-2MMEPNSX.cjs → chunk-RAPPN6MN.cjs} +3 -3
  67. package/dist/{chunk-2MMEPNSX.cjs.map → chunk-RAPPN6MN.cjs.map} +1 -1
  68. package/dist/{chunk-XQ4II4BK.js → chunk-SOUGXQJE.js} +4 -4
  69. package/dist/{chunk-E523WX5V.cjs → chunk-TV6NXNKO.cjs} +5 -5
  70. package/dist/{chunk-E523WX5V.cjs.map → chunk-TV6NXNKO.cjs.map} +1 -1
  71. package/dist/{chunk-FKBM6U43.js → chunk-USIRWQJ3.js} +76 -1
  72. package/dist/{chunk-FKBM6U43.js.map → chunk-USIRWQJ3.js.map} +1 -1
  73. package/dist/{chunk-CCWI3622.cjs → chunk-VOZZQ6HQ.cjs} +4 -4
  74. package/dist/{chunk-CCWI3622.cjs.map → chunk-VOZZQ6HQ.cjs.map} +1 -1
  75. package/dist/{chunk-JVLLA3Z7.js → chunk-WYELOUP4.js} +6 -6
  76. package/dist/{chunk-F2KBCLUG.js → chunk-X5NN4NJM.js} +2 -2
  77. package/dist/{chunk-KT47FRJC.cjs → chunk-Y2ZRUCYH.cjs} +15 -15
  78. package/dist/{chunk-KT47FRJC.cjs.map → chunk-Y2ZRUCYH.cjs.map} +1 -1
  79. package/dist/{chunk-YXWGSDK4.cjs → chunk-ZI27ALYX.cjs} +5 -80
  80. package/dist/chunk-ZI27ALYX.cjs.map +1 -0
  81. package/dist/{chunk-BVQEU5JB.js → chunk-ZOMGXH7C.js} +2 -2
  82. package/dist/{chunk-UNI3POHU.cjs → chunk-ZYDNPUSH.cjs} +279 -625
  83. package/dist/chunk-ZYDNPUSH.cjs.map +1 -0
  84. package/dist/components/case-studies/index.cjs +14 -14
  85. package/dist/components/case-studies/index.js +8 -8
  86. package/dist/components/chat/index.cjs +5 -5
  87. package/dist/components/chat/index.js +4 -4
  88. package/dist/components/contact/index.cjs +9 -9
  89. package/dist/components/contact/index.js +8 -8
  90. package/dist/components/docs/index.cjs +12 -12
  91. package/dist/components/docs/index.js +11 -11
  92. package/dist/components/embeds/index.cjs +9 -9
  93. package/dist/components/embeds/index.js +8 -8
  94. package/dist/components/faq/index.cjs +10 -10
  95. package/dist/components/faq/index.js +9 -9
  96. package/dist/components/features/changelog-manager.d.ts +17 -1
  97. package/dist/components/features/changelog-manager.d.ts.map +1 -1
  98. package/dist/components/features/index.cjs +8 -8
  99. package/dist/components/features/index.js +7 -7
  100. package/dist/components/help-center-pages/index.cjs +31 -31
  101. package/dist/components/help-center-pages/index.js +22 -22
  102. package/dist/components/index.cjs +71 -69
  103. package/dist/components/index.cjs.map +1 -1
  104. package/dist/components/index.js +26 -24
  105. package/dist/components/index.js.map +1 -1
  106. package/dist/components/meeting-scheduler/index.cjs +49 -49
  107. package/dist/components/meeting-scheduler/index.js +9 -9
  108. package/dist/components/navigation/index.cjs +11 -11
  109. package/dist/components/navigation/index.js +10 -10
  110. package/dist/components/onboarding-guides/index.cjs +12 -12
  111. package/dist/components/onboarding-guides/index.js +11 -11
  112. package/dist/components/related-content/index.cjs +6 -6
  113. package/dist/components/related-content/index.js +5 -5
  114. package/dist/components/tickets/index.cjs +13 -13
  115. package/dist/components/tickets/index.js +12 -12
  116. package/dist/components/ui/color-preset-select.d.ts +4 -5
  117. package/dist/components/ui/color-preset-select.d.ts.map +1 -1
  118. package/dist/components/ui/department-badge.d.ts +3 -3
  119. package/dist/components/ui/index.cjs +10 -8
  120. package/dist/components/ui/index.cjs.map +1 -1
  121. package/dist/components/ui/index.js +9 -7
  122. package/dist/components/ui/palette-badge.d.ts +8 -6
  123. package/dist/components/ui/palette-badge.d.ts.map +1 -1
  124. package/dist/components/ui/status-badge.d.ts +1 -1
  125. package/dist/components/ui/status-badge.d.ts.map +1 -1
  126. package/dist/hooks/index.cjs +5 -5
  127. package/dist/hooks/index.js +4 -4
  128. package/dist/index.cjs +18 -18
  129. package/dist/index.cjs.map +1 -1
  130. package/dist/index.js +46 -46
  131. package/dist/types/department.d.ts +1 -1
  132. package/dist/types/department.d.ts.map +1 -1
  133. package/dist/types/index.cjs.map +1 -1
  134. package/dist/types/index.js.map +1 -1
  135. package/dist/types/product-release.d.ts +5 -0
  136. package/dist/types/product-release.d.ts.map +1 -1
  137. package/dist/utils/color-presets.d.ts +24 -0
  138. package/dist/utils/color-presets.d.ts.map +1 -0
  139. package/dist/utils/index.cjs +24 -21
  140. package/dist/utils/index.cjs.map +1 -1
  141. package/dist/utils/index.d.ts +1 -1
  142. package/dist/utils/index.d.ts.map +1 -1
  143. package/dist/utils/index.js +22 -19
  144. package/dist/utils/index.js.map +1 -1
  145. package/package.json +1 -1
  146. package/src/components/features/__tests__/changelog-manager-tags.test.tsx +57 -0
  147. package/src/components/features/changelog-manager.tsx +69 -5
  148. package/src/components/ui/.department-badge.md +2 -2
  149. package/src/components/ui/.palette-badge.md +2 -2
  150. package/src/components/ui/.status-badge.md +2 -2
  151. package/src/components/ui/__tests__/department-badge.test.tsx +21 -23
  152. package/src/components/ui/color-preset-select.tsx +5 -21
  153. package/src/components/ui/department-badge.tsx +3 -3
  154. package/src/components/ui/palette-badge.tsx +13 -8
  155. package/src/components/ui/status-badge.tsx +0 -5
  156. package/src/types/department.ts +1 -1
  157. package/src/types/product-release.ts +5 -0
  158. package/src/utils/.color-presets.md +2 -0
  159. package/src/utils/color-presets.ts +48 -0
  160. package/src/utils/index.ts +1 -2
  161. package/dist/chunk-6QLOSGE7.cjs.map +0 -1
  162. package/dist/chunk-EHAYNUOL.cjs.map +0 -1
  163. package/dist/chunk-KTBZJP5J.cjs.map +0 -1
  164. package/dist/chunk-ON7663OW.js.map +0 -1
  165. package/dist/chunk-OQHFHKUG.cjs.map +0 -1
  166. package/dist/chunk-QS2QCXBH.js.map +0 -1
  167. package/dist/chunk-TDKOW2C5.cjs.map +0 -1
  168. package/dist/chunk-UBX3ATG5.cjs.map +0 -1
  169. package/dist/chunk-UNI3POHU.cjs.map +0 -1
  170. package/dist/chunk-YXWGSDK4.cjs.map +0 -1
  171. package/dist/chunk-YZJL6WGP.js.map +0 -1
  172. package/dist/utils/badge-palette.d.ts +0 -18
  173. package/dist/utils/badge-palette.d.ts.map +0 -1
  174. package/src/utils/.badge-palette.md +0 -2
  175. package/src/utils/badge-palette.ts +0 -38
  176. /package/dist/{chunk-X3LC6R37.js.map → chunk-32P6KUZP.js.map} +0 -0
  177. /package/dist/{chunk-U4UNC3RP.js.map → chunk-5BUEB2WQ.js.map} +0 -0
  178. /package/dist/{chunk-6AFJQOT2.js.map → chunk-65IVNHBS.js.map} +0 -0
  179. /package/dist/{chunk-S6WBBSII.js.map → chunk-76HB456V.js.map} +0 -0
  180. /package/dist/{chunk-HLZKMYST.js.map → chunk-7ZDPJ6SW.js.map} +0 -0
  181. /package/dist/{chunk-MB4IEWLH.js.map → chunk-BS6ASI3D.js.map} +0 -0
  182. /package/dist/{chunk-LLSX5T7X.js.map → chunk-CIRD5P4U.js.map} +0 -0
  183. /package/dist/{chunk-YQCA4ZEJ.js.map → chunk-CMUNJZWN.js.map} +0 -0
  184. /package/dist/{chunk-WBZ4HP7D.js.map → chunk-J6ATJUEE.js.map} +0 -0
  185. /package/dist/{chunk-LCMXGM2P.js.map → chunk-LUBIWC3N.js.map} +0 -0
  186. /package/dist/{chunk-ZRCWXJDW.js.map → chunk-LZB2UZJY.js.map} +0 -0
  187. /package/dist/{chunk-JWXEEZKD.js.map → chunk-MIOE7FYN.js.map} +0 -0
  188. /package/dist/{chunk-K43T7N7O.js.map → chunk-NBM7ZB6T.js.map} +0 -0
  189. /package/dist/{chunk-XQ4II4BK.js.map → chunk-SOUGXQJE.js.map} +0 -0
  190. /package/dist/{chunk-JVLLA3Z7.js.map → chunk-WYELOUP4.js.map} +0 -0
  191. /package/dist/{chunk-F2KBCLUG.js.map → chunk-X5NN4NJM.js.map} +0 -0
  192. /package/dist/{chunk-BVQEU5JB.js.map → chunk-ZOMGXH7C.js.map} +0 -0
@@ -3,11 +3,15 @@ import {
3
3
  next_image_default
4
4
  } from "./chunk-MDKCTSDS.js";
5
5
  import {
6
+ PLATFORM_THEME,
7
+ clamp,
8
+ getPlatformAccentColor,
6
9
  getPlatformBrandClasses,
10
+ getPlatformDisplayName,
7
11
  useAuthedImageSrc,
8
12
  useImageEdgeColor,
9
13
  useOgPlaceholderUrl
10
- } from "./chunk-FKBM6U43.js";
14
+ } from "./chunk-USIRWQJ3.js";
11
15
  import {
12
16
  FigmaIcon,
13
17
  ImageIcon,
@@ -507,6 +511,332 @@ var SquareAvatar = memo(
507
511
  );
508
512
  SquareAvatar.displayName = "SquareAvatar";
509
513
 
514
+ // src/utils/color-analysis.ts
515
+ var DESIGN_PALETTE = [
516
+ { name: "yellow", hex: "#FFC008", rgb: [255, 192, 8] },
517
+ { name: "black", hex: "#161616", rgb: [22, 22, 22] },
518
+ { name: "gray", hex: "#888888", rgb: [136, 136, 136] }
519
+ ];
520
+ function hexToRgb(hex) {
521
+ const normalized = hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (_, r, g, b) => `${r}${r}${g}${g}${b}${b}`);
522
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(normalized);
523
+ return result ? [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)] : [0, 0, 0];
524
+ }
525
+ function getLuminance(rgb) {
526
+ const [r, g, b] = rgb.map((channel) => {
527
+ const c = channel / 255;
528
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
529
+ });
530
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
531
+ }
532
+ function getContrastRatio(color1, color2) {
533
+ const lum1 = getLuminance(color1);
534
+ const lum2 = getLuminance(color2);
535
+ const brightest = Math.max(lum1, lum2);
536
+ const darkest = Math.min(lum1, lum2);
537
+ return (brightest + 0.05) / (darkest + 0.05);
538
+ }
539
+ function pickReadableTextColor(bgHex) {
540
+ const bg = hexToRgb(bgHex);
541
+ const darkContrast = getContrastRatio(bg, [26, 26, 26]);
542
+ const lightContrast = getContrastRatio(bg, [250, 250, 250]);
543
+ return darkContrast >= lightContrast ? "dark" : "light";
544
+ }
545
+ function extractDominantColor(canvas) {
546
+ const ctx = canvas.getContext("2d");
547
+ if (!ctx) return [128, 128, 128];
548
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
549
+ const data = imageData.data;
550
+ const sampleSize = Math.max(1, Math.floor(data.length / (4 * 1e3)));
551
+ const colorCounts = {};
552
+ for (let i = 0; i < data.length; i += 4 * sampleSize) {
553
+ const r = data[i];
554
+ const g = data[i + 1];
555
+ const b = data[i + 2];
556
+ const alpha = data[i + 3];
557
+ if (alpha < 128) continue;
558
+ const bucketR = Math.round(r / 32) * 32;
559
+ const bucketG = Math.round(g / 32) * 32;
560
+ const bucketB = Math.round(b / 32) * 32;
561
+ const key = `${bucketR},${bucketG},${bucketB}`;
562
+ colorCounts[key] = (colorCounts[key] || 0) + 1;
563
+ }
564
+ let maxCount = 0;
565
+ let dominantColor = [128, 128, 128];
566
+ for (const [colorKey, count] of Object.entries(colorCounts)) {
567
+ if (count > maxCount) {
568
+ maxCount = count;
569
+ const [r, g, b] = colorKey.split(",").map(Number);
570
+ dominantColor = [r, g, b];
571
+ }
572
+ }
573
+ return dominantColor;
574
+ }
575
+ function getBestContrastColor(imageColor) {
576
+ let bestColor = DESIGN_PALETTE[0];
577
+ let bestContrast = 0;
578
+ for (const color of DESIGN_PALETTE) {
579
+ const contrast = getContrastRatio(imageColor, color.rgb);
580
+ if (contrast > bestContrast) {
581
+ bestContrast = contrast;
582
+ bestColor = color;
583
+ }
584
+ }
585
+ return bestContrast >= 3 ? bestColor : DESIGN_PALETTE.find((c) => c.name === "black") || bestColor;
586
+ }
587
+ function analyzeImageColor(imageSrc) {
588
+ return new Promise((resolve, reject) => {
589
+ const img = new Image();
590
+ img.crossOrigin = "anonymous";
591
+ img.onload = () => {
592
+ try {
593
+ const canvas = document.createElement("canvas");
594
+ const ctx = canvas.getContext("2d");
595
+ if (!ctx) {
596
+ reject(new Error("Could not get canvas context"));
597
+ return;
598
+ }
599
+ const maxSize = 100;
600
+ const scale = Math.min(maxSize / img.width, maxSize / img.height);
601
+ canvas.width = img.width * scale;
602
+ canvas.height = img.height * scale;
603
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
604
+ const dominantColor = extractDominantColor(canvas);
605
+ const bestContrastColor = getBestContrastColor(dominantColor);
606
+ resolve(bestContrastColor);
607
+ } catch (error) {
608
+ reject(error);
609
+ }
610
+ };
611
+ img.onerror = () => reject(new Error("Failed to load image"));
612
+ img.src = imageSrc;
613
+ });
614
+ }
615
+ async function extractImageEdgeColorAsync(imageUrl) {
616
+ return new Promise((resolve) => {
617
+ if (typeof window === "undefined") {
618
+ resolve("#000000");
619
+ return;
620
+ }
621
+ const img = new Image();
622
+ img.crossOrigin = "anonymous";
623
+ img.onload = () => {
624
+ try {
625
+ const canvas = document.createElement("canvas");
626
+ const ctx = canvas.getContext("2d");
627
+ if (!ctx) {
628
+ resolve("#000000");
629
+ return;
630
+ }
631
+ const maxSize = 50;
632
+ const scale = Math.min(maxSize / img.naturalWidth, maxSize / img.naturalHeight);
633
+ const w = Math.round(img.naturalWidth * scale);
634
+ const h = Math.round(img.naturalHeight * scale);
635
+ canvas.width = w;
636
+ canvas.height = h;
637
+ ctx.drawImage(img, 0, 0, w, h);
638
+ const data = ctx.getImageData(0, 0, w, h).data;
639
+ const edgeW = Math.max(2, Math.round(w * 0.15));
640
+ const edgeH = Math.max(2, Math.round(h * 0.15));
641
+ const bucketSize = 32;
642
+ const buckets = /* @__PURE__ */ new Map();
643
+ for (let y = 0; y < h; y++) {
644
+ for (let x = 0; x < w; x++) {
645
+ if (!(x < edgeW || x >= w - edgeW || y < edgeH || y >= h - edgeH)) continue;
646
+ const i = (y * w + x) * 4;
647
+ if (data[i + 3] < 128) continue;
648
+ const br = Math.floor(data[i] / bucketSize) * bucketSize;
649
+ const bg = Math.floor(data[i + 1] / bucketSize) * bucketSize;
650
+ const bb = Math.floor(data[i + 2] / bucketSize) * bucketSize;
651
+ const key = `${br},${bg},${bb}`;
652
+ const existing = buckets.get(key);
653
+ if (existing) {
654
+ existing.r += data[i];
655
+ existing.g += data[i + 1];
656
+ existing.b += data[i + 2];
657
+ existing.count++;
658
+ } else {
659
+ buckets.set(key, { r: data[i], g: data[i + 1], b: data[i + 2], count: 1 });
660
+ }
661
+ }
662
+ }
663
+ let best = { r: 0, g: 0, b: 0, count: 0 };
664
+ for (const b2 of buckets.values()) {
665
+ if (b2.count > best.count) best = b2;
666
+ }
667
+ if (best.count === 0) {
668
+ resolve("#000000");
669
+ return;
670
+ }
671
+ const r = Math.round(best.r / best.count), g = Math.round(best.g / best.count), b = Math.round(best.b / best.count);
672
+ resolve(
673
+ `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`
674
+ );
675
+ } catch {
676
+ resolve("#000000");
677
+ }
678
+ };
679
+ img.onerror = () => resolve("#000000");
680
+ img.src = imageUrl;
681
+ });
682
+ }
683
+
684
+ // src/utils/ods-color-tokens-stub.ts
685
+ var colorTokens = {
686
+ primary: "#FFC008",
687
+ secondary: "#161616",
688
+ background: "#FAFAFA",
689
+ surface: "#FFFFFF",
690
+ text: {
691
+ primary: "#161616",
692
+ secondary: "#666666",
693
+ inverse: "#FFFFFF"
694
+ },
695
+ border: "#E5E5E5"
696
+ };
697
+
698
+ // src/utils/ods-color-utils.ts
699
+ var TOKEN_MAP = colorTokens;
700
+ function lookupToken(tokenKey) {
701
+ const value = TOKEN_MAP[tokenKey];
702
+ return typeof value === "string" ? value : void 0;
703
+ }
704
+ function getODSToken(category, color, variant = "base") {
705
+ const tokenKey = `${category}-${color}-${variant}`;
706
+ return lookupToken(tokenKey);
707
+ }
708
+ function getCurrentPlatform() {
709
+ if (typeof window === "undefined") {
710
+ return process.env.NEXT_PUBLIC_APP_TYPE || "openmsp";
711
+ }
712
+ const domPlatform = document.documentElement.getAttribute("data-app-type");
713
+ if (domPlatform) {
714
+ return domPlatform;
715
+ }
716
+ return process.env.NEXT_PUBLIC_APP_TYPE || "openmsp";
717
+ }
718
+ function switchPlatformTheme(platform) {
719
+ if (typeof window === "undefined") return;
720
+ const root = document.documentElement;
721
+ root.setAttribute("data-app-type", platform);
722
+ window.dispatchEvent(
723
+ new CustomEvent("platformThemeChanged", {
724
+ detail: { platform }
725
+ })
726
+ );
727
+ }
728
+ function getSemanticColor(semanticName, platform) {
729
+ if (typeof window === "undefined") return void 0;
730
+ const currentPlatform = platform || getCurrentPlatform();
731
+ const originalPlatform = getCurrentPlatform();
732
+ if (currentPlatform !== originalPlatform) {
733
+ switchPlatformTheme(currentPlatform);
734
+ }
735
+ const testElement = document.createElement("div");
736
+ document.body.appendChild(testElement);
737
+ const computedStyle = getComputedStyle(testElement);
738
+ const colorValue = computedStyle.getPropertyValue(`--color-${semanticName}`);
739
+ document.body.removeChild(testElement);
740
+ if (currentPlatform !== originalPlatform) {
741
+ switchPlatformTheme(originalPlatform);
742
+ }
743
+ return colorValue.trim() || void 0;
744
+ }
745
+ function getPlatformConfig(platform) {
746
+ const currentPlatform = platform || getCurrentPlatform();
747
+ const isDarkTheme = PLATFORM_THEME === "dark";
748
+ return {
749
+ platform: currentPlatform,
750
+ accentColor: getPlatformAccentColor(currentPlatform),
751
+ isDarkTheme,
752
+ isLightTheme: !isDarkTheme,
753
+ brandName: getPlatformDisplayName(currentPlatform)
754
+ };
755
+ }
756
+ function usePlatformColors(platform) {
757
+ const currentPlatform = platform || getCurrentPlatform();
758
+ const config = getPlatformConfig(currentPlatform);
759
+ return {
760
+ platform: currentPlatform,
761
+ accentColor: config.accentColor,
762
+ isDarkTheme: config.isDarkTheme,
763
+ isLightTheme: config.isLightTheme,
764
+ brandName: config.brandName,
765
+ getToken: (category, color, variant) => getODSToken(category, color, variant),
766
+ switchTheme: (newPlatform) => switchPlatformTheme(newPlatform),
767
+ getSemanticColor: (semanticName) => getSemanticColor(semanticName, currentPlatform)
768
+ };
769
+ }
770
+ function getReadableTextColor(hex) {
771
+ return pickReadableTextColor(hex) === "dark" ? "#212121" : "#fafafa";
772
+ }
773
+ var HEX_PATTERN = /^#[0-9a-fA-F]{6}$/;
774
+ function hexToRgb2(hex) {
775
+ if (!HEX_PATTERN.test(hex)) return null;
776
+ const n = Number.parseInt(hex.slice(1), 16);
777
+ return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
778
+ }
779
+ function rgbToHex(r, g, b) {
780
+ const to = (n) => clamp(Math.round(n), 0, 255).toString(16).padStart(2, "0");
781
+ return `#${to(r)}${to(g)}${to(b)}`;
782
+ }
783
+ var HOVER_DARKEN_STEP = 10;
784
+ var ACTIVE_DARKEN_STEP = 20;
785
+ function darkenByStep(hex, step) {
786
+ const rgb = hexToRgb2(hex);
787
+ if (!rgb) return hex;
788
+ return rgbToHex(rgb.r - step, rgb.g - step, rgb.b - step);
789
+ }
790
+ function deriveHoverColor(hex) {
791
+ return darkenByStep(hex, HOVER_DARKEN_STEP);
792
+ }
793
+ function deriveActiveColor(hex) {
794
+ return darkenByStep(hex, ACTIVE_DARKEN_STEP);
795
+ }
796
+ function rgbToHsl(r, g, b) {
797
+ const rn = r / 255;
798
+ const gn = g / 255;
799
+ const bn = b / 255;
800
+ const max = Math.max(rn, gn, bn);
801
+ const min = Math.min(rn, gn, bn);
802
+ const l = (max + min) / 2;
803
+ if (max === min) return { h: 0, s: 0, l: Math.round(l * 100) };
804
+ const d = max - min;
805
+ const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
806
+ let h;
807
+ if (max === rn) h = (gn - bn) / d + (gn < bn ? 6 : 0);
808
+ else if (max === gn) h = (bn - rn) / d + 2;
809
+ else h = (rn - gn) / d + 4;
810
+ h *= 60;
811
+ return { h: Math.round(h), s: Math.round(s * 100), l: Math.round(l * 100) };
812
+ }
813
+ function hslToRgb(h, s, l) {
814
+ const sn = clamp(s, 0, 100) / 100;
815
+ const ln = clamp(l, 0, 100) / 100;
816
+ const hn = (h % 360 + 360) % 360;
817
+ if (sn === 0) {
818
+ const v = Math.round(ln * 255);
819
+ return { r: v, g: v, b: v };
820
+ }
821
+ const q = ln < 0.5 ? ln * (1 + sn) : ln + sn - ln * sn;
822
+ const p = 2 * ln - q;
823
+ const hue2rgb = (t) => {
824
+ let tn = t;
825
+ if (tn < 0) tn += 1;
826
+ if (tn > 1) tn -= 1;
827
+ if (tn < 1 / 6) return p + (q - p) * 6 * tn;
828
+ if (tn < 1 / 2) return q;
829
+ if (tn < 2 / 3) return p + (q - p) * (2 / 3 - tn) * 6;
830
+ return p;
831
+ };
832
+ const hk = hn / 360;
833
+ return {
834
+ r: Math.round(hue2rgb(hk + 1 / 3) * 255),
835
+ g: Math.round(hue2rgb(hk) * 255),
836
+ b: Math.round(hue2rgb(hk - 1 / 3) * 255)
837
+ };
838
+ }
839
+
510
840
  // src/components/ui/interactive-card.tsx
511
841
  import React from "react";
512
842
  import { jsx as jsx3 } from "react/jsx-runtime";
@@ -757,11 +1087,6 @@ var statusBadgeVariants = cva("inline-flex items-center justify-center rounded",
757
1087
  yellow: "border border-ods-border bg-ods-accent text-ods-text-on-accent",
758
1088
  green: "bg-ods-success text-ods-text-on-accent",
759
1089
  purple: "bg-ods-flamingo-pink text-ods-text-on-accent",
760
- // Solid and soft ODS palette fills (`BADGE_PALETTE`): tokens only, no hex.
761
- cyanSoft: "bg-ods-flamingo-cyan-secondary text-ods-flamingo-cyan",
762
- pinkSoft: "bg-ods-flamingo-pink-secondary text-ods-flamingo-pink",
763
- openYellow: "bg-ods-open-yellow text-ods-text-on-accent",
764
- red: "bg-ods-error text-ods-text-on-accent",
765
1090
  success: "bg-ods-success-secondary text-ods-success",
766
1091
  error: "bg-ods-error-secondary text-ods-error",
767
1092
  warning: "bg-ods-warning-secondary text-ods-warning",
@@ -812,43 +1137,48 @@ function StatusBadge({ text, variant, colorScheme, className, singleLine, gen, s
812
1137
  );
813
1138
  }
814
1139
 
815
- // src/utils/badge-palette.ts
816
- var BADGE_PALETTE = [
817
- "cyan",
818
- "cyanSoft",
819
- "pink",
820
- "pinkSoft",
821
- "openYellow",
822
- "warning",
823
- "green",
824
- "success",
825
- "red",
826
- "error"
1140
+ // src/utils/color-presets.ts
1141
+ var COLOR_PRESETS = [
1142
+ { key: "green", label: "Green", color: "#5ea62e" },
1143
+ { key: "lime", label: "Lime", color: "#8bc34a" },
1144
+ { key: "teal", label: "Teal", color: "#4db6ac" },
1145
+ { key: "sky", label: "Sky", color: "#4fc3f7" },
1146
+ { key: "periwinkle", label: "Periwinkle", color: "#7e9cd8" },
1147
+ { key: "lavender", label: "Lavender", color: "#b39ddb" },
1148
+ { key: "yellow", label: "Yellow", color: "#e1b32f" },
1149
+ { key: "sand", label: "Sand", color: "#f0c674" },
1150
+ { key: "peach", label: "Peach", color: "#f39c7a" },
1151
+ { key: "red", label: "Red", color: "#f36666" },
1152
+ { key: "pink", label: "Pink", color: "#e988a8" },
1153
+ { key: "neutral", label: "Neutral", color: "#b0b0b0" }
827
1154
  ];
828
- function isBadgePaletteKey(value) {
829
- return typeof value === "string" && BADGE_PALETTE.includes(value);
1155
+ function colorPreset(key) {
1156
+ return key ? COLOR_PRESETS.find((preset) => preset.key === key) : void 0;
830
1157
  }
831
- function pickBadgePaletteColor({
1158
+ function pickPresetColor({
832
1159
  avoid = [],
833
1160
  random = Math.random
834
1161
  } = {}) {
1162
+ const colours = COLOR_PRESETS.filter((preset) => preset.key !== "neutral");
835
1163
  const used = new Set(avoid);
836
- const free = BADGE_PALETTE.filter((key) => !used.has(key));
837
- const pool = free.length > 0 ? free : BADGE_PALETTE;
838
- return pool[Math.floor(random() * pool.length) % pool.length];
1164
+ const free = colours.filter((preset) => !used.has(preset.key));
1165
+ const pool = free.length > 0 ? free : colours;
1166
+ return pool[Math.floor(random() * pool.length) % pool.length].key;
839
1167
  }
840
1168
 
841
1169
  // src/components/ui/palette-badge.tsx
842
1170
  import { jsx as jsx7 } from "react/jsx-runtime";
843
1171
  function PaletteBadge({ text, color, className, variant = "button" }) {
1172
+ const fill = colorPreset(color)?.color ?? (color && HEX_PATTERN.test(color) ? color : null);
844
1173
  return /* @__PURE__ */ jsx7(
845
1174
  StatusBadge,
846
1175
  {
847
1176
  text,
848
- colorScheme: isBadgePaletteKey(color) ? color : "default",
1177
+ colorScheme: "default",
849
1178
  variant,
850
1179
  singleLine: true,
851
- className
1180
+ className,
1181
+ style: fill ? { backgroundColor: fill, color: getReadableTextColor(fill) } : void 0
852
1182
  }
853
1183
  );
854
1184
  }
@@ -4098,6 +4428,26 @@ export {
4098
4428
  formatPricingModel,
4099
4429
  formatBioText,
4100
4430
  SquareAvatar,
4431
+ DESIGN_PALETTE,
4432
+ getContrastRatio,
4433
+ pickReadableTextColor,
4434
+ extractDominantColor,
4435
+ getBestContrastColor,
4436
+ analyzeImageColor,
4437
+ extractImageEdgeColorAsync,
4438
+ getCurrentPlatform,
4439
+ switchPlatformTheme,
4440
+ getSemanticColor,
4441
+ getPlatformConfig,
4442
+ usePlatformColors,
4443
+ getReadableTextColor,
4444
+ HEX_PATTERN,
4445
+ hexToRgb2 as hexToRgb,
4446
+ rgbToHex,
4447
+ deriveHoverColor,
4448
+ deriveActiveColor,
4449
+ rgbToHsl,
4450
+ hslToRgb,
4101
4451
  InteractiveCard,
4102
4452
  Modal,
4103
4453
  ModalContent,
@@ -4109,9 +4459,9 @@ export {
4109
4459
  genBadgeBgOpacity,
4110
4460
  generationTierFromLabel,
4111
4461
  StatusBadge,
4112
- BADGE_PALETTE,
4113
- isBadgePaletteKey,
4114
- pickBadgePaletteColor,
4462
+ COLOR_PRESETS,
4463
+ colorPreset,
4464
+ pickPresetColor,
4115
4465
  PaletteBadge,
4116
4466
  DepartmentBadge,
4117
4467
  getProxiedImageUrl,
@@ -4209,4 +4559,4 @@ export {
4209
4559
  canonicalContentRefType,
4210
4560
  buildListUrl
4211
4561
  };
4212
- //# sourceMappingURL=chunk-QS2QCXBH.js.map
4562
+ //# sourceMappingURL=chunk-2J7EFH4V.js.map