@micheeeeel/yinyangapp 1.0.2 → 1.0.4

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 (35) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/animations/AnimationsMngr.d.ts +26 -0
  3. package/dist/types/components/controller/YinYangController.d.ts +59 -0
  4. package/dist/types/components/factory/YinYangAppFactory.d.ts +62 -0
  5. package/dist/types/components/model/YinYangModel.d.ts +41 -0
  6. package/dist/types/components/view/BorderDrawer.d.ts +42 -0
  7. package/dist/types/components/view/SpikeDrawer.d.ts +54 -0
  8. package/dist/types/components/view/ViewInitializer.d.ts +91 -0
  9. package/dist/types/components/view/YinYangDrawer.d.ts +57 -0
  10. package/dist/types/components/view/YinYangView.d.ts +52 -0
  11. package/dist/types/data/OddCategoryColors.d.ts +3 -0
  12. package/dist/types/data/coupe_rase_Orangs-outans/data_Kalimantan.d.ts +3 -0
  13. package/dist/types/data/coupe_rase_Orangs-outans/data_PT_Mayawana_Persada.d.ts +3 -0
  14. package/dist/types/data/data_institu_bancaire.d.ts +3 -0
  15. package/dist/types/interfaces/IAnimator.d.ts +3 -0
  16. package/dist/types/interfaces/ICategory.d.ts +9 -0
  17. package/dist/types/interfaces/ICircleManager.d.ts +8 -0
  18. package/dist/types/interfaces/IGradientStop.d.ts +5 -0
  19. package/dist/types/interfaces/IGraphicElement.d.ts +15 -0
  20. package/dist/types/interfaces/IGraphicsStrategy.d.ts +23 -0
  21. package/dist/types/interfaces/IOddItem.d.ts +6 -0
  22. package/dist/types/interfaces/ISpikeManager.d.ts +4 -0
  23. package/dist/types/interfaces/IViewData.d.ts +5 -0
  24. package/dist/types/interfaces/IYinOrYangPattern.d.ts +8 -0
  25. package/dist/types/interfaces/IYinYangAppFactory.d.ts +17 -0
  26. package/dist/types/interfaces/IYinYangController.d.ts +22 -0
  27. package/dist/types/interfaces/IYinYangModel.d.ts +18 -0
  28. package/dist/types/interfaces/IYinYangView.d.ts +19 -0
  29. package/dist/types/script.d.ts +2 -0
  30. package/dist/types/utils/d3/D3Animator.d.ts +4 -0
  31. package/dist/types/utils/d3/D3Element.d.ts +20 -0
  32. package/dist/types/utils/d3/D3GraphicsStrategy.d.ts +61 -0
  33. package/dist/types/utils/geometryUtils.d.ts +4 -0
  34. package/package.json +7 -6
  35. package/dist/index.html +0 -1
