@e-llm-studio/federated-dashboard-components 2.2.9-rca-test-16 → 2.2.9-rca-test-18

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 (148) hide show
  1. package/dist/ExecutiveDashboard/ExecutiveDashboardWrapper.js +1 -1
  2. package/dist/ExecutiveDashboard/api/insightsApi.js +1 -1
  3. package/dist/ExecutiveDashboard/components/ExecutiveDashboard.js +1 -1
  4. package/dist/ExecutiveDashboard/components/Graph/LineChart.js +1 -1
  5. package/dist/ExecutiveDashboard/components/Graph/axisDomain.js +1 -1
  6. package/dist/ExecutiveDashboard/components/Insights/AgCharts.js +1 -1
  7. package/dist/ExecutiveDashboard/components/Insights/AgReport.js +1 -1
  8. package/dist/ExecutiveDashboard/components/Insights/CommentsThread.js +1 -1
  9. package/dist/ExecutiveDashboard/components/Insights/DecisionAdvantageCard.js +1 -1
  10. package/dist/ExecutiveDashboard/components/Insights/DrillTable.js +1 -1
  11. package/dist/ExecutiveDashboard/components/Insights/InsightTabs.js +1 -1
  12. package/dist/ExecutiveDashboard/components/Insights/InsightsContext.js +1 -1
  13. package/dist/ExecutiveDashboard/components/Insights/KpiChart.js +1 -1
  14. package/dist/ExecutiveDashboard/components/Insights/L1Report.js +1 -1
  15. package/dist/ExecutiveDashboard/components/Insights/NeedsAttention.js +1 -1
  16. package/dist/ExecutiveDashboard/components/Insights/ReportDrawer.js +1 -1
  17. package/dist/ExecutiveDashboard/components/Insights/agPrimitives.js +1 -1
  18. package/dist/ExecutiveDashboard/components/Insights/drillDay.js +1 -1
  19. package/dist/ExecutiveDashboard/components/Insights/insightsErrors.js +2 -0
  20. package/dist/ExecutiveDashboard/components/Insights/insightsErrors.js.map +1 -0
  21. package/dist/ExecutiveDashboard/components/Insights/insightsFormat.js +1 -1
  22. package/dist/ExecutiveDashboard/components/Insights/insightsUtils.js +1 -1
  23. package/dist/ExecutiveDashboard/components/RcaDecisionComponent/CitationMarkdown.js +2 -0
  24. package/dist/ExecutiveDashboard/components/RcaDecisionComponent/CitationMarkdown.js.map +1 -0
  25. package/dist/ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.js +1 -1
  26. package/dist/ExecutiveDashboard/components/Table/TableCard.js +1 -1
  27. package/dist/HumanIntelligence/HumanChangesTableWrapper.js +1 -1
  28. package/dist/HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.js +1 -1
  29. package/dist/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.js +1 -1
  30. package/dist/HumanIntelligence/components/HumanIntelligenceCard/HumanIntelligenceCard.js +1 -1
  31. package/dist/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.js +2 -0
  32. package/dist/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.js.map +1 -0
  33. package/dist/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.module.css.js +2 -0
  34. package/dist/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.module.css.js.map +1 -0
  35. package/dist/HumanIntelligence/components/ReviewLearningConditionsModal/parser.js +2 -0
  36. package/dist/HumanIntelligence/components/ReviewLearningConditionsModal/parser.js.map +1 -0
  37. package/dist/HumanIntelligence/hooks/accessToken.js +2 -0
  38. package/dist/HumanIntelligence/hooks/accessToken.js.map +1 -0
  39. package/dist/HumanIntelligence/hooks/useHumanChangesData.js +1 -1
  40. package/dist/HumanIntelligence/utils/inlineMarkup.js +1 -1
  41. package/dist/cjs/ExecutiveDashboard/ExecutiveDashboardWrapper.js +1 -1
  42. package/dist/cjs/ExecutiveDashboard/api/insightsApi.js +1 -1
  43. package/dist/cjs/ExecutiveDashboard/components/ExecutiveDashboard.js +1 -1
  44. package/dist/cjs/ExecutiveDashboard/components/Graph/LineChart.js +1 -1
  45. package/dist/cjs/ExecutiveDashboard/components/Graph/axisDomain.js +1 -1
  46. package/dist/cjs/ExecutiveDashboard/components/Insights/AgCharts.js +1 -1
  47. package/dist/cjs/ExecutiveDashboard/components/Insights/AgReport.js +1 -1
  48. package/dist/cjs/ExecutiveDashboard/components/Insights/CommentsThread.js +1 -1
  49. package/dist/cjs/ExecutiveDashboard/components/Insights/DecisionAdvantageCard.js +1 -1
  50. package/dist/cjs/ExecutiveDashboard/components/Insights/DrillTable.js +1 -1
  51. package/dist/cjs/ExecutiveDashboard/components/Insights/InsightTabs.js +1 -1
  52. package/dist/cjs/ExecutiveDashboard/components/Insights/InsightsContext.js +1 -1
  53. package/dist/cjs/ExecutiveDashboard/components/Insights/KpiChart.js +1 -1
  54. package/dist/cjs/ExecutiveDashboard/components/Insights/L1Report.js +1 -1
  55. package/dist/cjs/ExecutiveDashboard/components/Insights/NeedsAttention.js +1 -1
  56. package/dist/cjs/ExecutiveDashboard/components/Insights/ReportDrawer.js +1 -1
  57. package/dist/cjs/ExecutiveDashboard/components/Insights/agPrimitives.js +1 -1
  58. package/dist/cjs/ExecutiveDashboard/components/Insights/drillDay.js +1 -1
  59. package/dist/cjs/ExecutiveDashboard/components/Insights/insightsErrors.js +2 -0
  60. package/dist/cjs/ExecutiveDashboard/components/Insights/insightsErrors.js.map +1 -0
  61. package/dist/cjs/ExecutiveDashboard/components/Insights/insightsFormat.js +1 -1
  62. package/dist/cjs/ExecutiveDashboard/components/Insights/insightsUtils.js +1 -1
  63. package/dist/cjs/ExecutiveDashboard/components/RcaDecisionComponent/CitationMarkdown.js +2 -0
  64. package/dist/cjs/ExecutiveDashboard/components/RcaDecisionComponent/CitationMarkdown.js.map +1 -0
  65. package/dist/cjs/ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.js +1 -1
  66. package/dist/cjs/ExecutiveDashboard/components/Table/TableCard.js +1 -1
  67. package/dist/cjs/HumanIntelligence/HumanChangesTableWrapper.js +1 -1
  68. package/dist/cjs/HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.js +1 -1
  69. package/dist/cjs/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.js +1 -1
  70. package/dist/cjs/HumanIntelligence/components/HumanIntelligenceCard/HumanIntelligenceCard.js +1 -1
  71. package/dist/cjs/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.js +2 -0
  72. package/dist/cjs/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.js.map +1 -0
  73. package/dist/cjs/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.module.css.js +2 -0
  74. package/dist/cjs/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.module.css.js.map +1 -0
  75. package/dist/cjs/HumanIntelligence/components/ReviewLearningConditionsModal/parser.js +2 -0
  76. package/dist/cjs/HumanIntelligence/components/ReviewLearningConditionsModal/parser.js.map +1 -0
  77. package/dist/cjs/HumanIntelligence/hooks/accessToken.js +2 -0
  78. package/dist/cjs/HumanIntelligence/hooks/accessToken.js.map +1 -0
  79. package/dist/cjs/HumanIntelligence/hooks/useHumanChangesData.js +1 -1
  80. package/dist/cjs/HumanIntelligence/utils/inlineMarkup.js +1 -1
  81. package/dist/cjs/styles.css +1 -1
  82. package/dist/styles.css +1 -1
  83. package/dist/types/ExecutiveDashboard/ExecutiveDashboardWrapper.d.ts +1 -1
  84. package/dist/types/ExecutiveDashboard/ExecutiveDashboardWrapper.d.ts.map +1 -1
  85. package/dist/types/ExecutiveDashboard/TestExecutiveDashboard.d.ts.map +1 -1
  86. package/dist/types/ExecutiveDashboard/api/insightsApi.d.ts +9 -0
  87. package/dist/types/ExecutiveDashboard/api/insightsApi.d.ts.map +1 -1
  88. package/dist/types/ExecutiveDashboard/components/ExecutiveDashboard.d.ts +3 -1
  89. package/dist/types/ExecutiveDashboard/components/ExecutiveDashboard.d.ts.map +1 -1
  90. package/dist/types/ExecutiveDashboard/components/Graph/LineChart.d.ts.map +1 -1
  91. package/dist/types/ExecutiveDashboard/components/Graph/axisDomain.d.ts +4 -4
  92. package/dist/types/ExecutiveDashboard/components/Graph/axisDomain.d.ts.map +1 -1
  93. package/dist/types/ExecutiveDashboard/components/Graph/types.d.ts +2 -0
  94. package/dist/types/ExecutiveDashboard/components/Graph/types.d.ts.map +1 -1
  95. package/dist/types/ExecutiveDashboard/components/Insights/AgCharts.d.ts.map +1 -1
  96. package/dist/types/ExecutiveDashboard/components/Insights/AgReport.d.ts +18 -3
  97. package/dist/types/ExecutiveDashboard/components/Insights/AgReport.d.ts.map +1 -1
  98. package/dist/types/ExecutiveDashboard/components/Insights/CommentsThread.d.ts.map +1 -1
  99. package/dist/types/ExecutiveDashboard/components/Insights/DecisionAdvantageCard.d.ts.map +1 -1
  100. package/dist/types/ExecutiveDashboard/components/Insights/DrillTable.d.ts.map +1 -1
  101. package/dist/types/ExecutiveDashboard/components/Insights/InsightTabs.d.ts.map +1 -1
  102. package/dist/types/ExecutiveDashboard/components/Insights/InsightsContext.d.ts +3 -1
  103. package/dist/types/ExecutiveDashboard/components/Insights/InsightsContext.d.ts.map +1 -1
  104. package/dist/types/ExecutiveDashboard/components/Insights/KpiChart.d.ts +28 -2
  105. package/dist/types/ExecutiveDashboard/components/Insights/KpiChart.d.ts.map +1 -1
  106. package/dist/types/ExecutiveDashboard/components/Insights/L1Report.d.ts.map +1 -1
  107. package/dist/types/ExecutiveDashboard/components/Insights/NeedsAttention.d.ts.map +1 -1
  108. package/dist/types/ExecutiveDashboard/components/Insights/ReportDrawer.d.ts.map +1 -1
  109. package/dist/types/ExecutiveDashboard/components/Insights/agPrimitives.d.ts +16 -3
  110. package/dist/types/ExecutiveDashboard/components/Insights/agPrimitives.d.ts.map +1 -1
  111. package/dist/types/ExecutiveDashboard/components/Insights/drillDay.d.ts +9 -4
  112. package/dist/types/ExecutiveDashboard/components/Insights/drillDay.d.ts.map +1 -1
  113. package/dist/types/ExecutiveDashboard/components/Insights/insightsErrors.d.ts +11 -0
  114. package/dist/types/ExecutiveDashboard/components/Insights/insightsErrors.d.ts.map +1 -0
  115. package/dist/types/ExecutiveDashboard/components/Insights/insightsFormat.d.ts +38 -0
  116. package/dist/types/ExecutiveDashboard/components/Insights/insightsFormat.d.ts.map +1 -1
  117. package/dist/types/ExecutiveDashboard/components/Insights/insightsUtils.d.ts +17 -1
  118. package/dist/types/ExecutiveDashboard/components/Insights/insightsUtils.d.ts.map +1 -1
  119. package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/CitationMarkdown.d.ts +54 -0
  120. package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/CitationMarkdown.d.ts.map +1 -0
  121. package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.d.ts +3 -2
  122. package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.d.ts.map +1 -1
  123. package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/types.d.ts +15 -0
  124. package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/types.d.ts.map +1 -1
  125. package/dist/types/ExecutiveDashboard/components/Table/TableCard.d.ts +6 -1
  126. package/dist/types/ExecutiveDashboard/components/Table/TableCard.d.ts.map +1 -1
  127. package/dist/types/ExecutiveDashboard/types/index.d.ts +6 -0
  128. package/dist/types/ExecutiveDashboard/types/index.d.ts.map +1 -1
  129. package/dist/types/ExecutiveDashboard/types/insights.d.ts +20 -0
  130. package/dist/types/ExecutiveDashboard/types/insights.d.ts.map +1 -1
  131. package/dist/types/HumanIntelligence/HumanChangesTableWrapper.d.ts.map +1 -1
  132. package/dist/types/HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.d.ts +2 -0
  133. package/dist/types/HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.d.ts.map +1 -1
  134. package/dist/types/HumanIntelligence/components/HumanIntelligenceCard/HumanIntelligenceCard.d.ts +2 -0
  135. package/dist/types/HumanIntelligence/components/HumanIntelligenceCard/HumanIntelligenceCard.d.ts.map +1 -1
  136. package/dist/types/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.d.ts +5 -0
  137. package/dist/types/HumanIntelligence/components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.d.ts.map +1 -0
  138. package/dist/types/HumanIntelligence/components/ReviewLearningConditionsModal/parser.d.ts +20 -0
  139. package/dist/types/HumanIntelligence/components/ReviewLearningConditionsModal/parser.d.ts.map +1 -0
  140. package/dist/types/HumanIntelligence/components/ReviewLearningConditionsModal/types.d.ts +45 -0
  141. package/dist/types/HumanIntelligence/components/ReviewLearningConditionsModal/types.d.ts.map +1 -0
  142. package/dist/types/HumanIntelligence/hooks/accessToken.d.ts +13 -0
  143. package/dist/types/HumanIntelligence/hooks/accessToken.d.ts.map +1 -0
  144. package/dist/types/HumanIntelligence/hooks/useHumanChangesData.d.ts +12 -4
  145. package/dist/types/HumanIntelligence/hooks/useHumanChangesData.d.ts.map +1 -1
  146. package/dist/types/HumanIntelligence/utils/inlineMarkup.d.ts +2 -0
  147. package/dist/types/HumanIntelligence/utils/inlineMarkup.d.ts.map +1 -1
  148. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- import{__assign as n}from"../../../_virtual/_tslib.js";function t(n,t){var e,r;if(!t||null==n||!Number.isFinite(n))return null;var a=Math.max(0,Math.min(Number.isFinite(Number(t.decimals))?Number(t.decimals):1,4)),o=n,i="";if(t.compact)for(var c=0,u=[[1e9,"B"],[1e6,"M"],[1e3,"K"]];c<u.length;c++){var l=u[c],d=l[0],v=l[1];if(Math.abs(o)>=d){o/=d,i=v;break}}var f=Math.abs(o).toLocaleString("en-US",{minimumFractionDigits:a,maximumFractionDigits:a});return"".concat(o<0?"-":"").concat(null!==(e=t.prefix)&&void 0!==e?e:"").concat(f).concat(i).concat(null!==(r=t.suffix)&&void 0!==r?r:"")}var e=function(n){return n.replace(/\.(\d*?)0+(?!\d)/,function(n,t){return t?".".concat(t):""})};function r(r,a){if(!a)return null;var o=t(r,a.compact?n(n({},a),{decimals:0}):a);return o&&!a.compact?e(o):o}var a={day:{grain:"day",unit:"day",adjective:"Daily"},week:{grain:"week",unit:"week",adjective:"Weekly"},month:{grain:"month",unit:"month",adjective:"Monthly"},quarter:{grain:"quarter",unit:"quarter",adjective:"Quarterly"}},o=function(n){var t;return null!==(t=a[String(null!=n?n:"day")])&&void 0!==t?t:a.day},i=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},c=function(n,t){return void 0===t&&(t="day"),"day"===t?"".concat(n,"-day average"):"".concat(n,"-").concat(i(t)," Average")},u=function(n,t){return void 0===t&&(t="day"),"day"===t?"".concat(n,"-day Average"):"".concat(n,"-").concat(i(t)," Average")},l=function(n,t){return void 0===t&&(t="day"),"".concat(n).concat(t.charAt(0))},d=function(n){var t=n.slice(0,10).split("-").map(Number),e=t[0],r=t[1],a=t[2];return new Date(e,(r||1)-1,a||1)};function v(n,t){var e=String(n);if(!/^\d{4}-\d{2}-\d{2}/.test(e))return e;if("month"===t)return d(e).toLocaleString("en-GB",{month:"short"});if("quarter"===t){var r=d(e);return"Q".concat(Math.floor(r.getMonth()/3)+1," ").concat(r.getFullYear())}return"".concat(e.slice(5,7),"/").concat(e.slice(8,10))}function f(n,t){var e=String(n);if(!t||"day"===t||!/^\d{4}-\d{2}-\d{2}/.test(e))return e;var r=d(e);return"month"===t?"".concat(r.toLocaleString("en-GB",{month:"long"})," ").concat(r.getFullYear()):"quarter"===t?"Q".concat(Math.floor(r.getMonth()/3)+1," ").concat(r.getFullYear()):"Week of ".concat(r.getDate()," ").concat(r.toLocaleString("en-GB",{month:"short"})," ").concat(r.getFullYear())}f.axisTitle=function(n){return i(n)};var s=function(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"").replace(/s$/,"")};function m(n,t){var e,r,a=null===(e=null==n?void 0:n.label)||void 0===e?void 0:e.trim();if(a&&(null===(r=null==t?void 0:t.options)||void 0===r?void 0:r.length)){var o=s(a),i=t.options.find(function(n){var t;return s(n.label)===o||(null!==(t=n.aliases)&&void 0!==t?t:[]).some(function(n){return s(n)===o})});return i?{label:i.label,tone:i.tone}:!1===t.showUnknown?void 0:{label:a,tone:"neutral"}}}function g(n,t){var e,r=function(n){var t,e;return null!==(e=null===(t=/^[\s\S]*?[.!?](?=\s+[A-Z(]|\s*$)/.exec(n))||void 0===t?void 0:t[0])&&void 0!==e?e:n}(n);return null===(e=null==t?void 0:t.find(function(n){return n.label&&r.includes(n.label)}))||void 0===e?void 0:e.label}export{c as averageLabel,u as averageLineLabel,l as averageShort,r as formatAxisFigure,t as formatFigure,f as longPeriod,o as periodWordsOf,m as rootCauseTag,g as rootCauseTitle,v as shortPeriod,e as trimZeros};
1
+ import{__assign as n,__spreadArray as t}from"../../../_virtual/_tslib.js";function e(n,t){var e,r;if(!t||null==n||!Number.isFinite(n))return null;var a=Math.max(0,Math.min(Number.isFinite(Number(t.decimals))?Number(t.decimals):1,4)),o=n,i="";if(t.compact)for(var l=0,u=[[1e9,"B"],[1e6,"M"],[1e3,"K"]];l<u.length;l++){var c=u[l],d=c[0],f=c[1];if(Math.abs(o)>=d){o/=d,i=f;break}}var s=Math.abs(o).toLocaleString("en-US",{minimumFractionDigits:a,maximumFractionDigits:a});return"".concat(o<0?"-":"").concat(null!==(e=t.prefix)&&void 0!==e?e:"").concat(s).concat(i).concat(null!==(r=t.suffix)&&void 0!==r?r:"")}var r=function(n){return n.replace(/\.(\d*?)0+(?!\d)/,function(n,t){return t?".".concat(t):""})};function a(t,a){if(!a)return null;var o=e(t,a.compact?n(n({},a),{decimals:0}):a);return o&&!a.compact?r(o):o}var o={day:{grain:"day",unit:"day",adjective:"Daily"},week:{grain:"week",unit:"week",adjective:"Weekly"},month:{grain:"month",unit:"month",adjective:"Monthly"},quarter:{grain:"quarter",unit:"quarter",adjective:"Quarterly"}},i=function(n){var t;return null!==(t=o[String(null!=n?n:"day")])&&void 0!==t?t:o.day},l=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},u=function(n,t){return void 0===t&&(t="day"),"day"===t?"".concat(n,"-day average"):"".concat(n,"-").concat(l(t)," Average")},c=function(n,t){return void 0===t&&(t="day"),"day"===t?"".concat(n,"-day Average"):"".concat(n,"-").concat(l(t)," Average")},d=function(n,t){return void 0===t&&(t="day"),"".concat(n).concat(t.charAt(0))},f=function(n){var t=n.slice(0,10).split("-").map(Number),e=t[0],r=t[1],a=t[2];return new Date(e,(r||1)-1,a||1)};function s(n,t){var e=String(n);if(!/^\d{4}-\d{2}-\d{2}/.test(e))return e;if("month"===t)return f(e).toLocaleString("en-GB",{month:"short"});if("quarter"===t){var r=f(e);return"Q".concat(Math.floor(r.getMonth()/3)+1," ").concat(r.getFullYear())}return"".concat(e.slice(5,7),"/").concat(e.slice(8,10))}function v(n,t){var e=String(n);if(!t||"day"===t||!/^\d{4}-\d{2}-\d{2}/.test(e))return e;var r=f(e);return"month"===t?"".concat(r.toLocaleString("en-GB",{month:"long"})," ").concat(r.getFullYear()):"quarter"===t?"Q".concat(Math.floor(r.getMonth()/3)+1," ").concat(r.getFullYear()):"Week of ".concat(r.getDate()," ").concat(r.toLocaleString("en-GB",{month:"short"})," ").concat(r.getFullYear())}v.axisTitle=function(n){return l(n)};var g=function(n){return"".concat(n.getFullYear(),"-").concat(String(n.getMonth()+1).padStart(2,"0"),"-").concat(String(n.getDate()).padStart(2,"0"))};function h(n,t){if(!/^\d{4}-\d{2}-\d{2}/.test(n))return n;var e=f(n);return"month"===t?g(new Date(e.getFullYear(),e.getMonth(),1)):"quarter"===t?g(new Date(e.getFullYear(),3*Math.floor(e.getMonth()/3),1)):"year"===t?g(new Date(e.getFullYear(),0,1)):n.slice(0,10)}function m(n,t){if(!/^\d{4}-\d{2}-\d{2}/.test(n))return n;var e=f(h(n,t));return"month"===t?g(new Date(e.getFullYear(),e.getMonth()+1,0)):"quarter"===t?g(new Date(e.getFullYear(),e.getMonth()+3,0)):"year"===t?g(new Date(e.getFullYear(),11,31)):"week"===t?g(new Date(e.getFullYear(),e.getMonth(),e.getDate()+6)):n.slice(0,10)}function p(n,t,e,r){var a=((null==n?void 0:n.start)||(null==n?void 0:n.end)||"").slice(0,10),o=((null==n?void 0:n.end)||(null==n?void 0:n.start)||"").slice(0,10);return!(!a||!o)&&(m(o,r)>=t&&a<=e)}var y=/\b(?:costs?|expenses?|expenditures?|spend(?:ing)?|opex|overheads?)\b/gi;function w(n){var e=new Map;return Object.entries(null!=n?n:{}).forEach(function(n){var r,a,o=n[0],i=n[1],l="down"===(null==i?void 0:i.goodDirection)?"down":"up",u=Array.isArray(null==i?void 0:i.aliases)?i.aliases.filter(function(n){return"string"==typeof n}):[];t([null!==(r=null==i?void 0:i.label)&&void 0!==r?r:"",(null!==(a=null==i?void 0:i.label)&&void 0!==a?a:"").replace(/\s*\([^()]*\)\s*$/,""),o.replace(/_/g," ")],u,!0).forEach(function(n){var t=n.trim();t.length>=3&&!e.has(t.toLowerCase())&&e.set(t.toLowerCase(),{name:t,good:l})})}),Array.from(e.values()).sort(function(n,t){return t.name.length-n.name.length})}var b=/[.!?]\s+(?=[A-Z(])/g;function x(n,e,r){var a=[];e.forEach(function(t){var e=t.name,r=t.good;Array.from(n.matchAll(new RegExp("(?<![\\w])".concat(function(n){return n.replace(/[.*+?^$(){}|[\]\\/]/g,"\\$&")}(e),"(?![\\w])"),"gi"))).forEach(function(n){var t,e;a.push({start:null!==(t=n.index)&&void 0!==t?t:0,end:(null!==(e=n.index)&&void 0!==e?e:0)+n[0].length,good:r})})}),Array.from(n.matchAll(y)).forEach(function(n){var t,e=null!==(t=n.index)&&void 0!==t?t:0;a.some(function(t){return t.start<=e&&t.end>=e+n[0].length})||a.push({start:e,end:e+n[0].length,good:"down"})});var o=t([0],Array.from(n.matchAll(b),function(n){var t;return(null!==(t=n.index)&&void 0!==t?t:0)+n[0].length}),!0),i=new RegExp(r.source,r.flags.includes("g")?r.flags:"".concat(r.flags,"g")),l=Array.from(n.matchAll(i),function(n){var t;return null!==(t=n.index)&&void 0!==t?t:0});return Array.from(n.matchAll(i),function(t){var e,r=null!==(e=t.index)&&void 0!==e?e:0,i=r+t[0].length,u=/^\)?\s*(?:in|of|for)\s+(?:the\s+)?/i.exec(n.slice(i));if(u){var c=i+u[0].length,d=a.filter(function(n){return n.start===c}).sort(function(n,t){return t.end-n.end})[0];if(d)return d.good}var f=Math.max.apply(Math,o.filter(function(n){return n<=r})),s=a.filter(function(n){return n.start>=f&&n.end<=r&&function(n){return!l.some(function(t){return t>=n.end&&t<r})}(n)}).sort(function(n,t){return t.start-n.start||t.end-n.end})[0];return s?s.good:null})}var A=function(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"").replace(/s$/,"")};function M(n,t){var e,r,a=null===(e=null==n?void 0:n.label)||void 0===e?void 0:e.trim();if(a&&(null===(r=null==t?void 0:t.options)||void 0===r?void 0:r.length)){var o=A(a),i=t.options.find(function(n){var t;return A(n.label)===o||(null!==(t=n.aliases)&&void 0!==t?t:[]).some(function(n){return A(n)===o})});return i?{label:i.label,tone:i.tone}:!1===t.showUnknown?void 0:{label:a,tone:"neutral"}}}function F(n,t){var e,r=function(n){var t,e;return null!==(e=null===(t=/^[\s\S]*?[.!?](?=\s+[A-Z(]|\s*$)/.exec(n))||void 0===t?void 0:t[0])&&void 0!==e?e:n}(n);return null===(e=null==t?void 0:t.find(function(n){return n.label&&r.includes(n.label)}))||void 0===e?void 0:e.label}export{u as averageLabel,c as averageLineLabel,d as averageShort,x as figureDirections,a as formatAxisFigure,e as formatFigure,w as kpiMentions,v as longPeriod,p as periodInRange,m as periodLastDay,h as periodStart,i as periodWordsOf,M as rootCauseTag,F as rootCauseTitle,s as shortPeriod,r as trimZeros};
2
2
  //# sourceMappingURL=insightsFormat.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as n,__spreadArray as e,__awaiter as t,__generator as i}from"../../../_virtual/_tslib.js";import{useState as r,useRef as o,useEffect as a,createElement as l}from"react";import{fetchRowReport as u,toIsoDay as d,fetchInsightsJob as c}from"../../api/insightsApi.js";import{VerdictSentence as s,linkedText as v}from"./agPrimitives.js";import{longPeriod as f,rootCauseTag as g,rootCauseTitle as p}from"./insightsFormat.js";export{averageLabel,averageLineLabel,averageShort,formatAxisFigure,formatFigure,longPeriod,periodWordsOf,rootCauseTag,shortPeriod}from"./insightsFormat.js";import{useInsights as m}from"./insightsContextCore.js";function y(n){var e=null==n?void 0:n.enabled;return!0===e||"string"==typeof e&&["true","yes","y","1"].includes(e.trim().toLowerCase())}function h(n){var e=null==n?void 0:n.summaryCard;return e&&!1!==e.enabled?e:null}function b(n){var e,t;return(null!==(t=null===(e=null==n?void 0:n.tabs)||void 0===e?void 0:e.items)&&void 0!==t?t:[]).filter(function(n){return n&&"string"==typeof n.entityKey&&n.entityKey})}var w=function(n){var e=n?new Date("".concat(n.slice(0,10),"T00:00:00")).getDay():1;return 0===e||6===e?"vs previous weekend day":"vs previous working day"},F=function(n,e){return e&&"day"!==e?"vs previous ".concat(e):w(n)},K=function(n,e){if(!e||"day"===e||!n)return"today";var t=f(n,e);return"month"===e?t.split(" ")[0]:t},k=function(n){var e=n.slice(0,10).split("-").map(Number),t=e[0],i=e[1],r=e[2];return new Date(t,(i||1)-1,r||1)};function x(n){if(null==n?void 0:n.label)return n.label;if(!(null==n?void 0:n.start)||!(null==n?void 0:n.end))return"";var e=k(n.start),t=k(n.end),i=function(n){return n.getDate()},r=function(n){return n.toLocaleString("en-GB",{month:"short"})};return n.start===n.end?"".concat(i(t)," ").concat(r(t)," ").concat(t.getFullYear()):e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()?"".concat(i(e),"–").concat(i(t)," ").concat(r(t)," ").concat(t.getFullYear()):e.getFullYear()===t.getFullYear()?"".concat(i(e)," ").concat(r(e)," – ").concat(i(t)," ").concat(r(t)," ").concat(t.getFullYear()):"".concat(i(e)," ").concat(r(e)," ").concat(e.getFullYear()," – ").concat(i(t)," ").concat(r(t)," ").concat(t.getFullYear())}var D=function(n){return(null==n?void 0:n.label)?n.label:(null==n?void 0:n.end)?x({start:n.end,end:n.end}):""},S=function(n){var e=String(n);return/^\d{4}-\d{2}-\d{2}/.test(e)?"".concat(e.slice(5,7),"/").concat(e.slice(8,10)):e},I=function(n){return null!=n&&Number.isFinite(n)?String(n):"—"},A={spike:"Spike",drop:"Drop",fast_mover:"Fast mover",slow_mover:"Slow mover",new_entity:"New",dormant_entity:"Went quiet",recovered:"Recovered",stable:"Stable"},C=function(n){var e;return n?null!==(e=A[n])&&void 0!==e?e:n.replace(/_/g," "):""};function Y(n,e){return void 0===e&&(e="up"),"up"!==n&&"down"!==n?"#d97706":n===e?"#16a34a":"#dc2626"}var j="insights:open-entity-report";function M(){var n=this,e=m();return function(r){return t(n,void 0,void 0,function(){var n,t,o,a;return i(this,function(i){switch(i.label){case 0:if(!e)return[2];if(n=new CustomEvent(j,{detail:r,cancelable:!0}),window.dispatchEvent(n),n.defaultPrevented)return[3,4];if(!(t=e.headlineKpi))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,u(e.api,r.nodeKey,{kpiId:t,dataDay:r.dataDay||d(e.range.endDate)})];case 2:return o=i.sent(),(null===(a=o.report)||void 0===a?void 0:a.reportId)&&e.openReport({reportId:o.report.reportId,title:r.label}),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}})})}}var _=function(n,e,t){return(null!=n?n:[]).map(function(n){var i,r,o,a,u,d,c,f,m,y,h,b;return{id:n.id,tag:g(n.tag,t),title:p(n.content,n.links),detail:null!==(r=null===(i=n.decisioning)||void 0===i?void 0:i.explanation)&&void 0!==r?r:void 0,content:(null===(o=n.links)||void 0===o?void 0:o.length)&&e?l(s,{text:n.content,arrowsFollowVerdict:!0,renderText:v(n.links,e)}):/^(Good|Bad) news\s*[-–—]|[↑↓]/.test(n.content)?l(s,{text:n.content,arrowsFollowVerdict:!0}):n.content,decisioning:n.decisioning?{explanation:null!==(a=n.decisioning.explanation)&&void 0!==a?a:void 0,decisionMakingFactors:(null!==(u=n.decisioning.decisionMakingFactors)&&void 0!==u?u:[]).slice(0,3),gapsInDecision:null!==(d=n.decisioning.gapsInDecision)&&void 0!==d?d:[],score:null!==(c=n.decisioning.score)&&void 0!==c?c:void 0,evidence:n.decisioning.evidence?{label:n.decisioning.evidence.label,title:null!==(f=n.decisioning.evidence.title)&&void 0!==f?f:void 0,description:null!==(m=n.decisioning.evidence.description)&&void 0!==m?m:void 0,items:null!==(y=n.decisioning.evidence.items)&&void 0!==y?y:[],highlight:null!==(h=n.decisioning.evidence.highlight)&&void 0!==h?h:void 0,footer:null!==(b=n.decisioning.evidence.footer)&&void 0!==b?b:void 0}:void 0}:void 0}})},T=function(n,e){return Array.from(new Set(n.map(function(n){return(null!=n?n:"").trim()}).filter(Boolean))).slice(0,e)};function B(n,t){var i,r,o,a,l;if(!n||"generated"!==n.status)return null;var u=e(e([],null!==(i=n.rootCause)&&void 0!==i?i:[],!0),null!==(r=n.nextSteps)&&void 0!==r?r:[],!0).map(function(n){return n.decisioning}).filter(Boolean),d=T(u.flatMap(function(n){var e;return null!==(e=n.decisionMakingFactors)&&void 0!==e?e:[]}),3),c=T(u.flatMap(function(n){var e;return null!==(e=n.gapsInDecision)&&void 0!==e?e:[]}),4);return d.length||c.length||null!=n.score?{explanation:null!=t?t:(null===(o=n.summary)||void 0===o?void 0:o.body)||(null===(a=u[0])||void 0===a?void 0:a.explanation)||void 0,decisionMakingFactors:d,gapsInDecision:c,score:null!==(l=n.score)&&void 0!==l?l:void 0}:null}function L(n){var e,t,i;try{var r=null==n?void 0:n.replace(/^bearer\s+/i,"").split(".")[1];if(!r)return{email:null,isAdmin:!1};var o=JSON.parse(decodeURIComponent(escape(atob(r.replace(/-/g,"+").replace(/_/g,"/"))))),a=[].concat(null!==(e=o.rolename)&&void 0!==e?e:[],null!==(t=o.role)&&void 0!==t?t:[],null!==(i=o.roles)&&void 0!==i?i:[]).map(String);return{email:o.email||o.sub||null,isAdmin:a.some(function(n){return"cw-admin"===n||/ Admin$/.test(n)})}}catch(n){return{email:null,isAdmin:!1}}}function N(t,i,l){var u=r({loading:Boolean(t),identityKey:l}),d=u[0],c=u[1],s=r(0),v=s[0],f=s[1],g=o(t);g.current=t,a(function(){var e=g.current;if(e){var t=new AbortController;return c(function(n){return{data:n.identityKey===l?n.data:void 0,loading:!0,identityKey:l}}),e(t.signal).then(function(n){t.signal.aborted||c({data:n,loading:!1,identityKey:l})}).catch(function(n){t.signal.aborted||"AbortError"===(null==n?void 0:n.name)||c({error:n,loading:!1,identityKey:l})}),function(){return t.abort()}}c(function(e){return n(n({},e),{data:e.identityKey===l?e.data:void 0,error:void 0,loading:!1,identityKey:l})})},e(e([],i,!0),[v,l],!1));var p=void 0===l||d.identityKey===l;return n(n({},d),{data:p?d.data:void 0,error:p?d.error:void 0,loading:p?d.loading:Boolean(t),reload:function(){return f(function(n){return n+1})},updateData:function(e){return c(function(t){return n(n({},t),{data:e(t.identityKey===l?t.data:void 0),identityKey:l})})}})}function P(n,e,l){var u=this,d=r({status:null,error:null}),s=d[0],v=d[1],f=o(l);return f.current=l,a(function(){if(n&&e){var r,o=!1,a=function(){return t(u,void 0,void 0,function(){var t,l,u;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,c(e,n)];case 1:return t=i.sent(),o?[2]:(v({status:t.status,error:"failed"===t.status?t.error||"The job failed.":null}),"succeeded"===t.status?null===(u=f.current)||void 0===u||u.call(f,t.reportId):"failed"!==t.status&&(r=setTimeout(a,4e3)),[3,3]);case 2:return l=i.sent(),o||v({status:"failed",error:l.message||"The job couldn't be checked."}),[3,3];case 3:return[2]}})})};return a(),function(){o=!0,clearTimeout(r)}}v({status:null,error:null})},[n,e]),s}export{j as OPEN_INSIGHTS_ENTITY_REPORT,x as formatPeriod,D as formatReportDate,I as formatValue,b as insightTabItems,y as isInsightsOn,C as movementLabel,K as periodName,w as previousDayLabel,F as previousPeriodLabel,B as reportDecisioning,Y as sentimentColor,S as shortDay,h as summaryCardConfig,_ as toRcaItems,N as useInsightsFetch,P as useJob,M as useOpenRow,L as viewerFromToken};
1
+ import{__assign as n,__spreadArray as e,__awaiter as t,__generator as i}from"../../../_virtual/_tslib.js";import{useState as o,useRef as r,useEffect as a,useLayoutEffect as l,createElement as u}from"react";import{fetchRowReport as c,toIsoDay as d,fetchInsightsJob as s}from"../../api/insightsApi.js";import{VerdictSentence as v,linkedText as f}from"./agPrimitives.js";import{stripMarkup as g}from"../RcaDecisionComponent/CitationMarkdown.js";import{longPeriod as p,periodStart as m,rootCauseTag as y,rootCauseTitle as h}from"./insightsFormat.js";export{averageLabel,averageLineLabel,averageShort,formatAxisFigure,formatFigure,longPeriod,periodWordsOf,rootCauseTag,shortPeriod}from"./insightsFormat.js";import{useInsights as b}from"./insightsContextCore.js";var w=[],F=null;function k(n,e){var t=r(n);t.current=n;var i=o(function(){return w.length>0})[0],a=o(!1),u=a[0],c=a[1];return l(function(){var n,i={};w.length&&c(!0),w.push(i),F||(F={overflow:document.body.style.overflow,focus:document.activeElement}),document.body.style.overflow="hidden",null===(n=e.current)||void 0===n||n.focus({preventScroll:!0});var o=function(n){"Escape"===n.key&&w[w.length-1]===i&&t.current()};return document.addEventListener("keydown",o),function(){document.removeEventListener("keydown",o),w.splice(w.indexOf(i),1),queueMicrotask(function(){var n,e;if(!w.length&&F){var t=F;F=null,document.body.style.overflow=t.overflow,null===(e=null===(n=t.focus)||void 0===n?void 0:n.focus)||void 0===e||e.call(n)}})}},[]),"ag-modal".concat(i?" ag-modal--instant":"").concat(u?" ag-modal--stacked":"")}function x(n,e){l(function(){n.current&&(n.current.scrollTop=0)},[e])}function D(n){var e=null==n?void 0:n.enabled;return!0===e||"string"==typeof e&&["true","yes","y","1"].includes(e.trim().toLowerCase())}function K(n){var e=null==n?void 0:n.summaryCard;return e&&!1!==e.enabled?e:null}function I(n){var e,t;return(null!==(t=null===(e=null==n?void 0:n.tabs)||void 0===e?void 0:e.items)&&void 0!==t?t:[]).filter(function(n){return n&&"string"==typeof n.entityKey&&n.entityKey})}var M=function(n){var e=n?new Date("".concat(n.slice(0,10),"T00:00:00")).getDay():1;return 0===e||6===e?"vs previous weekend day":"vs previous working day"},S=function(n,e){return e&&"day"!==e?"vs previous ".concat(e):M(n)},C=function(n,e){if(!e||"day"===e||!n)return"today";var t=p(n,e);return"month"===e?t.split(" ")[0]:t},j=function(n){var e=n.slice(0,10).split("-").map(Number),t=e[0],i=e[1],o=e[2];return new Date(t,(i||1)-1,o||1)};function A(n){if(null==n?void 0:n.label)return n.label;if(!(null==n?void 0:n.start)||!(null==n?void 0:n.end))return"";var e=j(n.start),t=j(n.end),i=function(n){return n.getDate()},o=function(n){return n.toLocaleString("en-GB",{month:"short"})};return n.start===n.end?"".concat(i(t)," ").concat(o(t)," ").concat(t.getFullYear()):e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()?"".concat(i(e),"–").concat(i(t)," ").concat(o(t)," ").concat(t.getFullYear()):e.getFullYear()===t.getFullYear()?"".concat(i(e)," ").concat(o(e)," – ").concat(i(t)," ").concat(o(t)," ").concat(t.getFullYear()):"".concat(i(e)," ").concat(o(e)," ").concat(e.getFullYear()," – ").concat(i(t)," ").concat(o(t)," ").concat(t.getFullYear())}var Y=function(n){return(null==n?void 0:n.label)?n.label:(null==n?void 0:n.end)?A({start:n.end,end:n.end}):""},T=function(n){var e=String(n);return/^\d{4}-\d{2}-\d{2}/.test(e)?"".concat(e.slice(5,7),"/").concat(e.slice(8,10)):e},_=function(n){return null!=n&&Number.isFinite(n)?String(n):"—"},E={spike:"Spike",drop:"Drop",fast_mover:"Fast mover",slow_mover:"Slow mover",new_entity:"New",dormant_entity:"Went quiet",recovered:"Recovered",stable:"Stable"},L=function(n){var e;return n?null!==(e=E[n])&&void 0!==e?e:n.replace(/_/g," "):""};function B(n,e){return void 0===e&&(e="up"),"up"!==n&&"down"!==n?"#d97706":n===e?"#16a34a":"#dc2626"}var N="insights:open-entity-report";function P(){var n=this,e=b();return function(o){return t(n,void 0,void 0,function(){var n,t,r,a;return i(this,function(i){switch(i.label){case 0:if(!e)return[2];if(n=new CustomEvent(N,{detail:o,cancelable:!0}),window.dispatchEvent(n),n.defaultPrevented)return[3,4];if(!(t=e.headlineKpi))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,c(e.api,o.nodeKey,{kpiId:t,dataDay:o.dataDay||m(d(e.range.endDate),e.period.grain)})];case 2:return r=i.sent(),(null===(a=r.report)||void 0===a?void 0:a.reportId)&&e.openReport({reportId:r.report.reportId,title:o.label}),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}})})}}var R=function(n,e,t){return(null!=n?n:[]).map(function(n){var i,o,r,a,l,c,d,s,p,m,b,w,F,k,x=null!==(o=null===(i=n.cited)||void 0===i?void 0:i.citation)&&void 0!==o?o:void 0;return{id:n.id,tag:y(n.tag,t),title:h(g(n.content),n.links),detail:null!==(a=null===(r=n.decisioning)||void 0===r?void 0:r.explanation)&&void 0!==a?a:void 0,citations:x,content:(null===(l=n.links)||void 0===l?void 0:l.length)&&e?u(v,{text:n.content,arrowsFollowVerdict:!0,renderText:f(n.links,e),citations:x}):/^(Good|Bad) news\s*[-–—]|[↑↓]/.test(n.content)?u(v,{text:n.content,arrowsFollowVerdict:!0,citations:x}):n.content,decisioning:n.decisioning?{citations:x,explanation:null!==(c=n.decisioning.explanation)&&void 0!==c?c:void 0,decisionMakingFactors:(null!==(d=n.decisioning.decisionMakingFactors)&&void 0!==d?d:[]).slice(0,3),gapsInDecision:null!==(s=n.decisioning.gapsInDecision)&&void 0!==s?s:[],score:null!==(p=n.decisioning.score)&&void 0!==p?p:void 0,evidence:n.decisioning.evidence?{label:n.decisioning.evidence.label,title:null!==(m=n.decisioning.evidence.title)&&void 0!==m?m:void 0,description:null!==(b=n.decisioning.evidence.description)&&void 0!==b?b:void 0,items:null!==(w=n.decisioning.evidence.items)&&void 0!==w?w:[],highlight:null!==(F=n.decisioning.evidence.highlight)&&void 0!==F?F:void 0,footer:null!==(k=n.decisioning.evidence.footer)&&void 0!==k?k:void 0}:void 0}:void 0}})},O=function(n,e){return Array.from(new Set(n.map(function(n){return(null!=n?n:"").trim()}).filter(Boolean))).slice(0,e)};function q(n,t){var i,o,r,a,l,u,c,d,s,v,f,p,m,y;if(!n||"generated"!==n.status)return null;var h=null!==(r=null===(o=null===(i=n.summary)||void 0===i?void 0:i.cited)||void 0===o?void 0:o.citation)&&void 0!==r?r:void 0,b=null===(a=n.summary)||void 0===a?void 0:a.decisioning;if(b)return{explanation:null!=t?t:b.explanation||(null===(l=n.summary)||void 0===l?void 0:l.body)||void 0,decisionMakingFactors:null!==(u=b.decisionMakingFactors)&&void 0!==u?u:[],gapsInDecision:null!==(c=b.gapsInDecision)&&void 0!==c?c:[],score:null!==(s=null!==(d=b.score)&&void 0!==d?d:n.score)&&void 0!==s?s:void 0,citations:h};var w=e(e([],null!==(v=n.rootCause)&&void 0!==v?v:[],!0),null!==(f=n.nextSteps)&&void 0!==f?f:[],!0).map(function(n){return n.decisioning}).filter(Boolean),F=O(w.flatMap(function(n){var e;return null!==(e=n.decisionMakingFactors)&&void 0!==e?e:[]}).map(g),3),k=O(w.flatMap(function(n){var e;return null!==(e=n.gapsInDecision)&&void 0!==e?e:[]}).map(g),4);return F.length||k.length||null!=n.score?{explanation:null!=t?t:(null===(p=n.summary)||void 0===p?void 0:p.body)||((null===(m=w[0])||void 0===m?void 0:m.explanation)?g(w[0].explanation):void 0),decisionMakingFactors:F,gapsInDecision:k,score:null!==(y=n.score)&&void 0!==y?y:void 0,citations:h}:null}function G(n){var e,t,i;try{var o=null==n?void 0:n.replace(/^bearer\s+/i,"").split(".")[1];if(!o)return{email:null,isAdmin:!1};var r=JSON.parse(decodeURIComponent(escape(atob(o.replace(/-/g,"+").replace(/_/g,"/"))))),a=[].concat(null!==(e=r.rolename)&&void 0!==e?e:[],null!==(t=r.role)&&void 0!==t?t:[],null!==(i=r.roles)&&void 0!==i?i:[]).map(String);return{email:r.email||r.sub||null,isAdmin:a.some(function(n){return"cw-admin"===n||/ Admin$/.test(n)})}}catch(n){return{email:null,isAdmin:!1}}}function V(t,i,l){var u=o({loading:Boolean(t),identityKey:l}),c=u[0],d=u[1],s=o(0),v=s[0],f=s[1],g=r(t);g.current=t,a(function(){var e=g.current;if(e){var t=new AbortController;return d(function(n){return{data:n.identityKey===l?n.data:void 0,loading:!0,identityKey:l}}),e(t.signal).then(function(n){t.signal.aborted||d({data:n,loading:!1,identityKey:l})}).catch(function(n){t.signal.aborted||"AbortError"===(null==n?void 0:n.name)||d({error:n,loading:!1,identityKey:l})}),function(){return t.abort()}}d(function(e){return n(n({},e),{data:e.identityKey===l?e.data:void 0,error:void 0,loading:!1,identityKey:l})})},e(e([],i,!0),[v,l],!1));var p=void 0===l||c.identityKey===l;return n(n({},c),{data:p?c.data:void 0,error:p?c.error:void 0,loading:p?c.loading:Boolean(t),reload:function(){return f(function(n){return n+1})},updateData:function(e){return d(function(t){return n(n({},t),{data:e(t.identityKey===l?t.data:void 0),identityKey:l})})}})}function W(n,e,l){var u=this,c=o({status:null,error:null}),d=c[0],v=c[1],f=r(l);return f.current=l,a(function(){if(n&&e){var o,r=!1,a=function(){return t(u,void 0,void 0,function(){var t,l,u;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,s(e,n)];case 1:return t=i.sent(),r?[2]:(v({status:t.status,error:"failed"===t.status?t.error||"The job failed.":null}),"succeeded"===t.status?null===(u=f.current)||void 0===u||u.call(f,t.reportId):"failed"!==t.status&&(o=setTimeout(a,4e3)),[3,3]);case 2:return l=i.sent(),r||v({status:"failed",error:l.message||"The job couldn't be checked."}),[3,3];case 3:return[2]}})})};return a(),function(){r=!0,clearTimeout(o)}}v({status:null,error:null})},[n,e]),d}export{N as OPEN_INSIGHTS_ENTITY_REPORT,A as formatPeriod,Y as formatReportDate,_ as formatValue,I as insightTabItems,D as isInsightsOn,L as movementLabel,C as periodName,M as previousDayLabel,S as previousPeriodLabel,q as reportDecisioning,B as sentimentColor,T as shortDay,K as summaryCardConfig,R as toRcaItems,V as useInsightsFetch,k as useInsightsModal,W as useJob,P as useOpenRow,x as useScrollToTopOnStep,G as viewerFromToken};
2
2
  //# sourceMappingURL=insightsUtils.js.map
