@watermarkinsights/ripple 5.7.0-9 → 5.8.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/cjs/{global-80ed0881.js → global-541becf9.js} +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/priv-option-list.cjs.entry.js +13 -2
  4. package/dist/cjs/ripple.cjs.js +1 -1
  5. package/dist/cjs/wm-line-chart.cjs.entry.js +19 -38
  6. package/dist/cjs/wm-modal-pss_3.cjs.entry.js +24 -23
  7. package/dist/collection/components/charts/wm-line-chart/wm-line-chart.js +19 -38
  8. package/dist/collection/components/selects/priv-option-list/priv-option-list.css +10 -0
  9. package/dist/collection/components/selects/priv-option-list/priv-option-list.js +12 -1
  10. package/dist/collection/components/wm-modal-pss/wm-modal-pss-footer.css +12 -0
  11. package/dist/collection/components/wm-modal-pss/wm-modal-pss-footer.js +1 -1
  12. package/dist/collection/components/wm-modal-pss/wm-modal-pss-header.css +12 -0
  13. package/dist/collection/components/wm-modal-pss/wm-modal-pss-header.js +3 -2
  14. package/dist/collection/components/wm-modal-pss/wm-modal-pss.css +16 -2
  15. package/dist/collection/components/wm-modal-pss/wm-modal-pss.js +12 -11
  16. package/dist/collection/dev/pss-modal.js +8 -0
  17. package/dist/collection/dev/scripts.js +12 -15
  18. package/dist/esm/{chartFunctions-dfcb1edf.js → chartFunctions-34f19953.js} +1 -1
  19. package/dist/esm/{functions-b791a892.js → functions-8800c690.js} +1 -1
  20. package/dist/esm/{global-525745d2.js → global-3ec0570b.js} +1 -1
  21. package/dist/esm/{intl-f2f7ce8b.js → intl-b110ca8d.js} +1 -1
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/priv-calendar.entry.js +1 -1
  24. package/dist/esm/priv-chart-popover.entry.js +1 -1
  25. package/dist/esm/priv-option-list.entry.js +14 -3
  26. package/dist/esm/ripple.js +1 -1
  27. package/dist/esm/wm-action-menu_2.entry.js +1 -1
  28. package/dist/esm/wm-button.entry.js +1 -1
  29. package/dist/esm/wm-chart.entry.js +3 -3
  30. package/dist/esm/wm-date-range.entry.js +1 -1
  31. package/dist/esm/wm-datepicker.entry.js +1 -1
  32. package/dist/esm/wm-file.entry.js +1 -1
  33. package/dist/esm/wm-input.entry.js +2 -2
  34. package/dist/esm/wm-line-chart.entry.js +22 -41
  35. package/dist/esm/wm-modal-pss_3.entry.js +22 -21
  36. package/dist/esm/wm-modal_3.entry.js +2 -2
  37. package/dist/esm/wm-navigation_3.entry.js +2 -2
  38. package/dist/esm/wm-navigator.entry.js +1 -1
  39. package/dist/esm/wm-nested-select.entry.js +2 -2
  40. package/dist/esm/wm-optgroup.entry.js +1 -1
  41. package/dist/esm/wm-option_2.entry.js +2 -2
  42. package/dist/esm/wm-pagination.entry.js +1 -1
  43. package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
  44. package/dist/esm/wm-search.entry.js +2 -2
  45. package/dist/esm/wm-snackbar.entry.js +2 -2
  46. package/dist/esm/wm-tab-item_3.entry.js +1 -1
  47. package/dist/esm/wm-tag-input.entry.js +2 -2
  48. package/dist/esm/wm-tag-option.entry.js +1 -1
  49. package/dist/esm/wm-textarea.entry.js +2 -2
  50. package/dist/esm/wm-timepicker.entry.js +1 -1
  51. package/dist/esm/wm-toggletip.entry.js +1 -1
  52. package/dist/esm/wm-uploader.entry.js +2 -2
  53. package/dist/esm-es5/{chartFunctions-dfcb1edf.js → chartFunctions-34f19953.js} +1 -1
  54. package/dist/esm-es5/{functions-b791a892.js → functions-8800c690.js} +1 -1
  55. package/dist/esm-es5/{global-525745d2.js → global-3ec0570b.js} +1 -1
  56. package/dist/esm-es5/{intl-f2f7ce8b.js → intl-b110ca8d.js} +1 -1
  57. package/dist/esm-es5/loader.js +1 -1
  58. package/dist/esm-es5/priv-calendar.entry.js +1 -1
  59. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  60. package/dist/esm-es5/priv-option-list.entry.js +1 -1
  61. package/dist/esm-es5/ripple.js +1 -1
  62. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  63. package/dist/esm-es5/wm-button.entry.js +1 -1
  64. package/dist/esm-es5/wm-chart.entry.js +1 -1
  65. package/dist/esm-es5/wm-date-range.entry.js +1 -1
  66. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  67. package/dist/esm-es5/wm-file.entry.js +1 -1
  68. package/dist/esm-es5/wm-input.entry.js +1 -1
  69. package/dist/esm-es5/wm-line-chart.entry.js +1 -1
  70. package/dist/esm-es5/wm-modal-pss_3.entry.js +1 -1
  71. package/dist/esm-es5/wm-modal_3.entry.js +1 -1
  72. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  73. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  74. package/dist/esm-es5/wm-nested-select.entry.js +1 -1
  75. package/dist/esm-es5/wm-optgroup.entry.js +1 -1
  76. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  77. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  78. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  79. package/dist/esm-es5/wm-search.entry.js +1 -1
  80. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  81. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  82. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  83. package/dist/esm-es5/wm-tag-option.entry.js +1 -1
  84. package/dist/esm-es5/wm-textarea.entry.js +1 -1
  85. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  86. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  87. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  88. package/dist/ripple/{p-21d372ed.js → p-02dc1562.js} +1 -1
  89. package/dist/ripple/{p-ca971eac.system.entry.js → p-037bf5c7.system.entry.js} +1 -1
  90. package/dist/ripple/{p-ff1ed90f.entry.js → p-04d5e7d7.entry.js} +1 -1
  91. package/dist/ripple/{p-eefbca0e.system.js → p-064eda0e.system.js} +1 -1
  92. package/dist/ripple/{p-b01f9998.system.entry.js → p-0eea8fd3.system.entry.js} +1 -1
  93. package/dist/ripple/{p-1d18d9d2.system.entry.js → p-0faf7ef9.system.entry.js} +1 -1
  94. package/dist/ripple/{p-45f9ad09.entry.js → p-13cc92e7.entry.js} +1 -1
  95. package/dist/ripple/{p-236af552.entry.js → p-1618709f.entry.js} +1 -1
  96. package/dist/ripple/{p-bf7d98d8.entry.js → p-1c7201d1.entry.js} +1 -1
  97. package/dist/ripple/{p-c853e185.system.entry.js → p-2520d947.system.entry.js} +1 -1
  98. package/dist/ripple/{p-6d129ef8.system.entry.js → p-29f41fea.system.entry.js} +1 -1
  99. package/dist/ripple/{p-f24572f5.entry.js → p-2c028fe2.entry.js} +1 -1
  100. package/dist/ripple/{p-3e415c49.system.entry.js → p-2f565d7a.system.entry.js} +1 -1
  101. package/dist/ripple/{p-02deae76.entry.js → p-31b587a3.entry.js} +1 -1
  102. package/dist/ripple/{p-41550baa.entry.js → p-3212fd0e.entry.js} +1 -1
  103. package/dist/ripple/{p-215793a4.entry.js → p-34d80f95.entry.js} +1 -1
  104. package/dist/ripple/{p-f2101a0d.entry.js → p-37649315.entry.js} +1 -1
  105. package/dist/ripple/{p-aea13873.entry.js → p-3aca84d7.entry.js} +1 -1
  106. package/dist/ripple/{p-0b1c6965.system.entry.js → p-3bb1f795.system.entry.js} +1 -1
  107. package/dist/ripple/{p-828adbf1.system.js → p-4378b6b9.system.js} +1 -1
  108. package/dist/ripple/{p-ed1f6b8d.system.entry.js → p-43b03ad8.system.entry.js} +1 -1
  109. package/dist/ripple/{p-fa4f1030.system.entry.js → p-4743176d.system.entry.js} +1 -1
  110. package/dist/ripple/{p-c2e00d4a.system.entry.js → p-4c5606da.system.entry.js} +1 -1
  111. package/dist/ripple/p-54d7688a.entry.js +1 -0
  112. package/dist/ripple/{p-eddbcb21.js → p-5943c8b1.js} +1 -1
  113. package/dist/ripple/{p-2e79fa49.entry.js → p-5ea1c7a6.entry.js} +1 -1
  114. package/dist/ripple/{p-1389302e.system.entry.js → p-5eb02aa9.system.entry.js} +1 -1
  115. package/dist/ripple/{p-6cc07645.system.entry.js → p-6025efee.system.entry.js} +1 -1
  116. package/dist/ripple/p-6692b5a6.entry.js +1 -0
  117. package/dist/ripple/{p-db9657eb.system.entry.js → p-6a4c59e0.system.entry.js} +1 -1
  118. package/dist/ripple/{p-5284791c.entry.js → p-6ad695a5.entry.js} +1 -1
  119. package/dist/ripple/{p-149a22bf.entry.js → p-6d2122b9.entry.js} +1 -1
  120. package/dist/ripple/{p-30b905eb.system.entry.js → p-6eb50cc3.system.entry.js} +1 -1
  121. package/dist/ripple/{p-012cab20.entry.js → p-72c22a55.entry.js} +1 -1
  122. package/dist/ripple/{p-505eca1c.system.entry.js → p-7906a797.system.entry.js} +1 -1
  123. package/dist/ripple/{p-749597da.system.entry.js → p-7b982ba8.system.entry.js} +1 -1
  124. package/dist/ripple/{p-83be63f6.entry.js → p-7e4866c3.entry.js} +1 -1
  125. package/dist/ripple/{p-84ba5b74.entry.js → p-870cf4ef.entry.js} +1 -1
  126. package/dist/ripple/{p-1e625a5e.entry.js → p-8f217fb1.entry.js} +1 -1
  127. package/dist/ripple/{p-f4bcee58.system.entry.js → p-90261a03.system.entry.js} +1 -1
  128. package/dist/ripple/{p-f40e1468.system.entry.js → p-9a2cf94c.system.entry.js} +1 -1
  129. package/dist/ripple/{p-cff5d7e9.system.entry.js → p-9fccdac8.system.entry.js} +1 -1
  130. package/dist/ripple/p-ae4c8481.system.entry.js +1 -0
  131. package/dist/ripple/{p-c1e3c2fb.entry.js → p-b01d022f.entry.js} +1 -1
  132. package/dist/ripple/{p-b9dbf1f4.entry.js → p-b0e099f8.entry.js} +1 -1
  133. package/dist/ripple/{p-c47fab48.entry.js → p-b19ea29e.entry.js} +1 -1
  134. package/dist/ripple/p-b8671d49.system.entry.js +1 -0
  135. package/dist/ripple/{p-5300b15d.entry.js → p-b976c84b.entry.js} +1 -1
  136. package/dist/ripple/{p-226fe4e0.entry.js → p-c2657183.entry.js} +1 -1
  137. package/dist/ripple/{p-a3c01e10.system.entry.js → p-c39a3951.system.entry.js} +1 -1
  138. package/dist/ripple/{p-3deaf4d9.system.entry.js → p-cbd2473d.system.entry.js} +1 -1
  139. package/dist/ripple/{p-3d50db36.entry.js → p-cedfcf23.entry.js} +1 -1
  140. package/dist/ripple/{p-a0ecb6d7.system.entry.js → p-d824406e.system.entry.js} +1 -1
  141. package/dist/ripple/{p-6fdfe9f4.system.entry.js → p-dd26ae24.system.entry.js} +1 -1
  142. package/dist/ripple/{p-cad0c5f9.system.entry.js → p-dd76bf0a.system.entry.js} +1 -1
  143. package/dist/ripple/{p-e081fdc2.system.entry.js → p-e28671cd.system.entry.js} +1 -1
  144. package/dist/ripple/{p-72165bd2.entry.js → p-e4ff7200.entry.js} +1 -1
  145. package/dist/ripple/{p-df157138.entry.js → p-e53b6f7c.entry.js} +1 -1
  146. package/dist/ripple/{p-16f65bf4.js → p-eca78c2b.js} +1 -1
  147. package/dist/ripple/{p-1092e5ce.js → p-ed65f965.js} +1 -1
  148. package/dist/ripple/{p-ae82b3d2.system.js → p-edd87140.system.js} +1 -1
  149. package/dist/ripple/{p-81c2df85.system.js → p-ee31c799.system.js} +1 -1
  150. package/dist/ripple/{p-f90e4094.entry.js → p-f05e38b1.entry.js} +1 -1
  151. package/dist/ripple/p-f367f027.system.entry.js +1 -0
  152. package/dist/ripple/p-f939505d.entry.js +1 -0
  153. package/dist/ripple/{p-5a9e3108.system.entry.js → p-f9d26f8b.system.entry.js} +1 -1
  154. package/dist/ripple/{p-01035c8e.system.js → p-fb22d5a8.system.js} +1 -1
  155. package/dist/ripple/ripple.esm.js +1 -1
  156. package/dist/ripple/ripple.js +1 -1
  157. package/dist/types/components/charts/wm-line-chart/wm-line-chart.d.ts +0 -2
  158. package/dist/types/components/wm-modal-pss/wm-modal-pss-footer.d.ts +1 -1
  159. package/dist/types/components/wm-modal-pss/wm-modal-pss-header.d.ts +1 -1
  160. package/dist/types/components/wm-modal-pss/wm-modal-pss.d.ts +33 -0
  161. package/package.json +1 -1
  162. package/dist/ripple/p-249add87.system.entry.js +0 -1
  163. package/dist/ripple/p-5254f902.entry.js +0 -1
  164. package/dist/ripple/p-6e725656.system.entry.js +0 -1
  165. package/dist/ripple/p-725230dd.system.entry.js +0 -1
  166. package/dist/ripple/p-e687176d.entry.js +0 -1
  167. package/dist/ripple/p-f13b034e.entry.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,r,n){function a(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function o(e){try{c(n["throw"](e))}catch(e){i(e)}}function c(e){e.done?r(e.value):a(e.value).then(s,o)}c((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(e){return function(t){return c([e,t])}}function c(o){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(r=0)),r)try{if(n=1,a&&(i=o[0]&2?a["return"]:o[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;if(a=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;a=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){r.label=o[1];break}if(o[0]===6&&r.label<i[1]){r.label=i[1];i=o;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(o);break}if(i[2])r.ops.pop();r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e];a=0}finally{n=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,i;n<a;n++){if(i||!(n in t)){if(!i)i=Array.prototype.slice.call(t,0,n);i[n]=t[n]}}return e.concat(i||Array.prototype.slice.call(t))};import{h}from"./index-558b5a82.js";import{i as intl,c as safeMultiplyFloat,e as getPosition,f as checkForActiveElInShadow}from"./functions-b791a892.js";var colors={salmon:"#ff5f4e",cyan:"#19a1a9",forest:"#088000",sleet:"#7f97ad",midnight:"#2e1b46",lavender:"#8b86ca",periwinkle:"#575195",gray:"#6b6b6b"};var allChartsDetails={doughnut:{size:155,colors:[colors.forest,colors.gray],thickness:.73,padding:25,category:"doughnut"},doughnut1:{size:130,colors:[colors.lavender,colors.midnight,colors.gray],thickness:.5,padding:90,category:"doughnut"},doughnut2:{size:130,colors:[colors.periwinkle,colors.cyan,colors.midnight,colors.salmon,colors.gray],thickness:.5,padding:90,category:"doughnut"},doughnut3:{size:130,colors:[colors.lavender,colors.midnight,"#0089e4",colors.forest,"#ea8500","#d54f41","#146ca9"],thickness:.5,padding:90,category:"doughnut"},bar:{size:350,colors:[colors.forest,colors.gray],padding:0,category:"stackedBar"},bar2:{size:400,colors:[colors.gray,colors.periwinkle,colors.midnight,colors.cyan,colors.salmon],padding:0,category:"stackedBar"},bar3:{size:300,colors:["#0d696e",colors.cyan,"#8e4129",colors.salmon],padding:0,category:"stackedBar"},bar4:{size:400,colors:[colors.salmon,colors.cyan,colors.periwinkle],padding:0,category:"stackedBar"},bar5:{size:400,colors:[colors.gray,colors.lavender,colors.midnight,"#0089e4",colors.forest,"#ea8500","#d54f41","#146ca9"],padding:0,category:"stackedBar"},bar6:{size:400,colors:[colors.lavender],padding:0,category:"simpleBar"},bar7:{size:400,colors:[colors.periwinkle,colors.cyan,colors.salmon,colors.gray],padding:0,category:"simpleBar"}};function showValue(e){return e==="percentage"||e==="amount"?"show-values":""}var textHiddenMessage=intl.formatMessage({id:"chart.hiddenValues",defaultMessage:"Values are hidden when too close together.",description:"Text displayed when a chart has some values hidden"});var seeDetailsMessage=intl.formatMessage({id:"chart.clickToSeeDetails",defaultMessage:"Click or use arrow keys to see details.",description:"Text displayed, guiding user to interact to see more details."});function abbrNumber(e){return e>999||e<-999?Math.round(e/100)/10+"K":e}function amountToPercent(e,t,r){return r?Math.round(e*100/t):Math.round(e*1e4/t)/100}function amountToDegree(e,t){return e*360/t}function toFixed(e){return parseFloat((Math.floor(e*100)/100).toFixed(2))}function polarToCartesian(e,t,r,n){var a=toFixed(e+e*t*Math.cos(Math.PI*r/180));var i=toFixed(e+e*t*Math.sin(Math.PI*r/180));if(n!==undefined){var s=toFixed(e+e*t*Math.cos(Math.PI*n/180));var o=toFixed(e+e*t*Math.sin(Math.PI*n/180));return{x1:a,y1:i,x2:s,y2:o}}return{x:a,y:i}}function getArc(e,t,r,n,a){var i=toFixed(a/2*e);return"A ".concat(i,", ").concat(i," 0 ").concat(t," ").concat(toFixed(r),", ").concat(toFixed(n))}function scale(e,t,r,n,a){var i=(e-t)*(a-n)/(r-t)+n;return i<n?n:i>a?a:i}function minSpacing(e){return scale(e,300,900,70,150)}function getMaxTicks(e){return Math.round(e/minSpacing(e))}function getInterval(e,t){var r=e/t;var n=Math.pow(10,Math.floor(Math.log10(r)));var a=r/n;var i;if(a>5){i=10*n}else if(a>3){i=5*n}else if(a>2){i=3*n}else if(a>1.5){i=2*n}else if(a>1){i=1.5*n}else{i=n}return i}function handleSliceKeyDown(e){if(this.popoverEl&&this.popoverEl.open&&e.key==="Enter"){var t=this.popoverEl.querySelector("button");t&&t.click()}}function handleSliceClick(e,t){if(this.popoverEl&&!this.isTabbing){t.coords={x:e.clientX,y:e.clientY};openPopover(this.popoverEl,t);highlightSegmentInfo(Array.from(this.el.shadowRoot.querySelectorAll("[data-segmentindex")),t)}}function handleSliceFocus(e,t){if(this.popoverEl&&this.isTabbing){this.focusedSliceId=t.id;t.coords=getPosition(e.target);t.coords.x=t.coords.x+30;t.coords.y=t.coords.y+30;openPopover(this.popoverEl,t);highlightSegmentInfo(Array.from(this.el.shadowRoot.querySelectorAll("[data-segmentindex")),t)}}function handleChartKeydown(e){switch(e.key){case"ArrowUp":case"ArrowLeft":e.preventDefault();this.isTabbing=true;focusPrevious.call(this);break;case"ArrowRight":case"ArrowDown":e.preventDefault();this.isTabbing=true;focusNext.call(this);break;case"Tab":exitChart.call(this);break;case"Escape":this.popoverEl.open=false;this.userIsNavigating=false;break}}function openPopover(e,t){e.open=false;if(t.title&&t.text){e.sliceDetails=Object.assign({},t);window.setTimeout((function(){return e.open=true}),30)}}function focusNext(){var e=checkForActiveElInShadow(document.activeElement);var t=(this.sliceEls.indexOf(e)+1)%this.sliceEls.length;focusSlice.call(this,t)}function focusPrevious(){if(this.sliceEls){var e=checkForActiveElInShadow(document.activeElement);var t=this.sliceEls.indexOf(e);if(t===-1){t=0}else if(t===0){t=this.sliceEls.length-1}else{t-=1}focusSlice.call(this,t)}}function focusSlice(e){var t=this;if(this.sliceEls&&this.el){this.userIsNavigating=true;this.componentWrapperEl.tabIndex=-1;this.el.focusable=false;this.sliceEls.map((function(e){e.tabIndex=-1;e.focusable=false}));this.sliceEls[e].tabIndex=0;this.sliceEls[e].focusable=true;this.sliceEls[e].focus();this.focusedSliceId=this.sliceEls[e].id;window.setTimeout((function(){if(t.popoverEl){t.popoverEl.open=true}}),10)}}function exitChart(){var e=this;this.focusedSliceId=undefined;this.sliceEls&&this.sliceEls.map((function(e){e.tabIndex=-1;e.focusable=false}));this.userIsNavigating=false;window.setTimeout((function(){e.componentWrapperEl.tabIndex=0;e.el.focusable=true;if(e.popoverEl){e.popoverEl.open=false}}),100)}function getDetails(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n;var a=this;return __generator(this,(function(i){this.slicesDetails=[];t=0;r=Array.from(this.el.children);this.total=r.reduce((function(e,t){return e+=parseInt(t.getAttribute("amount")||"0")}),0);n=__spreadArray([],allChartsDetails[e].colors,true);if(this.chartType==="bar2"&&this.el.children.length<=4){n.splice(2,1)}if(e==="bar3"&&r.length===2){n=[n[1],n[3]]}if(e==="doughnut2"&&r.length<5){n.splice(2,1);if(r.length<4){n.shift()}}if(e==="bar5"&&!this.notStartedColor){n.shift()}r.forEach((function(r,i){var s=parseInt(r.getAttribute("amount")||"0");var o=amountToPercent(s,a.total,true);var c=i;if(e==="bar6"){c=0}var u={amount:s,perc:o,legend:r.getAttribute("legend"),color:n[c]||colors.gray,offset:t,id:"".concat(a.uid,"-").concat(i+1),title:r.getAttribute("popover-title"),text:r.getAttribute("popover-text"),buttonText:r.getAttribute("popover-button-text"),sliceRef:r,inSmallCluster:false,index:i};t+=s;a.slicesDetails.push(u)}));return[2]}))}))}function sortSlicesDetails(e,t){var r=__spreadArray([],e,true).sort((function(e,t){return e.amount===t.amount?0:e.amount>t.amount?-1:1}));var n=0;r.filter((function(e){return e.amount>0})).forEach((function(e,a){var i=r[a===0?r.length-1:a-1];var s=r[a===r.length-1?0:a+1];var o=amountToPercent(i.amount,t,true);var c=amountToPercent(s.amount,t,true);var u=e.perc===0?8:5;var h=e.perc<4;var l=o<u;var d=c<u;var f=h&&(l||d);e.inSmallCluster=f;e.offset=n;n+=e.amount}));return r}function getPathData(e,t,r){var n=amountToDegree(t,this.total)-90;var a=e/this.total*360;var i=n+a;var s=a>180?"1 1":"0 1";var o=a>180?"1 0":"0 0";var c=this.chartDetails.size/2;var u=this.chartDetails.thickness;var h=1;var l=r==="doughnut";var d=1.5;var f=l?2.25:3;if(a===360){i-=.01}var v=polarToCartesian(c,h,n+d,i);var g=polarToCartesian(c,u,n+f,i);var p="M ".concat(v.x1,", ").concat(v.y1," ");var m=getArc(h,s,v.x2,v.y2,this.chartDetails.size);var b=" L ".concat(g.x2,", ").concat(g.y2," ");var x=getArc(u,o,g.x1,g.y1,this.chartDetails.size);return p+m+b+x+" z"}function renderInstructionsText(){var e=intl.formatMessage({id:"chart.instructions",defaultMessage:"Use arrow keys to browse elements, press Tab to exit.",description:"For screen readers only, instructions on how to interact with the chart component"});return h("div",{id:"chart-instructions"},e)}function renderFilter(){return h("defs",null,h("filter",{id:"wmHoverDropShadow"},h("feGaussianBlur",{stdDeviation:"3"}),h("feOffset",{result:"offsetblur"}),h("feFlood",{"flood-color":"#333"}),h("feComposite",{operator:"in",in2:"offsetblur"}),h("feMerge",null,h("feMergeNode",null),h("feMergeNode",{in:"SourceGraphic"}))))}function applyMinimumAngle(e,t,r){var n=t.map((function(e){return amountToDegree(e.amount,r)}));var a=n.some((function(t){return t!==0&&t<e}));if(a){var i=n.map((function(t){return t==0?t:Math.max(t,e)}));var s=i.reduce((function(t,r){return t+(r>e&&r!==0?r:0)}),0);var o=i.reduce((function(t,r){return t+(r>e&&r!==0?0:r)}),0);var c=360-o;var u=s-c;var h=u/c;var l=i.map((function(t){return t>e?t-h*t:t==0?0:e}));var d=0;t=t.map((function(e,t){var n=l[t]/360*r;var a=d;d+=n;return Object.assign(Object.assign({},e),{amount:n,offset:a})}))}return t}function renderDoughnut(e){var t=this;var r=this.chartDetails.size+this.chartDetails.padding;var n=e==="doughnut";var a=n?this.slicesDetails:sortSlicesDetails(this.slicesDetails,this.total);a=applyMinimumAngle(7,a,this.total);return h("div",{class:"chart-wrapper doughnut-wrapper"},h("svg",{width:r+"px",height:r+"px",id:"graphic-".concat(this.uid),class:"doughnut-svg"},renderFilter(),a.map((function(r){return renderPath.call(t,r,e)})),renderFocusOutline.call(this),n?h("text",{class:"value",x:"50%",y:"50%","font-size":"1.5rem","font-weight":"500","text-anchor":"middle","dominant-baseline":"middle"},amountToPercent(a[0].amount,this.total,true)+"%"):h("g",{transform:"translate(".concat(this.chartDetails.padding/2,", ").concat(this.chartDetails.padding/2,")"),"text-anchor":"middle","dominant-baseline":"middle"},a.map((function(e){return e.amount>0&&!e.inSmallCluster?renderDoughnutText.call(t,e):""})))))}function highlightSegmentInfo(e,t){e.forEach((function(e){if(e.dataset.segmentindex&&parseInt(e.dataset.segmentindex)!==t.index){e.classList.add("faded")}else{e.classList.remove("faded")}}))}function removeSegmentInfoHighlight(e){e.forEach((function(e){e.classList.remove("faded")}))}function renderPath(e,t){var r=this;var n=amountToPercent(e.amount,this.total,true)+"%";return!isNaN(e.amount)&&h("g",{transform:"translate(".concat(this.chartDetails.padding/2,", ").concat(this.chartDetails.padding/2,")")},h("path",{id:e.id,class:"segment doughnut-segment",fill:e.amount?e.color:"transparent",d:getPathData.call(this,e.amount,e.offset,t),onClick:function(t){return handleSliceClick.call(r,t,e)},onFocus:function(t){return handleSliceFocus.call(r,t,e)},onKeyDown:function(e){return handleSliceKeyDown.call(r,e)},role:"img","aria-label":"".concat(e.legend,", ").concat(n),"data-segmentindex":e.index}))}function renderFocusOutline(){return this.isTabbing?h("g",{transform:"translate(".concat(this.chartDetails.padding/2,", ").concat(this.chartDetails.padding/2,")")},h("use",{tabindex:-1,id:"kfbg1",xlinkHref:"#".concat(this.focusedSliceId)}),h("use",{tabindex:-1,id:"kfstroke",xlinkHref:"#".concat(this.focusedSliceId)}),h("use",{tabindex:-1,id:"kfbg2",xlinkHref:"#".concat(this.focusedSliceId)})):""}function renderDoughnutText(e){var t=amountToDegree(e.offset+e.amount/2,this.total);var r=polarToCartesian(this.chartDetails.size/2,1.4,t-90),n=r.x,a=r.y;return h("text",{class:"value",x:n+"px",y:a+"px","data-segmentindex":e.index},"".concat(e.perc>0?e.perc:"<1","%"))}function renderStackedBar(e){var t=this;var r=e==="bar";var n=this.el.shadowRoot.querySelectorAll(".value");if(n.length>0){requestAnimationFrame((function(){var e=[];var r=4;var a=false;n.forEach((function(t){t.classList.remove("hidden");var n=parseInt(t.dataset.value);if(e.length>0&&n!=0){var i=t.getBoundingClientRect().left-r;e.forEach((function(e){var r=parseInt(e.dataset.value);var s=e.getBoundingClientRect().right>i;if(s){var o=n<r?t:e;o.classList.add("hidden");a=true}}))}if(!t.classList.contains("hidden")&&n>0){e.push(t)}}));(t.isBar||t.isDoughnut)&&t.showHiddenValuesMessage(a)}))}return h("div",{class:"chart-wrapper bar-wrapper"},r?h("div",{class:"single-perc"},amountToPercent(this.slicesDetails[0].amount,this.total,true)+"%"):"",this.chartType==="bar3"&&this.drawAxis(),h("div",{class:"inner-stacked-bar-wrapper ".concat(showValue(this.valueFormat))},!r?h("div",{class:"values ".concat(this.valueFormat)},this.slicesDetails.map((function(e){return t.renderBarText(e,5)}))):"",h("div",{class:"stacked-bar-segments-wrapper"},this.slicesDetails.map((function(e){return renderStackedBarSegment.call(t,e,5)}))),r?renderCompletionMessage.call(this):""),this.chartType==="bar3"?h("div",{class:"bar3-axis-label","aria-hidden":"true"},h("span",null,"0%"),h("span",null,"100%")):"")}function renderStackedBarSegment(e,t){var r=this;var n=amountToPercent(e.amount,this.total,false);var a=this.el.shadowRoot.querySelector(".stacked-bar-segments-wrapper");var i=a?a.offsetWidth:this.el.offsetWidth;var s=n/100*i>=t;var o=s||e.amount==0?"".concat(n,"%"):"".concat(t,"px");var c="";if(this.valueFormat=="percentage"){c="".concat(amountToPercent(e.amount,this.total,true)," %")}else if(this.valueFormat=="amount"){c=e.amount.toString()}return h("div",{class:"segment stacked-bar-segment ".concat(amountToPercent(e.amount,this.total,false)===0?"zero":""," ").concat(s?"":"fixed-width"),style:{backgroundColor:e.color,width:o},onClick:function(t){return handleSliceClick.call(r,t,e)},onFocus:function(t){return handleSliceFocus.call(r,t,e)},onKeyDown:function(e){return handleSliceKeyDown.call(r,e)},"data-segmentindex":e.index},h("span",{class:"sr-only"},"".concat(e.legend," ").concat(c)))}function renderSimpleBar(e){var t=this;var r=this.slicesDetails.map((function(e){return e.amount})).reduce((function(e,t){return e>t?e:t}));var n=parseInt(getComputedStyle(this.el).getPropertyValue("--labelWidth"),10);var a=48;var i=this.el.getBoundingClientRect().width;var s=i-n-a;var o=getMaxTicks(s);var c=getInterval(r,o);var u=o*c;var l=Math.floor((u-r)/c);o-=l;this.el.style.setProperty("--backgroundSize",100/o+"%");this.el.style.setProperty("--labelWidth",this.labelWidth);if(e==="bar7"&&!this.showBarLegend){this.el.style.setProperty("--labelWidth","0px")}var d=[];this.slicesDetails.forEach((function(n){n.legend&&d.push(renderSimpleBarLegend(n.legend,t.showBarLegend,e));d.push(renderSimpleBarItem.call(t,n,c,o,r))}));var f=[];for(var v=1;v<=o;v++){var g=abbrNumber(safeMultiplyFloat(v,c));f.push(h("div",{class:"tick"},h("span",null,g)))}var p=e==="bar6"&&this.showGrid&&this.el.getBoundingClientRect().width>300;return h("div",{class:"chart-wrapper simple-bar-wrapper"},h("div",{class:"chart ".concat(showValue(this.valueFormat))},p&&h("div",{class:"gridlines"}),h("div",{class:"rows"},d)),p&&h("div",{class:"x-axis","aria-hidden":"true"},h("div",{class:"zero"},h("span",null,"0")),f))}function renderSimpleBarLegend(e,t,r){var n=r==="bar7"&&!t?" hidden":"";return h("label",{class:"label".concat(n)},e)}function renderSimpleBarItem(e,t,r,n){var a=this;var i=this.currentChartType==="bar6"?t*r:n;var s=amountToPercent(e.amount,i,false);var o=s?s+"%":"1px";var c=abbrNumber(e.amount);var u=this.valueFormat==="amount"?c:"";if(this.currentChartType==="bar6"&&this.valueFormat==="percentage"){u=e.amount+"%"}else if(this.currentChartType==="bar7"&&this.valueFormat==="percentage"){u=(this.total===0?"0":amountToPercent(e.amount,this.total,true))+"%"}return h("div",{class:"bar segment",style:{backgroundColor:e.color,width:o},onClick:function(t){return handleSliceClick.call(a,t,e)},onFocus:function(t){return handleSliceFocus.call(a,t,e)},onKeyDown:function(e){return handleSliceKeyDown.call(a,e)},"data-segmentindex":e.index},h("div",{class:"value"},u))}function renderLegend(e){var t=this;if(this.showLegend){var r=this.slicesDetails.reduce((function(e,t){return e=t.inSmallCluster?true:e}),false);this.isDoughnut&&this.showHiddenValuesMessage(r);return h("div",{class:"legend-wrapper"},h("div",{class:"legend ".concat(e," ").concat(this.mode==="bar"?"--top":"--bottom"),"aria-hidden":"true"},this.slicesDetails.map((function(e){var r=t.printModeFormat=="amount"?"".concat(e.amount,"/").concat(t.total):"".concat(amountToPercent(e.amount,t.total,true),"%");if(!!e.amount||!!e.legend){return renderLegendItem.call(t,{key:e.legend,color:e.color},r,e)}}))),this.isDoughnut&&!this.printMode&&renderHiddenValuesMessage())}}function renderLegendItem(e,t,r){var n=this;if(t===void 0){t=""}if(r===void 0){r=null}var a=function(e){if(r){r.coords={x:e.clientX,y:e.clientY};openPopover(n.popoverEl,r);highlightSegmentInfo(Array.from(n.el.shadowRoot.querySelectorAll("[data-segmentindex")),r)}};return h("div",{class:"legend-item",onClick:function(e){return a(e)},"data-segmentindex":r?r.index:null},h("div",{class:"legend-color",style:{backgroundColor:e.color}}),h("div",{class:"legend-text"},e.key,t&&h("span",{class:"print-value ".concat(this.printMode?"force-visible":"")},": ",t)))}function renderCompletionMessage(){if(this.completionMessage){return h("div",{class:"completion-message"},this.completionMessage)}}function renderHiddenValuesMessage(){return h("div",{class:"hidden-values-warning hidden"},textHiddenMessage,h("br",null),seeDetailsMessage)}export{allChartsDetails as a,renderSimpleBar as b,renderStackedBar as c,renderDoughnut as d,renderInstructionsText as e,renderLegend as f,getDetails as g,handleChartKeydown as h,renderHiddenValuesMessage as i,exitChart as j,amountToPercent as k,renderCompletionMessage as l,renderLegendItem as m,abbrNumber as n,getInterval as o,removeSegmentInfoHighlight as r};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,r,n){function a(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function o(e){try{c(n["throw"](e))}catch(e){i(e)}}function c(e){e.done?r(e.value):a(e.value).then(s,o)}c((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(e){return function(t){return c([e,t])}}function c(o){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(r=0)),r)try{if(n=1,a&&(i=o[0]&2?a["return"]:o[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;if(a=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;a=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){r.label=o[1];break}if(o[0]===6&&r.label<i[1]){r.label=i[1];i=o;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(o);break}if(i[2])r.ops.pop();r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e];a=0}finally{n=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,i;n<a;n++){if(i||!(n in t)){if(!i)i=Array.prototype.slice.call(t,0,n);i[n]=t[n]}}return e.concat(i||Array.prototype.slice.call(t))};import{h}from"./index-558b5a82.js";import{i as intl,c as checkForActiveElInShadow,e as safeMultiplyFloat,f as getPosition}from"./functions-8800c690.js";var colors={salmon:"#ff5f4e",cyan:"#19a1a9",forest:"#088000",sleet:"#7f97ad",midnight:"#2e1b46",lavender:"#8b86ca",periwinkle:"#575195",gray:"#6b6b6b"};var allChartsDetails={doughnut:{size:155,colors:[colors.forest,colors.gray],thickness:.73,padding:25,category:"doughnut"},doughnut1:{size:130,colors:[colors.lavender,colors.midnight,colors.gray],thickness:.5,padding:90,category:"doughnut"},doughnut2:{size:130,colors:[colors.periwinkle,colors.cyan,colors.midnight,colors.salmon,colors.gray],thickness:.5,padding:90,category:"doughnut"},doughnut3:{size:130,colors:[colors.lavender,colors.midnight,"#0089e4",colors.forest,"#ea8500","#d54f41","#146ca9"],thickness:.5,padding:90,category:"doughnut"},bar:{size:350,colors:[colors.forest,colors.gray],padding:0,category:"stackedBar"},bar2:{size:400,colors:[colors.gray,colors.periwinkle,colors.midnight,colors.cyan,colors.salmon],padding:0,category:"stackedBar"},bar3:{size:300,colors:["#0d696e",colors.cyan,"#8e4129",colors.salmon],padding:0,category:"stackedBar"},bar4:{size:400,colors:[colors.salmon,colors.cyan,colors.periwinkle],padding:0,category:"stackedBar"},bar5:{size:400,colors:[colors.gray,colors.lavender,colors.midnight,"#0089e4",colors.forest,"#ea8500","#d54f41","#146ca9"],padding:0,category:"stackedBar"},bar6:{size:400,colors:[colors.lavender],padding:0,category:"simpleBar"},bar7:{size:400,colors:[colors.periwinkle,colors.cyan,colors.salmon,colors.gray],padding:0,category:"simpleBar"}};function showValue(e){return e==="percentage"||e==="amount"?"show-values":""}var textHiddenMessage=intl.formatMessage({id:"chart.hiddenValues",defaultMessage:"Values are hidden when too close together.",description:"Text displayed when a chart has some values hidden"});var seeDetailsMessage=intl.formatMessage({id:"chart.clickToSeeDetails",defaultMessage:"Click or use arrow keys to see details.",description:"Text displayed, guiding user to interact to see more details."});function abbrNumber(e){return e>999||e<-999?Math.round(e/100)/10+"K":e}function amountToPercent(e,t,r){return r?Math.round(e*100/t):Math.round(e*1e4/t)/100}function amountToDegree(e,t){return e*360/t}function toFixed(e){return parseFloat((Math.floor(e*100)/100).toFixed(2))}function polarToCartesian(e,t,r,n){var a=toFixed(e+e*t*Math.cos(Math.PI*r/180));var i=toFixed(e+e*t*Math.sin(Math.PI*r/180));if(n!==undefined){var s=toFixed(e+e*t*Math.cos(Math.PI*n/180));var o=toFixed(e+e*t*Math.sin(Math.PI*n/180));return{x1:a,y1:i,x2:s,y2:o}}return{x:a,y:i}}function getArc(e,t,r,n,a){var i=toFixed(a/2*e);return"A ".concat(i,", ").concat(i," 0 ").concat(t," ").concat(toFixed(r),", ").concat(toFixed(n))}function scale(e,t,r,n,a){var i=(e-t)*(a-n)/(r-t)+n;return i<n?n:i>a?a:i}function minSpacing(e){return scale(e,300,900,70,150)}function getMaxTicks(e){return Math.round(e/minSpacing(e))}function getInterval(e,t){var r=e/t;var n=Math.pow(10,Math.floor(Math.log10(r)));var a=r/n;var i;if(a>5){i=10*n}else if(a>3){i=5*n}else if(a>2){i=3*n}else if(a>1.5){i=2*n}else if(a>1){i=1.5*n}else{i=n}return i}function handleSliceKeyDown(e){if(this.popoverEl&&this.popoverEl.open&&e.key==="Enter"){var t=this.popoverEl.querySelector("button");t&&t.click()}}function handleSliceClick(e,t){if(this.popoverEl&&!this.isTabbing){t.coords={x:e.clientX,y:e.clientY};openPopover(this.popoverEl,t);highlightSegmentInfo(Array.from(this.el.shadowRoot.querySelectorAll("[data-segmentindex")),t)}}function handleSliceFocus(e,t){if(this.popoverEl&&this.isTabbing){this.focusedSliceId=t.id;t.coords=getPosition(e.target);t.coords.x=t.coords.x+30;t.coords.y=t.coords.y+30;openPopover(this.popoverEl,t);highlightSegmentInfo(Array.from(this.el.shadowRoot.querySelectorAll("[data-segmentindex")),t)}}function handleChartKeydown(e){switch(e.key){case"ArrowUp":case"ArrowLeft":e.preventDefault();this.isTabbing=true;focusPrevious.call(this);break;case"ArrowRight":case"ArrowDown":e.preventDefault();this.isTabbing=true;focusNext.call(this);break;case"Tab":exitChart.call(this);break;case"Escape":this.popoverEl.open=false;this.userIsNavigating=false;break}}function openPopover(e,t){e.open=false;if(t.title&&t.text){e.sliceDetails=Object.assign({},t);window.setTimeout((function(){return e.open=true}),30)}}function focusNext(){var e=checkForActiveElInShadow(document.activeElement);var t=(this.sliceEls.indexOf(e)+1)%this.sliceEls.length;focusSlice.call(this,t)}function focusPrevious(){if(this.sliceEls){var e=checkForActiveElInShadow(document.activeElement);var t=this.sliceEls.indexOf(e);if(t===-1){t=0}else if(t===0){t=this.sliceEls.length-1}else{t-=1}focusSlice.call(this,t)}}function focusSlice(e){var t=this;if(this.sliceEls&&this.el){this.userIsNavigating=true;this.componentWrapperEl.tabIndex=-1;this.el.focusable=false;this.sliceEls.map((function(e){e.tabIndex=-1;e.focusable=false}));this.sliceEls[e].tabIndex=0;this.sliceEls[e].focusable=true;this.sliceEls[e].focus();this.focusedSliceId=this.sliceEls[e].id;window.setTimeout((function(){if(t.popoverEl){t.popoverEl.open=true}}),10)}}function exitChart(){var e=this;this.focusedSliceId=undefined;this.sliceEls&&this.sliceEls.map((function(e){e.tabIndex=-1;e.focusable=false}));this.userIsNavigating=false;window.setTimeout((function(){e.componentWrapperEl.tabIndex=0;e.el.focusable=true;if(e.popoverEl){e.popoverEl.open=false}}),100)}function getDetails(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n;var a=this;return __generator(this,(function(i){this.slicesDetails=[];t=0;r=Array.from(this.el.children);this.total=r.reduce((function(e,t){return e+=parseInt(t.getAttribute("amount")||"0")}),0);n=__spreadArray([],allChartsDetails[e].colors,true);if(this.chartType==="bar2"&&this.el.children.length<=4){n.splice(2,1)}if(e==="bar3"&&r.length===2){n=[n[1],n[3]]}if(e==="doughnut2"&&r.length<5){n.splice(2,1);if(r.length<4){n.shift()}}if(e==="bar5"&&!this.notStartedColor){n.shift()}r.forEach((function(r,i){var s=parseInt(r.getAttribute("amount")||"0");var o=amountToPercent(s,a.total,true);var c=i;if(e==="bar6"){c=0}var u={amount:s,perc:o,legend:r.getAttribute("legend"),color:n[c]||colors.gray,offset:t,id:"".concat(a.uid,"-").concat(i+1),title:r.getAttribute("popover-title"),text:r.getAttribute("popover-text"),buttonText:r.getAttribute("popover-button-text"),sliceRef:r,inSmallCluster:false,index:i};t+=s;a.slicesDetails.push(u)}));return[2]}))}))}function sortSlicesDetails(e,t){var r=__spreadArray([],e,true).sort((function(e,t){return e.amount===t.amount?0:e.amount>t.amount?-1:1}));var n=0;r.filter((function(e){return e.amount>0})).forEach((function(e,a){var i=r[a===0?r.length-1:a-1];var s=r[a===r.length-1?0:a+1];var o=amountToPercent(i.amount,t,true);var c=amountToPercent(s.amount,t,true);var u=e.perc===0?8:5;var h=e.perc<4;var l=o<u;var d=c<u;var f=h&&(l||d);e.inSmallCluster=f;e.offset=n;n+=e.amount}));return r}function getPathData(e,t,r){var n=amountToDegree(t,this.total)-90;var a=e/this.total*360;var i=n+a;var s=a>180?"1 1":"0 1";var o=a>180?"1 0":"0 0";var c=this.chartDetails.size/2;var u=this.chartDetails.thickness;var h=1;var l=r==="doughnut";var d=1.5;var f=l?2.25:3;if(a===360){i-=.01}var v=polarToCartesian(c,h,n+d,i);var g=polarToCartesian(c,u,n+f,i);var p="M ".concat(v.x1,", ").concat(v.y1," ");var m=getArc(h,s,v.x2,v.y2,this.chartDetails.size);var b=" L ".concat(g.x2,", ").concat(g.y2," ");var x=getArc(u,o,g.x1,g.y1,this.chartDetails.size);return p+m+b+x+" z"}function renderInstructionsText(){var e=intl.formatMessage({id:"chart.instructions",defaultMessage:"Use arrow keys to browse elements, press Tab to exit.",description:"For screen readers only, instructions on how to interact with the chart component"});return h("div",{id:"chart-instructions"},e)}function renderFilter(){return h("defs",null,h("filter",{id:"wmHoverDropShadow"},h("feGaussianBlur",{stdDeviation:"3"}),h("feOffset",{result:"offsetblur"}),h("feFlood",{"flood-color":"#333"}),h("feComposite",{operator:"in",in2:"offsetblur"}),h("feMerge",null,h("feMergeNode",null),h("feMergeNode",{in:"SourceGraphic"}))))}function applyMinimumAngle(e,t,r){var n=t.map((function(e){return amountToDegree(e.amount,r)}));var a=n.some((function(t){return t!==0&&t<e}));if(a){var i=n.map((function(t){return t==0?t:Math.max(t,e)}));var s=i.reduce((function(t,r){return t+(r>e&&r!==0?r:0)}),0);var o=i.reduce((function(t,r){return t+(r>e&&r!==0?0:r)}),0);var c=360-o;var u=s-c;var h=u/c;var l=i.map((function(t){return t>e?t-h*t:t==0?0:e}));var d=0;t=t.map((function(e,t){var n=l[t]/360*r;var a=d;d+=n;return Object.assign(Object.assign({},e),{amount:n,offset:a})}))}return t}function renderDoughnut(e){var t=this;var r=this.chartDetails.size+this.chartDetails.padding;var n=e==="doughnut";var a=n?this.slicesDetails:sortSlicesDetails(this.slicesDetails,this.total);a=applyMinimumAngle(7,a,this.total);return h("div",{class:"chart-wrapper doughnut-wrapper"},h("svg",{width:r+"px",height:r+"px",id:"graphic-".concat(this.uid),class:"doughnut-svg"},renderFilter(),a.map((function(r){return renderPath.call(t,r,e)})),renderFocusOutline.call(this),n?h("text",{class:"value",x:"50%",y:"50%","font-size":"1.5rem","font-weight":"500","text-anchor":"middle","dominant-baseline":"middle"},amountToPercent(a[0].amount,this.total,true)+"%"):h("g",{transform:"translate(".concat(this.chartDetails.padding/2,", ").concat(this.chartDetails.padding/2,")"),"text-anchor":"middle","dominant-baseline":"middle"},a.map((function(e){return e.amount>0&&!e.inSmallCluster?renderDoughnutText.call(t,e):""})))))}function highlightSegmentInfo(e,t){e.forEach((function(e){if(e.dataset.segmentindex&&parseInt(e.dataset.segmentindex)!==t.index){e.classList.add("faded")}else{e.classList.remove("faded")}}))}function removeSegmentInfoHighlight(e){e.forEach((function(e){e.classList.remove("faded")}))}function renderPath(e,t){var r=this;var n=amountToPercent(e.amount,this.total,true)+"%";return!isNaN(e.amount)&&h("g",{transform:"translate(".concat(this.chartDetails.padding/2,", ").concat(this.chartDetails.padding/2,")")},h("path",{id:e.id,class:"segment doughnut-segment",fill:e.amount?e.color:"transparent",d:getPathData.call(this,e.amount,e.offset,t),onClick:function(t){return handleSliceClick.call(r,t,e)},onFocus:function(t){return handleSliceFocus.call(r,t,e)},onKeyDown:function(e){return handleSliceKeyDown.call(r,e)},role:"img","aria-label":"".concat(e.legend,", ").concat(n),"data-segmentindex":e.index}))}function renderFocusOutline(){return this.isTabbing?h("g",{transform:"translate(".concat(this.chartDetails.padding/2,", ").concat(this.chartDetails.padding/2,")")},h("use",{tabindex:-1,id:"kfbg1",xlinkHref:"#".concat(this.focusedSliceId)}),h("use",{tabindex:-1,id:"kfstroke",xlinkHref:"#".concat(this.focusedSliceId)}),h("use",{tabindex:-1,id:"kfbg2",xlinkHref:"#".concat(this.focusedSliceId)})):""}function renderDoughnutText(e){var t=amountToDegree(e.offset+e.amount/2,this.total);var r=polarToCartesian(this.chartDetails.size/2,1.4,t-90),n=r.x,a=r.y;return h("text",{class:"value",x:n+"px",y:a+"px","data-segmentindex":e.index},"".concat(e.perc>0?e.perc:"<1","%"))}function renderStackedBar(e){var t=this;var r=e==="bar";var n=this.el.shadowRoot.querySelectorAll(".value");if(n.length>0){requestAnimationFrame((function(){var e=[];var r=4;var a=false;n.forEach((function(t){t.classList.remove("hidden");var n=parseInt(t.dataset.value);if(e.length>0&&n!=0){var i=t.getBoundingClientRect().left-r;e.forEach((function(e){var r=parseInt(e.dataset.value);var s=e.getBoundingClientRect().right>i;if(s){var o=n<r?t:e;o.classList.add("hidden");a=true}}))}if(!t.classList.contains("hidden")&&n>0){e.push(t)}}));(t.isBar||t.isDoughnut)&&t.showHiddenValuesMessage(a)}))}return h("div",{class:"chart-wrapper bar-wrapper"},r?h("div",{class:"single-perc"},amountToPercent(this.slicesDetails[0].amount,this.total,true)+"%"):"",this.chartType==="bar3"&&this.drawAxis(),h("div",{class:"inner-stacked-bar-wrapper ".concat(showValue(this.valueFormat))},!r?h("div",{class:"values ".concat(this.valueFormat)},this.slicesDetails.map((function(e){return t.renderBarText(e,5)}))):"",h("div",{class:"stacked-bar-segments-wrapper"},this.slicesDetails.map((function(e){return renderStackedBarSegment.call(t,e,5)}))),r?renderCompletionMessage.call(this):""),this.chartType==="bar3"?h("div",{class:"bar3-axis-label","aria-hidden":"true"},h("span",null,"0%"),h("span",null,"100%")):"")}function renderStackedBarSegment(e,t){var r=this;var n=amountToPercent(e.amount,this.total,false);var a=this.el.shadowRoot.querySelector(".stacked-bar-segments-wrapper");var i=a?a.offsetWidth:this.el.offsetWidth;var s=n/100*i>=t;var o=s||e.amount==0?"".concat(n,"%"):"".concat(t,"px");var c="";if(this.valueFormat=="percentage"){c="".concat(amountToPercent(e.amount,this.total,true)," %")}else if(this.valueFormat=="amount"){c=e.amount.toString()}return h("div",{class:"segment stacked-bar-segment ".concat(amountToPercent(e.amount,this.total,false)===0?"zero":""," ").concat(s?"":"fixed-width"),style:{backgroundColor:e.color,width:o},onClick:function(t){return handleSliceClick.call(r,t,e)},onFocus:function(t){return handleSliceFocus.call(r,t,e)},onKeyDown:function(e){return handleSliceKeyDown.call(r,e)},"data-segmentindex":e.index},h("span",{class:"sr-only"},"".concat(e.legend," ").concat(c)))}function renderSimpleBar(e){var t=this;var r=this.slicesDetails.map((function(e){return e.amount})).reduce((function(e,t){return e>t?e:t}));var n=parseInt(getComputedStyle(this.el).getPropertyValue("--labelWidth"),10);var a=48;var i=this.el.getBoundingClientRect().width;var s=i-n-a;var o=getMaxTicks(s);var c=getInterval(r,o);var u=o*c;var l=Math.floor((u-r)/c);o-=l;this.el.style.setProperty("--backgroundSize",100/o+"%");this.el.style.setProperty("--labelWidth",this.labelWidth);if(e==="bar7"&&!this.showBarLegend){this.el.style.setProperty("--labelWidth","0px")}var d=[];this.slicesDetails.forEach((function(n){n.legend&&d.push(renderSimpleBarLegend(n.legend,t.showBarLegend,e));d.push(renderSimpleBarItem.call(t,n,c,o,r))}));var f=[];for(var v=1;v<=o;v++){var g=abbrNumber(safeMultiplyFloat(v,c));f.push(h("div",{class:"tick"},h("span",null,g)))}var p=e==="bar6"&&this.showGrid&&this.el.getBoundingClientRect().width>300;return h("div",{class:"chart-wrapper simple-bar-wrapper"},h("div",{class:"chart ".concat(showValue(this.valueFormat))},p&&h("div",{class:"gridlines"}),h("div",{class:"rows"},d)),p&&h("div",{class:"x-axis","aria-hidden":"true"},h("div",{class:"zero"},h("span",null,"0")),f))}function renderSimpleBarLegend(e,t,r){var n=r==="bar7"&&!t?" hidden":"";return h("label",{class:"label".concat(n)},e)}function renderSimpleBarItem(e,t,r,n){var a=this;var i=this.currentChartType==="bar6"?t*r:n;var s=amountToPercent(e.amount,i,false);var o=s?s+"%":"1px";var c=abbrNumber(e.amount);var u=this.valueFormat==="amount"?c:"";if(this.currentChartType==="bar6"&&this.valueFormat==="percentage"){u=e.amount+"%"}else if(this.currentChartType==="bar7"&&this.valueFormat==="percentage"){u=(this.total===0?"0":amountToPercent(e.amount,this.total,true))+"%"}return h("div",{class:"bar segment",style:{backgroundColor:e.color,width:o},onClick:function(t){return handleSliceClick.call(a,t,e)},onFocus:function(t){return handleSliceFocus.call(a,t,e)},onKeyDown:function(e){return handleSliceKeyDown.call(a,e)},"data-segmentindex":e.index},h("div",{class:"value"},u))}function renderLegend(e){var t=this;if(this.showLegend){var r=this.slicesDetails.reduce((function(e,t){return e=t.inSmallCluster?true:e}),false);this.isDoughnut&&this.showHiddenValuesMessage(r);return h("div",{class:"legend-wrapper"},h("div",{class:"legend ".concat(e," ").concat(this.mode==="bar"?"--top":"--bottom"),"aria-hidden":"true"},this.slicesDetails.map((function(e){var r=t.printModeFormat=="amount"?"".concat(e.amount,"/").concat(t.total):"".concat(amountToPercent(e.amount,t.total,true),"%");if(!!e.amount||!!e.legend){return renderLegendItem.call(t,{key:e.legend,color:e.color},r,e)}}))),this.isDoughnut&&!this.printMode&&renderHiddenValuesMessage())}}function renderLegendItem(e,t,r){var n=this;if(t===void 0){t=""}if(r===void 0){r=null}var a=function(e){if(r){r.coords={x:e.clientX,y:e.clientY};openPopover(n.popoverEl,r);highlightSegmentInfo(Array.from(n.el.shadowRoot.querySelectorAll("[data-segmentindex")),r)}};return h("div",{class:"legend-item",onClick:function(e){return a(e)},"data-segmentindex":r?r.index:null},h("div",{class:"legend-color",style:{backgroundColor:e.color}}),h("div",{class:"legend-text"},e.key,t&&h("span",{class:"print-value ".concat(this.printMode?"force-visible":"")},": ",t)))}function renderCompletionMessage(){if(this.completionMessage){return h("div",{class:"completion-message"},this.completionMessage)}}function renderHiddenValuesMessage(){return h("div",{class:"hidden-values-warning hidden"},textHiddenMessage,h("br",null),seeDetailsMessage)}export{allChartsDetails as a,renderSimpleBar as b,renderStackedBar as c,renderDoughnut as d,renderInstructionsText as e,renderLegend as f,getDetails as g,handleChartKeydown as h,renderHiddenValuesMessage as i,exitChart as j,amountToPercent as k,renderCompletionMessage as l,renderLegendItem as m,abbrNumber as n,getInterval as o,removeSegmentInfoHighlight as r};