ztd-charts-cli 0.11.2 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/api.d.ts +32 -32
  2. package/dist/api.js +1 -1
  3. package/dist/{chunk-6RWRYJ22.js → chunk-KNBUVTZ2.js} +55 -31
  4. package/dist/cli.js +7 -2
  5. package/dist/client/area.js +5 -5
  6. package/dist/client/bar.js +9 -9
  7. package/dist/client/barRace.js +5 -5
  8. package/dist/client/beeswarm.js +5 -5
  9. package/dist/client/box.js +9 -9
  10. package/dist/client/bubble.js +7 -7
  11. package/dist/client/bullet.js +4 -4
  12. package/dist/client/bump.js +6 -6
  13. package/dist/client/calendar.js +5 -5
  14. package/dist/client/candlestick.js +6 -6
  15. package/dist/client/chord.js +5 -5
  16. package/dist/client/choropleth.js +4 -4
  17. package/dist/client/donut.js +6 -6
  18. package/dist/client/dumbbell.js +5 -5
  19. package/dist/client/flowMap.js +5 -5
  20. package/dist/client/funnel.js +9 -9
  21. package/dist/client/gauge.js +3 -3
  22. package/dist/client/heatmap.js +5 -5
  23. package/dist/client/histogram.js +5 -5
  24. package/dist/client/line.js +5 -5
  25. package/dist/client/lollipop.js +1 -1
  26. package/dist/client/marimekko.js +6 -6
  27. package/dist/client/network.js +8 -8
  28. package/dist/client/parallel.js +6 -6
  29. package/dist/client/pareto.js +1 -1
  30. package/dist/client/pie.js +6 -6
  31. package/dist/client/radar.js +7 -7
  32. package/dist/client/radialBar.js +1 -1
  33. package/dist/client/ridgeline.js +4 -4
  34. package/dist/client/sankey.js +10 -10
  35. package/dist/client/scatter.js +10 -10
  36. package/dist/client/segmented.js +5 -5
  37. package/dist/client/skyline.js +9 -9
  38. package/dist/client/slope.js +6 -6
  39. package/dist/client/sparkline.js +6 -6
  40. package/dist/client/stream.js +6 -6
  41. package/dist/client/sunburst.js +4 -4
  42. package/dist/client/symbolMap.js +3 -3
  43. package/dist/client/tileMap.js +4 -4
  44. package/dist/client/timeline.js +8 -8
  45. package/dist/client/tree.js +2 -2
  46. package/dist/client/treemap.js +3 -3
  47. package/dist/client/waffle.js +5 -5
  48. package/dist/client/waterfall.js +4 -4
  49. package/package.json +2 -2
@@ -19,10 +19,10 @@
19
19
  @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
20
  .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
21
  @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
