UNPKG

@xintao1105/rose-pie

Version:

```bash npm install @xintao1105/rose-pie ```

28 lines (24 loc) 36.6 kB
"use strict";var mt=Object.defineProperty;var xt=(s,i,o)=>i in s?mt(s,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[i]=o;var Fe=(s,i,o)=>(xt(s,typeof i!="symbol"?i+"":i,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("react"),vt=require("@feige0629/debug-console"),bt=require("d3"),X=require("clone");function St(s){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const o in s)if(o!=="default"){const p=Object.getOwnPropertyDescriptor(s,o);Object.defineProperty(i,o,p.get?p:{enumerable:!0,get:()=>s[o]})}}return i.default=s,Object.freeze(i)}const le=St(bt);var Me={exports:{}},je={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Je;function yt(){if(Je)return je;Je=1;var s=te,i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),p=Object.prototype.hasOwnProperty,n=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function m(d,u,E){var t,y={},k=null,C=null;E!==void 0&&(k=""+E),u.key!==void 0&&(k=""+u.key),u.ref!==void 0&&(C=u.ref);for(t in u)p.call(u,t)&&!c.hasOwnProperty(t)&&(y[t]=u[t]);if(d&&d.defaultProps)for(t in u=d.defaultProps,u)y[t]===void 0&&(y[t]=u[t]);return{$$typeof:i,type:d,key:k,ref:C,props:y,_owner:n.current}}return je.Fragment=o,je.jsx=m,je.jsxs=m,je}var ke={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Xe;function _t(){return Xe||(Xe=1,process.env.NODE_ENV!=="production"&&function(){var s=te,i=Symbol.for("react.element"),o=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),d=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),t=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),G=Symbol.iterator,h="@@iterator";function r(e){if(e===null||typeof e!="object")return null;var a=G&&e[G]||e[h];return typeof a=="function"?a:null}var T=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(e){{for(var a=arguments.length,l=new Array(a>1?a-1:0),g=1;g<a;g++)l[g-1]=arguments[g];W("error",e,l)}}function W(e,a,l){{var g=T.ReactDebugCurrentFrame,S=g.getStackAddendum();S!==""&&(a+="%s",l=l.concat([S]));var R=l.map(function(v){return String(v)});R.unshift("Warning: "+a),Function.prototype.apply.call(console[e],console,R)}}var Z=!1,L=!1,se=!1,re=!1,b=!1,I;I=Symbol.for("react.module.reference");function $(e){return!!(typeof e=="string"||typeof e=="function"||e===p||e===c||b||e===n||e===E||e===t||re||e===C||Z||L||se||typeof e=="object"&&e!==null&&(e.$$typeof===k||e.$$typeof===y||e.$$typeof===m||e.$$typeof===d||e.$$typeof===u||e.$$typeof===I||e.getModuleId!==void 0))}function O(e,a,l){var g=e.displayName;if(g)return g;var S=a.displayName||a.name||"";return S!==""?l+"("+S+")":l}function be(e){return e.displayName||"Context"}function M(e){if(e==null)return null;if(typeof e.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case p:return"Fragment";case o:return"Portal";case c:return"Profiler";case n:return"StrictMode";case E:return"Suspense";case t:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var a=e;return be(a)+".Consumer";case m:var l=e;return be(l._context)+".Provider";case u:return O(e,e.render,"ForwardRef");case y:var g=e.displayName||null;return g!==null?g:M(e.type)||"Memo";case k:{var S=e,R=S._payload,v=S._init;try{return M(v(R))}catch{return null}}}return null}var H=Object.assign,Q=0,Se,z,D,B,A,V,ce;function ye(){}ye.__reactDisabledLog=!0;function $e(){{if(Q===0){Se=console.log,z=console.info,D=console.warn,B=console.error,A=console.group,V=console.groupCollapsed,ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ye,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Q++}}function Pe(){{if(Q--,Q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:H({},e,{value:Se}),info:H({},e,{value:z}),warn:H({},e,{value:D}),error:H({},e,{value:B}),group:H({},e,{value:A}),groupCollapsed:H({},e,{value:V}),groupEnd:H({},e,{value:ce})})}Q<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=T.ReactCurrentDispatcher,_e;function pe(e,a,l){{if(_e===void 0)try{throw Error()}catch(S){var g=S.stack.trim().match(/\n( *(at )?)/);_e=g&&g[1]||""}return` `+_e+e}}var Re=!1,ne;{var we=typeof WeakMap=="function"?WeakMap:Map;ne=new we}function ue(e,a){if(!e||Re)return"";{var l=ne.get(e);if(l!==void 0)return l}var g;Re=!0;var S=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var R;R=fe.current,fe.current=null,$e();try{if(a){var v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(J){g=J}Reflect.construct(e,[],v)}else{try{v.call()}catch(J){g=J}e.call(v.prototype)}}else{try{throw Error()}catch(J){g=J}e()}}catch(J){if(J&&g&&typeof J.stack=="string"){for(var x=J.stack.split(` `),N=g.stack.split(` `),j=x.length-1,P=N.length-1;j>=1&&P>=0&&x[j]!==N[P];)P--;for(;j>=1&&P>=0;j--,P--)if(x[j]!==N[P]){if(j!==1||P!==1)do if(j--,P--,P<0||x[j]!==N[P]){var Y=` `+x[j].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),typeof e=="function"&&ne.set(e,Y),Y}while(j>=1&&P>=0);break}}}finally{Re=!1,fe.current=R,Pe(),Error.prepareStackTrace=S}var ve=e?e.displayName||e.name:"",qe=ve?pe(ve):"";return typeof e=="function"&&ne.set(e,qe),qe}function Oe(e,a,l){return ue(e,!1)}function Ce(e){var a=e.prototype;return!!(a&&a.isReactComponent)}function de(e,a,l){if(e==null)return"";if(typeof e=="function")return ue(e,Ce(e));if(typeof e=="string")return pe(e);switch(e){case E:return pe("Suspense");case t:return pe("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Oe(e.render);case y:return de(e.type,a,l);case k:{var g=e,S=g._payload,R=g._init;try{return de(R(S),a,l)}catch{}}}return""}var ge=Object.prototype.hasOwnProperty,he={},q=T.ReactDebugCurrentFrame;function oe(e){if(e){var a=e._owner,l=de(e.type,e._source,a?a.type:null);q.setExtraStackFrame(l)}else q.setExtraStackFrame(null)}function ae(e,a,l,g,S){{var R=Function.call.bind(ge);for(var v in e)if(R(e,v)){var x=void 0;try{if(typeof e[v]!="function"){var N=Error((g||"React class")+": "+l+" type `"+v+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[v]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw N.name="Invariant Violation",N}x=e[v](a,v,g,l,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(j){x=j}x&&!(x instanceof Error)&&(oe(S),_("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",g||"React class",l,v,typeof x),oe(null)),x instanceof Error&&!(x.message in he)&&(he[x.message]=!0,oe(S),_("Failed %s type: %s",l,x.message),oe(null))}}}var ee=Array.isArray;function f(e){return ee(e)}function Ee(e){{var a=typeof Symbol=="function"&&Symbol.toStringTag,l=a&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l}}function me(e){try{return ie(e),!1}catch{return!0}}function ie(e){return""+e}function F(e){if(me(e))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ee(e)),ie(e)}var Te=T.ReactCurrentOwner,et={key:!0,ref:!0,__self:!0,__source:!0},Ae,Ye,Ve;Ve={};function tt(e){if(ge.call(e,"ref")){var a=Object.getOwnPropertyDescriptor(e,"ref").get;if(a&&a.isReactWarning)return!1}return e.ref!==void 0}function rt(e){if(ge.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function nt(e,a){if(typeof e.ref=="string"&&Te.current&&a&&Te.current.stateNode!==a){var l=M(Te.current.type);Ve[l]||(_('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',M(Te.current.type),e.ref),Ve[l]=!0)}}function ot(e,a){{var l=function(){Ae||(Ae=!0,_("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}}function at(e,a){{var l=function(){Ye||(Ye=!0,_("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};l.isReactWarning=!0,Object.defineProperty(e,"ref",{get:l,configurable:!0})}}var it=function(e,a,l,g,S,R,v){var x={$$typeof:i,type:e,key:a,ref:l,props:v,_owner:R};return x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(x,"_self",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.defineProperty(x,"_source",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x};function lt(e,a,l,g,S){{var R,v={},x=null,N=null;l!==void 0&&(F(l),x=""+l),rt(a)&&(F(a.key),x=""+a.key),tt(a)&&(N=a.ref,nt(a,S));for(R in a)ge.call(a,R)&&!et.hasOwnProperty(R)&&(v[R]=a[R]);if(e&&e.defaultProps){var j=e.defaultProps;for(R in j)v[R]===void 0&&(v[R]=j[R])}if(x||N){var P=typeof e=="function"?e.displayName||e.name||"Unknown":e;x&&ot(v,P),N&&at(v,P)}return it(e,x,N,S,g,Te.current,v)}}var Ie=T.ReactCurrentOwner,De=T.ReactDebugCurrentFrame;function xe(e){if(e){var a=e._owner,l=de(e.type,e._source,a?a.type:null);De.setExtraStackFrame(l)}else De.setExtraStackFrame(null)}var Ne;Ne=!1;function We(e){return typeof e=="object"&&e!==null&&e.$$typeof===i}function Le(){{if(Ie.current){var e=M(Ie.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function st(e){{if(e!==void 0){var a=e.fileName.replace(/^.*[\\\/]/,""),l=e.lineNumber;return` Check your code at `+a+":"+l+"."}return""}}var He={};function ct(e){{var a=Le();if(!a){var l=typeof e=="string"?e:e.displayName||e.name;l&&(a=` Check the top-level render call using <`+l+">.")}return a}}function Be(e,a){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var l=ct(a);if(He[l])return;He[l]=!0;var g="";e&&e._owner&&e._owner!==Ie.current&&(g=" It was passed a child from "+M(e._owner.type)+"."),xe(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',l,g),xe(null)}}function Ue(e,a){{if(typeof e!="object")return;if(f(e))for(var l=0;l<e.length;l++){var g=e[l];We(g)&&Be(g,a)}else if(We(e))e._store&&(e._store.validated=!0);else if(e){var S=r(e);if(typeof S=="function"&&S!==e.entries)for(var R=S.call(e),v;!(v=R.next()).done;)We(v.value)&&Be(v.value,a)}}}function ft(e){{var a=e.type;if(a==null||typeof a=="string")return;var l;if(typeof a=="function")l=a.propTypes;else if(typeof a=="object"&&(a.$$typeof===u||a.$$typeof===y))l=a.propTypes;else return;if(l){var g=M(a);ae(l,e.props,"prop",g,e)}else if(a.PropTypes!==void 0&&!Ne){Ne=!0;var S=M(a);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",S||"Unknown")}typeof a.getDefaultProps=="function"&&!a.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pt(e){{for(var a=Object.keys(e.props),l=0;l<a.length;l++){var g=a[l];if(g!=="children"&&g!=="key"){xe(e),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",g),xe(null);break}}e.ref!==null&&(xe(e),_("Invalid attribute `ref` supplied to `React.Fragment`."),xe(null))}}function Ge(e,a,l,g,S,R){{var v=$(e);if(!v){var x="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(x+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var N=st(S);N?x+=N:x+=Le();var j;e===null?j="null":f(e)?j="array":e!==void 0&&e.$$typeof===i?(j="<"+(M(e.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):j=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",j,x)}var P=lt(e,a,l,S,R);if(P==null)return P;if(v){var Y=a.children;if(Y!==void 0)if(g)if(f(Y)){for(var ve=0;ve<Y.length;ve++)Ue(Y[ve],e);Object.freeze&&Object.freeze(Y)}else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ue(Y,e)}return e===p?pt(P):ft(P),P}}function ut(e,a,l){return Ge(e,a,l,!0)}function dt(e,a,l){return Ge(e,a,l,!1)}var gt=dt,ht=ut;ke.Fragment=p,ke.jsx=gt,ke.jsxs=ht}()),ke}process.env.NODE_ENV==="production"?Me.exports=yt():Me.exports=_t();var w=Me.exports;const Rt="_legend_wrapper_1nuwc_1",wt="_legend_wrapper_ul_1nuwc_5",Ct="_legend_wrapper_li_1nuwc_10",Et="_legend_module_contentStyle_1nuwc_15",Tt="_label_line_1nuwc_22",Ft="_dash_1nuwc_1",jt="_label_text_1nuwc_27",kt="_show_1nuwc_1",$t="_inner_arc_1nuwc_31",K={legend_wrapper:Rt,legend_wrapper_ul:wt,legend_wrapper_li:Ct,legend_module_contentStyle:Et,label_line:Tt,dash:Ft,label_text:jt,show:kt,inner_arc:$t},Pt=(s,i)=>{const{category:o,proportion:p,trueValue:n,legendSpacing:c,layoutSpacing:m,layoutNumberColumns:d,layoutDeviation:u,legendPosition:E}=s;if(s&&typeof s!="boolean"){let t={},y={},k={},C={};if(o&&typeof o!="boolean"){const r=o.textStyle;t={fontSize:(r==null?void 0:r.fontSize)+"px",color:r==null?void 0:r.color,fontFamily:r==null?void 0:r.fontFamily,fontWeight:r==null?void 0:r.fontWeight,fontStyle:r==null?void 0:r.fontStyle,lineHeight:(r==null?void 0:r.lineHeight)+"px",letterSpacing:(r==null?void 0:r.letterSpacing)+"px",paddingLeft:c+"px"}}if(p&&typeof p!="boolean"){const r=p.textStyle;y={fontSize:(r==null?void 0:r.fontSize)+"px",color:r==null?void 0:r.color,fontFamily:r==null?void 0:r.fontFamily,fontWeight:r==null?void 0:r.fontWeight,fontStyle:r==null?void 0:r.fontStyle,lineHeight:(r==null?void 0:r.lineHeight)+"px",letterSpacing:(r==null?void 0:r.letterSpacing)+"px",marginLeft:p.spacing+"px"}}if(n&&typeof n!="boolean"){const r=n.textStyle;if(k={fontSize:(r==null?void 0:r.fontSize)+"px",color:r==null?void 0:r.color,fontFamily:r==null?void 0:r.fontFamily,fontWeight:r==null?void 0:r.fontWeight,fontStyle:r==null?void 0:r.fontStyle,lineHeight:(r==null?void 0:r.lineHeight)+"px",letterSpacing:(r==null?void 0:r.letterSpacing)+"px",marginLeft:n.spacing+"px",display:"flex",alignItems:"center",justifyContent:"flex-start"},n.suffix&&typeof n.suffix!="boolean"){const T=n.suffix.deviation;C={fontSize:n.suffix.fontSize+"px",transform:"translate3d(0px, 0px, 0px)",color:r==null?void 0:r.color,fontFamily:r==null?void 0:r.fontFamily,fontWeight:r==null?void 0:r.fontWeight,fontStyle:r==null?void 0:r.fontStyle,lineHeight:(r==null?void 0:r.lineHeight)+"px",letterSpacing:(r==null?void 0:r.letterSpacing)+"px",marginLeft:T.x+"px",marginTop:T.y+"px"}}}const G={display:"grid",gap:`${m==null?void 0:m.row}px ${m==null?void 0:m.column}px`,gridTemplateColumns:`repeat(${d}, ${d}fr)`};return{show:!0,legendStyle:{position:"absolute",height:"auto",display:"flex",...Vt(E,u)},ulStyle:G,a:t,b:y,c:k,d:C}}else return{show:!1}},Ot=(s,i)=>{const{tipSpacing:o,category:p,trueValue:n,proportion:c}=s;let m={},d={},u={},E={};if(p&&typeof p!="boolean"){const t=p.textStyle;m={fontSize:(t==null?void 0:t.fontSize)+"px",color:t==null?void 0:t.color,fontFamily:t==null?void 0:t.fontFamily,fontWeight:t==null?void 0:t.fontWeight,fontStyle:t==null?void 0:t.fontStyle,lineHeight:(t==null?void 0:t.lineHeight)+"px",letterSpacing:(t==null?void 0:t.letterSpacing)+"px",paddingLeft:o+"px"}}if(c&&typeof c!="boolean"){const t=c.textStyle;d={fontSize:(t==null?void 0:t.fontSize)+"px",color:t==null?void 0:t.color,fontFamily:t==null?void 0:t.fontFamily,fontWeight:t==null?void 0:t.fontWeight,fontStyle:t==null?void 0:t.fontStyle,lineHeight:(t==null?void 0:t.lineHeight)+"px",letterSpacing:(t==null?void 0:t.letterSpacing)+"px",marginLeft:c.spacing+"px"}}if(n&&typeof n!="boolean"){const t=n.textStyle;if(u={fontSize:(t==null?void 0:t.fontSize)+"px",color:t==null?void 0:t.color,fontFamily:t==null?void 0:t.fontFamily,fontWeight:t==null?void 0:t.fontWeight,fontStyle:t==null?void 0:t.fontStyle,lineHeight:(t==null?void 0:t.lineHeight)+"px",letterSpacing:(t==null?void 0:t.letterSpacing)+"px",marginLeft:n.spacing+"px",display:"flex",alignItems:"center",justifyContent:"flex-start"},n.suffix&&typeof n.suffix!="boolean"){const y=n.suffix.deviation;E={fontSize:n.suffix.fontSize+"px",transform:"translate3d(0px, 0px, 0px)",color:t==null?void 0:t.color,fontFamily:t==null?void 0:t.fontFamily,fontWeight:t==null?void 0:t.fontWeight,fontStyle:t==null?void 0:t.fontStyle,lineHeight:(t==null?void 0:t.lineHeight)+"px",letterSpacing:(t==null?void 0:t.letterSpacing)+"px",marginLeft:y.x+"px",marginTop:y.y+"px"}}}return{show:!0,a:m,b:d,c:u,d:E}},Vt=(s=5,i)=>{let o={};return s===0?o={left:0,top:5,justifyContent:"flex-start",transform:`translate3d(${i.x}px, ${i.y}px, 0px)`}:s===1?o={left:"50%",top:5,justifyContent:"center",transform:`translate3d(${i.x}px, ${i.y}px, 0px) translateX(-50%)`}:s===2?o={right:0,top:5,justifyContent:"flex-end",transform:`translate3d(${i.x}px, ${i.y}px, 0px)`}:s===3?o={left:0,top:"50%",alignItems:"center",transform:`translate3d(${i.x}px, ${i.y}px, 0px) translateY(-50%)`}:s===4?o={left:"50%",top:"50%",alignItems:"center",justifyContent:"center",transform:`translate3d(${i.x}px, ${i.y}px, 0px) translate(-50%,-50%)`}:s===5?o={right:0,top:"50%",alignItems:"center",justifyContent:"flex-end",transform:`translate3d(${i.x}px, ${i.y}px, 0px) translateY(-50%)`}:s===6?o={left:0,bottom:0,justifyContent:"flex-start",alignItems:"flex-end",transform:`translate3d(${i.x}px, ${i.y}px, 0px)`}:s===7?o={left:"50%",bottom:0,justifyContent:"center",alignItems:"flex-end",transform:`translate3d(${i.x}px, ${i.y}px, 0px) translateX(-50%)`}:s===8&&(o={right:0,bottom:0,justifyContent:"flex-end",alignItems:"flex-end",transform:`translate3d(${i.x}px, ${i.y}px, 0px)`}),o},ze=(s=0)=>{const i=(c,m,d)=>{const u=c[0],E=c[1],t=m[0],y=m[1],k=Math.cos(d),C=Math.sin(d);return[(u-t)*k-(E-y)*C+t,(u-t)*C+(E-y)*k+y]},o=c=>c/(180/Math.PI);let p=[0,0],n=[1,0];if(s){const c=[0,0];p=i(p,c,o(s)),n=i(n,c,o(s))}return{x:p[0],y:p[1],x2:n[0],y2:n[1]}};let U=0;const Ze=(s=0,i,o,p)=>{p==1?U+=s:U=0;for(let n=0;n<i.length-U;n++){if(o.length<n+1){Ze(n,i,o,1);return}i[U+n].color={type:"linear",...ze(o[n].color.direction),colorStops:[{offset:0,color:o[n].color.startVal},{offset:1,color:o[n].color.endVal}]},i[U+n].startVal=o[n].color.startVal,i[U+n].endVal=o[n].color.endVal,i[U+n].direction=o[n].color.direction,i[U+n].displayName=o[n].displayName,i[U+n].seriesLegendIcon=o[n].seriesLegendIcon}return i},It=(s,i)=>{for(let o=0;o<i.length;o++){const p=i[o];p.name===s.seriesMapping.fieldName&&(p.color={type:"linear",...ze(s.seriesColor.direction),colorStops:[{offset:0,color:s.seriesColor.startVal},{offset:1,color:s.seriesColor.endVal}],global:!1},p.startVal=s.seriesColor.startVal,p.endVal=s.seriesColor.endVal,p.direction=s.seriesColor.direction,p.displayName=s.seriesMapping.displayName,p.seriesLegendIcon=s.seriesLegendIcon)}return i},Ke=(s,i)=>{const{dataSeries:o=[]}=s,p=[],n=[];let c=[];const m=[];if(o.length===0)return[];for(let d=0;d<o.length;d++){const u=o[d];u.seriesMapping.fieldName&&!p.includes(u.seriesMapping.fieldName)&&p.push(u.seriesMapping.fieldName),m.push({color:u.seriesColor,displayName:u.seriesMapping.displayName,seriesLegendIcon:u.seriesLegendIcon})}if(p.length>0){for(let d=0;d<i.length;d++)i[d].color={type:"linear",...ze(o[o.length-1].seriesColor.direction),colorStops:[{offset:0,color:o[o.length-1].seriesColor.startVal},{offset:1,color:o[o.length-1].seriesColor.endVal}]},i[d].startVal=o[o.length-1].seriesColor.startVal,i[d].endVal=o[o.length-1].seriesColor.endVal,i[d].direction=o[o.length-1].seriesColor.direction,c.push(i[d]);for(let d=0;d<o.length;d++){const u=o[d];u.seriesMapping.fieldName&&(n.includes(u.seriesMapping.fieldName)||(n.push(u.seriesMapping.fieldName),c=It(u,i)))}}else U=0,Ze(0,i,m,0),c=i;return c},Nt=s=>{const i=s.data;let o=X(i);const p=s.filterData,n=s.params.legend;if(!n||typeof n=="boolean")return;if(n.order==="desc"&&(o=i.sort((h,r)=>r.value-h.value)),n.order==="asc"&&(o=i.sort((h,r)=>h.value-r.value)),n.order===""){const h=[];for(let r=0;r<p.length;r++){const T=p[r];for(let _=0;_<i.length;_++){const W=i[_];T.s===W.s&&h.push(W)}}o=h}let c=0;for(let h=0;h<o.length;h++){const r=o[h].value;o[h].custom||(c+=r)}const m=Pt(n),d=h=>{var _,W,Z,L;const r={minWidth:((_=n.legendGraphicalSize)==null?void 0:_.width)||"0px",minHeight:((W=n.legendGraphicalSize)==null?void 0:W.height)||"0px",marginRight:n.legendSpacing+"px",background:`linear-gradient(${h.direction}deg, ${h.startVal} 0%, ${h.endVal} 100%)`,borderRadius:n.graphicFillet+"px"},T={minWidth:((Z=n.legendGraphicalSize)==null?void 0:Z.width)||"0px",minHeight:((L=n.legendGraphicalSize)==null?void 0:L.height)||"0px",marginRight:n.legendSpacing+"px",backgroundImage:`url(${h.seriesLegendIcon?h.seriesLegendIcon:n.legendIcon})`,backgroundRepeat:"no-repeat",backgroundPosition:"50%",backgroundSize:"contain",borderRadius:n.graphicFillet+"px"};return n.legendType==="legendTypePreset"?r:T},u=m.legendStyle,E=m.ulStyle,t=m.a,y=m.c,k=m.d,C=m.b,G=h=>{const r=p.filter(T=>T.s===h);s.onClick&&typeof s.onClick=="function"&&s.onClick(r[0])};return w.jsx("div",{className:K.legend_wrapper,style:u,children:w.jsx("ul",{style:E,children:o.map(h=>!h.custom&&w.jsxs("li",{className:K.legend_wrapper_li,onClick:()=>G(h.name),children:[w.jsx("span",{style:d(h)}),w.jsxs("span",{className:K.legend_module_contentStyle,children:[n.category&&w.jsx("span",{style:t,children:h.displayName?h.displayName:h.name}),w.jsxs("div",{style:{display:"flex"},children:[n.trueValue&&typeof n.trueValue!="boolean"&&w.jsxs("span",{style:n.trueValue.colorFollow?{...y,color:h.endVal}:y,children:[w.jsx("span",{children:h.value}),n.trueValue.suffix&&typeof n.trueValue.suffix!="boolean"&&w.jsx("span",{style:n.trueValue.colorFollow?{...k,color:h.endVal}:k,children:n.trueValue.suffix.content})]}),n.proportion&&typeof n.proportion!="boolean"&&w.jsxs("span",{style:n.proportion.colorFollow?{...C,color:h.endVal}:C,children:[c===0?0:(h.value/c*100).toFixed(n.proportion.decimalPlaces),"%"]})]})]})]},h.name))})})},Wt=te.forwardRef((s,i)=>{const[o,p]=te.useState(0);te.useImperativeHandle(i,()=>({setIndex:b=>p(b)}));let n=s.data;const c={tipGraphicalSize:{width:10,height:10},tipSpacing:5,tipgraphicFillet:0,tipIconSize:{width:20,height:20},tipIcon:"",tipType:"Preset",category:{textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"rgba(230,247,255,0.7)",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}},trueValue:!1,proportion:{decimalPlaces:0,spacing:15,colorFollow:!0,textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"#E5F1FF",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}}},{seriesOrder:m,promptBoxTabs:d=c}=s.params,{tipGraphicalSize:u,tipSpacing:E,tipgraphicFillet:t,tipIconSize:y,tipIcon:k,tipType:C,category:G,trueValue:h,proportion:r}=d;m==="desc"&&(n=s.data.sort((b,I)=>I.value-b.value)),m==="asc"&&(n=s.data.sort((b,I)=>b.value-I.value));let T=0;for(let b=0;b<n.length;b++){const I=n[b].value;n[b].custom||(T+=I)}const _=Ot(d),W=b=>{const I={minWidth:(u==null?void 0:u.width)||"0px",minHeight:(u==null?void 0:u.height)||"0px",marginRight:E+"px",background:`linear-gradient(${b.direction}deg, ${b.startVal} 0%, ${b.endVal} 100%)`,borderRadius:t+"px"},$={minWidth:(y==null?void 0:y.width)||"0px",minHeight:(y==null?void 0:y.height)||"0px",marginRight:E+"px",backgroundImage:`url(${b.seriestipIcon?b.seriestipIcon:k})`,backgroundRepeat:"no-repeat",backgroundPosition:"50%",backgroundSize:"contain",borderRadius:t+"px"};return C==="Preset"?I:$},Z=_.a,L=_.c,se=_.d,re=_.b;return w.jsx("div",{className:K.legend_wrapper,children:w.jsx("ul",{children:n.map((b,I)=>!b.custom&&I===o&&w.jsxs("li",{className:K.legend_wrapper_li,children:[w.jsx("span",{style:W(b)}),w.jsxs("span",{className:K.legend_module_contentStyle,children:[G&&w.jsx("span",{style:Z,children:b.displayName?b.displayName:b.name}),h&&typeof h!="boolean"&&w.jsxs("span",{style:h.colorFollow?{...L,color:b.endVal}:L,children:[w.jsx("span",{children:b.value}),h.suffix&&typeof h.suffix!="boolean"&&w.jsx("span",{style:h.colorFollow?{...se,color:b.endVal}:se,children:h.suffix.content})]}),r&&typeof r!="boolean"&&w.jsxs("span",{style:r.colorFollow?{...re,color:b.endVal}:re,children:[T===0?0:(b.value/T*100).toFixed(r.decimalPlaces),"%"]})]})]},b.name))})})}),Mt=vt.createDebug("false","dateTimePicker",{scope:"Green",desc:"RedBackground"});Mt("13213");const zt=[{s:"系列一",y:67},{s:"系列二",y:34},{s:"系列三",y:18},{s:"系列四",y:9},{s:"系列五",y:6}],At=[{seriesMapping:{fieldName:"",displayName:""},seriesColor:{startVal:"rgba(0,214,138,1)",endVal:"rgba(0,214,138,1)",direction:30},seriesLegendIcon:""},{seriesMapping:{fieldName:"",displayName:""},seriesColor:{startVal:"rgba(186,231,255,1)",endVal:"rgba(186,231,255,1)",direction:30},seriesLegendIcon:""},{seriesMapping:{fieldName:"",displayName:""},seriesColor:{startVal:"rgba(47,84,235,1)",endVal:"rgba(47,84,235,1)",direction:30},seriesLegendIcon:""},{seriesMapping:{fieldName:"",displayName:""},seriesColor:{startVal:"rgba(30,231,231,1)",endVal:"rgba(30,231,231,1)",direction:30},seriesLegendIcon:""},{seriesMapping:{fieldName:"",displayName:""},seriesColor:{startVal:"rgba(24,144,255,1)",endVal:"rgba(24,144,255,1)",direction:30},seriesLegendIcon:""}];class Qe extends te.Component{constructor(o){super(o);Fe(this,"d3Node");Fe(this,"domRef",te.createRef());Fe(this,"tooltipRef",te.createRef());this.state={}}setData(){return(this.props.data||[]).map(n=>({s:n.s,y:n.y,name:n.s,value:n.y,displayName:"",extra:n}))}getSort(){const o=this.props,p=this.setData();let n=X(p),c=0,m=0;if(n&&n.length>0){o.seriesOrder==="desc"?(n=X(p).sort((d,u)=>u.y-d.y),c=n[0].y):o.seriesOrder==="asc"?(n=X(p).sort((d,u)=>d.y-u.y),c=n[n.length-1].y):c=X(p).sort((u,E)=>E.y-u.y)[0].y;for(let d=0;d<p.length;d++){const u=p[d];m+=u.y}}return{data:n,maxValue:c,total:m}}init(){const{data:o,maxValue:p,total:n}=this.getSort();if(o.length==0)return!1;const c=this.props.base.width,m=this.props.base.height,d=(this.props.innerRadius||0)*Math.min(c,m)/2,u=(this.props.outerRadius||1)*Math.min(c,m)/2,E="none",t=0,k=(this.props.graphicalSpacing||4)/u,C=this.props.margin,h=le.select(this.d3Node).attr("width",c).attr("height",m).attr("style",`width: ${c}px; height: ${m}px;`).append("g").attr("transform",`translate(${(C==null?void 0:C.left)||0}, ${(C==null?void 0:C.top)||0})`),r=`transition: transform 0.3s ease-in-out 0s; transform: translate(${c/2-(((C==null?void 0:C.right)||0)-u/2)}px, ${m/2}px) rotate(0deg);`,T=h.append("g").attr("style",r),_=T.append("g"),W=($,O)=>[Math.cos($)*O,Math.sin($)*O],Z=($,O)=>$?O=="vertical"?"":"0.5em":"",L=o.map(()=>10),se=le.range(o.length).filter($=>!isNaN(L[$])),re=le.pie().padAngle(k).sort(null).value($=>L[$])(se),b=Ke(this.props,X(o)),I=Math.ceil(Math.PI*d*2/b.length);b.map(($,O)=>{const be="rose_pie_linear_"+O,M=o[O].y/p*(u-d),H=M>5?M:5,Q=le.arc().innerRadius(d).outerRadius(d+H).cornerRadius(2);T.append("path").attr("class",K.inner_arc).style("stroke-dasharray",`${I},${2*I}`).style("stroke-dashoffset",`${I}`).style("animation-delay",`${2e3*O}ms`).attr("data-index",O).attr("d",Q(re[O])).attr("stroke",E).attr("stroke-width",t).attr("fill",`url(#${be})`).attr("fill-opacity",1).on("click",z=>{z.preventDefault(),z.stopPropagation(),this.onClick($)}).on("mousemove",z=>{var D,B,A;if((D=this.props.promptBoxTabs)!=null&&D.hoverTrigger){const V=(B=this.domRef)!=null&&B.clientHeight?(A=this.domRef)==null?void 0:A.clientHeight:50;this.domRef.style.transform=`translate3d(${z.offsetX}px, ${z.offsetY-(V+10)}px, 0px)`,this.domRef.style.display="flex",this.tooltipRef.setIndex(O)}}).on("mouseleave",z=>{var D,B,A;if((D=this.props.promptBoxTabs)!=null&&D.hoverTrigger){const V=(B=this.domRef)!=null&&B.clientHeight?(A=this.domRef)==null?void 0:A.clientHeight:50;this.domRef.style.transform=`translate3d(0px, ${0-(V+10)}px, 0px)`,this.domRef.style.display="none"}});const Se=T.append("defs").append("linearGradient").attr("id",be).attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",1).attr("gradientTransform",`rotate(${$.direction+180}, 0.5, 0.5)`);if(Se.append("stop").attr("key",0).attr("offset",$.color.colorStops[0].offset).attr("stop-color",$.color.colorStops[0].color).attr("stop-opacity",1),Se.append("stop").attr("key",1).attr("offset",$.color.colorStops[1].offset).attr("stop-color",$.color.colorStops[1].color).attr("stop-opacity",1),this.props.valueLabel&&typeof this.props.valueLabel!="boolean"){const{lineLength:z,deviation:D,layout:B,category:A,trueValue:V,proportion:ce}=this.props.valueLabel,ye=d+H,$e=Q.centroid(re[O]),Pe=Math.atan2($e[1],$e[0]),fe=W(Pe,ye),_e=fe[0],pe=fe[1],Re=W(Pe,ye+z.line1),ne=Re,we=ne[0],ue=ne[1],Oe=we<0?-1:1,Ce=we+z.line2*Oe,de=D.x,ge=D.y,he=Ce+(de+6)*Oe,q=B,oe=_.append("g");oe.append("path").attr("class",K.label_line).style("animation-delay",`${2e3*(O+1)-800}ms`).attr("d",`M${_e}, ${pe}L${we}, ${ue}L${Ce}, ${ue}`).attr("stroke",$.color.colorStops[0].color).attr("fill","none");const ae=oe.append("text");if(ae.attr("class",K.label_text).style("animation-delay",`${2e3*(O+1)-800}ms`).attr("x",he).attr("y",ue+ge).attr("dominant-baseline","middle").attr("text-anchor",Ce>=0?"start":"end"),A&&typeof A!="boolean"){const f=A.textStyle;ae.append("tspan").attr("font-size",(f==null?void 0:f.fontSize)||"12px").attr("fill",(f==null?void 0:f.color)||"rgba(230,247,255,0.7)").attr("font-family",(f==null?void 0:f.fontFamily)||"Microsoft Yahei").attr("letter-spacing",(f==null?void 0:f.letterSpacing)||"0px").attr("font-weight",(f==null?void 0:f.fontWeight)||"normal").attr("font-style",(f==null?void 0:f.fontStyle)||"normal").text(o[O].s+":")}const ee=typeof V=="boolean"?V:!0;if(V&&typeof V!="boolean"){const f=V.textStyle;if(ae.append("tspan").attr("x",ee&&q==="vertical"?he:"").attr("dx",Z(ee,q)).attr("dy",ee&&q==="vertical"?"1.5em":"").attr("font-size",(f==null?void 0:f.fontSize)||"12px").attr("fill",(f==null?void 0:f.color)||"rgba(230,247,255,0.7)").attr("font-family",(f==null?void 0:f.fontFamily)||"Microsoft Yahei").attr("letter-spacing",(f==null?void 0:f.letterSpacing)||"0px").attr("font-weight",(f==null?void 0:f.fontWeight)||"normal").attr("font-style",(f==null?void 0:f.fontStyle)||"normal").text(o[O].y),V!=null&&V.suffix&&typeof V.suffix!="boolean"){const{content:Ee,fontSize:me,deviation:ie}=V.suffix;ae.append("tspan").attr("dx",ie.x).attr("dy",ie.y).attr("font-size",me+"px").attr("fill",(f==null?void 0:f.color)||"rgba(230,247,255,0.7)").attr("font-family",(f==null?void 0:f.fontFamily)||"Microsoft Yahei").attr("letter-spacing",(f==null?void 0:f.letterSpacing)||"0px").attr("font-weight",(f==null?void 0:f.fontWeight)||"normal").attr("font-style",(f==null?void 0:f.fontStyle)||"normal").text(Ee)}}if(ce&&typeof ce!="boolean"){const{decimalPlaces:f,textStyle:Ee}=ce,me=Math.round(o[O].y/n*100).toFixed(f||0),ie=V?`(${me}%)`:`${me}%`,F=Ee;ae.append("tspan").attr("x",!ee&&q==="vertical"?he:"").attr("dx",!ee&&q==="vertical"?0:"0.5em").attr("dy",!ee&&q==="vertical"?"1.5em":0).attr("font-size",(F==null?void 0:F.fontSize)||"12px").attr("fill",(F==null?void 0:F.color)||"rgba(230,247,255,1)").attr("font-family",(F==null?void 0:F.fontFamily)||"Microsoft Yahei").attr("letter-spacing",(F==null?void 0:F.letterSpacing)||"0px").attr("font-weight",(F==null?void 0:F.fontWeight)||"normal").attr("font-style",(F==null?void 0:F.fontStyle)||"normal").text(ie)}}})}onClick(o){this.props.onClick&&typeof this.props.onClick=="function"&&this.props.onClick(o)}async componentDidMount(){await le.select(this.d3Node).selectAll("*").remove(),this.init()}componentWillUnmount(){le.select(this.d3Node).selectAll("*").remove()}async componentDidUpdate(){await le.select(this.d3Node).selectAll("*").remove(),this.init()}render(){const{data:o}=this.getSort(),p=Ke(this.props,X(o)),n=()=>{if(this.props.promptBoxTabs&&typeof this.props.promptBoxTabs!="boolean"){const{margin:c,bgColor:m}=this.props.promptBoxTabs;return{position:"absolute",display:"none",whiteSpace:"nowrap",zIndex:9999999,willChange:"transform",boxShadow:"rgb(0 0 0 / 20 %) 1px 2px 10px",padding:`${c==null?void 0:c.top}px ${c==null?void 0:c.right}px ${c==null?void 0:c.bottom}px ${c==null?void 0:c.left}px`,top:"0px",left:"0px",transition:"all linear 10ms",background:m,pointerEvents:"none",alignItems:"center",justifyContent:"center"}}return{}};return w.jsxs("div",{style:{height:this.props.base.height+"px",width:this.props.base.width+"px",position:"relative"},children:[o&&o.length>0&&w.jsx("svg",{className:"d3-node",ref:c=>this.d3Node=c}),this.props.legend&&o&&o.length>0&&w.jsx(Nt,{data:X(p),filterData:this.setData(),params:this.props,onClick:c=>this.onClick(c)},JSON.stringify(o)),w.jsx("div",{style:n(),ref:c=>this.domRef=c,children:w.jsx(Wt,{data:X(p),params:this.props,ref:c=>this.tooltipRef=c})})]})}}Fe(Qe,"defaultProps",{base:{width:420,height:210},margin:{top:10,bottom:0,left:0,right:115},valueLabel:{lineLength:{line1:25,line2:10},layout:"horizontal",deviation:{x:0,y:0},category:{textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"rgba(230,247,255,0.7)",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}},proportion:{decimalPlaces:0,textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"#E5F1FF",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}},trueValue:{suffix:{content:"",fontSize:12,deviation:{x:8,y:0}},textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"rgba(230,247,255,0.7)",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}}},legend:{order:"asc",legendType:"legendTypePreset",legendIcon:"",legendIconSize:{width:20,height:20},legendGraphicalSize:{width:10,height:10},graphicFillet:0,legendSpacing:5,category:{textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"rgba(230,247,255,0.7)",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}},proportion:{decimalPlaces:0,spacing:15,colorFollow:!0,textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"#E5F1FF",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}},trueValue:{suffix:{content:"",fontSize:12,deviation:{x:8,y:0}},textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"rgba(230,247,255,0.7)",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}},layoutNumberColumns:1,layoutSpacing:{row:25,column:10},legendPosition:5,layoutDeviation:{x:-10,y:0}},innerRadius:.42,outerRadius:1,fillet:{radius:2},graphicalSpacing:4,seriesOrder:"asc",dataSeries:At,promptBoxTabs:{hoverTrigger:!0,margin:{top:15,bottom:15,left:10,right:10},tipType:"Preset",tipIcon:"",tipIconSize:{width:20,height:20},tipGraphicalSize:{width:10,height:10},tipgraphicFillet:0,tipSpacing:5,bgColor:"rgba(45,51,61,0.8)",category:{textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"rgba(230,247,255,0.7)",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}},trueValue:!1,proportion:{decimalPlaces:0,spacing:15,colorFollow:!0,textStyle:{fontFamily:"Microsoft Yahei",fontSize:12,color:"#E5F1FF",fontWeight:"normal",fontStyle:"normal",letterSpacing:0}}},data:zt});exports.RosePie=Qe;