
/**
 * 由 Fantastic-admin 提供技术支持
 * Powered by Fantastic-admin
 * https://fantastic-admin.hurui.me
 */
  
import{pn as e}from"./src-CLMBPGj1.js";import{B as t,Ct as n,bt as r}from"./reactivity.esm-bundler-D9OPVc9J.js";import{_ as i,b as a,bt as o,et as s,mt as c,o as l,v as u,xt as d,y as f}from"./runtime-core.esm-bundler-D-xeQwTN.js";import{it as p}from"./lib-C-QGo8GG-CvPpiVvZ.js";import{t as m}from"./rolldown-runtime-Dy4uBu1J-DK3Fl9T5.js";import{t as h}from"./_plugin-vue_export-helper-B3ysoDQm-BDNMzG2s.js";import{t as g}from"./Shape-Dmh9jBFh-B2aZ5PK0.js";var _=e({n:()=>v,t:()=>E}),v=m({default:()=>E}),y=[`id`],b=[`role`,`tabindex`,`onKeydown`,`onFocus`],x=[`onClick`,`width`,`viewBox`],S={key:0},C=[`id`],w=[`offset`,`stop-color`],T=[`fill`],E=h({__name:`Legend`,props:{legendSet:{type:Array,default(){return[]}},config:{type:Object,default(){return{}}},id:{type:String,default:``},clickable:{type:Boolean,default:!0},isCursorPointer:{type:Boolean,default:!1}},emits:[`clickMarker`,`focusMarker`],setup(e,{emit:m}){let h=e,_=m;function v(e,t){h.clickable&&_(`clickMarker`,{legend:e,i:t})}function E(e,t,n){h.clickable&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v(t,n))}function D(e,t,n){e.preventDefault(),_(`focusMarker`,{legend:t,i:n})}function O(e){return Array.isArray(e.gradientColors)&&e.gradientColors.length}function k(e,t){let n=h.id||h.config.cy||`legend`,r=O(e)?e.gradientColors.join(`_`):``;return`${n}_${e.seriesIndex??t}_${t}_${r}_gradient`.replace(/[^a-zA-Z0-9_-]/g,`_`).slice(0,160)}function A(e,t){return t===1?`0%`:`${e/(t-1)*100}%`}function j(e){return O(e)?`0 0 90 60`:e.shape&&e.shape===`star`?`-10 -10 80 80`:`0 0 60 60`}return(m,h)=>(c(),a(`div`,{id:e.id,class:`vue-data-ui-legend`,style:n({background:e.config.backgroundColor,color:e.config.color,paddingBottom:(e.config.paddingBottom??0)+`px`,paddingTop:(e.config.paddingTop??12)+`px`,fontWeight:e.config.fontWeight,fontSize:`var(--legend-font-size, ${e.config.fontSize??14}px)`})},[d(m.$slots,`legendTitle`,{titleSet:e.legendSet},void 0,!0),d(m.$slots,`legendToggle`,{},void 0,!0),(c(!0),a(l,null,o(e.legendSet,(h,_)=>(c(),a(`div`,{key:`legend_${_}`,class:r({"vue-data-ui-legend-item":!0,active:e.clickable&&e.isCursorPointer}),role:e.clickable?`button`:void 0,tabindex:e.clickable?0:void 0,onKeydown:e=>E(e,h,_),onFocus:e=>D(e,h,_)},[h.shape?(c(),a(`svg`,{key:0,onClick:e=>v(h,_),height:`1em`,width:O(h)?`1.4em`:`1em`,viewBox:j(h),style:n(`overflow: visible; opacity:${h.opacity}`),"aria-hidden":`true`},[O(h)?(c(),a(`defs`,S,[i(`linearGradient`,{id:k(h,_),x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`},[(c(!0),a(l,null,o(h.gradientColors,(e,t)=>(c(),a(`stop`,{key:`legend_gradient_${_}_${t}`,offset:A(t,h.gradientColors.length),"stop-color":e},null,8,w))),128))],8,C)])):f(``,!0),O(h)?(c(),a(`rect`,{key:1,x:`3`,y:`12`,width:`84`,height:`38`,rx:`21`,stroke:`none`,fill:`url(#${k(h,_)})`},null,8,T)):(c(),u(g,{key:2,stroke:`none`,shape:h.shape,radius:30,plot:{x:30,y:h.shape===`triangle`?36:30},fill:h.color},null,8,[`shape`,`plot`,`fill`])),d(m.$slots,`legend-pattern`,s({ref_for:!0},{legend:h,index:t(p)(h.absoluteIndex)?h.absoluteIndex:_}),void 0,!0)],12,x)):f(``,!0),d(m.$slots,`item`,{legend:h,index:_},void 0,!0)],42,b))),128)),d(m.$slots,`after`,{},void 0,!0)],12,y))}},[[`__scopeId`,`data-v-a5e2fb14`]]);export{E as n,_ as t};