package/dist/bundle.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3")):"function"==typeof define&&define.amd?define(["d3"],e):"object"==typeof exports?exports.YinYangApp=e(require("d3")):t.YinYangApp=e(t.d3)}(this,(t=>(()=>{"use strict";var e={5:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.AnimationsMngr=void 0;var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.subscribers=[]}var e,r;return e=t,r=[{key:"subscribe",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e4;this.subscribers.push({component:t,clockWise:e,time:r})}},{key:"startAll",value:function(){var t=this;this.subscribers.forEach((function(e){var r=e.component,i=e.clockWise,n=e.time;return t.animate(r,i,n)}))}},{key:"revertRotation",value:function(t){var e=this.subscribers.find((function(e){return e.component===t}));e&&(t.view.viewInitializer.yinYangGroup.interruptAllAnimation(),e.clockWise=!e.clockWise,this.animate(t,e.clockWise,e.time))}},{key:"animate",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,i=t.view.viewInitializer,n=i.yinYangGroup,o=i.yinOrYangGroup,a=i.positionX,s=i.positionY;n.applyContinuousRotation(r,a,s,e),Object.values(o).forEach((function(t){var n=t.type,o=i.yinOrYangGroup.yin.centerY,s=i.yinOrYangGroup.yang.centerY,c=i.yinOrYangGroup.yin.radius,l=i.yinOrYangGroup.yang.radius,u="yang"===n?c:-l,y="yang"===n?s:o;t.graphElementGroup.applyTranslationAndRotationAltogether(r,a,y,u,e,n)}))}}],r&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.AnimationsMngr=o},839:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangController=void 0;var o=function(){function t(e,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.model=e,this.view=r,this.factory=i,this.animator=r.viewInitializer.graphicStrategy.animator}var e,r;return e=t,(r=[{key:"getBorderNb",value:function(){try{return this.model.borderNb}catch(t){throw console.error("Error getting border number:",t),t}}},{key:"getSortedData",value:function(){try{return this.model.sortedData}catch(t){throw console.error("Error getting sorted data:",t),t}}},{key:"getCategories",value:function(){try{return this.model.categories}catch(t){throw console.error("Error getting categories:",t),t}}},{key:"getKey",value:function(){try{return this.model.key}catch(t){throw console.error("Error getting key:",t),t}}},{key:"getParentKey",value:function(){try{return this.model.parentKey}catch(t){throw console.error("Error getting parent key:",t),t}}},{key:"getIsEnemy",value:function(){try{return this.model.isEnemy}catch(t){throw console.error("Error getting isEnemy status:",t),t}}},{key:"calculateAverageScore",value:function(){try{return this.model.calculateAverageScore()}catch(t){throw console.error("Error calculating average score:",t),t}}},{key:"generateChildKey",value:function(){try{return this.model.generateChildKey()}catch(t){throw console.error("Error generating child key:",t),t}}},{key:"createYinYangChildren",value:function(){var t=this;try{this.model.getSmallCircleData().forEach((function(e,r){e.score,e.angle;var i={minEdge:2*t.view.viewInitializer.smallCircleRadius,containerId:t.view.viewData.containerId,borderAnimationDuration:t.view.viewData.borderAnimationDuration};t.factory.create([t.model.sortedData[r]],i,t.model.isEnemy,t.getKey());var n=t.view.viewInitializer.borderOuterRadius,o=n/(2*t.view.viewInitializer.smallCircleRadius+n);t.view.viewInitializer.resizeWholePattern(o)}))}catch(t){throw console.error("Error drawing YinYang children:",t),t}}},{key:"InitializeAnimations",value:function(){var t=this;try{this.factory.animator.subscribe(this),this.view.addClickEventToYinYangGroup((function(){return t.factory.animator.revertRotation(t)})),["yang","yin"].forEach((function(e){t.view.addClickEventToArcGroups(e,(function(){return t.factory.animator.revertRotation(t)}))}))}catch(t){throw console.error("Error initializing animations:",t),t}}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangController=o},578:(t,e,r)=>{function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,o(i.key),i)}}function o(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangAppFactory=void 0;var a=r(573),s=r(535),c=r(839),l=r(5),u=r(892),y=r(948),p=r(528),f=r(67),h=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.idCounter=0,this.graphicsStrategy=e,this.instances=new Map,this.animator=this.createAnimationsManager()}var e,r;return e=t,r=[{key:"generateUniqueId",value:function(){return"".concat(this.idCounter++)}},{key:"getInstances",value:function(){return this.instances}},{key:"createModel",value:function(t){var e,r,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var o=n?null!==(r=null===(e=this.instances.get(n))||void 0===e?void 0:e.generateChildKey())&&void 0!==r?r:"":this.generateUniqueId();return new a.YinYangModel(t,o,n,i)}catch(t){throw console.error("Error creating model:",t),t}}},{key:"createView",value:function(){try{var t=new y.ViewInitializer(this.graphicsStrategy),e=new f.YinYangDrawer(t),r=new u.SpikeDrawer(t),i=new p.BorderDrawer(t);return new s.YinYangView(t,e,r,i)}catch(t){throw console.error("Error creating view:",t),t}}},{key:"createController",value:function(t,e){try{return new c.YinYangController(t,e,this)}catch(t){throw console.error("Error creating controller:",t),t}}},{key:"createAnimationsManager",value:function(){try{return new l.AnimationsMngr}catch(t){throw console.error("Error creating animations manager:",t),t}}},{key:"create",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;try{var n=this.createModel(t,r,i),o=this.createView(),a=this.createController(n,o);return o.initialize(a,e,this.instances.get(null!=i?i:"")),this.instances.set(n.key,a),a.InitializeAnimations(),a}catch(t){throw console.error("Error creating app:",t),t}}}],r&&n(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangAppFactory=h},573:(t,e,r)=>{function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function o(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,a(i.key),i)}}function a(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangModel=void 0;var s=r(468),c=function(){function t(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3?arguments[3]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sortedData=e.sort((function(t,e){return t.categorie.localeCompare(e.categorie)})),this.categories=this.setupCategories(e),this.key=r,this.parentKey=i,this.childCounter=0,this.borderNb=2,this.isEnemy=n}var e,r;return e=t,(r=[{key:"generateChildKey",value:function(){return"".concat(this.key,".").concat(this.childCounter++)}},{key:"calculateAverageScore",value:function(){var t=this.sortedData.reduce((function(t,e){return t+e.score}),0);return Math.round(t/this.sortedData.length*10)/10}},{key:"getSmallCircleData",value:function(){var t=this;return this.sortedData.map((function(e,r){return{score:e.score,angle:r*(2*Math.PI/t.sortedData.length)}}))}},{key:"setupCategories",value:function(t){var e=t.reduce((function(t,e){return t[e.categorie]=(t[e.categorie]||0)+1,t}),{}),r=t.length,i=[],o=0;return Object.entries(e).map((function(t){var e,a,c=(a=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,n=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw n}}return s}}(e,a)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=c[0],u=c[1],y=2*Math.PI*o,p=u/r;o+=p;var f=y+2*Math.PI*p;i.push({category:l,color:s.categoryColorNames[l]||"grey",percentage:p,angles:{startAngle:y,endAngle:f}})})),i}}])&&o(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangModel=c},528:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.BorderDrawer=void 0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ViewInitializer=e}var e,r;return e=t,r=[{key:"initialize",value:function(){this.viewData=this.ViewInitializer.viewData,this.yinYangGroup=this.ViewInitializer.yinYangGroup,this.graphicStrategy=this.ViewInitializer.graphicStrategy,this.positionX=this.ViewInitializer.positionX,this.positionY=this.ViewInitializer.positionY,this.borderThickness=this.ViewInitializer.borderThickness,this.innerRadius=this.ViewInitializer.borderInnerRadius,this.outerRadius=this.ViewInitializer.borderOuterRadius,this.categories=this.ViewInitializer.categories,this.isChild=this.ViewInitializer.isChild,this.containerId=this.ViewInitializer.containerId,this.key=this.ViewInitializer.key}},{key:"createBorders",value:function(){this.graphicStrategy.drawArc(this.yinYangGroup,this.positionX,this.positionY,this.innerRadius,this.outerRadius,0,2*Math.PI,this.ViewInitializer.isEnemy?"black":"white");for(var t=this.ViewInitializer.controller.getBorderNb(),e=0;e<t;e++){var r=this.innerRadius+this.borderThickness*e,i=r+this.borderThickness;this.drawBorder(r,i,e)}}},{key:"drawBorder",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.categories[0].color,n="";if(!this.isChild){var o=this.CreateBorderMaskAndGradient(t,e,r),a=o.border_gradient_id,s=o.borderMaskId;i="url(#".concat(a,")"),n="url(#".concat(s,")")}var c=this.yinYangGroup.appendElement("g"),l=this.graphicStrategy.drawCircle(c,this.positionX,this.positionY,t+this.borderThickness/2,"none",1);l.setStyle("stroke",i).setStyle("stroke-width",this.borderThickness.toString()),this.isChild||c.setStyle("filter","url(#rainbow-filter)"),this.isChild?l.setStyle("opacity","0.2"):l.setStyle("mask",n)}},{key:"CreateBorderMaskAndGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.categories.map((function(t){return t.color})),n=[{offset:"0%",color:i[0],opacity:1},{offset:"100%",color:i[i.length-1],opacity:1}],o="".concat(this.containerId,"-borderGradient-").concat(this.key,"-").concat(r),a=this.graphicStrategy.createLinearGradient(o,"0%","0%","100%","0%",n,"objectBoundingBox");this.graphicStrategy.changeBorderColors(a,this.viewData.borderAnimationDuration,i);var s="".concat(this.containerId,"-borderMaskId-").concat(this.key,"-").concat(r);return this.graphicStrategy.createBorderMask(s,this.positionX,this.positionY,t,e),{border_gradient_id:o,borderMaskId:s}}}],r&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.BorderDrawer=o},892:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.SpikeDrawer=void 0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ViewInitializer=e}var e,r;return e=t,(r=[{key:"initialize",value:function(){this.viewData=this.ViewInitializer.viewData,this.categories=this.ViewInitializer.categories,this.isChild=this.ViewInitializer.isChild,this.yinOrYangGroup=this.ViewInitializer.yinOrYangGroup,this.sortedData=this.ViewInitializer.controller.getSortedData(),this.positionX=this.ViewInitializer.positionX,this.containerId=this.ViewInitializer.containerId,this.key=this.ViewInitializer.key,this.graphicStrategy=this.ViewInitializer.graphicStrategy}},{key:"createSpikes",value:function(){this.drawYinYangSpikes(this.yinOrYangGroup)}},{key:"drawYinYangSpikes",value:function(t){var e=this;Object.values(t).forEach((function(t){e.drawYinOrYangSpikes(t.centerY,t.radius,t.type)}))}},{key:"drawYinOrYangSpikes",value:function(t,e,r){var i=this;this.categories.forEach((function(n){i.isChild||i.drawSpikes(n,t,e/i.yinOrYangGroup[r].smallRadiusRatio,e,r,n.angles.startAngle,n.angles.endAngle)}))}},{key:"drawSpikes",value:function(t,e,r,i,n,o,a){var s=this,c=this.sortedData.filter((function(e){return e.categorie===t.category}));c.forEach((function(l,u){var y=o+(a-o)*((u+1)/(c.length+1));y="yang"===n?-y+Math.PI:y;var p=s.positionX+r*Math.sin(y),f=e+r*Math.cos(y),h="yang"===n?s.ViewInitializer.borderInnerRadius*l.score:s.ViewInitializer.borderInnerRadius*(1-l.score),d=p+(h=h>i-r?i-r:h)*Math.sin(y),g=f+h*Math.cos(y),v=p.toString(),b=f.toString(),m=d.toString(),w=g.toString(),S="".concat(s.containerId,"-gradientSpike-").concat(s.key,"-").concat(n,"-").concat(t.category,"-").concat(u);s.graphicStrategy.createLinearGradient(S,v,b,m,w,[{offset:"0%",color:"yin"===n?"black":"white",opacity:1},{offset:"80%",color:t.color,opacity:1},{offset:"100%",color:t.color,opacity:0}],"userSpaceOnUse"),s.graphicStrategy.drawLineWithGradient(s.yinOrYangGroup[n].graphElementGroup,p,f,d,g,S)}))}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.SpikeDrawer=o},948:(t,e,r)=>{function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,o(i.key),i)}}function o(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.ViewInitializer=void 0;var a=r(939),s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.borderThicknessRatio=10,this.offsetfromBorder=0,this.graphicStrategy=e}var e,r;return e=t,(r=[{key:"initializeGraphicElements",value:function(t,e,r){this.containerId=e.containerId,this.controller=t,this.viewData=e,this.borderOuterRadius=this.viewData.minEdge/2,this.borderThickness=this.borderOuterRadius/this.borderThicknessRatio,this.borderInnerRadius=this.borderOuterRadius-this.borderThickness*t.getBorderNb(),this.smallCircleRadius=a.GeometryUtils.calculateSmallCircleRadius(this.borderInnerRadius,this.controller.getSortedData().length),this.distanceFromChild=r?0:this.borderOuterRadius+this.smallCircleRadius+this.offsetfromBorder,this.graphicContainer=r?r.view.viewInitializer.graphicContainer:this.createGraphicContainer(this.containerId),this.globalGroup=r?r.view.viewInitializer.globalGroup:this.graphicContainer.appendElement("g"),this.yinYangGroup=this.globalGroup.appendElement("g"),this.averageScore=this.controller.calculateAverageScore(),this.categories=this.controller.getCategories(),this.key=t.getKey(),this.isChild=!!r;var i=this.getPatternPosition(r);this.positionX=i.positionX,this.positionY=i.positionY,this.yinOrYangGroup=this.createYinOrYangGroups(),this.isEnemy=t.getIsEnemy()}},{key:"resizeWholePattern",value:function(t){this.graphicStrategy.resizeGroup(this.globalGroup,t,this.positionX,this.positionY)}},{key:"createGraphicContainer",value:function(t){return this.graphicStrategy.initialize(t,this.viewData.minEdge)}},{key:"createYinOrYangGroups",value:function(){var t=this.borderInnerRadius*this.averageScore,e=this.borderInnerRadius-t,r=this.positionY-e,i=this.positionY+t;return{yang:{type:"yang",graphElementGroup:this.globalGroup.appendElement("g"),centerY:r,radius:t,smallRadiusRatio:5},yin:{type:"yin",graphElementGroup:this.globalGroup.appendElement("g"),centerY:i,radius:e,smallRadiusRatio:5}}}},{key:"getPatternPosition",value:function(t){return t?this.GetChildPosition(t.view):this.centerMotif()}},{key:"GetChildPosition",value:function(t){var e,r=(Number(null===(e=this.controller)||void 0===e?void 0:e.getKey().split(".").pop())||0)*(2*Math.PI/t.controller.getSortedData().length);return{positionX:t.viewInitializer.positionX+t.viewInitializer.distanceFromChild*Math.cos(r),positionY:t.viewInitializer.positionY+t.viewInitializer.distanceFromChild*Math.sin(r)}}},{key:"centerMotif",value:function(){var t=this.graphicContainer.getDimensions();return{positionX:t.width/2,positionY:t.height/2}}}])&&n(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.ViewInitializer=s},67:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangDrawer=void 0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ViewInitializer=e}var e,r;return e=t,(r=[{key:"initialize",value:function(){this.viewData=this.ViewInitializer.viewData,this.yinYangGroup=this.ViewInitializer.yinYangGroup,this.yinOrYangGroup=this.ViewInitializer.yinOrYangGroup,this.graphicStrategy=this.ViewInitializer.graphicStrategy,this.positionX=this.ViewInitializer.positionX,this.positionY=this.ViewInitializer.positionY,this.categories=this.ViewInitializer.categories,this.containerId=this.ViewInitializer.containerId,this.key=this.ViewInitializer.key}},{key:"createYinYangPattern",value:function(){this.drawMainCircle(),this.drawSemiCircle(),this.drawYinYangSymbols(this.yinOrYangGroup)}},{key:"drawMainCircle",value:function(){this.graphicStrategy.drawCircle(this.yinYangGroup,this.positionX,this.positionY,this.ViewInitializer.borderInnerRadius,"white"),this.yinYangGroup.select("circle").setAttribute("stroke","black")}},{key:"drawSemiCircle",value:function(){this.graphicStrategy.drawArc(this.yinYangGroup,this.positionX,this.positionY,0,this.ViewInitializer.borderInnerRadius,0,Math.PI,"black")}},{key:"drawYinYangSymbols",value:function(t){var e=this;Object.values(t).forEach((function(t){e.drawYinOrYang(t.centerY,t.radius,t.type)}))}},{key:"drawYinOrYang",value:function(t,e,r){this.graphicStrategy.drawCircle(this.yinYangGroup,this.positionX,t,e,"yin"===r?"black":"white");var i=e/this.yinOrYangGroup[r].smallRadiusRatio;this.drawCategoryArcs(t,e,r,i),this.graphicStrategy.drawCircle(this.yinOrYangGroup[r].graphElementGroup,this.positionX,t,i,"yin"===r?"white":"black",1)}},{key:"drawCategoryArcs",value:function(t,e,r,i){var n=this;this.categories.forEach((function(o){var a="".concat(n.containerId,"-").concat(o.category,"-").concat(n.key,"-").concat(r),s="".concat(n.containerId,"-categoryArcMask-").concat(a);n.categories.length>1&&n.graphicStrategy.createYinOrYangArcMask(s,n.positionX,t,i,e,o.angles.startAngle,o.angles.endAngle,r);var c="".concat(n.containerId,"-categoryArcGradientId-").concat(a);n.graphicStrategy.createUnderlyingCircleGradient(c,o.color),n.graphicStrategy.createUnderlyingCircleWithArcMask(s,c,n.yinOrYangGroup[r].graphElementGroup,n.positionX,t,e)}))}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangDrawer=o},535:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangView=void 0;var o=function(){function t(e,r,i,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._positionX=0,this._positionY=0,this.viewInitializer=e,this.yinYangDrawer=r,this.spikeDrawer=i,this.borderDrawer=n}var e,r;return e=t,(r=[{key:"controller",get:function(){return this._controller},set:function(t){this._controller=t}},{key:"viewData",get:function(){return this._viewData},set:function(t){this._viewData=t}},{key:"positionX",get:function(){return this._positionX},set:function(t){this._positionX=t}},{key:"positionY",get:function(){return this._positionY},set:function(t){this._positionY=t}},{key:"viewInitializer",get:function(){return this._viewInitializer},set:function(t){this._viewInitializer=t}},{key:"yinYangDrawer",get:function(){return this._yinYangDrawer},set:function(t){this._yinYangDrawer=t}},{key:"spikeDrawer",get:function(){return this._spikeDrawer},set:function(t){this._spikeDrawer=t}},{key:"borderDrawer",get:function(){return this._borderDrawer},set:function(t){this._borderDrawer=t}},{key:"initialize",value:function(t,e,r){this.controller=t,this.viewData=e,this.viewInitializer.initializeGraphicElements(t,e,r),this.yinYangDrawer.initialize(),this.yinYangDrawer.createYinYangPattern(),this.spikeDrawer.initialize(),this.spikeDrawer.createSpikes(),this.borderDrawer.initialize(),this.borderDrawer.createBorders()}},{key:"addClickEventToYinYangGroup",value:function(t){this.viewInitializer.yinYangGroup.addEventListener("click",t)}},{key:"addClickEventToArcGroups",value:function(t,e){this.viewInitializer.yinOrYangGroup[t].graphElementGroup.addEventListener("click",e)}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangView=o},468:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.categoryColorNames=void 0,e.categoryColorNames={Environment:"green",Economy:"blue",Wellbeing:"red",Peace:"orange",Cooperation:"cyan"}},462:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[{categorie:"Environment",composante:"Déforestation de la forêt tropicale",score:.1,description:"Destruction massive de la forêt tropicale, menaçant les habitats naturels."},{categorie:"Environment",composante:"Drainage des tourbières",score:.2,description:"Assèchement des tourbières, perturbant l'écosystème et augmentant les émissions de CO2."},{categorie:"Environment",composante:"Plantations d'eucalyptus et d'acacias",score:.3,description:"Établissement de monocultures avec impact négatif sur la biodiversité."},{categorie:"Economy",composante:"Création d'emplois temporaires",score:.4,description:"Offre d'emplois à court terme mais sans développement durable à long terme."},{categorie:"Economy",composante:"Production de matières premières pour le papier",score:.5,description:"Contribution économique par la production de papier, mais avec des pratiques non durables."},{categorie:"Wellbeing",composante:"Violation des droits des indigènes Dayak",score:.1,description:"Vol des terres et déplacement des communautés locales, affectant leur mode de vie."},{categorie:"Wellbeing",composante:"Impact sur la santé des travailleurs",score:.3,description:"Conditions de travail potentiellement dangereuses sans mesures de protection adéquates."},{categorie:"Peace",composante:"Conflits avec les communautés locales",score:.2,description:"Tensions et conflits dus au vol des terres et à la destruction des ressources naturelles."},{categorie:"Peace",composante:"Manque de transparence financière",score:.2,description:"Absence de divulgation des informations sur les dirigeants et les pratiques de l'entreprise."},{categorie:"Cooperation",composante:"Relations avec les organisations environnementales",score:.1,description:"Faibles collaborations avec les ONG, malgré les appels à l'action."},{categorie:"Cooperation",composante:"Engagement envers la chaîne d’approvisionnement sans déforestation",score:.3,description:"Déclaration d'engagement par RGE, mais non-respecté par PT Mayawana Persada."}]},441:function(t,e,r){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeYinYangApp=void 0;var n=r(578),o=i(r(462)),a=r(317);function s(t){var e={modelDataEnemy:o.default,viewDataEnemy:t},r=new a.D3GraphicsStrategy;new n.YinYangAppFactory(r).create(e.modelDataEnemy,e.viewDataEnemy,!0)}e.initializeYinYangApp=s,document.addEventListener("DOMContentLoaded",(function(){try{var t=document.getElementById("svg-container");if(!t)throw new Error("#svg-container non trouvé");var e=t.clientWidth,r=t.clientHeight;s({minEdge:Math.min(e,r),containerId:"svg-container",borderAnimationDuration:15e3})}catch(t){console.error("An error occurred during initialization:",t)}}))},620:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.D3Animator=void 0;var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r;return e=t,(r=[{key:"applyColorAnimation",value:function(t,e,r){var i=document.createElementNS("http://www.w3.org/2000/svg","animate");i.setAttribute("attributeName","stop-color"),i.setAttribute("values",r.join(";")),i.setAttribute("dur","".concat(e,"ms")),i.setAttribute("repeatCount","indefinite"),t.appendChild(i)}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.D3Animator=o},601:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.D3Element=void 0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.selection=e}var e,r;return e=t,r=[{key:"appendElement",value:function(e){return new t(this.selection.append(e))}},{key:"setStyle",value:function(t,e){return this.selection.style(t,e),this}},{key:"setAttribute",value:function(t,e){return this.selection.attr(t,e),this}},{key:"addEventListener",value:function(t,e){this.selection.on(t,e)}},{key:"getSelection",value:function(){return this.selection}},{key:"select",value:function(e){return new t(this.selection.select(e))}},{key:"node",value:function(){return this.selection.node()}},{key:"getDimensions",value:function(){var t=this.selection.node();if(t instanceof SVGSVGElement){var e=t.getBoundingClientRect();return{width:e.width,height:e.height}}return{width:0,height:0}}},{key:"interruptAllAnimation",value:function(){this.selection.interrupt().selectAll("*").interrupt()}},{key:"applyContinuousRotation",value:function(t,e,r){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.selection.transition().duration(t).attrTween("transform",(function(){return function(t){return"rotate(".concat(t*(i?360:-360),",").concat(e,",").concat(r,")")}}))}},{key:"applyTranslationAndRotationAltogether",value:function(t,e,r,i,n,o){this.selection.transition().duration(t).attrTween("transform",(function(){return function(t){var a=2*t*Math.PI*(n?1:-1),s=i*Math.sin(a),c=i-i*Math.cos(a),l=e+s,u=r+c,y="yang"===o?3:-1,p=180*a/Math.PI;return"rotate(".concat(y*p,", ").concat(l,", ").concat(u,") translate(").concat(s,", ").concat(c,")")}}))}}],r&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.D3Element=o},317:function(t,e,r){function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function o(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,a(i.key),i)}}function a(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:String(e)}var s=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),c=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&s(e,t,r);return c(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.D3GraphicsStrategy=void 0;var u=l(r(893)),y=r(601),p=r(620),f=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.animator=new p.D3Animator,this.currentScale=1,this.currentY=0,this.currentX=0}var e,r;return e=t,r=[{key:"initialize",value:function(t,e){var r=u.select("#".concat(t)).append("svg").attr("width",e).attr("height",e);return this.defs=new y.D3Element(r.append("defs")),new y.D3Element(r)}},{key:"resizeGroup",value:function(t,e,r,i){t.setAttribute("transform","translate(".concat(r,", ").concat(i,") \n scale(").concat(e,") \n translate(").concat(-r,", ").concat(-i,") "))}},{key:"drawArc",value:function(t,e,r,i,n,o,a,s){var c=u.arc().innerRadius(i).outerRadius(n).startAngle(o).endAngle(a);t.appendElement("path").setAttribute("d",c).setAttribute("transform","translate(".concat(e,",").concat(r,")")).setStyle("fill",s)}},{key:"drawCircle",value:function(t,e,r,i,n){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return t.appendElement("circle").setAttribute("cx",e.toString()).setAttribute("cy",r.toString()).setAttribute("r",i.toString()).setStyle("fill",n).setStyle("opacity",o.toString())}},{key:"createLinearGradient",value:function(t,e,r,i,n,o,a){var s=this.defs.appendElement("linearGradient").setAttribute("id",t).setAttribute("x1",e).setAttribute("y1",r).setAttribute("x2",i).setAttribute("y2",n).setAttribute("gradientUnits",a);return o.forEach((function(t){s.appendElement("stop").setAttribute("offset",t.offset).setAttribute("stop-color",t.color).setAttribute("stop-opacity",t.opacity.toString())})),s}},{key:"createArc",value:function(t,e,r,i){return u.arc().innerRadius(t).outerRadius(e).startAngle(r).endAngle(i)}},{key:"createYinOrYangArcMask",value:function(t,e,r,i,n,o,a,s){var c=Math.PI-o,l=Math.PI-a,u=this.createArc(i,n,"yang"===s?o:c,"yang"===s?a:l),y=this.defs.appendElement("mask").setAttribute("id",t);this.createLinearGradient("start","0%","0%","100%","0%",[{offset:"0%",color:"white",opacity:1},{offset:"100%",color:"white",opacity:0}],"objectBoundingBox"),this.createLinearGradient("end","0%","0%","100%","0%",[{offset:"0%",color:"white",opacity:0},{offset:"100%",color:"white",opacity:1}],"objectBoundingBox");var p=180+180*("yang"===s?o:c)/Math.PI,f=.1*n;y.appendElement("rect").setAttribute("x",(e-("yang"===s?0:f)).toString()).setAttribute("y",r.toString()).setAttribute("transform","rotate(".concat(p,",").concat(e,",").concat(r,")")).setAttribute("width",f.toString()).setAttribute("height",n.toString()).setAttribute("fill","yang"===s?"url(#start)":"url(#end)");var h=180+180*("yang"===s?a:l)/Math.PI;return y.appendElement("rect").setAttribute("x",(e-("yang"===s?f:0)).toString()).setAttribute("y",r.toString()).setAttribute("transform","rotate(".concat(h,",").concat(e,",").concat(r.toString(),")")).setAttribute("width",f.toString()).setAttribute("height",n.toString()).setAttribute("fill","yang"===s?"url(#end)":"url(#start)"),y.appendElement("path").setAttribute("d",u({})||"").setAttribute("transform","translate(".concat(e,", ").concat(r.toString(),")")).setAttribute("fill","white"),y}},{key:"createBorderMask",value:function(t,e,r,i,n){var o=this.createArc(i,n,0,2*Math.PI),a=this.defs.appendElement("mask").setAttribute("id",t),s=this.defs.appendElement("radialGradient").setAttribute("id","borderMaskGradient").setAttribute("cx","50%").setAttribute("cy","50%").setAttribute("r","50%"),c=i/n,l=100*c,u=l+100*(1-c)*.7;s.appendElement("stop").setAttribute("offset","".concat(l,"%")).setAttribute("stop-color","white").setAttribute("stop-opacity","1"),s.appendElement("stop").setAttribute("offset","".concat(u,"%")).setAttribute("stop-color","white").setAttribute("stop-opacity","0"),a.appendElement("path").setAttribute("d",o({})||"").setAttribute("transform","translate(".concat(e,", ").concat(r,")")).setAttribute("fill","url(#borderMaskGradient)")}},{key:"changeBorderColors",value:function(t,e,r){var i=e;r.push(r[0]),this.animator.applyColorAnimation(t.select("stop:first-child").node(),i,r);var o,a=(o=r,function(t){if(Array.isArray(t))return n(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).filter((function(t){return void 0!==t}));a.length>0&&a.unshift(a.pop()),a.push(a[0]),this.animator.applyColorAnimation(t.select("stop:last-child").node(),i,a)}},{key:"drawLineWithGradient",value:function(t,e,r,i,n,o){t.appendElement("line").setAttribute("x1",e.toString()).setAttribute("y1",r.toString()).setAttribute("x2",i.toString()).setAttribute("y2",n.toString()).setStyle("stroke","url(#".concat(o,")"))}},{key:"createUnderlyingCircleGradient",value:function(t,e){var r=this.defs.appendElement("radialGradient").setAttribute("id",t).setAttribute("cx","50%").setAttribute("cy","50%").setAttribute("r","50%");r.appendElement("stop").setAttribute("offset","0%").setAttribute("stop-color",e).setAttribute("stop-opacity","1"),r.appendElement("stop").setAttribute("offset","100%").setAttribute("stop-color",e).setAttribute("stop-opacity","0")}},{key:"createUnderlyingCircleWithArcMask",value:function(t,e,r,i,n,o){this.drawCircle(r,i,n,o,"url(#".concat(e,")")).setAttribute("mask","url(#".concat(t,")"))}}],r&&o(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.D3GraphicsStrategy=f},939:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.GeometryUtils=void 0;var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r;return e=t,r=[{key:"calculateSpikeLength",value:function(t,e){return t*e*.5}},{key:"calculateSmallCircleRadius",value:function(t,e){return 2*Math.PI*t/e/2}}],null&&i(e.prototype,null),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GeometryUtils=o},893:e=>{e.exports=t}},r={};return function t(i){var n=r[i];if(void 0!==n)return n.exports;var o=r[i]={exports:{}};return e[i].call(o.exports,o,o.exports,t),o.exports}(441)})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3")):"function"==typeof define&&define.amd?define(["d3"],e):"object"==typeof exports?exports.YinYangApp=e(require("d3")):t.YinYangApp=e(t.d3)}(this,(t=>(()=>{"use strict";var e={5:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.AnimationsMngr=void 0;var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.subscribers=[]}var e,r;return e=t,r=[{key:"subscribe",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e4;this.subscribers.push({component:t,clockWise:e,time:r})}},{key:"startAll",value:function(){var t=this;this.subscribers.forEach((function(e){var r=e.component,i=e.clockWise,n=e.time;return t.animate(r,i,n)}))}},{key:"revertRotation",value:function(t){var e=this.subscribers.find((function(e){return e.component===t}));e&&(t.view.viewInitializer.yinYangGroup.interruptAllAnimation(),e.clockWise=!e.clockWise,this.animate(t,e.clockWise,e.time))}},{key:"animate",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,i=t.view.viewInitializer,n=i.yinYangGroup,o=i.yinOrYangGroup,a=i.positionX,s=i.positionY;n.applyContinuousRotation(r,a,s,e),Object.values(o).forEach((function(t){var n=t.type,o=i.yinOrYangGroup.yin.centerY,s=i.yinOrYangGroup.yang.centerY,c=i.yinOrYangGroup.yin.radius,l=i.yinOrYangGroup.yang.radius,u="yang"===n?c:-l,y="yang"===n?s:o;t.graphElementGroup.applyTranslationAndRotationAltogether(r,a,y,u,e,n)}))}}],r&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.AnimationsMngr=o},839:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangController=void 0;var o=function(){function t(e,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.model=e,this.view=r,this.factory=i,this.animator=r.viewInitializer.graphicStrategy.animator}var e,r;return e=t,(r=[{key:"getBorderNb",value:function(){try{return this.model.borderNb}catch(t){throw console.error("Error getting border number:",t),t}}},{key:"getSortedData",value:function(){try{return this.model.sortedData}catch(t){throw console.error("Error getting sorted data:",t),t}}},{key:"getCategories",value:function(){try{return this.model.categories}catch(t){throw console.error("Error getting categories:",t),t}}},{key:"getKey",value:function(){try{return this.model.key}catch(t){throw console.error("Error getting key:",t),t}}},{key:"getParentKey",value:function(){try{return this.model.parentKey}catch(t){throw console.error("Error getting parent key:",t),t}}},{key:"getIsEnemy",value:function(){try{return this.model.isEnemy}catch(t){throw console.error("Error getting isEnemy status:",t),t}}},{key:"calculateAverageScore",value:function(){try{return this.model.calculateAverageScore()}catch(t){throw console.error("Error calculating average score:",t),t}}},{key:"generateChildKey",value:function(){try{return this.model.generateChildKey()}catch(t){throw console.error("Error generating child key:",t),t}}},{key:"createYinYangChildren",value:function(){var t=this;try{this.model.getSmallCircleData().forEach((function(e,r){e.score,e.angle;var i={minEdge:2*t.view.viewInitializer.smallCircleRadius,containerId:t.view.viewData.containerId,borderAnimationDuration:t.view.viewData.borderAnimationDuration};t.factory.create([t.model.sortedData[r]],i,t.model.isEnemy,t.getKey());var n=t.view.viewInitializer.borderOuterRadius,o=n/(2*t.view.viewInitializer.smallCircleRadius+n);t.view.viewInitializer.resizeWholePattern(o)}))}catch(t){throw console.error("Error drawing YinYang children:",t),t}}},{key:"InitializeAnimations",value:function(){var t=this;try{this.factory.animator.subscribe(this),this.view.addClickEventToYinYangGroup((function(){return t.factory.animator.revertRotation(t)})),["yang","yin"].forEach((function(e){t.view.addClickEventToArcGroups(e,(function(){return t.factory.animator.revertRotation(t)}))}))}catch(t){throw console.error("Error initializing animations:",t),t}}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangController=o},578:(t,e,r)=>{function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,o(i.key),i)}}function o(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangAppFactory=void 0;var a=r(573),s=r(535),c=r(839),l=r(5),u=r(892),y=r(948),p=r(528),f=r(67),h=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.idCounter=0,this.graphicsStrategy=e,this.instances=new Map,this.animator=this.createAnimationsManager()}var e,r;return e=t,r=[{key:"generateUniqueId",value:function(){return"".concat(this.idCounter++)}},{key:"getInstances",value:function(){return this.instances}},{key:"createModel",value:function(t){var e,r,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var o=n?null!==(r=null===(e=this.instances.get(n))||void 0===e?void 0:e.generateChildKey())&&void 0!==r?r:"":this.generateUniqueId();return new a.YinYangModel(t,o,n,i)}catch(t){throw console.error("Error creating model:",t),t}}},{key:"createView",value:function(){try{var t=new y.ViewInitializer(this.graphicsStrategy),e=new f.YinYangDrawer(t),r=new u.SpikeDrawer(t),i=new p.BorderDrawer(t);return new s.YinYangView(t,e,r,i)}catch(t){throw console.error("Error creating view:",t),t}}},{key:"createController",value:function(t,e){try{return new c.YinYangController(t,e,this)}catch(t){throw console.error("Error creating controller:",t),t}}},{key:"createAnimationsManager",value:function(){try{return new l.AnimationsMngr}catch(t){throw console.error("Error creating animations manager:",t),t}}},{key:"create",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;try{var n=this.createModel(t,r,i),o=this.createView(),a=this.createController(n,o);return o.initialize(a,e,this.instances.get(null!=i?i:"")),this.instances.set(n.key,a),a.InitializeAnimations(),a}catch(t){throw console.error("Error creating app:",t),t}}}],r&&n(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangAppFactory=h},573:(t,e,r)=>{function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function o(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,a(i.key),i)}}function a(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangModel=void 0;var s=r(468),c=function(){function t(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3?arguments[3]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sortedData=e.sort((function(t,e){return t.categorie.localeCompare(e.categorie)})),this.categories=this.setupCategories(e),this.key=r,this.parentKey=i,this.childCounter=0,this.borderNb=2,this.isEnemy=n}var e,r;return e=t,(r=[{key:"generateChildKey",value:function(){return"".concat(this.key,".").concat(this.childCounter++)}},{key:"calculateAverageScore",value:function(){var t=this.sortedData.reduce((function(t,e){return t+e.score}),0);return Math.round(t/this.sortedData.length*10)/10}},{key:"getSmallCircleData",value:function(){var t=this;return this.sortedData.map((function(e,r){return{score:e.score,angle:r*(2*Math.PI/t.sortedData.length)}}))}},{key:"setupCategories",value:function(t){var e=t.reduce((function(t,e){return t[e.categorie]=(t[e.categorie]||0)+1,t}),{}),r=t.length,i=[],o=0;return Object.entries(e).map((function(t){var e,a,c=(a=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(i=o.call(r)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,n=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw n}}return s}}(e,a)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=c[0],u=c[1],y=2*Math.PI*o,p=u/r;o+=p;var f=y+2*Math.PI*p;i.push({category:l,color:s.categoryColorNames[l]||"grey",percentage:p,angles:{startAngle:y,endAngle:f}})})),i}}])&&o(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangModel=c},528:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.BorderDrawer=void 0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ViewInitializer=e}var e,r;return e=t,r=[{key:"initialize",value:function(){this.viewData=this.ViewInitializer.viewData,this.yinYangGroup=this.ViewInitializer.yinYangGroup,this.graphicStrategy=this.ViewInitializer.graphicStrategy,this.positionX=this.ViewInitializer.positionX,this.positionY=this.ViewInitializer.positionY,this.borderThickness=this.ViewInitializer.borderThickness,this.innerRadius=this.ViewInitializer.borderInnerRadius,this.outerRadius=this.ViewInitializer.borderOuterRadius,this.categories=this.ViewInitializer.categories,this.isChild=this.ViewInitializer.isChild,this.containerId=this.ViewInitializer.containerId,this.key=this.ViewInitializer.key}},{key:"createBorders",value:function(){this.graphicStrategy.drawArc(this.yinYangGroup,this.positionX,this.positionY,this.innerRadius,this.outerRadius,0,2*Math.PI,this.ViewInitializer.isEnemy?"black":"white");for(var t=this.ViewInitializer.controller.getBorderNb(),e=0;e<t;e++){var r=this.innerRadius+this.borderThickness*e,i=r+this.borderThickness;this.drawBorder(r,i,e)}}},{key:"drawBorder",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.categories[0].color,n="";if(!this.isChild){var o=this.CreateBorderMaskAndGradient(t,e,r),a=o.border_gradient_id,s=o.borderMaskId;i="url(#".concat(a,")"),n="url(#".concat(s,")")}var c=this.yinYangGroup.appendElement("g"),l=this.graphicStrategy.drawCircle(c,this.positionX,this.positionY,t+this.borderThickness/2,"none",1);l.setStyle("stroke",i).setStyle("stroke-width",this.borderThickness.toString()),this.isChild||c.setStyle("filter","url(#rainbow-filter)"),this.isChild?l.setStyle("opacity","0.2"):l.setStyle("mask",n)}},{key:"CreateBorderMaskAndGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.categories.map((function(t){return t.color})),n=[{offset:"0%",color:i[0],opacity:1},{offset:"100%",color:i[i.length-1],opacity:1}],o="".concat(this.containerId,"-borderGradient-").concat(this.key,"-").concat(r),a=this.graphicStrategy.createLinearGradient(o,"0%","0%","100%","0%",n,"objectBoundingBox");this.graphicStrategy.changeBorderColors(a,this.viewData.borderAnimationDuration,i);var s="".concat(this.containerId,"-borderMaskId-").concat(this.key,"-").concat(r);return this.graphicStrategy.createBorderMask(s,this.positionX,this.positionY,t,e),{border_gradient_id:o,borderMaskId:s}}}],r&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.BorderDrawer=o},892:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.SpikeDrawer=void 0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ViewInitializer=e}var e,r;return e=t,(r=[{key:"initialize",value:function(){this.viewData=this.ViewInitializer.viewData,this.categories=this.ViewInitializer.categories,this.isChild=this.ViewInitializer.isChild,this.yinOrYangGroup=this.ViewInitializer.yinOrYangGroup,this.sortedData=this.ViewInitializer.controller.getSortedData(),this.positionX=this.ViewInitializer.positionX,this.containerId=this.ViewInitializer.containerId,this.key=this.ViewInitializer.key,this.graphicStrategy=this.ViewInitializer.graphicStrategy}},{key:"createSpikes",value:function(){this.drawYinYangSpikes(this.yinOrYangGroup)}},{key:"drawYinYangSpikes",value:function(t){var e=this;Object.values(t).forEach((function(t){e.drawYinOrYangSpikes(t.centerY,t.radius,t.type)}))}},{key:"drawYinOrYangSpikes",value:function(t,e,r){var i=this;this.categories.forEach((function(n){i.isChild||i.drawSpikes(n,t,e/i.yinOrYangGroup[r].smallRadiusRatio,e,r,n.angles.startAngle,n.angles.endAngle)}))}},{key:"drawSpikes",value:function(t,e,r,i,n,o,a){var s=this,c=this.sortedData.filter((function(e){return e.categorie===t.category}));c.forEach((function(l,u){var y=o+(a-o)*((u+1)/(c.length+1));y="yang"===n?-y+Math.PI:y;var p=s.positionX+r*Math.sin(y),f=e+r*Math.cos(y),h="yang"===n?s.ViewInitializer.borderInnerRadius*l.score:s.ViewInitializer.borderInnerRadius*(1-l.score),d=p+(h=h>i-r?i-r:h)*Math.sin(y),g=f+h*Math.cos(y),v=p.toString(),b=f.toString(),m=d.toString(),w=g.toString(),S="".concat(s.containerId,"-gradientSpike-").concat(s.key,"-").concat(n,"-").concat(t.category,"-").concat(u);s.graphicStrategy.createLinearGradient(S,v,b,m,w,[{offset:"0%",color:"yin"===n?"black":"white",opacity:1},{offset:"80%",color:t.color,opacity:1},{offset:"100%",color:t.color,opacity:0}],"userSpaceOnUse"),s.graphicStrategy.drawLineWithGradient(s.yinOrYangGroup[n].graphElementGroup,p,f,d,g,S)}))}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.SpikeDrawer=o},948:(t,e,r)=>{function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,o(i.key),i)}}function o(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.ViewInitializer=void 0;var a=r(939),s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.borderThicknessRatio=10,this.offsetfromBorder=0,this.graphicStrategy=e}var e,r;return e=t,(r=[{key:"initializeGraphicElements",value:function(t,e,r){this.containerId=e.containerId,this.controller=t,this.viewData=e,this.borderOuterRadius=this.viewData.minEdge/2,this.borderThickness=this.borderOuterRadius/this.borderThicknessRatio,this.borderInnerRadius=this.borderOuterRadius-this.borderThickness*t.getBorderNb(),this.smallCircleRadius=a.GeometryUtils.calculateSmallCircleRadius(this.borderInnerRadius,this.controller.getSortedData().length),this.distanceFromChild=r?0:this.borderOuterRadius+this.smallCircleRadius+this.offsetfromBorder,this.graphicContainer=r?r.view.viewInitializer.graphicContainer:this.createGraphicContainer(this.containerId),this.globalGroup=r?r.view.viewInitializer.globalGroup:this.graphicContainer.appendElement("g"),this.yinYangGroup=this.globalGroup.appendElement("g"),this.averageScore=this.controller.calculateAverageScore(),this.categories=this.controller.getCategories(),this.key=t.getKey(),this.isChild=!!r;var i=this.getPatternPosition(r);this.positionX=i.positionX,this.positionY=i.positionY,this.yinOrYangGroup=this.createYinOrYangGroups(),this.isEnemy=t.getIsEnemy()}},{key:"resizeWholePattern",value:function(t){this.graphicStrategy.resizeGroup(this.globalGroup,t,this.positionX,this.positionY)}},{key:"createGraphicContainer",value:function(t){return this.graphicStrategy.initialize(t,this.viewData.minEdge)}},{key:"createYinOrYangGroups",value:function(){var t=this.borderInnerRadius*this.averageScore,e=this.borderInnerRadius-t,r=this.positionY-e,i=this.positionY+t;return{yang:{type:"yang",graphElementGroup:this.globalGroup.appendElement("g"),centerY:r,radius:t,smallRadiusRatio:5},yin:{type:"yin",graphElementGroup:this.globalGroup.appendElement("g"),centerY:i,radius:e,smallRadiusRatio:5}}}},{key:"getPatternPosition",value:function(t){return t?this.GetChildPosition(t.view):this.centerMotif()}},{key:"GetChildPosition",value:function(t){var e,r=(Number(null===(e=this.controller)||void 0===e?void 0:e.getKey().split(".").pop())||0)*(2*Math.PI/t.controller.getSortedData().length);return{positionX:t.viewInitializer.positionX+t.viewInitializer.distanceFromChild*Math.cos(r),positionY:t.viewInitializer.positionY+t.viewInitializer.distanceFromChild*Math.sin(r)}}},{key:"centerMotif",value:function(){var t=this.graphicContainer.getDimensions();return{positionX:t.width/2,positionY:t.height/2}}}])&&n(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.ViewInitializer=s},67:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangDrawer=void 0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ViewInitializer=e}var e,r;return e=t,(r=[{key:"initialize",value:function(){this.viewData=this.ViewInitializer.viewData,this.yinYangGroup=this.ViewInitializer.yinYangGroup,this.yinOrYangGroup=this.ViewInitializer.yinOrYangGroup,this.graphicStrategy=this.ViewInitializer.graphicStrategy,this.positionX=this.ViewInitializer.positionX,this.positionY=this.ViewInitializer.positionY,this.categories=this.ViewInitializer.categories,this.containerId=this.ViewInitializer.containerId,this.key=this.ViewInitializer.key}},{key:"createYinYangPattern",value:function(){this.drawMainCircle(),this.drawSemiCircle(),this.drawYinYangSymbols(this.yinOrYangGroup)}},{key:"drawMainCircle",value:function(){this.graphicStrategy.drawCircle(this.yinYangGroup,this.positionX,this.positionY,this.ViewInitializer.borderInnerRadius,"white"),this.yinYangGroup.select("circle").setAttribute("stroke","black")}},{key:"drawSemiCircle",value:function(){this.graphicStrategy.drawArc(this.yinYangGroup,this.positionX,this.positionY,0,this.ViewInitializer.borderInnerRadius,0,Math.PI,"black")}},{key:"drawYinYangSymbols",value:function(t){var e=this;Object.values(t).forEach((function(t){e.drawYinOrYang(t.centerY,t.radius,t.type)}))}},{key:"drawYinOrYang",value:function(t,e,r){this.graphicStrategy.drawCircle(this.yinYangGroup,this.positionX,t,e,"yin"===r?"black":"white");var i=e/this.yinOrYangGroup[r].smallRadiusRatio;this.drawCategoryArcs(t,e,r,i),this.graphicStrategy.drawCircle(this.yinOrYangGroup[r].graphElementGroup,this.positionX,t,i,"yin"===r?"white":"black",1)}},{key:"drawCategoryArcs",value:function(t,e,r,i){var n=this;this.categories.forEach((function(o){var a="".concat(n.containerId,"-").concat(o.category,"-").concat(n.key,"-").concat(r),s="".concat(n.containerId,"-categoryArcMask-").concat(a);n.categories.length>1&&n.graphicStrategy.createYinOrYangArcMask(s,n.positionX,t,i,e,o.angles.startAngle,o.angles.endAngle,r);var c="".concat(n.containerId,"-categoryArcGradientId-").concat(a);n.graphicStrategy.createUnderlyingCircleGradient(c,o.color),n.graphicStrategy.createUnderlyingCircleWithArcMask(s,c,n.yinOrYangGroup[r].graphElementGroup,n.positionX,t,e)}))}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangDrawer=o},535:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.YinYangView=void 0;var o=function(){function t(e,r,i,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._positionX=0,this._positionY=0,this.viewInitializer=e,this.yinYangDrawer=r,this.spikeDrawer=i,this.borderDrawer=n}var e,r;return e=t,(r=[{key:"controller",get:function(){return this._controller},set:function(t){this._controller=t}},{key:"viewData",get:function(){return this._viewData},set:function(t){this._viewData=t}},{key:"positionX",get:function(){return this._positionX},set:function(t){this._positionX=t}},{key:"positionY",get:function(){return this._positionY},set:function(t){this._positionY=t}},{key:"viewInitializer",get:function(){return this._viewInitializer},set:function(t){this._viewInitializer=t}},{key:"yinYangDrawer",get:function(){return this._yinYangDrawer},set:function(t){this._yinYangDrawer=t}},{key:"spikeDrawer",get:function(){return this._spikeDrawer},set:function(t){this._spikeDrawer=t}},{key:"borderDrawer",get:function(){return this._borderDrawer},set:function(t){this._borderDrawer=t}},{key:"initialize",value:function(t,e,r){this.controller=t,this.viewData=e,this.viewInitializer.initializeGraphicElements(t,e,r),this.yinYangDrawer.initialize(),this.yinYangDrawer.createYinYangPattern(),this.spikeDrawer.initialize(),this.spikeDrawer.createSpikes(),this.borderDrawer.initialize(),this.borderDrawer.createBorders()}},{key:"addClickEventToYinYangGroup",value:function(t){this.viewInitializer.yinYangGroup.addEventListener("click",t)}},{key:"addClickEventToArcGroups",value:function(t,e){this.viewInitializer.yinOrYangGroup[t].graphElementGroup.addEventListener("click",e)}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.YinYangView=o},468:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.categoryColorNames=void 0,e.categoryColorNames={Environment:"green",Economy:"blue",Wellbeing:"red",Peace:"orange",Cooperation:"cyan"}},462:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[{categorie:"Environment",composante:"Déforestation de la forêt tropicale",score:.1,description:"Destruction massive de la forêt tropicale, menaçant les habitats naturels."},{categorie:"Environment",composante:"Drainage des tourbières",score:.2,description:"Assèchement des tourbières, perturbant l'écosystème et augmentant les émissions de CO2."},{categorie:"Environment",composante:"Plantations d'eucalyptus et d'acacias",score:.3,description:"Établissement de monocultures avec impact négatif sur la biodiversité."},{categorie:"Economy",composante:"Création d'emplois temporaires",score:.4,description:"Offre d'emplois à court terme mais sans développement durable à long terme."},{categorie:"Economy",composante:"Production de matières premières pour le papier",score:.5,description:"Contribution économique par la production de papier, mais avec des pratiques non durables."},{categorie:"Wellbeing",composante:"Violation des droits des indigènes Dayak",score:.1,description:"Vol des terres et déplacement des communautés locales, affectant leur mode de vie."},{categorie:"Wellbeing",composante:"Impact sur la santé des travailleurs",score:.3,description:"Conditions de travail potentiellement dangereuses sans mesures de protection adéquates."},{categorie:"Peace",composante:"Conflits avec les communautés locales",score:.2,description:"Tensions et conflits dus au vol des terres et à la destruction des ressources naturelles."},{categorie:"Peace",composante:"Manque de transparence financière",score:.2,description:"Absence de divulgation des informations sur les dirigeants et les pratiques de l'entreprise."},{categorie:"Cooperation",composante:"Relations avec les organisations environnementales",score:.1,description:"Faibles collaborations avec les ONG, malgré les appels à l'action."},{categorie:"Cooperation",composante:"Engagement envers la chaîne d’approvisionnement sans déforestation",score:.3,description:"Déclaration d'engagement par RGE, mais non-respecté par PT Mayawana Persada."}]},441:function(t,e,r){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeYinYangApp=void 0;var n=r(578),o=i(r(462)),a=r(317);e.initializeYinYangApp=function(t){var e={modelDataEnemy:o.default,viewDataEnemy:t},r=new a.D3GraphicsStrategy;new n.YinYangAppFactory(r).create(e.modelDataEnemy,e.viewDataEnemy,!0)}},620:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.D3Animator=void 0;var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r;return e=t,(r=[{key:"applyColorAnimation",value:function(t,e,r){var i=document.createElementNS("http://www.w3.org/2000/svg","animate");i.setAttribute("attributeName","stop-color"),i.setAttribute("values",r.join(";")),i.setAttribute("dur","".concat(e,"ms")),i.setAttribute("repeatCount","indefinite"),t.appendChild(i)}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.D3Animator=o},601:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.D3Element=void 0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.selection=e}var e,r;return e=t,r=[{key:"appendElement",value:function(e){return new t(this.selection.append(e))}},{key:"setStyle",value:function(t,e){return this.selection.style(t,e),this}},{key:"setAttribute",value:function(t,e){return this.selection.attr(t,e),this}},{key:"addEventListener",value:function(t,e){this.selection.on(t,e)}},{key:"getSelection",value:function(){return this.selection}},{key:"select",value:function(e){return new t(this.selection.select(e))}},{key:"node",value:function(){return this.selection.node()}},{key:"getDimensions",value:function(){var t=this.selection.node();if(t instanceof SVGSVGElement){var e=t.getBoundingClientRect();return{width:e.width,height:e.height}}return{width:0,height:0}}},{key:"interruptAllAnimation",value:function(){this.selection.interrupt().selectAll("*").interrupt()}},{key:"applyContinuousRotation",value:function(t,e,r){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.selection.transition().duration(t).attrTween("transform",(function(){return function(t){return"rotate(".concat(t*(i?360:-360),",").concat(e,",").concat(r,")")}}))}},{key:"applyTranslationAndRotationAltogether",value:function(t,e,r,i,n,o){this.selection.transition().duration(t).attrTween("transform",(function(){return function(t){var a=2*t*Math.PI*(n?1:-1),s=i*Math.sin(a),c=i-i*Math.cos(a),l=e+s,u=r+c,y="yang"===o?3:-1,p=180*a/Math.PI;return"rotate(".concat(y*p,", ").concat(l,", ").concat(u,") translate(").concat(s,", ").concat(c,")")}}))}}],r&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.D3Element=o},317:function(t,e,r){function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function o(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,a(i.key),i)}}function a(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:String(e)}var s=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),c=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&s(e,t,r);return c(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.D3GraphicsStrategy=void 0;var u=l(r(893)),y=r(601),p=r(620),f=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.animator=new p.D3Animator,this.currentScale=1,this.currentY=0,this.currentX=0}var e,r;return e=t,r=[{key:"initialize",value:function(t,e){var r=u.select("#".concat(t)).append("svg").attr("width",e).attr("height",e);return this.defs=new y.D3Element(r.append("defs")),new y.D3Element(r)}},{key:"resizeGroup",value:function(t,e,r,i){t.setAttribute("transform","translate(".concat(r,", ").concat(i,") \n scale(").concat(e,") \n translate(").concat(-r,", ").concat(-i,") "))}},{key:"drawArc",value:function(t,e,r,i,n,o,a,s){var c=u.arc().innerRadius(i).outerRadius(n).startAngle(o).endAngle(a);t.appendElement("path").setAttribute("d",c).setAttribute("transform","translate(".concat(e,",").concat(r,")")).setStyle("fill",s)}},{key:"drawCircle",value:function(t,e,r,i,n){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return t.appendElement("circle").setAttribute("cx",e.toString()).setAttribute("cy",r.toString()).setAttribute("r",i.toString()).setStyle("fill",n).setStyle("opacity",o.toString())}},{key:"createLinearGradient",value:function(t,e,r,i,n,o,a){var s=this.defs.appendElement("linearGradient").setAttribute("id",t).setAttribute("x1",e).setAttribute("y1",r).setAttribute("x2",i).setAttribute("y2",n).setAttribute("gradientUnits",a);return o.forEach((function(t){s.appendElement("stop").setAttribute("offset",t.offset).setAttribute("stop-color",t.color).setAttribute("stop-opacity",t.opacity.toString())})),s}},{key:"createArc",value:function(t,e,r,i){return u.arc().innerRadius(t).outerRadius(e).startAngle(r).endAngle(i)}},{key:"createYinOrYangArcMask",value:function(t,e,r,i,n,o,a,s){var c=Math.PI-o,l=Math.PI-a,u=this.createArc(i,n,"yang"===s?o:c,"yang"===s?a:l),y=this.defs.appendElement("mask").setAttribute("id",t);this.createLinearGradient("start","0%","0%","100%","0%",[{offset:"0%",color:"white",opacity:1},{offset:"100%",color:"white",opacity:0}],"objectBoundingBox"),this.createLinearGradient("end","0%","0%","100%","0%",[{offset:"0%",color:"white",opacity:0},{offset:"100%",color:"white",opacity:1}],"objectBoundingBox");var p=180+180*("yang"===s?o:c)/Math.PI,f=.1*n;y.appendElement("rect").setAttribute("x",(e-("yang"===s?0:f)).toString()).setAttribute("y",r.toString()).setAttribute("transform","rotate(".concat(p,",").concat(e,",").concat(r,")")).setAttribute("width",f.toString()).setAttribute("height",n.toString()).setAttribute("fill","yang"===s?"url(#start)":"url(#end)");var h=180+180*("yang"===s?a:l)/Math.PI;return y.appendElement("rect").setAttribute("x",(e-("yang"===s?f:0)).toString()).setAttribute("y",r.toString()).setAttribute("transform","rotate(".concat(h,",").concat(e,",").concat(r.toString(),")")).setAttribute("width",f.toString()).setAttribute("height",n.toString()).setAttribute("fill","yang"===s?"url(#end)":"url(#start)"),y.appendElement("path").setAttribute("d",u({})||"").setAttribute("transform","translate(".concat(e,", ").concat(r.toString(),")")).setAttribute("fill","white"),y}},{key:"createBorderMask",value:function(t,e,r,i,n){var o=this.createArc(i,n,0,2*Math.PI),a=this.defs.appendElement("mask").setAttribute("id",t),s=this.defs.appendElement("radialGradient").setAttribute("id","borderMaskGradient").setAttribute("cx","50%").setAttribute("cy","50%").setAttribute("r","50%"),c=i/n,l=100*c,u=l+100*(1-c)*.7;s.appendElement("stop").setAttribute("offset","".concat(l,"%")).setAttribute("stop-color","white").setAttribute("stop-opacity","1"),s.appendElement("stop").setAttribute("offset","".concat(u,"%")).setAttribute("stop-color","white").setAttribute("stop-opacity","0"),a.appendElement("path").setAttribute("d",o({})||"").setAttribute("transform","translate(".concat(e,", ").concat(r,")")).setAttribute("fill","url(#borderMaskGradient)")}},{key:"changeBorderColors",value:function(t,e,r){var i=e;r.push(r[0]),this.animator.applyColorAnimation(t.select("stop:first-child").node(),i,r);var o,a=(o=r,function(t){if(Array.isArray(t))return n(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).filter((function(t){return void 0!==t}));a.length>0&&a.unshift(a.pop()),a.push(a[0]),this.animator.applyColorAnimation(t.select("stop:last-child").node(),i,a)}},{key:"drawLineWithGradient",value:function(t,e,r,i,n,o){t.appendElement("line").setAttribute("x1",e.toString()).setAttribute("y1",r.toString()).setAttribute("x2",i.toString()).setAttribute("y2",n.toString()).setStyle("stroke","url(#".concat(o,")"))}},{key:"createUnderlyingCircleGradient",value:function(t,e){var r=this.defs.appendElement("radialGradient").setAttribute("id",t).setAttribute("cx","50%").setAttribute("cy","50%").setAttribute("r","50%");r.appendElement("stop").setAttribute("offset","0%").setAttribute("stop-color",e).setAttribute("stop-opacity","1"),r.appendElement("stop").setAttribute("offset","100%").setAttribute("stop-color",e).setAttribute("stop-opacity","0")}},{key:"createUnderlyingCircleWithArcMask",value:function(t,e,r,i,n,o){this.drawCircle(r,i,n,o,"url(#".concat(e,")")).setAttribute("mask","url(#".concat(t,")"))}}],r&&o(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.D3GraphicsStrategy=f},939:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.GeometryUtils=void 0;var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r;return e=t,r=[{key:"calculateSpikeLength",value:function(t,e){return t*e*.5}},{key:"calculateSmallCircleRadius",value:function(t,e){return 2*Math.PI*t/e/2}}],null&&i(e.prototype,null),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GeometryUtils=o},893:e=>{e.exports=t}},r={};return function t(i){var n=r[i];if(void 0!==n)return n.exports;var o=r[i]={exports:{}};return e[i].call(o.exports,o,o.exports,t),o.exports}(441)})()));
@@ -0,0 +1,26 @@
1
+ import { IYinYangController } from "../interfaces/IYinYangController";
2
+ export declare class AnimationsMngr {
3
+ private subscribers;
4
+ constructor();
5
+ /**
6
+ * Subscribes a component (YinYangController) to the animation manager.
7
+ * Each component will have a specified rotation direction and duration.
8
+ */
9
+ subscribe(component: IYinYangController, clockWise?: boolean, time?: number): void;
10
+ /**
11
+ * Starts the animations for all subscribed components.
12
+ * Each component will rotate based on the specified direction and duration.
13
+ */
14
+ startAll(): void;
15
+ /**
16
+ * Reverts the rotation direction of a specific component and re-applies the animation.
17
+ * This will interrupt any ongoing animations and start a new one with the opposite direction.
18
+ */
19
+ revertRotation(component: IYinYangController): void;
20
+ /**
21
+ * Animates the specified component (YinYangController) with a rotation.
22
+ * The rotation applies to the entire group with the center of the large circle as the pivot.
23
+ * It also applies individual translations and rotations to the Yin and Yang parts.
24
+ */
25
+ animate(component: IYinYangController, clockWise: boolean, time?: number): void;
26
+ }
@@ -0,0 +1,59 @@
1
+ import { IYinYangModel } from "../../interfaces/IYinYangModel";
2
+ import { IYinYangView } from "../../interfaces/IYinYangView";
3
+ import { IYinYangController } from "../../interfaces/IYinYangController";
4
+ import { ICategory } from "../../interfaces/ICategory";
5
+ import { IYinYangAppFactory } from "../../interfaces/IYinYangAppFactory";
6
+ import { IOddItem } from "../../interfaces/IOddItem";
7
+ import { IAnimator } from "../../interfaces/IAnimator";
8
+ export declare class YinYangController implements IYinYangController {
9
+ model: IYinYangModel;
10
+ view: IYinYangView;
11
+ factory: IYinYangAppFactory;
12
+ animator: IAnimator;
13
+ /**
14
+ * Constructor to initialize the controller with its model, view, and factory.
15
+ */
16
+ constructor(model: IYinYangModel, view: IYinYangView, factory: IYinYangAppFactory);
17
+ /**
18
+ * Retrieves the number of borders for the YinYang view.
19
+ */
20
+ getBorderNb(): number;
21
+ /**
22
+ * Retrieves the sorted data for the model.
23
+ */
24
+ getSortedData(): IOddItem[];
25
+ /**
26
+ * Retrieves the categories from the model.
27
+ */
28
+ getCategories(): ICategory[];
29
+ /**
30
+ * Retrieves the unique key for this instance of the model.
31
+ */
32
+ getKey(): string;
33
+ /**
34
+ * Retrieves the parent key for this instance, if it exists.
35
+ */
36
+ getParentKey(): string | null;
37
+ /**
38
+ * Determines whether the current model represents an enemy.
39
+ */
40
+ getIsEnemy(): boolean;
41
+ /**
42
+ * Calculates the average score based on the model's data.
43
+ */
44
+ calculateAverageScore(): number;
45
+ /**
46
+ * Generates a unique child key for sub-instances.
47
+ */
48
+ generateChildKey(): string;
49
+ /**
50
+ * Creates child instances of the YinYang pattern using the model's data.
51
+ * Each child is generated based on the small circle data.
52
+ */
53
+ createYinYangChildren(): void;
54
+ /**
55
+ * Initializes animations for this instance and sets up event listeners for clicks.
56
+ * Rotations are reverted on click events.
57
+ */
58
+ InitializeAnimations(): void;
59
+ }
@@ -0,0 +1,62 @@
1
+ import { AnimationsMngr } from "../../animations/AnimationsMngr";
2
+ import { IOddItem } from "../../interfaces/IOddItem";
3
+ import { IYinYangModel } from "../../interfaces/IYinYangModel";
4
+ import { IYinYangView } from "../../interfaces/IYinYangView";
5
+ import { IYinYangController } from "../../interfaces/IYinYangController";
6
+ import { IGraphicsStrategy } from "../../interfaces/IGraphicsStrategy";
7
+ import { IYinYangAppFactory } from "../../interfaces/IYinYangAppFactory";
8
+ import { IViewData } from "../../interfaces/IViewData";
9
+ export declare class YinYangAppFactory implements IYinYangAppFactory {
10
+ instances: Map<string, IYinYangController>;
11
+ private idCounter;
12
+ graphicsStrategy: IGraphicsStrategy;
13
+ animator: AnimationsMngr;
14
+ constructor(graphicsStrategy: IGraphicsStrategy);
15
+ /**
16
+ * Generates a unique ID for each created instance.
17
+ */
18
+ private generateUniqueId;
19
+ /**
20
+ * Returns all created instances of YinYangController.
21
+ */
22
+ getInstances(): Map<string, IYinYangController>;
23
+ /**
24
+ * Creates a new YinYang model.
25
+ *
26
+ * @param modelData - Data for the model based on IOddItem.
27
+ * @param isEnemy - Indicates if the model is for an enemy (defaults to true).
28
+ * @param parentKey - The key of the parent model if any.
29
+ * @returns A new instance of YinYangModel.
30
+ */
31
+ createModel(modelData: IOddItem[], isEnemy?: boolean, parentKey?: string | null): IYinYangModel;
32
+ /**
33
+ * Creates a new view for the YinYang diagram.
34
+ *
35
+ * @returns A new instance of YinYangView.
36
+ */
37
+ createView(): IYinYangView;
38
+ /**
39
+ * Creates a new controller to manage interactions between the model and the view.
40
+ *
41
+ * @param model - The YinYang model instance.
42
+ * @param view - The YinYang view instance.
43
+ * @returns A new instance of YinYangController.
44
+ */
45
+ createController(model: IYinYangModel, view: IYinYangView): IYinYangController;
46
+ /**
47
+ * Initializes the animation manager.
48
+ *
49
+ * @returns A new instance of AnimationsMngr to handle animations.
50
+ */
51
+ createAnimationsManager(): AnimationsMngr;
52
+ /**
53
+ * Creates the full YinYang application including model, view, and controller.
54
+ *
55
+ * @param modelData - The data for the model.
56
+ * @param viewData - The data for the view (e.g., dimensions, container ID).
57
+ * @param isEnemy - Indicates whether the entity is an enemy.
58
+ * @param parentKey - Optional key for a parent instance.
59
+ * @returns The created YinYangController.
60
+ */
61
+ create(modelData: IOddItem[], viewData: IViewData, isEnemy?: boolean, parentKey?: string | null): IYinYangController;
62
+ }
@@ -0,0 +1,41 @@
1
+ import { IOddItem } from "../../interfaces/IOddItem";
2
+ import { IYinYangModel } from "../../interfaces/IYinYangModel";
3
+ import { ICategory } from "../../interfaces/ICategory";
4
+ export declare class YinYangModel implements IYinYangModel {
5
+ sortedData: IOddItem[];
6
+ categories: ICategory[];
7
+ key: string;
8
+ parentKey: string | null;
9
+ childCounter: number;
10
+ borderNb: number;
11
+ isEnemy: boolean;
12
+ /**
13
+ * Constructor for the YinYangModel.
14
+ * Sorts the input data, initializes the categories, and sets up the properties.
15
+ */
16
+ constructor(data: IOddItem[], key: string, parentKey: string | null | undefined, isEnemy: boolean);
17
+ /**
18
+ * Generates a unique key for child instances.
19
+ */
20
+ generateChildKey(): string;
21
+ /**
22
+ * Calculates the average score from the data.
23
+ * @returns The average score rounded to one decimal place.
24
+ */
25
+ calculateAverageScore(): number;
26
+ /**
27
+ * Retrieves the small circle data, including score and angle for each item.
28
+ * @returns Array of small circle data with score and angle for each item.
29
+ */
30
+ getSmallCircleData(): {
31
+ score: number;
32
+ angle: number;
33
+ }[];
34
+ /**
35
+ * Sets up the categories for the YinYang diagram based on the input data.
36
+ * Calculates the percentage and angles for each category.
37
+ * @param data - Array of items to categorize.
38
+ * @returns Array of category objects with their respective data.
39
+ */
40
+ setupCategories(data: IOddItem[]): ICategory[];
41
+ }
@@ -0,0 +1,42 @@
1
+ import { ViewInitializer } from "./ViewInitializer";
2
+ export declare class BorderDrawer {
3
+ private ViewInitializer;
4
+ private viewData;
5
+ private yinYangGroup;
6
+ private graphicStrategy;
7
+ private positionX;
8
+ private positionY;
9
+ private innerRadius;
10
+ private outerRadius;
11
+ private borderThickness;
12
+ private categories;
13
+ private isChild;
14
+ private containerId;
15
+ private key;
16
+ constructor(ViewInitializer: ViewInitializer);
17
+ /**
18
+ * Initializes the properties needed for drawing borders based on the ViewInitializer data.
19
+ */
20
+ initialize(): void;
21
+ /**
22
+ * Creates the borders for the Yin Yang pattern. It draws the underlying arc and then applies
23
+ * additional borders based on the number of borders needed.
24
+ */
25
+ createBorders(): void;
26
+ /**
27
+ * Draws an individual border around the Yin Yang pattern using a gradient or mask.
28
+ *
29
+ * @param innerRadius - The inner radius of the border.
30
+ * @param outerRadius - The outer radius of the border.
31
+ * @param index - Index of the border, used for generating unique identifiers.
32
+ */
33
+ drawBorder(innerRadius: number, outerRadius: number, index?: number): void;
34
+ /**
35
+ * Creates a mask and a linear gradient for the borders. The gradient animates the border colors.
36
+ *
37
+ * @param innerRadius - The inner radius of the border.
38
+ * @param outerRadius - The outer radius of the border.
39
+ * @param index - Index of the border, used for generating unique identifiers.
40
+ */
41
+ private CreateBorderMaskAndGradient;
42
+ }
@@ -0,0 +1,54 @@
1
+ import { ICategory } from "../../interfaces/ICategory";
2
+ import { ViewInitializer } from "./ViewInitializer";
3
+ import { IYinOrYangPattern } from "../../interfaces/IYinOrYangPattern";
4
+ export declare class SpikeDrawer {
5
+ private ViewInitializer;
6
+ private categories;
7
+ private isChild;
8
+ private yinOrYangGroup;
9
+ private sortedData;
10
+ private positionX;
11
+ private viewData;
12
+ private containerId;
13
+ private key;
14
+ private graphicStrategy;
15
+ constructor(ViewInitializer: ViewInitializer);
16
+ /**
17
+ * Initializes the necessary data for drawing spikes.
18
+ * It retrieves data from the ViewInitializer and sets local properties.
19
+ */
20
+ initialize(): void;
21
+ /**
22
+ * Triggers the process of drawing spikes for both Yin and Yang elements.
23
+ */
24
+ createSpikes(): void;
25
+ /**
26
+ * Loops through both Yin and Yang groups and calls the spike drawing function for each.
27
+ */
28
+ drawYinYangSpikes(yinOrYangGroup: {
29
+ yin: IYinOrYangPattern;
30
+ yang: IYinOrYangPattern;
31
+ }): void;
32
+ /**
33
+ * Draws spikes for either Yin or Yang based on the data.
34
+ * The spikes are drawn for each category, with different sizes and positions.
35
+ *
36
+ * @param centerY - The Y coordinate of the center.
37
+ * @param radius - The radius of the element (Yin or Yang).
38
+ * @param type - Whether the element is "yin" or "yang".
39
+ */
40
+ drawYinOrYangSpikes(centerY: number, radius: number, type: "yin" | "yang"): void;
41
+ /**
42
+ * Draws individual spikes based on the data, angle, and category.
43
+ * Each spike's length is determined by the score of the associated data item.
44
+ *
45
+ * @param cat - The category of the data item.
46
+ * @param centerY - The Y coordinate of the center.
47
+ * @param smallRadius - The radius of the inner circle.
48
+ * @param radius - The radius of the outer circle.
49
+ * @param type - Whether the element is "yin" or "yang".
50
+ * @param startAngle - The starting angle of the spike.
51
+ * @param endAngle - The ending angle of the spike.
52
+ */
53
+ drawSpikes(cat: ICategory, centerY: number, smallRadius: number, radius: number, type: "yin" | "yang", startAngle: number, endAngle: number): void;
54
+ }
@@ -0,0 +1,91 @@
1
+ import { IGraphicsStrategy } from "../../interfaces/IGraphicsStrategy";
2
+ import { IGraphicElement } from "../../interfaces/IGraphicElement";
3
+ import { IYinYangController } from "../../interfaces/IYinYangController";
4
+ import { ICategory } from "../../interfaces/ICategory";
5
+ import { IYinYangView } from "../../interfaces/IYinYangView";
6
+ import { IYinOrYangPattern } from "../../interfaces/IYinOrYangPattern";
7
+ import { IViewData } from "../../interfaces/IViewData";
8
+ export declare class ViewInitializer {
9
+ graphicContainer: IGraphicElement;
10
+ graphicStrategy: IGraphicsStrategy;
11
+ globalGroup: IGraphicElement;
12
+ yinOrYangGroup: {
13
+ yin: IYinOrYangPattern;
14
+ yang: IYinOrYangPattern;
15
+ };
16
+ yinYangGroup: IGraphicElement;
17
+ smallCircleRadius: number;
18
+ distanceFromChild: number;
19
+ controller: IYinYangController;
20
+ viewData: IViewData;
21
+ averageScore: number;
22
+ categories: ICategory[];
23
+ containerId: string;
24
+ key: string;
25
+ isChild: boolean;
26
+ positionX: number;
27
+ positionY: number;
28
+ borderThicknessRatio: number;
29
+ borderThickness: number;
30
+ borderInnerRadius: number;
31
+ borderOuterRadius: number;
32
+ offsetfromBorder: number;
33
+ isEnemy: boolean;
34
+ private areChildren;
35
+ constructor(graphicStrategy: IGraphicsStrategy);
36
+ /**
37
+ * Initializes the graphical elements for the YinYang visualization.
38
+ * It sets up the main container, calculates various properties such as the radius and position,
39
+ * and creates the necessary groups for the Yin and Yang elements.
40
+ *
41
+ * @param controller - The controller managing the YinYang model and view.
42
+ * @param viewData - Contains data for the view, such as the radius and container ID.
43
+ * @param parent - The parent controller (optional), used to calculate child positions.
44
+ */
45
+ initializeGraphicElements(controller: IYinYangController, viewData: IViewData, parent?: IYinYangController): void;
46
+ resizeWholePattern(shrinkRatio: number): void;
47
+ /**
48
+ * Creates the main graphic container where the YinYang visualization will be rendered .
49
+ *
50
+ * @param containerId - The ID of the container element.
51
+ * @param parent - The parent controller (optional), used to inherit properties from the parent container.
52
+ * @returns A new graphic element to contain the visualization.
53
+ */
54
+ private createGraphicContainer;
55
+ /**
56
+ * Creates groups for Yin and Yang with their respective radii and positions.
57
+ * The groups will be used for independent transformations and styling.
58
+ *
59
+ * @returns Object containing the Yin and Yang group elements and properties.
60
+ */
61
+ private createYinOrYangGroups;
62
+ /**
63
+ * Determines the position of the pattern.
64
+ * If the view is a child, its position is calculated relative to the parent;
65
+ * otherwise, the position is centered in the container.
66
+ *
67
+ * @param parent - The parent controller (optional).
68
+ * @returns Object with the X and Y coordinates for the pattern.
69
+ */
70
+ private getPatternPosition;
71
+ /**
72
+ * Calculates the position of a child pattern relative to its parent.
73
+ * This takes into account the radius and offset from the parent's border.
74
+ *
75
+ * @param parentView - The view of the parent YinYang instance.
76
+ * @returns Object with the X and Y coordinates for the child pattern.
77
+ */
78
+ GetChildPosition(parentView: IYinYangView): {
79
+ positionX: number;
80
+ positionY: number;
81
+ };
82
+ /**
83
+ * Centers the current motif in the graphic container.
84
+ *
85
+ * @returns Object with the X and Y coordinates for the centered motif.
86
+ */
87
+ centerMotif(): {
88
+ positionX: number;
89
+ positionY: number;
90
+ };
91
+ }
@@ -0,0 +1,57 @@
1
+ import { ViewInitializer } from "./ViewInitializer";
2
+ import { IYinOrYangPattern } from "../../interfaces/IYinOrYangPattern";
3
+ export declare class YinYangDrawer {
4
+ private ViewInitializer;
5
+ private viewData;
6
+ private yinYangGroup;
7
+ private yinOrYangGroup;
8
+ private graphicStrategy;
9
+ private positionX;
10
+ private positionY;
11
+ private categories;
12
+ private containerId;
13
+ private key;
14
+ constructor(ViewInitializer: ViewInitializer);
15
+ /**
16
+ * Initializes all the necessary properties from the ViewInitializer.
17
+ * These properties are used for drawing the Yin Yang pattern.
18
+ */
19
+ initialize(): void;
20
+ /**
21
+ * Creates the full Yin Yang pattern, including the main circle, semi-circles, and the Yin Yang symbols.
22
+ */
23
+ createYinYangPattern(): void;
24
+ /**
25
+ * Draws the main outer circle representing the Yin Yang.
26
+ */
27
+ drawMainCircle(): void;
28
+ /**
29
+ * Draws a semi-circle (black half) within the main Yin Yang circle.
30
+ */
31
+ drawSemiCircle(): void;
32
+ /**
33
+ * Loops through both Yin and Yang groups and draws the respective symbols (small circles).
34
+ */
35
+ drawYinYangSymbols(yinOrYangGroup: {
36
+ yin: IYinOrYangPattern;
37
+ yang: IYinOrYangPattern;
38
+ }): void;
39
+ /**
40
+ * Draws either the Yin or Yang circle based on the type provided.
41
+ * It also draws the small central circle and the arcs for categories within the symbol.
42
+ *
43
+ * @param centerY - The Y coordinate for the center of the symbol.
44
+ * @param radius - The radius of the symbol (Yin or Yang).
45
+ * @param type - Whether the symbol is "yin" or "yang".
46
+ */
47
+ drawYinOrYang(centerY: number, radius: number, type: "yin" | "yang"): void;
48
+ /**
49
+ * Draws category-specific arcs with gradient fills and masks to represent different ODDs (Sustainable Development Goals).
50
+ *
51
+ * @param centerY - The Y coordinate of the center of the symbol.
52
+ * @param radius - The radius of the main symbol.
53
+ * @param type - Whether the symbol is "yin" or "yang".
54
+ * @param smallRadius - The radius of the small circle within the symbol.
55
+ */
56
+ drawCategoryArcs(centerY: number, radius: number, type: "yin" | "yang", smallRadius: number): void;
57
+ }
@@ -0,0 +1,52 @@
1
+ import { IYinYangView } from "../../interfaces/IYinYangView";
2
+ import { IYinYangController } from "../../interfaces/IYinYangController";
3
+ import { YinYangDrawer } from "./YinYangDrawer";
4
+ import { SpikeDrawer } from "./SpikeDrawer";
5
+ import { ViewInitializer } from "./ViewInitializer";
6
+ import { BorderDrawer } from "./BorderDrawer";
7
+ import { IViewData } from "../../interfaces/IViewData";
8
+ export declare class YinYangView implements IYinYangView {
9
+ private _controller;
10
+ private _viewData;
11
+ private _positionX;
12
+ private _positionY;
13
+ private _yinYangDrawer;
14
+ private _spikeDrawer;
15
+ private _borderDrawer;
16
+ private _viewInitializer;
17
+ /**
18
+ * Constructor to initialize view components.
19
+ */
20
+ constructor(viewInitializer: ViewInitializer, yinYangDrawer: YinYangDrawer, spikeDrawer: SpikeDrawer, borderDrawer: BorderDrawer);
21
+ get controller(): IYinYangController;
22
+ set controller(value: IYinYangController);
23
+ get viewData(): IViewData;
24
+ set viewData(value: IViewData);
25
+ get positionX(): number;
26
+ set positionX(value: number);
27
+ get positionY(): number;
28
+ set positionY(value: number);
29
+ get viewInitializer(): ViewInitializer;
30
+ set viewInitializer(value: ViewInitializer);
31
+ get yinYangDrawer(): YinYangDrawer;
32
+ set yinYangDrawer(value: YinYangDrawer);
33
+ get spikeDrawer(): SpikeDrawer;
34
+ set spikeDrawer(value: SpikeDrawer);
35
+ get borderDrawer(): BorderDrawer;
36
+ set borderDrawer(value: BorderDrawer);
37
+ /**
38
+ * Initialize the view with the controller, view data, and optionally a parent.
39
+ * Sets up the graphical elements and drawers for the YinYang diagram.
40
+ */
41
+ initialize(controller: IYinYangController, viewData: IViewData, parent?: IYinYangController): void;
42
+ /**
43
+ * Adds a click event listener to the YinYang group.
44
+ */
45
+ addClickEventToYinYangGroup(callback: () => void): void;
46
+ /**
47
+ * Adds a click event listener to either Yin or Yang arc groups.
48
+ * @param type - Indicates whether it is the 'yin' or 'yang' group.
49
+ * @param callback - The function to execute on click.
50
+ */
51
+ addClickEventToArcGroups(type: "yin" | "yang", callback: () => void): void;
52
+ }
@@ -0,0 +1,3 @@
1
+ export declare const categoryColorNames: {
2
+ [key: string]: string;
3
+ };
@@ -0,0 +1,3 @@
1
+ import { IOddItem } from "../../interfaces/IOddItem";
2
+ declare let odd: IOddItem[];
3
+ export default odd;
@@ -0,0 +1,3 @@
1
+ import { IOddItem } from "../../interfaces/IOddItem";
2
+ declare let odd: IOddItem[];
3
+ export default odd;
@@ -0,0 +1,3 @@
1
+ import { IOddItem } from "../interfaces/IOddItem";
2
+ declare let odd: IOddItem[];
3
+ export default odd;
@@ -0,0 +1,3 @@
1
+ export interface IAnimator {
2
+ applyColorAnimation(stopElement: SVGStopElement, duration: number, color: string[]): void;
3
+ }
@@ -0,0 +1,9 @@
1
+ export interface ICategory {
2
+ category: string;
3
+ color: string;
4
+ percentage: number;
5
+ angles: {
6
+ startAngle: number;
7
+ endAngle: number;
8
+ };
9
+ }
@@ -0,0 +1,8 @@
1
+ import { IGraphicElement } from "./IGraphicElement";
2
+ export interface ICircleManager {
3
+ arcGroups: {
4
+ yin: IGraphicElement;
5
+ yang: IGraphicElement;
6
+ };
7
+ createYinYangCircles(): void;
8
+ }
@@ -0,0 +1,5 @@
1
+ export interface IGradientStop {
2
+ offset: string;
3
+ color: string;
4
+ opacity: number;
5
+ }
@@ -0,0 +1,15 @@
1
+ export interface IGraphicElement {
2
+ appendElement(elementType: string): IGraphicElement;
3
+ setStyle(property: string, value: string): IGraphicElement;
4
+ setAttribute(name: string, value: string): IGraphicElement;
5
+ addEventListener(event: string, callback: () => void): void;
6
+ select(query: string): IGraphicElement;
7
+ node(): any;
8
+ getDimensions(): {
9
+ width: number;
10
+ height: number;
11
+ };
12
+ interruptAllAnimation(): void;
13
+ applyContinuousRotation(duration: number, centerX: number, centerY: number, clockwise: boolean): void;
14
+ applyTranslationAndRotationAltogether(time: number, centerX: number, centerY: number, orbitalRadius: number, clockwise: boolean, type: "yin" | "yang"): void;
15
+ }
@@ -0,0 +1,23 @@
1
+ import { D3Element } from "../utils/d3/D3Element";
2
+ import { IAnimator } from "./IAnimator";
3
+ import { IGraphicElement } from "./IGraphicElement";
4
+ export interface IGraphicsStrategy {
5
+ animator: IAnimator;
6
+ defs: D3Element;
7
+ initialize(svgSelector: string, w: number, svgElement?: IGraphicElement, defElement?: IGraphicElement): IGraphicElement;
8
+ resizeGroup(group: IGraphicElement, scaleFactor: number, centerX: Number, centerY: Number): void;
9
+ drawArc(parent: IGraphicElement, cx: number, cy: number, innerRadius: number, outerRadius: number, startAngle: number, endAngle: number, fill: string): void;
10
+ drawArc(parent: IGraphicElement, cx: number, cy: number, innerRadius: number, outerRadius: number, startAngle: number, endAngle: number, fill: string): void;
11
+ drawCircle(parent: IGraphicElement, cx: number, cy: number, radius: number, fill: string, opacity?: number): IGraphicElement;
12
+ createLinearGradient(id: string, x1: string, y1: string, x2: string, y2: string, stops: {
13
+ offset: string;
14
+ color: string;
15
+ opacity: number;
16
+ }[], gradientUnits: string): IGraphicElement;
17
+ createYinOrYangArcMask(id: string, cx: number, cy: number, innerRadius: number, outerRadius: number, startAngle: number, endAngle: number, type: "yin" | "yang"): void;
18
+ createBorderMask(id: string, cx: number, cy: number, innerRadius: number, outerRadius: number): void;
19
+ changeBorderColors(gradient: any, duration: number, colors: string[]): void;
20
+ drawLineWithGradient(parent: IGraphicElement, x1: number, y1: number, x2: number, y2: number, gradientId: string): void;
21
+ createUnderlyingCircleGradient(id: string, color: string): void;
22
+ createUnderlyingCircleWithArcMask(maskId: string, gradientId: string, parent: IGraphicElement, cx: number, cy: number, radius: number): void;
23
+ }
@@ -0,0 +1,6 @@
1
+ export interface IOddItem {
2
+ categorie: string;
3
+ composante: string;
4
+ score: number;
5
+ description: string;
6
+ }
@@ -0,0 +1,4 @@
1
+ import { ICategory } from "./ICategory";
2
+ export interface ISpikeManager {
3
+ createSpike(cat: ICategory): void;
4
+ }
@@ -0,0 +1,5 @@
1
+ export interface IViewData {
2
+ minEdge: number;
3
+ containerId: string;
4
+ borderAnimationDuration: number;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { IGraphicElement } from "./IGraphicElement";
2
+ export interface IYinOrYangPattern {
3
+ type: "yin" | "yang";
4
+ graphElementGroup: IGraphicElement;
5
+ centerY: number;
6
+ radius: number;
7
+ smallRadiusRatio: number;
8
+ }
@@ -0,0 +1,17 @@
1
+ import { YinYangModel } from "../components/model/YinYangModel";
2
+ import { IYinYangView } from "./IYinYangView";
3
+ import { IYinYangController } from "./IYinYangController";
4
+ import { AnimationsMngr } from "../animations/AnimationsMngr";
5
+ import { IOddItem } from "../interfaces/IOddItem";
6
+ import { IGraphicsStrategy } from "./IGraphicsStrategy";
7
+ import { IViewData } from "./IViewData";
8
+ export interface IYinYangAppFactory {
9
+ graphicsStrategy: IGraphicsStrategy;
10
+ animator: AnimationsMngr;
11
+ create(modelData: IOddItem[], viewData: IViewData, isEnemy: boolean, parentKey?: string | null): IYinYangController;
12
+ createModel(dataSubset: IOddItem[], isEnemy: boolean, parentKey?: string | null): YinYangModel;
13
+ createView(): IYinYangView;
14
+ createController(model: YinYangModel, view: IYinYangView): IYinYangController;
15
+ createAnimationsManager(): AnimationsMngr;
16
+ getInstances(): Map<string, IYinYangController>;
17
+ }
@@ -0,0 +1,22 @@
1
+ import { IOddItem } from "../interfaces/IOddItem";
2
+ import { IYinYangAppFactory } from "./IYinYangAppFactory";
3
+ import { ICategory } from "./ICategory";
4
+ import { IYinYangModel } from "./IYinYangModel";
5
+ import { IYinYangView } from "./IYinYangView";
6
+ import { IAnimator } from "./IAnimator";
7
+ export interface IYinYangController {
8
+ model: IYinYangModel;
9
+ view: IYinYangView;
10
+ factory: IYinYangAppFactory;
11
+ animator: IAnimator;
12
+ createYinYangChildren(): void;
13
+ getBorderNb(): number;
14
+ getSortedData(): IOddItem[];
15
+ getCategories(): ICategory[];
16
+ getKey(): string;
17
+ getParentKey(): string | null;
18
+ getIsEnemy(): boolean;
19
+ calculateAverageScore(): number;
20
+ generateChildKey(): string;
21
+ InitializeAnimations(): void;
22
+ }
@@ -0,0 +1,18 @@
1
+ import { IOddItem } from "../interfaces/IOddItem";
2
+ import { ICategory } from "./ICategory";
3
+ export interface IYinYangModel {
4
+ sortedData: IOddItem[];
5
+ categories: ICategory[];
6
+ key: string;
7
+ parentKey: string | null;
8
+ childCounter: number;
9
+ borderNb: number;
10
+ isEnemy: boolean;
11
+ generateChildKey(): string;
12
+ calculateAverageScore(): number;
13
+ getSmallCircleData(): {
14
+ score: number;
15
+ angle: number;
16
+ }[];
17
+ setupCategories(data: IOddItem[]): ICategory[];
18
+ }
@@ -0,0 +1,19 @@
1
+ import { IViewData } from "./IViewData";
2
+ import { ViewInitializer } from "../components/view/ViewInitializer";
3
+ import { IYinYangController } from "./IYinYangController";
4
+ import { YinYangDrawer } from "../components/view/YinYangDrawer";
5
+ import { SpikeDrawer } from "../components/view/SpikeDrawer";
6
+ import { BorderDrawer } from "../components/view/BorderDrawer";
7
+ export interface IYinYangView {
8
+ controller: IYinYangController;
9
+ viewData: IViewData;
10
+ positionX: number;
11
+ positionY: number;
12
+ viewInitializer: ViewInitializer;
13
+ yinYangDrawer: YinYangDrawer;
14
+ spikeDrawer: SpikeDrawer;
15
+ borderDrawer: BorderDrawer;
16
+ initialize(controller: IYinYangController, viewData: IViewData, parent?: IYinYangController): void;
17
+ addClickEventToYinYangGroup(callback: () => void): void;
18
+ addClickEventToArcGroups(type: "yin" | "yang", callback: () => void): void;
19
+ }
@@ -0,0 +1,2 @@
1
+ import { IViewData } from "./interfaces/IViewData";
2
+ export declare function initializeYinYangApp(viewData: IViewData): void;
@@ -0,0 +1,4 @@
1
+ import { IAnimator } from "../../interfaces/IAnimator";
2
+ export declare class D3Animator implements IAnimator {
3
+ applyColorAnimation(stopElement: SVGStopElement, duration: number, colors: string[]): void;
4
+ }
@@ -0,0 +1,20 @@
1
+ import * as d3 from "d3";
2
+ import { IGraphicElement } from "../../interfaces/IGraphicElement";
3
+ export declare class D3Element implements IGraphicElement {
4
+ private selection;
5
+ constructor(selection: d3.Selection<any, unknown, HTMLElement, any>);
6
+ appendElement(elementType: string): IGraphicElement;
7
+ setStyle(property: string, value: string): IGraphicElement;
8
+ setAttribute(name: string, value: string): IGraphicElement;
9
+ addEventListener(event: string, callback: () => void): void;
10
+ getSelection(): d3.Selection<any, unknown, HTMLElement, any>;
11
+ select(query: string): IGraphicElement;
12
+ node(): any;
13
+ getDimensions(): {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ interruptAllAnimation(): void;
18
+ applyContinuousRotation(duration: number, centerX: number, centerY: number, clockwise?: boolean): void;
19
+ applyTranslationAndRotationAltogether(time: number, centerX: number, centerY: number, orbitalRadius: number, clockwise: boolean, type: "yin" | "yang"): void;
20
+ }
@@ -0,0 +1,61 @@
1
+ import { IGraphicsStrategy } from "../../interfaces/IGraphicsStrategy";
2
+ import { D3Element } from "./D3Element";
3
+ import { D3Animator } from "./D3Animator";
4
+ export declare class D3GraphicsStrategy implements IGraphicsStrategy {
5
+ animator: D3Animator;
6
+ defs: D3Element;
7
+ private currentScale;
8
+ private currentY;
9
+ private currentX;
10
+ /**
11
+ * Initializes the SVG element and appends it to the given selector.
12
+ * Also creates a 'defs' section for reusable graphical elements like gradients.
13
+ */
14
+ initialize(svgSelector: string, patternRadius: number): D3Element;
15
+ resizeGroup(group: D3Element, scaleFactor: number, centerX: Number, centerY: Number): void;
16
+ /**
17
+ * Draws an arc using D3 on the parent element.
18
+ */
19
+ drawArc(parent: D3Element, cx: number, cy: number, innerRadius: number, outerRadius: number, startAngle: number, endAngle: number, fill: string): void;
20
+ /**
21
+ * Draws a circle on the parent element with the specified attributes.
22
+ */
23
+ drawCircle(parent: D3Element, cx: number, cy: number, radius: number, fill: string, opacity?: number): D3Element;
24
+ /**
25
+ * Creates a linear gradient element in the 'defs' section.
26
+ * Stops define the gradient transitions.
27
+ */
28
+ createLinearGradient(id: string, x1: string, y1: string, x2: string, y2: string, stops: {
29
+ offset: string;
30
+ color: string;
31
+ opacity: number;
32
+ }[], gradientUnits: string): D3Element;
33
+ /**
34
+ * Helper function to create an arc path with the specified radii and angles.
35
+ */
36
+ private createArc;
37
+ /**
38
+ * Creates a mask for Yin or Yang arcs using a gradient for soft transitions.
39
+ */
40
+ createYinOrYangArcMask(maskId: string, cx: number, cy: number, innerRadius: number, outerRadius: number, startAngle: number, endAngle: number, type: "yin" | "yang"): D3Element;
41
+ /**
42
+ * Creates a mask for the border with a radial gradient to simulate fading edges.
43
+ */
44
+ createBorderMask(id: string, centerX: number, centerY: number, innerRadius: number, outerRadius: number): void;
45
+ /**
46
+ * Changes the colors of a border gradient over time using an animation.
47
+ */
48
+ changeBorderColors(gradient: D3Element, duration: number, colors: string[]): void;
49
+ /**
50
+ * Draws a line with a gradient stroke.
51
+ */
52
+ drawLineWithGradient(parent: D3Element, x1: number, y1: number, x2: number, y2: number, gradientId: string): void;
53
+ /**
54
+ * Creates a radial gradient for an underlying circle.
55
+ */
56
+ createUnderlyingCircleGradient(id: string, color: string): void;
57
+ /**
58
+ * Creates an underlying circle with a gradient and applies an arc mask.
59
+ */
60
+ createUnderlyingCircleWithArcMask(maskId: string, gradientId: string, parent: D3Element, cx: number, cy: number, radius: number): void;
61
+ }
@@ -0,0 +1,4 @@
1
+ export declare class GeometryUtils {
2
+ static calculateSpikeLength(radius: number, value: number): number;
3
+ static calculateSmallCircleRadius(grandRadius: number, dataLength: number): number;
4
+ }
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@micheeeeel/yinyangapp",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A program to visualize human activity balance to reach Sustainable Development Objectives",
5
5
  "main": "dist/bundle.js",
6
6
  "types": "dist/types/script.d.ts",
7
+ "files": [
8
+ "dist/bundle.js",
9
+ "dist/types",
10
+ "README.md"
11
+ ],
7
12
  "scripts": {
8
13
  "test": "echo \"Error: no test specified\" && exit 1",
9
14
  "build": "tsc -p tsconfig.types.json && webpack --mode production",
@@ -28,9 +33,5 @@
28
33
  "webpack": "^5.90.3",
29
34
  "webpack-cli": "^5.1.4",
30
35
  "webpack-dev-server": "^5.0.4"
31
- },
32
- "files": [
33
- "dist",
34
- "README.md"
35
- ]
36
+ }
36
37
  }
package/dist/index.html DELETED
@@ -1 +0,0 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>YinYangApp Visualization</title><script defer="defer" src="bundle.js"></script></head><body><h1>YinYang Visualization</h1><div id="svg-container" style="width: 100vw; height: 100vh"></div><script src="https://d3js.org/d3.v7.min.js"></script></body></html>