@@ -0,0 +1,2 @@
1
+ import{__awaiter as e,__generator as n,__assign as t,__rest as o}from"../../../_virtual/_tslib.js";import{jsx as r,Fragment as i,jsxs as a}from"react/jsx-runtime";import{createContext as c,useContext as l,useState as u,useRef as d,useCallback as s,useEffect as p}from"react";import{createPortal as v}from"react-dom";import{X as h}from"lucide-react";import f from"react-markdown";import m from"rehype-raw";import{BPACitationRenderer as w,ExcelHoverCard as g}from"@e-llm-studio/citation";var y=function(e){return e.replace(/<[^>]+>/g,"")},b=function(e){return Boolean(e&&/<a\s[^>]*href=|\]\([^)\s]+\)/i.test(e))},_=c(void 0);function C(o,r){var i=this,a=(null!=o?o:"").replace(/\/+$/,"");if(a){var c="".concat(a.endsWith("/backend")?a:"".concat(a,"/backend"),"/gcs/get-signed-url/");return function(o){return e(i,void 0,void 0,function(){var e,i,a,l,u;return n(this,function(n){switch(n.label){case 0:return[4,fetch(c,{method:"POST",headers:t({accept:"application/json","Content-Type":"application/json"},r?{Authorization:"Bearer ".concat(r)}:{}),body:JSON.stringify({gsutil_url:o.startsWith("gs://")?o:"gs://".concat(o)})})];case 1:if(!(e=n.sent()).ok)throw new Error("Could not get a signed URL for the workbook (".concat(e.status,")"));return[4,e.json()];case 2:return i=n.sent(),[2,null!==(u=null!==(a=null==i?void 0:i.signed_url)&&void 0!==a?a:null===(l=null==i?void 0:i.data)||void 0===l?void 0:l.signed_url)&&void 0!==u?u:null]}})})}}}var N=/^([a-z][a-z0-9_]*)\$(\d+)\$?(.*)$/i,x={excel_citations:"excel_citation",scanned_doc_citations:"scanned_doc_citation"};var k=function(e,n){try{return"true"===new URL(e,"http://example.com").searchParams.get(n)}catch(e){return!1}},H=c(!1),E=c(!1),M=function(e){var n=window.getComputedStyle(e).overflowY;return("auto"===n||"scroll"===n||"overlay"===n)&&e.scrollHeight>e.clientHeight+1};function T(e,n){p(function(){if(n){var t=0,o=!1,r=0,i=Number.NaN,a=performance.now()+2e4,c=function(){var n,l;if(!o){var u=e.current,d=null!==(l=null!==(n=null==u?void 0:u.querySelector('[data-cite-anchor="true"]'))&&void 0!==n?n:null==u?void 0:u.querySelector('[data-cite-anchor-row="true"]'))&&void 0!==l?l:null;if(u&&d){var s=d.getBoundingClientRect().top;if(r=Math.abs(s-i)<1?r+1:0,i=s,r>=6)return void function(e,n){for(var t=function(n,t){var o=e.getBoundingClientRect();return o.top>=n+24&&o.bottom<=t-24?0:o.top+o.height/2-(n+t)/2},o=n.parentElement;o&&o!==document.body&&o!==document.documentElement;o=o.parentElement)if(M(o)){var r=o.getBoundingClientRect(),i=t(Math.max(r.top,0),Math.min(r.bottom,window.innerHeight));Math.abs(i)>=1&&(o.scrollTop+=i)}var a=t(0,window.innerHeight);Math.abs(a)>=1&&window.scrollBy({top:a})}(d,u)}performance.now()<a&&(t=requestAnimationFrame(c))}};return t=requestAnimationFrame(c),function(){o=!0,cancelAnimationFrame(t)}}},[n,e])}var L=function(e){return"excel_citation"===e||"excel_citations"===e};function P(e){var n=e.title,o=e.onClose,i=e.children;return p(function(){var e=function(e){"Escape"===e.key&&o()},n=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",e),function(){document.body.style.overflow=n,window.removeEventListener("keydown",e)}},[o]),v(r("div",t({className:"rca-cite-popup",onClick:function(e){e.stopPropagation(),o()}},{children:a("div",t({className:"rca-cite-popup__panel",role:"dialog","aria-modal":"true",onClick:function(e){return e.stopPropagation()}},{children:[a("div",t({className:"rca-cite-popup__header"},{children:[r("span",t({className:"rca-cite-popup__title"},{children:n})),r("button",t({type:"button",className:"rca-cite-popup__close","aria-label":"Close citation",onClick:o},{children:r(h,{"aria-hidden":"true"})}))]})),r("div",t({className:"rca-cite-popup__body"},{children:i}))]}))})),document.body)}function R(e){var n,o,c,l=e.href,h=e.citations,f=e.resolveGcsUrl,m=e.display,y=e.hoverEnabled,b=e.autoScroll,_=e.children,C=u(!1),N=C[0],x=C[1],H=d(null);T(H,b&&N);var E=s(function(){return x(!1)},[]),M="popup"===m,R=y&&k(l,"hover")&&null!==(c=null===(o=null===(n=function(e,n){var t,o;if(!(null==e?void 0:e.length))return null;var r=null;try{var i=new URL(n,"http://example.com").searchParams;r=null!==(t=i.get("citationNumber"))&&void 0!==t?t:i.get("citation_number")}catch(e){return null}return r&&null!==(o=e.find(function(e){var n,t,o,i=null!==(t=null===(n=null==e?void 0:e.customMetaData)||void 0===n?void 0:n.type)&&void 0!==t?t:null===(o=null==e?void 0:e.customMetadata)||void 0===o?void 0:o.type;return L(i)&&String(null==e?void 0:e.citation_number)===r}))&&void 0!==o?o:null}(h,l))||void 0===n?void 0:n.customMetaData)||void 0===o?void 0:o.hover)&&void 0!==c?c:"",S=function(e){var n=d(null),t=d(void 0),o=u(null),r=o[0],i=o[1],a=function(){return window.clearTimeout(t.current)},c=s(function(){window.clearTimeout(t.current),i(null)},[]);return p(function(){if(r)return window.addEventListener("scroll",c,!0),function(){return window.removeEventListener("scroll",c,!0)}},[r,c]),p(function(){return function(){return window.clearTimeout(t.current)}},[]),{anchorRef:n,position:r,show:function(){var t;a();var o=null===(t=n.current)||void 0===t?void 0:t.getBoundingClientRect();if(e&&o){var r=Math.max(16,Math.min(o.left,window.innerWidth-280-16)),c=window.innerHeight-o.bottom<280&&o.top>window.innerHeight-o.bottom;i({left:r,top:c?o.top-6:o.bottom+6,above:c})}},scheduleHide:function(){a(),t.current=window.setTimeout(function(){return i(null)},120)},cancelClose:a,hide:c}}(Boolean(R.trim())),B=k(l,"calculation"),U=r(w,t({href:l,citations:h,excelCitationData:{citations:h,resolveGcsUrl:f,openFullscreenOnExpand:!0,showCalculation:B}},{children:_}));return a(i,{children:[r("button",t({ref:S.anchorRef,type:"button",className:"rca-cite-link".concat(!M&&N?" rca-cite-link--open":""),"aria-haspopup":M?"dialog":void 0,"aria-expanded":M?void 0:N,onMouseEnter:S.show,onMouseLeave:S.scheduleHide,onFocus:S.show,onBlur:S.scheduleHide,onClick:function(e){e.stopPropagation(),S.hide(),x(function(e){return!!M||!e})}},{children:_})),!S.position||M&&N||"undefined"==typeof document?null:v(r("div",t({className:"rca-cite-hover",role:"tooltip",style:{left:S.position.left,top:S.position.top,transform:S.position.above?"translateY(-100%)":void 0},onMouseEnter:S.cancelClose,onMouseLeave:S.scheduleHide},{children:r(g,{hover:R,action:a("button",t({type:"button",className:"rca-cite-hover__open",onClick:function(e){e.stopPropagation(),S.hide(),x(!0)}},{children:["Click to open the source ",r("span",t({"aria-hidden":"true"},{children:"→"}))]}))})})),document.body),N&&M?r(P,t({title:_,onClose:E},{children:r("span",t({ref:H,className:"rca-cite-popup__citation"},{children:U}))})):null,N&&!M?r("span",t({ref:H,className:"rca-cite-dropdown",onClick:function(e){return e.stopPropagation()}},{children:U})):null]})}function S(e){var n=e.text,a=e.citations,c=e.resolveGcsUrl,u=e.excelDisplay,d=void 0===u?"dropdown":u,s=e.excelHover,p=e.autoScrollToCitedCell,v=l(H),h=null!=p?p:v,g=l(E),y=null!=s?s:g,b=l(_),C=null!=c?c:b,k={p:function(e){var n=e.children;return r(i,{children:n})},red:function(e){var n=e.children;return r("span",t({className:"rca-cite-red"},{children:n}))},green:function(e){var n=e.children;return r("span",t({className:"rca-cite-green"},{children:n}))},a:function(e){var n=e.href,i=e.children;e.node;var c=o(e,["href","children","node"]),l=n?function(e){var n,t,o=N.exec(e.trim());try{t=new URL(o?o[3]||"./":e,"http://example.com")}catch(n){return{citationType:null,rendererHref:e}}var r=t.searchParams,i=(null==o?void 0:o[1])||r.get("citation_type");return o&&i?(r.set("citation_type",null!==(n=x[i])&&void 0!==n?n:i),r.get("citationNumber")||r.set("citationNumber",o[2]),{citationType:i,rendererHref:".".concat(t.pathname,"?").concat(r.toString())}):{citationType:i,rendererHref:e}}(n):null;return(null==l?void 0:l.citationType)?L(l.citationType)?r(R,t({href:l.rendererHref,citations:a,resolveGcsUrl:C,display:d,hoverEnabled:y,autoScroll:h},{children:i})):r(w,t({href:l.rendererHref,citations:a,excelCitationData:{citations:a,resolveGcsUrl:C}},{children:i})):r("a",t({href:n},c,{children:i}))}};return r(f,t({rehypePlugins:[m],components:k},{children:n}))}export{H as AutoScrollToCitedCellContext,S as CitationMarkdown,_ as ExcelGcsResolverContext,E as ExcelHoverContext,C as createCwGcsResolver,b as hasCitationLink,y as stripMarkup};
2
+ //# sourceMappingURL=CitationMarkdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CitationMarkdown.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as n,Fragment as c}from"react/jsx-runtime";import{useState as a,useId as t}from"react";import{Sparkles as r,Search as l,CheckCircle2 as o,ChevronUp as s,ChevronDown as d,Lightbulb as u}from"lucide-react";import h from"../../../assets/icons/cognitive_desicioning_icon_brain.svg.js";var _=function(e){return void 0===e&&(e=0),Math.max(0,Math.min(100,Math.round(e)))};function m(i){var a=i.text.split(/(\*\*[^*]+\*\*|`[^`]+`)/g);return n(c,{children:a.map(function(i,c){return/^\*\*[^*]+\*\*$/.test(i)?n("strong",e({className:"rca-decision__strong"},{children:i.slice(2,-2)}),c):/^`[^`]+`$/.test(i)?n("code",e({className:"rca-decision__code"},{children:i.slice(1,-1)}),c):i})})}function g(c){var a=c.open,t=c.onToggle,r=c.label,l=void 0===r?"cognitive decisioning":r;return i("button",e({type:"button",className:"rca-decision__reasoning-trigger","aria-label":"".concat(a?"Hide":"Show"," ").concat(l),"aria-expanded":a,onClick:t},{children:[n("img",{src:h,alt:""}),n(a?s:d,{"aria-hidden":"true"})]}))}function v(c){var t,o,m=c.decisioning,g=a(!1),v=g[0],N=g[1],f=_(m.score),b=null!==(t=m.decisionMakingFactors)&&void 0!==t?t:[],y=null!==(o=m.gapsInDecision)&&void 0!==o?o:[];return i("div",e({className:"rca-decision__reasoning"},{children:[m.explanation?i("section",e({className:"rca-decision__explanation"},{children:[n("h3",{children:"Explanation"}),n("div",{children:m.explanation})]})):null,i("section",e({className:"rca-decision__cognitive"},{children:[i("button",e({type:"button",className:"rca-decision__cognitive-toggle","aria-expanded":v,onClick:function(){return N(function(e){return!e})}},{children:[i("span",e({className:"rca-decision__cognitive-title"},{children:[n("img",{src:h,alt:""}),"Cognitive Decisioning AI"]})),i("span",e({className:"rca-decision__score"},{children:[n(r,{"aria-hidden":"true"}),f,"%"]})),n(v?s:d,{"aria-hidden":"true"})]})),v?i("div",e({className:"rca-decision__cognitive-body"},{children:[n(p,{icon:n(u,{"aria-hidden":"true"}),title:"Decision Making Factors",items:b,evidence:m.evidence}),n(p,{icon:n(l,{"aria-hidden":"true"}),title:"Gaps in Decision",items:y.length?y:["No gaps identified"]})]})):null]}))]}))}function p(t){var l=t.icon,o=t.title,u=t.items,h=t.evidence,_=a(!1),m=_[0],g=_[1];return u.length?i("div",e({className:"rca-decision__reasoning-section"},{children:[i("h4",{children:[n("span",e({className:"rca-decision__subsection-icon"},{children:l})),o]}),n("ol",{children:u.map(function(a,t){return i("li",{children:[a,0===t&&h?i(c,{children:[i("button",e({type:"button",className:"rca-decision__evidence-trigger","aria-expanded":m,onClick:function(){return g(function(e){return!e})}},{children:[n(r,{"aria-hidden":"true"}),h.label,n(m?s:d,{"aria-hidden":"true"})]})),m?n(N,{evidence:h,onClose:function(){return g(!1)}}):null]}):null]},"".concat(o,"-").concat(t))})})]})):null}function N(a){var t,r,l=a.evidence,o=a.onClose,d=function(e){if(!l.highlight||"string"!=typeof e)return e;var a=e.indexOf(l.highlight);return a<0?e:i(c,{children:[e.slice(0,a),n("mark",{children:l.highlight}),e.slice(a+l.highlight.length)]})};return i("div",e({className:"rca-decision__evidence-detail"},{children:[i("button",e({type:"button",className:"rca-decision__evidence-header",onClick:o},{children:[n("span",{children:null!==(t=l.title)&&void 0!==t?t:l.label}),n(s,{"aria-hidden":"true"})]})),i("div",e({className:"rca-decision__evidence-body"},{children:[l.description?n("p",{children:l.description}):null,null===(r=l.items)||void 0===r?void 0:r.map(function(e,i){return n("p",{children:d(e)},i)})]})),l.footer?n("div",e({className:"rca-decision__evidence-footer"},{children:l.footer})):null]}))}function f(c){var r=c.title,l=c.items,o=c.tone,u=c.icon,h=c.layout,_=void 0===h?"list":h,p=a(null),N=p[0],f=p[1],b=a(function(){return new Set}),y=b[0],x=b[1],w=a(!1),C=w[0],k=w[1],S=t(),M=C?l:l.slice(0,3),D="cards"===_;return i("section",e({className:"rca-decision__section"},{children:[i("h2",{children:[n("span",e({className:"rca-decision__section-icon rca-decision__section-icon--".concat(o)},{children:u})),r]}),n("ol",e({className:"rca-decision__items".concat(D?" rca-decision__items--cards":""),id:S},{children:M.map(function(c,a){var t,r,l,u=null!==(t=c.id)&&void 0!==t?t:"".concat(o,"-").concat(a),h=N===u;if(D){var _=y.has(u),p=c.tag?n("span",e({className:"rca-decision__tag rca-decision__tag--".concat(null!==(r=c.tag.tone)&&void 0!==r?r:"neutral")},{children:c.tag.label})):null;return i("li",e({className:"rca-decision__card"},{children:[c.title?i("div",e({className:"rca-decision__card-head"},{children:[i("span",e({className:"rca-decision__card-title"},{children:[a+1,". ",c.title]})),p]})):null,i("div",e({className:"rca-decision__item-row"},{children:[c.title?null:p,c.title?null:i("span",e({className:"rca-decision__card-number"},{children:[a+1,". "]})),n("div",e({className:"rca-decision__item-content"},{children:"string"==typeof c.content?n(m,{text:c.content}):c.content})),c.decisioning?n(g,{open:h,onToggle:function(){return f(h?null:u)}}):null]})),c.detail?i("button",e({type:"button",className:"rca-decision__view-more","aria-expanded":_,onClick:function(){return e=u,x(function(i){var n=new Set(i);return n.has(e)?n.delete(e):n.add(e),n});var e}},{children:[_?"View Less":"View More",n(_?s:d,{"aria-hidden":"true"})]})):null,_&&c.detail?n("p",e({className:"rca-decision__card-detail"},{children:c.detail})):null,h&&c.decisioning?n(v,{decisioning:c.decisioning}):null]}),u)}return i("li",{children:[i("div",e({className:"rca-decision__item-row"},{children:[c.tag?n("span",e({className:"rca-decision__tag rca-decision__tag--".concat(null!==(l=c.tag.tone)&&void 0!==l?l:"neutral")},{children:c.tag.label})):null,n("div",e({className:"rca-decision__item-content"},{children:"string"==typeof c.content?n(m,{text:c.content}):c.content})),c.decisioning?n(g,{open:h,onToggle:function(){return f(h?null:u)}}):null]})),h&&c.decisioning?n(v,{decisioning:c.decisioning}):null]},u)})})),l.length>3?i("button",e({type:"button",className:"rca-decision__see-more","aria-controls":S,"aria-expanded":C,onClick:function(){k(!C),f(null)}},{children:[C?"See Less":"See More (".concat(l.length-3,")"),n(C?s:d,{"aria-hidden":"true"})]})):null]}))}function b(c){var t=c.title,s=void 0===t?"Decision Advantage":t,d=c.score,u=c.summary,h=c.footer,m=c.evidenceNote,p=c.notice,N=c.headerActions,b=c.afterSections,y=c.decisioning,x=c.rootCause,w=c.rootCauseLayout,C=void 0===w?"list":w,k=c.nextSteps,S=c.width,M=c.maxWidth,D=c.height,A=c.className,T=void 0===A?"":A,j=a(!1),I=j[0],L=j[1];return i("article",e({className:"rca-decision ".concat(void 0!==D?"rca-decision--fixed-height":""," ").concat(T).trim(),style:{width:S,height:D,maxWidth:null!=M?M:S?"none":void 0}},{children:[i("header",e({className:"rca-decision__header"},{children:[n("span",{children:s}),i("span",e({className:"rca-decision__header-end"},{children:[N,y?n(g,{open:I,onToggle:function(){return L(function(e){return!e})},label:"how the AI reached this report"}):null,null!=d?i("span",e({className:"rca-decision__header-score"},{children:[n(r,{"aria-hidden":"true"}),_(d),"%"]})):null]}))]})),i("div",e({className:"rca-decision__body"},{children:[p?n("div",e({className:"rca-decision__notice"},{children:p})):null,I&&y?n("div",e({className:"rca-decision__header-reasoning"},{children:n(v,{decisioning:y})})):null,u&&(u.headline||u.body)?i("section",e({className:"rca-decision__summary"},{children:[u.eyebrow?n("span",e({className:"rca-decision__eyebrow"},{children:u.eyebrow})):null,u.headline?n("h2",e({className:"rca-decision__headline"},{children:u.headline})):null,u.body?n("p",e({className:"rca-decision__summary-body"},{children:u.body})):null,m?n("p",e({className:"rca-decision__evidence-note"},{children:m})):null]})):m?n("p",e({className:"rca-decision__evidence-note"},{children:m})):null,x.length?n(f,{title:"Root Cause",items:x,tone:"root-cause",icon:n(l,{"aria-hidden":"true"}),layout:C}):null,k.length?n(f,{title:"Next Steps",items:k,tone:"next-steps",icon:n(o,{"aria-hidden":"true"})}):null,b,h?n("p",e({className:"rca-decision__footer"},{children:h})):null]}))]}))}export{b as RcaDecisionComponent,v as ReasoningPanel,g as ReasoningTrigger,b as default};
1
+ import{__assign as e}from"../../../_virtual/_tslib.js";import{jsx as i,jsxs as n,Fragment as c}from"react/jsx-runtime";import{useState as t,useId as a}from"react";import{Sparkles as l,Search as r,CheckCircle2 as o,ChevronUp as s,ChevronDown as d,Lightbulb as u}from"lucide-react";import{AutoScrollToCitedCellContext as h,ExcelHoverContext as _,hasCitationLink as v,CitationMarkdown as m}from"./CitationMarkdown.js";import g from"../../../assets/icons/cognitive_desicioning_icon_brain.svg.js";var p=function(e){return void 0===e&&(e=0),Math.max(0,Math.min(100,Math.round(e)))};function N(n){var t=n.text.split(/(\*\*[^*]+\*\*|`[^`]+`)/g);return i(c,{children:t.map(function(n,c){return/^\*\*[^*]+\*\*$/.test(n)?i("strong",e({className:"rca-decision__strong"},{children:n.slice(2,-2)}),c):/^`[^`]+`$/.test(n)?i("code",e({className:"rca-decision__code"},{children:n.slice(1,-1)}),c):n})})}function f(e){var n=e.text,t=e.citations,a=e.resolveGcsUrl,l=e.excelDisplay,r=e.excelHover;return"string"!=typeof n?i(c,{children:n}):v(n)?i(m,{text:n,citations:t,resolveGcsUrl:a,excelDisplay:l,excelHover:r}):i(N,{text:n})}function x(c){var t=c.open,a=c.onToggle,l=c.label,r=void 0===l?"cognitive decisioning":l;return n("button",e({type:"button",className:"rca-decision__reasoning-trigger","aria-label":"".concat(t?"Hide":"Show"," ").concat(r),"aria-expanded":t,onClick:a},{children:[i("img",{src:g,alt:""}),i(t?s:d,{"aria-hidden":"true"})]}))}function b(c){var a,o,h=c.decisioning,_=c.resolveExcelCitationGcsUrl,v=t(!0),N=v[0],f=v[1],x=p(h.score),b=null!==(a=h.decisionMakingFactors)&&void 0!==a?a:[],C=null!==(o=h.gapsInDecision)&&void 0!==o?o:[];return n("div",e({className:"rca-decision__reasoning"},{children:[h.explanation?n("section",e({className:"rca-decision__explanation"},{children:[i("h3",{children:"Explanation"}),i("div",{children:"string"==typeof h.explanation?i(m,{text:h.explanation,citations:h.citations,resolveGcsUrl:_}):h.explanation})]})):null,n("section",e({className:"rca-decision__cognitive"},{children:[n("button",e({type:"button",className:"rca-decision__cognitive-toggle","aria-expanded":N,onClick:function(){return f(function(e){return!e})}},{children:[n("span",e({className:"rca-decision__cognitive-title"},{children:[i("img",{src:g,alt:""}),"Cognitive Decisioning AI"]})),n("span",e({className:"rca-decision__score"},{children:[i(l,{"aria-hidden":"true"}),x,"%"]})),i(N?s:d,{"aria-hidden":"true"})]})),N?n("div",e({className:"rca-decision__cognitive-body"},{children:[i(y,{icon:i(u,{"aria-hidden":"true"}),title:"Decision Making Factors",items:b,evidence:h.evidence,citations:h.citations,resolveGcsUrl:_}),i(y,{icon:i(r,{"aria-hidden":"true"}),title:"Gaps in Decision",items:C.length?C:["No gaps identified"],citations:h.citations,resolveGcsUrl:_})]})):null]}))]}))}function y(a){var r=a.icon,o=a.title,u=a.items,h=a.evidence,_=a.citations,g=a.resolveGcsUrl,p=t(!1),N=p[0],f=p[1];return u.length?n("div",e({className:"rca-decision__reasoning-section"},{children:[n("h4",{children:[i("span",e({className:"rca-decision__subsection-icon"},{children:r})),o]}),i("ol",{children:u.map(function(t,a){return n("li",{children:["string"==typeof t&&v(t)?i(m,{text:t,citations:_,resolveGcsUrl:g}):t,0===a&&h?n(c,{children:[n("button",e({type:"button",className:"rca-decision__evidence-trigger","aria-expanded":N,onClick:function(){return f(function(e){return!e})}},{children:[i(l,{"aria-hidden":"true"}),h.label,i(N?s:d,{"aria-hidden":"true"})]})),N?i(C,{evidence:h,onClose:function(){return f(!1)}}):null]}):null]},"".concat(o,"-").concat(a))})})]})):null}function C(t){var a,l,r=t.evidence,o=t.onClose,d=function(e){if(!r.highlight||"string"!=typeof e)return e;var t=e.indexOf(r.highlight);return t<0?e:n(c,{children:[e.slice(0,t),i("mark",{children:r.highlight}),e.slice(t+r.highlight.length)]})};return n("div",e({className:"rca-decision__evidence-detail"},{children:[n("button",e({type:"button",className:"rca-decision__evidence-header",onClick:o},{children:[i("span",{children:null!==(a=r.title)&&void 0!==a?a:r.label}),i(s,{"aria-hidden":"true"})]})),n("div",e({className:"rca-decision__evidence-body"},{children:[r.description?i("p",{children:r.description}):null,null===(l=r.items)||void 0===l?void 0:l.map(function(e,n){return i("p",{children:d(e)},n)})]})),r.footer?i("div",e({className:"rca-decision__evidence-footer"},{children:r.footer})):null]}))}function G(c){var l=c.title,r=c.items,o=c.tone,u=c.icon,h=c.layout,_=void 0===h?"list":h,v=c.resolveExcelCitationGcsUrl,m=t(null),g=m[0],p=m[1],N=t(function(){return new Set}),y=N[0];N[1];var C=t(!1),G=C[0],U=C[1],w=a(),k=G?r:r.slice(0,3),E="cards"===_;return n("section",e({className:"rca-decision__section"},{children:[n("h2",{children:[i("span",e({className:"rca-decision__section-icon rca-decision__section-icon--".concat(o)},{children:u})),l]}),i("ol",e({className:"rca-decision__items".concat(E?" rca-decision__items--cards":""),id:w},{children:k.map(function(c,t){var a,l,r,s=null!==(a=c.id)&&void 0!==a?a:"".concat(o,"-").concat(t),d=g===s;if(E){y.has(s);var u=c.tag?i("span",e({className:"rca-decision__tag rca-decision__tag--".concat(null!==(l=c.tag.tone)&&void 0!==l?l:"neutral")},{children:c.tag.label})):null;return n("li",e({className:"rca-decision__card"},{children:[c.title?n("div",e({className:"rca-decision__card-head"},{children:[n("span",e({className:"rca-decision__card-title"},{children:[t+1,". ",c.title]})),u]})):null,n("div",e({className:"rca-decision__item-row"},{children:[c.title?null:u,c.title?null:n("span",e({className:"rca-decision__card-number"},{children:[t+1,". "]})),i("div",e({className:"rca-decision__item-content"},{children:i(f,{text:c.content,citations:c.citations,resolveGcsUrl:v})})),c.decisioning?i(x,{open:d,onToggle:function(){return p(d?null:s)}}):null]})),null,null,d&&c.decisioning?i(b,{decisioning:c.decisioning,resolveExcelCitationGcsUrl:v}):null]}),s)}return n("li",{children:[n("div",e({className:"rca-decision__item-row"},{children:[c.tag?i("span",e({className:"rca-decision__tag rca-decision__tag--".concat(null!==(r=c.tag.tone)&&void 0!==r?r:"neutral")},{children:c.tag.label})):null,i("div",e({className:"rca-decision__item-content"},{children:i(f,{text:c.content,citations:c.citations,resolveGcsUrl:v})})),c.decisioning?i(x,{open:d,onToggle:function(){return p(d?null:s)}}):null]})),d&&c.decisioning?i(b,{decisioning:c.decisioning,resolveExcelCitationGcsUrl:v}):null]},s)})})),r.length>3?n("button",e({type:"button",className:"rca-decision__see-more","aria-controls":w,"aria-expanded":G,onClick:function(){U(!G),p(null)}},{children:[G?"See Less":"See More (".concat(r.length-3,")"),i(G?s:d,{"aria-hidden":"true"})]})):null]}))}function U(c){var a=c.title,s=void 0===a?"Decision Advantage":a,d=c.score,u=c.summary,v=c.footer,m=c.evidenceNote,g=c.notice,N=c.headerActions,y=c.afterSections,C=c.decisioning,U=c.rootCause,w=c.rootCauseLayout,k=void 0===w?"list":w,E=c.nextSteps,D=c.resolveExcelCitationGcsUrl,S=c.autoScrollToCitedCell,M=void 0!==S&&S,H=c.excelHover,T=void 0!==H&&H,j=c.width,A=c.maxWidth,I=c.height,F=c.className,L=void 0===F?"":F,P=t(!1),W=P[0],$=P[1];return i(h.Provider,e({value:M},{children:i(_.Provider,e({value:T},{children:n("article",e({className:"rca-decision ".concat(void 0!==I?"rca-decision--fixed-height":""," ").concat(L).trim(),style:{width:j,height:I,maxWidth:null!=A?A:j?"none":void 0}},{children:[n("header",e({className:"rca-decision__header"},{children:[i("span",{children:s}),n("span",e({className:"rca-decision__header-end"},{children:[N,C?i(x,{open:W,onToggle:function(){return $(function(e){return!e})},label:"how the AI reached this report"}):null,null!=d?n("span",e({className:"rca-decision__header-score"},{children:[i(l,{"aria-hidden":"true"}),p(d),"%"]})):null]}))]})),n("div",e({className:"rca-decision__body"},{children:[g?i("div",e({className:"rca-decision__notice"},{children:g})):null,W&&C?i("div",e({className:"rca-decision__header-reasoning"},{children:i(b,{decisioning:C,resolveExcelCitationGcsUrl:D})})):null,u&&(u.headline||u.body)?n("section",e({className:"rca-decision__summary"},{children:[u.eyebrow?i("span",e({className:"rca-decision__eyebrow"},{children:u.eyebrow})):null,u.headline?i("h2",e({className:"rca-decision__headline"},{children:i(f,{text:u.headline,citations:u.citations,resolveGcsUrl:D,excelDisplay:"popup",excelHover:!0})})):null,u.body?i("div",e({className:"rca-decision__summary-body"},{children:i(f,{text:u.body,citations:u.citations,resolveGcsUrl:D,excelHover:!0})})):null,m?i("p",e({className:"rca-decision__evidence-note"},{children:m})):null]})):m?i("p",e({className:"rca-decision__evidence-note"},{children:m})):null,U.length?i(G,{title:"Root Cause",items:U,tone:"root-cause",icon:i(r,{"aria-hidden":"true"}),layout:k,resolveExcelCitationGcsUrl:D}):null,E.length?i(G,{title:"Next Steps",items:E,tone:"next-steps",icon:i(o,{"aria-hidden":"true"}),resolveExcelCitationGcsUrl:D}):null,y,v?i("p",e({className:"rca-decision__footer"},{children:v})):null]}))]}))}))}))}export{U as RcaDecisionComponent,b as ReasoningPanel,x as ReasoningTrigger,U as default};
2
2
  //# sourceMappingURL=RcaDecisionComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as l}from"../../../_virtual/_tslib.js";import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o}from"react";import{ArrowRight as a,Minimize as n,Maximize as i}from"lucide-react";import c from"./FTable.js";import r from"../FiltersSidebar/CustomTextInput.js";import d from"./SortDropdown.js";function s(s){var u=s.title,h=s.icon,v=s.showExpandButton,m=void 0===v||v,p=s.className,f=s.styles,b=s.table,x=s.searchBar,N=s.sort,y=s.cta,g=s.onExpand,C=o(!1),j=C[0],B=C[1],k=Boolean((null==y?void 0:y.ctaEnabled)&&(null==y?void 0:y.ctaText));return e("div",l({className:"\n tc-root\n ".concat(j?"tc-root--fullscreen":"","\n ").concat(null!=p?p:"","\n "),style:null==f?void 0:f.root},{children:[e("div",l({className:"tc-header",style:null==f?void 0:f.header},{children:[e("div",l({className:"tc-header-left"},{children:[h&&t("div",l({className:"tc-title-icon",style:l({width:"20px",height:"20px"},null==f?void 0:f.icon)},{children:h})),t("div",l({className:"tc-title",style:null==f?void 0:f.title},{children:u}))]})),e("div",l({className:"tc-header-right"},{children:[x&&t(r,{value:null==x?void 0:x.value,placeholder:null==x?void 0:x.placeholder,onChange:null==x?void 0:x.onChange,searchIcon:!0,className:"tc-search"}),N&&t(d,{value:N.value,orderBy:N.orderBy,options:N.options,placeholder:null==N?void 0:N.placeholder,onChange:N.onChange}),k&&e("button",l({type:"button",className:"tc-cta",onClick:function(){var l;return null===(l=null==y?void 0:y.ctaOnClick)||void 0===l?void 0:l.call(y)}},{children:[null==y?void 0:y.ctaText,t(a,{size:14,strokeWidth:2,"aria-hidden":!0})]})),m&&!k&&t("button",l({className:"tc-expand-btn",onClick:function(){var l=!j;B(l),null==g||g(l)}},{children:t(j?n:i,{size:20})}))]}))]})),t("div",l({className:"tc-table tc-table--fit"},{children:t(c,l({},b,{emptyState:null==b?void 0:b.emptyState,scrollHeight:j?"calc(100vh - 140px)":null==b?void 0:b.scrollHeight}))}))]}))}export{s as default};
1
+ import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as l,jsx as t}from"react/jsx-runtime";import{useState as o}from"react";import{ArrowRight as a,Minimize as n,Maximize as i}from"lucide-react";import c from"./FTable.js";import r from"../FiltersSidebar/CustomTextInput.js";import d from"./SortDropdown.js";function s(s){var u=s.title,h=s.icon,v=s.showExpandButton,m=void 0===v||v,p=s.className,f=s.renderHeaderJsx,x=s.styles,b=s.table,y=s.searchBar,N=s.sort,g=s.cta,C=s.onExpand,j=o(!1),B=j[0],k=j[1],S=Boolean((null==g?void 0:g.ctaEnabled)&&(null==g?void 0:g.ctaText)),T="function"==typeof f?f():f;return l("div",e({className:"\n tc-root\n ".concat(B?"tc-root--fullscreen":"","\n ").concat(null!=p?p:"","\n "),style:null==x?void 0:x.root},{children:[l("div",e({className:"tc-header",style:null==x?void 0:x.header},{children:[l("div",e({className:"tc-header-left"},{children:[h&&t("div",e({className:"tc-title-icon",style:e({width:"20px",height:"20px"},null==x?void 0:x.icon)},{children:h})),t("div",e({className:"tc-title",style:null==x?void 0:x.title},{children:u}))]})),l("div",e({className:"tc-header-right"},{children:[B&&T,y&&t(r,{value:null==y?void 0:y.value,placeholder:null==y?void 0:y.placeholder,onChange:null==y?void 0:y.onChange,searchIcon:!0,className:"tc-search"}),N&&t(d,{value:N.value,orderBy:N.orderBy,options:N.options,placeholder:null==N?void 0:N.placeholder,onChange:N.onChange}),S&&l("button",e({type:"button",className:"tc-cta",onClick:function(){var e;return null===(e=null==g?void 0:g.ctaOnClick)||void 0===e?void 0:e.call(g)}},{children:[null==g?void 0:g.ctaText,t(a,{size:14,strokeWidth:2,"aria-hidden":!0})]})),m&&!S&&t("button",e({className:"tc-expand-btn",onClick:function(){var e=!B;k(e),null==C||C(e)}},{children:t(B?n:i,{size:20})}))]}))]})),t("div",e({className:"tc-table tc-table--fit"},{children:t(c,e({},b,{emptyState:null==b?void 0:b.emptyState,scrollHeight:B?"calc(100vh - 140px)":null==b?void 0:b.scrollHeight}))}))]}))}export{s as default};
2
2
  //# sourceMappingURL=TableCard.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as n,__spreadArray as o,__awaiter as i,__generator as a}from"../_virtual/_tslib.js";import{jsx as l,jsxs as t}from"react/jsx-runtime";import{useState as r,useMemo as d}from"react";import{Minimize as s,Maximize as c,ChevronUp as u,ChevronDown as h}from"lucide-react";import p from"./components/LogTable/LogTable.js";import{useHumanIntelligenceController as g}from"./hooks/useHumanIntelligenceController.js";import{useHumanChangesData as v}from"./hooks/useHumanChangesData.js";import f from"./components/LogFilters/LogFilters.js";import m from"./components/LogFilters/LogFilterDropdown.js";import w from"./styles/HumanIntelligence.module.css.js";import{CitationProvider as x,TeachMePlugin as b}from"@e-llm-studio/instant-learning";var y={highestFrequency:"highestFrequency",lowestFrequency:"lowestFrequency"},I=["Positive Impact","No Measurable Impact","Mixed Impact","Negative Impact"],_={positive:{bg:"#ECFDF5",fg:"#065F46"},no_measurable_impact:{bg:"#F3F4F6",fg:"#4B5563"},mixed:{bg:"#FEF3C7",fg:"#92400E"},negative:{bg:"#fef2f2",fg:"#dc2626"},"Positive Impact":{bg:"#ECFDF5",fg:"#065F46"},"No Measurable Impact":{bg:"#F3F4F6",fg:"#4B5563"},"Mixed Impact":{bg:"#FEF3C7",fg:"#92400E"},"Negative Impact ":{bg:"#F3E8E8",fg:"#6B3C3C"}},C={positive:"Positive Impact",no_measurable_impact:"No Measurable Impact",mixed:"Mixed Impact",negative:"Negative Impact"},F={backgroundColor:"#F9FAFB",textAlign:"left",padding:"10px 16px",letterSpacing:"0.01em",color:"#666E7D",fontFamily:"Inter",fontSize:"13px",fontStyle:"normal",fontWeight:"600",lineHeight:"18px"},k={color:"#111827",fontFamily:"Inter",fontSize:"14px",fontStyle:"normal",fontWeight:400,lineHeight:"20px"},S=[{label:"Highest Frequency",value:"highestFrequency"},{label:"Lowest Frequency",value:"lowestFrequency"}];function L(L){var z,H,N,R,E,M,O,A,j,D,P,T,q,B,W,U,G,J,K,$,Q,V=this,X=L.configId;L.changeLogConfigId;var Y=L.userDetails,Z=L.app_integration_id,ee=L.teachMeConfig,ne=L.getData,oe=L.query,ie=L.extraColumns,ae=L.filters,le=L.filterDropdown,te=L.table,re=L.rowHeight,de=L.headerHeight,se=L.rowPadding,ce=L.headerPadding,ue=L.rowLineHeight,he=L.tableClassName,pe=L.impactLabelOptions,ge=void 0===pe?I:pe,ve=L.impactOptions,fe=L.sortOptions,me=void 0===fe?S:fe,we=L.rejectLearningApi,xe=L.generateLearningApi,be=L.config,ye=L.className,Ie=L.style,_e=L.isMaximized,Ce=L.defaultIsMaximized,Fe=void 0!==Ce&&Ce,ke=L.onMaximizedChange,Se=L.isTableOpen,Le=L.defaultIsTableOpen,ze=void 0===Le||Le,He=L.onTableOpenChange,Ne=L.footerActions,Re=L.modeId,Ee=e(L,["configId","changeLogConfigId","userDetails","app_integration_id","teachMeConfig","getData","query","extraColumns","filters","filterDropdown","table","rowHeight","headerHeight","rowPadding","headerPadding","rowLineHeight","tableClassName","impactLabelOptions","impactOptions","sortOptions","rejectLearningApi","generateLearningApi","config","className","style","isMaximized","defaultIsMaximized","onMaximizedChange","isTableOpen","defaultIsTableOpen","onTableOpenChange","footerActions","modeId"]),Me=null==Y?void 0:Y.accessToken,Oe=r(ze),Ae=Oe[0],je=Oe[1],De=void 0!==Se?Se:Ae,Pe=r(!1),Te=Pe[0],qe=Pe[1],Be=r(null),We=Be[0],Ue=Be[1],Ge=r(!1),Je=Ge[0],Ke=Ge[1],$e=r(""),Qe=$e[0],Ve=$e[1],Xe=r(null),Ye=Xe[0],Ze=Xe[1],en=function(e,o,i){return void 0===o&&(o=5e3),void 0===i&&(i=100),new Promise(function(a){var l=Date.now(),t=function(){var r,d,s=null!==(r=e.raw)&&void 0!==r?r:e,c=null!==(d=null==s?void 0:s.scopeId)&&void 0!==d?d:e.scopeId;c||Date.now()-l>=o?a(n(n({},e),{scopeId:c,raw:s?n(n({},s),{scopeId:c}):s})):setTimeout(t,i)};t()})},nn=r(Fe),on=nn[0],an=nn[1],ln=void 0!==_e?_e:on,tn=r(!1);tn[0];var rn=tn[1],dn=function(e,n,o,l){return i(V,void 0,void 0,function(){var i,t,r,d,s,c,u,h,p,g;return a(this,function(a){switch(a.label){case 0:if(!o)throw new Error("A learning action API configuration is required to submit this action.");if(i=null!==(c=e.raw)&&void 0!==c?c:e,!(t=null!==(h=null!==(u=i.humanChangeId)&&void 0!==u?u:e.humanChangeId)&&void 0!==h?h:e.id))throw new Error("The selected row is missing humanChangeId.");return r=null!==(g=null!==(p=o.baseUrl)&&void 0!==p?p:null==ne?void 0:ne.baseUrl)&&void 0!==g?g:"",d="".concat(r.replace(/\/$/,""),"/").concat(o.endpoint.replace(/^\//,"")),[4,fetch(d,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({humanIntelligentConfigId:X,human_change_id:t,review_status:n,reviewed_by_name:(null==Y?void 0:Y.firstname)+" "+(null==Y?void 0:Y.lastname),reviewed_by_email:null==Y?void 0:Y.email,human_change_feedback:l})})];case 1:if(!(s=a.sent()).ok)throw new Error("Learning action failed: ".concat(s.status," ").concat(s.statusText));return[2]}})})},sn=function(){Ke(!1),Ve(""),Ze(null)},cn=g({initialImpactRange:void 0}),un=cn.keyword,hn=cn.searchInput,pn=cn.dateRange,gn=cn.sort,vn=cn.filterOpen,fn=cn.draftImpactLabels,mn=cn.closeFilterPanel,wn=cn.toggleFilterPanel,xn=cn.setDraftImpactLabels,bn=cn.selectedImpactLabels,yn=cn.handleSearchChange,In=cn.handleDateChange,_n=cn.handleSortChange,Cn=cn.handleApplyFilters,Fn=cn.handleResetFilters,kn=d(function(){var e,n={scopeId:null!==(e=null==oe?void 0:oe.scopeId)&&void 0!==e?e:[],content:un||void 0,overallImpact:(null==bn?void 0:bn.length)?bn:void 0};return gn&&(n.orderBy=y[gn]),n},[null==oe?void 0:oe.scopeId,un,bn,gn]),Sn=!(!(null==ne?void 0:ne.baseUrl)||!(null==ne?void 0:ne.endpoint)),Ln=v({baseUrl:Sn?null==ne?void 0:ne.baseUrl:void 0,endpoint:Sn?null==ne?void 0:ne.endpoint:void 0,humanChangeConfigId:X,eventId:null==oe?void 0:oe.eventId,filters:kn,pageSize:null!==(z=null==oe?void 0:oe.paginationLimit)&&void 0!==z?z:12}),zn=Ln.rows,Hn=Ln.loading,Nn=Ln.loadingMore,Rn=Ln.hasMore,En=Ln.fetchMore,Mn=Ln.refetch,On=d(function(){return[{key:"humanChangePatterns",header:"Human Changes Pattern",style:{width:"55%"},headerStyle:F,body:function(e){var o,i=e;return l("div",n({style:k},{children:null!==(o=null==i?void 0:i.title)&&void 0!==o?o:"—"}))}},{key:"frequency",header:"Frequency",style:{width:"20%"},headerStyle:F,body:function(e){var o,i=e;return l("div",n({style:k},{children:null!==(o=null==i?void 0:i.frequency)&&void 0!==o?o:"—"}))}},{key:"overAllImpact",header:"Overall Impact",style:{width:"25%"},headerStyle:F,body:function(e){var o=e,i=function(e){var n;return e?null!==(n=C[e])&&void 0!==n?n:e:void 0}(null==o?void 0:o.impactLabel),a=(null==o?void 0:o.impactLabel)&&_[o.impactLabel]||{bg:"#F3F4F6",fg:"#4B5563"};return l("div",n({style:{backgroundColor:a.bg,color:a.fg,padding:"3px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:500,width:"fit-content"}},{children:i||"—"}))}}]},[]),An=d(function(){var e=o([],On,!0);return null==ie||ie.forEach(function(n){var o=e.findIndex(function(e){return e.key===n.key});-1!==o?e[o]=n:e.push(n)}),e},[On,ie]);return console.log(null!==(R=null===(N=null!==(H=null==We?void 0:We.raw)&&void 0!==H?H:We)||void 0===N?void 0:N.scopeId)&&void 0!==R?R:null==We?void 0:We.scopeId,We,"ruleSetId debug"),t("div",n({className:"human-changes-wrapper ".concat(ln?"human-changes-wrapper--maximized":""," ").concat(ye||"").trim()},Ee,{style:n(n({padding:"16px 20px",display:"flex",flexDirection:"column",gap:"16px",border:"1px solid #E2E8F0",backgroundColor:"#FFFFFF"},ln?{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",zIndex:50,margin:0,borderRadius:0,overflow:"auto"}:{position:"relative",borderRadius:"12px"}),Ie)},{children:[l("style",{children:"\n /* Scoped size container so the header responds to the component's own\n width, not the viewport. Kept off the root wrapper on purpose: size\n containment would trap the position:fixed maximized/modal layers. */\n .human-changes-wrapper .human-changes-header-container {\n container-type: inline-size;\n width: 100%;\n }\n\n /* ---------- header layout ---------- */\n .human-changes-wrapper .human-changes-header {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 12px 24px;\n width: 100%;\n }\n\n .human-changes-wrapper .human-changes-header__titles {\n flex: 1 1 220px;\n min-width: 0;\n order: 1;\n }\n\n .human-changes-wrapper .human-changes-header__title {\n margin: 0;\n padding-bottom: 2px;\n font-family: Inter;\n font-size: 18px;\n font-weight: 600;\n color: #0F172A;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .human-changes-wrapper .human-changes-header__description {\n margin: 0;\n font-family: Inter;\n font-size: 13px;\n color: #64748B;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .human-changes-wrapper .human-changes-header__toolbar {\n order: 2;\n min-width: 0;\n ".concat((null==be?void 0:be.showHeader)?"flex: 0 1 auto;":"flex: 1 1 240px;","\n }\n\n .human-changes-wrapper .human-changes-header__toggles {\n order: 3;\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 0 0 auto;\n margin-left: auto;\n }\n\n /* ---------- toolbar (search / filter / sort) ---------- */\n .human-changes-wrapper .log-toolbar {\n width: 100%;\n min-width: 0;\n // flex-wrap: wrap;\n gap: 12px;\n }\n .human-changes-wrapper .log-toolbar__search {\n ").concat((null==be?void 0:be.showHeader)?"flex: 0 1 260px; width: auto; min-width: 160px;":"flex: 1 1 240px; width: auto; min-width: 160px;","\n }\n .human-changes-wrapper .log-toolbar__actions {\n flex: 0 0 auto;\n }\n .human-changes-wrapper .log-toolbar__btn {\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n /* ---------- narrow container: title keeps the toggles, toolbar drops\n to its own full-width row instead of colliding with the title ---------- */\n ").concat((null==be?void 0:be.showHeader)?"\n @container (max-width: 900px) {\n .human-changes-wrapper .human-changes-header__toolbar {\n order: 3;\n flex: 1 1 100%;\n }\n .human-changes-wrapper .human-changes-header__toggles {\n order: 2;\n }\n .human-changes-wrapper .log-toolbar__search {\n flex: 1 1 240px;\n }\n }":"","\n\n /* ---------- very narrow: search takes a full row, filters below ---------- */\n @container (max-width: 480px) {\n .human-changes-wrapper .human-changes-header__titles {\n flex: 1 1 100%;\n }\n .human-changes-wrapper .log-toolbar__search {\n flex: 1 1 100%;\n }\n .human-changes-wrapper .log-toolbar__actions {\n flex: 1 1 100%;\n }\n .human-changes-wrapper .log-toolbar__filter {\n flex: 1 1 auto;\n }\n .human-changes-wrapper .log-toolbar__btn {\n flex: 1 1 auto;\n justify-content: center;\n }\n }\n ")}),l("div",n({className:"human-changes-header-container"},{children:t("div",n({className:"human-changes-header"},{children:[(null==be?void 0:be.showHeader)&&t("div",n({className:"human-changes-header__titles"},{children:[l("h2",n({className:"human-changes-header__title",title:be.title||"Human Changes"},{children:be.title||"Human Changes"})),l("p",n({className:"human-changes-header__description",title:be.description||"Recurring scheduling patterns identified from human changes."},{children:be.description||"Recurring scheduling patterns identified from human changes."}))]})),l("div",n({className:"human-changes-header__toolbar"},{children:l(f,n({},ae,{config:n(n({showFilterButton:!0},null==ae?void 0:ae.config),{sortOptions:null!==(M=null===(E=null==ae?void 0:ae.config)||void 0===E?void 0:E.sortOptions)&&void 0!==M?M:me}),value:n({search:hn,dateRange:pn,sort:gn},null==ae?void 0:ae.value),onChange:n({onSearch:function(e){var n,o;yn(e),null===(o=null===(n=null==ae?void 0:ae.onChange)||void 0===n?void 0:n.onSearch)||void 0===o||o.call(n,e)},onDate:In,onSort:_n},null==ae?void 0:ae.onChange),filterActive:bn.length>0,onOpenFilter:function(){var e;wn(),null===(e=null==ae?void 0:ae.onOpenFilter)||void 0===e||e.call(ae)},filterPanel:!1!==(null==be?void 0:be.showSidebar)?l(m,n({},le,{visible:vn,onHide:function(){var e;mn(),null===(e=null==le?void 0:le.onHide)||void 0===e||e.call(le)},impactOptions:null!==(A=null!==(O=null==le?void 0:le.impactOptions)&&void 0!==O?O:ve)&&void 0!==A?A:ge.map(function(e){return{label:e,value:e}}),selectedImpacts:fn,onImpactChange:function(e){var n;xn(e),null===(n=null==le?void 0:le.onImpactChange)||void 0===n||n.call(le,e)},onApply:function(){var e;Cn(),null===(e=null==le?void 0:le.onApply)||void 0===e||e.call(le)},onReset:function(){var e;Fn(),null===(e=null==le?void 0:le.onReset)||void 0===e||e.call(le)}})):null}))})),((null==be?void 0:be.showMaximizeToggle)||(null==be?void 0:be.showAccordionToggle))&&t("div",n({className:"human-changes-header__toggles"},{children:[(null==be?void 0:be.showMaximizeToggle)&&l("button",n({onClick:function(){var e=!ln;void 0===_e&&an(e),null==ke||ke(e)},"aria-label":ln?"Restore":"Maximize",style:{height:"40px",width:"40px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",color:"#6b7280",cursor:"pointer"}},{children:l(ln?s:c,{size:16})})),(null==be?void 0:be.showAccordionToggle)&&l("button",n({onClick:function(){var e=!De;void 0===Se&&je(e),null==He||He(e)},"aria-label":De?"Collapse table":"Expand table",style:{height:"40px",width:"40px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",color:"#6b7280",cursor:"pointer"}},{children:l(De?u:h,{size:16})}))]}))]}))})),De&&l(p,n({},te,{renderExpandedRow:(null==te?void 0:te.renderExpandedRow)?function(e,o){var i,a,r,d,s,c,u,h,p=!1!==(null===(i=null==Ne?void 0:Ne.primary)||void 0===i?void 0:i.show)||!1!==(null===(a=null==Ne?void 0:Ne.secondary)||void 0===a?void 0:a.show);return t("div",n({style:{display:"flex",flexDirection:"column"}},{children:[te.renderExpandedRow(e,o),p&&t("div",n({className:w.footerActionContainer},{children:[!1!==(null===(r=null==Ne?void 0:Ne.secondary)||void 0===r?void 0:r.show)&&l("button",n({className:"".concat(w.footerActionSecondary," ").concat((null===(d=null==Ne?void 0:Ne.secondary)||void 0===d?void 0:d.className)||"").trim(),onClick:o.rejectLearning},{children:(null===(s=null==Ne?void 0:Ne.secondary)||void 0===s?void 0:s.label)||"Reject"})),!1!==(null===(c=null==Ne?void 0:Ne.primary)||void 0===c?void 0:c.show)&&l("button",n({className:"".concat(w.footerActionPrimary," ").concat((null===(u=null==Ne?void 0:Ne.primary)||void 0===u?void 0:u.className)||"").trim(),onClick:o.generateLearning},{children:(null===(h=null==Ne?void 0:Ne.primary)||void 0===h?void 0:h.label)||"Generate Learning"}))]}))]}))}:void 0,onRejectLearning:function(e){return i(V,void 0,void 0,function(){return a(this,function(n){return Ze(e),Ke(!0),[2]})})},onGenerateLearning:function(e){return i(V,void 0,void 0,function(){var n,o;return a(this,function(i){switch(i.label){case 0:rn(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,en(e)];case 2:return n=i.sent(),Ue(n),qe(!0),[3,5];case 3:return o=i.sent(),console.error(o),[3,5];case 4:return rn(!1),[7];case 5:return[2]}})})},columns:An,rows:zn,headerStyle:F,headerClassName:"audit-header",rowHeight:null!==(j=null==te?void 0:te.rowHeight)&&void 0!==j?j:re,headerHeight:null!==(D=null==te?void 0:te.headerHeight)&&void 0!==D?D:de,rowPadding:null!==(P=null==te?void 0:te.rowPadding)&&void 0!==P?P:se,headerPadding:null!==(T=null==te?void 0:te.headerPadding)&&void 0!==T?T:ce,rowLineHeight:null!==(q=null==te?void 0:te.rowLineHeight)&&void 0!==q?q:ue,className:null!==(B=null==te?void 0:te.className)&&void 0!==B?B:he,loading:Hn,loadingMore:Nn,hasMore:Rn,onLoadMore:function(){null==En||En()}})),t(x,{children:[Je&&l("div",n({style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(15, 23, 42, 0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},onClick:sn},{children:t("div",n({onClick:function(e){return e.stopPropagation()},style:{background:"#fff",borderRadius:"12px",padding:"20px 24px",width:"360px",boxShadow:"0 10px 30px rgba(0,0,0,0.2)",display:"flex",flexDirection:"column",gap:"12px",fontFamily:"Inter"}},{children:[l("h3",n({style:{margin:0,fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:"Reject learning"})),l("p",n({style:{margin:0,fontSize:"13px",color:"#64748B"}},{children:"Optionally add a reason before rejecting this learning."})),l("input",{type:"text",value:Qe,onChange:function(e){return Ve(e.target.value)},placeholder:"Enter feedback (optional)...",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid #E2E8F0",fontSize:"14px",fontFamily:"Inter",outline:"none"},autoFocus:!0}),t("div",n({style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"}},{children:[l("button",n({onClick:sn,style:{padding:"8px 14px",borderRadius:"8px",border:"1px solid #E2E8F0",background:"#fff",color:"#374151",fontSize:"13px",fontWeight:500,cursor:"pointer"}},{children:"Cancel"})),l("button",n({onClick:function(){return i(V,void 0,void 0,function(){var e;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),[4,dn(Ye||{},"rejected",we,Qe)];case 1:return n.sent(),[3,4];case 2:return e=n.sent(),console.error(e),[3,4];case 3:return Ke(!1),Ve(""),Ze(null),Mn(),[7];case 4:return[2]}})})},style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:"#111827",color:"#fff",fontSize:"13px",fontWeight:500,cursor:"pointer"}},{children:"Submit"}))]}))]}))})),l(b,{isOpen:Te,onClose:function(){qe(!1),Ue(null),Mn()},app_integration_id:Z,token:Me,mode:"ADD",config:ee,pluginPayload:{modeId:Re,initialDraftMessage:null==We?void 0:We.summary,postSaveCallback:function(){console.log("postSaveCallback called with activeLearningRow:",We),dn(We||{},"accepted",xe)},ruleSet:{ruleSetId:null!==(G=null===(U=null!==(W=null==We?void 0:We.raw)&&void 0!==W?W:We)||void 0===U?void 0:U.scopeId)&&void 0!==G?G:null==We?void 0:We.scopeId}}},null!==(Q=null!==($=null===(K=null!==(J=null==We?void 0:We.raw)&&void 0!==J?J:We)||void 0===K?void 0:K.scopeId)&&void 0!==$?$:null==We?void 0:We.scopeId)&&void 0!==Q?Q:"pending")]})]}))}export{L as default};