- `;function St(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function Tt(e,t){let[n]=(0,wr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var kr=!1;function st(){if(kr||typeof document>"u"||(kr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=yi,document.head.appendChild(e)}var Ct=N(V(),1),ye=typeof window<"u"&&typeof document<"u",Se=ye?Ct.useLayoutEffect:Ct.useEffect;function At(){return typeof performance<"u"?performance.now():Date.now()}function X(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ae(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var $r={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},vr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var xi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ki={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function wi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function $i(e){return wi(xi,e)}function Mr(e,t){let n=$i(e);return{text:n?n[t]:e,...ki[n?.id??"basic"]}}var Sr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ue(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Sr[t.toLowerCase()]&&(t=Sr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Ar(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function gn(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function Xe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Tr(e){return .2126*Xe(e[0])+.7152*Xe(e[1])+.0722*Xe(e[2])}function pn(e,t,n){let r=typeof e=="string"?Ue(e):e,o=typeof t=="string"?Ue(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ue(n):n:null;o[3]<1&&a&&(o=gn(o,a));let i=r[3]<1?gn(r,o):r,s=Tr(i),l=Tr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function vi(e){return[Xe(e[0]),Xe(e[1]),Xe(e[2])]}function hn(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function Cr(e){let[t,n,r]=vi(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Mi([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[hn(4.0767416621*o-3.3077115913*a+.2309699292*i),hn(-1.2684380046*o+2.6097574011*a-.3413193965*i),hn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Nt(e,t,n){let r=Ue(e),o=Ue(t);if(!r||!o)return e;let a=Cr(r),i=Cr(o),s=Math.max(0,Math.min(1,n));return Ar(Mi([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function bn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=pn(a,e,n);i>o&&(o=i,r=a)}return r}function Q(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function Si(e,t){let n=bn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return pn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):bn(t,["#FFFFFF","#000000"])}function Ft(e,t){let n=Nt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Si(e,n),raw:n}}function xe(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Q(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=Q(e,"neutral");else if(s===0)r[i]=Q(e,"ink");else if(s===a-1)r[i]=Q(e,"neutral");else if(a===3)r[i]=Q(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?Q(e,"strong"):Ft(e,1-l)}}),r}var yn="mix:";function Le(e){return e({theme:un,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${yn}${o}`}).map(n=>n.fill)}function Nr(e,t){return t?.startsWith(yn)?e.mix("neutralStrong","neutral",Number(t.slice(yn.length))):e.color(t)}function ze(e,t,n){return xe(e,t+1,n).slice(0,t)}function Fr(e,t,n,r="neutral"){let o=Q(e,"accent"),a=Q(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Rr(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Q(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=Q(e,"neutral"):s===0?r[i]=Q(e,"strong"):s===a-1?r[i]=Q(e,"neutral"):r[i]=Ft(e,1-s/(a-1))}),r}var ke=N(V(),1);var Rt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),se="en-US",Pr=new Map;function xn(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Pr.get(r);return o||(o=new Intl.NumberFormat(e,n),Pr.set(r,o)),o}function kn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Je(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=se,...r}=t;return kn(xn(n,r).format(e))}var wn=e=>e!==0&&Math.abs(e)<.05,$n=(e,t,n="")=>`${Je(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ye(e,t={}){if(!Number.isFinite(e))return"-";if(wn(e)&&t.maximumFractionDigits===void 0)return $n(e,t.locale??se,"%");let n=Math.abs(e);return`${Je(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Er(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=se,...r}=t;if(X(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Je(u,{locale:n,...r,maximumFractionDigits:m})+l}}return kn(xn(n,{notation:"compact",...r}).format(e))}var Ti=(e,t=X(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Be(e,t=se,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=xn(t,o);return l=>Number.isFinite(l)?`${i}${kn(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Ye(o,{locale:t});case"ratio":return o=>Ye(o*100,{locale:t});case"compact":return o=>Er(o,{locale:t});case"currency":return r(Ti(t));default:{let o=r({maximumFractionDigits:1});return a=>wn(a)?$n(a,t):o(a)}}}function Ir(e,t=se,n=0){return e!==void 0?Be(e,t):n>=1e5?r=>wn(r)?$n(r,t):Er(r,{locale:t}):r=>Je(r,{locale:t})}function Ci(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var vn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Ai=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Ni=["january","february","march","april","may","june","july","august","september","october","november","december"],Lr=e=>{let t=e.toLowerCase();return t.length<3?0:Ni.findIndex(n=>n.startsWith(t))+1},_r=e=>+e+(+e<30?2e3:1900);function Or(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Fi=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],zr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Br=/\{([^{}]+)\}/g;function Pt(e,t){let n;for(let r of Fi)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[_r(n[3]),+n[2],+n[1],1]:[_r(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=zr.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Lr(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=Lr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var jr=e=>Ai.test(e)||Pt(e)!==null;function Gr(e){let t;for(let n of e){let r=typeof n=="string"?zr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Lt(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(vn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Lt(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Pt(n,t);if(r)return Ci(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Dr=new Map;function lt(e,t={month:"short",day:"numeric"}){let n=Lt(e);if(!n)return"-";let{locale:r=se,...o}=t,a=r+JSON.stringify(o),i=Dr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Dr.set(a,i)),i.format(n)}var Mn=N(z(),1),_t=(0,ke.createContext)({theme:Pe,cssVars:!0});function Ri(e,t=Pe){return e?typeof e=="string"?mn[e]??t:fn(t,e):t}function Dt(e){let t=(0,ke.useContext)(_t),n=e.base?mn[e.base]:t.theme,r=(0,ke.useMemo)(()=>Ri(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ke.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ke.useMemo)(()=>dn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Mn.jsx)(_t.Provider,{value:i,children:(0,Mn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Pi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Wr(e){return Pi.has(e)}function Li(e,t){let n=r=>t?`var(${Mt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Wr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Wr(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Nt(e[r],e[o],a)}}}function we(e){let t=(0,ke.useContext)(_t);return(0,ke.useMemo)(()=>{let n=fn(t.theme,e);return Li(n,t.cssVars)},[t.theme,t.cssVars,e])}function ce(e){let t=(0,ke.useContext)(_t);return e??t.locale??se}function Vr(e){return e?dn(e):{}}var Et=N(V(),1),Sn=(0,Et.createContext)(void 0);function Kr(e){let t=(0,Et.useContext)(Sn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var R=N(z(),1),_i={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},Di={en:_i,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ei={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Tn=e=>Di[X(ce(e))];function Cn(e){let t=we(e.theme),n=Tn(e.locale),[r,o]=(0,It.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,R.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),f=d&&l===1,h=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Ii,{p:t,item:m,off:!d}),(0,R.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,R.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,R.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":f||void 0,onClick:()=>{f||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:h}):h},u)})});return i?(0,R.jsxs)(R.Fragment,{children:[c,(0,R.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ei,children:r?n.shown(l,e.items.length):""})]}):c}function Ii({p:e,item:t,off:n}){let r=Nr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,R.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,R.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,R.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,R.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function Oi(e){let t=we(e.theme),n=Mr(e.level,X(ce(e.locale)));return(0,R.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function zi(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,R.jsxs)(R.Fragment,{children:[e.slice(0,r),(0,R.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Ur(e){let t=we(e.theme),n=Tn(e.locale),[r,o]=(0,It.useState)(0);Se(()=>st(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,R.jsx)(Cn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,R.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,R.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,R.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,R.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,R.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,R.jsx)(Oi,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,R.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,R.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,R.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,R.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:zi(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,R.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,R.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,R.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,R.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,R.jsx)("span",{}),i]}):null]}),(0,R.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,R.jsx)(Sn.Provider,{value:r,children:(0,R.jsx)(Ke.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,R.jsxs)(R.Fragment,{children:[m,u]}):u]})}function An(e){let t=we(e.theme),n=Tn(e.locale),r=e.height??220;if(Se(()=>st(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,R.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,R.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,R.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,R.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,R.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,R.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,R.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,R.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,R.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,R.jsx)(R.Fragment,{children:e.children})}var et=N(V(),1);var ue=N(V(),1);var W=N(z(),1),Ot=60;var zt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Xr(e){let{c:t,events:n}=e,r=(0,ue.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,Se(()=>{st()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,ue.useContext)(Ke),c=e.ariaLabel??l??e.kind,m=(0,ue.useMemo)(()=>s?`${n.length}${n.slice(0,Ot).map(v=>`${v.label}${v.series??""}${v.formatted??v.value??""}`).join("")}`:"",[n,s]),u=(0,ue.useMemo)(()=>(0,W.jsx)(Bi,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,ue.useRef)(null);(0,ue.useEffect)(()=>{let v=()=>{d.current=null};return window.addEventListener("scroll",v,{capture:!0,passive:!0}),window.addEventListener("resize",v,{passive:!0}),()=>{window.removeEventListener("scroll",v,{capture:!0}),window.removeEventListener("resize",v)}},[]),(0,ue.useEffect)(()=>{d.current=null},[t.width,t.height]);let f=v=>{if(v.target!==v.currentTarget)return;if(e.onKey?.(v)){v.preventDefault();return}let S=t.active,L;switch(v.key){case"ArrowRight":case"ArrowDown":L=S===null?0:(S+1)%i;break;case"ArrowLeft":case"ArrowUp":L=S===null?i-1:(S-1+i)%i;break;case"Home":L=0;break;case"End":L=i-1;break;case"Escape":if(S===null)return;L=null;break;case"Enter":case" ":S!==null&&(v.preventDefault(),t.click(S));return;default:return}v.preventDefault(),t.setActive(L,"keyboard")},{via:h,node:g,setActive:b}=t;(0,ue.useEffect)(()=>{if(h!=="touch"||!g)return;let v=S=>{g.contains(S.target)||b(null)};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[h,g,b]);let p=t.active!==null?n[t.active]:null,w=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,k=w&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&p?e.renderTip(p):null,y=e.announce??(t.via==="keyboard"&&p?`${p.label}${p.series?` ${p.series}`:""}: ${p.formatted??p.value??""} (${(t.active??0)+1}/${i})`:""),C;if(w){let v=w.x*k,S=t.width*k,L=`clamp(${(4-v).toFixed(1)}px, -50%, calc(${(S-v-4).toFixed(1)}px - 100%))`,B=w.y<64;C={position:"absolute",left:v,top:w.y*k,transform:`translate(${L}, ${B?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*k-8)}}let P=v=>{d.current=null,v.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},D=v=>v?S=>{let L=d.current??(d.current=S.currentTarget.getBoundingClientRect());L.width&&v((S.clientX-L.left)/L.width*t.width,(S.clientY-L.top)/L.height*t.height,S)}:void 0,j=D(e.onPointerMove),I=D(e.onPointerDown),F=j||I?v=>{v.pointerType==="touch"&&j?.(v),I?.(v)}:void 0,T=D(e.onPointerUp),A=Vr(e.theme);return(0,W.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:v=>{t.via==="keyboard"&&!v.currentTarget.contains(v.relatedTarget)&&t.setActive(null)},onPointerLeave:P,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...A,...e.style},children:[t.pending?null:e.underlay,(0,W.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:j,onPointerDown:F,onPointerUp:T,onPointerCancel:T,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,W.jsx)("title",{id:o,children:c}),(0,W.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,W.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,w?(0,W.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:C,children:M??(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:w.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:w.title}),w.rows.map((v,S)=>(0,W.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(v.strong?"ink":"muted")},children:[v.color?(0,W.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:v.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,v.label]}),(0,W.jsx)("span",{style:{fontWeight:v.strong===!1?500:700},children:v.value})]},S))]})}):null,(0,W.jsx)("span",{className:"ztd-sr",style:zt,"aria-live":"polite","aria-atomic":"true",children:y}),s&&!t.pending?u:null]})}function Bi({label:e,events:t,t:n}){return(0,W.jsx)("div",{className:"ztd-sr",style:zt,children:(0,W.jsxs)("table",{children:[(0,W.jsx)("caption",{children:n.table(e)}),(0,W.jsxs)("tbody",{children:[t.slice(0,Ot).map((r,o)=>(0,W.jsxs)("tr",{children:[(0,W.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,W.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Ot?(0,W.jsx)("tr",{children:(0,W.jsx)("td",{colSpan:2,children:n.more(t.length-Ot)})}):null]})]})})}function Nn(e){let t=e.baseline??"central";return(0,W.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var x=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ge=x("label","string",!0,"Item name field"),ne=x("value","number",!0,"Value field"),ji=[ge,ne],Gi=[ge,ne],Hi=[x("label","string",!0,"Stage name"),x("value","number",!0,"Users at the stage")],Wi=[ge,ne],Vi=[x("label","string",!0,"Leaf (lowest level) name"),ne,x("group","string",!1,"Parent group field")],Ki=[x("label","string",!0,"Leaf name"),ne,x("group","string",!1,"Parent group field")],Ui=[ge,x("value","number",!0,"Change (total rows may omit it)"),x("type","string",!1,'"total" makes a total bar')],Xi=[ge,ne],Yi=[x("x","string",!0,"Column field"),x("series","string",!0,"Stacked series field"),ne],Ji=[x("x","string",!0,"Column field"),x("y","string",!0,"Row field"),ne],qi=[x("axis","string",!0,"Metric (axis) field"),x("value","number",!0,"Value field",{multi:!0}),x("series","string",!1,"Series field")],Zi=[x("x","number",!0,"x value"),x("y","number",!0,"y value"),x("size","number",!1,"Circle size"),x("label","string",!1,"Name")],Jr=x("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Qi=[x("x","any",!0,"x field (date, number or category)"),x("y","number",!0,"y field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field (long tables)"),x("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Jr],es=[x("x","any",!0,"x field"),x("y","number",!0,"y field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field"),x("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),Jr],ts=[x("x","any",!0,"x field"),x("y","number",!0,"y field",{multi:!0}),x("series","string",!1,"Series field")],ns=[x("x","string",!0,"Category field"),x("y","number",!0,"Value field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field"),x("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],rs=[ge,ne],os=[x("value","number",!0,"Value field",{prop:"valueKey"}),x("target","number",!1,"Target field",{prop:"targetKey"})],as=[ge,x("value","number",!0,"Actual value field"),x("target","number",!1,"Target field")],is=[x("x","any",!1,"x field"),x("y","number",!0,"y field")],ss=[ge,x("x","string",!1,"Period field (long tables)"),x("value","number",!1,"Value field (long tables)")],ls=[ge,x("start","number",!0,"Before value"),x("end","number",!0,"After value")],cs=[ge,ne],us=[x("value","number",!0,"Value field"),x("group","string",!1,"Group (row) field"),x("label","string",!1,"Dot name")],ms=[x("group","string",!0,"Group field"),x("value","number",!0,"Value field")],ds=[x("source","string",!0,"Source node"),x("target","string",!0,"Target node"),ne],fs=[x("source","string",!0,"Sending group"),x("target","string",!0,"Receiving group"),ne],hs=[x("date","date",!0,"Date field"),ne],gs=[x("x","any",!0,"Period field"),x("series","string",!0,"Item field"),x("rank","number",!1,"Rank field (1 is first)"),x("value","number",!1,"Value field (instead of rank, largest is first)")],ps=[x("group","string",!0,"Group field"),x("value","number",!0,"Value field")],bs=[x("label","string",!1,"Row name field")],ys=[x("x","date",!0,"Date (period) field"),x("open","number",!0,"Open price field"),x("high","number",!0,"High price field"),x("low","number",!0,"Low price field"),x("close","number",!0,"Close price field"),x("volume","number",!1,"Volume field")],xs=[ge,ne],ks=[x("x","any",!0,"Period field (date or category)"),x("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field (long tables, back row only)"),x("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],ws=[x("value","number",!1,"Sample value field (raw rows)"),x("group","string",!1,"Group field. Up to 2 groups overlap"),x("x0","number",!1,"Bin start (pre-binned rows)"),x("x1","number",!1,"Bin end (pre-binned rows)"),x("count","number",!1,"Samples in the bin (pre-binned rows)")],$s=[x("region","string",!0,"Region name or code, matched to a tile of options.map"),ne],vs=[ge,ne,x("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Ms=[x("source","string",!0,"Source node"),x("target","string",!0,"Target node"),x("value","number",!1,"Link weight. Without it every row counts 1")],Ss=[x("label","string",!0,"Row name. Items with the same name share a row"),x("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),x("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),x("group","string",!1,"Group field (one color per group, and the legend)"),x("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Ts=[x("label","string",!0,"Node name field"),x("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),x("group","string",!1,"Parent group field (flat rows, as in the treemap)"),x("id","string",!1,"Row id for id/parent rows. Defaults to the label"),x("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Cs=[x("region","string",!0,"Region name or code, matched to a region of options.map"),ne],As=[x("lon","number",!1,"Longitude (degrees)"),x("lat","number",!1,"Latitude (degrees)"),x("size","number",!1,"Value (circle area). Without it all circles match"),x("label","string",!1,"Place name"),x("region","string",!1,"Region of options.map, for rows without lon and lat"),x("group","string",!1,"Group field (one color per group)")],Ns=[x("source","string",!0,"Start: a name in options.places or a region"),x("target","string",!0,"End"),x("value","number",!1,"Amount. Without it each row counts 1")],Fs=[x("x","number",!0,"x value"),x("y","number",!0,"y value"),x("series","string",!1,"Series field (one color per series)"),x("label","string",!1,"Name")],Yr={pie:ji,donut:Gi,funnel:Hi,waffle:Wi,treemap:Vi,sunburst:Ki,waterfall:Ui,pareto:Xi,marimekko:Yi,heatmap:Ji,radar:qi,bubble:Zi,line:Qi,area:es,stream:ts,bar:ns,radialBar:rs,gauge:os,bullet:as,sparkline:is,slope:ss,dumbbell:ls,lollipop:cs,beeswarm:us,ridgeline:ms,sankey:ds,chord:fs,calendar:hs,bump:gs,box:ps,parallel:bs,candlestick:ys,segmented:xs,skyline:ks,histogram:ws,scatter:Fs,tileMap:$s,barRace:vs,network:Ms,timeline:Ss,tree:Ts,choropleth:Cs,symbolMap:As,flowMap:Ns},qe={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function qr(e,t){return t==="ko"?e.nameKo:e.name}function Zr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Qr=["line","area","bar","scatter"],eo=24,Fn=["line","area","bar","scatter","timeline"];function Rn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function to(e,t,n){return Fn.includes(e)&&!Rn(e,t,n).length&&!(e==="scatter"&&Bt(n))}function Bt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function no(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Rs={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function jt(e){let t=Yr[e]?e:Rs[e]??Object.keys(qe).find(n=>n.toLowerCase()===e.toLowerCase()||qe[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!qe[t]))return{type:t,component:qe[t].component,name:qe[t].name,nameKo:qe[t].nameKo,encoding:Yr[t]}}function ro(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of jt(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function Gt(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ps(e,t){if(e==null||typeof e!="object")return;let n=e;if(Gt(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Gt(r,o))return;r=r[o]}return r}}function Te(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function je(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ps(r,n)}function _e(e,t){let n=je(e,t);return(r,o)=>Te(n(r,o))}function le(e,t){let n=je(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function me(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ls(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
22
+ `;function St(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function Tt(e,t){let[n]=(0,wr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var kr=!1;function st(){if(kr||typeof document>"u"||(kr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=yi,document.head.appendChild(e)}var Ct=N(V(),1),ye=typeof window<"u"&&typeof document<"u",Se=ye?Ct.useLayoutEffect:Ct.useEffect;function At(){return typeof performance<"u"?performance.now():Date.now()}function X(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ae(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var $r={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},vr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var xi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ki={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function wi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function $i(e){return wi(xi,e)}function Mr(e,t){let n=$i(e);return{text:n?n[t]:e,...ki[n?.id??"basic"]}}var Sr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ue(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Sr[t.toLowerCase()]&&(t=Sr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Ar(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function gn(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function Xe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Tr(e){return .2126*Xe(e[0])+.7152*Xe(e[1])+.0722*Xe(e[2])}function pn(e,t,n){let r=typeof e=="string"?Ue(e):e,o=typeof t=="string"?Ue(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ue(n):n:null;o[3]<1&&a&&(o=gn(o,a));let i=r[3]<1?gn(r,o):r,s=Tr(i),l=Tr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function vi(e){return[Xe(e[0]),Xe(e[1]),Xe(e[2])]}function hn(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function Cr(e){let[t,n,r]=vi(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Mi([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[hn(4.0767416621*o-3.3077115913*a+.2309699292*i),hn(-1.2684380046*o+2.6097574011*a-.3413193965*i),hn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Nt(e,t,n){let r=Ue(e),o=Ue(t);if(!r||!o)return e;let a=Cr(r),i=Cr(o),s=Math.max(0,Math.min(1,n));return Ar(Mi([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function bn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=pn(a,e,n);i>o&&(o=i,r=a)}return r}function Q(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function Si(e,t){let n=bn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return pn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):bn(t,["#FFFFFF","#000000"])}function Ft(e,t){let n=Nt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Si(e,n),raw:n}}function xe(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Q(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=Q(e,"neutral");else if(s===0)r[i]=Q(e,"ink");else if(s===a-1)r[i]=Q(e,"neutral");else if(a===3)r[i]=Q(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?Q(e,"strong"):Ft(e,1-l)}}),r}var yn="mix:";function Le(e){return e({theme:un,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${yn}${o}`}).map(n=>n.fill)}function Nr(e,t){return t?.startsWith(yn)?e.mix("neutralStrong","neutral",Number(t.slice(yn.length))):e.color(t)}function ze(e,t,n){return xe(e,t+1,n).slice(0,t)}function Fr(e,t,n,r="neutral"){let o=Q(e,"accent"),a=Q(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Rr(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Q(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=Q(e,"neutral"):s===0?r[i]=Q(e,"strong"):s===a-1?r[i]=Q(e,"neutral"):r[i]=Ft(e,1-s/(a-1))}),r}var ke=N(V(),1);var Rt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),se="en-US",Pr=new Map;function xn(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Pr.get(r);return o||(o=new Intl.NumberFormat(e,n),Pr.set(r,o)),o}function kn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Je(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=se,...r}=t;return kn(xn(n,r).format(e))}var wn=e=>e!==0&&Math.abs(e)<.05,$n=(e,t,n="")=>`${Je(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ye(e,t={}){if(!Number.isFinite(e))return"-";if(wn(e)&&t.maximumFractionDigits===void 0)return $n(e,t.locale??se,"%");let n=Math.abs(e);return`${Je(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Er(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=se,...r}=t;if(X(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Je(u,{locale:n,...r,maximumFractionDigits:m})+l}}return kn(xn(n,{notation:"compact",...r}).format(e))}var Ti=(e,t=X(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Be(e,t=se,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=xn(t,o);return l=>Number.isFinite(l)?`${i}${kn(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Ye(o,{locale:t});case"ratio":return o=>Ye(o*100,{locale:t});case"compact":return o=>Er(o,{locale:t});case"currency":return r(Ti(t));default:{let o=r({maximumFractionDigits:1});return a=>wn(a)?$n(a,t):o(a)}}}function Ir(e,t=se,n=0){return e!==void 0?Be(e,t):n>=1e5?r=>wn(r)?$n(r,t):Er(r,{locale:t}):r=>Je(r,{locale:t})}function Ci(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var vn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Ai=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Ni=["january","february","march","april","may","june","july","august","september","october","november","december"],Lr=e=>{let t=e.toLowerCase();return t.length<3?0:Ni.findIndex(n=>n.startsWith(t))+1},_r=e=>+e+(+e<30?2e3:1900);function Or(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Fi=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],zr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Br=/\{([^{}]+)\}/g;function Pt(e,t){let n;for(let r of Fi)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[_r(n[3]),+n[2],+n[1],1]:[_r(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=zr.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Lr(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=Lr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var jr=e=>Ai.test(e)||Pt(e)!==null;function Gr(e){let t;for(let n of e){let r=typeof n=="string"?zr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Lt(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(vn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Lt(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Pt(n,t);if(r)return Ci(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Dr=new Map;function lt(e,t={month:"short",day:"numeric"}){let n=Lt(e);if(!n)return"-";let{locale:r=se,...o}=t,a=r+JSON.stringify(o),i=Dr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Dr.set(a,i)),i.format(n)}var Mn=N(z(),1),_t=(0,ke.createContext)({theme:Pe,cssVars:!0});function Ri(e,t=Pe){return e?typeof e=="string"?mn[e]??t:fn(t,e):t}function Dt(e){let t=(0,ke.useContext)(_t),n=e.base?mn[e.base]:t.theme,r=(0,ke.useMemo)(()=>Ri(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ke.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ke.useMemo)(()=>dn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Mn.jsx)(_t.Provider,{value:i,children:(0,Mn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Pi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Wr(e){return Pi.has(e)}function Li(e,t){let n=r=>t?`var(${Mt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Wr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Wr(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Nt(e[r],e[o],a)}}}function we(e){let t=(0,ke.useContext)(_t);return(0,ke.useMemo)(()=>{let n=fn(t.theme,e);return Li(n,t.cssVars)},[t.theme,t.cssVars,e])}function ce(e){let t=(0,ke.useContext)(_t);return e??t.locale??se}function Vr(e){return e?dn(e):{}}var Et=N(V(),1),Sn=(0,Et.createContext)(void 0);function Kr(e){let t=(0,Et.useContext)(Sn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var R=N(z(),1),_i={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},Di={en:_i,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ei={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Tn=e=>Di[X(ce(e))];function Cn(e){let t=we(e.theme),n=Tn(e.locale),[r,o]=(0,It.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,R.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),f=d&&l===1,h=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Ii,{p:t,item:m,off:!d}),(0,R.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,R.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,R.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":f||void 0,onClick:()=>{f||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:h}):h},u)})});return i?(0,R.jsxs)(R.Fragment,{children:[c,(0,R.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ei,children:r?n.shown(l,e.items.length):""})]}):c}function Ii({p:e,item:t,off:n}){let r=Nr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,R.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,R.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,R.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,R.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function Oi(e){let t=we(e.theme),n=Mr(e.level,X(ce(e.locale)));return(0,R.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function zi(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,R.jsxs)(R.Fragment,{children:[e.slice(0,r),(0,R.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Ur(e){let t=we(e.theme),n=Tn(e.locale),[r,o]=(0,It.useState)(0);Se(()=>st(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,R.jsx)(Cn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,R.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,R.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,R.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,R.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,R.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,R.jsx)(Oi,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,R.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,R.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,R.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,R.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:zi(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,R.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,R.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,R.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,R.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,R.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,R.jsx)("span",{}),i]}):null]}),(0,R.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,R.jsx)(Sn.Provider,{value:r,children:(0,R.jsx)(Ke.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,R.jsxs)(R.Fragment,{children:[m,u]}):u]})}function An(e){let t=we(e.theme),n=Tn(e.locale),r=e.height??220;if(Se(()=>st(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,R.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,R.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,R.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,R.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,R.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,R.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,R.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,R.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,R.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,R.jsx)(R.Fragment,{children:e.children})}var et=N(V(),1);var ue=N(V(),1);var W=N(z(),1),Ot=60;var zt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Xr(e){let{c:t,events:n}=e,r=(0,ue.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,Se(()=>{st()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,ue.useContext)(Ke),c=e.ariaLabel??l??e.kind,m=(0,ue.useMemo)(()=>s?`${n.length}${n.slice(0,Ot).map(v=>`${v.label}${v.series??""}${v.formatted??v.value??""}`).join("")}`:"",[n,s]),u=(0,ue.useMemo)(()=>(0,W.jsx)(Bi,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,ue.useRef)(null);(0,ue.useEffect)(()=>{let v=()=>{d.current=null};return window.addEventListener("scroll",v,{capture:!0,passive:!0}),window.addEventListener("resize",v,{passive:!0}),()=>{window.removeEventListener("scroll",v,{capture:!0}),window.removeEventListener("resize",v)}},[]),(0,ue.useEffect)(()=>{d.current=null},[t.width,t.height]);let f=v=>{if(v.target!==v.currentTarget)return;if(e.onKey?.(v)){v.preventDefault();return}let S=t.active,L;switch(v.key){case"ArrowRight":case"ArrowDown":L=S===null?0:(S+1)%i;break;case"ArrowLeft":case"ArrowUp":L=S===null?i-1:(S-1+i)%i;break;case"Home":L=0;break;case"End":L=i-1;break;case"Escape":if(S===null)return;L=null;break;case"Enter":case" ":S!==null&&(v.preventDefault(),t.click(S));return;default:return}v.preventDefault(),t.setActive(L,"keyboard")},{via:h,node:g,setActive:b}=t;(0,ue.useEffect)(()=>{if(h!=="touch"||!g)return;let v=S=>{g.contains(S.target)||b(null)};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[h,g,b]);let p=t.active!==null?n[t.active]:null,w=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,k=w&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&p?e.renderTip(p):null,x=e.announce??(t.via==="keyboard"&&p?`${p.label}${p.series?` ${p.series}`:""}: ${p.formatted??p.value??""} (${(t.active??0)+1}/${i})`:""),C;if(w){let v=w.x*k,S=t.width*k,L=`clamp(${(4-v).toFixed(1)}px, -50%, calc(${(S-v-4).toFixed(1)}px - 100%))`,B=w.y<64;C={position:"absolute",left:v,top:w.y*k,transform:`translate(${L}, ${B?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*k-8)}}let P=v=>{d.current=null,v.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},D=v=>v?S=>{let L=d.current??(d.current=S.currentTarget.getBoundingClientRect());L.width&&v((S.clientX-L.left)/L.width*t.width,(S.clientY-L.top)/L.height*t.height,S)}:void 0,j=D(e.onPointerMove),I=D(e.onPointerDown),F=j||I?v=>{v.pointerType==="touch"&&j?.(v),I?.(v)}:void 0,T=D(e.onPointerUp),A=Vr(e.theme);return(0,W.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:v=>{t.via==="keyboard"&&!v.currentTarget.contains(v.relatedTarget)&&t.setActive(null)},onPointerLeave:P,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...A,...e.style},children:[t.pending?null:e.underlay,(0,W.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:j,onPointerDown:F,onPointerUp:T,onPointerCancel:T,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,W.jsx)("title",{id:o,children:c}),(0,W.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,W.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,w?(0,W.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:C,children:M??(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:w.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:w.title}),w.rows.map((v,S)=>(0,W.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(v.strong?"ink":"muted")},children:[v.color?(0,W.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:v.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,v.label]}),(0,W.jsx)("span",{style:{fontWeight:v.strong===!1?500:700},children:v.value})]},S))]})}):null,(0,W.jsx)("span",{className:"ztd-sr",style:zt,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?u:null]})}function Bi({label:e,events:t,t:n}){return(0,W.jsx)("div",{className:"ztd-sr",style:zt,children:(0,W.jsxs)("table",{children:[(0,W.jsx)("caption",{children:n.table(e)}),(0,W.jsxs)("tbody",{children:[t.slice(0,Ot).map((r,o)=>(0,W.jsxs)("tr",{children:[(0,W.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,W.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Ot?(0,W.jsx)("tr",{children:(0,W.jsx)("td",{colSpan:2,children:n.more(t.length-Ot)})}):null]})]})})}function Nn(e){let t=e.baseline??"central";return(0,W.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ge=y("label","string",!0,"Item name field"),re=y("value","number",!0,"Value field"),ji=[ge,re],Gi=[ge,re],Hi=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],Wi=[ge,re],Vi=[y("label","string",!0,"Leaf (lowest level) name"),re,y("group","string",!1,"Parent group field")],Ki=[y("label","string",!0,"Leaf name"),re,y("group","string",!1,"Parent group field")],Ui=[ge,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],Xi=[ge,re],Yi=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),re],Ji=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),re],qi=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],Zi=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],Jr=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Qi=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Jr],es=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),Jr],ts=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],ns=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],rs=[ge,re],os=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],as=[ge,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],is=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],ss=[ge,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],ls=[ge,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],cs=[ge,re],us=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],ms=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],ds=[y("source","string",!1,"Source node"),y("target","string",!1,"Target node"),y("dimensions","string",!1,"Stage columns of a wide table, left to right (2 to 6). Each row is one path, so source and target are not used. Without value, each row counts 1",{multi:!0}),y("value","number",!1,"Value field")],fs=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),re],hs=[y("date","date",!0,"Date field"),re],gs=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],ps=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],bs=[y("label","string",!1,"Row name field")],ys=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],xs=[ge,re],ks=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],ws=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],$s=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),re],vs=[ge,re,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Ms=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],Ss=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Ts=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Cs=[y("region","string",!0,"Region name or code, matched to a region of options.map"),re],As=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],Ns=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],Fs=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],Yr={pie:ji,donut:Gi,funnel:Hi,waffle:Wi,treemap:Vi,sunburst:Ki,waterfall:Ui,pareto:Xi,marimekko:Yi,heatmap:Ji,radar:qi,bubble:Zi,line:Qi,area:es,stream:ts,bar:ns,radialBar:rs,gauge:os,bullet:as,sparkline:is,slope:ss,dumbbell:ls,lollipop:cs,beeswarm:us,ridgeline:ms,sankey:ds,chord:fs,calendar:hs,bump:gs,box:ps,parallel:bs,candlestick:ys,segmented:xs,skyline:ks,histogram:ws,scatter:Fs,tileMap:$s,barRace:vs,network:Ms,timeline:Ss,tree:Ts,choropleth:Cs,symbolMap:As,flowMap:Ns},qe={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function qr(e,t){return t==="ko"?e.nameKo:e.name}function Zr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Qr=["line","area","bar","scatter"],eo=24,Fn=["line","area","bar","scatter","timeline"];function Rn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function to(e,t,n){return Fn.includes(e)&&!Rn(e,t,n).length&&!(e==="scatter"&&Bt(n))}function Bt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function no(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Rs={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",butterfly:"bar",pyramid:"bar",populationPyramid:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",raincloud:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap",alluvial:"sankey",parallelSets:"sankey"};function jt(e){let t=Yr[e]?e:Rs[e]??Object.keys(qe).find(n=>n.toLowerCase()===e.toLowerCase()||qe[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!qe[t]))return{type:t,component:qe[t].component,name:qe[t].name,nameKo:qe[t].nameKo,encoding:Yr[t]}}function ro(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of jt(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function Gt(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ps(e,t){if(e==null||typeof e!="object")return;let n=e;if(Gt(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Gt(r,o))return;r=r[o]}return r}}function Te(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function je(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ps(r,n)}function _e(e,t){let n=je(e,t);return(r,o)=>Te(n(r,o))}function le(e,t){let n=je(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function me(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ls(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
23
23
  `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var _s=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function oo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(_s.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Te(t);if(Number.isFinite(n))return n}return t}function Ge(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Ls(o),i=[],s=[],l="",c=!1;for(let h=0;h<o.length;h++){let g=o[h];c?g==='"'?o[h+1]==='"'?(l+='"',h++):c=!1:l+=g:g==='"'&&!l.trim()?(c=!0,l=""):g===a?(s.push(l),l=""):g===`
24
24
  `||g==="\r"?(g==="\r"&&o[h+1]===`
25
- `&&h++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(h=>!(h.length===1&&h[0].trim()===""));if(!m.length)return[];let u=h=>n?oo(h):h;if(!r)return m.map(h=>Object.fromEntries(h.map((g,b)=>[String(b),u(g)])));let d=[],f=new Set;return m[0].forEach((h,g)=>{let b=h.trim()||`col${g+1}`,p=b;for(let w=2;f.has(p);w++)p=`${b}_${w}`;f.add(p),d.push(p)}),m.slice(1).map(h=>Object.fromEntries(d.map((g,b)=>[g,u(h[b]??"")])))}function Pn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?oo(i[l]):i[l]??null])))}function Ds(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function ao(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function De(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return De(JSON.parse(t))}catch{}return Ge(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Pn(e):typeof e[0]=="number"?e.map((t,n)=>({label:String(n+1),value:t})):e.filter(t=>t&&typeof t=="object"):[];if(typeof e=="object"){let t=e;return Array.isArray(t.data)?De(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Pn(t.rows,t.columns.map(n=>typeof n=="object"&&n&&"name"in n?String(n.name):String(n))):Array.isArray(t.rows)&&Array.isArray(t.fields)||Array.isArray(t.rows)?De(t.rows):Array.isArray(t.values)?Pn(t.values):Array.isArray(t.items)?De(t.items):Array.isArray(t.results)?De(t.results):Ds(t)}return[]}function Ht(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Ln(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let f=i(d,c),h=f-i(d,c-1),g=0;for(let b=0;b<d;b++)g+=i(b,c)-i(b,c-1);m+=f,u+=(h/2+g)*f}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let f=0;f<n;f++){let h=e[f][l],g=Number.isFinite(h)?h:0;g>=0?(o[f][l]=u,u+=g,a[f][l]=u):(o[f][l]=d,d+=g,a[f][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function io(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function so(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,f)=>{d>u&&(u=d,m=f)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var Es=Math.PI*2;function Ee(e,t,n){return e<t?t:e>n?n:e}function lo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function co(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function mo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function uo(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var Wt=new Map;function $e(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Wt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);mo(c)?i+=uo(c):s+=uo(c)}a=i+s*(n>=600?1.07:1),Wt.size>5e3&&Wt.clear(),Wt.set(o,a)}return a*t}function Vt(e,t,n,r=400){if(e=e.trim(),$e(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;$e(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(mo(s.charCodeAt(0))?2:3)?"":s+o}var ho=N(z(),1),Is=e=>Array.isArray(e)&&e.length===2;function fo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Is(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var po=N(z(),1),_n=10.5;function Os(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>Je(i,{locale:n,maximumFractionDigits:a}))}function go(e,t,n){let r=18;for(let o of Os(e,t,n))r=Math.max(r,$e(o,_n));return Math.ceil(r+8)}function Dn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function Ze(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Dn(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let f=Dn(c[1]-c[0],n);if(f===l)break;l=f}return c}function bo(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Dn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function En(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>bo(n,r,l),s}function In(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=Ze(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function zs(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let f of c){let h=Number((f*10**d).toPrecision(12));h>=e*(1-1e-9)&&h<=t*(1+1e-9)&&u.push(h)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:bo(e,t,3)}function yo(e,t){let n=En([Math.log10(e[0]),Math.log10(e[1])],t),r=(o=>o>0?n(Math.log10(o)):Number.NaN);return r.domain=e,r.range=t,r.invert=o=>10**n.invert(o),r.ticks=()=>zs(e[0],e[1],Math.abs(t[1]-t[0])),r}function ct(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var Bs=864e5;function xo(e,t,n,r=se){let o=t-e;if(!(o>0))return[{t:e,label:lt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Bs,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,f=!1)=>{let h=new Date(m),g=-1,b=0;for(;h.getTime()<=t&&b++<500;){if(h.getTime()>=e){let p=h.getFullYear(),w=f&&!l&&p!==g;i.push({t:h.getTime(),label:lt(h,{locale:r,...d,...w?{year:"numeric"}:{}})}),g=p}u(h)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(d>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,h=>h.setFullYear(h.getFullYear()+d/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),h=f.getMonth()%d;h&&f.setMonth(f.getMonth()+(d-h)),c(f,g=>g.setMonth(g.getMonth()+d),{month:"short"},!0)}}return i}function ko(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var js=(e,t,n)=>e==="date"?Lt(t,n)?.getTime()??NaN:Te(t);function Gs(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&jr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function ut(e,t,n,r,o={}){let a=je(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:je(n,"y"),c=!i&&r!==void 0?je(r,"series"):null,m=e.map((A,v)=>a(A,v)),u=o.xType??Gs(m),d=o.locale??se,f,h,g;if(u==="band"){let A=m.map(S=>String(S??""));f=me(A);let v=new Map(f.map((S,L)=>[S,L]));h=f.map((S,L)=>L),g=Int32Array.from(A,S=>v.get(S)??-1)}else{let A=u==="date"?o.dayFirst??Gr(m):void 0,v=m.map(B=>js(u,B,A)),S=Array.from(new Set(v.filter(B=>Number.isFinite(B)))).sort((B,oe)=>B-oe),L=new Map(S.map((B,oe)=>[B,oe]));h=S,f=S.map(String),g=Int32Array.from(v,B=>L.get(B)??-1)}let b=o.dateFormat,p=A=>typeof A=="string"?Pt(A.trim())?.[3]:void 0,w=u==="date"&&m.length<5e3?p(m[0]):void 0,k=(w===2||w===3)&&m.every(A=>p(A)===w),M=k&&w===3;if(u==="date"&&!b){let A=h.length>1?h[h.length-1]-h[0]:0;b=k&&w===2||A>864e5*120?{month:"short"}:A<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},A>864e5*800&&(b={year:"numeric",month:"short"})}let y;if(u==="band")y=f;else if(M&&!o.dateFormat){let A=X(d)==="ko";y=h.map(v=>{let S=new Date(v),L=Math.floor(S.getMonth()/3)+1;return A?`${S.getFullYear()}년 ${L}분기`:`Q${L} ${S.getFullYear()}`})}else{let A=h.every(vn),v=u==="date"?new Intl.DateTimeFormat(d,b):new Intl.NumberFormat(d,A?{useGrouping:!1}:{maximumFractionDigits:6});y=h.length>1e3?ko(h.length,S=>v.format(h[S])):h.map(S=>v.format(S))}let C=s?[...s]:c?me(e.map((A,v)=>String(c(A,v)??""))):[""],P=new Map(C.map((A,v)=>[A,v])),D=C.map(()=>new Array(f.length).fill(NaN)),j=C.map(()=>new Array(f.length).fill(null)),I=o.aggregate??"sum",F=I==="mean"?C.map(()=>new Uint32Array(f.length)):null,T=(A,v,S,L)=>{let B=D[A][v];I==="last"?D[A][v]=S:I==="count"?D[A][v]=(Number.isFinite(B)?B:0)+1:I==="mean"?Number.isFinite(S)&&(D[A][v]=(Number.isFinite(B)?B:0)+S,F[A][v]++):D[A][v]=Number.isFinite(B)?B+(Number.isFinite(S)?S:0):S,j[A][v]=L};for(let A=0;A<e.length;A++){let v=g[A];if(v<0)continue;let S=e[A];if(s)for(let L=0;L<s.length;L++)T(L,v,Te(S[s[L]]),S);else{let L=c?P.get(String(c(S,A)??""))??0:0;T(L,v,Te(l(S,A)),S)}}if(F)for(let A=0;A<D.length;A++)for(let v=0;v<f.length;v++)F[A][v]>1&&(D[A][v]/=F[A][v]);return{type:u,keys:f,xnum:h,labels:y,series:C,values:D,rows:j}}var Hs=140,dt=12,wo=14,On=20,$o=12.5;function Ws(e,t,n=eo){let r=le(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function Vs(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+dt)/(Hs+dt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ks(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*dt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var mt=e=>e.filter(Number.isFinite);function Kt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=_e(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return mt(n)}function vo(e,t,n,r,o,a){return ut(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Us(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let y=t.flat(),C=r.refLines??{},[P,D]=ct([...Kt(y,r.x??"x"),...mt([Number(C.x)])]),[j,I]=ct([...Kt(y,r.y??"y"),...mt([Number(C.y)])].filter(T=>!s||T>0)),F=r.zero??!1;return{y:c??(s?In(j,I,i):Ze(j,I,i,{zero:F,pad:.08})),x:r.xDomain??Ze(P,D,Math.max(2,Math.round(o/110)),{zero:F,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),f=n.every(y=>y.keys.join("")===d),h=n.length>0&&n.every(y=>y.type!=="band"&&y.type===n[0].type),g=r.xDomain??(!m&&h?ct(n.flatMap(y=>mt(y.xnum))):void 0),b=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(b==="percent")return{x:g,sameKeys:f};if(c)return{y:c,x:g,sameKeys:f};let p=[];t.forEach((y,C)=>{let P=n[C];if(b==="stacked"||b==="auto"&&P.series.length>1){let j=Ln(P.values,"zero");j.y0.forEach(I=>p.push(...I)),j.y1.forEach(I=>p.push(...I))}else P.values.forEach(j=>p.push(...j));m&&!u&&r.line!==void 0&&vo(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(j=>p.push(...j)),m||p.push(...Kt(y,r.lower),...Kt(y,r.upper))}),m&&p.push(0),u||p.push(...fo(r.annotations));for(let y of r.referenceLines??[])p.push(y.y);r.signColors&&p.push(Number(r.baseline??0));let[w,k]=ct(mt(p).filter(y=>!s||y>0));return{y:s?In(w,k,i):m?Ze(w,k,u?Math.max(2,Math.round(o/120)):i):Ze(w,k,i,{zero:r.zero??e==="area"}),x:g,sameKeys:f}}function Xs(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=ut(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?yo:En)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=go(c,Ir(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(y=>y.series),d=r.endLabels??n.some(y=>y.series.length>1),f=m+6,h=a-(d?Math.min(a*.28,Math.max(...u.map(y=>$e(y,11,700)),20)+14):10),g=l.keys.length,[b,p]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,w=l.type==="number"?g>12:g>xo(b,p,Math.max(2,Math.floor((h-f)/64)),s).length;if(l.type==="band"||!g||w)return;let k=y=>f+(l.xnum[y]-b)/(p-b)*(h-f),M=y=>$e(l.labels[y],_n);for(let y=1;;y++){let C=Array.from({length:Math.ceil(g/y)},(P,D)=>D*y);if(y>=g||C.every((P,D)=>!D||k(P)-k(C[D-1])>=(M(P)+M(C[D-1]))/2+8))return C.map(P=>({value:l.xnum[P],label:l.labels[P]}))}}function Ys(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function Js(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${Ys(`${e}|${t}|${o}|${Ht(r)}`)}`}function qs(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var Zs={en:{intro:(e,t)=>`${Ae(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},zn=18;function Mo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Ws(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Vs(s,i,e.columns),{pw:c,ph:m}=Ks(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(F=>vo(t,F,n,n.y,n.series,n.aggregate)),f=u?Us(t,o,d,n,c,m):{sameKeys:!1},h=u?Xs(t,o,d,n,f,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",b=u&&(!g||f.sameKeys),p=u&&(g||f.x!==void 0||f.sameKeys),w=new Set(qs(e.highlight,r)?[e.highlight].flat():[]),k=w.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??Js(t,e.by,n,e.data),C=Rt(Be(n.format,e.locale),n.unit),P=Zs[e.lang],D=[],j=r.map(F=>F===""?P.blank:F);return{panels:r.map((F,T)=>{let A=o[T],v=j[T],S=T%l,L;if(t!=="scatter"){let oe=d[T],Fe=ae=>oe.values.reduce((G,wt)=>G+(Number.isFinite(wt[ae])?wt[ae]:0),0),H=oe.keys.map((ae,G)=>G).filter(ae=>oe.values.some(G=>Number.isFinite(G[ae]))),re=H[H.length-1];D.push({first:H.length?Fe(H[0]):NaN,last:H.length?Fe(re):NaN,total:H.reduce((ae,G)=>ae+Fe(G),0)}),t!=="bar"&&oe.series.length===1&&re!==void 0&&(L=C(oe.values[0][re]))}else D.push({first:NaN,last:NaN,total:A.length});let B={data:A,width:c,height:m,ariaLabel:e.title?`${e.title}, ${v}`:v,syncId:y,highlight:k?w.has(F)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!b||S===0,showXAxis:!p||T+l>=i};return f.y&&(B.yDomain=f.y),f.x&&(B.xDomain=f.x),h&&(B.xTicks=h),{value:F,label:v,props:B,last:L,isPicked:w.has(F)}}),cols:l,pw:c,ph:m,isPanelPick:k,description:Qs(t,e.by,j,D,a,C,P)}}function Qs(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>co(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var de=N(V(),1);function el(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function tl(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var Ut={threshold:.25,enoughPx:96,rootMargin:"0px"};function Co(e,t=!0){let[n,r]=(0,de.useState)({visible:!t,near:!t});return(0,de.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=tl(i[i.length-1],Ut.threshold,Ut.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:el(Ut.threshold),rootMargin:Ut.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function So(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Xt(e){let[t,n]=(0,de.useState)(null),[r,o]=(0,de.useState)(e??null),a=(0,de.useCallback)(i=>{n(i),i&&e===void 0&&o(So(i))},[e]);return Se(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(So(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var nl=()=>()=>{};function Qe(){return(0,de.useSyncExternalStore)(nl,()=>!0,()=>!1)}var To="(prefers-reduced-motion: reduce)";function Yt(e="auto"){let[t,n]=(0,de.useState)(()=>ye&&typeof window.matchMedia=="function"?window.matchMedia(To).matches:!1);return(0,de.useEffect)(()=>{if(e!=="auto"||!ye||typeof window.matchMedia!="function")return;let r=window.matchMedia(To),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var ve=N(z(),1),rl=60,ol=420;function Ao(e){let t=we(),n=e.chartProps??{},[,r,o]=Xt(e.width),a=e.width??(o||480),i=ce(e.locale??n.locale),s=X(i),l=(0,et.useContext)(Ke),c=e.title??l,m=e.chart.facetPlan,u=(0,et.useMemo)(()=>{let p=Mo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return m?m(p,n,i):p},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(p,w)=>typeof w=="function"?String(w):w),e.highlight,e.syncId,a,e.height,c,i,s,m]),d=`${(0,et.useId)().replace(/:/g,"")}fd`,f=Yt(n.reducedMotion??"auto"),h=Qe(),g=Tt({motion:{enabled:n.animate!==!1&&!f&&ye},hydrated:h},{waiting:!1,generation:0}),b=e.chart;return(0,ve.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,ve.jsx)("p",{id:d,style:zt,children:e.description??u.description}),(0,ve.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:dt,rowGap:wo,...u.legend?{marginTop:zn}:null},children:u.panels.map((p,w)=>{let k=t.paint(p.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,ve.jsxs)("div",{"data-facet":p.value,style:{minWidth:0,...St(g,!1,"fade",w*rl,ol)},children:[(0,ve.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:On,fontSize:$o,fontWeight:700,lineHeight:`${On}px`,color:k},children:[(0,ve.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.label}),p.last!==void 0?(0,ve.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:p.last}):null]}),(0,ve.jsx)(b,{...n,...p.props})]},p.value)})}),u.legend?(0,ve.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:zn},children:u.legend}):null]})}var No=["max","min","first","last","none"];function Me(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,f)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=f)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var pe=N(V(),1);async function al(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(X(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ge(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ge(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ge(a)}async function il(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await al(a,t.parse,o,t.locale)}return t.select&&(r=ao(r,t.select)),t.transform?t.transform(r):De(r)}function Fo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,pe.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,pe.useState)(0),c=ce(t.locale),m=(0,pe.useRef)(t);m.current={...t,locale:c};let u=(0,pe.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],h=JSON.stringify(f.map(p=>typeof p=="object"?JSON.stringify(p):String(p))),g=(0,pe.useRef)(!1);(0,pe.useEffect)(()=>{let p=u.current;if(!p||!r){i(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let w=new AbortController,k=!0;return g.current=!0,i(M=>({...M,data:o?M.data:[],status:"loading",error:null})),il(p,{...m.current,signal:w.signal}).then(M=>{k&&i({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!k||w.signal.aborted||i(y=>({...y,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{k&&(g.current=!1)}),()=>{k=!1,g.current=!1,w.abort()}},[d,r,s,h,o]),(0,pe.useEffect)(()=>{if(!n||!r)return;let p=setInterval(()=>{g.current||l(w=>w+1)},n);return()=>clearInterval(p)},[n,r]);let b=(0,pe.useCallback)(()=>l(p=>p+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:b}}var jn=N(z(),1),sl=["csv","svg","png"],ll=/^[=+\-@\t\r\n=+-@]/,cl=/var\(|color-mix\(/;function Ro(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Or(e.getTime()):String(e);return`"${(ll.test(t)&&!Number.isFinite(Te(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ul(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function ml(e,t){return`\uFEFF${[t.map(Ro),...e.map(r=>t.map(o=>Ro(r[o])))].map(r=>r.join(",")).join(`\r
25
+ `&&h++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(h=>!(h.length===1&&h[0].trim()===""));if(!m.length)return[];let u=h=>n?oo(h):h;if(!r)return m.map(h=>Object.fromEntries(h.map((g,b)=>[String(b),u(g)])));let d=[],f=new Set;return m[0].forEach((h,g)=>{let b=h.trim()||`col${g+1}`,p=b;for(let w=2;f.has(p);w++)p=`${b}_${w}`;f.add(p),d.push(p)}),m.slice(1).map(h=>Object.fromEntries(d.map((g,b)=>[g,u(h[b]??"")])))}function Pn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?oo(i[l]):i[l]??null])))}function Ds(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function ao(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function De(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return De(JSON.parse(t))}catch{}return Ge(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Pn(e):typeof e[0]=="number"?e.map((t,n)=>({label:String(n+1),value:t})):e.filter(t=>t&&typeof t=="object"):[];if(typeof e=="object"){let t=e;return Array.isArray(t.data)?De(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Pn(t.rows,t.columns.map(n=>typeof n=="object"&&n&&"name"in n?String(n.name):String(n))):Array.isArray(t.rows)&&Array.isArray(t.fields)||Array.isArray(t.rows)?De(t.rows):Array.isArray(t.values)?Pn(t.values):Array.isArray(t.items)?De(t.items):Array.isArray(t.results)?De(t.results):Ds(t)}return[]}function Ht(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Ln(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let f=i(d,c),h=f-i(d,c-1),g=0;for(let b=0;b<d;b++)g+=i(b,c)-i(b,c-1);m+=f,u+=(h/2+g)*f}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let f=0;f<n;f++){let h=e[f][l],g=Number.isFinite(h)?h:0;g>=0?(o[f][l]=u,u+=g,a[f][l]=u):(o[f][l]=d,d+=g,a[f][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function io(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function so(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,f)=>{d>u&&(u=d,m=f)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var Es=Math.PI*2;function Ee(e,t,n){return e<t?t:e>n?n:e}function lo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function co(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function mo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function uo(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var Wt=new Map;function $e(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Wt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);mo(c)?i+=uo(c):s+=uo(c)}a=i+s*(n>=600?1.07:1),Wt.size>5e3&&Wt.clear(),Wt.set(o,a)}return a*t}function Vt(e,t,n,r=400){if(e=e.trim(),$e(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;$e(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(mo(s.charCodeAt(0))?2:3)?"":s+o}var ho=N(z(),1),Is=e=>Array.isArray(e)&&e.length===2;function fo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Is(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var po=N(z(),1),_n=10.5;function Os(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>Je(i,{locale:n,maximumFractionDigits:a}))}function go(e,t,n){let r=18;for(let o of Os(e,t,n))r=Math.max(r,$e(o,_n));return Math.ceil(r+8)}function Dn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function Ze(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Dn(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let f=Dn(c[1]-c[0],n);if(f===l)break;l=f}return c}function bo(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Dn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function En(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>bo(n,r,l),s}function In(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=Ze(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function zs(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let f of c){let h=Number((f*10**d).toPrecision(12));h>=e*(1-1e-9)&&h<=t*(1+1e-9)&&u.push(h)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:bo(e,t,3)}function yo(e,t){let n=En([Math.log10(e[0]),Math.log10(e[1])],t),r=(o=>o>0?n(Math.log10(o)):Number.NaN);return r.domain=e,r.range=t,r.invert=o=>10**n.invert(o),r.ticks=()=>zs(e[0],e[1],Math.abs(t[1]-t[0])),r}function ct(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var Bs=864e5;function xo(e,t,n,r=se){let o=t-e;if(!(o>0))return[{t:e,label:lt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Bs,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,f=!1)=>{let h=new Date(m),g=-1,b=0;for(;h.getTime()<=t&&b++<500;){if(h.getTime()>=e){let p=h.getFullYear(),w=f&&!l&&p!==g;i.push({t:h.getTime(),label:lt(h,{locale:r,...d,...w?{year:"numeric"}:{}})}),g=p}u(h)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(d>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,h=>h.setFullYear(h.getFullYear()+d/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),h=f.getMonth()%d;h&&f.setMonth(f.getMonth()+(d-h)),c(f,g=>g.setMonth(g.getMonth()+d),{month:"short"},!0)}}return i}function ko(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var js=(e,t,n)=>e==="date"?Lt(t,n)?.getTime()??NaN:Te(t);function Gs(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&jr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function ut(e,t,n,r,o={}){let a=je(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:je(n,"y"),c=!i&&r!==void 0?je(r,"series"):null,m=e.map((A,v)=>a(A,v)),u=o.xType??Gs(m),d=o.locale??se,f,h,g;if(u==="band"){let A=m.map(S=>String(S??""));f=me(A);let v=new Map(f.map((S,L)=>[S,L]));h=f.map((S,L)=>L),g=Int32Array.from(A,S=>v.get(S)??-1)}else{let A=u==="date"?o.dayFirst??Gr(m):void 0,v=m.map(B=>js(u,B,A)),S=Array.from(new Set(v.filter(B=>Number.isFinite(B)))).sort((B,oe)=>B-oe),L=new Map(S.map((B,oe)=>[B,oe]));h=S,f=S.map(String),g=Int32Array.from(v,B=>L.get(B)??-1)}let b=o.dateFormat,p=A=>typeof A=="string"?Pt(A.trim())?.[3]:void 0,w=u==="date"&&m.length<5e3?p(m[0]):void 0,k=(w===2||w===3)&&m.every(A=>p(A)===w),M=k&&w===3;if(u==="date"&&!b){let A=h.length>1?h[h.length-1]-h[0]:0;b=k&&w===2||A>864e5*120?{month:"short"}:A<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},A>864e5*800&&(b={year:"numeric",month:"short"})}let x;if(u==="band")x=f;else if(M&&!o.dateFormat){let A=X(d)==="ko";x=h.map(v=>{let S=new Date(v),L=Math.floor(S.getMonth()/3)+1;return A?`${S.getFullYear()}년 ${L}분기`:`Q${L} ${S.getFullYear()}`})}else{let A=h.every(vn),v=u==="date"?new Intl.DateTimeFormat(d,b):new Intl.NumberFormat(d,A?{useGrouping:!1}:{maximumFractionDigits:6});x=h.length>1e3?ko(h.length,S=>v.format(h[S])):h.map(S=>v.format(S))}let C=s?[...s]:c?me(e.map((A,v)=>String(c(A,v)??""))):[""],P=new Map(C.map((A,v)=>[A,v])),D=C.map(()=>new Array(f.length).fill(NaN)),j=C.map(()=>new Array(f.length).fill(null)),I=o.aggregate??"sum",F=I==="mean"?C.map(()=>new Uint32Array(f.length)):null,T=(A,v,S,L)=>{let B=D[A][v];I==="last"?D[A][v]=S:I==="count"?D[A][v]=(Number.isFinite(B)?B:0)+1:I==="mean"?Number.isFinite(S)&&(D[A][v]=(Number.isFinite(B)?B:0)+S,F[A][v]++):D[A][v]=Number.isFinite(B)?B+(Number.isFinite(S)?S:0):S,j[A][v]=L};for(let A=0;A<e.length;A++){let v=g[A];if(v<0)continue;let S=e[A];if(s)for(let L=0;L<s.length;L++)T(L,v,Te(S[s[L]]),S);else{let L=c?P.get(String(c(S,A)??""))??0:0;T(L,v,Te(l(S,A)),S)}}if(F)for(let A=0;A<D.length;A++)for(let v=0;v<f.length;v++)F[A][v]>1&&(D[A][v]/=F[A][v]);return{type:u,keys:f,xnum:h,labels:x,series:C,values:D,rows:j}}var Hs=140,dt=12,wo=14,On=20,$o=12.5;function Ws(e,t,n=eo){let r=le(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function Vs(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+dt)/(Hs+dt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ks(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*dt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var mt=e=>e.filter(Number.isFinite);function Kt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=_e(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return mt(n)}function vo(e,t,n,r,o,a){return ut(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Us(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let x=t.flat(),C=r.refLines??{},[P,D]=ct([...Kt(x,r.x??"x"),...mt([Number(C.x)])]),[j,I]=ct([...Kt(x,r.y??"y"),...mt([Number(C.y)])].filter(T=>!s||T>0)),F=r.zero??!1;return{y:c??(s?In(j,I,i):Ze(j,I,i,{zero:F,pad:.08})),x:r.xDomain??Ze(P,D,Math.max(2,Math.round(o/110)),{zero:F,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),f=n.every(x=>x.keys.join("")===d),h=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),g=r.xDomain??(!m&&h?ct(n.flatMap(x=>mt(x.xnum))):void 0),b=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(b==="percent")return{x:g,sameKeys:f};if(c)return{y:c,x:g,sameKeys:f};let p=[];t.forEach((x,C)=>{let P=n[C];if(b==="stacked"||b==="auto"&&P.series.length>1){let j=Ln(P.values,"zero");j.y0.forEach(I=>p.push(...I)),j.y1.forEach(I=>p.push(...I))}else P.values.forEach(j=>p.push(...j));m&&!u&&r.line!==void 0&&vo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(j=>p.push(...j)),m||p.push(...Kt(x,r.lower),...Kt(x,r.upper))}),m&&p.push(0),u||p.push(...fo(r.annotations));for(let x of r.referenceLines??[])p.push(x.y);r.signColors&&p.push(Number(r.baseline??0));let[w,k]=ct(mt(p).filter(x=>!s||x>0));return{y:s?In(w,k,i):m?Ze(w,k,u?Math.max(2,Math.round(o/120)):i):Ze(w,k,i,{zero:r.zero??e==="area"}),x:g,sameKeys:f}}function Xs(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=ut(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?yo:En)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=go(c,Ir(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(x=>x.series),d=r.endLabels??n.some(x=>x.series.length>1),f=m+6,h=a-(d?Math.min(a*.28,Math.max(...u.map(x=>$e(x,11,700)),20)+14):10),g=l.keys.length,[b,p]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,w=l.type==="number"?g>12:g>xo(b,p,Math.max(2,Math.floor((h-f)/64)),s).length;if(l.type==="band"||!g||w)return;let k=x=>f+(l.xnum[x]-b)/(p-b)*(h-f),M=x=>$e(l.labels[x],_n);for(let x=1;;x++){let C=Array.from({length:Math.ceil(g/x)},(P,D)=>D*x);if(x>=g||C.every((P,D)=>!D||k(P)-k(C[D-1])>=(M(P)+M(C[D-1]))/2+8))return C.map(P=>({value:l.xnum[P],label:l.labels[P]}))}}function Ys(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function Js(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${Ys(`${e}|${t}|${o}|${Ht(r)}`)}`}function qs(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var Zs={en:{intro:(e,t)=>`${Ae(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},zn=18;function Mo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Ws(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Vs(s,i,e.columns),{pw:c,ph:m}=Ks(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(F=>vo(t,F,n,n.y,n.series,n.aggregate)),f=u?Us(t,o,d,n,c,m):{sameKeys:!1},h=u?Xs(t,o,d,n,f,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",b=u&&(!g||f.sameKeys),p=u&&(g||f.x!==void 0||f.sameKeys),w=new Set(qs(e.highlight,r)?[e.highlight].flat():[]),k=w.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??Js(t,e.by,n,e.data),C=Rt(Be(n.format,e.locale),n.unit),P=Zs[e.lang],D=[],j=r.map(F=>F===""?P.blank:F);return{panels:r.map((F,T)=>{let A=o[T],v=j[T],S=T%l,L;if(t!=="scatter"){let oe=d[T],Fe=ae=>oe.values.reduce((G,wt)=>G+(Number.isFinite(wt[ae])?wt[ae]:0),0),H=oe.keys.map((ae,G)=>G).filter(ae=>oe.values.some(G=>Number.isFinite(G[ae]))),ne=H[H.length-1];D.push({first:H.length?Fe(H[0]):NaN,last:H.length?Fe(ne):NaN,total:H.reduce((ae,G)=>ae+Fe(G),0)}),t!=="bar"&&oe.series.length===1&&ne!==void 0&&(L=C(oe.values[0][ne]))}else D.push({first:NaN,last:NaN,total:A.length});let B={data:A,width:c,height:m,ariaLabel:e.title?`${e.title}, ${v}`:v,syncId:x,highlight:k?w.has(F)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!b||S===0,showXAxis:!p||T+l>=i};return f.y&&(B.yDomain=f.y),f.x&&(B.xDomain=f.x),h&&(B.xTicks=h),{value:F,label:v,props:B,last:L,isPicked:w.has(F)}}),cols:l,pw:c,ph:m,isPanelPick:k,description:Qs(t,e.by,j,D,a,C,P)}}function Qs(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>co(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var de=N(V(),1);function el(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function tl(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var Ut={threshold:.25,enoughPx:96,rootMargin:"0px"};function Co(e,t=!0){let[n,r]=(0,de.useState)({visible:!t,near:!t});return(0,de.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=tl(i[i.length-1],Ut.threshold,Ut.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:el(Ut.threshold),rootMargin:Ut.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function So(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Xt(e){let[t,n]=(0,de.useState)(null),[r,o]=(0,de.useState)(e??null),a=(0,de.useCallback)(i=>{n(i),i&&e===void 0&&o(So(i))},[e]);return Se(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(So(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var nl=()=>()=>{};function Qe(){return(0,de.useSyncExternalStore)(nl,()=>!0,()=>!1)}var To="(prefers-reduced-motion: reduce)";function Yt(e="auto"){let[t,n]=(0,de.useState)(()=>ye&&typeof window.matchMedia=="function"?window.matchMedia(To).matches:!1);return(0,de.useEffect)(()=>{if(e!=="auto"||!ye||typeof window.matchMedia!="function")return;let r=window.matchMedia(To),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var ve=N(z(),1),rl=60,ol=420;function Ao(e){let t=we(),n=e.chartProps??{},[,r,o]=Xt(e.width),a=e.width??(o||480),i=ce(e.locale??n.locale),s=X(i),l=(0,et.useContext)(Ke),c=e.title??l,m=e.chart.facetPlan,u=(0,et.useMemo)(()=>{let p=Mo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return m?m(p,n,i):p},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(p,w)=>typeof w=="function"?String(w):w),e.highlight,e.syncId,a,e.height,c,i,s,m]),d=`${(0,et.useId)().replace(/:/g,"")}fd`,f=Yt(n.reducedMotion??"auto"),h=Qe(),g=Tt({motion:{enabled:n.animate!==!1&&!f&&ye},hydrated:h},{waiting:!1,generation:0}),b=e.chart;return(0,ve.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,ve.jsx)("p",{id:d,style:zt,children:e.description??u.description}),(0,ve.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:dt,rowGap:wo,...u.legend?{marginTop:zn}:null},children:u.panels.map((p,w)=>{let k=t.paint(p.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,ve.jsxs)("div",{"data-facet":p.value,style:{minWidth:0,...St(g,!1,"fade",w*rl,ol)},children:[(0,ve.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:On,fontSize:$o,fontWeight:700,lineHeight:`${On}px`,color:k},children:[(0,ve.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.label}),p.last!==void 0?(0,ve.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:p.last}):null]}),(0,ve.jsx)(b,{...n,...p.props})]},p.value)})}),u.legend?(0,ve.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:zn},children:u.legend}):null]})}var No=["max","min","first","last","none"];function Me(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,f)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=f)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var pe=N(V(),1);async function al(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(X(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ge(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ge(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ge(a)}async function il(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await al(a,t.parse,o,t.locale)}return t.select&&(r=ao(r,t.select)),t.transform?t.transform(r):De(r)}function Fo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,pe.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,pe.useState)(0),c=ce(t.locale),m=(0,pe.useRef)(t);m.current={...t,locale:c};let u=(0,pe.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],h=JSON.stringify(f.map(p=>typeof p=="object"?JSON.stringify(p):String(p))),g=(0,pe.useRef)(!1);(0,pe.useEffect)(()=>{let p=u.current;if(!p||!r){i(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let w=new AbortController,k=!0;return g.current=!0,i(M=>({...M,data:o?M.data:[],status:"loading",error:null})),il(p,{...m.current,signal:w.signal}).then(M=>{k&&i({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!k||w.signal.aborted||i(x=>({...x,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{k&&(g.current=!1)}),()=>{k=!1,g.current=!1,w.abort()}},[d,r,s,h,o]),(0,pe.useEffect)(()=>{if(!n||!r)return;let p=setInterval(()=>{g.current||l(w=>w+1)},n);return()=>clearInterval(p)},[n,r]);let b=(0,pe.useCallback)(()=>l(p=>p+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:b}}var jn=N(z(),1),sl=["csv","svg","png"],ll=/^[=+\-@\t\r\n=+-@]/,cl=/var\(|color-mix\(/;function Ro(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Or(e.getTime()):String(e);return`"${(ll.test(t)&&!Number.isFinite(Te(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ul(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function ml(e,t){return`\uFEFF${[t.map(Ro),...e.map(r=>t.map(o=>Ro(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
27
  `}function dl(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Bn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Po=2,Ie=16;function Lo(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function _o(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Do(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+Ie*2,i+Ie*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((h,g)=>{let b;for(let p of Array.from(h.attributes)){if(!cl.test(p.value))continue;let w=(b??(b=getComputedStyle(h))).getPropertyValue(p.name);w&&m[g].setAttribute(p.name,Lo(w,u))}}),c.removeAttribute("style");for(let[h,g]of Object.entries({viewBox:`${-Ie} ${-Ie} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(h,String(g));let d=Lo(getComputedStyle(r).backgroundColor,u),f=o.parentElement?.querySelector("canvas")??null;if(n){let h=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(_o("rect",{x:-Ie,y:-Ie,width:s,height:l,fill:d}),h),f&&c.insertBefore(_o("image",{href:f.toDataURL(),width:a,height:i}),h)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:f}}function fl(e,t){let n=Do(e,Po,!1);if(!n)return;let r=Po,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,Ie*r,Ie*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&Bn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Eo(e){let t=we(e.theme),n=X(ce(e.locale))==="ko",r=dl(e.filename),o=(a,i)=>{if(a==="csv")return Bn(new Blob([ml(e.data,e.columns?.length?e.columns:ul(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return fl(i,r);let s=Do(i,1,!0);s&&Bn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,jn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:sl.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,jn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Oo=N(z(),1);function Io(e,t=se){let n=Be(void 0,t),r=e.split(`
28
- `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?lt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Br,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Oo.jsx)("div",{children:s},l)):null}}function ft(e){let t=String(e??"").normalize("NFC").trim().replace(/\s+/g," ").toLowerCase();return/^\d+$/.test(t)?t.replace(/^0+(?=\d)/,""):t}function tt(e){let t=new Map;return e.forEach((n,r)=>{for(let o of n){let a=ft(o);a&&!t.has(a)&&t.set(a,r)}}),n=>t.get(ft(n))??-1}function zo(e,t){let n=[...new Set([...new Set(e)].map(ft))].filter(Boolean),r=-1,o=0;return t.forEach((a,i)=>{let s=n.filter(l=>a(l)>=0).length;s>o&&(o=s,r=i)}),r}function Bo(e,t,n=!1){let r=le(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=me(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}var hl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function jo(e){if(typeof e!="string")return[];let t=new Int8Array(128).fill(-1);for(let i=0;i<64;i++)t[hl.charCodeAt(i)]=i;let n=[],r=0,o=1,a=0;for(let i=0;i<e.length;i++){let s=t[e.charCodeAt(i)]??-1;s<0||(r+=(s&31)*o,a++,s&32&&a<7?o*=32:(s&32||n.push(r%2?-(r+1)/2:r/2),r=0,o=1,a=0))}return n}var Go=new WeakMap,Jt=(e,t)=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=t?e:-1;function qt(e){let t=Go.get(e);if(t)return t;let n=Array.isArray(e.topo?.t)?e.topo.t:[],[r,o,a]=n.every(g=>Number.isFinite(g))&&n.length>=3?n:[NaN,NaN,NaN],i=Number.isFinite(r)&&r>0,s=i?jo(e.topo.arcs):[],l=[],c=0;for(let g=0;g<s.length;){let b=Jt(s[g++],(s.length-g)/2);if(b<0)break;let p=[],w=0,k=0;for(let M=0;M<b;M++)w+=s[g++],k+=s[g++],p.push([w*r+o,k*r+a]);c+=b,l.push(p)}let m=i?jo(e.topo.shapes):[],u=0,d=c*4,h=(Array.isArray(e.regions)?e.regions:[]).map(g=>{let b=Array.isArray(g)?g.filter(M=>typeof M=="string"):[],p=[];for(let M=Jt(m[u++],m.length-u);M>0;M--){let y=[];for(let C=Jt(m[u++],m.length-u);C>0;C--){let P=[];for(let D=Jt(m[u++],m.length-u),j=0;j<D;j++){let I=m[u++],F=(I>=0?l[I]:l[~I]?.slice().reverse())??[];if(d-=F.length,d<0)break;for(let T=j?1:0;T<F.length;T++)P.push(F[T])}if(P.length>1&&P[0][0]===P[P.length-1][0]&&P[0][1]===P[P.length-1][1]&&P.pop(),P.length>=3&&y.push(P),d<0||u>m.length)break}if(y.length&&p.push(y),d<0||u>m.length)break}let w=b[0]??"",k=e.namesKo?.[w];return{id:w,name:b[1]??w,nameKo:typeof k=="string"?k:void 0,keys:typeof k=="string"?[...b,k]:b,polygons:p}});return Go.set(e,h),h}var Oe=e=>typeof e=="string"&&e.trim()!==""?e:typeof e=="number"&&Number.isFinite(e)?String(e):void 0;function Ho(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){if(!Array.isArray(r)||typeof r[0]!="number"||typeof r[1]!="number"||!Number.isFinite(r[0])||!Number.isFinite(r[1]))continue;let[o,a]=r;a>90||a<-90||o>540||o<-540?(t.n++,a=Math.max(-90,Math.min(90,a)),o=((o+180)%360+360)%360-180):(o>180||o<-180)&&t.n++;let i=n[n.length-1];(!i||i[0]!==o||i[1]!==a)&&n.push([o,a])}return n.length>1&&n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]&&n.pop(),n.length>=3?n:null}function Zt(e,t,n){let r=`${t??""}${n??""}`,o=Wo.get(e),a=o?.get(r);if(a)return a;let i=gl(e,t,n);return o||Wo.set(e,o=new Map),o.set(r,i),i}var Wo=new WeakMap;function gl(e,t,n){let r=[],o=[],a={n:0};return(Array.isArray(e.features)?e.features:[]).forEach((i,s)=>{let l=i&&typeof i.properties=="object"&&i.properties||{},c=i?.geometry,m=c&&Array.isArray(c.coordinates)?c.type==="Polygon"?[c.coordinates]:c.type==="MultiPolygon"?c.coordinates:[]:[],u=[];for(let h of m){if(!Array.isArray(h))continue;let g=Ho(h[0],a);g&&u.push([g,...h.slice(1).map(b=>Ho(b,a)).filter(b=>b!==null)])}if(!u.length)return void o.push(s);let d=(t?Oe(l[t]):void 0)??Oe(i?.id)??Oe(l.id)??Oe(l.code)??String(s+1),f=(n?Oe(l[n]):void 0)??Oe(l.name)??Oe(l.NAME)??d;r.push({id:d,name:f,keys:[...new Set([d,f,Oe(i?.id)].filter(h=>!!h))],polygons:u})}),{shapes:r,skipped:o,outOfRange:a.n}}var ht=["world","us-states","kr-sido"];function Ko(){var t;let e=globalThis;return e[t=Symbol.for("ztd-charts.geo.maps")]??(e[t]=new Map)}function He(e){let t=e;return!!t&&typeof t=="object"&&typeof t.name=="string"&&Array.isArray(t.regions)&&!!t.topo&&typeof t.topo.arcs=="string"}function pl(e){let t=e;return!!t&&typeof t=="object"&&t.type==="FeatureCollection"&&Array.isArray(t.features)}function nt(e){return Ko().get(e)}function Gn(){return[...Ko().keys()]}function bl(e){return e.regions.map(t=>{let n=Array.isArray(t)?t.filter(o=>typeof o=="string"):[],r=n[0]!==void 0?e.namesKo?.[n[0]]:void 0;return typeof r=="string"?[...n,r]:n})}var Vo=new WeakMap;function gt(e){let t=Vo.get(e);return t||Vo.set(e,t=tt(bl(e))),t}function Uo(e,t){if(e===void 0||e==="auto"){let n=Gn();if(!n.length)return{missing:"auto"};let r=zo(t(),n.map(a=>gt(nt(a)))),o=n[Math.max(0,r)];return{map:nt(o),name:o}}if(typeof e=="string"){let n=nt(e);return n?{map:n,name:e}:{missing:e}}return He(e)?{map:e,name:e.name}:pl(e)?{map:e}:null}var ot=.017453292519943295,Ce=e=>((e+180)%360+360)%360-180,Xo=1.340264,Yo=-.081106,Jo=893e-6,qo=.003796,Zo=.8660254037844386,yl=(e,t)=>{let n=Math.asin(Zo*Math.sin(t)),r=n*n,o=r*r*r;return[e*Math.cos(n)/(Zo*(Xo+3*Yo*r+o*(7*Jo+9*qo*r))),n*(Xo+Yo*r+o*(Jo+qo*r))]};function Qt(e,t){let n=Math.sin(e*ot),r=(n+Math.sin(t*ot))/2;if(Math.abs(r)<.001)return(i,s)=>[i,Math.sin(s)];let o=1+n*(2*r-n),a=Math.sqrt(o)/r;return(i,s)=>{let l=Math.sqrt(Math.max(0,o-2*r*Math.sin(s)))/r;return[l*Math.sin(i*r),a-l*Math.cos(i*r)]}}function pt(e,t,n=[0,0],r=1,o=[0,0]){let[a,i]=t(n[0]*ot,n[1]*ot);return{lon0:e,raw:(s,l)=>{let[c,m]=t(s*ot,Math.max(-90,Math.min(90,l))*ot);return[r*(c-a)+o[0],-r*(m-i)+o[1]]}}}var ea=["AK","HI"];function bt(e,t,n,r){let o=e.pick(t,n,r);return o.raw(Ce(t-o.lon0),n)}function Hn(e,t=0,n){if(e==="albersUsa"){let o=pt(-96,Qt(29.5,45.5),[-.6,38.7]),a=pt(-154,Qt(55,65),[-2,58.5],.35,[-.307,.201]),i=pt(-157,Qt(8,18),[-3,19.9],1,[-.205,.212]);return{name:e,pick:(s,l,c)=>c!==void 0?c==="AK"?a:c==="HI"?i:o:l>=50&&(s<=-129||s>=170)?a:l>=18&&l<=23&&s>=-161&&s<=-154?i:o}}if(e==="conic"&&n){let[,o,,a]=n,i=pt(t,Qt(o+(a-o)/6,o+(a-o)*5/6),[0,(o+a)/2]);return{name:e,pick:()=>i}}let r=pt(t,yl);return{name:"equalEarth",pick:()=>r}}function en(e){let t=[],n=1/0,r=-1/0;for(let i of e)for(let s of i.polygons)for(let[l,c]of s[0])t.push(Ce(l)),c<n&&(n=c),c>r&&(r=c);if(!t.length)return null;t.sort((i,s)=>i-s);let o=t[0]+360-t[t.length-1],a=t[0];for(let i=1;i<t.length;i++)t[i]-t[i-1]>o&&(o=t[i]-t[i-1],a=t[i]);return[a,n,a+360-o,r]}function tn(e){return e[2]-e[0]>150||e[3]-e[1]>70?"equalEarth":"conic"}function Qo(e,t,n){let r=[];for(let o=0;o<e.length;o++){let a=e[o],i=e[(o+1)%e.length],s=(a[0]-t)*n>=0,l=(i[0]-t)*n>=0;s&&r.push(a),s!==l&&r.push([t,a[1]+(i[1]-a[1])*(t-a[0])/(i[0]-a[0])])}return r}function xl(e){let t=0,n=-1;for(let a=0;a<e.length;a++)Math.abs(e[a][0]-e[(a+e.length-1)%e.length][0])>180&&(t++,n<0&&(n=a));if(!t)return[e];if(t%2){let a=e[(n+e.length-1)%e.length],i=e[n],s=a[0]>0?180:-180,l=360-Math.abs(a[0]-i[0]),c=a[1]+(i[1]-a[1])*(Math.abs(s-a[0])||0)/(l||1),m=e.reduce((u,d)=>u+d[1],0)<0?-90:90;return[[...e.slice(0,n),[s,c],[s,m],[-s,m],[-s,c],...e.slice(n)]]}let r=[e[0]];for(let a=1;a<e.length;a++){let i=e[a][0],s=r[a-1][0];for(;i-s>180;)i-=360;for(;i-s<-180;)i+=360;r.push([i,e[a][1]])}let o=[];for(let a of[-1,0,1]){let i=Qo(Qo(r,a*360-180,1),a*360+180,-1),s=0;for(let l=0,c=i.length-1;l<i.length;c=l++)s+=(i[c][0]-i[l][0])*(i[c][1]+i[l][1]);i.length>=3&&Math.abs(s)>1e-9&&o.push(a?i.map(([l,c])=>[l-a*360,c]):i)}return o}function ta(e,t){let n=[],r=[],o=[],a=[1/0,1/0,-1/0,-1/0];return t.polygons.forEach((i,s)=>i.forEach((l,c)=>{let m=e.pick(l[0][0],l[0][1],e.name==="albersUsa"?t.id:void 0);for(let u of xl(l.map(([d,f])=>[Ce(d-m.lon0),f]))){let d=new Float64Array(u.length*2);u.forEach(([f,h],g)=>{let[b,p]=m.raw(f,h);d[g*2]=b,d[g*2+1]=p,b<a[0]&&(a[0]=b),p<a[1]&&(a[1]=p),b>a[2]&&(a[2]=b),p>a[3]&&(a[3]=p)}),n.push(d),r.push(s),o.push(c===0)}})),{rings:n,poly:r,outer:o,box:a}}function na(e,t){let n=[1/0,1/0,-1/0,-1/0],[r,o,a,i]=t;for(let s=0;s<=24;s++){let l=s/24;for(let[c,m]of[[r+(a-r)*l,o],[r+(a-r)*l,i],[r,o+(i-o)*l],[a,o+(i-o)*l]]){let[u,d]=bt(e,c,m);n[0]=Math.min(n[0],u),n[1]=Math.min(n[1],d),n[2]=Math.max(n[2],u),n[3]=Math.max(n[3],d)}}return n}function ra(e,t,n){let r=e[2]-e[0],o=e[3]-e[1],a=r>0&&o>0?Math.min(t/r,n/o):1;return{k:a,tx:(t-r*a)/2-e[0]*a,ty:(n-o*a)/2-e[1]*a}}var rt=e=>Math.round(e*10)/10||0;function oa(e,t,n,r=0){let o="";for(let a of e){let i="",s=NaN,l=NaN,c=0,m=1/0,u=-1/0,d=1/0,f=-1/0;for(let g=0;g<a.length;g+=2){let b=rt(a[g]*t.k+t.tx),p=rt(a[g+1]*t.k+t.ty);Math.abs(b-s)<.35&&Math.abs(p-l)<.35||(i+=c?`${c===1?"l":" "}${rt(b-s)} ${rt(p-l)}`:`M${b} ${p}`,s=b,l=p,c++,b<m&&(m=b),b>u&&(u=b),p<d&&(d=p),p>f&&(f=p))}n!==void 0&&(u<0||f<0||m>n[0]||d>n[1])||Math.min(u-m,f-d)<r||(c>=3&&(u-m>=1||f-d>=1)?o+=`${i}Z`:r||(o+=`M${rt((m+u)/2-.8)} ${rt((d+f)/2-.8)}h1.6v1.6h-1.6Z`))}return o}function kl(e){let t=0,n=0,r=0,o=e.length/2;for(let a=0,i=o-1;a<o;i=a++){let s=e[i*2]*e[a*2+1]-e[a*2]*e[i*2+1];t+=s,n+=(e[i*2]+e[a*2])*s,r+=(e[i*2+1]+e[a*2+1])*s}return[t/2,t?n/(3*t):NaN,t?r/(3*t):NaN]}function aa(e){let t=new Map,n=e.rings.map(kl);e.rings.forEach((d,f)=>t.set(e.poly[f],(t.get(e.poly[f])??0)+(e.outer[f]?1:-1)*Math.abs(n[f][0])));let r=-1,o=0;for(let[d,f]of t)f>o&&(o=f,r=d);if(r<0)return[NaN,NaN];let a=e.rings.map((d,f)=>f).filter(d=>e.poly[d]===r),i=0,s=0;for(let d of a)e.outer[d]&&(i+=n[d][2]*Math.abs(n[d][0]),s+=Math.abs(n[d][0]));let l=i/s,c=[];for(let d of a){let f=e.rings[d],h=f.length/2;for(let g=0,b=h-1;g<h;b=g++){let p=f[g*2+1],w=f[b*2+1];p>l!=w>l&&c.push(f[g*2]+(f[b*2]-f[g*2])*(l-p)/(w-p))}}c.sort((d,f)=>d-f);let m=NaN,u=-1;for(let d=0;d+1<c.length;d+=2)c[d+1]-c[d]>u&&(u=c[d+1]-c[d],m=(c[d]+c[d+1])/2);return[m,l]}var ia=new WeakMap;function wl(e){let t=Math.max(.5,(e[2]-e[0])*.05),n=Math.max(.5,(e[3]-e[1])*.05);return[e[0]-t,Math.max(-90,e[1]-n),e[2]+t,Math.min(90,e[3]+n)]}function nn(e,t={}){let n=`${t.focus??""}${t.featureId??""}${t.featureName??""}`,r=ia.get(e),o=r?.get(n);if(o)return o;let a=He(e)?e:null,i=a?qt(a):Zt(e,t.featureId,t.featureName).shapes,s=new Set(a?.hidden??[]),l=t.focus!==void 0&&a?.focus&&Object.hasOwn(a.focus,t.focus)?a.focus[t.focus]:void 0,c=l?new Set(l.ids.split(" ")):null,m=new Set;i.forEach((f,h)=>{f.polygons.length&&!s.has(f.id)&&(!c||c.has(f.id))&&m.add(h)});let u=[];if(l)u.push({box:[...l.box]});else{let f=new Map;for(let h of m){let g=a?.projection==="albersUsa"&&ea.includes(i[h].id)?i[h].id:"",b=f.get(g);b?b.push(i[h]):f.set(g,[i[h]])}for(let[h,g]of f){let b=en(g);if(!b)continue;let p=(a?a.projection:tn(b))==="equalEarth",w=wl(b);u.push({box:p?[-180,w[1],180,w[3]]:w,...h&&{id:h}})}}let d={boxes:u,shown:m,shapes:i,match:a?gt(a):tt(i.map(f=>f.keys))};return r||ia.set(e,r=new Map),r.set(n,d),d}function $l(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>=-180&&e<=180&&t>=-90&&t<=90}function vl(e,t,n){for(let r of e.boxes){let[o,a,i,s]=r.box;if(!(n<a||n>s)){for(let l of[t,t+360,t-360])if(l>=o&&l<=i)return r}}return null}function Wn(e,t){if("name"in t){let r=e.match(t.name);return r<0?{miss:"unmatched"}:e.shown.has(r)?{region:r}:{miss:"outside"}}if(!$l(t.lon,t.lat))return{miss:"invalid"};let n=vl(e,t.lon,t.lat);return n?{lon:t.lon,lat:t.lat,...n.id&&{id:n.id}}:{miss:"outside"}}var Ml=e=>e.boxes.reduce((t,n)=>t+(n.box[2]-n.box[0])*(n.box[3]-n.box[1]),0);function sa(e,t){if(e!==void 0&&e!=="auto")return Uo(e,()=>[]);let n=Gn();if(!n.length)return{missing:"auto"};let r=t(),o=new Set,a=r.filter(m=>{if(!("name"in m))return!0;let u=ft(m.name);return!u||o.has(u)?!1:(o.add(u),!0)}),i=-1,s=0,l=1/0;n.forEach((m,u)=>{let d=nn(nt(m)),f=0;for(let g of a)"miss"in Wn(d,g)||f++;let h=Ml(d);(f>s||f===s&&f>0&&h<l)&&(i=u,s=f,l=h)});let c=i>=0?n[i]:n.includes("world")?"world":n[0];return{map:nt(c),name:c}}var la=2e3;function ca(e,t,n){return Number.isFinite(e)&&Number.isFinite(t)?{lon:e,lat:t}:n.trim()?{name:n}:{lon:NaN,lat:NaN}}function ua(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Ge(t.csv)}return null}var ba=N(V(),1);var q=N(V(),1);function ma(e,t){let n=we(e.theme),[r,o,a]=Xt(e.width),i=Qe(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=Yt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,d=Co(r,e.animateOnView!==!1&&u),f=ce(e.locale),h=X(f),g=(0,q.useMemo)(()=>Be(e.format,f,t.format),[e.format,f,t.format]),b=(0,q.useCallback)(H=>Ye(H,{locale:f}),[f]),p=(0,q.useMemo)(()=>Rt(g,e.unit),[g,e.unit]),w=(0,q.useMemo)(()=>Ht(e.data),[e.data]),[k,M]=(0,q.useState)(null),[y,C]=(0,q.useState)(null),P=(0,q.useRef)([]),D=(0,q.useRef)(e.onHover);D.current=e.onHover;let j=(0,q.useRef)(e.onClick);j.current=e.onClick;let I=(0,q.useRef)(null),F=(0,q.useRef)(null),T=(0,q.useRef)(null),A=(0,q.useCallback)((H,re="pointer")=>{if(T.current!==H){T.current=H;let ae=H===null?null:P.current[H]??null;queueMicrotask(()=>D.current?.(ae)),F.current?.(H)}I.current=H===null?null:re,M(H),C(I.current)},[]),v=(0,q.useCallback)(H=>{I.current!=="keyboard"&&(I.current=H===null?null:"sync",M(H),C(I.current))},[]),S=(0,q.useCallback)(H=>{let re=P.current[H];re&&j.current?.(re)},[]),L=Kr(e.replayKey),B=e.width!==void 0||(a??0)>0,oe={enabled:u,active:d.visible&&B,near:d.near,replayKey:L,dataKey:w,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Fe=(0,q.useCallback)((H,re=1)=>k===null||k===H?re:re*.38,[k]);return{p:n,width:s,height:c,measured:B,responsive:e.width===void 0,pending:ye&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:oe,fv:p,fmt:g,pct:b,locale:f,lang:h,t:h==="ko"?vr:$r,active:k,via:y,setActive:A,click:S,events:P,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Fe,sig:w,description:e.description,reduced:m,publish:F,applySync:v}}var Y=N(V(),1);function Sl(e){return 1-Math.pow(1-e,3)}function Tl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Cl(e){return e==="easeInOut"?Tl:e==="linear"?t=>t:Sl}function Al(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function at(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function rn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function da(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function fa(e,t,n,r){if(!t||!n||t.length!==n.length)return at(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of at(s,n[i]))o.push(l)}return o.length===r?o:at(e,r)}var on=class{constructor(){this.tracks=new Map;this.seq=0;this.easing="spring";this.duration=900;this.omega=8.2;this.animating=!1;this.entranceStart=-1;this.maxDelay=0}configure(t,n){this.easing=t,this.duration=Math.max(1,n),this.omega=7.4/(this.duration/1e3)}sameTargets(t){let n=0;for(let r of this.tracks.values())r.exiting||n++;if(n!==t.length)return!1;for(let r of t){let o=this.tracks.get(r.key);if(!o||o.exiting||!rn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),da(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=rn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=fa(s.cur,s.parts,i.parts,c),s.vel=fa(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),da(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=rn(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=rn(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=at(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Cl(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=at(s.from,c)),s.vel.length!==c&&(s.vel=at(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,f=0;for(let h=0;h<c;h++){let g=s.from[h]-s.to[h],b=s.vel[h]+a*g;s.cur[h]=s.to[h]+(g+b*l)*u,s.curVel[h]=(s.vel[h]-a*b*l)*u,d&&f<.15&&(f=Math.max(f,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/a)))}m=a*l>=20||d&&f<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),f=Al(this.easing,u)/o;for(let h=0;h<c;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*d,s.curVel[h]=(s.to[h]-s.from[h])*f;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},yt=new Set,an=0;function ha(e){an=0;let t=Array.from(yt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||yt.delete(n)}yt.size&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(ha))}function ga(e){return yt.add(e),!an&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(ha)),()=>{yt.delete(e)}}function Nl(e){let t=new Map,n=!1;for(let r of e){let o=(t.get(r.key)??0)+1;t.set(r.key,o),o>1&&(n=!0)}return n?(t.clear(),e.map(r=>{let o=(t.get(r.key)??0)+1;return t.set(r.key,o),o>1?{...r,key:`${r.key}#${o}`}:r})):e}function pa(e,t){let n=(0,Y.useMemo)(()=>Nl(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,Y.useRef)(null),d=(0,Y.useRef)("init"),f=(0,Y.useRef)(null),h=(0,Y.useRef)(s),g=(0,Y.useRef)(i),b=(0,Y.useRef)(!1),p=(0,Y.useRef)(0),[,w]=(0,Y.useState)(0),k=(0,Y.useRef)(null),M=(0,Y.useRef)(!0);u.current||(u.current=new on,u.current.configure(l,c),u.current.snap(n),f.current=n);let y=u.current;if(y.configure(l,c),f.current!==n){let F=d.current,T=!Object.is(h.current,s);y.sameTargets(n)?y.refreshData(n):!r||F==="init"?y.snap(n):F==="idle"?y.hold(n):F==="running"||T?y.update(n,At(),m):y.snap(n),f.current=n,h.current=s}let C=(0,Y.useRef)(()=>!1);C.current=F=>{if(!M.current)return!1;let T=y.step(F);return!T&&d.current==="running"&&(d.current="done"),w(A=>(A+1)%1e9),T||(k.current=null),T};let P=(0,Y.useCallback)(()=>{if(!ye||k.current||!y.animating)return;let F=T=>C.current(T);k.current=ga(F)},[y]);Se(()=>{let F=!Object.is(g.current,i);if(g.current=i,!r){(d.current!=="done"||y.animating)&&(y.snap(f.current??n),d.current="done",w(T=>T+1));return}d.current==="init"||F&&a?(y.hold(f.current??n),d.current="idle",b.current=!1,w(T=>T+1)):F&&(b.current=!0)},[r,i]),Se(()=>{!r||!a||!b.current||(b.current=!1,y.hold(f.current??n),d.current="idle",w(F=>F+1))},[a,r]),(0,Y.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(At()),p.current+=1,d.current="running",P(),w(F=>F+1))},[r,o,i,y,P]),(0,Y.useEffect)(()=>{y.animating&&P()}),(0,Y.useEffect)(()=>(M.current=!0,()=>{M.current=!1,k.current?.(),k.current=null}),[]);let D=At(),j=y.elapsed(D),I=r&&d.current==="idle";return{items:y.items(),get:F=>y.get(F),elapsed:I?0:j,fade:(F,T=320)=>I?0:Number.isFinite(j)?Math.max(0,Math.min(1,(j-F)/T)):1,waiting:I,animating:y.animating,generation:p.current}}var Vn=N(z(),1);function ya(e,t,n,r,o){if(r)return o==="categorical"?xe(e,t,n):Rr(e,t,n);if(o==="categorical")return xe(e,t,n);let a=Q(e,"strong"),i=Q(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var Fl=N(V(),1);var Kn=N(z(),1);var xa=e=>e?"neutralStrong":"accent";var Un=N(z(),1);function ka(e,t,n,r){if(typeof e!="function")return Me(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Rl=N(V(),1);var Yn=N(z(),1),Pl={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ae(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},wa={en:Pl,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},Xn=["ink","muted","dim"];function $a(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Xn.length)}var va=N(V(),1),Ma=N(z(),1);function Jn({p:e,frame:t,regions:n,opacity:r}){let o=(0,va.useMemo)(()=>n.map(a=>t.paths[a]).join(""),[t,n]);return o?(0,Ma.jsx)("path",{d:o,fill:e.paint("neutralSoft"),fillOpacity:r,stroke:e.paint("panel"),strokeWidth:.6,strokeLinejoin:"round",fillRule:"evenodd",pointerEvents:"none"}):null}var Ll=(e,t)=>e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1],Sa=new WeakMap;function Ta(e,t={}){let n=Number.isFinite(t.lon0)?((t.lon0+180)%360+360)%360-180:0,r=`${t.focus??""}${t.featureId??""}${t.featureName??""}${n?`${n}`:""}`,o=Sa.get(e),a=o?.get(r);if(a)return a;let i=He(e)?e:null,s=i?qt(i):Zt(e,t.featureId,t.featureName).shapes,l=new Set(i?.hidden??[]),c=t.focus!==void 0&&i?.focus&&Object.hasOwn(i.focus,t.focus)?i.focus[t.focus]:void 0,m=s.map((p,w)=>w).filter(p=>!l.has(s[p].id)&&s[p].polygons.length),u;if(c)u=Hn("equalEarth",c.lon0);else{let p=en(m.map(k=>s[k]))??[-180,-60,180,85],w=i?i.projection:tn(p);u=Hn(w,w==="conic"||!i?(p[0]+p[2])/2:w==="equalEarth"?n:0,p)}let d=s.map(p=>ta(u,p)),f=[1/0,1/0,-1/0,-1/0];if(c)f=na(u,c.box);else for(let p of m){let w=d[p].box;f=[Math.min(f[0],w[0]),Math.min(f[1],w[1]),Math.max(f[2],w[2]),Math.max(f[3],w[3])]}Number.isFinite(f[0])||(f=[0,0,1,1]);let h=m.filter(p=>Ll(d[p].box,f)),g=c?new Set(c.ids.split(" ")):null,b={shapes:s,projected:d,projection:u,box:f,regions:g?h.filter(p=>g.has(s[p].id)):h,context:g?h.filter(p=>!g.has(s[p].id)):[],clip:!!c,centers:d.map(aa),match:i?gt(i):tt(s.map(p=>p.keys))};return o||Sa.set(e,o=new Map),o.set(r,b),b}function Ca(e){let t=e.box[2]-e.box[0],n=e.box[3]-e.box[1];return t>0&&n>0?t/n:2}function Aa(e,t,n,r=2,o=e.box){let a=ra(o,Math.max(1,t-r*2),Math.max(1,n-r*2));a.tx+=r,a.ty+=r;let i=new Set([...e.regions,...e.context]);return{fit:a,paths:e.projected.map((s,l)=>i.has(l)?oa(s.rings,a,[t,n]):""),centers:e.centers.map(([s,l])=>[s*a.k+a.tx,l*a.k+a.ty]),project:(s,l,c)=>{let[m,u]=bt(e.projection,s,l,c);return[m*a.k+a.tx,u*a.k+a.ty]}}}var Fa=N(z(),1);function Na({p:e,l:t,dim:n}){return(0,Fa.jsx)("text",{x:Math.round(t.x*10)/10,y:Math.round(t.y*10)/10,dy:"0.35em",fontSize:11,fontWeight:t.weight,textAnchor:t.anchor,fill:e.paint("ink"),stroke:e.paint("panel"),strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke",opacity:n?.45:void 0,className:"ztd-mark",style:{pointerEvents:"none"},children:t.text})}var Ra=new WeakMap;function qn(e){let t=Ra.get(e);if(t)return t;let n=[NaN,NaN],r=-1;for(let o of e.polygons){let a=o[0];if(!a||a.length<3)continue;let i=a[0][0],s=0,l=0,c=0;for(let m=0,u=a.length-1;m<a.length;u=m++){let d=i+Ce(a[m][0]-i),f=i+Ce(a[u][0]-i),h=f*a[m][1]-d*a[u][1];s+=h,l+=(f+d)*h,c+=(a[u][1]+a[m][1])*h}Math.abs(s)>r&&s!==0&&(r=Math.abs(s),n=[Ce(l/(3*s)),c/(3*s)])}return r<0&&(n=e.polygons[0]?.[0]?.[0]?[e.polygons[0][0][0][0],e.polygons[0][0][0][1]]:[NaN,NaN]),Ra.set(e,n),n}var xt={atlantic:0,pacific:150};function La(e,t){let n=He(e)?e:null;return!!n&&n.projection==="equalEarth"&&!(t!==void 0&&n.focus&&Object.hasOwn(n.focus,t))}function _a(e,t,n){if(e==="atlantic"||e==="pacific")return xt[e];let r=o=>{let a=0;for(let i of t)Math.abs(Ce(i.b-o)-Ce(i.a-o))>180&&(a=Zn(a+i.w));for(let i of n)Math.abs(Ce(i-o))>160&&(a+=1);return a};return r(xt.pacific)<r(xt.atlantic)?xt.pacific:xt.atlantic}var We=e=>Math.round(e*10)/10||0,Zn=e=>Math.min(Number.MAX_VALUE,e);function Da(e,t){if("miss"in t)return null;let n=e.projection.name==="albersUsa";if("region"in t){let[i,s]=e.centers[t.region]??[NaN,NaN],l=e.shapes[t.region],[c,m]=qn(l);return!Number.isFinite(i)||!Number.isFinite(s)||!Number.isFinite(c)?null:{x:i,y:s,lon:c,lat:m,sub:e.projection.pick(c,m,n?l.id:void 0)}}let r=n?t.id??"":void 0,[o,a]=bt(e.projection,t.lon,t.lat,r);return Number.isFinite(o)&&Number.isFinite(a)?{x:o,y:a,lon:t.lon,lat:t.lat,sub:e.projection.pick(t.lon,t.lat,r)}:null}function Ea(e,t){let n=[e.box[0],e.box[1],e.box[2],e.box[3]];if(e.clip)return n;for(let r of t)r.x<n[0]&&(n[0]=r.x),r.y<n[1]&&(n[1]=r.y),r.x>n[2]&&(n[2]=r.x),r.y>n[3]&&(n[3]=r.y);return n}var Pa=(e,t)=>e[0]<t[2]&&e[2]>t[0]&&e[1]<t[3]&&e[3]>t[1];function Ia(e,t,n,r,o=[],a=[]){let i=[...o],s=[],l=r*.62,c=new Set;return e.forEach((m,u)=>{let d=`${Math.round(m.x)} ${Math.round(m.y)}`;if(c.has(d))return;c.add(d);let f=m.weight??600,h=$e(m.text,r,f),g=m.r+3,b=[[m.x+g,m.y,"start",[m.x+g,m.y-l,m.x+g+h,m.y+l]],[m.x-g,m.y,"end",[m.x-g-h,m.y-l,m.x-g,m.y+l]],[m.x,m.y-g-l,"middle",[m.x-h/2,m.y-g-2*l,m.x+h/2,m.y-g]],[m.x,m.y+g+l,"middle",[m.x-h/2,m.y+g,m.x+h/2,m.y+g+2*l]]];for(let[p,w,k,M]of b)if(!(M[0]<1||M[1]<0||M[2]>t-1||M[3]>n)&&!(i.some(y=>Pa(y,M))||a.some(y=>Pa(y,M)))){i.push(M),s.push({x:p,y:w,anchor:k,text:m.text,weight:f,k:u});return}}),s}function Oa(e,t){return Ye(e,{locale:t,maximumFractionDigits:Math.abs(e)<10?1:0})}function sn(e,t){return t==="ko"?e==="auto"?"등록한 지도가 없어요. ztd-charts/geo의 지도를 registerMap에 넘겨 주세요":ht.includes(e)?`"${e}" 지도를 등록하지 않았어요. ztd-charts/geo/${e}에서 불러와 registerMap에 넘겨 주세요`:`"${e}" 지도를 등록하지 않았어요. 지도를 registerMap에 넘기거나 ${ht.join(", ")}, GeoJSON을 써 주세요`:e==="auto"?"No map is registered. Import one from ztd-charts/geo and pass it to registerMap":ht.includes(e)?`Map "${e}" is not registered. Import it from ztd-charts/geo/${e} and pass it to registerMap`:`Map "${e}" is not registered. Pass a map to registerMap, or use ${ht.join(", ")} or a GeoJSON`}var _l=N(V(),1);var Ha=N(z(),1),Dl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ae(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},El={en:Dl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},za=(e,t)=>El[e].other(t);function Ba(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,lo(o.map(a=>a.value)))}}var ja=e=>Number.isFinite(e)&&e>0?e:0;function Ga(e,t,n,r){return r==="emphasis"?Fr(e,t,n):xe(e,t,n)}var Il=N(V(),1);var Ua=N(z(),1);function Wa(e,t){return t===!1?e.map((n,r)=>r):so(e)}function Va(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Me(e,t,t,r,"max")}function Ka(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=Q(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?Q(e,"neutral"):Ft(e,1-i/Math.max(1,o.length-1))),r}var K=N(V(),1);var U=N(z(),1),Ol=new Intl.PluralRules("en-US",{type:"ordinal"}),zl={one:"st",two:"nd",few:"rd"},Bl={kind:"Symbol map",share:e=>`${e} of the total`,shareLabel:"Share",rankLabel:"Rank",groupLabel:"Group",rank:(e,t)=>`${e}${zl[Ol.select(e)]??"th"} of ${t}`,desc:(e,t,n)=>`${Ae(e,"place")}, ${t} in total. Largest: ${n}`,skipped:e=>`${Ae(e,"row")} could not be placed on the map`,capped:(e,t)=>`The ${e} largest of ${t} places are drawn`},jl={en:Bl,ko:{kind:"기호 지도",share:e=>`전체의 ${e}`,shareLabel:"비율",rankLabel:"순위",groupLabel:"묶음",rank:(e,t)=>`${t}곳 중 ${e}위`,desc:(e,t,n)=>`지점 ${e}곳, 합계 ${t}. 가장 큰 곳: ${n}`,skipped:e=>`지도에 놓지 못한 행 ${e}개`,capped:(e,t)=>`지점 ${t}곳 중 큰 ${e}곳을 그려요`}},Gl=8;function Xa(e){if(!(e>0)||!Number.isFinite(e))return 0;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n>=5?5:n>=2?2:1)*t}var Hl=e=>Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"&&Number.isFinite(t));function Ya(e,t){if(!Hl(e))return null;let n=Math.max(1,t/8),r=Ee(Math.min(e[0],e[1]),.5,n);return[r,Ee(Math.max(e[0],e[1]),r,n)]}function Qn(e){let{counted:t,rows:n}=(0,K.useMemo)(()=>{let $=ie=>e.data.some(he=>he!==null&&typeof he=="object"&&Gt(he,ie)),_=_e(e.lon,"lon"),O=_e(e.lat,"lat"),Z=e.region!==void 0||$("region")?le(e.region,"region"):()=>"",E=e.size!==void 0||$("size"),J=_e(e.size,"size"),fe=e.label!==void 0||$("label")?le(e.label,"label"):$("name")?le("name","name"):()=>"",te=e.group!==void 0?le(e.group,"group"):null;return{counted:!E,rows:e.data.map((ie,he)=>({d:ie,place:ca(_(ie,he),O(ie,he),Z(ie,he)),value:E?J(ie,he):1,label:fe(ie,he).trim(),group:te?te(ie,he):""}))}},[e.data,e.lon,e.lat,e.region,e.size,e.label,e.group]),r=(0,K.useMemo)(()=>sa(e.map,()=>n.map($=>$.place)),[e.map,n]),o=r&&"map"in r?r.map:null,a=(0,K.useMemo)(()=>({focus:e.focus,featureId:e.featureId,featureName:e.featureName}),[e.focus,e.featureId,e.featureName]),i=(0,K.useMemo)(()=>{if(!o)return[];let $=nn(o,a);return n.map(_=>Wn($,_.place))},[o,a,n]),s=(0,K.useMemo)(()=>{if(!o||!La(o,e.focus))return;let $=nn(o,a),_=i.flatMap(O=>"lon"in O?[O.lon]:"region"in O?[qn($.shapes[O.region])[0]]:[]);return _a(e.center,[],_)},[o,a,i,e.focus,e.center]),l=(0,K.useMemo)(()=>o?Ta(o,{...a,lon0:s}):null,[o,a,s]),c=l?Ca(l):2,m=$=>Ya(e.sizeRange,$)?.[1]??Ee($/26,8,30),u=ma(e,{height:$=>{let _=m($)+2;return Math.round(Math.max(120,Math.min(($-2*_)/c+2*_,$*.85)))},duration:520,stagger:70}),{p:d,width:f,height:h,fv:g}=u,b=jl[u.lang],p=(0,K.useId)().replace(/:/g,""),w=(0,K.useMemo)(()=>{let $=me(n.map(E=>E.group).filter(Boolean)),_=new Map($.map((E,J)=>[E,J]));if(!l)return{pts:[],all:0,total:0,skipped:n.length,groups:$};let O=[];n.forEach((E,J)=>{if(!(E.value>0)||!Number.isFinite(E.value))return;let fe=i[J],te=Da(l,fe);if(!te)return;let ie=E.label||("region"in fe?(u.lang==="ko"?l.shapes[fe.region].nameKo:void 0)??l.shapes[fe.region].name:`${Math.abs(te.lat).toFixed(2)}°${te.lat<0?"S":"N"}, ${Math.abs(te.lon).toFixed(2)}°${te.lon<0?"W":"E"}`);O.push({row:J,datum:E.d,label:ie,value:E.value,group:_.get(E.group)??-1,at:te,rank:0})}),O.sort((E,J)=>J.value-E.value||E.row-J.row),O.forEach((E,J)=>E.rank=J&&O[J-1].value===E.value?O[J-1].rank:J+1);let Z=0;for(let E of O)Z=Zn(Z+E.value);return{pts:O.slice(0,la),all:O.length,total:Z,skipped:n.length-O.length,groups:$}},[l,i,n,u.lang]),{pts:k,all:M,total:y}=w,C=k.length,P=C?k[0].value:0,D=C>0&&k[C-1].value===P,j=Ya(e.sizeRange,Math.min(f,h))??[C>500?1.5:2.5,m(f)],[I,F]=j,T=$=>t||D?Ee(Math.min(F,f/90),I,F):Ee(F*Math.sqrt($/P),I,F),A=t||D?T(P)+2:F+2,v=(0,K.useMemo)(()=>l?Ea(l,k.map($=>$.at)):null,[l,k]),S=(0,K.useMemo)(()=>l&&v?Aa(l,f,h,A,v):null,[l,v,f,h,A]),L=(0,K.useMemo)(()=>S?k.map($=>[$.at.x*S.fit.k+S.fit.tx,$.at.y*S.fit.k+S.fit.ty]):[],[S,k]),B=(0,K.useMemo)(()=>{let $=e.highlight,_=D&&(typeof $=="string"||Array.isArray($))?(Array.isArray($)?$:[$]).filter(O=>O!=="max"&&O!=="min"):$;return Me(_,k.map(O=>O.datum),k.map(O=>O.label),k.map(O=>O.value),D?"none":"max")},[e.highlight,k,D]),oe=(0,K.useMemo)(()=>w.groups.length?ze(d,w.groups.length,new Set):[],[d,w.groups.length]),Fe=($,_)=>$.group>=0&&oe[$.group]?oe[$.group].fill:B.has(_)?d.paint("accent"):d.paint("neutralStrong"),H=(0,K.useMemo)(()=>k.map($=>y>0?Oa($.value/y*100,u.locale):""),[k,y,u.locale]),re=(0,K.useMemo)(()=>k.map(($,_)=>({datum:$.datum,index:$.row,key:`${$.row}`,label:$.label,value:$.value,...$.group>=0&&{series:w.groups[$.group]},formatted:[g($.value),H[_]&&b.share(H[_]),b.rank($.rank,M)].filter(Boolean).join(", ")})),[k,H,M,g,b,w.groups]),ae=(0,K.useMemo)(()=>{if(e.legend===!1||t||D||!C)return[];let $=10**(Math.floor(Math.log10(P))-1),_=Number.isFinite($)&&$>0?Math.floor(P/$)*$:P;return[...new Set([_,Xa(_/4),Xa(_/20)])].filter(O=>O>0&&T(O)>=3).slice(0,3)},[e.legend,t,D,C,P,F,I]),G=(0,K.useMemo)(()=>{if(!ae.length)return null;let $=T(ae[0]),_=ae.map(be=>g(be)),O=Math.max(..._.map(be=>$e(be,10))),Z=2*$+6+O,E=2*$;if(Z>f*.45||E>h*.45)return null;let J=[[4,h-4-E],[f-4-Z,h-4-E],[4,4],[f-4-Z,4]],fe=J[0],te=1/0;for(let[be,Re]of J){let ln=0;L.forEach(([cr,ur],ui)=>{let vt=T(k[ui].value),mr=Math.min(cr+vt,be+Z)-Math.max(cr-vt,be),dr=Math.min(ur+vt,Re+E)-Math.max(ur-vt,Re);mr>0&&dr>0&&(ln+=mr*dr)}),ln<te&&(te=ln,fe=[be,Re])}let ie=ae.map((be,Re)=>({r:T(be),text:_[Re]})),he=ie.filter((be,Re)=>Re===0||ie[Re-1].r*2-be.r*2>=11);return{x0:fe[0],y0:fe[1],R:$,bw:Z,bh:E,items:he}},[ae,L,k,f,h,g]),wt=(0,K.useMemo)(()=>{if(!u.showLabels||!C)return[];let $=f>=600?6:f>=390?4:0,_=[...k.keys()].filter(E=>B.has(E)).slice(0,40).concat([...k.keys()].filter(E=>!B.has(E)).slice(0,$)),O=G?[[G.x0,G.y0,G.x0+G.bw,G.y0+G.bh]]:[],Z=L.slice(0,300).map(([E,J],fe)=>{let te=T(k[fe].value);return[E-te,J-te,E+te,J+te]});return Ia(_.map(E=>({x:L[E][0],y:L[E][1],r:T(k[E].value),text:Vt(k[E].label,Math.min(140,f*.35),11,600),weight:B.has(E)?700:600})),f,h,11,O,Z).map(E=>({...E,k:_[E.k]}))},[u.showLabels,C,k,B,L,f,h,G]),oi=(0,K.useMemo)(()=>[{key:"__m",to:[1],from:[0],data:null}],[]),$t=pa(oi,u.motion),tr=Tt(u,$t),nr=u.motion.duration??520,rr=u.motion.stagger??70,it=Math.max(1,Math.ceil(C/Gl)),ee=u.active!==null&&u.active<C?u.active:null,or=null;if(ee!==null&&L[ee]){let $=k[ee],[_,O]=L[ee],Z=H[ee];or={x:Ee(_,0,f),y:Ee(O-T($.value),0,h),title:$.label,rows:[{label:u.t.value,value:g($.value),color:Fe($,ee)},...Z?[{label:b.shareLabel,value:Z,strong:!1}]:[],{label:b.rankLabel,value:b.rank($.rank,M),strong:!1},...$.group>=0?[{label:b.groupLabel,value:w.groups[$.group],strong:!1}]:[]]}}let Ve=r&&"missing"in r?r.missing:null,ar=[w.skipped?b.skipped(w.skipped):"",M>C?b.capped(C,M):""].filter(Boolean),ai=C?`${b.kind}. ${b.desc(M,g(y),`${k[0].label} ${g(P)}`)}`:"",ii=e.description??(C?`${ai}${ar.length?`. ${ar.join(". ")}`:""}.`:Ve?sn(Ve,u.lang):""),si=u.via==="keyboard"&&ee!==null&&re[ee]?`${re[ee].label}, ${re[ee].formatted}`:"",ir=($,_)=>u.setActive($,_==="touch"?"touch":"pointer"),sr=($,_)=>(0,U.jsx)("circle",{cx:We(L[_][0]),cy:We(L[_][1]),r:We(T($.value)),fill:Fe($,_),fillOpacity:B.has(_)&&$.group<0?.9:.75,stroke:d.paint("panel"),strokeWidth:.8,className:"ztd-mark ztd-pop",onPointerEnter:O=>ir(_,O.pointerType),onClick:()=>u.click(_)},$.row),lr=($,_,O)=>(0,U.jsx)("circle",{cx:We(L[$][0]),cy:We(L[$][1]),r:We(T(k[$].value)+_),fill:"none",stroke:d.paint("ink"),strokeWidth:O,pointerEvents:"none"},`o${k[$].row}`),li=(0,K.useMemo)(()=>Array.from({length:Math.ceil(C/it)},($,_)=>(0,U.jsx)("g",{style:St(tr,$t.waiting,"pop",_*rr,nr),children:k.slice(_*it,(_+1)*it).map((O,Z)=>sr(O,_*it+Z))},_)),[k,L,B,oe,d,tr,$t.waiting,it,rr,nr,I,F,t,D]),ci=(0,K.useMemo)(()=>k.flatMap(($,_)=>B.has(_)&&$.group>=0?[lr(_,0,1.4)]:[]),[k,L,B,d,I,F,t,D]);return(0,U.jsxs)(Xr,{c:u,kind:b.kind,ariaLabel:e.ariaLabel,description:ii,emptyText:Ve?sn(Ve,u.lang):void 0,events:re,tip:or,renderTip:e.tooltip,announce:si,className:e.className,style:e.style,theme:e.theme,defs:l?.clip?(0,U.jsx)("clipPath",{id:`${p}c`,children:(0,U.jsx)("rect",{width:f,height:h})}):void 0,children:[Ve?(0,U.jsx)(Nn,{x:f/2,y:h/2,anchor:"middle",size:12,fill:d.paint("muted"),children:Vt(sn(Ve,u.lang),f-16,12)}):null,S&&l?(0,U.jsxs)("g",{children:[(0,U.jsx)("rect",{width:f,height:h,fill:"transparent",onPointerEnter:$=>u.via==="keyboard"?void 0:ir(null,$.pointerType)}),(0,U.jsxs)("g",{clipPath:l.clip?`url(#${p}c)`:void 0,children:[l.context.length?(0,U.jsx)(Jn,{p:d,frame:S,regions:l.context,opacity:.6}):null,(0,U.jsx)(Jn,{p:d,frame:S,regions:l.regions}),G?(0,U.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:G.items.map(($,_)=>(0,U.jsxs)("g",{children:[(0,U.jsx)("circle",{cx:G.x0+G.R,cy:G.y0+G.bh-$.r,r:$.r,fill:"none",stroke:d.paint("muted"),strokeWidth:.8}),(0,U.jsx)("line",{x1:G.x0+G.R,x2:G.x0+2*G.R+3,y1:G.y0+G.bh-2*$.r,y2:G.y0+G.bh-2*$.r,stroke:d.paint("muted"),strokeWidth:.6,strokeDasharray:"2 2"}),(0,U.jsx)(Nn,{x:G.x0+2*G.R+6,y:G.y0+G.bh-2*$.r,size:10,fill:d.paint("muted"),children:$.text})]},_))}):null,(0,U.jsx)("g",{opacity:ee!==null?.45:void 0,children:li}),ci,ee!==null?(0,U.jsxs)("g",{pointerEvents:"none",children:[sr(k[ee],ee),lr(ee,2.5,2)]}):null]}),wt.map($=>(0,U.jsx)(Na,{p:d,l:$,dim:ee!==null&&ee!==$.k},`l${k[$.k].row}`))]},$t.generation):null]})}function Ja(e){return!e||typeof e!="object"||Array.isArray(e)?[]:me(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function qa(e,t){return ze(e,t+1,new Set)}var Wl=N(V(),1);var Qa=N(z(),1);var Vl=26;var td=Vl*.62;function Za(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!No.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Ne=N(z(),1);function ei(e,t,n){let r=jt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Bt(n)?jt("bubble"):r}function Kl(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function Ul(e,t,n,r=!1){let o=ei(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Fn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=le(a.label,"label"),d=_e(a.value,"value"),f=o.type==="waffle",h=t.map((y,C)=>({r:y,label:u(y,C),value:f?d(y,C):ja(d(y,C))})),{kept:g,other:b}=f?{kept:h,other:null}:Ba(h,i.other,(y,C)=>({r:{},label:za(X(n),y),value:C})),p=Me(s,g.map(y=>y.r),g.map(y=>y.label),g.map(y=>y.value),f?"first":"max"),w=b?[...g,b]:g,k=Le(y=>f?xe(y,w.length,p):Ga(y,w.length,p,i.colorMode)),M=f&&i.shape==="arc";return w.map((y,C)=>({label:y.label,color:k[C],...M&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=$a(Array.isArray(i.ma)?i.ma:void 0,t.length),d=wa[X(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((f,h)=>({label:d.maLegend(f),color:Xn[h],shape:"line"}))]}if(o.type==="network"){let u=Ja(i.groups);if(u.length<2)return[];let d=Le(f=>qa(f,u.length));return u.map((f,h)=>({label:f,color:d[h],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=le(a.group,"group"),d=me(t.map((h,g)=>u(h,g)).filter(Boolean));if(d.length<2)return[];let f=Le(h=>ze(h,d.length,new Set));return d.map((h,g)=>({label:h,color:f[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Bt(i))return[];let u=le(a.series,"series"),d=me(t.map((g,b)=>u(g,b)));if(d.length<2)return[];let f=ka(s,t,d,u),h=Le(g=>ze(g,d.length,f));return c(d.map((g,b)=>({label:g,color:h[b],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let f=Bo(t,d,u),h=Le(g=>xe(g,f.length,Za(s,f)));return c(f.map((g,b)=>({label:g,color:h[b],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let k=le(a.series,"series");u=me(t.map((M,y)=>k(M,y)))}let d=Rn(o.type,a,i);if(d.length){let k=Me(s,u,u,u.map(()=>0),"none"),M=Le(C=>xe(C,u.length,k)),y=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((C,P)=>({label:C,color:M[P]}));return[...c(y),...d.map((C,P)=>({label:C,color:xa(P),shape:"line"}))]}if(u.length<2)return[];let h=o.type==="bar"&&i.layout==="diverging"&&s===void 0?io(u.length,Array.isArray(i.negative)?i.negative.map(k=>u.indexOf(String(k))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=h>=0?new Set([h]):Me(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((k,M)=>({label:k,color:g.has(M)?"accent":"neutralStrong",shape:"square"})));let b=i.colorMode,p=k=>xe(k,u.length,g);if((o.type==="line"||o.type==="area")&&(p=k=>ya(k,u.length,g,o.type==="area",b)),o.type==="stream"){let k=ut(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),M=Wa(k.values,i.reorder),y=Va(s,k.series,k.values);p=C=>Ka(C,M,y)}let w=Le(p);return c(u.map((k,M)=>({label:k,color:w[M],...o.type==="line"&&{shape:"line"}})))}return[]}function Xl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Qr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Yl(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function ti(e,t){let{spec:n}=e,r=ei(n.type,n.encoding,n.options),o=(0,kt.useMemo)(()=>ua(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Zr(n,e.locale),s=ce(i),l=X(s),c=Fo(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=no(n),u=(0,kt.useMemo)(()=>m?Io(m,s):void 0,[m,s]),d=n.options?.hidden,f=Array.isArray(d)?d.map(String):[],h=f.join(""),[g,b]=(0,kt.useState)(null);if(!r)return(0,Ne.jsx)(An,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let p=o??c.data,w=t[r.type],k={...n.options??{}},M={...Kl(r,n.encoding),...k,...u?{tooltip:u}:{},data:p,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},y=n.card?.legend==="toggle"&&to(r.type,n.encoding??{},k),C=g&&g.base===h?g.hidden:f;y&&(M.hidden=C);let P=T=>b(A=>{let v=A&&A.base===h?A.hidden:f;return{base:h,hidden:v.includes(T)?v.filter(S=>S!==T):[...v,T]}}),D=M.height??220,j=Xl(n,r.type),I=a&&!p.length&&(c.loading||c.error||c.empty)?(0,Ne.jsx)(An,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:D,locale:i}):j?(0,Ne.jsx)(Ao,{chart:w,...Yl(r.type,j,M)}):(0,Ne.jsx)(w,{...M});if(n.card){let T=n.card,A=T.legend==="auto"||T.legend==="toggle"?Ul(n,p,s,y):T.legend,v=A?.length?y?(0,Ne.jsx)(Cn,{items:A,hidden:C,onToggle:P,locale:i}):A:void 0,S=T.download?(0,Ne.jsx)(Eo,{data:p,columns:ro(n),filename:T.title??r.type,formats:Array.isArray(T.download)?T.download:void 0,locale:i}):void 0;I=(0,Ne.jsx)(Ur,{number:T.number,title:T.title??qr(r,l),subtitle:T.subtitle,legend:v,actions:S,source:T.source||void 0,note:T.note||void 0,accent:T.accent,takeaway:T.takeaway,level:T.level,sample:T.sample,replay:T.replay!==!1,className:e.className,locale:i,children:I})}let F=e.theme??n.theme;return F&&(I=(0,Ne.jsx)(Dt,{theme:F,children:I})),I}function Jl({cfg:e,components:t}){let n=Qe();return ti({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ri(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ni.hydrateRoot)(r,(0,er.createElement)(Dt,{theme:o.theme,cssVars:!0},(0,er.createElement)(Jl,{cfg:o,components:{[e]:t}})))}ri("symbolMap",Qn);})();
28
+ `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?lt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Br,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Oo.jsx)("div",{children:s},l)):null}}function ft(e){let t=String(e??"").normalize("NFC").trim().replace(/\s+/g," ").toLowerCase();return/^\d+$/.test(t)?t.replace(/^0+(?=\d)/,""):t}function tt(e){let t=new Map;return e.forEach((n,r)=>{for(let o of n){let a=ft(o);a&&!t.has(a)&&t.set(a,r)}}),n=>t.get(ft(n))??-1}function zo(e,t){let n=[...new Set([...new Set(e)].map(ft))].filter(Boolean),r=-1,o=0;return t.forEach((a,i)=>{let s=n.filter(l=>a(l)>=0).length;s>o&&(o=s,r=i)}),r}function Bo(e,t,n=!1){let r=le(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=me(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}var hl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function jo(e){if(typeof e!="string")return[];let t=new Int8Array(128).fill(-1);for(let i=0;i<64;i++)t[hl.charCodeAt(i)]=i;let n=[],r=0,o=1,a=0;for(let i=0;i<e.length;i++){let s=t[e.charCodeAt(i)]??-1;s<0||(r+=(s&31)*o,a++,s&32&&a<7?o*=32:(s&32||n.push(r%2?-(r+1)/2:r/2),r=0,o=1,a=0))}return n}var Go=new WeakMap,Jt=(e,t)=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=t?e:-1;function qt(e){let t=Go.get(e);if(t)return t;let n=Array.isArray(e.topo?.t)?e.topo.t:[],[r,o,a]=n.every(g=>Number.isFinite(g))&&n.length>=3?n:[NaN,NaN,NaN],i=Number.isFinite(r)&&r>0,s=i?jo(e.topo.arcs):[],l=[],c=0;for(let g=0;g<s.length;){let b=Jt(s[g++],(s.length-g)/2);if(b<0)break;let p=[],w=0,k=0;for(let M=0;M<b;M++)w+=s[g++],k+=s[g++],p.push([w*r+o,k*r+a]);c+=b,l.push(p)}let m=i?jo(e.topo.shapes):[],u=0,d=c*4,h=(Array.isArray(e.regions)?e.regions:[]).map(g=>{let b=Array.isArray(g)?g.filter(M=>typeof M=="string"):[],p=[];for(let M=Jt(m[u++],m.length-u);M>0;M--){let x=[];for(let C=Jt(m[u++],m.length-u);C>0;C--){let P=[];for(let D=Jt(m[u++],m.length-u),j=0;j<D;j++){let I=m[u++],F=(I>=0?l[I]:l[~I]?.slice().reverse())??[];if(d-=F.length,d<0)break;for(let T=j?1:0;T<F.length;T++)P.push(F[T])}if(P.length>1&&P[0][0]===P[P.length-1][0]&&P[0][1]===P[P.length-1][1]&&P.pop(),P.length>=3&&x.push(P),d<0||u>m.length)break}if(x.length&&p.push(x),d<0||u>m.length)break}let w=b[0]??"",k=e.namesKo?.[w];return{id:w,name:b[1]??w,nameKo:typeof k=="string"?k:void 0,keys:typeof k=="string"?[...b,k]:b,polygons:p}});return Go.set(e,h),h}var Oe=e=>typeof e=="string"&&e.trim()!==""?e:typeof e=="number"&&Number.isFinite(e)?String(e):void 0;function Ho(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){if(!Array.isArray(r)||typeof r[0]!="number"||typeof r[1]!="number"||!Number.isFinite(r[0])||!Number.isFinite(r[1]))continue;let[o,a]=r;a>90||a<-90||o>540||o<-540?(t.n++,a=Math.max(-90,Math.min(90,a)),o=((o+180)%360+360)%360-180):(o>180||o<-180)&&t.n++;let i=n[n.length-1];(!i||i[0]!==o||i[1]!==a)&&n.push([o,a])}return n.length>1&&n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]&&n.pop(),n.length>=3?n:null}function Zt(e,t,n){let r=`${t??""}${n??""}`,o=Wo.get(e),a=o?.get(r);if(a)return a;let i=gl(e,t,n);return o||Wo.set(e,o=new Map),o.set(r,i),i}var Wo=new WeakMap;function gl(e,t,n){let r=[],o=[],a={n:0};return(Array.isArray(e.features)?e.features:[]).forEach((i,s)=>{let l=i&&typeof i.properties=="object"&&i.properties||{},c=i?.geometry,m=c&&Array.isArray(c.coordinates)?c.type==="Polygon"?[c.coordinates]:c.type==="MultiPolygon"?c.coordinates:[]:[],u=[];for(let h of m){if(!Array.isArray(h))continue;let g=Ho(h[0],a);g&&u.push([g,...h.slice(1).map(b=>Ho(b,a)).filter(b=>b!==null)])}if(!u.length)return void o.push(s);let d=(t?Oe(l[t]):void 0)??Oe(i?.id)??Oe(l.id)??Oe(l.code)??String(s+1),f=(n?Oe(l[n]):void 0)??Oe(l.name)??Oe(l.NAME)??d;r.push({id:d,name:f,keys:[...new Set([d,f,Oe(i?.id)].filter(h=>!!h))],polygons:u})}),{shapes:r,skipped:o,outOfRange:a.n}}var ht=["world","us-states","kr-sido"];function Ko(){var t;let e=globalThis;return e[t=Symbol.for("ztd-charts.geo.maps")]??(e[t]=new Map)}function He(e){let t=e;return!!t&&typeof t=="object"&&typeof t.name=="string"&&Array.isArray(t.regions)&&!!t.topo&&typeof t.topo.arcs=="string"}function pl(e){let t=e;return!!t&&typeof t=="object"&&t.type==="FeatureCollection"&&Array.isArray(t.features)}function nt(e){return Ko().get(e)}function Gn(){return[...Ko().keys()]}function bl(e){return e.regions.map(t=>{let n=Array.isArray(t)?t.filter(o=>typeof o=="string"):[],r=n[0]!==void 0?e.namesKo?.[n[0]]:void 0;return typeof r=="string"?[...n,r]:n})}var Vo=new WeakMap;function gt(e){let t=Vo.get(e);return t||Vo.set(e,t=tt(bl(e))),t}function Uo(e,t){if(e===void 0||e==="auto"){let n=Gn();if(!n.length)return{missing:"auto"};let r=zo(t(),n.map(a=>gt(nt(a)))),o=n[Math.max(0,r)];return{map:nt(o),name:o}}if(typeof e=="string"){let n=nt(e);return n?{map:n,name:e}:{missing:e}}return He(e)?{map:e,name:e.name}:pl(e)?{map:e}:null}var ot=.017453292519943295,Ce=e=>((e+180)%360+360)%360-180,Xo=1.340264,Yo=-.081106,Jo=893e-6,qo=.003796,Zo=.8660254037844386,yl=(e,t)=>{let n=Math.asin(Zo*Math.sin(t)),r=n*n,o=r*r*r;return[e*Math.cos(n)/(Zo*(Xo+3*Yo*r+o*(7*Jo+9*qo*r))),n*(Xo+Yo*r+o*(Jo+qo*r))]};function Qt(e,t){let n=Math.sin(e*ot),r=(n+Math.sin(t*ot))/2;if(Math.abs(r)<.001)return(i,s)=>[i,Math.sin(s)];let o=1+n*(2*r-n),a=Math.sqrt(o)/r;return(i,s)=>{let l=Math.sqrt(Math.max(0,o-2*r*Math.sin(s)))/r;return[l*Math.sin(i*r),a-l*Math.cos(i*r)]}}function pt(e,t,n=[0,0],r=1,o=[0,0]){let[a,i]=t(n[0]*ot,n[1]*ot);return{lon0:e,raw:(s,l)=>{let[c,m]=t(s*ot,Math.max(-90,Math.min(90,l))*ot);return[r*(c-a)+o[0],-r*(m-i)+o[1]]}}}var ea=["AK","HI"];function bt(e,t,n,r){let o=e.pick(t,n,r);return o.raw(Ce(t-o.lon0),n)}function Hn(e,t=0,n){if(e==="albersUsa"){let o=pt(-96,Qt(29.5,45.5),[-.6,38.7]),a=pt(-154,Qt(55,65),[-2,58.5],.35,[-.307,.201]),i=pt(-157,Qt(8,18),[-3,19.9],1,[-.205,.212]);return{name:e,pick:(s,l,c)=>c!==void 0?c==="AK"?a:c==="HI"?i:o:l>=50&&(s<=-129||s>=170)?a:l>=18&&l<=23&&s>=-161&&s<=-154?i:o}}if(e==="conic"&&n){let[,o,,a]=n,i=pt(t,Qt(o+(a-o)/6,o+(a-o)*5/6),[0,(o+a)/2]);return{name:e,pick:()=>i}}let r=pt(t,yl);return{name:"equalEarth",pick:()=>r}}function en(e){let t=[],n=1/0,r=-1/0;for(let i of e)for(let s of i.polygons)for(let[l,c]of s[0])t.push(Ce(l)),c<n&&(n=c),c>r&&(r=c);if(!t.length)return null;t.sort((i,s)=>i-s);let o=t[0]+360-t[t.length-1],a=t[0];for(let i=1;i<t.length;i++)t[i]-t[i-1]>o&&(o=t[i]-t[i-1],a=t[i]);return[a,n,a+360-o,r]}function tn(e){return e[2]-e[0]>150||e[3]-e[1]>70?"equalEarth":"conic"}function Qo(e,t,n){let r=[];for(let o=0;o<e.length;o++){let a=e[o],i=e[(o+1)%e.length],s=(a[0]-t)*n>=0,l=(i[0]-t)*n>=0;s&&r.push(a),s!==l&&r.push([t,a[1]+(i[1]-a[1])*(t-a[0])/(i[0]-a[0])])}return r}function xl(e){let t=0,n=-1;for(let a=0;a<e.length;a++)Math.abs(e[a][0]-e[(a+e.length-1)%e.length][0])>180&&(t++,n<0&&(n=a));if(!t)return[e];if(t%2){let a=e[(n+e.length-1)%e.length],i=e[n],s=a[0]>0?180:-180,l=360-Math.abs(a[0]-i[0]),c=a[1]+(i[1]-a[1])*(Math.abs(s-a[0])||0)/(l||1),m=e.reduce((u,d)=>u+d[1],0)<0?-90:90;return[[...e.slice(0,n),[s,c],[s,m],[-s,m],[-s,c],...e.slice(n)]]}let r=[e[0]];for(let a=1;a<e.length;a++){let i=e[a][0],s=r[a-1][0];for(;i-s>180;)i-=360;for(;i-s<-180;)i+=360;r.push([i,e[a][1]])}let o=[];for(let a of[-1,0,1]){let i=Qo(Qo(r,a*360-180,1),a*360+180,-1),s=0;for(let l=0,c=i.length-1;l<i.length;c=l++)s+=(i[c][0]-i[l][0])*(i[c][1]+i[l][1]);i.length>=3&&Math.abs(s)>1e-9&&o.push(a?i.map(([l,c])=>[l-a*360,c]):i)}return o}function ta(e,t){let n=[],r=[],o=[],a=[1/0,1/0,-1/0,-1/0];return t.polygons.forEach((i,s)=>i.forEach((l,c)=>{let m=e.pick(l[0][0],l[0][1],e.name==="albersUsa"?t.id:void 0);for(let u of xl(l.map(([d,f])=>[Ce(d-m.lon0),f]))){let d=new Float64Array(u.length*2);u.forEach(([f,h],g)=>{let[b,p]=m.raw(f,h);d[g*2]=b,d[g*2+1]=p,b<a[0]&&(a[0]=b),p<a[1]&&(a[1]=p),b>a[2]&&(a[2]=b),p>a[3]&&(a[3]=p)}),n.push(d),r.push(s),o.push(c===0)}})),{rings:n,poly:r,outer:o,box:a}}function na(e,t){let n=[1/0,1/0,-1/0,-1/0],[r,o,a,i]=t;for(let s=0;s<=24;s++){let l=s/24;for(let[c,m]of[[r+(a-r)*l,o],[r+(a-r)*l,i],[r,o+(i-o)*l],[a,o+(i-o)*l]]){let[u,d]=bt(e,c,m);n[0]=Math.min(n[0],u),n[1]=Math.min(n[1],d),n[2]=Math.max(n[2],u),n[3]=Math.max(n[3],d)}}return n}function ra(e,t,n){let r=e[2]-e[0],o=e[3]-e[1],a=r>0&&o>0?Math.min(t/r,n/o):1;return{k:a,tx:(t-r*a)/2-e[0]*a,ty:(n-o*a)/2-e[1]*a}}var rt=e=>Math.round(e*10)/10||0;function oa(e,t,n,r=0){let o="";for(let a of e){let i="",s=NaN,l=NaN,c=0,m=1/0,u=-1/0,d=1/0,f=-1/0;for(let g=0;g<a.length;g+=2){let b=rt(a[g]*t.k+t.tx),p=rt(a[g+1]*t.k+t.ty);Math.abs(b-s)<.35&&Math.abs(p-l)<.35||(i+=c?`${c===1?"l":" "}${rt(b-s)} ${rt(p-l)}`:`M${b} ${p}`,s=b,l=p,c++,b<m&&(m=b),b>u&&(u=b),p<d&&(d=p),p>f&&(f=p))}n!==void 0&&(u<0||f<0||m>n[0]||d>n[1])||Math.min(u-m,f-d)<r||(c>=3&&(u-m>=1||f-d>=1)?o+=`${i}Z`:r||(o+=`M${rt((m+u)/2-.8)} ${rt((d+f)/2-.8)}h1.6v1.6h-1.6Z`))}return o}function kl(e){let t=0,n=0,r=0,o=e.length/2;for(let a=0,i=o-1;a<o;i=a++){let s=e[i*2]*e[a*2+1]-e[a*2]*e[i*2+1];t+=s,n+=(e[i*2]+e[a*2])*s,r+=(e[i*2+1]+e[a*2+1])*s}return[t/2,t?n/(3*t):NaN,t?r/(3*t):NaN]}function aa(e){let t=new Map,n=e.rings.map(kl);e.rings.forEach((d,f)=>t.set(e.poly[f],(t.get(e.poly[f])??0)+(e.outer[f]?1:-1)*Math.abs(n[f][0])));let r=-1,o=0;for(let[d,f]of t)f>o&&(o=f,r=d);if(r<0)return[NaN,NaN];let a=e.rings.map((d,f)=>f).filter(d=>e.poly[d]===r),i=0,s=0;for(let d of a)e.outer[d]&&(i+=n[d][2]*Math.abs(n[d][0]),s+=Math.abs(n[d][0]));let l=i/s,c=[];for(let d of a){let f=e.rings[d],h=f.length/2;for(let g=0,b=h-1;g<h;b=g++){let p=f[g*2+1],w=f[b*2+1];p>l!=w>l&&c.push(f[g*2]+(f[b*2]-f[g*2])*(l-p)/(w-p))}}c.sort((d,f)=>d-f);let m=NaN,u=-1;for(let d=0;d+1<c.length;d+=2)c[d+1]-c[d]>u&&(u=c[d+1]-c[d],m=(c[d]+c[d+1])/2);return[m,l]}var ia=new WeakMap;function wl(e){let t=Math.max(.5,(e[2]-e[0])*.05),n=Math.max(.5,(e[3]-e[1])*.05);return[e[0]-t,Math.max(-90,e[1]-n),e[2]+t,Math.min(90,e[3]+n)]}function nn(e,t={}){let n=`${t.focus??""}${t.featureId??""}${t.featureName??""}`,r=ia.get(e),o=r?.get(n);if(o)return o;let a=He(e)?e:null,i=a?qt(a):Zt(e,t.featureId,t.featureName).shapes,s=new Set(a?.hidden??[]),l=t.focus!==void 0&&a?.focus&&Object.hasOwn(a.focus,t.focus)?a.focus[t.focus]:void 0,c=l?new Set(l.ids.split(" ")):null,m=new Set;i.forEach((f,h)=>{f.polygons.length&&!s.has(f.id)&&(!c||c.has(f.id))&&m.add(h)});let u=[];if(l)u.push({box:[...l.box]});else{let f=new Map;for(let h of m){let g=a?.projection==="albersUsa"&&ea.includes(i[h].id)?i[h].id:"",b=f.get(g);b?b.push(i[h]):f.set(g,[i[h]])}for(let[h,g]of f){let b=en(g);if(!b)continue;let p=(a?a.projection:tn(b))==="equalEarth",w=wl(b);u.push({box:p?[-180,w[1],180,w[3]]:w,...h&&{id:h}})}}let d={boxes:u,shown:m,shapes:i,match:a?gt(a):tt(i.map(f=>f.keys))};return r||ia.set(e,r=new Map),r.set(n,d),d}function $l(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>=-180&&e<=180&&t>=-90&&t<=90}function vl(e,t,n){for(let r of e.boxes){let[o,a,i,s]=r.box;if(!(n<a||n>s)){for(let l of[t,t+360,t-360])if(l>=o&&l<=i)return r}}return null}function Wn(e,t){if("name"in t){let r=e.match(t.name);return r<0?{miss:"unmatched"}:e.shown.has(r)?{region:r}:{miss:"outside"}}if(!$l(t.lon,t.lat))return{miss:"invalid"};let n=vl(e,t.lon,t.lat);return n?{lon:t.lon,lat:t.lat,...n.id&&{id:n.id}}:{miss:"outside"}}var Ml=e=>e.boxes.reduce((t,n)=>t+(n.box[2]-n.box[0])*(n.box[3]-n.box[1]),0);function sa(e,t){if(e!==void 0&&e!=="auto")return Uo(e,()=>[]);let n=Gn();if(!n.length)return{missing:"auto"};let r=t(),o=new Set,a=r.filter(m=>{if(!("name"in m))return!0;let u=ft(m.name);return!u||o.has(u)?!1:(o.add(u),!0)}),i=-1,s=0,l=1/0;n.forEach((m,u)=>{let d=nn(nt(m)),f=0;for(let g of a)"miss"in Wn(d,g)||f++;let h=Ml(d);(f>s||f===s&&f>0&&h<l)&&(i=u,s=f,l=h)});let c=i>=0?n[i]:n.includes("world")?"world":n[0];return{map:nt(c),name:c}}var la=2e3;function ca(e,t,n){return Number.isFinite(e)&&Number.isFinite(t)?{lon:e,lat:t}:n.trim()?{name:n}:{lon:NaN,lat:NaN}}function ua(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Ge(t.csv)}return null}var ba=N(V(),1);var q=N(V(),1);function ma(e,t){let n=we(e.theme),[r,o,a]=Xt(e.width),i=Qe(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=Yt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,d=Co(r,e.animateOnView!==!1&&u),f=ce(e.locale),h=X(f),g=(0,q.useMemo)(()=>Be(e.format,f,t.format),[e.format,f,t.format]),b=(0,q.useCallback)(H=>Ye(H,{locale:f}),[f]),p=(0,q.useMemo)(()=>Rt(g,e.unit),[g,e.unit]),w=(0,q.useMemo)(()=>Ht(e.data),[e.data]),[k,M]=(0,q.useState)(null),[x,C]=(0,q.useState)(null),P=(0,q.useRef)([]),D=(0,q.useRef)(e.onHover);D.current=e.onHover;let j=(0,q.useRef)(e.onClick);j.current=e.onClick;let I=(0,q.useRef)(null),F=(0,q.useRef)(null),T=(0,q.useRef)(null),A=(0,q.useCallback)((H,ne="pointer")=>{if(T.current!==H){T.current=H;let ae=H===null?null:P.current[H]??null;queueMicrotask(()=>D.current?.(ae)),F.current?.(H)}I.current=H===null?null:ne,M(H),C(I.current)},[]),v=(0,q.useCallback)(H=>{I.current!=="keyboard"&&(I.current=H===null?null:"sync",M(H),C(I.current))},[]),S=(0,q.useCallback)(H=>{let ne=P.current[H];ne&&j.current?.(ne)},[]),L=Kr(e.replayKey),B=e.width!==void 0||(a??0)>0,oe={enabled:u,active:d.visible&&B,near:d.near,replayKey:L,dataKey:w,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Fe=(0,q.useCallback)((H,ne=1)=>k===null||k===H?ne:ne*.38,[k]);return{p:n,width:s,height:c,measured:B,responsive:e.width===void 0,pending:ye&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:oe,fv:p,fmt:g,pct:b,locale:f,lang:h,t:h==="ko"?vr:$r,active:k,via:x,setActive:A,click:S,events:P,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Fe,sig:w,description:e.description,reduced:m,publish:F,applySync:v}}var Y=N(V(),1);function Sl(e){return 1-Math.pow(1-e,3)}function Tl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Cl(e){return e==="easeInOut"?Tl:e==="linear"?t=>t:Sl}function Al(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function at(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function rn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function da(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function fa(e,t,n,r){if(!t||!n||t.length!==n.length)return at(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of at(s,n[i]))o.push(l)}return o.length===r?o:at(e,r)}var on=class{constructor(){this.tracks=new Map;this.seq=0;this.easing="spring";this.duration=900;this.omega=8.2;this.animating=!1;this.entranceStart=-1;this.maxDelay=0}configure(t,n){this.easing=t,this.duration=Math.max(1,n),this.omega=7.4/(this.duration/1e3)}sameTargets(t){let n=0;for(let r of this.tracks.values())r.exiting||n++;if(n!==t.length)return!1;for(let r of t){let o=this.tracks.get(r.key);if(!o||o.exiting||!rn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),da(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=rn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=fa(s.cur,s.parts,i.parts,c),s.vel=fa(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),da(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=rn(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=rn(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=at(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Cl(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=at(s.from,c)),s.vel.length!==c&&(s.vel=at(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,f=0;for(let h=0;h<c;h++){let g=s.from[h]-s.to[h],b=s.vel[h]+a*g;s.cur[h]=s.to[h]+(g+b*l)*u,s.curVel[h]=(s.vel[h]-a*b*l)*u,d&&f<.15&&(f=Math.max(f,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/a)))}m=a*l>=20||d&&f<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),f=Al(this.easing,u)/o;for(let h=0;h<c;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*d,s.curVel[h]=(s.to[h]-s.from[h])*f;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},yt=new Set,an=0;function ha(e){an=0;let t=Array.from(yt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||yt.delete(n)}yt.size&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(ha))}function ga(e){return yt.add(e),!an&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(ha)),()=>{yt.delete(e)}}function Nl(e){let t=new Map,n=!1;for(let r of e){let o=(t.get(r.key)??0)+1;t.set(r.key,o),o>1&&(n=!0)}return n?(t.clear(),e.map(r=>{let o=(t.get(r.key)??0)+1;return t.set(r.key,o),o>1?{...r,key:`${r.key}#${o}`}:r})):e}function pa(e,t){let n=(0,Y.useMemo)(()=>Nl(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,Y.useRef)(null),d=(0,Y.useRef)("init"),f=(0,Y.useRef)(null),h=(0,Y.useRef)(s),g=(0,Y.useRef)(i),b=(0,Y.useRef)(!1),p=(0,Y.useRef)(0),[,w]=(0,Y.useState)(0),k=(0,Y.useRef)(null),M=(0,Y.useRef)(!0);u.current||(u.current=new on,u.current.configure(l,c),u.current.snap(n),f.current=n);let x=u.current;if(x.configure(l,c),f.current!==n){let F=d.current,T=!Object.is(h.current,s);x.sameTargets(n)?x.refreshData(n):!r||F==="init"?x.snap(n):F==="idle"?x.hold(n):F==="running"||T?x.update(n,At(),m):x.snap(n),f.current=n,h.current=s}let C=(0,Y.useRef)(()=>!1);C.current=F=>{if(!M.current)return!1;let T=x.step(F);return!T&&d.current==="running"&&(d.current="done"),w(A=>(A+1)%1e9),T||(k.current=null),T};let P=(0,Y.useCallback)(()=>{if(!ye||k.current||!x.animating)return;let F=T=>C.current(T);k.current=ga(F)},[x]);Se(()=>{let F=!Object.is(g.current,i);if(g.current=i,!r){(d.current!=="done"||x.animating)&&(x.snap(f.current??n),d.current="done",w(T=>T+1));return}d.current==="init"||F&&a?(x.hold(f.current??n),d.current="idle",b.current=!1,w(T=>T+1)):F&&(b.current=!0)},[r,i]),Se(()=>{!r||!a||!b.current||(b.current=!1,x.hold(f.current??n),d.current="idle",w(F=>F+1))},[a,r]),(0,Y.useEffect)(()=>{r&&o&&d.current==="idle"&&(x.start(At()),p.current+=1,d.current="running",P(),w(F=>F+1))},[r,o,i,x,P]),(0,Y.useEffect)(()=>{x.animating&&P()}),(0,Y.useEffect)(()=>(M.current=!0,()=>{M.current=!1,k.current?.(),k.current=null}),[]);let D=At(),j=x.elapsed(D),I=r&&d.current==="idle";return{items:x.items(),get:F=>x.get(F),elapsed:I?0:j,fade:(F,T=320)=>I?0:Number.isFinite(j)?Math.max(0,Math.min(1,(j-F)/T)):1,waiting:I,animating:x.animating,generation:p.current}}var Vn=N(z(),1);function ya(e,t,n,r,o){if(r)return o==="categorical"?xe(e,t,n):Rr(e,t,n);if(o==="categorical")return xe(e,t,n);let a=Q(e,"strong"),i=Q(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var Fl=N(V(),1);var Kn=N(z(),1);var xa=e=>e?"neutralStrong":"accent";var Un=N(z(),1);function ka(e,t,n,r){if(typeof e!="function")return Me(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Rl=N(V(),1);var Yn=N(z(),1),Pl={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ae(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},wa={en:Pl,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},Xn=["ink","muted","dim"];function $a(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Xn.length)}var va=N(V(),1),Ma=N(z(),1);function Jn({p:e,frame:t,regions:n,opacity:r}){let o=(0,va.useMemo)(()=>n.map(a=>t.paths[a]).join(""),[t,n]);return o?(0,Ma.jsx)("path",{d:o,fill:e.paint("neutralSoft"),fillOpacity:r,stroke:e.paint("panel"),strokeWidth:.6,strokeLinejoin:"round",fillRule:"evenodd",pointerEvents:"none"}):null}var Ll=(e,t)=>e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1],Sa=new WeakMap;function Ta(e,t={}){let n=Number.isFinite(t.lon0)?((t.lon0+180)%360+360)%360-180:0,r=`${t.focus??""}${t.featureId??""}${t.featureName??""}${n?`${n}`:""}`,o=Sa.get(e),a=o?.get(r);if(a)return a;let i=He(e)?e:null,s=i?qt(i):Zt(e,t.featureId,t.featureName).shapes,l=new Set(i?.hidden??[]),c=t.focus!==void 0&&i?.focus&&Object.hasOwn(i.focus,t.focus)?i.focus[t.focus]:void 0,m=s.map((p,w)=>w).filter(p=>!l.has(s[p].id)&&s[p].polygons.length),u;if(c)u=Hn("equalEarth",c.lon0);else{let p=en(m.map(k=>s[k]))??[-180,-60,180,85],w=i?i.projection:tn(p);u=Hn(w,w==="conic"||!i?(p[0]+p[2])/2:w==="equalEarth"?n:0,p)}let d=s.map(p=>ta(u,p)),f=[1/0,1/0,-1/0,-1/0];if(c)f=na(u,c.box);else for(let p of m){let w=d[p].box;f=[Math.min(f[0],w[0]),Math.min(f[1],w[1]),Math.max(f[2],w[2]),Math.max(f[3],w[3])]}Number.isFinite(f[0])||(f=[0,0,1,1]);let h=m.filter(p=>Ll(d[p].box,f)),g=c?new Set(c.ids.split(" ")):null,b={shapes:s,projected:d,projection:u,box:f,regions:g?h.filter(p=>g.has(s[p].id)):h,context:g?h.filter(p=>!g.has(s[p].id)):[],clip:!!c,centers:d.map(aa),match:i?gt(i):tt(s.map(p=>p.keys))};return o||Sa.set(e,o=new Map),o.set(r,b),b}function Ca(e){let t=e.box[2]-e.box[0],n=e.box[3]-e.box[1];return t>0&&n>0?t/n:2}function Aa(e,t,n,r=2,o=e.box){let a=ra(o,Math.max(1,t-r*2),Math.max(1,n-r*2));a.tx+=r,a.ty+=r;let i=new Set([...e.regions,...e.context]);return{fit:a,paths:e.projected.map((s,l)=>i.has(l)?oa(s.rings,a,[t,n]):""),centers:e.centers.map(([s,l])=>[s*a.k+a.tx,l*a.k+a.ty]),project:(s,l,c)=>{let[m,u]=bt(e.projection,s,l,c);return[m*a.k+a.tx,u*a.k+a.ty]}}}var Fa=N(z(),1);function Na({p:e,l:t,dim:n}){return(0,Fa.jsx)("text",{x:Math.round(t.x*10)/10,y:Math.round(t.y*10)/10,dy:"0.35em",fontSize:11,fontWeight:t.weight,textAnchor:t.anchor,fill:e.paint("ink"),stroke:e.paint("panel"),strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke",opacity:n?.45:void 0,className:"ztd-mark",style:{pointerEvents:"none"},children:t.text})}var Ra=new WeakMap;function qn(e){let t=Ra.get(e);if(t)return t;let n=[NaN,NaN],r=-1;for(let o of e.polygons){let a=o[0];if(!a||a.length<3)continue;let i=a[0][0],s=0,l=0,c=0;for(let m=0,u=a.length-1;m<a.length;u=m++){let d=i+Ce(a[m][0]-i),f=i+Ce(a[u][0]-i),h=f*a[m][1]-d*a[u][1];s+=h,l+=(f+d)*h,c+=(a[u][1]+a[m][1])*h}Math.abs(s)>r&&s!==0&&(r=Math.abs(s),n=[Ce(l/(3*s)),c/(3*s)])}return r<0&&(n=e.polygons[0]?.[0]?.[0]?[e.polygons[0][0][0][0],e.polygons[0][0][0][1]]:[NaN,NaN]),Ra.set(e,n),n}var xt={atlantic:0,pacific:150};function La(e,t){let n=He(e)?e:null;return!!n&&n.projection==="equalEarth"&&!(t!==void 0&&n.focus&&Object.hasOwn(n.focus,t))}function _a(e,t,n){if(e==="atlantic"||e==="pacific")return xt[e];let r=o=>{let a=0;for(let i of t)Math.abs(Ce(i.b-o)-Ce(i.a-o))>180&&(a=Zn(a+i.w));for(let i of n)Math.abs(Ce(i-o))>160&&(a+=1);return a};return r(xt.pacific)<r(xt.atlantic)?xt.pacific:xt.atlantic}var We=e=>Math.round(e*10)/10||0,Zn=e=>Math.min(Number.MAX_VALUE,e);function Da(e,t){if("miss"in t)return null;let n=e.projection.name==="albersUsa";if("region"in t){let[i,s]=e.centers[t.region]??[NaN,NaN],l=e.shapes[t.region],[c,m]=qn(l);return!Number.isFinite(i)||!Number.isFinite(s)||!Number.isFinite(c)?null:{x:i,y:s,lon:c,lat:m,sub:e.projection.pick(c,m,n?l.id:void 0)}}let r=n?t.id??"":void 0,[o,a]=bt(e.projection,t.lon,t.lat,r);return Number.isFinite(o)&&Number.isFinite(a)?{x:o,y:a,lon:t.lon,lat:t.lat,sub:e.projection.pick(t.lon,t.lat,r)}:null}function Ea(e,t){let n=[e.box[0],e.box[1],e.box[2],e.box[3]];if(e.clip)return n;for(let r of t)r.x<n[0]&&(n[0]=r.x),r.y<n[1]&&(n[1]=r.y),r.x>n[2]&&(n[2]=r.x),r.y>n[3]&&(n[3]=r.y);return n}var Pa=(e,t)=>e[0]<t[2]&&e[2]>t[0]&&e[1]<t[3]&&e[3]>t[1];function Ia(e,t,n,r,o=[],a=[]){let i=[...o],s=[],l=r*.62,c=new Set;return e.forEach((m,u)=>{let d=`${Math.round(m.x)} ${Math.round(m.y)}`;if(c.has(d))return;c.add(d);let f=m.weight??600,h=$e(m.text,r,f),g=m.r+3,b=[[m.x+g,m.y,"start",[m.x+g,m.y-l,m.x+g+h,m.y+l]],[m.x-g,m.y,"end",[m.x-g-h,m.y-l,m.x-g,m.y+l]],[m.x,m.y-g-l,"middle",[m.x-h/2,m.y-g-2*l,m.x+h/2,m.y-g]],[m.x,m.y+g+l,"middle",[m.x-h/2,m.y+g,m.x+h/2,m.y+g+2*l]]];for(let[p,w,k,M]of b)if(!(M[0]<1||M[1]<0||M[2]>t-1||M[3]>n)&&!(i.some(x=>Pa(x,M))||a.some(x=>Pa(x,M)))){i.push(M),s.push({x:p,y:w,anchor:k,text:m.text,weight:f,k:u});return}}),s}function Oa(e,t){return Ye(e,{locale:t,maximumFractionDigits:Math.abs(e)<10?1:0})}function sn(e,t){return t==="ko"?e==="auto"?"등록한 지도가 없어요. ztd-charts/geo의 지도를 registerMap에 넘겨 주세요":ht.includes(e)?`"${e}" 지도를 등록하지 않았어요. ztd-charts/geo/${e}에서 불러와 registerMap에 넘겨 주세요`:`"${e}" 지도를 등록하지 않았어요. 지도를 registerMap에 넘기거나 ${ht.join(", ")}, GeoJSON을 써 주세요`:e==="auto"?"No map is registered. Import one from ztd-charts/geo and pass it to registerMap":ht.includes(e)?`Map "${e}" is not registered. Import it from ztd-charts/geo/${e} and pass it to registerMap`:`Map "${e}" is not registered. Pass a map to registerMap, or use ${ht.join(", ")} or a GeoJSON`}var _l=N(V(),1);var Ha=N(z(),1),Dl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ae(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},El={en:Dl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},za=(e,t)=>El[e].other(t);function Ba(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,lo(o.map(a=>a.value)))}}var ja=e=>Number.isFinite(e)&&e>0?e:0;function Ga(e,t,n,r){return r==="emphasis"?Fr(e,t,n):xe(e,t,n)}var Il=N(V(),1);var Ua=N(z(),1);function Wa(e,t){return t===!1?e.map((n,r)=>r):so(e)}function Va(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Me(e,t,t,r,"max")}function Ka(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=Q(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?Q(e,"neutral"):Ft(e,1-i/Math.max(1,o.length-1))),r}var K=N(V(),1);var U=N(z(),1),Ol=new Intl.PluralRules("en-US",{type:"ordinal"}),zl={one:"st",two:"nd",few:"rd"},Bl={kind:"Symbol map",share:e=>`${e} of the total`,shareLabel:"Share",rankLabel:"Rank",groupLabel:"Group",rank:(e,t)=>`${e}${zl[Ol.select(e)]??"th"} of ${t}`,desc:(e,t,n)=>`${Ae(e,"place")}, ${t} in total. Largest: ${n}`,skipped:e=>`${Ae(e,"row")} could not be placed on the map`,capped:(e,t)=>`The ${e} largest of ${t} places are drawn`},jl={en:Bl,ko:{kind:"기호 지도",share:e=>`전체의 ${e}`,shareLabel:"비율",rankLabel:"순위",groupLabel:"묶음",rank:(e,t)=>`${t}곳 중 ${e}위`,desc:(e,t,n)=>`지점 ${e}곳, 합계 ${t}. 가장 큰 곳: ${n}`,skipped:e=>`지도에 놓지 못한 행 ${e}개`,capped:(e,t)=>`지점 ${t}곳 중 큰 ${e}곳을 그려요`}},Gl=8;function Xa(e){if(!(e>0)||!Number.isFinite(e))return 0;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n>=5?5:n>=2?2:1)*t}var Hl=e=>Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"&&Number.isFinite(t));function Ya(e,t){if(!Hl(e))return null;let n=Math.max(1,t/8),r=Ee(Math.min(e[0],e[1]),.5,n);return[r,Ee(Math.max(e[0],e[1]),r,n)]}function Qn(e){let{counted:t,rows:n}=(0,K.useMemo)(()=>{let $=ie=>e.data.some(he=>he!==null&&typeof he=="object"&&Gt(he,ie)),_=_e(e.lon,"lon"),O=_e(e.lat,"lat"),Z=e.region!==void 0||$("region")?le(e.region,"region"):()=>"",E=e.size!==void 0||$("size"),J=_e(e.size,"size"),fe=e.label!==void 0||$("label")?le(e.label,"label"):$("name")?le("name","name"):()=>"",te=e.group!==void 0?le(e.group,"group"):null;return{counted:!E,rows:e.data.map((ie,he)=>({d:ie,place:ca(_(ie,he),O(ie,he),Z(ie,he)),value:E?J(ie,he):1,label:fe(ie,he).trim(),group:te?te(ie,he):""}))}},[e.data,e.lon,e.lat,e.region,e.size,e.label,e.group]),r=(0,K.useMemo)(()=>sa(e.map,()=>n.map($=>$.place)),[e.map,n]),o=r&&"map"in r?r.map:null,a=(0,K.useMemo)(()=>({focus:e.focus,featureId:e.featureId,featureName:e.featureName}),[e.focus,e.featureId,e.featureName]),i=(0,K.useMemo)(()=>{if(!o)return[];let $=nn(o,a);return n.map(_=>Wn($,_.place))},[o,a,n]),s=(0,K.useMemo)(()=>{if(!o||!La(o,e.focus))return;let $=nn(o,a),_=i.flatMap(O=>"lon"in O?[O.lon]:"region"in O?[qn($.shapes[O.region])[0]]:[]);return _a(e.center,[],_)},[o,a,i,e.focus,e.center]),l=(0,K.useMemo)(()=>o?Ta(o,{...a,lon0:s}):null,[o,a,s]),c=l?Ca(l):2,m=$=>Ya(e.sizeRange,$)?.[1]??Ee($/26,8,30),u=ma(e,{height:$=>{let _=m($)+2;return Math.round(Math.max(120,Math.min(($-2*_)/c+2*_,$*.85)))},duration:520,stagger:70}),{p:d,width:f,height:h,fv:g}=u,b=jl[u.lang],p=(0,K.useId)().replace(/:/g,""),w=(0,K.useMemo)(()=>{let $=me(n.map(E=>E.group).filter(Boolean)),_=new Map($.map((E,J)=>[E,J]));if(!l)return{pts:[],all:0,total:0,skipped:n.length,groups:$};let O=[];n.forEach((E,J)=>{if(!(E.value>0)||!Number.isFinite(E.value))return;let fe=i[J],te=Da(l,fe);if(!te)return;let ie=E.label||("region"in fe?(u.lang==="ko"?l.shapes[fe.region].nameKo:void 0)??l.shapes[fe.region].name:`${Math.abs(te.lat).toFixed(2)}°${te.lat<0?"S":"N"}, ${Math.abs(te.lon).toFixed(2)}°${te.lon<0?"W":"E"}`);O.push({row:J,datum:E.d,label:ie,value:E.value,group:_.get(E.group)??-1,at:te,rank:0})}),O.sort((E,J)=>J.value-E.value||E.row-J.row),O.forEach((E,J)=>E.rank=J&&O[J-1].value===E.value?O[J-1].rank:J+1);let Z=0;for(let E of O)Z=Zn(Z+E.value);return{pts:O.slice(0,la),all:O.length,total:Z,skipped:n.length-O.length,groups:$}},[l,i,n,u.lang]),{pts:k,all:M,total:x}=w,C=k.length,P=C?k[0].value:0,D=C>0&&k[C-1].value===P,j=Ya(e.sizeRange,Math.min(f,h))??[C>500?1.5:2.5,m(f)],[I,F]=j,T=$=>t||D?Ee(Math.min(F,f/90),I,F):Ee(F*Math.sqrt($/P),I,F),A=t||D?T(P)+2:F+2,v=(0,K.useMemo)(()=>l?Ea(l,k.map($=>$.at)):null,[l,k]),S=(0,K.useMemo)(()=>l&&v?Aa(l,f,h,A,v):null,[l,v,f,h,A]),L=(0,K.useMemo)(()=>S?k.map($=>[$.at.x*S.fit.k+S.fit.tx,$.at.y*S.fit.k+S.fit.ty]):[],[S,k]),B=(0,K.useMemo)(()=>{let $=e.highlight,_=D&&(typeof $=="string"||Array.isArray($))?(Array.isArray($)?$:[$]).filter(O=>O!=="max"&&O!=="min"):$;return Me(_,k.map(O=>O.datum),k.map(O=>O.label),k.map(O=>O.value),D?"none":"max")},[e.highlight,k,D]),oe=(0,K.useMemo)(()=>w.groups.length?ze(d,w.groups.length,new Set):[],[d,w.groups.length]),Fe=($,_)=>$.group>=0&&oe[$.group]?oe[$.group].fill:B.has(_)?d.paint("accent"):d.paint("neutralStrong"),H=(0,K.useMemo)(()=>k.map($=>x>0?Oa($.value/x*100,u.locale):""),[k,x,u.locale]),ne=(0,K.useMemo)(()=>k.map(($,_)=>({datum:$.datum,index:$.row,key:`${$.row}`,label:$.label,value:$.value,...$.group>=0&&{series:w.groups[$.group]},formatted:[g($.value),H[_]&&b.share(H[_]),b.rank($.rank,M)].filter(Boolean).join(", ")})),[k,H,M,g,b,w.groups]),ae=(0,K.useMemo)(()=>{if(e.legend===!1||t||D||!C)return[];let $=10**(Math.floor(Math.log10(P))-1),_=Number.isFinite($)&&$>0?Math.floor(P/$)*$:P;return[...new Set([_,Xa(_/4),Xa(_/20)])].filter(O=>O>0&&T(O)>=3).slice(0,3)},[e.legend,t,D,C,P,F,I]),G=(0,K.useMemo)(()=>{if(!ae.length)return null;let $=T(ae[0]),_=ae.map(be=>g(be)),O=Math.max(..._.map(be=>$e(be,10))),Z=2*$+6+O,E=2*$;if(Z>f*.45||E>h*.45)return null;let J=[[4,h-4-E],[f-4-Z,h-4-E],[4,4],[f-4-Z,4]],fe=J[0],te=1/0;for(let[be,Re]of J){let ln=0;L.forEach(([cr,ur],ui)=>{let vt=T(k[ui].value),mr=Math.min(cr+vt,be+Z)-Math.max(cr-vt,be),dr=Math.min(ur+vt,Re+E)-Math.max(ur-vt,Re);mr>0&&dr>0&&(ln+=mr*dr)}),ln<te&&(te=ln,fe=[be,Re])}let ie=ae.map((be,Re)=>({r:T(be),text:_[Re]})),he=ie.filter((be,Re)=>Re===0||ie[Re-1].r*2-be.r*2>=11);return{x0:fe[0],y0:fe[1],R:$,bw:Z,bh:E,items:he}},[ae,L,k,f,h,g]),wt=(0,K.useMemo)(()=>{if(!u.showLabels||!C)return[];let $=f>=600?6:f>=390?4:0,_=[...k.keys()].filter(E=>B.has(E)).slice(0,40).concat([...k.keys()].filter(E=>!B.has(E)).slice(0,$)),O=G?[[G.x0,G.y0,G.x0+G.bw,G.y0+G.bh]]:[],Z=L.slice(0,300).map(([E,J],fe)=>{let te=T(k[fe].value);return[E-te,J-te,E+te,J+te]});return Ia(_.map(E=>({x:L[E][0],y:L[E][1],r:T(k[E].value),text:Vt(k[E].label,Math.min(140,f*.35),11,600),weight:B.has(E)?700:600})),f,h,11,O,Z).map(E=>({...E,k:_[E.k]}))},[u.showLabels,C,k,B,L,f,h,G]),oi=(0,K.useMemo)(()=>[{key:"__m",to:[1],from:[0],data:null}],[]),$t=pa(oi,u.motion),tr=Tt(u,$t),nr=u.motion.duration??520,rr=u.motion.stagger??70,it=Math.max(1,Math.ceil(C/Gl)),ee=u.active!==null&&u.active<C?u.active:null,or=null;if(ee!==null&&L[ee]){let $=k[ee],[_,O]=L[ee],Z=H[ee];or={x:Ee(_,0,f),y:Ee(O-T($.value),0,h),title:$.label,rows:[{label:u.t.value,value:g($.value),color:Fe($,ee)},...Z?[{label:b.shareLabel,value:Z,strong:!1}]:[],{label:b.rankLabel,value:b.rank($.rank,M),strong:!1},...$.group>=0?[{label:b.groupLabel,value:w.groups[$.group],strong:!1}]:[]]}}let Ve=r&&"missing"in r?r.missing:null,ar=[w.skipped?b.skipped(w.skipped):"",M>C?b.capped(C,M):""].filter(Boolean),ai=C?`${b.kind}. ${b.desc(M,g(x),`${k[0].label} ${g(P)}`)}`:"",ii=e.description??(C?`${ai}${ar.length?`. ${ar.join(". ")}`:""}.`:Ve?sn(Ve,u.lang):""),si=u.via==="keyboard"&&ee!==null&&ne[ee]?`${ne[ee].label}, ${ne[ee].formatted}`:"",ir=($,_)=>u.setActive($,_==="touch"?"touch":"pointer"),sr=($,_)=>(0,U.jsx)("circle",{cx:We(L[_][0]),cy:We(L[_][1]),r:We(T($.value)),fill:Fe($,_),fillOpacity:B.has(_)&&$.group<0?.9:.75,stroke:d.paint("panel"),strokeWidth:.8,className:"ztd-mark ztd-pop",onPointerEnter:O=>ir(_,O.pointerType),onClick:()=>u.click(_)},$.row),lr=($,_,O)=>(0,U.jsx)("circle",{cx:We(L[$][0]),cy:We(L[$][1]),r:We(T(k[$].value)+_),fill:"none",stroke:d.paint("ink"),strokeWidth:O,pointerEvents:"none"},`o${k[$].row}`),li=(0,K.useMemo)(()=>Array.from({length:Math.ceil(C/it)},($,_)=>(0,U.jsx)("g",{style:St(tr,$t.waiting,"pop",_*rr,nr),children:k.slice(_*it,(_+1)*it).map((O,Z)=>sr(O,_*it+Z))},_)),[k,L,B,oe,d,tr,$t.waiting,it,rr,nr,I,F,t,D]),ci=(0,K.useMemo)(()=>k.flatMap(($,_)=>B.has(_)&&$.group>=0?[lr(_,0,1.4)]:[]),[k,L,B,d,I,F,t,D]);return(0,U.jsxs)(Xr,{c:u,kind:b.kind,ariaLabel:e.ariaLabel,description:ii,emptyText:Ve?sn(Ve,u.lang):void 0,events:ne,tip:or,renderTip:e.tooltip,announce:si,className:e.className,style:e.style,theme:e.theme,defs:l?.clip?(0,U.jsx)("clipPath",{id:`${p}c`,children:(0,U.jsx)("rect",{width:f,height:h})}):void 0,children:[Ve?(0,U.jsx)(Nn,{x:f/2,y:h/2,anchor:"middle",size:12,fill:d.paint("muted"),children:Vt(sn(Ve,u.lang),f-16,12)}):null,S&&l?(0,U.jsxs)("g",{children:[(0,U.jsx)("rect",{width:f,height:h,fill:"transparent",onPointerEnter:$=>u.via==="keyboard"?void 0:ir(null,$.pointerType)}),(0,U.jsxs)("g",{clipPath:l.clip?`url(#${p}c)`:void 0,children:[l.context.length?(0,U.jsx)(Jn,{p:d,frame:S,regions:l.context,opacity:.6}):null,(0,U.jsx)(Jn,{p:d,frame:S,regions:l.regions}),G?(0,U.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:G.items.map(($,_)=>(0,U.jsxs)("g",{children:[(0,U.jsx)("circle",{cx:G.x0+G.R,cy:G.y0+G.bh-$.r,r:$.r,fill:"none",stroke:d.paint("muted"),strokeWidth:.8}),(0,U.jsx)("line",{x1:G.x0+G.R,x2:G.x0+2*G.R+3,y1:G.y0+G.bh-2*$.r,y2:G.y0+G.bh-2*$.r,stroke:d.paint("muted"),strokeWidth:.6,strokeDasharray:"2 2"}),(0,U.jsx)(Nn,{x:G.x0+2*G.R+6,y:G.y0+G.bh-2*$.r,size:10,fill:d.paint("muted"),children:$.text})]},_))}):null,(0,U.jsx)("g",{opacity:ee!==null?.45:void 0,children:li}),ci,ee!==null?(0,U.jsxs)("g",{pointerEvents:"none",children:[sr(k[ee],ee),lr(ee,2.5,2)]}):null]}),wt.map($=>(0,U.jsx)(Na,{p:d,l:$,dim:ee!==null&&ee!==$.k},`l${k[$.k].row}`))]},$t.generation):null]})}function Ja(e){return!e||typeof e!="object"||Array.isArray(e)?[]:me(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function qa(e,t){return ze(e,t+1,new Set)}var Wl=N(V(),1);var Qa=N(z(),1);var Vl=26;var td=Vl*.62;function Za(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!No.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Ne=N(z(),1);function ei(e,t,n){let r=jt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Bt(n)?jt("bubble"):r}function Kl(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function Ul(e,t,n,r=!1){let o=ei(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Fn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=le(a.label,"label"),d=_e(a.value,"value"),f=o.type==="waffle",h=t.map((x,C)=>({r:x,label:u(x,C),value:f?d(x,C):ja(d(x,C))})),{kept:g,other:b}=f?{kept:h,other:null}:Ba(h,i.other,(x,C)=>({r:{},label:za(X(n),x),value:C})),p=Me(s,g.map(x=>x.r),g.map(x=>x.label),g.map(x=>x.value),f?"first":"max"),w=b?[...g,b]:g,k=Le(x=>f?xe(x,w.length,p):Ga(x,w.length,p,i.colorMode)),M=f&&i.shape==="arc";return w.map((x,C)=>({label:x.label,color:k[C],...M&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=$a(Array.isArray(i.ma)?i.ma:void 0,t.length),d=wa[X(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((f,h)=>({label:d.maLegend(f),color:Xn[h],shape:"line"}))]}if(o.type==="network"){let u=Ja(i.groups);if(u.length<2)return[];let d=Le(f=>qa(f,u.length));return u.map((f,h)=>({label:f,color:d[h],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=le(a.group,"group"),d=me(t.map((h,g)=>u(h,g)).filter(Boolean));if(d.length<2)return[];let f=Le(h=>ze(h,d.length,new Set));return d.map((h,g)=>({label:h,color:f[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Bt(i))return[];let u=le(a.series,"series"),d=me(t.map((g,b)=>u(g,b)));if(d.length<2)return[];let f=ka(s,t,d,u),h=Le(g=>ze(g,d.length,f));return c(d.map((g,b)=>({label:g,color:h[b],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let f=Bo(t,d,u),h=Le(g=>xe(g,f.length,Za(s,f)));return c(f.map((g,b)=>({label:g,color:h[b],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let k=le(a.series,"series");u=me(t.map((M,x)=>k(M,x)))}let d=Rn(o.type,a,i);if(d.length){let k=Me(s,u,u,u.map(()=>0),"none"),M=Le(C=>xe(C,u.length,k)),x=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((C,P)=>({label:C,color:M[P]}));return[...c(x),...d.map((C,P)=>({label:C,color:xa(P),shape:"line"}))]}if(u.length<2)return[];let h=o.type==="bar"&&i.layout==="diverging"&&s===void 0?io(u.length,Array.isArray(i.negative)?i.negative.map(k=>u.indexOf(String(k))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=h>=0?new Set([h]):Me(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((k,M)=>({label:k,color:g.has(M)?"accent":"neutralStrong",shape:"square"})));let b=i.colorMode,p=k=>xe(k,u.length,g);if((o.type==="line"||o.type==="area")&&(p=k=>ya(k,u.length,g,o.type==="area",b)),o.type==="stream"){let k=ut(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),M=Wa(k.values,i.reorder),x=Va(s,k.series,k.values);p=C=>Ka(C,M,x)}let w=Le(p);return c(u.map((k,M)=>({label:k,color:w[M],...o.type==="line"&&{shape:"line"}})))}return[]}function Xl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Qr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Yl(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function ti(e,t){let{spec:n}=e,r=ei(n.type,n.encoding,n.options),o=(0,kt.useMemo)(()=>ua(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Zr(n,e.locale),s=ce(i),l=X(s),c=Fo(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=no(n),u=(0,kt.useMemo)(()=>m?Io(m,s):void 0,[m,s]),d=n.options?.hidden,f=Array.isArray(d)?d.map(String):[],h=f.join(""),[g,b]=(0,kt.useState)(null);if(!r)return(0,Ne.jsx)(An,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let p=o??c.data,w=t[r.type],k={...n.options??{}},M={...Kl(r,n.encoding),...k,...u?{tooltip:u}:{},data:p,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},x=n.card?.legend==="toggle"&&to(r.type,n.encoding??{},k),C=g&&g.base===h?g.hidden:f;x&&(M.hidden=C);let P=T=>b(A=>{let v=A&&A.base===h?A.hidden:f;return{base:h,hidden:v.includes(T)?v.filter(S=>S!==T):[...v,T]}}),D=M.height??220,j=Xl(n,r.type),I=a&&!p.length&&(c.loading||c.error||c.empty)?(0,Ne.jsx)(An,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:D,locale:i}):j?(0,Ne.jsx)(Ao,{chart:w,...Yl(r.type,j,M)}):(0,Ne.jsx)(w,{...M});if(n.card){let T=n.card,A=T.legend==="auto"||T.legend==="toggle"?Ul(n,p,s,x):T.legend,v=A?.length?x?(0,Ne.jsx)(Cn,{items:A,hidden:C,onToggle:P,locale:i}):A:void 0,S=T.download?(0,Ne.jsx)(Eo,{data:p,columns:ro(n),filename:T.title??r.type,formats:Array.isArray(T.download)?T.download:void 0,locale:i}):void 0;I=(0,Ne.jsx)(Ur,{number:T.number,title:T.title??qr(r,l),subtitle:T.subtitle,legend:v,actions:S,source:T.source||void 0,note:T.note||void 0,accent:T.accent,takeaway:T.takeaway,level:T.level,sample:T.sample,replay:T.replay!==!1,className:e.className,locale:i,children:I})}let F=e.theme??n.theme;return F&&(I=(0,Ne.jsx)(Dt,{theme:F,children:I})),I}function Jl({cfg:e,components:t}){let n=Qe();return ti({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ri(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ni.hydrateRoot)(r,(0,er.createElement)(Dt,{theme:o.theme,cssVars:!0},(0,er.createElement)(Jl,{cfg:o,components:{[e]:t}})))}ri("symbolMap",Qn);})();