@undp/data-viz 1.2.7 → 1.2.8
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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -64,5 +64,5 @@ License: MIT
|
|
|
64
64
|
`&&($=`
|
|
65
65
|
`);var z=0,C=!1;this.parse=function(A,M,O){if(typeof A!="string")throw new Error("Input must be a string");var K=A.length,Q=x.length,se=$.length,T=V.length,Z=W(q),ie=[],ue=[],he=[],Y=z=0;if(!A)return te();if(G||G!==!1&&A.indexOf(B)===-1){for(var ge=A.split($),oe=0;oe<ge.length;oe++){if(he=ge[oe],z+=he.length,oe!==ge.length-1)z+=$.length;else if(O)return te();if(!V||he.substring(0,T)!==V){if(Z){if(ie=[],R(he.split(x)),Me(),C)return te()}else R(he.split(x));if(ae&&ae<=oe)return ie=ie.slice(0,ae),te(!0)}}return te()}for(var ce=A.indexOf(x,z),N=A.indexOf($,z),U=new RegExp(v(X)+v(B),"g"),ve=A.indexOf(B,z);;)if(A[z]===B)for(ve=z,z++;;){if((ve=A.indexOf(B,ve+1))===-1)return O||ue.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:ie.length,index:z}),ee();if(ve===K-1)return ee(A.substring(z,ve).replace(U,B));if(B===X&&A[ve+1]===X)ve++;else if(B===X||ve===0||A[ve-1]!==X){ce!==-1&&ce<ve+1&&(ce=A.indexOf(x,ve+1));var J=le((N=N!==-1&&N<ve+1?A.indexOf($,ve+1):N)===-1?ce:Math.min(ce,N));if(A.substr(ve+1+J,Q)===x){he.push(A.substring(z,ve).replace(U,B)),A[z=ve+1+J+Q]!==B&&(ve=A.indexOf(B,z)),ce=A.indexOf(x,z),N=A.indexOf($,z);break}if(J=le(N),A.substring(ve+1+J,ve+1+J+se)===$){if(he.push(A.substring(z,ve).replace(U,B)),de(ve+1+J+se),ce=A.indexOf(x,z),ve=A.indexOf(B,z),Z&&(Me(),C))return te();if(ae&&ie.length>=ae)return te(!0);break}ue.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:ie.length,index:z}),ve++}}else if(V&&he.length===0&&A.substring(z,z+T)===V){if(N===-1)return te();z=N+se,N=A.indexOf($,z),ce=A.indexOf(x,z)}else if(ce!==-1&&(ce<N||N===-1))he.push(A.substring(z,ce)),z=ce+Q,ce=A.indexOf(x,z);else{if(N===-1)break;if(he.push(A.substring(z,N)),de(N+se),Z&&(Me(),C))return te();if(ae&&ie.length>=ae)return te(!0)}return ee();function R(be){ie.push(be),Y=z}function le(be){var ne=0;return ne=be!==-1&&(be=A.substring(ve+1,be))&&be.trim()===""?be.length:ne}function ee(be){return O||(be===void 0&&(be=A.substring(z)),he.push(be),z=K,R(he),Z&&Me()),te()}function de(be){z=be,R(he),he=[],N=A.indexOf($,z)}function te(be){if(D.header&&!M&&ie.length&&!b){var ne=ie[0],De={},xe=new Set(ne);let Ae=!1;for(let ke=0;ke<ne.length;ke++){let me=ne[ke];if(De[me=W(D.transformHeader)?D.transformHeader(me,ke):me]){let Se,Le=De[me];for(;Se=me+"_"+Le,Le++,xe.has(Se););xe.add(Se),ne[ke]=Se,De[me]++,Ae=!0,(_=_===null?{}:_)[Se]=me}else De[me]=1,ne[ke]=me;xe.add(me)}Ae&&console.warn("Duplicate headers found and renamed."),b=!0}return{data:ie,errors:ue,meta:{delimiter:x,linebreak:$,aborted:C,truncated:!!be,cursor:Y+(M||0),renamedHeaders:_}}}function Me(){q(te()),ie=[],ue=[]}},this.abort=function(){C=!0},this.getCharIndex=function(){return z}}function I(D){var x=D.data,$=s[x.workerId],V=!1;if(x.error)$.userError(x.error,x.file);else if(x.results&&x.results.data){var q={abort:function(){V=!0,j(x.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:w,resume:w};if(W($.userStep)){for(var ae=0;ae<x.results.data.length&&($.userStep({data:x.results.data[ae],errors:x.results.errors,meta:x.results.meta},q),!V);ae++);delete x.results}else W($.userChunk)&&($.userChunk(x.results,q,x.file),delete x.results)}x.finished&&!V&&j(x.workerId,x.results)}function j(D,x){var $=s[D];W($.userComplete)&&$.userComplete(x),$.terminate(),delete s[D]}function w(){throw new Error("Not implemented.")}function S(D){if(typeof D!="object"||D===null)return D;var x,$=Array.isArray(D)?[]:{};for(x in D)$[x]=S(D[x]);return $}function P(D,x){return function(){D.apply(x,arguments)}}function W(D){return typeof D=="function"}return u.parse=function(D,x){var $=(x=x||{}).dynamicTyping||!1;if(W($)&&(x.dynamicTypingFunction=$,$={}),x.dynamicTyping=$,x.transform=!!W(x.transform)&&x.transform,!x.worker||!u.WORKERS_SUPPORTED)return $=null,u.NODE_STREAM_INPUT,typeof D=="string"?(D=(V=>V.charCodeAt(0)!==65279?V:V.slice(1))(D),$=new(x.download?f:g)(x)):D.readable===!0&&W(D.read)&&W(D.on)?$=new p(x):(i.File&&D instanceof File||D instanceof Object)&&($=new d(x)),$.stream(D);($=(()=>{var V;return!!u.WORKERS_SUPPORTED&&(V=(()=>{var q=i.URL||i.webkitURL||null,ae=n.toString();return u.BLOB_URL||(u.BLOB_URL=q.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",ae,")();"],{type:"text/javascript"})))})(),(V=new i.Worker(V)).onmessage=I,V.id=c++,s[V.id]=V)})()).userStep=x.step,$.userChunk=x.chunk,$.userComplete=x.complete,$.userError=x.error,x.step=W(x.step),x.chunk=W(x.chunk),x.complete=W(x.complete),x.error=W(x.error),delete x.worker,$.postMessage({input:D,config:x,workerId:$.id})},u.unparse=function(D,x){var $=!1,V=!0,q=",",ae=`\r
|
|
66
66
|
`,G='"',_=G+G,b=!1,B=null,X=!1,z=((()=>{if(typeof x=="object"){if(typeof x.delimiter!="string"||u.BAD_DELIMITERS.filter(function(M){return x.delimiter.indexOf(M)!==-1}).length||(q=x.delimiter),typeof x.quotes!="boolean"&&typeof x.quotes!="function"&&!Array.isArray(x.quotes)||($=x.quotes),typeof x.skipEmptyLines!="boolean"&&typeof x.skipEmptyLines!="string"||(b=x.skipEmptyLines),typeof x.newline=="string"&&(ae=x.newline),typeof x.quoteChar=="string"&&(G=x.quoteChar),typeof x.header=="boolean"&&(V=x.header),Array.isArray(x.columns)){if(x.columns.length===0)throw new Error("Option columns is empty");B=x.columns}x.escapeChar!==void 0&&(_=x.escapeChar+G),x.escapeFormulae instanceof RegExp?X=x.escapeFormulae:typeof x.escapeFormulae=="boolean"&&x.escapeFormulae&&(X=/^[=+\-@\t\r].*$/)}})(),new RegExp(v(G),"g"));if(typeof D=="string"&&(D=JSON.parse(D)),Array.isArray(D)){if(!D.length||Array.isArray(D[0]))return C(null,D,b);if(typeof D[0]=="object")return C(B||Object.keys(D[0]),D,b)}else if(typeof D=="object")return typeof D.data=="string"&&(D.data=JSON.parse(D.data)),Array.isArray(D.data)&&(D.fields||(D.fields=D.meta&&D.meta.fields||B),D.fields||(D.fields=Array.isArray(D.data[0])?D.fields:typeof D.data[0]=="object"?Object.keys(D.data[0]):[]),Array.isArray(D.data[0])||typeof D.data[0]=="object"||(D.data=[D.data])),C(D.fields||[],D.data||[],b);throw new Error("Unable to serialize unrecognized input");function C(M,O,K){var Q="",se=(typeof M=="string"&&(M=JSON.parse(M)),typeof O=="string"&&(O=JSON.parse(O)),Array.isArray(M)&&0<M.length),T=!Array.isArray(O[0]);if(se&&V){for(var Z=0;Z<M.length;Z++)0<Z&&(Q+=q),Q+=A(M[Z],Z);0<O.length&&(Q+=ae)}for(var ie=0;ie<O.length;ie++){var ue=(se?M:O[ie]).length,he=!1,Y=se?Object.keys(O[ie]).length===0:O[ie].length===0;if(K&&!se&&(he=K==="greedy"?O[ie].join("").trim()==="":O[ie].length===1&&O[ie][0].length===0),K==="greedy"&&se){for(var ge=[],oe=0;oe<ue;oe++){var ce=T?M[oe]:oe;ge.push(O[ie][ce])}he=ge.join("").trim()===""}if(!he){for(var N=0;N<ue;N++){0<N&&!Y&&(Q+=q);var U=se&&T?M[N]:N;Q+=A(O[ie][U],N)}ie<O.length-1&&(!K||0<ue&&!Y)&&(Q+=ae)}}return Q}function A(M,O){var K,Q;return M==null?"":M.constructor===Date?JSON.stringify(M).slice(1,25):(Q=!1,X&&typeof M=="string"&&X.test(M)&&(M="'"+M,Q=!0),K=M.toString().replace(z,_),(Q=Q||$===!0||typeof $=="function"&&$(M,O)||Array.isArray($)&&$[O]||((se,T)=>{for(var Z=0;Z<T.length;Z++)if(-1<se.indexOf(T[Z]))return!0;return!1})(K,u.BAD_DELIMITERS)||-1<K.indexOf(q)||K.charAt(0)===" "||K.charAt(K.length-1)===" ")?G+K+G:K)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
|
|
67
|
-
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!a&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=m,u.ParserHandle=y,u.NetworkStreamer=f,u.FileStreamer=d,u.StringStreamer=g,u.ReadableStreamStreamer=p,i.jQuery&&((r=i.jQuery).fn.parse=function(D){var x=D.config||{},$=[];return this.each(function(ae){if(!(r(this).prop("tagName").toUpperCase()==="INPUT"&&r(this).attr("type").toLowerCase()==="file"&&i.FileReader)||!this.files||this.files.length===0)return!0;for(var G=0;G<this.files.length;G++)$.push({file:this.files[G],inputElem:this,instanceConfig:r.extend({},x)})}),V(),this;function V(){if($.length===0)W(D.complete)&&D.complete();else{var ae,G,_,b,B=$[0];if(W(D.before)){var X=D.before(B.file,B.inputElem);if(typeof X=="object"){if(X.action==="abort")return ae="AbortError",G=B.file,_=B.inputElem,b=X.reason,void(W(D.error)&&D.error({name:ae},G,_,b));if(X.action==="skip")return void q();typeof X.config=="object"&&(B.instanceConfig=r.extend(B.instanceConfig,X.config))}else if(X==="skip")return void q()}var z=B.instanceConfig.complete;B.instanceConfig.complete=function(C){W(z)&&z(C,B.file,B.inputElem),q()},u.parse(B.file,B.instanceConfig)}}function q(){$.splice(0,1),V()}}),o&&(i.onmessage=function(D){D=D.data,u.WORKER_ID===void 0&&D&&(u.WORKER_ID=D.workerId),typeof D.input=="string"?i.postMessage({workerId:u.WORKER_ID,results:u.parse(D.input,D.config),finished:!0}):(i.File&&D.input instanceof File||D.input instanceof Object)&&(D=u.parse(D.input,D.config))&&i.postMessage({workerId:u.WORKER_ID,results:D,finished:!0})}),(f.prototype=Object.create(h.prototype)).constructor=f,(d.prototype=Object.create(h.prototype)).constructor=d,(g.prototype=Object.create(g.prototype)).constructor=g,(p.prototype=Object.create(h.prototype)).constructor=p,u})}(Wl)),Wl.exports}var $L=IL();const Rv=rr($L);function $r(t,e){return!e||e.length===0?t:t.map(i=>{const r={...i};return e.forEach(a=>{r[a.column]=r[a.column]?r[a.column].split(a.delimiter||",").map(o=>o.trim()):[]}),r})}var Ds={exports:{}};Ds.exports;var zm;function LL(){return zm||(zm=1,function(t,e){var n=200,i="Expected a function",r="__lodash_hash_undefined__",a=1,o=2,s=9007199254740991,c="[object Arguments]",u="[object Array]",h="[object Boolean]",f="[object Date]",d="[object Error]",g="[object Function]",p="[object GeneratorFunction]",y="[object Map]",v="[object Number]",m="[object Object]",I="[object Promise]",j="[object RegExp]",w="[object Set]",S="[object String]",P="[object Symbol]",W="[object WeakMap]",D="[object ArrayBuffer]",x="[object DataView]",$="[object Float32Array]",V="[object Float64Array]",q="[object Int8Array]",ae="[object Int16Array]",G="[object Int32Array]",_="[object Uint8Array]",b="[object Uint8ClampedArray]",B="[object Uint16Array]",X="[object Uint32Array]",z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,C=/^\w*$/,A=/^\./,M=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,O=/[\\^$.*+?()[\]{}|]/g,K=/\\(\\)?/g,Q=/^\[object .+?Constructor\]$/,se=/^(?:0|[1-9]\d*)$/,T={};T[$]=T[V]=T[q]=T[ae]=T[G]=T[_]=T[b]=T[B]=T[X]=!0,T[c]=T[u]=T[D]=T[h]=T[x]=T[f]=T[d]=T[g]=T[y]=T[v]=T[m]=T[j]=T[w]=T[S]=T[W]=!1;var Z=typeof Ot=="object"&&Ot&&Ot.Object===Object&&Ot,ie=typeof self=="object"&&self&&self.Object===Object&&self,ue=Z||ie||Function("return this")(),he=e&&!e.nodeType&&e,Y=he&&!0&&t&&!t.nodeType&&t,ge=Y&&Y.exports===he,oe=ge&&Z.process,ce=function(){try{return oe&&oe.binding("util")}catch{}}(),N=ce&&ce.isTypedArray;function U(ye,L,pe,E){for(var fe=-1,Te=ye?ye.length:0;++fe<Te;){var Ne=ye[fe];L(E,Ne,pe(Ne),ye)}return E}function ve(ye,L){for(var pe=-1,E=ye?ye.length:0;++pe<E;)if(L(ye[pe],pe,ye))return!0;return!1}function J(ye){return function(L){return L?.[ye]}}function R(ye,L){for(var pe=-1,E=Array(ye);++pe<ye;)E[pe]=L(pe);return E}function le(ye){return function(L){return ye(L)}}function ee(ye,L){return ye?.[L]}function de(ye){var L=!1;if(ye!=null&&typeof ye.toString!="function")try{L=!!(ye+"")}catch{}return L}function te(ye){var L=-1,pe=Array(ye.size);return ye.forEach(function(E,fe){pe[++L]=[fe,E]}),pe}function Me(ye,L){return function(pe){return ye(L(pe))}}function be(ye){var L=-1,pe=Array(ye.size);return ye.forEach(function(E){pe[++L]=E}),pe}var ne=Array.prototype,De=Function.prototype,xe=Object.prototype,Ae=ue["__core-js_shared__"],ke=function(){var ye=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return ye?"Symbol(src)_1."+ye:""}(),me=De.toString,Se=xe.hasOwnProperty,Le=xe.toString,F=RegExp("^"+me.call(Se).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ie=ue.Symbol,Ve=ue.Uint8Array,H=xe.propertyIsEnumerable,Oe=ne.splice,Ee=Me(Object.keys,Object),it=pn(ue,"DataView"),Tt=pn(ue,"Map"),sn=pn(ue,"Promise"),vn=pn(ue,"Set"),ln=pn(ue,"WeakMap"),Ut=pn(Object,"create"),jt=Kt(it),gn=Kt(Tt),Xt=Kt(sn),Hn=Kt(vn),Tn=Kt(ln),zi=Ie?Ie.prototype:void 0,xi=zi?zi.valueOf:void 0,Gi=zi?zi.toString:void 0;function Wn(ye){var L=-1,pe=ye?ye.length:0;for(this.clear();++L<pe;){var E=ye[L];this.set(E[0],E[1])}}function ai(){this.__data__=Ut?Ut(null):{}}function oi(ye){return this.has(ye)&&delete this.__data__[ye]}function Ni(ye){var L=this.__data__;if(Ut){var pe=L[ye];return pe===r?void 0:pe}return Se.call(L,ye)?L[ye]:void 0}function or(ye){var L=this.__data__;return Ut?L[ye]!==void 0:Se.call(L,ye)}function nn(ye,L){var pe=this.__data__;return pe[ye]=Ut&&L===void 0?r:L,this}Wn.prototype.clear=ai,Wn.prototype.delete=oi,Wn.prototype.get=Ni,Wn.prototype.has=or,Wn.prototype.set=nn;function kn(ye){var L=-1,pe=ye?ye.length:0;for(this.clear();++L<pe;){var E=ye[L];this.set(E[0],E[1])}}function jn(){this.__data__=[]}function na(ye){var L=this.__data__,pe=Ui(L,ye);if(pe<0)return!1;var E=L.length-1;return pe==E?L.pop():Oe.call(L,pe,1),!0}function ia(ye){var L=this.__data__,pe=Ui(L,ye);return pe<0?void 0:L[pe][1]}function ra(ye){return Ui(this.__data__,ye)>-1}function It(ye,L){var pe=this.__data__,E=Ui(pe,ye);return E<0?pe.push([ye,L]):pe[E][1]=L,this}kn.prototype.clear=jn,kn.prototype.delete=na,kn.prototype.get=ia,kn.prototype.has=ra,kn.prototype.set=It;function An(ye){var L=-1,pe=ye?ye.length:0;for(this.clear();++L<pe;){var E=ye[L];this.set(E[0],E[1])}}function _n(){this.__data__={hash:new Wn,map:new(Tt||kn),string:new Wn}}function aa(ye){return Gn(this,ye).delete(ye)}function oa(ye){return Gn(this,ye).get(ye)}function sa(ye){return Gn(this,ye).has(ye)}function $t(ye,L){return Gn(this,ye).set(ye,L),this}An.prototype.clear=_n,An.prototype.delete=aa,An.prototype.get=oa,An.prototype.has=sa,An.prototype.set=$t;function Yi(ye){var L=-1,pe=ye?ye.length:0;for(this.__data__=new An;++L<pe;)this.add(ye[L])}function qi(ye){return this.__data__.set(ye,r),this}function la(ye){return this.__data__.has(ye)}Yi.prototype.add=Yi.prototype.push=qi,Yi.prototype.has=la;function On(ye){this.__data__=new kn(ye)}function Nn(){this.__data__=new kn}function zn(ye){return this.__data__.delete(ye)}function ca(ye){return this.__data__.get(ye)}function ua(ye){return this.__data__.has(ye)}function Lt(ye,L){var pe=this.__data__;if(pe instanceof kn){var E=pe.__data__;if(!Tt||E.length<n-1)return E.push([ye,L]),this;pe=this.__data__=new An(E)}return pe.set(ye,L),this}On.prototype.clear=Nn,On.prototype.delete=zn,On.prototype.get=ca,On.prototype.has=ua,On.prototype.set=Lt;function ha(ye,L){var pe=Rt(ye)||dr(ye)?R(ye.length,String):[],E=pe.length,fe=!!E;for(var Te in ye)Se.call(ye,Te)&&!(fe&&(Te=="length"||Yn(Te,E)))&&pe.push(Te);return pe}function Ui(ye,L){for(var pe=ye.length;pe--;)if(cn(ye[pe][0],L))return pe;return-1}function Xi(ye,L,pe,E){return fa(ye,function(fe,Te,Ne){L(E,fe,pe(fe),Ne)}),E}var fa=cr(ga),da=Da();function ga(ye,L){return ye&&da(ye,L,bn)}function In(ye,L){L=zt(L,ye)?[L]:Er(L);for(var pe=0,E=L.length;ye!=null&&pe<E;)ye=ye[Xn(L[pe++])];return pe&&pe==E?ye:void 0}function Lr(ye){return Le.call(ye)}function pa(ye,L){return ye!=null&&L in Object(ye)}function Ii(ye,L,pe,E,fe){return ye===L?!0:ye==null||L==null||!wn(ye)&&!Qt(L)?ye!==ye&&L!==L:sr(ye,L,Ii,pe,E,fe)}function sr(ye,L,pe,E,fe,Te){var Ne=Rt(ye),Be=Rt(L),Re=u,Ge=u;Ne||(Re=At(ye),Re=Re==c?m:Re),Be||(Ge=At(L),Ge=Ge==c?m:Ge);var Ue=Re==m&&!de(ye),re=Ge==m&&!de(L),we=Re==Ge;if(we&&!Ue)return Te||(Te=new On),Ne||vi(ye)?ur(ye,L,pe,E,fe,Te):Ma(ye,L,Re,pe,E,fe,Te);if(!(fe&o)){var _e=Ue&&Se.call(ye,"__wrapped__"),Fe=re&&Se.call(L,"__wrapped__");if(_e||Fe){var We=_e?ye.value():ye,He=Fe?L.value():L;return Te||(Te=new On),pe(We,He,E,fe,Te)}}return we?(Te||(Te=new On),Ta(ye,L,pe,E,fe,Te)):!1}function Pr(ye,L,pe,E){var fe=pe.length,Te=fe;if(ye==null)return!Te;for(ye=Object(ye);fe--;){var Ne=pe[fe];if(Ne[2]?Ne[1]!==ye[Ne[0]]:!(Ne[0]in ye))return!1}for(;++fe<Te;){Ne=pe[fe];var Be=Ne[0],Re=ye[Be],Ge=Ne[1];if(Ne[2]){if(Re===void 0&&!(Be in ye))return!1}else{var Ue=new On,re;if(!(re===void 0?Ii(Ge,Re,E,a|o,Ue):re))return!1}}return!0}function ma(ye){if(!wn(ye)||Fr(ye))return!1;var L=un(ye)||de(ye)?F:Q;return L.test(Kt(ye))}function ya(ye){return Qt(ye)&&Kn(ye.length)&&!!T[Le.call(ye)]}function lr(ye){return typeof ye=="function"?ye:ye==null?Aa:typeof ye=="object"?Rt(ye)?wa(ye[0],ye[1]):va(ye):Rr(ye)}function xa(ye){if(!si(ye))return Ee(ye);var L=[];for(var pe in Object(ye))Se.call(ye,pe)&&pe!="constructor"&&L.push(pe);return L}function va(ye){var L=Vr(ye);return L.length==1&&L[0][2]?qn(L[0][0],L[0][1]):function(pe){return pe===ye||Pr(pe,ye,L)}}function wa(ye,L){return zt(ye)&&hr(L)?qn(Xn(ye),L):function(pe){var E=ci(pe,ye);return E===void 0&&E===L?Qn(pe,ye):Ii(L,E,void 0,a|o)}}function ba(ye){return function(L){return In(L,ye)}}function Ca(ye){if(typeof ye=="string")return ye;if(li(ye))return Gi?Gi.call(ye):"";var L=ye+"";return L=="0"&&1/ye==-1/0?"-0":L}function Er(ye){return Rt(ye)?ye:Un(ye)}function Sa(ye,L){return function(pe,E){var fe=Rt(pe)?U:Xi,Te={};return fe(pe,ye,lr(E),Te)}}function cr(ye,L){return function(pe,E){if(pe==null)return pe;if(!$i(pe))return ye(pe,E);for(var fe=pe.length,Te=-1,Ne=Object(pe);++Te<fe&&E(Ne[Te],Te,Ne)!==!1;);return pe}}function Da(ye){return function(L,pe,E){for(var fe=-1,Te=Object(L),Ne=E(L),Be=Ne.length;Be--;){var Re=Ne[++fe];if(pe(Te[Re],Re,Te)===!1)break}return L}}function ur(ye,L,pe,E,fe,Te){var Ne=fe&o,Be=ye.length,Re=L.length;if(Be!=Re&&!(Ne&&Re>Be))return!1;var Ge=Te.get(ye);if(Ge&&Te.get(L))return Ge==L;var Ue=-1,re=!0,we=fe&a?new Yi:void 0;for(Te.set(ye,L),Te.set(L,ye);++Ue<Be;){var _e=ye[Ue],Fe=L[Ue];if(E)var We=Ne?E(Fe,_e,Ue,L,ye,Te):E(_e,Fe,Ue,ye,L,Te);if(We!==void 0){if(We)continue;re=!1;break}if(we){if(!ve(L,function(He,Ye){if(!we.has(Ye)&&(_e===He||pe(_e,He,E,fe,Te)))return we.add(Ye)})){re=!1;break}}else if(!(_e===Fe||pe(_e,Fe,E,fe,Te))){re=!1;break}}return Te.delete(ye),Te.delete(L),re}function Ma(ye,L,pe,E,fe,Te,Ne){switch(pe){case x:if(ye.byteLength!=L.byteLength||ye.byteOffset!=L.byteOffset)return!1;ye=ye.buffer,L=L.buffer;case D:return!(ye.byteLength!=L.byteLength||!E(new Ve(ye),new Ve(L)));case h:case f:case v:return cn(+ye,+L);case d:return ye.name==L.name&&ye.message==L.message;case j:case S:return ye==L+"";case y:var Be=te;case w:var Re=Te&o;if(Be||(Be=be),ye.size!=L.size&&!Re)return!1;var Ge=Ne.get(ye);if(Ge)return Ge==L;Te|=a,Ne.set(ye,L);var Ue=ur(Be(ye),Be(L),E,fe,Te,Ne);return Ne.delete(ye),Ue;case P:if(xi)return xi.call(ye)==xi.call(L)}return!1}function Ta(ye,L,pe,E,fe,Te){var Ne=fe&o,Be=bn(ye),Re=Be.length,Ge=bn(L),Ue=Ge.length;if(Re!=Ue&&!Ne)return!1;for(var re=Re;re--;){var we=Be[re];if(!(Ne?we in L:Se.call(L,we)))return!1}var _e=Te.get(ye);if(_e&&Te.get(L))return _e==L;var Fe=!0;Te.set(ye,L),Te.set(L,ye);for(var We=Ne;++re<Re;){we=Be[re];var He=ye[we],Ye=L[we];if(E)var Ze=Ne?E(Ye,He,we,L,ye,Te):E(He,Ye,we,ye,L,Te);if(!(Ze===void 0?He===Ye||pe(He,Ye,E,fe,Te):Ze)){Fe=!1;break}We||(We=we=="constructor")}if(Fe&&!We){var Ke=ye.constructor,nt=L.constructor;Ke!=nt&&"constructor"in ye&&"constructor"in L&&!(typeof Ke=="function"&&Ke instanceof Ke&&typeof nt=="function"&&nt instanceof nt)&&(Fe=!1)}return Te.delete(ye),Te.delete(L),Fe}function Gn(ye,L){var pe=ye.__data__;return ja(L)?pe[typeof L=="string"?"string":"hash"]:pe.map}function Vr(ye){for(var L=bn(ye),pe=L.length;pe--;){var E=L[pe],fe=ye[E];L[pe]=[E,fe,hr(fe)]}return L}function pn(ye,L){var pe=ee(ye,L);return ma(pe)?pe:void 0}var At=Lr;(it&&At(new it(new ArrayBuffer(1)))!=x||Tt&&At(new Tt)!=y||sn&&At(sn.resolve())!=I||vn&&At(new vn)!=w||ln&&At(new ln)!=W)&&(At=function(ye){var L=Le.call(ye),pe=L==m?ye.constructor:void 0,E=pe?Kt(pe):void 0;if(E)switch(E){case jt:return x;case gn:return y;case Xt:return I;case Hn:return w;case Tn:return W}return L});function ka(ye,L,pe){L=zt(L,ye)?[L]:Er(L);for(var E,fe=-1,Ne=L.length;++fe<Ne;){var Te=Xn(L[fe]);if(!(E=ye!=null&&pe(ye,Te)))break;ye=ye[Te]}if(E)return E;var Ne=ye?ye.length:0;return!!Ne&&Kn(Ne)&&Yn(Te,Ne)&&(Rt(ye)||dr(ye))}function Yn(ye,L){return L=L??s,!!L&&(typeof ye=="number"||se.test(ye))&&ye>-1&&ye%1==0&&ye<L}function zt(ye,L){if(Rt(ye))return!1;var pe=typeof ye;return pe=="number"||pe=="symbol"||pe=="boolean"||ye==null||li(ye)?!0:C.test(ye)||!z.test(ye)||L!=null&&ye in Object(L)}function ja(ye){var L=typeof ye;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?ye!=="__proto__":ye===null}function Fr(ye){return!!ke&&ke in ye}function si(ye){var L=ye&&ye.constructor,pe=typeof L=="function"&&L.prototype||xe;return ye===pe}function hr(ye){return ye===ye&&!wn(ye)}function qn(ye,L){return function(pe){return pe==null?!1:pe[ye]===L&&(L!==void 0||ye in Object(pe))}}var Un=$n(function(ye){ye=wi(ye);var L=[];return A.test(ye)&&L.push(""),ye.replace(M,function(pe,E,fe,Te){L.push(fe?Te.replace(K,"$1"):E||pe)}),L});function Xn(ye){if(typeof ye=="string"||li(ye))return ye;var L=ye+"";return L=="0"&&1/ye==-1/0?"-0":L}function Kt(ye){if(ye!=null){try{return me.call(ye)}catch{}try{return ye+""}catch{}}return""}var fr=Sa(function(ye,L,pe){Se.call(ye,pe)?ye[pe].push(L):ye[pe]=[L]});function $n(ye,L){if(typeof ye!="function"||L&&typeof L!="function")throw new TypeError(i);var pe=function(){var E=arguments,fe=L?L.apply(this,E):E[0],Te=pe.cache;if(Te.has(fe))return Te.get(fe);var Ne=ye.apply(this,E);return pe.cache=Te.set(fe,Ne),Ne};return pe.cache=new($n.Cache||An),pe}$n.Cache=An;function cn(ye,L){return ye===L||ye!==ye&&L!==L}function dr(ye){return gr(ye)&&Se.call(ye,"callee")&&(!H.call(ye,"callee")||Le.call(ye)==c)}var Rt=Array.isArray;function $i(ye){return ye!=null&&Kn(ye.length)&&!un(ye)}function gr(ye){return Qt(ye)&&$i(ye)}function un(ye){var L=wn(ye)?Le.call(ye):"";return L==g||L==p}function Kn(ye){return typeof ye=="number"&&ye>-1&&ye%1==0&&ye<=s}function wn(ye){var L=typeof ye;return!!ye&&(L=="object"||L=="function")}function Qt(ye){return!!ye&&typeof ye=="object"}function li(ye){return typeof ye=="symbol"||Qt(ye)&&Le.call(ye)==P}var vi=N?le(N):ya;function wi(ye){return ye==null?"":Ca(ye)}function ci(ye,L,pe){var E=ye==null?void 0:In(ye,L);return E===void 0?pe:E}function Qn(ye,L){return ye!=null&&ka(ye,L,pa)}function bn(ye){return $i(ye)?ha(ye):xa(ye)}function Aa(ye){return ye}function Rr(ye){return zt(ye)?J(Xn(ye)):ba(ye)}t.exports=fr}(Ds,Ds.exports)),Ds.exports}var PL=LL();const EL=rr(PL);function VL(t,e){return t.map(n=>{const i={...n};return i["~id"]=i[e],i})}function FL(t){const e=[];return t.forEach(n=>{n.forEach(i=>{e.push(i)})}),e}function RL(t,e){const n=EL(t,"~id"),i=Object.keys(n).map(s=>n[s].reduce((u,h)=>(Object.assign(u,h),u),{})),r=new Set;i.forEach(s=>{Object.keys(s).forEach(c=>{r.add(c)})});const a={};return r.forEach(s=>{a[s]=void 0}),i.map(s=>({...a,...s})).map(s=>({...s,[e]:s["~id"]}))}function BL(t,e){const n=t.map(r=>VL(r.data,r.idColumn)),i=FL(n);return RL(i,e||"~id")}function Go(t,e){if(!e)return t;Qi.registerHelper("json",i=>new Qi.SafeString(JSON.stringify(i,null,2)));const n=Qi.compile(e);return JSON.parse(n(t))}async function co(t,e,n,i,r,a){return new Promise((o,s)=>{Rv.parse(t,{download:!0,skipEmptyLines:!0,dynamicTyping:!0,header:a!==!1,delimiter:r||",",complete(c){if(i&&console.log("Data from file:",c.data),n){const u=$r(c.data,n);i&&console.log("Data after transformation of column to array:",u),o(Go(u,e))}else o(Go(c.data,e))},error(c){s(c)}})})}async function HL(t,e,n,i,r,a){return new Promise((o,s)=>{Rv.parse(t,{skipEmptyLines:!0,header:a!==!1,delimiter:r||",",complete(c){if(i&&console.log("Data from file:",c.data),n){const u=$r(c.data,n);i&&console.log("Data after transformation of column to array:",u),o(Go(u,e))}else o(Go(c.data,e))},error(c){s(c)}})})}async function en(t,e,n,i){const r=t;try{const a=await fetch(r);if(!a.ok)throw new Error(`Response status: ${a.status}`);const o=await a.json(),s=Go(o,n);if(i&&console.log("Data from file:",o),e){const c=$r(s,e);return i&&console.log("Data after transformation of column to array:",c),c}return s}catch(a){return a}}async function uo(t,e,n,i,r){const a=await fetch(t,{method:"GET",headers:e});if(!a.ok)throw new Error("Network response was not ok");const o=await a.json(),s=Go(o,i);if(r&&(console.log("Data from api:",o),console.log("Data from api after transformation:",s)),n){const c=$r(s,n);return r&&console.log("Data after transformation of column to array:",c),c}return s}async function ts(t,e){const n=await Promise.all(t.map(r=>r.fileType==="json"?en(r.dataURL,r.columnsToArray,r.dataTransformation,!1):r.fileType==="api"?uo(r.dataURL,r.apiHeaders,r.columnsToArray,r.dataTransformation,!1):co(r.dataURL,r.dataTransformation,r.columnsToArray,!1,r.delimiter,!0)));return BL(n.map((r,a)=>({data:r,idColumn:t[a].idColumnName})),e)}const WL=(t,e)=>{const n=[...t];for(;n.length<e;)n.push(n[n.length-1]);return n};function Gs(t,e){const n=tt(t.filter(a=>a!=null),a=>a),r=([...new Set(n)].length<e?WL(n,e).slice(1,-1):sI(n,e).slice(1,-1)).map(a=>{const o=parseFloat(Zh(".2r")(a));return isNaN(o)?a<-1?Math.round(a):a:a!==0&&Math.abs(a)<1?o:Math.round(o)});return[...new Set(r)]}function Bv(t){const{data:e,graphTitle:n,mapData:i="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",colors:r=Pe.light.bivariateColors.colors05x05,sources:a,graphDescription:o,height:s,width:c,footNote:u="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",xDomain:h,yDomain:f,xColorLegendTitle:d="X Color key",yColorLegendTitle:g="Y Color key",tooltip:p,scale:y=.95,centerPoint:v,padding:m,mapBorderWidth:I=.5,mapNoDataColor:j=Pe.light.graphNoData,backgroundColor:w=!1,mapBorderColor:S=Pe.light.grays["gray-500"],relativeHeight:P,onSeriesMouseOver:W,isWorldMap:D=!0,zoomScaleExtend:x=[.8,6],zoomTranslateExtend:$,graphID:V,showColorScale:q=!0,highlightedIds:ae=[],onSeriesMouseClick:G,mapProperty:_="ISO3",graphDownload:b=!1,dataDownload:B=!1,showAntarctica:X=!1,language:z="en",minHeight:C=0,theme:A="light",ariaLabel:M,resetSelectionOnDoubleClick:O=!0,detailsOnClick:K,styles:Q,classNames:se,mapProjection:T,zoomInteraction:Z="button",animate:ie=!1,dimmedOpacity:ue=.3,customLayers:he=[],timeline:Y={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(Y.autoplay),J=di(Xe(e.filter(ne=>ne.date!==void 0&&ne.date!==null),ne=>ne.date).map(ne=>ze(`${ne.date}`,Y.dateFormat||"yyyy",new Date).getTime()),(ne,De)=>an(ne,De)),[R,le]=k.useState(Y.autoplay?0:J.length-1),[ee,de]=k.useState(void 0),te=k.useRef(null),Me=k.useRef(null);k.useEffect(()=>{const ne=new ResizeObserver(De=>{oe(c||De[0].contentRect.width||760),N(s||De[0].target.clientHeight||480)});return te.current&&(N(te.current.clientHeight||480),oe(te.current.clientWidth||760),c||ne.observe(te.current)),()=>ne.disconnect()},[c,s]),k.useEffect(()=>{typeof i=="string"?en(i).then(De=>{de(De)}):de(i)},[i]),k.useEffect(()=>{const ne=setInterval(()=>{le(De=>De<J.length-1?De+1:0)},(Y.speed||2)*1e3);return U||clearInterval(ne),()=>clearInterval(ne)},[J,U,Y.speed]);const be=yi(J,R,Y.showOnlyActiveDate,Y.dateFormat||"yyyy");return h&&f&&(h.length!==r[0].length-1||f.length!==r.length-1)?(console.error("the xDomain and yDomain array length don't match to the color array length"),null):l.jsx("div",{className:`${A||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:z==="he"||z==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${w?w===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${z||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...w&&w!==!0?{backgroundColor:w}:{}},id:V,ref:Me,"aria-label":M||`${n?`The graph shows ${n}. `:""}This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:w?m||"1rem":m||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||o||b||B?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:o,width:c,graphDownload:b?Me.current:void 0,dataDownload:B?e.map(ne=>ne.data).filter(ne=>ne!==void 0).length>0?e.map(ne=>ne.data).filter(ne=>ne!==void 0):e.filter(ne=>ne!==void 0):null}):null,Y.enabled&&J.length>0&&be?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{ve(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:J[0],max:J[J.length-1],marks:be,step:null,defaultValue:J[J.length-1],value:J[R],onChangeComplete:ne=>{le(J.indexOf(ne))},onChange:ne=>{le(J.indexOf(ne))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:te,"aria-label":"Map area",children:(c||ge)&&(s||ce)&&ee?l.jsx(OL,{data:e.filter(ne=>Y.enabled?ne.date===ft(new Date(J[R]),Y.dateFormat||"yyyy"):ne),mapData:X?ee:{...ee,features:ee.features.filter(ne=>ne.properties.NAME!=="Antarctica")},xDomain:h||Gs(e.map(ne=>ne.x),r[0].length),yDomain:f||Gs(e.map(ne=>ne.y),r.length),width:c||ge,height:Math.max(C,s||(P?C?(c||ge)*P>C?(c||ge)*P:C:(c||ge)*P:ce)),scale:y,centerPoint:v,colors:r,xColorLegendTitle:d,yColorLegendTitle:g,mapBorderWidth:I,mapNoDataColor:j,mapBorderColor:S,tooltip:p,onSeriesMouseOver:W,isWorldMap:D,zoomScaleExtend:x,zoomTranslateExtend:$,onSeriesMouseClick:G,mapProperty:_,highlightedIds:ae,resetSelectionOnDoubleClick:O,styles:Q,showColorScale:q,classNames:se,mapProjection:T||(D?"naturalEarth":"mercator"),detailsOnClick:K,zoomInteraction:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0},dimmedOpacity:ue,customLayers:he}):l.jsx("div",{style:{height:`${Math.max(C,s||(P?C?(c||ge)*P>C?(c||ge)*P:C:(c||ge)*P:ce))}px`},className:"flex items-center justify-center",children:l.jsx(Ce.Spinner,{"aria-label":"Loading graph"})})}),a||u?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:a,footNote:u,width:c}):null]})})})})}function zL(t){const{data:e,colorDomain:n,colors:i,mapData:r,colorLegendTitle:a,categorical:o,height:s,width:c,scale:u,centerPoint:h,tooltip:f,mapBorderWidth:d,mapBorderColor:g,mapNoDataColor:p,onSeriesMouseOver:y,showColorScale:v,zoomScaleExtend:m,zoomTranslateExtend:I,highlightedIds:j,onSeriesMouseClick:w,mapProperty:S,resetSelectionOnDoubleClick:P,detailsOnClick:W,styles:D,classNames:x,mapProjection:$,zoomInteraction:V,animate:q,dimmedOpacity:ae,customLayers:G}=t,[_,b]=k.useState(void 0),B=k.useRef(null),[X,z]=k.useState(!(c<680)),[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z=k.useRef(null),ie=ct(Z,{once:q.once,amount:q.amount}),ue=k.useRef(null),he=o?Xs().domain(n).range(i):Po().domain(n).range(i);k.useEffect(()=>{const le=bt(ue.current),ee=bt(Z.current),de=Me=>{if(V==="noZoom")return!1;if(V==="button")return!Me.type.includes("wheel");const be=Me.type==="wheel",ne=Me.type.startsWith("touch"),De=Me.type==="mousedown"||Me.type==="mousemove";return ne?!0:be?V==="scroll"?!0:Me.ctrlKey:De&&!Me.button&&!Me.ctrlKey},te=Dd().scaleExtent(m).translateExtent(I||[[-20,-20],[c+20,s+20]]).filter(de).on("zoom",({transform:Me})=>{le.attr("transform",Me)});ee.call(te),B.current=te},[s,c,V]);const Y=hd(r),ge=fd(r),oe=Y[2]-Y[0],ce=Y[3]-Y[1],N=c*190/960*360/oe,U=s*190/678*180/ce,ve=u*Math.min(N,U),J=$==="mercator"?xd().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve):$==="equalEarth"?vd().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve):$==="naturalEarth"?wd().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve):$==="orthographic"?bd().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve):md().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve),R=le=>{if(!Z.current||!B.current)return;bt(Z.current).call(B.current.scaleBy,le==="in"?1.2:1/1.2)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx($e.svg,{width:`${c}px`,height:`${s}px`,viewBox:`0 0 ${c} ${s}`,ref:Z,direction:"ltr",children:l.jsxs("g",{ref:ue,children:[G.filter(le=>le.position==="before").map(le=>le.layer),r.features.map((le,ee)=>e.findIndex(te=>te.id===le.properties[S])!==-1?null:l.jsx("g",{opacity:_?ae:j.length!==0?j.indexOf(le.properties[S])!==-1?1:ae:1,children:le.geometry.type==="MultiPolygon"?le.geometry.coordinates.map((te,Me)=>{let be="";return te.forEach(ne=>{let De=" M";ne.forEach((xe,Ae)=>{const ke=J([xe[0],xe[1]]);Ae!==ne.length-1?De=`${De}${ke[0]} ${ke[1]}L`:De=`${De}${ke[0]} ${ke[1]}`}),be+=De}),l.jsx("path",{d:be,style:{stroke:g,strokeWidth:d,fill:p}},Me)}):le.geometry.coordinates.map((te,Me)=>{let be="M";return te.forEach((ne,De)=>{const xe=J([ne[0],ne[1]]);De!==te.length-1?be=`${be}${xe[0]} ${xe[1]}L`:be=`${be}${xe[0]} ${xe[1]}`}),l.jsx("path",{d:be,style:{stroke:g,strokeWidth:d,fill:p}},Me)})},ee)),l.jsx(mt,{children:e.map(le=>{const ee=r.features.findIndex(te=>le.id===te.properties[S]),de=je(le.x)?p:he(le.x);return l.jsx($e.g,{variants:{initial:{opacity:0},whileInView:{opacity:_?_===de?1:ae:j.length!==0?j.indexOf(le.id)!==-1?1:ae:1,transition:{duration:q.duration}}},initial:"initial",animate:ie?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},onMouseEnter:te=>{O(le),T(te.clientY),Q(te.clientX),y?.(le)},onMouseMove:te=>{O(le),T(te.clientY),Q(te.clientX)},onMouseLeave:()=>{O(void 0),Q(void 0),T(void 0),y?.(void 0)},onClick:()=>{(w||W)&&(dt(C,le)&&P?(A(void 0),w?.(void 0)):(A(le),w?.(le)))},children:ee===-1?null:r.features[ee].geometry.type==="MultiPolygon"?r.features[ee].geometry.coordinates.map((te,Me)=>{let be="";return te.forEach(ne=>{let De=" M";ne.forEach((xe,Ae)=>{const ke=J([xe[0],xe[1]]);Ae!==ne.length-1?De=`${De}${ke[0]} ${ke[1]}L`:De=`${De}${ke[0]} ${ke[1]}`}),be+=De}),l.jsx($e.path,{d:be,variants:{initial:{fill:de,opacity:0},whileInView:{fill:de,opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:ie?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},style:{stroke:g,strokeWidth:d}},`${le.id}-${Me}`)}):r.features[ee].geometry.coordinates.map((te,Me)=>{let be="M";return te.forEach((ne,De)=>{const xe=J([ne[0],ne[1]]);De!==te.length-1?be=`${be}${xe[0]} ${xe[1]}L`:be=`${be}${xe[0]} ${xe[1]}`}),l.jsx($e.path,{d:be,variants:{initial:{fill:de,opacity:0},whileInView:{fill:de,opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:ie?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},style:{stroke:g,strokeWidth:d}},`${le.id}-${Me}`)})},le.id)})}),M?r.features.filter(le=>le.properties[S]===M.id).map((le,ee)=>l.jsx("g",{children:le.geometry.type==="MultiPolygon"?le.geometry.coordinates.map((de,te)=>{let Me="";return de.forEach(be=>{let ne=" M";be.forEach((De,xe)=>{const Ae=J([De[0],De[1]]);xe!==be.length-1?ne=`${ne}${Ae[0]} ${Ae[1]}L`:ne=`${ne}${Ae[0]} ${Ae[1]}`}),Me+=ne}),l.jsx("path",{d:Me,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},te)}):le.geometry.coordinates.map((de,te)=>{let Me="M";return de.forEach((be,ne)=>{const De=J([be[0],be[1]]);ne!==de.length-1?Me=`${Me}${De[0]} ${De[1]}L`:Me=`${Me}${De[0]} ${De[1]}`}),l.jsx("path",{d:Me,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},te)})},ee)):null,G.filter(le=>le.position==="after").map(le=>le.layer)]})}),v===!1?null:l.jsx("div",{className:"absolute left-4 bottom-4",children:X?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{z(!1)},children:l.jsx(ea,{})}),l.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:o?void 0:"340px"},children:[a&&a!==""?l.jsx(Ce.P,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:a}):null,o?l.jsx("div",{className:"flex flex-col gap-3",children:n.map((le,ee)=>l.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{b(i[ee%i.length])},onMouseLeave:()=>{b(void 0)},children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i[ee%i.length]}}),l.jsx(Ce.P,{size:"sm",marginBottom:"none",leading:"none",children:le})]},ee))}):l.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:l.jsxs("g",{children:[n.map((le,ee)=>l.jsxs("g",{onMouseOver:()=>{b(i[ee])},onMouseLeave:()=>{b(void 0)},className:"cursor-pointer",children:[l.jsx("rect",{x:ee*320/i.length+1,y:1,width:320/i.length-2,height:8,className:_===i[ee]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:i[ee],..._===i[ee]?{}:{stroke:i[ee]}}}),l.jsx("text",{x:(ee+1)*320/i.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:qe(le,"NA")})]},ee)),l.jsx("g",{children:l.jsx("rect",{onMouseOver:()=>{b(i[n.length])},onMouseLeave:()=>{b(void 0)},x:n.length*320/i.length+1,y:1,width:320/i.length-2,height:8,className:`cursor-pointer ${_===i[n.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:i[n.length],..._===i[n.length]?{}:{stroke:i[n.length]}}})})]})})]})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{z(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),V==="button"&&l.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[l.jsx("button",{onClick:()=>R("in"),className:"leading-0 px-2 py-3.5 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),l.jsx("button",{onClick:()=>R("out"),className:"leading-0 px-2 py-3.5 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),W&&C!==void 0?l.jsx(Ce.Modal,{open:C!==void 0,onClose:()=>{A(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof W=="string"?{__html:lt(W,C)}:void 0,children:typeof W=="function"?W(C):null})}):null,M&&f&&K&&se?l.jsx(st,{data:M,body:f,xPos:K,yPos:se,backgroundStyle:D?.tooltip,className:x?.tooltip}):null]})}var Ou,Gm;function GL(){if(Gm)return Ou;Gm=1;var t=1/0,e=9007199254740991,n="[object Arguments]",i="[object Function]",r="[object GeneratorFunction]",a=typeof Ot=="object"&&Ot&&Ot.Object===Object&&Ot,o=typeof self=="object"&&self&&self.Object===Object&&self,s=a||o||Function("return this")(),c=Object.prototype,u=c.hasOwnProperty,h=c.toString,f=s.Symbol,d=c.propertyIsEnumerable,g=f?f.isConcatSpreadable:void 0;function p(x,$,V,q,ae){var G=-1,_=x.length;for(V||(V=y),ae||(ae=[]);++G<_;){var b=x[G];V(b)?p(b,$-1,V,q,ae):ae[ae.length]=b}return ae}function y(x){return I(x)||m(x)||!!(g&&x&&x[g])}function v(x){var $=x?x.length:0;return $?p(x,t):[]}function m(x){return w(x)&&u.call(x,"callee")&&(!d.call(x,"callee")||h.call(x)==n)}var I=Array.isArray;function j(x){return x!=null&&P(x.length)&&!S(x)}function w(x){return D(x)&&j(x)}function S(x){var $=W(x)?h.call(x):"";return $==i||$==r}function P(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=e}function W(x){var $=typeof x;return!!x&&($=="object"||$=="function")}function D(x){return!!x&&typeof x=="object"}return Ou=v,Ou}var YL=GL();const hn=rr(YL);function jr(t,e){return t.length===0?[]:typeof t[0][e]!="object"?tt(Xe(t,r=>r[e]),r=>r[e]).map(r=>r[e]):tt(Xe(hn(t.map(i=>i[e])),i=>i),i=>i)}function Hv(t){const{data:e,mapData:n="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",graphTitle:i,colors:r,sources:a,graphDescription:o,height:s,width:c,footNote:u="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorDomain:h,colorLegendTitle:f,scaleType:d="threshold",scale:g=.95,centerPoint:p,padding:y,mapBorderWidth:v=.5,mapNoDataColor:m=Pe.light.graphNoData,backgroundColor:I=!1,mapBorderColor:j=Pe.light.grays["gray-500"],relativeHeight:w,tooltip:S,onSeriesMouseOver:P,isWorldMap:W=!0,showColorScale:D=!0,zoomScaleExtend:x=[.8,6],zoomTranslateExtend:$,graphID:V,highlightedIds:q=[],onSeriesMouseClick:ae,mapProperty:G="ISO3",graphDownload:_=!1,dataDownload:b=!1,showAntarctica:B=!1,language:X="en",minHeight:z=0,theme:C="light",ariaLabel:A,resetSelectionOnDoubleClick:M=!0,detailsOnClick:O,styles:K,classNames:Q,mapProjection:se,zoomInteraction:T="button",animate:Z=!1,dimmedOpacity:ie=.3,customLayers:ue=[],timeline:he={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=t,[Y,ge]=k.useState(0),[oe,ce]=k.useState(0),[N,U]=k.useState(he.autoplay),ve=di(Xe(e.filter(ne=>ne.date!==void 0&&ne.date!==null),ne=>ne.date).map(ne=>ze(`${ne.date}`,he.dateFormat||"yyyy",new Date).getTime()),(ne,De)=>an(ne,De)),[J,R]=k.useState(he.autoplay?0:ve.length-1),[le,ee]=k.useState(void 0),de=k.useRef(null),te=k.useRef(null);k.useEffect(()=>{const ne=new ResizeObserver(De=>{ge(c||De[0].target.clientWidth||760),ce(s||De[0].target.clientHeight||480)});return de.current&&(ce(de.current.clientHeight||480),ge(de.current.clientWidth||760),c||ne.observe(de.current)),()=>ne.disconnect()},[c,s]),k.useEffect(()=>{typeof n=="string"?en(n).then(De=>{ee(De)}):ee(n)},[n]);const Me=h||(d==="categorical"?jr(e,"x"):Gs(e.map(ne=>ne.x),r?.length||4));k.useEffect(()=>{const ne=setInterval(()=>{R(De=>De<ve.length-1?De+1:0)},(he.speed||2)*1e3);return N||clearInterval(ne),()=>clearInterval(ne)},[ve,N,he.speed]);const be=yi(ve,J,he.showOnlyActiveDate,he.dateFormat||"yyyy");return l.jsx("div",{className:`${C||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:X==="he"||X==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${X||"en"}`,Q?.graphContainer),style:{...K?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:V,ref:te,"aria-label":A||`${i?`The graph shows ${i}. `:""}This is a choropleth map where geographic areas are colored in proportion to a specific variable.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:I?y||"1rem":y||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[i||o||_||b?l.jsx(Qe,{styles:{title:K?.title,description:K?.description},classNames:{title:Q?.title,description:Q?.description},graphTitle:i,graphDescription:o,width:c,graphDownload:_?te.current:void 0,dataDownload:b?e.map(ne=>ne.data).filter(ne=>ne!==void 0).length>0?e.map(ne=>ne.data).filter(ne=>ne!==void 0):e.filter(ne=>ne!==void 0):null}):null,he.enabled&&ve.length>0&&be?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{U(!N)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":N?"Click to pause animation":"Click to play animation",children:N?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:ve[0],max:ve[ve.length-1],marks:be,step:null,defaultValue:ve[ve.length-1],value:ve[J],onChangeComplete:ne=>{R(ve.indexOf(ne))},onChange:ne=>{R(ve.indexOf(ne))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:de,"aria-label":"Map area",children:(c||Y)&&(s||oe)&&le?l.jsx(zL,{data:e.filter(ne=>he.enabled?ne.date===ft(new Date(ve[J]),he.dateFormat||"yyyy"):ne),mapData:B?le:{...le,features:le.features.filter(ne=>ne.properties.NAME!=="Antarctica")},colorDomain:Me,width:c||Y,height:Math.max(z,s||(w?z?(c||Y)*w>z?(c||Y)*w:z:(c||Y)*w:oe)),scale:g,centerPoint:p,colors:r||(d==="categorical"?Pe[C].sequentialColors[`neutralColorsx0${Me.length}`]:Pe[C].sequentialColors[`neutralColorsx0${Me.length+1}`]),colorLegendTitle:f,mapBorderWidth:v,mapNoDataColor:m,categorical:d==="categorical",mapBorderColor:j,tooltip:S,onSeriesMouseOver:P,isWorldMap:W,showColorScale:D,zoomScaleExtend:x,zoomTranslateExtend:$,onSeriesMouseClick:ae,mapProperty:G,highlightedIds:q,resetSelectionOnDoubleClick:M,styles:K,classNames:Q,detailsOnClick:O,mapProjection:se||(W?"naturalEarth":"mercator"),zoomInteraction:T,dimmedOpacity:ie,animate:Z===!0?{duration:.5,once:!0,amount:.5}:Z||{duration:0,once:!0,amount:0},customLayers:ue}):l.jsx("div",{style:{height:`${Math.max(z,s||(w?z?(c||Y)*w>z?(c||Y)*w:z:(c||Y)*w:oe))}px`},className:"flex items-center justify-center",children:l.jsx(Ce.Spinner,{"aria-label":"Loading graph"})})}),a||u?l.jsx(et,{styles:{footnote:K?.footnote,source:K?.source},classNames:{footnote:Q?.footnote,source:Q?.source},sources:a,footNote:u,width:c}):null]})})})})}function qL(t){const{data:e,colors:n,mapData:i,colorLegendTitle:r,colorDomain:a,radius:o,height:s,width:c,scale:u,centerPoint:h,tooltip:f,showLabels:d,mapBorderWidth:g,mapBorderColor:p,mapNoDataColor:y,onSeriesMouseOver:v,showColorScale:m,zoomScaleExtend:I,zoomTranslateExtend:j,highlightedDataPoints:w,onSeriesMouseClick:S,resetSelectionOnDoubleClick:P,detailsOnClick:W,styles:D,classNames:x,mapProjection:$,zoomInteraction:V,animate:q,dimmedOpacity:ae,customLayers:G,maxRadiusValue:_}=t,[b,B]=k.useState(void 0),[X,z]=k.useState(!(c<680)),C=k.useRef(null),[A,M]=k.useState(void 0),[O,K]=k.useState(void 0),[Q,se]=k.useState(void 0),[T,Z]=k.useState(void 0),ie=k.useRef(null),ue=ct(ie,{once:q.once,amount:q.amount}),he=k.useRef(null),Y=e.filter(ee=>ee.radius===void 0||ee.radius===null).length!==e.length?Qs().domain([0,_]).range([.25,o]).nice():void 0;k.useEffect(()=>{const ee=bt(he.current),de=bt(ie.current),te=be=>{if(V==="noZoom")return!1;if(V==="button")return!be.type.includes("wheel");const ne=be.type==="wheel",De=be.type.startsWith("touch"),xe=be.type==="mousedown"||be.type==="mousemove";return De?!0:ne?V==="scroll"?!0:be.ctrlKey:xe&&!be.button&&!be.ctrlKey},Me=Dd().scaleExtent(I).translateExtent(j||[[-20,-20],[c+20,s+20]]).filter(te).on("zoom",({transform:be})=>{ee.attr("transform",be)});de.call(Me),C.current=Me},[s,c,V]);const ge=hd(i),oe=fd(i),ce=ge[2]-ge[0],N=ge[3]-ge[1],U=c*190/960*360/ce,ve=s*190/678*180/N,J=u*Math.min(U,ve),R=$==="mercator"?xd().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J):$==="equalEarth"?vd().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J):$==="naturalEarth"?wd().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J):$==="orthographic"?bd().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J):md().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J),le=ee=>{if(!ie.current||!C.current)return;bt(ie.current).call(C.current.scaleBy,ee==="in"?1.2:1/1.2)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx($e.svg,{width:`${c}px`,height:`${s}px`,viewBox:`0 0 ${c} ${s}`,ref:ie,direction:"ltr",children:l.jsxs("g",{ref:he,children:[G.filter(ee=>ee.position==="before").map(ee=>ee.layer),i.features.map((ee,de)=>l.jsx("g",{children:ee.geometry.type==="MultiPolygon"?ee.geometry.coordinates.map((te,Me)=>{let be="";return te.forEach(ne=>{let De=" M";ne.forEach((xe,Ae)=>{const ke=R([xe[0],xe[1]]);Ae!==ne.length-1?De=`${De}${ke[0]} ${ke[1]}L`:De=`${De}${ke[0]} ${ke[1]}`}),be+=De}),l.jsx("path",{d:be,style:{stroke:p,strokeWidth:g,fill:y}},Me)}):ee.geometry.coordinates.map((te,Me)=>{let be="M";return te.forEach((ne,De)=>{const xe=R([ne[0],ne[1]]);De!==te.length-1?be=`${be}${xe[0]} ${xe[1]}L`:be=`${be}${xe[0]} ${xe[1]}`}),l.jsx("path",{d:be,style:{stroke:p,strokeWidth:g,fill:y}},Me)})},de)),l.jsx(mt,{children:e.map(ee=>{const de=e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray;return l.jsxs($e.g,{variants:{initial:{opacity:0},whileInView:{opacity:b?b===de?1:ae:w.length!==0?w.indexOf(ee.label||"")!==-1?1:ae:1,transition:{duration:q.duration}}},initial:"initial",animate:ue?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},onMouseEnter:te=>{K(ee),Z(te.clientY),se(te.clientX),v?.(ee)},onMouseMove:te=>{K(ee),Z(te.clientY),se(te.clientX)},onMouseLeave:()=>{K(void 0),se(void 0),Z(void 0),v?.(void 0)},onClick:()=>{(S||W)&&(dt(A,ee)&&P?(M(void 0),S?.(void 0)):(M(ee),S?.(ee)))},transform:`translate(${R([ee.long,ee.lat])[0]},${R([ee.long,ee.lat])[1]})`,children:[l.jsx($e.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray,stroke:e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray},whileInView:{r:Y?Y(ee.radius||0):o,fill:e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray,stroke:e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray,transition:{duration:q.duration}}},initial:"initial",animate:ue?"whileInView":"initial",exit:{r:0,transition:{duration:q.duration}},style:{fillOpacity:.8}}),d&&ee.label?l.jsx($e.text,{variants:{initial:{opacity:0,x:Y?Y(ee.radius||0):o},whileInView:{opacity:1,x:Y?Y(ee.radius||0):o,transition:{duration:q.duration}}},initial:"initial",animate:ue?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},y:0,className:"fill-primary-gray-600 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},dx:4,dy:5,children:ee.label}):null]},ee.label||`${ee.lat}-${ee.long}`)})}),G.filter(ee=>ee.position==="after").map(ee=>ee.layer)]})}),e.filter(ee=>ee.color).length===0||m===!1?null:l.jsx("div",{className:"absolute left-4 bottom-4",children:X?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{z(!1)},children:l.jsx(ea,{})}),l.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[r&&r!==""?l.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:r}):null,l.jsx("div",{className:"flex flex-col gap-3",children:a.map((ee,de)=>l.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{B(n[de%n.length])},onMouseLeave:()=>{B(void 0)},children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n[de%n.length]}}),l.jsx(Ce.P,{size:"sm",marginBottom:"none",leading:"none",children:ee})]},de))})]})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{z(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),V==="button"&&l.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[l.jsx("button",{onClick:()=>le("in"),className:"leading-0 px-2 py-3.5 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),l.jsx("button",{onClick:()=>le("out"),className:"leading-0 px-2 py-3.5 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),W&&A!==void 0?l.jsx(Ce.Modal,{open:A!==void 0,onClose:()=>{M(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof W=="string"?{__html:lt(W,A)}:void 0,children:typeof W=="function"?W(A):null})}):null,O&&f&&Q&&T?l.jsx(st,{data:O,body:f,xPos:Q,yPos:T,backgroundStyle:D?.tooltip,className:x?.tooltip}):null]})}function Wv(t){const{data:e,mapData:n="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",graphTitle:i,colors:r,sources:a,graphDescription:o,height:s,width:c,footNote:u="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorLegendTitle:h,colorDomain:f,radius:d=5,scale:g=.95,centerPoint:p,padding:y,mapBorderWidth:v=.5,mapNoDataColor:m=Pe.light.graphNoData,backgroundColor:I=!1,showLabels:j=!1,mapBorderColor:w=Pe.light.grays["gray-500"],tooltip:S,relativeHeight:P,onSeriesMouseOver:W,isWorldMap:D=!0,showColorScale:x=!0,zoomScaleExtend:$=[.8,6],zoomTranslateExtend:V,graphID:q,highlightedDataPoints:ae=[],onSeriesMouseClick:G,graphDownload:_=!1,dataDownload:b=!1,showAntarctica:B=!1,language:X="en",minHeight:z=0,theme:C="light",ariaLabel:A,resetSelectionOnDoubleClick:M=!0,detailsOnClick:O,styles:K,classNames:Q,mapProjection:se,zoomInteraction:T="button",animate:Z=!1,dimmedOpacity:ie=.3,customLayers:ue=[],maxRadiusValue:he,timeline:Y={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(Y.autoplay),J=di(Xe(e.filter(ne=>ne.date!==void 0&&ne.date!==null),ne=>ne.date).map(ne=>ze(`${ne.date}`,Y.dateFormat||"yyyy",new Date).getTime()),(ne,De)=>an(ne,De)),[R,le]=k.useState(Y.autoplay?0:J.length-1),[ee,de]=k.useState(void 0),te=k.useRef(null),Me=k.useRef(null);k.useEffect(()=>{const ne=new ResizeObserver(De=>{oe(c||De[0].target.clientWidth||760),N(s||De[0].target.clientHeight||480)});return te.current&&(N(te.current.clientHeight||480),oe(te.current.clientWidth||760),c||ne.observe(te.current)),()=>ne.disconnect()},[c,s]),k.useEffect(()=>{typeof n=="string"?en(n).then(De=>{de(De)}):de(n)},[n]),k.useEffect(()=>{const ne=setInterval(()=>{le(De=>De<J.length-1?De+1:0)},(Y.speed||2)*1e3);return U||clearInterval(ne),()=>clearInterval(ne)},[J,U,Y.speed]);const be=yi(J,R,Y.showOnlyActiveDate,Y.dateFormat||"yyyy");return l.jsx("div",{className:`${C||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:X==="he"||X==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${X||"en"}`,Q?.graphContainer),style:{...K?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:q,ref:Me,"aria-label":A||`${i?`The graph shows ${i}. `:""}This is a dot density map showing the distribution of a variable across a region or world, with each dot representing a data point.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:I?y||"1rem":y||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[i||o||_||b?l.jsx(Qe,{styles:{title:K?.title,description:K?.description},classNames:{title:Q?.title,description:Q?.description},graphTitle:i,graphDescription:o,width:c,graphDownload:_?Me.current:void 0,dataDownload:b?e.map(ne=>ne.data).filter(ne=>ne!==void 0).length>0?e.map(ne=>ne.data).filter(ne=>ne!==void 0):e.filter(ne=>ne!==void 0):null}):null,Y.enabled&&J.length>0&&be?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{ve(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:J[0],max:J[J.length-1],marks:be,step:null,defaultValue:J[J.length-1],value:J[R],onChangeComplete:ne=>{le(J.indexOf(ne))},onChange:ne=>{le(J.indexOf(ne))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:te,"aria-label":"Map area",children:(c||ge)&&(s||ce)&&ee?l.jsx(qL,{data:e.filter(ne=>Y.enabled?ne.date===ft(new Date(J[R]),Y.dateFormat||"yyyy"):ne),mapData:B?ee:{...ee,features:ee.features.filter(ne=>ne.properties.NAME!=="Antarctica")},colorDomain:e.filter(ne=>ne.color).length===0?[]:f||Xe(e.filter(ne=>!je(ne.color)),"color").map(ne=>`${ne.color}`),width:c||ge,height:Math.max(z,s||(P?z?(c||ge)*P>z?(c||ge)*P:z:(c||ge)*P:ce)),scale:g,centerPoint:p,colors:e.filter(ne=>ne.color).length===0?r?[r]:[Pe.primaryColors["blue-600"]]:r||Pe[C].categoricalColors.colors,colorLegendTitle:h,radius:d,mapBorderWidth:v,mapNoDataColor:m,mapBorderColor:w,tooltip:S,onSeriesMouseOver:W,showLabels:j,isWorldMap:D,showColorScale:x,zoomScaleExtend:$,zoomTranslateExtend:V,onSeriesMouseClick:G,highlightedDataPoints:ae,resetSelectionOnDoubleClick:M,styles:K,classNames:Q,zoomInteraction:T,detailsOnClick:O,mapProjection:se||(D?"naturalEarth":"mercator"),animate:Z===!0?{duration:.5,once:!0,amount:.5}:Z||{duration:0,once:!0,amount:0},dimmedOpacity:ie,customLayers:ue,maxRadiusValue:je(he)?Math.max(...e.map(ne=>ne.radius).filter(ne=>ne!=null)):he}):l.jsx("div",{style:{height:`${Math.max(z,s||(P?z?(c||ge)*P>z?(c||ge)*P:z:(c||ge)*P:ce))}px`},className:"flex items-center justify-center",children:l.jsx(Ce.Spinner,{"aria-label":"Loading graph"})})}),a||u?l.jsx(et,{styles:{footnote:K?.footnote,source:K?.source},classNames:{footnote:Q?.footnote,source:Q?.source},sources:a,footNote:u,width:c}):null]})})})})}function UL(t){const{width:e,autoRotate:n,data:i,enableZoom:r,categorical:a,colorDomain:o,colors:s,globeMaterial:c,height:u,polygonData:h,mapProperty:f,mapBorderColor:d,atmosphereColor:g,tooltip:p,styles:y,classNames:v,mapNoDataColor:m,centerPoint:I,colorLegendTitle:j,showColorScale:w,hoverStrokeColor:S,detailsOnClick:P,onSeriesMouseClick:W,onSeriesMouseOver:D,resetSelectionOnDoubleClick:x,highlightedIds:$,altitude:V,globeOffset:q,polygonAltitude:ae,centerLng:G,centerLat:_}=t,b=k.useRef(void 0),[B,X]=k.useState(void 0),[z,C]=k.useState(!(e<680)),[A,M]=k.useState({x:0,y:0}),[O,K]=k.useState(void 0),Q=a?Xs().domain(o).range(s):Po().domain(o).range(s);k.useEffect(()=>{b?.current&&(b.current.controls().autoRotate=n!==0,b.current.controls().enableZoom=r,b.current.controls().autoRotateSpeed=n)},[n,r]),k.useEffect(()=>{b.current&&(O?b.current.controls().autoRotate=!1:b.current.controls().autoRotate=n!==0)},[O,n]),k.useEffect(()=>{const T=b.current?.renderer().domElement;if(!T)return;const Z=ie=>{M({x:ie.clientX,y:ie.clientY})};return T.addEventListener("mousemove",Z),()=>T.removeEventListener("mousemove",Z)},[]),k.useEffect(()=>{b.current&&b.current.pointOfView({lat:_,lng:G,altitude:V},1e3)},[V,G,_]);const se=new Gw.MeshLambertMaterial(c);return l.jsxs("div",{className:"relative",children:[l.jsx(Vw,{ref:b,width:e,height:u,globeOffset:q,lineHoverPrecision:0,polygonsData:h,polygonAltitude:T=>$.includes(T?.properties?.[f])?.1:T?.properties?.[f]===O?.id?.01:ae,polygonCapColor:T=>{const Z=T?.properties?.[f],ie=i.find(ue=>ue.id===Z)?.x;return ie!=null?Q(ie):m},polygonSideColor:T=>{const Z=T?.properties?.[f],ie=i.find(he=>he.id===Z)?.x,ue=ie!=null?Q(ie):m;return $.includes(T?.properties?.[f])?ue:"rgba(100,100,100,0)"},polygonStrokeColor:T=>T?.properties?.[f]===O?.id?S:d,onPolygonClick:T=>{const Z=T?.properties?.[f]?i.find(ie=>ie.id===T?.properties?.[f]):void 0;(W||P)&&(dt(B,Z)&&x&&Z?(X(void 0),W?.(void 0)):(X(Z),W?.(Z))),X(Z),W?.(Z)},onPolygonHover:T=>{const Z=T?.properties?.[f]?i.find(ie=>ie.id===T?.properties?.[f]):void 0;K(Z),D?.(Z)},atmosphereColor:g,globeMaterial:se,backgroundColor:"rgba(0, 0, 0, 0)",polygonsTransitionDuration:100,onGlobeReady:()=>{b.current&&b.current.pointOfView({lat:I[0],lng:I[1]})}}),w===!1?null:l.jsx("div",{className:"absolute left-4 bottom-4",children:z?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{C(!1)},children:l.jsx(ea,{})}),l.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:a?void 0:"340px"},children:[j&&j!==""?l.jsx(Ce.P,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:j}):null,a?l.jsx("div",{className:"flex flex-col gap-3",children:o.map((T,Z)=>l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s[Z%s.length]}}),l.jsx(Ce.P,{size:"sm",marginBottom:"none",leading:"none",children:T})]},Z))}):l.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:l.jsxs("g",{children:[o.map((T,Z)=>l.jsxs("g",{className:"cursor-pointer",children:[l.jsx("rect",{x:Z*320/s.length+1,y:1,width:320/s.length-2,height:8,style:{fill:s[Z],stroke:s[Z]}}),l.jsx("text",{x:(Z+1)*320/s.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:qe(T,"NA")})]},Z)),l.jsx("g",{children:l.jsx("rect",{x:o.length*320/s.length+1,y:1,width:320/s.length-2,height:8,style:{fill:s[o.length],stroke:s[o.length]}})})]})})]})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{C(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),O&&p?l.jsx(st,{data:O,body:p,xPos:A.x,yPos:A.y,backgroundStyle:y?.tooltip,className:v?.tooltip}):null,P&&B!==void 0?l.jsx(Ce.Modal,{open:B!==void 0,onClose:()=>{X(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof P=="string"?{__html:lt(P,B)}:void 0,children:typeof P=="function"?P(B):null})}):null]})}function zv(t){const{data:e,mapData:n="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",graphTitle:i,colors:r,sources:a,graphDescription:o,height:s,width:c,footNote:u="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorDomain:h,colorLegendTitle:f,scaleType:d="threshold",padding:g,mapNoDataColor:p=Pe.light.graphNoData,backgroundColor:y=!1,mapBorderColor:v=Pe.light.grays["gray-500"],relativeHeight:m,tooltip:I,graphID:j,mapProperty:w="ISO3",dataDownload:S=!1,language:P="en",minHeight:W=0,theme:D="light",ariaLabel:x,styles:$,classNames:V,autoRotate:q=!0,enableZoom:ae=!0,globeMaterial:G={color:"#fff",opacity:1,transparent:!1},centerPoint:_=[0,0],atmosphereColor:b="#999",showColorScale:B=!0,resetSelectionOnDoubleClick:X=!0,detailsOnClick:z,onSeriesMouseOver:C,onSeriesMouseClick:A,highlightedIds:M=[],altitude:O=1,globeOffset:K=[0,0],polygonAltitude:Q=.01}=t,[se,T]=k.useState(void 0),[Z,ie]=k.useState(0),[ue,he]=k.useState(0),Y=k.useRef(null);k.useEffect(()=>{const oe=new ResizeObserver(ce=>{ie(c||ce[0].target.clientWidth||760),he(s||ce[0].target.clientHeight||480)});return Y.current&&(he(Y.current.clientHeight||480),ie(Y.current.clientWidth||760),c||oe.observe(Y.current)),()=>oe.disconnect()},[c,s]),k.useEffect(()=>{typeof n=="string"?en(n).then(ce=>{if(n==="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json"){const N=ce.features.map(U=>{if(U.geometry.type==="Polygon"){const R=[...U.geometry.coordinates[0]].reverse(),le={...U.geometry,coordinates:[R]};return{...U,geometry:le}}const ve=[];U.geometry.coordinates.forEach(R=>{const le=[...R[0]].reverse();ve.push([le])});const J={...U.geometry,coordinates:ve};return{...U,geometry:J}});T(N)}else T(ce.features)}):T(n.features)},[n]);const ge=h||(d==="categorical"?jr(e,"x"):Gs(e.map(oe=>oe.x),r?.length||4));return l.jsx("div",{className:`${D||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:P==="he"||P==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${y?y===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${P||"en"}`,V?.graphContainer),style:{...$?.graphContainer||{},...y&&y!==!0?{backgroundColor:y}:{}},id:j,"aria-label":x||`${i?`The graph shows ${i}. `:""}This is a map.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:y?g||"1rem":g||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[i||o||S?l.jsx(Qe,{styles:{title:$?.title,description:$?.description},classNames:{title:V?.title,description:V?.description},graphTitle:i,graphDescription:o,width:c,graphDownload:void 0,dataDownload:S?e.map(oe=>oe.data).filter(oe=>oe!==void 0).length>0?e.map(oe=>oe.data).filter(oe=>oe!==void 0):e.filter(oe=>oe!==void 0):null}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:Y,"aria-label":"Map area",children:(c||Z)&&(s||ue)&&se?l.jsx(UL,{data:e,globeOffset:K,polygonData:se,colorDomain:ge,width:c||Z,height:Math.max(W,s||(m?W?(c||Z)*m>W?(c||Z)*m:W:(c||Z)*m:ue)),colors:r||(d==="categorical"?Pe[D].sequentialColors[`neutralColorsx0${ge.length}`]:Pe[D].sequentialColors[`neutralColorsx0${ge.length+1}`]),mapNoDataColor:p,categorical:d==="categorical",mapBorderColor:v,tooltip:I,mapProperty:w,styles:$,classNames:V,autoRotate:q===!0?1.5:q===!1?0:q,enableZoom:ae,globeMaterial:G,atmosphereColor:b,centerPoint:_,colorLegendTitle:f,showColorScale:B,hoverStrokeColor:D==="light"?Pe.light.grays["gray-700"]:Pe.light.grays["gray-300"],highlightedIds:M,resetSelectionOnDoubleClick:X,detailsOnClick:z,onSeriesMouseOver:C,onSeriesMouseClick:A,altitude:O,polygonAltitude:Q,centerLat:_[0],centerLng:_[1]}):l.jsx("div",{style:{height:`${Math.max(W,s||(m?W?(c||Z)*m>W?(c||Z)*m:W:(c||Z)*m:ue))}px`},className:"flex items-center justify-center",children:l.jsx(Ce.Spinner,{"aria-label":"Loading graph"})})}),a||u?l.jsx(et,{styles:{footnote:$?.footnote,source:$?.source},classNames:{footnote:V?.footnote,source:V?.source},sources:a,footNote:u,width:c}):null]})})})})}var Nu,Ym;function XL(){if(Ym)return Nu;Ym=1;var t="__lodash_hash_undefined__",e=9007199254740991,n="[object Function]",i="[object GeneratorFunction]",r=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=typeof Ot=="object"&&Ot&&Ot.Object===Object&&Ot,s=typeof self=="object"&&self&&self.Object===Object&&self,c=o||s||Function("return this")();function u(F,Ie,Ve){switch(Ve.length){case 0:return F.call(Ie);case 1:return F.call(Ie,Ve[0]);case 2:return F.call(Ie,Ve[0],Ve[1]);case 3:return F.call(Ie,Ve[0],Ve[1],Ve[2])}return F.apply(Ie,Ve)}function h(F,Ie){var Ve=F?F.length:0;return!!Ve&&g(F,Ie,0)>-1}function f(F,Ie){for(var Ve=-1,H=F?F.length:0,Oe=Array(H);++Ve<H;)Oe[Ve]=Ie(F[Ve],Ve,F);return Oe}function d(F,Ie,Ve,H){for(var Oe=F.length,Ee=Ve+-1;++Ee<Oe;)if(Ie(F[Ee],Ee,F))return Ee;return-1}function g(F,Ie,Ve){if(Ie!==Ie)return d(F,p,Ve);for(var H=Ve-1,Oe=F.length;++H<Oe;)if(F[H]===Ie)return H;return-1}function p(F){return F!==F}function y(F,Ie){return F.has(Ie)}function v(F,Ie){return F?.[Ie]}function m(F){var Ie=!1;if(F!=null&&typeof F.toString!="function")try{Ie=!!(F+"")}catch{}return Ie}var I=Array.prototype,j=Function.prototype,w=Object.prototype,S=c["__core-js_shared__"],P=function(){var F=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||"");return F?"Symbol(src)_1."+F:""}(),W=j.toString,D=w.hasOwnProperty,x=w.toString,$=RegExp("^"+W.call(D).replace(r,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=I.splice,q=Math.max,ae=Math.min,G=de(c,"Map"),_=de(Object,"create");function b(F){var Ie=-1,Ve=F?F.length:0;for(this.clear();++Ie<Ve;){var H=F[Ie];this.set(H[0],H[1])}}function B(){this.__data__=_?_(null):{}}function X(F){return this.has(F)&&delete this.__data__[F]}function z(F){var Ie=this.__data__;if(_){var Ve=Ie[F];return Ve===t?void 0:Ve}return D.call(Ie,F)?Ie[F]:void 0}function C(F){var Ie=this.__data__;return _?Ie[F]!==void 0:D.call(Ie,F)}function A(F,Ie){var Ve=this.__data__;return Ve[F]=_&&Ie===void 0?t:Ie,this}b.prototype.clear=B,b.prototype.delete=X,b.prototype.get=z,b.prototype.has=C,b.prototype.set=A;function M(F){var Ie=-1,Ve=F?F.length:0;for(this.clear();++Ie<Ve;){var H=F[Ie];this.set(H[0],H[1])}}function O(){this.__data__=[]}function K(F){var Ie=this.__data__,Ve=U(Ie,F);if(Ve<0)return!1;var H=Ie.length-1;return Ve==H?Ie.pop():V.call(Ie,Ve,1),!0}function Q(F){var Ie=this.__data__,Ve=U(Ie,F);return Ve<0?void 0:Ie[Ve][1]}function se(F){return U(this.__data__,F)>-1}function T(F,Ie){var Ve=this.__data__,H=U(Ve,F);return H<0?Ve.push([F,Ie]):Ve[H][1]=Ie,this}M.prototype.clear=O,M.prototype.delete=K,M.prototype.get=Q,M.prototype.has=se,M.prototype.set=T;function Z(F){var Ie=-1,Ve=F?F.length:0;for(this.clear();++Ie<Ve;){var H=F[Ie];this.set(H[0],H[1])}}function ie(){this.__data__={hash:new b,map:new(G||M),string:new b}}function ue(F){return ee(this,F).delete(F)}function he(F){return ee(this,F).get(F)}function Y(F){return ee(this,F).has(F)}function ge(F,Ie){return ee(this,F).set(F,Ie),this}Z.prototype.clear=ie,Z.prototype.delete=ue,Z.prototype.get=he,Z.prototype.has=Y,Z.prototype.set=ge;function oe(F){var Ie=-1,Ve=F?F.length:0;for(this.__data__=new Z;++Ie<Ve;)this.add(F[Ie])}function ce(F){return this.__data__.set(F,t),this}function N(F){return this.__data__.has(F)}oe.prototype.add=oe.prototype.push=ce,oe.prototype.has=N;function U(F,Ie){for(var Ve=F.length;Ve--;)if(De(F[Ve][0],Ie))return Ve;return-1}function ve(F,Ie,Ve){for(var H=h,Oe=F[0].length,Ee=F.length,it=Ee,Tt=Array(Ee),sn=1/0,vn=[];it--;){var ln=F[it];sn=ae(ln.length,sn),Tt[it]=Oe>=120&&ln.length>=120?new oe(it&&ln):void 0}ln=F[0];var Ut=-1,jt=Tt[0];e:for(;++Ut<Oe&&vn.length<sn;){var gn=ln[Ut],Xt=gn;if(gn=gn!==0?gn:0,!(jt?y(jt,Xt):H(vn,Xt))){for(it=Ee;--it;){var Hn=Tt[it];if(!(Hn?y(Hn,Xt):H(F[it],Xt)))continue e}jt&&jt.push(Xt),vn.push(gn)}}return vn}function J(F){if(!Se(F)||Me(F))return!1;var Ie=ke(F)||m(F)?$:a;return Ie.test(be(F))}function R(F,Ie){return Ie=q(Ie===void 0?F.length-1:Ie,0),function(){for(var Ve=arguments,H=-1,Oe=q(Ve.length-Ie,0),Ee=Array(Oe);++H<Oe;)Ee[H]=Ve[Ie+H];H=-1;for(var it=Array(Ie+1);++H<Ie;)it[H]=Ve[H];return it[Ie]=Ee,u(F,this,it)}}function le(F){return Ae(F)?F:[]}function ee(F,Ie){var Ve=F.__data__;return te(Ie)?Ve[typeof Ie=="string"?"string":"hash"]:Ve.map}function de(F,Ie){var Ve=v(F,Ie);return J(Ve)?Ve:void 0}function te(F){var Ie=typeof F;return Ie=="string"||Ie=="number"||Ie=="symbol"||Ie=="boolean"?F!=="__proto__":F===null}function Me(F){return!!P&&P in F}function be(F){if(F!=null){try{return W.call(F)}catch{}try{return F+""}catch{}}return""}var ne=R(function(F){var Ie=f(F,le);return Ie.length&&Ie[0]===F[0]?ve(Ie):[]});function De(F,Ie){return F===Ie||F!==F&&Ie!==Ie}function xe(F){return F!=null&&me(F.length)&&!ke(F)}function Ae(F){return Le(F)&&xe(F)}function ke(F){var Ie=Se(F)?x.call(F):"";return Ie==n||Ie==i}function me(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=e}function Se(F){var Ie=typeof F;return!!F&&(Ie=="object"||Ie=="function")}function Le(F){return!!F&&typeof F=="object"}return Nu=ne,Nu}var KL=XL();const Qa=rr(KL);function Ai(t,e){return e.length===0?t:t.filter(r=>e.every(a=>a.includeValues&&a.includeValues.length>0?Qa(hn([r[a.column]]),a.includeValues).length>0:!0)).filter(r=>e.every(a=>a.excludeValues&&a.excludeValues.length>0?Qa(hn([r[a.column]]),a.excludeValues).length===0:!0))}function QL(t){const{mapStyle:e,height:n,width:i,relativeHeight:r,center:a,zoomLevel:o,minHeight:s,includeLayers:c,excludeLayers:u,mapLegend:h}=t,[f,d]=k.useState(0),[g,p]=k.useState(0),[y,v]=k.useState(!0),m=k.useRef(null),I=k.useRef(null),j=k.useRef(null);return k.useEffect(()=>{const w=new ResizeObserver(S=>{d(i||S[0].target.clientWidth||620),p(n||S[0].target.clientHeight||480)});return m.current&&(p(m.current.clientHeight||480),d(m.current.clientWidth||620),i||w.observe(m.current)),()=>w.disconnect()},[i,n]),k.useEffect(()=>{I.current&&f&&!j.current&&en(e).then(w=>{bt(I.current).selectAll("div").remove();const P=new Sc.Protocol;hi.addProtocol("pmtiles",P.tile);const W={container:I.current,style:c.length===0&&u.length===0?w:{...w,layers:Ai(w.layers,[{column:"id",includeValues:c,excludeValues:u}])},attributionControl:!0};a&&(W.center=a),o&&(W.zoom=o),j.current=new hi.Map(W),j.current.addControl(new hi.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),j.current.addControl(new hi.ScaleControl,"bottom-left")})},[f,a,o,c,u,e]),k.useEffect(()=>{j.current&&en(e).then(w=>{const S={...w,layers:Ai(w.layers,[{column:"id",includeValues:c,excludeValues:u}])};j.current.setStyle(S)})},[u,c,e]),l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:m,"aria-label":"Map area",children:(i||f)&&(n||g)?l.jsxs("div",{style:{width:i||f,height:Math.max(s,n||(r?s?(i||f)*r>s?(i||f)*r:s:(i||f)*r:g))},children:[l.jsx("div",{ref:I,className:"map maplibre-show-control",style:{width:"100%",height:"100%"}}),h?l.jsx("div",{className:"absolute left-[22px] bottom-13",children:y?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{v(!1)},children:l.jsx(ea,{})}),l.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof h=="string"?{__html:lt(h)}:void 0,children:k.isValidElement(h)?h:null})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{v(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function ZL(t){const{mapStyle:e,height:n,width:i,relativeHeight:r,center:a,zoomLevel:o,minHeight:s,includeLayers:c,excludeLayers:u,mapLegend:h}=t,[f,d]=k.useState(0),[g,p]=k.useState(0),[y,v]=k.useState(!0),m=k.useRef(null),I=k.useRef(null);return k.useEffect(()=>{const j=new ResizeObserver(w=>{d(i||w[0].target.clientWidth||620),p(n||w[0].target.clientHeight||480)});return m.current&&(p(m.current.clientHeight||480),d(m.current.clientWidth||620),i||j.observe(m.current)),()=>j.disconnect()},[i,n]),k.useEffect(()=>{I.current&&f&&en(e).then(j=>{bt(I.current).selectAll("div").remove();const S=new Sc.Protocol;hi.addProtocol("pmtiles",S.tile);const P={container:I.current,style:c.length===0&&u.length===0?j:{...j,layers:Ai(j.layers,[{column:"id",includeValues:c,excludeValues:u}])},attributionControl:!0};a&&(P.center=a),o&&(P.zoom=o);const W=new hi.Map(P);W.addControl(new hi.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),W.addControl(new hi.ScaleControl,"bottom-left")})},[f,e,a,o,c,u]),l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:m,"aria-label":"Map area",children:(i||f)&&(n||g)?l.jsxs("div",{style:{width:i||f,height:Math.max(s,n||(r?s?(i||f)*r>s?(i||f)*r:s:(i||f)*r:g))},children:[l.jsx("div",{ref:I,className:"map maplibre-show-control",style:{width:"100%",height:"100%"}}),h?l.jsx("div",{className:"absolute left-[22px] bottom-13",children:y?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{v(!1)},children:l.jsx(ea,{})}),l.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof h=="string"?{__html:lt(h)}:void 0,children:k.isValidElement(h)?h:null})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{v(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function Gv(t){const{mapStyle:e,graphTitle:n,height:i,width:r,relativeHeight:a,sources:o,graphDescription:s,footNote:c,padding:u,backgroundColor:h=!1,center:f,zoomLevel:d,graphID:g,language:p="en",minHeight:y=0,theme:v="light",includeLayers:m=[],excludeLayers:I=[],ariaLabel:j,uiMode:w="normal",styles:S,classNames:P,mapLegend:W}=t,[D,x]=k.useState(typeof e=="string"?e:e[0].style);k.useEffect(()=>{x(typeof e=="string"?e:e[0].style)},[e]);const $=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]);return l.jsx("div",{className:`${v||"light"} flex ${r?"w-fit grow-0":"w-full grow"}`,dir:p==="he"||p==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${p||"en"}`,P?.graphContainer),style:{...S?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:g,"aria-label":j||`${n?`The graph shows ${n}. `:""}This is a map.${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||s?l.jsx(Qe,{styles:{title:S?.title,description:S?.description},classNames:{title:P?.title,description:P?.description},graphTitle:n,graphDescription:s,width:r}):null,typeof e=="string"?null:l.jsx(Ce.DropdownSelect,{options:e.map(V=>({label:V.name,value:V.style})),isClearable:!1,size:"sm",variant:w,isRtl:p==="he"||p==="ar",isSearchable:!0,filterOption:Ce.createFilter($),defaultValue:{label:e[0].name,value:e[0].style},controlShouldRenderValue:!0,onChange:V=>{V&&x(V.value)}}),typeof e=="string"?l.jsx(ZL,{mapStyle:e,center:f,zoomLevel:d,width:r,height:i,relativeHeight:a,minHeight:y,includeLayers:m,excludeLayers:I,mapLegend:W}):l.jsx(QL,{mapStyle:D,center:f,zoomLevel:d,width:r,height:i,relativeHeight:a,minHeight:y,includeLayers:m,excludeLayers:I,mapLegend:(W||[]).find(V=>V.mapStyleName===e.find(q=>q.style===D)?.name)?.legend}),o||c?l.jsx(et,{styles:{footnote:S?.footnote,source:S?.source},classNames:{footnote:P?.footnote,source:P?.source},sources:o,footNote:c,width:r}):null]})})})})}function JL(t,e){let n=!1;function i(r,a){if(!n){n=!0;const o=r.getCenter(),s=r.getZoom(),c=r.getBearing(),u=r.getPitch();a.jumpTo({center:o,zoom:s,bearing:c,pitch:u}),n=!1}}t.on("move",()=>{i(t,e)}),e.on("move",()=>{i(e,t)})}function eP(t){const{height:e,width:n,mapStyles:i,center:r,zoomLevel:a,mapLegend:o}=t,[s,c]=k.useState(50),[u,h]=k.useState(!1),f=k.useRef(null),[d,g]=k.useState(!0),p=k.useRef(50),y=k.useRef(0),v=ps.useSensors(ps.useSensor(ps.PointerSensor,{activationConstraint:{distance:0}})),m=()=>{h(!0),p.current=s,f.current&&(y.current=f.current.getBoundingClientRect().width)},I=x=>{if(!f.current||y.current===0)return;const $=x.delta.x/y.current*100,V=Math.max(0,Math.min(100,p.current+$));c(V)},j=()=>{h(!1)},w=x=>{if(u||!f.current)return;const $=f.current.getBoundingClientRect(),q=(x.clientX-$.left)/$.width*100;c(Math.max(0,Math.min(100,q)))},S=k.useRef(null),P=k.useRef(null),W=k.useRef(null),D=k.useRef(null);return k.useEffect(()=>{if(D.current&&P.current&&W.current&&n){bt(D.current).selectAll(".maplibregl-compare").remove(),bt(P.current).selectAll("div").remove(),bt(W.current).selectAll("div").remove();const q=new Sc.Protocol;Oa.addProtocol("pmtiles",q.tile);const ae=new Oa.Map({container:P.current,style:i[0],center:r||[0,0],zoom:a||4}),G=new Oa.Map({container:W.current,style:i[1],center:r||[0,0],zoom:a||4});G.addControl(new Oa.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),ae.addControl(new Oa.ScaleControl,"bottom-left"),ae.addControl(new Oa.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),G.addControl(new Oa.ScaleControl,"bottom-left"),JL(ae,G)}},[n,i,r,a]),l.jsxs("div",{className:"flex flex-col grow justify-center leading-0",ref:S,"aria-label":"Map area",children:[l.jsx("div",{style:{width:n,height:e},children:l.jsx("div",{ref:D,className:"map maplibre-show-control relative w-full h-full",style:{inset:0},children:l.jsx(ps.DndContext,{sensors:v,modifiers:[Bw.restrictToHorizontalAxis],onDragStart:m,onDragMove:I,onDragEnd:j,children:l.jsxs("div",{ref:f,style:{position:"relative",width:n,height:e,overflow:"hidden",cursor:u?"grabbing":"col-resize",userSelect:"none"},onClick:w,children:[l.jsx("div",{ref:W,className:"absolute h-full rightMap w-full",style:{position:"absolute",top:0,left:0,clipPath:`polygon(${s}% 0%, ${s}% 100%, 100% 100%, 100% 0%)`}}),l.jsx("div",{ref:P,className:"absolute h-full leftMap w-full",style:{position:"absolute",top:0,left:0,inset:0,clipPath:`polygon(0% 0%, ${s}% 0%, ${s}% 100%, 0% 100%)`}}),l.jsx(tP,{position:s})]})})})}),o?l.jsx("div",{className:"absolute left-[22px] bottom-13",children:d?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{g(!1)},children:l.jsx(ea,{})}),l.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof o=="string"?{__html:lt(o)}:void 0,children:k.isValidElement(o)?o:null})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{g(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]})}function tP(t){const{position:e}=t,{attributes:n,listeners:i,setNodeRef:r}=ps.useDraggable({id:"slider-handle"});return l.jsxs("div",{ref:r,style:{position:"absolute",left:`${e}%`,top:0,bottom:0,width:"40px",transform:"translateX(-50%)",cursor:"col-resize",display:"flex",justifyContent:"center",alignItems:"center",zIndex:10,touchAction:"none"},...i,...n,children:[l.jsx("div",{className:"h-full bg-primary-blue-600 dark:bg-primary-blue-400",style:{width:"2px"}}),l.jsx("div",{className:"flex bg-primary-blue-600 dark:bg-primary-blue-400 rounded-full absolute items-center justify-center text-primary-white font-primary-white",style:{boxShadow:"inset 0 0 0 1px #fff",width:"42px",height:"42px",top:"calc(50% - 21px)",left:"0",cursor:"col-resize"},children:l.jsx(t2,{})})]})}function Yv(t){const{graphTitle:e,height:n,width:i,relativeHeight:r,sources:a,graphDescription:o,footNote:s,padding:c,backgroundColor:u=!1,graphID:h,mapStyles:f,center:d=[0,0],zoomLevel:g=3,language:p="en",minHeight:y=0,theme:v="light",ariaLabel:m,styles:I,classNames:j,mapLegend:w}=t,[S,P]=k.useState(0),[W,D]=k.useState(0),x=k.useRef(null);return k.useEffect(()=>{const $=new ResizeObserver(V=>{P(i||V[0].target.clientWidth||620),D(n||V[0].target.clientHeight||480)});return x.current&&(D(x.current.clientHeight||480),P(x.current.clientWidth||620),i||$.observe(x.current)),()=>$.disconnect()},[i,n]),l.jsx("div",{className:`${v||"light"} flex ${i?"w-fit grow-0":"w-full grow"}`,dir:p==="he"||p==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${u?u===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${p||"en"}`,j?.graphContainer),style:{...I?.graphContainer||{},...u&&u!==!0?{backgroundColor:u}:{}},id:h,"aria-label":m||`${e?`The graph shows ${e}. `:""}This is a comparison between two maps.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:u?c||"1rem":c||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[e||o?l.jsx(Qe,{styles:{title:I?.title,description:I?.description},classNames:{title:j?.title,description:j?.description},graphTitle:e,graphDescription:o,width:i}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:x,"aria-label":"map area",children:(i||S)&&(n||W)?l.jsx(eP,{width:i||S,height:Math.max(y,n||(r?y?(i||S)*r>y?(i||S)*r:y:(i||S)*r:W)),mapStyles:f,center:d,zoomLevel:g,mapLegend:w}):null}),a||s?l.jsx(et,{styles:{footnote:I?.footnote,source:I?.source},classNames:{footnote:j?.footnote,source:j?.source},sources:a,footNote:s,width:i}):null]})})})})}function nP(t){const{mapStyle:e,height:n,width:i,relativeHeight:r,center:a,zoomLevel:o,minHeight:s,selectedLayer:c,layerIdList:u,excludeLayers:h,mapLegend:f}=t,[d,g]=k.useState(0),[p,y]=k.useState(0),[v,m]=k.useState(!0),[I,j]=k.useState(void 0),w=k.useRef(null),S=k.useRef(null),P=k.useRef(null);return k.useEffect(()=>{const W=new ResizeObserver(D=>{g(i||D[0].target.clientWidth||620),y(n||D[0].target.clientHeight||480)});return w.current&&(y(w.current.clientHeight||480),g(w.current.clientWidth||620),i||W.observe(w.current)),()=>W.disconnect()},[i,n]),k.useEffect(()=>{S.current&&d&&!P.current&&en(e).then(W=>{j(W),bt(S.current).selectAll("div").remove();const x=new Sc.Protocol;hi.addProtocol("pmtiles",x.tile);const $={container:S.current,style:{...W,layers:Ai(W.layers,[{column:"id",excludeValues:[...h,...u.filter(V=>c.indexOf(V)===-1)]}])},attributionControl:!0};a&&($.center=a),o&&($.zoom=o),P.current=new hi.Map($),P.current.addControl(new hi.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),P.current.addControl(new hi.ScaleControl,"bottom-left")})},[d,a,o,u,e,h,c]),k.useEffect(()=>{if(P.current)if(I){const W={...I,layers:Ai(I.layers,[{column:"id",excludeValues:[...h,...u.filter(D=>c.indexOf(D)===-1)]}])};P.current.setStyle(W)}else en(e).then(W=>{const D={...W,layers:Ai(W.layers,[{column:"id",excludeValues:[...h,...u.filter(x=>c.indexOf(x)===-1)]}])};P.current.setStyle(D)})},[h,u,e,I,c]),l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:w,"aria-label":"Map area",children:(i||d)&&(n||p)?l.jsxs("div",{style:{width:i||d,height:Math.max(s,n||(r?s?(i||d)*r>s?(i||d)*r:s:(i||d)*r:p))},children:[l.jsx("div",{ref:S,className:"map maplibre-show-control w-full h-full"}),f?l.jsx("div",{className:"absolute left-[22px] bottom-13",children:v?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{m(!1)},children:l.jsx(ea,{})}),l.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof f=="string"?{__html:lt(f)}:void 0,children:k.isValidElement(f)?f:null})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{m(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function qv(t){const{mapStyle:e,graphTitle:n,height:i,width:r,relativeHeight:a,sources:o,graphDescription:s,footNote:c,padding:u,backgroundColor:h=!1,center:f,zoomLevel:d,graphID:g,language:p="en",minHeight:y=0,theme:v="light",layerSelection:m,excludeLayers:I=[],ariaLabel:j,uiMode:w="normal",styles:S,classNames:P,mapLegend:W=[]}=t,[D,x]=k.useState(m[0].layerID);k.useEffect(()=>{x(m[0].layerID)},[m]);const $=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]);return l.jsx("div",{className:`${v||"light"} flex ${r?"w-fit grow-0":"w-full grow"}`,dir:p==="he"||p==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${p||"en"}`,P?.graphContainer),style:{...S?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:g,"aria-label":j||`${n?`The graph shows ${n}. `:""}This is a map.${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||s?l.jsx(Qe,{styles:{title:S?.title,description:S?.description},classNames:{title:P?.title,description:P?.description},graphTitle:n,graphDescription:s,width:r}):null,l.jsx(Ce.DropdownSelect,{options:m.map(V=>({label:V.name,value:V.layerID})),size:"sm",isClearable:!1,variant:w,isRtl:p==="he"||p==="ar",isSearchable:!0,filterOption:Ce.createFilter($),defaultValue:{label:m[0].name,value:m[0].layerID},controlShouldRenderValue:!0,onChange:V=>{V&&x(V.value)}}),l.jsx(nP,{mapStyle:e,center:f,zoomLevel:d,width:r,height:i,relativeHeight:a,minHeight:y,selectedLayer:D,layerIdList:hn(m.map(V=>V.layerID)),excludeLayers:I,mapLegend:W.find(V=>V.mapStyleName===m.find(q=>q.layerID===D)?.name)?.legend}),o||c?l.jsx(et,{styles:{footnote:S?.footnote,source:S?.source},classNames:{footnote:P?.footnote,source:P?.source},sources:o,footNote:c,width:r}):null]})})})})}function iP(t){const{data:e,width:n,height:i,showLabels:r,colors:a,colorDomain:o,radius:s,xAxisTitle:c,yAxisTitle:u,leftMargin:h,rightMargin:f,topMargin:d,bottomMargin:g,tooltip:p,onSeriesMouseOver:y,refXValues:v,refYValues:m,highlightAreaSettings:I,selectedColor:j,highlightedDataPoints:w,maxRadiusValue:S,maxXValue:P,minXValue:W,maxYValue:D,minYValue:x,onSeriesMouseClick:$,rtl:V,annotations:q,customHighlightAreaSettings:ae,regressionLine:G,resetSelectionOnDoubleClick:_,detailsOnClick:b,noOfXTicks:B,noOfYTicks:X,labelColor:z,xSuffix:C,ySuffix:A,xPrefix:M,yPrefix:O,styles:K,classNames:Q,animate:se,dimmedOpacity:T,precision:Z,customLayers:ie}=t,ue=k.useRef(null),he=ct(ue,{once:se.once,amount:se.amount}),[Y,ge]=k.useState(void 0),[oe,ce]=k.useState(void 0),[N,U]=k.useState(void 0),[ve,J]=k.useState(void 0),R={top:d,bottom:c?g+50:g,left:u?h+30:h,right:f},le=e.map((Se,Le)=>({...Se,id:`${Le}`})),ee=n-R.left-R.right,de=i-R.top-R.bottom,te=e.filter(Se=>Se.radius===void 0||Se.radius===null).length!==e.length?Qs().domain([0,S]).range([.25,s]).nice():void 0,Me=le.filter(Se=>!je(Se.radius)).length===0?le:Nc(le.filter(Se=>!je(Se.radius)),"radius","desc"),be=ut().domain([W,P]).range([0,ee]).nice(),ne=ut().domain([x,D]).range([de,0]).nice(),De=be.ticks(B),xe=ne.ticks(X),Ae=Lc.from(Me.filter(Se=>!je(Se.x)&&!je(Se.y)),Se=>be(Se.x),Se=>ne(Se.y)).voronoi([0,0,ee<0?0:ee,de<0?0:de]),ke=sd(e.filter(Se=>!je(Se.x)&&!je(Se.y)).map(Se=>[be(Se.x),ne(Se.y)])),me=ld(ke);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:ue,children:l.jsxs("g",{transform:`translate(${R.left},${R.top})`,children:[l.jsxs(mt,{children:[l.jsx(iI,{areaSettings:I,width:ee,height:de,scaleX:be,scaleY:ne,animate:se,isInView:he}),l.jsx(lo,{areaSettings:ae,scaleX:be,scaleY:ne,animate:se,isInView:he})]}),l.jsxs("g",{children:[l.jsx(ri,{values:xe.filter(Se=>Se!==0),y:xe.filter(Se=>Se!==0).map(Se=>ne(Se)),x1:0,x2:ee+R.right,styles:{gridLines:K?.yAxis?.gridLines,labels:K?.yAxis?.labels},classNames:{gridLines:Q?.yAxis?.gridLines,labels:Q?.yAxis?.labels},suffix:A,prefix:O,labelType:"secondary",showGridLines:!0,labelPos:"side",precision:Z}),l.jsx(Dt,{y1:ne(x<0?0:x),y2:ne(x<0?0:x),x1:0,x2:ee+R.right,label:qe(x<0?0:x,"NA",Z,O,A),labelPos:{x:0,y:ne(x<0?0:x),dy:"0.33em",dx:-4},classNames:{axis:Q?.xAxis?.axis,label:Q?.yAxis?.labels},styles:{axis:K?.xAxis?.axis,label:{textAnchor:"end",...K?.yAxis?.labels||{}}}}),l.jsx(Nt,{x:0-h-15,y:de/2,style:K?.yAxis?.title,className:Q?.yAxis?.title,text:u,rotate90:!0})]}),l.jsxs("g",{children:[l.jsx(Rn,{values:De.filter(Se=>Se!==0),x:De.filter(Se=>Se!==0).map(Se=>be(Se)),y1:0,y2:de,styles:{gridLines:K?.xAxis?.gridLines,labels:K?.xAxis?.labels},classNames:{gridLines:Q?.xAxis?.gridLines,labels:Q?.xAxis?.labels},suffix:C,prefix:M,labelType:"primary",showGridLines:!0,precision:Z}),l.jsx(Dt,{x1:be(W<0?0:W),x2:be(W<0?0:W),y1:0,y2:de,label:qe(W<0?0:W,"NA",Z,M,C),labelPos:{x:be(W<0?0:W),y:de,dy:"1em",dx:0},classNames:{axis:Q?.xAxis?.axis,label:Q?.yAxis?.labels},styles:{axis:K?.xAxis?.axis,label:{textAnchor:"middle",...K?.yAxis?.labels||{}}}}),l.jsx(Nt,{x:ee/2,y:de+30,style:K?.xAxis?.title,className:Q?.xAxis?.title,text:c})]}),ie.filter(Se=>Se.position==="before").map(Se=>Se.layer),l.jsxs(mt,{children:[Me.filter(Se=>!je(Se.x)&&!je(Se.y)).map((Se,Le)=>l.jsx("path",{d:Ae.renderCell(Me.findIndex(F=>F.id===Se.id)),opacity:0,onMouseEnter:F=>{ge(Se),J(F.clientY),U(F.clientX),y?.(Se)},onMouseMove:F=>{ge(Se),J(F.clientY),U(F.clientX)},onMouseLeave:()=>{ge(void 0),U(void 0),J(void 0),y?.(void 0)},onClick:()=>{($||b)&&(dt(oe,Se)&&_?(ce(void 0),$?.(void 0)):(ce(Se),$?.(Se)))}},`${Se.label||Le}`)),Me.filter(Se=>!je(Se.x)&&!je(Se.y)).map((Se,Le)=>l.jsxs($e.g,{variants:{initial:{x:be(Se.x),y:ne(Se.y),opacity:j?Se.color&&a[o.indexOf(`${Se.color}`)]===j?1:T:Y?Y.id===Se.id?1:T:w.length!==0?w.indexOf(Se.label||"")!==-1?1:T:1},whileInView:{x:be(Se.x),y:ne(Se.y),opacity:j?Se.color&&a[o.indexOf(`${Se.color}`)]===j?1:T:Y?Y.id===Se.id?1:T:w.length!==0?w.indexOf(Se.label||"")!==-1?1:T:1,transition:{duration:se.duration}}},initial:"initial",animate:he?"whileInView":"initial",exit:{opacity:0,transition:{duration:se.duration}},onMouseEnter:F=>{ge(Se),J(F.clientY),U(F.clientX),y?.(Se)},onMouseMove:F=>{ge(Se),J(F.clientY),U(F.clientX)},onMouseLeave:()=>{ge(void 0),U(void 0),J(void 0),y?.(void 0)},onClick:()=>{($||b)&&(dt(oe,Se)&&_?(ce(void 0),$?.(void 0)):(ce(Se),$?.(Se)))},children:[l.jsx($e.circle,{cx:0,cy:0,exit:{r:0,transition:{duration:se.duration}},variants:{initial:{r:0,fill:e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray,stroke:e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray},whileInView:{r:te?te(Se.radius||0):s,fill:e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray,stroke:e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray,transition:{duration:se.duration}}},initial:"initial",animate:he?"whileInView":"initial",style:{fillOpacity:.6}}),r&&!je(Se.label)?l.jsx($e.text,{style:{...K?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",Q?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:se.duration}},variants:{initial:{x:te?te(Se.radius||0):s,opacity:0,fill:z||(e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray)},whileInView:{x:te?te(Se.radius||0):s,opacity:1,fill:z||(e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray),transition:{duration:se.duration}}},initial:"initial",animate:he?"whileInView":"initial",dy:"0.33em",dx:3,children:Se.label}):w.length!==0&&!je(Se.label)&&w.indexOf(Se.label)!==-1?l.jsx($e.text,{style:{fill:z||(e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray),...K?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",Q?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:se.duration}},variants:{initial:{x:te?te(Se.radius||0):s,opacity:0},whileInView:{x:te?te(Se.radius||0):s,opacity:1,transition:{duration:se.duration}}},initial:"initial",animate:he?"whileInView":"initial",dy:"0.33em",dx:3,children:Se.label}):null]},`${Se.label||Le}`)),v.map((Se,Le)=>l.jsx(Tr,{text:Se.text,color:Se.color,x:be(Se.value),y1:0,y2:de,textSide:be(Se.value)>ee*.75||V?"left":"right",classNames:Se.classNames,styles:Se.styles,animate:se,isInView:he},Le)),m.map((Se,Le)=>l.jsx(gi,{text:Se.text,color:Se.color,y:ne(Se.value),x1:0,x2:ee,classNames:Se.classNames,styles:Se.styles,animate:se,isInView:he},Le)),l.jsx("g",{children:q.map((Se,Le)=>{const F=oo({x:Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0),y:Se.yCoordinate?ne(Se.yCoordinate)+(Se.yOffset||0)-8:0+(Se.yOffset||0)-8},{x:Se.xCoordinate?be(Se.xCoordinate):0,y:Se.yCoordinate?ne(Se.yCoordinate):0},je(Se.connectorRadius)?3.5:Se.connectorRadius),Ie=Se.showConnector?{y1:F.y,x1:F.x,y2:Se.yCoordinate?ne(Se.yCoordinate)+(Se.yOffset||0):0+(Se.yOffset||0),x2:Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0),cy:Se.yCoordinate?ne(Se.yCoordinate):0,cx:Se.xCoordinate?be(Se.xCoordinate):0,circleRadius:je(Se.connectorRadius)?3.5:Se.connectorRadius,strokeWidth:Se.showConnector===!0?2:Math.min(Se.showConnector||0,1)}:void 0,Ve={y:Se.yCoordinate?ne(Se.yCoordinate)+(Se.yOffset||0)-8:0+(Se.yOffset||0)-8,x:V?0:Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0),width:V?Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0):ee-(Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0)),maxWidth:Se.maxWidth,fontWeight:Se.fontWeight,align:Se.align};return l.jsx(so,{color:Se.color,connectorsSettings:Ie,labelSettings:Ve,text:Se.text,classNames:Se.classNames,styles:Se.styles,animate:se,isInView:he},Le)})}),G?l.jsx(cd,{x1:0,x2:ee,y1:me(0),y2:me(ee),graphHeight:de,graphWidth:ee,className:Q?.regLine,style:K?.regLine,color:typeof G=="string"?G:void 0,animate:se,isInView:he}):null]}),ie.filter(Se=>Se.position==="after").map(Se=>Se.layer)]})}),Y&&p&&N&&ve?l.jsx(st,{data:Y,body:p,xPos:N,yPos:ve,backgroundStyle:K?.tooltip,className:Q?.tooltip}):null,b&&oe!==void 0?l.jsx(Ce.Modal,{open:oe!==void 0,onClose:()=>{ce(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof b=="string"?{__html:lt(b,oe)}:void 0,children:typeof b=="function"?b(oe):null})}):null]})}function Uv(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,showLabels:o=!1,height:s,width:c,footNote:u,colorDomain:h,colorLegendTitle:f,radius:d=5,xAxisTitle:g="X Axis",yAxisTitle:p="Y Axis",padding:y,backgroundColor:v=!1,leftMargin:m=0,rightMargin:I=10,topMargin:j=20,bottomMargin:w=50,tooltip:S,relativeHeight:P,onSeriesMouseOver:W,refXValues:D=[],refYValues:x=[],highlightAreaSettings:$=[],showColorScale:V=!0,highlightedDataPoints:q=[],graphID:ae,maxRadiusValue:G,maxXValue:_,minXValue:b,maxYValue:B,minYValue:X,xSuffix:z="",ySuffix:C="",xPrefix:A="",yPrefix:M="",onSeriesMouseClick:O,graphDownload:K=!1,dataDownload:Q=!1,language:se="en",showNAColor:T=!0,minHeight:Z=0,annotations:ie=[],customHighlightAreaSettings:ue=[],theme:he="light",regressionLine:Y=!1,ariaLabel:ge,resetSelectionOnDoubleClick:oe=!0,detailsOnClick:ce,noOfXTicks:N=5,noOfYTicks:U=5,labelColor:ve,styles:J,classNames:R,animate:le=!1,dimmedOpacity:ee=.3,precision:de=2,customLayers:te=[],timeline:Me={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=t,[be,ne]=k.useState(0),[De,xe]=k.useState(0),[Ae,ke]=k.useState(Me.autoplay),me=di(Xe(e.filter(Ee=>Ee.date!==void 0&&Ee.date!==null),Ee=>Ee.date).map(Ee=>ze(`${Ee.date}`,Me.dateFormat||"yyyy",new Date).getTime()),(Ee,it)=>an(Ee,it)),[Se,Le]=k.useState(Me.autoplay?0:me.length-1),[F,Ie]=k.useState(void 0),Ve=k.useRef(null),H=k.useRef(null);k.useEffect(()=>{const Ee=new ResizeObserver(it=>{ne(c||it[0].target.clientWidth||620),xe(s||it[0].target.clientHeight||480)});return Ve.current&&(xe(Ve.current.clientHeight||480),ne(Ve.current.clientWidth||620),c||Ee.observe(Ve.current)),()=>Ee.disconnect()},[c,s]),k.useEffect(()=>{const Ee=setInterval(()=>{Le(it=>it<me.length-1?it+1:0)},(Me.speed||2)*1e3);return Ae||clearInterval(Ee),()=>clearInterval(Ee)},[me,Ae,Me.speed]);const Oe=yi(me,Se,Me.showOnlyActiveDate,Me.dateFormat||"yyyy");return l.jsx("div",{className:`${he||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:se==="he"||se==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${se||"en"}`,R?.graphContainer),style:{...J?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:ae,ref:H,"aria-label":ge||`${n?`The graph shows ${n}. `:""}This is a scatter plot that shows correlation between two variables.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:v?y||"1rem":y||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||K||Q?l.jsx(Qe,{styles:{title:J?.title,description:J?.description},classNames:{title:R?.title,description:R?.description},graphTitle:n,graphDescription:a,width:c,graphDownload:K?H.current:void 0,dataDownload:Q?e.map(Ee=>Ee.data).filter(Ee=>Ee!==void 0).length>0?e.map(Ee=>Ee.data).filter(Ee=>Ee!==void 0):e.filter(Ee=>Ee!==void 0):null}):null,Me.enabled&&me.length>0&&Oe?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{ke(!Ae)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":Ae?"Click to pause animation":"Click to play animation",children:Ae?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:me[0],max:me[me.length-1],marks:Oe,step:null,defaultValue:me[me.length-1],value:me[Se],onChangeComplete:Ee=>{Le(me.indexOf(Ee))},onChange:Ee=>{Le(me.indexOf(Ee))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[V&&e.filter(Ee=>Ee.color).length!==0?l.jsx(tn,{width:c,colorLegendTitle:f,colors:i||Pe[he].categoricalColors.colors,colorDomain:h||Xe(e.filter(Ee=>Ee.color),"color").map(Ee=>Ee.color),setSelectedColor:Ie,showNAColor:T}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:Ve,"aria-label":"Graph area",children:(c||be)&&(s||De)?l.jsx(iP,{data:Z2(e,Me.dateFormat||"yyyy").filter(Ee=>Me.enabled?Ee.date===ft(new Date(me[Se]),Me.dateFormat||"yyyy"):Ee),width:c||be,height:Math.max(Z,s||(P?Z?(c||be)*P>Z?(c||be)*P:Z:(c||be)*P:De)),colorDomain:e.filter(Ee=>Ee.color).length===0?[]:h||Xe(e.filter(Ee=>Ee.color),"color").map(Ee=>Ee.color),colors:e.filter(Ee=>Ee.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[he].categoricalColors.colors,xAxisTitle:g,yAxisTitle:p,refXValues:D,refYValues:x,showLabels:o,radius:d,leftMargin:m,rightMargin:I,topMargin:j,bottomMargin:w,tooltip:S,onSeriesMouseOver:W,highlightAreaSettings:$,highlightedDataPoints:e.filter(Ee=>Ee.label).length===0?[]:q,selectedColor:F,maxRadiusValue:je(G)?Math.max(...e.map(Ee=>Ee.radius).filter(Ee=>Ee!=null)):G,maxXValue:je(_)?Math.max(...e.map(Ee=>Ee.x).filter(Ee=>Ee!=null))>0?Math.max(...e.map(Ee=>Ee.x).filter(Ee=>Ee!=null)):0:_,minXValue:je(b)?Math.min(...e.map(Ee=>Ee.x).filter(Ee=>Ee!=null))>0?0:Math.min(...e.map(Ee=>Ee.x).filter(Ee=>Ee!=null)):b,maxYValue:je(B)?Math.max(...e.map(Ee=>Ee.y).filter(Ee=>Ee!=null))>0?Math.max(...e.map(Ee=>Ee.y).filter(Ee=>Ee!=null)):0:B,minYValue:je(X)?Math.min(...e.map(Ee=>Ee.y).filter(Ee=>Ee!=null))>0?0:Math.min(...e.map(Ee=>Ee.y).filter(Ee=>Ee!=null)):X,onSeriesMouseClick:O,rtl:se==="he"||se==="ar",annotations:ie,customHighlightAreaSettings:ue,regressionLine:Y,resetSelectionOnDoubleClick:oe,detailsOnClick:ce,noOfXTicks:N,noOfYTicks:U,labelColor:ve,xSuffix:z,ySuffix:C,xPrefix:A,yPrefix:M,styles:J,classNames:R,animate:le===!0?{duration:.5,once:!0,amount:.5}:le||{duration:0,once:!0,amount:0},dimmedOpacity:ee,precision:de,customLayers:te}):null})]})}),r||u?l.jsx(et,{styles:{footnote:J?.footnote,source:J?.source},classNames:{footnote:R?.footnote,source:R?.source},sources:r,footNote:u,width:c}):null]})})})})}function rP(t){const{data:e,width:n,height:i,showLabels:r,colors:a,colorDomain:o,radius:s,leftMargin:c,rightMargin:u,topMargin:h,bottomMargin:f,tooltip:d,onSeriesMouseOver:g,axisTitles:p,highlightedDataPoints:y,selectedColor:v,minValue:m,maxValue:I,onSeriesMouseClick:j,resetSelectionOnDoubleClick:w,detailsOnClick:S,styles:P,classNames:W,animate:D,dimmedOpacity:x,customLayers:$}=t,V=k.useRef(null),q=ct(V,{once:D.once,amount:D.amount}),[ae,G]=k.useState(void 0),[_,b]=k.useState(void 0),[B,X]=k.useState(void 0),[z,C]=k.useState(void 0),A={top:h,bottom:f,left:c,right:u},M=n-A.left-A.right,O=i-A.top-A.bottom,K=Math.min(Math.min(...e.map(T=>T.y1)),Math.min(...e.map(T=>T.y2))),Q=Math.max(Math.max(...e.map(T=>T.y1)),Math.max(...e.map(T=>T.y2))),se=ut().domain([je(m)?K>0?0:K:m,je(I)?Q>0?Q:0:I]).range([O,0]).nice();return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,className:"mx-auto",direction:"ltr",ref:V,children:l.jsxs("g",{transform:`translate(${A.left},${A.top})`,children:[l.jsxs("g",{children:[l.jsx(Dt,{y1:0,y2:O,x1:s,x2:s,classNames:{axis:Ce.cn("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",W?.yAxis?.axis)}}),l.jsx(Nt,{x:s,y:O+15,style:P?.yAxis?.title,className:Ce.cn("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",W?.yAxis?.title),text:p[0]})]}),l.jsxs("g",{children:[l.jsx(Dt,{y1:0,y2:O,x1:M-s,x2:M-s,classNames:{axis:Ce.cn("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",W?.yAxis?.axis)}}),l.jsx(Nt,{x:M-s,y:O+15,style:P?.yAxis?.title,className:Ce.cn("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",W?.yAxis?.title),text:p[1]})]}),$.filter(T=>T.position==="before").map(T=>T.layer),l.jsx(mt,{children:e.map((T,Z)=>l.jsxs($e.g,{variants:{initial:{opacity:v?T.color&&a[o.indexOf(`${T.color}`)]===v?1:x:ae?ae.label===T.label?1:x:y.length!==0?y.indexOf(T.label)!==-1?1:x:1},whileInView:{opacity:v?T.color&&a[o.indexOf(`${T.color}`)]===v?1:x:ae?ae.label===T.label?1:x:y.length!==0?y.indexOf(T.label)!==-1?1:x:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},onMouseEnter:ie=>{G(T),C(ie.clientY),X(ie.clientX),g?.(T)},onMouseMove:ie=>{G(T),C(ie.clientY),X(ie.clientX)},onMouseLeave:()=>{G(void 0),X(void 0),C(void 0),g?.(void 0)},onClick:()=>{(j||S)&&(dt(_,T)&&w?(b(void 0),j?.(void 0)):(b(T),j?.(T)))},children:[l.jsx($e.circle,{cx:s,variants:{initial:{cy:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{cy:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},r:s,style:{fillOpacity:.6}}),r?l.jsx($e.text,{variants:{initial:{y:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{y:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},style:{textAnchor:"end",...P?.yAxis?.labels||{}},className:Ce.cn("text-xs",W?.yAxis?.labels),x:5,dy:"0.33em",textAnchor:"end",dx:0-s-3,children:T.label}):y.length!==0&&y.indexOf(T.label)!==-1?l.jsx($e.text,{variants:{initial:{y:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{y:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},style:{textAnchor:"end",...P?.yAxis?.labels||{}},className:Ce.cn("text-xs",W?.yAxis?.labels),x:5,dy:"0.33em",dx:-3,children:T.label}):null,l.jsx($e.circle,{cx:M-s,variants:{initial:{cy:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{cy:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},r:s,style:{fillOpacity:.6}}),r?l.jsx($e.text,{variants:{initial:{y:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{y:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},style:{textAnchor:"start",...P?.yAxis?.labels||{}},className:Ce.cn("text-xs",W?.yAxis?.labels),x:M-5,dy:"0.33em",dx:s+3,children:T.label}):y.length!==0&&y.indexOf(T.label)!==-1?l.jsx($e.text,{variants:{initial:{y:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{y:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},style:{textAnchor:"start",...P?.yAxis?.labels||{}},className:Ce.cn("text-xs",W?.yAxis?.labels),x:M-5,dy:"0.33em",dx:3,children:T.label}):null,l.jsx($e.line,{x1:s,x2:M-s,variants:{initial:{y1:se(T.y1),y2:se(T.y1),stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray},whileInView:{y1:se(T.y1),y2:se(T.y2),stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},className:W?.dataConnectors,style:{fill:"none",strokeWidth:1,...P?.dataConnectors}})]},Z))}),$.filter(T=>T.position==="after").map(T=>T.layer)]})}),ae&&d&&B&&z?l.jsx(st,{data:ae,body:d,xPos:B,yPos:z,backgroundStyle:P?.tooltip,className:W?.tooltip}):null,S&&_!==void 0?l.jsx(Ce.Modal,{open:_!==void 0,onClose:()=>{b(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof S=="string"?{__html:lt(S,_)}:void 0,children:typeof S=="function"?S(_):null})}):null]})}function Xv(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,showLabels:o=!1,height:s,width:c,footNote:u,colorDomain:h,colorLegendTitle:f,radius:d=5,axisTitles:g=["",""],padding:p,backgroundColor:y=!1,leftMargin:v=50,rightMargin:m=50,topMargin:I=20,bottomMargin:j=20,tooltip:w,relativeHeight:S,onSeriesMouseOver:P,showColorScale:W=!0,highlightedDataPoints:D=[],graphID:x,minValue:$,maxValue:V,onSeriesMouseClick:q,graphDownload:ae=!1,dataDownload:G=!1,fillContainer:_=!0,language:b="en",showNAColor:B=!0,minHeight:X=0,theme:z="light",ariaLabel:C,resetSelectionOnDoubleClick:A=!0,detailsOnClick:M,styles:O,classNames:K,animate:Q=!1,dimmedOpacity:se=.3,customLayers:T=[]}=t,[Z,ie]=k.useState(0),[ue,he]=k.useState(0),[Y,ge]=k.useState(void 0),oe=k.useRef(null),ce=k.useRef(null);return k.useEffect(()=>{const N=new ResizeObserver(U=>{ie(c||U[0].target.clientWidth||620),he(s||U[0].target.clientHeight||480)});return oe.current&&(he(oe.current.clientHeight||480),ie(oe.current.clientWidth||620),c||N.observe(oe.current)),()=>N.disconnect()},[c,s]),l.jsx("div",{className:`${z||"light"} flex ${c?"grow-0":"grow"} ${_?"w-full":"w-fit"} `,dir:b==="he"||b==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${y?y===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${b||"en"}`,K?.graphContainer),style:{...O?.graphContainer||{},...y&&y!==!0?{backgroundColor:y}:{}},id:x,ref:ce,"aria-label":C||`${n?`The graph shows ${n}. `:""}This is a slope chart showing changes in data between two category or starting and ending time. Each line represents a different row in data, with lines sloping up or down to show increase or decrease over two categories or time.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:y?p||"1rem":p||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||ae||G?l.jsx(Qe,{styles:{title:O?.title,description:O?.description},classNames:{title:K?.title,description:K?.description},graphTitle:n,graphDescription:a,width:c,graphDownload:ae?ce.current:void 0,dataDownload:G?e.map(N=>N.data).filter(N=>N!==void 0).length>0?e.map(N=>N.data).filter(N=>N!==void 0):e.filter(N=>N!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[W&&e.filter(N=>N.color).length!==0?l.jsx(tn,{width:c,colorLegendTitle:f,colors:i||Pe[z].categoricalColors.colors,colorDomain:h||Xe(e.filter(N=>N.color),"color").map(N=>N.color),setSelectedColor:ge,showNAColor:B}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:oe,"aria-label":"Graph area",children:(c||Z)&&(s||ue)?l.jsx(rP,{data:e.filter(N=>!je(N.y1)&&!je(N.y2)),width:c||Z,height:Math.max(X,s||(S?X?(c||Z)*S>X?(c||Z)*S:X:(c||Z)*S:ue)),colorDomain:e.filter(N=>N.color).length===0?[]:h||Xe(e.filter(N=>N.color),"color").map(N=>N.color),colors:e.filter(N=>N.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[z].categoricalColors.colors,selectedColor:Y,axisTitles:g,showLabels:o,radius:d,leftMargin:v,rightMargin:m,topMargin:I,bottomMargin:j,tooltip:w,onSeriesMouseOver:P,highlightedDataPoints:D,minValue:$,maxValue:V,onSeriesMouseClick:q,resetSelectionOnDoubleClick:A,detailsOnClick:M,styles:O,classNames:K,animate:Q===!0?{duration:.5,once:!0,amount:.5}:Q||{duration:0,once:!0,amount:0},dimmedOpacity:se,customLayers:T}):null})]})}),r||u?l.jsx(et,{styles:{footnote:O?.footnote,source:O?.source},classNames:{footnote:K?.footnote,source:K?.source},sources:r,footNote:u,width:c}):null]})})})})}function aP(t){const{data:e,barColor:n,suffix:i,prefix:r,barPadding:a,showValues:o,showTicks:s,leftMargin:c,truncateBy:u,width:h,height:f,rightMargin:d,topMargin:g,bottomMargin:p,showLabels:y,tooltip:v,onSeriesMouseOver:m,refValues:I,highlightedDataPoints:j,maxValue:w,minValue:S,onSeriesMouseClick:P,labelOrder:W,rtl:D,maxBarThickness:x,minBarThickness:$,resetSelectionOnDoubleClick:V,detailsOnClick:q,barAxisTitle:ae,valueColor:G,noOfTicks:_,styles:b,classNames:B,targetStyle:X,targetColor:z,qualitativeRangeColors:C,measureBarWidthFactor:A,animate:M,dimmedOpacity:O,precision:K,customLayers:Q,naLabel:se}=t,T=k.useRef(null),Z=ct(T,{once:M.once,amount:M.amount}),[ie,ue]=k.useState(void 0),[he,Y]=k.useState(void 0),[ge,oe]=k.useState(void 0),[ce,N]=k.useState(void 0),U={top:ae?g+25:g,bottom:p,left:c,right:d},ve=h-U.left-U.right,J=f-U.top-U.bottom,R=Math.max(...e.filter(me=>!je(me.size)).map(me=>me.size))<0?0:Math.max(...e.filter(me=>!je(me.size)).map(me=>me.size)),le=Math.max(...e.filter(me=>!je(me.target)).map(me=>me.target))<0?0:Math.max(...e.filter(me=>!je(me.target)).map(me=>me.target)),ee=Math.max(...e.map(me=>rt((me.qualitativeRange||[]).filter(Se=>!je(Se)))||0)),de=je(w)?Math.max(...[R,le,ee].filter(Number.isFinite))<0?0:Math.max(...[R,le,ee].filter(Number.isFinite)):w,te=Math.min(...e.filter(me=>!je(me.size)).map(me=>me.size))>=0?0:Math.min(...e.filter(me=>!je(me.size)).map(me=>me.size)),Me=Math.min(...e.filter(me=>!je(me.target)).map(me=>me.target))>=0?0:Math.min(...e.filter(me=>!je(me.target)).map(me=>me.target)),be=je(S)?Math.min(...[te,Me].filter(Number.isFinite))>=0?0:Math.min(...[te,Me].filter(Number.isFinite)):S,ne=e.map((me,Se)=>({...me,id:W?`${me.label}`:`${Se}`})),De=ut().domain([be,de]).range([0,ve]).nice(),xe=W||ne.map(me=>`${me.id}`),Ae=xn().domain(xe).range([0,$?Math.max(J,$*xe.length):x?Math.min(J,x*xe.length):J]).paddingInner(a),ke=De.ticks(_);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${h}px`,height:`${f}px`,viewBox:`0 0 ${h} ${f}`,direction:"ltr",ref:T,children:l.jsxs("g",{transform:`translate(${U.left},${U.top})`,children:[s?l.jsx(Rn,{values:ke.filter(me=>me!==0),x:ke.filter(me=>me!==0).map(me=>De(me)),y1:0-g,y2:J+U.bottom,styles:{gridLines:b?.xAxis?.gridLines,labels:b?.xAxis?.labels},classNames:{gridLines:B?.xAxis?.gridLines,labels:B?.xAxis?.labels},suffix:i,prefix:r,labelType:"secondary",showGridLines:!0,precision:K}):null,l.jsx(Nt,{x:ve/2,y:0-U.top+15,style:b?.xAxis?.title,className:B?.xAxis?.title,text:ae}),l.jsx(Dt,{x1:De(be<0?0:be),x2:De(be<0?0:be),y1:-2.5,y2:J+U.bottom,classNames:{axis:B?.yAxis?.axis},styles:{axis:b?.yAxis?.axis}}),Q.filter(me=>me.position==="before").map(me=>me.layer),l.jsxs(mt,{children:[ne.map(me=>je(Ae(me.id))?null:l.jsxs($e.g,{className:"undp-viz-g-with-hover",onMouseEnter:Se=>{ue(me),N(Se.clientY),oe(Se.clientX),m?.(me)},onClick:()=>{(P||q)&&(dt(he,me)&&V?(Y(void 0),P?.(void 0)):(Y(me),P?.(me)))},onMouseMove:Se=>{ue(me),N(Se.clientY),oe(Se.clientX)},onMouseLeave:()=>{ue(void 0),oe(void 0),N(void 0),m?.(void 0)},exit:{opacity:0,transition:{duration:M.duration}},variants:{initial:{x:0,y:Ae(`${me.id}`),opacity:j.length!==0?j.indexOf(me.label)!==-1?.85:O:.85},whileInView:{x:0,y:Ae(`${me.id}`),opacity:j.length!==0?j.indexOf(me.label)!==-1?.85:O:.85,transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial",children:[me.qualitativeRange?me.qualitativeRange.map((Se,Le)=>l.jsx($e.rect,{exit:{width:0,x:De(0),transition:{duration:M.duration}},variants:{initial:{x:De(0),width:0,fill:C[Le]},whileInView:{x:De(Le===0?0:rt(me.qualitativeRange.filter((F,Ie)=>Ie<Le&&F))),width:De(Se),fill:C[Le],transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial",y:0,height:Ae.bandwidth()},Le)):null,me.target&&X==="background"?l.jsx($e.rect,{y:0,x:me.target>=0?De(0):De(me.target),height:Ae.bandwidth(),style:{fill:z},exit:{width:0,x:De(0),transition:{duration:M.duration}},variants:{initial:{x:De(0),width:0},whileInView:{x:me.target>=0?De(0):De(me.target),width:me.target>=0?De(me.target)-De(0):De(0)-De(me.target),transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial"}):null,me.size?l.jsx($e.rect,{y:Ae.bandwidth()*((1-A)/2),style:{fill:n},height:Ae.bandwidth()*A,exit:{width:0,x:De(0),transition:{duration:M.duration}},variants:{initial:{x:De(0),width:0},whileInView:{x:me.size>=0?De(0):De(me.size),width:me.size>=0?De(me.size)-De(0):De(0)-De(me.size),transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial"}):null,me.target&&X==="line"?l.jsx($e.rect,{y:0,height:Ae.bandwidth(),style:{fill:z},width:2,exit:{opacity:0,x:De(0),transition:{duration:M.duration}},variants:{initial:{x:De(0),opacity:0},whileInView:{x:De(me.target)-1,opacity:1,transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial"}):null,y?l.jsx(io,{value:`${me.label}`.length<u?`${me.label}`:`${`${me.label}`.substring(0,u)}...`,y:0,x:(me.size||0)<0?De(0):0-U.left,width:(me.size||0)<0?h-De(0):De(0)+U.left,height:Ae.bandwidth(),alignment:me.size&&me.size<0?"left":"right",style:b?.yAxis?.labels,className:B?.yAxis?.labels,animate:M,isInView:Z}):null,o?l.jsx($e.text,{y:Ae.bandwidth()/2,style:{...G?{fill:G}:{fill:n},textAnchor:me.size&&me.size<0?"end":"start",...b?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",!G&&n.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",B?.graphObjectValues),dx:me.size&&me.size<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:M.duration}},variants:{initial:{x:De(0),opacity:0},whileInView:{x:me.size?De(me.size):De(0),opacity:1,transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial",children:qe(me.size,se,K,r,i)}):null]},me.label)),I?l.jsx(l.Fragment,{children:I.map((me,Se)=>l.jsx(Tr,{text:me.text,color:me.color,x:De(me.value),y1:0-U.top,y2:J+U.bottom,textSide:De(me.value)>ve*.75||D?"left":"right",classNames:me.classNames,styles:me.styles,animate:M,isInView:Z},Se))}):null]}),Q.filter(me=>me.position==="after").map(me=>me.layer)]})}),ie&&v&&ge&&ce?l.jsx(st,{data:ie,body:v,xPos:ge,yPos:ce,backgroundStyle:b?.tooltip,className:B?.tooltip}):null,q&&he!==void 0?l.jsx(Ce.Modal,{open:he!==void 0,onClose:()=>{Y(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof q=="string"?{__html:lt(q,he)}:void 0,children:typeof q=="function"?q(he):null})}):null]})}function oP(t){const{data:e,graphTitle:n,barColor:i=Pe.primaryColors["blue-600"],suffix:r="",sources:a,prefix:o="",graphDescription:s,barPadding:c=.25,showValues:u=!0,showTicks:h=!0,leftMargin:f=100,rightMargin:d=40,truncateBy:g=999,height:p,width:y,footNote:v,colorDomain:m,colorLegendTitle:I,highlightedDataPoints:j=[],padding:w,backgroundColor:S=!1,topMargin:P=25,bottomMargin:W=10,showLabels:D=!0,relativeHeight:x,tooltip:$,onSeriesMouseOver:V,refValues:q,showColorScale:ae=!0,graphID:G,maxValue:_,minValue:b,onSeriesMouseClick:B,graphDownload:X=!1,dataDownload:z=!1,sortData:C,labelOrder:A,language:M="en",minHeight:O=0,theme:K="light",maxBarThickness:Q,maxNumberOfBars:se,minBarThickness:T,ariaLabel:Z,resetSelectionOnDoubleClick:ie=!0,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y=5,valueColor:ge,styles:oe,classNames:ce,filterNA:N=!0,targetStyle:U="line",targetColor:ve=Pe.light.grays["gray-700"],qualitativeRangeColors:J,measureBarWidthFactor:R=.4,animate:le=!1,dimmedOpacity:ee=.3,precision:de=2,customLayers:te=[],naLabel:Me="NA"}=t,[be,ne]=k.useState(0),[De,xe]=k.useState(0),Ae=k.useRef(null),ke=k.useRef(null);return k.useEffect(()=>{const me=new ResizeObserver(Se=>{ne(y||Se[0].target.clientWidth||620),xe(p||Se[0].target.clientHeight||480)});return Ae.current&&(xe(Ae.current.clientHeight||480),ne(Ae.current.clientWidth||620),y||me.observe(Ae.current)),()=>me.disconnect()},[y,p]),l.jsx("div",{className:`${K||"light"} flex ${y?"w-fit grow-0":"w-full grow"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,ce?.graphContainer),style:{...oe?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:G,ref:ke,"aria-label":Z||`${n?`The graph shows ${n}. `:""}This is a bar chart. ${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:S?w||"1rem":w||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||s||X||z?l.jsx(Qe,{styles:{title:oe?.title,description:oe?.description},classNames:{title:ce?.title,description:ce?.description},graphTitle:n,graphDescription:s,width:y,graphDownload:X?ke.current:void 0,dataDownload:z?e.map(me=>me.data).filter(me=>me!==void 0).length>0?e.map(me=>me.data).filter(me=>me!==void 0):e.filter(me=>me!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[ae&&e.filter(me=>me.qualitativeRange).length!==0&&m?l.jsx(Hi,{width:y,colorLegendTitle:I,colors:J||Pe[K].sequentialColors.positiveColorsx10,colorDomain:m,showNAColor:!1}):null,l.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:Ae,"aria-label":"Graph area",children:(y||be)&&(p||De)?l.jsx(aP,{data:C==="asc"?tt(e.filter(me=>N?!je(me.size):me),me=>me.size).filter((me,Se)=>se?Se<se:!0):C==="desc"?tt(e.filter(me=>N?!je(me.size):me),me=>me.size).reverse().filter((me,Se)=>se?Se<se:!0):e.filter(me=>N?!je(me.size):me).filter((me,Se)=>se?Se<se:!0),barColor:i,targetColor:ve,width:y||be,height:Math.max(O,p||(x?O?(y||be)*x>O?(y||be)*x:O:(y||be)*x:De)),suffix:r,prefix:o,barPadding:c,showValues:u,showTicks:h,leftMargin:f,rightMargin:d,topMargin:P,bottomMargin:W,truncateBy:g,showLabels:D,tooltip:$,onSeriesMouseOver:V,refValues:q,maxValue:_,minValue:b,highlightedDataPoints:j,onSeriesMouseClick:B,labelOrder:A,rtl:M==="he"||M==="ar",maxBarThickness:Q,minBarThickness:T,resetSelectionOnDoubleClick:ie,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y,valueColor:ge,classNames:ce,styles:oe,targetStyle:U,qualitativeRangeColors:J||Pe[K].sequentialColors.positiveColorsx10,measureBarWidthFactor:R,animate:le===!0?{duration:.5,once:!0,amount:.5}:le||{duration:0,once:!0,amount:0},dimmedOpacity:ee,precision:de,customLayers:te,naLabel:Me}):null})]})}),a||v?l.jsx(et,{sources:a,footNote:v,width:y,styles:{footnote:oe?.footnote,source:oe?.source},classNames:{footnote:ce?.footnote,source:ce?.source}}):null]})})})})}function sP(t){const{data:e,width:n,height:i,barColor:r,suffix:a,prefix:o,barPadding:s,showLabels:c,showValues:u,showTicks:h,truncateBy:f,rightMargin:d,topMargin:g,bottomMargin:p,leftMargin:y,tooltip:v,onSeriesMouseOver:m,refValues:I,maxValue:j,minValue:w,highlightedDataPoints:S,onSeriesMouseClick:P,labelOrder:W,maxBarThickness:D,minBarThickness:x,resetSelectionOnDoubleClick:$,detailsOnClick:V,barAxisTitle:q,valueColor:ae,noOfTicks:G,styles:_,classNames:b,targetStyle:B,targetColor:X,qualitativeRangeColors:z,measureBarWidthFactor:C,animate:A,dimmedOpacity:M,precision:O,customLayers:K,naLabel:Q}=t,se=k.useRef(null),T=ct(se,{once:A.once,amount:A.amount}),Z={top:g,bottom:p,left:q?y+30:y,right:d},[ie,ue]=k.useState(void 0),[he,Y]=k.useState(void 0),[ge,oe]=k.useState(void 0),[ce,N]=k.useState(void 0),U=n-Z.left-Z.right,ve=i-Z.top-Z.bottom,J=Math.max(...e.filter(ke=>!je(ke.size)).map(ke=>ke.size))<0?0:Math.max(...e.filter(ke=>!je(ke.size)).map(ke=>ke.size)),R=Math.max(...e.filter(ke=>!je(ke.target)).map(ke=>ke.target))<0?0:Math.max(...e.filter(ke=>!je(ke.size)).map(ke=>ke.target)),le=Math.max(...e.map(ke=>rt((ke.qualitativeRange||[]).filter(me=>!je(me)))||0)),ee=je(j)?Math.max(...[J,R,le].filter(Number.isFinite))<0?0:Math.max(...[J,R,le].filter(Number.isFinite)):j,de=Math.min(...e.filter(ke=>!je(ke.size)).map(ke=>ke.size))>=0?0:Math.min(...e.filter(ke=>!je(ke.size)).map(ke=>ke.size)),te=Math.min(...e.filter(ke=>!je(ke.target)).map(ke=>ke.target))>=0?0:Math.min(...e.filter(ke=>!je(ke.target)).map(ke=>ke.target)),Me=je(w)?Math.min(...[de,te].filter(Number.isFinite))>=0?0:Math.min(...[de,te].filter(Number.isFinite)):w,be=ut().domain([Me,ee]).range([ve,0]).nice(),ne=e.map((ke,me)=>({...ke,id:W?`${ke.label}`:`${me}`})),De=W||ne.map(ke=>`${ke.id}`),xe=xn().domain(De).range([0,x?Math.max(U,x*De.length):D?Math.min(U,D*De.length):U]).paddingInner(s),Ae=be.ticks(G);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:se,children:l.jsxs("g",{transform:`translate(${Z.left},${Z.top})`,children:[l.jsx(Dt,{y1:be(Me<0?0:Me),y2:be(Me<0?0:Me),x1:0-y,x2:U+Z.right,label:qe(Me<0?0:Me,Q,O,o,a),labelPos:{x:0-y,dx:0,dy:ee<0?"1em":-5,y:be(Me<0?0:Me)},classNames:{axis:b?.xAxis?.axis,label:b?.yAxis?.labels},styles:{axis:_?.xAxis?.axis,label:_?.yAxis?.labels}}),h?l.jsx(ri,{values:Ae.filter(ke=>ke!==0),y:Ae.filter(ke=>ke!==0).map(ke=>be(ke)),x1:0-y,x2:U+Z.right,styles:{gridLines:_?.yAxis?.gridLines,labels:_?.yAxis?.labels},classNames:{gridLines:b?.yAxis?.gridLines,labels:b?.yAxis?.labels},suffix:a,prefix:o,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:O}):null,l.jsx(Nt,{x:0-y-15,y:ve/2,style:_?.yAxis?.title,className:b?.yAxis?.title,text:q,rotate90:!0}),K.filter(ke=>ke.position==="before").map(ke=>ke.layer),l.jsxs(mt,{children:[ne.map(ke=>je(xe(ke.id))?null:l.jsxs($e.g,{className:"undp-viz-g-with-hover",onMouseEnter:me=>{ue(ke),N(me.clientY),oe(me.clientX),m?.(ke)},onClick:()=>{(P||V)&&(dt(he,ke)&&$?(Y(void 0),P?.(void 0)):(Y(ke),P?.(ke)))},onMouseMove:me=>{ue(ke),N(me.clientY),oe(me.clientX)},onMouseLeave:()=>{ue(void 0),oe(void 0),N(void 0),m?.(void 0)},exit:{opacity:0,transition:{duration:A.duration}},variants:{initial:{x:xe(`${ke.id}`),y:0,opacity:S.length!==0?S.indexOf(ke.label)!==-1?.85:M:.85},whileInView:{x:xe(`${ke.id}`),y:0,opacity:S.length!==0?S.indexOf(ke.label)!==-1?.85:M:.85,transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial",children:[ke.qualitativeRange?ke.qualitativeRange.map((me,Se)=>l.jsx($e.rect,{x:0,exit:{height:0,y:be(0),transition:{duration:A.duration}},variants:{initial:{height:0,y:be(0),fill:z[Se]},whileInView:{height:Math.abs(be(rt(ke.qualitativeRange.filter((Le,F)=>F<=Se&&Le)))-be(rt(ke.qualitativeRange.filter((Le,F)=>F<Se&&Le)))),y:be(rt(ke.qualitativeRange.filter((Le,F)=>F<=Se&&Le))),fill:z[Se],transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial",width:xe.bandwidth()},Se)):null,ke.target&&B==="background"?l.jsx($e.rect,{x:0,width:xe.bandwidth(),style:{fill:X},exit:{height:0,y:be(0),transition:{duration:A.duration}},variants:{initial:{height:0,y:be(0)},whileInView:{height:Math.abs(be(ke.target)-be(0)),y:ke.target>0?be(ke.target):be(0),transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial"}):null,ke.size?l.jsx($e.rect,{x:xe.bandwidth()*((1-C)/2),width:xe.bandwidth()*C,style:{fill:r},exit:{height:0,y:be(0),transition:{duration:A.duration}},variants:{initial:{height:0,y:be(0)},whileInView:{height:Math.abs(be(ke.size)-be(0)),y:ke.size>0?be(ke.size):be(0),transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial"}):null,ke.target&&B==="line"?l.jsx($e.rect,{x:0,width:xe.bandwidth(),style:{fill:X},exit:{y:be(0),opacity:0,transition:{duration:A.duration}},variants:{initial:{y:be(0),opacity:0},whileInView:{y:be(ke.target)-1,opacity:1,transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial",height:2}):null,c?l.jsx(ro,{value:`${ke.label}`.length<f?`${ke.label}`:`${`${ke.label}`.substring(0,f)}...`,y:(ke.size||0)<0?0:be(0)+5,x:0,width:xe.bandwidth(),height:(ke.size||0)<0?be(0)-5:Z.bottom,style:_?.xAxis?.labels,className:b?.xAxis?.labels,alignment:(ke.size||0)<0?"bottom":"top",animate:A,isInView:T}):null,u?l.jsx($e.text,{x:xe.bandwidth()/2,style:{...ae?{fill:ae}:{fill:r},textAnchor:"middle",..._?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",!ae&&r.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",b?.graphObjectValues),dy:ke.size?ke.size>=0?"-5px":"1em":"-5px",exit:{opacity:0,transition:{duration:A.duration}},variants:{initial:{y:be(0),opacity:0},whileInView:{y:be(ke.size||0),opacity:1,transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial",children:qe(ke.size,Q,O,o,a)}):null]},ke.label)),I?l.jsx(l.Fragment,{children:I.map((ke,me)=>l.jsx(gi,{text:ke.text,color:ke.color,y:be(ke.value),x1:0-y,x2:U+Z.right,classNames:ke.classNames,styles:ke.styles,animate:A,isInView:T},me))}):null]}),K.filter(ke=>ke.position==="after").map(ke=>ke.layer)]})}),ie&&v&&ge&&ce?l.jsx(st,{data:ie,body:v,xPos:ge,yPos:ce,backgroundStyle:_?.tooltip,className:b?.tooltip}):null,V&&he!==void 0?l.jsx(Ce.Modal,{open:he!==void 0,onClose:()=>{Y(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof V=="string"?{__html:lt(V,he)}:void 0,children:typeof V=="function"?V(he):null})}):null]})}function lP(t){const{data:e,graphTitle:n,barColor:i=Pe.primaryColors["blue-600"],barPadding:r=.25,showTicks:a=!0,leftMargin:o=20,rightMargin:s=20,topMargin:c=20,bottomMargin:u=25,truncateBy:h=999,showLabels:f=!0,showValues:d=!0,backgroundColor:g=!1,suffix:p="",prefix:y="",sources:v,graphDescription:m,height:I,width:j,footNote:w,colorDomain:S,colorLegendTitle:P,padding:W,relativeHeight:D,tooltip:x,onSeriesMouseOver:$,refValues:V,showColorScale:q=!0,graphID:ae,maxValue:G,minValue:_,highlightedDataPoints:b=[],qualitativeRangeColors:B,onSeriesMouseClick:X,graphDownload:z=!1,dataDownload:C=!1,language:A="en",theme:M="light",sortData:O,labelOrder:K,minHeight:Q=0,maxBarThickness:se,maxNumberOfBars:T,minBarThickness:Z,ariaLabel:ie,resetSelectionOnDoubleClick:ue=!0,detailsOnClick:he,barAxisTitle:Y,noOfTicks:ge=5,valueColor:oe,styles:ce,classNames:N,targetColor:U=Pe.light.grays["gray-700"],filterNA:ve=!0,targetStyle:J="line",measureBarWidthFactor:R=.4,animate:le=!1,dimmedOpacity:ee=.3,precision:de=2,customLayers:te=[],naLabel:Me="NA"}=t,[be,ne]=k.useState(0),[De,xe]=k.useState(0),Ae=k.useRef(null),ke=k.useRef(null);return k.useEffect(()=>{const me=new ResizeObserver(Se=>{ne(j||Se[0].target.clientWidth||620),xe(I||Se[0].target.clientHeight||480)});return Ae.current&&(xe(Ae.current.clientHeight||480),ne(Ae.current.clientWidth||620),j||me.observe(Ae.current)),()=>me.disconnect()},[j,I]),l.jsx("div",{className:`${M||"light"} flex ${j?"w-fit grow-0":"w-full grow"}`,dir:A==="he"||A==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${A||"en"}`,N?.graphContainer),style:{...ce?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:ae,ref:ke,"aria-label":ie||`${n?`The graph shows ${n}. `:""}This is a grouped bar chart. ${m?` ${m}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:g?W||"1rem":W||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||m||z||C?l.jsx(Qe,{styles:{title:ce?.title,description:ce?.description},classNames:{title:N?.title,description:N?.description},graphTitle:n,graphDescription:m,width:j,graphDownload:z?ke.current:void 0,dataDownload:C?e.map(me=>me.data).filter(me=>me!==void 0).length>0?e.map(me=>me.data).filter(me=>me!==void 0):e.filter(me=>me!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[q&&e.filter(me=>me.qualitativeRange).length!==0&&S?l.jsx(Hi,{width:j,colorLegendTitle:P,colors:B||Pe[M].sequentialColors.positiveColorsx10,colorDomain:S,showNAColor:!1}):null,l.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:Ae,"aria-label":"Graph area",children:(j||be)&&(I||De)?l.jsx(sP,{data:O==="asc"?tt(e.filter(me=>ve?!je(me.size):me),me=>me.size).filter((me,Se)=>T?Se<T:!0):O==="desc"?tt(e.filter(me=>ve?!je(me.size):me),me=>me.size).reverse().filter((me,Se)=>T?Se<T:!0):e.filter(me=>ve?!je(me.size):me).filter((me,Se)=>T?Se<T:!0),barColor:i,targetColor:U,width:j||be,refValues:V,height:Math.max(Q,I||(D?Q?(j||be)*D>Q?(j||be)*D:Q:(j||be)*D:De)),suffix:p,prefix:y,barPadding:r,showLabels:f,showValues:d,showTicks:a,truncateBy:h,leftMargin:o,rightMargin:s,qualitativeRangeColors:B||Pe[M].sequentialColors.positiveColorsx10,topMargin:c,bottomMargin:u,tooltip:x,onSeriesMouseOver:$,maxValue:G,minValue:_,highlightedDataPoints:b,onSeriesMouseClick:X,labelOrder:K,maxBarThickness:se,minBarThickness:Z,resetSelectionOnDoubleClick:ue,detailsOnClick:he,barAxisTitle:Y,noOfTicks:ge,valueColor:oe,styles:ce,classNames:N,targetStyle:J,dimmedOpacity:ee,measureBarWidthFactor:R,animate:le===!0?{duration:.5,once:!0,amount:.5}:le||{duration:0,once:!0,amount:0},precision:de,customLayers:te,naLabel:Me}):null})]})}),v||w?l.jsx(et,{styles:{footnote:ce?.footnote,source:ce?.source},classNames:{footnote:N?.footnote,source:N?.source},sources:v,footNote:w,width:j}):null]})})})})}function Kv(t){const{data:e,graphTitle:n,barColor:i,barPadding:r,showTicks:a,leftMargin:o,rightMargin:s,topMargin:c,bottomMargin:u,truncateBy:h,showLabels:f,showValues:d,backgroundColor:g,suffix:p,prefix:y,sources:v,graphDescription:m,height:I,width:j,footNote:w,colorDomain:S,colorLegendTitle:P,padding:W,relativeHeight:D,tooltip:x,onSeriesMouseOver:$,refValues:V,showColorScale:q,graphID:ae,maxValue:G,minValue:_,highlightedDataPoints:b,onSeriesMouseClick:B,graphDownload:X,dataDownload:z,language:C,theme:A,sortData:M,labelOrder:O,minHeight:K,maxBarThickness:Q,maxNumberOfBars:se,minBarThickness:T,ariaLabel:Z,resetSelectionOnDoubleClick:ie,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y,valueColor:ge,orientation:oe="vertical",styles:ce,classNames:N,filterNA:U,targetStyle:ve,targetColor:J,qualitativeRangeColors:R,measureBarWidthFactor:le,animate:ee,dimmedOpacity:de,precision:te,naLabel:Me}=t;return oe==="vertical"?l.jsx(lP,{data:e,graphTitle:n,barColor:i,barPadding:r,showTicks:a,leftMargin:o,rightMargin:s,topMargin:c,bottomMargin:u,truncateBy:h,showLabels:f,showValues:d,backgroundColor:g,suffix:p,prefix:y,sources:v,graphDescription:m,height:I,width:j,footNote:w,colorDomain:S,colorLegendTitle:P,padding:W,relativeHeight:D,tooltip:x,onSeriesMouseOver:$,refValues:V,showColorScale:q,graphID:ae,maxValue:G,minValue:_,highlightedDataPoints:b,onSeriesMouseClick:B,graphDownload:X,dataDownload:z,language:C,theme:A,sortData:M,labelOrder:O,minHeight:K,maxBarThickness:Q,maxNumberOfBars:se,minBarThickness:T,ariaLabel:Z,resetSelectionOnDoubleClick:ie,styles:ce,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y,valueColor:ge,classNames:N,filterNA:U,targetStyle:ve,targetColor:J,measureBarWidthFactor:le,qualitativeRangeColors:R,animate:ee,dimmedOpacity:de,precision:te,naLabel:Me}):l.jsx(oP,{data:e,graphTitle:n,barColor:i,barPadding:r,showTicks:a,leftMargin:o,rightMargin:s,topMargin:c,bottomMargin:u,truncateBy:h,showLabels:f,showValues:d,backgroundColor:g,suffix:p,prefix:y,sources:v,graphDescription:m,height:I,width:j,footNote:w,colorDomain:S,colorLegendTitle:P,padding:W,relativeHeight:D,tooltip:x,onSeriesMouseOver:$,refValues:V,showColorScale:q,graphID:ae,maxValue:G,minValue:_,highlightedDataPoints:b,onSeriesMouseClick:B,graphDownload:X,dataDownload:z,language:C,theme:A,sortData:M,labelOrder:O,minHeight:K,maxBarThickness:Q,maxNumberOfBars:se,minBarThickness:T,ariaLabel:Z,resetSelectionOnDoubleClick:ie,styles:ce,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y,valueColor:ge,classNames:N,filterNA:U,targetStyle:ve,targetColor:J,measureBarWidthFactor:le,qualitativeRangeColors:R,animate:ee,dimmedOpacity:de,precision:te,naLabel:Me})}function cP(t){const{data:e,width:n,height:i,colors:r,dateFormat:a,noOfXTicks:o,rightMargin:s,leftMargin:c,topMargin:u,bottomMargin:h,yAxisTitle:f,tooltip:d,onSeriesMouseOver:g,highlightAreaSettings:p,refValues:y,minValue:v,maxValue:m,rtl:I,annotations:j,customHighlightAreaSettings:w,noOfYTicks:S,prefix:P,suffix:W,curveType:D,styles:x,classNames:$,precision:V,customLayers:q,animate:ae}=t,G=k.useRef(null),_=ct(G,{once:ae.once,amount:ae.amount}),b=D==="linear"?Oi:D==="step"?Or:D==="stepAfter"?Ir:D==="stepBefore"?Nr:_r,[B,X]=k.useState(void 0),[z,C]=k.useState(void 0),[A,M]=k.useState(void 0),O={top:u,bottom:h,left:f?c+30:c,right:s},K=k.useRef(null),Q=tt(e.map(R=>({...R,date:ze(`${R.date}`,a,new Date)})),"date"),se=p.map(R=>({...R,coordinates:[R.coordinates[0]===null?null:ze(`${R.coordinates[0]}`,a,new Date),R.coordinates[1]===null?null:ze(`${R.coordinates[1]}`,a,new Date)]})),T=w.map(R=>({...R,coordinates:R.coordinates.map((le,ee)=>ee%2===0?ze(`${le}`,a,new Date):le)})),Z=Q[0].y.map((R,le)=>Q.map(ee=>({date:ee.date,y0:le===0?0:rt(ee.y.filter((de,te)=>te<le)),y1:rt(ee.y.filter((de,te)=>te<=le))}))),ie=n-O.left-O.right,ue=i-O.top-O.bottom,he=Q[0].date,Y=Q[Q.length-1].date,ge=je(v)?0:v,oe=je(m)?Math.max(...e.map(R=>rt(R.y)||0)):m,ce=Zr().domain([he,Y]).range([0,ie]),N=ut().domain([ge,oe]).range([ue,0]).nice(),U=No().x(R=>ce(R.date)).y0(R=>N(R.y0)).y1(R=>N(R.y1)).curve(b),ve=N.ticks(S),J=ce.ticks(o);return k.useEffect(()=>{const R=ee=>{const de=Q[Qr(Q.map(te=>te.date),ce.invert(En(ee)[0]),1)];X(de||Q[Q.length-1]),g?.(de||Q[Q.length-1]),M(ee.clientY),C(ee.clientX)},le=()=>{X(void 0),C(void 0),M(void 0),g?.(void 0)};bt(K.current).on("mousemove",R).on("mouseout",le),g?.(void 0)},[ce,Q,g]),l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:G,children:l.jsx(mt,{children:l.jsxs($e.g,{transform:`translate(${O.left},${O.top})`,children:[l.jsx(ao,{areaSettings:se,width:ie,height:ue,scale:ce,animate:ae,isInView:_}),l.jsx(lo,{animate:ae,areaSettings:T,scaleX:ce,scaleY:N,isInView:_}),l.jsxs("g",{children:[l.jsx(ri,{values:ve.filter(R=>R!==0),y:ve.filter(R=>R!==0).map(R=>N(R)),x1:0-c,x2:ie+O.right,styles:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},classNames:{gridLines:$?.yAxis?.gridLines,labels:$?.yAxis?.labels},suffix:W,prefix:P,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:V}),l.jsx(Dt,{y1:N(ge<0?0:ge),y2:N(ge<0?0:ge),x1:0-c,x2:ie+O.right,label:qe(ge<0?0:ge,"NA",V,P,W),labelPos:{x:0-c,dx:0,dy:oe<0?"1em":-5,y:N(ge<0?0:ge)},classNames:{axis:$?.xAxis?.axis,label:$?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:x?.yAxis?.labels}}),l.jsx(Nt,{x:0-c-15,y:ue/2,style:x?.yAxis?.title,className:$?.yAxis?.title,text:f,rotate90:!0})]}),l.jsx(Rn,{values:J.map(R=>ft(R,a)),x:J.map(R=>ce(R)),y1:0,y2:ue,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:Ce.cn("opacity-0",$?.xAxis?.gridLines),labels:Ce.cn("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs",$?.xAxis?.labels)},suffix:W,prefix:P,labelType:"primary",showGridLines:!0,precision:V}),q.filter(R=>R.position==="before").map(R=>R.layer),l.jsxs($e.g,{children:[Z.map((R,le)=>l.jsx($e.path,{d:U(R),exit:{opacity:0,transition:{duration:ae.duration}},variants:{initial:{d:U(R.map(ee=>({...ee,y0:0,y1:0}))),opacity:0},whileInView:{d:U(R),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:_?"whileInView":"initial",style:{fill:r[le],opacity:.8}},le)),B?l.jsx("line",{y1:0,y2:ue,x1:ce(B.date),x2:ce(B.date),className:Ce.cn("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",$?.mouseOverLine),style:x?.mouseOverLine}):null]}),y?l.jsx(l.Fragment,{children:y.map((R,le)=>l.jsx(gi,{text:R.text,color:R.color,y:N(R.value),x1:0-c,x2:ie+O.right,classNames:R.classNames,styles:R.styles,animate:ae,isInView:_},le))}):null,l.jsx("g",{children:j.map((R,le)=>{const ee=oo({x:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0),y:R.yCoordinate?N(R.yCoordinate)+(R.yOffset||0)-8:0+(R.yOffset||0)-8},{x:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date)):0,y:R.yCoordinate?N(R.yCoordinate):0},je(R.connectorRadius)?3.5:R.connectorRadius),de=R.showConnector?{y1:ee.y,x1:ee.x,y2:R.yCoordinate?N(R.yCoordinate)+(R.yOffset||0):0+(R.yOffset||0),x2:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0),cx:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date)):0,cy:R.yCoordinate?N(R.yCoordinate):0,circleRadius:je(R.connectorRadius)?3.5:R.connectorRadius,strokeWidth:R.showConnector===!0?2:Math.min(R.showConnector||0,1)}:void 0,te={y:R.yCoordinate?N(R.yCoordinate)+(R.yOffset||0)-8:0+(R.yOffset||0)-8,x:I?0:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0),width:I?R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0):ie-(R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0)),maxWidth:R.maxWidth,fontWeight:R.fontWeight,align:R.align};return l.jsx(so,{color:R.color,connectorsSettings:de,labelSettings:te,text:R.text,classNames:R.classNames,styles:R.styles,animate:ae,isInView:_},le)})}),q.filter(R=>R.position==="after").map(R=>R.layer),l.jsx("rect",{ref:K,style:{fill:"none",pointerEvents:"all"},width:ie,height:ue})]})})}),B&&d&&z&&A?l.jsx(st,{data:B,body:d,xPos:z,yPos:A,backgroundStyle:x?.tooltip,className:$?.tooltip}):null]})}function Qv(t){const{data:e,graphTitle:n,colors:i=Pe.light.categoricalColors.colors,sources:r,graphDescription:a,height:o,width:s,footNote:c,noOfXTicks:u=10,dateFormat:h="yyyy",colorDomain:f,padding:d,backgroundColor:g=!1,colorLegendTitle:p,leftMargin:y=50,rightMargin:v=20,topMargin:m=20,bottomMargin:I=25,highlightAreaSettings:j=[],tooltip:w,relativeHeight:S,onSeriesMouseOver:P,refValues:W=[],graphID:D,minValue:x,maxValue:$,graphDownload:V=!1,dataDownload:q=!1,showColorScale:ae=!0,language:G="en",minHeight:_=0,annotations:b=[],customHighlightAreaSettings:B=[],theme:X="light",ariaLabel:z,yAxisTitle:C,noOfYTicks:A=5,prefix:M="",suffix:O="",curveType:K="curve",styles:Q,classNames:se,precision:T=2,customLayers:Z=[],animate:ie=!1}=t,[ue,he]=k.useState(0),[Y,ge]=k.useState(0),oe=k.useRef(null),ce=k.useRef(null);return k.useEffect(()=>{const N=new ResizeObserver(U=>{he(s||U[0].target.clientWidth||620),ge(o||U[0].target.clientHeight||480)});return oe.current&&(ge(oe.current.clientHeight||480),he(oe.current.clientWidth||620),s||N.observe(oe.current)),()=>N.disconnect()},[s,o]),l.jsx("div",{className:`${X||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:G==="he"||G==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${G||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:D,ref:ce,"aria-label":z||`${n?`The graph shows ${n}. `:""}This is a stacked area chart that shows trends over time.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:g?d||"1rem":d||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||V||q?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:a,width:s,graphDownload:V?ce.current:void 0,dataDownload:q?e.map(N=>N.data).filter(N=>N!==void 0).length>0?e.map(N=>N.data).filter(N=>N!==void 0):e.filter(N=>N!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[ae!==!1?l.jsx(Hi,{colorDomain:f,colors:i,colorLegendTitle:p,showNAColor:!1}):null,l.jsx("div",{className:"w-full grow leading-0",ref:oe,"aria-label":"Graph area",children:(s||ue)&&(o||Y)?l.jsx(cP,{data:e,colors:i,width:s||ue,height:Math.max(_,o||(S?_?(s||ue)*S>_?(s||ue)*S:_:(s||ue)*S:Y)),dateFormat:h,noOfXTicks:u,leftMargin:y,rightMargin:v,topMargin:m,bottomMargin:I,tooltip:w,onSeriesMouseOver:P,highlightAreaSettings:j,refValues:W,minValue:x,maxValue:$,rtl:G==="he"||G==="ar",annotations:b,customHighlightAreaSettings:B,yAxisTitle:C,noOfYTicks:A,prefix:M,suffix:O,curveType:K,styles:Q,classNames:se,precision:T,customLayers:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0}}):null})]})}),r||c?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:r,footNote:c,width:s}):null]})})})})}function uP(t){const{year:e,value:n,graphTitle:i,suffix:r="",sources:a,prefix:o="",graphDescription:s,footNote:c,padding:u,backgroundColor:h=!1,graphID:f,language:d="en",theme:g="light",ariaLabel:p,textBackground:y=!1,headingFontSize:v="4.375rem",centerAlign:m=!1,verticalAlign:I="center",layout:j="primary",styles:w,classNames:S,precision:P}=t;return l.jsx("div",{className:`${g||"light"} flex w-full`,dir:d==="he"||d==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col w-full h-inherit ${d||"en"}`,S?.graphContainer),style:{...w?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:f,"aria-label":p||`${i?`The graph shows ${i}. `:""}This is a statistic card.${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:j!=="secondary"?l.jsxs("div",{className:"flex flex-col w-full gap-12 justify-between grow",children:[i||s?l.jsx(Qe,{styles:{title:w?.title,description:w?.description},classNames:{title:S?.title,description:S?.description},graphTitle:i,graphDescription:s}):null,l.jsx("div",{className:`flex flex-col justify-between grow ${I==="top"?"justify-start":I==="bottom"?"justify-end":"justify-center"}`,children:l.jsxs(Ce.H3,{marginBottom:"base",className:`leading-none text-outline font-heading ${m?"text-center":d==="he"||d==="ar"?"text-right":"text-left"} ${y?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:v,letterSpacing:"0.05rem"},children:[qe(n,"NA",P,o,r)," ",e?l.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",e,")"]}):null]})}),a||c?l.jsx(et,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:S?.footnote,source:S?.source},sources:a,footNote:c}):null]}):l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-center",children:[l.jsxs(Ce.H3,{marginBottom:j==="secondary"?"none":"base",className:`leading-none text-outline font-heading ${m?"text-center":d==="he"||d==="ar"?"text-right":"text-left"} ${y?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:v,letterSpacing:"0.05rem"},children:[qe(n,"NA",P,o,r)," ",e?l.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",e,")"]}):null]}),i||s?l.jsx(Qe,{styles:{title:w?.title,description:w?.description},classNames:{title:S?.title,description:S?.description},graphTitle:i,graphDescription:s}):null,a||c?l.jsx(et,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:S?.footnote,source:S?.source},sources:a,footNote:c}):null]})})})})}function Zv(t){const{year:e,data:n,graphTitle:i,suffix:r="",sources:a,prefix:o="",graphDescription:s,footNote:c,padding:u,backgroundColor:h=!1,graphID:f,aggregationMethod:d="count",language:g="en",countOnly:p,theme:y="light",ariaLabel:v,textBackground:m=!1,headingFontSize:I="4.375rem",centerAlign:j=!1,verticalAlign:w="center",layout:S="primary",styles:P,classNames:W,precision:D=2}=t;return l.jsx("div",{className:`${y||"light"} flex w-full`,dir:g==="he"||g==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col w-full h-inherit ${g||"en"}`,W?.graphContainer),style:{...P?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:f,"aria-label":v||`${i?`The graph shows ${i}. `:""}This is a statistic card.${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:S!=="secondary"?l.jsxs("div",{className:"flex flex-col w-full gap-12 justify-between grow",children:[i||s?l.jsx(Qe,{styles:{title:P?.title,description:P?.description},classNames:{title:W?.title,description:W?.description},graphTitle:i,graphDescription:s}):null,l.jsx("div",{className:`flex flex-col justify-between grow ${w==="top"?"justify-start":w==="bottom"?"justify-end":"justify-center"}`,children:l.jsxs(Ce.H3,{marginBottom:"base",className:`leading-none text-outline font-heading ${j?"text-center":g==="he"||g==="ar"?"text-right":"text-left"} ${m?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:I,letterSpacing:"0.05rem"},children:[n.filter(x=>typeof x.value=="string").length>0||d==="count"?p&&p?.length!==0?n.filter(x=>p.indexOf(x.value)!==-1).length:n.length:qe(d==="sum"?rt(n.map(x=>x.value)):d==="average"?parseFloat((rt(n.map(x=>x.value))/n.length).toFixed(2)):d==="max"?Math.max(...n.map(x=>x.value).filter(x=>x!==void 0)):Math.min(...n.map(x=>x.value).filter(x=>x!==void 0)),"NA",D,o,r)," ",e?l.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",e,")"]}):null]})}),a||c?l.jsx(et,{styles:{footnote:P?.footnote,source:P?.source},classNames:{footnote:W?.footnote,source:W?.source},sources:a,footNote:c}):null]}):l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-center",children:[l.jsxs(Ce.H3,{marginBottom:S==="secondary"?"none":"base",className:`leading-none text-outline font-heading ${j?"text-center":g==="he"||g==="ar"?"text-right":"text-left"} ${m?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:I,letterSpacing:"0.05rem"},children:[n.filter(x=>typeof x.value=="string").length>0||d==="count"?p&&p?.length!==0?n.filter(x=>p.indexOf(x.value)!==-1).length:n.length:qe(d==="sum"?rt(n.map(x=>x.value)):d==="average"?parseFloat((rt(n.map(x=>x.value))/n.length).toFixed(2)):d==="max"?Math.max(...n.map(x=>x.value).filter(x=>x!==void 0)):Math.min(...n.map(x=>x.value).filter(x=>x!==void 0)),"NA",D,o,r)," ",e?l.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",e,")"]}):null]}),i||s?l.jsx(Qe,{styles:{title:P?.title,description:P?.description},classNames:{title:W?.title,description:W?.description},graphTitle:i,graphDescription:s}):null,a||c?l.jsx(et,{styles:{footnote:P?.footnote,source:P?.source},classNames:{footnote:W?.footnote,source:W?.source},sources:a,footNote:c}):null]})})})})}function hP(t){var e=0,n=t.children,i=n&&n.length;if(!i)e=1;else for(;--i>=0;)e+=n[i].value;t.value=e}function fP(){return this.eachAfter(hP)}function dP(t,e){let n=-1;for(const i of this)t.call(e,i,++n,this);return this}function gP(t,e){for(var n=this,i=[n],r,a,o=-1;n=i.pop();)if(t.call(e,n,++o,this),r=n.children)for(a=r.length-1;a>=0;--a)i.push(r[a]);return this}function pP(t,e){for(var n=this,i=[n],r=[],a,o,s,c=-1;n=i.pop();)if(r.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)i.push(a[o]);for(;n=r.pop();)t.call(e,n,++c,this);return this}function mP(t,e){let n=-1;for(const i of this)if(t.call(e,i,++n,this))return i}function yP(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n})}function xP(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function vP(t){for(var e=this,n=wP(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i}function wP(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;for(t=n.pop(),e=i.pop();t===e;)r=t,t=n.pop(),e=i.pop();return r}function bP(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function CP(){return Array.from(this)}function SP(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function DP(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*MP(){var t=this,e,n=[t],i,r,a;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,i=t.children)for(r=0,a=i.length;r<a;++r)n.push(i[r]);while(n.length)}function Jv(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=jP)):e===void 0&&(e=kP);for(var n=new Ys(t),i,r=[n],a,o,s,c;i=r.pop();)if((o=e(i.data))&&(c=(o=Array.from(o)).length))for(i.children=o,s=c-1;s>=0;--s)r.push(a=o[s]=new Ys(o[s])),a.parent=i,a.depth=i.depth+1;return n.eachBefore(ew)}function TP(){return Jv(this).eachBefore(AP)}function kP(t){return t.children}function jP(t){return Array.isArray(t)?t[1]:null}function AP(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function ew(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function Ys(t){this.data=t,this.depth=this.height=0,this.parent=null}Ys.prototype=Jv.prototype={constructor:Ys,count:fP,each:dP,eachAfter:pP,eachBefore:gP,find:mP,sum:yP,sort:xP,path:vP,ancestors:bP,descendants:CP,leaves:SP,links:DP,copy:TP,[Symbol.iterator]:MP};function Iu(t){return t==null?null:tw(t)}function tw(t){if(typeof t!="function")throw new Error;return t}function ds(){return 0}function gs(t){return function(){return t}}function _P(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function OP(t,e,n,i,r){for(var a=t.children,o,s=-1,c=a.length,u=t.value&&(i-e)/t.value;++s<c;)o=a[s],o.y0=n,o.y1=r,o.x0=e,o.x1=e+=o.value*u}var NP={depth:-1},qm={},$u={};function IP(t){return t.id}function $P(t){return t.parentId}function LP(){var t=IP,e=$P,n;function i(r){var a=Array.from(r),o=t,s=e,c,u,h,f,d,g,p,y,v=new Map;if(n!=null){const m=a.map((w,S)=>PP(n(w,S,r))),I=m.map(Um),j=new Set(m).add("");for(const w of I)j.has(w)||(j.add(w),m.push(w),I.push(Um(w)),a.push($u));o=(w,S)=>m[S],s=(w,S)=>I[S]}for(h=0,c=a.length;h<c;++h)u=a[h],g=a[h]=new Ys(u),(p=o(u,h,r))!=null&&(p+="")&&(y=g.id=p,v.set(y,v.has(y)?qm:g)),(p=s(u,h,r))!=null&&(p+="")&&(g.parent=p);for(h=0;h<c;++h)if(g=a[h],p=g.parent){if(d=v.get(p),!d)throw new Error("missing: "+p);if(d===qm)throw new Error("ambiguous: "+p);d.children?d.children.push(g):d.children=[g],g.parent=d}else{if(f)throw new Error("multiple roots");f=g}if(!f)throw new Error("no root");if(n!=null){for(;f.data===$u&&f.children.length===1;)f=f.children[0],--c;for(let m=a.length-1;m>=0&&(g=a[m],g.data===$u);--m)g.data=null}if(f.parent=NP,f.eachBefore(function(m){m.depth=m.parent.depth+1,--c}).eachBefore(ew),f.parent=null,c>0)throw new Error("cycle");return f}return i.id=function(r){return arguments.length?(t=Iu(r),i):t},i.parentId=function(r){return arguments.length?(e=Iu(r),i):e},i.path=function(r){return arguments.length?(n=Iu(r),i):n},i}function PP(t){t=`${t}`;let e=t.length;return Ph(t,e-1)&&!Ph(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function Um(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Ph(t,e););return t.slice(0,e)}function Ph(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if((n&1)===0)return!0}return!1}function EP(t,e,n,i,r){for(var a=t.children,o,s=-1,c=a.length,u=t.value&&(r-n)/t.value;++s<c;)o=a[s],o.x0=e,o.x1=i,o.y0=n,o.y1=n+=o.value*u}var VP=(1+Math.sqrt(5))/2;function FP(t,e,n,i,r,a){for(var o=[],s=e.children,c,u,h=0,f=0,d=s.length,g,p,y=e.value,v,m,I,j,w,S,P;h<d;){g=r-n,p=a-i;do v=s[f++].value;while(!v&&f<d);for(m=I=v,S=Math.max(p/g,g/p)/(y*t),P=v*v*S,w=Math.max(I/P,P/m);f<d;++f){if(v+=u=s[f].value,u<m&&(m=u),u>I&&(I=u),P=v*v*S,j=Math.max(I/P,P/m),j>w){v-=u;break}w=j}o.push(c={value:v,dice:g<p,children:s.slice(h,f)}),c.dice?OP(c,n,i,r,y?i+=p*v/y:a):EP(c,n,i,y?n+=g*v/y:r,a),y-=v,h=f}return o}const RP=function t(e){function n(i,r,a,o,s){FP(e,i,r,a,o,s)}return n.ratio=function(i){return t((i=+i)>1?i:1)},n}(VP);function BP(){var t=RP,e=!1,n=1,i=1,r=[0],a=ds,o=ds,s=ds,c=ds,u=ds;function h(d){return d.x0=d.y0=0,d.x1=n,d.y1=i,d.eachBefore(f),r=[0],e&&d.eachBefore(_P),d}function f(d){var g=r[d.depth],p=d.x0+g,y=d.y0+g,v=d.x1-g,m=d.y1-g;v<p&&(p=v=(p+v)/2),m<y&&(y=m=(y+m)/2),d.x0=p,d.y0=y,d.x1=v,d.y1=m,d.children&&(g=r[d.depth+1]=a(d)/2,p+=u(d)-g,y+=o(d)-g,v-=s(d)-g,m-=c(d)-g,v<p&&(p=v=(p+v)/2),m<y&&(y=m=(y+m)/2),t(d,p,y,v,m))}return h.round=function(d){return arguments.length?(e=!!d,h):e},h.size=function(d){return arguments.length?(n=+d[0],i=+d[1],h):[n,i]},h.tile=function(d){return arguments.length?(t=tw(d),h):t},h.padding=function(d){return arguments.length?h.paddingInner(d).paddingOuter(d):h.paddingInner()},h.paddingInner=function(d){return arguments.length?(a=typeof d=="function"?d:gs(+d),h):a},h.paddingOuter=function(d){return arguments.length?h.paddingTop(d).paddingRight(d).paddingBottom(d).paddingLeft(d):h.paddingTop()},h.paddingTop=function(d){return arguments.length?(o=typeof d=="function"?d:gs(+d),h):o},h.paddingRight=function(d){return arguments.length?(s=typeof d=="function"?d:gs(+d),h):s},h.paddingBottom=function(d){return arguments.length?(c=typeof d=="function"?d:gs(+d),h):c},h.paddingLeft=function(d){return arguments.length?(u=typeof d=="function"?d:gs(+d),h):u},h}function HP(t){const{data:e,colors:n,leftMargin:i,width:r,height:a,colorDomain:o,rightMargin:s,topMargin:c,bottomMargin:u,showLabels:h,tooltip:f,onSeriesMouseOver:d,selectedColor:g,showValues:p,suffix:y,prefix:v,highlightedDataPoints:m,onSeriesMouseClick:I,resetSelectionOnDoubleClick:j,detailsOnClick:w,language:S,styles:P,classNames:W,animate:D,dimmedOpacity:x,precision:$}=t,V=k.useRef(null),q=ct(V,{once:D.once,amount:D.amount}),[ae,G]=k.useState(void 0),[_,b]=k.useState(void 0),[B,X]=k.useState(void 0),[z,C]=k.useState(void 0),A={top:c,bottom:u,left:i,right:s},M=r-A.left-A.right,O=a-A.top-A.bottom,K=[{id:"root",parent:void 0,value:void 0,data:void 0},...e.map(T=>({id:T.label,value:T.size,parent:"root",data:T}))],Q=LP().id(T=>T.id).parentId(T=>T.parent)(K);Q.sum(T=>T.value);const se=BP().size([M,O]).padding(2)(Q);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${r}px`,height:`${a}px`,viewBox:`0 0 ${r} ${a}`,direction:"ltr",ref:V,children:l.jsx("g",{transform:`translate(${A.left},${A.top})`,children:l.jsx(mt,{children:se.children?.map(T=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:T.x0,y:T.y0},whileInView:{opacity:g?T.data.data.color&&n[o.indexOf(T.data.data.color)]===g?1:x:m.length!==0?m.indexOf(T.data.id)!==-1?.85:x:.85,x:T.x0,y:T.y0,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},onMouseEnter:Z=>{G(T.data.data),C(Z.clientY),X(Z.clientX),d?.(T.data.data)},onClick:()=>{(I||w)&&(_===T.data.id&&j?(b(void 0),I?.(void 0)):(b(T.data.id),I?.(T.data.data)))},onMouseMove:Z=>{G(T.data.data),C(Z.clientY),X(Z.clientX)},onMouseLeave:()=>{G(void 0),X(void 0),C(void 0),d?.(void 0)},children:[l.jsx($e.rect,{x:0,y:0,exit:{width:0,height:0,opacity:0,transition:{duration:D.duration}},variants:{initial:{width:0,height:0,fill:e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray},whileInView:{width:T.x1-T.x0,height:T.y1-T.y0,fill:e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial"}),T.x1-T.x0>50&&T.y1-T.y0>25&&(h||p)?l.jsx($e.g,{variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:l.jsx("foreignObject",{y:0,x:0,width:T.x1-T.x0,height:T.y1-T.y0,children:l.jsxs("div",{className:"flex flex-col gap-0.5 p-2 w-full",style:{color:yn(e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray)},children:[h?l.jsx(Ce.P,{marginBottom:"none",size:"sm",leading:"none",className:Ce.cn("w-full treemap-label",S==="ar"||S==="he"?"text-right":"text-left",W?.graphObjectValues),style:{WebkitLineClamp:T.y1-T.y0>50?T.y1-T.y0>100?T.y1-T.y0>150?void 0:3:2:1,display:"-webkit-box",WebkitBoxOrient:"vertical",overflow:"hidden",color:yn(e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray),...P?.graphObjectValues||{}},children:T.data.id}):null,p?l.jsx(Ce.P,{marginBottom:"none",size:"sm",leading:"none",className:Ce.cn("w-full font-bold treemap-value",S==="ar"||S==="he"?"text-right":"text-left",W?.graphObjectValues),style:{color:yn(e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray),...P?.graphObjectValues||{}},children:qe(T.data.value,"NA",$,v,y)}):null]})})}):null]},T.data.id))})})}),ae&&f&&B&&z?l.jsx(st,{data:ae,body:f,xPos:B,yPos:z,backgroundStyle:P?.tooltip,className:W?.tooltip}):null,w&&_!==void 0?l.jsx(Ce.Modal,{open:_!==void 0,onClose:()=>{b(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:lt(w,_)}:void 0,children:typeof w=="function"?w(_):null})}):null]})}function Md(t){const{data:e,graphTitle:n,colors:i,suffix:r="",sources:a,prefix:o="",graphDescription:s,leftMargin:c=0,rightMargin:u=0,topMargin:h=0,bottomMargin:f=0,height:d,width:g,footNote:p,colorDomain:y,colorLegendTitle:v,padding:m,backgroundColor:I=!1,showLabels:j=!0,relativeHeight:w,tooltip:S,onSeriesMouseOver:P,showColorScale:W=!0,showValues:D=!0,graphID:x,highlightedDataPoints:$=[],onSeriesMouseClick:V,graphDownload:q=!1,dataDownload:ae=!1,language:G="en",showNAColor:_=!0,minHeight:b=0,theme:B="light",ariaLabel:X,resetSelectionOnDoubleClick:z=!0,detailsOnClick:C,styles:A,classNames:M,animate:O=!1,dimmedOpacity:K=.3,precision:Q=2}=t,[se,T]=k.useState(0),[Z,ie]=k.useState(0),[ue,he]=k.useState(void 0),Y=k.useRef(null),ge=k.useRef(null);return k.useEffect(()=>{const oe=new ResizeObserver(ce=>{T(g||ce[0].target.clientWidth||620),ie(d||ce[0].target.clientHeight||480)});return Y.current&&(ie(Y.current.clientHeight||480),T(Y.current.clientWidth||620),g||oe.observe(Y.current)),()=>oe.disconnect()},[g,d]),l.jsx("div",{className:`${B||"light"} flex ${g?"w-fit grow-0":"w-full grow"}`,dir:G==="he"||G==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${G||"en"}`,M?.graphContainer),style:{...A?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:x,ref:ge,"aria-label":X||`${n?`The graph shows ${n}. `:""}This is a chart where data points are represented by squares, and their sizes reflect their values. ${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:I?m||"1rem":m||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||s||q||ae?l.jsx(Qe,{styles:{title:A?.title,description:A?.description},classNames:{title:M?.title,description:M?.description},graphTitle:n,graphDescription:s,width:g,graphDownload:q?ge.current:void 0,dataDownload:ae?e.map(oe=>oe.data).filter(oe=>oe!==void 0).length>0?e.map(oe=>oe.data).filter(oe=>oe!==void 0):e.filter(oe=>oe!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[W&&e.filter(oe=>oe.color).length!==0?l.jsx(tn,{width:g,colorLegendTitle:v,colors:i||Pe[B].categoricalColors.colors,colorDomain:y||Xe(e.filter(oe=>oe.color),"color").map(oe=>oe.color),setSelectedColor:he,showNAColor:_}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:Y,"aria-label":"Graph area",children:(g||se)&&(d||Z)?l.jsx(HP,{data:e.filter(oe=>!je(oe.size)),colors:e.filter(oe=>oe.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[B].categoricalColors.colors,colorDomain:e.filter(oe=>oe.color).length===0?[]:y||Xe(e.filter(oe=>oe.color),"color").map(oe=>oe.color),width:g||se,height:Math.max(b,d||(w?b?(g||se)*w>b?(g||se)*w:b:(g||se)*w:Z)),leftMargin:c,rightMargin:u,topMargin:h,bottomMargin:f,showLabels:j,showValues:D,suffix:r,prefix:o,selectedColor:ue,tooltip:S,onSeriesMouseOver:P,onSeriesMouseClick:V,highlightedDataPoints:$,resetSelectionOnDoubleClick:z,detailsOnClick:C,styles:A,classNames:M,language:G,animate:O===!0?{duration:.5,once:!0,amount:.5}:O||{duration:0,once:!0,amount:0},dimmedOpacity:K,precision:Q}):null})]})}),a||p?l.jsx(et,{styles:{footnote:A?.footnote,source:A?.source},classNames:{footnote:M?.footnote,source:M?.source},sources:a,footNote:p,width:g}):null]})})})})}function nw(t){const{data:e,size:n=200,graphTitle:i,sources:r,colors:a=Pe.light.categoricalColors.colors,graphDescription:o,totalNoOfDots:s=100,unitPadding:c=3,gridSize:u=10,footNote:h,padding:f,backgroundColor:d=!1,graphID:g,graphDownload:p=!1,language:y="en",showColorScale:v=!0,showStrokeForWhiteDots:m=!0,note:I,dataDownload:j=!1,theme:w="light",width:S,height:P,minHeight:W=0,relativeHeight:D,ariaLabel:x,styles:$,classNames:V,animate:q=!1,precision:ae=2}=t,G=k.useRef(null),_=q===!0?{duration:.5,once:!0,amount:.5}:q||{duration:0,once:!0,amount:0},b=ct(G,{once:_.once,amount:_.amount}),B=rt(e.map(M=>M.value)),X=k.useRef(null),z=n/u,C=(z-c*2)/2;if(C<=0)return console.error("The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0."),null;const A=[];return e.forEach((M,O)=>{const K=Math.round(M.value/B*s);for(let Q=0;Q<K;Q+=1)A.push({color:a[O]})}),l.jsx("div",{className:`${w||"light"} flex ${S?"w-fit grow-0":"w-full grow"}`,dir:y==="he"||y==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${d?d===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${y||"en"}`,V?.graphContainer),style:{...$?.graphContainer||{},minHeight:"inherit",...d&&d!==!0?{backgroundColor:d}:{}},id:g,ref:X,"aria-label":x||`${i?`The graph shows ${i}. `:""}${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:d?f||"1rem":f||0},children:l.jsxs("div",{className:"flex flex-col gap-3 w-full grow",children:[i||o||p?l.jsx(Qe,{styles:{title:$?.title,description:$?.description},classNames:{title:V?.title,description:V?.description},graphTitle:i,graphDescription:o,width:S,graphDownload:p?X.current:void 0,dataDownload:j?e.map(M=>M.data).filter(M=>M!==void 0).length>0?e.map(M=>M.data).filter(M=>M!==void 0):e.filter(M=>M!==void 0):null}):null,I?l.jsx(Ce.H2,{marginBottom:"2xs",className:"text-primary-gray-700 dark:text-primary-gray-100 font-bold",style:{width:S?`${S}px`:"100%"},children:I}):null,l.jsxs("div",{className:"flex grow flex-col gap-4 justify-between",children:[l.jsxs("div",{children:[v?l.jsx("div",{className:"mb-4 leading-0",style:{width:S?`${S}px`:"100%"},"aria-label":"Color legend",children:l.jsx("div",{className:"flex mb-0 flex-wrap gap-x-4 gap-y-1",children:e.map((M,O)=>l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:a[O]}}),l.jsxs(Ce.P,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[M.label,":"," ",l.jsx("span",{className:"font-bold",children:qe(M.value,"NA",ae)})]})]},O))})}):null,l.jsx("div",{"aria-label":"Graph area",children:l.jsx("svg",{width:`${S||n}px`,height:`${Math.max(W,P?D&&S?W?S*D>W?S*D:W:S*D:P:Math.floor((s-1)/u)*z+z/2+C+5)}px`,ref:G,direction:"ltr",viewBox:`0 0 ${S||n} ${Math.max(W,P?D&&S?W?S*D>W?S*D:W:S*D:P:Math.floor((s-1)/u)*z+z/2+C+5)}`,children:l.jsx(mt,{children:l.jsx("g",{children:A.map((M,O)=>l.jsx($e.circle,{cx:O%u*z+z/2,cy:Math.floor(O/u)*z+z/2,style:{...m?{}:{stroke:M.color},strokeWidth:1},variants:{initial:{fill:"#fff",opacity:0,...m?{}:{stroke:M.color},strokeWidth:1},whileInView:{fill:M.color,opacity:1,...m?{}:{stroke:M.color},strokeWidth:1,transition:{duration:0,delay:_.duration/A.length*O}}},initial:"initial",animate:b?"whileInView":"initial",className:(M.color.toLowerCase()==="#fff"||M.color.toLowerCase()==="#ffffff"||M.color.toLowerCase()==="white")&&m?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"",r:C},O))})})})})]}),r||h?l.jsx(et,{styles:{footnote:$?.footnote,source:$?.source},sources:r,footNote:h,width:S}):null]})]})})})})}function WP(t){const{data:e,showColumnLabels:n,leftMargin:i,rightMargin:r,truncateBy:a,width:o,height:s,topMargin:c,bottomMargin:u,tooltip:h,onSeriesMouseOver:f,suffix:d,prefix:g,showValues:p,colorDomain:y,colors:v,noDataColor:m,scaleType:I,showRowLabels:j,selectedColor:w,onSeriesMouseClick:S,resetSelectionOnDoubleClick:P,detailsOnClick:W,styles:D,classNames:x,animate:$,precision:V}=t,q=k.useRef(null),ae=ct(q,{once:$.once,amount:$.amount}),G={top:c,bottom:u,left:i,right:r},[_,b]=k.useState(void 0),[B,X]=k.useState(void 0),[z,C]=k.useState(void 0),[A,M]=k.useState(void 0),O=o-G.left-G.right,K=s-G.top-G.bottom,Q=Xe(e,Y=>Y.column).map(Y=>Y.column),se=Xe(e,Y=>Y.row).map(Y=>Y.row),T=xn().domain(se).range([0,K]),Z=T.bandwidth(),ie=xn().domain(Q).range([0,O]),ue=ie.bandwidth(),he=I==="categorical"?Xs().domain(y).range(v):I==="threshold"?Po().domain(y).range(v):ut().domain(y).range(v);return l.jsxs(l.Fragment,{children:[l.jsxs($e.svg,{width:`${o}px`,height:`${s}px`,viewBox:`0 0 ${o} ${s}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:q,children:[l.jsx("g",{transform:`translate(${G.left},0)`,children:n?Q.map((Y,ge)=>l.jsx(ro,{y:0,x:ie(Y),width:ue,height:G.top-5,value:`${Y}`.length<a?`${Y}`:`${`${Y}`.substring(0,a)}...`,style:D?.xAxis?.labels,className:x?.xAxis?.labels,alignment:"bottom",animate:{duration:0,once:!0,amount:0},isInView:ae},ge)):null}),l.jsx("g",{transform:`translate(0,${G.top})`,children:j?se.map((Y,ge)=>l.jsx(io,{value:`${Y}`.length<a?`${Y}`:`${`${Y}`.substring(0,a)}...`,y:T(Y),x:0,width:G.left,height:Z,alignment:"right",style:D?.yAxis?.labels,className:x?.yAxis?.labels,animate:{duration:0,once:!0,amount:0},isInView:ae},ge)):null}),l.jsxs("g",{transform:`translate(${G.left},${G.top})`,children:[se.map((Y,ge)=>l.jsx("g",{transform:`translate(0,${T(Y)})`,children:Q.map(oe=>l.jsx("rect",{x:ie(oe),y:0,width:ue,height:Z,style:{fill:m},className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700"},`${Y}-${oe}`))},ge)),e.filter(Y=>!je(Y.value)).map((Y,ge)=>{const oe=je(Y.value)?m:he(Y.value);return l.jsxs("g",{transform:`translate(${ie(Y.column)},${T(Y.row)})`,onMouseEnter:ce=>{X(Y),M(ce.clientY),C(ce.clientX),f?.(Y)},onClick:()=>{(S||W)&&(dt(_,Y)&&P?(b(void 0),S?.(void 0)):(b(Y),S?.(Y)))},onMouseMove:ce=>{X(Y),M(ce.clientY),C(ce.clientX)},onMouseLeave:()=>{X(void 0),C(void 0),M(void 0),f?.(void 0)},opacity:w?w===oe?1:.3:1,children:[l.jsx($e.rect,{x:0,y:0,width:ue,height:Z,className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700",exit:{opacity:0,transition:{duration:$.duration}},variants:{initial:{fill:oe,opacity:0},whileInView:{fill:oe,opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:ae?"whileInView":"initial"}),p&&!je(Y.value)?l.jsx($e.g,{variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:ae?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},children:l.jsx("foreignObject",{y:0,x:0,width:ue,height:Z,children:l.jsx("div",{className:"flex flex-col justify-center items-center h-inherit p-1",children:l.jsx("p",{className:Ce.cn("text-xs text-center m-0 leading-[1.25] graph-value",x?.graphObjectValues),style:{color:yn(oe),...D?.graphObjectValues||{}},children:qe(Y.value,"NA",V,g,d)})})},ge)}):null]},`${Y.column}-${Y.row}`)}),B?l.jsx("rect",{x:ie(B.column),y:T(B.row),width:ue,height:Z,style:{fill:"none",fillOpacity:0,strokeWidth:1.5},className:"stroke-primary-gray-700 dark:stroke-primary-gray-300"}):null]})]}),B&&h&&z&&A?l.jsx(st,{data:B,body:h,xPos:z,yPos:A,backgroundStyle:D?.tooltip,className:x?.tooltip}):null,W&&_!==void 0?l.jsx(Ce.Modal,{open:_!==void 0,onClose:()=>{b(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof W=="string"?{__html:lt(W,_)}:void 0,children:typeof W=="function"?W(_):null})}):null]})}function iw(t){const{colorLegendTitle:e,colorDomain:n,colors:i,width:r,className:a}=t;return l.jsxs("div",{className:Ce.cn("flex gap-0 flex-wrap justify-center leading-0",a),style:{maxWidth:r?`${r}px`:"none"},"aria-label":"Color legend",children:[e&&e!==""?l.jsx(Ce.P,{size:"sm",marginBottom:"2xs",className:"w-full text-center",children:e}):null,l.jsxs("div",{className:"flex gap-0 flex-wrap justify-center w-full min-w-[360px] leading-0",children:[l.jsx("div",{className:"h-4 mb-1 w-full min-w-[360px]",style:{background:`linear-gradient(90deg, ${i[0]} 0%, ${i[1]} 100%)`}}),l.jsxs("div",{className:"flex justify-between w-full min-w-[360px]",children:[l.jsx(Ce.P,{marginBottom:"none",size:"sm",children:qe(n[0],"NA",2,"","")}),l.jsx(Ce.P,{marginBottom:"none",size:"sm",children:qe(n[1],"NA",2,"","")})]})]})]})}function rw(t){const{colorLegendTitle:e,colorDomain:n,colors:i,setSelectedColor:r,width:a,naColor:o,className:s,showNAColor:c}=t,[u,h]=k.useState(void 0),f=o?320:360;return l.jsxs("div",{className:Ce.cn("flex flex-wrap gap-0 justify-center leading-0",s),style:{maxWidth:a?`${a}px`:"none"},"aria-label":"Color legend",children:[e&&e!==""?l.jsx(Ce.P,{size:"sm",marginBottom:"2xs",className:"w-full text-center",children:e}):null,l.jsx("svg",{width:"100%",viewBox:"0 0 360 30",style:{maxWidth:"360px"},direction:"ltr",children:l.jsxs("g",{children:[n.map((d,g)=>l.jsxs("g",{onMouseOver:()=>{h(i[g]),r(i[g])},onMouseLeave:()=>{h(void 0),r(void 0)},className:"cursor-pointer",children:[l.jsx("rect",{x:g*f/i.length+1,y:1,width:f/i.length-2,height:8,className:`stroke-1 ${u===i[g]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:i[g],...u!==i[g]?{stroke:i[g]}:{}}}),l.jsx("text",{x:(g+1)*f/i.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"middle"},children:qe(d,"NA",2,"","")})]},g)),l.jsx("g",{children:l.jsx("rect",{onMouseOver:()=>{h(i[n.length]),r(i[n.length])},onMouseLeave:()=>{h(void 0),r(void 0)},x:n.length*f/i.length+1,y:1,width:f/i.length-2,height:8,className:`cursor-pointer stroke-1 ${u===i[n.length]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:i[n.length],...u!==i[n.length]?{stroke:i[n.length]}:{}}})}),c?l.jsxs("g",{onMouseOver:()=>{h(o||"#D4D6D8"),r(o||"#D4D6D8")},onMouseLeave:()=>{h(void 0),r(void 0)},className:"cursor-pointer",children:[l.jsx("rect",{x:335,y:1,width:24,height:8,className:`stroke-1 ${u===o?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:o||"#D4D6D8",...u!==o?{stroke:o}:{},strokeWidth:1}}),l.jsx("text",{x:337.5,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},children:"NA"})]}):null]})})]})}function aw(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,showColumnLabels:o=!0,leftMargin:s=100,rightMargin:c=10,truncateBy:u=999,height:h,width:f,scaleType:d,colorDomain:g,footNote:p,colorLegendTitle:y,padding:v,backgroundColor:m=!1,topMargin:I=30,bottomMargin:j=10,tooltip:w,onSeriesMouseOver:S,suffix:P="",prefix:W="",showRowLabels:D=!0,relativeHeight:x,showValues:$,graphID:V,noDataColor:q=Pe.gray,showColorScale:ae=!0,onSeriesMouseClick:G,graphDownload:_=!1,dataDownload:b=!1,fillContainer:B=!0,language:X="en",showNAColor:z=!0,minHeight:C=0,theme:A="light",ariaLabel:M,resetSelectionOnDoubleClick:O=!0,detailsOnClick:K,styles:Q,classNames:se,animate:T=!1,precision:Z=2}=t,[ie,ue]=k.useState(0),[he,Y]=k.useState(0),[ge,oe]=k.useState(void 0),ce=k.useRef(null),N=k.useRef(null);k.useEffect(()=>{const ve=new ResizeObserver(J=>{ue(f||J[0].target.clientWidth||620),Y(h||J[0].target.clientHeight||480)});return ce.current&&(Y(ce.current.clientHeight||480),ue(ce.current.clientWidth||620),f||ve.observe(ce.current)),()=>ve.disconnect()},[f,h]);const U=d||(typeof g[0]=="string"?"categorical":g.length===2?"linear":"threshold");return l.jsx("div",{className:`${A||"light"} flex ${f?"grow-0":"grow"} ${B?"w-full":"w-fit"}`,dir:X==="he"||X==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${m?m===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${X||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...m&&m!==!0?{backgroundColor:m}:{}},id:V,ref:N,"aria-label":M||`${n?`The graph shows ${n}. `:""}This is a heatmap. ${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:m?v||"1rem":v||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||_||b?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:a,width:f,graphDownload:_?N.current:void 0,dataDownload:b?e.map(ve=>ve.data).filter(ve=>ve!==void 0).length>0?e.map(ve=>ve.data).filter(ve=>ve!==void 0):e.filter(ve=>ve!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[ae?U==="categorical"?l.jsx(tn,{width:B?void 0:f,colorLegendTitle:y,colors:i||(typeof g[0]=="string"?Pe[A].categoricalColors.colors:g.length===2?[Pe[A].sequentialColors.neutralColorsx09[0],Pe[A].sequentialColors.neutralColorsx09[8]]:Pe[A].sequentialColors[`neutralColorsx0${g.length+1}`]),colorDomain:g.map(ve=>`${ve}`),setSelectedColor:oe,showNAColor:z}):U==="threshold"?l.jsx(rw,{width:B?void 0:f,colorLegendTitle:y,colors:i||(typeof g[0]=="string"?Pe[A].categoricalColors.colors:g.length===2?[Pe[A].sequentialColors.neutralColorsx09[0],Pe[A].sequentialColors.neutralColorsx09[8]]:Pe[A].sequentialColors[`neutralColorsx0${g.length+1}`]),colorDomain:g,setSelectedColor:oe,naColor:q,showNAColor:z}):l.jsx(iw,{width:B?void 0:f,colorLegendTitle:y,colors:i||[Pe[A].sequentialColors.neutralColorsx09[0],Pe[A].sequentialColors.neutralColorsx09[8]],colorDomain:g}):null,l.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:ce,"aria-label":"Graph area",children:(f||ie)&&(h||he)?l.jsx(WP,{data:e,colorDomain:g,width:f||ie,colors:i||(typeof g[0]=="string"?Pe[A].categoricalColors.colors:g.length===2?[Pe[A].sequentialColors.neutralColorsx09[0],Pe[A].sequentialColors.neutralColorsx09[8]]:Pe[A].sequentialColors[`neutralColorsx0${g.length+1}`]),noDataColor:q,scaleType:U,height:Math.max(C,h||(x?C?(f||ie)*x>C?(f||ie)*x:C:(f||ie)*x:he)),showColumnLabels:o,leftMargin:s,rightMargin:c,topMargin:I,bottomMargin:j,selectedColor:ge,truncateBy:u,showRowLabels:D,tooltip:w,onSeriesMouseOver:S,showValues:$,suffix:P,prefix:W,onSeriesMouseClick:G,resetSelectionOnDoubleClick:O,detailsOnClick:K,styles:Q,classNames:se,animate:T===!0?{duration:.5,once:!0,amount:.5}:T||{duration:0,once:!0,amount:0},precision:Z}):null})]})}),r||p?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:r,footNote:p,width:f}):null]})})})})}const Xm=t=>t.map(i=>i||1).reduce((i,r)=>i+r,0);function ow(t){const{width:e,height:n,graphTitle:i,sources:r,graphDescription:a,footNote:o,graphID:s,data:c,columnData:u,onSeriesMouseClick:h,language:f="en",theme:d="light",ariaLabel:g,backgroundColor:p=!1,padding:y,resetSelectionOnDoubleClick:v=!0,styles:m,classNames:I,minWidth:j,naLabel:w="NA",precision:S=2}=t,[P,W]=k.useState(void 0),[D,x]=k.useState(void 0),[$,V]=k.useState("asc"),[q,ae]=k.useState(void 0),[G,_]=k.useState({}),[b,B]=k.useState(u.filter(C=>C.filterOptions&&C.filterOptions.length>0).map(C=>({id:C.columnId,option:C.filterOptions}))),[X,z]=k.useState(c);return k.useEffect(()=>{const C=[];c.forEach(A=>{let M=!0;b.forEach(O=>{if(typeof A[O.id]!="object"&&typeof A[O.id]!="function"&&typeof A[O.id]!="symbol")if(u[u.findIndex(K=>K.columnId===O.id)].separator){const K=A[O.id].split(u[u.findIndex(Q=>Q.columnId===O.id)].separator);Qa(K,O.option).length===0&&(M=!1)}else O.option.indexOf(A[O.id])===-1&&(M=!1)}),M&&C.push(A)}),z(P&&c?$==="asc"?tt(C,[P]):tt(C,[P]).reverse():C)},[P,$,c,b,u]),l.jsx("div",{className:`${d||"light"} flex ${e?"w-fit grow-0":"w-full grow"}`,dir:f==="he"||f==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${p?p===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${f||"en"} w-full`,I?.graphContainer),style:{...m?.graphContainer||{},...p&&p!==!0?{backgroundColor:p}:{}},id:s,"aria-label":g||`${i?`The graph shows ${i}. `:""}This is an data table. ${a?` ${a}`:""}`,children:l.jsxs("div",{className:"flex grow",style:{padding:p?y||"1rem":y||0},children:[l.jsxs("div",{className:"flex flex-col gap-3 w-full justify-between grow",children:[i||a?l.jsx(Qe,{styles:{title:m?.title,description:m?.description},classNames:{title:I?.title,description:I?.description},graphTitle:i,graphDescription:a,width:e}):null,l.jsx("div",{className:"grow flex flex-col justify-center",children:l.jsx("div",{className:"undp-scrollbar",style:{width:e?`${e}px`:"100%",height:n?`${n}px`:"auto"},children:l.jsx("div",{style:j?{minWidth:j}:void 0,children:c?l.jsxs("table",{className:"w-full",style:{borderCollapse:"collapse"},children:[l.jsx("thead",{className:"text-left bg-primary-gray-300 dark:bg-primary-gray-550",children:l.jsx("tr",{children:u?.map((C,A)=>l.jsx("th",{className:"text-primary-gray-700 dark:text-primary-gray-100 text-sm",style:{width:`calc(${100*(C.columnWidth||1)/Xm(u.map(M=>M.columnWidth||1))}%`},children:l.jsxs("div",{className:"flex gap-2 justify-between items-center p-4",children:[l.jsx(Ce.P,{size:"sm",marginBottom:"none",className:`w-fit grow text-${C.align||"left"} font-bold`,children:C.columnTitle||C.columnId}),C.sortable?l.jsx("button",{type:"button",className:"bg-transparent cursor-pointer p-0 m-0 border-0",onClick:()=>{P===C.columnId?($==="asc"&&V("desc"),$==="desc"&&W(void 0)):(W(C.columnId),V("asc"))},children:P===C.columnId?$==="asc"?l.jsx(ZA,{}):l.jsx(QA,{}):l.jsx(KA,{})}):null,C.filterOptions&&C.filterOptions.length?l.jsx("button",{type:"button",className:"bg-transparent cursor-pointer m-0 p-0 border-0",onClick:M=>{if(q===C.columnId)ae(void 0);else if(M.currentTarget){ae(C.columnId);const O=M.currentTarget.getBoundingClientRect();_({top:O.bottom+window.scrollY,left:O.left+window.scrollX-160<0?O.left+window.scrollX:O.left+window.scrollX-160,width:"10rem"})}},children:b[b.findIndex(M=>M.id===C.columnId)].option.length===C.filterOptions?.length?l.jsx(JA,{}):l.jsx(e2,{})}):null]})},A))})}),l.jsx("tbody",{children:X?.map((C,A)=>l.jsx("tr",{className:`cursor-${h?"pointer":"auto"} border-b border-b-primary-gray-400 dark:border-b-primary-gray-500 ${dt(D,C)?"bg-primary-gray-200 dark:bg-primary-gray-600":"bg-transparent"}`,style:C.rowStyle,onClick:()=>{h&&(dt(D,C)&&v?(x(void 0),h(void 0)):(x(C),h(C)))},children:u.map((M,O)=>l.jsx("td",{className:`text-primary-gray-700 dark:text-primary-gray-100 text-sm text-${M.align||"left"}`,style:{width:`calc(${100*(C.columnWidth||1)/Xm(u.map(K=>K.columnWidth||1))}%`},children:l.jsx("div",{className:`text-primary-gray-700 dark:text-primary-gray-100 flex p-4 ${M.align==="right"?"justify-end":M.align==="center"?"justify-center":"justify-start"}`,children:typeof C[M.columnId]=="number"?l.jsx(Ce.P,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${M.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${M.align||"left"} ${M.chip?M.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...M.chip&&M.chipColors?{backgroundColor:M.chipColors[M.chipColors.findIndex(K=>K.value===C[M.chipColumnId||M.columnId])].color,color:yn(M.chipColors[M.chipColors.findIndex(K=>K.value===C[M.chipColumnId||M.columnId])].color)}:{}},children:qe(C[M.columnId],w,S,M.prefix,M.suffix)}):typeof C[M.columnId]=="string"?M.separator?l.jsx("div",{className:"text-primary-gray-700 dark:text-primary-gray-100 flex flex-wrap gap-2",children:C[M.columnId].split(M.separator).map((K,Q)=>l.jsx(Ce.P,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${M.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${M.align||"left"} ${M.chip?M.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...M.chip&&M.chipColors?{backgroundColor:M.chipColors[M.chipColors.findIndex(se=>se.value===(M.chipColumnId?C[M.chipColumnId]:K))].color,color:yn(M.chipColors[M.chipColors.findIndex(se=>se.value===(M.chipColumnId?C[M.chipColumnId]:K))].color)}:{}},children:qe(K,w,S,M.prefix,M.suffix)},Q))}):l.jsx(Ce.P,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${M.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${M.align||"left"} ${M.chip?M.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...M.chip&&M.chipColors?{backgroundColor:M.chipColors[M.chipColors.findIndex(K=>K.value===C[M.chipColumnId||M.columnId])].color,color:yn(M.chipColors[M.chipColors.findIndex(K=>K.value===C[M.chipColumnId||M.columnId])].color)}:{}},children:qe(C[M.columnId],w,S,M.prefix,M.suffix)}):l.jsx("div",{children:qe(C[M.columnId],w,S,M.prefix,M.suffix)})})},O))},A))})]}):null})})}),r||o?l.jsx(et,{styles:{footnote:m?.footnote,source:m?.source},classNames:{footnote:I?.footnote,source:I?.source},sources:r,footNote:o,width:e}):null]}),q&&l.jsx("div",{style:G,className:"absolute p-3 border z-[1000] rounded-sm bg-primary-white dark:bg-primary-gray-700 border-primary-gray-300 dark:border-primary-gray-550",children:l.jsxs("div",{className:"max-w-60",children:[l.jsx(Ce.P,{size:"sm",marginBottom:"2xs",className:"font-bold",children:"Filter data by"}),l.jsx("div",{className:"flex flex-col gap-2",children:u[u.findIndex(C=>C.columnId===q)].filterOptions?.map((C,A)=>l.jsx("div",{children:l.jsxs("label",{className:"undp-viz-label",children:[l.jsx("input",{type:"checkbox",className:"undp-viz-checkbox",checked:b[b.findIndex(M=>M.id===q)].option.indexOf(C)!==-1,onChange:()=>{const M=b.findIndex(K=>K.id===q),O=[...b[M].option];if(O.indexOf(C)!==-1){O.splice(O.indexOf(C),1);const K=[...b];K[M].option=O,B(K)}else{O.push(C);const K=[...b];K[M].option=O,B(K)}}}),C]},A)},A))})]})})]})})})}const zP=t=>t?Object.entries(t).map(([n,i])=>Array.isArray(i)?{" ":n,value:`"${i.join("; ")}"`}:{" ":n,value:`"${i}"`}):{};function GP(t){const{width:e,height:n,data:i,onSeriesMouseClick:r,cardTemplate:a,cardBackgroundColor:o,cardMinWidth:s=320,detailsOnClick:c,noOfItemsInAPage:u,styles:h,classNames:f,page:d,allowDataDownloadOnDetail:g}=t,[p,y]=k.useState(void 0);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"undp-scrollbar w-full my-0 mx-auto grid gap-4 undp-viz-data-cards-container",style:{width:e?`${e}px`:"100%",height:n?`${n}px`:"auto",gridTemplateColumns:`repeat(auto-fill, minmax(${s}px, 1fr))`},children:i.filter((v,m)=>u?m<d*u&&m>=(d-1)*u:!0).map((v,m)=>l.jsx("div",{style:{...h?.dataCards||{},...o&&{backgroundColor:o}},className:`w-full flex flex-col ${r||c?"cursor-pointer":"cursor-auto"}${o?"":"bg-primary-gray-200 dark:bg-primary-gray-600"} ${f?.dataCards||""}`,onClick:()=>{r?.(v),y(v)},dangerouslySetInnerHTML:typeof a=="string"?{__html:lt(a,v)}:void 0,children:typeof a=="function"?a(v):null},m))}),c&&p!==void 0?l.jsxs(Ce.Modal,{open:p!==void 0,onClose:()=>{y(void 0)},children:[l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof c=="string"?{__html:lt(c,p)}:void 0,children:typeof c=="function"?c(p):null}),g?l.jsx("div",{className:"flex",children:l.jsx(Hf,{csvData:zP(p),headers:[{label:" ",key:" "},{label:"value",key:"value"}],buttonContent:l.jsxs("div",{className:"flex items-center gap-4",children:[typeof g=="string"?g:null,l.jsx(Bf,{})]})})}):null]}):null]})}function Kr(t){if(t!==void 0)return Array.isArray(t)?t.map(e=>({value:e,label:e})):{value:t,label:t}}const YP=(t,e,n)=>e.length===0?t:t.filter(i=>e.some(r=>i[r]?.toLowerCase().includes(n.toLowerCase())));function sw(t){const{width:e,height:n,graphTitle:i,sources:r,graphDescription:a,footNote:o,graphID:s,data:c,onSeriesMouseClick:u,language:h="en",theme:f="light",ariaLabel:d,cardTemplate:g,cardBackgroundColor:p,cardFilters:y,cardSortingOptions:v,cardSearchColumns:m,cardMinWidth:I=320,backgroundColor:j=!1,padding:w,detailsOnClick:S,allowDataDownloadOnDetail:P=!1,noOfItemsInAPage:W,uiMode:D="normal",styles:x,classNames:$}=t,[V,q]=k.useState(c),[ae,G]=k.useState(1),[_,b]=k.useState(""),B=k.useMemo(()=>(y||[]).map(O=>({filter:O.column,label:O.label||`Filter by ${O.column}`,singleSelect:!0,clearable:!0,defaultValue:Kr(O.defaultValue),availableValues:jr(c,O.column).filter(K=>!O.excludeValues?.includes(`${K}`)).map(K=>({value:K,label:K})),width:O.width})),[y,c]),[X,z]=k.useState((y||[]).map(O=>({filter:O.column,value:Kr(O.defaultValue)}))),[C,A]=k.useState(v?!v.defaultValue||v.options.findIndex(O=>O.label===v.defaultValue)===-1?v.options[0]:v.options[v.options.findIndex(O=>O.label===v.defaultValue)]:void 0),M=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]);return k.useEffect(()=>{A(v?!v.defaultValue||v.options.findIndex(O=>O.label===v.defaultValue)===-1?v.options[0]:v.options[v.options.findIndex(O=>O.label===v.defaultValue)]:void 0)},[v]),k.useEffect(()=>{const O=YP(c,m||[],_).filter(K=>X.every(Q=>Q.value&&hn([Q.value]).length>0?Qa(hn([K[Q.filter]]),hn([Q.value]).map(se=>se.value)).length>0:!0));q(C?tt(O,C?.value,C?.type):O)},[c,m,_,X,C]),k.useEffect(()=>{G(1)},[V]),l.jsx("div",{className:`${f||"light"} flex ${e?"w-fit grow-0":"w-full grow"}`,dir:h==="he"||h==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${j?j===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${h||"en"}`,$?.graphContainer),style:{...x?.graphContainer||{},...j&&j!==!0?{backgroundColor:j}:{}},id:s,"aria-label":d||`${i?`The graph shows ${i}. `:""}This is an list of cards. ${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:j?w||"1rem":w||0},children:l.jsxs("div",{className:"flex flex-col grow gap-3 w-full justify-between",children:[i||a?l.jsx(Qe,{styles:{title:x?.title,description:x?.description},classNames:{title:$?.title,description:$?.description},graphTitle:i,graphDescription:a,width:e}):null,v||B.length>0?l.jsxs("div",{className:"flex gap-4 flex-wrap items-start w-full",children:[v?l.jsxs("div",{className:"grow shrink-0 min-w-[240px]",style:{width:v.width||"calc(25% - 0.75rem)"},children:[l.jsx(Ce.P,{marginBottom:"xs",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:"Sort by"}),l.jsx(Ce.DropdownSelect,{options:v.options,isRtl:h==="he"||h==="ar",isSearchable:!0,filterOption:Ce.createFilter(M),onChange:O=>{A(O||void 0)},variant:D,size:"sm",defaultValue:!v.defaultValue||v.options.findIndex(O=>O.label===v.defaultValue)===-1?v.options[0]:v.options[v.options.findIndex(O=>O.label===v.defaultValue)]})]}):null,B?.map((O,K)=>l.jsxs("div",{className:"grow shrink-0 min-w-[240px]",style:{width:O.width||"calc(25% - 0.75rem)"},children:[l.jsx(Ce.P,{marginBottom:"xs",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:O.label}),l.jsx(Ce.DropdownSelect,{options:O.availableValues,isClearable:O.clearable===void 0?!0:O.clearable,isRtl:h==="he"||h==="ar",isSearchable:!0,variant:D,size:"sm",controlShouldRenderValue:!0,filterOption:Ce.createFilter(M),onChange:Q=>{z(se=>se.map(T=>T.filter===O.filter?{...T,value:Q}:T))},defaultValue:O.defaultValue})]},K))]}):null,(m||[]).length>0?l.jsx("div",{style:{paddingTop:"1px"},children:l.jsx(Ce.Search,{placeholder:"Search...",onSearch:O=>{b(O||"")},buttonVariant:"icon",inputVariant:D,showSearchButton:!1,inputSize:"sm"})}):null,l.jsx(GP,{data:V,width:e,height:n,cardTemplate:g,cardMinWidth:I,page:ae,cardBackgroundColor:p,styles:x,classNames:$,noOfItemsInAPage:W,detailsOnClick:S,onSeriesMouseClick:u,allowDataDownloadOnDetail:P}),W?l.jsx(Ce.Pagination,{total:V.length,defaultPage:0,pageSize:W,onChange:G}):null,r||o?l.jsx(et,{styles:{footnote:x?.footnote,source:x?.source},classNames:{footnote:$?.footnote,source:$?.source},sources:r,footNote:o,width:e}):null]})})})})}function lw(t,e){if(t<2)return[];const n=e/(t-1);return Array.from({length:t},(i,r)=>r*n)}function qP(t){const{data:e,width:n,height:i,colors:r,colorDomain:a,radius:o,leftMargin:s,rightMargin:c,topMargin:u,bottomMargin:h,tooltip:f,onSeriesMouseOver:d,highlightedDataPoints:g,selectedColor:p,minValue:y,maxValue:v,onSeriesMouseClick:m,prefix:I,suffix:j,stripType:w,highlightColor:S,dotOpacity:P,resetSelectionOnDoubleClick:W,detailsOnClick:D,styles:x,classNames:$,valueColor:V,animate:q,noOfTicks:ae,dimmedOpacity:G,precision:_,customLayers:b}=t,B=k.useRef(null),X=ct(B,{once:q.once,amount:q.amount}),[z,C]=k.useState(void 0),[A,M]=k.useState(void 0),[O,K]=k.useState(void 0),[Q,se]=k.useState(void 0),T={top:u,bottom:h,left:s,right:c},Z=n-T.left-T.right,ie=i-T.top-T.bottom,ue=e.map((N,U)=>({...N,id:`${U}`})),he=tt(ue,N=>{const U=(g||[]).indexOf(N.label);return U===-1?1/0:U}).reverse(),Y=je(v)?Math.max(...e.filter(N=>!je(N.position)).map(N=>N.position))<0?0:Math.max(...e.filter(N=>!je(N.position)).map(N=>N.position)):v,ge=je(y)?Math.min(...e.filter(N=>!je(N.position)).map(N=>N.position))>=0?0:Math.min(...e.filter(N=>!je(N.position)).map(N=>N.position)):y,oe=ut().domain([ge,Y]).range([0,Z]).nice(),ce=lw(ae,Z);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:B,children:l.jsxs("g",{transform:`translate(${T.left},${T.top})`,children:[b.filter(N=>N.position==="before").map(N=>N.layer),l.jsxs(mt,{children:[he.map(N=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:oe(0),y:ie/2},whileInView:{x:oe(N.position),y:ie/2,opacity:p?N.color&&r[a.indexOf(N.color)]===p?.95:G:g.length!==0?g.indexOf(N.label)!==-1?.95:G:P,transition:{duration:q.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},onMouseEnter:U=>{C(N),se(U.clientY),K(U.clientX),d?.(N)},onClick:()=>{(m||D)&&(dt(A,N)&&W?(M(void 0),m?.(void 0)):(M(N),m?.(N)))},onMouseMove:U=>{C(N),se(U.clientY),K(U.clientX)},onMouseLeave:()=>{C(void 0),K(void 0),se(void 0),d?.(void 0)},children:[w==="dot"?l.jsx($e.circle,{cy:0,cx:0,variants:{initial:{fill:S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray},whileInView:{fill:S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray,transition:{duration:q.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},r:o}):l.jsx($e.rect,{y:0-o,x:-1,height:o*2,width:2,variants:{initial:{fill:S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray},whileInView:{fill:S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray,transition:{duration:q.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}}}),g.length!==0&&g.indexOf(N.label)!==-1?l.jsx($e.text,{x:0,y:0-o-5,variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},style:{fill:V||(S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray),textAnchor:"middle",...x?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm font-bold",$?.graphObjectValues),children:qe(N.position,"NA",_,I,j)}):null]},N.label)),ce.map((N,U)=>l.jsx("text",{x:N,y:ie/2+o,style:{textAnchor:U===0?"start":U===ce.length-1?"end":"middle",...x?.xAxis?.labels||{}},className:Ce.cn("fill-primary-gray-550 dark:fill-primary-gray-500 text-xs",$?.xAxis?.labels),dy:"1em",children:qe(oe.invert(N),"NA",_,I,j)},U))]}),b.filter(N=>N.position==="after").map(N=>N.layer)]})}),z&&f&&O&&Q?l.jsx(st,{data:z,body:f,xPos:O,yPos:Q,backgroundStyle:x?.tooltip,className:$?.tooltip}):null,D&&A!==void 0?l.jsx(Ce.Modal,{open:A!==void 0,onClose:()=>{M(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof D=="string"?{__html:lt(D,A)}:void 0,children:typeof D=="function"?D(A):null})}):null]})}function UP(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f=5,padding:d,backgroundColor:g=!1,leftMargin:p=5,rightMargin:y=5,topMargin:v=10,bottomMargin:m=10,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S=!0,highlightedDataPoints:P=[],graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,graphDownload:V=!1,dataDownload:q=!1,prefix:ae="",suffix:G="",stripType:_="dot",language:b="en",highlightColor:B,dotOpacity:X=.3,showNAColor:z=!0,minHeight:C=0,theme:A="light",ariaLabel:M,resetSelectionOnDoubleClick:O=!0,detailsOnClick:K,styles:Q,classNames:se,valueColor:T,animate:Z=!1,noOfTicks:ie=2,dimmedOpacity:ue=.3,precision:he=2,customLayers:Y=[]}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(void 0),J=k.useRef(null),R=k.useRef(null);return k.useEffect(()=>{const le=new ResizeObserver(ee=>{oe(s||ee[0].target.clientWidth||620),N(o||ee[0].target.clientHeight||480)});return J.current&&(N(J.current.clientHeight||480),oe(J.current.clientWidth||620),s||le.observe(J.current)),()=>le.disconnect()},[s,o]),l.jsx("div",{className:`${A||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:b==="he"||b==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${b||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:W,ref:R,"aria-label":M||`${n?`The graph shows ${n}. `:""}This is a strip chart showing distribution of data along the horizontal axis. Each dot represents an individual data point, helping to visualize the spread and clustering of values.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:g?d||"1rem":d||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||V||q?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:a,width:s,graphDownload:V?R.current:void 0,dataDownload:q?e.map(le=>le.data).filter(le=>le!==void 0).length>0?e.map(le=>le.data).filter(le=>le!==void 0):e.filter(le=>le!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[S!==!1&&e.filter(le=>le.color).length!==0?l.jsx(tn,{width:s,colorLegendTitle:h,colors:i||Pe[A].categoricalColors.colors,colorDomain:u||Xe(e.filter(le=>le.color),"color").map(le=>le.color),setSelectedColor:ve,showNAColor:z??!0}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:J,"aria-label":"Graph area",children:(s||ge)&&(o||ce)?l.jsx(qP,{data:e,width:s||ge,height:Math.max(C,o||(j?C?(s||ge)*j>C?(s||ge)*j:C:(s||ge)*j:ce)),colorDomain:e.filter(le=>le.color).length===0?[]:u||Xe(e.filter(le=>le.color),"color").map(le=>le.color),colors:e.filter(le=>le.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[A].categoricalColors.colors,selectedColor:U,radius:f,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,onSeriesMouseOver:w,highlightedDataPoints:P,minValue:D,maxValue:x,onSeriesMouseClick:$,prefix:ae,suffix:G,stripType:_,highlightColor:B,dotOpacity:X,resetSelectionOnDoubleClick:O,detailsOnClick:K,styles:Q,classNames:se,valueColor:T,animate:Z===!0?{duration:.5,once:!0,amount:.5}:Z||{duration:0,once:!0,amount:0},noOfTicks:ie,dimmedOpacity:ue,precision:he,customLayers:Y}):null})]})}),r||c?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:r,footNote:c,width:s}):null]})})})})}function XP(t){const{data:e,width:n,height:i,colors:r,colorDomain:a,radius:o,leftMargin:s,rightMargin:c,topMargin:u,bottomMargin:h,tooltip:f,onSeriesMouseOver:d,highlightedDataPoints:g,selectedColor:p,minValue:y,maxValue:v,onSeriesMouseClick:m,noOfTicks:I,prefix:j,suffix:w,stripType:S,highlightColor:P,dotOpacity:W,resetSelectionOnDoubleClick:D,detailsOnClick:x,styles:$,classNames:V,valueColor:q,animate:ae,dimmedOpacity:G,precision:_,customLayers:b}=t,B=k.useRef(null),X=ct(B,{once:ae.once,amount:ae.amount}),[z,C]=k.useState(void 0),[A,M]=k.useState(void 0),[O,K]=k.useState(void 0),[Q,se]=k.useState(void 0),T={top:u,bottom:h,left:s,right:c},Z=n-T.left-T.right,ie=i-T.top-T.bottom,ue=e.map((N,U)=>({...N,id:`${U}`})),he=tt(ue,N=>{const U=(g||[]).indexOf(N.label);return U===-1?1/0:U}).reverse(),Y=je(v)?Math.max(...e.filter(N=>!je(N.position)).map(N=>N.position))<0?0:Math.max(...e.filter(N=>!je(N.position)).map(N=>N.position)):v,ge=je(y)?Math.min(...e.filter(N=>!je(N.position)).map(N=>N.position))>=0?0:Math.min(...e.filter(N=>!je(N.position)).map(N=>N.position)):y,oe=ut().domain([ge,Y]).range([ie,0]).nice(),ce=lw(I,ie);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:B,children:l.jsxs("g",{transform:`translate(${T.left},${T.top})`,children:[b.filter(N=>N.position==="before").map(N=>N.layer),l.jsxs(mt,{children:[he.map(N=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:Z/2,y:oe(0)},whileInView:{x:Z/2,y:oe(N.position),opacity:p?N.color&&r[a.indexOf(N.color)]===p?.95:G:g.length!==0?g.indexOf(N.label)!==-1?.95:G:W,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:ae.duration}},onMouseEnter:U=>{C(N),se(U.clientY),K(U.clientX),d?.(N)},onClick:()=>{(m||x)&&(dt(A,N)&&D?(M(void 0),m?.(void 0)):(M(N),m?.(N)))},onMouseMove:U=>{C(N),se(U.clientY),K(U.clientX)},onMouseLeave:()=>{C(void 0),K(void 0),se(void 0),d?.(void 0)},children:[S==="dot"?l.jsx($e.circle,{cy:0,cx:0,variants:{initial:{fill:P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray},whileInView:{fill:P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:ae.duration}},r:o}):l.jsx($e.rect,{x:0-o,y:-1,width:o*2,height:2,variants:{initial:{fill:P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray},whileInView:{fill:P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:ae.duration}}}),g.length!==0&&g.indexOf(N.label)!==-1?l.jsx($e.text,{y:0,dy:"0.33em",x:0+o+3,variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:ae.duration}},style:{fill:q||(P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray),textAnchor:"start",...$?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm font-bold",V?.graphObjectValues),children:qe(N.position,"NA",_,j,w)}):null]},N.label)),ce.map((N,U)=>l.jsx("text",{y:N,x:Z/2+o+5,style:{textAnchor:"start",...$?.yAxis?.labels||{}},className:Ce.cn("fill-primary-gray-550 dark:fill-primary-gray-500 text-xs",V?.yAxis?.labels),children:qe(oe.invert(N),"NA",_,j,w)},U))]}),b.filter(N=>N.position==="after").map(N=>N.layer)]})}),z&&f&&O&&Q?l.jsx(st,{data:z,body:f,xPos:O,yPos:Q,backgroundStyle:$?.tooltip,className:V?.tooltip}):null,x&&A!==void 0?l.jsx(Ce.Modal,{open:A!==void 0,onClose:()=>{M(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof x=="string"?{__html:lt(x,A)}:void 0,children:typeof x=="function"?x(A):null})}):null]})}function KP(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f=5,padding:d,backgroundColor:g=!1,leftMargin:p=20,rightMargin:y=20,topMargin:v=10,bottomMargin:m=10,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S=!0,highlightedDataPoints:P=[],graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,graphDownload:V=!1,dataDownload:q=!1,prefix:ae="",suffix:G="",stripType:_="dot",language:b="en",highlightColor:B,dotOpacity:X=.3,showNAColor:z=!0,minHeight:C=0,theme:A="light",ariaLabel:M,resetSelectionOnDoubleClick:O=!0,detailsOnClick:K,styles:Q,classNames:se,valueColor:T,animate:Z=!1,noOfTicks:ie=2,dimmedOpacity:ue=.3,precision:he=2,customLayers:Y=[]}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(void 0),J=k.useRef(null),R=k.useRef(null);return k.useEffect(()=>{const le=new ResizeObserver(ee=>{oe(s||ee[0].target.clientWidth||620),N(o||ee[0].target.clientHeight||480)});return J.current&&(N(J.current.clientHeight||480),oe(J.current.clientWidth||620),s||le.observe(J.current)),()=>le.disconnect()},[s,o]),l.jsx("div",{className:`${A||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:b==="he"||b==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${b||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:W,ref:R,"aria-label":M||`${n?`The graph shows ${n}. `:""}This is a strip chart showing distribution of data along the vertical axis. Each dot represents an individual data point, helping to visualize the spread and clustering of values.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:g?d||"1rem":d||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||V||q?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:a,width:s,graphDownload:V?R.current:void 0,dataDownload:q?e.map(le=>le.data).filter(le=>le!==void 0).length>0?e.map(le=>le.data).filter(le=>le!==void 0):e.filter(le=>le!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[S!==!1&&e.filter(le=>le.color).length!==0?l.jsx(tn,{width:s,colorLegendTitle:h,colors:i||Pe[A].categoricalColors.colors,colorDomain:u||Xe(e.filter(le=>le.color),"color").map(le=>le.color),setSelectedColor:ve,showNAColor:z}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:J,children:(s||ge)&&(o||ce)?l.jsx(XP,{data:e,width:s||ge,height:Math.max(C,o||(j?C?(s||ge)*j>C?(s||ge)*j:C:(s||ge)*j:ce)),colorDomain:e.filter(le=>le.color).length===0?[]:u||Xe(e.filter(le=>le.color),"color").map(le=>le.color),colors:e.filter(le=>le.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[A].categoricalColors.colors,selectedColor:U,radius:f,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,onSeriesMouseOver:w,highlightedDataPoints:P,minValue:D,maxValue:x,onSeriesMouseClick:$,prefix:ae,suffix:G,stripType:_,highlightColor:B,dotOpacity:X,resetSelectionOnDoubleClick:O,detailsOnClick:K,styles:Q,classNames:se,valueColor:T,animate:Z===!0?{duration:.5,once:!0,amount:.5}:Z||{duration:0,once:!0,amount:0},noOfTicks:ie,dimmedOpacity:ue,precision:he,customLayers:Y}):null})]})}),r||c?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:r,footNote:c,width:s}):null]})})})})}function cw(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f,padding:d,backgroundColor:g,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S,highlightedDataPoints:P,graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,noOfTicks:V,graphDownload:q,dataDownload:ae,prefix:G,suffix:_,stripType:b,language:B,highlightColor:X,dotOpacity:z,showNAColor:C,minHeight:A,theme:M,ariaLabel:O,valueColor:K,resetSelectionOnDoubleClick:Q,detailsOnClick:se,orientation:T="vertical",styles:Z,classNames:ie,animate:ue,dimmedOpacity:he=.3,precision:Y,customLayers:ge}=t;return T==="vertical"?l.jsx(KP,{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f,padding:d,backgroundColor:g,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S,highlightedDataPoints:P,graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,noOfTicks:V,graphDownload:q,dataDownload:ae,prefix:G,suffix:_,stripType:b,language:B,highlightColor:X,dotOpacity:z,showNAColor:C,minHeight:A,theme:M,ariaLabel:O,resetSelectionOnDoubleClick:Q,styles:Z,valueColor:K,detailsOnClick:se,classNames:ie,animate:ue,dimmedOpacity:he,precision:Y,customLayers:ge}):l.jsx(UP,{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f,padding:d,backgroundColor:g,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S,highlightedDataPoints:P,graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,noOfTicks:V,graphDownload:q,dataDownload:ae,prefix:G,suffix:_,stripType:b,language:B,highlightColor:X,dotOpacity:z,showNAColor:C,minHeight:A,theme:M,ariaLabel:O,resetSelectionOnDoubleClick:Q,styles:Z,valueColor:K,detailsOnClick:se,classNames:ie,animate:ue,dimmedOpacity:he,precision:Y,customLayers:ge})}function QP(t){const{data:e,width:n,height:i,barColor:r,lineColor:a,axisTitles:o,sameAxes:s,rightMargin:c,leftMargin:u,topMargin:h,bottomMargin:f,tooltip:d,showValues:g,onSeriesMouseOver:p,barPadding:y,truncateBy:v,showLabels:m,onSeriesMouseClick:I,resetSelectionOnDoubleClick:j,detailsOnClick:w,noOfTicks:S,lineSuffix:P,barSuffix:W,linePrefix:D,barPrefix:x,curveType:$,styles:V,classNames:q,animate:ae,precision:G,customLayers:_,naLabel:b}=t,B=k.useRef(null),X=ct(B,{once:ae.once,amount:ae.amount}),z=$==="linear"?Oi:$==="step"?Or:$==="stepAfter"?Ir:$==="stepBefore"?Nr:_r,[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z={top:h,bottom:f,left:u+50,right:c+65},ie=n-Z.left-Z.right,ue=i-Z.top-Z.bottom,he=e.map((te,Me)=>({...te,id:`${Me}`})),Y=xn().domain(he.map(te=>`${te.id}`)).range([0,ie]).paddingInner(y),ge=Math.min(...he.map(te=>te.bar).filter(te=>te!=null))!==1/0?Math.min(...he.map(te=>te.bar).filter(te=>te!=null))>0?0:Math.min(...he.map(te=>te.bar).filter(te=>te!=null)):0,oe=Math.min(...he.map(te=>te.line).filter(te=>te!=null))!==1/0?Math.min(...he.map(te=>te.line).filter(te=>te!=null))>0?0:Math.min(...he.map(te=>te.line).filter(te=>te!=null)):0,ce=Math.max(...he.map(te=>te.bar).filter(te=>te!=null))!==1/0?Math.max(...he.map(te=>te.bar).filter(te=>te!=null)):0,N=Math.max(...he.map(te=>te.line).filter(te=>te!=null))!==1/0?Math.max(...he.map(te=>te.line).filter(te=>te!=null)):0,U=ge<oe?ge:oe,ve=ce>N?ce:N,J=ut().domain([s?U:ge,s?ve>0?ve:0:ce>0?ce:0]).range([ue,0]).nice(),R=ut().domain([s?U:oe,s?ve>0?ve:0:N>0?N:0]).range([ue,0]).nice(),le=ii().defined(te=>!je(te.line)).x(te=>Y(`${te.id}`)+Y.bandwidth()/2).y(te=>R(te.line)).curve(z),ee=J.ticks(S),de=R.ticks(S);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:B,children:l.jsxs("g",{transform:`translate(${Z.left},${Z.top})`,children:[l.jsxs("g",{children:[ee.map((te,Me)=>l.jsxs("g",{children:[l.jsx("line",{y1:J(te),y2:J(te),x1:-15,x2:-20,style:{stroke:r,strokeWidth:1,...V?.yAxis?.gridLines||{}},className:q?.yAxis?.gridLines}),l.jsx("text",{x:-25,y:J(te),dy:"0.33em",className:Ce.cn("text-xs",q?.yAxis?.labels),style:{textAnchor:"end",fill:r,...V?.yAxis?.labels||{}},children:qe(te,b,G,x,W)})]},Me)),l.jsx(Dt,{y1:0,y2:ue,x1:-15,x2:-15,classNames:{axis:q?.xAxis?.axis},styles:{axis:{stroke:r,...V?.xAxis?.axis||{}}}}),l.jsx(Nt,{x:10-Z.left,y:ue/2,style:{fill:r,...V?.yAxis?.title||{}},className:q?.yAxis?.title,text:o[0].length>100?`${o[0].substring(0,100)}...`:o[0],rotate90:!0})]}),l.jsxs("g",{children:[de.map((te,Me)=>l.jsxs("g",{children:[l.jsx("line",{y1:R(te),y2:R(te),x1:ie+15,x2:ie+20,style:{stroke:a,strokeWidth:1,...V?.yAxis?.gridLines||{}},className:q?.yAxis?.gridLines}),l.jsx("text",{x:ie+25,y:R(te),dy:"0.33em",dx:-2,style:{textAnchor:"start",fill:a,...V?.yAxis?.labels||{}},className:Ce.cn("text-xs",q?.yAxis?.labels),children:qe(te,b,G,D,P)})]},Me)),l.jsx(Dt,{y1:0,y2:ue,x1:ie+15,x2:ie+15,classNames:{axis:q?.xAxis?.axis},styles:{axis:{stroke:a,...V?.xAxis?.axis||{}}}}),l.jsx(Nt,{x:ie+Z.right-15,y:ue/2,style:{fill:a,...V?.yAxis?.title||{}},className:q?.yAxis?.title,text:o[1].length>100?`${o[1].substring(0,100)}...`:o[1],rotate90:!0})]}),l.jsx(Dt,{y1:s?J(0):ue,y2:s?J(0):ue,x1:-15,x2:ie+15,classNames:{axis:q?.xAxis?.axis},styles:{axis:V?.xAxis?.axis}}),_.filter(te=>te.position==="before").map(te=>te.layer),l.jsxs(mt,{children:[he.map((te,Me)=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:be=>{A(te),T(be.clientY),Q(be.clientX),p?.(te)},onClick:()=>{(I||w)&&(dt(M,te)&&j?(O(void 0),I?.(void 0)):(O(te),I?.(te)))},onMouseMove:be=>{A(te),T(be.clientY),Q(be.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),p?.(void 0)},children:[l.jsx($e.rect,{variants:{initial:{attrY:J(0),height:0,opacity:1},whileInView:{attrY:te.bar?te.bar>0?J(te.bar):J(0):0,height:te.bar?Math.abs(J(te.bar)-J(0)):0,opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{attrY:J(0),height:0,opacity:0,transition:{duration:ae.duration}},x:Y(`${Me}`),width:Y.bandwidth(),style:{fill:r}}),g&&!je(te.bar)?l.jsx($e.text,{x:Y(`${te.id}`)+Y.bandwidth()/2,exit:{attrY:J(0),opacity:0,transition:{duration:ae.duration}},variants:{initial:{attrY:J(0),opacity:0},whileInView:{attrY:J(te.bar||0),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",style:{fill:r,textAnchor:"middle",...V?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",q?.graphObjectValues),dy:te.bar?te.bar>=0?"-5px":"1em":"-5px",children:qe(te.bar,b,G,x,W)}):null,m?l.jsx(ro,{value:`${te.label}`.length<v?`${te.label}`:`${`${te.label}`.substring(0,v)}...`,y:ue+5,x:Y(`${te.id}`),width:Y.bandwidth(),height:Z.bottom,style:V?.xAxis?.labels,className:q?.xAxis?.labels,alignment:"top",animate:ae,isInView:X}):null]},te.label)),l.jsx($e.path,{exit:{opacity:0,transition:{duration:ae.duration}},variants:{initial:{d:le(he.map(te=>({...te,line:0}))),opacity:0},whileInView:{d:le(he),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",style:{stroke:a,fill:"none",strokeWidth:2}}),he.map((te,Me)=>l.jsx("g",{children:je(te.line)?null:l.jsxs("g",{onMouseEnter:be=>{A(te),T(be.clientY),Q(be.clientX),p?.(te)},onClick:()=>{(I||w)&&(dt(M,te)&&j?(O(void 0),I?.(void 0)):(O(te),I?.(te)))},onMouseMove:be=>{A(te),T(be.clientY),Q(be.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),p?.(void 0)},children:[l.jsx($e.circle,{exit:{cy:R(0),opacity:0,transition:{duration:ae.duration}},variants:{initial:{cy:R(0),opacity:0},whileInView:{cy:R(te.line),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",cx:Y(te.id)+Y.bandwidth()/2,r:ie/he.length<5?0:ie/he.length<20?2:4,style:{fill:a}}),g?l.jsx($e.text,{x:Y(`${te.id}`)+Y.bandwidth()/2,exit:{y:R(0),opacity:0,transition:{duration:ae.duration}},style:{fill:a,textAnchor:"middle",...V?.graphObjectValues||{}},variants:{initial:{y:R(0),opacity:0},whileInView:{y:R(te.line),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",className:Ce.cn("graph-value text-sm",q?.graphObjectValues),dy:"-5px",children:qe(te.line,b,G,D,P)}):null]})},Me))]}),_.filter(te=>te.position==="after").map(te=>te.layer)]})}),C&&d&&K&&se?l.jsx(st,{data:C,body:d,xPos:K,yPos:se,backgroundStyle:V?.tooltip,className:q?.tooltip}):null,w&&M!==void 0?l.jsx(Ce.Modal,{open:M!==void 0,onClose:()=>{O(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:lt(w,M)}:void 0,children:typeof w=="function"?w(M):null})}):null]})}function uw(t){const{data:e,graphTitle:n,sources:i,graphDescription:r,height:a,width:o,footNote:s,padding:c,lineColor:u=Pe.light.categoricalColors.colors[1],barColor:h=Pe.light.categoricalColors.colors[0],sameAxes:f=!1,backgroundColor:d=!1,leftMargin:g=80,rightMargin:p=80,topMargin:y=20,bottomMargin:v=25,lineAxisTitle:m="Line chart",barAxisTitle:I="Bar graph",tooltip:j,relativeHeight:w,onSeriesMouseOver:S,graphID:P,graphDownload:W=!1,dataDownload:D=!1,barPadding:x=.25,truncateBy:$=999,showLabels:V=!0,onSeriesMouseClick:q,language:ae="en",colorLegendTitle:G,minHeight:_=0,theme:b="light",ariaLabel:B,resetSelectionOnDoubleClick:X=!0,detailsOnClick:z,showValues:C=!0,noOfTicks:A=5,lineSuffix:M="",barSuffix:O="",linePrefix:K="",barPrefix:Q="",curveType:se="curve",styles:T,classNames:Z,animate:ie=!1,precision:ue=2,customLayers:he=[],naLabel:Y="NA"}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),U=k.useRef(null),ve=k.useRef(null);return k.useEffect(()=>{const J=new ResizeObserver(R=>{oe(o||R[0].target.clientWidth||620),N(a||R[0].target.clientHeight||480)});return U.current&&(N(U.current.clientHeight||480),oe(U.current.clientWidth||620),o||J.observe(U.current)),()=>J.disconnect()},[o,a]),l.jsx("div",{className:`${b||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:ae==="he"||ae==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${d?d===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${ae||"en"}`,Z?.graphContainer),style:{...T?.graphContainer||{},...d&&d!==!0?{backgroundColor:d}:{}},id:P,ref:ve,"aria-label":B||`${n?`The graph shows ${n}. `:""}This is a pareto chart that shows a variable as bars and another as line chart.${r?` ${r}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:d?c||"1rem":c||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||r||W||D?l.jsx(Qe,{styles:{title:T?.title,description:T?.description},classNames:{title:Z?.title,description:Z?.description},graphTitle:n,graphDescription:r,width:o,graphDownload:W?ve.current:void 0,dataDownload:D?e.map(J=>J.data).filter(J=>J!==void 0).length>0?e.map(J=>J.data).filter(J=>J!==void 0):e.filter(J=>J!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[l.jsx(Hi,{colorDomain:[I,m],colors:[h||Pe[b].categoricalColors.colors[0],u||Pe[b].categoricalColors.colors[1]],colorLegendTitle:G,showNAColor:!1}),l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:U,"aria-label":"Graph area",children:(o||ge)&&(a||ce)?l.jsx(QP,{data:e,sameAxes:f,lineColor:u,barColor:h,width:o||ge,height:Math.max(_,a||(w?_?(o||ge)*w>_?(o||ge)*w:_:(o||ge)*w:ce)),truncateBy:$,leftMargin:g,rightMargin:p,topMargin:y,bottomMargin:v,axisTitles:[I,m],tooltip:j,onSeriesMouseOver:S,barPadding:x,showLabels:V,onSeriesMouseClick:q,resetSelectionOnDoubleClick:X,detailsOnClick:z,noOfTicks:A,lineSuffix:M,barSuffix:O,linePrefix:K,barPrefix:Q,curveType:se,showValues:C,styles:T,classNames:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0},precision:ue,customLayers:he,naLabel:Y}):null})]})}),i||s?l.jsx(et,{styles:{footnote:T?.footnote,source:T?.source},classNames:{footnote:Z?.footnote,source:Z?.source},sources:i,footNote:s,width:o}):null]})})})})}function ZP(t){const{data:e,width:n,height:i,barColors:r,centerGap:a,refValues:o,maxValue:s,minValue:c,showValues:u,axisTitles:h,rightMargin:f,leftMargin:d,topMargin:g,bottomMargin:p,tooltip:y,onSeriesMouseOver:v,barPadding:m,truncateBy:I,onSeriesMouseClick:j,showTicks:w,suffix:S,prefix:P,resetSelectionOnDoubleClick:W,detailsOnClick:D,styles:x,classNames:$,noOfTicks:V,animate:q,precision:ae,customLayers:G,minValueLeftBar:_,minValueRightBar:b,naLabel:B}=t,X=k.useRef(null),z=ct(X,{once:q.once,amount:q.amount}),[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z={top:g,bottom:p,left:d,right:f},ie=n-Z.left-Z.right,ue=i-Z.top-Z.bottom,he=e.map((U,ve)=>({...U,id:`${ve}`})),Y=xn().domain(he.map(U=>`${U.id}`)).range([ue,0]).paddingInner(m),ge=ut().domain([c,s]).range([0,(ie-a)/2]).nice(),oe=ge.ticks(V),ce=ut().domain([c,s]).range([(ie-a)/2,0]).nice(),N=ce.ticks(V);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:X,children:l.jsxs("g",{transform:`translate(${Z.left},${Z.top})`,children:[G.filter(U=>U.position==="before").map(U=>U.layer),l.jsxs("g",{transform:"translate(0,0)",children:[w?l.jsx(Rn,{values:N.filter(U=>U!==0),x:N.filter(U=>U!==0).map(U=>ce(U)),y1:0-g,y2:ue+Z.bottom,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:$?.xAxis?.gridLines,labels:$?.xAxis?.labels},suffix:S,prefix:P,labelType:"secondary",showGridLines:!0,leftLabel:!0,precision:ae}):null,l.jsxs(mt,{children:[he.map((U,ve)=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:J=>{A(U),T(J.clientY),Q(J.clientX),v?.(U)},onClick:()=>{(j||D)&&(dt(M,U)&&W?(O(void 0),j?.(void 0)):(O(U),j?.(U)))},onMouseMove:J=>{A(U),T(J.clientY),Q(J.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),v?.(void 0)},children:[U.leftBar?l.jsx($e.rect,{y:Y(`${ve}`),style:{fill:r[0]},height:Y.bandwidth(),variants:{initial:{x:ce(0),width:0},whileInView:{x:U.leftBar<0?ce(0):ce(U.leftBar),width:U.leftBar<0?ce(U.leftBar)-ce(0):ce(0)-ce(U.leftBar),transition:{duration:q.duration}}},initial:"initial",animate:z?"whileInView":"initial",exit:{x:ce(0),width:0,transition:{duration:q.duration}}}):null,u?l.jsx($e.text,{y:Y(`${ve}`)+Y.bandwidth()/2,style:{fill:r[0],textAnchor:U.rightBar&&U.rightBar>0?"end":"start",...x?.graphObjectValues||{}},dx:U.rightBar&&U.rightBar>0?-5:5,dy:"0.33em",className:Ce.cn("graph-value text-sm",$?.graphObjectValues),exit:{opacity:0,transition:{duration:q.duration}},variants:{initial:{x:ce(0),opacity:0},whileInView:{x:U.leftBar?ce(U.leftBar):ce(_<0?0:_),opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:z?"whileInView":"initial",children:qe(U.rightBar,B,ae,P,S)}):null]},U.label)),l.jsx(Dt,{y1:-2.5,y2:ue+Z.bottom,x1:ce(_<0?0:_),x2:ce(_<0?0:_),classNames:{axis:$?.yAxis?.axis},styles:{axis:x?.yAxis?.axis}}),o?l.jsx(l.Fragment,{children:o.map((U,ve)=>l.jsx(Tr,{text:U.text,color:U.color,x:ce(U.value),y1:0-Z.top,y2:ue+Z.bottom,textSide:"left",classNames:U.classNames,styles:U.styles,animate:q,isInView:z},ve))}):null]})]}),l.jsxs("g",{transform:`translate(${(ie+a)/2},0)`,children:[w?l.jsx(Rn,{values:oe.filter(U=>U!==0),x:oe.filter(U=>U!==0).map(U=>ge(U)),y1:0-g,y2:ue+Z.bottom,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:$?.xAxis?.gridLines,labels:$?.xAxis?.labels},suffix:S,prefix:P,labelType:"secondary",showGridLines:!0,precision:ae}):null,l.jsxs(mt,{children:[he.map((U,ve)=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:J=>{A(U),T(J.clientY),Q(J.clientX),v?.(U)},onClick:()=>{(j||D)&&(dt(M,U)&&W?(O(void 0),j?.(void 0)):(O(U),j?.(U)))},onMouseMove:J=>{A(U),T(J.clientY),Q(J.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),v?.(void 0)},children:[U.rightBar?l.jsx($e.rect,{y:Y(`${ve}`),style:{fill:r[1]},height:Y.bandwidth(),exit:{x:ge(0),width:0,transition:{duration:q.duration}},variants:{initial:{x:ge(0),width:0},whileInView:{x:U.rightBar>=0?ge(0):ge(U.rightBar),width:U.rightBar>=0?ge(U.rightBar)-ge(0):ge(0)-ge(U.rightBar),transition:{duration:q.duration}}},initial:"initial",animate:z?"whileInView":"initial"}):null,u?l.jsx($e.text,{y:Y(`${ve}`)+Y.bandwidth()/2,style:{fill:r[1],textAnchor:U.rightBar&&U.rightBar<0?"end":"start",...x?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",$?.graphObjectValues),dx:U.rightBar&&U.rightBar<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:q.duration}},variants:{initial:{x:ge(0),opacity:0},whileInView:{x:U.rightBar?ge(U.rightBar):ge(b<0?0:b),opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:z?"whileInView":"initial",children:qe(U.rightBar,B,ae,P,S)}):null]},ve)),l.jsx(Dt,{y1:-2.5,y2:ue+Z.bottom,x1:ge(b<0?0:b),x2:ge(b<0?0:b),classNames:{axis:$?.yAxis?.axis},styles:{axis:x?.yAxis?.axis}}),o?l.jsx(l.Fragment,{children:o.map((U,ve)=>l.jsx(Tr,{text:U.text,color:U.color,x:ge(U.value),y1:0-Z.top,y2:ue+Z.bottom,textSide:"right",classNames:U.classNames,styles:U.styles,animate:q,isInView:z},ve))}):null]})]}),l.jsx(mt,{children:l.jsx($e.g,{transform:`translate(${ie/2},0)`,children:he.map((U,ve)=>l.jsx(io,{value:`${U.label}`.length<I?`${U.label}`:`${`${U.label}`.substring(0,I)}...`,y:Y(`${U.id}`),x:0-a/2,width:a,height:Y.bandwidth(),alignment:"center",style:x?.yAxis?.labels,className:$?.yAxis?.labels,animate:q,isInView:z},ve))})}),l.jsxs("g",{transform:`translate(0,${ue})`,children:[l.jsx("text",{style:{fill:r[0],textAnchor:"end",...x?.yAxis?.title},className:Ce.cn("text-base",$?.yAxis?.title),x:ie/2-a/2,y:0,dx:-5,dy:20,children:h[0]}),l.jsx("text",{style:{fill:r[1],textAnchor:"start",...x?.yAxis?.title},className:Ce.cn("text-base",$?.yAxis?.title),x:ie/2+a/2,y:0,dx:5,dy:20,children:h[1]})]}),G.filter(U=>U.position==="after").map(U=>U.layer)]})}),C&&y&&K&&se?l.jsx(st,{data:C,body:y,xPos:K,yPos:se,backgroundStyle:x?.tooltip,className:$?.tooltip}):null,D&&M!==void 0?l.jsx(Ce.Modal,{open:M!==void 0,onClose:()=>{O(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof D=="string"?{__html:lt(D,M)}:void 0,children:typeof D=="function"?D(M):null})}):null]})}function xo(t,e,n,i){const r=t.map(s=>s[e]).filter(s=>!je(s)),a=je(n)?Math.min(...r)>=0?0:Math.min(...r):n,o=je(i)?Math.max(...r)<0?0:Math.max(...r):i;return{min:a,max:o}}function hw(t){const{data:e,graphTitle:n,sources:i,graphDescription:r,height:a,width:o,footNote:s,padding:c,barColors:u=[Pe.light.categoricalColors.colors[0],Pe.light.categoricalColors.colors[1]],backgroundColor:h=!1,leftMargin:f=20,rightMargin:d=20,topMargin:g=25,bottomMargin:p=30,rightBarTitle:y="Right bar graph",leftBarTitle:v="Left bar graph",tooltip:m,relativeHeight:I,onSeriesMouseOver:j,graphID:w,barPadding:S=.25,truncateBy:P=999,onSeriesMouseClick:W,centerGap:D=100,showValues:x=!0,maxValue:$,minValue:V,refValues:q=[],suffix:ae="",prefix:G="",showTicks:_=!0,showColorScale:b=!1,graphDownload:B=!1,dataDownload:X=!1,language:z="en",colorLegendTitle:C,minHeight:A=0,theme:M="light",ariaLabel:O,resetSelectionOnDoubleClick:K=!0,detailsOnClick:Q,styles:se,classNames:T,noOfTicks:Z=5,animate:ie=!1,precision:ue=2,customLayers:he=[],timeline:Y={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:ge="NA"}=t,[oe,ce]=k.useState(0),[N,U]=k.useState(0),[ve,J]=k.useState(Y.autoplay),R=di(Xe(e.filter(be=>be.date!==void 0&&be.date!==null),be=>be.date).map(be=>ze(`${be.date}`,Y.dateFormat||"yyyy",new Date).getTime()),(be,ne)=>an(be,ne)),[le,ee]=k.useState(Y.autoplay?0:R.length-1),de=k.useRef(null),te=k.useRef(null);k.useEffect(()=>{const be=new ResizeObserver(ne=>{ce(o||ne[0].target.clientWidth||620),U(a||ne[0].target.clientHeight||480)});return de.current&&(U(de.current.clientHeight||480),ce(de.current.clientWidth||620),o||be.observe(de.current)),()=>be.disconnect()},[o,a]),k.useEffect(()=>{const be=setInterval(()=>{ee(ne=>ne<R.length-1?ne+1:0)},(Y.speed||2)*1e3);return ve||clearInterval(be),()=>clearInterval(be)},[R,ve,Y.speed]);const Me=yi(R,le,Y.showOnlyActiveDate,Y.dateFormat||"yyyy");return l.jsx("div",{className:`${M||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:z==="he"||z==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${z||"en"}`,T?.graphContainer),style:{...se?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:w,ref:te,"aria-label":O||`${n?`The graph shows ${n}. `:""}This is a diverging bar chart. ${r?` ${r}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?c||"1rem":c||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||r||B||X?l.jsx(Qe,{styles:{title:se?.title,description:se?.description},classNames:{title:T?.title,description:T?.description},graphTitle:n,graphDescription:r,width:o,graphDownload:B?te.current:void 0,dataDownload:X?e.map(be=>be.data).filter(be=>be!==void 0).length>0?e.map(be=>be.data).filter(be=>be!==void 0):e.filter(be=>be!==void 0):null}):null,Y.enabled&&R.length>0&&Me?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{J(!ve)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":ve?"Click to pause animation":"Click to play animation",children:ve?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:R[0],max:R[R.length-1],marks:Me,step:null,defaultValue:R[R.length-1],value:R[le],onChangeComplete:be=>{ee(R.indexOf(be))},onChange:be=>{ee(R.indexOf(be))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[b?l.jsx(Hi,{colorLegendTitle:C,colorDomain:[v,y],colors:u,showNAColor:!1}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:de,"aria-label":"Graph area",children:(o||oe)&&(a||N)?l.jsx(ZP,{data:Q2(e,Y.dateFormat||"yyyy").filter(be=>Y.enabled?be.date===ft(new Date(R[le]),Y.dateFormat||"yyyy"):be),barColors:u,width:o||oe,centerGap:D,height:Math.max(A,a||(I?A?(o||oe)*I>A?(o||oe)*I:A:(o||oe)*I:N)),truncateBy:P,leftMargin:f,rightMargin:d,topMargin:g,bottomMargin:p,axisTitles:[v,y],tooltip:m,onSeriesMouseOver:j,barPadding:S,refValues:q,maxValue:Math.max(xo(e,"leftBar",V,$).max,xo(e,"rightBar",V,$).max),minValue:Math.min(xo(e,"leftBar",V,$).min,xo(e,"rightBar",V,$).min),minValueLeftBar:xo(e,"leftBar",V,$).min,minValueRightBar:xo(e,"rightBar",V,$).min,showValues:x,onSeriesMouseClick:W,showTicks:_,suffix:ae,prefix:G,resetSelectionOnDoubleClick:K,detailsOnClick:Q,styles:se,classNames:T,noOfTicks:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0},precision:ue,customLayers:he,naLabel:ge}):null})]})}),i||s?l.jsx(et,{styles:{footnote:se?.footnote,source:se?.source},classNames:{footnote:T?.footnote,source:T?.source},sources:i,footNote:s,width:o}):null]})})})})}function fw(t){const{data:e,graphTitle:n,sources:i,graphDescription:r,barPadding:a,showValues:o,showTicks:s,leftMargin:c,rightMargin:u,height:h,width:f,footNote:d,colors:g,padding:p,backgroundColor:y,topMargin:v,bottomMargin:m,showLabels:I,relativeHeight:j,tooltip:w,onSeriesMouseOver:S,refValues:P,graphID:W,maxValue:D,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,numberOfBins:q,truncateBy:ae,graphType:G,barGraphLayout:_,donutStrokeWidth:b,sortData:B,language:X,minHeight:z,theme:C="light",maxBarThickness:A,ariaLabel:M,detailsOnClick:O,styles:K,classNames:Q,precision:se}=t,[T,Z]=k.useState([]);return k.useEffect(()=>{const ue=yC().thresholds(q||10).value(he=>he.value)(e).map(he=>({label:`${he.x0}-${he.x1}`,size:he.length,data:{options:`${he.x0}-${he.x1}`,frequency:he.length}}));Z(ue)},[e,q]),T.length===0?l.jsx("div",{style:{width:`${f}px`,height:`${h}px`,margin:"auto"},children:l.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:l.jsx(Ce.Spinner,{})})}):G==="circlePacking"?l.jsx(td,{colors:g||Pe.graphMainColor,graphTitle:n,graphDescription:r,footNote:d,width:f,height:h,sources:i,leftMargin:c,rightMargin:u,backgroundColor:y,padding:p,topMargin:v,bottomMargin:m,relativeHeight:j,showLabels:I,tooltip:w,onSeriesMouseOver:S,showColorScale:!1,showValues:o,graphID:W,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,data:T,language:X,minHeight:z,theme:C,ariaLabel:M,detailsOnClick:O,styles:K,classNames:Q,precision:se}):G==="treeMap"?l.jsx(Md,{colors:g||Pe.graphMainColor,graphTitle:n,graphDescription:r,footNote:d,width:f,height:h,sources:i,leftMargin:c,rightMargin:u,backgroundColor:y,padding:p,topMargin:v,bottomMargin:m,relativeHeight:j,showLabels:I,tooltip:w,onSeriesMouseOver:S,showColorScale:!1,showValues:o,graphID:W,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,data:T,language:X,minHeight:z,theme:C,ariaLabel:M,detailsOnClick:O,styles:K,classNames:Q,precision:se}):G==="donutChart"?l.jsx(rd,{colors:g||Pe[C].categoricalColors.colors,graphTitle:n,graphDescription:r,footNote:d,radius:f&&h?f<h?f:h:f||h||void 0,sources:i,backgroundColor:y,padding:p,tooltip:w,onSeriesMouseOver:S,graphID:W,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,data:T,strokeWidth:b,showColorScale:!0,sortData:B,language:X,theme:C,ariaLabel:M,detailsOnClick:O,styles:K,classNames:Q,precision:se}):l.jsx(Gf,{colors:g||Pe.graphMainColor,graphTitle:n,graphDescription:r,footNote:d,width:f,height:h,sources:i,leftMargin:c,rightMargin:u,backgroundColor:y,padding:p,topMargin:v,bottomMargin:m,relativeHeight:j,showLabels:I,tooltip:w,onSeriesMouseOver:S,showColorScale:!1,showValues:o,graphID:W,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,data:T,barPadding:a,refValues:P,truncateBy:ae,maxValue:D,showTicks:s,sortData:B,language:X,minHeight:z,theme:C,maxBarThickness:A,ariaLabel:M,orientation:_,detailsOnClick:O,styles:K,classNames:Q,precision:se})}function Km(t,e){let n;if(e===void 0)for(const i of t)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of t)(r=e(r,++i,t))!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}return n}function dw(t,e){let n;if(e===void 0)for(const i of t)i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of t)(r=e(r,++i,t))!=null&&(n>r||n===void 0&&r>=r)&&(n=r)}return n}function Lu(t,e){let n=0;if(e===void 0)for(let i of t)(i=+i)&&(n+=i);else{let i=-1;for(let r of t)(r=+e(r,++i,t))&&(n+=r)}return n}function JP(t){return t.target.depth}function eE(t,e){return t.sourceLinks.length?t.depth:e-1}function Pu(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?dw(t.sourceLinks,JP)-1:0}function Ol(t){return function(){return t}}function Qm(t,e){return bc(t.source,e.source)||t.index-e.index}function Zm(t,e){return bc(t.target,e.target)||t.index-e.index}function bc(t,e){return t.y0-e.y0}function Eu(t){return t.value}function tE(t){return t.index}function nE(t){return t.nodes}function iE(t){return t.links}function Jm(t,e){const n=t.get(e);if(!n)throw new Error("missing: "+e);return n}function e0({nodes:t}){for(const e of t){let n=e.y0,i=n;for(const r of e.sourceLinks)r.y0=n+r.width/2,n+=r.width;for(const r of e.targetLinks)r.y1=i+r.width/2,i+=r.width}}function Vu(){let t=0,e=0,n=1,i=1,r=24,a=8,o,s=tE,c=eE,u,h,f=nE,d=iE,g=6;function p(){const _={nodes:f.apply(null,arguments),links:d.apply(null,arguments)};return y(_),v(_),m(_),I(_),S(_),e0(_),_}p.update=function(_){return e0(_),_},p.nodeId=function(_){return arguments.length?(s=typeof _=="function"?_:Ol(_),p):s},p.nodeAlign=function(_){return arguments.length?(c=typeof _=="function"?_:Ol(_),p):c},p.nodeSort=function(_){return arguments.length?(u=_,p):u},p.nodeWidth=function(_){return arguments.length?(r=+_,p):r},p.nodePadding=function(_){return arguments.length?(a=o=+_,p):a},p.nodes=function(_){return arguments.length?(f=typeof _=="function"?_:Ol(_),p):f},p.links=function(_){return arguments.length?(d=typeof _=="function"?_:Ol(_),p):d},p.linkSort=function(_){return arguments.length?(h=_,p):h},p.size=function(_){return arguments.length?(t=e=0,n=+_[0],i=+_[1],p):[n-t,i-e]},p.extent=function(_){return arguments.length?(t=+_[0][0],n=+_[1][0],e=+_[0][1],i=+_[1][1],p):[[t,e],[n,i]]},p.iterations=function(_){return arguments.length?(g=+_,p):g};function y({nodes:_,links:b}){for(const[X,z]of _.entries())z.index=X,z.sourceLinks=[],z.targetLinks=[];const B=new Map(_.map((X,z)=>[s(X,z,_),X]));for(const[X,z]of b.entries()){z.index=X;let{source:C,target:A}=z;typeof C!="object"&&(C=z.source=Jm(B,C)),typeof A!="object"&&(A=z.target=Jm(B,A)),C.sourceLinks.push(z),A.targetLinks.push(z)}if(h!=null)for(const{sourceLinks:X,targetLinks:z}of _)X.sort(h),z.sort(h)}function v({nodes:_}){for(const b of _)b.value=b.fixedValue===void 0?Math.max(Lu(b.sourceLinks,Eu),Lu(b.targetLinks,Eu)):b.fixedValue}function m({nodes:_}){const b=_.length;let B=new Set(_),X=new Set,z=0;for(;B.size;){for(const C of B){C.depth=z;for(const{target:A}of C.sourceLinks)X.add(A)}if(++z>b)throw new Error("circular link");B=X,X=new Set}}function I({nodes:_}){const b=_.length;let B=new Set(_),X=new Set,z=0;for(;B.size;){for(const C of B){C.height=z;for(const{source:A}of C.targetLinks)X.add(A)}if(++z>b)throw new Error("circular link");B=X,X=new Set}}function j({nodes:_}){const b=Km(_,z=>z.depth)+1,B=(n-t-r)/(b-1),X=new Array(b);for(const z of _){const C=Math.max(0,Math.min(b-1,Math.floor(c.call(null,z,b))));z.layer=C,z.x0=t+C*B,z.x1=z.x0+r,X[C]?X[C].push(z):X[C]=[z]}if(u)for(const z of X)z.sort(u);return X}function w(_){const b=dw(_,B=>(i-e-(B.length-1)*o)/Lu(B,Eu));for(const B of _){let X=e;for(const z of B){z.y0=X,z.y1=X+z.value*b,X=z.y1+o;for(const C of z.sourceLinks)C.width=C.value*b}X=(i-X+o)/(B.length+1);for(let z=0;z<B.length;++z){const C=B[z];C.y0+=X*(z+1),C.y1+=X*(z+1)}q(B)}}function S(_){const b=j(_);o=Math.min(a,(i-e)/(Km(b,B=>B.length)-1)),w(b);for(let B=0;B<g;++B){const X=Math.pow(.99,B),z=Math.max(1-X,(B+1)/g);W(b,X,z),P(b,X,z)}}function P(_,b,B){for(let X=1,z=_.length;X<z;++X){const C=_[X];for(const A of C){let M=0,O=0;for(const{source:Q,value:se}of A.targetLinks){let T=se*(A.layer-Q.layer);M+=ae(Q,A)*T,O+=T}if(!(O>0))continue;let K=(M/O-A.y0)*b;A.y0+=K,A.y1+=K,V(A)}u===void 0&&C.sort(bc),D(C,B)}}function W(_,b,B){for(let X=_.length,z=X-2;z>=0;--z){const C=_[z];for(const A of C){let M=0,O=0;for(const{target:Q,value:se}of A.sourceLinks){let T=se*(Q.layer-A.layer);M+=G(A,Q)*T,O+=T}if(!(O>0))continue;let K=(M/O-A.y0)*b;A.y0+=K,A.y1+=K,V(A)}u===void 0&&C.sort(bc),D(C,B)}}function D(_,b){const B=_.length>>1,X=_[B];$(_,X.y0-o,B-1,b),x(_,X.y1+o,B+1,b),$(_,i,_.length-1,b),x(_,e,0,b)}function x(_,b,B,X){for(;B<_.length;++B){const z=_[B],C=(b-z.y0)*X;C>1e-6&&(z.y0+=C,z.y1+=C),b=z.y1+o}}function $(_,b,B,X){for(;B>=0;--B){const z=_[B],C=(z.y1-b)*X;C>1e-6&&(z.y0-=C,z.y1-=C),b=z.y0-o}}function V({sourceLinks:_,targetLinks:b}){if(h===void 0){for(const{source:{sourceLinks:B}}of b)B.sort(Zm);for(const{target:{targetLinks:B}}of _)B.sort(Qm)}}function q(_){if(h===void 0)for(const{sourceLinks:b,targetLinks:B}of _)b.sort(Zm),B.sort(Qm)}function ae(_,b){let B=_.y0-(_.sourceLinks.length-1)*o/2;for(const{target:X,width:z}of _.sourceLinks){if(X===b)break;B+=z+o}for(const{source:X,width:z}of b.targetLinks){if(X===_)break;B-=z}return B}function G(_,b){let B=b.y0-(b.targetLinks.length-1)*o/2;for(const{source:X,width:z}of b.targetLinks){if(X===_)break;B+=z+o}for(const{target:X,width:z}of _.sourceLinks){if(X===b)break;B-=z}return B}return p}var Eh=Math.PI,Vh=2*Eh,Va=1e-6,rE=Vh-Va;function Fh(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function gw(){return new Fh}Fh.prototype=gw.prototype={constructor:Fh,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+a)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var a=this._x1,o=this._y1,s=n-t,c=i-e,u=a-t,h=o-e,f=u*u+h*h;if(r<0)throw new Error("negative radius: "+r);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>Va)if(!(Math.abs(h*s-c*u)>Va)||!r)this._+="L"+(this._x1=t)+","+(this._y1=e);else{var d=n-a,g=i-o,p=s*s+c*c,y=d*d+g*g,v=Math.sqrt(p),m=Math.sqrt(f),I=r*Math.tan((Eh-Math.acos((p+f-y)/(2*v*m)))/2),j=I/m,w=I/v;Math.abs(j-1)>Va&&(this._+="L"+(t+j*u)+","+(e+j*h)),this._+="A"+r+","+r+",0,0,"+ +(h*d>u*g)+","+(this._x1=t+w*s)+","+(this._y1=e+w*c)}},arc:function(t,e,n,i,r,a){t=+t,e=+e,n=+n,a=!!a;var o=n*Math.cos(i),s=n*Math.sin(i),c=t+o,u=e+s,h=1^a,f=a?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);this._x1===null?this._+="M"+c+","+u:(Math.abs(this._x1-c)>Va||Math.abs(this._y1-u)>Va)&&(this._+="L"+c+","+u),n&&(f<0&&(f=f%Vh+Vh),f>rE?this._+="A"+n+","+n+",0,1,"+h+","+(t-o)+","+(e-s)+"A"+n+","+n+",0,1,"+h+","+(this._x1=c)+","+(this._y1=u):f>Va&&(this._+="A"+n+","+n+",0,"+ +(f>=Eh)+","+h+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};function t0(t){return function(){return t}}function aE(t){return t[0]}function oE(t){return t[1]}var sE=Array.prototype.slice;function lE(t){return t.source}function cE(t){return t.target}function uE(t){var e=lE,n=cE,i=aE,r=oE,a=null;function o(){var s,c=sE.call(arguments),u=e.apply(this,c),h=n.apply(this,c);if(a||(a=s=gw()),t(a,+i.apply(this,(c[0]=u,c)),+r.apply(this,c),+i.apply(this,(c[0]=h,c)),+r.apply(this,c)),s)return a=null,s+""||null}return o.source=function(s){return arguments.length?(e=s,o):e},o.target=function(s){return arguments.length?(n=s,o):n},o.x=function(s){return arguments.length?(i=typeof s=="function"?s:t0(+s),o):i},o.y=function(s){return arguments.length?(r=typeof s=="function"?s:t0(+s),o):r},o.context=function(s){return arguments.length?(a=s??null,o):a},o}function hE(t,e,n,i,r){t.moveTo(e,n),t.bezierCurveTo(e=(e+i)/2,n,e,r,i,r)}function fE(){return uE(hE)}function dE(t){return[t.source.x1,t.y0]}function gE(t){return[t.target.x0,t.y1]}function pE(){return fE().source(dE).target(gE)}function mE(t){const{data:e,showLabels:n,leftMargin:i,rightMargin:r,truncateBy:a,width:o,height:s,topMargin:c,bottomMargin:u,tooltip:h,onSeriesMouseOver:f,suffix:d,prefix:g,showValues:p,onSeriesMouseClick:y,nodePadding:v,nodeWidth:m,id:I,highlightedSourceDataPoints:j,highlightedTargetDataPoints:w,defaultLinkOpacity:S,sourceTitle:P,targetTitle:W,animate:D,sortNodes:x,resetSelectionOnDoubleClick:$,detailsOnClick:V,styles:q,classNames:ae,precision:G,customLayers:_}=t,b=k.useRef(null),B=ct(b,{once:D.once,amount:D.amount}),[X,z]=k.useState(void 0),[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z={top:c,bottom:u,left:i,right:r},ie=o-Z.left-Z.right,ue=s-Z.top-Z.bottom,he=x==="mostReadable"?Vu().nodeWidth(m).nodePadding(v).size([ie,ue]).nodeAlign(Pu):x==="none"?Vu().nodeWidth(m).nodePadding(v).size([ie,ue]).nodeAlign(Pu).nodeSort(()=>null).linkSort(()=>null):Vu().nodeWidth(m).nodePadding(v).size([ie,ue]).nodeAlign(Pu).nodeSort(x==="desc"?(ce,N)=>(N.value||0)-(ce.value||0):(ce,N)=>(ce.value||0)-(N.value||0)),{nodes:Y,links:ge}=he(e),oe=pE();return l.jsxs(l.Fragment,{children:[l.jsxs($e.svg,{width:`${o}px`,height:`${s}px`,viewBox:`0 0 ${o} ${s}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:b,children:[P?l.jsx("text",{x:Z.left,y:Z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"start"},children:P}):null,W?l.jsx("text",{x:o-Z.right,y:Z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"end"},children:W}):null,l.jsxs("g",{transform:`translate(${Z.left},${Z.top})`,children:[_.filter(ce=>ce.position==="before").map(ce=>ce.layer),Y.filter(ce=>ce.type==="source").map((ce,N)=>l.jsx("g",{onMouseEnter:()=>{O(ce)},onMouseLeave:()=>{O(void 0)},children:l.jsxs("g",{transform:`translate(${ce.x0},${ce.y0})`,children:[l.jsx("rect",{x:0,y:0,width:(ce.x1||0)-(ce.x0||0),height:(ce.y1||0)-(ce.y0||0),style:{fill:ce.color}}),n||p?l.jsx("foreignObject",{y:0-v/2,x:0-i,width:i,height:(ce.y1||0)-(ce.y0||0)+v,children:l.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(ce.y1||0)-(ce.y0||0)+v}px`,overflow:"visible"},children:[n?l.jsx(Ce.P,{marginBottom:p?"3xs":"none",size:"sm",leading:"none",className:Ce.cn("sankey-right-label text-right",ae?.graphObjectValues),style:{hyphens:"auto",color:ce.color,...q?.graphObjectValues},children:`${ce.label}`.length<a?`${ce.label}`:`${`${ce.label}`.substring(0,a)}...`}):null,p?l.jsx(Ce.P,{marginBottom:"none",size:"sm",leading:"none",className:Ce.cn("sankey-right-value text-right font-bold",ae?.graphObjectValues),style:{hyphens:"auto",color:ce.color,...q?.graphObjectValues},children:qe(ce.value,"NA",G,g,d)}):null]})}):null]})},N)),Y.filter(ce=>ce.type==="target").map((ce,N)=>l.jsx("g",{onMouseEnter:()=>{O(ce)},onMouseLeave:()=>{O(void 0)},children:l.jsxs("g",{transform:`translate(${ce.x0},${ce.y0})`,children:[l.jsx("rect",{x:0,y:0,width:(ce.x1||0)-(ce.x0||0),height:(ce.y1||0)-(ce.y0||0),style:{fill:ce.color}}),n||p?l.jsx("foreignObject",{y:0-v/2,x:m,width:r-m,height:(ce.y1||0)-(ce.y0||0)+v,children:l.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(ce.y1||0)-(ce.y0||0)+v}px`},children:[n?l.jsx(Ce.P,{marginBottom:p?"3xs":"none",size:"sm",leading:"none",className:Ce.cn("sankey-left-label text-left",ae?.graphObjectValues),style:{hyphens:"auto",color:ce.color,...q?.graphObjectValues},children:`${ce.label}`.length<a?`${ce.label}`:`${`${ce.label}`.substring(0,a)}...`}):null,p?l.jsx(Ce.P,{size:"sm",leading:"none",marginBottom:"none",className:Ce.cn("sankey-left-value text-left font-bold",ae?.graphObjectValues),style:{hyphens:"auto",color:ce.color,...q?.graphObjectValues},children:qe(ce.value,"NA",G,g,d)}):null]})}):null]})},N)),l.jsx("defs",{children:ge.map((ce,N)=>l.jsxs("linearGradient",{id:`${I}-gradient-${N}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",gradientUnits:"userSpaceOnUse",children:[l.jsx("stop",{offset:"0%",style:{stopColor:ce.source.color,stopOpacity:1}}),l.jsx("stop",{offset:"100%",style:{stopColor:ce.target.color,stopOpacity:1}})]},N))}),l.jsx("g",{children:l.jsx(mt,{children:ge.map((ce,N)=>l.jsx($e.g,{className:"undp-viz-g-with-hover",onMouseEnter:U=>{z(ce.data),T(U.clientY),Q(U.clientX),f?.(ce)},onMouseMove:U=>{z(ce.data),T(U.clientY),Q(U.clientX)},onClick:()=>{(y||V)&&(dt(C,ce.data)&&$?(A(void 0),y?.(void 0)):(A(ce.data),y?.(ce.data)))},onMouseLeave:()=>{z(void 0),Q(void 0),T(void 0),f?.(void 0)},variants:{initial:{opacity:M?ce.source.name===M.name||ce.target.name===M.name?.85:S:(j.length!==0||w.length!==0)&&(j.indexOf(ce.source.label)!==-1||w.indexOf(ce.target.label)!==-1)?.85:S},whileInView:{opacity:M?ce.source.name===M.name||ce.target.name===M.name?.85:S:(j.length!==0||w.length!==0)&&(j.indexOf(ce.source.label)!==-1||w.indexOf(ce.target.label)!==-1)?.85:S,transition:{duration:D.duration}}},initial:"initial",animate:B?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:l.jsx($e.path,{d:oe(ce)||"",style:{stroke:`url(#${I}-gradient-${N})`,strokeWidth:ce.width,fill:"none"},exit:{opacity:0,transition:{duration:D.duration}},variants:{initial:{pathLength:0,opacity:1},whileInView:{pathLength:1,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:B?"whileInView":"initial"},`${ce.source}-${ce.target}`)},`${ce.source}-${ce.target}`))})}),_.filter(ce=>ce.position==="after").map(ce=>ce.layer)]})]}),X&&h&&K&&se?l.jsx(st,{data:X,body:h,xPos:K,yPos:se,backgroundStyle:q?.tooltip,className:ae?.tooltip}):null,V&&C!==void 0?l.jsx(Ce.Modal,{open:C!==void 0,onClose:()=>{A(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof V=="string"?{__html:lt(V,C)}:void 0,children:typeof V=="function"?V(C):null})}):null]})}function pw(t){const{data:e,graphTitle:n,sources:i,graphDescription:r,showLabels:a=!0,leftMargin:o=75,rightMargin:s=75,topMargin:c=30,bottomMargin:u=10,truncateBy:h=999,height:f,width:d,footNote:g,padding:p,backgroundColor:y,tooltip:v,onSeriesMouseOver:m,suffix:I="",prefix:j="",relativeHeight:w,showValues:S=!0,graphID:P,onSeriesMouseClick:W,graphDownload:D=!1,dataDownload:x=!1,fillContainer:$=!0,language:V="en",minHeight:q=0,theme:ae="light",ariaLabel:G,sourceColors:_,targetColors:b,sourceColorDomain:B,targetColorDomain:X,nodePadding:z=5,nodeWidth:C=5,highlightedSourceDataPoints:A=[],highlightedTargetDataPoints:M=[],defaultLinkOpacity:O=.3,sourceTitle:K,targetTitle:Q,sortNodes:se="mostReadable",resetSelectionOnDoubleClick:T=!0,detailsOnClick:Z,styles:ie,classNames:ue,animate:he=!1,precision:Y=2,customLayers:ge=[]}=t,[oe,ce]=k.useState(0),[N,U]=k.useState(0),[ve,J]=k.useState(void 0),R=k.useRef(null),le=k.useRef(null);return k.useEffect(()=>{const ee=Xe(e,"source").map(ne=>({name:`source_${ne.source}`,type:"source",label:`${ne.source}`,color:typeof _=="string"||!_?_||Pe.graphMainColor:_[(B||Xe(e,"source").map(De=>`${De.source}`)).findIndex(De=>`${De}`==`${ne.source}`)>_.length?_.length-1:(B||Xe(e,"source").map(De=>`${De.source}`)).findIndex(De=>`${De}`==`${ne.source}`)],totalValue:rt(e.filter(De=>`${De.source}`==`${ne.source}`).map(De=>De.value))})),de=se==="asc"?tt(ee,ne=>ne.totalValue):se==="desc"?tt(ee,ne=>ne.totalValue).reverse():ee,te=Xe(e,"target").map(ne=>({name:`target_${ne.target}`,type:"target",label:`${ne.target}`,color:typeof b=="string"||!b?b||Pe.graphMainColor:b[(X||Xe(e,"target").map(De=>`${De.target}`)).findIndex(De=>`${De}`==`${ne.target}`)>b.length?b.length-1:(X||Xe(e,"target").map(De=>`${De.target}`)).findIndex(De=>`${De}`==`${ne.target}`)],totalValue:rt(e.filter(De=>`${De.target}`==`${ne.target}`).map(De=>De.value))})),Me=se==="asc"?tt(te,ne=>ne.totalValue):se==="desc"?tt(te,ne=>ne.totalValue).reverse():te,be=[...de,...Me];J({nodes:be,links:e.map(ne=>({source:be.findIndex(De=>De.name===`source_${ne.source}`),target:be.findIndex(De=>De.name===`target_${ne.target}`),value:ne.value,data:{...ne}}))})},[e,se,B,_,X,b]),k.useEffect(()=>{const ee=new ResizeObserver(de=>{ce(d||de[0].target.clientWidth||620),U(f||de[0].target.clientHeight||480)});return R.current&&(U(R.current.clientHeight||480),ce(R.current.clientWidth||620),d||ee.observe(R.current)),()=>ee.disconnect()},[d,f]),l.jsx("div",{className:`${ae||"light"} flex ${d?"grow-0":"grow"} ${$?"w-full":"w-fit"} `,dir:V==="he"||V==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${y?y===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${V||"en"}`,ue?.graphContainer),style:{...ie?.graphContainer||{},...y&&y!==!0?{backgroundColor:y}:{}},id:P,ref:le,"aria-label":G||`${n?`The graph shows ${n}. `:""}This is a sankey chart showing flow. ${r?` ${r}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:y?p||"1rem":p||0},children:l.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[n||r||D||x?l.jsx(Qe,{styles:{title:ie?.title,description:ie?.description},classNames:{title:ue?.title,description:ue?.description},graphTitle:n,graphDescription:r,width:d,graphDownload:D?le.current:void 0,dataDownload:x?e.map(ee=>ee.data).filter(ee=>ee!==void 0).length>0?e.map(ee=>ee.data).filter(ee=>ee!==void 0):e.filter(ee=>ee!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsx("div",{className:"flex flex-col grow justify-center gap-3 w-full leading-0",ref:R,"aria-label":"Graph area",children:(d||oe)&&(f||N)&&ve?l.jsx(mE,{data:ve,width:d||oe,nodePadding:z,nodeWidth:C,height:Math.max(q,f||(w?q?(d||oe)*w>q?(d||oe)*w:q:(d||oe)*w:N)),showLabels:a,leftMargin:o,rightMargin:s,topMargin:c,bottomMargin:u,truncateBy:h,tooltip:v,onSeriesMouseOver:m,showValues:S,suffix:I,prefix:j,onSeriesMouseClick:W,id:rl(8),highlightedSourceDataPoints:A.map(ee=>`${ee}`),highlightedTargetDataPoints:M.map(ee=>`${ee}`),defaultLinkOpacity:O,sourceTitle:K,targetTitle:Q,sortNodes:se,resetSelectionOnDoubleClick:T,styles:ie,classNames:ue,detailsOnClick:Z,animate:he===!0?{duration:.5,once:!0,amount:.5}:he||{duration:0,once:!0,amount:0},precision:Y,customLayers:ge}):null})}),i||g?l.jsx(et,{styles:{footnote:ie?.footnote,source:ie?.source},classNames:{footnote:ue?.footnote,source:ue?.source},sources:i,footNote:g,width:d}):null]})})})})}function yE(t){const{data:e,radius:n,lineColors:i,tooltip:r,onSeriesMouseOver:a,onSeriesMouseClick:o,colorDomain:s,detailsOnClick:c,styles:u,classNames:h,selectedColor:f,axisLabels:d,strokeWidth:g,showValues:p,showDots:y,rightMargin:v,topMargin:m,bottomMargin:I,leftMargin:j,curveType:w,noOfTicks:S,minValue:P,maxValue:W,resetSelectionOnDoubleClick:D,fillShape:x,highlightedLines:$,animate:V,dimmedOpacity:q,precision:ae,customLayers:G}=t,_=k.useRef(null),b=ct(_,{once:V.once,amount:V.amount}),B=w==="linear"?gO:dO,X={top:m,left:j},z=Math.min((2*n-j-v)/2,(2*n-m-I)/2),[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z=ut().domain([0,e[0].values.length]).range([0,2*Math.PI]),ie=je(W)?Math.max(...e.map(oe=>Math.max(...oe.values.filter(ce=>!je(ce)))))<0?0:Math.max(...e.map(oe=>Math.max(...oe.values.filter(ce=>!je(ce))))):W,ue=je(P)?Math.min(...e.map(oe=>Math.min(...oe.values.filter(ce=>!je(ce)))))>=0?0:Math.min(...e.map(oe=>Math.min(...oe.values.filter(ce=>!je(ce))))):P,he=ut().domain([ue,ie]).range([0,z]).nice(),Y=he.ticks(S),ge=fO().radius(oe=>he(oe)).angle((oe,ce)=>Z(ce)).curve(B);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n*2}px`,height:`${n*2}px`,viewBox:`0 0 ${n*2} ${n*2}`,direction:"ltr",ref:_,children:l.jsxs("g",{transform:`translate(${X.left},${X.top})`,children:[G.filter(oe=>oe.position==="before").map(oe=>oe.layer),l.jsxs("g",{transform:`translate(${z},${z})`,children:[d.map((oe,ce)=>l.jsxs("g",{children:[l.jsx("line",{x1:0,y1:0,x2:Math.cos(Z(ce)-Math.PI/2)*z,y2:Math.sin(Z(ce)-Math.PI/2)*z,className:Ce.cn("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",h?.xAxis?.axis),style:u?.xAxis?.axis},ce),l.jsx("text",{x:Math.cos(Z(ce)-Math.PI/2)*(z+6),y:Math.sin(Z(ce)-Math.PI/2)*(z+6),style:{textAnchor:Math.cos(Z(ce)-Math.PI/2)<0?"end":Math.cos(Z(ce)-Math.PI/2)<1e-5?"middle":"start",...u?.xAxis?.labels||""},dy:Math.sin(Z(ce)-Math.PI/2)<0?0:Math.sin(Z(ce)-Math.PI/2)<1e-5?5:10,className:Ce.cn("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",h?.xAxis?.labels),children:oe})]},ce)),Y.map((oe,ce)=>l.jsxs("g",{children:[l.jsx("path",{d:ge(Array(d.length).fill(oe))||"",className:Ce.cn("stroke-primary-gray-500 dark:stroke-primary-gray-550",h?.xAxis?.gridLines),style:{...u?.xAxis?.gridLines,fill:"none"}}),l.jsx("foreignObject",{x:-25,y:Math.sin(-Math.PI/2)*he(oe)>-1e-4?Math.sin(-Math.PI/2)*he(oe)-7:Math.sin(-Math.PI/2)*he(oe)-5,width:50,height:12,children:l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:Ce.cn("fill-primary-gray-500 dark:fill-primary-gray-550 text-xs m-0 py-0 px-1.5 text-center leading-none bg-primary-white dark:bg-primary-gray-700",h?.xAxis?.labels),style:u?.xAxis?.labels,children:qe(oe,"NA",ae)})})})]},ce)),l.jsx(mt,{children:e.map((oe,ce)=>l.jsxs($e.g,{variants:{initial:{opacity:C?oe.label===C.label?1:q:f?oe.color&&i[s.indexOf(oe.color)]===f?1:q:$.length!==0?oe.label&&$.indexOf(oe.label)!==-1?1:.3:1},whileInView:{opacity:C?oe.label===C.label?1:q:f?oe.color&&i[s.indexOf(oe.color)]===f?1:q:$.length!==0?oe.label&&$.indexOf(oe.label)!==-1?1:q:1,transition:{duration:V.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:V.duration}},onMouseEnter:N=>{A(oe),T(N.clientY),Q(N.clientX),a?.(oe)},onMouseMove:N=>{A(oe),T(N.clientY),Q(N.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),a?.(void 0)},onClick:()=>{(o||c)&&(dt(M,oe)&&D?(O(void 0),o?.(void 0)):(O(oe),o?.(oe)))},children:[l.jsx($e.path,{d:ge(oe.values)||"",variants:{initial:{d:ge(oe.values.map(N=>0))||""},whileInView:{d:ge(oe.values)||"",transition:{duration:V.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:V.duration}},style:{stroke:e.filter(N=>N.color).length===0?i[0]:oe.color?i[s.indexOf(oe.color)]:Pe.gray,fill:x?e.filter(N=>N.color).length===0?i[0]:oe.color?i[s.indexOf(oe.color)]:Pe.gray:"none",fillOpacity:.1,strokeWidth:g}}),l.jsx("g",{children:oe.values.map((N,U)=>l.jsx("g",{children:je(N)?null:l.jsxs(l.Fragment,{children:[y?l.jsx($e.circle,{cx:Math.cos(Z(U)-Math.PI/2)*he(N),cy:Math.sin(Z(U)-Math.PI/2)*he(N),r:4,style:{fill:e.filter(ve=>ve.color).length===0?i[0]:oe.color?i[s.indexOf(oe.color)]:Pe.gray},variants:{initial:{cx:0,cy:0,opacity:0},whileInView:{cx:Math.cos(Z(U)-Math.PI/2)*he(N),cy:Math.sin(Z(U)-Math.PI/2)*he(N),opacity:1,transition:{duration:V.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:V.duration}}}):null,p?l.jsx($e.text,{x:Math.cos(Z(U)-Math.PI/2)*(he(N)+6),y:Math.sin(Z(U)-Math.PI/2)*(he(N)+6),style:{fill:i[ce],textAnchor:Math.cos(Z(U)-Math.PI/2)<0?"end":Math.cos(Z(U)-Math.PI/2)<1e-5?"middle":"start",...u?.graphObjectValues||{}},dy:Math.sin(Z(U)-Math.PI/2)<0?10:(Math.sin(Z(U)-Math.PI/2)<1e-5,0),className:Ce.cn("graph-value text-xs font-bold",h?.graphObjectValues),variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:V.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:V.duration}},children:qe(N,"NA",ae)}):null]})},U))})]},oe.label||ce))})]}),G.filter(oe=>oe.position==="after").map(oe=>oe.layer)]})}),C&&r&&K&&se?l.jsx(st,{data:C,body:r,xPos:K,yPos:se,backgroundStyle:u?.tooltip,className:h?.tooltip}):null,c&&M!==void 0?l.jsx(Ce.Modal,{open:M!==void 0,onClose:()=>{O(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof c=="string"?{__html:lt(c,M)}:void 0,children:typeof c=="function"?c(M):null})}):null]})}function mw(t){const{graphTitle:e,colors:n,sources:i,graphDescription:r,footNote:a,radius:o,data:s,showColorScale:c=!0,padding:u,backgroundColor:h=!1,tooltip:f,onSeriesMouseOver:d,graphID:g,onSeriesMouseClick:p,topMargin:y=75,bottomMargin:v=75,leftMargin:m=75,rightMargin:I=75,graphDownload:j=!1,dataDownload:w=!1,colorDomain:S,language:P="en",theme:W="light",highlightedLines:D=[],width:x,height:$,minHeight:V=0,strokeWidth:q=2,relativeHeight:ae,ariaLabel:G,colorLegendTitle:_,detailsOnClick:b,styles:B,classNames:X,showNAColor:z=!0,axisLabels:C,showDots:A=!0,showValues:M=!1,curveType:O="curve",noOfTicks:K=5,minValue:Q,maxValue:se,fillShape:T=!1,resetSelectionOnDoubleClick:Z=!0,animate:ie=!1,dimmedOpacity:ue=.3,precision:he=2,customLayers:Y=[]}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(0),[J,R]=k.useState(void 0),le=k.useRef(null),ee=k.useRef(null);return k.useEffect(()=>{const de=new ResizeObserver(te=>{N(x||te[0].target.clientWidth||420),ve($||te[0].target.clientHeight||420),oe((Math.min(x||te[0].target.clientWidth||620,$||te[0].target.clientHeight||480)||420)/2)});return le.current&&(ve(le.current.clientHeight||420),N(le.current.clientWidth||420),oe((Math.min(le.current.clientWidth,le.current.clientHeight)||420)/2),(!x||!o)&&de.observe(le.current)),()=>de.disconnect()},[x,$,o]),l.jsx("div",{className:`${W||"light"} flex ${x?"w-fit grow-0":"w-full grow"}`,dir:P==="he"||P==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${P||"en"}`,X?.graphContainer),style:{...B?.graphContainer||{},minHeight:"inherit",...h&&h!==!0?{backgroundColor:h}:{}},id:g,ref:ee,"aria-label":G||`${e?`The graph shows ${e}. `:""}This is a donut or pie chart chart. ${r?` ${r}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:l.jsxs("div",{className:"flex flex-col gap-2 w-full grow justify-between",children:[e||r||j||w?l.jsx(Qe,{styles:{title:B?.title,description:B?.description},classNames:{title:X?.title,description:X?.description},graphTitle:e,graphDescription:r,width:x,graphDownload:j?ee.current:void 0,dataDownload:w?s.map(de=>de.data).filter(de=>de!==void 0).length>0?s.map(de=>de.data).filter(de=>de!==void 0):s.filter(de=>de!==void 0):null}):null,l.jsx("div",{className:"flex grow flex-col justify-center items-stretch gap-8 flex-wrap",style:{width:x?`${x}px`:"100%"},children:s.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[c&&s.filter(de=>de.color).length!==0?l.jsx(tn,{width:x,colorLegendTitle:_,colors:n||Pe[W].categoricalColors.colors,colorDomain:S||Xe(s.filter(de=>de.color),"color").map(de=>de.color),setSelectedColor:R,showNAColor:z}):null,l.jsx("div",{className:`flex ${x?"grow-0":"grow"} items-center justify-center leading-0`,style:{width:x?`${x}px`:"100%",height:$?`${Math.max(V,$||(ae?V?(x||ce)*ae>V?(x||ce)*ae:V:(x||ce)*ae:U))}px`:"auto"},ref:le,"aria-label":"Graph area",children:l.jsx("div",{className:"w-full flex justify-center leading-0",children:o||ge?l.jsx(yE,{data:s,lineColors:s.filter(de=>de.color).length===0?n?[n]:[Pe.primaryColors["blue-600"]]:n||Pe[W].categoricalColors.colors,radius:o||ge,tooltip:f,colorDomain:S||Xe(s.filter(de=>de.color),"color").map(de=>de.color),onSeriesMouseOver:d,onSeriesMouseClick:p,styles:B,detailsOnClick:b,selectedColor:J,axisLabels:C,strokeWidth:q,showValues:M,showDots:A,topMargin:y,bottomMargin:v,leftMargin:m,rightMargin:I,curveType:O,noOfTicks:K,minValue:Q,maxValue:se,fillShape:T,highlightedLines:D,resetSelectionOnDoubleClick:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0},dimmedOpacity:ue,precision:he,customLayers:Y}):null})})]})}),i||a?l.jsx(et,{styles:{footnote:B?.footnote,source:B?.source},classNames:{footnote:X?.footnote,source:X?.source},sources:i,footNote:a,width:x}):l.jsx("div",{})]})})})})}function Ct(t,e,n){return e.findIndex(i=>i.chartConfigId===t)===-1?void 0:typeof e[e.findIndex(i=>i.chartConfigId===t)].columnId=="object"?e[e.findIndex(i=>i.chartConfigId===t)].columnId.map(i=>n.findIndex(r=>r.value===i)===-1?i:n[n.findIndex(r=>r.value===i)].label):n.findIndex(i=>i.value===e[e.findIndex(r=>r.chartConfigId===t)].columnId)===-1?e[e.findIndex(i=>i.chartConfigId===t)].columnId:n[n.findIndex(i=>i.value===e[e.findIndex(r=>r.chartConfigId===t)].columnId)].label}function yw(t){const{settings:e,graph:n,graphData:i,debugMode:r,graphDataConfiguration:a,readableHeader:o,updateFilters:s}=t;if(r&&(console.log(`Graph: ${n}`),console.log("Transformed data:",i),console.log("Settings:",e)),typeof i=="string")return l.jsx("div",{className:`flex my-0 mx-auto grow flex-col justify-center ${e?.width?"w-fit":"w-full"}`,style:{height:"inherit"},children:l.jsx(Ce.P,{size:"sm",marginBottom:"none",className:"p-2 text-center text-accent-dark-red dark:text-accent-red",children:i})});const c={barChart:Gf,bulletChart:Kv,groupedBarChart:Rx,stackedBarChart:Bx,lineChart:yv,dualAxisLineChart:pv,multiLineChart:xv,multiLineAltChart:vv,stackedAreaChart:Qv,choroplethMap:Hv,biVariateChoroplethMap:Bv,dotDensityMap:Wv,donutChart:rd,slopeChart:Xv,scatterPlot:Uv,dumbbellChart:tv,treeMap:Md,circlePacking:td,heatMap:aw,stripChart:cw,beeSwarmChart:nv,butterflyChart:hw,histogram:fw,sparkLine:bv,paretoChart:uw,dataTable:ow,statCard:Zv,geoHubCompareMap:Yv,geoHubMap:Gv,unitChart:nw,differenceLineChart:wv,geoHubMapWithLayerSelection:qv,sankeyChart:pw,lineChartWithConfidenceInterval:mv,dataCards:sw,radarChart:mw,threeDGlobe:zv},u=d=>{switch(d){case"barChart":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,orientation:e?.orientation,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,height:e?.height,width:e?.width,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,barPadding:e?.barPadding,showValues:e?.showValues,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,truncateBy:e?.truncateBy,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,showColorScale:e?.showColorScale,maxValue:e?.maxValue,minValue:e?.minValue,labelOrder:e?.labelOrder,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,sortData:e?.sortData,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,maxBarThickness:e?.maxBarThickness,minBarThickness:e?.minBarThickness,maxNumberOfBars:e?.maxNumberOfBars,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.label)},resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,detailsOnClick:e?.detailsOnClick,barAxisTitle:e?.barAxisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,filterNA:e?.filterNA,animate:e?.animate,naLabel:e?.naLabel};case"groupedBarChart":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,orientation:e?.orientation,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,showColorScale:e?.showColorScale,sources:e?.sources,barPadding:e?.barPadding,showTicks:e?.showTicks,truncateBy:e?.truncateBy,colorDomain:e?.colorDomain||Ct("size",a||[],o||[]),colorLegendTitle:e?.colorLegendTitle,suffix:e?.suffix,prefix:e?.prefix,showValues:e?.showValues,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,showLabels:e?.showLabels,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,labelOrder:e?.labelOrder,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,maxBarThickness:e?.maxBarThickness,ariaLabel:e?.ariaLabel,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,detailsOnClick:e?.detailsOnClick,barAxisTitle:e?.barAxisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,animate:e?.animate,naLabel:e?.naLabel};case"stackedBarChart":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,orientation:e?.orientation,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,showColorScale:e?.showColorScale,width:e?.width,height:e?.height,sources:e?.sources,barPadding:e?.barPadding,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,truncateBy:e?.truncateBy,colorDomain:e?.colorDomain||Ct("size",a||[],o||[]),colorLegendTitle:e?.colorLegendTitle,backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,suffix:e?.suffix,prefix:e?.prefix,labelOrder:e?.labelOrder,showValues:e?.showValues,showLabels:e?.showLabels,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,maxValue:e?.maxValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,maxBarThickness:e?.maxBarThickness,minBarThickness:e?.minBarThickness,maxNumberOfBars:e?.maxNumberOfBars,sortParameter:e?.sortParameter,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,barAxisTitle:e?.barAxisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,animate:e?.animate,naLabel:e?.naLabel};case"bulletChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,orientation:e?.orientation,data:i,barColor:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,height:e?.height,width:e?.width,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,barPadding:e?.barPadding,showValues:e?.showValues,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,truncateBy:e?.truncateBy,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,showColorScale:e?.showColorScale,maxValue:e?.maxValue,minValue:e?.minValue,labelOrder:e?.labelOrder,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,sortData:e?.sortData,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,maxBarThickness:e?.maxBarThickness,minBarThickness:e?.minBarThickness,maxNumberOfBars:e?.maxNumberOfBars,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.label)},resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,detailsOnClick:e?.detailsOnClick,barAxisTitle:e?.barAxisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,filterNA:e?.filterNA,qualitativeRangeColors:e?.qualitativeRangeColors,targetStyle:e?.targetStyle,targetColor:e?.targetColor,measureBarWidthFactor:e?.measureBarWidthFactor,animate:e?.animate,naLabel:e?.naLabel};case"lineChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,curveType:e?.curveType,data:i,graphID:e?.graphID,lineColor:e?.lineColor,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,showValues:e?.showValues,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,regressionLine:e?.regressionLine,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,styles:e?.styles,classNames:e?.classNames};case"lineChartWithConfidenceInterval":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,curveType:e?.curveType,graphID:e?.graphID,lineColor:e?.lineColor,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,showValues:e?.showValues,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,regressionLine:e?.regressionLine,ariaLabel:e?.ariaLabel,showIntervalDots:e?.showIntervalDots,showIntervalValues:e?.showIntervalValues,intervalLineStrokeWidth:e?.intervalLineStrokeWidth,intervalLineColors:e?.intervalLineColors,intervalAreaColor:e?.intervalAreaColor,intervalAreaOpacity:e?.intervalAreaOpacity,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,colorLegendTitle:e?.colorLegendTitle,colorLegendColors:e?.colorLegendColors,colorLegendDomain:e?.colorLegendDomain,styles:e?.styles,classNames:e?.classNames};case"dualAxisLineChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,curveType:e?.curveType,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,labels:e?.labels||[Ct("y1",a||[],o||[]),Ct("y2",a||[],o||[])],footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,showValues:e?.showValues,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,lineColors:e?.lineColors,sameAxes:e?.sameAxes,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,colorLegendTitle:e?.colorLegendTitle,ariaLabel:e?.ariaLabel,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,lineSuffixes:e?.lineSuffixes,linePrefixes:e?.linePrefixes,styles:e?.styles,classNames:e?.classNames};case"multiLineChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,data:i,curveType:e?.curveType,lineColors:e?.lineColors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,suffix:e?.suffix,prefix:e?.prefix,showColorScale:e?.showColorScale,labels:e?.labels||Ct("y",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,showValues:e?.showValues,relativeHeight:e?.relativeHeight,showColorLegendAtTop:e?.showColorLegendAtTop,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,highlightedLines:e?.highlightedLines,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,colorLegendTitle:e?.colorLegendTitle,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,styles:e?.styles,classNames:e?.classNames,dashedLines:e?.dashedLines,dashSettings:e?.dashSettings,labelsToBeHidden:e?.labelsToBeHidden};case"multiLineAltChart":return{naLabel:e?.naLabel,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,dimmedOpacity:e?.dimmedOpacity,curveType:e?.curveType,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,suffix:e?.suffix,prefix:e?.prefix,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,showLabels:e?.showLabels,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,highlightedLines:e?.highlightedLines,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,colorLegendTitle:e?.colorLegendTitle,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,styles:e?.styles,classNames:e?.classNames,colorDomain:e?.colorDomain,showNAColor:e?.showNAColor};case"differenceLineChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,curveType:e?.curveType,lineColors:e?.lineColors,diffAreaColors:e?.diffAreaColors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,suffix:e?.suffix,prefix:e?.prefix,labels:e?.labels||[Ct("y1",a||[],o||[]),Ct("y2",a||[],o||[])],backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,showValues:e?.showValues,relativeHeight:e?.relativeHeight,showColorLegendAtTop:e?.showColorLegendAtTop,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,colorLegendTitle:e?.colorLegendTitle,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,styles:e?.styles,classNames:e?.classNames};case"stackedAreaChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,curveType:e?.curveType,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,colorDomain:e?.colorDomain||Ct("y",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,colorLegendTitle:e?.colorLegendTitle,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,relativeHeight:e?.relativeHeight,bottomMargin:e?.bottomMargin,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,showColorScale:e?.showColorScale,language:e?.language,minHeight:e?.minHeight,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,suffix:e?.suffix,prefix:e?.prefix,styles:e?.styles,classNames:e?.classNames};case"choroplethMap":return{timeline:e?.timeline,customLayers:e?.customLayers,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphTitle:e?.graphTitle,mapData:e?.mapData,mapProjection:e?.mapProjection,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,colorDomain:e?.colorDomain,colors:e?.colors,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("x",a||[],o||[]),scaleType:e?.scaleType,categorical:e?.categorical,data:i,scale:e?.scale,centerPoint:e?.centerPoint,backgroundColor:e?.backgroundColor,mapBorderWidth:e?.mapBorderWidth,mapNoDataColor:e?.mapNoDataColor,mapBorderColor:e?.mapBorderColor,relativeHeight:e?.relativeHeight,padding:e?.padding,isWorldMap:e?.isWorldMap,tooltip:e?.tooltip,showColorScale:e?.showColorScale,zoomScaleExtend:e?.zoomScaleExtend,zoomTranslateExtend:e?.zoomTranslateExtend,graphID:e?.graphID,highlightedIds:e?.highlightedIds,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,mapProperty:e?.mapProperty,showAntarctica:e?.showAntarctica,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.id)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,zoomInteraction:e?.zoomInteraction,animate:e?.animate};case"biVariateChoroplethMap":return{timeline:e?.timeline,customLayers:e?.customLayers,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,mapData:e?.mapData,mapProjection:e?.mapProjection,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,xColorLegendTitle:Object.keys(e||{}).indexOf("xColorLegendTitle")!==-1?e?.xColorLegendTitle:Ct("x",a||[],o||[]),yColorLegendTitle:Object.keys(e||{}).indexOf("yColorLegendTitle")!==-1?e?.yColorLegendTitle:Ct("y",a||[],o||[]),xDomain:e?.xDomain,yDomain:e?.yDomain,colors:e?.colors,scale:e?.scale,centerPoint:e?.centerPoint,backgroundColor:e?.backgroundColor,mapBorderWidth:e?.mapBorderWidth,mapNoDataColor:e?.mapNoDataColor,padding:e?.padding,mapBorderColor:e?.mapBorderColor,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,isWorldMap:e?.isWorldMap,zoomScaleExtend:e?.zoomScaleExtend,zoomTranslateExtend:e?.zoomTranslateExtend,graphID:e?.graphID,highlightedIds:e?.highlightedIds,mapProperty:e?.mapProperty,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,showAntarctica:e?.showAntarctica,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.id)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,zoomInteraction:e?.zoomInteraction,animate:e?.animate};case"dotDensityMap":return{timeline:e?.timeline,customLayers:e?.customLayers,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphTitle:e?.graphTitle,mapData:e?.mapData,mapProjection:e?.mapProjection,graphDescription:e?.graphDescription,footNote:e?.footNote,maxRadiusValue:e?.maxRadiusValue,width:e?.width,height:e?.height,radius:e?.radius,sources:e?.sources,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),data:i,scale:e?.scale,centerPoint:e?.centerPoint,backgroundColor:e?.backgroundColor,mapBorderWidth:e?.mapBorderWidth,mapNoDataColor:e?.mapNoDataColor,mapBorderColor:e?.mapBorderColor,padding:e?.padding,showLabels:e?.showLabels,relativeHeight:e?.relativeHeight,isWorldMap:e?.isWorldMap,tooltip:e?.tooltip,showColorScale:e?.showColorScale,zoomScaleExtend:e?.zoomScaleExtend,zoomTranslateExtend:e?.zoomTranslateExtend,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,showAntarctica:e?.showAntarctica,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,zoomInteraction:e?.zoomInteraction,animate:e?.animate};case"threeDGlobe":return{highlightedIds:e?.highlightedIds,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphTitle:e?.graphTitle,mapData:e?.mapData,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,colorDomain:e?.colorDomain,colors:e?.colors,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("x",a||[],o||[]),scaleType:e?.scaleType,data:i,centerPoint:e?.centerPoint,backgroundColor:e?.backgroundColor,mapNoDataColor:e?.mapNoDataColor,mapBorderColor:e?.mapBorderColor,relativeHeight:e?.relativeHeight,padding:e?.padding,tooltip:e?.tooltip,showColorScale:e?.showColorScale,graphID:e?.graphID,dataDownload:e?.dataDownload,mapProperty:e?.mapProperty,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.id)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,categorical:e?.categorical,autoRotate:e?.autoRotate,globeMaterial:e?.globeMaterial,atmosphereColor:e?.atmosphereColor,enableZoom:e?.enableZoom};case"donutChart":return{precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,mainText:e?.mainText,data:i,colors:e?.colors,graphTitle:e?.graphTitle,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,graphDescription:e?.graphDescription,subNote:e?.subNote,footNote:e?.footNote,radius:e?.radius,strokeWidth:e?.strokeWidth,showColorScale:e?.showColorScale,backgroundColor:e?.backgroundColor,padding:e?.padding,tooltip:e?.tooltip,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,colorDomain:e?.colorDomain,sortData:e?.sortData,language:e?.language,width:e?.width,height:e?.height,minHeight:e?.minHeight,relativeHeight:e?.relativeHeight,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,ariaLabel:e?.ariaLabel,legendMaxWidth:e?.legendMaxWidth,onSeriesMouseClick:g=>{s?.(g.label)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,colorScaleMaxWidth:e?.colorScaleMaxWidth};case"slopeChart":return{customLayers:e?.customLayers,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,showLabels:e?.showLabels,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),radius:e?.radius,axisTitles:e?.axisTitles,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,highlightedDataPoints:e?.highlightedDataPoints,showColorScale:e?.showColorScale,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,fillContainer:e?.fillContainer,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"scatterPlot":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,showLabels:e?.showLabels,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),radius:e?.radius,xAxisTitle:Object.keys(e||{}).indexOf("xAxisTitle")!==-1?e?.xAxisTitle:Ct("x",a||[],o||[]),yAxisTitle:Object.keys(e||{}).indexOf("yAxisTitle")!==-1?e?.yAxisTitle:Ct("y",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refXValues:e?.refXValues,refYValues:e?.refYValues,highlightedDataPoints:e?.highlightedDataPoints,highlightAreaSettings:e?.highlightAreaSettings,showColorScale:e?.showColorScale,graphID:e?.graphID,maxRadiusValue:e?.maxRadiusValue,maxXValue:e?.maxXValue,minXValue:e?.minXValue,maxYValue:e?.maxYValue,minYValue:e?.minYValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,regressionLine:e?.regressionLine,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,noOfXTicks:e?.noOfXTicks,noOfYTicks:e?.noOfYTicks,labelColor:e?.labelColor,xSuffix:e?.xSuffix,ySuffix:e?.ySuffix,xPrefix:e?.xPrefix,yPrefix:e?.yPrefix,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"dumbbellChart":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,orientation:e?.orientation,refValues:e?.refValues,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,barPadding:e?.barPadding,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,truncateBy:e?.truncateBy,labelOrder:e?.labelOrder,showColorScale:e?.showColorScale,colorDomain:e?.colorDomain||Ct("x",a||[],o||[]),colorLegendTitle:e?.colorLegendTitle,backgroundColor:e?.backgroundColor,padding:e?.padding,radius:e?.radius,relativeHeight:e?.relativeHeight,showValues:e?.showValues,showLabels:e?.showLabels,tooltip:e?.tooltip,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,suffix:e?.suffix,prefix:e?.prefix,language:e?.language,minHeight:e?.minHeight,sortParameter:e?.sortParameter,arrowConnector:e?.arrowConnector,connectorStrokeWidth:e?.connectorStrokeWidth,maxBarThickness:e?.maxBarThickness,minBarThickness:e?.minBarThickness,maxNumberOfBars:e?.maxNumberOfBars,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,axisTitle:e?.axisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,animate:e?.animate,highlightedDataPoints:e?.highlightedDataPoints,dimmedOpacity:e?.dimmedOpacity};case"treeMap":return{precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,tooltip:e?.tooltip,showColorScale:e?.showColorScale,showValues:e?.showValues,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.label)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"circlePacking":return{precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,tooltip:e?.tooltip,showColorScale:e?.showColorScale,showValues:e?.showValues,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,radius:e?.radius,maxRadiusValue:e?.maxRadiusValue,onSeriesMouseClick:g=>{s?.(g.label)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"heatMap":return{precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,scaleType:e?.scaleType,colorDomain:e?.colorDomain,showColumnLabels:e?.showColumnLabels,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,truncateBy:e?.truncateBy,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,suffix:e?.suffix,prefix:e?.prefix,showValues:e?.showValues,showRowLabels:e?.showRowLabels,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,graphID:e?.graphID,noDataColor:e?.noDataColor,showColorScale:e?.showColorScale,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,fillContainer:e?.fillContainer,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"stripChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,orientation:e?.orientation,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),radius:e?.radius,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,highlightedDataPoints:e?.highlightedDataPoints,showColorScale:e?.showColorScale,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,noOfTicks:e?.noOfTicks,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,prefix:e?.prefix,suffix:e?.suffix,stripType:e?.stripType,valueColor:e?.valueColor,language:e?.language,minHeight:e?.minHeight,highlightColor:e?.highlightColor,dotOpacity:e?.dotOpacity,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"beeSwarmChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,showColorScale:e?.showColorScale,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,radius:e?.radius,maxRadiusValue:e?.maxRadiusValue,maxValue:e?.maxValue,minValue:e?.minValue,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,orientation:e?.orientation,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"butterflyChart":return{naLabel:e?.naLabel,timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,leftBarTitle:Object.keys(e||{}).indexOf("leftBarTitle")!==-1?e?.leftBarTitle:Ct("leftBar",a||[],o||[]),rightBarTitle:Object.keys(e||{}).indexOf("rightBarTitle")!==-1?e?.rightBarTitle:Ct("rightBar",a||[],o||[]),footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,barColors:e?.barColors,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,barPadding:e?.barPadding,truncateBy:e?.truncateBy,suffix:e?.suffix,prefix:e?.prefix,showTicks:e?.showTicks,showValues:e?.showValues,centerGap:e?.centerGap,maxValue:e?.maxValue,minValue:e?.minValue,showColorScale:e?.showColorScale,refValues:e?.refValues,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"histogram":return{precision:e?.precision,theme:e?.theme,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,barPadding:e?.barPadding,showValues:e?.showValues,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,maxValue:e?.maxValue,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,numberOfBins:e?.numberOfBins,truncateBy:e?.truncateBy,donutStrokeWidth:e?.donutStrokeWidth,sortData:e?.sortData,barGraphLayout:e?.barGraphLayout,graphType:e?.graphType,language:e?.language,minHeight:e?.minHeight,maxBarThickness:e?.maxBarThickness,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames};case"sparkLine":return{customLayers:e?.customLayers,theme:e?.theme,data:i,curveType:e?.curveType,lineColor:e?.lineColor,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,dateFormat:e?.dateFormat,area:e?.area,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,styles:e?.styles,classNames:e?.classNames};case"paretoChart":return{naLabel:e?.naLabel,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,showValues:e?.showValues,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,barTitle:Object.keys(e||{}).indexOf("barTitle")!==-1?e?.barTitle:Ct("barTitle",a||[],o||[]),lineTitle:Object.keys(e||{}).indexOf("lineTitle")!==-1?e?.lineTitle:Ct("lineTitle",a||[],o||[]),footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,barColor:e?.barColor,curveType:e?.curveType,lineColor:e?.lineColor,sameAxes:e?.sameAxes,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,barPadding:e?.barPadding,truncateBy:e?.truncateBy,showLabels:e?.showLabels,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,noOfTicks:e?.noOfTicks,lineSuffix:e?.lineSuffix,barSuffix:e?.barSuffix,linePrefix:e?.lineSuffix,barPrefix:e?.barPrefix,barAxisTitle:e?.barAxisTitle,lineAxisTitle:e?.lineAxisTitle,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"dataTable":return{naLabel:e?.naLabel,precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,graphID:e?.graphID,width:e?.width,height:e?.height,columnData:e?.columnData||[],data:i,language:e?.language,ariaLabel:e?.ariaLabel,minWidth:e?.minWidth,backgroundColor:e?.backgroundColor,padding:e?.padding,styles:e?.styles,classNames:e?.classNames};case"statCard":return{precision:e?.precision,theme:e?.theme,year:e?.year,data:i,graphTitle:e?.graphTitle||"",graphDescription:e?.graphDescription,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources||[],footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,graphID:e?.graphID,aggregationMethod:e?.aggregationMethod,language:e?.language,minHeight:e?.minHeight,countOnly:e?.countOnly,ariaLabel:e?.ariaLabel,textBackground:e?.textBackground,headingFontSize:e?.headingFontSize,centerAlign:e?.centerAlign,verticalAlign:e?.verticalAlign,styles:e?.styles,classNames:e?.classNames,layout:e?.layout};case"geoHubCompareMap":return{theme:e?.theme,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,width:e?.width,height:e?.height,relativeHeight:e?.relativeHeight,graphID:e?.graphID,mapStyles:e?.mapStyles,center:e?.center,zoomLevel:e?.zoomLevel,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,styles:e?.styles,classNames:e?.classNames,mapLegend:e?.mapLegend};case"geoHubMap":return{theme:e?.theme,mapStyle:e?.mapStyle,center:e?.center,zoomLevel:e?.zoomLevel,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,width:e?.width,height:e?.height,relativeHeight:e?.relativeHeight,graphID:e?.graphID,language:e?.language,minHeight:e?.minHeight,includeLayers:e?.includeLayers,excludeLayers:e?.excludeLayers,ariaLabel:e?.ariaLabel,uiMode:e?.uiMode,styles:e?.styles,classNames:e?.classNames,mapLegend:e?.mapLegend};case"geoHubMapWithLayerSelection":return{theme:e?.theme,mapStyle:e?.mapStyle,center:e?.center,zoomLevel:e?.zoomLevel,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,width:e?.width,height:e?.height,relativeHeight:e?.relativeHeight,graphID:e?.graphID,language:e?.language,minHeight:e?.minHeight,layerSelection:e?.layerSelection,excludeLayers:e?.excludeLayers,ariaLabel:e?.ariaLabel,uiMode:e?.uiMode,mapLegend:e?.mapLegend};case"unitChart":return{precision:e?.precision,theme:e?.theme,totalNoOfDots:e?.totalNoOfDots,gridSize:e?.gridSize,unitPadding:e?.unitPadding,size:e?.size,graphTitle:e?.graphTitle,sources:e?.sources,colors:e?.colors,graphDescription:e?.graphDescription,footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,showColorScale:e?.showColorScale,showStrokeForWhiteDots:e?.showStrokeForWhiteDots,note:e?.note,data:i,width:e?.width,height:e?.height,minHeight:e?.minHeight,relativeHeight:e?.relativeHeight,ariaLabel:e?.ariaLabel,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"sankeyChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,showLabels:e?.showLabels,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,truncateBy:e?.truncateBy,padding:e?.padding,backgroundColor:e?.backgroundColor,tooltip:e?.tooltip,suffix:e?.suffix,prefix:e?.prefix,relativeHeight:e?.relativeHeight,showValues:e?.showValues,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,fillContainer:e?.fillContainer,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,sourceColors:e?.sourceColors,targetColors:e?.targetColors,sourceColorDomain:e?.sourceColorDomain,targetColorDomain:e?.targetColorDomain,nodePadding:e?.nodePadding,nodeWidth:e?.nodeWidth,highlightedSourceDataPoints:e?.highlightedSourceDataPoints,highlightedTargetDataPoints:e?.highlightedTargetDataPoints,defaultLinkOpacity:e?.defaultLinkOpacity,sourceTitle:e?.sourceTitle,targetTitle:e?.targetTitle,sortNodes:e?.sortNodes,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"dataCards":return{theme:e?.theme,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,graphID:e?.graphID,width:e?.width,height:e?.height,columnData:e?.columnData||[],data:i,language:e?.language,ariaLabel:e?.ariaLabel,cardTemplate:e?.cardTemplate,cardBackgroundColor:e?.cardBackgroundColor,cardFilters:e?.cardFilters||[],cardSortingOptions:e?.cardSortingOptions,cardSearchColumns:e?.cardSearchColumns,cardMinWidth:e?.cardMinWidth,backgroundColor:e?.backgroundColor,padding:e?.padding,detailsOnClick:e?.detailsOnClick,allowDataDownloadOnDetail:e?.allowDataDownloadOnDetail,noOfItemsInAPage:e?.noOfItemsInAPage,uiMode:e?.uiMode,styles:e?.styles,classNames:e?.classNames};case"radarChart":return{customLayers:e?.customLayers,precision:e?.precision,graphTitle:e?.graphTitle,dimmedOpacity:e?.dimmedOpacity,graphDescription:e?.graphDescription,footNote:e?.footNote,sources:e?.sources,ariaLabel:e?.ariaLabel,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:e?.colorLegendTitle,backgroundColor:e?.backgroundColor,styles:e?.styles,classNames:e?.classNames,width:e?.width,height:e?.height,minHeight:e?.minHeight,relativeHeight:e?.relativeHeight,padding:e?.padding,radius:e?.radius,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,maxValue:e?.maxValue,minValue:e?.minValue,showValues:e?.showValues,showDots:e?.showDots,strokeWidth:e?.strokeWidth,fillShape:e?.fillShape,noOfTicks:e?.noOfTicks,showColorScale:e?.showColorScale,showNAColor:e?.showNAColor,highlightedLines:e?.highlightedLines,axisLabels:e?.axisLabels,curveType:e?.curveType,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,tooltip:e?.tooltip,detailsOnClick:e?.detailsOnClick,language:e?.language,theme:e?.theme,graphID:e?.graphID,animate:e?.animate};default:return{}}},h=c[n],f=u(n);return l.jsx("div",{className:`grow my-0 ${n!=="statCard"?"mx-auto":"mx-0"} flex flex-col h-inherit ${e?.width?"w-fit":"w-full"} ${n!=="unitChart"&&n!=="statCard"?"justify-center":"justify-start"} ${e?.theme||"light"}`,style:{minHeight:"inherit"},children:h?l.jsx(h,{...f}):l.jsx(Ce.P,{size:"sm",marginBottom:"none",className:"p-2 text-center text-accent-dark-red dark:text-accent-red",children:`Invalid chart type: ${n}`})})}const Cc=[{chartID:"barChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!0,multiple:!1},{id:"color",required:!1,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"bulletChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!0,multiple:!1},{id:"target",required:!1,multiple:!1},{id:"qualitativeRange",required:!1,multiple:!0}]},{chartID:"radarChart",configuration:[{id:"label",required:!1,multiple:!1},{id:"values",required:!0,multiple:!0},{id:"color",required:!1,multiple:!1}]},{chartID:"stackedBarChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",multiple:!0,required:!0},{id:"date",required:!1,multiple:!1}]},{chartID:"groupedBarChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",multiple:!0,required:!0},{id:"date",required:!1,multiple:!1}]},{chartID:"lineChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1}]},{chartID:"dualAxisLineChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y1",multiple:!1,required:!0},{id:"y2",multiple:!1,required:!0}]},{chartID:"differenceLineChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y1",multiple:!1,required:!0},{id:"y2",multiple:!1,required:!0}]},{chartID:"multiLineChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",multiple:!0,required:!0}]},{chartID:"multiLineAltChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",multiple:!1,required:!0},{id:"label",multiple:!1,required:!0},{id:"color",multiple:!1,required:!1}]},{chartID:"stackedAreaChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",multiple:!0,required:!0}]},{chartID:"threeDGlobe",configuration:[{id:"id",required:!0,multiple:!1},{id:"x",required:!0,multiple:!1}]},{chartID:"choroplethMap",configuration:[{id:"id",required:!0,multiple:!1},{id:"x",required:!0,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"biVariateChoroplethMap",configuration:[{id:"id",required:!0,multiple:!1},{id:"x",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"dotDensityMap",configuration:[{id:"lat",required:!0,multiple:!1},{id:"long",required:!0,multiple:!1},{id:"label",multiple:!1,required:!1},{id:"color",multiple:!1,required:!1},{id:"radius",required:!1,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"donutChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!0,multiple:!1}]},{chartID:"slopeChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"y1",required:!0,multiple:!1},{id:"y2",required:!0,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"scatterPlot",configuration:[{id:"x",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1},{id:"radius",required:!1,multiple:!1},{id:"color",required:!1,multiple:!1},{id:"label",required:!0,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"dumbbellChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"x",multiple:!0,required:!0},{id:"date",required:!1,multiple:!1}]},{chartID:"treeMap",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!0,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"circlePacking",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!1,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"sankeyChart",configuration:[{id:"source",required:!0,multiple:!1},{id:"target",required:!0,multiple:!1},{id:"value",required:!1,multiple:!1}]},{chartID:"heatMap",configuration:[{id:"row",required:!0,multiple:!1},{id:"column",required:!0,multiple:!1},{id:"value",required:!0,multiple:!1}]},{chartID:"stripChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"position",required:!0,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"statCard",configuration:[{id:"value",required:!0,multiple:!1}]},{chartID:"beeSwarmChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"position",required:!0,multiple:!1},{id:"radius",required:!1,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"butterflyChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"leftBar",required:!0,multiple:!1},{id:"rightBar",required:!0,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"lineChartWithConfidenceInterval",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1},{id:"yMin",required:!1,multiple:!1},{id:"yMax",required:!1,multiple:!1}]},{chartID:"histogram",configuration:[{id:"value",required:!0,multiple:!1}]},{chartID:"sparkLine",configuration:[{id:"dale",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1}]},{chartID:"paretoChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"bar",required:!0,multiple:!1},{id:"line",required:!0,multiple:!1}]},{chartID:"unitChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"value",required:!0,multiple:!1}]}];function n0(t,e){return e.filter(n=>!t.includes(n))}function xE(t,e,n){const i=hn(t.map(c=>c.columnId)),r=n0(n,i);if(r.length!==0)return{isValid:!1,err:`Key(s) in configuration that don't match keys in the data: ${r.join(", ")}. Possible reason: If you are using 'dataTransform' then the allowed keys (columns) are only the one present in 'aggregationColumnsSetting' array in 'dataTransform' object plus n additional key called 'count'.`};const a=t.map(c=>c.chartConfigId),o=Cc[Cc.findIndex(c=>c.chartID===e)].configuration.filter(c=>c.required).map(c=>c.id),s=n0(a,o);return{isValid:s.length===0,err:s.length===0?void 0:`Missing required ID(s) in configuration: ${s.join(", ")}`}}const Fi=[{graphName:"Bar graph",graphID:"barChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Stacked bar graph",graphID:"stackedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Grouped bar graph",graphID:"groupedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated bar chart",graphID:"animatedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated stacked bar chart",graphID:"animatedStackedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated grouped bar chart",graphID:"animatedGroupedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Bee swarm chart",graphID:"beeSwarmChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Butterfly chart",graphID:"butterflyChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated butterfly chart",graphID:"animatedButterflyChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Bullet chart",graphID:"bulletChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Circle packing",graphID:"circlePacking",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Data table",graphID:"dataTable",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Pie/donut chart",graphID:"donutChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Dumbbell chart",graphID:"dumbbellChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated dumbbell chart",graphID:"animatedDumbbellChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Heat map",graphID:"heatMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Histogram",graphID:"histogram",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Line chart",graphID:"lineChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Multi-line chart",graphID:"multiLineChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Multi-line chart alternative",graphID:"multiLineAltChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Difference line chart",graphID:"differenceLineChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Dual-axes line chart",graphID:"dualAxisLineChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Line chart with interval",graphID:"lineChartWithConfidenceInterval",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Spark line",graphID:"sparkLine",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Choropleth map",graphID:"choroplethMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Three-D globe",graphID:"threeDGlobe",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Bi-variate choropleth map",graphID:"biVariateChoroplethMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Dot density map",graphID:"dotDensityMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated choropleth map",graphID:"animatedChoroplethMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated bi-variate choropleth map",graphID:"animatedBiVariateChoroplethMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated dot density map",graphID:"animatedDotDensityMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"GeoHub map with comparison",graphID:"geoHubCompareMap",availableInGriddedGraph:!1,geoHubMapPresentation:!0,availableInWideToLongFormat:!1},{graphName:"GeoHub map",graphID:"geoHubMap",availableInGriddedGraph:!1,geoHubMapPresentation:!0,availableInWideToLongFormat:!1},{graphName:"GeoHub map with layer selection",graphID:"geoHubMapWithLayerSelection",availableInGriddedGraph:!1,geoHubMapPresentation:!0,availableInWideToLongFormat:!1},{graphName:"Pareto chart",graphID:"paretoChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Scatter plot",graphID:"scatterPlot",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated scatter plot",graphID:"animatedScatterPlot",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Slope chart",graphID:"slopeChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Stacked area chart/area chart",graphID:"stackedAreaChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Statistic card",graphID:"statCard",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Strip chart",graphID:"stripChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Tree map",graphID:"treeMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Unit chart",graphID:"unitChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Sankey chart",graphID:"sankeyChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Data cards list",graphID:"dataCards",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Radar chart",graphID:"radarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1}];function Vc(t,e,n){if(Fi.filter(r=>r.geoHubMapPresentation).map(r=>r.graphID).indexOf(e)!==-1)return t;if(!t)return"Cannot fetch data";if(e==="dataTable"||e==="dataCards"||t.length===0)return t;if(!n)return console.error("Your data configuration is not accurate"),"No graph configuration is provided";const i=xE(n,e,Object.keys(t[0]));if(i.isValid){const r=Cc[Cc.findIndex(o=>o.chartID===e)].configuration;return t.map(o=>{const s={};return n.filter(c=>c.columnId).forEach(c=>{r[r.findIndex(u=>u.id===c.chartConfigId)].multiple?(s[r[r.findIndex(u=>u.id===c.chartConfigId)].id]=[],c.columnId.forEach(u=>{s[r[r.findIndex(h=>h.id===c.chartConfigId)].id].push(je(o[u])?null:o[u])})):s[r[r.findIndex(u=>u.id===c.chartConfigId)].id]=je(o[c.columnId])?null:o[c.columnId],s[`${c.chartConfigId}Columns`]=c.columnId}),s.data=o,s})}return console.error(i.err),i.err}function Td(t,e,n){return t.length===0?[]:typeof t[0][e]!="object"?Xe(t,o=>o[e]).map(o=>{const s={};s[e]=o[e];const c=t.filter(u=>u[e]===o[e]);return s.count=c.length,s.rollUpData=c,n?.forEach(u=>{s[u.column]=u.aggregationMethod==="average"?parseFloat((rt(c.map(h=>h[u.column]))/c.length).toFixed(2)):u.aggregationMethod==="max"?Math.max(...c.map(h=>h[u.column])):u.aggregationMethod==="min"?Math.min(...c.map(h=>h[u.column])):rt(c.map(h=>h[u.column]))}),s}):Xe(hn(t.map(a=>a[e])),a=>a).map(a=>{const o={};o[e]=a;const s=t.filter(c=>c[e].indexOf(a)!==-1);return o.rollUpData=s,o.count=s.length,n?.forEach(c=>{o[c.column]=c.aggregationMethod==="average"?parseFloat((rt(s.map(u=>u[c.column]))/s.length).toFixed(2)):c.aggregationMethod==="max"?Math.max(...s.map(u=>u[c.column])):c.aggregationMethod==="min"?Math.min(...s.map(u=>u[c.column])):rt(s.map(u=>u[c.column]))}),o})}function xw(t,e){return e.findIndex(n=>n.chartConfigId===t)===-1?!1:typeof e[e.findIndex(n=>n.chartConfigId===t)].columnId!="string"}const vE=t=>{if(t.findIndex(n=>n.chartConfigId==="yMin")!==-1&&t.findIndex(n=>n.chartConfigId==="yMax")!==-1)return t;const e=[...t];return t.findIndex(n=>n.chartConfigId==="yMin")===-1&&e.push({chartConfigId:"yMin",columnId:`${t[t.findIndex(n=>n.chartConfigId==="y")].columnId}Min`}),t.findIndex(n=>n.chartConfigId==="yMax")===-1&&e.push({chartConfigId:"yMax",columnId:`${t[t.findIndex(n=>n.chartConfigId==="y")].columnId}Max`}),e},Fu=(t,e)=>{const n=e?.map(i=>{const r=t?.findIndex(o=>o.chartConfigId===i.chartConfigId);if(r===-1)return{};const a=t[r]?.allowedColumnIds?.findIndex(o=>o.value===i.columnId);return a===-1?{}:t[r].allowedColumnIds[a].graphSettings||{}})||[];return Object.assign({},...n)};function ol(t){const{graphSettings:e,dataSettings:n,filters:i,graphType:r,dataTransform:a,graphDataConfiguration:o,dataFilters:s,debugMode:c,dataSelectionOptions:u,advancedDataSelectionOptions:h,readableHeader:f,noOfFiltersPerRow:d=4,updateFilters:g,uiMode:p="normal",theme:y="light",highlightDataPointSettings:v}=t,[m,I]=k.useState(void 0),[j,w]=k.useState(void 0),[S,P]=k.useState(o),[W,D]=k.useState({}),[x,$]=k.useState(void 0),[V,q]=k.useState([]),ae=k.useRef(null),G=k.useRef(o),[_,b]=k.useState([]),B=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),X=k.useCallback(async()=>{if(r!=="geoHubMap"&&r!=="geoHubCompareMap"&&r!=="geoHubMapWithLayerSelection"&&n)try{const O=await(n.dataURL?typeof n.dataURL=="string"?n.fileType==="json"?en(n.dataURL,n.columnsToArray,n.dataTransformation,c):n.fileType==="api"?uo(n.dataURL,n.apiHeaders,n.columnsToArray,n.dataTransformation,c):co(n.dataURL,n.dataTransformation,n.columnsToArray,c,n.delimiter,!0):ts(n.dataURL,n.idColumnTitle):$r(n.data,n.columnsToArray));w(O);const K=(i||[]).map(Q=>({filter:Q.column,label:Q.label||`Filter by ${Q.column}`,singleSelect:Q.singleSelect,clearable:Q.clearable,defaultValue:Kr(Q.defaultValue),value:Kr(Q.defaultValue),availableValues:jr(O,Q.column).filter(se=>!Q.excludeValues?.includes(`${se}`)).map(se=>({value:se,label:se})),allowSelectAll:Q.allowSelectAll,width:Q.width}));b(K)}catch(M){console.error("Data fetching error:",M)}},[n,r,i,c]);k.useEffect(()=>{X()},[X]);const z=k.useMemo(()=>!j||_.length===0?j:j.filter(O=>_.every(K=>K.value&&hn([K.value]).length>0?Qa(hn([O[K.filter]]),hn([K.value]).map(Q=>Q.value)).length>0:!0)),[_,j]);k.useEffect(()=>{u&&D(Fu(u,o))},[u,o]),k.useEffect(()=>{r!=="geoHubMap"&&r!=="geoHubCompareMap"&&r!=="geoHubMapWithLayerSelection"&&j&&I(z)},[z,r,j]),k.useEffect(()=>{v?.column&&z&&q(jr(z,v.column).filter(M=>!v?.excludeValues?.includes(`${M}`)).map(M=>({value:M,label:M})))},[z,v]),k.useEffect(()=>{dt(G.current,o)||(P(o),G.current=o)},[o]);const C=k.useCallback((M,O)=>{b(K=>K.map(Q=>Q.filter===M?{...Q,value:O}:Q))},[]),A=k.useMemo(()=>{if(!m)return;const M=r==="lineChartWithConfidenceInterval"&&S?vE(S):S;return r!=="geoHubMap"&&r!=="geoHubCompareMap"&&r!=="geoHubMapWithLayerSelection"?Vc(a?Td(Ai(m,s||[]),a.keyColumn,a.aggregationColumnsSetting):Ai(m,s||[]),r,M):void 0},[r,S,m,s,a]);return!n&&r!=="geoHubMap"&&r!=="geoHubCompareMap"&&r!=="geoHubMapWithLayerSelection"?l.jsx(Ce.P,{size:"xs",className:"text-center text-accent-dark-red dark:text-accent-red p-2",children:"Please make sure either `dataSettings` props are present as they are required for data."}):l.jsx("div",{className:`${y||e?.theme||"light"} flex ${e?.width?"w-fit grow-0":"w-full grow"}${e?.height?"":" h-full"}`,dir:e?.language==="he"||e?.language==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${e?.backgroundColor?e?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${e?.language||"en"}`,e?.classNames?.graphContainer),style:{...e?.styles?.graphContainer||{},...e?.backgroundColor&&e?.backgroundColor!==!0?{backgroundColor:e?.backgroundColor}:{}},id:e?.graphID,ref:ae,children:l.jsx("div",{style:{padding:e?.backgroundColor?e?.padding||"1rem":e?.padding||0,flexGrow:1,display:"flex"},children:l.jsx("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:m||Fi.filter(M=>M.geoHubMapPresentation).map(M=>M.graphID).indexOf(r)!==-1?l.jsxs(l.Fragment,{children:[W?.graphTitle||W?.graphDescription||e?.graphTitle||e?.graphDescription||e?.graphDownload||e?.dataDownload?l.jsx(Qe,{styles:{title:W?.styles?.title||e?.styles?.title,description:W?.styles?.description||e?.styles?.description},classNames:{title:W?.classNames?.title||e?.classNames?.title,description:W?.classNames?.description||e?.classNames?.description},graphTitle:W?.graphTitle||e?.graphTitle,graphDescription:W?.graphDescription||e?.graphDescription,width:W?.width||e?.width,graphDownload:e?.graphDownload?ae.current:void 0,dataDownload:e?.dataDownload&&m&&m.length>0?m:null}):null,_.length!==0||(u||[]).length!==0||(h||[]).length!==0||v?l.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:[h?.map((M,O)=>l.jsxs("div",{style:{width:M.width||`calc(${100/d}% - ${(d-1)/d}rem)`,flexGrow:1,flexShrink:M.ui!=="radio"?0:1,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:M.label||"Graph by"}),M.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:M.options.map(K=>({...K,value:K.label})),size:"sm",isClearable:!1,isSearchable:!0,variant:p,controlShouldRenderValue:!0,defaultValue:M.defaultValue?{...M.defaultValue,value:M.defaultValue?.label}:{...M.options[0],value:M.options[0].label},onChange:K=>{D(K?.graphSettings||{}),P(K?.dataConfiguration)}}):l.jsx(Ce.RadioGroup,{defaultValue:M.defaultValue?.label||M.options[0].label,variant:p,onValueChange:K=>{const Q=M.options[M.options.findIndex(se=>se.label===K)];D(Q.graphSettings||{}),P(Q.dataConfiguration)},children:M.options.map((K,Q)=>l.jsx(Ce.RadioGroupItem,{label:K.label,value:K.label},Q))})]},O)),u?.map((M,O)=>l.jsxs("div",{style:{width:M.width||`calc(${100/d}% - ${(d-1)/d}rem)`,flexGrow:1,flexShrink:M.ui!=="radio"?0:1,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:M.label||`Visualize ${M.chartConfigId} by`}),xw(M.chartConfigId,S||[])?M.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:M.allowedColumnIds,size:"sm",isMulti:!0,isSearchable:!0,variant:p,controlShouldRenderValue:!0,defaultValue:o?o[o.findIndex(K=>K.chartConfigId===M.chartConfigId)].columnId.map(K=>M.allowedColumnIds[M.allowedColumnIds.findIndex(Q=>Q.value===K)]):void 0,filterOption:Ce.createFilter(B),onChange:K=>{const Q={columnId:(K||[]).map(T=>T.value),chartConfigId:M.chartConfigId},se=S?.map(T=>T.chartConfigId===Q.chartConfigId?Q:T);P(se)}}):l.jsx(Ce.CheckboxGroup,{variant:p,defaultValue:o?o[o.findIndex(K=>K.chartConfigId===M.chartConfigId)].columnId.map(K=>M.allowedColumnIds[M.allowedColumnIds.findIndex(Q=>Q.value===K)]).map(K=>K.value):[],onValueChange:K=>{const Q={columnId:K||[],chartConfigId:M.chartConfigId},se=S?.map(T=>T.chartConfigId===Q.chartConfigId?Q:T);P(se)},children:M.allowedColumnIds.map((K,Q)=>l.jsx(Ce.CheckboxGroupItem,{label:K.label,value:K.label},Q))}):M.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:M.allowedColumnIds,size:"sm",isClearable:!1,isSearchable:!0,variant:p,controlShouldRenderValue:!0,defaultValue:o?M.allowedColumnIds[M.allowedColumnIds.findIndex(K=>K.value===o[o.findIndex(Q=>Q.chartConfigId===M.chartConfigId)].columnId)]:void 0,onChange:K=>{const Q={columnId:K?.value,chartConfigId:M.chartConfigId},se=S?.map(T=>T.chartConfigId===Q.chartConfigId?Q:T);D(Fu(u,se)),P(se)}}):l.jsx(Ce.RadioGroup,{variant:p,defaultValue:o?M.allowedColumnIds[M.allowedColumnIds.findIndex(K=>K.value===o[o.findIndex(Q=>Q.chartConfigId===M.chartConfigId)].columnId)].label:"",onValueChange:K=>{const se={columnId:M.allowedColumnIds[M.allowedColumnIds.findIndex(Z=>Z.label===K)].value,chartConfigId:M.chartConfigId},T=S?.map(Z=>Z.chartConfigId===se.chartConfigId?se:Z);D(Fu(u,T)),P(T)},children:M.allowedColumnIds.map((K,Q)=>l.jsx(Ce.RadioGroupItem,{label:K.label,value:K.label},Q))})]},O)),_?.map((M,O)=>l.jsxs("div",{style:{width:M.width||`calc(${100/d}% - ${(d-1)/d}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:M.label}),M.singleSelect?l.jsx(Ce.DropdownSelect,{options:M.availableValues,variant:p,isClearable:M.clearable===void 0?!0:M.clearable,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:K=>{C(M.filter,K)},value:M.value,defaultValue:M.defaultValue}):l.jsxs(l.Fragment,{children:[M.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:M.availableValues,variant:p,size:"sm",isMulti:!0,isClearable:M.clearable===void 0?!0:M.clearable,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:K=>{C(M.filter,K)},value:M.value,defaultValue:M.defaultValue}):l.jsx(Ce.CheckboxGroup,{variant:p,defaultValue:M.defaultValue?M.defaultValue.map(K=>`${K.value}`):[],value:M.value?M.value.map(K=>`${K.value}`):void 0,onValueChange:K=>{C(M.filter,M.availableValues.filter(Q=>K.indexOf(`${Q.value}`)!==-1))},children:M.availableValues.map((K,Q)=>l.jsx(Ce.CheckboxGroupItem,{label:`${K.label}`,value:`${K.value}`},Q))}),M.allowSelectAll?l.jsx("button",{type:"button",className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",onClick:()=>{C(M.filter,M.availableValues)},children:"Select all options"}):null]})]},O)),v?l.jsxs("div",{style:{width:v.width||`calc(${100/d}% - ${(d-1)/d}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:v.label||"Highlight data"}),l.jsx(Ce.DropdownSelect,{options:V,variant:p,size:"sm",isMulti:!0,isClearable:!0,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:M=>{$(M?.map(O=>O.value))},value:x?.map(M=>({label:M,value:M})),defaultValue:v.defaultValues?.map(M=>({label:M,value:M}))})]}):null]}):null,l.jsx(yw,{graph:r,graphData:A,graphDataConfiguration:S,debugMode:c,readableHeader:f||[],updateFilters:g,settings:{...e||{},...W,graphTitle:void 0,graphDescription:void 0,graphDownload:!1,dataDownload:!1,backgroundColor:void 0,padding:"0",theme:e?.theme||y,...x?{highlightedDataPoints:x,highlightedIds:x?.map(M=>`${M}`),highlightedLines:x?.map(M=>M)}:{}}})]}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})})})})})}const Ru=t=>t.map(i=>i.columnWidth||1).reduce((i,r)=>i+r,0),wE=["barChart","choroplethMap","biVariateChoroplethMap","circlePacking","treeMap"];function vw(t){const{dashboardID:e,dashboardLayout:n,dataSettings:i,filters:r,debugMode:a,theme:o="light",readableHeader:s,dataFilters:c,noOfFiltersPerRow:u=4,filterPosition:h,uiMode:f="normal",graphStyles:d,graphClassNames:g}=t,[p,y]=k.useState(void 0),[v,m]=k.useState(void 0),[I,j]=k.useState([]),w=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),S=k.useMemo(()=>!v||I.length===0?v:v.filter(x=>I.every($=>$.value&&hn([$.value]).length>0?Qa(hn([x[$.filter]]),hn([$.value]).map(V=>V.value)).length>0:!0)),[I,v]);k.useEffect(()=>{y(S)},[S]);const P=k.useCallback(async()=>{if(i)try{const x=await(i.dataURL?typeof i.dataURL=="string"?i.fileType==="json"?en(i.dataURL,i.columnsToArray,i.dataTransformation,a):i.fileType==="api"?uo(i.dataURL,i.apiHeaders,i.columnsToArray,i.dataTransformation,a):co(i.dataURL,i.dataTransformation,i.columnsToArray,a,i.delimiter,!0):ts(i.dataURL,i.idColumnTitle):$r(i.data,i.columnsToArray));m(x);const $=(r||[]).map(V=>({filter:V.column,label:V.label||`Filter by ${V.column}`,singleSelect:V.singleSelect,clearable:V.clearable,defaultValue:Kr(V.defaultValue),value:Kr(V.defaultValue),availableValues:jr(x,V.column).filter(q=>!V.excludeValues?.includes(`${q}`)).map(q=>({value:q,label:q})),allowSelectAll:V.allowSelectAll,width:V.width}));j($)}catch(D){console.error("Data fetching error:",D)}},[i,r,a]);k.useEffect(()=>{P()},[P]);const W=k.useCallback((D,x)=>{j($=>$.map(V=>V.filter===D?{...V,value:x}:V))},[]);return l.jsx("div",{className:`${o||"light"} flex grow`,dir:n.language==="he"||n.language==="ar"?"rtl":void 0,children:l.jsx("div",{className:`${n.backgroundColor?n.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto gap-4 flex flex-col w-full grow h-inherit ${n.language||"en"}`,style:{...n.backgroundColor&&n.backgroundColor!==!0?{backgroundColor:n.backgroundColor}:{}},id:e,children:l.jsx("div",{style:{padding:n.backgroundColor?n.padding||"1rem":n.padding||0,flexGrow:1,display:"flex"},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n.title||n.description?l.jsx(Qe,{graphTitle:n.title,graphDescription:n.description,isDashboard:!0}):null,l.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap"},children:[I.length!==0?l.jsx("div",{style:{width:h==="side"?"280px":"100%",flexGrow:1,flexShrink:0},children:l.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%",position:"sticky",top:"1rem"},children:I?.map((D,x)=>l.jsxs("div",{style:{width:D.width||`calc(${100/u}% - ${(u-1)/u}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:D.label}),D.singleSelect?l.jsx(Ce.DropdownSelect,{options:D.availableValues,isClearable:D.clearable===void 0?!0:D.clearable,size:"sm",variant:f,isMulti:!1,isSearchable:!0,filterOption:Ce.createFilter(w),onChange:$=>{W(D.filter,$)},defaultValue:D.defaultValue,value:D.value}):l.jsxs(l.Fragment,{children:[l.jsx(Ce.DropdownSelect,{options:D.availableValues,isMulti:!0,size:"sm",isClearable:D.clearable===void 0?!0:D.clearable,variant:f,isSearchable:!0,controlShouldRenderValue:!0,closeMenuOnSelect:!1,hideSelectedOptions:!1,filterOption:Ce.createFilter(w),onChange:$=>{W(D.filter,$)},value:D.value,defaultValue:D.defaultValue}),D.allowSelectAll?l.jsx("button",{type:"button",className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",onClick:()=>{W(D.filter,D.availableValues)},children:"Select all options"}):null]})]},x))})}):null,l.jsx("div",{style:{width:h==="side"?"calc(100% - 280px - 1rem)":"100%",minWidth:"280px",flexGrow:1,display:"flex",gap:"1rem",flexWrap:"wrap",flexShrink:"0"},children:n.rows.map((D,x)=>l.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${D.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:D.columns.map(($,V)=>l.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*($.columnWidth||1)/Ru(D.columns)}% - ${(Ru(D.columns)-($.columnWidth||1))/Ru(D.columns)}rem)`,minHeight:"inherit"},children:l.jsx(ol,{graphType:$.graphType,dataFilters:$.dataFilters,uiMode:f,graphSettings:{...$.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:$.attachedFilter?!1:$.settings?.resetSelectionOnDoubleClick,styles:$.settings?.styles||d,classNames:$.settings?.classNames||g,radius:$.graphType==="donutChart"?void 0:$.settings?.radius,size:$.graphType==="unitChart"?$.settings?.size:void 0,language:$.settings?.language||n.language,theme:$.settings?.theme||o},dataSettings:{data:p?Ai(p,c||[]):void 0},updateFilters:$.attachedFilter&&wE.indexOf($.graphType)!==-1&&I.findIndex(q=>q.filter===$.attachedFilter)!==-1?q=>{const ae=I.findIndex(_=>_.filter===$.attachedFilter),G=q?I[ae].singleSelect?{value:q,label:q}:[{value:q,label:q}]:void 0;W($.attachedFilter,G)}:void 0,dataTransform:$.dataTransform,dataSelectionOptions:$.dataSelectionOptions,advancedDataSelectionOptions:$.advancedDataSelectionOptions,graphDataConfiguration:$.graphDataConfiguration,debugMode:a,readableHeader:s||[]})},V))},x))})]})]})})})})}function bE(t,e,n,i){const r=[];return t.forEach(a=>{Object.entries(a).forEach(([o,s])=>{if(o!==e){const c={indicator:n.findIndex(u=>u.value===o)!==-1?n[n.findIndex(u=>u.value===o)].label:o,value:s};c[e]=a[e],r.push(c)}})}),i&&console.log(r),r}const Bu=t=>t.map(i=>i.columnWidth||1).reduce((i,r)=>i+r,0);function ww(t){const{dashboardID:e,dashboardLayout:n,dataSettings:i,debugMode:r,theme:a="light",readableHeader:o,dataFilters:s,uiMode:c="normal",graphStyles:u,graphClassNames:h}=t,f=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),[d,g]=k.useState(void 0),[p,y]=k.useState([]),[v,m]=k.useState(void 0),[I,j]=k.useState(void 0);k.useEffect(()=>{if(I){const S=I.filter(P=>P[i.keyColumn]===v);g(S)}},[I,v,i.keyColumn]);const w=k.useCallback(async()=>{if(i)try{const P=await(i.dataURL?typeof i.dataURL=="string"?i.fileType==="json"?en(i.dataURL,void 0,i.dataTransformation,r):i.fileType==="api"?uo(i.dataURL,i.apiHeaders,void 0,i.dataTransformation,r):co(i.dataURL,i.dataTransformation,void 0,r,i.delimiter,!0):ts(i.dataURL,i.idColumnTitle):$r(i.data,void 0)),W=Ai(P,s||[]);y(W.map(x=>x[i.keyColumn])),m(W[0][i.keyColumn]);const D=bE(W,i.keyColumn,o||[],r);j(D)}catch(S){console.error("Data fetching error:",S)}},[i,r,s,o]);return k.useEffect(()=>{w()},[w]),l.jsx("div",{className:`${a||"light"} flex grow`,dir:n.language==="he"||n.language==="ar"?"rtl":void 0,children:l.jsx("div",{className:`${n?.backgroundColor?n?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col h-inherit w-full ml-auto mr-auto grow gap-4 ${n?.language||"en"}`,style:{...n?.backgroundColor&&n?.backgroundColor!==!0?{backgroundColor:n?.backgroundColor}:{}},id:e,children:l.jsx("div",{className:"flex grow",style:{padding:n.backgroundColor?n.padding||"1rem":n.padding||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n.title||n.description?l.jsx(Qe,{graphTitle:n.title,graphDescription:n.description,isDashboard:!0}):null,d?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:l.jsxs("div",{style:{width:"100%",flexGrow:1,flexShrink:0,minWidth:"240px"},children:[n.dropdownLabel?l.jsx(Ce.Label,{className:"mb-2",children:n.dropdownLabel}):null,l.jsx(Ce.DropdownSelect,{options:p.map(S=>({value:S,label:S})),size:"sm",variant:c,isClearable:!1,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(f),onChange:S=>{m(S?.value)},defaultValue:{value:v,label:v}})]})}),n.rows.map((S,P)=>l.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${S.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:S.columns.map((W,D)=>l.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*(W.columnWidth||1)/Bu(S.columns)}% - ${(Bu(S.columns)-(W.columnWidth||1))/Bu(S.columns)}rem)`,minHeight:"inherit"},children:l.jsx(ol,{graphType:W.graphType,dataFilters:W.dataFilters,uiMode:c,graphSettings:{...W.settings||{},width:void 0,height:void 0,radius:W.graphType==="donutChart"?void 0:W.settings?.radius,size:W.graphType==="unitChart"?W.settings.size:void 0,language:W.settings?.language||n.language,theme:W.settings?.theme||a,styles:W.settings?.styles||u,classNames:W.settings?.classNames||h},dataSettings:{data:d},graphDataConfiguration:W.graphDataConfiguration?W.graphDataConfiguration:W.graphType==="unitChart"?[{columnId:"indicator",chartConfigId:"label"},{columnId:"value",chartConfigId:"value"}]:[{columnId:"indicator",chartConfigId:"label"},{columnId:"value",chartConfigId:"size"}],debugMode:r,readableHeader:o||[]})},D))},P))]}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})]})})})})}function bw(t){const{graphSettings:e,dataSettings:n,filters:i,graphType:r,dataTransform:a,graphDataConfiguration:o,noOfColumns:s,columnGridBy:c,dataFilters:u,showCommonColorScale:h,minGraphHeight:f,minGraphWidth:d,debugMode:g,dataSelectionOptions:p,advancedDataSelectionOptions:y,readableHeader:v,noOfFiltersPerRow:m=4,uiMode:I="normal",theme:j="light"}=t,[w,S]=k.useState(void 0),[P,W]=k.useState(void 0),[D,x]=k.useState([]),$=k.useRef(null),[V,q]=k.useState(o),[ae,G]=k.useState([]),[_,b]=k.useState({}),B=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),X=k.useMemo(()=>!P||ae.length===0?P:P.filter(M=>ae.every(O=>O.value&&hn([O.value]).length>0?Qa(hn([M[O.filter]]),hn([O.value]).map(K=>K.value)).length>0:!0)),[ae,P]);k.useEffect(()=>{S(X)},[X]);const z=k.useCallback(async()=>{if(n)try{const M=await(n.dataURL?typeof n.dataURL=="string"?n.fileType==="json"?en(n.dataURL,n.columnsToArray,n.dataTransformation,g):n.fileType==="api"?uo(n.dataURL,n.apiHeaders,n.columnsToArray,n.dataTransformation,g):co(n.dataURL,n.dataTransformation,n.columnsToArray,g,n.delimiter,!0):ts(n.dataURL,n.idColumnTitle):$r(n.data,n.columnsToArray));W(M);const O=jr(M,c);x(O);const K=(i||[]).map(Q=>({filter:Q.column,label:Q.label||`Filter by ${Q.column}`,singleSelect:Q.singleSelect,clearable:Q.clearable,defaultValue:Kr(Q.defaultValue),value:Kr(Q.defaultValue),availableValues:jr(M,Q.column).filter(se=>!Q.excludeValues?.includes(`${se}`)).map(se=>({value:se,label:se})),allowSelectAll:Q.allowSelectAll,width:Q.width}));G(K)}catch(A){console.error("Data fetching error:",A)}},[n,g,c,i]);k.useEffect(()=>{z()},[z]),k.useEffect(()=>{q(o)},[o]);const C=k.useCallback((A,M)=>{G(O=>O.map(K=>K.filter===A?{...K,value:M}:K))},[]);return l.jsx("div",{className:`${j||e?.theme||"light"} flex ${e?.width?"w-fit grow-0":"w-full grow"}`,dir:e?.language==="he"||e?.language==="ar"?"rtl":void 0,children:l.jsx("div",{className:`${e?.backgroundColor?e?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${e?.language||"en"}`,style:{...e?.backgroundColor&&e?.backgroundColor!==!0?{backgroundColor:e?.backgroundColor}:{}},id:e?.graphID,ref:$,"aria-label":e?.ariaLabel||`${e?.graphTitle?`The graph shows ${e?.graphTitle}. `:""}This is a gridded chart.${e?.graphDescription?` ${e?.graphDescription}`:""}`,children:l.jsx("div",{style:{padding:e?.backgroundColor?e?.padding||"1rem":e?.padding||0,flexGrow:1,display:"flex"},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[_?.graphTitle||_?.graphDescription||e?.graphTitle||e?.graphDescription||e?.graphDownload||e?.dataDownload?l.jsx(Qe,{styles:{title:_?.styles?.title||e?.styles?.title,description:_?.styles?.description||e?.styles?.description},classNames:{title:_?.classNames?.title||e?.classNames?.title,description:_?.classNames?.description||e?.classNames?.description},graphTitle:_?.graphTitle||e?.graphTitle,graphDescription:_?.graphDescription||e?.graphDescription,width:_?.width||e?.width,graphDownload:e?.graphDownload?$.current:void 0,dataDownload:e?.dataDownload&&w&&w.length>0?w:null}):null,w&&D.length>0?l.jsxs(l.Fragment,{children:[ae.length!==0||(p||[]).length!==0||(y||[]).length!==0?l.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:[y?.map((A,M)=>l.jsxs("div",{style:{width:A.width||`calc(${100/m}% - ${(m-1)/m}rem)`,flexGrow:1,flexShrink:A.ui!=="radio"?0:1,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:A.label||"Graph by"}),A.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:A.options.map(O=>({...O,value:O.label})),isClearable:!1,isSearchable:!0,variant:I,controlShouldRenderValue:!0,defaultValue:A.defaultValue?{...A.defaultValue,value:A.defaultValue?.label}:{...A.options[0],value:A.options[0].label},onChange:O=>{b(O?.graphSettings||{}),q(O?.dataConfiguration)}}):l.jsx(Ce.RadioGroup,{defaultValue:A.defaultValue?.label||A.options[0].label,variant:I,onValueChange:O=>{const K=A.options[A.options.findIndex(Q=>Q.label===O)];b(K.graphSettings||{}),q(K.dataConfiguration)},children:A.options.map((O,K)=>l.jsx(Ce.RadioGroupItem,{label:O.label,value:O.label},K))})]},M)),p?.map((A,M)=>l.jsxs("div",{style:{width:A.width||`calc(${100/m}% - ${(m-1)/m}rem)`,flexGrow:1,flexShrink:A.ui!=="radio"?0:1,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:A.label||`Visualize ${A.chartConfigId} by`}),xw(A.chartConfigId,V||[])?A.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:A.allowedColumnIds,isMulti:!0,variant:I,isSearchable:!0,controlShouldRenderValue:!0,defaultValue:o?o[o.findIndex(O=>O.chartConfigId===A.chartConfigId)].columnId.map(O=>A.allowedColumnIds[A.allowedColumnIds.findIndex(K=>K.value===O)]):void 0,filterOption:Ce.createFilter(B),onChange:O=>{const K={columnId:O.map(se=>se.value),chartConfigId:A.chartConfigId},Q=V?.map(se=>se.chartConfigId===K.chartConfigId?K:se);q(Q)},isRtl:e?.language==="ar"||e?.language==="he"}):l.jsx(Ce.CheckboxGroup,{variant:I,defaultValue:o?o[o.findIndex(O=>O.chartConfigId===A.chartConfigId)].columnId.map(O=>A.allowedColumnIds[A.allowedColumnIds.findIndex(K=>K.value===O)]).map(O=>O.value):[],onValueChange:O=>{const K={columnId:O||[],chartConfigId:A.chartConfigId},Q=V?.map(se=>se.chartConfigId===K.chartConfigId?K:se);q(Q)},children:A.allowedColumnIds.map((O,K)=>l.jsx(Ce.CheckboxGroupItem,{label:O.label,value:O.label},K))}):A.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:A.allowedColumnIds,isClearable:!1,isSearchable:!0,variant:I,defaultValue:o?A.allowedColumnIds[A.allowedColumnIds.findIndex(O=>O.value===o[o.findIndex(K=>K.chartConfigId===A.chartConfigId)].columnId)]:void 0,controlShouldRenderValue:!0,onChange:O=>{const K={columnId:O?.value,chartConfigId:A.chartConfigId},Q=V?.map(se=>se.chartConfigId===K.chartConfigId?K:se);b(O?.graphSettings||{}),q(Q)}}):l.jsx(Ce.RadioGroup,{variant:I,defaultValue:o?A.allowedColumnIds[A.allowedColumnIds.findIndex(O=>O.value===o[o.findIndex(K=>K.chartConfigId===A.chartConfigId)].columnId)].label:"",onValueChange:O=>{const K=A.allowedColumnIds[A.allowedColumnIds.findIndex(T=>T.label===O)],Q={columnId:K.value,chartConfigId:A.chartConfigId},se=V?.map(T=>T.chartConfigId===Q.chartConfigId?Q:T);b(K.graphSettings||{}),q(se)},children:A.allowedColumnIds.map((O,K)=>l.jsx(Ce.RadioGroupItem,{label:O.label,value:O.label},K))})]},M)),ae?.map((A,M)=>l.jsxs("div",{style:{width:A.width||`calc(${100/m}% - ${(m-1)/m}rem)`,flexGrow:1,flexShrink:0,flexWrap:"wrap"},children:[l.jsx(Ce.Label,{className:"mb-2",children:A.label}),A.singleSelect?l.jsx(Ce.DropdownSelect,{variant:I,options:A.availableValues,isClearable:A.clearable===void 0?!0:A.clearable,isRtl:e?.language==="ar"||e?.language==="he",isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:O=>{C(A.filter,O)},defaultValue:A.defaultValue}):l.jsxs(l.Fragment,{children:[l.jsx(Ce.DropdownSelect,{variant:I,options:A.availableValues,isMulti:!0,isClearable:A.clearable===void 0?!0:A.clearable,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:O=>{C(A.filter,O)},defaultValue:A.defaultValue,isRtl:e?.language==="ar"||e?.language==="he"}),A.allowSelectAll?l.jsx("button",{className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",type:"button",onClick:()=>{C(A.filter,A.availableValues)},children:"Select all options"}):null]})]},M))]}):null,h!==!1&&e?.showColorScale!==!1?l.jsx(Hi,{width:e?.width,colorLegendTitle:e?.colorLegendTitle,colors:e?.colors||e?.lineColors||Pe[e?.theme||"light"].categoricalColors.colors,colorDomain:e?.colorDomain||e?.labels||[],showNAColor:e?.showNAColor===void 0||e?.showNAColor===null?!0:e?.showNAColor}):null,l.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"1rem",flexDirection:e?.language==="ar"||e?.language==="he"?"row-reverse":"row",justifyContent:"center"},children:D.map((A,M)=>l.jsx("div",{style:{width:`calc(${100/(s||Math.min(4,D.length||0))}% - ${((s||Math.min(4,D.length||0))-1)/(s||Math.min(4,D.length||0))}rem)`,minWidth:je(d)?"280px":`${d}px`},children:l.jsx(yw,{graph:r,graphDataConfiguration:V,graphData:Vc(a?Td(Ai(w,u||[]).filter(O=>O[c]===A),a.keyColumn,a.aggregationColumnsSetting):Ai(w,u||[]).filter(O=>O[c]===A),r,V)||[],debugMode:g,settings:{...e||{},..._,theme:e?.theme||j,width:void 0,height:void 0,relativeHeight:e?.relativeHeight||.67,minHeight:f,graphTitle:`${A}`,graphDescription:void 0,graphDownload:!1,dataDownload:!1,backgroundColor:void 0,padding:"0",footNote:void 0,sources:void 0,showColorScale:e?.showColorScale===!1?!1:h===!1},readableHeader:v||[]})},M))})]}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})}),e?.sources||e?.footNote?l.jsx(et,{styles:{footnote:e?.styles?.footnote,source:e?.styles?.source},classNames:{footnote:e?.classNames?.footnote,source:e?.classNames?.source},sources:e?.sources,footNote:e?.footNote,width:e?.width}):null]})})})})}function CE(t){const{chapters:e,visibilityThreshold:n=.5,mode:i="overlay",infoWidth:r="320px",infoPosition:a="left",infoBackgroundColor:o="rgba(255,255,255,0.8)"}=t,[s,c]=k.useState(0),u=[];return e.forEach((h,f)=>{h.sections.forEach((d,g)=>{u.push({chapter:f,dataSettings:h.dataSettings,section:g,graphType:h.graphType,infoBox:d.infoBox,graphSettings:{...h.graphSettings,...d.graphSettings||{},animate:!0},graphDataConfiguration:d.graphDataConfiguration||h.graphDataConfiguration||[]})})}),l.jsxs("div",{className:"relative w-full h-full",children:[l.jsx($e.div,{className:"fixed top-0 h-full -z-10",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},style:{left:i==="overlay"||a==="right"?0:r,width:i==="overlay"?"100%":`calc(100% - ${r})`},children:l.jsx(ol,{graphType:u[s].graphType,dataSettings:u[s].dataSettings,graphSettings:u[s].graphSettings,graphDataConfiguration:u[s].graphDataConfiguration})},u[s].chapter),l.jsx("div",{children:u.map((h,f)=>l.jsx(SE,{width:r,index:f,infoBox:h.infoBox,setActiveIndex:c,position:a,mode:i,visibilityThreshold:n,backgroundColor:o},`${h.chapter}-${h.section}`))})]})}function SE({infoBox:t,index:e,setActiveIndex:n,position:i,mode:r,visibilityThreshold:a,backgroundColor:o,width:s}){const c=k.useRef(null);return ct(c,{once:!1,amount:a})&&n(e),l.jsx("section",{ref:c,className:`min-h-screen flex ${i==="center"?"justify-center":i==="right"?"justify-end":"justify-start"}`,children:l.jsxs("div",{className:`p-8 ${r==="overlay"?"h-fit mx-10 ":""}`,style:{backgroundColor:o,width:s},children:[t.title,t.description]})})}function DE(t){const{config:e}=t,[n,i]=k.useState(void 0);return k.useEffect(()=>{(async()=>{if(typeof e=="string"){const a=await en(e);i(a)}else i(e)})()},[e]),n?l.jsx(vw,{dashboardID:n.dashboardID,dashboardLayout:n.dashboardLayout,dataSettings:n.dataSettings,filters:n.filters,debugMode:n.debugMode,theme:n.theme,readableHeader:n.readableHeader,dataFilters:n.dataFilters,noOfFiltersPerRow:n.noOfFiltersPerRow,filterPosition:n.filterPosition,uiMode:n.uiMode,graphStyles:n.graphStyles,graphClassNames:n.graphClassNames}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})}function ME(t){const{config:e}=t,[n,i]=k.useState(void 0);return k.useEffect(()=>{typeof e=="string"?en(e).then(a=>{i(a)}):i(e)},[e]),n?l.jsx(ww,{dashboardID:n.dashboardID,dashboardLayout:n.dashboardLayout,dataSettings:n.dataSettings,debugMode:n.debugMode,theme:n.theme,readableHeader:n.readableHeader,dataFilters:n.dataFilters,uiMode:n.uiMode,graphStyles:n.graphStyles,graphClassNames:n.graphClassNames}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})}function TE(t){const{config:e}=t,[n,i]=k.useState(void 0);return k.useEffect(()=>{typeof e=="string"?en(e).then(a=>{i(a)}):i(e)},[e]),n?l.jsx(ol,{graphSettings:n.graphSettings,dataSettings:n.dataSettings,filters:n.filters,graphType:n.graphType,dataTransform:n.dataTransform,graphDataConfiguration:n.graphDataConfiguration,dataFilters:n.dataFilters,debugMode:n.debugMode,dataSelectionOptions:n.dataSelectionOptions,advancedDataSelectionOptions:n.advancedDataSelectionOptions,readableHeader:n.readableHeader,noOfFiltersPerRow:n.noOfFiltersPerRow,uiMode:n.uiMode,highlightDataPointSettings:n.highlightDataPointSettings}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})}function kE(t){const{config:e}=t,[n,i]=k.useState(void 0);return k.useEffect(()=>{(async()=>{if(typeof e=="string"){const a=await en(e);i(a)}else i(e)})()},[e]),n?l.jsx(bw,{noOfColumns:n.noOfColumns,columnGridBy:n.columnGridBy,graphSettings:n.graphSettings,dataSettings:n.dataSettings,filters:n.filters,graphType:n.graphType,minGraphHeight:n.minGraphHeight,minGraphWidth:n.minGraphWidth,dataTransform:n.dataTransform,graphDataConfiguration:n.graphDataConfiguration,dataFilters:n.dataFilters,showCommonColorScale:n.showCommonColorScale,debugMode:n.debugMode,dataSelectionOptions:n.dataSelectionOptions,advancedDataSelectionOptions:n.advancedDataSelectionOptions,readableHeader:n.readableHeader,noOfFiltersPerRow:n.noOfFiltersPerRow,theme:n.theme}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})}const Cw=(t,e,n,i,r)=>{const a="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8",o=Bc.utils.json_to_sheet([i],{header:n,skipHeader:!0});o["!cols"]=r,Bc.utils.sheet_add_json(o,t,{header:n,skipHeader:!0,origin:-1});const s={Sheets:{data:o},SheetNames:["data"]},c=Bc.write(s,{bookType:"xlsx",type:"array"}),u=new Blob([c],{type:a});Hw.saveAs(u,`${e}.xlsx`)};function jE(t){const{buttonContent:e,buttonType:n="tertiary",csvData:i,fileName:r="data",headers:a,xlsxHeader:o,wscols:s,buttonSmall:c,className:u=""}=t;return l.jsx(Ce.Button,{variant:n,className:`${c?"p-2":"py-4 px-6"} ${u}`,onClick:()=>Cw(i,r,a,o,s),"aria-label":"Click to download the data as xlsx",children:e||l.jsx(Bf,{})})}function Rh(t,e){const n=zw.elementToSVG(t),r=new XMLSerializer().serializeToString(n),a=new Blob([r],{type:"application/xml"}),o=document.createElement("a");o.href=window.URL.createObjectURL(a),o.download=`${e}.svg`,document.body.appendChild(o),o.click(),document.body.removeChild(o)}function AE(t){const{nodeID:e,filename:n="image",buttonContent:i,buttonType:r="tertiary",buttonSmall:a,className:o=""}=t;return l.jsx(Ce.Button,{variant:r,className:`undp-viz-download-button ${a?"p-2":"py-4 px-6"} ${o}`,onClick:()=>{typeof e=="string"?document.getElementById(e)?Rh(document.getElementById(e),n):console.error("Cannot find the html element"):Rh(e,n)},"aria-label":"Click to download the graph as svg",children:i||l.jsx(kx,{})})}function _E(t){const{text:e,successMessage:n="Text copied",buttonText:i,buttonSmall:r=!1,className:a=""}=t,{toast:o}=Ce.useToast();return l.jsxs(l.Fragment,{children:[l.jsxs(Ce.Button,{variant:"tertiary",className:`${r?"p-2":"py-4 px-6"} ${a}`,onClick:()=>{navigator.clipboard.writeText(e),o({variant:"success",description:n,duration:1e3})},"aria-label":"Click to copy the text",children:[l.jsx(XA,{}),i||null]}),l.jsx(Ce.Toaster,{})]})}const OE=t=>{let e="";return t.forEach(i=>{e+=`~${`${i}`.replace(/ /g,"+")}`}),e.substring(1)};function Sw(t,e){let n="";return e.forEach(i=>{let r="";switch(typeof i.value){case"number":r=`${i.value}`;break;case"boolean":r=`${i.value}`;break;case"object":r=OE(i.value);break;default:r=`${i.value}`}n+=`&${i.id}=${r.replace(/ /g,"+").replaceAll("'","_")}`}),`${t}?${n}`}function NE(t,e){return`<iframe src="${Sw(t,e)}" loading="lazy" style="width: 100%; border: 0px none"></iframe>`}function IE(t,e){const n=t.slice().sort((r,a)=>r-a),i=Math.ceil(e/100*n.length)-1;return n[i]}function $E(){const t=[];return new URL(window.location.href).searchParams.forEach((e,n)=>{t.push({param:n,value:e.replaceAll("+"," ").replaceAll("_","'").split("~").length>1?e.replaceAll("+"," ").replaceAll("_","'").split("~"):e.replaceAll("+"," ").replaceAll("_","'")})}),t}function LE(t,e=2){const n=t.reduce((o,s)=>o+s,0)/t.length,i=Math.sqrt(t.reduce((o,s)=>o+(s-n)**2,0)/t.length),r=e*i;return t.filter(o=>Math.abs(o-n)<=r)}async function PE(t,e,n,i,r,a,o,s,c){try{const u=await(typeof t=="string"?i==="json"?en(t,a,s,!1):i==="api"?uo(t,o,a,s,!1):co(t,s,a,!1,r,!0):ts(t,c));return Vc(u,n,e)}catch(u){return console.error("Error fetching or processing data",u),null}}const Dw="https://raw.githubusercontent.com/UNDP-Data/undp-viz-library-schemas/refs/heads/main/";function EE(t){if(Fi.filter(e=>e.geoHubMapPresentation).map(e=>e.graphID).indexOf(t)!==-1)return null;switch(t){case"dataTable":return"dataSchema/dataTableDataSchema.json";case"dataCards":return"dataSchema/dataTableDataSchema.json";case"barChart":return"dataSchema/barGraphDataSchema.json";case"stackedBarChart":return"dataSchema/stackedBarGraphDataSchema.json";case"groupedBarChart":return"dataSchema/groupedBarGraphDataSchema.json";case"lineChart":return"dataSchema/lineChartDataSchema.json";case"dualAxisLineChart":return"dataSchema/dualAxisLineChartDataSchema.json";case"differenceLineChart":return"dataSchema/differenceLineChartDataSchema.json";case"multiLineChart":return"dataSchema/multiLineChartDataSchema.json";case"multiLineAltChart":return"dataSchema/multiLineAltChartDataSchema.json";case"stackedAreaChart":return"dataSchema/areaChartDataSchema.json";case"choroplethMap":return"dataSchema/choroplethMapDataSchema.json";case"threeDGlobe":return"dataSchema/choroplethMapDataSchema.json";case"bulletChart":return"dataSchema/bulletChartDataSchema.json";case"biVariateChoroplethMap":return"dataSchema/biVariateChoroplethMapDataSchema.json";case"dotDensityMap":return"dataSchema/dotDensityMapDataSchema.json";case"donutChart":return"dataSchema/donutChartDataSchema.json";case"slopeChart":return"dataSchema/slopeChartDataSchema.json";case"scatterPlot":return"dataSchema/scatterPlotDataSchema.json";case"dumbbellChart":return"dataSchema/dumbbellChartDataSchema.json";case"treeMap":return"dataSchema/treeMapDataSchema.json";case"circlePacking":return"dataSchema/circlePackingDataSchema.json";case"heatMap":return"dataSchema/heatMapDataSchema.json";case"stripChart":return"dataSchema/stripChartDataSchema.json";case"beeSwarmChart":return"dataSchema/beeSwarmChartDataSchema.json";case"butterflyChart":return"dataSchema/butterflyChartDataSchema.json";case"histogram":return"dataSchema/histogramDataSchema.json";case"sparkLine":return"dataSchema/lineChartDataSchema.json";case"paretoChart":return"dataSchema/paretoChartDataSchema.json";case"statCard":return"dataSchema/statCardDataSchema.json";case"unitChart":return"dataSchema/unitChartDataSchema.json";case"sankeyChart":return"dataSchema/sankeyChartDataSchema.json";case"lineChartWithConfidenceInterval":return"dataSchema/lineChartWithConfidenceIntervalDataSchema.json";case"radarChart":return"dataSchema/radarChartDataSchema.json";default:return console.error("Unknown chart type:",t),null}}function VE(t){switch(t){case"barChart":return"settingsSchema/simpleBarChartSettingsSchema.json";case"stackedBarChart":return"settingsSchema/stackedBarChartSettingsSchema.json";case"groupedBarChart":return"settingsSchema/groupedBarChartSettingsSchema.json";case"lineChart":return"settingsSchema/lineChartSettingsSchema.json";case"dualAxisLineChart":return"settingsSchema/dualAxisLineChartSettingsSchema.json";case"multiLineChart":return"settingsSchema/multiLineChartSettingsSchema.json";case"multiLineAltChart":return"settingsSchema/multiLineAltChartSettingsSchema.json";case"differenceLineChart":return"settingsSchema/differenceLineChartSettingsSchema.json";case"stackedAreaChart":return"settingsSchema/stackedAreaChartSettingsSchema.json";case"choroplethMap":return"settingsSchema/choroplethMapSettingsSchema.json";case"threeDGlobe":return"settingsSchema/threeDGlobeSettingsSchema.json";case"bulletChart":return"settingsSchema/bulletChartSettingsSchema.json";case"biVariateChoroplethMap":return"settingsSchema/biVariateChoroplethMapSettingsSchema.json";case"dotDensityMap":return"settingsSchema/dotDensityMapSettingsSchema.json";case"donutChart":return"settingsSchema/donutChartSettingsSchema.json";case"slopeChart":return"settingsSchema/slopeChartSettingsSchema.json";case"scatterPlot":return"settingsSchema/scatterPlotSettingsSchema.json";case"dumbbellChart":return"settingsSchema/dumbbellChartSettingsSchema.json";case"treeMap":return"settingsSchema/treeMapSettingsSchema.json";case"circlePacking":return"settingsSchema/circlePackingSettingsSchema.json";case"heatMap":return"settingsSchema/heatMapSettingsSchema.json";case"stripChart":return"settingsSchema/stripChartSettingsSchema.json";case"beeSwarmChart":return"settingsSchema/beeSwarmChartSettingsSchema.json";case"butterflyChart":return"settingsSchema/butterflyChartSettingsSchema.json";case"histogram":return"settingsSchema/histogramSettingsSchema.json";case"sparkLine":return"settingsSchema/sparkLineSettingsSchema.json";case"paretoChart":return"settingsSchema/paretoChartSettingsSchema.json";case"dataTable":return"settingsSchema/dataTableSettingsSchema.json";case"statCard":return"settingsSchema/statCardSettingsSchema.json";case"geoHubCompareMap":return"settingsSchema/geoHubCompareMapSettingsSchema.json";case"geoHubMap":return"settingsSchema/geoHubMapSettingsSchema.json";case"geoHubMapWithLayerSelection":return"settingsSchema/geoHubMapWithLayerSelectionSettingsSchema.json";case"unitChart":return"settingsSchema/unitChartSettingsSchema.json";case"sankeyChart":return"settingsSchema/sankeyChartSettingsSchema.json";case"lineChartWithConfidenceInterval":return"settingsSchema/lineChartWithConfidenceIntervalSettingsSchema.json";case"dataCards":return"settingsSchema/dataCardListSettingsSchema.json";case"allGraphs":return"settingsSchema/SettingsSchema.json";case"radarChart":return"settingsSchema/radarChartSettingsSchema.json";default:return console.error("Unknown chart type:",t),null}}async function Mw(t){const e=await fetch(`${Dw}${EE(t)}`);if(!e.ok)throw new Error(`Response status: ${e.status}`);return await e.json()}async function ta(t){const e=await fetch(`${Dw}${VE(t)}`);if(!e.ok)throw new Error(`Response status: ${e.status}`);return await e.json()}function FE(t){switch(t){case"barChart":return["label","size","color","date"];case"bulletChart":return["label","size","target","qualitativeRange"];case"treeMap":return["label","size","color"];case"circlePacking":return["label","size","color"];case"butterflyChart":return["label","leftBar","rightBar","date"];case"groupedBarChart":return["label","size","date"];case"stackedBarChart":return["label","size","date"];case"dumbbellChart":return["x","label","date"];case"donutChart":return["size","label"];case"histogram":return["value"];case"choroplethMap":return["x","id","date"];case"threeDGlobe":return["x","id"];case"biVariateChoroplethMap":return["x","y","id","date"];case"lineChart":return["date","y"];case"multiLineChart":return["date","y"];case"multiLineAltChart":return["date","y","label","color"];case"radarChart":return["values","label","color"];case"stackedAreaChart":return["date","y"];case"scatterPlot":return["x","y","radius","color","label","date"];case"dualAxisLineChart":return["date","y1","y2"];case"paretoChart":return["label","bar","line"];case"dotDensityMap":return["lat","long","radius","color","label","date"];case"slopeChart":return["y1","y2","color","label"];case"heatMap":return["row","column","value"];case"beeSwarmChart":return["label","position","radius","color"];case"stripChart":return["label","position","color"];case"statCard":return["value"];case"sankeyChart":return["source","target","value"];case"differenceLineChart":return["date","y1","y2"];case"unitChart":return["label","value"];case"sparkLine":return["date","y"];case"lineChartWithConfidenceInterval":return["date","y","yMin","yMax"];case"dashboardWideToLong":return["label","size","color","value"];case"dashboard":return["label","radius","size","row","y1","y","rightBar","position","leftBar","x","bar","line","y2","column","date","value","color","long","lat","id","source","target","yMin","yMax"];default:return["label","radius","size","row","y1","y","rightBar","position","leftBar","x","bar","line","y2","column","date","value","color","long","lat","id","source","target","yMin","yMax"]}}function Ri(t){return!t||t.length===0?{}:{enum:t}}const i0=t=>({items:{properties:{column:{type:"string",...Ri(t)},delimiter:{type:"string"}},type:"object",required:["column"]},type:"array"}),Za=t=>({properties:{columnsToArray:i0(t),data:{},dataURL:{oneOf:[{type:"string"},{type:"array",items:{type:"object",properties:{fileType:{enum:["csv","json","api"],type:"string"},apiHeaders:{},dataTransformation:{type:"string"},idColumnName:{type:"string"},dataURL:{type:"string"},delimiter:{type:"string"},columnsToArray:i0()},required:["dataURL","idColumnName"]}}]},delimiter:{type:"string"},fileType:{enum:["csv","json","api"],type:"string"},apiHeaders:{},dataTransformation:{type:"string"},idColumnTitle:{type:"string"}},type:"object"}),Ja=t=>({type:"array",items:{type:"object",properties:{value:{type:"string",...Ri(t)},label:{type:"string"}},required:["value","label"]}}),Yo=t=>({items:{properties:{clearable:{type:"boolean"},allowSelectAll:{type:"boolean"},width:{type:"string"},excludeValues:{items:{type:"string"},type:"array"},column:{type:"string",...Ri(t)},defaultValue:{anyOf:[{items:{oneOf:[{type:"string"},{type:"number"}]},type:"array"},{type:"string"},{type:"number"}]},label:{type:"string"},ui:{type:"string",enum:["select","radio"]},singleSelect:{type:"boolean"}},required:["column"],type:"object"},type:"array"}),qo=async t=>{const e=await ta("allGraphs");return{type:"array",items:{type:"object",properties:{chartConfigId:{type:"string"},label:{type:"string"},width:{type:"string"},allowedColumnIds:{type:"array",items:{type:"object",properties:{value:{type:"string",...Ri(t)},label:{type:"string"},graphSettings:e},required:["value","label"]},minItems:1},ui:{type:"string",enum:["select","radio"]}},required:["chartConfigId","allowedColumnIds"]}}},Ar=t=>({type:"array",items:{type:"object",properties:{column:{type:"string",...Ri(t)},includeValues:{type:"array",items:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]}},excludeValues:{type:"array",items:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]}}},required:["column"]}}),Uo=t=>({type:"object",properties:{keyColumn:{type:"string",...Ri(t)},aggregationColumnsSetting:{type:"array",items:{type:"object",properties:{column:{type:"string",...Ri(t)},aggregationMethod:{type:"string",enum:["sum","average","min","max"]}},required:["column"]}}},required:["keyColumn"]}),eo=(t,e)=>({type:"array",items:{type:"object",properties:{columnId:{oneOf:[{type:"string",...Ri(t)},{type:"array",items:{type:"string",...Ri(t)}}]},chartConfigId:{type:"string",...Ri(FE(e))}},required:["columnId","chartConfigId"]}}),qs=async(t,e)=>{const n=await ta("allGraphs");return{type:"array",items:{type:"object",properties:{chartConfigId:{type:"string"},label:{type:"string"},width:{type:"string"},options:{type:"array",items:{type:"object",properties:{dataConfiguration:eo(t,e),label:{type:"string"},graphSettings:n},required:["dataConfiguration","label"]},minItems:1},defaultValue:{type:"array",items:{type:"object",properties:{dataConfiguration:eo(t,e),label:{type:"string"},graphSettings:n},required:["dataConfiguration","label"]},minItems:1},ui:{type:"string",enum:["select","radio"]}},required:["chartConfigId","options"]}}},Tw=async(t,e)=>{const n=await ta(e||"allGraphs");return e&&Fi.filter(i=>i.geoHubMapPresentation).map(i=>i.graphID).indexOf(e)!==-1?{type:"object",properties:{graphSettings:n,graphType:{type:"string",enum:Fi.filter(i=>i.geoHubMapPresentation).map(i=>i.graphID)},debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},uiMode:{type:"string",enum:["light","normal"]},classNames:{type:"object"},highlightDataPointSettings:{type:"object",properties:{column:{type:"string"},label:{type:"string"},defaultValues:{oneOf:[{type:"array",items:{type:"string"}},{type:"array",items:{type:"number"}}]},excludeValues:{type:"array",items:{type:"string"}},allowSelectAll:{type:"boolean"},width:{type:"string"}},required:["column"]},styles:{type:"object"}},required:["graphType"]}:e==="dataTable"||e==="dataCards"?{type:"object",properties:{graphSettings:n,dataSettings:Za(t),filters:Yo(t),noOfFiltersPerRow:{type:"number"},graphType:{type:"string",enum:["dataTable","dataCards"]},dataTransform:Uo(t),dataFilters:Ar(t),readableHeader:Ja(t),dataSelectionOptions:qo(t),advancedDataSelectionOptions:qs(t,e),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},uiMode:{type:"string",enum:["light","normal"]},classNames:{type:"object"},highlightDataPointSettings:{type:"object",properties:{column:{type:"string"},label:{type:"string"},defaultValues:{oneOf:[{type:"array",items:{type:"string"}},{type:"array",items:{type:"number"}}]},excludeValues:{type:"array",items:{type:"string"}},allowSelectAll:{type:"boolean"},width:{type:"string"}},required:["column"]},styles:{type:"object"}},required:["dataSettings","graphType"]}:{type:"object",properties:{graphSettings:n,dataSettings:Za(t),filters:Yo(t),classNames:{type:"object"},styles:{type:"object"},graphType:{type:"string",enum:Fi.map(i=>i.graphID)},noOfFiltersPerRow:{type:"number"},dataTransform:Uo(t),dataFilters:Ar(t),graphDataConfiguration:eo(t,e),readableHeader:Ja(t),dataSelectionOptions:qo(t),advancedDataSelectionOptions:qs(t,e),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},highlightDataPointSettings:{type:"object",properties:{column:{type:"string"},label:{type:"string"},defaultValues:{oneOf:[{type:"array",items:{type:"string"}},{type:"array",items:{type:"number"}}]},excludeValues:{type:"array",items:{type:"string"}},allowSelectAll:{type:"boolean"},width:{type:"string"}},required:["column"]},uiMode:{type:"string",enum:["light","normal"]}},required:e?["dataSettings","graphType","graphDataConfiguration"]:["graphType"]}},kw=async(t,e)=>{const n=await ta(e||"allGraphs");return e==="dataTable"||e==="dataCards"?{type:"object",properties:{graphSettings:n,dataSettings:Za(t),filters:Yo(t),classNames:{type:"object"},styles:{type:"object"},noOfFiltersPerRow:{type:"number"},graphType:{type:"string",enum:["dataTable","dataCards"]},uiMode:{type:"string",enum:["light","normal"]},dataTransform:Uo(t),dataFilters:Ar(t),noOfColumns:{type:"number"},columnGridBy:{type:"string"},showCommonColorScale:{type:"boolean"},minGraphHeight:{type:"number"},minGraphWidth:{type:"number"},readableHeader:Ja(t),dataSelectionOptions:qo(t),advancedDataSelectionOptions:qs(t,e),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]}},required:["columnGridBy","dataSettings","graphType"]}:{type:"object",properties:{graphSettings:n,dataSettings:Za(t),filters:Yo(t),classNames:{type:"object"},styles:{type:"object"},noOfFiltersPerRow:{type:"number"},graphType:{type:"string",enum:Fi.filter(i=>i.availableInGriddedGraph!==!1).map(i=>i.graphID)},uiMode:{type:"string",enum:["light","normal"]},dataTransform:Uo(t),dataFilters:Ar(t),graphDataConfiguration:eo(t,e),noOfColumns:{type:"number"},columnGridBy:{type:"string"},showCommonColorScale:{type:"boolean"},minGraphHeight:{type:"number"},minGraphWidth:{type:"number"},readableHeader:Ja(t),dataSelectionOptions:qo(t),advancedDataSelectionOptions:qs(t,e),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]}},required:e?["columnGridBy","dataSettings","graphType","graphDataConfiguration"]:["columnGridBy","dataSettings","graphType"]}},jw=async t=>{const e=await ta("allGraphs");return{properties:{dashboardID:{type:"string"},graphClassNames:{type:"object"},graphStyles:{type:"object"},dashboardLayout:{properties:{backgroundColor:{type:["string","boolean"]},description:{type:"string"},language:{enum:["ar","en","he"],type:"string"},padding:{type:"string"},title:{type:"string"},rows:{items:{properties:{columns:{items:{properties:{columnWidth:{type:"number"},dataFilters:Ar(),dataTransform:Uo(),graphDataConfiguration:eo(void 0,"dashboard"),graphType:{enum:Fi.map(n=>n.graphID),type:"string"},settings:e,dataSelectionOptions:qo(),advancedDataSelectionOptions:qs(),attachedFilter:{type:"string",...Ri(t)}},type:"object",required:["graphType"]},type:"array"},height:{type:"number"}},type:"object",required:["columns"]},type:"array"}},type:"object",required:["rows"]},dataSettings:Za(t),filters:Yo(t),noOfFiltersPerRow:{type:"number"},uiMode:{type:"string",enum:["light","normal"]},filterPosition:{type:"string",enum:["top","side"]},readableHeader:Ja(t),dataFilters:Ar(t),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},graphBackgroundColor:{oneOf:[{type:"string"},{type:"boolean"}]}},type:"object",required:["dashboardLayout","dataSettings"]}},Aw=async()=>{const t=await ta("allGraphs");return{properties:{dashboardID:{type:"string"},graphClassNames:{type:"object"},graphStyles:{type:"object"},dashboardLayout:{properties:{backgroundColor:{type:["string","boolean"]},description:{type:"string"},language:{enum:["ar","en","he"],type:"string"},padding:{type:"string"},dropdownLabel:{type:"string"},title:{type:"string"},rows:{items:{properties:{columns:{items:{properties:{columnWidth:{type:"number"},dataFilters:Ar(),graphDataConfiguration:eo(void 0,"dashboardWideToLong"),graphType:{enum:Fi.filter(e=>e.availableInWideToLongFormat).map(e=>e.graphID),type:"string"},settings:t},type:"object",required:["graphType"]},type:"array"},height:{type:"number"}},type:"object",required:["columns"]},type:"array"}},type:"object",required:["rows"]},dataSettings:{properties:{...Za().properties,keyColumn:{type:"string"}},required:["keyColumn"],type:"object"},uiMode:{type:"string",enum:["light","normal"]},dataFilters:Ar(),readableHeader:Ja(),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},graphBackgroundColor:{oneOf:[{type:"string"},{type:"boolean"}]}},type:"object",required:["dashboardLayout","dataSettings"]}};async function RE(t,e){let n;try{n=(await import("ajv")).default}catch(s){throw console.error(s),new Error("AJV is not installed. Please install it to use runtime validation.")}const i=new n({allErrors:!0,allowUnionTypes:!0});if(Fi.filter(s=>s.geoHubMapPresentation).map(s=>s.graphID).indexOf(e)!==-1)return{isValid:!0,err:void 0};if(!t)return{isValid:!1,err:"No data provided"};if(e==="dataTable"||e==="dataCards"||t.length===0)return{isValid:!0,err:void 0};const r=await Mw(e);if(!r)return{isValid:!1,err:`Invalid chart type: ${e}`};const a=i.compile(r);return a(t)?{isValid:!0,err:void 0}:(console.error(a.errors),{isValid:!1,err:a.errors?.map(s=>`Error at ${s.instancePath}: ${s.message}`).join("; ")})}async function BE(t,e){let n;try{n=(await import("ajv")).default}catch(s){throw console.error(s),new Error("AJV is not installed. Please install it to use runtime validation.")}const i=new n({allErrors:!0,allowUnionTypes:!0}),r=await ta(e);if(!r)return{isValid:!1,err:`Invalid chart type: ${e}`};const a=i.compile(r);return a(t)?{isValid:!0,err:void 0}:(console.error(a.errors),{isValid:!1,err:a.errors?.map(s=>`Error at ${s.instancePath}: ${s.message}`).join("; ")})}async function HE(t,e){let n;try{n=(await import("ajv")).default}catch(s){throw console.error(s),new Error("AJV is not installed. Please install it to use runtime validation.")}const i=new n({allErrors:!0,allowUnionTypes:!0});let r;switch(e){case"griddedGraph":r=kw(void 0,t.graphType);break;case"multiGraphDashboard":r=jw();break;case"singleGraphDashboard":r=Tw(void 0,t.graphType);break;case"multiGraphDashboardWideToLongFormat":r=Aw();break}if(!r)return{isValid:!1,err:`Invalid chart type: ${e}`};const a=i.compile(r);return a(t)?{isValid:!0,err:void 0}:(console.error(a.errors),{isValid:!1,err:a.errors?.map(s=>`Error at ${s.instancePath}: ${s.message}`).join("; ")})}exports.AreaChart=Qv;exports.BasicStatCard=uP;exports.BeeSwarmChart=nv;exports.BiVariateChoroplethMap=Bv;exports.BulletChart=Kv;exports.ButterflyChart=hw;exports.ChoroplethMap=Hv;exports.CirclePackingGraph=td;exports.ColorLegend=Hi;exports.ColorLegendWithMouseOver=tn;exports.Colors=Pe;exports.CopyTextButton=_E;exports.CsvDownloadButton=Hf;exports.DataCards=sw;exports.DataTable=ow;exports.DifferenceLineChart=wv;exports.DonutChart=rd;exports.DotDensityMap=Wv;exports.DualAxisLineChart=pv;exports.DumbbellChart=tv;exports.ExcelDownloadButton=jE;exports.FootNote=yx;exports.GeoHubCompareMaps=Yv;exports.GeoHubMap=Gv;exports.GeoHubMapWithLayerSelection=qv;exports.GraphDescription=Vx;exports.GraphFooter=et;exports.GraphHeader=Qe;exports.GraphList=Fi;exports.GraphTitle=Fx;exports.GriddedGraphs=bw;exports.GriddedGraphsFromConfig=kE;exports.GroupedBarGraph=Rx;exports.HeatMap=aw;exports.Histogram=fw;exports.ImageDownloadButton=Ex;exports.LineChartWithConfidenceInterval=mv;exports.LinearColorLegend=iw;exports.MultiGraphDashboard=vw;exports.MultiGraphDashboardFromConfig=DE;exports.MultiGraphDashboardWideToLongFormat=ww;exports.MultiGraphDashboardWideToLongFormatFromConfig=ME;exports.MultiLineAltChart=vv;exports.MultiLineChart=xv;exports.ParetoChart=uw;exports.RadarChart=mw;exports.SVGDownloadButton=AE;exports.SankeyChart=pw;exports.ScatterPlot=Uv;exports.ScrollStory=CE;exports.SimpleBarGraph=Gf;exports.SimpleLineChart=yv;exports.SingleGraphDashboard=ol;exports.SingleGraphDashboardFromConfig=TE;exports.SlopeChart=Xv;exports.Source=xx;exports.SparkLine=bv;exports.StackedBarGraph=Bx;exports.StatCardFromData=Zv;exports.StripChart=cw;exports.ThreeDGlobe=zv;exports.ThresholdColorLegendWithMouseOver=rw;exports.TreeMapGraph=Md;exports.UnitChart=nw;exports.checkIfNullOrUndefined=je;exports.excelDownload=Cw;exports.fetchAndParseCSV=co;exports.fetchAndParseCSVFromTextBlob=HL;exports.fetchAndParseJSON=en;exports.fetchAndParseMultipleDataSources=ts;exports.fetchAndTransformDataFromAPI=uo;exports.generateEmbedLink=Sw;exports.generateIframeCode=NE;exports.getDashboardJSONSchema=jw;exports.getDashboardWideToLongFormatJSONSchema=Aw;exports.getDataFiltersSchema=Ar;exports.getDataSchema=Mw;exports.getDataSelectionSchema=qo;exports.getDataSettingsSchema=Za;exports.getDataTransformSchema=Uo;exports.getFiltersSchema=Yo;exports.getGraphDataConfigurationSchema=eo;exports.getGriddedGraphJSONSchema=kw;exports.getJenks=Gs;exports.getPercentileValue=IE;exports.getQueryParamsFromLink=$E;exports.getReadableHeaderSchema=Ja;exports.getSettingsSchema=ta;exports.getSingleGraphJSONSchema=Tw;exports.getTextColorBasedOnBgColor=yn;exports.getUniqValue=jr;exports.imageDownload=xh;exports.numberFormattingFunction=qe;exports.removeOutliers=LE;exports.svgDownload=Rh;exports.transformColumnsToArray=$r;exports.transformDataForAggregation=Td;exports.transformDataForGraph=Vc;exports.transformDataForGraphFromFile=PE;exports.validateConfigSchema=HE;exports.validateDataSchema=RE;exports.validateSettingsSchema=BE;
|
|
67
|
+
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!a&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=m,u.ParserHandle=y,u.NetworkStreamer=f,u.FileStreamer=d,u.StringStreamer=g,u.ReadableStreamStreamer=p,i.jQuery&&((r=i.jQuery).fn.parse=function(D){var x=D.config||{},$=[];return this.each(function(ae){if(!(r(this).prop("tagName").toUpperCase()==="INPUT"&&r(this).attr("type").toLowerCase()==="file"&&i.FileReader)||!this.files||this.files.length===0)return!0;for(var G=0;G<this.files.length;G++)$.push({file:this.files[G],inputElem:this,instanceConfig:r.extend({},x)})}),V(),this;function V(){if($.length===0)W(D.complete)&&D.complete();else{var ae,G,_,b,B=$[0];if(W(D.before)){var X=D.before(B.file,B.inputElem);if(typeof X=="object"){if(X.action==="abort")return ae="AbortError",G=B.file,_=B.inputElem,b=X.reason,void(W(D.error)&&D.error({name:ae},G,_,b));if(X.action==="skip")return void q();typeof X.config=="object"&&(B.instanceConfig=r.extend(B.instanceConfig,X.config))}else if(X==="skip")return void q()}var z=B.instanceConfig.complete;B.instanceConfig.complete=function(C){W(z)&&z(C,B.file,B.inputElem),q()},u.parse(B.file,B.instanceConfig)}}function q(){$.splice(0,1),V()}}),o&&(i.onmessage=function(D){D=D.data,u.WORKER_ID===void 0&&D&&(u.WORKER_ID=D.workerId),typeof D.input=="string"?i.postMessage({workerId:u.WORKER_ID,results:u.parse(D.input,D.config),finished:!0}):(i.File&&D.input instanceof File||D.input instanceof Object)&&(D=u.parse(D.input,D.config))&&i.postMessage({workerId:u.WORKER_ID,results:D,finished:!0})}),(f.prototype=Object.create(h.prototype)).constructor=f,(d.prototype=Object.create(h.prototype)).constructor=d,(g.prototype=Object.create(g.prototype)).constructor=g,(p.prototype=Object.create(h.prototype)).constructor=p,u})}(Wl)),Wl.exports}var $L=IL();const Rv=rr($L);function $r(t,e){return!e||e.length===0?t:t.map(i=>{const r={...i};return e.forEach(a=>{r[a.column]=r[a.column]?r[a.column].split(a.delimiter||",").map(o=>o.trim()):[]}),r})}var Ds={exports:{}};Ds.exports;var zm;function LL(){return zm||(zm=1,function(t,e){var n=200,i="Expected a function",r="__lodash_hash_undefined__",a=1,o=2,s=9007199254740991,c="[object Arguments]",u="[object Array]",h="[object Boolean]",f="[object Date]",d="[object Error]",g="[object Function]",p="[object GeneratorFunction]",y="[object Map]",v="[object Number]",m="[object Object]",I="[object Promise]",j="[object RegExp]",w="[object Set]",S="[object String]",P="[object Symbol]",W="[object WeakMap]",D="[object ArrayBuffer]",x="[object DataView]",$="[object Float32Array]",V="[object Float64Array]",q="[object Int8Array]",ae="[object Int16Array]",G="[object Int32Array]",_="[object Uint8Array]",b="[object Uint8ClampedArray]",B="[object Uint16Array]",X="[object Uint32Array]",z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,C=/^\w*$/,A=/^\./,M=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,O=/[\\^$.*+?()[\]{}|]/g,K=/\\(\\)?/g,Q=/^\[object .+?Constructor\]$/,se=/^(?:0|[1-9]\d*)$/,T={};T[$]=T[V]=T[q]=T[ae]=T[G]=T[_]=T[b]=T[B]=T[X]=!0,T[c]=T[u]=T[D]=T[h]=T[x]=T[f]=T[d]=T[g]=T[y]=T[v]=T[m]=T[j]=T[w]=T[S]=T[W]=!1;var Z=typeof Ot=="object"&&Ot&&Ot.Object===Object&&Ot,ie=typeof self=="object"&&self&&self.Object===Object&&self,ue=Z||ie||Function("return this")(),he=e&&!e.nodeType&&e,Y=he&&!0&&t&&!t.nodeType&&t,ge=Y&&Y.exports===he,oe=ge&&Z.process,ce=function(){try{return oe&&oe.binding("util")}catch{}}(),N=ce&&ce.isTypedArray;function U(ye,L,pe,E){for(var fe=-1,Te=ye?ye.length:0;++fe<Te;){var Ne=ye[fe];L(E,Ne,pe(Ne),ye)}return E}function ve(ye,L){for(var pe=-1,E=ye?ye.length:0;++pe<E;)if(L(ye[pe],pe,ye))return!0;return!1}function J(ye){return function(L){return L?.[ye]}}function R(ye,L){for(var pe=-1,E=Array(ye);++pe<ye;)E[pe]=L(pe);return E}function le(ye){return function(L){return ye(L)}}function ee(ye,L){return ye?.[L]}function de(ye){var L=!1;if(ye!=null&&typeof ye.toString!="function")try{L=!!(ye+"")}catch{}return L}function te(ye){var L=-1,pe=Array(ye.size);return ye.forEach(function(E,fe){pe[++L]=[fe,E]}),pe}function Me(ye,L){return function(pe){return ye(L(pe))}}function be(ye){var L=-1,pe=Array(ye.size);return ye.forEach(function(E){pe[++L]=E}),pe}var ne=Array.prototype,De=Function.prototype,xe=Object.prototype,Ae=ue["__core-js_shared__"],ke=function(){var ye=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return ye?"Symbol(src)_1."+ye:""}(),me=De.toString,Se=xe.hasOwnProperty,Le=xe.toString,F=RegExp("^"+me.call(Se).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ie=ue.Symbol,Ve=ue.Uint8Array,H=xe.propertyIsEnumerable,Oe=ne.splice,Ee=Me(Object.keys,Object),it=pn(ue,"DataView"),Tt=pn(ue,"Map"),sn=pn(ue,"Promise"),vn=pn(ue,"Set"),ln=pn(ue,"WeakMap"),Ut=pn(Object,"create"),jt=Kt(it),gn=Kt(Tt),Xt=Kt(sn),Hn=Kt(vn),Tn=Kt(ln),zi=Ie?Ie.prototype:void 0,xi=zi?zi.valueOf:void 0,Gi=zi?zi.toString:void 0;function Wn(ye){var L=-1,pe=ye?ye.length:0;for(this.clear();++L<pe;){var E=ye[L];this.set(E[0],E[1])}}function ai(){this.__data__=Ut?Ut(null):{}}function oi(ye){return this.has(ye)&&delete this.__data__[ye]}function Ni(ye){var L=this.__data__;if(Ut){var pe=L[ye];return pe===r?void 0:pe}return Se.call(L,ye)?L[ye]:void 0}function or(ye){var L=this.__data__;return Ut?L[ye]!==void 0:Se.call(L,ye)}function nn(ye,L){var pe=this.__data__;return pe[ye]=Ut&&L===void 0?r:L,this}Wn.prototype.clear=ai,Wn.prototype.delete=oi,Wn.prototype.get=Ni,Wn.prototype.has=or,Wn.prototype.set=nn;function kn(ye){var L=-1,pe=ye?ye.length:0;for(this.clear();++L<pe;){var E=ye[L];this.set(E[0],E[1])}}function jn(){this.__data__=[]}function na(ye){var L=this.__data__,pe=Ui(L,ye);if(pe<0)return!1;var E=L.length-1;return pe==E?L.pop():Oe.call(L,pe,1),!0}function ia(ye){var L=this.__data__,pe=Ui(L,ye);return pe<0?void 0:L[pe][1]}function ra(ye){return Ui(this.__data__,ye)>-1}function It(ye,L){var pe=this.__data__,E=Ui(pe,ye);return E<0?pe.push([ye,L]):pe[E][1]=L,this}kn.prototype.clear=jn,kn.prototype.delete=na,kn.prototype.get=ia,kn.prototype.has=ra,kn.prototype.set=It;function An(ye){var L=-1,pe=ye?ye.length:0;for(this.clear();++L<pe;){var E=ye[L];this.set(E[0],E[1])}}function _n(){this.__data__={hash:new Wn,map:new(Tt||kn),string:new Wn}}function aa(ye){return Gn(this,ye).delete(ye)}function oa(ye){return Gn(this,ye).get(ye)}function sa(ye){return Gn(this,ye).has(ye)}function $t(ye,L){return Gn(this,ye).set(ye,L),this}An.prototype.clear=_n,An.prototype.delete=aa,An.prototype.get=oa,An.prototype.has=sa,An.prototype.set=$t;function Yi(ye){var L=-1,pe=ye?ye.length:0;for(this.__data__=new An;++L<pe;)this.add(ye[L])}function qi(ye){return this.__data__.set(ye,r),this}function la(ye){return this.__data__.has(ye)}Yi.prototype.add=Yi.prototype.push=qi,Yi.prototype.has=la;function On(ye){this.__data__=new kn(ye)}function Nn(){this.__data__=new kn}function zn(ye){return this.__data__.delete(ye)}function ca(ye){return this.__data__.get(ye)}function ua(ye){return this.__data__.has(ye)}function Lt(ye,L){var pe=this.__data__;if(pe instanceof kn){var E=pe.__data__;if(!Tt||E.length<n-1)return E.push([ye,L]),this;pe=this.__data__=new An(E)}return pe.set(ye,L),this}On.prototype.clear=Nn,On.prototype.delete=zn,On.prototype.get=ca,On.prototype.has=ua,On.prototype.set=Lt;function ha(ye,L){var pe=Rt(ye)||dr(ye)?R(ye.length,String):[],E=pe.length,fe=!!E;for(var Te in ye)Se.call(ye,Te)&&!(fe&&(Te=="length"||Yn(Te,E)))&&pe.push(Te);return pe}function Ui(ye,L){for(var pe=ye.length;pe--;)if(cn(ye[pe][0],L))return pe;return-1}function Xi(ye,L,pe,E){return fa(ye,function(fe,Te,Ne){L(E,fe,pe(fe),Ne)}),E}var fa=cr(ga),da=Da();function ga(ye,L){return ye&&da(ye,L,bn)}function In(ye,L){L=zt(L,ye)?[L]:Er(L);for(var pe=0,E=L.length;ye!=null&&pe<E;)ye=ye[Xn(L[pe++])];return pe&&pe==E?ye:void 0}function Lr(ye){return Le.call(ye)}function pa(ye,L){return ye!=null&&L in Object(ye)}function Ii(ye,L,pe,E,fe){return ye===L?!0:ye==null||L==null||!wn(ye)&&!Qt(L)?ye!==ye&&L!==L:sr(ye,L,Ii,pe,E,fe)}function sr(ye,L,pe,E,fe,Te){var Ne=Rt(ye),Be=Rt(L),Re=u,Ge=u;Ne||(Re=At(ye),Re=Re==c?m:Re),Be||(Ge=At(L),Ge=Ge==c?m:Ge);var Ue=Re==m&&!de(ye),re=Ge==m&&!de(L),we=Re==Ge;if(we&&!Ue)return Te||(Te=new On),Ne||vi(ye)?ur(ye,L,pe,E,fe,Te):Ma(ye,L,Re,pe,E,fe,Te);if(!(fe&o)){var _e=Ue&&Se.call(ye,"__wrapped__"),Fe=re&&Se.call(L,"__wrapped__");if(_e||Fe){var We=_e?ye.value():ye,He=Fe?L.value():L;return Te||(Te=new On),pe(We,He,E,fe,Te)}}return we?(Te||(Te=new On),Ta(ye,L,pe,E,fe,Te)):!1}function Pr(ye,L,pe,E){var fe=pe.length,Te=fe;if(ye==null)return!Te;for(ye=Object(ye);fe--;){var Ne=pe[fe];if(Ne[2]?Ne[1]!==ye[Ne[0]]:!(Ne[0]in ye))return!1}for(;++fe<Te;){Ne=pe[fe];var Be=Ne[0],Re=ye[Be],Ge=Ne[1];if(Ne[2]){if(Re===void 0&&!(Be in ye))return!1}else{var Ue=new On,re;if(!(re===void 0?Ii(Ge,Re,E,a|o,Ue):re))return!1}}return!0}function ma(ye){if(!wn(ye)||Fr(ye))return!1;var L=un(ye)||de(ye)?F:Q;return L.test(Kt(ye))}function ya(ye){return Qt(ye)&&Kn(ye.length)&&!!T[Le.call(ye)]}function lr(ye){return typeof ye=="function"?ye:ye==null?Aa:typeof ye=="object"?Rt(ye)?wa(ye[0],ye[1]):va(ye):Rr(ye)}function xa(ye){if(!si(ye))return Ee(ye);var L=[];for(var pe in Object(ye))Se.call(ye,pe)&&pe!="constructor"&&L.push(pe);return L}function va(ye){var L=Vr(ye);return L.length==1&&L[0][2]?qn(L[0][0],L[0][1]):function(pe){return pe===ye||Pr(pe,ye,L)}}function wa(ye,L){return zt(ye)&&hr(L)?qn(Xn(ye),L):function(pe){var E=ci(pe,ye);return E===void 0&&E===L?Qn(pe,ye):Ii(L,E,void 0,a|o)}}function ba(ye){return function(L){return In(L,ye)}}function Ca(ye){if(typeof ye=="string")return ye;if(li(ye))return Gi?Gi.call(ye):"";var L=ye+"";return L=="0"&&1/ye==-1/0?"-0":L}function Er(ye){return Rt(ye)?ye:Un(ye)}function Sa(ye,L){return function(pe,E){var fe=Rt(pe)?U:Xi,Te={};return fe(pe,ye,lr(E),Te)}}function cr(ye,L){return function(pe,E){if(pe==null)return pe;if(!$i(pe))return ye(pe,E);for(var fe=pe.length,Te=-1,Ne=Object(pe);++Te<fe&&E(Ne[Te],Te,Ne)!==!1;);return pe}}function Da(ye){return function(L,pe,E){for(var fe=-1,Te=Object(L),Ne=E(L),Be=Ne.length;Be--;){var Re=Ne[++fe];if(pe(Te[Re],Re,Te)===!1)break}return L}}function ur(ye,L,pe,E,fe,Te){var Ne=fe&o,Be=ye.length,Re=L.length;if(Be!=Re&&!(Ne&&Re>Be))return!1;var Ge=Te.get(ye);if(Ge&&Te.get(L))return Ge==L;var Ue=-1,re=!0,we=fe&a?new Yi:void 0;for(Te.set(ye,L),Te.set(L,ye);++Ue<Be;){var _e=ye[Ue],Fe=L[Ue];if(E)var We=Ne?E(Fe,_e,Ue,L,ye,Te):E(_e,Fe,Ue,ye,L,Te);if(We!==void 0){if(We)continue;re=!1;break}if(we){if(!ve(L,function(He,Ye){if(!we.has(Ye)&&(_e===He||pe(_e,He,E,fe,Te)))return we.add(Ye)})){re=!1;break}}else if(!(_e===Fe||pe(_e,Fe,E,fe,Te))){re=!1;break}}return Te.delete(ye),Te.delete(L),re}function Ma(ye,L,pe,E,fe,Te,Ne){switch(pe){case x:if(ye.byteLength!=L.byteLength||ye.byteOffset!=L.byteOffset)return!1;ye=ye.buffer,L=L.buffer;case D:return!(ye.byteLength!=L.byteLength||!E(new Ve(ye),new Ve(L)));case h:case f:case v:return cn(+ye,+L);case d:return ye.name==L.name&&ye.message==L.message;case j:case S:return ye==L+"";case y:var Be=te;case w:var Re=Te&o;if(Be||(Be=be),ye.size!=L.size&&!Re)return!1;var Ge=Ne.get(ye);if(Ge)return Ge==L;Te|=a,Ne.set(ye,L);var Ue=ur(Be(ye),Be(L),E,fe,Te,Ne);return Ne.delete(ye),Ue;case P:if(xi)return xi.call(ye)==xi.call(L)}return!1}function Ta(ye,L,pe,E,fe,Te){var Ne=fe&o,Be=bn(ye),Re=Be.length,Ge=bn(L),Ue=Ge.length;if(Re!=Ue&&!Ne)return!1;for(var re=Re;re--;){var we=Be[re];if(!(Ne?we in L:Se.call(L,we)))return!1}var _e=Te.get(ye);if(_e&&Te.get(L))return _e==L;var Fe=!0;Te.set(ye,L),Te.set(L,ye);for(var We=Ne;++re<Re;){we=Be[re];var He=ye[we],Ye=L[we];if(E)var Ze=Ne?E(Ye,He,we,L,ye,Te):E(He,Ye,we,ye,L,Te);if(!(Ze===void 0?He===Ye||pe(He,Ye,E,fe,Te):Ze)){Fe=!1;break}We||(We=we=="constructor")}if(Fe&&!We){var Ke=ye.constructor,nt=L.constructor;Ke!=nt&&"constructor"in ye&&"constructor"in L&&!(typeof Ke=="function"&&Ke instanceof Ke&&typeof nt=="function"&&nt instanceof nt)&&(Fe=!1)}return Te.delete(ye),Te.delete(L),Fe}function Gn(ye,L){var pe=ye.__data__;return ja(L)?pe[typeof L=="string"?"string":"hash"]:pe.map}function Vr(ye){for(var L=bn(ye),pe=L.length;pe--;){var E=L[pe],fe=ye[E];L[pe]=[E,fe,hr(fe)]}return L}function pn(ye,L){var pe=ee(ye,L);return ma(pe)?pe:void 0}var At=Lr;(it&&At(new it(new ArrayBuffer(1)))!=x||Tt&&At(new Tt)!=y||sn&&At(sn.resolve())!=I||vn&&At(new vn)!=w||ln&&At(new ln)!=W)&&(At=function(ye){var L=Le.call(ye),pe=L==m?ye.constructor:void 0,E=pe?Kt(pe):void 0;if(E)switch(E){case jt:return x;case gn:return y;case Xt:return I;case Hn:return w;case Tn:return W}return L});function ka(ye,L,pe){L=zt(L,ye)?[L]:Er(L);for(var E,fe=-1,Ne=L.length;++fe<Ne;){var Te=Xn(L[fe]);if(!(E=ye!=null&&pe(ye,Te)))break;ye=ye[Te]}if(E)return E;var Ne=ye?ye.length:0;return!!Ne&&Kn(Ne)&&Yn(Te,Ne)&&(Rt(ye)||dr(ye))}function Yn(ye,L){return L=L??s,!!L&&(typeof ye=="number"||se.test(ye))&&ye>-1&&ye%1==0&&ye<L}function zt(ye,L){if(Rt(ye))return!1;var pe=typeof ye;return pe=="number"||pe=="symbol"||pe=="boolean"||ye==null||li(ye)?!0:C.test(ye)||!z.test(ye)||L!=null&&ye in Object(L)}function ja(ye){var L=typeof ye;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?ye!=="__proto__":ye===null}function Fr(ye){return!!ke&&ke in ye}function si(ye){var L=ye&&ye.constructor,pe=typeof L=="function"&&L.prototype||xe;return ye===pe}function hr(ye){return ye===ye&&!wn(ye)}function qn(ye,L){return function(pe){return pe==null?!1:pe[ye]===L&&(L!==void 0||ye in Object(pe))}}var Un=$n(function(ye){ye=wi(ye);var L=[];return A.test(ye)&&L.push(""),ye.replace(M,function(pe,E,fe,Te){L.push(fe?Te.replace(K,"$1"):E||pe)}),L});function Xn(ye){if(typeof ye=="string"||li(ye))return ye;var L=ye+"";return L=="0"&&1/ye==-1/0?"-0":L}function Kt(ye){if(ye!=null){try{return me.call(ye)}catch{}try{return ye+""}catch{}}return""}var fr=Sa(function(ye,L,pe){Se.call(ye,pe)?ye[pe].push(L):ye[pe]=[L]});function $n(ye,L){if(typeof ye!="function"||L&&typeof L!="function")throw new TypeError(i);var pe=function(){var E=arguments,fe=L?L.apply(this,E):E[0],Te=pe.cache;if(Te.has(fe))return Te.get(fe);var Ne=ye.apply(this,E);return pe.cache=Te.set(fe,Ne),Ne};return pe.cache=new($n.Cache||An),pe}$n.Cache=An;function cn(ye,L){return ye===L||ye!==ye&&L!==L}function dr(ye){return gr(ye)&&Se.call(ye,"callee")&&(!H.call(ye,"callee")||Le.call(ye)==c)}var Rt=Array.isArray;function $i(ye){return ye!=null&&Kn(ye.length)&&!un(ye)}function gr(ye){return Qt(ye)&&$i(ye)}function un(ye){var L=wn(ye)?Le.call(ye):"";return L==g||L==p}function Kn(ye){return typeof ye=="number"&&ye>-1&&ye%1==0&&ye<=s}function wn(ye){var L=typeof ye;return!!ye&&(L=="object"||L=="function")}function Qt(ye){return!!ye&&typeof ye=="object"}function li(ye){return typeof ye=="symbol"||Qt(ye)&&Le.call(ye)==P}var vi=N?le(N):ya;function wi(ye){return ye==null?"":Ca(ye)}function ci(ye,L,pe){var E=ye==null?void 0:In(ye,L);return E===void 0?pe:E}function Qn(ye,L){return ye!=null&&ka(ye,L,pa)}function bn(ye){return $i(ye)?ha(ye):xa(ye)}function Aa(ye){return ye}function Rr(ye){return zt(ye)?J(Xn(ye)):ba(ye)}t.exports=fr}(Ds,Ds.exports)),Ds.exports}var PL=LL();const EL=rr(PL);function VL(t,e){return t.map(n=>{const i={...n};return i["~id"]=i[e],i})}function FL(t){const e=[];return t.forEach(n=>{n.forEach(i=>{e.push(i)})}),e}function RL(t,e){const n=EL(t,"~id"),i=Object.keys(n).map(s=>n[s].reduce((u,h)=>(Object.assign(u,h),u),{})),r=new Set;i.forEach(s=>{Object.keys(s).forEach(c=>{r.add(c)})});const a={};return r.forEach(s=>{a[s]=void 0}),i.map(s=>({...a,...s})).map(s=>({...s,[e]:s["~id"]}))}function BL(t,e){const n=t.map(r=>VL(r.data,r.idColumn)),i=FL(n);return RL(i,e||"~id")}function Go(t,e){if(!e)return t;Qi.registerHelper("json",i=>new Qi.SafeString(JSON.stringify(i,null,2)));const n=Qi.compile(e);return JSON.parse(n(t))}async function co(t,e,n,i,r,a){return new Promise((o,s)=>{Rv.parse(t,{download:!0,skipEmptyLines:!0,dynamicTyping:!0,header:a!==!1,delimiter:r||",",complete(c){if(i&&console.log("Data from file:",c.data),n){const u=$r(c.data,n);i&&console.log("Data after transformation of column to array:",u),o(Go(u,e))}else o(Go(c.data,e))},error(c){s(c)}})})}async function HL(t,e,n,i,r,a){return new Promise((o,s)=>{Rv.parse(t,{skipEmptyLines:!0,header:a!==!1,delimiter:r||",",complete(c){if(i&&console.log("Data from file:",c.data),n){const u=$r(c.data,n);i&&console.log("Data after transformation of column to array:",u),o(Go(u,e))}else o(Go(c.data,e))},error(c){s(c)}})})}async function en(t,e,n,i){const r=t;try{const a=await fetch(r);if(!a.ok)throw new Error(`Response status: ${a.status}`);const o=await a.json(),s=Go(o,n);if(i&&console.log("Data from file:",o),e){const c=$r(s,e);return i&&console.log("Data after transformation of column to array:",c),c}return s}catch(a){return a}}async function uo(t,e,n,i,r){const a=await fetch(t,{method:"GET",headers:e});if(!a.ok)throw new Error("Network response was not ok");const o=await a.json(),s=Go(o,i);if(r&&(console.log("Data from api:",o),console.log("Data from api after transformation:",s)),n){const c=$r(s,n);return r&&console.log("Data after transformation of column to array:",c),c}return s}async function ts(t,e){const n=await Promise.all(t.map(r=>r.fileType==="json"?en(r.dataURL,r.columnsToArray,r.dataTransformation,!1):r.fileType==="api"?uo(r.dataURL,r.apiHeaders,r.columnsToArray,r.dataTransformation,!1):co(r.dataURL,r.dataTransformation,r.columnsToArray,!1,r.delimiter,!0)));return BL(n.map((r,a)=>({data:r,idColumn:t[a].idColumnName})),e)}const WL=(t,e)=>{const n=[...t];for(;n.length<e;)n.push(n[n.length-1]);return n};function Gs(t,e){const n=tt(t.filter(a=>a!=null),a=>a),r=([...new Set(n)].length<e?WL(n,e).slice(1,-1):sI(n,e).slice(1,-1)).map(a=>{const o=parseFloat(Zh(".2r")(a));return isNaN(o)?a<-1?Math.round(a):a:a!==0&&Math.abs(a)<1?o:Math.round(o)});return[...new Set(r)]}function Bv(t){const{data:e,graphTitle:n,mapData:i="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",colors:r=Pe.light.bivariateColors.colors05x05,sources:a,graphDescription:o,height:s,width:c,footNote:u="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",xDomain:h,yDomain:f,xColorLegendTitle:d="X Color key",yColorLegendTitle:g="Y Color key",tooltip:p,scale:y=.95,centerPoint:v,padding:m,mapBorderWidth:I=.5,mapNoDataColor:j=Pe.light.graphNoData,backgroundColor:w=!1,mapBorderColor:S=Pe.light.grays["gray-500"],relativeHeight:P,onSeriesMouseOver:W,isWorldMap:D=!0,zoomScaleExtend:x=[.8,6],zoomTranslateExtend:$,graphID:V,showColorScale:q=!0,highlightedIds:ae=[],onSeriesMouseClick:G,mapProperty:_="ISO3",graphDownload:b=!1,dataDownload:B=!1,showAntarctica:X=!1,language:z="en",minHeight:C=0,theme:A="light",ariaLabel:M,resetSelectionOnDoubleClick:O=!0,detailsOnClick:K,styles:Q,classNames:se,mapProjection:T,zoomInteraction:Z="button",animate:ie=!1,dimmedOpacity:ue=.3,customLayers:he=[],timeline:Y={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(Y.autoplay),J=di(Xe(e.filter(ne=>ne.date!==void 0&&ne.date!==null),ne=>ne.date).map(ne=>ze(`${ne.date}`,Y.dateFormat||"yyyy",new Date).getTime()),(ne,De)=>an(ne,De)),[R,le]=k.useState(Y.autoplay?0:J.length-1),[ee,de]=k.useState(void 0),te=k.useRef(null),Me=k.useRef(null);k.useEffect(()=>{const ne=new ResizeObserver(De=>{oe(c||De[0].contentRect.width||760),N(s||De[0].target.clientHeight||480)});return te.current&&(N(te.current.clientHeight||480),oe(te.current.clientWidth||760),c||ne.observe(te.current)),()=>ne.disconnect()},[c,s]),k.useEffect(()=>{typeof i=="string"?en(i).then(De=>{de(De)}):de(i)},[i]),k.useEffect(()=>{const ne=setInterval(()=>{le(De=>De<J.length-1?De+1:0)},(Y.speed||2)*1e3);return U||clearInterval(ne),()=>clearInterval(ne)},[J,U,Y.speed]);const be=yi(J,R,Y.showOnlyActiveDate,Y.dateFormat||"yyyy");return h&&f&&(h.length!==r[0].length-1||f.length!==r.length-1)?(console.error("the xDomain and yDomain array length don't match to the color array length"),null):l.jsx("div",{className:`${A||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:z==="he"||z==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${w?w===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${z||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...w&&w!==!0?{backgroundColor:w}:{}},id:V,ref:Me,"aria-label":M||`${n?`The graph shows ${n}. `:""}This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:w?m||"1rem":m||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||o||b||B?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:o,width:c,graphDownload:b?Me.current:void 0,dataDownload:B?e.map(ne=>ne.data).filter(ne=>ne!==void 0).length>0?e.map(ne=>ne.data).filter(ne=>ne!==void 0):e.filter(ne=>ne!==void 0):null}):null,Y.enabled&&J.length>0&&be?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{ve(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:J[0],max:J[J.length-1],marks:be,step:null,defaultValue:J[J.length-1],value:J[R],onChangeComplete:ne=>{le(J.indexOf(ne))},onChange:ne=>{le(J.indexOf(ne))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:te,"aria-label":"Map area",children:(c||ge)&&(s||ce)&&ee?l.jsx(OL,{data:e.filter(ne=>Y.enabled?ne.date===ft(new Date(J[R]),Y.dateFormat||"yyyy"):ne),mapData:X?ee:{...ee,features:ee.features.filter(ne=>ne.properties.NAME!=="Antarctica")},xDomain:h||Gs(e.map(ne=>ne.x),r[0].length),yDomain:f||Gs(e.map(ne=>ne.y),r.length),width:c||ge,height:Math.max(C,s||(P?C?(c||ge)*P>C?(c||ge)*P:C:(c||ge)*P:ce)),scale:y,centerPoint:v,colors:r,xColorLegendTitle:d,yColorLegendTitle:g,mapBorderWidth:I,mapNoDataColor:j,mapBorderColor:S,tooltip:p,onSeriesMouseOver:W,isWorldMap:D,zoomScaleExtend:x,zoomTranslateExtend:$,onSeriesMouseClick:G,mapProperty:_,highlightedIds:ae,resetSelectionOnDoubleClick:O,styles:Q,showColorScale:q,classNames:se,mapProjection:T||(D?"naturalEarth":"mercator"),detailsOnClick:K,zoomInteraction:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0},dimmedOpacity:ue,customLayers:he}):l.jsx("div",{style:{height:`${Math.max(C,s||(P?C?(c||ge)*P>C?(c||ge)*P:C:(c||ge)*P:ce))}px`},className:"flex items-center justify-center",children:l.jsx(Ce.Spinner,{"aria-label":"Loading graph"})})}),a||u?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:a,footNote:u,width:c}):null]})})})})}function zL(t){const{data:e,colorDomain:n,colors:i,mapData:r,colorLegendTitle:a,categorical:o,height:s,width:c,scale:u,centerPoint:h,tooltip:f,mapBorderWidth:d,mapBorderColor:g,mapNoDataColor:p,onSeriesMouseOver:y,showColorScale:v,zoomScaleExtend:m,zoomTranslateExtend:I,highlightedIds:j,onSeriesMouseClick:w,mapProperty:S,resetSelectionOnDoubleClick:P,detailsOnClick:W,styles:D,classNames:x,mapProjection:$,zoomInteraction:V,animate:q,dimmedOpacity:ae,customLayers:G}=t,[_,b]=k.useState(void 0),B=k.useRef(null),[X,z]=k.useState(!(c<680)),[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z=k.useRef(null),ie=ct(Z,{once:q.once,amount:q.amount}),ue=k.useRef(null),he=o?Xs().domain(n).range(i):Po().domain(n).range(i);k.useEffect(()=>{const le=bt(ue.current),ee=bt(Z.current),de=Me=>{if(V==="noZoom")return!1;if(V==="button")return!Me.type.includes("wheel");const be=Me.type==="wheel",ne=Me.type.startsWith("touch"),De=Me.type==="mousedown"||Me.type==="mousemove";return ne?!0:be?V==="scroll"?!0:Me.ctrlKey:De&&!Me.button&&!Me.ctrlKey},te=Dd().scaleExtent(m).translateExtent(I||[[-20,-20],[c+20,s+20]]).filter(de).on("zoom",({transform:Me})=>{le.attr("transform",Me)});ee.call(te),B.current=te},[s,c,V]);const Y=hd(r),ge=fd(r),oe=Y[2]-Y[0],ce=Y[3]-Y[1],N=c*190/960*360/oe,U=s*190/678*180/ce,ve=u*Math.min(N,U),J=$==="mercator"?xd().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve):$==="equalEarth"?vd().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve):$==="naturalEarth"?wd().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve):$==="orthographic"?bd().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve):md().rotate([0,0]).center(h||ge.geometry.coordinates).translate([c/2,s/2]).scale(ve),R=le=>{if(!Z.current||!B.current)return;bt(Z.current).call(B.current.scaleBy,le==="in"?1.2:1/1.2)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx($e.svg,{width:`${c}px`,height:`${s}px`,viewBox:`0 0 ${c} ${s}`,ref:Z,direction:"ltr",children:l.jsxs("g",{ref:ue,children:[G.filter(le=>le.position==="before").map(le=>le.layer),r.features.map((le,ee)=>e.findIndex(te=>te.id===le.properties[S])!==-1?null:l.jsx("g",{opacity:_?ae:j.length!==0?j.indexOf(le.properties[S])!==-1?1:ae:1,children:le.geometry.type==="MultiPolygon"?le.geometry.coordinates.map((te,Me)=>{let be="";return te.forEach(ne=>{let De=" M";ne.forEach((xe,Ae)=>{const ke=J([xe[0],xe[1]]);Ae!==ne.length-1?De=`${De}${ke[0]} ${ke[1]}L`:De=`${De}${ke[0]} ${ke[1]}`}),be+=De}),l.jsx("path",{d:be,style:{stroke:g,strokeWidth:d,fill:p}},Me)}):le.geometry.coordinates.map((te,Me)=>{let be="M";return te.forEach((ne,De)=>{const xe=J([ne[0],ne[1]]);De!==te.length-1?be=`${be}${xe[0]} ${xe[1]}L`:be=`${be}${xe[0]} ${xe[1]}`}),l.jsx("path",{d:be,style:{stroke:g,strokeWidth:d,fill:p}},Me)})},ee)),l.jsx(mt,{children:e.map(le=>{const ee=r.features.findIndex(te=>le.id===te.properties[S]),de=je(le.x)?p:he(le.x);return l.jsx($e.g,{variants:{initial:{opacity:0},whileInView:{opacity:_?_===de?1:ae:j.length!==0?j.indexOf(le.id)!==-1?1:ae:1,transition:{duration:q.duration}}},initial:"initial",animate:ie?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},onMouseEnter:te=>{O(le),T(te.clientY),Q(te.clientX),y?.(le)},onMouseMove:te=>{O(le),T(te.clientY),Q(te.clientX)},onMouseLeave:()=>{O(void 0),Q(void 0),T(void 0),y?.(void 0)},onClick:()=>{(w||W)&&(dt(C,le)&&P?(A(void 0),w?.(void 0)):(A(le),w?.(le)))},children:ee===-1?null:r.features[ee].geometry.type==="MultiPolygon"?r.features[ee].geometry.coordinates.map((te,Me)=>{let be="";return te.forEach(ne=>{let De=" M";ne.forEach((xe,Ae)=>{const ke=J([xe[0],xe[1]]);Ae!==ne.length-1?De=`${De}${ke[0]} ${ke[1]}L`:De=`${De}${ke[0]} ${ke[1]}`}),be+=De}),l.jsx($e.path,{d:be,variants:{initial:{fill:de,opacity:0},whileInView:{fill:de,opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:ie?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},style:{stroke:g,strokeWidth:d}},`${le.id}-${Me}`)}):r.features[ee].geometry.coordinates.map((te,Me)=>{let be="M";return te.forEach((ne,De)=>{const xe=J([ne[0],ne[1]]);De!==te.length-1?be=`${be}${xe[0]} ${xe[1]}L`:be=`${be}${xe[0]} ${xe[1]}`}),l.jsx($e.path,{d:be,variants:{initial:{fill:de,opacity:0},whileInView:{fill:de,opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:ie?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},style:{stroke:g,strokeWidth:d}},`${le.id}-${Me}`)})},le.id)})}),M?r.features.filter(le=>le.properties[S]===M.id).map((le,ee)=>l.jsx("g",{children:le.geometry.type==="MultiPolygon"?le.geometry.coordinates.map((de,te)=>{let Me="";return de.forEach(be=>{let ne=" M";be.forEach((De,xe)=>{const Ae=J([De[0],De[1]]);xe!==be.length-1?ne=`${ne}${Ae[0]} ${Ae[1]}L`:ne=`${ne}${Ae[0]} ${Ae[1]}`}),Me+=ne}),l.jsx("path",{d:Me,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},te)}):le.geometry.coordinates.map((de,te)=>{let Me="M";return de.forEach((be,ne)=>{const De=J([be[0],be[1]]);ne!==de.length-1?Me=`${Me}${De[0]} ${De[1]}L`:Me=`${Me}${De[0]} ${De[1]}`}),l.jsx("path",{d:Me,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},te)})},ee)):null,G.filter(le=>le.position==="after").map(le=>le.layer)]})}),v===!1?null:l.jsx("div",{className:"absolute left-4 bottom-4",children:X?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{z(!1)},children:l.jsx(ea,{})}),l.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:o?void 0:"340px"},children:[a&&a!==""?l.jsx(Ce.P,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:a}):null,o?l.jsx("div",{className:"flex flex-col gap-3",children:n.map((le,ee)=>l.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{b(i[ee%i.length])},onMouseLeave:()=>{b(void 0)},children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i[ee%i.length]}}),l.jsx(Ce.P,{size:"sm",marginBottom:"none",leading:"none",children:le})]},ee))}):l.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:l.jsxs("g",{children:[n.map((le,ee)=>l.jsxs("g",{onMouseOver:()=>{b(i[ee])},onMouseLeave:()=>{b(void 0)},className:"cursor-pointer",children:[l.jsx("rect",{x:ee*320/i.length+1,y:1,width:320/i.length-2,height:8,className:_===i[ee]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:i[ee],..._===i[ee]?{}:{stroke:i[ee]}}}),l.jsx("text",{x:(ee+1)*320/i.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:qe(le,"NA")})]},ee)),l.jsx("g",{children:l.jsx("rect",{onMouseOver:()=>{b(i[n.length])},onMouseLeave:()=>{b(void 0)},x:n.length*320/i.length+1,y:1,width:320/i.length-2,height:8,className:`cursor-pointer ${_===i[n.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:i[n.length],..._===i[n.length]?{}:{stroke:i[n.length]}}})})]})})]})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{z(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),V==="button"&&l.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[l.jsx("button",{onClick:()=>R("in"),className:"leading-0 px-2 py-3.5 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),l.jsx("button",{onClick:()=>R("out"),className:"leading-0 px-2 py-3.5 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),W&&C!==void 0?l.jsx(Ce.Modal,{open:C!==void 0,onClose:()=>{A(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof W=="string"?{__html:lt(W,C)}:void 0,children:typeof W=="function"?W(C):null})}):null,M&&f&&K&&se?l.jsx(st,{data:M,body:f,xPos:K,yPos:se,backgroundStyle:D?.tooltip,className:x?.tooltip}):null]})}var Ou,Gm;function GL(){if(Gm)return Ou;Gm=1;var t=1/0,e=9007199254740991,n="[object Arguments]",i="[object Function]",r="[object GeneratorFunction]",a=typeof Ot=="object"&&Ot&&Ot.Object===Object&&Ot,o=typeof self=="object"&&self&&self.Object===Object&&self,s=a||o||Function("return this")(),c=Object.prototype,u=c.hasOwnProperty,h=c.toString,f=s.Symbol,d=c.propertyIsEnumerable,g=f?f.isConcatSpreadable:void 0;function p(x,$,V,q,ae){var G=-1,_=x.length;for(V||(V=y),ae||(ae=[]);++G<_;){var b=x[G];V(b)?p(b,$-1,V,q,ae):ae[ae.length]=b}return ae}function y(x){return I(x)||m(x)||!!(g&&x&&x[g])}function v(x){var $=x?x.length:0;return $?p(x,t):[]}function m(x){return w(x)&&u.call(x,"callee")&&(!d.call(x,"callee")||h.call(x)==n)}var I=Array.isArray;function j(x){return x!=null&&P(x.length)&&!S(x)}function w(x){return D(x)&&j(x)}function S(x){var $=W(x)?h.call(x):"";return $==i||$==r}function P(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=e}function W(x){var $=typeof x;return!!x&&($=="object"||$=="function")}function D(x){return!!x&&typeof x=="object"}return Ou=v,Ou}var YL=GL();const hn=rr(YL);function jr(t,e){return t.length===0?[]:typeof t[0][e]!="object"?tt(Xe(t,r=>r[e]),r=>r[e]).map(r=>r[e]):tt(Xe(hn(t.map(i=>i[e])),i=>i),i=>i)}function Hv(t){const{data:e,mapData:n="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",graphTitle:i,colors:r,sources:a,graphDescription:o,height:s,width:c,footNote:u="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorDomain:h,colorLegendTitle:f,scaleType:d="threshold",scale:g=.95,centerPoint:p,padding:y,mapBorderWidth:v=.5,mapNoDataColor:m=Pe.light.graphNoData,backgroundColor:I=!1,mapBorderColor:j=Pe.light.grays["gray-500"],relativeHeight:w,tooltip:S,onSeriesMouseOver:P,isWorldMap:W=!0,showColorScale:D=!0,zoomScaleExtend:x=[.8,6],zoomTranslateExtend:$,graphID:V,highlightedIds:q=[],onSeriesMouseClick:ae,mapProperty:G="ISO3",graphDownload:_=!1,dataDownload:b=!1,showAntarctica:B=!1,language:X="en",minHeight:z=0,theme:C="light",ariaLabel:A,resetSelectionOnDoubleClick:M=!0,detailsOnClick:O,styles:K,classNames:Q,mapProjection:se,zoomInteraction:T="button",animate:Z=!1,dimmedOpacity:ie=.3,customLayers:ue=[],timeline:he={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=t,[Y,ge]=k.useState(0),[oe,ce]=k.useState(0),[N,U]=k.useState(he.autoplay),ve=di(Xe(e.filter(ne=>ne.date!==void 0&&ne.date!==null),ne=>ne.date).map(ne=>ze(`${ne.date}`,he.dateFormat||"yyyy",new Date).getTime()),(ne,De)=>an(ne,De)),[J,R]=k.useState(he.autoplay?0:ve.length-1),[le,ee]=k.useState(void 0),de=k.useRef(null),te=k.useRef(null);k.useEffect(()=>{const ne=new ResizeObserver(De=>{ge(c||De[0].target.clientWidth||760),ce(s||De[0].target.clientHeight||480)});return de.current&&(ce(de.current.clientHeight||480),ge(de.current.clientWidth||760),c||ne.observe(de.current)),()=>ne.disconnect()},[c,s]),k.useEffect(()=>{typeof n=="string"?en(n).then(De=>{ee(De)}):ee(n)},[n]);const Me=h||(d==="categorical"?jr(e,"x"):Gs(e.map(ne=>ne.x),r?.length||4));k.useEffect(()=>{const ne=setInterval(()=>{R(De=>De<ve.length-1?De+1:0)},(he.speed||2)*1e3);return N||clearInterval(ne),()=>clearInterval(ne)},[ve,N,he.speed]);const be=yi(ve,J,he.showOnlyActiveDate,he.dateFormat||"yyyy");return l.jsx("div",{className:`${C||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:X==="he"||X==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${X||"en"}`,Q?.graphContainer),style:{...K?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:V,ref:te,"aria-label":A||`${i?`The graph shows ${i}. `:""}This is a choropleth map where geographic areas are colored in proportion to a specific variable.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:I?y||"1rem":y||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[i||o||_||b?l.jsx(Qe,{styles:{title:K?.title,description:K?.description},classNames:{title:Q?.title,description:Q?.description},graphTitle:i,graphDescription:o,width:c,graphDownload:_?te.current:void 0,dataDownload:b?e.map(ne=>ne.data).filter(ne=>ne!==void 0).length>0?e.map(ne=>ne.data).filter(ne=>ne!==void 0):e.filter(ne=>ne!==void 0):null}):null,he.enabled&&ve.length>0&&be?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{U(!N)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":N?"Click to pause animation":"Click to play animation",children:N?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:ve[0],max:ve[ve.length-1],marks:be,step:null,defaultValue:ve[ve.length-1],value:ve[J],onChangeComplete:ne=>{R(ve.indexOf(ne))},onChange:ne=>{R(ve.indexOf(ne))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:de,"aria-label":"Map area",children:(c||Y)&&(s||oe)&&le?l.jsx(zL,{data:e.filter(ne=>he.enabled?ne.date===ft(new Date(ve[J]),he.dateFormat||"yyyy"):ne),mapData:B?le:{...le,features:le.features.filter(ne=>ne.properties.NAME!=="Antarctica")},colorDomain:Me,width:c||Y,height:Math.max(z,s||(w?z?(c||Y)*w>z?(c||Y)*w:z:(c||Y)*w:oe)),scale:g,centerPoint:p,colors:r||(d==="categorical"?Pe[C].sequentialColors[`neutralColorsx0${Me.length}`]:Pe[C].sequentialColors[`neutralColorsx0${Me.length+1}`]),colorLegendTitle:f,mapBorderWidth:v,mapNoDataColor:m,categorical:d==="categorical",mapBorderColor:j,tooltip:S,onSeriesMouseOver:P,isWorldMap:W,showColorScale:D,zoomScaleExtend:x,zoomTranslateExtend:$,onSeriesMouseClick:ae,mapProperty:G,highlightedIds:q,resetSelectionOnDoubleClick:M,styles:K,classNames:Q,detailsOnClick:O,mapProjection:se||(W?"naturalEarth":"mercator"),zoomInteraction:T,dimmedOpacity:ie,animate:Z===!0?{duration:.5,once:!0,amount:.5}:Z||{duration:0,once:!0,amount:0},customLayers:ue}):l.jsx("div",{style:{height:`${Math.max(z,s||(w?z?(c||Y)*w>z?(c||Y)*w:z:(c||Y)*w:oe))}px`},className:"flex items-center justify-center",children:l.jsx(Ce.Spinner,{"aria-label":"Loading graph"})})}),a||u?l.jsx(et,{styles:{footnote:K?.footnote,source:K?.source},classNames:{footnote:Q?.footnote,source:Q?.source},sources:a,footNote:u,width:c}):null]})})})})}function qL(t){const{data:e,colors:n,mapData:i,colorLegendTitle:r,colorDomain:a,radius:o,height:s,width:c,scale:u,centerPoint:h,tooltip:f,showLabels:d,mapBorderWidth:g,mapBorderColor:p,mapNoDataColor:y,onSeriesMouseOver:v,showColorScale:m,zoomScaleExtend:I,zoomTranslateExtend:j,highlightedDataPoints:w,onSeriesMouseClick:S,resetSelectionOnDoubleClick:P,detailsOnClick:W,styles:D,classNames:x,mapProjection:$,zoomInteraction:V,animate:q,dimmedOpacity:ae,customLayers:G,maxRadiusValue:_}=t,[b,B]=k.useState(void 0),[X,z]=k.useState(!(c<680)),C=k.useRef(null),[A,M]=k.useState(void 0),[O,K]=k.useState(void 0),[Q,se]=k.useState(void 0),[T,Z]=k.useState(void 0),ie=k.useRef(null),ue=ct(ie,{once:q.once,amount:q.amount}),he=k.useRef(null),Y=e.filter(ee=>ee.radius===void 0||ee.radius===null).length!==e.length?Qs().domain([0,_]).range([.25,o]).nice():void 0;k.useEffect(()=>{const ee=bt(he.current),de=bt(ie.current),te=be=>{if(V==="noZoom")return!1;if(V==="button")return!be.type.includes("wheel");const ne=be.type==="wheel",De=be.type.startsWith("touch"),xe=be.type==="mousedown"||be.type==="mousemove";return De?!0:ne?V==="scroll"?!0:be.ctrlKey:xe&&!be.button&&!be.ctrlKey},Me=Dd().scaleExtent(I).translateExtent(j||[[-20,-20],[c+20,s+20]]).filter(te).on("zoom",({transform:be})=>{ee.attr("transform",be)});de.call(Me),C.current=Me},[s,c,V]);const ge=hd(i),oe=fd(i),ce=ge[2]-ge[0],N=ge[3]-ge[1],U=c*190/960*360/ce,ve=s*190/678*180/N,J=u*Math.min(U,ve),R=$==="mercator"?xd().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J):$==="equalEarth"?vd().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J):$==="naturalEarth"?wd().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J):$==="orthographic"?bd().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J):md().rotate([0,0]).center(h||oe.geometry.coordinates).translate([c/2,s/2]).scale(J),le=ee=>{if(!ie.current||!C.current)return;bt(ie.current).call(C.current.scaleBy,ee==="in"?1.2:1/1.2)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx($e.svg,{width:`${c}px`,height:`${s}px`,viewBox:`0 0 ${c} ${s}`,ref:ie,direction:"ltr",children:l.jsxs("g",{ref:he,children:[G.filter(ee=>ee.position==="before").map(ee=>ee.layer),i.features.map((ee,de)=>l.jsx("g",{children:ee.geometry.type==="MultiPolygon"?ee.geometry.coordinates.map((te,Me)=>{let be="";return te.forEach(ne=>{let De=" M";ne.forEach((xe,Ae)=>{const ke=R([xe[0],xe[1]]);Ae!==ne.length-1?De=`${De}${ke[0]} ${ke[1]}L`:De=`${De}${ke[0]} ${ke[1]}`}),be+=De}),l.jsx("path",{d:be,style:{stroke:p,strokeWidth:g,fill:y}},Me)}):ee.geometry.coordinates.map((te,Me)=>{let be="M";return te.forEach((ne,De)=>{const xe=R([ne[0],ne[1]]);De!==te.length-1?be=`${be}${xe[0]} ${xe[1]}L`:be=`${be}${xe[0]} ${xe[1]}`}),l.jsx("path",{d:be,style:{stroke:p,strokeWidth:g,fill:y}},Me)})},de)),l.jsx(mt,{children:e.map(ee=>{const de=e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray;return l.jsxs($e.g,{variants:{initial:{opacity:0},whileInView:{opacity:b?b===de?1:ae:w.length!==0?w.indexOf(ee.label||"")!==-1?1:ae:1,transition:{duration:q.duration}}},initial:"initial",animate:ue?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},onMouseEnter:te=>{K(ee),Z(te.clientY),se(te.clientX),v?.(ee)},onMouseMove:te=>{K(ee),Z(te.clientY),se(te.clientX)},onMouseLeave:()=>{K(void 0),se(void 0),Z(void 0),v?.(void 0)},onClick:()=>{(S||W)&&(dt(A,ee)&&P?(M(void 0),S?.(void 0)):(M(ee),S?.(ee)))},transform:`translate(${R([ee.long,ee.lat])[0]},${R([ee.long,ee.lat])[1]})`,children:[l.jsx($e.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray,stroke:e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray},whileInView:{r:Y?Y(ee.radius||0):o,fill:e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray,stroke:e.filter(te=>te.color).length===0?n[0]:ee.color?n[a.indexOf(`${ee.color}`)]:Pe.gray,transition:{duration:q.duration}}},initial:"initial",animate:ue?"whileInView":"initial",exit:{r:0,transition:{duration:q.duration}},style:{fillOpacity:.8}}),d&&ee.label?l.jsx($e.text,{variants:{initial:{opacity:0,x:Y?Y(ee.radius||0):o},whileInView:{opacity:1,x:Y?Y(ee.radius||0):o,transition:{duration:q.duration}}},initial:"initial",animate:ue?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},y:0,className:"fill-primary-gray-600 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},dx:4,dy:5,children:ee.label}):null]},ee.label||`${ee.lat}-${ee.long}`)})}),G.filter(ee=>ee.position==="after").map(ee=>ee.layer)]})}),e.filter(ee=>ee.color).length===0||m===!1?null:l.jsx("div",{className:"absolute left-4 bottom-4",children:X?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{z(!1)},children:l.jsx(ea,{})}),l.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[r&&r!==""?l.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:r}):null,l.jsx("div",{className:"flex flex-col gap-3",children:a.map((ee,de)=>l.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{B(n[de%n.length])},onMouseLeave:()=>{B(void 0)},children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n[de%n.length]}}),l.jsx(Ce.P,{size:"sm",marginBottom:"none",leading:"none",children:ee})]},de))})]})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{z(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),V==="button"&&l.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[l.jsx("button",{onClick:()=>le("in"),className:"leading-0 px-2 py-3.5 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),l.jsx("button",{onClick:()=>le("out"),className:"leading-0 px-2 py-3.5 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),W&&A!==void 0?l.jsx(Ce.Modal,{open:A!==void 0,onClose:()=>{M(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof W=="string"?{__html:lt(W,A)}:void 0,children:typeof W=="function"?W(A):null})}):null,O&&f&&Q&&T?l.jsx(st,{data:O,body:f,xPos:Q,yPos:T,backgroundStyle:D?.tooltip,className:x?.tooltip}):null]})}function Wv(t){const{data:e,mapData:n="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",graphTitle:i,colors:r,sources:a,graphDescription:o,height:s,width:c,footNote:u="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorLegendTitle:h,colorDomain:f,radius:d=5,scale:g=.95,centerPoint:p,padding:y,mapBorderWidth:v=.5,mapNoDataColor:m=Pe.light.graphNoData,backgroundColor:I=!1,showLabels:j=!1,mapBorderColor:w=Pe.light.grays["gray-500"],tooltip:S,relativeHeight:P,onSeriesMouseOver:W,isWorldMap:D=!0,showColorScale:x=!0,zoomScaleExtend:$=[.8,6],zoomTranslateExtend:V,graphID:q,highlightedDataPoints:ae=[],onSeriesMouseClick:G,graphDownload:_=!1,dataDownload:b=!1,showAntarctica:B=!1,language:X="en",minHeight:z=0,theme:C="light",ariaLabel:A,resetSelectionOnDoubleClick:M=!0,detailsOnClick:O,styles:K,classNames:Q,mapProjection:se,zoomInteraction:T="button",animate:Z=!1,dimmedOpacity:ie=.3,customLayers:ue=[],maxRadiusValue:he,timeline:Y={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(Y.autoplay),J=di(Xe(e.filter(ne=>ne.date!==void 0&&ne.date!==null),ne=>ne.date).map(ne=>ze(`${ne.date}`,Y.dateFormat||"yyyy",new Date).getTime()),(ne,De)=>an(ne,De)),[R,le]=k.useState(Y.autoplay?0:J.length-1),[ee,de]=k.useState(void 0),te=k.useRef(null),Me=k.useRef(null);k.useEffect(()=>{const ne=new ResizeObserver(De=>{oe(c||De[0].target.clientWidth||760),N(s||De[0].target.clientHeight||480)});return te.current&&(N(te.current.clientHeight||480),oe(te.current.clientWidth||760),c||ne.observe(te.current)),()=>ne.disconnect()},[c,s]),k.useEffect(()=>{typeof n=="string"?en(n).then(De=>{de(De)}):de(n)},[n]),k.useEffect(()=>{const ne=setInterval(()=>{le(De=>De<J.length-1?De+1:0)},(Y.speed||2)*1e3);return U||clearInterval(ne),()=>clearInterval(ne)},[J,U,Y.speed]);const be=yi(J,R,Y.showOnlyActiveDate,Y.dateFormat||"yyyy");return l.jsx("div",{className:`${C||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:X==="he"||X==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${X||"en"}`,Q?.graphContainer),style:{...K?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:q,ref:Me,"aria-label":A||`${i?`The graph shows ${i}. `:""}This is a dot density map showing the distribution of a variable across a region or world, with each dot representing a data point.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:I?y||"1rem":y||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[i||o||_||b?l.jsx(Qe,{styles:{title:K?.title,description:K?.description},classNames:{title:Q?.title,description:Q?.description},graphTitle:i,graphDescription:o,width:c,graphDownload:_?Me.current:void 0,dataDownload:b?e.map(ne=>ne.data).filter(ne=>ne!==void 0).length>0?e.map(ne=>ne.data).filter(ne=>ne!==void 0):e.filter(ne=>ne!==void 0):null}):null,Y.enabled&&J.length>0&&be?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{ve(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:J[0],max:J[J.length-1],marks:be,step:null,defaultValue:J[J.length-1],value:J[R],onChangeComplete:ne=>{le(J.indexOf(ne))},onChange:ne=>{le(J.indexOf(ne))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:te,"aria-label":"Map area",children:(c||ge)&&(s||ce)&&ee?l.jsx(qL,{data:e.filter(ne=>Y.enabled?ne.date===ft(new Date(J[R]),Y.dateFormat||"yyyy"):ne),mapData:B?ee:{...ee,features:ee.features.filter(ne=>ne.properties.NAME!=="Antarctica")},colorDomain:e.filter(ne=>ne.color).length===0?[]:f||Xe(e.filter(ne=>!je(ne.color)),"color").map(ne=>`${ne.color}`),width:c||ge,height:Math.max(z,s||(P?z?(c||ge)*P>z?(c||ge)*P:z:(c||ge)*P:ce)),scale:g,centerPoint:p,colors:e.filter(ne=>ne.color).length===0?r?[r]:[Pe.primaryColors["blue-600"]]:r||Pe[C].categoricalColors.colors,colorLegendTitle:h,radius:d,mapBorderWidth:v,mapNoDataColor:m,mapBorderColor:w,tooltip:S,onSeriesMouseOver:W,showLabels:j,isWorldMap:D,showColorScale:x,zoomScaleExtend:$,zoomTranslateExtend:V,onSeriesMouseClick:G,highlightedDataPoints:ae,resetSelectionOnDoubleClick:M,styles:K,classNames:Q,zoomInteraction:T,detailsOnClick:O,mapProjection:se||(D?"naturalEarth":"mercator"),animate:Z===!0?{duration:.5,once:!0,amount:.5}:Z||{duration:0,once:!0,amount:0},dimmedOpacity:ie,customLayers:ue,maxRadiusValue:je(he)?Math.max(...e.map(ne=>ne.radius).filter(ne=>ne!=null)):he}):l.jsx("div",{style:{height:`${Math.max(z,s||(P?z?(c||ge)*P>z?(c||ge)*P:z:(c||ge)*P:ce))}px`},className:"flex items-center justify-center",children:l.jsx(Ce.Spinner,{"aria-label":"Loading graph"})})}),a||u?l.jsx(et,{styles:{footnote:K?.footnote,source:K?.source},classNames:{footnote:Q?.footnote,source:Q?.source},sources:a,footNote:u,width:c}):null]})})})})}function UL(t){const{width:e,autoRotate:n,data:i,enableZoom:r,categorical:a,colorDomain:o,colors:s,globeMaterial:c,height:u,polygonData:h,mapProperty:f,mapBorderColor:d,atmosphereColor:g,tooltip:p,styles:y,classNames:v,mapNoDataColor:m,centerPoint:I,colorLegendTitle:j,showColorScale:w,hoverStrokeColor:S,detailsOnClick:P,onSeriesMouseClick:W,onSeriesMouseOver:D,resetSelectionOnDoubleClick:x,highlightedIds:$,scale:V,globeOffset:q,polygonAltitude:ae,centerLng:G,centerLat:_}=t,b=k.useRef(void 0),[B,X]=k.useState(void 0),[z,C]=k.useState(!(e<680)),[A,M]=k.useState({x:0,y:0}),[O,K]=k.useState(void 0),Q=a?Xs().domain(o).range(s):Po().domain(o).range(s);k.useEffect(()=>{b?.current&&(b.current.controls().autoRotate=n!==0,b.current.controls().enableZoom=r,b.current.controls().autoRotateSpeed=n)},[n,r]),k.useEffect(()=>{b.current&&(O?b.current.controls().autoRotate=!1:b.current.controls().autoRotate=n!==0)},[O,n]),k.useEffect(()=>{const T=b.current?.renderer().domElement;if(!T)return;const Z=ie=>{M({x:ie.clientX,y:ie.clientY})};return T.addEventListener("mousemove",Z),()=>T.removeEventListener("mousemove",Z)},[]),k.useEffect(()=>{b.current&&b.current.pointOfView({lat:_,lng:G,altitude:V},1e3)},[V,G,_]);const se=new Gw.MeshLambertMaterial({color:"#fff",opacity:1,transparent:!1,...c||{}});return l.jsxs("div",{className:"relative",children:[l.jsx(Vw,{ref:b,width:e,height:u,globeOffset:q,lineHoverPrecision:0,polygonsData:h,polygonAltitude:T=>$.includes(T?.properties?.[f])?.1:T?.properties?.[f]===O?.id?.01:ae,polygonCapColor:T=>{const Z=T?.properties?.[f],ie=i.find(ue=>ue.id===Z)?.x;return ie!=null?Q(ie):m},polygonSideColor:T=>{const Z=T?.properties?.[f],ie=i.find(he=>he.id===Z)?.x,ue=ie!=null?Q(ie):m;return $.includes(T?.properties?.[f])?ue:"rgba(100,100,100,0)"},polygonStrokeColor:T=>T?.properties?.[f]===O?.id?S:d,onPolygonClick:T=>{const Z=T?.properties?.[f]?i.find(ie=>ie.id===T?.properties?.[f]):void 0;(W||P)&&(dt(B,Z)&&x&&Z?(X(void 0),W?.(void 0)):(X(Z),W?.(Z))),X(Z),W?.(Z)},onPolygonHover:T=>{const Z=T?.properties?.[f]?i.find(ie=>ie.id===T?.properties?.[f]):void 0;K(Z),D?.(Z)},atmosphereColor:g,globeMaterial:se,backgroundColor:"rgba(0, 0, 0, 0)",polygonsTransitionDuration:100,onGlobeReady:()=>{b.current&&b.current.pointOfView({lat:I[0],lng:I[1]})}}),w===!1?null:l.jsx("div",{className:"absolute left-4 bottom-4",children:z?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{C(!1)},children:l.jsx(ea,{})}),l.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:a?void 0:"340px"},children:[j&&j!==""?l.jsx(Ce.P,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:j}):null,a?l.jsx("div",{className:"flex flex-col gap-3",children:o.map((T,Z)=>l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s[Z%s.length]}}),l.jsx(Ce.P,{size:"sm",marginBottom:"none",leading:"none",children:T})]},Z))}):l.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:l.jsxs("g",{children:[o.map((T,Z)=>l.jsxs("g",{className:"cursor-pointer",children:[l.jsx("rect",{x:Z*320/s.length+1,y:1,width:320/s.length-2,height:8,style:{fill:s[Z],stroke:s[Z]}}),l.jsx("text",{x:(Z+1)*320/s.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:qe(T,"NA")})]},Z)),l.jsx("g",{children:l.jsx("rect",{x:o.length*320/s.length+1,y:1,width:320/s.length-2,height:8,style:{fill:s[o.length],stroke:s[o.length]}})})]})})]})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{C(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),O&&p?l.jsx(st,{data:O,body:p,xPos:A.x,yPos:A.y,backgroundStyle:y?.tooltip,className:v?.tooltip}):null,P&&B!==void 0?l.jsx(Ce.Modal,{open:B!==void 0,onClose:()=>{X(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof P=="string"?{__html:lt(P,B)}:void 0,children:typeof P=="function"?P(B):null})}):null]})}function zv(t){const{data:e,mapData:n="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",graphTitle:i,colors:r,sources:a,graphDescription:o,height:s,width:c,footNote:u="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorDomain:h,colorLegendTitle:f,scaleType:d="threshold",padding:g,mapNoDataColor:p=Pe.light.graphNoData,backgroundColor:y=!1,mapBorderColor:v=Pe.light.grays["gray-500"],relativeHeight:m,tooltip:I,graphID:j,mapProperty:w="ISO3",dataDownload:S=!1,language:P="en",minHeight:W=0,theme:D="light",ariaLabel:x,styles:$,classNames:V,autoRotate:q=!0,enableZoom:ae=!0,globeMaterial:G,centerPoint:_=[0,0],atmosphereColor:b="#999",showColorScale:B=!0,resetSelectionOnDoubleClick:X=!0,detailsOnClick:z,onSeriesMouseOver:C,onSeriesMouseClick:A,highlightedIds:M=[],scale:O=1,globeOffset:K=[0,0],polygonAltitude:Q=.01}=t,[se,T]=k.useState(void 0),[Z,ie]=k.useState(0),[ue,he]=k.useState(0),Y=k.useRef(null);k.useEffect(()=>{const oe=new ResizeObserver(ce=>{ie(c||ce[0].target.clientWidth||760),he(s||ce[0].target.clientHeight||480)});return Y.current&&(he(Y.current.clientHeight||480),ie(Y.current.clientWidth||760),c||oe.observe(Y.current)),()=>oe.disconnect()},[c,s]),k.useEffect(()=>{typeof n=="string"?en(n).then(ce=>{if(n==="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json"){const N=ce.features.map(U=>{if(U.geometry.type==="Polygon"){const R=[...U.geometry.coordinates[0]].reverse(),le={...U.geometry,coordinates:[R]};return{...U,geometry:le}}const ve=[];U.geometry.coordinates.forEach(R=>{const le=[...R[0]].reverse();ve.push([le])});const J={...U.geometry,coordinates:ve};return{...U,geometry:J}});T(N)}else T(ce.features)}):T(n.features)},[n]);const ge=h||(d==="categorical"?jr(e,"x"):Gs(e.map(oe=>oe.x),r?.length||4));return l.jsx("div",{className:`${D||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:P==="he"||P==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${y?y===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${P||"en"}`,V?.graphContainer),style:{...$?.graphContainer||{},...y&&y!==!0?{backgroundColor:y}:{}},id:j,"aria-label":x||`${i?`The graph shows ${i}. `:""}This is a map.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:y?g||"1rem":g||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[i||o||S?l.jsx(Qe,{styles:{title:$?.title,description:$?.description},classNames:{title:V?.title,description:V?.description},graphTitle:i,graphDescription:o,width:c,graphDownload:void 0,dataDownload:S?e.map(oe=>oe.data).filter(oe=>oe!==void 0).length>0?e.map(oe=>oe.data).filter(oe=>oe!==void 0):e.filter(oe=>oe!==void 0):null}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:Y,"aria-label":"Map area",children:(c||Z)&&(s||ue)&&se?l.jsx(UL,{data:e,globeOffset:K,polygonData:se,colorDomain:ge,width:c||Z,height:Math.max(W,s||(m?W?(c||Z)*m>W?(c||Z)*m:W:(c||Z)*m:ue)),colors:r||(d==="categorical"?Pe[D].sequentialColors[`neutralColorsx0${ge.length}`]:Pe[D].sequentialColors[`neutralColorsx0${ge.length+1}`]),mapNoDataColor:p,categorical:d==="categorical",mapBorderColor:v,tooltip:I,mapProperty:w,styles:$,classNames:V,autoRotate:q===!0?1.5:q===!1?0:q,enableZoom:ae,globeMaterial:G,atmosphereColor:b,centerPoint:_,colorLegendTitle:f,showColorScale:B,hoverStrokeColor:D==="light"?Pe.light.grays["gray-700"]:Pe.light.grays["gray-300"],highlightedIds:M,resetSelectionOnDoubleClick:X,detailsOnClick:z,onSeriesMouseOver:C,onSeriesMouseClick:A,scale:O,polygonAltitude:Q,centerLat:_[0],centerLng:_[1]}):l.jsx("div",{style:{height:`${Math.max(W,s||(m?W?(c||Z)*m>W?(c||Z)*m:W:(c||Z)*m:ue))}px`},className:"flex items-center justify-center",children:l.jsx(Ce.Spinner,{"aria-label":"Loading graph"})})}),a||u?l.jsx(et,{styles:{footnote:$?.footnote,source:$?.source},classNames:{footnote:V?.footnote,source:V?.source},sources:a,footNote:u,width:c}):null]})})})})}var Nu,Ym;function XL(){if(Ym)return Nu;Ym=1;var t="__lodash_hash_undefined__",e=9007199254740991,n="[object Function]",i="[object GeneratorFunction]",r=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=typeof Ot=="object"&&Ot&&Ot.Object===Object&&Ot,s=typeof self=="object"&&self&&self.Object===Object&&self,c=o||s||Function("return this")();function u(F,Ie,Ve){switch(Ve.length){case 0:return F.call(Ie);case 1:return F.call(Ie,Ve[0]);case 2:return F.call(Ie,Ve[0],Ve[1]);case 3:return F.call(Ie,Ve[0],Ve[1],Ve[2])}return F.apply(Ie,Ve)}function h(F,Ie){var Ve=F?F.length:0;return!!Ve&&g(F,Ie,0)>-1}function f(F,Ie){for(var Ve=-1,H=F?F.length:0,Oe=Array(H);++Ve<H;)Oe[Ve]=Ie(F[Ve],Ve,F);return Oe}function d(F,Ie,Ve,H){for(var Oe=F.length,Ee=Ve+-1;++Ee<Oe;)if(Ie(F[Ee],Ee,F))return Ee;return-1}function g(F,Ie,Ve){if(Ie!==Ie)return d(F,p,Ve);for(var H=Ve-1,Oe=F.length;++H<Oe;)if(F[H]===Ie)return H;return-1}function p(F){return F!==F}function y(F,Ie){return F.has(Ie)}function v(F,Ie){return F?.[Ie]}function m(F){var Ie=!1;if(F!=null&&typeof F.toString!="function")try{Ie=!!(F+"")}catch{}return Ie}var I=Array.prototype,j=Function.prototype,w=Object.prototype,S=c["__core-js_shared__"],P=function(){var F=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||"");return F?"Symbol(src)_1."+F:""}(),W=j.toString,D=w.hasOwnProperty,x=w.toString,$=RegExp("^"+W.call(D).replace(r,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=I.splice,q=Math.max,ae=Math.min,G=de(c,"Map"),_=de(Object,"create");function b(F){var Ie=-1,Ve=F?F.length:0;for(this.clear();++Ie<Ve;){var H=F[Ie];this.set(H[0],H[1])}}function B(){this.__data__=_?_(null):{}}function X(F){return this.has(F)&&delete this.__data__[F]}function z(F){var Ie=this.__data__;if(_){var Ve=Ie[F];return Ve===t?void 0:Ve}return D.call(Ie,F)?Ie[F]:void 0}function C(F){var Ie=this.__data__;return _?Ie[F]!==void 0:D.call(Ie,F)}function A(F,Ie){var Ve=this.__data__;return Ve[F]=_&&Ie===void 0?t:Ie,this}b.prototype.clear=B,b.prototype.delete=X,b.prototype.get=z,b.prototype.has=C,b.prototype.set=A;function M(F){var Ie=-1,Ve=F?F.length:0;for(this.clear();++Ie<Ve;){var H=F[Ie];this.set(H[0],H[1])}}function O(){this.__data__=[]}function K(F){var Ie=this.__data__,Ve=U(Ie,F);if(Ve<0)return!1;var H=Ie.length-1;return Ve==H?Ie.pop():V.call(Ie,Ve,1),!0}function Q(F){var Ie=this.__data__,Ve=U(Ie,F);return Ve<0?void 0:Ie[Ve][1]}function se(F){return U(this.__data__,F)>-1}function T(F,Ie){var Ve=this.__data__,H=U(Ve,F);return H<0?Ve.push([F,Ie]):Ve[H][1]=Ie,this}M.prototype.clear=O,M.prototype.delete=K,M.prototype.get=Q,M.prototype.has=se,M.prototype.set=T;function Z(F){var Ie=-1,Ve=F?F.length:0;for(this.clear();++Ie<Ve;){var H=F[Ie];this.set(H[0],H[1])}}function ie(){this.__data__={hash:new b,map:new(G||M),string:new b}}function ue(F){return ee(this,F).delete(F)}function he(F){return ee(this,F).get(F)}function Y(F){return ee(this,F).has(F)}function ge(F,Ie){return ee(this,F).set(F,Ie),this}Z.prototype.clear=ie,Z.prototype.delete=ue,Z.prototype.get=he,Z.prototype.has=Y,Z.prototype.set=ge;function oe(F){var Ie=-1,Ve=F?F.length:0;for(this.__data__=new Z;++Ie<Ve;)this.add(F[Ie])}function ce(F){return this.__data__.set(F,t),this}function N(F){return this.__data__.has(F)}oe.prototype.add=oe.prototype.push=ce,oe.prototype.has=N;function U(F,Ie){for(var Ve=F.length;Ve--;)if(De(F[Ve][0],Ie))return Ve;return-1}function ve(F,Ie,Ve){for(var H=h,Oe=F[0].length,Ee=F.length,it=Ee,Tt=Array(Ee),sn=1/0,vn=[];it--;){var ln=F[it];sn=ae(ln.length,sn),Tt[it]=Oe>=120&&ln.length>=120?new oe(it&&ln):void 0}ln=F[0];var Ut=-1,jt=Tt[0];e:for(;++Ut<Oe&&vn.length<sn;){var gn=ln[Ut],Xt=gn;if(gn=gn!==0?gn:0,!(jt?y(jt,Xt):H(vn,Xt))){for(it=Ee;--it;){var Hn=Tt[it];if(!(Hn?y(Hn,Xt):H(F[it],Xt)))continue e}jt&&jt.push(Xt),vn.push(gn)}}return vn}function J(F){if(!Se(F)||Me(F))return!1;var Ie=ke(F)||m(F)?$:a;return Ie.test(be(F))}function R(F,Ie){return Ie=q(Ie===void 0?F.length-1:Ie,0),function(){for(var Ve=arguments,H=-1,Oe=q(Ve.length-Ie,0),Ee=Array(Oe);++H<Oe;)Ee[H]=Ve[Ie+H];H=-1;for(var it=Array(Ie+1);++H<Ie;)it[H]=Ve[H];return it[Ie]=Ee,u(F,this,it)}}function le(F){return Ae(F)?F:[]}function ee(F,Ie){var Ve=F.__data__;return te(Ie)?Ve[typeof Ie=="string"?"string":"hash"]:Ve.map}function de(F,Ie){var Ve=v(F,Ie);return J(Ve)?Ve:void 0}function te(F){var Ie=typeof F;return Ie=="string"||Ie=="number"||Ie=="symbol"||Ie=="boolean"?F!=="__proto__":F===null}function Me(F){return!!P&&P in F}function be(F){if(F!=null){try{return W.call(F)}catch{}try{return F+""}catch{}}return""}var ne=R(function(F){var Ie=f(F,le);return Ie.length&&Ie[0]===F[0]?ve(Ie):[]});function De(F,Ie){return F===Ie||F!==F&&Ie!==Ie}function xe(F){return F!=null&&me(F.length)&&!ke(F)}function Ae(F){return Le(F)&&xe(F)}function ke(F){var Ie=Se(F)?x.call(F):"";return Ie==n||Ie==i}function me(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=e}function Se(F){var Ie=typeof F;return!!F&&(Ie=="object"||Ie=="function")}function Le(F){return!!F&&typeof F=="object"}return Nu=ne,Nu}var KL=XL();const Qa=rr(KL);function Ai(t,e){return e.length===0?t:t.filter(r=>e.every(a=>a.includeValues&&a.includeValues.length>0?Qa(hn([r[a.column]]),a.includeValues).length>0:!0)).filter(r=>e.every(a=>a.excludeValues&&a.excludeValues.length>0?Qa(hn([r[a.column]]),a.excludeValues).length===0:!0))}function QL(t){const{mapStyle:e,height:n,width:i,relativeHeight:r,center:a,zoomLevel:o,minHeight:s,includeLayers:c,excludeLayers:u,mapLegend:h}=t,[f,d]=k.useState(0),[g,p]=k.useState(0),[y,v]=k.useState(!0),m=k.useRef(null),I=k.useRef(null),j=k.useRef(null);return k.useEffect(()=>{const w=new ResizeObserver(S=>{d(i||S[0].target.clientWidth||620),p(n||S[0].target.clientHeight||480)});return m.current&&(p(m.current.clientHeight||480),d(m.current.clientWidth||620),i||w.observe(m.current)),()=>w.disconnect()},[i,n]),k.useEffect(()=>{I.current&&f&&!j.current&&en(e).then(w=>{bt(I.current).selectAll("div").remove();const P=new Sc.Protocol;hi.addProtocol("pmtiles",P.tile);const W={container:I.current,style:c.length===0&&u.length===0?w:{...w,layers:Ai(w.layers,[{column:"id",includeValues:c,excludeValues:u}])},attributionControl:!0};a&&(W.center=a),o&&(W.zoom=o),j.current=new hi.Map(W),j.current.addControl(new hi.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),j.current.addControl(new hi.ScaleControl,"bottom-left")})},[f,a,o,c,u,e]),k.useEffect(()=>{j.current&&en(e).then(w=>{const S={...w,layers:Ai(w.layers,[{column:"id",includeValues:c,excludeValues:u}])};j.current.setStyle(S)})},[u,c,e]),l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:m,"aria-label":"Map area",children:(i||f)&&(n||g)?l.jsxs("div",{style:{width:i||f,height:Math.max(s,n||(r?s?(i||f)*r>s?(i||f)*r:s:(i||f)*r:g))},children:[l.jsx("div",{ref:I,className:"map maplibre-show-control",style:{width:"100%",height:"100%"}}),h?l.jsx("div",{className:"absolute left-[22px] bottom-13",children:y?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{v(!1)},children:l.jsx(ea,{})}),l.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof h=="string"?{__html:lt(h)}:void 0,children:k.isValidElement(h)?h:null})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{v(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function ZL(t){const{mapStyle:e,height:n,width:i,relativeHeight:r,center:a,zoomLevel:o,minHeight:s,includeLayers:c,excludeLayers:u,mapLegend:h}=t,[f,d]=k.useState(0),[g,p]=k.useState(0),[y,v]=k.useState(!0),m=k.useRef(null),I=k.useRef(null);return k.useEffect(()=>{const j=new ResizeObserver(w=>{d(i||w[0].target.clientWidth||620),p(n||w[0].target.clientHeight||480)});return m.current&&(p(m.current.clientHeight||480),d(m.current.clientWidth||620),i||j.observe(m.current)),()=>j.disconnect()},[i,n]),k.useEffect(()=>{I.current&&f&&en(e).then(j=>{bt(I.current).selectAll("div").remove();const S=new Sc.Protocol;hi.addProtocol("pmtiles",S.tile);const P={container:I.current,style:c.length===0&&u.length===0?j:{...j,layers:Ai(j.layers,[{column:"id",includeValues:c,excludeValues:u}])},attributionControl:!0};a&&(P.center=a),o&&(P.zoom=o);const W=new hi.Map(P);W.addControl(new hi.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),W.addControl(new hi.ScaleControl,"bottom-left")})},[f,e,a,o,c,u]),l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:m,"aria-label":"Map area",children:(i||f)&&(n||g)?l.jsxs("div",{style:{width:i||f,height:Math.max(s,n||(r?s?(i||f)*r>s?(i||f)*r:s:(i||f)*r:g))},children:[l.jsx("div",{ref:I,className:"map maplibre-show-control",style:{width:"100%",height:"100%"}}),h?l.jsx("div",{className:"absolute left-[22px] bottom-13",children:y?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{v(!1)},children:l.jsx(ea,{})}),l.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof h=="string"?{__html:lt(h)}:void 0,children:k.isValidElement(h)?h:null})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{v(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function Gv(t){const{mapStyle:e,graphTitle:n,height:i,width:r,relativeHeight:a,sources:o,graphDescription:s,footNote:c,padding:u,backgroundColor:h=!1,center:f,zoomLevel:d,graphID:g,language:p="en",minHeight:y=0,theme:v="light",includeLayers:m=[],excludeLayers:I=[],ariaLabel:j,uiMode:w="normal",styles:S,classNames:P,mapLegend:W}=t,[D,x]=k.useState(typeof e=="string"?e:e[0].style);k.useEffect(()=>{x(typeof e=="string"?e:e[0].style)},[e]);const $=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]);return l.jsx("div",{className:`${v||"light"} flex ${r?"w-fit grow-0":"w-full grow"}`,dir:p==="he"||p==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${p||"en"}`,P?.graphContainer),style:{...S?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:g,"aria-label":j||`${n?`The graph shows ${n}. `:""}This is a map.${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||s?l.jsx(Qe,{styles:{title:S?.title,description:S?.description},classNames:{title:P?.title,description:P?.description},graphTitle:n,graphDescription:s,width:r}):null,typeof e=="string"?null:l.jsx(Ce.DropdownSelect,{options:e.map(V=>({label:V.name,value:V.style})),isClearable:!1,size:"sm",variant:w,isRtl:p==="he"||p==="ar",isSearchable:!0,filterOption:Ce.createFilter($),defaultValue:{label:e[0].name,value:e[0].style},controlShouldRenderValue:!0,onChange:V=>{V&&x(V.value)}}),typeof e=="string"?l.jsx(ZL,{mapStyle:e,center:f,zoomLevel:d,width:r,height:i,relativeHeight:a,minHeight:y,includeLayers:m,excludeLayers:I,mapLegend:W}):l.jsx(QL,{mapStyle:D,center:f,zoomLevel:d,width:r,height:i,relativeHeight:a,minHeight:y,includeLayers:m,excludeLayers:I,mapLegend:(W||[]).find(V=>V.mapStyleName===e.find(q=>q.style===D)?.name)?.legend}),o||c?l.jsx(et,{styles:{footnote:S?.footnote,source:S?.source},classNames:{footnote:P?.footnote,source:P?.source},sources:o,footNote:c,width:r}):null]})})})})}function JL(t,e){let n=!1;function i(r,a){if(!n){n=!0;const o=r.getCenter(),s=r.getZoom(),c=r.getBearing(),u=r.getPitch();a.jumpTo({center:o,zoom:s,bearing:c,pitch:u}),n=!1}}t.on("move",()=>{i(t,e)}),e.on("move",()=>{i(e,t)})}function eP(t){const{height:e,width:n,mapStyles:i,center:r,zoomLevel:a,mapLegend:o}=t,[s,c]=k.useState(50),[u,h]=k.useState(!1),f=k.useRef(null),[d,g]=k.useState(!0),p=k.useRef(50),y=k.useRef(0),v=ps.useSensors(ps.useSensor(ps.PointerSensor,{activationConstraint:{distance:0}})),m=()=>{h(!0),p.current=s,f.current&&(y.current=f.current.getBoundingClientRect().width)},I=x=>{if(!f.current||y.current===0)return;const $=x.delta.x/y.current*100,V=Math.max(0,Math.min(100,p.current+$));c(V)},j=()=>{h(!1)},w=x=>{if(u||!f.current)return;const $=f.current.getBoundingClientRect(),q=(x.clientX-$.left)/$.width*100;c(Math.max(0,Math.min(100,q)))},S=k.useRef(null),P=k.useRef(null),W=k.useRef(null),D=k.useRef(null);return k.useEffect(()=>{if(D.current&&P.current&&W.current&&n){bt(D.current).selectAll(".maplibregl-compare").remove(),bt(P.current).selectAll("div").remove(),bt(W.current).selectAll("div").remove();const q=new Sc.Protocol;Oa.addProtocol("pmtiles",q.tile);const ae=new Oa.Map({container:P.current,style:i[0],center:r||[0,0],zoom:a||4}),G=new Oa.Map({container:W.current,style:i[1],center:r||[0,0],zoom:a||4});G.addControl(new Oa.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),ae.addControl(new Oa.ScaleControl,"bottom-left"),ae.addControl(new Oa.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),G.addControl(new Oa.ScaleControl,"bottom-left"),JL(ae,G)}},[n,i,r,a]),l.jsxs("div",{className:"flex flex-col grow justify-center leading-0",ref:S,"aria-label":"Map area",children:[l.jsx("div",{style:{width:n,height:e},children:l.jsx("div",{ref:D,className:"map maplibre-show-control relative w-full h-full",style:{inset:0},children:l.jsx(ps.DndContext,{sensors:v,modifiers:[Bw.restrictToHorizontalAxis],onDragStart:m,onDragMove:I,onDragEnd:j,children:l.jsxs("div",{ref:f,style:{position:"relative",width:n,height:e,overflow:"hidden",cursor:u?"grabbing":"col-resize",userSelect:"none"},onClick:w,children:[l.jsx("div",{ref:W,className:"absolute h-full rightMap w-full",style:{position:"absolute",top:0,left:0,clipPath:`polygon(${s}% 0%, ${s}% 100%, 100% 100%, 100% 0%)`}}),l.jsx("div",{ref:P,className:"absolute h-full leftMap w-full",style:{position:"absolute",top:0,left:0,inset:0,clipPath:`polygon(0% 0%, ${s}% 0%, ${s}% 100%, 0% 100%)`}}),l.jsx(tP,{position:s})]})})})}),o?l.jsx("div",{className:"absolute left-[22px] bottom-13",children:d?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{g(!1)},children:l.jsx(ea,{})}),l.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof o=="string"?{__html:lt(o)}:void 0,children:k.isValidElement(o)?o:null})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{g(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]})}function tP(t){const{position:e}=t,{attributes:n,listeners:i,setNodeRef:r}=ps.useDraggable({id:"slider-handle"});return l.jsxs("div",{ref:r,style:{position:"absolute",left:`${e}%`,top:0,bottom:0,width:"40px",transform:"translateX(-50%)",cursor:"col-resize",display:"flex",justifyContent:"center",alignItems:"center",zIndex:10,touchAction:"none"},...i,...n,children:[l.jsx("div",{className:"h-full bg-primary-blue-600 dark:bg-primary-blue-400",style:{width:"2px"}}),l.jsx("div",{className:"flex bg-primary-blue-600 dark:bg-primary-blue-400 rounded-full absolute items-center justify-center text-primary-white font-primary-white",style:{boxShadow:"inset 0 0 0 1px #fff",width:"42px",height:"42px",top:"calc(50% - 21px)",left:"0",cursor:"col-resize"},children:l.jsx(t2,{})})]})}function Yv(t){const{graphTitle:e,height:n,width:i,relativeHeight:r,sources:a,graphDescription:o,footNote:s,padding:c,backgroundColor:u=!1,graphID:h,mapStyles:f,center:d=[0,0],zoomLevel:g=3,language:p="en",minHeight:y=0,theme:v="light",ariaLabel:m,styles:I,classNames:j,mapLegend:w}=t,[S,P]=k.useState(0),[W,D]=k.useState(0),x=k.useRef(null);return k.useEffect(()=>{const $=new ResizeObserver(V=>{P(i||V[0].target.clientWidth||620),D(n||V[0].target.clientHeight||480)});return x.current&&(D(x.current.clientHeight||480),P(x.current.clientWidth||620),i||$.observe(x.current)),()=>$.disconnect()},[i,n]),l.jsx("div",{className:`${v||"light"} flex ${i?"w-fit grow-0":"w-full grow"}`,dir:p==="he"||p==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${u?u===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${p||"en"}`,j?.graphContainer),style:{...I?.graphContainer||{},...u&&u!==!0?{backgroundColor:u}:{}},id:h,"aria-label":m||`${e?`The graph shows ${e}. `:""}This is a comparison between two maps.${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:u?c||"1rem":c||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[e||o?l.jsx(Qe,{styles:{title:I?.title,description:I?.description},classNames:{title:j?.title,description:j?.description},graphTitle:e,graphDescription:o,width:i}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:x,"aria-label":"map area",children:(i||S)&&(n||W)?l.jsx(eP,{width:i||S,height:Math.max(y,n||(r?y?(i||S)*r>y?(i||S)*r:y:(i||S)*r:W)),mapStyles:f,center:d,zoomLevel:g,mapLegend:w}):null}),a||s?l.jsx(et,{styles:{footnote:I?.footnote,source:I?.source},classNames:{footnote:j?.footnote,source:j?.source},sources:a,footNote:s,width:i}):null]})})})})}function nP(t){const{mapStyle:e,height:n,width:i,relativeHeight:r,center:a,zoomLevel:o,minHeight:s,selectedLayer:c,layerIdList:u,excludeLayers:h,mapLegend:f}=t,[d,g]=k.useState(0),[p,y]=k.useState(0),[v,m]=k.useState(!0),[I,j]=k.useState(void 0),w=k.useRef(null),S=k.useRef(null),P=k.useRef(null);return k.useEffect(()=>{const W=new ResizeObserver(D=>{g(i||D[0].target.clientWidth||620),y(n||D[0].target.clientHeight||480)});return w.current&&(y(w.current.clientHeight||480),g(w.current.clientWidth||620),i||W.observe(w.current)),()=>W.disconnect()},[i,n]),k.useEffect(()=>{S.current&&d&&!P.current&&en(e).then(W=>{j(W),bt(S.current).selectAll("div").remove();const x=new Sc.Protocol;hi.addProtocol("pmtiles",x.tile);const $={container:S.current,style:{...W,layers:Ai(W.layers,[{column:"id",excludeValues:[...h,...u.filter(V=>c.indexOf(V)===-1)]}])},attributionControl:!0};a&&($.center=a),o&&($.zoom=o),P.current=new hi.Map($),P.current.addControl(new hi.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),P.current.addControl(new hi.ScaleControl,"bottom-left")})},[d,a,o,u,e,h,c]),k.useEffect(()=>{if(P.current)if(I){const W={...I,layers:Ai(I.layers,[{column:"id",excludeValues:[...h,...u.filter(D=>c.indexOf(D)===-1)]}])};P.current.setStyle(W)}else en(e).then(W=>{const D={...W,layers:Ai(W.layers,[{column:"id",excludeValues:[...h,...u.filter(x=>c.indexOf(x)===-1)]}])};P.current.setStyle(D)})},[h,u,e,I,c]),l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:w,"aria-label":"Map area",children:(i||d)&&(n||p)?l.jsxs("div",{style:{width:i||d,height:Math.max(s,n||(r?s?(i||d)*r>s?(i||d)*r:s:(i||d)*r:p))},children:[l.jsx("div",{ref:S,className:"map maplibre-show-control w-full h-full"}),f?l.jsx("div",{className:"absolute left-[22px] bottom-13",children:v?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{m(!1)},children:l.jsx(ea,{})}),l.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof f=="string"?{__html:lt(f)}:void 0,children:k.isValidElement(f)?f:null})]}):l.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{m(!0)},children:l.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function qv(t){const{mapStyle:e,graphTitle:n,height:i,width:r,relativeHeight:a,sources:o,graphDescription:s,footNote:c,padding:u,backgroundColor:h=!1,center:f,zoomLevel:d,graphID:g,language:p="en",minHeight:y=0,theme:v="light",layerSelection:m,excludeLayers:I=[],ariaLabel:j,uiMode:w="normal",styles:S,classNames:P,mapLegend:W=[]}=t,[D,x]=k.useState(m[0].layerID);k.useEffect(()=>{x(m[0].layerID)},[m]);const $=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]);return l.jsx("div",{className:`${v||"light"} flex ${r?"w-fit grow-0":"w-full grow"}`,dir:p==="he"||p==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${p||"en"}`,P?.graphContainer),style:{...S?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:g,"aria-label":j||`${n?`The graph shows ${n}. `:""}This is a map.${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||s?l.jsx(Qe,{styles:{title:S?.title,description:S?.description},classNames:{title:P?.title,description:P?.description},graphTitle:n,graphDescription:s,width:r}):null,l.jsx(Ce.DropdownSelect,{options:m.map(V=>({label:V.name,value:V.layerID})),size:"sm",isClearable:!1,variant:w,isRtl:p==="he"||p==="ar",isSearchable:!0,filterOption:Ce.createFilter($),defaultValue:{label:m[0].name,value:m[0].layerID},controlShouldRenderValue:!0,onChange:V=>{V&&x(V.value)}}),l.jsx(nP,{mapStyle:e,center:f,zoomLevel:d,width:r,height:i,relativeHeight:a,minHeight:y,selectedLayer:D,layerIdList:hn(m.map(V=>V.layerID)),excludeLayers:I,mapLegend:W.find(V=>V.mapStyleName===m.find(q=>q.layerID===D)?.name)?.legend}),o||c?l.jsx(et,{styles:{footnote:S?.footnote,source:S?.source},classNames:{footnote:P?.footnote,source:P?.source},sources:o,footNote:c,width:r}):null]})})})})}function iP(t){const{data:e,width:n,height:i,showLabels:r,colors:a,colorDomain:o,radius:s,xAxisTitle:c,yAxisTitle:u,leftMargin:h,rightMargin:f,topMargin:d,bottomMargin:g,tooltip:p,onSeriesMouseOver:y,refXValues:v,refYValues:m,highlightAreaSettings:I,selectedColor:j,highlightedDataPoints:w,maxRadiusValue:S,maxXValue:P,minXValue:W,maxYValue:D,minYValue:x,onSeriesMouseClick:$,rtl:V,annotations:q,customHighlightAreaSettings:ae,regressionLine:G,resetSelectionOnDoubleClick:_,detailsOnClick:b,noOfXTicks:B,noOfYTicks:X,labelColor:z,xSuffix:C,ySuffix:A,xPrefix:M,yPrefix:O,styles:K,classNames:Q,animate:se,dimmedOpacity:T,precision:Z,customLayers:ie}=t,ue=k.useRef(null),he=ct(ue,{once:se.once,amount:se.amount}),[Y,ge]=k.useState(void 0),[oe,ce]=k.useState(void 0),[N,U]=k.useState(void 0),[ve,J]=k.useState(void 0),R={top:d,bottom:c?g+50:g,left:u?h+30:h,right:f},le=e.map((Se,Le)=>({...Se,id:`${Le}`})),ee=n-R.left-R.right,de=i-R.top-R.bottom,te=e.filter(Se=>Se.radius===void 0||Se.radius===null).length!==e.length?Qs().domain([0,S]).range([.25,s]).nice():void 0,Me=le.filter(Se=>!je(Se.radius)).length===0?le:Nc(le.filter(Se=>!je(Se.radius)),"radius","desc"),be=ut().domain([W,P]).range([0,ee]).nice(),ne=ut().domain([x,D]).range([de,0]).nice(),De=be.ticks(B),xe=ne.ticks(X),Ae=Lc.from(Me.filter(Se=>!je(Se.x)&&!je(Se.y)),Se=>be(Se.x),Se=>ne(Se.y)).voronoi([0,0,ee<0?0:ee,de<0?0:de]),ke=sd(e.filter(Se=>!je(Se.x)&&!je(Se.y)).map(Se=>[be(Se.x),ne(Se.y)])),me=ld(ke);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:ue,children:l.jsxs("g",{transform:`translate(${R.left},${R.top})`,children:[l.jsxs(mt,{children:[l.jsx(iI,{areaSettings:I,width:ee,height:de,scaleX:be,scaleY:ne,animate:se,isInView:he}),l.jsx(lo,{areaSettings:ae,scaleX:be,scaleY:ne,animate:se,isInView:he})]}),l.jsxs("g",{children:[l.jsx(ri,{values:xe.filter(Se=>Se!==0),y:xe.filter(Se=>Se!==0).map(Se=>ne(Se)),x1:0,x2:ee+R.right,styles:{gridLines:K?.yAxis?.gridLines,labels:K?.yAxis?.labels},classNames:{gridLines:Q?.yAxis?.gridLines,labels:Q?.yAxis?.labels},suffix:A,prefix:O,labelType:"secondary",showGridLines:!0,labelPos:"side",precision:Z}),l.jsx(Dt,{y1:ne(x<0?0:x),y2:ne(x<0?0:x),x1:0,x2:ee+R.right,label:qe(x<0?0:x,"NA",Z,O,A),labelPos:{x:0,y:ne(x<0?0:x),dy:"0.33em",dx:-4},classNames:{axis:Q?.xAxis?.axis,label:Q?.yAxis?.labels},styles:{axis:K?.xAxis?.axis,label:{textAnchor:"end",...K?.yAxis?.labels||{}}}}),l.jsx(Nt,{x:0-h-15,y:de/2,style:K?.yAxis?.title,className:Q?.yAxis?.title,text:u,rotate90:!0})]}),l.jsxs("g",{children:[l.jsx(Rn,{values:De.filter(Se=>Se!==0),x:De.filter(Se=>Se!==0).map(Se=>be(Se)),y1:0,y2:de,styles:{gridLines:K?.xAxis?.gridLines,labels:K?.xAxis?.labels},classNames:{gridLines:Q?.xAxis?.gridLines,labels:Q?.xAxis?.labels},suffix:C,prefix:M,labelType:"primary",showGridLines:!0,precision:Z}),l.jsx(Dt,{x1:be(W<0?0:W),x2:be(W<0?0:W),y1:0,y2:de,label:qe(W<0?0:W,"NA",Z,M,C),labelPos:{x:be(W<0?0:W),y:de,dy:"1em",dx:0},classNames:{axis:Q?.xAxis?.axis,label:Q?.yAxis?.labels},styles:{axis:K?.xAxis?.axis,label:{textAnchor:"middle",...K?.yAxis?.labels||{}}}}),l.jsx(Nt,{x:ee/2,y:de+30,style:K?.xAxis?.title,className:Q?.xAxis?.title,text:c})]}),ie.filter(Se=>Se.position==="before").map(Se=>Se.layer),l.jsxs(mt,{children:[Me.filter(Se=>!je(Se.x)&&!je(Se.y)).map((Se,Le)=>l.jsx("path",{d:Ae.renderCell(Me.findIndex(F=>F.id===Se.id)),opacity:0,onMouseEnter:F=>{ge(Se),J(F.clientY),U(F.clientX),y?.(Se)},onMouseMove:F=>{ge(Se),J(F.clientY),U(F.clientX)},onMouseLeave:()=>{ge(void 0),U(void 0),J(void 0),y?.(void 0)},onClick:()=>{($||b)&&(dt(oe,Se)&&_?(ce(void 0),$?.(void 0)):(ce(Se),$?.(Se)))}},`${Se.label||Le}`)),Me.filter(Se=>!je(Se.x)&&!je(Se.y)).map((Se,Le)=>l.jsxs($e.g,{variants:{initial:{x:be(Se.x),y:ne(Se.y),opacity:j?Se.color&&a[o.indexOf(`${Se.color}`)]===j?1:T:Y?Y.id===Se.id?1:T:w.length!==0?w.indexOf(Se.label||"")!==-1?1:T:1},whileInView:{x:be(Se.x),y:ne(Se.y),opacity:j?Se.color&&a[o.indexOf(`${Se.color}`)]===j?1:T:Y?Y.id===Se.id?1:T:w.length!==0?w.indexOf(Se.label||"")!==-1?1:T:1,transition:{duration:se.duration}}},initial:"initial",animate:he?"whileInView":"initial",exit:{opacity:0,transition:{duration:se.duration}},onMouseEnter:F=>{ge(Se),J(F.clientY),U(F.clientX),y?.(Se)},onMouseMove:F=>{ge(Se),J(F.clientY),U(F.clientX)},onMouseLeave:()=>{ge(void 0),U(void 0),J(void 0),y?.(void 0)},onClick:()=>{($||b)&&(dt(oe,Se)&&_?(ce(void 0),$?.(void 0)):(ce(Se),$?.(Se)))},children:[l.jsx($e.circle,{cx:0,cy:0,exit:{r:0,transition:{duration:se.duration}},variants:{initial:{r:0,fill:e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray,stroke:e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray},whileInView:{r:te?te(Se.radius||0):s,fill:e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray,stroke:e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray,transition:{duration:se.duration}}},initial:"initial",animate:he?"whileInView":"initial",style:{fillOpacity:.6}}),r&&!je(Se.label)?l.jsx($e.text,{style:{...K?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",Q?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:se.duration}},variants:{initial:{x:te?te(Se.radius||0):s,opacity:0,fill:z||(e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray)},whileInView:{x:te?te(Se.radius||0):s,opacity:1,fill:z||(e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray),transition:{duration:se.duration}}},initial:"initial",animate:he?"whileInView":"initial",dy:"0.33em",dx:3,children:Se.label}):w.length!==0&&!je(Se.label)&&w.indexOf(Se.label)!==-1?l.jsx($e.text,{style:{fill:z||(e.filter(F=>F.color).length===0?a[0]:Se.color?a[o.indexOf(`${Se.color}`)]:Pe.gray),...K?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",Q?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:se.duration}},variants:{initial:{x:te?te(Se.radius||0):s,opacity:0},whileInView:{x:te?te(Se.radius||0):s,opacity:1,transition:{duration:se.duration}}},initial:"initial",animate:he?"whileInView":"initial",dy:"0.33em",dx:3,children:Se.label}):null]},`${Se.label||Le}`)),v.map((Se,Le)=>l.jsx(Tr,{text:Se.text,color:Se.color,x:be(Se.value),y1:0,y2:de,textSide:be(Se.value)>ee*.75||V?"left":"right",classNames:Se.classNames,styles:Se.styles,animate:se,isInView:he},Le)),m.map((Se,Le)=>l.jsx(gi,{text:Se.text,color:Se.color,y:ne(Se.value),x1:0,x2:ee,classNames:Se.classNames,styles:Se.styles,animate:se,isInView:he},Le)),l.jsx("g",{children:q.map((Se,Le)=>{const F=oo({x:Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0),y:Se.yCoordinate?ne(Se.yCoordinate)+(Se.yOffset||0)-8:0+(Se.yOffset||0)-8},{x:Se.xCoordinate?be(Se.xCoordinate):0,y:Se.yCoordinate?ne(Se.yCoordinate):0},je(Se.connectorRadius)?3.5:Se.connectorRadius),Ie=Se.showConnector?{y1:F.y,x1:F.x,y2:Se.yCoordinate?ne(Se.yCoordinate)+(Se.yOffset||0):0+(Se.yOffset||0),x2:Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0),cy:Se.yCoordinate?ne(Se.yCoordinate):0,cx:Se.xCoordinate?be(Se.xCoordinate):0,circleRadius:je(Se.connectorRadius)?3.5:Se.connectorRadius,strokeWidth:Se.showConnector===!0?2:Math.min(Se.showConnector||0,1)}:void 0,Ve={y:Se.yCoordinate?ne(Se.yCoordinate)+(Se.yOffset||0)-8:0+(Se.yOffset||0)-8,x:V?0:Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0),width:V?Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0):ee-(Se.xCoordinate?be(Se.xCoordinate)+(Se.xOffset||0):0+(Se.xOffset||0)),maxWidth:Se.maxWidth,fontWeight:Se.fontWeight,align:Se.align};return l.jsx(so,{color:Se.color,connectorsSettings:Ie,labelSettings:Ve,text:Se.text,classNames:Se.classNames,styles:Se.styles,animate:se,isInView:he},Le)})}),G?l.jsx(cd,{x1:0,x2:ee,y1:me(0),y2:me(ee),graphHeight:de,graphWidth:ee,className:Q?.regLine,style:K?.regLine,color:typeof G=="string"?G:void 0,animate:se,isInView:he}):null]}),ie.filter(Se=>Se.position==="after").map(Se=>Se.layer)]})}),Y&&p&&N&&ve?l.jsx(st,{data:Y,body:p,xPos:N,yPos:ve,backgroundStyle:K?.tooltip,className:Q?.tooltip}):null,b&&oe!==void 0?l.jsx(Ce.Modal,{open:oe!==void 0,onClose:()=>{ce(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof b=="string"?{__html:lt(b,oe)}:void 0,children:typeof b=="function"?b(oe):null})}):null]})}function Uv(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,showLabels:o=!1,height:s,width:c,footNote:u,colorDomain:h,colorLegendTitle:f,radius:d=5,xAxisTitle:g="X Axis",yAxisTitle:p="Y Axis",padding:y,backgroundColor:v=!1,leftMargin:m=0,rightMargin:I=10,topMargin:j=20,bottomMargin:w=50,tooltip:S,relativeHeight:P,onSeriesMouseOver:W,refXValues:D=[],refYValues:x=[],highlightAreaSettings:$=[],showColorScale:V=!0,highlightedDataPoints:q=[],graphID:ae,maxRadiusValue:G,maxXValue:_,minXValue:b,maxYValue:B,minYValue:X,xSuffix:z="",ySuffix:C="",xPrefix:A="",yPrefix:M="",onSeriesMouseClick:O,graphDownload:K=!1,dataDownload:Q=!1,language:se="en",showNAColor:T=!0,minHeight:Z=0,annotations:ie=[],customHighlightAreaSettings:ue=[],theme:he="light",regressionLine:Y=!1,ariaLabel:ge,resetSelectionOnDoubleClick:oe=!0,detailsOnClick:ce,noOfXTicks:N=5,noOfYTicks:U=5,labelColor:ve,styles:J,classNames:R,animate:le=!1,dimmedOpacity:ee=.3,precision:de=2,customLayers:te=[],timeline:Me={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=t,[be,ne]=k.useState(0),[De,xe]=k.useState(0),[Ae,ke]=k.useState(Me.autoplay),me=di(Xe(e.filter(Ee=>Ee.date!==void 0&&Ee.date!==null),Ee=>Ee.date).map(Ee=>ze(`${Ee.date}`,Me.dateFormat||"yyyy",new Date).getTime()),(Ee,it)=>an(Ee,it)),[Se,Le]=k.useState(Me.autoplay?0:me.length-1),[F,Ie]=k.useState(void 0),Ve=k.useRef(null),H=k.useRef(null);k.useEffect(()=>{const Ee=new ResizeObserver(it=>{ne(c||it[0].target.clientWidth||620),xe(s||it[0].target.clientHeight||480)});return Ve.current&&(xe(Ve.current.clientHeight||480),ne(Ve.current.clientWidth||620),c||Ee.observe(Ve.current)),()=>Ee.disconnect()},[c,s]),k.useEffect(()=>{const Ee=setInterval(()=>{Le(it=>it<me.length-1?it+1:0)},(Me.speed||2)*1e3);return Ae||clearInterval(Ee),()=>clearInterval(Ee)},[me,Ae,Me.speed]);const Oe=yi(me,Se,Me.showOnlyActiveDate,Me.dateFormat||"yyyy");return l.jsx("div",{className:`${he||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:se==="he"||se==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${se||"en"}`,R?.graphContainer),style:{...J?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:ae,ref:H,"aria-label":ge||`${n?`The graph shows ${n}. `:""}This is a scatter plot that shows correlation between two variables.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:v?y||"1rem":y||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||K||Q?l.jsx(Qe,{styles:{title:J?.title,description:J?.description},classNames:{title:R?.title,description:R?.description},graphTitle:n,graphDescription:a,width:c,graphDownload:K?H.current:void 0,dataDownload:Q?e.map(Ee=>Ee.data).filter(Ee=>Ee!==void 0).length>0?e.map(Ee=>Ee.data).filter(Ee=>Ee!==void 0):e.filter(Ee=>Ee!==void 0):null}):null,Me.enabled&&me.length>0&&Oe?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{ke(!Ae)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":Ae?"Click to pause animation":"Click to play animation",children:Ae?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:me[0],max:me[me.length-1],marks:Oe,step:null,defaultValue:me[me.length-1],value:me[Se],onChangeComplete:Ee=>{Le(me.indexOf(Ee))},onChange:Ee=>{Le(me.indexOf(Ee))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[V&&e.filter(Ee=>Ee.color).length!==0?l.jsx(tn,{width:c,colorLegendTitle:f,colors:i||Pe[he].categoricalColors.colors,colorDomain:h||Xe(e.filter(Ee=>Ee.color),"color").map(Ee=>Ee.color),setSelectedColor:Ie,showNAColor:T}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:Ve,"aria-label":"Graph area",children:(c||be)&&(s||De)?l.jsx(iP,{data:Z2(e,Me.dateFormat||"yyyy").filter(Ee=>Me.enabled?Ee.date===ft(new Date(me[Se]),Me.dateFormat||"yyyy"):Ee),width:c||be,height:Math.max(Z,s||(P?Z?(c||be)*P>Z?(c||be)*P:Z:(c||be)*P:De)),colorDomain:e.filter(Ee=>Ee.color).length===0?[]:h||Xe(e.filter(Ee=>Ee.color),"color").map(Ee=>Ee.color),colors:e.filter(Ee=>Ee.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[he].categoricalColors.colors,xAxisTitle:g,yAxisTitle:p,refXValues:D,refYValues:x,showLabels:o,radius:d,leftMargin:m,rightMargin:I,topMargin:j,bottomMargin:w,tooltip:S,onSeriesMouseOver:W,highlightAreaSettings:$,highlightedDataPoints:e.filter(Ee=>Ee.label).length===0?[]:q,selectedColor:F,maxRadiusValue:je(G)?Math.max(...e.map(Ee=>Ee.radius).filter(Ee=>Ee!=null)):G,maxXValue:je(_)?Math.max(...e.map(Ee=>Ee.x).filter(Ee=>Ee!=null))>0?Math.max(...e.map(Ee=>Ee.x).filter(Ee=>Ee!=null)):0:_,minXValue:je(b)?Math.min(...e.map(Ee=>Ee.x).filter(Ee=>Ee!=null))>0?0:Math.min(...e.map(Ee=>Ee.x).filter(Ee=>Ee!=null)):b,maxYValue:je(B)?Math.max(...e.map(Ee=>Ee.y).filter(Ee=>Ee!=null))>0?Math.max(...e.map(Ee=>Ee.y).filter(Ee=>Ee!=null)):0:B,minYValue:je(X)?Math.min(...e.map(Ee=>Ee.y).filter(Ee=>Ee!=null))>0?0:Math.min(...e.map(Ee=>Ee.y).filter(Ee=>Ee!=null)):X,onSeriesMouseClick:O,rtl:se==="he"||se==="ar",annotations:ie,customHighlightAreaSettings:ue,regressionLine:Y,resetSelectionOnDoubleClick:oe,detailsOnClick:ce,noOfXTicks:N,noOfYTicks:U,labelColor:ve,xSuffix:z,ySuffix:C,xPrefix:A,yPrefix:M,styles:J,classNames:R,animate:le===!0?{duration:.5,once:!0,amount:.5}:le||{duration:0,once:!0,amount:0},dimmedOpacity:ee,precision:de,customLayers:te}):null})]})}),r||u?l.jsx(et,{styles:{footnote:J?.footnote,source:J?.source},classNames:{footnote:R?.footnote,source:R?.source},sources:r,footNote:u,width:c}):null]})})})})}function rP(t){const{data:e,width:n,height:i,showLabels:r,colors:a,colorDomain:o,radius:s,leftMargin:c,rightMargin:u,topMargin:h,bottomMargin:f,tooltip:d,onSeriesMouseOver:g,axisTitles:p,highlightedDataPoints:y,selectedColor:v,minValue:m,maxValue:I,onSeriesMouseClick:j,resetSelectionOnDoubleClick:w,detailsOnClick:S,styles:P,classNames:W,animate:D,dimmedOpacity:x,customLayers:$}=t,V=k.useRef(null),q=ct(V,{once:D.once,amount:D.amount}),[ae,G]=k.useState(void 0),[_,b]=k.useState(void 0),[B,X]=k.useState(void 0),[z,C]=k.useState(void 0),A={top:h,bottom:f,left:c,right:u},M=n-A.left-A.right,O=i-A.top-A.bottom,K=Math.min(Math.min(...e.map(T=>T.y1)),Math.min(...e.map(T=>T.y2))),Q=Math.max(Math.max(...e.map(T=>T.y1)),Math.max(...e.map(T=>T.y2))),se=ut().domain([je(m)?K>0?0:K:m,je(I)?Q>0?Q:0:I]).range([O,0]).nice();return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,className:"mx-auto",direction:"ltr",ref:V,children:l.jsxs("g",{transform:`translate(${A.left},${A.top})`,children:[l.jsxs("g",{children:[l.jsx(Dt,{y1:0,y2:O,x1:s,x2:s,classNames:{axis:Ce.cn("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",W?.yAxis?.axis)}}),l.jsx(Nt,{x:s,y:O+15,style:P?.yAxis?.title,className:Ce.cn("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",W?.yAxis?.title),text:p[0]})]}),l.jsxs("g",{children:[l.jsx(Dt,{y1:0,y2:O,x1:M-s,x2:M-s,classNames:{axis:Ce.cn("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",W?.yAxis?.axis)}}),l.jsx(Nt,{x:M-s,y:O+15,style:P?.yAxis?.title,className:Ce.cn("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",W?.yAxis?.title),text:p[1]})]}),$.filter(T=>T.position==="before").map(T=>T.layer),l.jsx(mt,{children:e.map((T,Z)=>l.jsxs($e.g,{variants:{initial:{opacity:v?T.color&&a[o.indexOf(`${T.color}`)]===v?1:x:ae?ae.label===T.label?1:x:y.length!==0?y.indexOf(T.label)!==-1?1:x:1},whileInView:{opacity:v?T.color&&a[o.indexOf(`${T.color}`)]===v?1:x:ae?ae.label===T.label?1:x:y.length!==0?y.indexOf(T.label)!==-1?1:x:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},onMouseEnter:ie=>{G(T),C(ie.clientY),X(ie.clientX),g?.(T)},onMouseMove:ie=>{G(T),C(ie.clientY),X(ie.clientX)},onMouseLeave:()=>{G(void 0),X(void 0),C(void 0),g?.(void 0)},onClick:()=>{(j||S)&&(dt(_,T)&&w?(b(void 0),j?.(void 0)):(b(T),j?.(T)))},children:[l.jsx($e.circle,{cx:s,variants:{initial:{cy:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{cy:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},r:s,style:{fillOpacity:.6}}),r?l.jsx($e.text,{variants:{initial:{y:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{y:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},style:{textAnchor:"end",...P?.yAxis?.labels||{}},className:Ce.cn("text-xs",W?.yAxis?.labels),x:5,dy:"0.33em",textAnchor:"end",dx:0-s-3,children:T.label}):y.length!==0&&y.indexOf(T.label)!==-1?l.jsx($e.text,{variants:{initial:{y:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{y:se(T.y1),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},style:{textAnchor:"end",...P?.yAxis?.labels||{}},className:Ce.cn("text-xs",W?.yAxis?.labels),x:5,dy:"0.33em",dx:-3,children:T.label}):null,l.jsx($e.circle,{cx:M-s,variants:{initial:{cy:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{cy:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},r:s,style:{fillOpacity:.6}}),r?l.jsx($e.text,{variants:{initial:{y:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{y:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},style:{textAnchor:"start",...P?.yAxis?.labels||{}},className:Ce.cn("text-xs",W?.yAxis?.labels),x:M-5,dy:"0.33em",dx:s+3,children:T.label}):y.length!==0&&y.indexOf(T.label)!==-1?l.jsx($e.text,{variants:{initial:{y:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:0},whileInView:{y:se(T.y2),fill:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},style:{textAnchor:"start",...P?.yAxis?.labels||{}},className:Ce.cn("text-xs",W?.yAxis?.labels),x:M-5,dy:"0.33em",dx:3,children:T.label}):null,l.jsx($e.line,{x1:s,x2:M-s,variants:{initial:{y1:se(T.y1),y2:se(T.y1),stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray},whileInView:{y1:se(T.y1),y2:se(T.y2),stroke:e.filter(ie=>ie.color).length===0?a[0]:T.color?a[o.indexOf(`${T.color}`)]:Pe.gray,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},className:W?.dataConnectors,style:{fill:"none",strokeWidth:1,...P?.dataConnectors}})]},Z))}),$.filter(T=>T.position==="after").map(T=>T.layer)]})}),ae&&d&&B&&z?l.jsx(st,{data:ae,body:d,xPos:B,yPos:z,backgroundStyle:P?.tooltip,className:W?.tooltip}):null,S&&_!==void 0?l.jsx(Ce.Modal,{open:_!==void 0,onClose:()=>{b(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof S=="string"?{__html:lt(S,_)}:void 0,children:typeof S=="function"?S(_):null})}):null]})}function Xv(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,showLabels:o=!1,height:s,width:c,footNote:u,colorDomain:h,colorLegendTitle:f,radius:d=5,axisTitles:g=["",""],padding:p,backgroundColor:y=!1,leftMargin:v=50,rightMargin:m=50,topMargin:I=20,bottomMargin:j=20,tooltip:w,relativeHeight:S,onSeriesMouseOver:P,showColorScale:W=!0,highlightedDataPoints:D=[],graphID:x,minValue:$,maxValue:V,onSeriesMouseClick:q,graphDownload:ae=!1,dataDownload:G=!1,fillContainer:_=!0,language:b="en",showNAColor:B=!0,minHeight:X=0,theme:z="light",ariaLabel:C,resetSelectionOnDoubleClick:A=!0,detailsOnClick:M,styles:O,classNames:K,animate:Q=!1,dimmedOpacity:se=.3,customLayers:T=[]}=t,[Z,ie]=k.useState(0),[ue,he]=k.useState(0),[Y,ge]=k.useState(void 0),oe=k.useRef(null),ce=k.useRef(null);return k.useEffect(()=>{const N=new ResizeObserver(U=>{ie(c||U[0].target.clientWidth||620),he(s||U[0].target.clientHeight||480)});return oe.current&&(he(oe.current.clientHeight||480),ie(oe.current.clientWidth||620),c||N.observe(oe.current)),()=>N.disconnect()},[c,s]),l.jsx("div",{className:`${z||"light"} flex ${c?"grow-0":"grow"} ${_?"w-full":"w-fit"} `,dir:b==="he"||b==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${y?y===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${b||"en"}`,K?.graphContainer),style:{...O?.graphContainer||{},...y&&y!==!0?{backgroundColor:y}:{}},id:x,ref:ce,"aria-label":C||`${n?`The graph shows ${n}. `:""}This is a slope chart showing changes in data between two category or starting and ending time. Each line represents a different row in data, with lines sloping up or down to show increase or decrease over two categories or time.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:y?p||"1rem":p||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||ae||G?l.jsx(Qe,{styles:{title:O?.title,description:O?.description},classNames:{title:K?.title,description:K?.description},graphTitle:n,graphDescription:a,width:c,graphDownload:ae?ce.current:void 0,dataDownload:G?e.map(N=>N.data).filter(N=>N!==void 0).length>0?e.map(N=>N.data).filter(N=>N!==void 0):e.filter(N=>N!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[W&&e.filter(N=>N.color).length!==0?l.jsx(tn,{width:c,colorLegendTitle:f,colors:i||Pe[z].categoricalColors.colors,colorDomain:h||Xe(e.filter(N=>N.color),"color").map(N=>N.color),setSelectedColor:ge,showNAColor:B}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:oe,"aria-label":"Graph area",children:(c||Z)&&(s||ue)?l.jsx(rP,{data:e.filter(N=>!je(N.y1)&&!je(N.y2)),width:c||Z,height:Math.max(X,s||(S?X?(c||Z)*S>X?(c||Z)*S:X:(c||Z)*S:ue)),colorDomain:e.filter(N=>N.color).length===0?[]:h||Xe(e.filter(N=>N.color),"color").map(N=>N.color),colors:e.filter(N=>N.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[z].categoricalColors.colors,selectedColor:Y,axisTitles:g,showLabels:o,radius:d,leftMargin:v,rightMargin:m,topMargin:I,bottomMargin:j,tooltip:w,onSeriesMouseOver:P,highlightedDataPoints:D,minValue:$,maxValue:V,onSeriesMouseClick:q,resetSelectionOnDoubleClick:A,detailsOnClick:M,styles:O,classNames:K,animate:Q===!0?{duration:.5,once:!0,amount:.5}:Q||{duration:0,once:!0,amount:0},dimmedOpacity:se,customLayers:T}):null})]})}),r||u?l.jsx(et,{styles:{footnote:O?.footnote,source:O?.source},classNames:{footnote:K?.footnote,source:K?.source},sources:r,footNote:u,width:c}):null]})})})})}function aP(t){const{data:e,barColor:n,suffix:i,prefix:r,barPadding:a,showValues:o,showTicks:s,leftMargin:c,truncateBy:u,width:h,height:f,rightMargin:d,topMargin:g,bottomMargin:p,showLabels:y,tooltip:v,onSeriesMouseOver:m,refValues:I,highlightedDataPoints:j,maxValue:w,minValue:S,onSeriesMouseClick:P,labelOrder:W,rtl:D,maxBarThickness:x,minBarThickness:$,resetSelectionOnDoubleClick:V,detailsOnClick:q,barAxisTitle:ae,valueColor:G,noOfTicks:_,styles:b,classNames:B,targetStyle:X,targetColor:z,qualitativeRangeColors:C,measureBarWidthFactor:A,animate:M,dimmedOpacity:O,precision:K,customLayers:Q,naLabel:se}=t,T=k.useRef(null),Z=ct(T,{once:M.once,amount:M.amount}),[ie,ue]=k.useState(void 0),[he,Y]=k.useState(void 0),[ge,oe]=k.useState(void 0),[ce,N]=k.useState(void 0),U={top:ae?g+25:g,bottom:p,left:c,right:d},ve=h-U.left-U.right,J=f-U.top-U.bottom,R=Math.max(...e.filter(me=>!je(me.size)).map(me=>me.size))<0?0:Math.max(...e.filter(me=>!je(me.size)).map(me=>me.size)),le=Math.max(...e.filter(me=>!je(me.target)).map(me=>me.target))<0?0:Math.max(...e.filter(me=>!je(me.target)).map(me=>me.target)),ee=Math.max(...e.map(me=>rt((me.qualitativeRange||[]).filter(Se=>!je(Se)))||0)),de=je(w)?Math.max(...[R,le,ee].filter(Number.isFinite))<0?0:Math.max(...[R,le,ee].filter(Number.isFinite)):w,te=Math.min(...e.filter(me=>!je(me.size)).map(me=>me.size))>=0?0:Math.min(...e.filter(me=>!je(me.size)).map(me=>me.size)),Me=Math.min(...e.filter(me=>!je(me.target)).map(me=>me.target))>=0?0:Math.min(...e.filter(me=>!je(me.target)).map(me=>me.target)),be=je(S)?Math.min(...[te,Me].filter(Number.isFinite))>=0?0:Math.min(...[te,Me].filter(Number.isFinite)):S,ne=e.map((me,Se)=>({...me,id:W?`${me.label}`:`${Se}`})),De=ut().domain([be,de]).range([0,ve]).nice(),xe=W||ne.map(me=>`${me.id}`),Ae=xn().domain(xe).range([0,$?Math.max(J,$*xe.length):x?Math.min(J,x*xe.length):J]).paddingInner(a),ke=De.ticks(_);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${h}px`,height:`${f}px`,viewBox:`0 0 ${h} ${f}`,direction:"ltr",ref:T,children:l.jsxs("g",{transform:`translate(${U.left},${U.top})`,children:[s?l.jsx(Rn,{values:ke.filter(me=>me!==0),x:ke.filter(me=>me!==0).map(me=>De(me)),y1:0-g,y2:J+U.bottom,styles:{gridLines:b?.xAxis?.gridLines,labels:b?.xAxis?.labels},classNames:{gridLines:B?.xAxis?.gridLines,labels:B?.xAxis?.labels},suffix:i,prefix:r,labelType:"secondary",showGridLines:!0,precision:K}):null,l.jsx(Nt,{x:ve/2,y:0-U.top+15,style:b?.xAxis?.title,className:B?.xAxis?.title,text:ae}),l.jsx(Dt,{x1:De(be<0?0:be),x2:De(be<0?0:be),y1:-2.5,y2:J+U.bottom,classNames:{axis:B?.yAxis?.axis},styles:{axis:b?.yAxis?.axis}}),Q.filter(me=>me.position==="before").map(me=>me.layer),l.jsxs(mt,{children:[ne.map(me=>je(Ae(me.id))?null:l.jsxs($e.g,{className:"undp-viz-g-with-hover",onMouseEnter:Se=>{ue(me),N(Se.clientY),oe(Se.clientX),m?.(me)},onClick:()=>{(P||q)&&(dt(he,me)&&V?(Y(void 0),P?.(void 0)):(Y(me),P?.(me)))},onMouseMove:Se=>{ue(me),N(Se.clientY),oe(Se.clientX)},onMouseLeave:()=>{ue(void 0),oe(void 0),N(void 0),m?.(void 0)},exit:{opacity:0,transition:{duration:M.duration}},variants:{initial:{x:0,y:Ae(`${me.id}`),opacity:j.length!==0?j.indexOf(me.label)!==-1?.85:O:.85},whileInView:{x:0,y:Ae(`${me.id}`),opacity:j.length!==0?j.indexOf(me.label)!==-1?.85:O:.85,transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial",children:[me.qualitativeRange?me.qualitativeRange.map((Se,Le)=>l.jsx($e.rect,{exit:{width:0,x:De(0),transition:{duration:M.duration}},variants:{initial:{x:De(0),width:0,fill:C[Le]},whileInView:{x:De(Le===0?0:rt(me.qualitativeRange.filter((F,Ie)=>Ie<Le&&F))),width:De(Se),fill:C[Le],transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial",y:0,height:Ae.bandwidth()},Le)):null,me.target&&X==="background"?l.jsx($e.rect,{y:0,x:me.target>=0?De(0):De(me.target),height:Ae.bandwidth(),style:{fill:z},exit:{width:0,x:De(0),transition:{duration:M.duration}},variants:{initial:{x:De(0),width:0},whileInView:{x:me.target>=0?De(0):De(me.target),width:me.target>=0?De(me.target)-De(0):De(0)-De(me.target),transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial"}):null,me.size?l.jsx($e.rect,{y:Ae.bandwidth()*((1-A)/2),style:{fill:n},height:Ae.bandwidth()*A,exit:{width:0,x:De(0),transition:{duration:M.duration}},variants:{initial:{x:De(0),width:0},whileInView:{x:me.size>=0?De(0):De(me.size),width:me.size>=0?De(me.size)-De(0):De(0)-De(me.size),transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial"}):null,me.target&&X==="line"?l.jsx($e.rect,{y:0,height:Ae.bandwidth(),style:{fill:z},width:2,exit:{opacity:0,x:De(0),transition:{duration:M.duration}},variants:{initial:{x:De(0),opacity:0},whileInView:{x:De(me.target)-1,opacity:1,transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial"}):null,y?l.jsx(io,{value:`${me.label}`.length<u?`${me.label}`:`${`${me.label}`.substring(0,u)}...`,y:0,x:(me.size||0)<0?De(0):0-U.left,width:(me.size||0)<0?h-De(0):De(0)+U.left,height:Ae.bandwidth(),alignment:me.size&&me.size<0?"left":"right",style:b?.yAxis?.labels,className:B?.yAxis?.labels,animate:M,isInView:Z}):null,o?l.jsx($e.text,{y:Ae.bandwidth()/2,style:{...G?{fill:G}:{fill:n},textAnchor:me.size&&me.size<0?"end":"start",...b?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",!G&&n.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",B?.graphObjectValues),dx:me.size&&me.size<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:M.duration}},variants:{initial:{x:De(0),opacity:0},whileInView:{x:me.size?De(me.size):De(0),opacity:1,transition:{duration:M.duration}}},initial:"initial",animate:Z?"whileInView":"initial",children:qe(me.size,se,K,r,i)}):null]},me.label)),I?l.jsx(l.Fragment,{children:I.map((me,Se)=>l.jsx(Tr,{text:me.text,color:me.color,x:De(me.value),y1:0-U.top,y2:J+U.bottom,textSide:De(me.value)>ve*.75||D?"left":"right",classNames:me.classNames,styles:me.styles,animate:M,isInView:Z},Se))}):null]}),Q.filter(me=>me.position==="after").map(me=>me.layer)]})}),ie&&v&&ge&&ce?l.jsx(st,{data:ie,body:v,xPos:ge,yPos:ce,backgroundStyle:b?.tooltip,className:B?.tooltip}):null,q&&he!==void 0?l.jsx(Ce.Modal,{open:he!==void 0,onClose:()=>{Y(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof q=="string"?{__html:lt(q,he)}:void 0,children:typeof q=="function"?q(he):null})}):null]})}function oP(t){const{data:e,graphTitle:n,barColor:i=Pe.primaryColors["blue-600"],suffix:r="",sources:a,prefix:o="",graphDescription:s,barPadding:c=.25,showValues:u=!0,showTicks:h=!0,leftMargin:f=100,rightMargin:d=40,truncateBy:g=999,height:p,width:y,footNote:v,colorDomain:m,colorLegendTitle:I,highlightedDataPoints:j=[],padding:w,backgroundColor:S=!1,topMargin:P=25,bottomMargin:W=10,showLabels:D=!0,relativeHeight:x,tooltip:$,onSeriesMouseOver:V,refValues:q,showColorScale:ae=!0,graphID:G,maxValue:_,minValue:b,onSeriesMouseClick:B,graphDownload:X=!1,dataDownload:z=!1,sortData:C,labelOrder:A,language:M="en",minHeight:O=0,theme:K="light",maxBarThickness:Q,maxNumberOfBars:se,minBarThickness:T,ariaLabel:Z,resetSelectionOnDoubleClick:ie=!0,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y=5,valueColor:ge,styles:oe,classNames:ce,filterNA:N=!0,targetStyle:U="line",targetColor:ve=Pe.light.grays["gray-700"],qualitativeRangeColors:J,measureBarWidthFactor:R=.4,animate:le=!1,dimmedOpacity:ee=.3,precision:de=2,customLayers:te=[],naLabel:Me="NA"}=t,[be,ne]=k.useState(0),[De,xe]=k.useState(0),Ae=k.useRef(null),ke=k.useRef(null);return k.useEffect(()=>{const me=new ResizeObserver(Se=>{ne(y||Se[0].target.clientWidth||620),xe(p||Se[0].target.clientHeight||480)});return Ae.current&&(xe(Ae.current.clientHeight||480),ne(Ae.current.clientWidth||620),y||me.observe(Ae.current)),()=>me.disconnect()},[y,p]),l.jsx("div",{className:`${K||"light"} flex ${y?"w-fit grow-0":"w-full grow"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,ce?.graphContainer),style:{...oe?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:G,ref:ke,"aria-label":Z||`${n?`The graph shows ${n}. `:""}This is a bar chart. ${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:S?w||"1rem":w||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||s||X||z?l.jsx(Qe,{styles:{title:oe?.title,description:oe?.description},classNames:{title:ce?.title,description:ce?.description},graphTitle:n,graphDescription:s,width:y,graphDownload:X?ke.current:void 0,dataDownload:z?e.map(me=>me.data).filter(me=>me!==void 0).length>0?e.map(me=>me.data).filter(me=>me!==void 0):e.filter(me=>me!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[ae&&e.filter(me=>me.qualitativeRange).length!==0&&m?l.jsx(Hi,{width:y,colorLegendTitle:I,colors:J||Pe[K].sequentialColors.positiveColorsx10,colorDomain:m,showNAColor:!1}):null,l.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:Ae,"aria-label":"Graph area",children:(y||be)&&(p||De)?l.jsx(aP,{data:C==="asc"?tt(e.filter(me=>N?!je(me.size):me),me=>me.size).filter((me,Se)=>se?Se<se:!0):C==="desc"?tt(e.filter(me=>N?!je(me.size):me),me=>me.size).reverse().filter((me,Se)=>se?Se<se:!0):e.filter(me=>N?!je(me.size):me).filter((me,Se)=>se?Se<se:!0),barColor:i,targetColor:ve,width:y||be,height:Math.max(O,p||(x?O?(y||be)*x>O?(y||be)*x:O:(y||be)*x:De)),suffix:r,prefix:o,barPadding:c,showValues:u,showTicks:h,leftMargin:f,rightMargin:d,topMargin:P,bottomMargin:W,truncateBy:g,showLabels:D,tooltip:$,onSeriesMouseOver:V,refValues:q,maxValue:_,minValue:b,highlightedDataPoints:j,onSeriesMouseClick:B,labelOrder:A,rtl:M==="he"||M==="ar",maxBarThickness:Q,minBarThickness:T,resetSelectionOnDoubleClick:ie,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y,valueColor:ge,classNames:ce,styles:oe,targetStyle:U,qualitativeRangeColors:J||Pe[K].sequentialColors.positiveColorsx10,measureBarWidthFactor:R,animate:le===!0?{duration:.5,once:!0,amount:.5}:le||{duration:0,once:!0,amount:0},dimmedOpacity:ee,precision:de,customLayers:te,naLabel:Me}):null})]})}),a||v?l.jsx(et,{sources:a,footNote:v,width:y,styles:{footnote:oe?.footnote,source:oe?.source},classNames:{footnote:ce?.footnote,source:ce?.source}}):null]})})})})}function sP(t){const{data:e,width:n,height:i,barColor:r,suffix:a,prefix:o,barPadding:s,showLabels:c,showValues:u,showTicks:h,truncateBy:f,rightMargin:d,topMargin:g,bottomMargin:p,leftMargin:y,tooltip:v,onSeriesMouseOver:m,refValues:I,maxValue:j,minValue:w,highlightedDataPoints:S,onSeriesMouseClick:P,labelOrder:W,maxBarThickness:D,minBarThickness:x,resetSelectionOnDoubleClick:$,detailsOnClick:V,barAxisTitle:q,valueColor:ae,noOfTicks:G,styles:_,classNames:b,targetStyle:B,targetColor:X,qualitativeRangeColors:z,measureBarWidthFactor:C,animate:A,dimmedOpacity:M,precision:O,customLayers:K,naLabel:Q}=t,se=k.useRef(null),T=ct(se,{once:A.once,amount:A.amount}),Z={top:g,bottom:p,left:q?y+30:y,right:d},[ie,ue]=k.useState(void 0),[he,Y]=k.useState(void 0),[ge,oe]=k.useState(void 0),[ce,N]=k.useState(void 0),U=n-Z.left-Z.right,ve=i-Z.top-Z.bottom,J=Math.max(...e.filter(ke=>!je(ke.size)).map(ke=>ke.size))<0?0:Math.max(...e.filter(ke=>!je(ke.size)).map(ke=>ke.size)),R=Math.max(...e.filter(ke=>!je(ke.target)).map(ke=>ke.target))<0?0:Math.max(...e.filter(ke=>!je(ke.size)).map(ke=>ke.target)),le=Math.max(...e.map(ke=>rt((ke.qualitativeRange||[]).filter(me=>!je(me)))||0)),ee=je(j)?Math.max(...[J,R,le].filter(Number.isFinite))<0?0:Math.max(...[J,R,le].filter(Number.isFinite)):j,de=Math.min(...e.filter(ke=>!je(ke.size)).map(ke=>ke.size))>=0?0:Math.min(...e.filter(ke=>!je(ke.size)).map(ke=>ke.size)),te=Math.min(...e.filter(ke=>!je(ke.target)).map(ke=>ke.target))>=0?0:Math.min(...e.filter(ke=>!je(ke.target)).map(ke=>ke.target)),Me=je(w)?Math.min(...[de,te].filter(Number.isFinite))>=0?0:Math.min(...[de,te].filter(Number.isFinite)):w,be=ut().domain([Me,ee]).range([ve,0]).nice(),ne=e.map((ke,me)=>({...ke,id:W?`${ke.label}`:`${me}`})),De=W||ne.map(ke=>`${ke.id}`),xe=xn().domain(De).range([0,x?Math.max(U,x*De.length):D?Math.min(U,D*De.length):U]).paddingInner(s),Ae=be.ticks(G);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:se,children:l.jsxs("g",{transform:`translate(${Z.left},${Z.top})`,children:[l.jsx(Dt,{y1:be(Me<0?0:Me),y2:be(Me<0?0:Me),x1:0-y,x2:U+Z.right,label:qe(Me<0?0:Me,Q,O,o,a),labelPos:{x:0-y,dx:0,dy:ee<0?"1em":-5,y:be(Me<0?0:Me)},classNames:{axis:b?.xAxis?.axis,label:b?.yAxis?.labels},styles:{axis:_?.xAxis?.axis,label:_?.yAxis?.labels}}),h?l.jsx(ri,{values:Ae.filter(ke=>ke!==0),y:Ae.filter(ke=>ke!==0).map(ke=>be(ke)),x1:0-y,x2:U+Z.right,styles:{gridLines:_?.yAxis?.gridLines,labels:_?.yAxis?.labels},classNames:{gridLines:b?.yAxis?.gridLines,labels:b?.yAxis?.labels},suffix:a,prefix:o,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:O}):null,l.jsx(Nt,{x:0-y-15,y:ve/2,style:_?.yAxis?.title,className:b?.yAxis?.title,text:q,rotate90:!0}),K.filter(ke=>ke.position==="before").map(ke=>ke.layer),l.jsxs(mt,{children:[ne.map(ke=>je(xe(ke.id))?null:l.jsxs($e.g,{className:"undp-viz-g-with-hover",onMouseEnter:me=>{ue(ke),N(me.clientY),oe(me.clientX),m?.(ke)},onClick:()=>{(P||V)&&(dt(he,ke)&&$?(Y(void 0),P?.(void 0)):(Y(ke),P?.(ke)))},onMouseMove:me=>{ue(ke),N(me.clientY),oe(me.clientX)},onMouseLeave:()=>{ue(void 0),oe(void 0),N(void 0),m?.(void 0)},exit:{opacity:0,transition:{duration:A.duration}},variants:{initial:{x:xe(`${ke.id}`),y:0,opacity:S.length!==0?S.indexOf(ke.label)!==-1?.85:M:.85},whileInView:{x:xe(`${ke.id}`),y:0,opacity:S.length!==0?S.indexOf(ke.label)!==-1?.85:M:.85,transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial",children:[ke.qualitativeRange?ke.qualitativeRange.map((me,Se)=>l.jsx($e.rect,{x:0,exit:{height:0,y:be(0),transition:{duration:A.duration}},variants:{initial:{height:0,y:be(0),fill:z[Se]},whileInView:{height:Math.abs(be(rt(ke.qualitativeRange.filter((Le,F)=>F<=Se&&Le)))-be(rt(ke.qualitativeRange.filter((Le,F)=>F<Se&&Le)))),y:be(rt(ke.qualitativeRange.filter((Le,F)=>F<=Se&&Le))),fill:z[Se],transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial",width:xe.bandwidth()},Se)):null,ke.target&&B==="background"?l.jsx($e.rect,{x:0,width:xe.bandwidth(),style:{fill:X},exit:{height:0,y:be(0),transition:{duration:A.duration}},variants:{initial:{height:0,y:be(0)},whileInView:{height:Math.abs(be(ke.target)-be(0)),y:ke.target>0?be(ke.target):be(0),transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial"}):null,ke.size?l.jsx($e.rect,{x:xe.bandwidth()*((1-C)/2),width:xe.bandwidth()*C,style:{fill:r},exit:{height:0,y:be(0),transition:{duration:A.duration}},variants:{initial:{height:0,y:be(0)},whileInView:{height:Math.abs(be(ke.size)-be(0)),y:ke.size>0?be(ke.size):be(0),transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial"}):null,ke.target&&B==="line"?l.jsx($e.rect,{x:0,width:xe.bandwidth(),style:{fill:X},exit:{y:be(0),opacity:0,transition:{duration:A.duration}},variants:{initial:{y:be(0),opacity:0},whileInView:{y:be(ke.target)-1,opacity:1,transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial",height:2}):null,c?l.jsx(ro,{value:`${ke.label}`.length<f?`${ke.label}`:`${`${ke.label}`.substring(0,f)}...`,y:(ke.size||0)<0?0:be(0)+5,x:0,width:xe.bandwidth(),height:(ke.size||0)<0?be(0)-5:Z.bottom,style:_?.xAxis?.labels,className:b?.xAxis?.labels,alignment:(ke.size||0)<0?"bottom":"top",animate:A,isInView:T}):null,u?l.jsx($e.text,{x:xe.bandwidth()/2,style:{...ae?{fill:ae}:{fill:r},textAnchor:"middle",..._?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",!ae&&r.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",b?.graphObjectValues),dy:ke.size?ke.size>=0?"-5px":"1em":"-5px",exit:{opacity:0,transition:{duration:A.duration}},variants:{initial:{y:be(0),opacity:0},whileInView:{y:be(ke.size||0),opacity:1,transition:{duration:A.duration}}},initial:"initial",animate:T?"whileInView":"initial",children:qe(ke.size,Q,O,o,a)}):null]},ke.label)),I?l.jsx(l.Fragment,{children:I.map((ke,me)=>l.jsx(gi,{text:ke.text,color:ke.color,y:be(ke.value),x1:0-y,x2:U+Z.right,classNames:ke.classNames,styles:ke.styles,animate:A,isInView:T},me))}):null]}),K.filter(ke=>ke.position==="after").map(ke=>ke.layer)]})}),ie&&v&&ge&&ce?l.jsx(st,{data:ie,body:v,xPos:ge,yPos:ce,backgroundStyle:_?.tooltip,className:b?.tooltip}):null,V&&he!==void 0?l.jsx(Ce.Modal,{open:he!==void 0,onClose:()=>{Y(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof V=="string"?{__html:lt(V,he)}:void 0,children:typeof V=="function"?V(he):null})}):null]})}function lP(t){const{data:e,graphTitle:n,barColor:i=Pe.primaryColors["blue-600"],barPadding:r=.25,showTicks:a=!0,leftMargin:o=20,rightMargin:s=20,topMargin:c=20,bottomMargin:u=25,truncateBy:h=999,showLabels:f=!0,showValues:d=!0,backgroundColor:g=!1,suffix:p="",prefix:y="",sources:v,graphDescription:m,height:I,width:j,footNote:w,colorDomain:S,colorLegendTitle:P,padding:W,relativeHeight:D,tooltip:x,onSeriesMouseOver:$,refValues:V,showColorScale:q=!0,graphID:ae,maxValue:G,minValue:_,highlightedDataPoints:b=[],qualitativeRangeColors:B,onSeriesMouseClick:X,graphDownload:z=!1,dataDownload:C=!1,language:A="en",theme:M="light",sortData:O,labelOrder:K,minHeight:Q=0,maxBarThickness:se,maxNumberOfBars:T,minBarThickness:Z,ariaLabel:ie,resetSelectionOnDoubleClick:ue=!0,detailsOnClick:he,barAxisTitle:Y,noOfTicks:ge=5,valueColor:oe,styles:ce,classNames:N,targetColor:U=Pe.light.grays["gray-700"],filterNA:ve=!0,targetStyle:J="line",measureBarWidthFactor:R=.4,animate:le=!1,dimmedOpacity:ee=.3,precision:de=2,customLayers:te=[],naLabel:Me="NA"}=t,[be,ne]=k.useState(0),[De,xe]=k.useState(0),Ae=k.useRef(null),ke=k.useRef(null);return k.useEffect(()=>{const me=new ResizeObserver(Se=>{ne(j||Se[0].target.clientWidth||620),xe(I||Se[0].target.clientHeight||480)});return Ae.current&&(xe(Ae.current.clientHeight||480),ne(Ae.current.clientWidth||620),j||me.observe(Ae.current)),()=>me.disconnect()},[j,I]),l.jsx("div",{className:`${M||"light"} flex ${j?"w-fit grow-0":"w-full grow"}`,dir:A==="he"||A==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${A||"en"}`,N?.graphContainer),style:{...ce?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:ae,ref:ke,"aria-label":ie||`${n?`The graph shows ${n}. `:""}This is a grouped bar chart. ${m?` ${m}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:g?W||"1rem":W||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||m||z||C?l.jsx(Qe,{styles:{title:ce?.title,description:ce?.description},classNames:{title:N?.title,description:N?.description},graphTitle:n,graphDescription:m,width:j,graphDownload:z?ke.current:void 0,dataDownload:C?e.map(me=>me.data).filter(me=>me!==void 0).length>0?e.map(me=>me.data).filter(me=>me!==void 0):e.filter(me=>me!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[q&&e.filter(me=>me.qualitativeRange).length!==0&&S?l.jsx(Hi,{width:j,colorLegendTitle:P,colors:B||Pe[M].sequentialColors.positiveColorsx10,colorDomain:S,showNAColor:!1}):null,l.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:Ae,"aria-label":"Graph area",children:(j||be)&&(I||De)?l.jsx(sP,{data:O==="asc"?tt(e.filter(me=>ve?!je(me.size):me),me=>me.size).filter((me,Se)=>T?Se<T:!0):O==="desc"?tt(e.filter(me=>ve?!je(me.size):me),me=>me.size).reverse().filter((me,Se)=>T?Se<T:!0):e.filter(me=>ve?!je(me.size):me).filter((me,Se)=>T?Se<T:!0),barColor:i,targetColor:U,width:j||be,refValues:V,height:Math.max(Q,I||(D?Q?(j||be)*D>Q?(j||be)*D:Q:(j||be)*D:De)),suffix:p,prefix:y,barPadding:r,showLabels:f,showValues:d,showTicks:a,truncateBy:h,leftMargin:o,rightMargin:s,qualitativeRangeColors:B||Pe[M].sequentialColors.positiveColorsx10,topMargin:c,bottomMargin:u,tooltip:x,onSeriesMouseOver:$,maxValue:G,minValue:_,highlightedDataPoints:b,onSeriesMouseClick:X,labelOrder:K,maxBarThickness:se,minBarThickness:Z,resetSelectionOnDoubleClick:ue,detailsOnClick:he,barAxisTitle:Y,noOfTicks:ge,valueColor:oe,styles:ce,classNames:N,targetStyle:J,dimmedOpacity:ee,measureBarWidthFactor:R,animate:le===!0?{duration:.5,once:!0,amount:.5}:le||{duration:0,once:!0,amount:0},precision:de,customLayers:te,naLabel:Me}):null})]})}),v||w?l.jsx(et,{styles:{footnote:ce?.footnote,source:ce?.source},classNames:{footnote:N?.footnote,source:N?.source},sources:v,footNote:w,width:j}):null]})})})})}function Kv(t){const{data:e,graphTitle:n,barColor:i,barPadding:r,showTicks:a,leftMargin:o,rightMargin:s,topMargin:c,bottomMargin:u,truncateBy:h,showLabels:f,showValues:d,backgroundColor:g,suffix:p,prefix:y,sources:v,graphDescription:m,height:I,width:j,footNote:w,colorDomain:S,colorLegendTitle:P,padding:W,relativeHeight:D,tooltip:x,onSeriesMouseOver:$,refValues:V,showColorScale:q,graphID:ae,maxValue:G,minValue:_,highlightedDataPoints:b,onSeriesMouseClick:B,graphDownload:X,dataDownload:z,language:C,theme:A,sortData:M,labelOrder:O,minHeight:K,maxBarThickness:Q,maxNumberOfBars:se,minBarThickness:T,ariaLabel:Z,resetSelectionOnDoubleClick:ie,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y,valueColor:ge,orientation:oe="vertical",styles:ce,classNames:N,filterNA:U,targetStyle:ve,targetColor:J,qualitativeRangeColors:R,measureBarWidthFactor:le,animate:ee,dimmedOpacity:de,precision:te,naLabel:Me}=t;return oe==="vertical"?l.jsx(lP,{data:e,graphTitle:n,barColor:i,barPadding:r,showTicks:a,leftMargin:o,rightMargin:s,topMargin:c,bottomMargin:u,truncateBy:h,showLabels:f,showValues:d,backgroundColor:g,suffix:p,prefix:y,sources:v,graphDescription:m,height:I,width:j,footNote:w,colorDomain:S,colorLegendTitle:P,padding:W,relativeHeight:D,tooltip:x,onSeriesMouseOver:$,refValues:V,showColorScale:q,graphID:ae,maxValue:G,minValue:_,highlightedDataPoints:b,onSeriesMouseClick:B,graphDownload:X,dataDownload:z,language:C,theme:A,sortData:M,labelOrder:O,minHeight:K,maxBarThickness:Q,maxNumberOfBars:se,minBarThickness:T,ariaLabel:Z,resetSelectionOnDoubleClick:ie,styles:ce,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y,valueColor:ge,classNames:N,filterNA:U,targetStyle:ve,targetColor:J,measureBarWidthFactor:le,qualitativeRangeColors:R,animate:ee,dimmedOpacity:de,precision:te,naLabel:Me}):l.jsx(oP,{data:e,graphTitle:n,barColor:i,barPadding:r,showTicks:a,leftMargin:o,rightMargin:s,topMargin:c,bottomMargin:u,truncateBy:h,showLabels:f,showValues:d,backgroundColor:g,suffix:p,prefix:y,sources:v,graphDescription:m,height:I,width:j,footNote:w,colorDomain:S,colorLegendTitle:P,padding:W,relativeHeight:D,tooltip:x,onSeriesMouseOver:$,refValues:V,showColorScale:q,graphID:ae,maxValue:G,minValue:_,highlightedDataPoints:b,onSeriesMouseClick:B,graphDownload:X,dataDownload:z,language:C,theme:A,sortData:M,labelOrder:O,minHeight:K,maxBarThickness:Q,maxNumberOfBars:se,minBarThickness:T,ariaLabel:Z,resetSelectionOnDoubleClick:ie,styles:ce,detailsOnClick:ue,barAxisTitle:he,noOfTicks:Y,valueColor:ge,classNames:N,filterNA:U,targetStyle:ve,targetColor:J,measureBarWidthFactor:le,qualitativeRangeColors:R,animate:ee,dimmedOpacity:de,precision:te,naLabel:Me})}function cP(t){const{data:e,width:n,height:i,colors:r,dateFormat:a,noOfXTicks:o,rightMargin:s,leftMargin:c,topMargin:u,bottomMargin:h,yAxisTitle:f,tooltip:d,onSeriesMouseOver:g,highlightAreaSettings:p,refValues:y,minValue:v,maxValue:m,rtl:I,annotations:j,customHighlightAreaSettings:w,noOfYTicks:S,prefix:P,suffix:W,curveType:D,styles:x,classNames:$,precision:V,customLayers:q,animate:ae}=t,G=k.useRef(null),_=ct(G,{once:ae.once,amount:ae.amount}),b=D==="linear"?Oi:D==="step"?Or:D==="stepAfter"?Ir:D==="stepBefore"?Nr:_r,[B,X]=k.useState(void 0),[z,C]=k.useState(void 0),[A,M]=k.useState(void 0),O={top:u,bottom:h,left:f?c+30:c,right:s},K=k.useRef(null),Q=tt(e.map(R=>({...R,date:ze(`${R.date}`,a,new Date)})),"date"),se=p.map(R=>({...R,coordinates:[R.coordinates[0]===null?null:ze(`${R.coordinates[0]}`,a,new Date),R.coordinates[1]===null?null:ze(`${R.coordinates[1]}`,a,new Date)]})),T=w.map(R=>({...R,coordinates:R.coordinates.map((le,ee)=>ee%2===0?ze(`${le}`,a,new Date):le)})),Z=Q[0].y.map((R,le)=>Q.map(ee=>({date:ee.date,y0:le===0?0:rt(ee.y.filter((de,te)=>te<le)),y1:rt(ee.y.filter((de,te)=>te<=le))}))),ie=n-O.left-O.right,ue=i-O.top-O.bottom,he=Q[0].date,Y=Q[Q.length-1].date,ge=je(v)?0:v,oe=je(m)?Math.max(...e.map(R=>rt(R.y)||0)):m,ce=Zr().domain([he,Y]).range([0,ie]),N=ut().domain([ge,oe]).range([ue,0]).nice(),U=No().x(R=>ce(R.date)).y0(R=>N(R.y0)).y1(R=>N(R.y1)).curve(b),ve=N.ticks(S),J=ce.ticks(o);return k.useEffect(()=>{const R=ee=>{const de=Q[Qr(Q.map(te=>te.date),ce.invert(En(ee)[0]),1)];X(de||Q[Q.length-1]),g?.(de||Q[Q.length-1]),M(ee.clientY),C(ee.clientX)},le=()=>{X(void 0),C(void 0),M(void 0),g?.(void 0)};bt(K.current).on("mousemove",R).on("mouseout",le),g?.(void 0)},[ce,Q,g]),l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:G,children:l.jsx(mt,{children:l.jsxs($e.g,{transform:`translate(${O.left},${O.top})`,children:[l.jsx(ao,{areaSettings:se,width:ie,height:ue,scale:ce,animate:ae,isInView:_}),l.jsx(lo,{animate:ae,areaSettings:T,scaleX:ce,scaleY:N,isInView:_}),l.jsxs("g",{children:[l.jsx(ri,{values:ve.filter(R=>R!==0),y:ve.filter(R=>R!==0).map(R=>N(R)),x1:0-c,x2:ie+O.right,styles:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},classNames:{gridLines:$?.yAxis?.gridLines,labels:$?.yAxis?.labels},suffix:W,prefix:P,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:V}),l.jsx(Dt,{y1:N(ge<0?0:ge),y2:N(ge<0?0:ge),x1:0-c,x2:ie+O.right,label:qe(ge<0?0:ge,"NA",V,P,W),labelPos:{x:0-c,dx:0,dy:oe<0?"1em":-5,y:N(ge<0?0:ge)},classNames:{axis:$?.xAxis?.axis,label:$?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:x?.yAxis?.labels}}),l.jsx(Nt,{x:0-c-15,y:ue/2,style:x?.yAxis?.title,className:$?.yAxis?.title,text:f,rotate90:!0})]}),l.jsx(Rn,{values:J.map(R=>ft(R,a)),x:J.map(R=>ce(R)),y1:0,y2:ue,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:Ce.cn("opacity-0",$?.xAxis?.gridLines),labels:Ce.cn("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs",$?.xAxis?.labels)},suffix:W,prefix:P,labelType:"primary",showGridLines:!0,precision:V}),q.filter(R=>R.position==="before").map(R=>R.layer),l.jsxs($e.g,{children:[Z.map((R,le)=>l.jsx($e.path,{d:U(R),exit:{opacity:0,transition:{duration:ae.duration}},variants:{initial:{d:U(R.map(ee=>({...ee,y0:0,y1:0}))),opacity:0},whileInView:{d:U(R),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:_?"whileInView":"initial",style:{fill:r[le],opacity:.8}},le)),B?l.jsx("line",{y1:0,y2:ue,x1:ce(B.date),x2:ce(B.date),className:Ce.cn("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",$?.mouseOverLine),style:x?.mouseOverLine}):null]}),y?l.jsx(l.Fragment,{children:y.map((R,le)=>l.jsx(gi,{text:R.text,color:R.color,y:N(R.value),x1:0-c,x2:ie+O.right,classNames:R.classNames,styles:R.styles,animate:ae,isInView:_},le))}):null,l.jsx("g",{children:j.map((R,le)=>{const ee=oo({x:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0),y:R.yCoordinate?N(R.yCoordinate)+(R.yOffset||0)-8:0+(R.yOffset||0)-8},{x:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date)):0,y:R.yCoordinate?N(R.yCoordinate):0},je(R.connectorRadius)?3.5:R.connectorRadius),de=R.showConnector?{y1:ee.y,x1:ee.x,y2:R.yCoordinate?N(R.yCoordinate)+(R.yOffset||0):0+(R.yOffset||0),x2:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0),cx:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date)):0,cy:R.yCoordinate?N(R.yCoordinate):0,circleRadius:je(R.connectorRadius)?3.5:R.connectorRadius,strokeWidth:R.showConnector===!0?2:Math.min(R.showConnector||0,1)}:void 0,te={y:R.yCoordinate?N(R.yCoordinate)+(R.yOffset||0)-8:0+(R.yOffset||0)-8,x:I?0:R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0),width:I?R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0):ie-(R.xCoordinate?ce(ze(`${R.xCoordinate}`,a,new Date))+(R.xOffset||0):0+(R.xOffset||0)),maxWidth:R.maxWidth,fontWeight:R.fontWeight,align:R.align};return l.jsx(so,{color:R.color,connectorsSettings:de,labelSettings:te,text:R.text,classNames:R.classNames,styles:R.styles,animate:ae,isInView:_},le)})}),q.filter(R=>R.position==="after").map(R=>R.layer),l.jsx("rect",{ref:K,style:{fill:"none",pointerEvents:"all"},width:ie,height:ue})]})})}),B&&d&&z&&A?l.jsx(st,{data:B,body:d,xPos:z,yPos:A,backgroundStyle:x?.tooltip,className:$?.tooltip}):null]})}function Qv(t){const{data:e,graphTitle:n,colors:i=Pe.light.categoricalColors.colors,sources:r,graphDescription:a,height:o,width:s,footNote:c,noOfXTicks:u=10,dateFormat:h="yyyy",colorDomain:f,padding:d,backgroundColor:g=!1,colorLegendTitle:p,leftMargin:y=50,rightMargin:v=20,topMargin:m=20,bottomMargin:I=25,highlightAreaSettings:j=[],tooltip:w,relativeHeight:S,onSeriesMouseOver:P,refValues:W=[],graphID:D,minValue:x,maxValue:$,graphDownload:V=!1,dataDownload:q=!1,showColorScale:ae=!0,language:G="en",minHeight:_=0,annotations:b=[],customHighlightAreaSettings:B=[],theme:X="light",ariaLabel:z,yAxisTitle:C,noOfYTicks:A=5,prefix:M="",suffix:O="",curveType:K="curve",styles:Q,classNames:se,precision:T=2,customLayers:Z=[],animate:ie=!1}=t,[ue,he]=k.useState(0),[Y,ge]=k.useState(0),oe=k.useRef(null),ce=k.useRef(null);return k.useEffect(()=>{const N=new ResizeObserver(U=>{he(s||U[0].target.clientWidth||620),ge(o||U[0].target.clientHeight||480)});return oe.current&&(ge(oe.current.clientHeight||480),he(oe.current.clientWidth||620),s||N.observe(oe.current)),()=>N.disconnect()},[s,o]),l.jsx("div",{className:`${X||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:G==="he"||G==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${G||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:D,ref:ce,"aria-label":z||`${n?`The graph shows ${n}. `:""}This is a stacked area chart that shows trends over time.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:g?d||"1rem":d||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||V||q?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:a,width:s,graphDownload:V?ce.current:void 0,dataDownload:q?e.map(N=>N.data).filter(N=>N!==void 0).length>0?e.map(N=>N.data).filter(N=>N!==void 0):e.filter(N=>N!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[ae!==!1?l.jsx(Hi,{colorDomain:f,colors:i,colorLegendTitle:p,showNAColor:!1}):null,l.jsx("div",{className:"w-full grow leading-0",ref:oe,"aria-label":"Graph area",children:(s||ue)&&(o||Y)?l.jsx(cP,{data:e,colors:i,width:s||ue,height:Math.max(_,o||(S?_?(s||ue)*S>_?(s||ue)*S:_:(s||ue)*S:Y)),dateFormat:h,noOfXTicks:u,leftMargin:y,rightMargin:v,topMargin:m,bottomMargin:I,tooltip:w,onSeriesMouseOver:P,highlightAreaSettings:j,refValues:W,minValue:x,maxValue:$,rtl:G==="he"||G==="ar",annotations:b,customHighlightAreaSettings:B,yAxisTitle:C,noOfYTicks:A,prefix:M,suffix:O,curveType:K,styles:Q,classNames:se,precision:T,customLayers:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0}}):null})]})}),r||c?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:r,footNote:c,width:s}):null]})})})})}function uP(t){const{year:e,value:n,graphTitle:i,suffix:r="",sources:a,prefix:o="",graphDescription:s,footNote:c,padding:u,backgroundColor:h=!1,graphID:f,language:d="en",theme:g="light",ariaLabel:p,textBackground:y=!1,headingFontSize:v="4.375rem",centerAlign:m=!1,verticalAlign:I="center",layout:j="primary",styles:w,classNames:S,precision:P}=t;return l.jsx("div",{className:`${g||"light"} flex w-full`,dir:d==="he"||d==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col w-full h-inherit ${d||"en"}`,S?.graphContainer),style:{...w?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:f,"aria-label":p||`${i?`The graph shows ${i}. `:""}This is a statistic card.${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:j!=="secondary"?l.jsxs("div",{className:"flex flex-col w-full gap-12 justify-between grow",children:[i||s?l.jsx(Qe,{styles:{title:w?.title,description:w?.description},classNames:{title:S?.title,description:S?.description},graphTitle:i,graphDescription:s}):null,l.jsx("div",{className:`flex flex-col justify-between grow ${I==="top"?"justify-start":I==="bottom"?"justify-end":"justify-center"}`,children:l.jsxs(Ce.H3,{marginBottom:"base",className:`leading-none text-outline font-heading ${m?"text-center":d==="he"||d==="ar"?"text-right":"text-left"} ${y?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:v,letterSpacing:"0.05rem"},children:[qe(n,"NA",P,o,r)," ",e?l.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",e,")"]}):null]})}),a||c?l.jsx(et,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:S?.footnote,source:S?.source},sources:a,footNote:c}):null]}):l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-center",children:[l.jsxs(Ce.H3,{marginBottom:j==="secondary"?"none":"base",className:`leading-none text-outline font-heading ${m?"text-center":d==="he"||d==="ar"?"text-right":"text-left"} ${y?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:v,letterSpacing:"0.05rem"},children:[qe(n,"NA",P,o,r)," ",e?l.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",e,")"]}):null]}),i||s?l.jsx(Qe,{styles:{title:w?.title,description:w?.description},classNames:{title:S?.title,description:S?.description},graphTitle:i,graphDescription:s}):null,a||c?l.jsx(et,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:S?.footnote,source:S?.source},sources:a,footNote:c}):null]})})})})}function Zv(t){const{year:e,data:n,graphTitle:i,suffix:r="",sources:a,prefix:o="",graphDescription:s,footNote:c,padding:u,backgroundColor:h=!1,graphID:f,aggregationMethod:d="count",language:g="en",countOnly:p,theme:y="light",ariaLabel:v,textBackground:m=!1,headingFontSize:I="4.375rem",centerAlign:j=!1,verticalAlign:w="center",layout:S="primary",styles:P,classNames:W,precision:D=2}=t;return l.jsx("div",{className:`${y||"light"} flex w-full`,dir:g==="he"||g==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col w-full h-inherit ${g||"en"}`,W?.graphContainer),style:{...P?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:f,"aria-label":v||`${i?`The graph shows ${i}. `:""}This is a statistic card.${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:S!=="secondary"?l.jsxs("div",{className:"flex flex-col w-full gap-12 justify-between grow",children:[i||s?l.jsx(Qe,{styles:{title:P?.title,description:P?.description},classNames:{title:W?.title,description:W?.description},graphTitle:i,graphDescription:s}):null,l.jsx("div",{className:`flex flex-col justify-between grow ${w==="top"?"justify-start":w==="bottom"?"justify-end":"justify-center"}`,children:l.jsxs(Ce.H3,{marginBottom:"base",className:`leading-none text-outline font-heading ${j?"text-center":g==="he"||g==="ar"?"text-right":"text-left"} ${m?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:I,letterSpacing:"0.05rem"},children:[n.filter(x=>typeof x.value=="string").length>0||d==="count"?p&&p?.length!==0?n.filter(x=>p.indexOf(x.value)!==-1).length:n.length:qe(d==="sum"?rt(n.map(x=>x.value)):d==="average"?parseFloat((rt(n.map(x=>x.value))/n.length).toFixed(2)):d==="max"?Math.max(...n.map(x=>x.value).filter(x=>x!==void 0)):Math.min(...n.map(x=>x.value).filter(x=>x!==void 0)),"NA",D,o,r)," ",e?l.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",e,")"]}):null]})}),a||c?l.jsx(et,{styles:{footnote:P?.footnote,source:P?.source},classNames:{footnote:W?.footnote,source:W?.source},sources:a,footNote:c}):null]}):l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-center",children:[l.jsxs(Ce.H3,{marginBottom:S==="secondary"?"none":"base",className:`leading-none text-outline font-heading ${j?"text-center":g==="he"||g==="ar"?"text-right":"text-left"} ${m?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:I,letterSpacing:"0.05rem"},children:[n.filter(x=>typeof x.value=="string").length>0||d==="count"?p&&p?.length!==0?n.filter(x=>p.indexOf(x.value)!==-1).length:n.length:qe(d==="sum"?rt(n.map(x=>x.value)):d==="average"?parseFloat((rt(n.map(x=>x.value))/n.length).toFixed(2)):d==="max"?Math.max(...n.map(x=>x.value).filter(x=>x!==void 0)):Math.min(...n.map(x=>x.value).filter(x=>x!==void 0)),"NA",D,o,r)," ",e?l.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",e,")"]}):null]}),i||s?l.jsx(Qe,{styles:{title:P?.title,description:P?.description},classNames:{title:W?.title,description:W?.description},graphTitle:i,graphDescription:s}):null,a||c?l.jsx(et,{styles:{footnote:P?.footnote,source:P?.source},classNames:{footnote:W?.footnote,source:W?.source},sources:a,footNote:c}):null]})})})})}function hP(t){var e=0,n=t.children,i=n&&n.length;if(!i)e=1;else for(;--i>=0;)e+=n[i].value;t.value=e}function fP(){return this.eachAfter(hP)}function dP(t,e){let n=-1;for(const i of this)t.call(e,i,++n,this);return this}function gP(t,e){for(var n=this,i=[n],r,a,o=-1;n=i.pop();)if(t.call(e,n,++o,this),r=n.children)for(a=r.length-1;a>=0;--a)i.push(r[a]);return this}function pP(t,e){for(var n=this,i=[n],r=[],a,o,s,c=-1;n=i.pop();)if(r.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)i.push(a[o]);for(;n=r.pop();)t.call(e,n,++c,this);return this}function mP(t,e){let n=-1;for(const i of this)if(t.call(e,i,++n,this))return i}function yP(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n})}function xP(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function vP(t){for(var e=this,n=wP(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i}function wP(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;for(t=n.pop(),e=i.pop();t===e;)r=t,t=n.pop(),e=i.pop();return r}function bP(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function CP(){return Array.from(this)}function SP(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function DP(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*MP(){var t=this,e,n=[t],i,r,a;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,i=t.children)for(r=0,a=i.length;r<a;++r)n.push(i[r]);while(n.length)}function Jv(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=jP)):e===void 0&&(e=kP);for(var n=new Ys(t),i,r=[n],a,o,s,c;i=r.pop();)if((o=e(i.data))&&(c=(o=Array.from(o)).length))for(i.children=o,s=c-1;s>=0;--s)r.push(a=o[s]=new Ys(o[s])),a.parent=i,a.depth=i.depth+1;return n.eachBefore(ew)}function TP(){return Jv(this).eachBefore(AP)}function kP(t){return t.children}function jP(t){return Array.isArray(t)?t[1]:null}function AP(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function ew(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function Ys(t){this.data=t,this.depth=this.height=0,this.parent=null}Ys.prototype=Jv.prototype={constructor:Ys,count:fP,each:dP,eachAfter:pP,eachBefore:gP,find:mP,sum:yP,sort:xP,path:vP,ancestors:bP,descendants:CP,leaves:SP,links:DP,copy:TP,[Symbol.iterator]:MP};function Iu(t){return t==null?null:tw(t)}function tw(t){if(typeof t!="function")throw new Error;return t}function ds(){return 0}function gs(t){return function(){return t}}function _P(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function OP(t,e,n,i,r){for(var a=t.children,o,s=-1,c=a.length,u=t.value&&(i-e)/t.value;++s<c;)o=a[s],o.y0=n,o.y1=r,o.x0=e,o.x1=e+=o.value*u}var NP={depth:-1},qm={},$u={};function IP(t){return t.id}function $P(t){return t.parentId}function LP(){var t=IP,e=$P,n;function i(r){var a=Array.from(r),o=t,s=e,c,u,h,f,d,g,p,y,v=new Map;if(n!=null){const m=a.map((w,S)=>PP(n(w,S,r))),I=m.map(Um),j=new Set(m).add("");for(const w of I)j.has(w)||(j.add(w),m.push(w),I.push(Um(w)),a.push($u));o=(w,S)=>m[S],s=(w,S)=>I[S]}for(h=0,c=a.length;h<c;++h)u=a[h],g=a[h]=new Ys(u),(p=o(u,h,r))!=null&&(p+="")&&(y=g.id=p,v.set(y,v.has(y)?qm:g)),(p=s(u,h,r))!=null&&(p+="")&&(g.parent=p);for(h=0;h<c;++h)if(g=a[h],p=g.parent){if(d=v.get(p),!d)throw new Error("missing: "+p);if(d===qm)throw new Error("ambiguous: "+p);d.children?d.children.push(g):d.children=[g],g.parent=d}else{if(f)throw new Error("multiple roots");f=g}if(!f)throw new Error("no root");if(n!=null){for(;f.data===$u&&f.children.length===1;)f=f.children[0],--c;for(let m=a.length-1;m>=0&&(g=a[m],g.data===$u);--m)g.data=null}if(f.parent=NP,f.eachBefore(function(m){m.depth=m.parent.depth+1,--c}).eachBefore(ew),f.parent=null,c>0)throw new Error("cycle");return f}return i.id=function(r){return arguments.length?(t=Iu(r),i):t},i.parentId=function(r){return arguments.length?(e=Iu(r),i):e},i.path=function(r){return arguments.length?(n=Iu(r),i):n},i}function PP(t){t=`${t}`;let e=t.length;return Ph(t,e-1)&&!Ph(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function Um(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Ph(t,e););return t.slice(0,e)}function Ph(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if((n&1)===0)return!0}return!1}function EP(t,e,n,i,r){for(var a=t.children,o,s=-1,c=a.length,u=t.value&&(r-n)/t.value;++s<c;)o=a[s],o.x0=e,o.x1=i,o.y0=n,o.y1=n+=o.value*u}var VP=(1+Math.sqrt(5))/2;function FP(t,e,n,i,r,a){for(var o=[],s=e.children,c,u,h=0,f=0,d=s.length,g,p,y=e.value,v,m,I,j,w,S,P;h<d;){g=r-n,p=a-i;do v=s[f++].value;while(!v&&f<d);for(m=I=v,S=Math.max(p/g,g/p)/(y*t),P=v*v*S,w=Math.max(I/P,P/m);f<d;++f){if(v+=u=s[f].value,u<m&&(m=u),u>I&&(I=u),P=v*v*S,j=Math.max(I/P,P/m),j>w){v-=u;break}w=j}o.push(c={value:v,dice:g<p,children:s.slice(h,f)}),c.dice?OP(c,n,i,r,y?i+=p*v/y:a):EP(c,n,i,y?n+=g*v/y:r,a),y-=v,h=f}return o}const RP=function t(e){function n(i,r,a,o,s){FP(e,i,r,a,o,s)}return n.ratio=function(i){return t((i=+i)>1?i:1)},n}(VP);function BP(){var t=RP,e=!1,n=1,i=1,r=[0],a=ds,o=ds,s=ds,c=ds,u=ds;function h(d){return d.x0=d.y0=0,d.x1=n,d.y1=i,d.eachBefore(f),r=[0],e&&d.eachBefore(_P),d}function f(d){var g=r[d.depth],p=d.x0+g,y=d.y0+g,v=d.x1-g,m=d.y1-g;v<p&&(p=v=(p+v)/2),m<y&&(y=m=(y+m)/2),d.x0=p,d.y0=y,d.x1=v,d.y1=m,d.children&&(g=r[d.depth+1]=a(d)/2,p+=u(d)-g,y+=o(d)-g,v-=s(d)-g,m-=c(d)-g,v<p&&(p=v=(p+v)/2),m<y&&(y=m=(y+m)/2),t(d,p,y,v,m))}return h.round=function(d){return arguments.length?(e=!!d,h):e},h.size=function(d){return arguments.length?(n=+d[0],i=+d[1],h):[n,i]},h.tile=function(d){return arguments.length?(t=tw(d),h):t},h.padding=function(d){return arguments.length?h.paddingInner(d).paddingOuter(d):h.paddingInner()},h.paddingInner=function(d){return arguments.length?(a=typeof d=="function"?d:gs(+d),h):a},h.paddingOuter=function(d){return arguments.length?h.paddingTop(d).paddingRight(d).paddingBottom(d).paddingLeft(d):h.paddingTop()},h.paddingTop=function(d){return arguments.length?(o=typeof d=="function"?d:gs(+d),h):o},h.paddingRight=function(d){return arguments.length?(s=typeof d=="function"?d:gs(+d),h):s},h.paddingBottom=function(d){return arguments.length?(c=typeof d=="function"?d:gs(+d),h):c},h.paddingLeft=function(d){return arguments.length?(u=typeof d=="function"?d:gs(+d),h):u},h}function HP(t){const{data:e,colors:n,leftMargin:i,width:r,height:a,colorDomain:o,rightMargin:s,topMargin:c,bottomMargin:u,showLabels:h,tooltip:f,onSeriesMouseOver:d,selectedColor:g,showValues:p,suffix:y,prefix:v,highlightedDataPoints:m,onSeriesMouseClick:I,resetSelectionOnDoubleClick:j,detailsOnClick:w,language:S,styles:P,classNames:W,animate:D,dimmedOpacity:x,precision:$}=t,V=k.useRef(null),q=ct(V,{once:D.once,amount:D.amount}),[ae,G]=k.useState(void 0),[_,b]=k.useState(void 0),[B,X]=k.useState(void 0),[z,C]=k.useState(void 0),A={top:c,bottom:u,left:i,right:s},M=r-A.left-A.right,O=a-A.top-A.bottom,K=[{id:"root",parent:void 0,value:void 0,data:void 0},...e.map(T=>({id:T.label,value:T.size,parent:"root",data:T}))],Q=LP().id(T=>T.id).parentId(T=>T.parent)(K);Q.sum(T=>T.value);const se=BP().size([M,O]).padding(2)(Q);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${r}px`,height:`${a}px`,viewBox:`0 0 ${r} ${a}`,direction:"ltr",ref:V,children:l.jsx("g",{transform:`translate(${A.left},${A.top})`,children:l.jsx(mt,{children:se.children?.map(T=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:T.x0,y:T.y0},whileInView:{opacity:g?T.data.data.color&&n[o.indexOf(T.data.data.color)]===g?1:x:m.length!==0?m.indexOf(T.data.id)!==-1?.85:x:.85,x:T.x0,y:T.y0,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},onMouseEnter:Z=>{G(T.data.data),C(Z.clientY),X(Z.clientX),d?.(T.data.data)},onClick:()=>{(I||w)&&(_===T.data.id&&j?(b(void 0),I?.(void 0)):(b(T.data.id),I?.(T.data.data)))},onMouseMove:Z=>{G(T.data.data),C(Z.clientY),X(Z.clientX)},onMouseLeave:()=>{G(void 0),X(void 0),C(void 0),d?.(void 0)},children:[l.jsx($e.rect,{x:0,y:0,exit:{width:0,height:0,opacity:0,transition:{duration:D.duration}},variants:{initial:{width:0,height:0,fill:e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray},whileInView:{width:T.x1-T.x0,height:T.y1-T.y0,fill:e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial"}),T.x1-T.x0>50&&T.y1-T.y0>25&&(h||p)?l.jsx($e.g,{variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:q?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:l.jsx("foreignObject",{y:0,x:0,width:T.x1-T.x0,height:T.y1-T.y0,children:l.jsxs("div",{className:"flex flex-col gap-0.5 p-2 w-full",style:{color:yn(e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray)},children:[h?l.jsx(Ce.P,{marginBottom:"none",size:"sm",leading:"none",className:Ce.cn("w-full treemap-label",S==="ar"||S==="he"?"text-right":"text-left",W?.graphObjectValues),style:{WebkitLineClamp:T.y1-T.y0>50?T.y1-T.y0>100?T.y1-T.y0>150?void 0:3:2:1,display:"-webkit-box",WebkitBoxOrient:"vertical",overflow:"hidden",color:yn(e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray),...P?.graphObjectValues||{}},children:T.data.id}):null,p?l.jsx(Ce.P,{marginBottom:"none",size:"sm",leading:"none",className:Ce.cn("w-full font-bold treemap-value",S==="ar"||S==="he"?"text-right":"text-left",W?.graphObjectValues),style:{color:yn(e.filter(Z=>Z.color).length===0?n[0]:T.data.data.color?n[o.indexOf(T.data.data.color)]:Pe.gray),...P?.graphObjectValues||{}},children:qe(T.data.value,"NA",$,v,y)}):null]})})}):null]},T.data.id))})})}),ae&&f&&B&&z?l.jsx(st,{data:ae,body:f,xPos:B,yPos:z,backgroundStyle:P?.tooltip,className:W?.tooltip}):null,w&&_!==void 0?l.jsx(Ce.Modal,{open:_!==void 0,onClose:()=>{b(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:lt(w,_)}:void 0,children:typeof w=="function"?w(_):null})}):null]})}function Md(t){const{data:e,graphTitle:n,colors:i,suffix:r="",sources:a,prefix:o="",graphDescription:s,leftMargin:c=0,rightMargin:u=0,topMargin:h=0,bottomMargin:f=0,height:d,width:g,footNote:p,colorDomain:y,colorLegendTitle:v,padding:m,backgroundColor:I=!1,showLabels:j=!0,relativeHeight:w,tooltip:S,onSeriesMouseOver:P,showColorScale:W=!0,showValues:D=!0,graphID:x,highlightedDataPoints:$=[],onSeriesMouseClick:V,graphDownload:q=!1,dataDownload:ae=!1,language:G="en",showNAColor:_=!0,minHeight:b=0,theme:B="light",ariaLabel:X,resetSelectionOnDoubleClick:z=!0,detailsOnClick:C,styles:A,classNames:M,animate:O=!1,dimmedOpacity:K=.3,precision:Q=2}=t,[se,T]=k.useState(0),[Z,ie]=k.useState(0),[ue,he]=k.useState(void 0),Y=k.useRef(null),ge=k.useRef(null);return k.useEffect(()=>{const oe=new ResizeObserver(ce=>{T(g||ce[0].target.clientWidth||620),ie(d||ce[0].target.clientHeight||480)});return Y.current&&(ie(Y.current.clientHeight||480),T(Y.current.clientWidth||620),g||oe.observe(Y.current)),()=>oe.disconnect()},[g,d]),l.jsx("div",{className:`${B||"light"} flex ${g?"w-fit grow-0":"w-full grow"}`,dir:G==="he"||G==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${G||"en"}`,M?.graphContainer),style:{...A?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:x,ref:ge,"aria-label":X||`${n?`The graph shows ${n}. `:""}This is a chart where data points are represented by squares, and their sizes reflect their values. ${s?` ${s}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:I?m||"1rem":m||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||s||q||ae?l.jsx(Qe,{styles:{title:A?.title,description:A?.description},classNames:{title:M?.title,description:M?.description},graphTitle:n,graphDescription:s,width:g,graphDownload:q?ge.current:void 0,dataDownload:ae?e.map(oe=>oe.data).filter(oe=>oe!==void 0).length>0?e.map(oe=>oe.data).filter(oe=>oe!==void 0):e.filter(oe=>oe!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[W&&e.filter(oe=>oe.color).length!==0?l.jsx(tn,{width:g,colorLegendTitle:v,colors:i||Pe[B].categoricalColors.colors,colorDomain:y||Xe(e.filter(oe=>oe.color),"color").map(oe=>oe.color),setSelectedColor:he,showNAColor:_}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:Y,"aria-label":"Graph area",children:(g||se)&&(d||Z)?l.jsx(HP,{data:e.filter(oe=>!je(oe.size)),colors:e.filter(oe=>oe.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[B].categoricalColors.colors,colorDomain:e.filter(oe=>oe.color).length===0?[]:y||Xe(e.filter(oe=>oe.color),"color").map(oe=>oe.color),width:g||se,height:Math.max(b,d||(w?b?(g||se)*w>b?(g||se)*w:b:(g||se)*w:Z)),leftMargin:c,rightMargin:u,topMargin:h,bottomMargin:f,showLabels:j,showValues:D,suffix:r,prefix:o,selectedColor:ue,tooltip:S,onSeriesMouseOver:P,onSeriesMouseClick:V,highlightedDataPoints:$,resetSelectionOnDoubleClick:z,detailsOnClick:C,styles:A,classNames:M,language:G,animate:O===!0?{duration:.5,once:!0,amount:.5}:O||{duration:0,once:!0,amount:0},dimmedOpacity:K,precision:Q}):null})]})}),a||p?l.jsx(et,{styles:{footnote:A?.footnote,source:A?.source},classNames:{footnote:M?.footnote,source:M?.source},sources:a,footNote:p,width:g}):null]})})})})}function nw(t){const{data:e,size:n=200,graphTitle:i,sources:r,colors:a=Pe.light.categoricalColors.colors,graphDescription:o,totalNoOfDots:s=100,unitPadding:c=3,gridSize:u=10,footNote:h,padding:f,backgroundColor:d=!1,graphID:g,graphDownload:p=!1,language:y="en",showColorScale:v=!0,showStrokeForWhiteDots:m=!0,note:I,dataDownload:j=!1,theme:w="light",width:S,height:P,minHeight:W=0,relativeHeight:D,ariaLabel:x,styles:$,classNames:V,animate:q=!1,precision:ae=2}=t,G=k.useRef(null),_=q===!0?{duration:.5,once:!0,amount:.5}:q||{duration:0,once:!0,amount:0},b=ct(G,{once:_.once,amount:_.amount}),B=rt(e.map(M=>M.value)),X=k.useRef(null),z=n/u,C=(z-c*2)/2;if(C<=0)return console.error("The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0."),null;const A=[];return e.forEach((M,O)=>{const K=Math.round(M.value/B*s);for(let Q=0;Q<K;Q+=1)A.push({color:a[O]})}),l.jsx("div",{className:`${w||"light"} flex ${S?"w-fit grow-0":"w-full grow"}`,dir:y==="he"||y==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${d?d===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${y||"en"}`,V?.graphContainer),style:{...$?.graphContainer||{},minHeight:"inherit",...d&&d!==!0?{backgroundColor:d}:{}},id:g,ref:X,"aria-label":x||`${i?`The graph shows ${i}. `:""}${o?` ${o}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:d?f||"1rem":f||0},children:l.jsxs("div",{className:"flex flex-col gap-3 w-full grow",children:[i||o||p?l.jsx(Qe,{styles:{title:$?.title,description:$?.description},classNames:{title:V?.title,description:V?.description},graphTitle:i,graphDescription:o,width:S,graphDownload:p?X.current:void 0,dataDownload:j?e.map(M=>M.data).filter(M=>M!==void 0).length>0?e.map(M=>M.data).filter(M=>M!==void 0):e.filter(M=>M!==void 0):null}):null,I?l.jsx(Ce.H2,{marginBottom:"2xs",className:"text-primary-gray-700 dark:text-primary-gray-100 font-bold",style:{width:S?`${S}px`:"100%"},children:I}):null,l.jsxs("div",{className:"flex grow flex-col gap-4 justify-between",children:[l.jsxs("div",{children:[v?l.jsx("div",{className:"mb-4 leading-0",style:{width:S?`${S}px`:"100%"},"aria-label":"Color legend",children:l.jsx("div",{className:"flex mb-0 flex-wrap gap-x-4 gap-y-1",children:e.map((M,O)=>l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:a[O]}}),l.jsxs(Ce.P,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[M.label,":"," ",l.jsx("span",{className:"font-bold",children:qe(M.value,"NA",ae)})]})]},O))})}):null,l.jsx("div",{"aria-label":"Graph area",children:l.jsx("svg",{width:`${S||n}px`,height:`${Math.max(W,P?D&&S?W?S*D>W?S*D:W:S*D:P:Math.floor((s-1)/u)*z+z/2+C+5)}px`,ref:G,direction:"ltr",viewBox:`0 0 ${S||n} ${Math.max(W,P?D&&S?W?S*D>W?S*D:W:S*D:P:Math.floor((s-1)/u)*z+z/2+C+5)}`,children:l.jsx(mt,{children:l.jsx("g",{children:A.map((M,O)=>l.jsx($e.circle,{cx:O%u*z+z/2,cy:Math.floor(O/u)*z+z/2,style:{...m?{}:{stroke:M.color},strokeWidth:1},variants:{initial:{fill:"#fff",opacity:0,...m?{}:{stroke:M.color},strokeWidth:1},whileInView:{fill:M.color,opacity:1,...m?{}:{stroke:M.color},strokeWidth:1,transition:{duration:0,delay:_.duration/A.length*O}}},initial:"initial",animate:b?"whileInView":"initial",className:(M.color.toLowerCase()==="#fff"||M.color.toLowerCase()==="#ffffff"||M.color.toLowerCase()==="white")&&m?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"",r:C},O))})})})})]}),r||h?l.jsx(et,{styles:{footnote:$?.footnote,source:$?.source},sources:r,footNote:h,width:S}):null]})]})})})})}function WP(t){const{data:e,showColumnLabels:n,leftMargin:i,rightMargin:r,truncateBy:a,width:o,height:s,topMargin:c,bottomMargin:u,tooltip:h,onSeriesMouseOver:f,suffix:d,prefix:g,showValues:p,colorDomain:y,colors:v,noDataColor:m,scaleType:I,showRowLabels:j,selectedColor:w,onSeriesMouseClick:S,resetSelectionOnDoubleClick:P,detailsOnClick:W,styles:D,classNames:x,animate:$,precision:V}=t,q=k.useRef(null),ae=ct(q,{once:$.once,amount:$.amount}),G={top:c,bottom:u,left:i,right:r},[_,b]=k.useState(void 0),[B,X]=k.useState(void 0),[z,C]=k.useState(void 0),[A,M]=k.useState(void 0),O=o-G.left-G.right,K=s-G.top-G.bottom,Q=Xe(e,Y=>Y.column).map(Y=>Y.column),se=Xe(e,Y=>Y.row).map(Y=>Y.row),T=xn().domain(se).range([0,K]),Z=T.bandwidth(),ie=xn().domain(Q).range([0,O]),ue=ie.bandwidth(),he=I==="categorical"?Xs().domain(y).range(v):I==="threshold"?Po().domain(y).range(v):ut().domain(y).range(v);return l.jsxs(l.Fragment,{children:[l.jsxs($e.svg,{width:`${o}px`,height:`${s}px`,viewBox:`0 0 ${o} ${s}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:q,children:[l.jsx("g",{transform:`translate(${G.left},0)`,children:n?Q.map((Y,ge)=>l.jsx(ro,{y:0,x:ie(Y),width:ue,height:G.top-5,value:`${Y}`.length<a?`${Y}`:`${`${Y}`.substring(0,a)}...`,style:D?.xAxis?.labels,className:x?.xAxis?.labels,alignment:"bottom",animate:{duration:0,once:!0,amount:0},isInView:ae},ge)):null}),l.jsx("g",{transform:`translate(0,${G.top})`,children:j?se.map((Y,ge)=>l.jsx(io,{value:`${Y}`.length<a?`${Y}`:`${`${Y}`.substring(0,a)}...`,y:T(Y),x:0,width:G.left,height:Z,alignment:"right",style:D?.yAxis?.labels,className:x?.yAxis?.labels,animate:{duration:0,once:!0,amount:0},isInView:ae},ge)):null}),l.jsxs("g",{transform:`translate(${G.left},${G.top})`,children:[se.map((Y,ge)=>l.jsx("g",{transform:`translate(0,${T(Y)})`,children:Q.map(oe=>l.jsx("rect",{x:ie(oe),y:0,width:ue,height:Z,style:{fill:m},className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700"},`${Y}-${oe}`))},ge)),e.filter(Y=>!je(Y.value)).map((Y,ge)=>{const oe=je(Y.value)?m:he(Y.value);return l.jsxs("g",{transform:`translate(${ie(Y.column)},${T(Y.row)})`,onMouseEnter:ce=>{X(Y),M(ce.clientY),C(ce.clientX),f?.(Y)},onClick:()=>{(S||W)&&(dt(_,Y)&&P?(b(void 0),S?.(void 0)):(b(Y),S?.(Y)))},onMouseMove:ce=>{X(Y),M(ce.clientY),C(ce.clientX)},onMouseLeave:()=>{X(void 0),C(void 0),M(void 0),f?.(void 0)},opacity:w?w===oe?1:.3:1,children:[l.jsx($e.rect,{x:0,y:0,width:ue,height:Z,className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700",exit:{opacity:0,transition:{duration:$.duration}},variants:{initial:{fill:oe,opacity:0},whileInView:{fill:oe,opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:ae?"whileInView":"initial"}),p&&!je(Y.value)?l.jsx($e.g,{variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:ae?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},children:l.jsx("foreignObject",{y:0,x:0,width:ue,height:Z,children:l.jsx("div",{className:"flex flex-col justify-center items-center h-inherit p-1",children:l.jsx("p",{className:Ce.cn("text-xs text-center m-0 leading-[1.25] graph-value",x?.graphObjectValues),style:{color:yn(oe),...D?.graphObjectValues||{}},children:qe(Y.value,"NA",V,g,d)})})},ge)}):null]},`${Y.column}-${Y.row}`)}),B?l.jsx("rect",{x:ie(B.column),y:T(B.row),width:ue,height:Z,style:{fill:"none",fillOpacity:0,strokeWidth:1.5},className:"stroke-primary-gray-700 dark:stroke-primary-gray-300"}):null]})]}),B&&h&&z&&A?l.jsx(st,{data:B,body:h,xPos:z,yPos:A,backgroundStyle:D?.tooltip,className:x?.tooltip}):null,W&&_!==void 0?l.jsx(Ce.Modal,{open:_!==void 0,onClose:()=>{b(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof W=="string"?{__html:lt(W,_)}:void 0,children:typeof W=="function"?W(_):null})}):null]})}function iw(t){const{colorLegendTitle:e,colorDomain:n,colors:i,width:r,className:a}=t;return l.jsxs("div",{className:Ce.cn("flex gap-0 flex-wrap justify-center leading-0",a),style:{maxWidth:r?`${r}px`:"none"},"aria-label":"Color legend",children:[e&&e!==""?l.jsx(Ce.P,{size:"sm",marginBottom:"2xs",className:"w-full text-center",children:e}):null,l.jsxs("div",{className:"flex gap-0 flex-wrap justify-center w-full min-w-[360px] leading-0",children:[l.jsx("div",{className:"h-4 mb-1 w-full min-w-[360px]",style:{background:`linear-gradient(90deg, ${i[0]} 0%, ${i[1]} 100%)`}}),l.jsxs("div",{className:"flex justify-between w-full min-w-[360px]",children:[l.jsx(Ce.P,{marginBottom:"none",size:"sm",children:qe(n[0],"NA",2,"","")}),l.jsx(Ce.P,{marginBottom:"none",size:"sm",children:qe(n[1],"NA",2,"","")})]})]})]})}function rw(t){const{colorLegendTitle:e,colorDomain:n,colors:i,setSelectedColor:r,width:a,naColor:o,className:s,showNAColor:c}=t,[u,h]=k.useState(void 0),f=o?320:360;return l.jsxs("div",{className:Ce.cn("flex flex-wrap gap-0 justify-center leading-0",s),style:{maxWidth:a?`${a}px`:"none"},"aria-label":"Color legend",children:[e&&e!==""?l.jsx(Ce.P,{size:"sm",marginBottom:"2xs",className:"w-full text-center",children:e}):null,l.jsx("svg",{width:"100%",viewBox:"0 0 360 30",style:{maxWidth:"360px"},direction:"ltr",children:l.jsxs("g",{children:[n.map((d,g)=>l.jsxs("g",{onMouseOver:()=>{h(i[g]),r(i[g])},onMouseLeave:()=>{h(void 0),r(void 0)},className:"cursor-pointer",children:[l.jsx("rect",{x:g*f/i.length+1,y:1,width:f/i.length-2,height:8,className:`stroke-1 ${u===i[g]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:i[g],...u!==i[g]?{stroke:i[g]}:{}}}),l.jsx("text",{x:(g+1)*f/i.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"middle"},children:qe(d,"NA",2,"","")})]},g)),l.jsx("g",{children:l.jsx("rect",{onMouseOver:()=>{h(i[n.length]),r(i[n.length])},onMouseLeave:()=>{h(void 0),r(void 0)},x:n.length*f/i.length+1,y:1,width:f/i.length-2,height:8,className:`cursor-pointer stroke-1 ${u===i[n.length]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:i[n.length],...u!==i[n.length]?{stroke:i[n.length]}:{}}})}),c?l.jsxs("g",{onMouseOver:()=>{h(o||"#D4D6D8"),r(o||"#D4D6D8")},onMouseLeave:()=>{h(void 0),r(void 0)},className:"cursor-pointer",children:[l.jsx("rect",{x:335,y:1,width:24,height:8,className:`stroke-1 ${u===o?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:o||"#D4D6D8",...u!==o?{stroke:o}:{},strokeWidth:1}}),l.jsx("text",{x:337.5,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},children:"NA"})]}):null]})})]})}function aw(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,showColumnLabels:o=!0,leftMargin:s=100,rightMargin:c=10,truncateBy:u=999,height:h,width:f,scaleType:d,colorDomain:g,footNote:p,colorLegendTitle:y,padding:v,backgroundColor:m=!1,topMargin:I=30,bottomMargin:j=10,tooltip:w,onSeriesMouseOver:S,suffix:P="",prefix:W="",showRowLabels:D=!0,relativeHeight:x,showValues:$,graphID:V,noDataColor:q=Pe.gray,showColorScale:ae=!0,onSeriesMouseClick:G,graphDownload:_=!1,dataDownload:b=!1,fillContainer:B=!0,language:X="en",showNAColor:z=!0,minHeight:C=0,theme:A="light",ariaLabel:M,resetSelectionOnDoubleClick:O=!0,detailsOnClick:K,styles:Q,classNames:se,animate:T=!1,precision:Z=2}=t,[ie,ue]=k.useState(0),[he,Y]=k.useState(0),[ge,oe]=k.useState(void 0),ce=k.useRef(null),N=k.useRef(null);k.useEffect(()=>{const ve=new ResizeObserver(J=>{ue(f||J[0].target.clientWidth||620),Y(h||J[0].target.clientHeight||480)});return ce.current&&(Y(ce.current.clientHeight||480),ue(ce.current.clientWidth||620),f||ve.observe(ce.current)),()=>ve.disconnect()},[f,h]);const U=d||(typeof g[0]=="string"?"categorical":g.length===2?"linear":"threshold");return l.jsx("div",{className:`${A||"light"} flex ${f?"grow-0":"grow"} ${B?"w-full":"w-fit"}`,dir:X==="he"||X==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${m?m===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${X||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...m&&m!==!0?{backgroundColor:m}:{}},id:V,ref:N,"aria-label":M||`${n?`The graph shows ${n}. `:""}This is a heatmap. ${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:m?v||"1rem":v||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||_||b?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:a,width:f,graphDownload:_?N.current:void 0,dataDownload:b?e.map(ve=>ve.data).filter(ve=>ve!==void 0).length>0?e.map(ve=>ve.data).filter(ve=>ve!==void 0):e.filter(ve=>ve!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[ae?U==="categorical"?l.jsx(tn,{width:B?void 0:f,colorLegendTitle:y,colors:i||(typeof g[0]=="string"?Pe[A].categoricalColors.colors:g.length===2?[Pe[A].sequentialColors.neutralColorsx09[0],Pe[A].sequentialColors.neutralColorsx09[8]]:Pe[A].sequentialColors[`neutralColorsx0${g.length+1}`]),colorDomain:g.map(ve=>`${ve}`),setSelectedColor:oe,showNAColor:z}):U==="threshold"?l.jsx(rw,{width:B?void 0:f,colorLegendTitle:y,colors:i||(typeof g[0]=="string"?Pe[A].categoricalColors.colors:g.length===2?[Pe[A].sequentialColors.neutralColorsx09[0],Pe[A].sequentialColors.neutralColorsx09[8]]:Pe[A].sequentialColors[`neutralColorsx0${g.length+1}`]),colorDomain:g,setSelectedColor:oe,naColor:q,showNAColor:z}):l.jsx(iw,{width:B?void 0:f,colorLegendTitle:y,colors:i||[Pe[A].sequentialColors.neutralColorsx09[0],Pe[A].sequentialColors.neutralColorsx09[8]],colorDomain:g}):null,l.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:ce,"aria-label":"Graph area",children:(f||ie)&&(h||he)?l.jsx(WP,{data:e,colorDomain:g,width:f||ie,colors:i||(typeof g[0]=="string"?Pe[A].categoricalColors.colors:g.length===2?[Pe[A].sequentialColors.neutralColorsx09[0],Pe[A].sequentialColors.neutralColorsx09[8]]:Pe[A].sequentialColors[`neutralColorsx0${g.length+1}`]),noDataColor:q,scaleType:U,height:Math.max(C,h||(x?C?(f||ie)*x>C?(f||ie)*x:C:(f||ie)*x:he)),showColumnLabels:o,leftMargin:s,rightMargin:c,topMargin:I,bottomMargin:j,selectedColor:ge,truncateBy:u,showRowLabels:D,tooltip:w,onSeriesMouseOver:S,showValues:$,suffix:P,prefix:W,onSeriesMouseClick:G,resetSelectionOnDoubleClick:O,detailsOnClick:K,styles:Q,classNames:se,animate:T===!0?{duration:.5,once:!0,amount:.5}:T||{duration:0,once:!0,amount:0},precision:Z}):null})]})}),r||p?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:r,footNote:p,width:f}):null]})})})})}const Xm=t=>t.map(i=>i||1).reduce((i,r)=>i+r,0);function ow(t){const{width:e,height:n,graphTitle:i,sources:r,graphDescription:a,footNote:o,graphID:s,data:c,columnData:u,onSeriesMouseClick:h,language:f="en",theme:d="light",ariaLabel:g,backgroundColor:p=!1,padding:y,resetSelectionOnDoubleClick:v=!0,styles:m,classNames:I,minWidth:j,naLabel:w="NA",precision:S=2}=t,[P,W]=k.useState(void 0),[D,x]=k.useState(void 0),[$,V]=k.useState("asc"),[q,ae]=k.useState(void 0),[G,_]=k.useState({}),[b,B]=k.useState(u.filter(C=>C.filterOptions&&C.filterOptions.length>0).map(C=>({id:C.columnId,option:C.filterOptions}))),[X,z]=k.useState(c);return k.useEffect(()=>{const C=[];c.forEach(A=>{let M=!0;b.forEach(O=>{if(typeof A[O.id]!="object"&&typeof A[O.id]!="function"&&typeof A[O.id]!="symbol")if(u[u.findIndex(K=>K.columnId===O.id)].separator){const K=A[O.id].split(u[u.findIndex(Q=>Q.columnId===O.id)].separator);Qa(K,O.option).length===0&&(M=!1)}else O.option.indexOf(A[O.id])===-1&&(M=!1)}),M&&C.push(A)}),z(P&&c?$==="asc"?tt(C,[P]):tt(C,[P]).reverse():C)},[P,$,c,b,u]),l.jsx("div",{className:`${d||"light"} flex ${e?"w-fit grow-0":"w-full grow"}`,dir:f==="he"||f==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${p?p===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${f||"en"} w-full`,I?.graphContainer),style:{...m?.graphContainer||{},...p&&p!==!0?{backgroundColor:p}:{}},id:s,"aria-label":g||`${i?`The graph shows ${i}. `:""}This is an data table. ${a?` ${a}`:""}`,children:l.jsxs("div",{className:"flex grow",style:{padding:p?y||"1rem":y||0},children:[l.jsxs("div",{className:"flex flex-col gap-3 w-full justify-between grow",children:[i||a?l.jsx(Qe,{styles:{title:m?.title,description:m?.description},classNames:{title:I?.title,description:I?.description},graphTitle:i,graphDescription:a,width:e}):null,l.jsx("div",{className:"grow flex flex-col justify-center",children:l.jsx("div",{className:"undp-scrollbar",style:{width:e?`${e}px`:"100%",height:n?`${n}px`:"auto"},children:l.jsx("div",{style:j?{minWidth:j}:void 0,children:c?l.jsxs("table",{className:"w-full",style:{borderCollapse:"collapse"},children:[l.jsx("thead",{className:"text-left bg-primary-gray-300 dark:bg-primary-gray-550",children:l.jsx("tr",{children:u?.map((C,A)=>l.jsx("th",{className:"text-primary-gray-700 dark:text-primary-gray-100 text-sm",style:{width:`calc(${100*(C.columnWidth||1)/Xm(u.map(M=>M.columnWidth||1))}%`},children:l.jsxs("div",{className:"flex gap-2 justify-between items-center p-4",children:[l.jsx(Ce.P,{size:"sm",marginBottom:"none",className:`w-fit grow text-${C.align||"left"} font-bold`,children:C.columnTitle||C.columnId}),C.sortable?l.jsx("button",{type:"button",className:"bg-transparent cursor-pointer p-0 m-0 border-0",onClick:()=>{P===C.columnId?($==="asc"&&V("desc"),$==="desc"&&W(void 0)):(W(C.columnId),V("asc"))},children:P===C.columnId?$==="asc"?l.jsx(ZA,{}):l.jsx(QA,{}):l.jsx(KA,{})}):null,C.filterOptions&&C.filterOptions.length?l.jsx("button",{type:"button",className:"bg-transparent cursor-pointer m-0 p-0 border-0",onClick:M=>{if(q===C.columnId)ae(void 0);else if(M.currentTarget){ae(C.columnId);const O=M.currentTarget.getBoundingClientRect();_({top:O.bottom+window.scrollY,left:O.left+window.scrollX-160<0?O.left+window.scrollX:O.left+window.scrollX-160,width:"10rem"})}},children:b[b.findIndex(M=>M.id===C.columnId)].option.length===C.filterOptions?.length?l.jsx(JA,{}):l.jsx(e2,{})}):null]})},A))})}),l.jsx("tbody",{children:X?.map((C,A)=>l.jsx("tr",{className:`cursor-${h?"pointer":"auto"} border-b border-b-primary-gray-400 dark:border-b-primary-gray-500 ${dt(D,C)?"bg-primary-gray-200 dark:bg-primary-gray-600":"bg-transparent"}`,style:C.rowStyle,onClick:()=>{h&&(dt(D,C)&&v?(x(void 0),h(void 0)):(x(C),h(C)))},children:u.map((M,O)=>l.jsx("td",{className:`text-primary-gray-700 dark:text-primary-gray-100 text-sm text-${M.align||"left"}`,style:{width:`calc(${100*(C.columnWidth||1)/Xm(u.map(K=>K.columnWidth||1))}%`},children:l.jsx("div",{className:`text-primary-gray-700 dark:text-primary-gray-100 flex p-4 ${M.align==="right"?"justify-end":M.align==="center"?"justify-center":"justify-start"}`,children:typeof C[M.columnId]=="number"?l.jsx(Ce.P,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${M.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${M.align||"left"} ${M.chip?M.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...M.chip&&M.chipColors?{backgroundColor:M.chipColors[M.chipColors.findIndex(K=>K.value===C[M.chipColumnId||M.columnId])].color,color:yn(M.chipColors[M.chipColors.findIndex(K=>K.value===C[M.chipColumnId||M.columnId])].color)}:{}},children:qe(C[M.columnId],w,S,M.prefix,M.suffix)}):typeof C[M.columnId]=="string"?M.separator?l.jsx("div",{className:"text-primary-gray-700 dark:text-primary-gray-100 flex flex-wrap gap-2",children:C[M.columnId].split(M.separator).map((K,Q)=>l.jsx(Ce.P,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${M.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${M.align||"left"} ${M.chip?M.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...M.chip&&M.chipColors?{backgroundColor:M.chipColors[M.chipColors.findIndex(se=>se.value===(M.chipColumnId?C[M.chipColumnId]:K))].color,color:yn(M.chipColors[M.chipColors.findIndex(se=>se.value===(M.chipColumnId?C[M.chipColumnId]:K))].color)}:{}},children:qe(K,w,S,M.prefix,M.suffix)},Q))}):l.jsx(Ce.P,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${M.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${M.align||"left"} ${M.chip?M.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...M.chip&&M.chipColors?{backgroundColor:M.chipColors[M.chipColors.findIndex(K=>K.value===C[M.chipColumnId||M.columnId])].color,color:yn(M.chipColors[M.chipColors.findIndex(K=>K.value===C[M.chipColumnId||M.columnId])].color)}:{}},children:qe(C[M.columnId],w,S,M.prefix,M.suffix)}):l.jsx("div",{children:qe(C[M.columnId],w,S,M.prefix,M.suffix)})})},O))},A))})]}):null})})}),r||o?l.jsx(et,{styles:{footnote:m?.footnote,source:m?.source},classNames:{footnote:I?.footnote,source:I?.source},sources:r,footNote:o,width:e}):null]}),q&&l.jsx("div",{style:G,className:"absolute p-3 border z-[1000] rounded-sm bg-primary-white dark:bg-primary-gray-700 border-primary-gray-300 dark:border-primary-gray-550",children:l.jsxs("div",{className:"max-w-60",children:[l.jsx(Ce.P,{size:"sm",marginBottom:"2xs",className:"font-bold",children:"Filter data by"}),l.jsx("div",{className:"flex flex-col gap-2",children:u[u.findIndex(C=>C.columnId===q)].filterOptions?.map((C,A)=>l.jsx("div",{children:l.jsxs("label",{className:"undp-viz-label",children:[l.jsx("input",{type:"checkbox",className:"undp-viz-checkbox",checked:b[b.findIndex(M=>M.id===q)].option.indexOf(C)!==-1,onChange:()=>{const M=b.findIndex(K=>K.id===q),O=[...b[M].option];if(O.indexOf(C)!==-1){O.splice(O.indexOf(C),1);const K=[...b];K[M].option=O,B(K)}else{O.push(C);const K=[...b];K[M].option=O,B(K)}}}),C]},A)},A))})]})})]})})})}const zP=t=>t?Object.entries(t).map(([n,i])=>Array.isArray(i)?{" ":n,value:`"${i.join("; ")}"`}:{" ":n,value:`"${i}"`}):{};function GP(t){const{width:e,height:n,data:i,onSeriesMouseClick:r,cardTemplate:a,cardBackgroundColor:o,cardMinWidth:s=320,detailsOnClick:c,noOfItemsInAPage:u,styles:h,classNames:f,page:d,allowDataDownloadOnDetail:g}=t,[p,y]=k.useState(void 0);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"undp-scrollbar w-full my-0 mx-auto grid gap-4 undp-viz-data-cards-container",style:{width:e?`${e}px`:"100%",height:n?`${n}px`:"auto",gridTemplateColumns:`repeat(auto-fill, minmax(${s}px, 1fr))`},children:i.filter((v,m)=>u?m<d*u&&m>=(d-1)*u:!0).map((v,m)=>l.jsx("div",{style:{...h?.dataCards||{},...o&&{backgroundColor:o}},className:`w-full flex flex-col ${r||c?"cursor-pointer":"cursor-auto"}${o?"":"bg-primary-gray-200 dark:bg-primary-gray-600"} ${f?.dataCards||""}`,onClick:()=>{r?.(v),y(v)},dangerouslySetInnerHTML:typeof a=="string"?{__html:lt(a,v)}:void 0,children:typeof a=="function"?a(v):null},m))}),c&&p!==void 0?l.jsxs(Ce.Modal,{open:p!==void 0,onClose:()=>{y(void 0)},children:[l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof c=="string"?{__html:lt(c,p)}:void 0,children:typeof c=="function"?c(p):null}),g?l.jsx("div",{className:"flex",children:l.jsx(Hf,{csvData:zP(p),headers:[{label:" ",key:" "},{label:"value",key:"value"}],buttonContent:l.jsxs("div",{className:"flex items-center gap-4",children:[typeof g=="string"?g:null,l.jsx(Bf,{})]})})}):null]}):null]})}function Kr(t){if(t!==void 0)return Array.isArray(t)?t.map(e=>({value:e,label:e})):{value:t,label:t}}const YP=(t,e,n)=>e.length===0?t:t.filter(i=>e.some(r=>i[r]?.toLowerCase().includes(n.toLowerCase())));function sw(t){const{width:e,height:n,graphTitle:i,sources:r,graphDescription:a,footNote:o,graphID:s,data:c,onSeriesMouseClick:u,language:h="en",theme:f="light",ariaLabel:d,cardTemplate:g,cardBackgroundColor:p,cardFilters:y,cardSortingOptions:v,cardSearchColumns:m,cardMinWidth:I=320,backgroundColor:j=!1,padding:w,detailsOnClick:S,allowDataDownloadOnDetail:P=!1,noOfItemsInAPage:W,uiMode:D="normal",styles:x,classNames:$}=t,[V,q]=k.useState(c),[ae,G]=k.useState(1),[_,b]=k.useState(""),B=k.useMemo(()=>(y||[]).map(O=>({filter:O.column,label:O.label||`Filter by ${O.column}`,singleSelect:!0,clearable:!0,defaultValue:Kr(O.defaultValue),availableValues:jr(c,O.column).filter(K=>!O.excludeValues?.includes(`${K}`)).map(K=>({value:K,label:K})),width:O.width})),[y,c]),[X,z]=k.useState((y||[]).map(O=>({filter:O.column,value:Kr(O.defaultValue)}))),[C,A]=k.useState(v?!v.defaultValue||v.options.findIndex(O=>O.label===v.defaultValue)===-1?v.options[0]:v.options[v.options.findIndex(O=>O.label===v.defaultValue)]:void 0),M=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]);return k.useEffect(()=>{A(v?!v.defaultValue||v.options.findIndex(O=>O.label===v.defaultValue)===-1?v.options[0]:v.options[v.options.findIndex(O=>O.label===v.defaultValue)]:void 0)},[v]),k.useEffect(()=>{const O=YP(c,m||[],_).filter(K=>X.every(Q=>Q.value&&hn([Q.value]).length>0?Qa(hn([K[Q.filter]]),hn([Q.value]).map(se=>se.value)).length>0:!0));q(C?tt(O,C?.value,C?.type):O)},[c,m,_,X,C]),k.useEffect(()=>{G(1)},[V]),l.jsx("div",{className:`${f||"light"} flex ${e?"w-fit grow-0":"w-full grow"}`,dir:h==="he"||h==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${j?j===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${h||"en"}`,$?.graphContainer),style:{...x?.graphContainer||{},...j&&j!==!0?{backgroundColor:j}:{}},id:s,"aria-label":d||`${i?`The graph shows ${i}. `:""}This is an list of cards. ${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:j?w||"1rem":w||0},children:l.jsxs("div",{className:"flex flex-col grow gap-3 w-full justify-between",children:[i||a?l.jsx(Qe,{styles:{title:x?.title,description:x?.description},classNames:{title:$?.title,description:$?.description},graphTitle:i,graphDescription:a,width:e}):null,v||B.length>0?l.jsxs("div",{className:"flex gap-4 flex-wrap items-start w-full",children:[v?l.jsxs("div",{className:"grow shrink-0 min-w-[240px]",style:{width:v.width||"calc(25% - 0.75rem)"},children:[l.jsx(Ce.P,{marginBottom:"xs",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:"Sort by"}),l.jsx(Ce.DropdownSelect,{options:v.options,isRtl:h==="he"||h==="ar",isSearchable:!0,filterOption:Ce.createFilter(M),onChange:O=>{A(O||void 0)},variant:D,size:"sm",defaultValue:!v.defaultValue||v.options.findIndex(O=>O.label===v.defaultValue)===-1?v.options[0]:v.options[v.options.findIndex(O=>O.label===v.defaultValue)]})]}):null,B?.map((O,K)=>l.jsxs("div",{className:"grow shrink-0 min-w-[240px]",style:{width:O.width||"calc(25% - 0.75rem)"},children:[l.jsx(Ce.P,{marginBottom:"xs",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:O.label}),l.jsx(Ce.DropdownSelect,{options:O.availableValues,isClearable:O.clearable===void 0?!0:O.clearable,isRtl:h==="he"||h==="ar",isSearchable:!0,variant:D,size:"sm",controlShouldRenderValue:!0,filterOption:Ce.createFilter(M),onChange:Q=>{z(se=>se.map(T=>T.filter===O.filter?{...T,value:Q}:T))},defaultValue:O.defaultValue})]},K))]}):null,(m||[]).length>0?l.jsx("div",{style:{paddingTop:"1px"},children:l.jsx(Ce.Search,{placeholder:"Search...",onSearch:O=>{b(O||"")},buttonVariant:"icon",inputVariant:D,showSearchButton:!1,inputSize:"sm"})}):null,l.jsx(GP,{data:V,width:e,height:n,cardTemplate:g,cardMinWidth:I,page:ae,cardBackgroundColor:p,styles:x,classNames:$,noOfItemsInAPage:W,detailsOnClick:S,onSeriesMouseClick:u,allowDataDownloadOnDetail:P}),W?l.jsx(Ce.Pagination,{total:V.length,defaultPage:0,pageSize:W,onChange:G}):null,r||o?l.jsx(et,{styles:{footnote:x?.footnote,source:x?.source},classNames:{footnote:$?.footnote,source:$?.source},sources:r,footNote:o,width:e}):null]})})})})}function lw(t,e){if(t<2)return[];const n=e/(t-1);return Array.from({length:t},(i,r)=>r*n)}function qP(t){const{data:e,width:n,height:i,colors:r,colorDomain:a,radius:o,leftMargin:s,rightMargin:c,topMargin:u,bottomMargin:h,tooltip:f,onSeriesMouseOver:d,highlightedDataPoints:g,selectedColor:p,minValue:y,maxValue:v,onSeriesMouseClick:m,prefix:I,suffix:j,stripType:w,highlightColor:S,dotOpacity:P,resetSelectionOnDoubleClick:W,detailsOnClick:D,styles:x,classNames:$,valueColor:V,animate:q,noOfTicks:ae,dimmedOpacity:G,precision:_,customLayers:b}=t,B=k.useRef(null),X=ct(B,{once:q.once,amount:q.amount}),[z,C]=k.useState(void 0),[A,M]=k.useState(void 0),[O,K]=k.useState(void 0),[Q,se]=k.useState(void 0),T={top:u,bottom:h,left:s,right:c},Z=n-T.left-T.right,ie=i-T.top-T.bottom,ue=e.map((N,U)=>({...N,id:`${U}`})),he=tt(ue,N=>{const U=(g||[]).indexOf(N.label);return U===-1?1/0:U}).reverse(),Y=je(v)?Math.max(...e.filter(N=>!je(N.position)).map(N=>N.position))<0?0:Math.max(...e.filter(N=>!je(N.position)).map(N=>N.position)):v,ge=je(y)?Math.min(...e.filter(N=>!je(N.position)).map(N=>N.position))>=0?0:Math.min(...e.filter(N=>!je(N.position)).map(N=>N.position)):y,oe=ut().domain([ge,Y]).range([0,Z]).nice(),ce=lw(ae,Z);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:B,children:l.jsxs("g",{transform:`translate(${T.left},${T.top})`,children:[b.filter(N=>N.position==="before").map(N=>N.layer),l.jsxs(mt,{children:[he.map(N=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:oe(0),y:ie/2},whileInView:{x:oe(N.position),y:ie/2,opacity:p?N.color&&r[a.indexOf(N.color)]===p?.95:G:g.length!==0?g.indexOf(N.label)!==-1?.95:G:P,transition:{duration:q.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},onMouseEnter:U=>{C(N),se(U.clientY),K(U.clientX),d?.(N)},onClick:()=>{(m||D)&&(dt(A,N)&&W?(M(void 0),m?.(void 0)):(M(N),m?.(N)))},onMouseMove:U=>{C(N),se(U.clientY),K(U.clientX)},onMouseLeave:()=>{C(void 0),K(void 0),se(void 0),d?.(void 0)},children:[w==="dot"?l.jsx($e.circle,{cy:0,cx:0,variants:{initial:{fill:S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray},whileInView:{fill:S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray,transition:{duration:q.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},r:o}):l.jsx($e.rect,{y:0-o,x:-1,height:o*2,width:2,variants:{initial:{fill:S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray},whileInView:{fill:S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray,transition:{duration:q.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}}}),g.length!==0&&g.indexOf(N.label)!==-1?l.jsx($e.text,{x:0,y:0-o-5,variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:q.duration}},style:{fill:V||(S&&g?g.indexOf(N.label)!==-1?S:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray),textAnchor:"middle",...x?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm font-bold",$?.graphObjectValues),children:qe(N.position,"NA",_,I,j)}):null]},N.label)),ce.map((N,U)=>l.jsx("text",{x:N,y:ie/2+o,style:{textAnchor:U===0?"start":U===ce.length-1?"end":"middle",...x?.xAxis?.labels||{}},className:Ce.cn("fill-primary-gray-550 dark:fill-primary-gray-500 text-xs",$?.xAxis?.labels),dy:"1em",children:qe(oe.invert(N),"NA",_,I,j)},U))]}),b.filter(N=>N.position==="after").map(N=>N.layer)]})}),z&&f&&O&&Q?l.jsx(st,{data:z,body:f,xPos:O,yPos:Q,backgroundStyle:x?.tooltip,className:$?.tooltip}):null,D&&A!==void 0?l.jsx(Ce.Modal,{open:A!==void 0,onClose:()=>{M(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof D=="string"?{__html:lt(D,A)}:void 0,children:typeof D=="function"?D(A):null})}):null]})}function UP(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f=5,padding:d,backgroundColor:g=!1,leftMargin:p=5,rightMargin:y=5,topMargin:v=10,bottomMargin:m=10,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S=!0,highlightedDataPoints:P=[],graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,graphDownload:V=!1,dataDownload:q=!1,prefix:ae="",suffix:G="",stripType:_="dot",language:b="en",highlightColor:B,dotOpacity:X=.3,showNAColor:z=!0,minHeight:C=0,theme:A="light",ariaLabel:M,resetSelectionOnDoubleClick:O=!0,detailsOnClick:K,styles:Q,classNames:se,valueColor:T,animate:Z=!1,noOfTicks:ie=2,dimmedOpacity:ue=.3,precision:he=2,customLayers:Y=[]}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(void 0),J=k.useRef(null),R=k.useRef(null);return k.useEffect(()=>{const le=new ResizeObserver(ee=>{oe(s||ee[0].target.clientWidth||620),N(o||ee[0].target.clientHeight||480)});return J.current&&(N(J.current.clientHeight||480),oe(J.current.clientWidth||620),s||le.observe(J.current)),()=>le.disconnect()},[s,o]),l.jsx("div",{className:`${A||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:b==="he"||b==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${b||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:W,ref:R,"aria-label":M||`${n?`The graph shows ${n}. `:""}This is a strip chart showing distribution of data along the horizontal axis. Each dot represents an individual data point, helping to visualize the spread and clustering of values.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:g?d||"1rem":d||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||V||q?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:a,width:s,graphDownload:V?R.current:void 0,dataDownload:q?e.map(le=>le.data).filter(le=>le!==void 0).length>0?e.map(le=>le.data).filter(le=>le!==void 0):e.filter(le=>le!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[S!==!1&&e.filter(le=>le.color).length!==0?l.jsx(tn,{width:s,colorLegendTitle:h,colors:i||Pe[A].categoricalColors.colors,colorDomain:u||Xe(e.filter(le=>le.color),"color").map(le=>le.color),setSelectedColor:ve,showNAColor:z??!0}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:J,"aria-label":"Graph area",children:(s||ge)&&(o||ce)?l.jsx(qP,{data:e,width:s||ge,height:Math.max(C,o||(j?C?(s||ge)*j>C?(s||ge)*j:C:(s||ge)*j:ce)),colorDomain:e.filter(le=>le.color).length===0?[]:u||Xe(e.filter(le=>le.color),"color").map(le=>le.color),colors:e.filter(le=>le.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[A].categoricalColors.colors,selectedColor:U,radius:f,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,onSeriesMouseOver:w,highlightedDataPoints:P,minValue:D,maxValue:x,onSeriesMouseClick:$,prefix:ae,suffix:G,stripType:_,highlightColor:B,dotOpacity:X,resetSelectionOnDoubleClick:O,detailsOnClick:K,styles:Q,classNames:se,valueColor:T,animate:Z===!0?{duration:.5,once:!0,amount:.5}:Z||{duration:0,once:!0,amount:0},noOfTicks:ie,dimmedOpacity:ue,precision:he,customLayers:Y}):null})]})}),r||c?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:r,footNote:c,width:s}):null]})})})})}function XP(t){const{data:e,width:n,height:i,colors:r,colorDomain:a,radius:o,leftMargin:s,rightMargin:c,topMargin:u,bottomMargin:h,tooltip:f,onSeriesMouseOver:d,highlightedDataPoints:g,selectedColor:p,minValue:y,maxValue:v,onSeriesMouseClick:m,noOfTicks:I,prefix:j,suffix:w,stripType:S,highlightColor:P,dotOpacity:W,resetSelectionOnDoubleClick:D,detailsOnClick:x,styles:$,classNames:V,valueColor:q,animate:ae,dimmedOpacity:G,precision:_,customLayers:b}=t,B=k.useRef(null),X=ct(B,{once:ae.once,amount:ae.amount}),[z,C]=k.useState(void 0),[A,M]=k.useState(void 0),[O,K]=k.useState(void 0),[Q,se]=k.useState(void 0),T={top:u,bottom:h,left:s,right:c},Z=n-T.left-T.right,ie=i-T.top-T.bottom,ue=e.map((N,U)=>({...N,id:`${U}`})),he=tt(ue,N=>{const U=(g||[]).indexOf(N.label);return U===-1?1/0:U}).reverse(),Y=je(v)?Math.max(...e.filter(N=>!je(N.position)).map(N=>N.position))<0?0:Math.max(...e.filter(N=>!je(N.position)).map(N=>N.position)):v,ge=je(y)?Math.min(...e.filter(N=>!je(N.position)).map(N=>N.position))>=0?0:Math.min(...e.filter(N=>!je(N.position)).map(N=>N.position)):y,oe=ut().domain([ge,Y]).range([ie,0]).nice(),ce=lw(I,ie);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:B,children:l.jsxs("g",{transform:`translate(${T.left},${T.top})`,children:[b.filter(N=>N.position==="before").map(N=>N.layer),l.jsxs(mt,{children:[he.map(N=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:Z/2,y:oe(0)},whileInView:{x:Z/2,y:oe(N.position),opacity:p?N.color&&r[a.indexOf(N.color)]===p?.95:G:g.length!==0?g.indexOf(N.label)!==-1?.95:G:W,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:ae.duration}},onMouseEnter:U=>{C(N),se(U.clientY),K(U.clientX),d?.(N)},onClick:()=>{(m||x)&&(dt(A,N)&&D?(M(void 0),m?.(void 0)):(M(N),m?.(N)))},onMouseMove:U=>{C(N),se(U.clientY),K(U.clientX)},onMouseLeave:()=>{C(void 0),K(void 0),se(void 0),d?.(void 0)},children:[S==="dot"?l.jsx($e.circle,{cy:0,cx:0,variants:{initial:{fill:P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray},whileInView:{fill:P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:ae.duration}},r:o}):l.jsx($e.rect,{x:0-o,y:-1,width:o*2,height:2,variants:{initial:{fill:P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray},whileInView:{fill:P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:ae.duration}}}),g.length!==0&&g.indexOf(N.label)!==-1?l.jsx($e.text,{y:0,dy:"0.33em",x:0+o+3,variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:ae.duration}},style:{fill:q||(P&&g?g.indexOf(N.label)!==-1?P:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray:e.filter(U=>U.color).length===0?r[0]:N.color?r[a.indexOf(N.color)]:Pe.gray),textAnchor:"start",...$?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm font-bold",V?.graphObjectValues),children:qe(N.position,"NA",_,j,w)}):null]},N.label)),ce.map((N,U)=>l.jsx("text",{y:N,x:Z/2+o+5,style:{textAnchor:"start",...$?.yAxis?.labels||{}},className:Ce.cn("fill-primary-gray-550 dark:fill-primary-gray-500 text-xs",V?.yAxis?.labels),children:qe(oe.invert(N),"NA",_,j,w)},U))]}),b.filter(N=>N.position==="after").map(N=>N.layer)]})}),z&&f&&O&&Q?l.jsx(st,{data:z,body:f,xPos:O,yPos:Q,backgroundStyle:$?.tooltip,className:V?.tooltip}):null,x&&A!==void 0?l.jsx(Ce.Modal,{open:A!==void 0,onClose:()=>{M(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof x=="string"?{__html:lt(x,A)}:void 0,children:typeof x=="function"?x(A):null})}):null]})}function KP(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f=5,padding:d,backgroundColor:g=!1,leftMargin:p=20,rightMargin:y=20,topMargin:v=10,bottomMargin:m=10,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S=!0,highlightedDataPoints:P=[],graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,graphDownload:V=!1,dataDownload:q=!1,prefix:ae="",suffix:G="",stripType:_="dot",language:b="en",highlightColor:B,dotOpacity:X=.3,showNAColor:z=!0,minHeight:C=0,theme:A="light",ariaLabel:M,resetSelectionOnDoubleClick:O=!0,detailsOnClick:K,styles:Q,classNames:se,valueColor:T,animate:Z=!1,noOfTicks:ie=2,dimmedOpacity:ue=.3,precision:he=2,customLayers:Y=[]}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(void 0),J=k.useRef(null),R=k.useRef(null);return k.useEffect(()=>{const le=new ResizeObserver(ee=>{oe(s||ee[0].target.clientWidth||620),N(o||ee[0].target.clientHeight||480)});return J.current&&(N(J.current.clientHeight||480),oe(J.current.clientWidth||620),s||le.observe(J.current)),()=>le.disconnect()},[s,o]),l.jsx("div",{className:`${A||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:b==="he"||b==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${b||"en"}`,se?.graphContainer),style:{...Q?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:W,ref:R,"aria-label":M||`${n?`The graph shows ${n}. `:""}This is a strip chart showing distribution of data along the vertical axis. Each dot represents an individual data point, helping to visualize the spread and clustering of values.${a?` ${a}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:g?d||"1rem":d||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||a||V||q?l.jsx(Qe,{styles:{title:Q?.title,description:Q?.description},classNames:{title:se?.title,description:se?.description},graphTitle:n,graphDescription:a,width:s,graphDownload:V?R.current:void 0,dataDownload:q?e.map(le=>le.data).filter(le=>le!==void 0).length>0?e.map(le=>le.data).filter(le=>le!==void 0):e.filter(le=>le!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[S!==!1&&e.filter(le=>le.color).length!==0?l.jsx(tn,{width:s,colorLegendTitle:h,colors:i||Pe[A].categoricalColors.colors,colorDomain:u||Xe(e.filter(le=>le.color),"color").map(le=>le.color),setSelectedColor:ve,showNAColor:z}):null,l.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:J,children:(s||ge)&&(o||ce)?l.jsx(XP,{data:e,width:s||ge,height:Math.max(C,o||(j?C?(s||ge)*j>C?(s||ge)*j:C:(s||ge)*j:ce)),colorDomain:e.filter(le=>le.color).length===0?[]:u||Xe(e.filter(le=>le.color),"color").map(le=>le.color),colors:e.filter(le=>le.color).length===0?i?[i]:[Pe.primaryColors["blue-600"]]:i||Pe[A].categoricalColors.colors,selectedColor:U,radius:f,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,onSeriesMouseOver:w,highlightedDataPoints:P,minValue:D,maxValue:x,onSeriesMouseClick:$,prefix:ae,suffix:G,stripType:_,highlightColor:B,dotOpacity:X,resetSelectionOnDoubleClick:O,detailsOnClick:K,styles:Q,classNames:se,valueColor:T,animate:Z===!0?{duration:.5,once:!0,amount:.5}:Z||{duration:0,once:!0,amount:0},noOfTicks:ie,dimmedOpacity:ue,precision:he,customLayers:Y}):null})]})}),r||c?l.jsx(et,{styles:{footnote:Q?.footnote,source:Q?.source},classNames:{footnote:se?.footnote,source:se?.source},sources:r,footNote:c,width:s}):null]})})})})}function cw(t){const{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f,padding:d,backgroundColor:g,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S,highlightedDataPoints:P,graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,noOfTicks:V,graphDownload:q,dataDownload:ae,prefix:G,suffix:_,stripType:b,language:B,highlightColor:X,dotOpacity:z,showNAColor:C,minHeight:A,theme:M,ariaLabel:O,valueColor:K,resetSelectionOnDoubleClick:Q,detailsOnClick:se,orientation:T="vertical",styles:Z,classNames:ie,animate:ue,dimmedOpacity:he=.3,precision:Y,customLayers:ge}=t;return T==="vertical"?l.jsx(KP,{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f,padding:d,backgroundColor:g,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S,highlightedDataPoints:P,graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,noOfTicks:V,graphDownload:q,dataDownload:ae,prefix:G,suffix:_,stripType:b,language:B,highlightColor:X,dotOpacity:z,showNAColor:C,minHeight:A,theme:M,ariaLabel:O,resetSelectionOnDoubleClick:Q,styles:Z,valueColor:K,detailsOnClick:se,classNames:ie,animate:ue,dimmedOpacity:he,precision:Y,customLayers:ge}):l.jsx(UP,{data:e,graphTitle:n,colors:i,sources:r,graphDescription:a,height:o,width:s,footNote:c,colorDomain:u,colorLegendTitle:h,radius:f,padding:d,backgroundColor:g,leftMargin:p,rightMargin:y,topMargin:v,bottomMargin:m,tooltip:I,relativeHeight:j,onSeriesMouseOver:w,showColorScale:S,highlightedDataPoints:P,graphID:W,minValue:D,maxValue:x,onSeriesMouseClick:$,noOfTicks:V,graphDownload:q,dataDownload:ae,prefix:G,suffix:_,stripType:b,language:B,highlightColor:X,dotOpacity:z,showNAColor:C,minHeight:A,theme:M,ariaLabel:O,resetSelectionOnDoubleClick:Q,styles:Z,valueColor:K,detailsOnClick:se,classNames:ie,animate:ue,dimmedOpacity:he,precision:Y,customLayers:ge})}function QP(t){const{data:e,width:n,height:i,barColor:r,lineColor:a,axisTitles:o,sameAxes:s,rightMargin:c,leftMargin:u,topMargin:h,bottomMargin:f,tooltip:d,showValues:g,onSeriesMouseOver:p,barPadding:y,truncateBy:v,showLabels:m,onSeriesMouseClick:I,resetSelectionOnDoubleClick:j,detailsOnClick:w,noOfTicks:S,lineSuffix:P,barSuffix:W,linePrefix:D,barPrefix:x,curveType:$,styles:V,classNames:q,animate:ae,precision:G,customLayers:_,naLabel:b}=t,B=k.useRef(null),X=ct(B,{once:ae.once,amount:ae.amount}),z=$==="linear"?Oi:$==="step"?Or:$==="stepAfter"?Ir:$==="stepBefore"?Nr:_r,[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z={top:h,bottom:f,left:u+50,right:c+65},ie=n-Z.left-Z.right,ue=i-Z.top-Z.bottom,he=e.map((te,Me)=>({...te,id:`${Me}`})),Y=xn().domain(he.map(te=>`${te.id}`)).range([0,ie]).paddingInner(y),ge=Math.min(...he.map(te=>te.bar).filter(te=>te!=null))!==1/0?Math.min(...he.map(te=>te.bar).filter(te=>te!=null))>0?0:Math.min(...he.map(te=>te.bar).filter(te=>te!=null)):0,oe=Math.min(...he.map(te=>te.line).filter(te=>te!=null))!==1/0?Math.min(...he.map(te=>te.line).filter(te=>te!=null))>0?0:Math.min(...he.map(te=>te.line).filter(te=>te!=null)):0,ce=Math.max(...he.map(te=>te.bar).filter(te=>te!=null))!==1/0?Math.max(...he.map(te=>te.bar).filter(te=>te!=null)):0,N=Math.max(...he.map(te=>te.line).filter(te=>te!=null))!==1/0?Math.max(...he.map(te=>te.line).filter(te=>te!=null)):0,U=ge<oe?ge:oe,ve=ce>N?ce:N,J=ut().domain([s?U:ge,s?ve>0?ve:0:ce>0?ce:0]).range([ue,0]).nice(),R=ut().domain([s?U:oe,s?ve>0?ve:0:N>0?N:0]).range([ue,0]).nice(),le=ii().defined(te=>!je(te.line)).x(te=>Y(`${te.id}`)+Y.bandwidth()/2).y(te=>R(te.line)).curve(z),ee=J.ticks(S),de=R.ticks(S);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:B,children:l.jsxs("g",{transform:`translate(${Z.left},${Z.top})`,children:[l.jsxs("g",{children:[ee.map((te,Me)=>l.jsxs("g",{children:[l.jsx("line",{y1:J(te),y2:J(te),x1:-15,x2:-20,style:{stroke:r,strokeWidth:1,...V?.yAxis?.gridLines||{}},className:q?.yAxis?.gridLines}),l.jsx("text",{x:-25,y:J(te),dy:"0.33em",className:Ce.cn("text-xs",q?.yAxis?.labels),style:{textAnchor:"end",fill:r,...V?.yAxis?.labels||{}},children:qe(te,b,G,x,W)})]},Me)),l.jsx(Dt,{y1:0,y2:ue,x1:-15,x2:-15,classNames:{axis:q?.xAxis?.axis},styles:{axis:{stroke:r,...V?.xAxis?.axis||{}}}}),l.jsx(Nt,{x:10-Z.left,y:ue/2,style:{fill:r,...V?.yAxis?.title||{}},className:q?.yAxis?.title,text:o[0].length>100?`${o[0].substring(0,100)}...`:o[0],rotate90:!0})]}),l.jsxs("g",{children:[de.map((te,Me)=>l.jsxs("g",{children:[l.jsx("line",{y1:R(te),y2:R(te),x1:ie+15,x2:ie+20,style:{stroke:a,strokeWidth:1,...V?.yAxis?.gridLines||{}},className:q?.yAxis?.gridLines}),l.jsx("text",{x:ie+25,y:R(te),dy:"0.33em",dx:-2,style:{textAnchor:"start",fill:a,...V?.yAxis?.labels||{}},className:Ce.cn("text-xs",q?.yAxis?.labels),children:qe(te,b,G,D,P)})]},Me)),l.jsx(Dt,{y1:0,y2:ue,x1:ie+15,x2:ie+15,classNames:{axis:q?.xAxis?.axis},styles:{axis:{stroke:a,...V?.xAxis?.axis||{}}}}),l.jsx(Nt,{x:ie+Z.right-15,y:ue/2,style:{fill:a,...V?.yAxis?.title||{}},className:q?.yAxis?.title,text:o[1].length>100?`${o[1].substring(0,100)}...`:o[1],rotate90:!0})]}),l.jsx(Dt,{y1:s?J(0):ue,y2:s?J(0):ue,x1:-15,x2:ie+15,classNames:{axis:q?.xAxis?.axis},styles:{axis:V?.xAxis?.axis}}),_.filter(te=>te.position==="before").map(te=>te.layer),l.jsxs(mt,{children:[he.map((te,Me)=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:be=>{A(te),T(be.clientY),Q(be.clientX),p?.(te)},onClick:()=>{(I||w)&&(dt(M,te)&&j?(O(void 0),I?.(void 0)):(O(te),I?.(te)))},onMouseMove:be=>{A(te),T(be.clientY),Q(be.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),p?.(void 0)},children:[l.jsx($e.rect,{variants:{initial:{attrY:J(0),height:0,opacity:1},whileInView:{attrY:te.bar?te.bar>0?J(te.bar):J(0):0,height:te.bar?Math.abs(J(te.bar)-J(0)):0,opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{attrY:J(0),height:0,opacity:0,transition:{duration:ae.duration}},x:Y(`${Me}`),width:Y.bandwidth(),style:{fill:r}}),g&&!je(te.bar)?l.jsx($e.text,{x:Y(`${te.id}`)+Y.bandwidth()/2,exit:{attrY:J(0),opacity:0,transition:{duration:ae.duration}},variants:{initial:{attrY:J(0),opacity:0},whileInView:{attrY:J(te.bar||0),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",style:{fill:r,textAnchor:"middle",...V?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",q?.graphObjectValues),dy:te.bar?te.bar>=0?"-5px":"1em":"-5px",children:qe(te.bar,b,G,x,W)}):null,m?l.jsx(ro,{value:`${te.label}`.length<v?`${te.label}`:`${`${te.label}`.substring(0,v)}...`,y:ue+5,x:Y(`${te.id}`),width:Y.bandwidth(),height:Z.bottom,style:V?.xAxis?.labels,className:q?.xAxis?.labels,alignment:"top",animate:ae,isInView:X}):null]},te.label)),l.jsx($e.path,{exit:{opacity:0,transition:{duration:ae.duration}},variants:{initial:{d:le(he.map(te=>({...te,line:0}))),opacity:0},whileInView:{d:le(he),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",style:{stroke:a,fill:"none",strokeWidth:2}}),he.map((te,Me)=>l.jsx("g",{children:je(te.line)?null:l.jsxs("g",{onMouseEnter:be=>{A(te),T(be.clientY),Q(be.clientX),p?.(te)},onClick:()=>{(I||w)&&(dt(M,te)&&j?(O(void 0),I?.(void 0)):(O(te),I?.(te)))},onMouseMove:be=>{A(te),T(be.clientY),Q(be.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),p?.(void 0)},children:[l.jsx($e.circle,{exit:{cy:R(0),opacity:0,transition:{duration:ae.duration}},variants:{initial:{cy:R(0),opacity:0},whileInView:{cy:R(te.line),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",cx:Y(te.id)+Y.bandwidth()/2,r:ie/he.length<5?0:ie/he.length<20?2:4,style:{fill:a}}),g?l.jsx($e.text,{x:Y(`${te.id}`)+Y.bandwidth()/2,exit:{y:R(0),opacity:0,transition:{duration:ae.duration}},style:{fill:a,textAnchor:"middle",...V?.graphObjectValues||{}},variants:{initial:{y:R(0),opacity:0},whileInView:{y:R(te.line),opacity:1,transition:{duration:ae.duration}}},initial:"initial",animate:X?"whileInView":"initial",className:Ce.cn("graph-value text-sm",q?.graphObjectValues),dy:"-5px",children:qe(te.line,b,G,D,P)}):null]})},Me))]}),_.filter(te=>te.position==="after").map(te=>te.layer)]})}),C&&d&&K&&se?l.jsx(st,{data:C,body:d,xPos:K,yPos:se,backgroundStyle:V?.tooltip,className:q?.tooltip}):null,w&&M!==void 0?l.jsx(Ce.Modal,{open:M!==void 0,onClose:()=>{O(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:lt(w,M)}:void 0,children:typeof w=="function"?w(M):null})}):null]})}function uw(t){const{data:e,graphTitle:n,sources:i,graphDescription:r,height:a,width:o,footNote:s,padding:c,lineColor:u=Pe.light.categoricalColors.colors[1],barColor:h=Pe.light.categoricalColors.colors[0],sameAxes:f=!1,backgroundColor:d=!1,leftMargin:g=80,rightMargin:p=80,topMargin:y=20,bottomMargin:v=25,lineAxisTitle:m="Line chart",barAxisTitle:I="Bar graph",tooltip:j,relativeHeight:w,onSeriesMouseOver:S,graphID:P,graphDownload:W=!1,dataDownload:D=!1,barPadding:x=.25,truncateBy:$=999,showLabels:V=!0,onSeriesMouseClick:q,language:ae="en",colorLegendTitle:G,minHeight:_=0,theme:b="light",ariaLabel:B,resetSelectionOnDoubleClick:X=!0,detailsOnClick:z,showValues:C=!0,noOfTicks:A=5,lineSuffix:M="",barSuffix:O="",linePrefix:K="",barPrefix:Q="",curveType:se="curve",styles:T,classNames:Z,animate:ie=!1,precision:ue=2,customLayers:he=[],naLabel:Y="NA"}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),U=k.useRef(null),ve=k.useRef(null);return k.useEffect(()=>{const J=new ResizeObserver(R=>{oe(o||R[0].target.clientWidth||620),N(a||R[0].target.clientHeight||480)});return U.current&&(N(U.current.clientHeight||480),oe(U.current.clientWidth||620),o||J.observe(U.current)),()=>J.disconnect()},[o,a]),l.jsx("div",{className:`${b||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:ae==="he"||ae==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${d?d===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${ae||"en"}`,Z?.graphContainer),style:{...T?.graphContainer||{},...d&&d!==!0?{backgroundColor:d}:{}},id:P,ref:ve,"aria-label":B||`${n?`The graph shows ${n}. `:""}This is a pareto chart that shows a variable as bars and another as line chart.${r?` ${r}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:d?c||"1rem":c||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||r||W||D?l.jsx(Qe,{styles:{title:T?.title,description:T?.description},classNames:{title:Z?.title,description:Z?.description},graphTitle:n,graphDescription:r,width:o,graphDownload:W?ve.current:void 0,dataDownload:D?e.map(J=>J.data).filter(J=>J!==void 0).length>0?e.map(J=>J.data).filter(J=>J!==void 0):e.filter(J=>J!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[l.jsx(Hi,{colorDomain:[I,m],colors:[h||Pe[b].categoricalColors.colors[0],u||Pe[b].categoricalColors.colors[1]],colorLegendTitle:G,showNAColor:!1}),l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:U,"aria-label":"Graph area",children:(o||ge)&&(a||ce)?l.jsx(QP,{data:e,sameAxes:f,lineColor:u,barColor:h,width:o||ge,height:Math.max(_,a||(w?_?(o||ge)*w>_?(o||ge)*w:_:(o||ge)*w:ce)),truncateBy:$,leftMargin:g,rightMargin:p,topMargin:y,bottomMargin:v,axisTitles:[I,m],tooltip:j,onSeriesMouseOver:S,barPadding:x,showLabels:V,onSeriesMouseClick:q,resetSelectionOnDoubleClick:X,detailsOnClick:z,noOfTicks:A,lineSuffix:M,barSuffix:O,linePrefix:K,barPrefix:Q,curveType:se,showValues:C,styles:T,classNames:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0},precision:ue,customLayers:he,naLabel:Y}):null})]})}),i||s?l.jsx(et,{styles:{footnote:T?.footnote,source:T?.source},classNames:{footnote:Z?.footnote,source:Z?.source},sources:i,footNote:s,width:o}):null]})})})})}function ZP(t){const{data:e,width:n,height:i,barColors:r,centerGap:a,refValues:o,maxValue:s,minValue:c,showValues:u,axisTitles:h,rightMargin:f,leftMargin:d,topMargin:g,bottomMargin:p,tooltip:y,onSeriesMouseOver:v,barPadding:m,truncateBy:I,onSeriesMouseClick:j,showTicks:w,suffix:S,prefix:P,resetSelectionOnDoubleClick:W,detailsOnClick:D,styles:x,classNames:$,noOfTicks:V,animate:q,precision:ae,customLayers:G,minValueLeftBar:_,minValueRightBar:b,naLabel:B}=t,X=k.useRef(null),z=ct(X,{once:q.once,amount:q.amount}),[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z={top:g,bottom:p,left:d,right:f},ie=n-Z.left-Z.right,ue=i-Z.top-Z.bottom,he=e.map((U,ve)=>({...U,id:`${ve}`})),Y=xn().domain(he.map(U=>`${U.id}`)).range([ue,0]).paddingInner(m),ge=ut().domain([c,s]).range([0,(ie-a)/2]).nice(),oe=ge.ticks(V),ce=ut().domain([c,s]).range([(ie-a)/2,0]).nice(),N=ce.ticks(V);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n}px`,height:`${i}px`,viewBox:`0 0 ${n} ${i}`,direction:"ltr",ref:X,children:l.jsxs("g",{transform:`translate(${Z.left},${Z.top})`,children:[G.filter(U=>U.position==="before").map(U=>U.layer),l.jsxs("g",{transform:"translate(0,0)",children:[w?l.jsx(Rn,{values:N.filter(U=>U!==0),x:N.filter(U=>U!==0).map(U=>ce(U)),y1:0-g,y2:ue+Z.bottom,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:$?.xAxis?.gridLines,labels:$?.xAxis?.labels},suffix:S,prefix:P,labelType:"secondary",showGridLines:!0,leftLabel:!0,precision:ae}):null,l.jsxs(mt,{children:[he.map((U,ve)=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:J=>{A(U),T(J.clientY),Q(J.clientX),v?.(U)},onClick:()=>{(j||D)&&(dt(M,U)&&W?(O(void 0),j?.(void 0)):(O(U),j?.(U)))},onMouseMove:J=>{A(U),T(J.clientY),Q(J.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),v?.(void 0)},children:[U.leftBar?l.jsx($e.rect,{y:Y(`${ve}`),style:{fill:r[0]},height:Y.bandwidth(),variants:{initial:{x:ce(0),width:0},whileInView:{x:U.leftBar<0?ce(0):ce(U.leftBar),width:U.leftBar<0?ce(U.leftBar)-ce(0):ce(0)-ce(U.leftBar),transition:{duration:q.duration}}},initial:"initial",animate:z?"whileInView":"initial",exit:{x:ce(0),width:0,transition:{duration:q.duration}}}):null,u?l.jsx($e.text,{y:Y(`${ve}`)+Y.bandwidth()/2,style:{fill:r[0],textAnchor:U.rightBar&&U.rightBar>0?"end":"start",...x?.graphObjectValues||{}},dx:U.rightBar&&U.rightBar>0?-5:5,dy:"0.33em",className:Ce.cn("graph-value text-sm",$?.graphObjectValues),exit:{opacity:0,transition:{duration:q.duration}},variants:{initial:{x:ce(0),opacity:0},whileInView:{x:U.leftBar?ce(U.leftBar):ce(_<0?0:_),opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:z?"whileInView":"initial",children:qe(U.rightBar,B,ae,P,S)}):null]},U.label)),l.jsx(Dt,{y1:-2.5,y2:ue+Z.bottom,x1:ce(_<0?0:_),x2:ce(_<0?0:_),classNames:{axis:$?.yAxis?.axis},styles:{axis:x?.yAxis?.axis}}),o?l.jsx(l.Fragment,{children:o.map((U,ve)=>l.jsx(Tr,{text:U.text,color:U.color,x:ce(U.value),y1:0-Z.top,y2:ue+Z.bottom,textSide:"left",classNames:U.classNames,styles:U.styles,animate:q,isInView:z},ve))}):null]})]}),l.jsxs("g",{transform:`translate(${(ie+a)/2},0)`,children:[w?l.jsx(Rn,{values:oe.filter(U=>U!==0),x:oe.filter(U=>U!==0).map(U=>ge(U)),y1:0-g,y2:ue+Z.bottom,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:$?.xAxis?.gridLines,labels:$?.xAxis?.labels},suffix:S,prefix:P,labelType:"secondary",showGridLines:!0,precision:ae}):null,l.jsxs(mt,{children:[he.map((U,ve)=>l.jsxs($e.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:J=>{A(U),T(J.clientY),Q(J.clientX),v?.(U)},onClick:()=>{(j||D)&&(dt(M,U)&&W?(O(void 0),j?.(void 0)):(O(U),j?.(U)))},onMouseMove:J=>{A(U),T(J.clientY),Q(J.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),v?.(void 0)},children:[U.rightBar?l.jsx($e.rect,{y:Y(`${ve}`),style:{fill:r[1]},height:Y.bandwidth(),exit:{x:ge(0),width:0,transition:{duration:q.duration}},variants:{initial:{x:ge(0),width:0},whileInView:{x:U.rightBar>=0?ge(0):ge(U.rightBar),width:U.rightBar>=0?ge(U.rightBar)-ge(0):ge(0)-ge(U.rightBar),transition:{duration:q.duration}}},initial:"initial",animate:z?"whileInView":"initial"}):null,u?l.jsx($e.text,{y:Y(`${ve}`)+Y.bandwidth()/2,style:{fill:r[1],textAnchor:U.rightBar&&U.rightBar<0?"end":"start",...x?.graphObjectValues||{}},className:Ce.cn("graph-value text-sm",$?.graphObjectValues),dx:U.rightBar&&U.rightBar<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:q.duration}},variants:{initial:{x:ge(0),opacity:0},whileInView:{x:U.rightBar?ge(U.rightBar):ge(b<0?0:b),opacity:1,transition:{duration:q.duration}}},initial:"initial",animate:z?"whileInView":"initial",children:qe(U.rightBar,B,ae,P,S)}):null]},ve)),l.jsx(Dt,{y1:-2.5,y2:ue+Z.bottom,x1:ge(b<0?0:b),x2:ge(b<0?0:b),classNames:{axis:$?.yAxis?.axis},styles:{axis:x?.yAxis?.axis}}),o?l.jsx(l.Fragment,{children:o.map((U,ve)=>l.jsx(Tr,{text:U.text,color:U.color,x:ge(U.value),y1:0-Z.top,y2:ue+Z.bottom,textSide:"right",classNames:U.classNames,styles:U.styles,animate:q,isInView:z},ve))}):null]})]}),l.jsx(mt,{children:l.jsx($e.g,{transform:`translate(${ie/2},0)`,children:he.map((U,ve)=>l.jsx(io,{value:`${U.label}`.length<I?`${U.label}`:`${`${U.label}`.substring(0,I)}...`,y:Y(`${U.id}`),x:0-a/2,width:a,height:Y.bandwidth(),alignment:"center",style:x?.yAxis?.labels,className:$?.yAxis?.labels,animate:q,isInView:z},ve))})}),l.jsxs("g",{transform:`translate(0,${ue})`,children:[l.jsx("text",{style:{fill:r[0],textAnchor:"end",...x?.yAxis?.title},className:Ce.cn("text-base",$?.yAxis?.title),x:ie/2-a/2,y:0,dx:-5,dy:20,children:h[0]}),l.jsx("text",{style:{fill:r[1],textAnchor:"start",...x?.yAxis?.title},className:Ce.cn("text-base",$?.yAxis?.title),x:ie/2+a/2,y:0,dx:5,dy:20,children:h[1]})]}),G.filter(U=>U.position==="after").map(U=>U.layer)]})}),C&&y&&K&&se?l.jsx(st,{data:C,body:y,xPos:K,yPos:se,backgroundStyle:x?.tooltip,className:$?.tooltip}):null,D&&M!==void 0?l.jsx(Ce.Modal,{open:M!==void 0,onClose:()=>{O(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof D=="string"?{__html:lt(D,M)}:void 0,children:typeof D=="function"?D(M):null})}):null]})}function xo(t,e,n,i){const r=t.map(s=>s[e]).filter(s=>!je(s)),a=je(n)?Math.min(...r)>=0?0:Math.min(...r):n,o=je(i)?Math.max(...r)<0?0:Math.max(...r):i;return{min:a,max:o}}function hw(t){const{data:e,graphTitle:n,sources:i,graphDescription:r,height:a,width:o,footNote:s,padding:c,barColors:u=[Pe.light.categoricalColors.colors[0],Pe.light.categoricalColors.colors[1]],backgroundColor:h=!1,leftMargin:f=20,rightMargin:d=20,topMargin:g=25,bottomMargin:p=30,rightBarTitle:y="Right bar graph",leftBarTitle:v="Left bar graph",tooltip:m,relativeHeight:I,onSeriesMouseOver:j,graphID:w,barPadding:S=.25,truncateBy:P=999,onSeriesMouseClick:W,centerGap:D=100,showValues:x=!0,maxValue:$,minValue:V,refValues:q=[],suffix:ae="",prefix:G="",showTicks:_=!0,showColorScale:b=!1,graphDownload:B=!1,dataDownload:X=!1,language:z="en",colorLegendTitle:C,minHeight:A=0,theme:M="light",ariaLabel:O,resetSelectionOnDoubleClick:K=!0,detailsOnClick:Q,styles:se,classNames:T,noOfTicks:Z=5,animate:ie=!1,precision:ue=2,customLayers:he=[],timeline:Y={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:ge="NA"}=t,[oe,ce]=k.useState(0),[N,U]=k.useState(0),[ve,J]=k.useState(Y.autoplay),R=di(Xe(e.filter(be=>be.date!==void 0&&be.date!==null),be=>be.date).map(be=>ze(`${be.date}`,Y.dateFormat||"yyyy",new Date).getTime()),(be,ne)=>an(be,ne)),[le,ee]=k.useState(Y.autoplay?0:R.length-1),de=k.useRef(null),te=k.useRef(null);k.useEffect(()=>{const be=new ResizeObserver(ne=>{ce(o||ne[0].target.clientWidth||620),U(a||ne[0].target.clientHeight||480)});return de.current&&(U(de.current.clientHeight||480),ce(de.current.clientWidth||620),o||be.observe(de.current)),()=>be.disconnect()},[o,a]),k.useEffect(()=>{const be=setInterval(()=>{ee(ne=>ne<R.length-1?ne+1:0)},(Y.speed||2)*1e3);return ve||clearInterval(be),()=>clearInterval(be)},[R,ve,Y.speed]);const Me=yi(R,le,Y.showOnlyActiveDate,Y.dateFormat||"yyyy");return l.jsx("div",{className:`${M||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:z==="he"||z==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${z||"en"}`,T?.graphContainer),style:{...se?.graphContainer||{},...h&&h!==!0?{backgroundColor:h}:{}},id:w,ref:te,"aria-label":O||`${n?`The graph shows ${n}. `:""}This is a diverging bar chart. ${r?` ${r}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?c||"1rem":c||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||r||B||X?l.jsx(Qe,{styles:{title:se?.title,description:se?.description},classNames:{title:T?.title,description:T?.description},graphTitle:n,graphDescription:r,width:o,graphDownload:B?te.current:void 0,dataDownload:X?e.map(be=>be.data).filter(be=>be!==void 0).length>0?e.map(be=>be.data).filter(be=>be!==void 0):e.filter(be=>be!==void 0):null}):null,Y.enabled&&R.length>0&&Me?l.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[l.jsx("button",{type:"button",onClick:()=>{J(!ve)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":ve?"Click to pause animation":"Click to play animation",children:ve?l.jsx(mi,{}):l.jsx(pi,{})}),l.jsx(Ce.SliderUI,{min:R[0],max:R[R.length-1],marks:Me,step:null,defaultValue:R[R.length-1],value:R[le],onChangeComplete:be=>{ee(R.indexOf(be))},onChange:be=>{ee(R.indexOf(be))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[b?l.jsx(Hi,{colorLegendTitle:C,colorDomain:[v,y],colors:u,showNAColor:!1}):null,l.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:de,"aria-label":"Graph area",children:(o||oe)&&(a||N)?l.jsx(ZP,{data:Q2(e,Y.dateFormat||"yyyy").filter(be=>Y.enabled?be.date===ft(new Date(R[le]),Y.dateFormat||"yyyy"):be),barColors:u,width:o||oe,centerGap:D,height:Math.max(A,a||(I?A?(o||oe)*I>A?(o||oe)*I:A:(o||oe)*I:N)),truncateBy:P,leftMargin:f,rightMargin:d,topMargin:g,bottomMargin:p,axisTitles:[v,y],tooltip:m,onSeriesMouseOver:j,barPadding:S,refValues:q,maxValue:Math.max(xo(e,"leftBar",V,$).max,xo(e,"rightBar",V,$).max),minValue:Math.min(xo(e,"leftBar",V,$).min,xo(e,"rightBar",V,$).min),minValueLeftBar:xo(e,"leftBar",V,$).min,minValueRightBar:xo(e,"rightBar",V,$).min,showValues:x,onSeriesMouseClick:W,showTicks:_,suffix:ae,prefix:G,resetSelectionOnDoubleClick:K,detailsOnClick:Q,styles:se,classNames:T,noOfTicks:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0},precision:ue,customLayers:he,naLabel:ge}):null})]})}),i||s?l.jsx(et,{styles:{footnote:se?.footnote,source:se?.source},classNames:{footnote:T?.footnote,source:T?.source},sources:i,footNote:s,width:o}):null]})})})})}function fw(t){const{data:e,graphTitle:n,sources:i,graphDescription:r,barPadding:a,showValues:o,showTicks:s,leftMargin:c,rightMargin:u,height:h,width:f,footNote:d,colors:g,padding:p,backgroundColor:y,topMargin:v,bottomMargin:m,showLabels:I,relativeHeight:j,tooltip:w,onSeriesMouseOver:S,refValues:P,graphID:W,maxValue:D,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,numberOfBins:q,truncateBy:ae,graphType:G,barGraphLayout:_,donutStrokeWidth:b,sortData:B,language:X,minHeight:z,theme:C="light",maxBarThickness:A,ariaLabel:M,detailsOnClick:O,styles:K,classNames:Q,precision:se}=t,[T,Z]=k.useState([]);return k.useEffect(()=>{const ue=yC().thresholds(q||10).value(he=>he.value)(e).map(he=>({label:`${he.x0}-${he.x1}`,size:he.length,data:{options:`${he.x0}-${he.x1}`,frequency:he.length}}));Z(ue)},[e,q]),T.length===0?l.jsx("div",{style:{width:`${f}px`,height:`${h}px`,margin:"auto"},children:l.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:l.jsx(Ce.Spinner,{})})}):G==="circlePacking"?l.jsx(td,{colors:g||Pe.graphMainColor,graphTitle:n,graphDescription:r,footNote:d,width:f,height:h,sources:i,leftMargin:c,rightMargin:u,backgroundColor:y,padding:p,topMargin:v,bottomMargin:m,relativeHeight:j,showLabels:I,tooltip:w,onSeriesMouseOver:S,showColorScale:!1,showValues:o,graphID:W,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,data:T,language:X,minHeight:z,theme:C,ariaLabel:M,detailsOnClick:O,styles:K,classNames:Q,precision:se}):G==="treeMap"?l.jsx(Md,{colors:g||Pe.graphMainColor,graphTitle:n,graphDescription:r,footNote:d,width:f,height:h,sources:i,leftMargin:c,rightMargin:u,backgroundColor:y,padding:p,topMargin:v,bottomMargin:m,relativeHeight:j,showLabels:I,tooltip:w,onSeriesMouseOver:S,showColorScale:!1,showValues:o,graphID:W,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,data:T,language:X,minHeight:z,theme:C,ariaLabel:M,detailsOnClick:O,styles:K,classNames:Q,precision:se}):G==="donutChart"?l.jsx(rd,{colors:g||Pe[C].categoricalColors.colors,graphTitle:n,graphDescription:r,footNote:d,radius:f&&h?f<h?f:h:f||h||void 0,sources:i,backgroundColor:y,padding:p,tooltip:w,onSeriesMouseOver:S,graphID:W,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,data:T,strokeWidth:b,showColorScale:!0,sortData:B,language:X,theme:C,ariaLabel:M,detailsOnClick:O,styles:K,classNames:Q,precision:se}):l.jsx(Gf,{colors:g||Pe.graphMainColor,graphTitle:n,graphDescription:r,footNote:d,width:f,height:h,sources:i,leftMargin:c,rightMargin:u,backgroundColor:y,padding:p,topMargin:v,bottomMargin:m,relativeHeight:j,showLabels:I,tooltip:w,onSeriesMouseOver:S,showColorScale:!1,showValues:o,graphID:W,onSeriesMouseClick:x,graphDownload:$,dataDownload:V,data:T,barPadding:a,refValues:P,truncateBy:ae,maxValue:D,showTicks:s,sortData:B,language:X,minHeight:z,theme:C,maxBarThickness:A,ariaLabel:M,orientation:_,detailsOnClick:O,styles:K,classNames:Q,precision:se})}function Km(t,e){let n;if(e===void 0)for(const i of t)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of t)(r=e(r,++i,t))!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}return n}function dw(t,e){let n;if(e===void 0)for(const i of t)i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);else{let i=-1;for(let r of t)(r=e(r,++i,t))!=null&&(n>r||n===void 0&&r>=r)&&(n=r)}return n}function Lu(t,e){let n=0;if(e===void 0)for(let i of t)(i=+i)&&(n+=i);else{let i=-1;for(let r of t)(r=+e(r,++i,t))&&(n+=r)}return n}function JP(t){return t.target.depth}function eE(t,e){return t.sourceLinks.length?t.depth:e-1}function Pu(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?dw(t.sourceLinks,JP)-1:0}function Ol(t){return function(){return t}}function Qm(t,e){return bc(t.source,e.source)||t.index-e.index}function Zm(t,e){return bc(t.target,e.target)||t.index-e.index}function bc(t,e){return t.y0-e.y0}function Eu(t){return t.value}function tE(t){return t.index}function nE(t){return t.nodes}function iE(t){return t.links}function Jm(t,e){const n=t.get(e);if(!n)throw new Error("missing: "+e);return n}function e0({nodes:t}){for(const e of t){let n=e.y0,i=n;for(const r of e.sourceLinks)r.y0=n+r.width/2,n+=r.width;for(const r of e.targetLinks)r.y1=i+r.width/2,i+=r.width}}function Vu(){let t=0,e=0,n=1,i=1,r=24,a=8,o,s=tE,c=eE,u,h,f=nE,d=iE,g=6;function p(){const _={nodes:f.apply(null,arguments),links:d.apply(null,arguments)};return y(_),v(_),m(_),I(_),S(_),e0(_),_}p.update=function(_){return e0(_),_},p.nodeId=function(_){return arguments.length?(s=typeof _=="function"?_:Ol(_),p):s},p.nodeAlign=function(_){return arguments.length?(c=typeof _=="function"?_:Ol(_),p):c},p.nodeSort=function(_){return arguments.length?(u=_,p):u},p.nodeWidth=function(_){return arguments.length?(r=+_,p):r},p.nodePadding=function(_){return arguments.length?(a=o=+_,p):a},p.nodes=function(_){return arguments.length?(f=typeof _=="function"?_:Ol(_),p):f},p.links=function(_){return arguments.length?(d=typeof _=="function"?_:Ol(_),p):d},p.linkSort=function(_){return arguments.length?(h=_,p):h},p.size=function(_){return arguments.length?(t=e=0,n=+_[0],i=+_[1],p):[n-t,i-e]},p.extent=function(_){return arguments.length?(t=+_[0][0],n=+_[1][0],e=+_[0][1],i=+_[1][1],p):[[t,e],[n,i]]},p.iterations=function(_){return arguments.length?(g=+_,p):g};function y({nodes:_,links:b}){for(const[X,z]of _.entries())z.index=X,z.sourceLinks=[],z.targetLinks=[];const B=new Map(_.map((X,z)=>[s(X,z,_),X]));for(const[X,z]of b.entries()){z.index=X;let{source:C,target:A}=z;typeof C!="object"&&(C=z.source=Jm(B,C)),typeof A!="object"&&(A=z.target=Jm(B,A)),C.sourceLinks.push(z),A.targetLinks.push(z)}if(h!=null)for(const{sourceLinks:X,targetLinks:z}of _)X.sort(h),z.sort(h)}function v({nodes:_}){for(const b of _)b.value=b.fixedValue===void 0?Math.max(Lu(b.sourceLinks,Eu),Lu(b.targetLinks,Eu)):b.fixedValue}function m({nodes:_}){const b=_.length;let B=new Set(_),X=new Set,z=0;for(;B.size;){for(const C of B){C.depth=z;for(const{target:A}of C.sourceLinks)X.add(A)}if(++z>b)throw new Error("circular link");B=X,X=new Set}}function I({nodes:_}){const b=_.length;let B=new Set(_),X=new Set,z=0;for(;B.size;){for(const C of B){C.height=z;for(const{source:A}of C.targetLinks)X.add(A)}if(++z>b)throw new Error("circular link");B=X,X=new Set}}function j({nodes:_}){const b=Km(_,z=>z.depth)+1,B=(n-t-r)/(b-1),X=new Array(b);for(const z of _){const C=Math.max(0,Math.min(b-1,Math.floor(c.call(null,z,b))));z.layer=C,z.x0=t+C*B,z.x1=z.x0+r,X[C]?X[C].push(z):X[C]=[z]}if(u)for(const z of X)z.sort(u);return X}function w(_){const b=dw(_,B=>(i-e-(B.length-1)*o)/Lu(B,Eu));for(const B of _){let X=e;for(const z of B){z.y0=X,z.y1=X+z.value*b,X=z.y1+o;for(const C of z.sourceLinks)C.width=C.value*b}X=(i-X+o)/(B.length+1);for(let z=0;z<B.length;++z){const C=B[z];C.y0+=X*(z+1),C.y1+=X*(z+1)}q(B)}}function S(_){const b=j(_);o=Math.min(a,(i-e)/(Km(b,B=>B.length)-1)),w(b);for(let B=0;B<g;++B){const X=Math.pow(.99,B),z=Math.max(1-X,(B+1)/g);W(b,X,z),P(b,X,z)}}function P(_,b,B){for(let X=1,z=_.length;X<z;++X){const C=_[X];for(const A of C){let M=0,O=0;for(const{source:Q,value:se}of A.targetLinks){let T=se*(A.layer-Q.layer);M+=ae(Q,A)*T,O+=T}if(!(O>0))continue;let K=(M/O-A.y0)*b;A.y0+=K,A.y1+=K,V(A)}u===void 0&&C.sort(bc),D(C,B)}}function W(_,b,B){for(let X=_.length,z=X-2;z>=0;--z){const C=_[z];for(const A of C){let M=0,O=0;for(const{target:Q,value:se}of A.sourceLinks){let T=se*(Q.layer-A.layer);M+=G(A,Q)*T,O+=T}if(!(O>0))continue;let K=(M/O-A.y0)*b;A.y0+=K,A.y1+=K,V(A)}u===void 0&&C.sort(bc),D(C,B)}}function D(_,b){const B=_.length>>1,X=_[B];$(_,X.y0-o,B-1,b),x(_,X.y1+o,B+1,b),$(_,i,_.length-1,b),x(_,e,0,b)}function x(_,b,B,X){for(;B<_.length;++B){const z=_[B],C=(b-z.y0)*X;C>1e-6&&(z.y0+=C,z.y1+=C),b=z.y1+o}}function $(_,b,B,X){for(;B>=0;--B){const z=_[B],C=(z.y1-b)*X;C>1e-6&&(z.y0-=C,z.y1-=C),b=z.y0-o}}function V({sourceLinks:_,targetLinks:b}){if(h===void 0){for(const{source:{sourceLinks:B}}of b)B.sort(Zm);for(const{target:{targetLinks:B}}of _)B.sort(Qm)}}function q(_){if(h===void 0)for(const{sourceLinks:b,targetLinks:B}of _)b.sort(Zm),B.sort(Qm)}function ae(_,b){let B=_.y0-(_.sourceLinks.length-1)*o/2;for(const{target:X,width:z}of _.sourceLinks){if(X===b)break;B+=z+o}for(const{source:X,width:z}of b.targetLinks){if(X===_)break;B-=z}return B}function G(_,b){let B=b.y0-(b.targetLinks.length-1)*o/2;for(const{source:X,width:z}of b.targetLinks){if(X===_)break;B+=z+o}for(const{target:X,width:z}of _.sourceLinks){if(X===b)break;B-=z}return B}return p}var Eh=Math.PI,Vh=2*Eh,Va=1e-6,rE=Vh-Va;function Fh(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function gw(){return new Fh}Fh.prototype=gw.prototype={constructor:Fh,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+a)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var a=this._x1,o=this._y1,s=n-t,c=i-e,u=a-t,h=o-e,f=u*u+h*h;if(r<0)throw new Error("negative radius: "+r);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>Va)if(!(Math.abs(h*s-c*u)>Va)||!r)this._+="L"+(this._x1=t)+","+(this._y1=e);else{var d=n-a,g=i-o,p=s*s+c*c,y=d*d+g*g,v=Math.sqrt(p),m=Math.sqrt(f),I=r*Math.tan((Eh-Math.acos((p+f-y)/(2*v*m)))/2),j=I/m,w=I/v;Math.abs(j-1)>Va&&(this._+="L"+(t+j*u)+","+(e+j*h)),this._+="A"+r+","+r+",0,0,"+ +(h*d>u*g)+","+(this._x1=t+w*s)+","+(this._y1=e+w*c)}},arc:function(t,e,n,i,r,a){t=+t,e=+e,n=+n,a=!!a;var o=n*Math.cos(i),s=n*Math.sin(i),c=t+o,u=e+s,h=1^a,f=a?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);this._x1===null?this._+="M"+c+","+u:(Math.abs(this._x1-c)>Va||Math.abs(this._y1-u)>Va)&&(this._+="L"+c+","+u),n&&(f<0&&(f=f%Vh+Vh),f>rE?this._+="A"+n+","+n+",0,1,"+h+","+(t-o)+","+(e-s)+"A"+n+","+n+",0,1,"+h+","+(this._x1=c)+","+(this._y1=u):f>Va&&(this._+="A"+n+","+n+",0,"+ +(f>=Eh)+","+h+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};function t0(t){return function(){return t}}function aE(t){return t[0]}function oE(t){return t[1]}var sE=Array.prototype.slice;function lE(t){return t.source}function cE(t){return t.target}function uE(t){var e=lE,n=cE,i=aE,r=oE,a=null;function o(){var s,c=sE.call(arguments),u=e.apply(this,c),h=n.apply(this,c);if(a||(a=s=gw()),t(a,+i.apply(this,(c[0]=u,c)),+r.apply(this,c),+i.apply(this,(c[0]=h,c)),+r.apply(this,c)),s)return a=null,s+""||null}return o.source=function(s){return arguments.length?(e=s,o):e},o.target=function(s){return arguments.length?(n=s,o):n},o.x=function(s){return arguments.length?(i=typeof s=="function"?s:t0(+s),o):i},o.y=function(s){return arguments.length?(r=typeof s=="function"?s:t0(+s),o):r},o.context=function(s){return arguments.length?(a=s??null,o):a},o}function hE(t,e,n,i,r){t.moveTo(e,n),t.bezierCurveTo(e=(e+i)/2,n,e,r,i,r)}function fE(){return uE(hE)}function dE(t){return[t.source.x1,t.y0]}function gE(t){return[t.target.x0,t.y1]}function pE(){return fE().source(dE).target(gE)}function mE(t){const{data:e,showLabels:n,leftMargin:i,rightMargin:r,truncateBy:a,width:o,height:s,topMargin:c,bottomMargin:u,tooltip:h,onSeriesMouseOver:f,suffix:d,prefix:g,showValues:p,onSeriesMouseClick:y,nodePadding:v,nodeWidth:m,id:I,highlightedSourceDataPoints:j,highlightedTargetDataPoints:w,defaultLinkOpacity:S,sourceTitle:P,targetTitle:W,animate:D,sortNodes:x,resetSelectionOnDoubleClick:$,detailsOnClick:V,styles:q,classNames:ae,precision:G,customLayers:_}=t,b=k.useRef(null),B=ct(b,{once:D.once,amount:D.amount}),[X,z]=k.useState(void 0),[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z={top:c,bottom:u,left:i,right:r},ie=o-Z.left-Z.right,ue=s-Z.top-Z.bottom,he=x==="mostReadable"?Vu().nodeWidth(m).nodePadding(v).size([ie,ue]).nodeAlign(Pu):x==="none"?Vu().nodeWidth(m).nodePadding(v).size([ie,ue]).nodeAlign(Pu).nodeSort(()=>null).linkSort(()=>null):Vu().nodeWidth(m).nodePadding(v).size([ie,ue]).nodeAlign(Pu).nodeSort(x==="desc"?(ce,N)=>(N.value||0)-(ce.value||0):(ce,N)=>(ce.value||0)-(N.value||0)),{nodes:Y,links:ge}=he(e),oe=pE();return l.jsxs(l.Fragment,{children:[l.jsxs($e.svg,{width:`${o}px`,height:`${s}px`,viewBox:`0 0 ${o} ${s}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:b,children:[P?l.jsx("text",{x:Z.left,y:Z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"start"},children:P}):null,W?l.jsx("text",{x:o-Z.right,y:Z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"end"},children:W}):null,l.jsxs("g",{transform:`translate(${Z.left},${Z.top})`,children:[_.filter(ce=>ce.position==="before").map(ce=>ce.layer),Y.filter(ce=>ce.type==="source").map((ce,N)=>l.jsx("g",{onMouseEnter:()=>{O(ce)},onMouseLeave:()=>{O(void 0)},children:l.jsxs("g",{transform:`translate(${ce.x0},${ce.y0})`,children:[l.jsx("rect",{x:0,y:0,width:(ce.x1||0)-(ce.x0||0),height:(ce.y1||0)-(ce.y0||0),style:{fill:ce.color}}),n||p?l.jsx("foreignObject",{y:0-v/2,x:0-i,width:i,height:(ce.y1||0)-(ce.y0||0)+v,children:l.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(ce.y1||0)-(ce.y0||0)+v}px`,overflow:"visible"},children:[n?l.jsx(Ce.P,{marginBottom:p?"3xs":"none",size:"sm",leading:"none",className:Ce.cn("sankey-right-label text-right",ae?.graphObjectValues),style:{hyphens:"auto",color:ce.color,...q?.graphObjectValues},children:`${ce.label}`.length<a?`${ce.label}`:`${`${ce.label}`.substring(0,a)}...`}):null,p?l.jsx(Ce.P,{marginBottom:"none",size:"sm",leading:"none",className:Ce.cn("sankey-right-value text-right font-bold",ae?.graphObjectValues),style:{hyphens:"auto",color:ce.color,...q?.graphObjectValues},children:qe(ce.value,"NA",G,g,d)}):null]})}):null]})},N)),Y.filter(ce=>ce.type==="target").map((ce,N)=>l.jsx("g",{onMouseEnter:()=>{O(ce)},onMouseLeave:()=>{O(void 0)},children:l.jsxs("g",{transform:`translate(${ce.x0},${ce.y0})`,children:[l.jsx("rect",{x:0,y:0,width:(ce.x1||0)-(ce.x0||0),height:(ce.y1||0)-(ce.y0||0),style:{fill:ce.color}}),n||p?l.jsx("foreignObject",{y:0-v/2,x:m,width:r-m,height:(ce.y1||0)-(ce.y0||0)+v,children:l.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(ce.y1||0)-(ce.y0||0)+v}px`},children:[n?l.jsx(Ce.P,{marginBottom:p?"3xs":"none",size:"sm",leading:"none",className:Ce.cn("sankey-left-label text-left",ae?.graphObjectValues),style:{hyphens:"auto",color:ce.color,...q?.graphObjectValues},children:`${ce.label}`.length<a?`${ce.label}`:`${`${ce.label}`.substring(0,a)}...`}):null,p?l.jsx(Ce.P,{size:"sm",leading:"none",marginBottom:"none",className:Ce.cn("sankey-left-value text-left font-bold",ae?.graphObjectValues),style:{hyphens:"auto",color:ce.color,...q?.graphObjectValues},children:qe(ce.value,"NA",G,g,d)}):null]})}):null]})},N)),l.jsx("defs",{children:ge.map((ce,N)=>l.jsxs("linearGradient",{id:`${I}-gradient-${N}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",gradientUnits:"userSpaceOnUse",children:[l.jsx("stop",{offset:"0%",style:{stopColor:ce.source.color,stopOpacity:1}}),l.jsx("stop",{offset:"100%",style:{stopColor:ce.target.color,stopOpacity:1}})]},N))}),l.jsx("g",{children:l.jsx(mt,{children:ge.map((ce,N)=>l.jsx($e.g,{className:"undp-viz-g-with-hover",onMouseEnter:U=>{z(ce.data),T(U.clientY),Q(U.clientX),f?.(ce)},onMouseMove:U=>{z(ce.data),T(U.clientY),Q(U.clientX)},onClick:()=>{(y||V)&&(dt(C,ce.data)&&$?(A(void 0),y?.(void 0)):(A(ce.data),y?.(ce.data)))},onMouseLeave:()=>{z(void 0),Q(void 0),T(void 0),f?.(void 0)},variants:{initial:{opacity:M?ce.source.name===M.name||ce.target.name===M.name?.85:S:(j.length!==0||w.length!==0)&&(j.indexOf(ce.source.label)!==-1||w.indexOf(ce.target.label)!==-1)?.85:S},whileInView:{opacity:M?ce.source.name===M.name||ce.target.name===M.name?.85:S:(j.length!==0||w.length!==0)&&(j.indexOf(ce.source.label)!==-1||w.indexOf(ce.target.label)!==-1)?.85:S,transition:{duration:D.duration}}},initial:"initial",animate:B?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:l.jsx($e.path,{d:oe(ce)||"",style:{stroke:`url(#${I}-gradient-${N})`,strokeWidth:ce.width,fill:"none"},exit:{opacity:0,transition:{duration:D.duration}},variants:{initial:{pathLength:0,opacity:1},whileInView:{pathLength:1,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:B?"whileInView":"initial"},`${ce.source}-${ce.target}`)},`${ce.source}-${ce.target}`))})}),_.filter(ce=>ce.position==="after").map(ce=>ce.layer)]})]}),X&&h&&K&&se?l.jsx(st,{data:X,body:h,xPos:K,yPos:se,backgroundStyle:q?.tooltip,className:ae?.tooltip}):null,V&&C!==void 0?l.jsx(Ce.Modal,{open:C!==void 0,onClose:()=>{A(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof V=="string"?{__html:lt(V,C)}:void 0,children:typeof V=="function"?V(C):null})}):null]})}function pw(t){const{data:e,graphTitle:n,sources:i,graphDescription:r,showLabels:a=!0,leftMargin:o=75,rightMargin:s=75,topMargin:c=30,bottomMargin:u=10,truncateBy:h=999,height:f,width:d,footNote:g,padding:p,backgroundColor:y,tooltip:v,onSeriesMouseOver:m,suffix:I="",prefix:j="",relativeHeight:w,showValues:S=!0,graphID:P,onSeriesMouseClick:W,graphDownload:D=!1,dataDownload:x=!1,fillContainer:$=!0,language:V="en",minHeight:q=0,theme:ae="light",ariaLabel:G,sourceColors:_,targetColors:b,sourceColorDomain:B,targetColorDomain:X,nodePadding:z=5,nodeWidth:C=5,highlightedSourceDataPoints:A=[],highlightedTargetDataPoints:M=[],defaultLinkOpacity:O=.3,sourceTitle:K,targetTitle:Q,sortNodes:se="mostReadable",resetSelectionOnDoubleClick:T=!0,detailsOnClick:Z,styles:ie,classNames:ue,animate:he=!1,precision:Y=2,customLayers:ge=[]}=t,[oe,ce]=k.useState(0),[N,U]=k.useState(0),[ve,J]=k.useState(void 0),R=k.useRef(null),le=k.useRef(null);return k.useEffect(()=>{const ee=Xe(e,"source").map(ne=>({name:`source_${ne.source}`,type:"source",label:`${ne.source}`,color:typeof _=="string"||!_?_||Pe.graphMainColor:_[(B||Xe(e,"source").map(De=>`${De.source}`)).findIndex(De=>`${De}`==`${ne.source}`)>_.length?_.length-1:(B||Xe(e,"source").map(De=>`${De.source}`)).findIndex(De=>`${De}`==`${ne.source}`)],totalValue:rt(e.filter(De=>`${De.source}`==`${ne.source}`).map(De=>De.value))})),de=se==="asc"?tt(ee,ne=>ne.totalValue):se==="desc"?tt(ee,ne=>ne.totalValue).reverse():ee,te=Xe(e,"target").map(ne=>({name:`target_${ne.target}`,type:"target",label:`${ne.target}`,color:typeof b=="string"||!b?b||Pe.graphMainColor:b[(X||Xe(e,"target").map(De=>`${De.target}`)).findIndex(De=>`${De}`==`${ne.target}`)>b.length?b.length-1:(X||Xe(e,"target").map(De=>`${De.target}`)).findIndex(De=>`${De}`==`${ne.target}`)],totalValue:rt(e.filter(De=>`${De.target}`==`${ne.target}`).map(De=>De.value))})),Me=se==="asc"?tt(te,ne=>ne.totalValue):se==="desc"?tt(te,ne=>ne.totalValue).reverse():te,be=[...de,...Me];J({nodes:be,links:e.map(ne=>({source:be.findIndex(De=>De.name===`source_${ne.source}`),target:be.findIndex(De=>De.name===`target_${ne.target}`),value:ne.value,data:{...ne}}))})},[e,se,B,_,X,b]),k.useEffect(()=>{const ee=new ResizeObserver(de=>{ce(d||de[0].target.clientWidth||620),U(f||de[0].target.clientHeight||480)});return R.current&&(U(R.current.clientHeight||480),ce(R.current.clientWidth||620),d||ee.observe(R.current)),()=>ee.disconnect()},[d,f]),l.jsx("div",{className:`${ae||"light"} flex ${d?"grow-0":"grow"} ${$?"w-full":"w-fit"} `,dir:V==="he"||V==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${y?y===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${V||"en"}`,ue?.graphContainer),style:{...ie?.graphContainer||{},...y&&y!==!0?{backgroundColor:y}:{}},id:P,ref:le,"aria-label":G||`${n?`The graph shows ${n}. `:""}This is a sankey chart showing flow. ${r?` ${r}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:y?p||"1rem":p||0},children:l.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[n||r||D||x?l.jsx(Qe,{styles:{title:ie?.title,description:ie?.description},classNames:{title:ue?.title,description:ue?.description},graphTitle:n,graphDescription:r,width:d,graphDownload:D?le.current:void 0,dataDownload:x?e.map(ee=>ee.data).filter(ee=>ee!==void 0).length>0?e.map(ee=>ee.data).filter(ee=>ee!==void 0):e.filter(ee=>ee!==void 0):null}):null,l.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:e.length===0?l.jsx(xt,{}):l.jsx("div",{className:"flex flex-col grow justify-center gap-3 w-full leading-0",ref:R,"aria-label":"Graph area",children:(d||oe)&&(f||N)&&ve?l.jsx(mE,{data:ve,width:d||oe,nodePadding:z,nodeWidth:C,height:Math.max(q,f||(w?q?(d||oe)*w>q?(d||oe)*w:q:(d||oe)*w:N)),showLabels:a,leftMargin:o,rightMargin:s,topMargin:c,bottomMargin:u,truncateBy:h,tooltip:v,onSeriesMouseOver:m,showValues:S,suffix:I,prefix:j,onSeriesMouseClick:W,id:rl(8),highlightedSourceDataPoints:A.map(ee=>`${ee}`),highlightedTargetDataPoints:M.map(ee=>`${ee}`),defaultLinkOpacity:O,sourceTitle:K,targetTitle:Q,sortNodes:se,resetSelectionOnDoubleClick:T,styles:ie,classNames:ue,detailsOnClick:Z,animate:he===!0?{duration:.5,once:!0,amount:.5}:he||{duration:0,once:!0,amount:0},precision:Y,customLayers:ge}):null})}),i||g?l.jsx(et,{styles:{footnote:ie?.footnote,source:ie?.source},classNames:{footnote:ue?.footnote,source:ue?.source},sources:i,footNote:g,width:d}):null]})})})})}function yE(t){const{data:e,radius:n,lineColors:i,tooltip:r,onSeriesMouseOver:a,onSeriesMouseClick:o,colorDomain:s,detailsOnClick:c,styles:u,classNames:h,selectedColor:f,axisLabels:d,strokeWidth:g,showValues:p,showDots:y,rightMargin:v,topMargin:m,bottomMargin:I,leftMargin:j,curveType:w,noOfTicks:S,minValue:P,maxValue:W,resetSelectionOnDoubleClick:D,fillShape:x,highlightedLines:$,animate:V,dimmedOpacity:q,precision:ae,customLayers:G}=t,_=k.useRef(null),b=ct(_,{once:V.once,amount:V.amount}),B=w==="linear"?gO:dO,X={top:m,left:j},z=Math.min((2*n-j-v)/2,(2*n-m-I)/2),[C,A]=k.useState(void 0),[M,O]=k.useState(void 0),[K,Q]=k.useState(void 0),[se,T]=k.useState(void 0),Z=ut().domain([0,e[0].values.length]).range([0,2*Math.PI]),ie=je(W)?Math.max(...e.map(oe=>Math.max(...oe.values.filter(ce=>!je(ce)))))<0?0:Math.max(...e.map(oe=>Math.max(...oe.values.filter(ce=>!je(ce))))):W,ue=je(P)?Math.min(...e.map(oe=>Math.min(...oe.values.filter(ce=>!je(ce)))))>=0?0:Math.min(...e.map(oe=>Math.min(...oe.values.filter(ce=>!je(ce))))):P,he=ut().domain([ue,ie]).range([0,z]).nice(),Y=he.ticks(S),ge=fO().radius(oe=>he(oe)).angle((oe,ce)=>Z(ce)).curve(B);return l.jsxs(l.Fragment,{children:[l.jsx($e.svg,{width:`${n*2}px`,height:`${n*2}px`,viewBox:`0 0 ${n*2} ${n*2}`,direction:"ltr",ref:_,children:l.jsxs("g",{transform:`translate(${X.left},${X.top})`,children:[G.filter(oe=>oe.position==="before").map(oe=>oe.layer),l.jsxs("g",{transform:`translate(${z},${z})`,children:[d.map((oe,ce)=>l.jsxs("g",{children:[l.jsx("line",{x1:0,y1:0,x2:Math.cos(Z(ce)-Math.PI/2)*z,y2:Math.sin(Z(ce)-Math.PI/2)*z,className:Ce.cn("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",h?.xAxis?.axis),style:u?.xAxis?.axis},ce),l.jsx("text",{x:Math.cos(Z(ce)-Math.PI/2)*(z+6),y:Math.sin(Z(ce)-Math.PI/2)*(z+6),style:{textAnchor:Math.cos(Z(ce)-Math.PI/2)<0?"end":Math.cos(Z(ce)-Math.PI/2)<1e-5?"middle":"start",...u?.xAxis?.labels||""},dy:Math.sin(Z(ce)-Math.PI/2)<0?0:Math.sin(Z(ce)-Math.PI/2)<1e-5?5:10,className:Ce.cn("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",h?.xAxis?.labels),children:oe})]},ce)),Y.map((oe,ce)=>l.jsxs("g",{children:[l.jsx("path",{d:ge(Array(d.length).fill(oe))||"",className:Ce.cn("stroke-primary-gray-500 dark:stroke-primary-gray-550",h?.xAxis?.gridLines),style:{...u?.xAxis?.gridLines,fill:"none"}}),l.jsx("foreignObject",{x:-25,y:Math.sin(-Math.PI/2)*he(oe)>-1e-4?Math.sin(-Math.PI/2)*he(oe)-7:Math.sin(-Math.PI/2)*he(oe)-5,width:50,height:12,children:l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:Ce.cn("fill-primary-gray-500 dark:fill-primary-gray-550 text-xs m-0 py-0 px-1.5 text-center leading-none bg-primary-white dark:bg-primary-gray-700",h?.xAxis?.labels),style:u?.xAxis?.labels,children:qe(oe,"NA",ae)})})})]},ce)),l.jsx(mt,{children:e.map((oe,ce)=>l.jsxs($e.g,{variants:{initial:{opacity:C?oe.label===C.label?1:q:f?oe.color&&i[s.indexOf(oe.color)]===f?1:q:$.length!==0?oe.label&&$.indexOf(oe.label)!==-1?1:.3:1},whileInView:{opacity:C?oe.label===C.label?1:q:f?oe.color&&i[s.indexOf(oe.color)]===f?1:q:$.length!==0?oe.label&&$.indexOf(oe.label)!==-1?1:q:1,transition:{duration:V.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:V.duration}},onMouseEnter:N=>{A(oe),T(N.clientY),Q(N.clientX),a?.(oe)},onMouseMove:N=>{A(oe),T(N.clientY),Q(N.clientX)},onMouseLeave:()=>{A(void 0),Q(void 0),T(void 0),a?.(void 0)},onClick:()=>{(o||c)&&(dt(M,oe)&&D?(O(void 0),o?.(void 0)):(O(oe),o?.(oe)))},children:[l.jsx($e.path,{d:ge(oe.values)||"",variants:{initial:{d:ge(oe.values.map(N=>0))||""},whileInView:{d:ge(oe.values)||"",transition:{duration:V.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:V.duration}},style:{stroke:e.filter(N=>N.color).length===0?i[0]:oe.color?i[s.indexOf(oe.color)]:Pe.gray,fill:x?e.filter(N=>N.color).length===0?i[0]:oe.color?i[s.indexOf(oe.color)]:Pe.gray:"none",fillOpacity:.1,strokeWidth:g}}),l.jsx("g",{children:oe.values.map((N,U)=>l.jsx("g",{children:je(N)?null:l.jsxs(l.Fragment,{children:[y?l.jsx($e.circle,{cx:Math.cos(Z(U)-Math.PI/2)*he(N),cy:Math.sin(Z(U)-Math.PI/2)*he(N),r:4,style:{fill:e.filter(ve=>ve.color).length===0?i[0]:oe.color?i[s.indexOf(oe.color)]:Pe.gray},variants:{initial:{cx:0,cy:0,opacity:0},whileInView:{cx:Math.cos(Z(U)-Math.PI/2)*he(N),cy:Math.sin(Z(U)-Math.PI/2)*he(N),opacity:1,transition:{duration:V.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:V.duration}}}):null,p?l.jsx($e.text,{x:Math.cos(Z(U)-Math.PI/2)*(he(N)+6),y:Math.sin(Z(U)-Math.PI/2)*(he(N)+6),style:{fill:i[ce],textAnchor:Math.cos(Z(U)-Math.PI/2)<0?"end":Math.cos(Z(U)-Math.PI/2)<1e-5?"middle":"start",...u?.graphObjectValues||{}},dy:Math.sin(Z(U)-Math.PI/2)<0?10:(Math.sin(Z(U)-Math.PI/2)<1e-5,0),className:Ce.cn("graph-value text-xs font-bold",h?.graphObjectValues),variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:V.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:V.duration}},children:qe(N,"NA",ae)}):null]})},U))})]},oe.label||ce))})]}),G.filter(oe=>oe.position==="after").map(oe=>oe.layer)]})}),C&&r&&K&&se?l.jsx(st,{data:C,body:r,xPos:K,yPos:se,backgroundStyle:u?.tooltip,className:h?.tooltip}):null,c&&M!==void 0?l.jsx(Ce.Modal,{open:M!==void 0,onClose:()=>{O(void 0)},children:l.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof c=="string"?{__html:lt(c,M)}:void 0,children:typeof c=="function"?c(M):null})}):null]})}function mw(t){const{graphTitle:e,colors:n,sources:i,graphDescription:r,footNote:a,radius:o,data:s,showColorScale:c=!0,padding:u,backgroundColor:h=!1,tooltip:f,onSeriesMouseOver:d,graphID:g,onSeriesMouseClick:p,topMargin:y=75,bottomMargin:v=75,leftMargin:m=75,rightMargin:I=75,graphDownload:j=!1,dataDownload:w=!1,colorDomain:S,language:P="en",theme:W="light",highlightedLines:D=[],width:x,height:$,minHeight:V=0,strokeWidth:q=2,relativeHeight:ae,ariaLabel:G,colorLegendTitle:_,detailsOnClick:b,styles:B,classNames:X,showNAColor:z=!0,axisLabels:C,showDots:A=!0,showValues:M=!1,curveType:O="curve",noOfTicks:K=5,minValue:Q,maxValue:se,fillShape:T=!1,resetSelectionOnDoubleClick:Z=!0,animate:ie=!1,dimmedOpacity:ue=.3,precision:he=2,customLayers:Y=[]}=t,[ge,oe]=k.useState(0),[ce,N]=k.useState(0),[U,ve]=k.useState(0),[J,R]=k.useState(void 0),le=k.useRef(null),ee=k.useRef(null);return k.useEffect(()=>{const de=new ResizeObserver(te=>{N(x||te[0].target.clientWidth||420),ve($||te[0].target.clientHeight||420),oe((Math.min(x||te[0].target.clientWidth||620,$||te[0].target.clientHeight||480)||420)/2)});return le.current&&(ve(le.current.clientHeight||420),N(le.current.clientWidth||420),oe((Math.min(le.current.clientWidth,le.current.clientHeight)||420)/2),(!x||!o)&&de.observe(le.current)),()=>de.disconnect()},[x,$,o]),l.jsx("div",{className:`${W||"light"} flex ${x?"w-fit grow-0":"w-full grow"}`,dir:P==="he"||P==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${h?h===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${P||"en"}`,X?.graphContainer),style:{...B?.graphContainer||{},minHeight:"inherit",...h&&h!==!0?{backgroundColor:h}:{}},id:g,ref:ee,"aria-label":G||`${e?`The graph shows ${e}. `:""}This is a donut or pie chart chart. ${r?` ${r}`:""}`,children:l.jsx("div",{className:"flex grow",style:{padding:h?u||"1rem":u||0},children:l.jsxs("div",{className:"flex flex-col gap-2 w-full grow justify-between",children:[e||r||j||w?l.jsx(Qe,{styles:{title:B?.title,description:B?.description},classNames:{title:X?.title,description:X?.description},graphTitle:e,graphDescription:r,width:x,graphDownload:j?ee.current:void 0,dataDownload:w?s.map(de=>de.data).filter(de=>de!==void 0).length>0?s.map(de=>de.data).filter(de=>de!==void 0):s.filter(de=>de!==void 0):null}):null,l.jsx("div",{className:"flex grow flex-col justify-center items-stretch gap-8 flex-wrap",style:{width:x?`${x}px`:"100%"},children:s.length===0?l.jsx(xt,{}):l.jsxs(l.Fragment,{children:[c&&s.filter(de=>de.color).length!==0?l.jsx(tn,{width:x,colorLegendTitle:_,colors:n||Pe[W].categoricalColors.colors,colorDomain:S||Xe(s.filter(de=>de.color),"color").map(de=>de.color),setSelectedColor:R,showNAColor:z}):null,l.jsx("div",{className:`flex ${x?"grow-0":"grow"} items-center justify-center leading-0`,style:{width:x?`${x}px`:"100%",height:$?`${Math.max(V,$||(ae?V?(x||ce)*ae>V?(x||ce)*ae:V:(x||ce)*ae:U))}px`:"auto"},ref:le,"aria-label":"Graph area",children:l.jsx("div",{className:"w-full flex justify-center leading-0",children:o||ge?l.jsx(yE,{data:s,lineColors:s.filter(de=>de.color).length===0?n?[n]:[Pe.primaryColors["blue-600"]]:n||Pe[W].categoricalColors.colors,radius:o||ge,tooltip:f,colorDomain:S||Xe(s.filter(de=>de.color),"color").map(de=>de.color),onSeriesMouseOver:d,onSeriesMouseClick:p,styles:B,detailsOnClick:b,selectedColor:J,axisLabels:C,strokeWidth:q,showValues:M,showDots:A,topMargin:y,bottomMargin:v,leftMargin:m,rightMargin:I,curveType:O,noOfTicks:K,minValue:Q,maxValue:se,fillShape:T,highlightedLines:D,resetSelectionOnDoubleClick:Z,animate:ie===!0?{duration:.5,once:!0,amount:.5}:ie||{duration:0,once:!0,amount:0},dimmedOpacity:ue,precision:he,customLayers:Y}):null})})]})}),i||a?l.jsx(et,{styles:{footnote:B?.footnote,source:B?.source},classNames:{footnote:X?.footnote,source:X?.source},sources:i,footNote:a,width:x}):l.jsx("div",{})]})})})})}function Ct(t,e,n){return e.findIndex(i=>i.chartConfigId===t)===-1?void 0:typeof e[e.findIndex(i=>i.chartConfigId===t)].columnId=="object"?e[e.findIndex(i=>i.chartConfigId===t)].columnId.map(i=>n.findIndex(r=>r.value===i)===-1?i:n[n.findIndex(r=>r.value===i)].label):n.findIndex(i=>i.value===e[e.findIndex(r=>r.chartConfigId===t)].columnId)===-1?e[e.findIndex(i=>i.chartConfigId===t)].columnId:n[n.findIndex(i=>i.value===e[e.findIndex(r=>r.chartConfigId===t)].columnId)].label}function yw(t){const{settings:e,graph:n,graphData:i,debugMode:r,graphDataConfiguration:a,readableHeader:o,updateFilters:s}=t;if(r&&(console.log(`Graph: ${n}`),console.log("Transformed data:",i),console.log("Settings:",e)),typeof i=="string")return l.jsx("div",{className:`flex my-0 mx-auto grow flex-col justify-center ${e?.width?"w-fit":"w-full"}`,style:{height:"inherit"},children:l.jsx(Ce.P,{size:"sm",marginBottom:"none",className:"p-2 text-center text-accent-dark-red dark:text-accent-red",children:i})});const c={barChart:Gf,bulletChart:Kv,groupedBarChart:Rx,stackedBarChart:Bx,lineChart:yv,dualAxisLineChart:pv,multiLineChart:xv,multiLineAltChart:vv,stackedAreaChart:Qv,choroplethMap:Hv,biVariateChoroplethMap:Bv,dotDensityMap:Wv,donutChart:rd,slopeChart:Xv,scatterPlot:Uv,dumbbellChart:tv,treeMap:Md,circlePacking:td,heatMap:aw,stripChart:cw,beeSwarmChart:nv,butterflyChart:hw,histogram:fw,sparkLine:bv,paretoChart:uw,dataTable:ow,statCard:Zv,geoHubCompareMap:Yv,geoHubMap:Gv,unitChart:nw,differenceLineChart:wv,geoHubMapWithLayerSelection:qv,sankeyChart:pw,lineChartWithConfidenceInterval:mv,dataCards:sw,radarChart:mw,threeDGlobe:zv},u=d=>{switch(d){case"barChart":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,orientation:e?.orientation,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,height:e?.height,width:e?.width,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,barPadding:e?.barPadding,showValues:e?.showValues,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,truncateBy:e?.truncateBy,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,showColorScale:e?.showColorScale,maxValue:e?.maxValue,minValue:e?.minValue,labelOrder:e?.labelOrder,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,sortData:e?.sortData,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,maxBarThickness:e?.maxBarThickness,minBarThickness:e?.minBarThickness,maxNumberOfBars:e?.maxNumberOfBars,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.label)},resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,detailsOnClick:e?.detailsOnClick,barAxisTitle:e?.barAxisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,filterNA:e?.filterNA,animate:e?.animate,naLabel:e?.naLabel};case"groupedBarChart":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,orientation:e?.orientation,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,showColorScale:e?.showColorScale,sources:e?.sources,barPadding:e?.barPadding,showTicks:e?.showTicks,truncateBy:e?.truncateBy,colorDomain:e?.colorDomain||Ct("size",a||[],o||[]),colorLegendTitle:e?.colorLegendTitle,suffix:e?.suffix,prefix:e?.prefix,showValues:e?.showValues,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,showLabels:e?.showLabels,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,labelOrder:e?.labelOrder,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,maxBarThickness:e?.maxBarThickness,ariaLabel:e?.ariaLabel,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,detailsOnClick:e?.detailsOnClick,barAxisTitle:e?.barAxisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,animate:e?.animate,naLabel:e?.naLabel};case"stackedBarChart":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,orientation:e?.orientation,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,showColorScale:e?.showColorScale,width:e?.width,height:e?.height,sources:e?.sources,barPadding:e?.barPadding,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,truncateBy:e?.truncateBy,colorDomain:e?.colorDomain||Ct("size",a||[],o||[]),colorLegendTitle:e?.colorLegendTitle,backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,suffix:e?.suffix,prefix:e?.prefix,labelOrder:e?.labelOrder,showValues:e?.showValues,showLabels:e?.showLabels,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,maxValue:e?.maxValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,maxBarThickness:e?.maxBarThickness,minBarThickness:e?.minBarThickness,maxNumberOfBars:e?.maxNumberOfBars,sortParameter:e?.sortParameter,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,barAxisTitle:e?.barAxisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,animate:e?.animate,naLabel:e?.naLabel};case"bulletChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,orientation:e?.orientation,data:i,barColor:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,height:e?.height,width:e?.width,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,barPadding:e?.barPadding,showValues:e?.showValues,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,truncateBy:e?.truncateBy,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,showColorScale:e?.showColorScale,maxValue:e?.maxValue,minValue:e?.minValue,labelOrder:e?.labelOrder,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,sortData:e?.sortData,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,maxBarThickness:e?.maxBarThickness,minBarThickness:e?.minBarThickness,maxNumberOfBars:e?.maxNumberOfBars,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.label)},resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,detailsOnClick:e?.detailsOnClick,barAxisTitle:e?.barAxisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,filterNA:e?.filterNA,qualitativeRangeColors:e?.qualitativeRangeColors,targetStyle:e?.targetStyle,targetColor:e?.targetColor,measureBarWidthFactor:e?.measureBarWidthFactor,animate:e?.animate,naLabel:e?.naLabel};case"lineChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,curveType:e?.curveType,data:i,graphID:e?.graphID,lineColor:e?.lineColor,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,showValues:e?.showValues,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,regressionLine:e?.regressionLine,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,styles:e?.styles,classNames:e?.classNames};case"lineChartWithConfidenceInterval":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,curveType:e?.curveType,graphID:e?.graphID,lineColor:e?.lineColor,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,showValues:e?.showValues,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,regressionLine:e?.regressionLine,ariaLabel:e?.ariaLabel,showIntervalDots:e?.showIntervalDots,showIntervalValues:e?.showIntervalValues,intervalLineStrokeWidth:e?.intervalLineStrokeWidth,intervalLineColors:e?.intervalLineColors,intervalAreaColor:e?.intervalAreaColor,intervalAreaOpacity:e?.intervalAreaOpacity,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,colorLegendTitle:e?.colorLegendTitle,colorLegendColors:e?.colorLegendColors,colorLegendDomain:e?.colorLegendDomain,styles:e?.styles,classNames:e?.classNames};case"dualAxisLineChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,curveType:e?.curveType,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,labels:e?.labels||[Ct("y1",a||[],o||[]),Ct("y2",a||[],o||[])],footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,showValues:e?.showValues,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,lineColors:e?.lineColors,sameAxes:e?.sameAxes,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,colorLegendTitle:e?.colorLegendTitle,ariaLabel:e?.ariaLabel,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,lineSuffixes:e?.lineSuffixes,linePrefixes:e?.linePrefixes,styles:e?.styles,classNames:e?.classNames};case"multiLineChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,data:i,curveType:e?.curveType,lineColors:e?.lineColors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,suffix:e?.suffix,prefix:e?.prefix,showColorScale:e?.showColorScale,labels:e?.labels||Ct("y",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,showValues:e?.showValues,relativeHeight:e?.relativeHeight,showColorLegendAtTop:e?.showColorLegendAtTop,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,highlightedLines:e?.highlightedLines,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,colorLegendTitle:e?.colorLegendTitle,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,styles:e?.styles,classNames:e?.classNames,dashedLines:e?.dashedLines,dashSettings:e?.dashSettings,labelsToBeHidden:e?.labelsToBeHidden};case"multiLineAltChart":return{naLabel:e?.naLabel,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,dimmedOpacity:e?.dimmedOpacity,curveType:e?.curveType,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,suffix:e?.suffix,prefix:e?.prefix,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refValues:e?.refValues,showLabels:e?.showLabels,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,highlightedLines:e?.highlightedLines,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,colorLegendTitle:e?.colorLegendTitle,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,styles:e?.styles,classNames:e?.classNames,colorDomain:e?.colorDomain,showNAColor:e?.showNAColor};case"differenceLineChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,curveType:e?.curveType,lineColors:e?.lineColors,diffAreaColors:e?.diffAreaColors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,suffix:e?.suffix,prefix:e?.prefix,labels:e?.labels||[Ct("y1",a||[],o||[]),Ct("y2",a||[],o||[])],backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,showValues:e?.showValues,relativeHeight:e?.relativeHeight,showColorLegendAtTop:e?.showColorLegendAtTop,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,animate:e?.animate,strokeWidth:e?.strokeWidth,showDots:e?.showDots,colorLegendTitle:e?.colorLegendTitle,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,minDate:e?.minDate,maxDate:e?.maxDate,styles:e?.styles,classNames:e?.classNames};case"stackedAreaChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,data:i,curveType:e?.curveType,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,noOfXTicks:e?.noOfXTicks,dateFormat:e?.dateFormat,colorDomain:e?.colorDomain||Ct("y",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,colorLegendTitle:e?.colorLegendTitle,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,relativeHeight:e?.relativeHeight,bottomMargin:e?.bottomMargin,tooltip:e?.tooltip,refValues:e?.refValues,highlightAreaSettings:e?.highlightAreaSettings,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,showColorScale:e?.showColorScale,language:e?.language,minHeight:e?.minHeight,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,ariaLabel:e?.ariaLabel,yAxisTitle:e?.yAxisTitle,noOfYTicks:e?.noOfYTicks,suffix:e?.suffix,prefix:e?.prefix,styles:e?.styles,classNames:e?.classNames};case"choroplethMap":return{timeline:e?.timeline,customLayers:e?.customLayers,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphTitle:e?.graphTitle,mapData:e?.mapData,mapProjection:e?.mapProjection,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,colorDomain:e?.colorDomain,colors:e?.colors,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("x",a||[],o||[]),scaleType:e?.scaleType,categorical:e?.categorical,data:i,scale:e?.scale,centerPoint:e?.centerPoint,backgroundColor:e?.backgroundColor,mapBorderWidth:e?.mapBorderWidth,mapNoDataColor:e?.mapNoDataColor,mapBorderColor:e?.mapBorderColor,relativeHeight:e?.relativeHeight,padding:e?.padding,isWorldMap:e?.isWorldMap,tooltip:e?.tooltip,showColorScale:e?.showColorScale,zoomScaleExtend:e?.zoomScaleExtend,zoomTranslateExtend:e?.zoomTranslateExtend,graphID:e?.graphID,highlightedIds:e?.highlightedIds,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,mapProperty:e?.mapProperty,showAntarctica:e?.showAntarctica,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.id)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,zoomInteraction:e?.zoomInteraction,animate:e?.animate};case"biVariateChoroplethMap":return{timeline:e?.timeline,customLayers:e?.customLayers,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,mapData:e?.mapData,mapProjection:e?.mapProjection,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,xColorLegendTitle:Object.keys(e||{}).indexOf("xColorLegendTitle")!==-1?e?.xColorLegendTitle:Ct("x",a||[],o||[]),yColorLegendTitle:Object.keys(e||{}).indexOf("yColorLegendTitle")!==-1?e?.yColorLegendTitle:Ct("y",a||[],o||[]),xDomain:e?.xDomain,yDomain:e?.yDomain,colors:e?.colors,scale:e?.scale,centerPoint:e?.centerPoint,backgroundColor:e?.backgroundColor,mapBorderWidth:e?.mapBorderWidth,mapNoDataColor:e?.mapNoDataColor,padding:e?.padding,mapBorderColor:e?.mapBorderColor,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,isWorldMap:e?.isWorldMap,zoomScaleExtend:e?.zoomScaleExtend,zoomTranslateExtend:e?.zoomTranslateExtend,graphID:e?.graphID,highlightedIds:e?.highlightedIds,mapProperty:e?.mapProperty,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,showAntarctica:e?.showAntarctica,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.id)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,zoomInteraction:e?.zoomInteraction,animate:e?.animate};case"dotDensityMap":return{timeline:e?.timeline,customLayers:e?.customLayers,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphTitle:e?.graphTitle,mapData:e?.mapData,mapProjection:e?.mapProjection,graphDescription:e?.graphDescription,footNote:e?.footNote,maxRadiusValue:e?.maxRadiusValue,width:e?.width,height:e?.height,radius:e?.radius,sources:e?.sources,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),data:i,scale:e?.scale,centerPoint:e?.centerPoint,backgroundColor:e?.backgroundColor,mapBorderWidth:e?.mapBorderWidth,mapNoDataColor:e?.mapNoDataColor,mapBorderColor:e?.mapBorderColor,padding:e?.padding,showLabels:e?.showLabels,relativeHeight:e?.relativeHeight,isWorldMap:e?.isWorldMap,tooltip:e?.tooltip,showColorScale:e?.showColorScale,zoomScaleExtend:e?.zoomScaleExtend,zoomTranslateExtend:e?.zoomTranslateExtend,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,showAntarctica:e?.showAntarctica,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,zoomInteraction:e?.zoomInteraction,animate:e?.animate};case"threeDGlobe":return{globeOffset:e?.globeOffset,polygonAltitude:e?.polygonAltitude,highlightedIds:e?.highlightedIds,scale:e?.scale,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphTitle:e?.graphTitle,mapData:e?.mapData,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,colorDomain:e?.colorDomain,colors:e?.colors,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("x",a||[],o||[]),scaleType:e?.scaleType,data:i,centerPoint:e?.centerPoint,backgroundColor:e?.backgroundColor,mapNoDataColor:e?.mapNoDataColor,mapBorderColor:e?.mapBorderColor,relativeHeight:e?.relativeHeight,padding:e?.padding,tooltip:e?.tooltip,showColorScale:e?.showColorScale,graphID:e?.graphID,dataDownload:e?.dataDownload,mapProperty:e?.mapProperty,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.id)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,categorical:e?.categorical,autoRotate:e?.autoRotate,globeMaterial:e?.globeMaterial,atmosphereColor:e?.atmosphereColor,enableZoom:e?.enableZoom};case"donutChart":return{precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,mainText:e?.mainText,data:i,colors:e?.colors,graphTitle:e?.graphTitle,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,graphDescription:e?.graphDescription,subNote:e?.subNote,footNote:e?.footNote,radius:e?.radius,strokeWidth:e?.strokeWidth,showColorScale:e?.showColorScale,backgroundColor:e?.backgroundColor,padding:e?.padding,tooltip:e?.tooltip,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,colorDomain:e?.colorDomain,sortData:e?.sortData,language:e?.language,width:e?.width,height:e?.height,minHeight:e?.minHeight,relativeHeight:e?.relativeHeight,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,ariaLabel:e?.ariaLabel,legendMaxWidth:e?.legendMaxWidth,onSeriesMouseClick:g=>{s?.(g.label)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,colorScaleMaxWidth:e?.colorScaleMaxWidth};case"slopeChart":return{customLayers:e?.customLayers,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,showLabels:e?.showLabels,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),radius:e?.radius,axisTitles:e?.axisTitles,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,highlightedDataPoints:e?.highlightedDataPoints,showColorScale:e?.showColorScale,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,fillContainer:e?.fillContainer,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"scatterPlot":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,showLabels:e?.showLabels,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),radius:e?.radius,xAxisTitle:Object.keys(e||{}).indexOf("xAxisTitle")!==-1?e?.xAxisTitle:Ct("x",a||[],o||[]),yAxisTitle:Object.keys(e||{}).indexOf("yAxisTitle")!==-1?e?.yAxisTitle:Ct("y",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,refXValues:e?.refXValues,refYValues:e?.refYValues,highlightedDataPoints:e?.highlightedDataPoints,highlightAreaSettings:e?.highlightAreaSettings,showColorScale:e?.showColorScale,graphID:e?.graphID,maxRadiusValue:e?.maxRadiusValue,maxXValue:e?.maxXValue,minXValue:e?.minXValue,maxYValue:e?.maxYValue,minYValue:e?.minYValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,customHighlightAreaSettings:e?.customHighlightAreaSettings,annotations:e?.annotations,regressionLine:e?.regressionLine,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,noOfXTicks:e?.noOfXTicks,noOfYTicks:e?.noOfYTicks,labelColor:e?.labelColor,xSuffix:e?.xSuffix,ySuffix:e?.ySuffix,xPrefix:e?.xPrefix,yPrefix:e?.yPrefix,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"dumbbellChart":return{timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,orientation:e?.orientation,refValues:e?.refValues,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,barPadding:e?.barPadding,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,truncateBy:e?.truncateBy,labelOrder:e?.labelOrder,showColorScale:e?.showColorScale,colorDomain:e?.colorDomain||Ct("x",a||[],o||[]),colorLegendTitle:e?.colorLegendTitle,backgroundColor:e?.backgroundColor,padding:e?.padding,radius:e?.radius,relativeHeight:e?.relativeHeight,showValues:e?.showValues,showLabels:e?.showLabels,tooltip:e?.tooltip,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,suffix:e?.suffix,prefix:e?.prefix,language:e?.language,minHeight:e?.minHeight,sortParameter:e?.sortParameter,arrowConnector:e?.arrowConnector,connectorStrokeWidth:e?.connectorStrokeWidth,maxBarThickness:e?.maxBarThickness,minBarThickness:e?.minBarThickness,maxNumberOfBars:e?.maxNumberOfBars,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,axisTitle:e?.axisTitle,noOfTicks:e?.noOfTicks,valueColor:e?.valueColor,styles:e?.styles,classNames:e?.classNames,animate:e?.animate,highlightedDataPoints:e?.highlightedDataPoints,dimmedOpacity:e?.dimmedOpacity};case"treeMap":return{precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,tooltip:e?.tooltip,showColorScale:e?.showColorScale,showValues:e?.showValues,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,onSeriesMouseClick:g=>{s?.(g.label)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"circlePacking":return{precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,tooltip:e?.tooltip,showColorScale:e?.showColorScale,showValues:e?.showValues,graphID:e?.graphID,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,radius:e?.radius,maxRadiusValue:e?.maxRadiusValue,onSeriesMouseClick:g=>{s?.(g.label)},detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"heatMap":return{precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,scaleType:e?.scaleType,colorDomain:e?.colorDomain,showColumnLabels:e?.showColumnLabels,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,truncateBy:e?.truncateBy,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,suffix:e?.suffix,prefix:e?.prefix,showValues:e?.showValues,showRowLabels:e?.showRowLabels,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,graphID:e?.graphID,noDataColor:e?.noDataColor,showColorScale:e?.showColorScale,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,fillContainer:e?.fillContainer,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"stripChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,orientation:e?.orientation,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),radius:e?.radius,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,highlightedDataPoints:e?.highlightedDataPoints,showColorScale:e?.showColorScale,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,noOfTicks:e?.noOfTicks,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,prefix:e?.prefix,suffix:e?.suffix,stripType:e?.stripType,valueColor:e?.valueColor,language:e?.language,minHeight:e?.minHeight,highlightColor:e?.highlightColor,dotOpacity:e?.dotOpacity,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"beeSwarmChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,dimmedOpacity:e?.dimmedOpacity,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,colorDomain:e?.colorDomain,colorLegendTitle:Object.keys(e||{}).indexOf("colorLegendTitle")!==-1?e?.colorLegendTitle:Ct("color",a||[],o||[]),backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,showColorScale:e?.showColorScale,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,radius:e?.radius,maxRadiusValue:e?.maxRadiusValue,maxValue:e?.maxValue,minValue:e?.minValue,highlightedDataPoints:e?.highlightedDataPoints,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,showNAColor:e?.showNAColor,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,orientation:e?.orientation,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"butterflyChart":return{naLabel:e?.naLabel,timeline:e?.timeline,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,leftBarTitle:Object.keys(e||{}).indexOf("leftBarTitle")!==-1?e?.leftBarTitle:Ct("leftBar",a||[],o||[]),rightBarTitle:Object.keys(e||{}).indexOf("rightBarTitle")!==-1?e?.rightBarTitle:Ct("rightBar",a||[],o||[]),footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,barColors:e?.barColors,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,barPadding:e?.barPadding,truncateBy:e?.truncateBy,suffix:e?.suffix,prefix:e?.prefix,showTicks:e?.showTicks,showValues:e?.showValues,centerGap:e?.centerGap,maxValue:e?.maxValue,minValue:e?.minValue,showColorScale:e?.showColorScale,refValues:e?.refValues,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"histogram":return{precision:e?.precision,theme:e?.theme,data:i,colors:e?.colors,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,barPadding:e?.barPadding,showValues:e?.showValues,showTicks:e?.showTicks,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,backgroundColor:e?.backgroundColor,padding:e?.padding,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,showLabels:e?.showLabels,maxValue:e?.maxValue,tooltip:e?.tooltip,refValues:e?.refValues,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,numberOfBins:e?.numberOfBins,truncateBy:e?.truncateBy,donutStrokeWidth:e?.donutStrokeWidth,sortData:e?.sortData,barGraphLayout:e?.barGraphLayout,graphType:e?.graphType,language:e?.language,minHeight:e?.minHeight,maxBarThickness:e?.maxBarThickness,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames};case"sparkLine":return{customLayers:e?.customLayers,theme:e?.theme,data:i,curveType:e?.curveType,lineColor:e?.lineColor,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,dateFormat:e?.dateFormat,area:e?.area,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,graphID:e?.graphID,maxValue:e?.maxValue,minValue:e?.minValue,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,styles:e?.styles,classNames:e?.classNames};case"paretoChart":return{naLabel:e?.naLabel,customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,showValues:e?.showValues,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,barTitle:Object.keys(e||{}).indexOf("barTitle")!==-1?e?.barTitle:Ct("barTitle",a||[],o||[]),lineTitle:Object.keys(e||{}).indexOf("lineTitle")!==-1?e?.lineTitle:Ct("lineTitle",a||[],o||[]),footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,backgroundColor:e?.backgroundColor,padding:e?.padding,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,barColor:e?.barColor,curveType:e?.curveType,lineColor:e?.lineColor,sameAxes:e?.sameAxes,relativeHeight:e?.relativeHeight,tooltip:e?.tooltip,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,barPadding:e?.barPadding,truncateBy:e?.truncateBy,showLabels:e?.showLabels,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,detailsOnClick:e?.detailsOnClick,noOfTicks:e?.noOfTicks,lineSuffix:e?.lineSuffix,barSuffix:e?.barSuffix,linePrefix:e?.lineSuffix,barPrefix:e?.barPrefix,barAxisTitle:e?.barAxisTitle,lineAxisTitle:e?.lineAxisTitle,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"dataTable":return{naLabel:e?.naLabel,precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,graphID:e?.graphID,width:e?.width,height:e?.height,columnData:e?.columnData||[],data:i,language:e?.language,ariaLabel:e?.ariaLabel,minWidth:e?.minWidth,backgroundColor:e?.backgroundColor,padding:e?.padding,styles:e?.styles,classNames:e?.classNames};case"statCard":return{precision:e?.precision,theme:e?.theme,year:e?.year,data:i,graphTitle:e?.graphTitle||"",graphDescription:e?.graphDescription,suffix:e?.suffix,prefix:e?.prefix,sources:e?.sources||[],footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,graphID:e?.graphID,aggregationMethod:e?.aggregationMethod,language:e?.language,minHeight:e?.minHeight,countOnly:e?.countOnly,ariaLabel:e?.ariaLabel,textBackground:e?.textBackground,headingFontSize:e?.headingFontSize,centerAlign:e?.centerAlign,verticalAlign:e?.verticalAlign,styles:e?.styles,classNames:e?.classNames,layout:e?.layout};case"geoHubCompareMap":return{theme:e?.theme,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,width:e?.width,height:e?.height,relativeHeight:e?.relativeHeight,graphID:e?.graphID,mapStyles:e?.mapStyles,center:e?.center,zoomLevel:e?.zoomLevel,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,styles:e?.styles,classNames:e?.classNames,mapLegend:e?.mapLegend};case"geoHubMap":return{theme:e?.theme,mapStyle:e?.mapStyle,center:e?.center,zoomLevel:e?.zoomLevel,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,width:e?.width,height:e?.height,relativeHeight:e?.relativeHeight,graphID:e?.graphID,language:e?.language,minHeight:e?.minHeight,includeLayers:e?.includeLayers,excludeLayers:e?.excludeLayers,ariaLabel:e?.ariaLabel,uiMode:e?.uiMode,styles:e?.styles,classNames:e?.classNames,mapLegend:e?.mapLegend};case"geoHubMapWithLayerSelection":return{theme:e?.theme,mapStyle:e?.mapStyle,center:e?.center,zoomLevel:e?.zoomLevel,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,width:e?.width,height:e?.height,relativeHeight:e?.relativeHeight,graphID:e?.graphID,language:e?.language,minHeight:e?.minHeight,layerSelection:e?.layerSelection,excludeLayers:e?.excludeLayers,ariaLabel:e?.ariaLabel,uiMode:e?.uiMode,mapLegend:e?.mapLegend};case"unitChart":return{precision:e?.precision,theme:e?.theme,totalNoOfDots:e?.totalNoOfDots,gridSize:e?.gridSize,unitPadding:e?.unitPadding,size:e?.size,graphTitle:e?.graphTitle,sources:e?.sources,colors:e?.colors,graphDescription:e?.graphDescription,footNote:e?.footNote,backgroundColor:e?.backgroundColor,padding:e?.padding,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,language:e?.language,showColorScale:e?.showColorScale,showStrokeForWhiteDots:e?.showStrokeForWhiteDots,note:e?.note,data:i,width:e?.width,height:e?.height,minHeight:e?.minHeight,relativeHeight:e?.relativeHeight,ariaLabel:e?.ariaLabel,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"sankeyChart":return{customLayers:e?.customLayers,precision:e?.precision,theme:e?.theme,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,data:i,graphTitle:e?.graphTitle,graphDescription:e?.graphDescription,footNote:e?.footNote,width:e?.width,height:e?.height,sources:e?.sources,showLabels:e?.showLabels,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,truncateBy:e?.truncateBy,padding:e?.padding,backgroundColor:e?.backgroundColor,tooltip:e?.tooltip,suffix:e?.suffix,prefix:e?.prefix,relativeHeight:e?.relativeHeight,showValues:e?.showValues,graphID:e?.graphID,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,fillContainer:e?.fillContainer,language:e?.language,minHeight:e?.minHeight,ariaLabel:e?.ariaLabel,sourceColors:e?.sourceColors,targetColors:e?.targetColors,sourceColorDomain:e?.sourceColorDomain,targetColorDomain:e?.targetColorDomain,nodePadding:e?.nodePadding,nodeWidth:e?.nodeWidth,highlightedSourceDataPoints:e?.highlightedSourceDataPoints,highlightedTargetDataPoints:e?.highlightedTargetDataPoints,defaultLinkOpacity:e?.defaultLinkOpacity,sourceTitle:e?.sourceTitle,targetTitle:e?.targetTitle,sortNodes:e?.sortNodes,detailsOnClick:e?.detailsOnClick,styles:e?.styles,classNames:e?.classNames,animate:e?.animate};case"dataCards":return{theme:e?.theme,graphTitle:e?.graphTitle,sources:e?.sources,graphDescription:e?.graphDescription,footNote:e?.footNote,graphID:e?.graphID,width:e?.width,height:e?.height,columnData:e?.columnData||[],data:i,language:e?.language,ariaLabel:e?.ariaLabel,cardTemplate:e?.cardTemplate,cardBackgroundColor:e?.cardBackgroundColor,cardFilters:e?.cardFilters||[],cardSortingOptions:e?.cardSortingOptions,cardSearchColumns:e?.cardSearchColumns,cardMinWidth:e?.cardMinWidth,backgroundColor:e?.backgroundColor,padding:e?.padding,detailsOnClick:e?.detailsOnClick,allowDataDownloadOnDetail:e?.allowDataDownloadOnDetail,noOfItemsInAPage:e?.noOfItemsInAPage,uiMode:e?.uiMode,styles:e?.styles,classNames:e?.classNames};case"radarChart":return{customLayers:e?.customLayers,precision:e?.precision,graphTitle:e?.graphTitle,dimmedOpacity:e?.dimmedOpacity,graphDescription:e?.graphDescription,footNote:e?.footNote,sources:e?.sources,ariaLabel:e?.ariaLabel,colors:e?.colors,colorDomain:e?.colorDomain,colorLegendTitle:e?.colorLegendTitle,backgroundColor:e?.backgroundColor,styles:e?.styles,classNames:e?.classNames,width:e?.width,height:e?.height,minHeight:e?.minHeight,relativeHeight:e?.relativeHeight,padding:e?.padding,radius:e?.radius,leftMargin:e?.leftMargin,rightMargin:e?.rightMargin,topMargin:e?.topMargin,bottomMargin:e?.bottomMargin,maxValue:e?.maxValue,minValue:e?.minValue,showValues:e?.showValues,showDots:e?.showDots,strokeWidth:e?.strokeWidth,fillShape:e?.fillShape,noOfTicks:e?.noOfTicks,showColorScale:e?.showColorScale,showNAColor:e?.showNAColor,highlightedLines:e?.highlightedLines,axisLabels:e?.axisLabels,curveType:e?.curveType,resetSelectionOnDoubleClick:e?.resetSelectionOnDoubleClick,graphDownload:e?.graphDownload,dataDownload:e?.dataDownload,tooltip:e?.tooltip,detailsOnClick:e?.detailsOnClick,language:e?.language,theme:e?.theme,graphID:e?.graphID,animate:e?.animate};default:return{}}},h=c[n],f=u(n);return l.jsx("div",{className:`grow my-0 ${n!=="statCard"?"mx-auto":"mx-0"} flex flex-col h-inherit ${e?.width?"w-fit":"w-full"} ${n!=="unitChart"&&n!=="statCard"?"justify-center":"justify-start"} ${e?.theme||"light"}`,style:{minHeight:"inherit"},children:h?l.jsx(h,{...f}):l.jsx(Ce.P,{size:"sm",marginBottom:"none",className:"p-2 text-center text-accent-dark-red dark:text-accent-red",children:`Invalid chart type: ${n}`})})}const Cc=[{chartID:"barChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!0,multiple:!1},{id:"color",required:!1,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"bulletChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!0,multiple:!1},{id:"target",required:!1,multiple:!1},{id:"qualitativeRange",required:!1,multiple:!0}]},{chartID:"radarChart",configuration:[{id:"label",required:!1,multiple:!1},{id:"values",required:!0,multiple:!0},{id:"color",required:!1,multiple:!1}]},{chartID:"stackedBarChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",multiple:!0,required:!0},{id:"date",required:!1,multiple:!1}]},{chartID:"groupedBarChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",multiple:!0,required:!0},{id:"date",required:!1,multiple:!1}]},{chartID:"lineChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1}]},{chartID:"dualAxisLineChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y1",multiple:!1,required:!0},{id:"y2",multiple:!1,required:!0}]},{chartID:"differenceLineChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y1",multiple:!1,required:!0},{id:"y2",multiple:!1,required:!0}]},{chartID:"multiLineChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",multiple:!0,required:!0}]},{chartID:"multiLineAltChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",multiple:!1,required:!0},{id:"label",multiple:!1,required:!0},{id:"color",multiple:!1,required:!1}]},{chartID:"stackedAreaChart",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",multiple:!0,required:!0}]},{chartID:"threeDGlobe",configuration:[{id:"id",required:!0,multiple:!1},{id:"x",required:!0,multiple:!1}]},{chartID:"choroplethMap",configuration:[{id:"id",required:!0,multiple:!1},{id:"x",required:!0,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"biVariateChoroplethMap",configuration:[{id:"id",required:!0,multiple:!1},{id:"x",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"dotDensityMap",configuration:[{id:"lat",required:!0,multiple:!1},{id:"long",required:!0,multiple:!1},{id:"label",multiple:!1,required:!1},{id:"color",multiple:!1,required:!1},{id:"radius",required:!1,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"donutChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!0,multiple:!1}]},{chartID:"slopeChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"y1",required:!0,multiple:!1},{id:"y2",required:!0,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"scatterPlot",configuration:[{id:"x",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1},{id:"radius",required:!1,multiple:!1},{id:"color",required:!1,multiple:!1},{id:"label",required:!0,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"dumbbellChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"x",multiple:!0,required:!0},{id:"date",required:!1,multiple:!1}]},{chartID:"treeMap",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!0,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"circlePacking",configuration:[{id:"label",required:!0,multiple:!1},{id:"size",required:!1,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"sankeyChart",configuration:[{id:"source",required:!0,multiple:!1},{id:"target",required:!0,multiple:!1},{id:"value",required:!1,multiple:!1}]},{chartID:"heatMap",configuration:[{id:"row",required:!0,multiple:!1},{id:"column",required:!0,multiple:!1},{id:"value",required:!0,multiple:!1}]},{chartID:"stripChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"position",required:!0,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"statCard",configuration:[{id:"value",required:!0,multiple:!1}]},{chartID:"beeSwarmChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"position",required:!0,multiple:!1},{id:"radius",required:!1,multiple:!1},{id:"color",required:!1,multiple:!1}]},{chartID:"butterflyChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"leftBar",required:!0,multiple:!1},{id:"rightBar",required:!0,multiple:!1},{id:"date",required:!1,multiple:!1}]},{chartID:"lineChartWithConfidenceInterval",configuration:[{id:"date",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1},{id:"yMin",required:!1,multiple:!1},{id:"yMax",required:!1,multiple:!1}]},{chartID:"histogram",configuration:[{id:"value",required:!0,multiple:!1}]},{chartID:"sparkLine",configuration:[{id:"dale",required:!0,multiple:!1},{id:"y",required:!0,multiple:!1}]},{chartID:"paretoChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"bar",required:!0,multiple:!1},{id:"line",required:!0,multiple:!1}]},{chartID:"unitChart",configuration:[{id:"label",required:!0,multiple:!1},{id:"value",required:!0,multiple:!1}]}];function n0(t,e){return e.filter(n=>!t.includes(n))}function xE(t,e,n){const i=hn(t.map(c=>c.columnId)),r=n0(n,i);if(r.length!==0)return{isValid:!1,err:`Key(s) in configuration that don't match keys in the data: ${r.join(", ")}. Possible reason: If you are using 'dataTransform' then the allowed keys (columns) are only the one present in 'aggregationColumnsSetting' array in 'dataTransform' object plus n additional key called 'count'.`};const a=t.map(c=>c.chartConfigId),o=Cc[Cc.findIndex(c=>c.chartID===e)].configuration.filter(c=>c.required).map(c=>c.id),s=n0(a,o);return{isValid:s.length===0,err:s.length===0?void 0:`Missing required ID(s) in configuration: ${s.join(", ")}`}}const Fi=[{graphName:"Bar graph",graphID:"barChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Stacked bar graph",graphID:"stackedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Grouped bar graph",graphID:"groupedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated bar chart",graphID:"animatedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated stacked bar chart",graphID:"animatedStackedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated grouped bar chart",graphID:"animatedGroupedBarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Bee swarm chart",graphID:"beeSwarmChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Butterfly chart",graphID:"butterflyChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated butterfly chart",graphID:"animatedButterflyChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Bullet chart",graphID:"bulletChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Circle packing",graphID:"circlePacking",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Data table",graphID:"dataTable",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Pie/donut chart",graphID:"donutChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Dumbbell chart",graphID:"dumbbellChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated dumbbell chart",graphID:"animatedDumbbellChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Heat map",graphID:"heatMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Histogram",graphID:"histogram",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Line chart",graphID:"lineChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Multi-line chart",graphID:"multiLineChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Multi-line chart alternative",graphID:"multiLineAltChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Difference line chart",graphID:"differenceLineChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Dual-axes line chart",graphID:"dualAxisLineChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Line chart with interval",graphID:"lineChartWithConfidenceInterval",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Spark line",graphID:"sparkLine",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Choropleth map",graphID:"choroplethMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Three-D globe",graphID:"threeDGlobe",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Bi-variate choropleth map",graphID:"biVariateChoroplethMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Dot density map",graphID:"dotDensityMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated choropleth map",graphID:"animatedChoroplethMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated bi-variate choropleth map",graphID:"animatedBiVariateChoroplethMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated dot density map",graphID:"animatedDotDensityMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"GeoHub map with comparison",graphID:"geoHubCompareMap",availableInGriddedGraph:!1,geoHubMapPresentation:!0,availableInWideToLongFormat:!1},{graphName:"GeoHub map",graphID:"geoHubMap",availableInGriddedGraph:!1,geoHubMapPresentation:!0,availableInWideToLongFormat:!1},{graphName:"GeoHub map with layer selection",graphID:"geoHubMapWithLayerSelection",availableInGriddedGraph:!1,geoHubMapPresentation:!0,availableInWideToLongFormat:!1},{graphName:"Pareto chart",graphID:"paretoChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Scatter plot",graphID:"scatterPlot",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Animated scatter plot",graphID:"animatedScatterPlot",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Slope chart",graphID:"slopeChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Stacked area chart/area chart",graphID:"stackedAreaChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Statistic card",graphID:"statCard",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Strip chart",graphID:"stripChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Tree map",graphID:"treeMap",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Unit chart",graphID:"unitChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!0},{graphName:"Sankey chart",graphID:"sankeyChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Data cards list",graphID:"dataCards",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1},{graphName:"Radar chart",graphID:"radarChart",availableInGriddedGraph:!0,geoHubMapPresentation:!1,availableInWideToLongFormat:!1}];function Vc(t,e,n){if(Fi.filter(r=>r.geoHubMapPresentation).map(r=>r.graphID).indexOf(e)!==-1)return t;if(!t)return"Cannot fetch data";if(e==="dataTable"||e==="dataCards"||t.length===0)return t;if(!n)return console.error("Your data configuration is not accurate"),"No graph configuration is provided";const i=xE(n,e,Object.keys(t[0]));if(i.isValid){const r=Cc[Cc.findIndex(o=>o.chartID===e)].configuration;return t.map(o=>{const s={};return n.filter(c=>c.columnId).forEach(c=>{r[r.findIndex(u=>u.id===c.chartConfigId)].multiple?(s[r[r.findIndex(u=>u.id===c.chartConfigId)].id]=[],c.columnId.forEach(u=>{s[r[r.findIndex(h=>h.id===c.chartConfigId)].id].push(je(o[u])?null:o[u])})):s[r[r.findIndex(u=>u.id===c.chartConfigId)].id]=je(o[c.columnId])?null:o[c.columnId],s[`${c.chartConfigId}Columns`]=c.columnId}),s.data=o,s})}return console.error(i.err),i.err}function Td(t,e,n){return t.length===0?[]:typeof t[0][e]!="object"?Xe(t,o=>o[e]).map(o=>{const s={};s[e]=o[e];const c=t.filter(u=>u[e]===o[e]);return s.count=c.length,s.rollUpData=c,n?.forEach(u=>{s[u.column]=u.aggregationMethod==="average"?parseFloat((rt(c.map(h=>h[u.column]))/c.length).toFixed(2)):u.aggregationMethod==="max"?Math.max(...c.map(h=>h[u.column])):u.aggregationMethod==="min"?Math.min(...c.map(h=>h[u.column])):rt(c.map(h=>h[u.column]))}),s}):Xe(hn(t.map(a=>a[e])),a=>a).map(a=>{const o={};o[e]=a;const s=t.filter(c=>c[e].indexOf(a)!==-1);return o.rollUpData=s,o.count=s.length,n?.forEach(c=>{o[c.column]=c.aggregationMethod==="average"?parseFloat((rt(s.map(u=>u[c.column]))/s.length).toFixed(2)):c.aggregationMethod==="max"?Math.max(...s.map(u=>u[c.column])):c.aggregationMethod==="min"?Math.min(...s.map(u=>u[c.column])):rt(s.map(u=>u[c.column]))}),o})}function xw(t,e){return e.findIndex(n=>n.chartConfigId===t)===-1?!1:typeof e[e.findIndex(n=>n.chartConfigId===t)].columnId!="string"}const vE=t=>{if(t.findIndex(n=>n.chartConfigId==="yMin")!==-1&&t.findIndex(n=>n.chartConfigId==="yMax")!==-1)return t;const e=[...t];return t.findIndex(n=>n.chartConfigId==="yMin")===-1&&e.push({chartConfigId:"yMin",columnId:`${t[t.findIndex(n=>n.chartConfigId==="y")].columnId}Min`}),t.findIndex(n=>n.chartConfigId==="yMax")===-1&&e.push({chartConfigId:"yMax",columnId:`${t[t.findIndex(n=>n.chartConfigId==="y")].columnId}Max`}),e},Fu=(t,e)=>{const n=e?.map(i=>{const r=t?.findIndex(o=>o.chartConfigId===i.chartConfigId);if(r===-1)return{};const a=t[r]?.allowedColumnIds?.findIndex(o=>o.value===i.columnId);return a===-1?{}:t[r].allowedColumnIds[a].graphSettings||{}})||[];return Object.assign({},...n)};function ol(t){const{graphSettings:e,dataSettings:n,filters:i,graphType:r,dataTransform:a,graphDataConfiguration:o,dataFilters:s,debugMode:c,dataSelectionOptions:u,advancedDataSelectionOptions:h,readableHeader:f,noOfFiltersPerRow:d=4,updateFilters:g,uiMode:p="normal",theme:y="light",highlightDataPointSettings:v}=t,[m,I]=k.useState(void 0),[j,w]=k.useState(void 0),[S,P]=k.useState(o),[W,D]=k.useState({}),[x,$]=k.useState(void 0),[V,q]=k.useState([]),ae=k.useRef(null),G=k.useRef(o),[_,b]=k.useState([]),B=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),X=k.useCallback(async()=>{if(r!=="geoHubMap"&&r!=="geoHubCompareMap"&&r!=="geoHubMapWithLayerSelection"&&n)try{const O=await(n.dataURL?typeof n.dataURL=="string"?n.fileType==="json"?en(n.dataURL,n.columnsToArray,n.dataTransformation,c):n.fileType==="api"?uo(n.dataURL,n.apiHeaders,n.columnsToArray,n.dataTransformation,c):co(n.dataURL,n.dataTransformation,n.columnsToArray,c,n.delimiter,!0):ts(n.dataURL,n.idColumnTitle):$r(n.data,n.columnsToArray));w(O);const K=(i||[]).map(Q=>({filter:Q.column,label:Q.label||`Filter by ${Q.column}`,singleSelect:Q.singleSelect,clearable:Q.clearable,defaultValue:Kr(Q.defaultValue),value:Kr(Q.defaultValue),availableValues:jr(O,Q.column).filter(se=>!Q.excludeValues?.includes(`${se}`)).map(se=>({value:se,label:se})),allowSelectAll:Q.allowSelectAll,width:Q.width}));b(K)}catch(M){console.error("Data fetching error:",M)}},[n,r,i,c]);k.useEffect(()=>{X()},[X]);const z=k.useMemo(()=>!j||_.length===0?j:j.filter(O=>_.every(K=>K.value&&hn([K.value]).length>0?Qa(hn([O[K.filter]]),hn([K.value]).map(Q=>Q.value)).length>0:!0)),[_,j]);k.useEffect(()=>{u&&D(Fu(u,o))},[u,o]),k.useEffect(()=>{r!=="geoHubMap"&&r!=="geoHubCompareMap"&&r!=="geoHubMapWithLayerSelection"&&j&&I(z)},[z,r,j]),k.useEffect(()=>{v?.column&&z&&q(jr(z,v.column).filter(M=>!v?.excludeValues?.includes(`${M}`)).map(M=>({value:M,label:M})))},[z,v]),k.useEffect(()=>{dt(G.current,o)||(P(o),G.current=o)},[o]);const C=k.useCallback((M,O)=>{b(K=>K.map(Q=>Q.filter===M?{...Q,value:O}:Q))},[]),A=k.useMemo(()=>{if(!m)return;const M=r==="lineChartWithConfidenceInterval"&&S?vE(S):S;return r!=="geoHubMap"&&r!=="geoHubCompareMap"&&r!=="geoHubMapWithLayerSelection"?Vc(a?Td(Ai(m,s||[]),a.keyColumn,a.aggregationColumnsSetting):Ai(m,s||[]),r,M):void 0},[r,S,m,s,a]);return!n&&r!=="geoHubMap"&&r!=="geoHubCompareMap"&&r!=="geoHubMapWithLayerSelection"?l.jsx(Ce.P,{size:"xs",className:"text-center text-accent-dark-red dark:text-accent-red p-2",children:"Please make sure either `dataSettings` props are present as they are required for data."}):l.jsx("div",{className:`${y||e?.theme||"light"} flex ${e?.width?"w-fit grow-0":"w-full grow"}${e?.height?"":" h-full"}`,dir:e?.language==="he"||e?.language==="ar"?"rtl":void 0,children:l.jsx("div",{className:Ce.cn(`${e?.backgroundColor?e?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${e?.language||"en"}`,e?.classNames?.graphContainer),style:{...e?.styles?.graphContainer||{},...e?.backgroundColor&&e?.backgroundColor!==!0?{backgroundColor:e?.backgroundColor}:{}},id:e?.graphID,ref:ae,children:l.jsx("div",{style:{padding:e?.backgroundColor?e?.padding||"1rem":e?.padding||0,flexGrow:1,display:"flex"},children:l.jsx("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:m||Fi.filter(M=>M.geoHubMapPresentation).map(M=>M.graphID).indexOf(r)!==-1?l.jsxs(l.Fragment,{children:[W?.graphTitle||W?.graphDescription||e?.graphTitle||e?.graphDescription||e?.graphDownload||e?.dataDownload?l.jsx(Qe,{styles:{title:W?.styles?.title||e?.styles?.title,description:W?.styles?.description||e?.styles?.description},classNames:{title:W?.classNames?.title||e?.classNames?.title,description:W?.classNames?.description||e?.classNames?.description},graphTitle:W?.graphTitle||e?.graphTitle,graphDescription:W?.graphDescription||e?.graphDescription,width:W?.width||e?.width,graphDownload:e?.graphDownload?ae.current:void 0,dataDownload:e?.dataDownload&&m&&m.length>0?m:null}):null,_.length!==0||(u||[]).length!==0||(h||[]).length!==0||v?l.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:[h?.map((M,O)=>l.jsxs("div",{style:{width:M.width||`calc(${100/d}% - ${(d-1)/d}rem)`,flexGrow:1,flexShrink:M.ui!=="radio"?0:1,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:M.label||"Graph by"}),M.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:M.options.map(K=>({...K,value:K.label})),size:"sm",isClearable:!1,isSearchable:!0,variant:p,controlShouldRenderValue:!0,defaultValue:M.defaultValue?{...M.defaultValue,value:M.defaultValue?.label}:{...M.options[0],value:M.options[0].label},onChange:K=>{D(K?.graphSettings||{}),P(K?.dataConfiguration)}}):l.jsx(Ce.RadioGroup,{defaultValue:M.defaultValue?.label||M.options[0].label,variant:p,onValueChange:K=>{const Q=M.options[M.options.findIndex(se=>se.label===K)];D(Q.graphSettings||{}),P(Q.dataConfiguration)},children:M.options.map((K,Q)=>l.jsx(Ce.RadioGroupItem,{label:K.label,value:K.label},Q))})]},O)),u?.map((M,O)=>l.jsxs("div",{style:{width:M.width||`calc(${100/d}% - ${(d-1)/d}rem)`,flexGrow:1,flexShrink:M.ui!=="radio"?0:1,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:M.label||`Visualize ${M.chartConfigId} by`}),xw(M.chartConfigId,S||[])?M.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:M.allowedColumnIds,size:"sm",isMulti:!0,isSearchable:!0,variant:p,controlShouldRenderValue:!0,defaultValue:o?o[o.findIndex(K=>K.chartConfigId===M.chartConfigId)].columnId.map(K=>M.allowedColumnIds[M.allowedColumnIds.findIndex(Q=>Q.value===K)]):void 0,filterOption:Ce.createFilter(B),onChange:K=>{const Q={columnId:(K||[]).map(T=>T.value),chartConfigId:M.chartConfigId},se=S?.map(T=>T.chartConfigId===Q.chartConfigId?Q:T);P(se)}}):l.jsx(Ce.CheckboxGroup,{variant:p,defaultValue:o?o[o.findIndex(K=>K.chartConfigId===M.chartConfigId)].columnId.map(K=>M.allowedColumnIds[M.allowedColumnIds.findIndex(Q=>Q.value===K)]).map(K=>K.value):[],onValueChange:K=>{const Q={columnId:K||[],chartConfigId:M.chartConfigId},se=S?.map(T=>T.chartConfigId===Q.chartConfigId?Q:T);P(se)},children:M.allowedColumnIds.map((K,Q)=>l.jsx(Ce.CheckboxGroupItem,{label:K.label,value:K.label},Q))}):M.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:M.allowedColumnIds,size:"sm",isClearable:!1,isSearchable:!0,variant:p,controlShouldRenderValue:!0,defaultValue:o?M.allowedColumnIds[M.allowedColumnIds.findIndex(K=>K.value===o[o.findIndex(Q=>Q.chartConfigId===M.chartConfigId)].columnId)]:void 0,onChange:K=>{const Q={columnId:K?.value,chartConfigId:M.chartConfigId},se=S?.map(T=>T.chartConfigId===Q.chartConfigId?Q:T);D(Fu(u,se)),P(se)}}):l.jsx(Ce.RadioGroup,{variant:p,defaultValue:o?M.allowedColumnIds[M.allowedColumnIds.findIndex(K=>K.value===o[o.findIndex(Q=>Q.chartConfigId===M.chartConfigId)].columnId)].label:"",onValueChange:K=>{const se={columnId:M.allowedColumnIds[M.allowedColumnIds.findIndex(Z=>Z.label===K)].value,chartConfigId:M.chartConfigId},T=S?.map(Z=>Z.chartConfigId===se.chartConfigId?se:Z);D(Fu(u,T)),P(T)},children:M.allowedColumnIds.map((K,Q)=>l.jsx(Ce.RadioGroupItem,{label:K.label,value:K.label},Q))})]},O)),_?.map((M,O)=>l.jsxs("div",{style:{width:M.width||`calc(${100/d}% - ${(d-1)/d}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:M.label}),M.singleSelect?l.jsx(Ce.DropdownSelect,{options:M.availableValues,variant:p,isClearable:M.clearable===void 0?!0:M.clearable,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:K=>{C(M.filter,K)},value:M.value,defaultValue:M.defaultValue}):l.jsxs(l.Fragment,{children:[M.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:M.availableValues,variant:p,size:"sm",isMulti:!0,isClearable:M.clearable===void 0?!0:M.clearable,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:K=>{C(M.filter,K)},value:M.value,defaultValue:M.defaultValue}):l.jsx(Ce.CheckboxGroup,{variant:p,defaultValue:M.defaultValue?M.defaultValue.map(K=>`${K.value}`):[],value:M.value?M.value.map(K=>`${K.value}`):void 0,onValueChange:K=>{C(M.filter,M.availableValues.filter(Q=>K.indexOf(`${Q.value}`)!==-1))},children:M.availableValues.map((K,Q)=>l.jsx(Ce.CheckboxGroupItem,{label:`${K.label}`,value:`${K.value}`},Q))}),M.allowSelectAll?l.jsx("button",{type:"button",className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",onClick:()=>{C(M.filter,M.availableValues)},children:"Select all options"}):null]})]},O)),v?l.jsxs("div",{style:{width:v.width||`calc(${100/d}% - ${(d-1)/d}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:v.label||"Highlight data"}),l.jsx(Ce.DropdownSelect,{options:V,variant:p,size:"sm",isMulti:!0,isClearable:!0,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:M=>{$(M?.map(O=>O.value))},value:x?.map(M=>({label:M,value:M})),defaultValue:v.defaultValues?.map(M=>({label:M,value:M}))})]}):null]}):null,l.jsx(yw,{graph:r,graphData:A,graphDataConfiguration:S,debugMode:c,readableHeader:f||[],updateFilters:g,settings:{...e||{},...W,graphTitle:void 0,graphDescription:void 0,graphDownload:!1,dataDownload:!1,backgroundColor:void 0,padding:"0",theme:e?.theme||y,...x?{highlightedDataPoints:x,highlightedIds:x?.map(M=>`${M}`),highlightedLines:x?.map(M=>M)}:{}}})]}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})})})})})}const Ru=t=>t.map(i=>i.columnWidth||1).reduce((i,r)=>i+r,0),wE=["barChart","choroplethMap","biVariateChoroplethMap","circlePacking","treeMap"];function vw(t){const{dashboardID:e,dashboardLayout:n,dataSettings:i,filters:r,debugMode:a,theme:o="light",readableHeader:s,dataFilters:c,noOfFiltersPerRow:u=4,filterPosition:h,uiMode:f="normal",graphStyles:d,graphClassNames:g}=t,[p,y]=k.useState(void 0),[v,m]=k.useState(void 0),[I,j]=k.useState([]),w=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),S=k.useMemo(()=>!v||I.length===0?v:v.filter(x=>I.every($=>$.value&&hn([$.value]).length>0?Qa(hn([x[$.filter]]),hn([$.value]).map(V=>V.value)).length>0:!0)),[I,v]);k.useEffect(()=>{y(S)},[S]);const P=k.useCallback(async()=>{if(i)try{const x=await(i.dataURL?typeof i.dataURL=="string"?i.fileType==="json"?en(i.dataURL,i.columnsToArray,i.dataTransformation,a):i.fileType==="api"?uo(i.dataURL,i.apiHeaders,i.columnsToArray,i.dataTransformation,a):co(i.dataURL,i.dataTransformation,i.columnsToArray,a,i.delimiter,!0):ts(i.dataURL,i.idColumnTitle):$r(i.data,i.columnsToArray));m(x);const $=(r||[]).map(V=>({filter:V.column,label:V.label||`Filter by ${V.column}`,singleSelect:V.singleSelect,clearable:V.clearable,defaultValue:Kr(V.defaultValue),value:Kr(V.defaultValue),availableValues:jr(x,V.column).filter(q=>!V.excludeValues?.includes(`${q}`)).map(q=>({value:q,label:q})),allowSelectAll:V.allowSelectAll,width:V.width}));j($)}catch(D){console.error("Data fetching error:",D)}},[i,r,a]);k.useEffect(()=>{P()},[P]);const W=k.useCallback((D,x)=>{j($=>$.map(V=>V.filter===D?{...V,value:x}:V))},[]);return l.jsx("div",{className:`${o||"light"} flex grow`,dir:n.language==="he"||n.language==="ar"?"rtl":void 0,children:l.jsx("div",{className:`${n.backgroundColor?n.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto gap-4 flex flex-col w-full grow h-inherit ${n.language||"en"}`,style:{...n.backgroundColor&&n.backgroundColor!==!0?{backgroundColor:n.backgroundColor}:{}},id:e,children:l.jsx("div",{style:{padding:n.backgroundColor?n.padding||"1rem":n.padding||0,flexGrow:1,display:"flex"},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n.title||n.description?l.jsx(Qe,{graphTitle:n.title,graphDescription:n.description,isDashboard:!0}):null,l.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap"},children:[I.length!==0?l.jsx("div",{style:{width:h==="side"?"280px":"100%",flexGrow:1,flexShrink:0},children:l.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%",position:"sticky",top:"1rem"},children:I?.map((D,x)=>l.jsxs("div",{style:{width:D.width||`calc(${100/u}% - ${(u-1)/u}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:D.label}),D.singleSelect?l.jsx(Ce.DropdownSelect,{options:D.availableValues,isClearable:D.clearable===void 0?!0:D.clearable,size:"sm",variant:f,isMulti:!1,isSearchable:!0,filterOption:Ce.createFilter(w),onChange:$=>{W(D.filter,$)},defaultValue:D.defaultValue,value:D.value}):l.jsxs(l.Fragment,{children:[l.jsx(Ce.DropdownSelect,{options:D.availableValues,isMulti:!0,size:"sm",isClearable:D.clearable===void 0?!0:D.clearable,variant:f,isSearchable:!0,controlShouldRenderValue:!0,closeMenuOnSelect:!1,hideSelectedOptions:!1,filterOption:Ce.createFilter(w),onChange:$=>{W(D.filter,$)},value:D.value,defaultValue:D.defaultValue}),D.allowSelectAll?l.jsx("button",{type:"button",className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",onClick:()=>{W(D.filter,D.availableValues)},children:"Select all options"}):null]})]},x))})}):null,l.jsx("div",{style:{width:h==="side"?"calc(100% - 280px - 1rem)":"100%",minWidth:"280px",flexGrow:1,display:"flex",gap:"1rem",flexWrap:"wrap",flexShrink:"0"},children:n.rows.map((D,x)=>l.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${D.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:D.columns.map(($,V)=>l.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*($.columnWidth||1)/Ru(D.columns)}% - ${(Ru(D.columns)-($.columnWidth||1))/Ru(D.columns)}rem)`,minHeight:"inherit"},children:l.jsx(ol,{graphType:$.graphType,dataFilters:$.dataFilters,uiMode:f,graphSettings:{...$.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:$.attachedFilter?!1:$.settings?.resetSelectionOnDoubleClick,styles:$.settings?.styles||d,classNames:$.settings?.classNames||g,radius:$.graphType==="donutChart"?void 0:$.settings?.radius,size:$.graphType==="unitChart"?$.settings?.size:void 0,language:$.settings?.language||n.language,theme:$.settings?.theme||o},dataSettings:{data:p?Ai(p,c||[]):void 0},updateFilters:$.attachedFilter&&wE.indexOf($.graphType)!==-1&&I.findIndex(q=>q.filter===$.attachedFilter)!==-1?q=>{const ae=I.findIndex(_=>_.filter===$.attachedFilter),G=q?I[ae].singleSelect?{value:q,label:q}:[{value:q,label:q}]:void 0;W($.attachedFilter,G)}:void 0,dataTransform:$.dataTransform,dataSelectionOptions:$.dataSelectionOptions,advancedDataSelectionOptions:$.advancedDataSelectionOptions,graphDataConfiguration:$.graphDataConfiguration,debugMode:a,readableHeader:s||[]})},V))},x))})]})]})})})})}function bE(t,e,n,i){const r=[];return t.forEach(a=>{Object.entries(a).forEach(([o,s])=>{if(o!==e){const c={indicator:n.findIndex(u=>u.value===o)!==-1?n[n.findIndex(u=>u.value===o)].label:o,value:s};c[e]=a[e],r.push(c)}})}),i&&console.log(r),r}const Bu=t=>t.map(i=>i.columnWidth||1).reduce((i,r)=>i+r,0);function ww(t){const{dashboardID:e,dashboardLayout:n,dataSettings:i,debugMode:r,theme:a="light",readableHeader:o,dataFilters:s,uiMode:c="normal",graphStyles:u,graphClassNames:h}=t,f=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),[d,g]=k.useState(void 0),[p,y]=k.useState([]),[v,m]=k.useState(void 0),[I,j]=k.useState(void 0);k.useEffect(()=>{if(I){const S=I.filter(P=>P[i.keyColumn]===v);g(S)}},[I,v,i.keyColumn]);const w=k.useCallback(async()=>{if(i)try{const P=await(i.dataURL?typeof i.dataURL=="string"?i.fileType==="json"?en(i.dataURL,void 0,i.dataTransformation,r):i.fileType==="api"?uo(i.dataURL,i.apiHeaders,void 0,i.dataTransformation,r):co(i.dataURL,i.dataTransformation,void 0,r,i.delimiter,!0):ts(i.dataURL,i.idColumnTitle):$r(i.data,void 0)),W=Ai(P,s||[]);y(W.map(x=>x[i.keyColumn])),m(W[0][i.keyColumn]);const D=bE(W,i.keyColumn,o||[],r);j(D)}catch(S){console.error("Data fetching error:",S)}},[i,r,s,o]);return k.useEffect(()=>{w()},[w]),l.jsx("div",{className:`${a||"light"} flex grow`,dir:n.language==="he"||n.language==="ar"?"rtl":void 0,children:l.jsx("div",{className:`${n?.backgroundColor?n?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col h-inherit w-full ml-auto mr-auto grow gap-4 ${n?.language||"en"}`,style:{...n?.backgroundColor&&n?.backgroundColor!==!0?{backgroundColor:n?.backgroundColor}:{}},id:e,children:l.jsx("div",{className:"flex grow",style:{padding:n.backgroundColor?n.padding||"1rem":n.padding||0},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n.title||n.description?l.jsx(Qe,{graphTitle:n.title,graphDescription:n.description,isDashboard:!0}):null,d?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:l.jsxs("div",{style:{width:"100%",flexGrow:1,flexShrink:0,minWidth:"240px"},children:[n.dropdownLabel?l.jsx(Ce.Label,{className:"mb-2",children:n.dropdownLabel}):null,l.jsx(Ce.DropdownSelect,{options:p.map(S=>({value:S,label:S})),size:"sm",variant:c,isClearable:!1,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(f),onChange:S=>{m(S?.value)},defaultValue:{value:v,label:v}})]})}),n.rows.map((S,P)=>l.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${S.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:S.columns.map((W,D)=>l.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*(W.columnWidth||1)/Bu(S.columns)}% - ${(Bu(S.columns)-(W.columnWidth||1))/Bu(S.columns)}rem)`,minHeight:"inherit"},children:l.jsx(ol,{graphType:W.graphType,dataFilters:W.dataFilters,uiMode:c,graphSettings:{...W.settings||{},width:void 0,height:void 0,radius:W.graphType==="donutChart"?void 0:W.settings?.radius,size:W.graphType==="unitChart"?W.settings.size:void 0,language:W.settings?.language||n.language,theme:W.settings?.theme||a,styles:W.settings?.styles||u,classNames:W.settings?.classNames||h},dataSettings:{data:d},graphDataConfiguration:W.graphDataConfiguration?W.graphDataConfiguration:W.graphType==="unitChart"?[{columnId:"indicator",chartConfigId:"label"},{columnId:"value",chartConfigId:"value"}]:[{columnId:"indicator",chartConfigId:"label"},{columnId:"value",chartConfigId:"size"}],debugMode:r,readableHeader:o||[]})},D))},P))]}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})]})})})})}function bw(t){const{graphSettings:e,dataSettings:n,filters:i,graphType:r,dataTransform:a,graphDataConfiguration:o,noOfColumns:s,columnGridBy:c,dataFilters:u,showCommonColorScale:h,minGraphHeight:f,minGraphWidth:d,debugMode:g,dataSelectionOptions:p,advancedDataSelectionOptions:y,readableHeader:v,noOfFiltersPerRow:m=4,uiMode:I="normal",theme:j="light"}=t,[w,S]=k.useState(void 0),[P,W]=k.useState(void 0),[D,x]=k.useState([]),$=k.useRef(null),[V,q]=k.useState(o),[ae,G]=k.useState([]),[_,b]=k.useState({}),B=k.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),X=k.useMemo(()=>!P||ae.length===0?P:P.filter(M=>ae.every(O=>O.value&&hn([O.value]).length>0?Qa(hn([M[O.filter]]),hn([O.value]).map(K=>K.value)).length>0:!0)),[ae,P]);k.useEffect(()=>{S(X)},[X]);const z=k.useCallback(async()=>{if(n)try{const M=await(n.dataURL?typeof n.dataURL=="string"?n.fileType==="json"?en(n.dataURL,n.columnsToArray,n.dataTransformation,g):n.fileType==="api"?uo(n.dataURL,n.apiHeaders,n.columnsToArray,n.dataTransformation,g):co(n.dataURL,n.dataTransformation,n.columnsToArray,g,n.delimiter,!0):ts(n.dataURL,n.idColumnTitle):$r(n.data,n.columnsToArray));W(M);const O=jr(M,c);x(O);const K=(i||[]).map(Q=>({filter:Q.column,label:Q.label||`Filter by ${Q.column}`,singleSelect:Q.singleSelect,clearable:Q.clearable,defaultValue:Kr(Q.defaultValue),value:Kr(Q.defaultValue),availableValues:jr(M,Q.column).filter(se=>!Q.excludeValues?.includes(`${se}`)).map(se=>({value:se,label:se})),allowSelectAll:Q.allowSelectAll,width:Q.width}));G(K)}catch(A){console.error("Data fetching error:",A)}},[n,g,c,i]);k.useEffect(()=>{z()},[z]),k.useEffect(()=>{q(o)},[o]);const C=k.useCallback((A,M)=>{G(O=>O.map(K=>K.filter===A?{...K,value:M}:K))},[]);return l.jsx("div",{className:`${j||e?.theme||"light"} flex ${e?.width?"w-fit grow-0":"w-full grow"}`,dir:e?.language==="he"||e?.language==="ar"?"rtl":void 0,children:l.jsx("div",{className:`${e?.backgroundColor?e?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${e?.language||"en"}`,style:{...e?.backgroundColor&&e?.backgroundColor!==!0?{backgroundColor:e?.backgroundColor}:{}},id:e?.graphID,ref:$,"aria-label":e?.ariaLabel||`${e?.graphTitle?`The graph shows ${e?.graphTitle}. `:""}This is a gridded chart.${e?.graphDescription?` ${e?.graphDescription}`:""}`,children:l.jsx("div",{style:{padding:e?.backgroundColor?e?.padding||"1rem":e?.padding||0,flexGrow:1,display:"flex"},children:l.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[_?.graphTitle||_?.graphDescription||e?.graphTitle||e?.graphDescription||e?.graphDownload||e?.dataDownload?l.jsx(Qe,{styles:{title:_?.styles?.title||e?.styles?.title,description:_?.styles?.description||e?.styles?.description},classNames:{title:_?.classNames?.title||e?.classNames?.title,description:_?.classNames?.description||e?.classNames?.description},graphTitle:_?.graphTitle||e?.graphTitle,graphDescription:_?.graphDescription||e?.graphDescription,width:_?.width||e?.width,graphDownload:e?.graphDownload?$.current:void 0,dataDownload:e?.dataDownload&&w&&w.length>0?w:null}):null,w&&D.length>0?l.jsxs(l.Fragment,{children:[ae.length!==0||(p||[]).length!==0||(y||[]).length!==0?l.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:[y?.map((A,M)=>l.jsxs("div",{style:{width:A.width||`calc(${100/m}% - ${(m-1)/m}rem)`,flexGrow:1,flexShrink:A.ui!=="radio"?0:1,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:A.label||"Graph by"}),A.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:A.options.map(O=>({...O,value:O.label})),isClearable:!1,isSearchable:!0,variant:I,controlShouldRenderValue:!0,defaultValue:A.defaultValue?{...A.defaultValue,value:A.defaultValue?.label}:{...A.options[0],value:A.options[0].label},onChange:O=>{b(O?.graphSettings||{}),q(O?.dataConfiguration)}}):l.jsx(Ce.RadioGroup,{defaultValue:A.defaultValue?.label||A.options[0].label,variant:I,onValueChange:O=>{const K=A.options[A.options.findIndex(Q=>Q.label===O)];b(K.graphSettings||{}),q(K.dataConfiguration)},children:A.options.map((O,K)=>l.jsx(Ce.RadioGroupItem,{label:O.label,value:O.label},K))})]},M)),p?.map((A,M)=>l.jsxs("div",{style:{width:A.width||`calc(${100/m}% - ${(m-1)/m}rem)`,flexGrow:1,flexShrink:A.ui!=="radio"?0:1,minWidth:"240px"},children:[l.jsx(Ce.Label,{className:"mb-2",children:A.label||`Visualize ${A.chartConfigId} by`}),xw(A.chartConfigId,V||[])?A.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:A.allowedColumnIds,isMulti:!0,variant:I,isSearchable:!0,controlShouldRenderValue:!0,defaultValue:o?o[o.findIndex(O=>O.chartConfigId===A.chartConfigId)].columnId.map(O=>A.allowedColumnIds[A.allowedColumnIds.findIndex(K=>K.value===O)]):void 0,filterOption:Ce.createFilter(B),onChange:O=>{const K={columnId:O.map(se=>se.value),chartConfigId:A.chartConfigId},Q=V?.map(se=>se.chartConfigId===K.chartConfigId?K:se);q(Q)},isRtl:e?.language==="ar"||e?.language==="he"}):l.jsx(Ce.CheckboxGroup,{variant:I,defaultValue:o?o[o.findIndex(O=>O.chartConfigId===A.chartConfigId)].columnId.map(O=>A.allowedColumnIds[A.allowedColumnIds.findIndex(K=>K.value===O)]).map(O=>O.value):[],onValueChange:O=>{const K={columnId:O||[],chartConfigId:A.chartConfigId},Q=V?.map(se=>se.chartConfigId===K.chartConfigId?K:se);q(Q)},children:A.allowedColumnIds.map((O,K)=>l.jsx(Ce.CheckboxGroupItem,{label:O.label,value:O.label},K))}):A.ui!=="radio"?l.jsx(Ce.DropdownSelect,{options:A.allowedColumnIds,isClearable:!1,isSearchable:!0,variant:I,defaultValue:o?A.allowedColumnIds[A.allowedColumnIds.findIndex(O=>O.value===o[o.findIndex(K=>K.chartConfigId===A.chartConfigId)].columnId)]:void 0,controlShouldRenderValue:!0,onChange:O=>{const K={columnId:O?.value,chartConfigId:A.chartConfigId},Q=V?.map(se=>se.chartConfigId===K.chartConfigId?K:se);b(O?.graphSettings||{}),q(Q)}}):l.jsx(Ce.RadioGroup,{variant:I,defaultValue:o?A.allowedColumnIds[A.allowedColumnIds.findIndex(O=>O.value===o[o.findIndex(K=>K.chartConfigId===A.chartConfigId)].columnId)].label:"",onValueChange:O=>{const K=A.allowedColumnIds[A.allowedColumnIds.findIndex(T=>T.label===O)],Q={columnId:K.value,chartConfigId:A.chartConfigId},se=V?.map(T=>T.chartConfigId===Q.chartConfigId?Q:T);b(K.graphSettings||{}),q(se)},children:A.allowedColumnIds.map((O,K)=>l.jsx(Ce.RadioGroupItem,{label:O.label,value:O.label},K))})]},M)),ae?.map((A,M)=>l.jsxs("div",{style:{width:A.width||`calc(${100/m}% - ${(m-1)/m}rem)`,flexGrow:1,flexShrink:0,flexWrap:"wrap"},children:[l.jsx(Ce.Label,{className:"mb-2",children:A.label}),A.singleSelect?l.jsx(Ce.DropdownSelect,{variant:I,options:A.availableValues,isClearable:A.clearable===void 0?!0:A.clearable,isRtl:e?.language==="ar"||e?.language==="he",isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:O=>{C(A.filter,O)},defaultValue:A.defaultValue}):l.jsxs(l.Fragment,{children:[l.jsx(Ce.DropdownSelect,{variant:I,options:A.availableValues,isMulti:!0,isClearable:A.clearable===void 0?!0:A.clearable,isSearchable:!0,controlShouldRenderValue:!0,filterOption:Ce.createFilter(B),onChange:O=>{C(A.filter,O)},defaultValue:A.defaultValue,isRtl:e?.language==="ar"||e?.language==="he"}),A.allowSelectAll?l.jsx("button",{className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",type:"button",onClick:()=>{C(A.filter,A.availableValues)},children:"Select all options"}):null]})]},M))]}):null,h!==!1&&e?.showColorScale!==!1?l.jsx(Hi,{width:e?.width,colorLegendTitle:e?.colorLegendTitle,colors:e?.colors||e?.lineColors||Pe[e?.theme||"light"].categoricalColors.colors,colorDomain:e?.colorDomain||e?.labels||[],showNAColor:e?.showNAColor===void 0||e?.showNAColor===null?!0:e?.showNAColor}):null,l.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"1rem",flexDirection:e?.language==="ar"||e?.language==="he"?"row-reverse":"row",justifyContent:"center"},children:D.map((A,M)=>l.jsx("div",{style:{width:`calc(${100/(s||Math.min(4,D.length||0))}% - ${((s||Math.min(4,D.length||0))-1)/(s||Math.min(4,D.length||0))}rem)`,minWidth:je(d)?"280px":`${d}px`},children:l.jsx(yw,{graph:r,graphDataConfiguration:V,graphData:Vc(a?Td(Ai(w,u||[]).filter(O=>O[c]===A),a.keyColumn,a.aggregationColumnsSetting):Ai(w,u||[]).filter(O=>O[c]===A),r,V)||[],debugMode:g,settings:{...e||{},..._,theme:e?.theme||j,width:void 0,height:void 0,relativeHeight:e?.relativeHeight||.67,minHeight:f,graphTitle:`${A}`,graphDescription:void 0,graphDownload:!1,dataDownload:!1,backgroundColor:void 0,padding:"0",footNote:void 0,sources:void 0,showColorScale:e?.showColorScale===!1?!1:h===!1},readableHeader:v||[]})},M))})]}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})}),e?.sources||e?.footNote?l.jsx(et,{styles:{footnote:e?.styles?.footnote,source:e?.styles?.source},classNames:{footnote:e?.classNames?.footnote,source:e?.classNames?.source},sources:e?.sources,footNote:e?.footNote,width:e?.width}):null]})})})})}function CE(t){const{chapters:e,visibilityThreshold:n=.5,mode:i="overlay",infoWidth:r="320px",infoPosition:a="left",infoBackgroundColor:o="rgba(255,255,255,0.8)"}=t,[s,c]=k.useState(0),u=[];return e.forEach((h,f)=>{h.sections.forEach((d,g)=>{u.push({chapter:f,dataSettings:h.dataSettings,section:g,graphType:h.graphType,infoBox:d.infoBox,graphSettings:{...h.graphSettings,...d.graphSettings||{},animate:!0},graphDataConfiguration:d.graphDataConfiguration||h.graphDataConfiguration||[]})})}),l.jsxs("div",{className:"relative w-full h-full",children:[l.jsx($e.div,{className:"fixed top-0 h-full -z-10",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},style:{left:i==="overlay"||a==="right"?0:r,width:i==="overlay"?"100%":`calc(100% - ${r})`},children:l.jsx(ol,{graphType:u[s].graphType,dataSettings:u[s].dataSettings,graphSettings:u[s].graphSettings,graphDataConfiguration:u[s].graphDataConfiguration})},u[s].chapter),l.jsx("div",{children:u.map((h,f)=>l.jsx(SE,{width:r,index:f,infoBox:h.infoBox,setActiveIndex:c,position:a,mode:i,visibilityThreshold:n,backgroundColor:o},`${h.chapter}-${h.section}`))})]})}function SE({infoBox:t,index:e,setActiveIndex:n,position:i,mode:r,visibilityThreshold:a,backgroundColor:o,width:s}){const c=k.useRef(null);return ct(c,{once:!1,amount:a})&&n(e),l.jsx("section",{ref:c,className:`min-h-screen flex ${i==="center"?"justify-center":i==="right"?"justify-end":"justify-start"}`,children:l.jsxs("div",{className:`p-8 ${r==="overlay"?"h-fit mx-10 ":""}`,style:{backgroundColor:o,width:s},children:[t.title,t.description]})})}function DE(t){const{config:e}=t,[n,i]=k.useState(void 0);return k.useEffect(()=>{(async()=>{if(typeof e=="string"){const a=await en(e);i(a)}else i(e)})()},[e]),n?l.jsx(vw,{dashboardID:n.dashboardID,dashboardLayout:n.dashboardLayout,dataSettings:n.dataSettings,filters:n.filters,debugMode:n.debugMode,theme:n.theme,readableHeader:n.readableHeader,dataFilters:n.dataFilters,noOfFiltersPerRow:n.noOfFiltersPerRow,filterPosition:n.filterPosition,uiMode:n.uiMode,graphStyles:n.graphStyles,graphClassNames:n.graphClassNames}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})}function ME(t){const{config:e}=t,[n,i]=k.useState(void 0);return k.useEffect(()=>{typeof e=="string"?en(e).then(a=>{i(a)}):i(e)},[e]),n?l.jsx(ww,{dashboardID:n.dashboardID,dashboardLayout:n.dashboardLayout,dataSettings:n.dataSettings,debugMode:n.debugMode,theme:n.theme,readableHeader:n.readableHeader,dataFilters:n.dataFilters,uiMode:n.uiMode,graphStyles:n.graphStyles,graphClassNames:n.graphClassNames}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})}function TE(t){const{config:e}=t,[n,i]=k.useState(void 0);return k.useEffect(()=>{typeof e=="string"?en(e).then(a=>{i(a)}):i(e)},[e]),n?l.jsx(ol,{graphSettings:n.graphSettings,dataSettings:n.dataSettings,filters:n.filters,graphType:n.graphType,dataTransform:n.dataTransform,graphDataConfiguration:n.graphDataConfiguration,dataFilters:n.dataFilters,debugMode:n.debugMode,dataSelectionOptions:n.dataSelectionOptions,advancedDataSelectionOptions:n.advancedDataSelectionOptions,readableHeader:n.readableHeader,noOfFiltersPerRow:n.noOfFiltersPerRow,uiMode:n.uiMode,highlightDataPointSettings:n.highlightDataPointSettings}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})}function kE(t){const{config:e}=t,[n,i]=k.useState(void 0);return k.useEffect(()=>{(async()=>{if(typeof e=="string"){const a=await en(e);i(a)}else i(e)})()},[e]),n?l.jsx(bw,{noOfColumns:n.noOfColumns,columnGridBy:n.columnGridBy,graphSettings:n.graphSettings,dataSettings:n.dataSettings,filters:n.filters,graphType:n.graphType,minGraphHeight:n.minGraphHeight,minGraphWidth:n.minGraphWidth,dataTransform:n.dataTransform,graphDataConfiguration:n.graphDataConfiguration,dataFilters:n.dataFilters,showCommonColorScale:n.showCommonColorScale,debugMode:n.debugMode,dataSelectionOptions:n.dataSelectionOptions,advancedDataSelectionOptions:n.advancedDataSelectionOptions,readableHeader:n.readableHeader,noOfFiltersPerRow:n.noOfFiltersPerRow,theme:n.theme}):l.jsx("div",{className:"w-full flex justify-center p-4",children:l.jsx(Ce.Spinner,{})})}const Cw=(t,e,n,i,r)=>{const a="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8",o=Bc.utils.json_to_sheet([i],{header:n,skipHeader:!0});o["!cols"]=r,Bc.utils.sheet_add_json(o,t,{header:n,skipHeader:!0,origin:-1});const s={Sheets:{data:o},SheetNames:["data"]},c=Bc.write(s,{bookType:"xlsx",type:"array"}),u=new Blob([c],{type:a});Hw.saveAs(u,`${e}.xlsx`)};function jE(t){const{buttonContent:e,buttonType:n="tertiary",csvData:i,fileName:r="data",headers:a,xlsxHeader:o,wscols:s,buttonSmall:c,className:u=""}=t;return l.jsx(Ce.Button,{variant:n,className:`${c?"p-2":"py-4 px-6"} ${u}`,onClick:()=>Cw(i,r,a,o,s),"aria-label":"Click to download the data as xlsx",children:e||l.jsx(Bf,{})})}function Rh(t,e){const n=zw.elementToSVG(t),r=new XMLSerializer().serializeToString(n),a=new Blob([r],{type:"application/xml"}),o=document.createElement("a");o.href=window.URL.createObjectURL(a),o.download=`${e}.svg`,document.body.appendChild(o),o.click(),document.body.removeChild(o)}function AE(t){const{nodeID:e,filename:n="image",buttonContent:i,buttonType:r="tertiary",buttonSmall:a,className:o=""}=t;return l.jsx(Ce.Button,{variant:r,className:`undp-viz-download-button ${a?"p-2":"py-4 px-6"} ${o}`,onClick:()=>{typeof e=="string"?document.getElementById(e)?Rh(document.getElementById(e),n):console.error("Cannot find the html element"):Rh(e,n)},"aria-label":"Click to download the graph as svg",children:i||l.jsx(kx,{})})}function _E(t){const{text:e,successMessage:n="Text copied",buttonText:i,buttonSmall:r=!1,className:a=""}=t,{toast:o}=Ce.useToast();return l.jsxs(l.Fragment,{children:[l.jsxs(Ce.Button,{variant:"tertiary",className:`${r?"p-2":"py-4 px-6"} ${a}`,onClick:()=>{navigator.clipboard.writeText(e),o({variant:"success",description:n,duration:1e3})},"aria-label":"Click to copy the text",children:[l.jsx(XA,{}),i||null]}),l.jsx(Ce.Toaster,{})]})}const OE=t=>{let e="";return t.forEach(i=>{e+=`~${`${i}`.replace(/ /g,"+")}`}),e.substring(1)};function Sw(t,e){let n="";return e.forEach(i=>{let r="";switch(typeof i.value){case"number":r=`${i.value}`;break;case"boolean":r=`${i.value}`;break;case"object":r=OE(i.value);break;default:r=`${i.value}`}n+=`&${i.id}=${r.replace(/ /g,"+").replaceAll("'","_")}`}),`${t}?${n}`}function NE(t,e){return`<iframe src="${Sw(t,e)}" loading="lazy" style="width: 100%; border: 0px none"></iframe>`}function IE(t,e){const n=t.slice().sort((r,a)=>r-a),i=Math.ceil(e/100*n.length)-1;return n[i]}function $E(){const t=[];return new URL(window.location.href).searchParams.forEach((e,n)=>{t.push({param:n,value:e.replaceAll("+"," ").replaceAll("_","'").split("~").length>1?e.replaceAll("+"," ").replaceAll("_","'").split("~"):e.replaceAll("+"," ").replaceAll("_","'")})}),t}function LE(t,e=2){const n=t.reduce((o,s)=>o+s,0)/t.length,i=Math.sqrt(t.reduce((o,s)=>o+(s-n)**2,0)/t.length),r=e*i;return t.filter(o=>Math.abs(o-n)<=r)}async function PE(t,e,n,i,r,a,o,s,c){try{const u=await(typeof t=="string"?i==="json"?en(t,a,s,!1):i==="api"?uo(t,o,a,s,!1):co(t,s,a,!1,r,!0):ts(t,c));return Vc(u,n,e)}catch(u){return console.error("Error fetching or processing data",u),null}}const Dw="https://raw.githubusercontent.com/UNDP-Data/undp-viz-library-schemas/refs/heads/main/";function EE(t){if(Fi.filter(e=>e.geoHubMapPresentation).map(e=>e.graphID).indexOf(t)!==-1)return null;switch(t){case"dataTable":return"dataSchema/dataTableDataSchema.json";case"dataCards":return"dataSchema/dataTableDataSchema.json";case"barChart":return"dataSchema/barGraphDataSchema.json";case"stackedBarChart":return"dataSchema/stackedBarGraphDataSchema.json";case"groupedBarChart":return"dataSchema/groupedBarGraphDataSchema.json";case"lineChart":return"dataSchema/lineChartDataSchema.json";case"dualAxisLineChart":return"dataSchema/dualAxisLineChartDataSchema.json";case"differenceLineChart":return"dataSchema/differenceLineChartDataSchema.json";case"multiLineChart":return"dataSchema/multiLineChartDataSchema.json";case"multiLineAltChart":return"dataSchema/multiLineAltChartDataSchema.json";case"stackedAreaChart":return"dataSchema/areaChartDataSchema.json";case"choroplethMap":return"dataSchema/choroplethMapDataSchema.json";case"threeDGlobe":return"dataSchema/choroplethMapDataSchema.json";case"bulletChart":return"dataSchema/bulletChartDataSchema.json";case"biVariateChoroplethMap":return"dataSchema/biVariateChoroplethMapDataSchema.json";case"dotDensityMap":return"dataSchema/dotDensityMapDataSchema.json";case"donutChart":return"dataSchema/donutChartDataSchema.json";case"slopeChart":return"dataSchema/slopeChartDataSchema.json";case"scatterPlot":return"dataSchema/scatterPlotDataSchema.json";case"dumbbellChart":return"dataSchema/dumbbellChartDataSchema.json";case"treeMap":return"dataSchema/treeMapDataSchema.json";case"circlePacking":return"dataSchema/circlePackingDataSchema.json";case"heatMap":return"dataSchema/heatMapDataSchema.json";case"stripChart":return"dataSchema/stripChartDataSchema.json";case"beeSwarmChart":return"dataSchema/beeSwarmChartDataSchema.json";case"butterflyChart":return"dataSchema/butterflyChartDataSchema.json";case"histogram":return"dataSchema/histogramDataSchema.json";case"sparkLine":return"dataSchema/lineChartDataSchema.json";case"paretoChart":return"dataSchema/paretoChartDataSchema.json";case"statCard":return"dataSchema/statCardDataSchema.json";case"unitChart":return"dataSchema/unitChartDataSchema.json";case"sankeyChart":return"dataSchema/sankeyChartDataSchema.json";case"lineChartWithConfidenceInterval":return"dataSchema/lineChartWithConfidenceIntervalDataSchema.json";case"radarChart":return"dataSchema/radarChartDataSchema.json";default:return console.error("Unknown chart type:",t),null}}function VE(t){switch(t){case"barChart":return"settingsSchema/simpleBarChartSettingsSchema.json";case"stackedBarChart":return"settingsSchema/stackedBarChartSettingsSchema.json";case"groupedBarChart":return"settingsSchema/groupedBarChartSettingsSchema.json";case"lineChart":return"settingsSchema/lineChartSettingsSchema.json";case"dualAxisLineChart":return"settingsSchema/dualAxisLineChartSettingsSchema.json";case"multiLineChart":return"settingsSchema/multiLineChartSettingsSchema.json";case"multiLineAltChart":return"settingsSchema/multiLineAltChartSettingsSchema.json";case"differenceLineChart":return"settingsSchema/differenceLineChartSettingsSchema.json";case"stackedAreaChart":return"settingsSchema/stackedAreaChartSettingsSchema.json";case"choroplethMap":return"settingsSchema/choroplethMapSettingsSchema.json";case"threeDGlobe":return"settingsSchema/threeDGlobeSettingsSchema.json";case"bulletChart":return"settingsSchema/bulletChartSettingsSchema.json";case"biVariateChoroplethMap":return"settingsSchema/biVariateChoroplethMapSettingsSchema.json";case"dotDensityMap":return"settingsSchema/dotDensityMapSettingsSchema.json";case"donutChart":return"settingsSchema/donutChartSettingsSchema.json";case"slopeChart":return"settingsSchema/slopeChartSettingsSchema.json";case"scatterPlot":return"settingsSchema/scatterPlotSettingsSchema.json";case"dumbbellChart":return"settingsSchema/dumbbellChartSettingsSchema.json";case"treeMap":return"settingsSchema/treeMapSettingsSchema.json";case"circlePacking":return"settingsSchema/circlePackingSettingsSchema.json";case"heatMap":return"settingsSchema/heatMapSettingsSchema.json";case"stripChart":return"settingsSchema/stripChartSettingsSchema.json";case"beeSwarmChart":return"settingsSchema/beeSwarmChartSettingsSchema.json";case"butterflyChart":return"settingsSchema/butterflyChartSettingsSchema.json";case"histogram":return"settingsSchema/histogramSettingsSchema.json";case"sparkLine":return"settingsSchema/sparkLineSettingsSchema.json";case"paretoChart":return"settingsSchema/paretoChartSettingsSchema.json";case"dataTable":return"settingsSchema/dataTableSettingsSchema.json";case"statCard":return"settingsSchema/statCardSettingsSchema.json";case"geoHubCompareMap":return"settingsSchema/geoHubCompareMapSettingsSchema.json";case"geoHubMap":return"settingsSchema/geoHubMapSettingsSchema.json";case"geoHubMapWithLayerSelection":return"settingsSchema/geoHubMapWithLayerSelectionSettingsSchema.json";case"unitChart":return"settingsSchema/unitChartSettingsSchema.json";case"sankeyChart":return"settingsSchema/sankeyChartSettingsSchema.json";case"lineChartWithConfidenceInterval":return"settingsSchema/lineChartWithConfidenceIntervalSettingsSchema.json";case"dataCards":return"settingsSchema/dataCardListSettingsSchema.json";case"allGraphs":return"settingsSchema/SettingsSchema.json";case"radarChart":return"settingsSchema/radarChartSettingsSchema.json";default:return console.error("Unknown chart type:",t),null}}async function Mw(t){const e=await fetch(`${Dw}${EE(t)}`);if(!e.ok)throw new Error(`Response status: ${e.status}`);return await e.json()}async function ta(t){const e=await fetch(`${Dw}${VE(t)}`);if(!e.ok)throw new Error(`Response status: ${e.status}`);return await e.json()}function FE(t){switch(t){case"barChart":return["label","size","color","date"];case"bulletChart":return["label","size","target","qualitativeRange"];case"treeMap":return["label","size","color"];case"circlePacking":return["label","size","color"];case"butterflyChart":return["label","leftBar","rightBar","date"];case"groupedBarChart":return["label","size","date"];case"stackedBarChart":return["label","size","date"];case"dumbbellChart":return["x","label","date"];case"donutChart":return["size","label"];case"histogram":return["value"];case"choroplethMap":return["x","id","date"];case"threeDGlobe":return["x","id"];case"biVariateChoroplethMap":return["x","y","id","date"];case"lineChart":return["date","y"];case"multiLineChart":return["date","y"];case"multiLineAltChart":return["date","y","label","color"];case"radarChart":return["values","label","color"];case"stackedAreaChart":return["date","y"];case"scatterPlot":return["x","y","radius","color","label","date"];case"dualAxisLineChart":return["date","y1","y2"];case"paretoChart":return["label","bar","line"];case"dotDensityMap":return["lat","long","radius","color","label","date"];case"slopeChart":return["y1","y2","color","label"];case"heatMap":return["row","column","value"];case"beeSwarmChart":return["label","position","radius","color"];case"stripChart":return["label","position","color"];case"statCard":return["value"];case"sankeyChart":return["source","target","value"];case"differenceLineChart":return["date","y1","y2"];case"unitChart":return["label","value"];case"sparkLine":return["date","y"];case"lineChartWithConfidenceInterval":return["date","y","yMin","yMax"];case"dashboardWideToLong":return["label","size","color","value"];case"dashboard":return["label","radius","size","row","y1","y","rightBar","position","leftBar","x","bar","line","y2","column","date","value","color","long","lat","id","source","target","yMin","yMax"];default:return["label","radius","size","row","y1","y","rightBar","position","leftBar","x","bar","line","y2","column","date","value","color","long","lat","id","source","target","yMin","yMax"]}}function Ri(t){return!t||t.length===0?{}:{enum:t}}const i0=t=>({items:{properties:{column:{type:"string",...Ri(t)},delimiter:{type:"string"}},type:"object",required:["column"]},type:"array"}),Za=t=>({properties:{columnsToArray:i0(t),data:{},dataURL:{oneOf:[{type:"string"},{type:"array",items:{type:"object",properties:{fileType:{enum:["csv","json","api"],type:"string"},apiHeaders:{},dataTransformation:{type:"string"},idColumnName:{type:"string"},dataURL:{type:"string"},delimiter:{type:"string"},columnsToArray:i0()},required:["dataURL","idColumnName"]}}]},delimiter:{type:"string"},fileType:{enum:["csv","json","api"],type:"string"},apiHeaders:{},dataTransformation:{type:"string"},idColumnTitle:{type:"string"}},type:"object"}),Ja=t=>({type:"array",items:{type:"object",properties:{value:{type:"string",...Ri(t)},label:{type:"string"}},required:["value","label"]}}),Yo=t=>({items:{properties:{clearable:{type:"boolean"},allowSelectAll:{type:"boolean"},width:{type:"string"},excludeValues:{items:{type:"string"},type:"array"},column:{type:"string",...Ri(t)},defaultValue:{anyOf:[{items:{oneOf:[{type:"string"},{type:"number"}]},type:"array"},{type:"string"},{type:"number"}]},label:{type:"string"},ui:{type:"string",enum:["select","radio"]},singleSelect:{type:"boolean"}},required:["column"],type:"object"},type:"array"}),qo=async t=>{const e=await ta("allGraphs");return{type:"array",items:{type:"object",properties:{chartConfigId:{type:"string"},label:{type:"string"},width:{type:"string"},allowedColumnIds:{type:"array",items:{type:"object",properties:{value:{type:"string",...Ri(t)},label:{type:"string"},graphSettings:e},required:["value","label"]},minItems:1},ui:{type:"string",enum:["select","radio"]}},required:["chartConfigId","allowedColumnIds"]}}},Ar=t=>({type:"array",items:{type:"object",properties:{column:{type:"string",...Ri(t)},includeValues:{type:"array",items:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]}},excludeValues:{type:"array",items:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]}}},required:["column"]}}),Uo=t=>({type:"object",properties:{keyColumn:{type:"string",...Ri(t)},aggregationColumnsSetting:{type:"array",items:{type:"object",properties:{column:{type:"string",...Ri(t)},aggregationMethod:{type:"string",enum:["sum","average","min","max"]}},required:["column"]}}},required:["keyColumn"]}),eo=(t,e)=>({type:"array",items:{type:"object",properties:{columnId:{oneOf:[{type:"string",...Ri(t)},{type:"array",items:{type:"string",...Ri(t)}}]},chartConfigId:{type:"string",...Ri(FE(e))}},required:["columnId","chartConfigId"]}}),qs=async(t,e)=>{const n=await ta("allGraphs");return{type:"array",items:{type:"object",properties:{chartConfigId:{type:"string"},label:{type:"string"},width:{type:"string"},options:{type:"array",items:{type:"object",properties:{dataConfiguration:eo(t,e),label:{type:"string"},graphSettings:n},required:["dataConfiguration","label"]},minItems:1},defaultValue:{type:"array",items:{type:"object",properties:{dataConfiguration:eo(t,e),label:{type:"string"},graphSettings:n},required:["dataConfiguration","label"]},minItems:1},ui:{type:"string",enum:["select","radio"]}},required:["chartConfigId","options"]}}},Tw=async(t,e)=>{const n=await ta(e||"allGraphs");return e&&Fi.filter(i=>i.geoHubMapPresentation).map(i=>i.graphID).indexOf(e)!==-1?{type:"object",properties:{graphSettings:n,graphType:{type:"string",enum:Fi.filter(i=>i.geoHubMapPresentation).map(i=>i.graphID)},debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},uiMode:{type:"string",enum:["light","normal"]},classNames:{type:"object"},highlightDataPointSettings:{type:"object",properties:{column:{type:"string"},label:{type:"string"},defaultValues:{oneOf:[{type:"array",items:{type:"string"}},{type:"array",items:{type:"number"}}]},excludeValues:{type:"array",items:{type:"string"}},allowSelectAll:{type:"boolean"},width:{type:"string"}},required:["column"]},styles:{type:"object"}},required:["graphType"]}:e==="dataTable"||e==="dataCards"?{type:"object",properties:{graphSettings:n,dataSettings:Za(t),filters:Yo(t),noOfFiltersPerRow:{type:"number"},graphType:{type:"string",enum:["dataTable","dataCards"]},dataTransform:Uo(t),dataFilters:Ar(t),readableHeader:Ja(t),dataSelectionOptions:qo(t),advancedDataSelectionOptions:qs(t,e),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},uiMode:{type:"string",enum:["light","normal"]},classNames:{type:"object"},highlightDataPointSettings:{type:"object",properties:{column:{type:"string"},label:{type:"string"},defaultValues:{oneOf:[{type:"array",items:{type:"string"}},{type:"array",items:{type:"number"}}]},excludeValues:{type:"array",items:{type:"string"}},allowSelectAll:{type:"boolean"},width:{type:"string"}},required:["column"]},styles:{type:"object"}},required:["dataSettings","graphType"]}:{type:"object",properties:{graphSettings:n,dataSettings:Za(t),filters:Yo(t),classNames:{type:"object"},styles:{type:"object"},graphType:{type:"string",enum:Fi.map(i=>i.graphID)},noOfFiltersPerRow:{type:"number"},dataTransform:Uo(t),dataFilters:Ar(t),graphDataConfiguration:eo(t,e),readableHeader:Ja(t),dataSelectionOptions:qo(t),advancedDataSelectionOptions:qs(t,e),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},highlightDataPointSettings:{type:"object",properties:{column:{type:"string"},label:{type:"string"},defaultValues:{oneOf:[{type:"array",items:{type:"string"}},{type:"array",items:{type:"number"}}]},excludeValues:{type:"array",items:{type:"string"}},allowSelectAll:{type:"boolean"},width:{type:"string"}},required:["column"]},uiMode:{type:"string",enum:["light","normal"]}},required:e?["dataSettings","graphType","graphDataConfiguration"]:["graphType"]}},kw=async(t,e)=>{const n=await ta(e||"allGraphs");return e==="dataTable"||e==="dataCards"?{type:"object",properties:{graphSettings:n,dataSettings:Za(t),filters:Yo(t),classNames:{type:"object"},styles:{type:"object"},noOfFiltersPerRow:{type:"number"},graphType:{type:"string",enum:["dataTable","dataCards"]},uiMode:{type:"string",enum:["light","normal"]},dataTransform:Uo(t),dataFilters:Ar(t),noOfColumns:{type:"number"},columnGridBy:{type:"string"},showCommonColorScale:{type:"boolean"},minGraphHeight:{type:"number"},minGraphWidth:{type:"number"},readableHeader:Ja(t),dataSelectionOptions:qo(t),advancedDataSelectionOptions:qs(t,e),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]}},required:["columnGridBy","dataSettings","graphType"]}:{type:"object",properties:{graphSettings:n,dataSettings:Za(t),filters:Yo(t),classNames:{type:"object"},styles:{type:"object"},noOfFiltersPerRow:{type:"number"},graphType:{type:"string",enum:Fi.filter(i=>i.availableInGriddedGraph!==!1).map(i=>i.graphID)},uiMode:{type:"string",enum:["light","normal"]},dataTransform:Uo(t),dataFilters:Ar(t),graphDataConfiguration:eo(t,e),noOfColumns:{type:"number"},columnGridBy:{type:"string"},showCommonColorScale:{type:"boolean"},minGraphHeight:{type:"number"},minGraphWidth:{type:"number"},readableHeader:Ja(t),dataSelectionOptions:qo(t),advancedDataSelectionOptions:qs(t,e),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]}},required:e?["columnGridBy","dataSettings","graphType","graphDataConfiguration"]:["columnGridBy","dataSettings","graphType"]}},jw=async t=>{const e=await ta("allGraphs");return{properties:{dashboardID:{type:"string"},graphClassNames:{type:"object"},graphStyles:{type:"object"},dashboardLayout:{properties:{backgroundColor:{type:["string","boolean"]},description:{type:"string"},language:{enum:["ar","en","he"],type:"string"},padding:{type:"string"},title:{type:"string"},rows:{items:{properties:{columns:{items:{properties:{columnWidth:{type:"number"},dataFilters:Ar(),dataTransform:Uo(),graphDataConfiguration:eo(void 0,"dashboard"),graphType:{enum:Fi.map(n=>n.graphID),type:"string"},settings:e,dataSelectionOptions:qo(),advancedDataSelectionOptions:qs(),attachedFilter:{type:"string",...Ri(t)}},type:"object",required:["graphType"]},type:"array"},height:{type:"number"}},type:"object",required:["columns"]},type:"array"}},type:"object",required:["rows"]},dataSettings:Za(t),filters:Yo(t),noOfFiltersPerRow:{type:"number"},uiMode:{type:"string",enum:["light","normal"]},filterPosition:{type:"string",enum:["top","side"]},readableHeader:Ja(t),dataFilters:Ar(t),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},graphBackgroundColor:{oneOf:[{type:"string"},{type:"boolean"}]}},type:"object",required:["dashboardLayout","dataSettings"]}},Aw=async()=>{const t=await ta("allGraphs");return{properties:{dashboardID:{type:"string"},graphClassNames:{type:"object"},graphStyles:{type:"object"},dashboardLayout:{properties:{backgroundColor:{type:["string","boolean"]},description:{type:"string"},language:{enum:["ar","en","he"],type:"string"},padding:{type:"string"},dropdownLabel:{type:"string"},title:{type:"string"},rows:{items:{properties:{columns:{items:{properties:{columnWidth:{type:"number"},dataFilters:Ar(),graphDataConfiguration:eo(void 0,"dashboardWideToLong"),graphType:{enum:Fi.filter(e=>e.availableInWideToLongFormat).map(e=>e.graphID),type:"string"},settings:t},type:"object",required:["graphType"]},type:"array"},height:{type:"number"}},type:"object",required:["columns"]},type:"array"}},type:"object",required:["rows"]},dataSettings:{properties:{...Za().properties,keyColumn:{type:"string"}},required:["keyColumn"],type:"object"},uiMode:{type:"string",enum:["light","normal"]},dataFilters:Ar(),readableHeader:Ja(),debugMode:{type:"boolean"},theme:{type:"string",enum:["dark","light"]},graphBackgroundColor:{oneOf:[{type:"string"},{type:"boolean"}]}},type:"object",required:["dashboardLayout","dataSettings"]}};async function RE(t,e){let n;try{n=(await import("ajv")).default}catch(s){throw console.error(s),new Error("AJV is not installed. Please install it to use runtime validation.")}const i=new n({allErrors:!0,allowUnionTypes:!0});if(Fi.filter(s=>s.geoHubMapPresentation).map(s=>s.graphID).indexOf(e)!==-1)return{isValid:!0,err:void 0};if(!t)return{isValid:!1,err:"No data provided"};if(e==="dataTable"||e==="dataCards"||t.length===0)return{isValid:!0,err:void 0};const r=await Mw(e);if(!r)return{isValid:!1,err:`Invalid chart type: ${e}`};const a=i.compile(r);return a(t)?{isValid:!0,err:void 0}:(console.error(a.errors),{isValid:!1,err:a.errors?.map(s=>`Error at ${s.instancePath}: ${s.message}`).join("; ")})}async function BE(t,e){let n;try{n=(await import("ajv")).default}catch(s){throw console.error(s),new Error("AJV is not installed. Please install it to use runtime validation.")}const i=new n({allErrors:!0,allowUnionTypes:!0}),r=await ta(e);if(!r)return{isValid:!1,err:`Invalid chart type: ${e}`};const a=i.compile(r);return a(t)?{isValid:!0,err:void 0}:(console.error(a.errors),{isValid:!1,err:a.errors?.map(s=>`Error at ${s.instancePath}: ${s.message}`).join("; ")})}async function HE(t,e){let n;try{n=(await import("ajv")).default}catch(s){throw console.error(s),new Error("AJV is not installed. Please install it to use runtime validation.")}const i=new n({allErrors:!0,allowUnionTypes:!0});let r;switch(e){case"griddedGraph":r=kw(void 0,t.graphType);break;case"multiGraphDashboard":r=jw();break;case"singleGraphDashboard":r=Tw(void 0,t.graphType);break;case"multiGraphDashboardWideToLongFormat":r=Aw();break}if(!r)return{isValid:!1,err:`Invalid chart type: ${e}`};const a=i.compile(r);return a(t)?{isValid:!0,err:void 0}:(console.error(a.errors),{isValid:!1,err:a.errors?.map(s=>`Error at ${s.instancePath}: ${s.message}`).join("; ")})}exports.AreaChart=Qv;exports.BasicStatCard=uP;exports.BeeSwarmChart=nv;exports.BiVariateChoroplethMap=Bv;exports.BulletChart=Kv;exports.ButterflyChart=hw;exports.ChoroplethMap=Hv;exports.CirclePackingGraph=td;exports.ColorLegend=Hi;exports.ColorLegendWithMouseOver=tn;exports.Colors=Pe;exports.CopyTextButton=_E;exports.CsvDownloadButton=Hf;exports.DataCards=sw;exports.DataTable=ow;exports.DifferenceLineChart=wv;exports.DonutChart=rd;exports.DotDensityMap=Wv;exports.DualAxisLineChart=pv;exports.DumbbellChart=tv;exports.ExcelDownloadButton=jE;exports.FootNote=yx;exports.GeoHubCompareMaps=Yv;exports.GeoHubMap=Gv;exports.GeoHubMapWithLayerSelection=qv;exports.GraphDescription=Vx;exports.GraphFooter=et;exports.GraphHeader=Qe;exports.GraphList=Fi;exports.GraphTitle=Fx;exports.GriddedGraphs=bw;exports.GriddedGraphsFromConfig=kE;exports.GroupedBarGraph=Rx;exports.HeatMap=aw;exports.Histogram=fw;exports.ImageDownloadButton=Ex;exports.LineChartWithConfidenceInterval=mv;exports.LinearColorLegend=iw;exports.MultiGraphDashboard=vw;exports.MultiGraphDashboardFromConfig=DE;exports.MultiGraphDashboardWideToLongFormat=ww;exports.MultiGraphDashboardWideToLongFormatFromConfig=ME;exports.MultiLineAltChart=vv;exports.MultiLineChart=xv;exports.ParetoChart=uw;exports.RadarChart=mw;exports.SVGDownloadButton=AE;exports.SankeyChart=pw;exports.ScatterPlot=Uv;exports.ScrollStory=CE;exports.SimpleBarGraph=Gf;exports.SimpleLineChart=yv;exports.SingleGraphDashboard=ol;exports.SingleGraphDashboardFromConfig=TE;exports.SlopeChart=Xv;exports.Source=xx;exports.SparkLine=bv;exports.StackedBarGraph=Bx;exports.StatCardFromData=Zv;exports.StripChart=cw;exports.ThreeDGlobe=zv;exports.ThresholdColorLegendWithMouseOver=rw;exports.TreeMapGraph=Md;exports.UnitChart=nw;exports.checkIfNullOrUndefined=je;exports.excelDownload=Cw;exports.fetchAndParseCSV=co;exports.fetchAndParseCSVFromTextBlob=HL;exports.fetchAndParseJSON=en;exports.fetchAndParseMultipleDataSources=ts;exports.fetchAndTransformDataFromAPI=uo;exports.generateEmbedLink=Sw;exports.generateIframeCode=NE;exports.getDashboardJSONSchema=jw;exports.getDashboardWideToLongFormatJSONSchema=Aw;exports.getDataFiltersSchema=Ar;exports.getDataSchema=Mw;exports.getDataSelectionSchema=qo;exports.getDataSettingsSchema=Za;exports.getDataTransformSchema=Uo;exports.getFiltersSchema=Yo;exports.getGraphDataConfigurationSchema=eo;exports.getGriddedGraphJSONSchema=kw;exports.getJenks=Gs;exports.getPercentileValue=IE;exports.getQueryParamsFromLink=$E;exports.getReadableHeaderSchema=Ja;exports.getSettingsSchema=ta;exports.getSingleGraphJSONSchema=Tw;exports.getTextColorBasedOnBgColor=yn;exports.getUniqValue=jr;exports.imageDownload=xh;exports.numberFormattingFunction=qe;exports.removeOutliers=LE;exports.svgDownload=Rh;exports.transformColumnsToArray=$r;exports.transformDataForAggregation=Td;exports.transformDataForGraph=Vc;exports.transformDataForGraphFromFile=PE;exports.validateConfigSchema=HE;exports.validateDataSchema=RE;exports.validateSettingsSchema=BE;
|
|
68
68
|
//# sourceMappingURL=index.cjs.map
|