ztd-charts-cli 0.5.1 → 0.7.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 (43) hide show
  1. package/README.md +1 -1
  2. package/dist/api.js +1 -1
  3. package/dist/{chunk-QVXYPBAX.js → chunk-4WXNLD5P.js} +54 -19
  4. package/dist/cli.js +1 -1
  5. package/dist/client/area.js +28 -0
  6. package/dist/client/bar.js +28 -0
  7. package/dist/client/beeswarm.js +28 -0
  8. package/dist/client/box.js +28 -0
  9. package/dist/client/bubble.js +28 -0
  10. package/dist/client/bullet.js +28 -0
  11. package/dist/client/bump.js +28 -0
  12. package/dist/client/calendar.js +28 -0
  13. package/dist/client/candlestick.js +28 -0
  14. package/dist/client/chord.js +28 -0
  15. package/dist/client/donut.js +28 -0
  16. package/dist/client/dumbbell.js +28 -0
  17. package/dist/client/funnel.js +28 -0
  18. package/dist/client/gauge.js +28 -0
  19. package/dist/client/heatmap.js +28 -0
  20. package/dist/client/histogram.js +28 -0
  21. package/dist/client/line.js +28 -0
  22. package/dist/client/lollipop.js +28 -0
  23. package/dist/client/marimekko.js +28 -0
  24. package/dist/client/parallel.js +28 -0
  25. package/dist/client/pareto.js +28 -0
  26. package/dist/client/pie.js +28 -0
  27. package/dist/client/radar.js +28 -0
  28. package/dist/client/radialBar.js +28 -0
  29. package/dist/client/react.js +66 -0
  30. package/dist/client/ridgeline.js +28 -0
  31. package/dist/client/sankey.js +28 -0
  32. package/dist/client/scatter.js +28 -0
  33. package/dist/client/segmented.js +28 -0
  34. package/dist/client/skyline.js +28 -0
  35. package/dist/client/slope.js +28 -0
  36. package/dist/client/sparkline.js +28 -0
  37. package/dist/client/stream.js +28 -0
  38. package/dist/client/sunburst.js +28 -0
  39. package/dist/client/tileMap.js +28 -0
  40. package/dist/client/treemap.js +28 -0
  41. package/dist/client/waffle.js +28 -0
  42. package/dist/client/waterfall.js +28 -0
  43. package/package.json +3 -3