1
+ import{__rest as e,__assign as n,__spreadArray as o,__awaiter as i,__generator as a}from"../_virtual/_tslib.js";import{jsx as t,jsxs as l}from"react/jsx-runtime";import{useState as r,useMemo as d}from"react";import{Minimize as s,Maximize as c,ChevronUp as u,ChevronDown as h}from"lucide-react";import p from"./components/LogTable/LogTable.js";import{useHumanIntelligenceController as g}from"./hooks/useHumanIntelligenceController.js";import{useHumanChangesData as v}from"./hooks/useHumanChangesData.js";import{AccessTokenContext as f,authHeader as m}from"./hooks/accessToken.js";import w from"./components/LogFilters/LogFilters.js";import x from"./components/LogFilters/LogFilterDropdown.js";import b from"./styles/HumanIntelligence.module.css.js";import{CitationProvider as y,TeachMePlugin as I}from"@e-llm-studio/instant-learning";import{ReviewLearningConditionsModal as C}from"./components/ReviewLearningConditionsModal/ReviewLearningConditionsModal.js";var _={highestFrequency:"highestFrequency",lowestFrequency:"lowestFrequency"},F=["Positive Impact","No Measurable Impact","Mixed Impact","Negative Impact"],k={positive:{bg:"#ECFDF5",fg:"#065F46"},no_measurable_impact:{bg:"#F3F4F6",fg:"#4B5563"},mixed:{bg:"#FEF3C7",fg:"#92400E"},negative:{bg:"#fef2f2",fg:"#dc2626"},"Positive Impact":{bg:"#ECFDF5",fg:"#065F46"},"No Measurable Impact":{bg:"#F3F4F6",fg:"#4B5563"},"Mixed Impact":{bg:"#FEF3C7",fg:"#92400E"},"Negative Impact ":{bg:"#F3E8E8",fg:"#6B3C3C"}},L={positive:"Positive Impact",no_measurable_impact:"No Measurable Impact",mixed:"Mixed Impact",negative:"Negative Impact"},S={backgroundColor:"#F9FAFB",textAlign:"left",padding:"10px 16px",letterSpacing:"0.01em",color:"#666E7D",fontFamily:"Inter",fontSize:"13px",fontStyle:"normal",fontWeight:"600",lineHeight:"18px"},z={color:"#111827",fontFamily:"Inter",fontSize:"14px",fontStyle:"normal",fontWeight:400,lineHeight:"20px"},H=[{label:"Highest Frequency",value:"highestFrequency"},{label:"Lowest Frequency",value:"lowestFrequency"}];function N(N){var R,M,O,j,E,A,P,D,T,q,B,W,U,G,J,K,$,Q,V,X,Y,Z,ee,ne=this,oe=N.configId;N.changeLogConfigId;var ie=N.userDetails,ae=N.app_integration_id,te=N.teachMeConfig,le=N.getData,re=N.query,de=N.extraColumns,se=N.filters,ce=N.filterDropdown,ue=N.table,he=N.rowHeight,pe=N.headerHeight,ge=N.rowPadding,ve=N.headerPadding,fe=N.rowLineHeight,me=N.tableClassName,we=N.impactLabelOptions,xe=void 0===we?F:we,be=N.impactOptions,ye=N.sortOptions,Ie=void 0===ye?H:ye,Ce=N.rejectLearningApi,_e=N.generateLearningApi,Fe=N.config,ke=N.className,Le=N.style,Se=N.isMaximized,ze=N.defaultIsMaximized,He=void 0!==ze&&ze,Ne=N.onMaximizedChange,Re=N.isTableOpen,Me=N.defaultIsTableOpen,Oe=void 0===Me||Me,je=N.onTableOpenChange,Ee=N.footerActions,Ae=N.modeId,Pe=e(N,["configId","changeLogConfigId","userDetails","app_integration_id","teachMeConfig","getData","query","extraColumns","filters","filterDropdown","table","rowHeight","headerHeight","rowPadding","headerPadding","rowLineHeight","tableClassName","impactLabelOptions","impactOptions","sortOptions","rejectLearningApi","generateLearningApi","config","className","style","isMaximized","defaultIsMaximized","onMaximizedChange","isTableOpen","defaultIsTableOpen","onTableOpenChange","footerActions","modeId"]),De=null==ie?void 0:ie.accessToken,Te=r(Oe),qe=Te[0],Be=Te[1],We=void 0!==Re?Re:qe,Ue=r(!1),Ge=Ue[0],Je=Ue[1],Ke=r(null),$e=Ke[0],Qe=Ke[1],Ve=r(!1),Xe=Ve[0],Ye=Ve[1],Ze=r(""),en=Ze[0],nn=Ze[1],on=r(null),an=on[0],tn=on[1],ln=r(!1),rn=ln[0],dn=ln[1],sn=r(null),cn=sn[0],un=sn[1],hn=r(!1),pn=hn[0],gn=hn[1],vn=function(e,o,i){return void 0===o&&(o=5e3),void 0===i&&(i=100),new Promise(function(a){var t=Date.now(),l=function(){var r,d,s=null!==(r=e.raw)&&void 0!==r?r:e,c=null!==(d=null==s?void 0:s.scopeId)&&void 0!==d?d:e.scopeId;c||Date.now()-t>=o?a(n(n({},e),{scopeId:c,raw:s?n(n({},s),{scopeId:c}):s})):setTimeout(l,i)};l()})},fn=function(e,n){return i(ne,void 0,void 0,function(){var o,i;return a(this,function(a){switch(a.label){case 0:In(!0),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,vn(e)];case 2:return o=a.sent(),Qe(o),void 0!==n&&un(n),Je(!0),[3,5];case 3:return i=a.sent(),console.error(i),[3,5];case 4:return In(!1),[7];case 5:return[2]}})})},mn=r(He),wn=mn[0],xn=mn[1],bn=void 0!==Se?Se:wn,yn=r(!1);yn[0];var In=yn[1],Cn=function(e,o,t,l){return i(ne,void 0,void 0,function(){var i,r,d,s,c,u,h,p,g,v;return a(this,function(a){switch(a.label){case 0:if(!t)throw new Error("A learning action API configuration is required to submit this action.");if(i=null!==(u=e.raw)&&void 0!==u?u:e,!(r=null!==(p=null!==(h=i.humanChangeId)&&void 0!==h?h:e.humanChangeId)&&void 0!==p?p:e.id))throw new Error("The selected row is missing humanChangeId.");return d=null!==(v=null!==(g=t.baseUrl)&&void 0!==g?g:null==le?void 0:le.baseUrl)&&void 0!==v?v:"",s="".concat(d.replace(/\/$/,""),"/").concat(t.endpoint.replace(/^\//,"")),[4,fetch(s,{method:"POST",headers:n({"content-type":"application/json"},m(De)),body:JSON.stringify({humanIntelligentConfigId:oe,human_change_id:r,review_status:o,reviewed_by_name:(null==ie?void 0:ie.firstname)+" "+(null==ie?void 0:ie.lastname),reviewed_by_email:null==ie?void 0:ie.email,human_change_feedback:l})})];case 1:if(!(c=a.sent()).ok)throw new Error("Learning action failed: ".concat(c.status," ").concat(c.statusText));return[2]}})})},_n=function(){Ye(!1),nn(""),tn(null)},Fn=g({initialImpactRange:void 0}),kn=Fn.keyword,Ln=Fn.searchInput,Sn=Fn.dateRange,zn=Fn.sort,Hn=Fn.filterOpen,Nn=Fn.draftImpactLabels,Rn=Fn.closeFilterPanel,Mn=Fn.toggleFilterPanel,On=Fn.setDraftImpactLabels,jn=Fn.selectedImpactLabels,En=Fn.handleSearchChange,An=Fn.handleDateChange,Pn=Fn.handleSortChange,Dn=Fn.handleApplyFilters,Tn=Fn.handleResetFilters,qn=d(function(){var e,n={scopeId:null!==(e=null==re?void 0:re.scopeId)&&void 0!==e?e:[],content:kn||void 0,overallImpact:(null==jn?void 0:jn.length)?jn:void 0};return zn&&(n.orderBy=_[zn]),n},[null==re?void 0:re.scopeId,kn,jn,zn]),Bn=!(!(null==le?void 0:le.baseUrl)||!(null==le?void 0:le.endpoint)),Wn=v({baseUrl:Bn?null==le?void 0:le.baseUrl:void 0,endpoint:Bn?null==le?void 0:le.endpoint:void 0,accessToken:De,humanChangeConfigId:oe,eventId:null==re?void 0:re.eventId,filters:qn,pageSize:null!==(R=null==re?void 0:re.paginationLimit)&&void 0!==R?R:12}),Un=Wn.rows,Gn=Wn.loading,Jn=Wn.loadingMore,Kn=Wn.hasMore,$n=Wn.fetchMore,Qn=Wn.refetch,Vn=d(function(){return[{key:"humanChangePatterns",header:"Human Changes Pattern",style:{width:"55%"},headerStyle:S,body:function(e){var o,i=e;return t("div",n({style:z},{children:null!==(o=null==i?void 0:i.title)&&void 0!==o?o:"—"}))}},{key:"frequency",header:"Frequency",style:{width:"20%"},headerStyle:S,body:function(e){var o,i=e;return t("div",n({style:z},{children:null!==(o=null==i?void 0:i.frequency)&&void 0!==o?o:"—"}))}},{key:"overAllImpact",header:"Overall Impact",style:{width:"25%"},headerStyle:S,body:function(e){var o=e,i=function(e){var n;return e?null!==(n=L[e])&&void 0!==n?n:e:void 0}(null==o?void 0:o.impactLabel),a=(null==o?void 0:o.impactLabel)&&k[o.impactLabel]||{bg:"#F3F4F6",fg:"#4B5563"};return t("div",n({style:{backgroundColor:a.bg,color:a.fg,padding:"3px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:500,width:"fit-content"}},{children:i||"—"}))}}]},[]),Xn=d(function(){var e=o([],Vn,!0);return null==de||de.forEach(function(n){var o=e.findIndex(function(e){return e.key===n.key});-1!==o?e[o]=n:e.push(n)}),e},[Vn,de]);return console.log(null!==(j=null===(O=null!==(M=null==$e?void 0:$e.raw)&&void 0!==M?M:$e)||void 0===O?void 0:O.scopeId)&&void 0!==j?j:null==$e?void 0:$e.scopeId,$e,"ruleSetId debug"),t(f.Provider,n({value:De},{children:l("div",n({className:"human-changes-wrapper ".concat(bn?"human-changes-wrapper--maximized":""," ").concat(ke||"").trim()},Pe,{style:n(n({padding:"16px 20px",display:"flex",flexDirection:"column",gap:"16px",border:"1px solid #E2E8F0",backgroundColor:"#FFFFFF"},bn?{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",zIndex:50,margin:0,borderRadius:0,overflow:"auto"}:{position:"relative",borderRadius:"12px"}),Le)},{children:[t("style",{children:"\n /* Scoped size container so the header responds to the component's own\n width, not the viewport. Kept off the root wrapper on purpose: size\n containment would trap the position:fixed maximized/modal layers. */\n .human-changes-wrapper .human-changes-header-container {\n container-type: inline-size;\n width: 100%;\n }\n\n /* ---------- header layout ---------- */\n .human-changes-wrapper .human-changes-header {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 12px 24px;\n width: 100%;\n }\n\n .human-changes-wrapper .human-changes-header__titles {\n flex: 1 1 220px;\n min-width: 0;\n order: 1;\n }\n\n .human-changes-wrapper .human-changes-header__title {\n margin: 0;\n padding-bottom: 2px;\n font-family: Inter;\n font-size: 18px;\n font-weight: 600;\n color: #0F172A;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .human-changes-wrapper .human-changes-header__description {\n margin: 0;\n font-family: Inter;\n font-size: 13px;\n color: #64748B;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .human-changes-wrapper .human-changes-header__toolbar {\n order: 2;\n min-width: 0;\n ".concat((null==Fe?void 0:Fe.showHeader)?"flex: 0 1 auto;":"flex: 1 1 240px;","\n }\n\n .human-changes-wrapper .human-changes-header__toggles {\n order: 3;\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 0 0 auto;\n margin-left: auto;\n }\n\n /* ---------- toolbar (search / filter / sort) ---------- */\n .human-changes-wrapper .log-toolbar {\n width: 100%;\n min-width: 0;\n // flex-wrap: wrap;\n gap: 12px;\n }\n .human-changes-wrapper .log-toolbar__search {\n ").concat((null==Fe?void 0:Fe.showHeader)?"flex: 0 1 260px; width: auto; min-width: 160px;":"flex: 1 1 240px; width: auto; min-width: 160px;","\n }\n .human-changes-wrapper .log-toolbar__actions {\n flex: 0 0 auto;\n }\n .human-changes-wrapper .log-toolbar__btn {\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n /* ---------- narrow container: title keeps the toggles, toolbar drops\n to its own full-width row instead of colliding with the title ---------- */\n ").concat((null==Fe?void 0:Fe.showHeader)?"\n @container (max-width: 900px) {\n .human-changes-wrapper .human-changes-header__toolbar {\n order: 3;\n flex: 1 1 100%;\n }\n .human-changes-wrapper .human-changes-header__toggles {\n order: 2;\n }\n .human-changes-wrapper .log-toolbar__search {\n flex: 1 1 240px;\n }\n }":"","\n\n /* ---------- very narrow: search takes a full row, filters below ---------- */\n @container (max-width: 480px) {\n .human-changes-wrapper .human-changes-header__titles {\n flex: 1 1 100%;\n }\n .human-changes-wrapper .log-toolbar__search {\n flex: 1 1 100%;\n }\n .human-changes-wrapper .log-toolbar__actions {\n flex: 1 1 100%;\n }\n .human-changes-wrapper .log-toolbar__filter {\n flex: 1 1 auto;\n }\n .human-changes-wrapper .log-toolbar__btn {\n flex: 1 1 auto;\n justify-content: center;\n }\n }\n ")}),t("div",n({className:"human-changes-header-container"},{children:l("div",n({className:"human-changes-header"},{children:[(null==Fe?void 0:Fe.showHeader)&&l("div",n({className:"human-changes-header__titles"},{children:[t("h2",n({className:"human-changes-header__title",title:Fe.title||"Human Changes"},{children:Fe.title||"Human Changes"})),t("p",n({className:"human-changes-header__description",title:Fe.description||"Recurring scheduling patterns identified from human changes."},{children:Fe.description||"Recurring scheduling patterns identified from human changes."}))]})),t("div",n({className:"human-changes-header__toolbar"},{children:t(w,n({},se,{config:n(n({showFilterButton:!0},null==se?void 0:se.config),{sortOptions:null!==(A=null===(E=null==se?void 0:se.config)||void 0===E?void 0:E.sortOptions)&&void 0!==A?A:Ie}),value:n({search:Ln,dateRange:Sn,sort:zn},null==se?void 0:se.value),onChange:n({onSearch:function(e){var n,o;En(e),null===(o=null===(n=null==se?void 0:se.onChange)||void 0===n?void 0:n.onSearch)||void 0===o||o.call(n,e)},onDate:An,onSort:Pn},null==se?void 0:se.onChange),filterActive:jn.length>0,onOpenFilter:function(){var e;Mn(),null===(e=null==se?void 0:se.onOpenFilter)||void 0===e||e.call(se)},filterPanel:!1!==(null==Fe?void 0:Fe.showSidebar)?t(x,n({},ce,{visible:Hn,onHide:function(){var e;Rn(),null===(e=null==ce?void 0:ce.onHide)||void 0===e||e.call(ce)},impactOptions:null!==(D=null!==(P=null==ce?void 0:ce.impactOptions)&&void 0!==P?P:be)&&void 0!==D?D:xe.map(function(e){return{label:e,value:e}}),selectedImpacts:Nn,onImpactChange:function(e){var n;On(e),null===(n=null==ce?void 0:ce.onImpactChange)||void 0===n||n.call(ce,e)},onApply:function(){var e;Dn(),null===(e=null==ce?void 0:ce.onApply)||void 0===e||e.call(ce)},onReset:function(){var e;Tn(),null===(e=null==ce?void 0:ce.onReset)||void 0===e||e.call(ce)}})):null}))})),((null==Fe?void 0:Fe.showMaximizeToggle)||(null==Fe?void 0:Fe.showAccordionToggle))&&l("div",n({className:"human-changes-header__toggles"},{children:[(null==Fe?void 0:Fe.showMaximizeToggle)&&t("button",n({onClick:function(){var e=!bn;void 0===Se&&xn(e),null==Ne||Ne(e)},"aria-label":bn?"Restore":"Maximize",style:{height:"40px",width:"40px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",color:"#6b7280",cursor:"pointer"}},{children:t(bn?s:c,{size:16})})),(null==Fe?void 0:Fe.showAccordionToggle)&&t("button",n({onClick:function(){var e=!We;void 0===Re&&Be(e),null==je||je(e)},"aria-label":We?"Collapse table":"Expand table",style:{height:"40px",width:"40px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",color:"#6b7280",cursor:"pointer"}},{children:t(We?u:h,{size:16})}))]}))]}))})),We&&t(p,n({},ue,{renderExpandedRow:(null==ue?void 0:ue.renderExpandedRow)?function(e,o){var i,a,r,d,s,c,u,h,p=!1!==(null===(i=null==Ee?void 0:Ee.primary)||void 0===i?void 0:i.show)||!1!==(null===(a=null==Ee?void 0:Ee.secondary)||void 0===a?void 0:a.show);return l("div",n({style:{display:"flex",flexDirection:"column"}},{children:[ue.renderExpandedRow(e,o),p&&l("div",n({className:b.footerActionContainer},{children:[!1!==(null===(r=null==Ee?void 0:Ee.secondary)||void 0===r?void 0:r.show)&&t("button",n({className:"".concat(b.footerActionSecondary," ").concat((null===(d=null==Ee?void 0:Ee.secondary)||void 0===d?void 0:d.className)||"").trim(),onClick:o.rejectLearning},{children:(null===(s=null==Ee?void 0:Ee.secondary)||void 0===s?void 0:s.label)||"Reject"})),!1!==(null===(c=null==Ee?void 0:Ee.primary)||void 0===c?void 0:c.show)&&t("button",n({className:"".concat(b.footerActionPrimary," ").concat((null===(u=null==Ee?void 0:Ee.primary)||void 0===u?void 0:u.className)||"").trim(),onClick:o.generateLearning},{children:(null===(h=null==Ee?void 0:Ee.primary)||void 0===h?void 0:h.label)||"Generate Learning"}))]}))]}))}:void 0,onRejectLearning:function(e){return i(ne,void 0,void 0,function(){return a(this,function(n){return tn(e),Ye(!0),[2]})})},onGenerateLearning:function(e){return i(ne,void 0,void 0,function(){return a(this,function(n){return Qe(e),dn(!0),[2]})})},columns:Xn,rows:Un,headerStyle:S,headerClassName:"audit-header",rowHeight:null!==(T=null==ue?void 0:ue.rowHeight)&&void 0!==T?T:he,headerHeight:null!==(q=null==ue?void 0:ue.headerHeight)&&void 0!==q?q:pe,rowPadding:null!==(B=null==ue?void 0:ue.rowPadding)&&void 0!==B?B:ge,headerPadding:null!==(W=null==ue?void 0:ue.headerPadding)&&void 0!==W?W:ve,rowLineHeight:null!==(U=null==ue?void 0:ue.rowLineHeight)&&void 0!==U?U:fe,className:null!==(G=null==ue?void 0:ue.className)&&void 0!==G?G:me,loading:Gn,loadingMore:Jn,hasMore:Kn,onLoadMore:function(){null==$n||$n()}})),l(y,{children:[Xe&&t("div",n({style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(15, 23, 42, 0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},onClick:_n},{children:l("div",n({onClick:function(e){return e.stopPropagation()},style:{background:"#fff",borderRadius:"12px",padding:"20px 24px",width:"360px",boxShadow:"0 10px 30px rgba(0,0,0,0.2)",display:"flex",flexDirection:"column",gap:"12px",fontFamily:"Inter"}},{children:[t("h3",n({style:{margin:0,fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:"Reject learning"})),t("p",n({style:{margin:0,fontSize:"13px",color:"#64748B"}},{children:"Optionally add a reason before rejecting this learning."})),t("input",{type:"text",value:en,onChange:function(e){return nn(e.target.value)},placeholder:"Enter feedback (optional)...",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid #E2E8F0",fontSize:"14px",fontFamily:"Inter",outline:"none"},autoFocus:!0}),l("div",n({style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"}},{children:[t("button",n({onClick:_n,style:{padding:"8px 14px",borderRadius:"8px",border:"1px solid #E2E8F0",background:"#fff",color:"#374151",fontSize:"13px",fontWeight:500,cursor:"pointer"}},{children:"Cancel"})),t("button",n({onClick:function(){return i(ne,void 0,void 0,function(){var e;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),[4,Cn(an||{},"rejected",Ce,en)];case 1:return n.sent(),[3,4];case 2:return e=n.sent(),console.error(e),[3,4];case 3:return Ye(!1),nn(""),tn(null),Qn(),[7];case 4:return[2]}})})},style:{padding:"8px 14px",borderRadius:"8px",border:"none",background:"#111827",color:"#fff",fontSize:"13px",fontWeight:500,cursor:"pointer"}},{children:"Submit"}))]}))]}))})),t(C,{isOpen:rn,onClose:function(){dn(!1),Qe(null),gn(!1)},onContinue:function(e){return i(ne,void 0,void 0,function(){var n,o;return a(this,function(i){switch(i.label){case 0:if(!(n=$e))return dn(!1),[2];gn(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,fn(n,e)];case 2:return i.sent(),dn(!1),[3,5];case 3:return o=i.sent(),console.error(o),[3,5];case 4:return gn(!1),[7];case 5:return[2]}})})},summary:(null==$e?void 0:$e.summary)||(null===(J=null==$e?void 0:$e.raw)||void 0===J?void 0:J.summary),inferredLearning:(null==$e?void 0:$e.title)||(null===(K=null==$e?void 0:$e.raw)||void 0===K?void 0:K.title)||"",isLoading:pn}),t(I,{isOpen:Ge,onClose:function(){Je(!1),Qe(null),un(null),Qn()},app_integration_id:ae,token:De,mode:"ADD",config:te,pluginPayload:{modeId:Ae,initialDraftMessage:cn,postSaveCallback:function(){console.log("postSaveCallback called with activeLearningRow:",$e),Cn($e||{},"accepted",_e)},ruleSet:{ruleSetId:null!==(V=null===(Q=null!==($=null==$e?void 0:$e.raw)&&void 0!==$?$:$e)||void 0===Q?void 0:Q.scopeId)&&void 0!==V?V:null==$e?void 0:$e.scopeId}}},null!==(ee=null!==(Z=null===(Y=null!==(X=null==$e?void 0:$e.raw)&&void 0!==X?X:$e)||void 0===Y?void 0:Y.scopeId)&&void 0!==Z?Z:null==$e?void 0:$e.scopeId)&&void 0!==ee?ee:"pending")]})]}))}))}export{N as default};
2
2
  //# sourceMappingURL=HumanChangesTableWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as n}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import r,{useState as a,useId as l}from"react";import{Wand2 as c,ChevronUp as d,ChevronDown as s}from"lucide-react";import{CitationRenderer as g}from"@e-llm-studio/citation";import{CitationContent as u}from"../CitationContent/CitationContent.js";import h from"./CognitiveDecisioning.module.css.js";import{useCitationChangelogs as m,useCitationSegments as p,useBusinessContextData as f}from"../../hooks/useHumanChangesData.js";import{formatColumnTitle as v,buildRecordMarkdown as x}from"../../utils/citationRecord.js";var b={pillButton:{background:"transparent",padding:0,margin:0,fontSize:"12px",fontWeight:600,color:"#3B82F6",cursor:"pointer",border:"none",display:"inline-flex",alignItems:"center",gap:"4px"},citationContent:{backgroundColor:"#FFFFFF",border:"1px solid #E2E8F0",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",width:"100%",maxWidth:"100%",marginTop:"8px",height:"400px",maxHeight:"400px",minHeight:"400px",padding:"16px",boxSizing:"border-box",overflow:"hidden"}},C=/\[([^\]]+)\]\(([^)\s]+)\)|<citation sequence_ids='(.*?)' changelog_ids='(.*?)'>(.*?)<\/citation>/g,y=function(e){var o=e.metric,r=e.isExpanded,a=e.onToggle,l=Object.entries(o).filter(function(e){e[0];var n=e[1];return"object"!=typeof n||null===n});if(0===l.length)return t("span",{children:"-"});var c=l.length>4,d=r?l:l.slice(0,4);return i("div",n({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[t("div",n({style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 16px"}},{children:d.map(function(e){var o=e[0],r=e[1];return i("div",n({style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"}},{children:[t("span",n({style:{color:"#64748b",fontSize:"12px"}},{children:v(o)})),t("span",n({style:{fontWeight:600,fontSize:"12px",color:"#334155",whiteSpace:"nowrap",flexShrink:0}},{children:String(r)}))]}),o)})})),c&&t("button",n({onClick:a,style:{alignSelf:"flex-start",background:"none",border:"none",color:"#2563eb",fontSize:"12px",fontWeight:500,cursor:"pointer",padding:"2px 0",marginTop:"4px"}},{children:r?"Show less":"+ ".concat(l.length-4," more")}))]}))},k=function(e){var i=e.citation,o=e.initialRows,a=e.fromConsumer,l=e.tableTitle,c=e.columns,d=e.rulebookTitle,s=e.rulebookPaginationText,g=e.rulebookComponent,h=e.humanIntelligentConfigId,b=e.changeLogConfigId,C=e.baseUrl,k=e.agentConfig,T="changelog"===(null==i?void 0:i.source),_=(null==i?void 0:i.changelog_ids)||[],I=r.useState({}),W=I[0],w=I[1],S=m({baseUrl:C,configId:b,changeLogIds:_,skip:a||!T||0===_.length}),N=S.data,L=S.loading,P=S.error,R=S.fetchNextPage,U=S.hasNextPage,F=S.isFetchingNextPage,j=S.fetchNextPageError,z=S.refetch,D=(null==i?void 0:i.segment_ids)||(T?[]:null==i?void 0:i.changelog_ids)||[],E=p({baseUrl:C,humanIntelligentConfigId:h,segmentIds:D,skip:a||T||0===D.length}),M=E.data,H=E.loading,B=E.error,O=E.refetch,q=f({baseUrl:C,humanIntelligentConfigId:h,agentConfig:k,skip:!k}),A=q.data,G=q.loading,J=q.error,K=q.refetch,Q=T?L:H,V=T?P:B,X=a?o||[]:(T?N:M)||[],Y=(null==c?void 0:c.length)?c:void 0;return!Y&&X&&X.length>0?Y=T?[{key:"change",title:v("change"),minWidth:150,maxWidth:250},{key:"changeTitle",title:v("changeTitle"),minWidth:150,maxWidth:250},{key:"modifiedbyemail",title:v("modifiedbyemail"),minWidth:150,maxWidth:250},{key:"modifiedbyname",title:v("modifiedbyname"),minWidth:150,maxWidth:250},{key:"created_at",title:v("created_at"),minWidth:200,maxWidth:300,render:function(e){var n=e.created_at;if(!n)return"-";try{return new Date(n).toLocaleString()}catch(e){return String(n)}}},{key:"change_log_impact",title:v("change_log_impact"),minWidth:150,maxWidth:250},{key:"change_log_impact_percentage",title:v("change_log_impact_percentage"),minWidth:150,maxWidth:250}]:[{key:"segmentSummary",title:v("segmentSummary"),minWidth:250,maxWidth:400},{key:"frequency",title:v("frequency"),minWidth:100,maxWidth:150},{key:"segmentMetric",title:v("segmentMetric"),minWidth:400,maxWidth:550,render:function(e,i){var o=e.segmentMetric;if(!o)return"-";var r=e.id?String(e.id):"row-".concat(i),a=!!W[r];return t(y,{metric:o,isExpanded:a,onToggle:function(){w(function(e){var i;return n(n({},e),((i={})[r]=!e[r],i))})}})}}]:Y||(Y=[]),t("div",n({style:{position:"relative",width:"100%"}},{children:t(u,{citationType:"record"===(null==i?void 0:i.type)?"record":"tabular",tableTitle:(null==i?void 0:i.source)?"".concat(i.source.charAt(0).toUpperCase()+i.source.slice(1)," ").concat("record"===(null==i?void 0:i.type)?"Record":"Table"):l,tableData:X,columns:Y,rulebookTitle:d,rulebookPaginationText:s,rulebookComponent:g,rulebookMarkdown:A,rulebookLoading:G,rulebookError:J,onRulebookRetry:K,highlights:null==i?void 0:i.business_context_highlight,loading:Q&&"record"!==(null==i?void 0:i.type),error:V,onRetry:T?z:O,onEndReached:T?R:void 0,hasNextPage:T?U:void 0,isFetchingNextPage:T?F:void 0,fetchNextPageError:T?j:void 0,recordMarkdown:"record"===(null==i?void 0:i.type)?x(i):""})}))},T=function(e,i,r,a){var l,c,u,m=i.citations,p=void 0===m?{}:m,f=i.changeLogs,v=void 0===f?[]:f,x=i.columns,y=void 0===x?[]:x,T=i.rulebookComponent,_=void 0===T?null:T,I=i.tableTitle,W=void 0===I?"Table data":I,w=i.rulebookTitle,S=void 0===w?"Rulebook":w,N=i.rulebookPaginationText,L=void 0===N?"":N,P=i.humanIntelligentConfigId,R=void 0===P?"":P,U=i.changeLogConfigId,F=void 0===U?"":U,j=i.baseUrl,z=void 0===j?"":j,D=i.agentConfig,E=void 0===D?"":D,M=[],H=0;C.lastIndex=0;for(var B=function(){u.index>H&&M.push(e.slice(H,u.index));var i,o,m=void 0!==u[1],f=m?u[1]:u[5],x=void 0;if(m){var T=(i=null!==(l=u[2])&&void 0!==l?l:"",(o=i.split("?")[1])?o.split("&").reduce(function(e,n){var i=n.split("="),t=i[0],o=i[1],r=void 0===o?"":o;return t&&(e[decodeURIComponent(t)]=decodeURIComponent(r)),e},{}):{}),I=T.citationNumber;if(!I)return M.push(f),H=C.lastIndex,"continue";x=p["citation_".concat(I)]}else{var w=(null!==(c=u[4])&&void 0!==c?c:"").replace(/[[\]"']/g,"").split(",").map(function(e){return e.trim()}).filter(Boolean);x=w.length?{type:"tabular",source:"changelog",changelog_ids:w}:void 0}var N=function(e,n){var i,t,o;if(!e)return{rows:n,fromConsumer:!0};if("record"===e.type){var r=null!==(i=e.changelog)&&void 0!==i?i:e.segment;return r?{rows:[r],fromConsumer:!1}:{rows:n,fromConsumer:!0}}var a=null!==(o=null!==(t=e.changelog_ids)&&void 0!==t?t:e.segment_ids)&&void 0!==o?o:[];if(!a.length)return{rows:n,fromConsumer:!0};var l=n.filter(function(e){return a.includes(function(e){var n,i,t;return null!==(t=null!==(i=null!==(n=null==e?void 0:e.change_log_id)&&void 0!==n?n:null==e?void 0:e.changeLogId)&&void 0!==i?i:null==e?void 0:e.changelog_id)&&void 0!==t?t:null==e?void 0:e.id}(e))});return l.length?{rows:l,fromConsumer:!0}:{rows:a.map(function(e){return{change_log_id:e}}),fromConsumer:!1}}(x,v),P=N.rows,U=N.fromConsumer,j="".concat(u.index,"-").concat(f),D=r.has(j);M.push(t("span",n({className:h.inlineCitationWrapper},{children:t(g,{inLineCitation:!0,citationTitle:f,isOpen:D,onToggle:function(){return a(j)},citationComponent:t("div",{style:{display:"none"}}),chevronDownComponent:t(s,{size:14,"aria-hidden":"true"}),chevronUpComponent:t(d,{size:14,"aria-hidden":"true"}),styles:n(n({},b),{citationWrapper:{display:"none"}})})}),j)),D&&M.push(t("div",n({style:{marginTop:"12px",marginBottom:"16px",display:"block",width:"100%"}},{children:t(k,{citation:x,initialRows:P,fromConsumer:U,tableTitle:W,columns:y,rulebookTitle:S,rulebookPaginationText:L,rulebookComponent:_,humanIntelligentConfigId:R,changeLogConfigId:F,baseUrl:z,agentConfig:E})}),"".concat(j,"-content"))),H=C.lastIndex};null!==(u=C.exec(e));)B();return H<e.length&&M.push(e.slice(H)),M.length>0?t(o,{children:M}):e},_=function(e){var i=e.text,o=e.options,l=a(new Set),c=l[0],d=l[1],s=r.useCallback(function(e){d(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),g=r.useMemo(function(){return T(i,o,c,s)},[i,o,c,s]);return t("li",{children:t("div",n({style:{display:"inline",lineHeight:"24px"}},{children:g}))})},I=function(r){var g,u,m,p=r.data,f=r.changeLogs,v=void 0===f?[]:f,x=r.defaultOpen,b=void 0!==x&&x,C=r.className,y=e(r,["data","changeLogs","defaultOpen","className"]),k=a(b),T=k[0],I=k[1],W=l(),w={citations:p.citation,changeLogs:v,columns:p.tableColumns,rulebookComponent:p.rulebookComponent,tableTitle:p.tableTitle,rulebookTitle:p.rulebookTitle,rulebookPaginationText:p.rulebookPaginationText,humanIntelligentConfigId:p.humanIntelligentConfigId,changeLogConfigId:p.changeLogConfigId,baseUrl:p.baseUrl,agentConfig:p.agentConfig},S=null!==(g=p.reason)&&void 0!==g?g:[],N=null!==(u=p.gap)&&void 0!==u?u:[],L=Math.round(100*(null!==(m=p.confidence_score)&&void 0!==m?m:0));return i("div",n({className:"".concat(h.accordionContainer," ").concat(C||"").trim()},y,{children:[i("button",n({type:"button",className:h.accordionHeader,onClick:function(){return I(function(e){return!e})},"aria-expanded":T,"aria-controls":W},{children:[t("h3",n({className:h.accordionTitle},{children:"Why these patterns were identified?"})),i("div",n({className:h.accordionPill},{children:[t(c,{size:14,"aria-hidden":"true"}),i("span",{children:[L,"%"]}),t(T?d:s,{size:14,"aria-hidden":"true"})]}))]})),T&&i("div",n({id:W,className:h.accordionContent,style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[S.length>0&&i("div",n({className:h.cognitiveSection},{children:[t("div",n({className:h.cognitiveSectionTitle},{children:"Decision Making Factors"})),t("ol",n({className:h.cognitiveList},{children:S.map(function(e,n){return t(_,{text:e,options:w},n)})}))]})),N.length>0&&i(o,{children:[S.length>0&&t("div",{className:h.cognitiveSeparator}),i("div",n({className:h.cognitiveSection},{children:[t("div",n({className:h.cognitiveSectionTitle},{children:"Gaps in Decision"})),t("ol",n({className:h.cognitiveList},{children:N.map(function(e,n){return t(_,{text:e,options:w},n)})}))]}))]})]}))]}))};export{I as CognitiveDecisioning};
1
+ import{__rest as e,__assign as n}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as o,Fragment as t}from"react/jsx-runtime";import r,{useState as a,useId as l}from"react";import{Wand2 as c,ChevronUp as d,ChevronDown as s}from"lucide-react";import{CitationRenderer as g}from"@e-llm-studio/citation";import{CitationContent as u}from"../CitationContent/CitationContent.js";import h from"./CognitiveDecisioning.module.css.js";import{useCitationChangelogs as m,useCitationSegments as p,useBusinessContextData as f}from"../../hooks/useHumanChangesData.js";import{formatColumnTitle as v,buildRecordMarkdown as x}from"../../utils/citationRecord.js";var b={pillButton:{background:"transparent",padding:0,margin:0,fontSize:"12px",fontWeight:600,color:"#3B82F6",cursor:"pointer",border:"none",display:"inline-flex",alignItems:"center",gap:"4px"},citationContent:{backgroundColor:"#FFFFFF",border:"1px solid #E2E8F0",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",width:"100%",maxWidth:"100%",marginTop:"8px",height:"400px",maxHeight:"400px",minHeight:"400px",padding:"16px",boxSizing:"border-box",overflow:"hidden"}},C=/\[([^\]]+)\]\(([^)\s]+)\)|<citation sequence_ids='(.*?)' changelog_ids='(.*?)'>(.*?)<\/citation>/g,k=function(e){var t=e.metric,r=e.isExpanded,a=e.onToggle,l=Object.entries(t).filter(function(e){e[0];var n=e[1];return"object"!=typeof n||null===n});if(0===l.length)return o("span",{children:"-"});var c=l.length>4,d=r?l:l.slice(0,4);return i("div",n({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[o("div",n({style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 16px"}},{children:d.map(function(e){var t=e[0],r=e[1];return i("div",n({style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"}},{children:[o("span",n({style:{color:"#64748b",fontSize:"12px"}},{children:v(t)})),o("span",n({style:{fontWeight:600,fontSize:"12px",color:"#334155",whiteSpace:"nowrap",flexShrink:0}},{children:String(r)}))]}),t)})})),c&&o("button",n({onClick:a,style:{alignSelf:"flex-start",background:"none",border:"none",color:"#2563eb",fontSize:"12px",fontWeight:500,cursor:"pointer",padding:"2px 0",marginTop:"4px"}},{children:r?"Show less":"+ ".concat(l.length-4," more")}))]}))},y=function(e){var i=e.citation,t=e.initialRows,a=e.fromConsumer,l=e.tableTitle,c=e.columns,d=e.rulebookTitle,s=e.rulebookPaginationText,g=e.rulebookComponent,h=e.humanIntelligentConfigId,b=e.changeLogConfigId,C=e.baseUrl,y=e.accessToken,T=e.agentConfig,_="changelog"===(null==i?void 0:i.source),I=(null==i?void 0:i.changelog_ids)||[],W=r.useState({}),w=W[0],S=W[1],N=m({baseUrl:C,accessToken:y,configId:b,changeLogIds:I,skip:a||!_||0===I.length}),L=N.data,P=N.loading,R=N.error,U=N.fetchNextPage,F=N.hasNextPage,j=N.isFetchingNextPage,z=N.fetchNextPageError,D=N.refetch,E=(null==i?void 0:i.segment_ids)||(_?[]:null==i?void 0:i.changelog_ids)||[],M=p({baseUrl:C,accessToken:y,humanIntelligentConfigId:h,segmentIds:E,skip:a||_||0===E.length}),H=M.data,B=M.loading,O=M.error,q=M.refetch,A=f({baseUrl:C,accessToken:y,humanIntelligentConfigId:h,agentConfig:T,skip:!T}),G=A.data,J=A.loading,K=A.error,Q=A.refetch,V=_?P:B,X=_?R:O,Y=a?t||[]:(_?L:H)||[],Z=(null==c?void 0:c.length)?c:void 0;return!Z&&Y&&Y.length>0?Z=_?[{key:"change",title:v("change"),minWidth:150,maxWidth:250},{key:"changeTitle",title:v("changeTitle"),minWidth:150,maxWidth:250},{key:"modifiedbyemail",title:v("modifiedbyemail"),minWidth:150,maxWidth:250},{key:"modifiedbyname",title:v("modifiedbyname"),minWidth:150,maxWidth:250},{key:"created_at",title:v("created_at"),minWidth:200,maxWidth:300,render:function(e){var n=e.created_at;if(!n)return"-";try{return new Date(n).toLocaleString()}catch(e){return String(n)}}},{key:"change_log_impact",title:v("change_log_impact"),minWidth:150,maxWidth:250},{key:"change_log_impact_percentage",title:v("change_log_impact_percentage"),minWidth:150,maxWidth:250}]:[{key:"segmentSummary",title:v("segmentSummary"),minWidth:250,maxWidth:400},{key:"frequency",title:v("frequency"),minWidth:100,maxWidth:150},{key:"segmentMetric",title:v("segmentMetric"),minWidth:400,maxWidth:550,render:function(e,i){var t=e.segmentMetric;if(!t)return"-";var r=e.id?String(e.id):"row-".concat(i),a=!!w[r];return o(k,{metric:t,isExpanded:a,onToggle:function(){S(function(e){var i;return n(n({},e),((i={})[r]=!e[r],i))})}})}}]:Z||(Z=[]),o("div",n({style:{position:"relative",width:"100%"}},{children:o(u,{citationType:"record"===(null==i?void 0:i.type)?"record":"tabular",tableTitle:(null==i?void 0:i.source)?"".concat(i.source.charAt(0).toUpperCase()+i.source.slice(1)," ").concat("record"===(null==i?void 0:i.type)?"Record":"Table"):l,tableData:Y,columns:Z,rulebookTitle:d,rulebookPaginationText:s,rulebookComponent:g,rulebookMarkdown:G,rulebookLoading:J,rulebookError:K,onRulebookRetry:Q,highlights:null==i?void 0:i.business_context_highlight,loading:V&&"record"!==(null==i?void 0:i.type),error:X,onRetry:_?D:q,onEndReached:_?U:void 0,hasNextPage:_?F:void 0,isFetchingNextPage:_?j:void 0,fetchNextPageError:_?z:void 0,recordMarkdown:"record"===(null==i?void 0:i.type)?x(i):""})}))},T=function(e,i,r,a){var l,c,u,m=i.citations,p=void 0===m?{}:m,f=i.changeLogs,v=void 0===f?[]:f,x=i.columns,k=void 0===x?[]:x,T=i.rulebookComponent,_=void 0===T?null:T,I=i.tableTitle,W=void 0===I?"Table data":I,w=i.rulebookTitle,S=void 0===w?"Rulebook":w,N=i.rulebookPaginationText,L=void 0===N?"":N,P=i.humanIntelligentConfigId,R=void 0===P?"":P,U=i.changeLogConfigId,F=void 0===U?"":U,j=i.baseUrl,z=void 0===j?"":j,D=i.accessToken,E=i.agentConfig,M=void 0===E?"":E,H=[],B=0;C.lastIndex=0;for(var O=function(){u.index>B&&H.push(e.slice(B,u.index));var i,t,m=void 0!==u[1],f=m?u[1]:u[5],x=void 0;if(m){var T=(i=null!==(l=u[2])&&void 0!==l?l:"",(t=i.split("?")[1])?t.split("&").reduce(function(e,n){var i=n.split("="),o=i[0],t=i[1],r=void 0===t?"":t;return o&&(e[decodeURIComponent(o)]=decodeURIComponent(r)),e},{}):{}),I=T.citationNumber;if(!I)return H.push(f),B=C.lastIndex,"continue";x=p["citation_".concat(I)]}else{var w=(null!==(c=u[4])&&void 0!==c?c:"").replace(/[[\]"']/g,"").split(",").map(function(e){return e.trim()}).filter(Boolean);x=w.length?{type:"tabular",source:"changelog",changelog_ids:w}:void 0}var N=function(e,n){var i,o,t;if(!e)return{rows:n,fromConsumer:!0};if("record"===e.type){var r=null!==(i=e.changelog)&&void 0!==i?i:e.segment;return r?{rows:[r],fromConsumer:!1}:{rows:n,fromConsumer:!0}}var a=null!==(t=null!==(o=e.changelog_ids)&&void 0!==o?o:e.segment_ids)&&void 0!==t?t:[];if(!a.length)return{rows:n,fromConsumer:!0};var l=n.filter(function(e){return a.includes(function(e){var n,i,o;return null!==(o=null!==(i=null!==(n=null==e?void 0:e.change_log_id)&&void 0!==n?n:null==e?void 0:e.changeLogId)&&void 0!==i?i:null==e?void 0:e.changelog_id)&&void 0!==o?o:null==e?void 0:e.id}(e))});return l.length?{rows:l,fromConsumer:!0}:{rows:a.map(function(e){return{change_log_id:e}}),fromConsumer:!1}}(x,v),P=N.rows,U=N.fromConsumer,j="".concat(u.index,"-").concat(f),E=r.has(j);H.push(o("span",n({className:h.inlineCitationWrapper},{children:o(g,{inLineCitation:!0,citationTitle:f,isOpen:E,onToggle:function(){return a(j)},citationComponent:o("div",{style:{display:"none"}}),chevronDownComponent:o(s,{size:14,"aria-hidden":"true"}),chevronUpComponent:o(d,{size:14,"aria-hidden":"true"}),styles:n(n({},b),{citationWrapper:{display:"none"}})})}),j)),E&&H.push(o("div",n({style:{marginTop:"12px",marginBottom:"16px",display:"block",width:"100%"}},{children:o(y,{citation:x,initialRows:P,fromConsumer:U,tableTitle:W,columns:k,rulebookTitle:S,rulebookPaginationText:L,rulebookComponent:_,humanIntelligentConfigId:R,changeLogConfigId:F,baseUrl:z,accessToken:D,agentConfig:M})}),"".concat(j,"-content"))),B=C.lastIndex};null!==(u=C.exec(e));)O();return B<e.length&&H.push(e.slice(B)),H.length>0?o(t,{children:H}):e},_=function(e){var i=e.text,t=e.options,l=a(new Set),c=l[0],d=l[1],s=r.useCallback(function(e){d(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),g=r.useMemo(function(){return T(i,t,c,s)},[i,t,c,s]);return o("li",{children:o("div",n({style:{display:"inline",lineHeight:"24px"}},{children:g}))})},I=function(r){var g,u,m,p=r.data,f=r.changeLogs,v=void 0===f?[]:f,x=r.defaultOpen,b=void 0!==x&&x,C=r.className,k=e(r,["data","changeLogs","defaultOpen","className"]),y=a(b),T=y[0],I=y[1],W=l(),w={citations:p.citation,changeLogs:v,columns:p.tableColumns,rulebookComponent:p.rulebookComponent,tableTitle:p.tableTitle,rulebookTitle:p.rulebookTitle,rulebookPaginationText:p.rulebookPaginationText,humanIntelligentConfigId:p.humanIntelligentConfigId,changeLogConfigId:p.changeLogConfigId,baseUrl:p.baseUrl,accessToken:p.accessToken,agentConfig:p.agentConfig},S=null!==(g=p.reason)&&void 0!==g?g:[],N=null!==(u=p.gap)&&void 0!==u?u:[],L=Math.round(100*(null!==(m=p.confidence_score)&&void 0!==m?m:0));return i("div",n({className:"".concat(h.accordionContainer," ").concat(C||"").trim()},k,{children:[i("button",n({type:"button",className:h.accordionHeader,onClick:function(){return I(function(e){return!e})},"aria-expanded":T,"aria-controls":W},{children:[o("h3",n({className:h.accordionTitle},{children:"Why these patterns were identified?"})),i("div",n({className:h.accordionPill},{children:[o(c,{size:14,"aria-hidden":"true"}),i("span",{children:[L,"%"]}),o(T?d:s,{size:14,"aria-hidden":"true"})]}))]})),T&&i("div",n({id:W,className:h.accordionContent,style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[S.length>0&&i("div",n({className:h.cognitiveSection},{children:[o("div",n({className:h.cognitiveSectionTitle},{children:"Decision Making Factors"})),o("ol",n({className:h.cognitiveList},{children:S.map(function(e,n){return o(_,{text:e,options:w},n)})}))]})),N.length>0&&i(t,{children:[S.length>0&&o("div",{className:h.cognitiveSeparator}),i("div",n({className:h.cognitiveSection},{children:[o("div",n({className:h.cognitiveSectionTitle},{children:"Gaps in Decision"})),o("ol",n({className:h.cognitiveList},{children:N.map(function(e,n){return o(_,{text:e,options:w},n)})}))]}))]})]}))]}))};export{I as CognitiveDecisioning};
2
2
  //# sourceMappingURL=CognitiveDecisioning.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as a,__assign as r}from"../../../_virtual/_tslib.js";import{jsxs as m,jsx as s}from"react/jsx-runtime";import e from"./HumanChangesSummary.module.css.js";import{renderInlineMarkup as i}from"../../utils/inlineMarkup.js";var l=function(l){var c=l.label,t=void 0===c?"HUMAN CHANGES SUMMARY":c,n=l.children,o=l.className,u=a(l,["label","children","className"]);return m("div",r({className:"".concat(e.summaryContainer," ").concat(o||"").trim()},u,{children:[s("h3",r({className:e.label},{children:t})),s("div",r({className:e.summaryText},{children:i(n,{classNames:{mark:e.highlight}})}))]}))};export{l as HumanChangesSummary};
1
+ import{__rest as a,__assign as r}from"../../../_virtual/_tslib.js";import{jsxs as s,jsx as m}from"react/jsx-runtime";import i from"./HumanChangesSummary.module.css.js";import{renderInlineMarkup as e}from"../../utils/inlineMarkup.js";var l=function(l){var n=l.label,t=void 0===n?"HUMAN CHANGES SUMMARY":n,c=l.children,o=l.className,u=a(l,["label","children","className"]);return s("div",r({className:"".concat(i.summaryContainer," ").concat(o||"").trim()},u,{children:[m("h3",r({className:i.label},{children:t})),m("div",r({className:i.summaryText},{children:e(c,{classNames:{mark:i.highlight},stripUnknownTags:!0})}))]}))};export{l as HumanChangesSummary};
2
2
  //# sourceMappingURL=HumanChangesSummary.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as n,__assign as a}from"../../../_virtual/_tslib.js";import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"./HumanIntelligenceCard.module.css.js";import{PatternDetails as r}from"../PatternDetails/PatternDetails.js";import{HumanChangesSummary as o}from"../HumanChangesSummary/HumanChangesSummary.js";import{CognitiveDecisioning as l}from"../CognitiveDecisioning/CognitiveDecisioning.js";var s=function(s){var m=s.patternDetails,g=s.humanChangesSummary;s.analysisAccordion;var c=s.cognitiveDecisioning,u=s.humanIntelligentConfigId,d=s.baseUrl,h=s.agentConfig,f=s.children,C=s.className,p=n(s,["patternDetails","humanChangesSummary","analysisAccordion","cognitiveDecisioning","humanIntelligentConfigId","baseUrl","agentConfig","children","className"]);return e("div",a({className:"".concat(t.cardContainer," ").concat(C||"").trim()},p,{children:[m&&i(r,a({label:m.label},{children:m.content})),m&&g&&i("div",{className:t.separator}),g&&i(o,a({label:g.label},{children:g.content})),c&&i(l,{data:a(a({},c),{humanIntelligentConfigId:c.humanIntelligentConfigId||u,baseUrl:c.baseUrl||d,agentConfig:c.agentConfig||h}),changeLogs:c.changeLogs,defaultOpen:!1}),f]}))};export{s as HumanIntelligenceCard};
1
+ import{__rest as n,__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as a,jsx as i}from"react/jsx-runtime";import t from"./HumanIntelligenceCard.module.css.js";import{PatternDetails as s}from"../PatternDetails/PatternDetails.js";import{HumanChangesSummary as o}from"../HumanChangesSummary/HumanChangesSummary.js";import{CognitiveDecisioning as r}from"../CognitiveDecisioning/CognitiveDecisioning.js";var l=function(l){var c=l.patternDetails,m=l.humanChangesSummary;l.analysisAccordion;var g=l.cognitiveDecisioning,u=l.humanIntelligentConfigId,d=l.baseUrl,h=l.accessToken,f=l.agentConfig,C=l.children,p=l.className,v=n(l,["patternDetails","humanChangesSummary","analysisAccordion","cognitiveDecisioning","humanIntelligentConfigId","baseUrl","accessToken","agentConfig","children","className"]);return a("div",e({className:"".concat(t.cardContainer," ").concat(p||"").trim()},v,{children:[c&&i(s,e({label:c.label},{children:c.content})),c&&m&&i("div",{className:t.separator}),m&&i(o,e({label:m.label},{children:m.content})),g&&i(r,{data:e(e({},g),{humanIntelligentConfigId:g.humanIntelligentConfigId||u,baseUrl:g.baseUrl||d,accessToken:g.accessToken||h,agentConfig:g.agentConfig||f}),changeLogs:g.changeLogs,defaultOpen:!1}),C]}))};export{l as HumanIntelligenceCard};
2
2
  //# sourceMappingURL=HumanIntelligenceCard.js.map
@@ -0,0 +1,2 @@
1
+ import{__assign as e}from"../../../_virtual/_tslib.js";import{jsx as n,jsxs as t}from"react/jsx-runtime";import{useState as l,useEffect as i}from"react";import{X as r,Check as a}from"lucide-react";import{parseSuggestedRule as c,buildDraftMessage as o}from"./parser.js";import s from"./ReviewLearningConditionsModal.module.css.js";var d=function(d){var u=d.isOpen,m=d.onClose,p=d.onContinue,f=d.summary,h=d.inferredLearning,g=d.isLoading,v=void 0!==g&&g,b=l([]),N=b[0],C=b[1],y=l(""),k=y[0],w=y[1],L=l(null),A=(L[0],L[1]),x=l("");x[0];var S=x[1];if(i(function(){if(u){var e=c(f);C(e.categories),w(e.ruleAction||"New rule."),A(null),S("")}},[u,f]),!u)return null;var j=(null==h?void 0:h.trim())||k||"",B=N.filter(function(e){return"configurable"===e.type}).flatMap(function(e){return e.options||[]}),R=B.length>0&&B.every(function(e){return e.selected});return n("div",e({className:s.overlay,onClick:m,role:"dialog","aria-modal":"true","aria-labelledby":"review-learning-title"},{children:t("div",e({className:s.modal,onClick:function(e){return e.stopPropagation()}},{children:[t("div",e({className:s.header},{children:[n("h2",e({id:"review-learning-title",className:s.title},{children:"Review learning conditions"})),n("p",e({className:s.subtitle},{children:"We identified these conditions from the recurring pattern. Deselect anything that should not be included in the learning."})),n("button",e({type:"button",className:s.closeButton,onClick:m,"aria-label":"Close dialog"},{children:n(r,{size:18})}))]})),t("div",e({className:s.body},{children:[Boolean(j)&&t("div",e({className:s.inferredCard},{children:[n("div",e({className:s.inferredLabel},{children:"Inferred Learning"})),n("p",e({className:s.inferredText},{children:j}))]})),n("div",e({className:s.selectAllRow},{children:t("button",e({type:"button",className:s.selectAllControl,onClick:function(){var n=!R;console.log("Select all toggled",{shouldSelectAll:n}),C(function(t){return t.map(function(t){return"configurable"!==t.type?t:e(e({},t),{options:t.options.map(function(t){return e(e({},t),{selected:n})})})})})},"aria-pressed":R},{children:[n("span",e({className:"".concat(s.selectAllCheckbox," ").concat(R?s.selectAllCheckboxChecked:"")},{children:R&&n(a,{size:12,strokeWidth:3})})),n("span",{children:"Select all"})]}))})),N.map(function(l,i){if("configurable"!==l.type)return null;var r=(l.options||[]).filter(function(e){return e.selected}).length;return l.tag,t("div",e({className:s.categorySection},{children:[t("div",e({className:s.categoryHeader},{children:[n("span",e({className:s.categoryLabel},{children:l.label})),t("span",e({className:s.categoryCount},{children:[r," selected"]}))]})),n("div",e({className:s.pillsRow},{children:(l.options||[]).map(function(l){return t("button",e({type:"button",className:"".concat(s.pill," ").concat(l.selected?s.pillSelected:s.pillDeselected),onClick:function(){return function(n,t){C(function(l){return l.map(function(l,i){return i!==n?l:e(e({},l),{options:l.options.map(function(n){return n.id===t?e(e({},n),{selected:!n.selected}):n})})})})}(i,l.id)}},{children:[l.selected&&n(a,{size:13,strokeWidth:2.5,className:s.checkIcon}),n("span",{children:l.value})]}),l.id)})}))]}),l.tag||"cat-".concat(i))})]})),t("div",e({className:s.footer},{children:[n("button",e({type:"button",className:s.cancelButton,onClick:m,disabled:v},{children:"Cancel"})),n("button",e({type:"button",className:s.continueButton,onClick:function(){var e=o(N,k);p(e)},disabled:v},{children:v?"Preparing...":"Continue to Generate Learning"}))]}))]}))}))};export{d as ReviewLearningConditionsModal,d as default};
2
+ //# sourceMappingURL=ReviewLearningConditionsModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReviewLearningConditionsModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ var e={overlay:"ReviewLearningConditionsModal-module_overlay__7x4JS",fadeIn:"ReviewLearningConditionsModal-module_fadeIn__M5tiM",modal:"ReviewLearningConditionsModal-module_modal__b6vcs",slideUp:"ReviewLearningConditionsModal-module_slideUp__I1z5s",header:"ReviewLearningConditionsModal-module_header__H37IG",title:"ReviewLearningConditionsModal-module_title__IxeAR",subtitle:"ReviewLearningConditionsModal-module_subtitle__UfjDL",closeButton:"ReviewLearningConditionsModal-module_closeButton__P1hJi",body:"ReviewLearningConditionsModal-module_body__ZXzL-",inferredCard:"ReviewLearningConditionsModal-module_inferredCard__JFTxd",inferredLabel:"ReviewLearningConditionsModal-module_inferredLabel__saLT7",inferredText:"ReviewLearningConditionsModal-module_inferredText__WNLhx",categorySection:"ReviewLearningConditionsModal-module_categorySection__AILgJ",categoryHeader:"ReviewLearningConditionsModal-module_categoryHeader__LaW5a",categoryLabel:"ReviewLearningConditionsModal-module_categoryLabel__H4Nn9",categoryCount:"ReviewLearningConditionsModal-module_categoryCount__opzUO",selectAllRow:"ReviewLearningConditionsModal-module_selectAllRow__-H8PS",selectAllControl:"ReviewLearningConditionsModal-module_selectAllControl__NUtrJ",selectAllCheckbox:"ReviewLearningConditionsModal-module_selectAllCheckbox__eOk-V",selectAllCheckboxChecked:"ReviewLearningConditionsModal-module_selectAllCheckboxChecked__BG0OE",pillsRow:"ReviewLearningConditionsModal-module_pillsRow__DLqtd",pill:"ReviewLearningConditionsModal-module_pill__qPAoB",pillSelected:"ReviewLearningConditionsModal-module_pillSelected__hd3EE",pillDeselected:"ReviewLearningConditionsModal-module_pillDeselected__Fkbfn",checkIcon:"ReviewLearningConditionsModal-module_checkIcon__yWJ7l",addButton:"ReviewLearningConditionsModal-module_addButton__kpXy1",addInputContainer:"ReviewLearningConditionsModal-module_addInputContainer__rkGYe",addInput:"ReviewLearningConditionsModal-module_addInput__lIcIg",addConfirmButton:"ReviewLearningConditionsModal-module_addConfirmButton__HczRO",addCancelButton:"ReviewLearningConditionsModal-module_addCancelButton__XigwV",footer:"ReviewLearningConditionsModal-module_footer__7FiJ7",cancelButton:"ReviewLearningConditionsModal-module_cancelButton__OqwLc",continueButton:"ReviewLearningConditionsModal-module_continueButton__dNBHk"};export{e as default};
2
+ //# sourceMappingURL=ReviewLearningConditionsModal.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReviewLearningConditionsModal.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ function e(e){return e?e.replace(/[_-]+/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}).trim():""}function t(e){return e?e.replace(/<[^>]+>/g,"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim():""}function n(e){for(var t,n,c,r={},l=/([a-zA-Z_:][-\w:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;null!==(c=l.exec(e));)r[c[1].toLowerCase()]=null!==(n=null!==(t=c[2])&&void 0!==t?t:c[3])&&void 0!==n?n:"";return r}function c(c){if(!c||"string"!=typeof c)return{categories:[],ruleAction:""};var r="New rule.",l=c.match(/<rule_action>\s*<p>\s*<b>RULE ACTION<\/b>\s*<br\s*\/?>\s*([\s\S]*?)\s*<\/p>\s*<\/rule_action>/i)||c.match(/<rule_action>([\s\S]*?)<\/rule_action>/i);l&&l[1]&&(r=t(l[1]).replace(/^RULE ACTION\s*/i,"").trim());for(var o,a=c.match(/<suggested_rule>([\s\S]*?)<\/suggested_rule>/i),i=a?a[1]:c,u=[],s=/<condition\b([^>]*)>([\s\S]*?)<\/condition>/gi,p=0;null!==(o=s.exec(i));){var g=n(o[1]),f=o[2],b=f.indexOf(":"),v=b>-1?t(f.slice(0,b)):"",d=b>-1?f.slice(b+1):f,h=g.id||v.toLowerCase().replace(/[\s-]+/g,"_").replace(/[^a-z0-9_]/g,"")||"condition_".concat(p);if(p+=1,"configurable"===g.type||"static"!==g.type&&/<option\b/i.test(d)){for(var _=[],m=/<option\b([^>]*)>([\s\S]*?)<\/option>/gi,x=void 0;null!==(x=m.exec(d));){var S=t(x[2]);S&&_.push({id:"".concat(h,"_").concat(_.length),value:S,selected:!1})}0!==_.length&&u.push({tag:h,label:v||e(h),type:"configurable",options:_})}else u.push({tag:h,label:v,type:"static",text:t(d),options:[]})}return{categories:u,ruleAction:r}}function r(e){var t,n,c=(e.options||[]).filter(function(e){return e.selected}).map(function(e){return e.value.trim()}).filter(Boolean);return 0===c.length?"":1===c.length?c[0]:(t=c).length<=1?null!==(n=t[0])&&void 0!==n?n:"":2===t.length?"".concat(t[0]," and ").concat(t[1]):"".concat(t.slice(0,-1).join(", "),", and ").concat(t[t.length-1])}function l(e,t){void 0===t&&(t="New rule.");var n="";if(t&&(n+="<p><b>RULE ACTION</b><br>".concat(t,"</p>")),e&&e.length>0){n+="<p><b>SUGGESTED RULE</b></p><ul>";for(var c=0,l=e;c<l.length;c++){var o=l[c],a=o.label?"".concat(o.label,": "):"";if("static"!==o.type){var i=r(o);i&&(n+="<li>".concat(a).concat(i,".</li>"))}else o.text&&(n+="<li>".concat(a).concat(o.text,"</li>"))}n+="</ul>"}return n}export{l as buildDraftMessage,e as formatTagLabel,c as parseSuggestedRule};
2
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{createContext as r,useContext as t}from"react";var n=r(void 0);function o(r){var o=t(n);return null!=r?r:o}function a(r){return r?{Authorization:"Bearer ".concat(r)}:{}}export{n as AccessTokenContext,a as authHeader,o as useAccessToken};
2
+ //# sourceMappingURL=accessToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessToken.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{__awaiter as e,__generator as n,__spreadArray as r}from"../../_virtual/_tslib.js";import{useState as t,useRef as o,useCallback as i,useEffect as a}from"react";function s(e,n){var r,t,o;return{id:null!==(r=e.humanChangeId)&&void 0!==r?r:"row_".concat(n),humanChangeId:e.humanChangeId,humanChangeScopeId:e.humanChangeScopeId,intentId:e.intentId,scopeId:e.scopeId,scopeName:e.scopeName,level:e.level,title:null!==(o=null!==(t=e.title)&&void 0!==t?t:e.summary)&&void 0!==o?o:"—",summary:e.summary,frequency:e.occurrenceFrequency,reviewStatus:e.reviewStatus,impactLabel:e.impactLabel,kpi:e.kpi,blastRadius:e.blastRadius,hasChildren:e.hasChildren,childrenCount:e.childrenCount,cognitiveDecisioning:e.cognitiveDecisioning,raw:e}}function c(c){var u=this,l=c.baseUrl,d=c.endpoint,h=c.humanChangeConfigId,f=c.eventId,g=c.filters,v=c.pageSize,p=void 0===v?12:v,m=t([]),y=m[0],b=m[1],w=t(!1),I=w[0],C=w[1],S=t(!1),x=S[0],N=S[1],A=t(null),O=A[0],j=A[1],E=t(!0),T=E[0],P=E[1],_=o(void 0),J=o(0),k=o(null),F=l&&d?"".concat(l).concat(d):void 0,M=i(function(t){return e(u,void 0,void 0,function(){var e,o,i,a,c,u,l,d,v,m,y,w,I;return n(this,function(n){switch(n.label){case 0:if(!F||!h)return[2];null===(I=k.current)||void 0===I||I.abort(),e=new AbortController,k.current=e,o=++J.current,t.append?N(!0):C(!0),j(null),n.label=1;case 1:return n.trys.push([1,4,5,6]),i={humanIntelligentConfigId:h,filters:g,pageSize:p},f&&(i.event_id=f),t.append&&_.current&&(i.cursor=_.current),[4,fetch(F,{method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i),signal:e.signal})];case 2:if(!(a=n.sent()).ok)throw new Error("Request failed: ".concat(a.status," ").concat(a.statusText));return[4,a.json()];case 3:if(c=n.sent(),o!==J.current)return[2];if(!1===(null==c?void 0:c.success))throw new Error("string"==typeof c.error?c.error:"Fetching human changes failed.");return u=function(e){var n,r;return null!==(r=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.humanChanges)&&void 0!==r?r:[]}(c),l=u.map(s),d=function(e,n){var r,t,o,i=null!==(t=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.nextCursor)&&void 0!==t?t:null,a=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pageSize;return{nextCursor:i,hasMore:!!i&&n>0&&("number"==typeof a?n>=a:n>0)}}(c,u.length),v=d.nextCursor,m=d.hasMore,y=!v||v!==_.current,_.current=null!=v?v:void 0,b(function(e){return t.append?r(r([],e,!0),l,!0):l}),P(m&&y),[3,6];case 4:return w=n.sent(),e.signal.aborted||o!==J.current?[2]:(j(w),t.append||b([]),P(!1),[3,6]);case 5:return e.signal.aborted||o!==J.current||(C(!1),N(!1)),k.current===e&&(k.current=null),[7];case 6:return[2]}})})},[F,h,f,JSON.stringify(g),p]);a(function(){_.current=void 0,P(!0),M({append:!1})},[F,h,f,JSON.stringify(g),p]),a(function(){return function(){var e;return null===(e=k.current)||void 0===e?void 0:e.abort()}},[]);var z=i(function(){I||x||!T||M({append:!0})},[I,x,T,M]),L=i(function(){_.current=void 0,P(!0),M({append:!1})},[M]);return{rows:y,loading:I,loadingMore:x,hasMore:T,fetchMore:z,refetch:L,error:O}}var u=new Map;function l(r){var o=this,s=r.baseUrl,c=r.humanIntelligentConfigId,l=r.segmentIds,d=r.skip,h=void 0!==d&&d,f=t([]),g=f[0],v=f[1],p=t(!1),m=p[0],y=p[1],b=t(null),w=b[0],I=b[1],C=t(0),S=C[0],x=C[1],N=i(function(){return x(function(e){return e+1})},[]);return a(function(){var r=!0;if(h||!s||!c||0===(null==l?void 0:l.length))return v([]),y(!1),void I(null);return e(o,void 0,void 0,function(){var t,o,i,a,d,h=this;return n(this,function(f){switch(f.label){case 0:y(!0),I(null),t={humanIntelligentConfigId:c,segment_ids:l},o="segment-details:".concat(s,":").concat(JSON.stringify(t)),f.label=1;case 1:return f.trys.push([1,3,4,5]),u.has(o)||(i=fetch("".concat(s,"/federated/human_change_config_filters/segment-details"),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify(t)}).then(function(r){return e(h,void 0,void 0,function(){var e,t;return n(this,function(n){switch(n.label){case 0:if(!r.ok)throw new Error("Failed to fetch segment details: ".concat(r.statusText));return[4,r.json()];case 1:if((e=n.sent()).success&&e.data&&Array.isArray(e.data.segments))return[2,e.data.segments];throw new Error((null===(t=e.error)||void 0===t?void 0:t.errorMessage)||"Invalid API response format")}})})}).catch(function(e){throw u.delete(o),e}),u.set(o,i)),[4,u.get(o)];case 2:return a=f.sent(),r?(v(a),[3,5]):[2];case 3:return d=f.sent(),r&&(console.error("Error fetching citation segments:",d),I(d.message||"An error occurred while fetching citation data."),v([])),[3,5];case 4:return r&&y(!1),[7];case 5:return[2]}})}),function(){r=!1}},[s,c,JSON.stringify(l),h,S]),{data:g,loading:m,error:w,refetch:N}}function d(s){var c=this,u=s.baseUrl,l=s.configId,d=s.changeLogIds,h=s.skip,f=void 0!==h&&h,g=t([]),v=g[0],p=g[1],m=t(!1),y=m[0],b=m[1],w=t(null),I=w[0],C=w[1],S=t(0),x=S[0],N=S[1],A=i(function(){return N(function(e){return e+1})},[]),O=t(null),j=O[0],E=O[1],T=t(!0),P=T[0],_=T[1],J=t(!1),k=J[0],F=J[1],M=t(null),z=M[0],L=M[1],U=o(!1);a(function(){if(p([]),E(null),_(!0),C(null),L(null),!f&&u&&l&&0!==d.length){var r=!0;return e(c,void 0,void 0,function(){var e,t,o,i,a,s,c;return n(this,function(n){switch(n.label){case 0:b(!0),U.current=!0,n.label=1;case 1:return n.trys.push([1,4,5,6]),e={configId:l,changeLogIds:d,orderBy:"latestFirst",pageSize:15},[4,fetch("".concat(u,"/changelog/audit-log/fetch-by-ids"),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify(e)})];case 2:if(!(t=n.sent()).ok)throw new Error("Failed to fetch changelogs: ".concat(t.statusText));return[4,t.json()];case 3:if(o=n.sent(),!r)return[2];if(!1===o.success)throw new Error((null===(c=o.error)||void 0===c?void 0:c.errorMessage)||o.error||"Invalid API response format");return i=o.data||o,a=Array.isArray(i.items)?i.items:Array.isArray(i)?i:[],p(a),E(i.nextCursor||null),_(!!i.hasNext),[3,6];case 4:return s=n.sent(),r&&(console.error("Error fetching changelogs:",s),C(s.message||"An error occurred while fetching changelogs.")),[3,6];case 5:return r&&(b(!1),U.current=!1),[7];case 6:return[2]}})}),function(){r=!1}}b(!1)},[u,l,JSON.stringify(d),f,x]);var q=i(function(){return e(c,void 0,void 0,function(){var e,t,o,i,a,s,c;return n(this,function(n){switch(n.label){case 0:if(f||!u||!l||0===d.length||!P||U.current)return[2];U.current=!0,F(!0),L(null),n.label=1;case 1:return n.trys.push([1,4,5,6]),e={configId:l,changeLogIds:d,orderBy:"latestFirst",pageSize:15},j&&(e.cursor=j),[4,fetch("".concat(u,"/changelog/audit-log/fetch-by-ids"),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify(e)})];case 2:if(!(t=n.sent()).ok)throw new Error("Failed to fetch changelogs: ".concat(t.statusText));return[4,t.json()];case 3:if(!1===(o=n.sent()).success)throw new Error((null===(c=o.error)||void 0===c?void 0:c.errorMessage)||o.error||"Invalid API response format");return i=o.data||o,a=Array.isArray(i.items)?i.items:Array.isArray(i)?i:[],p(function(e){return r(r([],e,!0),a,!0)}),E(i.nextCursor||null),_(!!i.hasNext),[3,6];case 4:return s=n.sent(),console.error("Error fetching next changelogs page:",s),L(s.message||"Failed to fetch more logs."),[3,6];case 5:return F(!1),U.current=!1,[7];case 6:return[2]}})})},[u,l,JSON.stringify(d),f,P,j]);return{data:v,loading:y,error:I,fetchNextPage:q,hasNextPage:P,isFetchingNextPage:k,fetchNextPageError:z,refetch:A}}function h(r){var o=this,s=r.baseUrl,c=r.humanIntelligentConfigId,l=r.agentConfig,d=r.skip,h=void 0!==d&&d,f=t(""),g=f[0],v=f[1],p=t(!1),m=p[0],y=p[1],b=t(null),w=b[0],I=b[1],C=t(0),S=C[0],x=C[1],N=i(function(){return x(function(e){return e+1})},[]);return a(function(){var r=!0;if(h||!s||!c||!l)return v(""),y(!1),void I(null);return e(o,void 0,void 0,function(){var t,o,i,a,d,h=this;return n(this,function(f){switch(f.label){case 0:y(!0),I(null),t={humanIntelligentConfigId:c,agentConfig:l},o="business-context:".concat(s,":").concat(JSON.stringify(t)),f.label=1;case 1:return f.trys.push([1,3,4,5]),u.has(o)||(i=fetch("".concat(s,"/federated/human_change_config_filters/business-context"),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify(t)}).then(function(r){return e(h,void 0,void 0,function(){var e,t;return n(this,function(n){switch(n.label){case 0:if(!r.ok)throw new Error("Failed to fetch business context: ".concat(r.statusText));return[4,r.json()];case 1:if((e=n.sent()).success&&e.data&&e.data.business_context)return[2,e.data.business_context];throw new Error((null===(t=e.error)||void 0===t?void 0:t.errorMessage)||"Invalid API response format")}})})}).catch(function(e){throw u.delete(o),e}),u.set(o,i)),[4,u.get(o)];case 2:return a=f.sent(),r?(v(a),[3,5]):[2];case 3:return d=f.sent(),r&&(console.error("Error fetching business context:",d),I(d.message||"An error occurred while fetching business context."),v("")),[3,5];case 4:return r&&y(!1),[7];case 5:return[2]}})}),function(){r=!1}},[s,c,l,h,S]),{data:g,loading:m,error:w,refetch:N}}export{h as useBusinessContextData,d as useCitationChangelogs,l as useCitationSegments,c as useHumanChangesData};
1
+ import{__awaiter as e,__generator as n,__spreadArray as r,__assign as t}from"../../_virtual/_tslib.js";import{useState as o,useRef as i,useCallback as a,useEffect as s}from"react";import{useAccessToken as c,authHeader as u}from"./accessToken.js";function l(e,n){var r,t,o;return{id:null!==(r=e.humanChangeId)&&void 0!==r?r:"row_".concat(n),humanChangeId:e.humanChangeId,humanChangeScopeId:e.humanChangeScopeId,intentId:e.intentId,scopeId:e.scopeId,scopeName:e.scopeName,level:e.level,title:null!==(o=null!==(t=e.title)&&void 0!==t?t:e.summary)&&void 0!==o?o:"—",summary:e.summary,frequency:e.occurrenceFrequency,reviewStatus:e.reviewStatus,impactLabel:e.impactLabel,kpi:e.kpi,blastRadius:e.blastRadius,hasChildren:e.hasChildren,childrenCount:e.childrenCount,cognitiveDecisioning:e.cognitiveDecisioning,raw:e}}function d(d){var h=this,f=d.baseUrl,g=d.endpoint,v=d.accessToken,p=d.humanChangeConfigId,m=d.eventId,y=d.filters,b=d.pageSize,w=void 0===b?12:b,I=c(v),C=o([]),S=C[0],x=C[1],N=o(!1),T=N[0],A=N[1],j=o(!1),O=j[0],k=j[1],E=o(null),P=E[0],_=E[1],J=o(!0),F=J[0],M=J[1],z=i(void 0),L=i(0),U=i(null),q=f&&g?"".concat(f).concat(g):void 0,R=a(function(o){return e(h,void 0,void 0,function(){var e,i,a,s,c,d,h,f,g,v,b,C,S;return n(this,function(n){switch(n.label){case 0:if(!q||!p)return[2];null===(S=U.current)||void 0===S||S.abort(),e=new AbortController,U.current=e,i=++L.current,o.append?k(!0):A(!0),_(null),n.label=1;case 1:return n.trys.push([1,4,5,6]),a={humanIntelligentConfigId:p,filters:y,pageSize:w},m&&(a.event_id=m),o.append&&z.current&&(a.cursor=z.current),[4,fetch(q,{method:"POST",headers:t({accept:"application/json","Content-Type":"application/json"},u(I)),body:JSON.stringify(a),signal:e.signal})];case 2:if(!(s=n.sent()).ok)throw new Error("Request failed: ".concat(s.status," ").concat(s.statusText));return[4,s.json()];case 3:if(c=n.sent(),i!==L.current)return[2];if(!1===(null==c?void 0:c.success))throw new Error("string"==typeof c.error?c.error:"Fetching human changes failed.");return d=function(e){var n,r;return null!==(r=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.humanChanges)&&void 0!==r?r:[]}(c),h=d.map(l),f=function(e,n){var r,t,o,i=null!==(t=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.nextCursor)&&void 0!==t?t:null,a=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.pageSize;return{nextCursor:i,hasMore:!!i&&n>0&&("number"==typeof a?n>=a:n>0)}}(c,d.length),g=f.nextCursor,v=f.hasMore,b=!g||g!==z.current,z.current=null!=g?g:void 0,x(function(e){return o.append?r(r([],e,!0),h,!0):h}),M(v&&b),[3,6];case 4:return C=n.sent(),e.signal.aborted||i!==L.current?[2]:(_(C),o.append||x([]),M(!1),[3,6]);case 5:return e.signal.aborted||i!==L.current||(A(!1),k(!1)),U.current===e&&(U.current=null),[7];case 6:return[2]}})})},[q,I,p,m,JSON.stringify(y),w]);s(function(){z.current=void 0,M(!0),R({append:!1})},[q,I,p,m,JSON.stringify(y),w]),s(function(){return function(){var e;return null===(e=U.current)||void 0===e?void 0:e.abort()}},[]);var B=a(function(){T||O||!F||R({append:!0})},[T,O,F,R]),D=a(function(){z.current=void 0,M(!0),R({append:!1})},[R]);return{rows:S,loading:T,loadingMore:O,hasMore:F,fetchMore:B,refetch:D,error:P}}var h=new Map;function f(r){var i=this,l=r.baseUrl,d=r.accessToken,f=r.humanIntelligentConfigId,g=r.segmentIds,v=r.skip,p=void 0!==v&&v,m=c(d),y=o([]),b=y[0],w=y[1],I=o(!1),C=I[0],S=I[1],x=o(null),N=x[0],T=x[1],A=o(0),j=A[0],O=A[1],k=a(function(){return O(function(e){return e+1})},[]);return s(function(){var r=!0;if(p||!l||!f||0===(null==g?void 0:g.length))return w([]),S(!1),void T(null);return e(i,void 0,void 0,function(){var o,i,a,s,c,d=this;return n(this,function(v){switch(v.label){case 0:S(!0),T(null),o={humanIntelligentConfigId:f,segment_ids:g},i="segment-details:".concat(l,":").concat(JSON.stringify(o)),v.label=1;case 1:return v.trys.push([1,3,4,5]),h.has(i)||(a=fetch("".concat(l,"/federated/human_change_config_filters/segment-details"),{method:"POST",headers:t({"Content-Type":"application/json",accept:"application/json"},u(m)),body:JSON.stringify(o)}).then(function(r){return e(d,void 0,void 0,function(){var e,t;return n(this,function(n){switch(n.label){case 0:if(!r.ok)throw new Error("Failed to fetch segment details: ".concat(r.statusText));return[4,r.json()];case 1:if((e=n.sent()).success&&e.data&&Array.isArray(e.data.segments))return[2,e.data.segments];throw new Error((null===(t=e.error)||void 0===t?void 0:t.errorMessage)||"Invalid API response format")}})})}).catch(function(e){throw h.delete(i),e}),h.set(i,a)),[4,h.get(i)];case 2:return s=v.sent(),r?(w(s),[3,5]):[2];case 3:return c=v.sent(),r&&(console.error("Error fetching citation segments:",c),T(c.message||"An error occurred while fetching citation data."),w([])),[3,5];case 4:return r&&S(!1),[7];case 5:return[2]}})}),function(){r=!1}},[l,m,f,JSON.stringify(g),p,j]),{data:b,loading:C,error:N,refetch:k}}function g(l){var d=this,h=l.baseUrl,f=l.accessToken,g=l.configId,v=l.changeLogIds,p=l.skip,m=void 0!==p&&p,y=c(f),b=o([]),w=b[0],I=b[1],C=o(!1),S=C[0],x=C[1],N=o(null),T=N[0],A=N[1],j=o(0),O=j[0],k=j[1],E=a(function(){return k(function(e){return e+1})},[]),P=o(null),_=P[0],J=P[1],F=o(!0),M=F[0],z=F[1],L=o(!1),U=L[0],q=L[1],R=o(null),B=R[0],D=R[1],G=i(!1);s(function(){if(I([]),J(null),z(!0),A(null),D(null),!m&&h&&g&&0!==v.length){var r=!0;return e(d,void 0,void 0,function(){var e,o,i,a,s,c,l;return n(this,function(n){switch(n.label){case 0:x(!0),G.current=!0,n.label=1;case 1:return n.trys.push([1,4,5,6]),e={configId:g,changeLogIds:v,orderBy:"latestFirst",pageSize:15},[4,fetch("".concat(h,"/changelog/audit-log/fetch-by-ids"),{method:"POST",headers:t({"Content-Type":"application/json",accept:"application/json"},u(y)),body:JSON.stringify(e)})];case 2:if(!(o=n.sent()).ok)throw new Error("Failed to fetch changelogs: ".concat(o.statusText));return[4,o.json()];case 3:if(i=n.sent(),!r)return[2];if(!1===i.success)throw new Error((null===(l=i.error)||void 0===l?void 0:l.errorMessage)||i.error||"Invalid API response format");return a=i.data||i,s=Array.isArray(a.items)?a.items:Array.isArray(a)?a:[],I(s),J(a.nextCursor||null),z(!!a.hasNext),[3,6];case 4:return c=n.sent(),r&&(console.error("Error fetching changelogs:",c),A(c.message||"An error occurred while fetching changelogs.")),[3,6];case 5:return r&&(x(!1),G.current=!1),[7];case 6:return[2]}})}),function(){r=!1}}x(!1)},[h,y,g,JSON.stringify(v),m,O]);var H=a(function(){return e(d,void 0,void 0,function(){var e,o,i,a,s,c,l;return n(this,function(n){switch(n.label){case 0:if(m||!h||!g||0===v.length||!M||G.current)return[2];G.current=!0,q(!0),D(null),n.label=1;case 1:return n.trys.push([1,4,5,6]),e={configId:g,changeLogIds:v,orderBy:"latestFirst",pageSize:15},_&&(e.cursor=_),[4,fetch("".concat(h,"/changelog/audit-log/fetch-by-ids"),{method:"POST",headers:t({"Content-Type":"application/json",accept:"application/json"},u(y)),body:JSON.stringify(e)})];case 2:if(!(o=n.sent()).ok)throw new Error("Failed to fetch changelogs: ".concat(o.statusText));return[4,o.json()];case 3:if(!1===(i=n.sent()).success)throw new Error((null===(l=i.error)||void 0===l?void 0:l.errorMessage)||i.error||"Invalid API response format");return a=i.data||i,s=Array.isArray(a.items)?a.items:Array.isArray(a)?a:[],I(function(e){return r(r([],e,!0),s,!0)}),J(a.nextCursor||null),z(!!a.hasNext),[3,6];case 4:return c=n.sent(),console.error("Error fetching next changelogs page:",c),D(c.message||"Failed to fetch more logs."),[3,6];case 5:return q(!1),G.current=!1,[7];case 6:return[2]}})})},[h,y,g,JSON.stringify(v),m,M,_]);return{data:w,loading:S,error:T,fetchNextPage:H,hasNextPage:M,isFetchingNextPage:U,fetchNextPageError:B,refetch:E}}function v(r){var i=this,l=r.baseUrl,d=r.accessToken,f=r.humanIntelligentConfigId,g=r.agentConfig,v=r.skip,p=void 0!==v&&v,m=c(d),y=o(""),b=y[0],w=y[1],I=o(!1),C=I[0],S=I[1],x=o(null),N=x[0],T=x[1],A=o(0),j=A[0],O=A[1],k=a(function(){return O(function(e){return e+1})},[]);return s(function(){var r=!0;if(p||!l||!f||!g)return w(""),S(!1),void T(null);return e(i,void 0,void 0,function(){var o,i,a,s,c,d=this;return n(this,function(v){switch(v.label){case 0:S(!0),T(null),o={humanIntelligentConfigId:f,agentConfig:g},i="business-context:".concat(l,":").concat(JSON.stringify(o)),v.label=1;case 1:return v.trys.push([1,3,4,5]),h.has(i)||(a=fetch("".concat(l,"/federated/human_change_config_filters/business-context"),{method:"POST",headers:t({"Content-Type":"application/json",accept:"application/json"},u(m)),body:JSON.stringify(o)}).then(function(r){return e(d,void 0,void 0,function(){var e,t;return n(this,function(n){switch(n.label){case 0:if(!r.ok)throw new Error("Failed to fetch business context: ".concat(r.statusText));return[4,r.json()];case 1:if((e=n.sent()).success&&e.data&&e.data.business_context)return[2,e.data.business_context];throw new Error((null===(t=e.error)||void 0===t?void 0:t.errorMessage)||"Invalid API response format")}})})}).catch(function(e){throw h.delete(i),e}),h.set(i,a)),[4,h.get(i)];case 2:return s=v.sent(),r?(w(s),[3,5]):[2];case 3:return c=v.sent(),r&&(console.error("Error fetching business context:",c),T(c.message||"An error occurred while fetching business context."),w("")),[3,5];case 4:return r&&S(!1),[7];case 5:return[2]}})}),function(){r=!1}},[l,m,f,g,p,j]),{data:b,loading:C,error:N,refetch:k}}export{v as useBusinessContextData,g as useCitationChangelogs,f as useCitationSegments,d as useHumanChangesData};
2
2
  //# sourceMappingURL=useHumanChangesData.js.map
@@ -1,2 +1,2 @@
1
- import{__spreadArray as e,__assign as n}from"../../_virtual/_tslib.js";import t from"react";var r=new Set(["b","strong","i","em","u","s","del","ins","mark","code","small","sub","sup","span","br","p","ul","ol","li"]),i=new Set(["br"]),a={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};var o=/<(\/?)([a-zA-Z][a-zA-Z0-9]*)([^>]*)>/g;function l(l,c){if(void 0===c&&(c={}),"string"!=typeof l)return l;if(!/[<&]/.test(l))return l;var s,u=c.classNames,f=void 0===u?{}:u,p={tag:null,children:[]},h=[p],d=function(){return h[h.length-1]},g=0,m=0,v=function(e){e&&d().children.push(e.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g,function(e,n){if("#"===n[0]){var t="x"===n[1]||"X"===n[1]?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return Number.isFinite(t)&&t>0?String.fromCodePoint(t):e}var r=a[n.toLowerCase()];return void 0===r?e:r}))},x=function(){var r=h.pop(),i=r.tag,a=f[i];d().children.push(t.createElement.apply(t,e([i,n({key:"".concat(i,"-").concat(m++)},a?{className:a}:{})],r.children,!1)))};o.lastIndex=0;for(var b=function(){var e=s[0],n=s[1],a=s[2].toLowerCase();if(!r.has(a))return"continue";if(v(l.slice(g,s.index)),g=s.index+e.length,i.has(a))return d().children.push(t.createElement(a,{key:"".concat(a,"-").concat(m++)})),"continue";if(n){var o=h.findIndex(function(e){return e.tag===a});if(o>0)for(;h.length>o;)x();return"continue"}h.push({tag:a,children:[]})};s=o.exec(l);)b();for(v(l.slice(g));h.length>1;)x();var y=p.children;return y.length?1===y.length&&"string"==typeof y[0]?y[0]:t.createElement.apply(t,e([t.Fragment,null],y,!1)):""}export{l as renderInlineMarkup};
1
+ import{__spreadArray as e,__assign as t}from"../../_virtual/_tslib.js";import n from"react";var a=new Set(["b","strong","i","em","u","s","del","ins","mark","code","small","sub","sup","span","br","p","ul","ol","li"]),r={condition:"span",option:"span"},i=new Set(["id","type","total","rank","count","pct","label"]),l=new Set(["br"]),o=new Set(["summary_payload","summary_context","what_happened","impact","where_it_applies","exemptions","tier","caution","rule_recommendation","rule_action","suggested_rule"]),s=new Set(["ul","ol"]),c={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};function u(e){return e.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g,function(e,t){if("#"===t[0]){var n="x"===t[1]||"X"===t[1]?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)&&n>0?String.fromCodePoint(n):e}var a=c[t.toLowerCase()];return void 0===a?e:a})}var p=/<(\/?)([a-zA-Z][a-zA-Z0-9]*)([^>]*)>/g,d=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;function f(e){var t,n,a,r,l={};for(d.lastIndex=0;r=d.exec(e);){var o=null===(t=r[1])||void 0===t?void 0:t.toLowerCase();o&&i.has(o)&&(l["data-".concat(o)]=u(null!==(a=null!==(n=r[2])&&void 0!==n?n:r[3])&&void 0!==a?a:""))}return l}function h(i,c){if(void 0===c&&(c={}),"string"!=typeof i)return i;if(!/[<&]/.test(i))return i;var d,h=c.classNames,g=void 0===h?{}:h,m=c.stripUnknownTags,v=void 0!==m&&m,x={tag:null,attrs:{},children:[]},_=[x],w=function(){return _[_.length-1]},y=0,b=0,k=function(e){var t;e&&(s.has(null!==(t=w().tag)&&void 0!==t?t:"")&&!e.trim()||w().children.push(u(e)))},A=function(){var a=_.pop(),i=a.tag,l=r[i],o=g[i],s=t(t(t({key:"".concat(i,"-").concat(b++)},o?{className:o}:{}),l?{"data-tag":i}:{}),a.attrs);w().children.push(n.createElement.apply(n,e([null!=l?l:i,s],a.children,!1)))};for(p.lastIndex=0;d=p.exec(i);){var S=d[0],z=d[1],Z=d[2],C=d[3],I=void 0===C?"":C,E=Z.toLowerCase(),F=a.has(E)||E in r;if(F||!o.has(E)&&!v){if(F)if(k(i.slice(y,d.index)),y=d.index+S.length,l.has(E))w().children.push(n.createElement(E,{key:"".concat(E,"-").concat(b++)}));else if(z){for(var L=-1,N=_.length-1;N>0;N--)if(_[N].tag===E){L=N;break}if(L>0)for(;_.length>L;)A()}else _.push({tag:E,attrs:E in r?f(I):{},children:[]}),/\/\s*$/.test(I)&&A()}else k(i.slice(y,d.index)),y=d.index+S.length}for(k(i.slice(y));_.length>1;)A();var j=x.children;return j.length?1===j.length&&"string"==typeof j[0]?j[0]:n.createElement.apply(n,e([n.Fragment,null],j,!1)):""}export{h as renderInlineMarkup};
2
2
  //# sourceMappingURL=inlineMarkup.js.map