@@ -0,0 +1,28 @@
1
+ (()=>{var go=Object.create;var fn=Object.defineProperty;var po=Object.getOwnPropertyDescriptor;var bo=Object.getOwnPropertyNames;var yo=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty;var St=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ko=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of bo(t))!xo.call(e,o)&&o!==n&&fn(e,o,{get:()=>t[o],enumerable:!(r=po(t,o))||r.enumerable});return e};var A=(e,t,n)=>(n=e!=null?go(yo(e)):{},ko(t||!e||!e.__esModule?fn(n,"default",{value:e,enumerable:!0}):n,e));var j=St((Ri,hn)=>{hn.exports=globalThis.__ztdReact.react});var pn=St((Pi,gn)=>{gn.exports=globalThis.__ztdReact["react-dom/client"]});var _=St((Ki,Wn)=>{Wn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var mn=A(j(),1),co=A(pn(),1);var Ye=A(j(),1);var mt=A(j(),1);var bn=A(j(),1),Te=(0,bn.createContext)(void 0);var wn=A(j(),1);var wo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],yn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',xn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',ye={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:yn,monoFamily:xn,radius:18,radiusCode:14,radiusMark:4},At={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:yn,monoFamily:xn,radius:18,radiusCode:14,radiusMark:4},Ft={dark:ye,light:At};function Je(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Nt(e){let t={};for(let n of wo){let r=e[n];typeof r=="string"&&(t[Je(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function Rt(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var vo=`
2
+ .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
+ .ztd-root:focus{outline:none}
4
+ .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${ye.accent});outline-offset:3px;border-radius:6px}
5
+ .ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
6
+ .ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
7
+ .ztd-tip{animation:ztd-fade .14s ease-out;transition:left .2s cubic-bezier(.22,1,.36,1),top .2s cubic-bezier(.22,1,.36,1)}
8
+ .ztd-guide{transition:transform .2s cubic-bezier(.22,1,.36,1)}
9
+ .ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
10
+ .ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
11
+ .ztd-btn:focus{outline:none}
12
+ .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${ye.accent});outline-offset:2px}
13
+ .ztd-card{transition:border-color .16s ease}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${ye.dim})}
15
+ @media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
16
+ @keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
17
+ @keyframes ztd-fade{from{opacity:0}to{opacity:1}}
18
+ .ztd-pop{transform-box:fill-box;transform-origin:center}
19
+ @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
+ .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
+ @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
+ `;function Ze(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 Qe(e,t){let[n]=(0,wn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var kn=!1;function He(){if(kn||typeof document>"u"||(kn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=vo,document.head.appendChild(e)}var et=A(j(),1),ae=typeof window<"u"&&typeof document<"u",ue=ae?et.useLayoutEffect:et.useEffect;function tt(){return typeof performance<"u"?performance.now():Date.now()}function V(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Se(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var vn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},$n={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var $o=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Co={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Mo(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function To(e){return Mo($o,e)}function Cn(e,t){let n=To(e);return{text:n?n[t]:e,...Co[n?.id??"basic"]}}var Mn={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ae(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Mn[t.toLowerCase()]&&(t=Mn[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 An(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 Dt(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 Fe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Tn(e){return .2126*Fe(e[0])+.7152*Fe(e[1])+.0722*Fe(e[2])}function Lt(e,t,n){let r=typeof e=="string"?Ae(e):e,o=typeof t=="string"?Ae(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ae(n):n:null;o[3]<1&&a&&(o=Dt(o,a));let i=r[3]<1?Dt(r,o):r,s=Tn(i),c=Tn(o);return(Math.max(s,c)+.05)/(Math.min(s,c)+.05)}function So(e){return[Fe(e[0]),Fe(e[1]),Fe(e[2])]}function Pt(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 Sn(e){let[t,n,r]=So(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 Ao([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[Pt(4.0767416621*o-3.3077115913*a+.2309699292*i),Pt(-1.2684380046*o+2.6097574011*a-.3413193965*i),Pt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function nt(e,t,n){let r=Ae(e),o=Ae(t);if(!r||!o)return e;let a=Sn(r),i=Sn(o),s=Math.max(0,Math.min(1,n));return An(Ao([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 Et(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Lt(a,e,n);i>o&&(o=i,r=a)}return r}function X(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 Fo(e,t){let n=Et(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Lt(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Et(t,["#FFFFFF","#000000"])}function rt(e,t){let n=nt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Fo(e,n),raw:n}}function ne(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=X(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=X(e,"neutral");else if(s===0)r[i]=X(e,"ink");else if(s===a-1)r[i]=X(e,"neutral");else if(a===3)r[i]=X(e,"strong");else{let c=(s-1)/Math.max(1,a-2);r[i]=c<=.001?X(e,"strong"):rt(e,1-c)}}),r}var _t="mix:";function je(e){return e({theme:At,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${_t}${o}`}).map(n=>n.fill)}function Fn(e,t){return t?.startsWith(_t)?e.mix("neutralStrong","neutral",Number(t.slice(_t.length))):e.color(t)}function Nn(e,t,n){return ne(e,t+1,n).slice(0,t)}function Rn(e,t,n,r="neutral"){let o=X(e,"accent"),a=X(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Pn(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=X(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=X(e,"neutral"):s===0?r[i]=X(e,"strong"):s===a-1?r[i]=X(e,"neutral"):r[i]=rt(e,1-s/(a-1))}),r}var ie=A(j(),1);var at=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),J="en-US",Dn=new Map;function It(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=Dn.get(r);return o||(o=new Intl.NumberFormat(e,n),Dn.set(r,o)),o}function Ot(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Ne(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=J,...r}=t;return Ot(It(n,r).format(e))}var Bt=e=>e!==0&&Math.abs(e)<.05,zt=(e,t,n="")=>`${Ne(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function ot(e,t={}){if(!Number.isFinite(e))return"-";if(Bt(e)&&t.maximumFractionDigits===void 0)return zt(e,t.locale??J,"%");let n=Math.abs(e);return`${Ne(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function In(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=J,...r}=t;if(V(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,c]=a[i],l=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||l<100?1:0)),u=Math.round(l*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Ne(u,{locale:n,...r,maximumFractionDigits:m})+c}}return Ot(It(n,{notation:"compact",...r}).format(e))}var No=(e,t=V(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function $e(e,t=J,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=It(t,o);return c=>Number.isFinite(c)?`${i}${Ot(s.format(c))}${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=>ot(o,{locale:t});case"ratio":return o=>ot(o*100,{locale:t});case"compact":return o=>In(o,{locale:t});case"currency":return r(No(t));default:{let o=r({maximumFractionDigits:1});return a=>Bt(a)?zt(a,t):o(a)}}}function On(e,t=J,n=0){return e!==void 0?$e(e,t):n>=1e5?r=>Bt(r)?zt(r,t):In(r,{locale:t}):r=>Ne(r,{locale:t})}function Ro(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Ht=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Po=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Do=["january","february","march","april","may","june","july","august","september","october","november","december"],Ln=e=>{let t=e.toLowerCase();return t.length<3?0:Do.findIndex(n=>n.startsWith(t))+1},En=e=>+e+(+e<30?2e3:1900);function Bn(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Lo=[/^(\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})일)?$/],zn=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Hn=/\{([^{}]+)\}/g;function it(e,t){let n;for(let r of Lo)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?[En(n[3]),+n[2],+n[1],1]:[En(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=zn.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=Ln(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=Ln(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var jn=e=>Po.test(e)||it(e)!==null;function Vn(e){let t;for(let n of e){let r=typeof n=="string"?zn.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function st(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(Ht(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return st(`${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=it(n,t);if(r)return Ro(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 _n=new Map;function Ve(e,t={month:"short",day:"numeric"}){let n=st(e);if(!n)return"-";let{locale:r=J,...o}=t,a=r+JSON.stringify(o),i=_n.get(a);return i||(i=new Intl.DateTimeFormat(r,o),_n.set(a,i)),i.format(n)}var jt=A(_(),1),lt=(0,ie.createContext)({theme:ye,cssVars:!0});function Eo(e,t=ye){return e?typeof e=="string"?Ft[e]??t:Rt(t,e):t}function ct(e){let t=(0,ie.useContext)(lt),n=e.base?Ft[e.base]:t.theme,r=(0,ie.useMemo)(()=>Eo(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ie.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ie.useMemo)(()=>Nt(r),[r]),c=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,jt.jsx)(lt.Provider,{value:i,children:(0,jt.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:c,children:e.children})})}var _o=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Gn(e){return _o.has(e)}function Io(e,t){let n=r=>t?`var(${Je(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Gn(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Gn(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 se(e){let t=(0,ie.useContext)(lt);return(0,ie.useMemo)(()=>{let n=Rt(t.theme,e);return Io(n,t.cssVars)},[t.theme,t.cssVars,e])}function Q(e){let t=(0,ie.useContext)(lt);return e??t.locale??J}function Kn(e){return e?Nt(e):{}}var ut=A(j(),1),Vt=(0,ut.createContext)(void 0);function Un(e){let t=(0,ut.useContext)(Vt);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var T=A(_(),1),Oo={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`},Bo={en:Oo,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var zo={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Wt=e=>Bo[V(Q(e))];function Gt(e){let t=se(e.theme),n=Wt(e.locale),[r,o]=(0,mt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),c=e.items.filter(m=>!s.has(m.label)).length,l=(0,T.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),h=d&&c===1,f=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(Ho,{p:t,item:m,off:!d}),(0,T.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,T.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,T.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":h||void 0,onClick:()=>{h||(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:h?"default":void 0},children:f}):f},u)})});return i?(0,T.jsxs)(T.Fragment,{children:[l,(0,T.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:zo,children:r?n.shown(c,e.items.length):""})]}):l}function Ho({p:e,item:t,off:n}){let r=Fn(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,T.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,T.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,T.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,T.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 jo(e){let t=se(e.theme),n=Cn(e.level,V(Q(e.locale)));return(0,T.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 Vo(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,T.jsxs)(T.Fragment,{children:[e.slice(0,r),(0,T.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Xn(e){let t=se(e.theme),n=Wt(e.locale),[r,o]=(0,mt.useState)(0);ue(()=>He(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,T.jsx)(Gt,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",c=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,l=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,T.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,T.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,T.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,T.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,T.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,T.jsx)(jo,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,T.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,T.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[c?(0,T.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:c}):null,(0,T.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:Vo(e.title,e.accent,t.paint("accentText"))}),e.actions,l?(0,T.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,T.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,T.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,T.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,T.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,T.jsx)("span",{}),i]}):null]}),(0,T.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,T.jsx)(Vt.Provider,{value:r,children:(0,T.jsx)(Te.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,T.jsxs)(T.Fragment,{children:[m,u]}):u]})}function Kt(e){let t=se(e.theme),n=Wt(e.locale),r=e.height??220;if(ue(()=>He(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,T.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,T.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,T.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,T.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,T.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,T.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,T.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,T.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,T.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,T.jsx)(T.Fragment,{children:e.children})}var Ie=A(j(),1);var ee=A(j(),1);var z=A(_(),1),dt=60;var ft={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Yn(e){let{c:t,events:n}=e,r=(0,ee.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,ue(()=>{He()},[]);let i=n.length,s=!e.noNav&&i>0,c=(0,ee.useContext)(Te),l=e.ariaLabel??c??e.kind,m=(0,ee.useMemo)(()=>s?`${n.length}${n.slice(0,dt).map(p=>`${p.label}${p.series??""}${p.formatted??p.value??""}`).join("")}`:"",[n,s]),u=(0,ee.useMemo)(()=>(0,z.jsx)(Wo,{label:l,events:n,t:t.t}),[l,m,t.t]),d=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let p=()=>{d.current=null};return window.addEventListener("scroll",p,{capture:!0,passive:!0}),window.addEventListener("resize",p,{passive:!0}),()=>{window.removeEventListener("scroll",p,{capture:!0}),window.removeEventListener("resize",p)}},[]),(0,ee.useEffect)(()=>{d.current=null},[t.width,t.height]);let h=p=>{if(p.target!==p.currentTarget)return;if(e.onKey?.(p)){p.preventDefault();return}let C=t.active,R;switch(p.key){case"ArrowRight":case"ArrowDown":R=C===null?0:(C+1)%i;break;case"ArrowLeft":case"ArrowUp":R=C===null?i-1:(C-1+i)%i;break;case"Home":R=0;break;case"End":R=i-1;break;case"Escape":if(C===null)return;R=null;break;case"Enter":case" ":C!==null&&(p.preventDefault(),t.click(C));return;default:return}p.preventDefault(),t.setActive(R,"keyboard")},{via:f,node:g,setActive:k}=t;(0,ee.useEffect)(()=>{if(f!=="touch"||!g)return;let p=C=>{g.contains(C.target)||k(null)};return document.addEventListener("pointerdown",p),()=>document.removeEventListener("pointerdown",p)},[f,g,k]);let x=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,M=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,v=typeof e.renderTip=="function"&&x?e.renderTip(x):null,b=e.announce??(t.via==="keyboard"&&x?`${x.label}${x.series?` ${x.series}`:""}: ${x.formatted??x.value??""} (${(t.active??0)+1}/${i})`:""),N;if($){let p=$.x*M,C=t.width*M,R=`clamp(${(4-p).toFixed(1)}px, -50%, calc(${(C-p-4).toFixed(1)}px - 100%))`,I=$.y<64;N={position:"absolute",left:p,top:$.y*M,transform:`translate(${R}, ${I?"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*M-8)}}let D=p=>{d.current=null,p.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},P=p=>p?C=>{let R=d.current??(d.current=C.currentTarget.getBoundingClientRect());R.width&&p((C.clientX-R.left)/R.width*t.width,(C.clientY-R.top)/R.height*t.height,C)}:void 0,E=P(e.onPointerMove),L=P(e.onPointerDown),F=E||L?p=>{p.pointerType==="touch"&&E?.(p),L?.(p)}:void 0,S=P(e.onPointerUp),w=Kn(e.theme);return(0,z.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":l,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:p=>{t.via==="keyboard"&&!p.currentTarget.contains(p.relatedTarget)&&t.setActive(null)},onPointerLeave:D,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"),...w,...e.style},children:[t.pending?null:e.underlay,(0,z.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:E,onPointerDown:F,onPointerUp:S,onPointerCancel:S,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,z.jsx)("title",{id:o,children:l}),(0,z.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,z.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,z.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:N,children:v??(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.rows.map((p,C)=>(0,z.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,z.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(p.strong?"ink":"muted")},children:[p.color?(0,z.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:p.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,p.label]}),(0,z.jsx)("span",{style:{fontWeight:p.strong===!1?500:700},children:p.value})]},C))]})}):null,(0,z.jsx)("span",{className:"ztd-sr",style:ft,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function Wo({label:e,events:t,t:n}){return(0,z.jsx)("div",{className:"ztd-sr",style:ft,children:(0,z.jsxs)("table",{children:[(0,z.jsx)("caption",{children:n.table(e)}),(0,z.jsxs)("tbody",{children:[t.slice(0,dt).map((r,o)=>(0,z.jsxs)("tr",{children:[(0,z.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,z.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>dt?(0,z.jsx)("tr",{children:(0,z.jsx)("td",{colSpan:2,children:n.more(t.length-dt)})}):null]})]})})}function ht(e){let t=e.baseline??"central";return(0,z.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}),le=y("label","string",!0,"Item name field"),Y=y("value","number",!0,"Value field"),Go=[le,Y],Ko=[le,Y],Uo=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],Xo=[le,Y],Yo=[y("label","string",!0,"Leaf (lowest level) name"),Y,y("group","string",!1,"Parent group field")],qo=[y("label","string",!0,"Leaf name"),Y,y("group","string",!1,"Parent group field")],Jo=[le,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],Zo=[le,Y],Qo=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),Y],ea=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),Y],ta=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],na=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],Jn=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),ra=[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}),Jn],oa=[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}),Jn],aa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],ia=[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})],sa=[le,Y],la=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],ca=[le,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],ua=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],ma=[le,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],da=[le,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],fa=[le,Y],ha=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],ga=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],pa=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),Y],ba=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),Y],ya=[y("date","date",!0,"Date field"),Y],xa=[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)")],ka=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],wa=[y("label","string",!1,"Row name field")],va=[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")],$a=[le,Y],Ca=[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})],Ma=[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)")],Ta=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),Y],Sa=[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")],qn={pie:Go,donut:Ko,funnel:Uo,waffle:Xo,treemap:Yo,sunburst:qo,waterfall:Jo,pareto:Zo,marimekko:Qo,heatmap:ea,radar:ta,bubble:na,line:ra,area:oa,stream:aa,bar:ia,radialBar:sa,gauge:la,bullet:ca,sparkline:ua,slope:ma,dumbbell:da,lollipop:fa,beeswarm:ha,ridgeline:ga,sankey:pa,chord:ba,calendar:ya,bump:xa,box:ka,parallel:wa,candlestick:va,segmented:$a,skyline:Ca,histogram:Ma,scatter:Sa,tileMap:Ta},Re={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:"타일 격자 지도"}};function Zn(e,t){return t==="ko"?e.nameKo:e.name}function Qn(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var er=["line","area","bar","scatter"],tr=24,Ut=["line","area","bar","scatter"];function Xt(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function nr(e,t,n){return Ut.includes(e)&&!Xt(e,t,n).length}function rr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Aa={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"};function gt(e){let t=qn[e]?e:Aa[e]??Object.keys(Re).find(n=>n.toLowerCase()===e.toLowerCase()||Re[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Re[t]))return{type:t,component:Re[t].component,name:Re[t].name,nameKo:Re[t].nameKo,encoding:qn[t]}}function or(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 gt(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 ar(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Fa(e,t){if(e==null||typeof e!="object")return;let n=e;if(ar(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!ar(r,o))return;r=r[o]}return r}}function he(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 Pe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Fa(r,n)}function De(e,t){let n=Pe(e,t);return(r,o)=>he(n(r,o))}function xe(e,t){let n=Pe(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 Le(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Na(e){let t=[],n=!1;for(let c=0;c<e.length&&c<4e3;c++){let l=e[c];if(l==='"')n=!n;else if(!n&&(l===`
23
+ `||l==="\r"))break;t.push(n?"":l)}let r=t.join(""),o=c=>r.split(c).length-1,a=[","," ",";","|"],i=",",s=0;for(let c of a){let l=o(c);l>s&&(s=l,i=c)}return i}var Ra=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function ir(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Ra.test(t)||/^[-+]?\.\d+$/.test(t)){let n=he(t);if(Number.isFinite(n))return n}return t}function Ce(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Na(o),i=[],s=[],c="",l=!1;for(let f=0;f<o.length;f++){let g=o[f];l?g==='"'?o[f+1]==='"'?(c+='"',f++):l=!1:c+=g:g==='"'&&!c.trim()?(l=!0,c=""):g===a?(s.push(c),c=""):g===`
24
+ `||g==="\r"?(g==="\r"&&o[f+1]===`
25
+ `&&f++,s.push(c),i.push(s),s=[],c=""):c+=g}(c!==""||s.length)&&(s.push(c),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?ir(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((g,k)=>[String(k),u(g)])));let d=[],h=new Set;return m[0].forEach((f,g)=>{let k=f.trim()||`col${g+1}`,x=k;for(let $=2;h.has(x);$++)x=`${k}_${$}`;h.add(x),d.push(x)}),m.slice(1).map(f=>Object.fromEntries(d.map((g,k)=>[g,u(f[k]??"")])))}function Yt(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,c)=>[s,r&&typeof i[c]=="string"?ir(i[c]):i[c]??null])))}function Pa(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,c)=>Object.fromEntries(a.map(l=>[l,e[l][c]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function sr(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 ke(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ke(JSON.parse(t))}catch{}return Ce(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Yt(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)?ke(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Yt(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)?ke(t.rows):Array.isArray(t.values)?Yt(t.values):Array.isArray(t.items)?ke(t.items):Array.isArray(t.results)?ke(t.results):Pa(t)}return[]}function pt(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 qt(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=(c,l)=>{let m=e[c][l];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let c=0;for(let l=1;l<r;l++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,l),f=h-i(d,l-1),g=0;for(let k=0;k<d;k++)g+=i(k,l)-i(k,l-1);m+=h,u+=(f/2+g)*h}m&&(c-=u/m),s[l]=c}}for(let c=0;c<r;c++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][c],g=Number.isFinite(f)?f:0;g>=0?(o[h][c]=u,u+=g,a[h][c]=u):(o[h][c]=d,d+=g,a[h][c]=d)}continue}let l=0;for(let u=0;u<n;u++)l+=i(u,c);let m=t==="silhouette"?-l/2:s[c];for(let u=0;u<n;u++){let d=i(u,c);t==="expand"&&(d=l?d/l*100:0),o[u][c]=m,m+=d,a[u][c]=m}}if(t==="wiggle"&&r){let c=1/0,l=-1/0;for(let u=0;u<r;u++)c=Math.min(c,o[0]?.[u]??0),l=Math.max(l,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 lr(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 cr(e){let t=e.length,n=e.map(l=>{let m=0,u=-1/0;return l.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(l=>l.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(l,m)=>m).sort((l,m)=>n[l]-n[m]),a=[],i=[],s=0,c=0;for(let l of o)s<c?(a.push(l),s+=r[l]):(i.push(l),c+=r[l]);return[...i.reverse(),...a]}var Da=Math.PI*2;function Me(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function ur(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function dr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function mr(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 bt=new Map;function ce(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=bt.get(o);if(a===void 0){let i=0,s=0;for(let c=0;c<r.length;c++){let l=r.charCodeAt(c);dr(l)?i+=mr(l):s+=mr(l)}a=i+s*(n>=600?1.07:1),bt.size>5e3&&bt.clear(),bt.set(o,a)}return a*t}function yt(e,t,n,r=400){if(e=e.trim(),ce(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let c=a+i+1>>1;ce(e.slice(0,c)+o,n,r)<=t?a=c:i=c-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(dr(s.charCodeAt(0))?2:3)?"":s+o}var hr=A(_(),1),La=e=>Array.isArray(e)&&e.length===2;function fr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&La(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var pr=A(_(),1),Jt=10.5;function Ea(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=>Ne(i,{locale:n,maximumFractionDigits:a}))}function gr(e,t,n){let r=18;for(let o of Ea(e,t,n))r=Math.max(r,ce(o,Jt));return Math.ceil(r+8)}function Zt(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 Ee(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,c=Zt(i,n),l=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/c-1e-9)*c,d=Math.floor(o/c+1e-9)*c;l=[o===0?0:o-d<=c*.3?d:o-i*s,a===0?0:u-a<=c*.3?u:a+i*s];let h=Zt(l[1]-l[0],n);if(h===c)break;c=h}return l}function br(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Zt(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let c=s,l=0;c<=o+a*1e-9&&l<200;c+=a,l++)i.push(Number((Math.round(c/a)*a).toPrecision(12)));return i}function Qt(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(c=>o+(c-n)*i);return s.domain=e,s.range=t,s.invert=c=>i===0?n:n+(c-o)/i,s.ticks=(c=4)=>br(n,r,c),s}function en(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]=Ee(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function _a(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(l,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of l){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}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 c=i([1,2,3,4,5,6,7,8,9]);return c.length>=2?c:br(e,t,3)}function yr(e,t){let n=Qt([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=()=>_a(e[0],e[1],Math.abs(t[1]-t[0])),r}function We(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 Ia=864e5;function xr(e,t,n,r=J){let o=t-e;if(!(o>0))return[{t:e,label:Ve(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Ia,i=[],s=new Date(e),c=new Date(e).getFullYear()===new Date(t).getFullYear(),l=(m,u,d,h=!1)=>{let f=new Date(m),g=-1,k=0;for(;f.getTime()<=t&&k++<500;){if(f.getTime()>=e){let x=f.getFullYear(),$=h&&!c&&x!==g;i.push({t:f.getTime(),label:Ve(f,{locale:r,...d,...$?{year:"numeric"}:{}})}),g=x}u(f)}};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(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),l(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());l(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),l(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(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);l(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),l(h,g=>g.setMonth(g.getMonth()+d),{month:"short"},!0)}}return i}function kr(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 c=o(i);return c>=0?(r[c]||(a[c]=t(c),r[c]=1),a[c]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var Oa=(e,t,n)=>e==="date"?st(t,n)?.getTime()??NaN:he(t);function Ba(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&jn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ge(e,t,n,r,o={}){let a=Pe(t,"x"),i=Array.isArray(n),s=i?n:null,c=i?null:Pe(n,"y"),l=!i&&r!==void 0?Pe(r,"series"):null,m=e.map((w,p)=>a(w,p)),u=o.xType??Ba(m),d=o.locale??J,h,f,g;if(u==="band"){let w=m.map(C=>String(C??""));h=Le(w);let p=new Map(h.map((C,R)=>[C,R]));f=h.map((C,R)=>R),g=Int32Array.from(w,C=>p.get(C)??-1)}else{let w=u==="date"?o.dayFirst??Vn(m):void 0,p=m.map(I=>Oa(u,I,w)),C=Array.from(new Set(p.filter(I=>Number.isFinite(I)))).sort((I,K)=>I-K),R=new Map(C.map((I,K)=>[I,K]));f=C,h=C.map(String),g=Int32Array.from(p,I=>R.get(I)??-1)}let k=o.dateFormat,x=w=>typeof w=="string"?it(w.trim())?.[3]:void 0,$=u==="date"&&m.length<5e3?x(m[0]):void 0,M=($===2||$===3)&&m.every(w=>x(w)===$),v=M&&$===3;if(u==="date"&&!k){let w=f.length>1?f[f.length-1]-f[0]:0;k=M&&$===2||w>864e5*120?{month:"short"}:w<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},w>864e5*800&&(k={year:"numeric",month:"short"})}let b;if(u==="band")b=h;else if(v&&!o.dateFormat){let w=V(d)==="ko";b=f.map(p=>{let C=new Date(p),R=Math.floor(C.getMonth()/3)+1;return w?`${C.getFullYear()}년 ${R}분기`:`Q${R} ${C.getFullYear()}`})}else{let w=f.every(Ht),p=u==="date"?new Intl.DateTimeFormat(d,k):new Intl.NumberFormat(d,w?{useGrouping:!1}:{maximumFractionDigits:6});b=f.length>1e3?kr(f.length,C=>p.format(f[C])):f.map(C=>p.format(C))}let N=s?[...s]:l?Le(e.map((w,p)=>String(l(w,p)??""))):[""],D=new Map(N.map((w,p)=>[w,p])),P=N.map(()=>new Array(h.length).fill(NaN)),E=N.map(()=>new Array(h.length).fill(null)),L=o.aggregate??"sum",F=L==="mean"?N.map(()=>new Uint32Array(h.length)):null,S=(w,p,C,R)=>{let I=P[w][p];L==="last"?P[w][p]=C:L==="count"?P[w][p]=(Number.isFinite(I)?I:0)+1:L==="mean"?Number.isFinite(C)&&(P[w][p]=(Number.isFinite(I)?I:0)+C,F[w][p]++):P[w][p]=Number.isFinite(I)?I+(Number.isFinite(C)?C:0):C,E[w][p]=R};for(let w=0;w<e.length;w++){let p=g[w];if(p<0)continue;let C=e[w];if(s)for(let R=0;R<s.length;R++)S(R,p,he(C[s[R]]),C);else{let R=l?D.get(String(l(C,w)??""))??0:0;S(R,p,he(c(C,w)),C)}}if(F)for(let w=0;w<P.length;w++)for(let p=0;p<h.length;p++)F[w][p]>1&&(P[w][p]/=F[w][p]);return{type:u,keys:h,xnum:f,labels:b,series:N,values:P,rows:E}}var za=140,Ue=12,wr=14,tn=20,vr=12.5;function Ha(e,t,n=tr){let r=xe(t,t),o=new Map;e.forEach((i,s)=>{let c=r(i,s),l=o.get(c);l?l.push(i):o.set(c,[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 ja(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Ue)/(za+Ue))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Va(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Ue)/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 Ke=e=>e.filter(Number.isFinite);function xt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=De(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return Ke(n)}function $r(e,t,n,r,o,a){return Ge(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Wa(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),c=r.yDomain,l=c&&(!s||c[0]>0&&c[1]>0)?c:void 0;if(e==="scatter"){let b=t.flat(),N=r.refLines??{},[D,P]=We([...xt(b,r.x??"x"),...Ke([Number(N.x)])]),[E,L]=We([...xt(b,r.y??"y"),...Ke([Number(N.y)])].filter(S=>!s||S>0)),F=r.zero??!1;return{y:l??(s?en(E,L,i):Ee(E,L,i,{zero:F,pad:.08})),x:r.xDomain??Ee(D,P,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(""),h=n.every(b=>b.keys.join("")===d),f=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),g=r.xDomain??(!m&&f?We(n.flatMap(b=>Ke(b.xnum))):void 0),k=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(k==="percent")return{x:g,sameKeys:h};if(l)return{y:l,x:g,sameKeys:h};let x=[];t.forEach((b,N)=>{let D=n[N];if(k==="stacked"||k==="auto"&&D.series.length>1){let E=qt(D.values,"zero");E.y0.forEach(L=>x.push(...L)),E.y1.forEach(L=>x.push(...L))}else D.values.forEach(E=>x.push(...E));m&&!u&&r.line!==void 0&&$r(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>x.push(...E)),m||x.push(...xt(b,r.lower),...xt(b,r.upper))}),m&&x.push(0),u||x.push(...fr(r.annotations));for(let b of r.referenceLines??[])x.push(b.y);r.signColors&&x.push(Number(r.baseline??0));let[$,M]=We(Ke(x).filter(b=>!s||b>0));return{y:s?en($,M,i):m?Ee($,M,u?Math.max(2,Math.round(o/120)):i):Ee($,M,i,{zero:r.zero??e==="area"}),x:g,sameKeys:h}}function Ga(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let c=Ge(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),l=(r.yScale==="log"&&e==="line"?yr:Qt)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=gr(l,On(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),d=r.endLabels??n.some(b=>b.series.length>1),h=m+6,f=a-(d?Math.min(a*.28,Math.max(...u.map(b=>ce(b,11,700)),20)+14):10),g=c.keys.length,[k,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=c.type==="number"?g>12:g>xr(k,x,Math.max(2,Math.floor((f-h)/64)),s).length;if(c.type==="band"||!g||$)return;let M=b=>h+(c.xnum[b]-k)/(x-k)*(f-h),v=b=>ce(c.labels[b],Jt);for(let b=1;;b++){let N=Array.from({length:Math.ceil(g/b)},(D,P)=>P*b);if(b>=g||N.every((D,P)=>!P||M(D)-M(N[P-1])>=(v(D)+v(N[P-1]))/2+8))return N.map(D=>({value:c.xnum[D],label:c.labels[D]}))}}function Ka(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 Ua(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${Ka(`${e}|${t}|${o}|${pt(r)}`)}`}function Xa(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 Ya={en:{intro:(e,t)=>`${Se(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:"(빈 값)"}};function Cr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Ha(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,c=ja(s,i,e.columns),{pw:l,ph:m}=Va(s,c,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(F=>$r(t,F,n,n.y,n.series,n.aggregate)),h=u?Wa(t,o,d,n,l,m):{sameKeys:!1},f=u?Ga(t,o,d,n,h,l,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",k=u&&(!g||h.sameKeys),x=u&&(g||h.x!==void 0||h.sameKeys),$=new Set(Xa(e.highlight,r)?[e.highlight].flat():[]),M=$.size>0,v=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??Ua(t,e.by,n,e.data),N=at($e(n.format,e.locale),n.unit),D=Ya[e.lang],P=[],E=r.map(F=>F===""?D.blank:F);return{panels:r.map((F,S)=>{let w=o[S],p=E[S],C=S%c,R;if(t!=="scatter"){let K=d[S],ve=oe=>K.values.reduce((fe,ze)=>fe+(Number.isFinite(ze[oe])?ze[oe]:0),0),B=K.keys.map((oe,fe)=>fe).filter(oe=>K.values.some(fe=>Number.isFinite(fe[oe]))),q=B[B.length-1];P.push({first:B.length?ve(B[0]):NaN,last:B.length?ve(q):NaN,total:B.reduce((oe,fe)=>oe+ve(fe),0)}),t!=="bar"&&K.series.length===1&&q!==void 0&&(R=N(K.values[0][q]))}else P.push({first:NaN,last:NaN,total:w.length});let I={data:w,width:l,height:m,ariaLabel:e.title?`${e.title}, ${p}`:p,syncId:b,highlight:M?$.has(F)?v?()=>!0:void 0:"none":e.highlight,showYAxis:!k||C===0,showXAxis:!x||S+c>=i};return h.y&&(I.yDomain=h.y),h.x&&(I.xDomain=h.x),f&&(I.xTicks=f),{value:F,label:p,props:I,last:R,isPicked:$.has(F)}}),cols:c,pw:l,ph:m,isPanelPick:M,description:qa(t,e.by,E,P,a,N,D)}}function qa(e,t,n,r,o,a,i){let s=i.intro(n.length,t),c=l=>ur(r.map(m=>m[l]));if(e==="line"||e==="area"){let l=c("last");l>=0&&(s+=i.endHigh(n[l],a(r[l].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 l=c("total");l>=0&&(s+=e==="bar"?i.total(n[l],a(r[l].total)):i.points(n[l],r[l].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var te=A(j(),1);function Ja(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Za(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function Sr(e,t=!0){let[n,r]=(0,te.useState)({visible:!t,near:!t});return(0,te.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=Za(i[i.length-1],.25);r(c=>c.visible===s?c:{...c,visible:s,near:c.near||s})},{threshold:Ja(.25),rootMargin:"0px 0px -8% 0px"}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(c=>c.near===s.isIntersecting?c:{...c,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 Mr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function kt(e){let[t,n]=(0,te.useState)(null),[r,o]=(0,te.useState)(e??null),a=(0,te.useCallback)(i=>{n(i),i&&e===void 0&&o(Mr(i))},[e]);return ue(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=l=>o(m=>m!==null&&Math.abs(m-l)<.5?m:l),s=()=>i(Mr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let c=new ResizeObserver(l=>{let m=l[l.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return c.observe(t),()=>c.disconnect()},[t,e]),[t,a,r]}var Qa=()=>()=>{};function _e(){return(0,te.useSyncExternalStore)(Qa,()=>!0,()=>!1)}var Tr="(prefers-reduced-motion: reduce)";function wt(e="auto"){let[t,n]=(0,te.useState)(()=>ae&&typeof window.matchMedia=="function"?window.matchMedia(Tr).matches:!1);return(0,te.useEffect)(()=>{if(e!=="auto"||!ae||typeof window.matchMedia!="function")return;let r=window.matchMedia(Tr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var me=A(_(),1),ei=60,ti=420;function Ar(e){let t=se(),n=e.chartProps??{},[,r,o]=kt(e.width),a=e.width??(o||480),i=Q(e.locale??n.locale),s=V(i),c=(0,Ie.useContext)(Te),l=e.title??c,m=(0,Ie.useMemo)(()=>Cr({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:l,locale:i,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,x)=>typeof x=="function"?String(x):x),e.highlight,e.syncId,a,e.height,l,i,s]),u=`${(0,Ie.useId)().replace(/:/g,"")}fd`,d=wt(n.reducedMotion??"auto"),h=_e(),f=Qe({motion:{enabled:n.animate!==!1&&!d&&ae},hydrated:h},{waiting:!1,generation:0}),g=e.chart;return(0,me.jsxs)("div",{ref:r,role:"group","aria-label":l,"aria-describedby":u,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,me.jsx)("p",{id:u,style:ft,children:e.description??m.description}),(0,me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${m.cols}, minmax(0, 1fr))`,columnGap:Ue,rowGap:wr},children:m.panels.map((k,x)=>{let $=t.paint(k.isPicked?"accentText":m.isPanelPick?"muted":"ink");return(0,me.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...Ze(f,!1,"fade",x*ei,ti)},children:[(0,me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:tn,fontSize:vr,fontWeight:700,lineHeight:`${tn}px`,color:$},children:[(0,me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.label}),k.last!==void 0?(0,me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:k.last}):null]}),(0,me.jsx)(g,{...n,...k.props})]},k.value)})})]})}function de(e,t,n,r,o="max"){let a=new Set,i=n.length,s=l=>{if(i&&l!=="none"){if(l==="first")a.add(0);else if(l==="last")a.add(i-1);else if(l==="max"||l==="min"){let m=-1,u=l==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(l==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((l,m)=>{m<i&&l!==null&&l!==void 0&&e(l,m)&&a.add(m)}),a;let c=Array.isArray(e)?e:[e];for(let l of c)typeof l=="number"?l>=0&&l<i&&a.add(l):l==="max"||l==="min"||l==="first"||l==="last"||l==="none"?s(l):n.forEach((m,u)=>{m===l&&a.add(u)});return a}var re=A(j(),1);async function ni(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(V(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ce(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 Ce(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ce(a)}async function ri(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 ni(a,t.parse,o,t.locale)}return t.select&&(r=sr(r,t.select)),t.transform?t.transform(r):ke(r)}function Fr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,re.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,c]=(0,re.useState)(0),l=Q(t.locale),m=(0,re.useRef)(t);m.current={...t,locale:l};let u=(0,re.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),g=(0,re.useRef)(!1);(0,re.useEffect)(()=>{let x=u.current;if(!x||!r){i(v=>v.status==="loading"?{...v,status:"idle"}:v);return}let $=new AbortController,M=!0;return g.current=!0,i(v=>({...v,data:o?v.data:[],status:"loading",error:null})),ri(x,{...m.current,signal:$.signal}).then(v=>{M&&i({data:v,status:"success",error:null,updatedAt:Date.now()})}).catch(v=>{!M||$.signal.aborted||i(b=>({...b,status:"error",error:v instanceof Error?v:new Error(String(v))}))}).finally(()=>{M&&(g.current=!1)}),()=>{M=!1,g.current=!1,$.abort()}},[d,r,s,f,o]),(0,re.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{g.current||c($=>$+1)},n);return()=>clearInterval(x)},[n,r]);let k=(0,re.useCallback)(()=>c(x=>x+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:k}}var rn=A(_(),1),oi=["csv","svg","png"],ai=/^[=+\-@\t\r\n=+-@]/,ii=/var\(|color-mix\(/;function Nr(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?Bn(e.getTime()):String(e);return`"${(ai.test(t)&&!Number.isFinite(he(t))?`'${t}`:t).replace(/"/g,'""')}"`}function si(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function li(e,t){return`\uFEFF${[t.map(Nr),...e.map(r=>t.map(o=>Nr(r[o])))].map(r=>r.join(",")).join(`\r
26
+ `)}\r
27
+ `}function ci(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function nn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Rr=2,we=16;function Pr(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 Dr(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 Lr(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,c]=[a+we*2,i+we*2],l=o.cloneNode(!0),m=l.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,g)=>{let k;for(let x of Array.from(f.attributes)){if(!ii.test(x.value))continue;let $=(k??(k=getComputedStyle(f))).getPropertyValue(x.name);$&&m[g].setAttribute(x.name,Pr($,u))}}),l.removeAttribute("style");for(let[f,g]of Object.entries({viewBox:`${-we} ${-we} ${s} ${c}`,width:s*t,height:c*t,"font-family":getComputedStyle(o).fontFamily}))l.setAttribute(f,String(g));let d=Pr(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=l.querySelector("desc")?.nextSibling??l.firstChild;l.insertBefore(Dr("rect",{x:-we,y:-we,width:s,height:c,fill:d}),f),h&&l.insertBefore(Dr("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(l),w:s,h:c,vw:a,vh:i,bg:d,canvas:h}}function ui(e,t){let n=Lr(e,Rr,!1);if(!n)return;let r=Rr,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,we*r,we*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(c=>c&&nn(c,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Er(e){let t=se(e.theme),n=V(Q(e.locale))==="ko",r=ci(e.filename),o=(a,i)=>{if(a==="csv")return nn(new Blob([li(e.data,e.columns?.length?e.columns:si(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return ui(i,r);let s=Lr(i,1,!0);s&&nn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,rn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:oi.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,rn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:c=>o(a,c.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 Ir=A(_(),1);function _r(e,t=J){let n=$e(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?Ve(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let c=!1,l=s.replace(Hn,(m,u)=>o(a,u.trim())??(c=!0,""));c||i.push(l)}return i.length?i.map((s,c)=>(0,Ir.jsx)("div",{children:s},c)):null}}function Or(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 Ce(t.csv)}return null}var Gr=A(j(),1);var G=A(j(),1);function Br(e,t){let n=se(e.theme),[r,o,a]=kt(e.width),i=_e(),s=e.width??(a||t.ssrWidth||480),c=typeof t.height=="function"?t.height(s):t.height,l=e.height??c,m=wt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ae,d=Sr(r,e.animateOnView!==!1&&u),h=Q(e.locale),f=V(h),g=(0,G.useMemo)(()=>$e(e.format,h,t.format),[e.format,h,t.format]),k=(0,G.useCallback)(B=>ot(B,{locale:h}),[h]),x=(0,G.useMemo)(()=>at(g,e.unit),[g,e.unit]),$=(0,G.useMemo)(()=>pt(e.data),[e.data]),[M,v]=(0,G.useState)(null),[b,N]=(0,G.useState)(null),D=(0,G.useRef)([]),P=(0,G.useRef)(e.onHover);P.current=e.onHover;let E=(0,G.useRef)(e.onClick);E.current=e.onClick;let L=(0,G.useRef)(null),F=(0,G.useRef)(null),S=(0,G.useRef)(null),w=(0,G.useCallback)((B,q="pointer")=>{if(S.current!==B){S.current=B;let oe=B===null?null:D.current[B]??null;queueMicrotask(()=>P.current?.(oe)),F.current?.(B)}L.current=B===null?null:q,v(B),N(L.current)},[]),p=(0,G.useCallback)(B=>{L.current!=="keyboard"&&(L.current=B===null?null:"sync",v(B),N(L.current))},[]),C=(0,G.useCallback)(B=>{let q=D.current[B];q&&E.current?.(q)},[]),R=Un(e.replayKey),I=e.width!==void 0||(a??0)>0,K={enabled:u,active:d.visible&&I,near:d.near,replayKey:R,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},ve=(0,G.useCallback)((B,q=1)=>M===null||M===B?q:q*.38,[M]);return{p:n,width:s,height:l,measured:I,responsive:e.width===void 0,pending:ae&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:K,fv:x,fmt:g,pct:k,locale:h,lang:f,t:f==="ko"?$n:vn,active:M,via:b,setActive:w,click:C,events:D,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:ve,sig:$,description:e.description,reduced:m,publish:F,applySync:p}}var W=A(j(),1);function mi(e){return 1-Math.pow(1-e,3)}function di(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function fi(e){return e==="easeInOut"?di:e==="linear"?t=>t:mi}function hi(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 Oe(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 vt(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 zr(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 Hr(e,t,n,r){if(!t||!n||t.length!==n.length)return Oe(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 c of Oe(s,n[i]))o.push(c)}return o.length===r?o:Oe(e,r)}var $t=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||!vt(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),zr(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=vt(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),c=r>0?Math.min(a*r,240):0;if(s){let l=i.to.length;s.from=Hr(s.cur,s.parts,i.parts,l),s.vel=Hr(s.curVel,s.parts,i.parts,l),s.parts=i.parts,s.to=i.to.slice(),zr(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):c),s.done=vt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let l=this.make(i,i.enter??i.from??i.to,n+c,0);l.done=vt(l.from,l.to),this.tracks.set(i.key,l)}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=Oe(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=fi(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let c=(t-s.t0)/1e3,l=s.to.length;if(s.from.length!==l&&(s.from=Oe(s.from,l)),s.vel.length!==l&&(s.vel=Oe(s.vel,l)),s.cur.length!==l&&(s.cur=new Array(l).fill(0),s.curVel=new Array(l).fill(0)),!(c>0)){for(let u=0;u<l;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*c),d=a*c>=8&&a*c<20,h=0;for(let f=0;f<l;f++){let g=s.from[f]-s.to[f],k=s.vel[f]+a*g;s.cur[f]=s.to[f]+(g+k*c)*u,s.curVel[f]=(s.vel[f]-a*k*c)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*c>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*c)*u)}else{let u=Math.min(1,c/o),d=r(u),h=hi(this.easing,u)/o;for(let f=0;f<l;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<l;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}},Xe=new Set,Ct=0;function jr(e){Ct=0;let t=Array.from(Xe);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Xe.delete(n)}Xe.size&&typeof requestAnimationFrame<"u"&&(Ct=requestAnimationFrame(jr))}function Vr(e){return Xe.add(e),!Ct&&typeof requestAnimationFrame<"u"&&(Ct=requestAnimationFrame(jr)),()=>{Xe.delete(e)}}function gi(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 Wr(e,t){let n=(0,W.useMemo)(()=>gi(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:c="spring",duration:l=900,stagger:m=0}=t,u=(0,W.useRef)(null),d=(0,W.useRef)("init"),h=(0,W.useRef)(null),f=(0,W.useRef)(s),g=(0,W.useRef)(i),k=(0,W.useRef)(!1),x=(0,W.useRef)(0),[,$]=(0,W.useState)(0),M=(0,W.useRef)(null),v=(0,W.useRef)(!0);u.current||(u.current=new $t,u.current.configure(c,l),u.current.snap(n),h.current=n);let b=u.current;if(b.configure(c,l),h.current!==n){let F=d.current,S=!Object.is(f.current,s);b.sameTargets(n)?b.refreshData(n):!r||F==="init"?b.snap(n):F==="idle"?b.hold(n):F==="running"||S?b.update(n,tt(),m):b.snap(n),h.current=n,f.current=s}let N=(0,W.useRef)(()=>!1);N.current=F=>{if(!v.current)return!1;let S=b.step(F);return!S&&d.current==="running"&&(d.current="done"),$(w=>(w+1)%1e9),S||(M.current=null),S};let D=(0,W.useCallback)(()=>{if(!ae||M.current||!b.animating)return;let F=S=>N.current(S);M.current=Vr(F)},[b]);ue(()=>{let F=!Object.is(g.current,i);if(g.current=i,!r){(d.current!=="done"||b.animating)&&(b.snap(h.current??n),d.current="done",$(S=>S+1));return}d.current==="init"||F&&a?(b.hold(h.current??n),d.current="idle",k.current=!1,$(S=>S+1)):F&&(k.current=!0)},[r,i]),ue(()=>{!r||!a||!k.current||(k.current=!1,b.hold(h.current??n),d.current="idle",$(F=>F+1))},[a,r]),(0,W.useEffect)(()=>{r&&o&&d.current==="idle"&&(b.start(tt()),x.current+=1,d.current="running",D(),$(F=>F+1))},[r,o,i,b,D]),(0,W.useEffect)(()=>{b.animating&&D()}),(0,W.useEffect)(()=>(v.current=!0,()=>{v.current=!1,M.current?.(),M.current=null}),[]);let P=tt(),E=b.elapsed(P),L=r&&d.current==="idle";return{items:b.items(),get:F=>b.get(F),elapsed:L?0:E,fade:(F,S=320)=>L?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-F)/S)):1,waiting:L,animating:b.animating,generation:x.current}}var on=A(_(),1);function Kr(e,t,n,r,o){if(r)return o==="categorical"?ne(e,t,n):Pn(e,t,n);if(o==="categorical")return ne(e,t,n);let a=X(e,"strong"),i=X(e,"accent");return Array.from({length:t},(s,c)=>n.has(c)?i:a)}var pi=A(j(),1);var an=A(_(),1);var Ur=e=>e?"neutralStrong":"accent";var sn=A(_(),1);function Xr(e,t,n,r){if(typeof e!="function")return de(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 c=o.get(r(i,s));c!==void 0&&e(i,s)&&a.add(c)}),a}var bi=A(j(),1);var cn=A(_(),1),yi={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}, ${Se(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Yr={en:yi,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}일 이동평균`}},ln=["ink","muted","dim"];function qr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,ln.length)}var xi=A(j(),1);var to=A(_(),1),ki={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Se(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},wi={en:ki,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Jr=(e,t)=>wi[e].other(t);function Zr(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,Me(o.map(a=>a.value)))}}var Qr=e=>Number.isFinite(e)&&e>0?e:0;function eo(e,t,n,r){return r==="emphasis"?Rn(e,t,n):ne(e,t,n)}var vi=A(j(),1);var ao=A(_(),1);function no(e,t){return t===!1?e.map((n,r)=>r):cr(e)}function ro(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return de(e,t,t,r,"max")}function oo(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]=X(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?X(e,"neutral"):rt(e,1-i/Math.max(1,o.length-1))),r}var Be=A(j(),1);var ge=A(_(),1),$i={kind:"Waffle chart",share:"Share",cells:"Cells",count:e=>`${e}`,of:e=>`Out of ${e} cells:`},Ci={en:$i,ko:{kind:"와플 차트",share:"비중",cells:"칸",count:e=>`${e}칸`,of:e=>`${e}칸 중`}};function io(e,t,n){let r=Math.max(n??0,Me(e));if(!(r>0))return e.map(()=>0);let o=e.map(l=>Math.max(0,l)/r*t),a=o.map(l=>Math.floor(l)),s=(n===void 0?t:Math.min(t,Math.round(Me(e)/r*t)))-Me(a),c=o.map((l,m)=>({r:l-Math.floor(l),i:m})).sort((l,m)=>m.r-l.r);for(let l=0;s>0&&l<c.length;l++,s--)a[c[l].i]++;return a}function un(e){let t=Br(e,{height:O=>Math.max(160,Math.min(230,O*.5)),duration:520,stagger:7}),{p:n,width:r,height:o}=t,a=Ci[t.lang],i=Math.max(1,Math.round(e.cells??100)),s=Math.max(1,Math.round(e.columns??10)),c=Math.ceil(i/s),l=(0,Be.useMemo)(()=>{let O=xe(e.label,"label"),H=De(e.value,"value"),U=e.data.map((Z,Tt)=>({d:Z,i:Tt,label:O(Z,Tt),value:Math.max(0,H(Z,Tt)||0)})),be=de(e.highlight,U.map(Z=>Z.d),U.map(Z=>Z.label),U.map(Z=>Z.value),"first"),Mt=io(U.map(Z=>Z.value),i,e.total),qe=e.total??Me(U.map(Z=>Z.value));return{rows:U,hi:be,counts:Mt,total:qe}},[e.data,e.label,e.value,e.highlight,i,e.total]),m=(0,Be.useMemo)(()=>ne(n,l.rows.length,l.hi),[n,l]),u=e.summary!==!1&&r>=260,d=r<360?2.5:3.5,h=u?r*.58:r,f=Math.max(3,Math.min((h-(s-1)*d)/s,(o-(c-1)*d)/c)),g=s*f+(s-1)*d,k=c*f+(c-1)*d,x=(o-k)/2,$=(0,Be.useMemo)(()=>{let O=[];return l.counts.forEach((H,U)=>{for(let be=0;be<H;be++)O.push(U)}),O},[l.counts]),M=t.motion.stagger??7,v=[...l.hi][0]??-1,b=l.rows[v],N=l.total>0&&b?b.value/l.total*100:0,D=l.rows.filter((O,H)=>!l.hi.has(H)),P=e.summaryNote??D.map(O=>`${O.label} ${t.fv(O.value)}`).join(" · "),E=Math.max(14,(r-g)*.12),L=r-g-E,F=Math.max(24,Math.min(46,L*.32,o*.24)),S=u&&b?Math.min(L,Math.max(ce(t.pct(N),F,800),ce(e.summaryLabel??b.label,12.5,700),P?ce(P,11):0)):0,w=u?Math.max(0,(r-(g+E+S))/2):(r-g)/2,p=w+g+E,C=r-p,R=(0,Be.useMemo)(()=>[{key:"__n",to:[N],from:[0],delay:100,data:null}],[N]),I=t.motion.duration??520,K=Wr(R,{...t.motion,duration:I+i*M*.8}),ve=K.get("__n")?.[0]??N,{active:B,via:q,setActive:oe,click:fe}=t,ze=Qe(t,K),mo=(0,Be.useMemo)(()=>Array.from({length:i},(O,H)=>{let U=$[H]??-1,be=H%s,Mt=Math.floor(H/s),qe=U>=0?m[U]:null;return(0,ge.jsx)("rect",{className:"ztd-mark ztd-pop","data-k":U,x:w+be*(f+d),y:x+Mt*(f+d),width:f,height:f,rx:Math.min(f*.22,4),fill:qe?qe.fill:n.paint("neutralSoft"),opacity:U>=0&&B!==null&&B!==U?.38:void 0,stroke:U>=0&&B===U&&q==="keyboard"?n.paint("ink"):void 0,strokeWidth:1.5,style:Ze(ze,K.waiting,"pop",H*M,I)},H)}),[i,$,s,w,x,f,d,m,n,B,q,ze,K.waiting,K.generation,M,I]),fo=l.rows.map((O,H)=>({datum:O.d,index:H,key:O.label,label:O.label,value:O.value,formatted:`${t.fv(O.value)} · ${t.pct(l.total?O.value/l.total*100:0)}`})),dn=null;if(t.active!==null&&l.rows[t.active]){let O=l.rows[t.active],H=$.indexOf(t.active),U=w+(H>=0?H:0)%s*(f+d)+f/2,be=x+Math.floor((H>=0?H:0)/s)*(f+d);dn={x:U,y:be,title:O.label,rows:[{label:t.t.value,value:t.fv(O.value),color:m[t.active].fill},{label:a.share,value:t.pct(l.total?O.value/l.total*100:0)},{label:a.cells,value:a.count(l.counts[t.active])}]}}let ho=e.description??`${a.kind}. ${a.of(i)} ${l.rows.map((O,H)=>`${O.label} ${a.count(l.counts[H])}`).join(", ")}.`;return(0,ge.jsxs)(Yn,{c:t,kind:a.kind,ariaLabel:e.ariaLabel,description:ho,events:fo,tip:dn,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,ge.jsx)("g",{onPointerOver:O=>{let H=Number(O.target.getAttribute("data-k"));H>=0&&oe(H,O.pointerType==="touch"?"touch":"pointer")},onClick:O=>{let H=Number(O.target.getAttribute("data-k"));H>=0&&fe(H)},children:mo},K.generation),u&&b?(0,ge.jsxs)("g",{opacity:K.fade(250,300),children:[(0,ge.jsx)(ht,{x:p,y:o/2-F*.32,size:F,weight:800,fill:n.paint("ink"),letterSpacing:-1,children:t.pct(ve)}),(0,ge.jsx)(ht,{x:p,y:o/2+F*.42,size:12.5,weight:700,fill:n.paint("ink"),children:yt(e.summaryLabel??b.label,C-2,12.5,700)}),P?(0,ge.jsx)(ht,{x:p,y:o/2+F*.42+17,size:11,fill:n.paint("muted"),children:yt(P,C-2,11)}):null]}):null]})}var pe=A(_(),1);function so(e,t){let n=gt(e);return n?.type==="scatter"&&t?.size!==void 0?gt("bubble"):n}function Mi(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 Ti(e,t,n,r=!1){let o=so(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,c=new Set(!r&&Ut.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),l=u=>u.filter(d=>!c.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=xe(a.label,"label"),d=De(a.value,"value"),h=o.type==="waffle",f=t.map((v,b)=>({r:v,label:u(v,b),value:h?d(v,b):Qr(d(v,b))})),{kept:g,other:k}=h?{kept:f,other:null}:Zr(f,i.other,(v,b)=>({r:{},label:Jr(V(n),v),value:b})),x=de(s,g.map(v=>v.r),g.map(v=>v.label),g.map(v=>v.value),h?"first":"max"),$=k?[...g,k]:g,M=je(v=>h?ne(v,$.length,x):eo(v,$.length,x,i.colorMode));return $.map((v,b)=>({label:v.label,color:M[b]}))}if(o.type==="candlestick"){let u=qr(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Yr[V(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:ln[f],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let u=xe(a.series,"series"),d=Le(t.map((g,k)=>u(g,k)));if(d.length<2)return[];let h=Xr(s,t,d,u),f=je(g=>Nn(g,d.length,h));return l(d.map((g,k)=>({label:g,color:f[k],shape:"circle"})))}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 M=xe(a.series,"series");u=Le(t.map((v,b)=>M(v,b)))}let d=Xt(o.type,a,i);if(d.length){let M=de(s,u,u,u.map(()=>0),"none"),v=je(N=>ne(N,u.length,M)),b=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((N,D)=>({label:N,color:v[D]}));return[...l(b),...d.map((N,D)=>({label:N,color:Ur(D),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?lr(u.length,Array.isArray(i.negative)?i.negative.map(M=>u.indexOf(String(M))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=f>=0?new Set([f]):de(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return l(u.map((M,v)=>({label:M,color:g.has(v)?"accent":"neutralStrong",shape:"square"})));let k=i.colorMode,x=M=>ne(M,u.length,g);if((o.type==="line"||o.type==="area")&&(x=M=>Kr(M,u.length,g,o.type==="area",k)),o.type==="stream"){let M=Ge(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),v=no(M.values,i.reorder),b=ro(s,M.series,M.values);x=N=>oo(N,v,b)}let $=je(x);return l(u.map((M,v)=>({label:M,color:$[v],...o.type==="line"&&{shape:"line"}})))}return[]}function Si(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&er.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ai(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:c,description:l,...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:c,description:l}}function lo(e,t){let{spec:n}=e,r=so(n.type,n.encoding),o=(0,Ye.useMemo)(()=>Or(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Qn(n,e.locale),s=Q(i),c=V(s),l=Fr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=rr(n),u=(0,Ye.useMemo)(()=>m?_r(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[g,k]=(0,Ye.useState)(null);if(!r)return(0,pe.jsx)(Kt,{error:c==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let x=o??l.data,$=t[r.type],M={...n.options??{}},v={...Mi(r,n.encoding),...M,...u?{tooltip:u}:{},data:x,...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},b=n.card?.legend==="toggle"&&nr(r.type,n.encoding??{},M),N=g&&g.base===f?g.hidden:h;b&&(v.hidden=N);let D=S=>k(w=>{let p=w&&w.base===f?w.hidden:h;return{base:f,hidden:p.includes(S)?p.filter(C=>C!==S):[...p,S]}}),P=v.height??220,E=Si(n,r.type),L=a&&!x.length&&(l.loading||l.error||l.empty)?(0,pe.jsx)(Kt,{loading:l.loading,error:l.error,empty:l.empty,onRetry:l.reload,height:P,locale:i}):E?(0,pe.jsx)(Ar,{chart:$,...Ai(r.type,E,v)}):(0,pe.jsx)($,{...v});if(n.card){let S=n.card,w=S.legend==="auto"||S.legend==="toggle"?Ti(n,x,s,b):S.legend,p=w?.length?b?(0,pe.jsx)(Gt,{items:w,hidden:N,onToggle:D,locale:i}):w:void 0,C=S.download?(0,pe.jsx)(Er,{data:x,columns:or(n),filename:S.title??r.type,formats:Array.isArray(S.download)?S.download:void 0,locale:i}):void 0;L=(0,pe.jsx)(Xn,{number:S.number,title:S.title??Zn(r,c),subtitle:S.subtitle,legend:p,actions:C,source:S.source||void 0,note:S.note||void 0,accent:S.accent,takeaway:S.takeaway,level:S.level,sample:S.sample,replay:S.replay!==!1,className:e.className,locale:i,children:L})}let F=e.theme??n.theme;return F&&(L=(0,pe.jsx)(ct,{theme:F,children:L})),L}function Fi({cfg:e,components:t}){let n=_e();return lo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function uo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,co.hydrateRoot)(r,(0,mn.createElement)(ct,{theme:o.theme,cssVars:!0},(0,mn.createElement)(Fi,{cfg:o,components:{[e]:t}})))}uo("waffle",un);})();
@@ -0,0 +1,28 @@
1
+ (()=>{var go=Object.create;var mn=Object.defineProperty;var po=Object.getOwnPropertyDescriptor;var bo=Object.getOwnPropertyNames;var yo=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty;var Mt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ko=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of bo(t))!xo.call(e,o)&&o!==n&&mn(e,o,{get:()=>t[o],enumerable:!(r=po(t,o))||r.enumerable});return e};var N=(e,t,n)=>(n=e!=null?go(yo(e)):{},ko(t||!e||!e.__esModule?mn(n,"default",{value:e,enumerable:!0}):n,e));var G=Mt((Ri,dn)=>{dn.exports=globalThis.__ztdReact.react});var hn=Mt((Pi,fn)=>{fn.exports=globalThis.__ztdReact["react-dom/client"]});var I=Mt((Ki,Vn)=>{Vn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var cn=N(G(),1),mo=N(hn(),1);var qe=N(G(),1);var ut=N(G(),1);var gn=N(G(),1),Se=(0,gn.createContext)(void 0);var xn=N(G(),1);var wo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],pn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',bn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',xe={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:pn,monoFamily:bn,radius:18,radiusCode:14,radiusMark:4},Tt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:pn,monoFamily:bn,radius:18,radiusCode:14,radiusMark:4},St={dark:xe,light:Tt};function Je(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function At(e){let t={};for(let n of wo){let r=e[n];typeof r=="string"&&(t[Je(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function Ft(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var vo=`
2
+ .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
+ .ztd-root:focus{outline:none}
4
+ .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${xe.accent});outline-offset:3px;border-radius:6px}
5
+ .ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
6
+ .ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
7
+ .ztd-tip{animation:ztd-fade .14s ease-out;transition:left .2s cubic-bezier(.22,1,.36,1),top .2s cubic-bezier(.22,1,.36,1)}
8
+ .ztd-guide{transition:transform .2s cubic-bezier(.22,1,.36,1)}
9
+ .ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
10
+ .ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
11
+ .ztd-btn:focus{outline:none}
12
+ .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${xe.accent});outline-offset:2px}
13
+ .ztd-card{transition:border-color .16s ease}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${xe.dim})}
15
+ @media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
16
+ @keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
17
+ @keyframes ztd-fade{from{opacity:0}to{opacity:1}}
18
+ .ztd-pop{transform-box:fill-box;transform-origin:center}
19
+ @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
+ .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
+ @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
+ `;function kn(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 wn(e,t){let[n]=(0,xn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var yn=!1;function je(){if(yn||typeof document>"u"||(yn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=vo,document.head.appendChild(e)}var Ze=N(G(),1),ae=typeof window<"u"&&typeof document<"u",ue=ae?Ze.useLayoutEffect:Ze.useEffect;function Qe(){return typeof performance<"u"?performance.now():Date.now()}function K(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 vn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},$n={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var $o=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Co={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Mo(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function To(e){return Mo($o,e)}function Cn(e,t){let n=To(e);return{text:n?n[t]:e,...Co[n?.id??"basic"]}}var Mn={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Fe(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Mn[t.toLowerCase()]&&(t=Mn[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&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 i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function An(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 Rt(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 Ne(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Tn(e){return .2126*Ne(e[0])+.7152*Ne(e[1])+.0722*Ne(e[2])}function Pt(e,t,n){let r=typeof e=="string"?Fe(e):e,o=typeof t=="string"?Fe(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?Fe(n):n:null;o[3]<1&&i&&(o=Rt(o,i));let a=r[3]<1?Rt(r,o):r,s=Tn(a),l=Tn(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function So(e){return[Ne(e[0]),Ne(e[1]),Ne(e[2])]}function Nt(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 Sn(e){let[t,n,r]=So(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function Ao([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[Nt(4.0767416621*o-3.3077115913*i+.2309699292*a),Nt(-1.2684380046*o+2.6097574011*i-.3413193965*a),Nt(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function et(e,t,n){let r=Fe(e),o=Fe(t);if(!r||!o)return e;let i=Sn(r),a=Sn(o),s=Math.max(0,Math.min(1,n));return An(Ao([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Dt(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Pt(i,e,n);a>o&&(o=a,r=i)}return r}function j(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 Fo(e,t){let n=Dt(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Pt(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Dt(t,["#FFFFFF","#000000"])}function tt(e,t){let n=et(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Fo(e,n),raw:n}}function me(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=j(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=j(e,"neutral");else if(s===0)r[a]=j(e,"ink");else if(s===i-1)r[a]=j(e,"neutral");else if(i===3)r[a]=j(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?j(e,"strong"):tt(e,1-l)}}),r}var Lt="mix:";function Ve(e){return e({theme:Tt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Lt}${o}`}).map(n=>n.fill)}function Fn(e,t){return t?.startsWith(Lt)?e.mix("neutralStrong","neutral",Number(t.slice(Lt.length))):e.color(t)}function Nn(e,t,n){return me(e,t+1,n).slice(0,t)}function Rn(e,t,n,r="neutral"){let o=j(e,"accent"),i=j(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Pn(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=j(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=j(e,"neutral"):s===0?r[a]=j(e,"strong"):s===i-1?r[a]=j(e,"neutral"):r[a]=tt(e,1-s/(i-1))}),r}var ie=N(G(),1);var rt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),Z="en-US",Dn=new Map;function Et(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=Dn.get(r);return o||(o=new Intl.NumberFormat(e,n),Dn.set(r,o)),o}function _t(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Re(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=Z,...r}=t;return _t(Et(n,r).format(e))}var It=e=>e!==0&&Math.abs(e)<.05,Ot=(e,t,n="")=>`${Re(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function nt(e,t={}){if(!Number.isFinite(e))return"-";if(It(e)&&t.maximumFractionDigits===void 0)return Ot(e,t.locale??Z,"%");let n=Math.abs(e);return`${Re(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function In(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=Z,...r}=t;if(K(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],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(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+Re(u,{locale:n,...r,maximumFractionDigits:m})+l}}return _t(Et(n,{notation:"compact",...r}).format(e))}var No=(e,t=K(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Me(e,t=Z,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=Et(t,o);return l=>Number.isFinite(l)?`${a}${_t(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>nt(o,{locale:t});case"ratio":return o=>nt(o*100,{locale:t});case"compact":return o=>In(o,{locale:t});case"currency":return r(No(t));default:{let o=r({maximumFractionDigits:1});return i=>It(i)?Ot(i,t):o(i)}}}function ot(e,t=Z,n=0){return e!==void 0?Me(e,t):n>=1e5?r=>It(r)?Ot(r,t):In(r,{locale:t}):r=>Re(r,{locale:t})}function Ro(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Bt=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Po=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Do=["january","february","march","april","may","june","july","august","september","october","november","december"],Ln=e=>{let t=e.toLowerCase();return t.length<3?0:Do.findIndex(n=>n.startsWith(t))+1},En=e=>+e+(+e<30?2e3:1900);function On(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Lo=[/^(\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})일)?$/],Bn=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,zn=/\{([^{}]+)\}/g;function at(e,t){let n;for(let r of Lo)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?[En(n[3]),+n[2],+n[1],1]:[En(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=Bn.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Ln(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=Ln(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Hn=e=>Po.test(e)||at(e)!==null;function jn(e){let t;for(let n of e){let r=typeof n=="string"?Bn.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function it(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(Bt(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return it(`${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=at(n,t);if(r)return Ro(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 _n=new Map;function We(e,t={month:"short",day:"numeric"}){let n=it(e);if(!n)return"-";let{locale:r=Z,...o}=t,i=r+JSON.stringify(o),a=_n.get(i);return a||(a=new Intl.DateTimeFormat(r,o),_n.set(i,a)),a.format(n)}var zt=N(I(),1),st=(0,ie.createContext)({theme:xe,cssVars:!0});function Eo(e,t=xe){return e?typeof e=="string"?St[e]??t:Ft(t,e):t}function lt(e){let t=(0,ie.useContext)(st),n=e.base?St[e.base]:t.theme,r=(0,ie.useMemo)(()=>Eo(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,ie.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,ie.useMemo)(()=>At(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,zt.jsx)(st.Provider,{value:a,children:(0,zt.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var _o=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Wn(e){return _o.has(e)}function Io(e,t){let n=r=>t?`var(${Je(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Wn(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Wn(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:et(e[r],e[o],i)}}}function se(e){let t=(0,ie.useContext)(st);return(0,ie.useMemo)(()=>{let n=Ft(t.theme,e);return Io(n,t.cssVars)},[t.theme,t.cssVars,e])}function Q(e){let t=(0,ie.useContext)(st);return e??t.locale??Z}function Gn(e){return e?At(e):{}}var ct=N(G(),1),Ht=(0,ct.createContext)(void 0);function Kn(e){let t=(0,ct.useContext)(Ht);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var A=N(I(),1),Oo={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`},Bo={en:Oo,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var zo={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},jt=e=>Bo[K(Q(e))];function Vt(e){let t=se(e.theme),n=jt(e.locale),[r,o]=(0,ut.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,A.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),h=d&&l===1,f=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Ho,{p:t,item:m,off:!d}),(0,A.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,A.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,A.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":h||void 0,onClick:()=>{h||(a(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:h?"default":void 0},children:f}):f},u)})});return a?(0,A.jsxs)(A.Fragment,{children:[c,(0,A.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:zo,children:r?n.shown(l,e.items.length):""})]}):c}function Ho({p:e,item:t,off:n}){let r=Fn(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,A.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,A.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,A.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,A.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 jo(e){let t=se(e.theme),n=Cn(e.level,K(Q(e.locale)));return(0,A.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 Vo(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,A.jsxs)(A.Fragment,{children:[e.slice(0,r),(0,A.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Un(e){let t=se(e.theme),n=jt(e.locale),[r,o]=(0,ut.useState)(0);ue(()=>je(),[]);let i=()=>{o(d=>d+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,A.jsx)(Vt,{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,A.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,A.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,A.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,A.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,A.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,A.jsx)(jo,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,A.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,A.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,A.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,A.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:Vo(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,A.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"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,A.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,A.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,A.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,A.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,A.jsx)("span",{}),a]}):null]}),(0,A.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,A.jsx)(Ht.Provider,{value:r,children:(0,A.jsx)(Se.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,A.jsxs)(A.Fragment,{children:[m,u]}):u]})}function Wt(e){let t=se(e.theme),n=jt(e.locale),r=e.height??220;if(ue(()=>je(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,A.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,A.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,A.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,A.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,A.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,A.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,i)=>(0,A.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,A.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,A.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,A.jsx)(A.Fragment,{children:e.children})}var Be=N(G(),1);var ee=N(G(),1);var z=N(I(),1),mt=60;var dt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Yn(e){let{c:t,events:n}=e,r=(0,ee.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,ue(()=>{je()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,ee.useContext)(Se),c=e.ariaLabel??l??e.kind,m=(0,ee.useMemo)(()=>s?`${n.length}${n.slice(0,mt).map(b=>`${b.label}${b.series??""}${b.formatted??b.value??""}`).join("")}`:"",[n,s]),u=(0,ee.useMemo)(()=>(0,z.jsx)(Wo,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let b=()=>{d.current=null};return window.addEventListener("scroll",b,{capture:!0,passive:!0}),window.addEventListener("resize",b,{passive:!0}),()=>{window.removeEventListener("scroll",b,{capture:!0}),window.removeEventListener("resize",b)}},[]),(0,ee.useEffect)(()=>{d.current=null},[t.width,t.height]);let h=b=>{if(b.target!==b.currentTarget)return;if(e.onKey?.(b)){b.preventDefault();return}let T=t.active,g;switch(b.key){case"ArrowRight":case"ArrowDown":g=T===null?0:(T+1)%a;break;case"ArrowLeft":case"ArrowUp":g=T===null?a-1:(T-1+a)%a;break;case"Home":g=0;break;case"End":g=a-1;break;case"Escape":if(T===null)return;g=null;break;case"Enter":case" ":T!==null&&(b.preventDefault(),t.click(T));return;default:return}b.preventDefault(),t.setActive(g,"keyboard")},{via:f,node:p,setActive:w}=t;(0,ee.useEffect)(()=>{if(f!=="touch"||!p)return;let b=T=>{p.contains(T.target)||w(null)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[f,p,w]);let k=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,M=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,$=typeof e.renderTip=="function"&&k?e.renderTip(k):null,y=e.announce??(t.via==="keyboard"&&k?`${k.label}${k.series?` ${k.series}`:""}: ${k.formatted??k.value??""} (${(t.active??0)+1}/${a})`:""),P;if(v){let b=v.x*M,T=t.width*M,g=`clamp(${(4-b).toFixed(1)}px, -50%, calc(${(T-b-4).toFixed(1)}px - 100%))`,S=v.y<64;P={position:"absolute",left:b,top:v.y*M,transform:`translate(${g}, ${S?"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*M-8)}}let D=b=>{d.current=null,b.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},L=b=>b?T=>{let g=d.current??(d.current=T.currentTarget.getBoundingClientRect());g.width&&b((T.clientX-g.left)/g.width*t.width,(T.clientY-g.top)/g.height*t.height,T)}:void 0,O=L(e.onPointerMove),E=L(e.onPointerDown),R=O||E?b=>{b.pointerType==="touch"&&O?.(b),E?.(b)}:void 0,F=L(e.onPointerUp),C=Gn(e.theme);return(0,z.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":i,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:b=>{t.via==="keyboard"&&!b.currentTarget.contains(b.relatedTarget)&&t.setActive(null)},onPointerLeave:D,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"),...C,...e.style},children:[t.pending?null:e.underlay,(0,z.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,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:O,onPointerDown:R,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,z.jsx)("title",{id:o,children:c}),(0,z.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,z.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,z.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:P,children:$??(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map((b,T)=>(0,z.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,z.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(b.strong?"ink":"muted")},children:[b.color?(0,z.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:b.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,b.label]}),(0,z.jsx)("span",{style:{fontWeight:b.strong===!1?500:700},children:b.value})]},T))]})}):null,(0,z.jsx)("span",{className:"ztd-sr",style:dt,"aria-live":"polite","aria-atomic":"true",children:y}),s&&!t.pending?u:null]})}function Wo({label:e,events:t,t:n}){return(0,z.jsx)("div",{className:"ztd-sr",style:dt,children:(0,z.jsxs)("table",{children:[(0,z.jsx)("caption",{children:n.table(e)}),(0,z.jsxs)("tbody",{children:[t.slice(0,mt).map((r,o)=>(0,z.jsxs)("tr",{children:[(0,z.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,z.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>mt?(0,z.jsx)("tr",{children:(0,z.jsx)("td",{colSpan:2,children:n.more(t.length-mt)})}):null]})]})})}function Pe(e){let t=e.baseline??"central";return(0,z.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}),le=x("label","string",!0,"Item name field"),J=x("value","number",!0,"Value field"),Go=[le,J],Ko=[le,J],Uo=[x("label","string",!0,"Stage name"),x("value","number",!0,"Users at the stage")],Yo=[le,J],Xo=[x("label","string",!0,"Leaf (lowest level) name"),J,x("group","string",!1,"Parent group field")],qo=[x("label","string",!0,"Leaf name"),J,x("group","string",!1,"Parent group field")],Jo=[le,x("value","number",!0,"Change (total rows may omit it)"),x("type","string",!1,'"total" makes a total bar')],Zo=[le,J],Qo=[x("x","string",!0,"Column field"),x("series","string",!0,"Stacked series field"),J],ea=[x("x","string",!0,"Column field"),x("y","string",!0,"Row field"),J],ta=[x("axis","string",!0,"Metric (axis) field"),x("value","number",!0,"Value field",{multi:!0}),x("series","string",!1,"Series field")],na=[x("x","number",!0,"x value"),x("y","number",!0,"y value"),x("size","number",!1,"Circle size"),x("label","string",!1,"Name")],qn=x("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),ra=[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}),qn],oa=[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}),qn],aa=[x("x","any",!0,"x field"),x("y","number",!0,"y field",{multi:!0}),x("series","string",!1,"Series field")],ia=[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})],sa=[le,J],la=[x("value","number",!0,"Value field",{prop:"valueKey"}),x("target","number",!1,"Target field",{prop:"targetKey"})],ca=[le,x("value","number",!0,"Actual value field"),x("target","number",!1,"Target field")],ua=[x("x","any",!1,"x field"),x("y","number",!0,"y field")],ma=[le,x("x","string",!1,"Period field (long tables)"),x("value","number",!1,"Value field (long tables)")],da=[le,x("start","number",!0,"Before value"),x("end","number",!0,"After value")],fa=[le,J],ha=[x("value","number",!0,"Value field"),x("group","string",!1,"Group (row) field"),x("label","string",!1,"Dot name")],ga=[x("group","string",!0,"Group field"),x("value","number",!0,"Value field")],pa=[x("source","string",!0,"Source node"),x("target","string",!0,"Target node"),J],ba=[x("source","string",!0,"Sending group"),x("target","string",!0,"Receiving group"),J],ya=[x("date","date",!0,"Date field"),J],xa=[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)")],ka=[x("group","string",!0,"Group field"),x("value","number",!0,"Value field")],wa=[x("label","string",!1,"Row name field")],va=[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")],$a=[le,J],Ca=[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})],Ma=[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)")],Ta=[x("region","string",!0,"Region name or code, matched to a tile of options.map"),J],Sa=[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")],Xn={pie:Go,donut:Ko,funnel:Uo,waffle:Yo,treemap:Xo,sunburst:qo,waterfall:Jo,pareto:Zo,marimekko:Qo,heatmap:ea,radar:ta,bubble:na,line:ra,area:oa,stream:aa,bar:ia,radialBar:sa,gauge:la,bullet:ca,sparkline:ua,slope:ma,dumbbell:da,lollipop:fa,beeswarm:ha,ridgeline:ga,sankey:pa,chord:ba,calendar:ya,bump:xa,box:ka,parallel:wa,candlestick:va,segmented:$a,skyline:Ca,histogram:Ma,scatter:Sa,tileMap:Ta},De={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:"타일 격자 지도"}};function Jn(e,t){return t==="ko"?e.nameKo:e.name}function Zn(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Qn=["line","area","bar","scatter"],er=24,Gt=["line","area","bar","scatter"];function Kt(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function tr(e,t,n){return Gt.includes(e)&&!Kt(e,t,n).length}function nr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Aa={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"};function ft(e){let t=Xn[e]?e:Aa[e]??Object.keys(De).find(n=>n.toLowerCase()===e.toLowerCase()||De[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!De[t]))return{type:t,component:De[t].component,name:De[t].name,nameKo:De[t].nameKo,encoding:Xn[t]}}function rr(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of ft(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function or(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Fa(e,t){if(e==null||typeof e!="object")return;let n=e;if(or(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!or(r,o))return;r=r[o]}return r}}function pe(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 be(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Fa(r,n)}function Le(e,t){let n=be(e,t);return(r,o)=>pe(n(r,o))}function ke(e,t){let n=be(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function Ee(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Na(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
+ `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var Ra=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function ar(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Ra.test(t)||/^[-+]?\.\d+$/.test(t)){let n=pe(t);if(Number.isFinite(n))return n}return t}function Te(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??Na(o),a=[],s=[],l="",c=!1;for(let f=0;f<o.length;f++){let p=o[f];c?p==='"'?o[f+1]==='"'?(l+='"',f++):c=!1:l+=p:p==='"'&&!l.trim()?(c=!0,l=""):p===i?(s.push(l),l=""):p===`
24
+ `||p==="\r"?(p==="\r"&&o[f+1]===`
25
+ `&&f++,s.push(l),a.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?ar(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((p,w)=>[String(w),u(p)])));let d=[],h=new Set;return m[0].forEach((f,p)=>{let w=f.trim()||`col${p+1}`,k=w;for(let v=2;h.has(k);v++)k=`${w}_${v}`;h.add(k),d.push(k)}),m.slice(1).map(f=>Object.fromEntries(d.map((p,w)=>[p,u(f[w]??"")])))}function Ut(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?ar(a[l]):a[l]??null])))}function Pa(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function ir(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 we(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return we(JSON.parse(t))}catch{}return Te(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Ut(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)?we(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Ut(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)?we(t.rows):Array.isArray(t.values)?Ut(t.values):Array.isArray(t.items)?we(t.items):Array.isArray(t.results)?we(t.results):Pa(t)}return[]}function ht(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function Yt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(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 h=a(d,c),f=h-a(d,c-1),p=0;for(let w=0;w<d;w++)p+=a(w,c)-a(w,c-1);m+=h,u+=(f/2+p)*h}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][l],p=Number.isFinite(f)?f:0;p>=0?(o[h][l]=u,u+=p,i[h][l]=u):(o[h][l]=d,d+=p,i[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=a(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,i[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,i[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[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,i[u][d]-=m}return{y0:o,y1:i}}function sr(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 lr(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,m=h)}),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]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Da=Math.PI*2;function gt(e,t,n){return e<t?t:e>n?n:e}function cr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function V(e){return Math.round(e*100)/100}function Xt(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let i=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,a=Math.min(n,r)/2,s=gt(i.tl??0,0,a),l=gt(i.tr??0,0,a),c=gt(i.br??0,0,a),m=gt(i.bl??0,0,a);return`M${V(e+s)},${V(t)}H${V(e+n-l)}`+(l?`A${V(l)},${V(l)} 0 0 1 ${V(e+n)},${V(t+l)}`:"")+`V${V(t+r-c)}`+(c?`A${V(c)},${V(c)} 0 0 1 ${V(e+n-c)},${V(t+r)}`:"")+`H${V(e+m)}`+(m?`A${V(m)},${V(m)} 0 0 1 ${V(e)},${V(t+r-m)}`:"")+`V${V(t+s)}`+(s?`A${V(s)},${V(s)} 0 0 1 ${V(e+s)},${V(t)}`:"")+"Z"}function ur(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function dr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function mr(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 pt=new Map;function ve(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=pt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);dr(c)?a+=mr(c):s+=mr(c)}i=a+s*(n>=600?1.07:1),pt.size>5e3&&pt.clear(),pt.set(o,i)}return i*t}function fr(e,t,n,r=400){if(e=e.trim(),ve(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ve(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(dr(s.charCodeAt(0))?2:3)?"":s+o}var gr=N(I(),1),La=e=>Array.isArray(e)&&e.length===2;function hr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&La(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var de=N(I(),1),_e=10.5;function pr(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>Re(a,{locale:n,maximumFractionDigits:i}))}function bt(e,t,n){let r=18;for(let o of pr(e,t,n))r=Math.max(r,ve(o,_e));return Math.ceil(r+8)}function br(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:pr(n,a,e.locale);return(0,de.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,m)=>{let u=Math.round(r(c))+.5,d=c===0&&e.zero!==!1;return(0,de.jsxs)("g",{children:[(0,de.jsx)("line",{x1:o,x2:i,y1:u,y2:u,stroke:t.paint(d?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:d?.7:1}),l?(0,de.jsx)(Pe,{x:s?i+6:o-6,y:u,anchor:s?"start":"end",size:_e,fill:t.paint("muted"),children:l[m]}):null]},c)})})}function Ea(e,t,n=_e,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((u,d)=>d);let s=t.map(u=>ve(u,n,o)),l=(u,d)=>Math.abs(e[d]-e[u])<(s[u]+s[d])/2+r,c=[];for(let u of i??[])c.some(d=>l(d,u))||c.push(u);let m=u=>!c.some(d=>l(d,u));for(let u=1;u<=a;u++){let d=c.slice();for(let h=0;h<a;h+=u)m(h)&&d.push(h);if(u>1&&(a-1)%u>u/2&&m(a-1)&&d.push(a-1),d.sort((h,f)=>h-f),d.every((h,f)=>!f||!l(d[f-1],h)))return d}return[0,a-1]}function yr(e){let{p:t,labels:n,centers:r,y:o,width:i}=e,a=e.size??_e,s=n.map((c,m)=>{let u=2*Math.max(0,Math.min(r[m],i-r[m]))-2;return fr(c,Math.min(e.maxWidth??160,u),a,e.strong?.has(m)?700:500)}),l=Ea(r,s,a,6,600,e.strong);return(0,de.jsx)("g",{"aria-hidden":"true",children:l.map(c=>{let m=e.strong?.has(c);return(0,de.jsxs)("g",{children:[(0,de.jsx)(Pe,{x:r[c],y:o,anchor:"middle",size:a,weight:m?700:500,fill:t.paint(m?"ink":"muted"),children:s[c]}),e.sub?.[c]?(0,de.jsx)(Pe,{x:r[c],y:o+a+3,anchor:"middle",size:a-1,fill:t.paint("muted"),children:e.sub[c]}):null]},c)})})}function qt(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 $e(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=qt(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let h=qt(c[1]-c[0],n);if(h===l)break;l=h}return c}function xr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=qt(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Ie(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>xr(n,r,l),s}function Jt(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[i,a]=$e(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function _a(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of c){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:xr(e,t,3)}function kr(e,t){let n=Ie([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=()=>_a(e[0],e[1],Math.abs(t[1]-t[0])),r}function wr(e,t,n=.2,r=n/2){let o=e.length,[i,a]=t,s=a-i,l=o?s/Math.max(1,o-n+r*2):s,c=l*(1-n),m=i+l*r,u=new Map(e.map((h,f)=>[h,f])),d=(h=>m+(u.get(h)??0)*l);return d.bandwidth=Math.max(0,c),d.step=l,d.domain=e,d.index=h=>u.get(h)??-1,d}function Ge(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 Ia=864e5;function vr(e,t,n,r=Z){let o=t-e;if(!(o>0))return[{t:e,label:We(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Ia,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,h=!1)=>{let f=new Date(m),p=-1,w=0;for(;f.getTime()<=t&&w++<500;){if(f.getTime()>=e){let k=f.getFullYear(),v=h&&!l&&k!==p;a.push({t:f.getTime(),label:We(f,{locale:r,...d,...v?{year:"numeric"}:{}})}),p=k}u(f)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(i<=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(i<=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=i/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),c(h,p=>p.setMonth(p.getMonth()+d),{month:"short"},!0)}}return a}function $r(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var Oa=(e,t,n)=>e==="date"?it(t,n)?.getTime()??NaN:pe(t);function Ba(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Hn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ke(e,t,n,r,o={}){let i=be(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:be(n,"y"),c=!a&&r!==void 0?be(r,"series"):null,m=e.map((C,b)=>i(C,b)),u=o.xType??Ba(m),d=o.locale??Z,h,f,p;if(u==="band"){let C=m.map(T=>String(T??""));h=Ee(C);let b=new Map(h.map((T,g)=>[T,g]));f=h.map((T,g)=>g),p=Int32Array.from(C,T=>b.get(T)??-1)}else{let C=u==="date"?o.dayFirst??jn(m):void 0,b=m.map(S=>Oa(u,S,C)),T=Array.from(new Set(b.filter(S=>Number.isFinite(S)))).sort((S,H)=>S-H),g=new Map(T.map((S,H)=>[S,H]));f=T,h=T.map(String),p=Int32Array.from(b,S=>g.get(S)??-1)}let w=o.dateFormat,k=C=>typeof C=="string"?at(C.trim())?.[3]:void 0,v=u==="date"&&m.length<5e3?k(m[0]):void 0,M=(v===2||v===3)&&m.every(C=>k(C)===v),$=M&&v===3;if(u==="date"&&!w){let C=f.length>1?f[f.length-1]-f[0]:0;w=M&&v===2||C>864e5*120?{month:"short"}:C<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},C>864e5*800&&(w={year:"numeric",month:"short"})}let y;if(u==="band")y=h;else if($&&!o.dateFormat){let C=K(d)==="ko";y=f.map(b=>{let T=new Date(b),g=Math.floor(T.getMonth()/3)+1;return C?`${T.getFullYear()}년 ${g}분기`:`Q${g} ${T.getFullYear()}`})}else{let C=f.every(Bt),b=u==="date"?new Intl.DateTimeFormat(d,w):new Intl.NumberFormat(d,C?{useGrouping:!1}:{maximumFractionDigits:6});y=f.length>1e3?$r(f.length,T=>b.format(f[T])):f.map(T=>b.format(T))}let P=s?[...s]:c?Ee(e.map((C,b)=>String(c(C,b)??""))):[""],D=new Map(P.map((C,b)=>[C,b])),L=P.map(()=>new Array(h.length).fill(NaN)),O=P.map(()=>new Array(h.length).fill(null)),E=o.aggregate??"sum",R=E==="mean"?P.map(()=>new Uint32Array(h.length)):null,F=(C,b,T,g)=>{let S=L[C][b];E==="last"?L[C][b]=T:E==="count"?L[C][b]=(Number.isFinite(S)?S:0)+1:E==="mean"?Number.isFinite(T)&&(L[C][b]=(Number.isFinite(S)?S:0)+T,R[C][b]++):L[C][b]=Number.isFinite(S)?S+(Number.isFinite(T)?T:0):T,O[C][b]=g};for(let C=0;C<e.length;C++){let b=p[C];if(b<0)continue;let T=e[C];if(s)for(let g=0;g<s.length;g++)F(g,b,pe(T[s[g]]),T);else{let g=c?D.get(String(c(T,C)??""))??0:0;F(g,b,pe(l(T,C)),T)}}if(R)for(let C=0;C<L.length;C++)for(let b=0;b<h.length;b++)R[C][b]>1&&(L[C][b]/=R[C][b]);return{type:u,keys:h,xnum:f,labels:y,series:P,values:L,rows:O}}var za=140,Ye=12,Cr=14,Zt=20,Mr=12.5;function Ha(e,t,n=er){let r=ke(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function ja(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Ye)/(za+Ye))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Va(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Ye)/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 Ue=e=>e.filter(Number.isFinite);function yt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Le(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return Ue(n)}function Tr(e,t,n,r,o,i){return Ke(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Wa(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/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(),P=r.refLines??{},[D,L]=Ge([...yt(y,r.x??"x"),...Ue([Number(P.x)])]),[O,E]=Ge([...yt(y,r.y??"y"),...Ue([Number(P.y)])].filter(F=>!s||F>0)),R=r.zero??!1;return{y:c??(s?Jt(O,E,a):$e(O,E,a,{zero:R,pad:.08})),x:r.xDomain??$e(D,L,Math.max(2,Math.round(o/110)),{zero:R,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(y=>y.keys.join("")===d),f=n.length>0&&n.every(y=>y.type!=="band"&&y.type===n[0].type),p=r.xDomain??(!m&&f?Ge(n.flatMap(y=>Ue(y.xnum))):void 0),w=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(w==="percent")return{x:p,sameKeys:h};if(c)return{y:c,x:p,sameKeys:h};let k=[];t.forEach((y,P)=>{let D=n[P];if(w==="stacked"||w==="auto"&&D.series.length>1){let O=Yt(D.values,"zero");O.y0.forEach(E=>k.push(...E)),O.y1.forEach(E=>k.push(...E))}else D.values.forEach(O=>k.push(...O));m&&!u&&r.line!==void 0&&Tr(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(O=>k.push(...O)),m||k.push(...yt(y,r.lower),...yt(y,r.upper))}),m&&k.push(0),u||k.push(...hr(r.annotations));for(let y of r.referenceLines??[])k.push(y.y);r.signColors&&k.push(Number(r.baseline??0));let[v,M]=Ge(Ue(k).filter(y=>!s||y>0));return{y:s?Jt(v,M,a):m?$e(v,M,u?Math.max(2,Math.round(o/120)):a):$e(v,M,a,{zero:r.zero??e==="area"}),x:p,sameKeys:h}}function Ga(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Ke(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?kr:Ie)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=bt(c,ot(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),h=m+6,f=i-(d?Math.min(i*.28,Math.max(...u.map(y=>ve(y,11,700)),20)+14):10),p=l.keys.length,[w,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?p>12:p>vr(w,k,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!p||v)return;let M=y=>h+(l.xnum[y]-w)/(k-w)*(f-h),$=y=>ve(l.labels[y],_e);for(let y=1;;y++){let P=Array.from({length:Math.ceil(p/y)},(D,L)=>L*y);if(y>=p||P.every((D,L)=>!L||M(D)-M(P[L-1])>=($(D)+$(P[L-1]))/2+8))return P.map(D=>({value:l.xnum[D],label:l.labels[D]}))}}function Ka(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 Ua(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${Ka(`${e}|${t}|${o}|${ht(r)}`)}`}function Ya(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 Xa={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:"(빈 값)"}};function Sr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Ha(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=ja(s,a,e.columns),{pw:c,ph:m}=Va(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(R=>Tr(t,R,n,n.y,n.series,n.aggregate)),h=u?Wa(t,o,d,n,c,m):{sameKeys:!1},f=u?Ga(t,o,d,n,h,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",w=u&&(!p||h.sameKeys),k=u&&(p||h.x!==void 0||h.sameKeys),v=new Set(Ya(e.highlight,r)?[e.highlight].flat():[]),M=v.size>0,$=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??Ua(t,e.by,n,e.data),P=rt(Me(n.format,e.locale),n.unit),D=Xa[e.lang],L=[],O=r.map(R=>R===""?D.blank:R);return{panels:r.map((R,F)=>{let C=o[F],b=O[F],T=F%l,g;if(t!=="scatter"){let H=d[F],W=q=>H.values.reduce((B,ne)=>B+(Number.isFinite(ne[q])?ne[q]:0),0),_=H.keys.map((q,B)=>B).filter(q=>H.values.some(B=>Number.isFinite(B[q]))),X=_[_.length-1];L.push({first:_.length?W(_[0]):NaN,last:_.length?W(X):NaN,total:_.reduce((q,B)=>q+W(B),0)}),t!=="bar"&&H.series.length===1&&X!==void 0&&(g=P(H.values[0][X]))}else L.push({first:NaN,last:NaN,total:C.length});let S={data:C,width:c,height:m,ariaLabel:e.title?`${e.title}, ${b}`:b,syncId:y,highlight:M?v.has(R)?$?()=>!0:void 0:"none":e.highlight,showYAxis:!w||T===0,showXAxis:!k||F+l>=a};return h.y&&(S.yDomain=h.y),h.x&&(S.xDomain=h.x),f&&(S.xTicks=f),{value:R,label:b,props:S,last:g,isPicked:v.has(R)}}),cols:l,pw:c,ph:m,isPanelPick:M,description:qa(t,e.by,O,L,i,P,D)}}function qa(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>ur(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var te=N(G(),1);function Ja(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Za(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function Nr(e,t=!0){let[n,r]=(0,te.useState)({visible:!t,near:!t});return(0,te.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(a=>{let s=Za(a[a.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Ja(.25),rootMargin:"0px 0px -8% 0px"}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function Ar(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function xt(e){let[t,n]=(0,te.useState)(null),[r,o]=(0,te.useState)(e??null),i=(0,te.useCallback)(a=>{n(a),a&&e===void 0&&o(Ar(a))},[e]);return ue(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a(Ar(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?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var Qa=()=>()=>{};function Oe(){return(0,te.useSyncExternalStore)(Qa,()=>!0,()=>!1)}var Fr="(prefers-reduced-motion: reduce)";function kt(e="auto"){let[t,n]=(0,te.useState)(()=>ae&&typeof window.matchMedia=="function"?window.matchMedia(Fr).matches:!1);return(0,te.useEffect)(()=>{if(e!=="auto"||!ae||typeof window.matchMedia!="function")return;let r=window.matchMedia(Fr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var fe=N(I(),1),ei=60,ti=420;function Rr(e){let t=se(),n=e.chartProps??{},[,r,o]=xt(e.width),i=e.width??(o||480),a=Q(e.locale??n.locale),s=K(a),l=(0,Be.useContext)(Se),c=e.title??l,m=(0,Be.useMemo)(()=>Sr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,i,e.height,c,a,s]),u=`${(0,Be.useId)().replace(/:/g,"")}fd`,d=kt(n.reducedMotion??"auto"),h=Oe(),f=wn({motion:{enabled:n.animate!==!1&&!d&&ae},hydrated:h},{waiting:!1,generation:0}),p=e.chart;return(0,fe.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":u,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,fe.jsx)("p",{id:u,style:dt,children:e.description??m.description}),(0,fe.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${m.cols}, minmax(0, 1fr))`,columnGap:Ye,rowGap:Cr},children:m.panels.map((w,k)=>{let v=t.paint(w.isPicked?"accentText":m.isPanelPick?"muted":"ink");return(0,fe.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...kn(f,!1,"fade",k*ei,ti)},children:[(0,fe.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Zt,fontSize:Mr,fontWeight:700,lineHeight:`${Zt}px`,color:v},children:[(0,fe.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,fe.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,fe.jsx)(p,{...n,...w.props})]},w.value)})})]})}function he(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&i.add(u)});return i}var oe=N(G(),1);async function ni(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(K(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Te(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Te(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Te(i)}async function ri(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),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await ni(i,t.parse,o,t.locale)}return t.select&&(r=ir(r,t.select)),t.transform?t.transform(r):we(r)}function Pr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,oe.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,oe.useState)(0),c=Q(t.locale),m=(0,oe.useRef)(t);m.current={...t,locale:c};let u=(0,oe.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),p=(0,oe.useRef)(!1);(0,oe.useEffect)(()=>{let k=u.current;if(!k||!r){a($=>$.status==="loading"?{...$,status:"idle"}:$);return}let v=new AbortController,M=!0;return p.current=!0,a($=>({...$,data:o?$.data:[],status:"loading",error:null})),ri(k,{...m.current,signal:v.signal}).then($=>{M&&a({data:$,status:"success",error:null,updatedAt:Date.now()})}).catch($=>{!M||v.signal.aborted||a(y=>({...y,status:"error",error:$ instanceof Error?$:new Error(String($))}))}).finally(()=>{M&&(p.current=!1)}),()=>{M=!1,p.current=!1,v.abort()}},[d,r,s,f,o]),(0,oe.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{p.current||l(v=>v+1)},n);return()=>clearInterval(k)},[n,r]);let w=(0,oe.useCallback)(()=>l(k=>k+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:w}}var en=N(I(),1),oi=["csv","svg","png"],ai=/^[=+\-@\t\r\n=+-@]/,ii=/var\(|color-mix\(/;function Dr(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?On(e.getTime()):String(e);return`"${(ai.test(t)&&!Number.isFinite(pe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function si(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function li(e,t){return`\uFEFF${[t.map(Dr),...e.map(r=>t.map(o=>Dr(r[o])))].map(r=>r.join(",")).join(`\r
26
+ `)}\r
27
+ `}function ci(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Qt(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Lr=2,Ce=16;function Er(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,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function _r(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 Ir(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+Ce*2,a+Ce*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,p)=>{let w;for(let k of Array.from(f.attributes)){if(!ii.test(k.value))continue;let v=(w??(w=getComputedStyle(f))).getPropertyValue(k.name);v&&m[p].setAttribute(k.name,Er(v,u))}}),c.removeAttribute("style");for(let[f,p]of Object.entries({viewBox:`${-Ce} ${-Ce} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(p));let d=Er(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(_r("rect",{x:-Ce,y:-Ce,width:s,height:l,fill:d}),f),h&&c.insertBefore(_r("image",{href:h.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:d,canvas:h}}function ui(e,t){let n=Ir(e,Lr,!1);if(!n)return;let r=Lr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,Ce*r,Ce*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Qt(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Or(e){let t=se(e.theme),n=K(Q(e.locale))==="ko",r=ci(e.filename),o=(i,a)=>{if(i==="csv")return Qt(new Blob([li(e.data,e.columns?.length?e.columns:si(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return ui(a,r);let s=Ir(a,1,!0);s&&Qt(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,en.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:oi.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,en.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,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:a},i)})})}var zr=N(I(),1);function Br(e,t=Z){let n=Me(void 0,t),r=e.split(`
28
+ `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?We(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(zn,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,zr.jsx)("div",{children:s},l)):null}}function Hr(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 Te(t.csv)}return null}var Yr=N(G(),1);var Y=N(G(),1);function jr(e,t){let n=se(e.theme),[r,o,i]=xt(e.width),a=Oe(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=kt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ae,d=Nr(r,e.animateOnView!==!1&&u),h=Q(e.locale),f=K(h),p=(0,Y.useMemo)(()=>Me(e.format,h,t.format),[e.format,h,t.format]),w=(0,Y.useCallback)(_=>nt(_,{locale:h}),[h]),k=(0,Y.useMemo)(()=>rt(p,e.unit),[p,e.unit]),v=(0,Y.useMemo)(()=>ht(e.data),[e.data]),[M,$]=(0,Y.useState)(null),[y,P]=(0,Y.useState)(null),D=(0,Y.useRef)([]),L=(0,Y.useRef)(e.onHover);L.current=e.onHover;let O=(0,Y.useRef)(e.onClick);O.current=e.onClick;let E=(0,Y.useRef)(null),R=(0,Y.useRef)(null),F=(0,Y.useRef)(null),C=(0,Y.useCallback)((_,X="pointer")=>{if(F.current!==_){F.current=_;let q=_===null?null:D.current[_]??null;queueMicrotask(()=>L.current?.(q)),R.current?.(_)}E.current=_===null?null:X,$(_),P(E.current)},[]),b=(0,Y.useCallback)(_=>{E.current!=="keyboard"&&(E.current=_===null?null:"sync",$(_),P(E.current))},[]),T=(0,Y.useCallback)(_=>{let X=D.current[_];X&&O.current?.(X)},[]),g=Kn(e.replayKey),S=e.width!==void 0||(i??0)>0,H={enabled:u,active:d.visible&&S,near:d.near,replayKey:g,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},W=(0,Y.useCallback)((_,X=1)=>M===null||M===_?X:X*.38,[M]);return{p:n,width:s,height:c,measured:S,responsive:e.width===void 0,pending:ae&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:H,fv:k,fmt:p,pct:w,locale:h,lang:f,t:f==="ko"?$n:vn,active:M,via:y,setActive:C,click:T,events:D,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:W,sig:v,description:e.description,reduced:m,publish:R,applySync:b}}var U=N(G(),1);function mi(e){return 1-Math.pow(1-e,3)}function di(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function fi(e){return e==="easeInOut"?di:e==="linear"?t=>t:mi}function hi(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 ze(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),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function wt(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 Vr(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 Wr(e,t,n,r){if(!t||!n||t.length!==n.length)return ze(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of ze(s,n[a]))o.push(l)}return o.length===r?o:ze(e,r)}var vt=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||!wt(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 i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).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),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}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),Vr(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=wt(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,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Wr(s.cur,s.parts,a.parts,c),s.vel=Wr(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Vr(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=wt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=wt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=ze(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=fi(this.easing),o=this.duration/1e3,i=this.omega,a=[];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=ze(s.from,c)),s.vel.length!==c&&(s.vel=ze(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(-i*l),d=i*l>=8&&i*l<20,h=0;for(let f=0;f<c;f++){let p=s.from[f]-s.to[f],w=s.vel[f]+i*p;s.cur[f]=s.to[f]+(p+w*l)*u,s.curVel[f]=(s.vel[f]-i*w*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=hi(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;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&&a.push(s.key)}else n=!0}for(let s of a)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}},Xe=new Set,$t=0;function Gr(e){$t=0;let t=Array.from(Xe);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Xe.delete(n)}Xe.size&&typeof requestAnimationFrame<"u"&&($t=requestAnimationFrame(Gr))}function Kr(e){return Xe.add(e),!$t&&typeof requestAnimationFrame<"u"&&($t=requestAnimationFrame(Gr)),()=>{Xe.delete(e)}}function gi(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 Ur(e,t){let n=(0,U.useMemo)(()=>gi(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,U.useRef)(null),d=(0,U.useRef)("init"),h=(0,U.useRef)(null),f=(0,U.useRef)(s),p=(0,U.useRef)(a),w=(0,U.useRef)(!1),k=(0,U.useRef)(0),[,v]=(0,U.useState)(0),M=(0,U.useRef)(null),$=(0,U.useRef)(!0);u.current||(u.current=new vt,u.current.configure(l,c),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(l,c),h.current!==n){let R=d.current,F=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||R==="init"?y.snap(n):R==="idle"?y.hold(n):R==="running"||F?y.update(n,Qe(),m):y.snap(n),h.current=n,f.current=s}let P=(0,U.useRef)(()=>!1);P.current=R=>{if(!$.current)return!1;let F=y.step(R);return!F&&d.current==="running"&&(d.current="done"),v(C=>(C+1)%1e9),F||(M.current=null),F};let D=(0,U.useCallback)(()=>{if(!ae||M.current||!y.animating)return;let R=F=>P.current(F);M.current=Kr(R)},[y]);ue(()=>{let R=!Object.is(p.current,a);if(p.current=a,!r){(d.current!=="done"||y.animating)&&(y.snap(h.current??n),d.current="done",v(F=>F+1));return}d.current==="init"||R&&i?(y.hold(h.current??n),d.current="idle",w.current=!1,v(F=>F+1)):R&&(w.current=!0)},[r,a]),ue(()=>{!r||!i||!w.current||(w.current=!1,y.hold(h.current??n),d.current="idle",v(R=>R+1))},[i,r]),(0,U.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(Qe()),k.current+=1,d.current="running",D(),v(R=>R+1))},[r,o,a,y,D]),(0,U.useEffect)(()=>{y.animating&&D()}),(0,U.useEffect)(()=>($.current=!0,()=>{$.current=!1,M.current?.(),M.current=null}),[]);let L=Qe(),O=y.elapsed(L),E=r&&d.current==="idle";return{items:y.items(),get:R=>y.get(R),elapsed:E?0:O,fade:(R,F=320)=>E?0:Number.isFinite(O)?Math.max(0,Math.min(1,(O-R)/F)):1,waiting:E,animating:y.animating,generation:k.current}}var tn=N(I(),1);function Xr(e,t,n,r,o){if(r)return o==="categorical"?me(e,t,n):Pn(e,t,n);if(o==="categorical")return me(e,t,n);let i=j(e,"strong"),a=j(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var pi=N(G(),1);var nn=N(I(),1);var qr=e=>e?"neutralStrong":"accent";var rn=N(I(),1);function Jr(e,t,n,r){if(typeof e!="function")return he(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var bi=N(G(),1);var an=N(I(),1),yi={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`},Zr={en:yi,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}일 이동평균`}},on=["ink","muted","dim"];function Qr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,on.length)}var xi=N(G(),1);var oo=N(I(),1),ki={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ae(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},wi={en:ki,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},eo=(e,t)=>wi[e].other(t);function to(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,cr(o.map(i=>i.value)))}}var no=e=>Number.isFinite(e)&&e>0?e:0;function ro(e,t,n,r){return r==="emphasis"?Rn(e,t,n):me(e,t,n)}var vi=N(G(),1);var lo=N(I(),1);function ao(e,t){return t===!1?e.map((n,r)=>r):lr(e)}function io(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return he(e,t,t,r,"max")}function so(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=j(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?j(e,"neutral"):tt(e,1-a/Math.max(1,o.length-1))),r}var sn=N(G(),1);var ce=N(I(),1),$i={kind:"Waterfall chart",total:"Total",up:"Increase",down:"Decrease",cum:"Cumulative"},Ci={en:$i,ko:{kind:"폭포 차트",total:"합계",up:"증가",down:"감소",cum:"누적"}};function ln(e){let t=jr(e,{height:g=>Math.max(190,Math.min(260,g*.55)),duration:650,stagger:130}),{p:n,width:r,height:o}=t,i=Ci[t.lang],a=i.total,s=(0,sn.useMemo)(()=>{let g=ke(e.label,"label"),S=Le(e.value,"value"),H=e.type?be(e.type,"type"):be(void 0,"type"),W=[],_=0;e.data.forEach((B,ne)=>{let re=S(B,ne),He=String(H(B,ne)??"").toLowerCase();if(He==="total"||He==="합계"||ne===0&&e.startTotal!==!1&&He!=="delta"){let ge=Number.isFinite(re)?re:_;W.push({i:ne,label:g(B,ne),value:ge,start:0,end:ge,total:!0,hi:!1,datum:B}),_=ge}else{let ge=Number.isFinite(re)?re:0;W.push({i:ne,label:g(B,ne),value:ge,start:_,end:_+ge,total:!1,hi:!1,datum:B}),_+=ge}}),e.endTotal&&W.push({i:W.length,label:typeof e.endTotal=="string"?e.endTotal:a,value:_,start:0,end:_,total:!0,hi:!1,datum:null});let X=W.map(B=>B.total?-1/0:B.value);return he(e.highlight,W.map(B=>B.datum),W.map(B=>B.label),X,"max").forEach(B=>{W[B]&&(W[B].hi=!0)}),W},[e.data,e.label,e.value,e.type,e.startTotal,e.endTotal,e.highlight,a]),l=Math.min(0,...s.map(g=>Math.min(g.start,g.end))),c=Math.max(0,...s.map(g=>Math.max(g.start,g.end))),m=$e(l,c,3),u=ot(e.format,t.locale,Math.max(Math.abs(m[0]),Math.abs(m[1]))),d=Ie(m,[0,1]).ticks(3),h=bt(d,u,t.locale),f=20,p=22,w=Ie(m,[o-p,f]),k=wr(s.map(g=>`${g.i}`),[h+4,r-2],.34,.12),v=k.bandwidth,M=Math.min(n.theme.radiusMark,v/4),$=t.motion.stagger??130,y=(0,sn.useMemo)(()=>s.map((g,S)=>{let H=w(g.start),W=w(g.end);return{key:`w:${g.label}`,to:[H,W,1],from:[H,H,0],enter:[H,H,0],delay:S*$,data:g}}),[s,m[0],m[1],o,$]),P=Ur(y,t.motion),D=j(n,"ink"),L=j(n,"accent"),O=j(n,"neutral"),E=j(n,"strong"),R=(g,S)=>g>0?`+${S(g)}`:g<0?`−${S(-g)}`:S(0),F=g=>R(g,t.fmt),C=s.map((g,S)=>({datum:g.datum,index:S,key:g.label,label:g.label,value:g.value,formatted:g.total?t.fv(g.value):R(g.value,t.fv)})),b=null;if(t.active!==null&&s[t.active]){let g=s[t.active];b={x:k(`${g.i}`)+v/2,y:Math.min(w(g.start),w(g.end)),title:g.label,rows:g.total?[{label:a,value:t.fv(g.value),color:D.fill}]:[{label:g.value>=0?i.up:i.down,value:R(g.value,t.fv),color:g.hi?L.fill:g.value>=0?O.fill:E.fill},{label:i.cum,value:t.fv(g.end)}]}}let T=e.description??`${i.kind}. ${s.map(g=>g.total?`${g.label} ${t.fv(g.value)}`:`${g.label} ${F(g.value)}`).join(", ")}.`;return(0,ce.jsxs)(Yn,{c:t,kind:i.kind,ariaLabel:e.ariaLabel,description:T,events:C,tip:b,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,ce.jsx)(br,{p:n,ticks:d,y:w,x0:h,x1:r,fmt:u,locale:t.locale}),P.items.map(g=>{let S=g.data;if(g.exiting)return null;let H=S.i,[W,_,X]=g.v,q=Math.min(W,_),B=Math.abs(_-W),ne=S.total?D:S.hi?L:S.value>=0?O:E,re=k(`${H}`),He=s[H+1],Ct=w(S.end),ge=(S.total||S.value>=0?q:q+B)+(S.total||S.value>=0?-9:10),un=P.fade(H*$+260,240);return(0,ce.jsxs)("g",{className:"ztd-mark",opacity:t.dim(S.i),onPointerEnter:ho=>t.setActive(H,ho.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(H),children:[(0,ce.jsx)("rect",{x:Math.max(0,re-(k.step-v)/2),y:f,width:Math.max(0,Math.min(r,re-(k.step-v)/2+k.step)-Math.max(0,re-(k.step-v)/2)),height:o-p-f,fill:"transparent"}),e.connectors!==!1&&He?(0,ce.jsx)("line",{x1:re+v,x2:k(`${H+1}`),y1:Math.round(Ct)+.5,y2:Math.round(Ct)+.5,stroke:n.paint("dim"),strokeWidth:1,strokeDasharray:"2 3",opacity:un*.9}):null,(0,ce.jsx)("path",{d:Xt(re,q,v,Math.max(B,X>0?1:0),S.value>=0||S.total?{tl:M,tr:M}:{bl:M,br:M}),fill:ne.fill,opacity:Math.max(.001,X)}),t.active===H&&t.via==="keyboard"?(0,ce.jsx)("path",{d:Xt(re-3,q-3,v+6,B+6,5),fill:"none",stroke:n.paint("ink"),strokeWidth:2}):null,t.showLabels?(0,ce.jsx)(Pe,{x:re+v/2,y:ge,anchor:"middle",size:11,weight:S.total||S.hi?800:500,fill:n.paint(S.total||S.hi?"ink":"muted"),opacity:un,children:S.total?t.fmt(S.value):F(S.value)}):null]},g.key)}),(0,ce.jsx)(yr,{p:n,width:r,labels:s.map(g=>g.label),centers:s.map(g=>k(`${g.i}`)+v/2),y:o-p+13,strong:new Set(s.map((g,S)=>g.total?S:-1).filter(g=>g>=0))})]})}var ye=N(I(),1);function co(e,t){let n=ft(e);return n?.type==="scatter"&&t?.size!==void 0?ft("bubble"):n}function Mi(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 Ti(e,t,n,r=!1){let o=co(e.type,e.encoding);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&Gt.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=ke(i.label,"label"),d=Le(i.value,"value"),h=o.type==="waffle",f=t.map(($,y)=>({r:$,label:u($,y),value:h?d($,y):no(d($,y))})),{kept:p,other:w}=h?{kept:f,other:null}:to(f,a.other,($,y)=>({r:{},label:eo(K(n),$),value:y})),k=he(s,p.map($=>$.r),p.map($=>$.label),p.map($=>$.value),h?"first":"max"),v=w?[...p,w]:p,M=Ve($=>h?me($,v.length,k):ro($,v.length,k,a.colorMode));return v.map(($,y)=>({label:$.label,color:M[y]}))}if(o.type==="candlestick"){let u=Qr(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Zr[K(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:on[f],shape:"line"}))]}if(o.type==="scatter"){if(typeof i.series!="string")return[];let u=ke(i.series,"series"),d=Ee(t.map((p,w)=>u(p,w)));if(d.length<2)return[];let h=Jr(s,t,d,u),f=Ve(p=>Nn(p,d.length,h));return c(d.map((p,w)=>({label:p,color:f[w],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let M=ke(i.series,"series");u=Ee(t.map(($,y)=>M($,y)))}let d=Kt(o.type,i,a);if(d.length){let M=he(s,u,u,u.map(()=>0),"none"),$=Ve(P=>me(P,u.length,M)),y=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((P,D)=>({label:P,color:$[D]}));return[...c(y),...d.map((P,D)=>({label:P,color:qr(D),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?sr(u.length,Array.isArray(a.negative)?a.negative.map(M=>u.indexOf(String(M))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,p=f>=0?new Set([f]):he(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((M,$)=>({label:M,color:p.has($)?"accent":"neutralStrong",shape:"square"})));let w=a.colorMode,k=M=>me(M,u.length,p);if((o.type==="line"||o.type==="area")&&(k=M=>Xr(M,u.length,p,o.type==="area",w)),o.type==="stream"){let M=Ke(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),$=ao(M.values,a.reorder),y=io(s,M.series,M.values);k=P=>so(P,$,y)}let v=Ve(k);return c(u.map((M,$)=>({label:M,color:v[$],...o.type==="line"&&{shape:"line"}})))}return[]}function Si(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Qn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ai(e,t,n){let{data:r,width:o,height:i,highlight:a,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:i,highlight:a,syncId:s,title:l,description:c}}function uo(e,t){let{spec:n}=e,r=co(n.type,n.encoding),o=(0,qe.useMemo)(()=>Hr(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Zn(n,e.locale),s=Q(a),l=K(s),c=Pr(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=nr(n),u=(0,qe.useMemo)(()=>m?Br(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[p,w]=(0,qe.useState)(null);if(!r)return(0,ye.jsx)(Wt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let k=o??c.data,v=t[r.type],M={...n.options??{}},$={...Mi(r,n.encoding),...M,...u?{tooltip:u}:{},data:k,...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:a},y=n.card?.legend==="toggle"&&tr(r.type,n.encoding??{},M),P=p&&p.base===f?p.hidden:h;y&&($.hidden=P);let D=F=>w(C=>{let b=C&&C.base===f?C.hidden:h;return{base:f,hidden:b.includes(F)?b.filter(T=>T!==F):[...b,F]}}),L=$.height??220,O=Si(n,r.type),E=i&&!k.length&&(c.loading||c.error||c.empty)?(0,ye.jsx)(Wt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:L,locale:a}):O?(0,ye.jsx)(Rr,{chart:v,...Ai(r.type,O,$)}):(0,ye.jsx)(v,{...$});if(n.card){let F=n.card,C=F.legend==="auto"||F.legend==="toggle"?Ti(n,k,s,y):F.legend,b=C?.length?y?(0,ye.jsx)(Vt,{items:C,hidden:P,onToggle:D,locale:a}):C:void 0,T=F.download?(0,ye.jsx)(Or,{data:k,columns:rr(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:a}):void 0;E=(0,ye.jsx)(Un,{number:F.number,title:F.title??Jn(r,l),subtitle:F.subtitle,legend:b,actions:T,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:a,children:E})}let R=e.theme??n.theme;return R&&(E=(0,ye.jsx)(lt,{theme:R,children:E})),E}function Fi({cfg:e,components:t}){let n=Oe();return uo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function fo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,mo.hydrateRoot)(r,(0,cn.createElement)(lt,{theme:o.theme,cssVars:!0},(0,cn.createElement)(Fi,{cfg:o,components:{[e]:t}})))}fo("waterfall",ln);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztd-charts-cli",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "ztd-charts CLI: list charts, get JSON Schemas, validate specs, render SVG/PNG/HTML, start a project, and get chart suggestions from data",
5
5
  "license": "MIT",
6
6
  "author": "Junhan2",
@@ -35,7 +35,7 @@
35
35
  "@resvg/resvg-js": "^2.6.2",
36
36
  "react": "^19.3.1",
37
37
  "react-dom": "^19.3.1",
38
- "ztd-charts": "0.5.1"
38
+ "ztd-charts": "0.7.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/react": "^19.2.0",
@@ -45,7 +45,7 @@
45
45
  "typescript": "5.9.3"
46
46
  },
47
47
  "scripts": {
48
- "build": "rm -rf dist && tsup && node scripts/copy-fonts.mjs",
48
+ "build": "rm -rf dist && tsup && node scripts/build-client.mjs && node scripts/copy-fonts.mjs",
49
49
  "typecheck": "tsc --noEmit -p tsconfig.json"
50
50
  }
51
51
  }