ztd-charts-cli 0.7.0 → 0.8.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 (54) hide show
  1. package/README.md +1 -1
  2. package/dist/api.d.ts +11 -1
  3. package/dist/api.js +5 -1
  4. package/dist/{chunk-4WXNLD5P.js → chunk-FB5WHEJX.js} +38 -15
  5. package/dist/cli.js +5 -4
  6. package/dist/client/NOTICE.md +39 -0
  7. package/dist/client/area.js +10 -10
  8. package/dist/client/bar.js +10 -10
  9. package/dist/client/barRace.js +28 -0
  10. package/dist/client/beeswarm.js +10 -10
  11. package/dist/client/box.js +10 -10
  12. package/dist/client/bubble.js +10 -10
  13. package/dist/client/bullet.js +9 -9
  14. package/dist/client/bump.js +10 -10
  15. package/dist/client/calendar.js +9 -9
  16. package/dist/client/candlestick.js +9 -9
  17. package/dist/client/chord.js +10 -10
  18. package/dist/client/choropleth.js +28 -0
  19. package/dist/client/donut.js +10 -10
  20. package/dist/client/dumbbell.js +9 -9
  21. package/dist/client/flowMap.js +28 -0
  22. package/dist/client/funnel.js +10 -10
  23. package/dist/client/gauge.js +10 -10
  24. package/dist/client/geo-kr-sido.js +1 -0
  25. package/dist/client/geo-us-states.js +1 -0
  26. package/dist/client/geo-world.js +1 -0
  27. package/dist/client/heatmap.js +9 -9
  28. package/dist/client/histogram.js +6 -6
  29. package/dist/client/line.js +10 -10
  30. package/dist/client/lollipop.js +10 -10
  31. package/dist/client/marimekko.js +6 -6
  32. package/dist/client/network.js +28 -0
  33. package/dist/client/parallel.js +9 -9
  34. package/dist/client/pareto.js +10 -10
  35. package/dist/client/pie.js +10 -10
  36. package/dist/client/radar.js +10 -10
  37. package/dist/client/radialBar.js +10 -10
  38. package/dist/client/ridgeline.js +10 -10
  39. package/dist/client/sankey.js +10 -10
  40. package/dist/client/scatter.js +10 -10
  41. package/dist/client/segmented.js +9 -9
  42. package/dist/client/skyline.js +10 -10
  43. package/dist/client/slope.js +10 -10
  44. package/dist/client/sparkline.js +10 -10
  45. package/dist/client/stream.js +10 -10
  46. package/dist/client/sunburst.js +9 -9
  47. package/dist/client/symbolMap.js +28 -0
  48. package/dist/client/tileMap.js +10 -10
  49. package/dist/client/timeline.js +28 -0
  50. package/dist/client/tree.js +28 -0
  51. package/dist/client/treemap.js +9 -9
  52. package/dist/client/waffle.js +9 -9
  53. package/dist/client/waterfall.js +10 -10
  54. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
- (()=>{var Oo=Object.create;var Fn=Object.defineProperty;var zo=Object.getOwnPropertyDescriptor;var Bo=Object.getOwnPropertyNames;var Ho=Object.getPrototypeOf,jo=Object.prototype.hasOwnProperty;var zt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Vo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bo(t))!jo.call(e,o)&&o!==n&&Fn(e,o,{get:()=>t[o],enumerable:!(r=zo(t,o))||r.enumerable});return e};var S=(e,t,n)=>(n=e!=null?Oo(Ho(e)):{},Vo(t||!e||!e.__esModule?Fn(n,"default",{value:e,enumerable:!0}):n,e));var W=zt((ts,Nn)=>{Nn.exports=globalThis.__ztdReact.react});var Pn=zt((ns,Rn)=>{Rn.exports=globalThis.__ztdReact["react-dom/client"]});var E=zt((ps,cr)=>{cr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Tn=S(W(),1),Po=S(Pn(),1);var at=S(W(),1);var Ct=S(W(),1);var Dn=S(W(),1),He=(0,Dn.createContext)(void 0);var In=S(W(),1);var Wo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Ln='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',En='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Ne={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:Ln,monoFamily:En,radius:18,radiusCode:14,radiusMark:4},Bt={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:Ln,monoFamily:En,radius:18,radiusCode:14,radiusMark:4},Ht={dark:Ne,light:Bt};function ut(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function jt(e){let t={};for(let n of Wo){let r=e[n];typeof r=="string"&&(t[ut(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 Vt(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 Go=`
1
+ (()=>{var Uo=Object.create;var Pn=Object.defineProperty;var Xo=Object.getOwnPropertyDescriptor;var Yo=Object.getOwnPropertyNames;var qo=Object.getPrototypeOf,Jo=Object.prototype.hasOwnProperty;var jt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Zo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Yo(t))!Jo.call(e,o)&&o!==n&&Pn(e,o,{get:()=>t[o],enumerable:!(r=Xo(t,o))||r.enumerable});return e};var C=(e,t,n)=>(n=e!=null?Uo(qo(e)):{},Zo(t||!e||!e.__esModule?Pn(n,"default",{value:e,enumerable:!0}):n,e));var V=jt((ys,Dn)=>{Dn.exports=globalThis.__ztdReact.react});var En=jt((xs,Ln)=>{Ln.exports=globalThis.__ztdReact["react-dom/client"]});var L=jt((Ps,dr)=>{dr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Rn=C(V(),1),Ho=C(En(),1);var it=C(V(),1);var Tt=C(V(),1);var On=C(V(),1),Ge=(0,On.createContext)(void 0);var Hn=C(V(),1);var Qo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],In='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',zn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Re={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:In,monoFamily:zn,radius:18,radiusCode:14,radiusMark:4},Gt={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:In,monoFamily:zn,radius:18,radiusCode:14,radiusMark:4},Vt={dark:Re,light:Gt};function mt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Wt(e){let t={};for(let n of Qo){let r=e[n];typeof r=="string"&&(t[mt(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 Kt(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 ea=`
2
2
  .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
3
  .ztd-root:focus{outline:none}
4
- .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Ne.accent});outline-offset:3px;border-radius:6px}
4
+ .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Re.accent});outline-offset:3px;border-radius:6px}
5
5
  .ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
6
6
  .ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
7
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)}
@@ -9,9 +9,9 @@
9
9
  .ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
10
10
  .ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
11
11
  .ztd-btn:focus{outline:none}
12
- .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Ne.accent});outline-offset:2px}
12
+ .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Re.accent});outline-offset:2px}
13
13
  .ztd-card{transition:border-color .16s ease}
14
- .ztd-card:hover{border-color:var(--ztd-dim,${Ne.dim})}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${Re.dim})}
15
15
  @media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
16
16
  @keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
17
17
  @keyframes ztd-fade{from{opacity:0}to{opacity:1}}
@@ -19,10 +19,10 @@
19
19
  @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
20
  .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
21
  @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
- `;function On(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 zn(e,t){let[n]=(0,In.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var _n=!1;function Ze(){if(_n||typeof document>"u"||(_n=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Go,document.head.appendChild(e)}var mt=S(W(),1),fe=typeof window<"u"&&typeof document<"u",be=fe?mt.useLayoutEffect:mt.useEffect;function dt(){return typeof performance<"u"?performance.now():Date.now()}function K(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ce(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Bn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Hn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var Ko=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Uo={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Xo(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Yo(e){return Xo(Ko,e)}function jn(e,t){let n=Yo(e);return{text:n?n[t]:e,...Uo[n?.id??"basic"]}}var Vn={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Re(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Vn[t.toLowerCase()]&&(t=Vn[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 Gt(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 ft(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 je(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Wn(e){return .2126*je(e[0])+.7152*je(e[1])+.0722*je(e[2])}function Kt(e,t,n){let r=typeof e=="string"?Re(e):e,o=typeof t=="string"?Re(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Re(n):n:null;o[3]<1&&a&&(o=ft(o,a));let i=r[3]<1?ft(r,o):r,s=Wn(i),l=Wn(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function qo(e){return[je(e[0]),je(e[1]),je(e[2])]}function Wt(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 Gn(e){let[t,n,r]=qo(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 Jo([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[Wt(4.0767416621*o-3.3077115913*a+.2309699292*i),Wt(-1.2684380046*o+2.6097574011*a-.3413193965*i),Wt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function ht(e,t,n){let r=Re(e),o=Re(t);if(!r||!o)return e;let a=Gn(r),i=Gn(o),s=Math.max(0,Math.min(1,n));return Gt(Jo([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 Ut(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Kt(a,e,n);i>o&&(o=i,r=a)}return r}function Zo(e,t,n){let r=Re(e),o=Re(t);return!r||!o?e:Gt(ft([r[0],r[1],r[2],n],o))}function Y(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 Kn(e,t){let n=Ut(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Kt(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Ut(t,["#FFFFFF","#000000"])}function gt(e,t){let n=ht(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Kn(e,n),raw:n}}function ye(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Y(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=Y(e,"neutral");else if(s===0)r[i]=Y(e,"ink");else if(s===a-1)r[i]=Y(e,"neutral");else if(a===3)r[i]=Y(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?Y(e,"strong"):gt(e,1-l)}}),r}var Xt="mix:";function Qe(e){return e({theme:Bt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Xt}${o}`}).map(n=>n.fill)}function Un(e,t){return t?.startsWith(Xt)?e.mix("neutralStrong","neutral",Number(t.slice(Xt.length))):e.color(t)}function Xn(e,t,n){return ye(e,t+1,n).slice(0,t)}function Yn(e,t,n,r="neutral"){let o=Y(e,"accent"),a=Y(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function qn(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Y(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=Y(e,"neutral"):s===0?r[i]=Y(e,"strong"):s===a-1?r[i]=Y(e,"neutral"):r[i]=gt(e,1-s/(a-1))}),r}function Qo(e,t,n=.1,r="accent"){let o=Math.max(0,Math.min(1,t)),a=n+(1-n)*o,i=Zo(e.theme[r],e.theme.panel,a);return{fill:e.paint(r),opacity:a,text:Kn(e,i),raw:i}}function Yt(e,t){let n=t.reverse?t.center===void 0?1-e:-e:e;if(t.steps){let r=t.center===void 0?0:-1,o=Math.max(0,Math.min(t.steps-1,Math.floor((n-r)/(1-r)*t.steps)));n=r+(1-r)*o/(t.steps-1)}return n}function pt(e,t,n,r){let o=Yt(t,r);return Qo(e,Math.abs(o),n,o<0?"neutralStrong":"accent")}function Jn(e,t,n){return{reverse:e,center:t,steps:n===void 0?void 0:Math.max(2,Math.min(12,Math.round(n)))}}var he=S(W(),1);var yt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),Q="en-US",Zn=new Map;function qt(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=Zn.get(r);return o||(o=new Intl.NumberFormat(e,n),Zn.set(r,o)),o}function Jt(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Ve(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=Q,...r}=t;return Jt(qt(n,r).format(e))}var Zt=e=>e!==0&&Math.abs(e)<.05,Qt=(e,t,n="")=>`${Ve(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function bt(e,t={}){if(!Number.isFinite(e))return"-";if(Zt(e)&&t.maximumFractionDigits===void 0)return Qt(e,t.locale??Q,"%");let n=Math.abs(e);return`${Ve(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function nr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=Q,...r}=t;if(K(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Ve(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Jt(qt(n,{notation:"compact",...r}).format(e))}var ea=(e,t=K(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function _e(e,t=Q,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=qt(t,o);return l=>Number.isFinite(l)?`${i}${Jt(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>bt(o,{locale:t});case"ratio":return o=>bt(o*100,{locale:t});case"compact":return o=>nr(o,{locale:t});case"currency":return r(ea(t));default:{let o=r({maximumFractionDigits:1});return a=>Zt(a)?Qt(a,t):o(a)}}}function rr(e,t=Q,n=0){return e!==void 0?_e(e,t):n>=1e5?r=>Zt(r)?Qt(r,t):nr(r,{locale:t}):r=>Ve(r,{locale:t})}function ta(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var en=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,na=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,ra=["january","february","march","april","may","june","july","august","september","october","november","december"],Qn=e=>{let t=e.toLowerCase();return t.length<3?0:ra.findIndex(n=>n.startsWith(t))+1},er=e=>+e+(+e<30?2e3:1900);function or(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var oa=[/^(\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})일)?$/],ar=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,ir=/\{([^{}]+)\}/g;function xt(e,t){let n;for(let r of oa)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?[er(n[3]),+n[2],+n[1],1]:[er(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=ar.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=Qn(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=Qn(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var sr=e=>na.test(e)||xt(e)!==null;function lr(e){let t;for(let n of e){let r=typeof n=="string"?ar.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function kt(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(en(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return kt(`${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=xt(n,t);if(r)return ta(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 tr=new Map;function et(e,t={month:"short",day:"numeric"}){let n=kt(e);if(!n)return"-";let{locale:r=Q,...o}=t,a=r+JSON.stringify(o),i=tr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),tr.set(a,i)),i.format(n)}var tn=S(E(),1),wt=(0,he.createContext)({theme:Ne,cssVars:!0});function aa(e,t=Ne){return e?typeof e=="string"?Ht[e]??t:Vt(t,e):t}function vt(e){let t=(0,he.useContext)(wt),n=e.base?Ht[e.base]:t.theme,r=(0,he.useMemo)(()=>aa(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,he.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,he.useMemo)(()=>jt(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,tn.jsx)(wt.Provider,{value:i,children:(0,tn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var ia=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function ur(e){return ia.has(e)}function sa(e,t){let n=r=>t?`var(${ut(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?ur(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?ur(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)})`:ht(e[r],e[o],a)}}}function ge(e){let t=(0,he.useContext)(wt);return(0,he.useMemo)(()=>{let n=Vt(t.theme,e);return sa(n,t.cssVars)},[t.theme,t.cssVars,e])}function ne(e){let t=(0,he.useContext)(wt);return e??t.locale??Q}function mr(e){return e?jt(e):{}}var $t=S(W(),1),nn=(0,$t.createContext)(void 0);function dr(e){let t=(0,$t.useContext)(nn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var A=S(E(),1),la={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`},ca={en:la,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var ua={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},rn=e=>ca[K(ne(e))];function on(e){let t=ge(e.theme),n=rn(e.locale),[r,o]=(0,Ct.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,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),f=d&&l===1,h=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ma,{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:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,A.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":f||void 0,onClick:()=>{f||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:h}):h},u)})});return i?(0,A.jsxs)(A.Fragment,{children:[c,(0,A.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:ua,children:r?n.shown(l,e.items.length):""})]}):c}function ma({p:e,item:t,off:n}){let r=Un(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 da(e){let t=ge(e.theme),n=jn(e.level,K(ne(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 fa(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 fr(e){let t=ge(e.theme),n=rn(e.locale),[r,o]=(0,Ct.useState)(0);be(()=>Ze(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,A.jsx)(on,{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)(da,{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:fa(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,A.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,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||i?(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",{}),i]}):null]}),(0,A.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,A.jsx)(nn.Provider,{value:r,children:(0,A.jsx)(He.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 an(e){let t=ge(e.theme),n=rn(e.locale),r=e.height??220;if(be(()=>Ze(),[]),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,a)=>(0,A.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,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 Ye=S(W(),1);var re=S(W(),1);var B=S(E(),1),Mt=60;var Tt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function hr(e){let{c:t,events:n}=e,r=(0,re.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,be(()=>{Ze()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,re.useContext)(He),c=e.ariaLabel??l??e.kind,m=(0,re.useMemo)(()=>s?`${n.length}${n.slice(0,Mt).map(b=>`${b.label}${b.series??""}${b.formatted??b.value??""}`).join("")}`:"",[n,s]),u=(0,re.useMemo)(()=>(0,B.jsx)(ha,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,re.useRef)(null);(0,re.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,re.useEffect)(()=>{d.current=null},[t.width,t.height]);let f=b=>{if(b.target!==b.currentTarget)return;if(e.onKey?.(b)){b.preventDefault();return}let T=t.active,L;switch(b.key){case"ArrowRight":case"ArrowDown":L=T===null?0:(T+1)%i;break;case"ArrowLeft":case"ArrowUp":L=T===null?i-1:(T-1+i)%i;break;case"Home":L=0;break;case"End":L=i-1;break;case"Escape":if(T===null)return;L=null;break;case"Enter":case" ":T!==null&&(b.preventDefault(),t.click(T));return;default:return}b.preventDefault(),t.setActive(L,"keyboard")},{via:h,node:g,setActive:y}=t;(0,re.useEffect)(()=>{if(h!=="touch"||!g)return;let b=T=>{g.contains(T.target)||y(null)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[h,g,y]);let x=t.active!==null?n[t.active]:null,w=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,M=w&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,v=typeof e.renderTip=="function"&&x?e.renderTip(x):null,p=e.announce??(t.via==="keyboard"&&x?`${x.label}${x.series?` ${x.series}`:""}: ${x.formatted??x.value??""} (${(t.active??0)+1}/${i})`:""),N;if(w){let b=w.x*M,T=t.width*M,L=`clamp(${(4-b).toFixed(1)}px, -50%, calc(${(T-b-4).toFixed(1)}px - 100%))`,z=w.y<64;N={position:"absolute",left:b,top:w.y*M,transform:`translate(${L}, ${z?"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 _=b=>{d.current=null,b.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},I=b=>b?T=>{let L=d.current??(d.current=T.currentTarget.getBoundingClientRect());L.width&&b((T.clientX-L.left)/L.width*t.width,(T.clientY-L.top)/L.height*t.height,T)}:void 0,O=I(e.onPointerMove),R=I(e.onPointerDown),D=O||R?b=>{b.pointerType==="touch"&&O?.(b),R?.(b)}:void 0,F=I(e.onPointerUp),$=mr(e.theme);return(0,B.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:b=>{t.via==="keyboard"&&!b.currentTarget.contains(b.relatedTarget)&&t.setActive(null)},onPointerLeave:_,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"),...$,...e.style},children:[t.pending?null:e.underlay,(0,B.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:O,onPointerDown:D,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,B.jsx)("title",{id:o,children:c}),(0,B.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,B.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,w?(0,B.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:N,children:v??(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:w.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:w.title}),w.rows.map((b,T)=>(0,B.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,B.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(b.strong?"ink":"muted")},children:[b.color?(0,B.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,B.jsx)("span",{style:{fontWeight:b.strong===!1?500:700},children:b.value})]},T))]})}):null,(0,B.jsx)("span",{className:"ztd-sr",style:Tt,"aria-live":"polite","aria-atomic":"true",children:p}),s&&!t.pending?u:null]})}function ha({label:e,events:t,t:n}){return(0,B.jsx)("div",{className:"ztd-sr",style:Tt,children:(0,B.jsxs)("table",{children:[(0,B.jsx)("caption",{children:n.table(e)}),(0,B.jsxs)("tbody",{children:[t.slice(0,Mt).map((r,o)=>(0,B.jsxs)("tr",{children:[(0,B.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,B.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Mt?(0,B.jsx)("tr",{children:(0,B.jsx)("td",{colSpan:2,children:n.more(t.length-Mt)})}):null]})]})})}function Ie(e){let t=e.baseline??"central";return(0,B.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 k=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),pe=k("label","string",!0,"Item name field"),J=k("value","number",!0,"Value field"),ga=[pe,J],pa=[pe,J],ba=[k("label","string",!0,"Stage name"),k("value","number",!0,"Users at the stage")],ya=[pe,J],xa=[k("label","string",!0,"Leaf (lowest level) name"),J,k("group","string",!1,"Parent group field")],ka=[k("label","string",!0,"Leaf name"),J,k("group","string",!1,"Parent group field")],wa=[pe,k("value","number",!0,"Change (total rows may omit it)"),k("type","string",!1,'"total" makes a total bar')],va=[pe,J],$a=[k("x","string",!0,"Column field"),k("series","string",!0,"Stacked series field"),J],Ca=[k("x","string",!0,"Column field"),k("y","string",!0,"Row field"),J],Ma=[k("axis","string",!0,"Metric (axis) field"),k("value","number",!0,"Value field",{multi:!0}),k("series","string",!1,"Series field")],Ta=[k("x","number",!0,"x value"),k("y","number",!0,"y value"),k("size","number",!1,"Circle size"),k("label","string",!1,"Name")],pr=k("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Sa=[k("x","any",!0,"x field (date, number or category)"),k("y","number",!0,"y field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field (long tables)"),k("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),pr],Aa=[k("x","any",!0,"x field"),k("y","number",!0,"y field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field"),k("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}),pr],Fa=[k("x","any",!0,"x field"),k("y","number",!0,"y field",{multi:!0}),k("series","string",!1,"Series field")],Na=[k("x","string",!0,"Category field"),k("y","number",!0,"Value field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field"),k("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})],Ra=[pe,J],Pa=[k("value","number",!0,"Value field",{prop:"valueKey"}),k("target","number",!1,"Target field",{prop:"targetKey"})],Da=[pe,k("value","number",!0,"Actual value field"),k("target","number",!1,"Target field")],La=[k("x","any",!1,"x field"),k("y","number",!0,"y field")],Ea=[pe,k("x","string",!1,"Period field (long tables)"),k("value","number",!1,"Value field (long tables)")],_a=[pe,k("start","number",!0,"Before value"),k("end","number",!0,"After value")],Ia=[pe,J],Oa=[k("value","number",!0,"Value field"),k("group","string",!1,"Group (row) field"),k("label","string",!1,"Dot name")],za=[k("group","string",!0,"Group field"),k("value","number",!0,"Value field")],Ba=[k("source","string",!0,"Source node"),k("target","string",!0,"Target node"),J],Ha=[k("source","string",!0,"Sending group"),k("target","string",!0,"Receiving group"),J],ja=[k("date","date",!0,"Date field"),J],Va=[k("x","any",!0,"Period field"),k("series","string",!0,"Item field"),k("rank","number",!1,"Rank field (1 is first)"),k("value","number",!1,"Value field (instead of rank, largest is first)")],Wa=[k("group","string",!0,"Group field"),k("value","number",!0,"Value field")],Ga=[k("label","string",!1,"Row name field")],Ka=[k("x","date",!0,"Date (period) field"),k("open","number",!0,"Open price field"),k("high","number",!0,"High price field"),k("low","number",!0,"Low price field"),k("close","number",!0,"Close price field"),k("volume","number",!1,"Volume field")],Ua=[pe,J],Xa=[k("x","any",!0,"Period field (date or category)"),k("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field (long tables, back row only)"),k("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Ya=[k("value","number",!1,"Sample value field (raw rows)"),k("group","string",!1,"Group field. Up to 2 groups overlap"),k("x0","number",!1,"Bin start (pre-binned rows)"),k("x1","number",!1,"Bin end (pre-binned rows)"),k("count","number",!1,"Samples in the bin (pre-binned rows)")],qa=[k("region","string",!0,"Region name or code, matched to a tile of options.map"),J],Ja=[k("x","number",!0,"x value"),k("y","number",!0,"y value"),k("series","string",!1,"Series field (one color per series)"),k("label","string",!1,"Name")],gr={pie:ga,donut:pa,funnel:ba,waffle:ya,treemap:xa,sunburst:ka,waterfall:wa,pareto:va,marimekko:$a,heatmap:Ca,radar:Ma,bubble:Ta,line:Sa,area:Aa,stream:Fa,bar:Na,radialBar:Ra,gauge:Pa,bullet:Da,sparkline:La,slope:Ea,dumbbell:_a,lollipop:Ia,beeswarm:Oa,ridgeline:za,sankey:Ba,chord:Ha,calendar:ja,bump:Va,box:Wa,parallel:Ga,candlestick:Ka,segmented:Ua,skyline:Xa,histogram:Ya,scatter:Ja,tileMap:qa},We={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 br(e,t){return t==="ko"?e.nameKo:e.name}function yr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var xr=["line","area","bar","scatter"],kr=24,sn=["line","area","bar","scatter"];function ln(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function wr(e,t,n){return sn.includes(e)&&!ln(e,t,n).length}function vr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Za={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 St(e){let t=gr[e]?e:Za[e]??Object.keys(We).find(n=>n.toLowerCase()===e.toLowerCase()||We[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!We[t]))return{type:t,component:We[t].component,name:We[t].name,nameKo:We[t].nameKo,encoding:gr[t]}}function $r(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 St(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 Cr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Qa(e,t){if(e==null||typeof e!="object")return;let n=e;if(Cr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Cr(r,o))return;r=r[o]}return r}}function Me(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 Ge(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Qa(r,n)}function Ke(e,t){let n=Ge(e,t);return(r,o)=>Me(n(r,o))}function Te(e,t){let n=Ge(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 Se(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function ei(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,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var ti=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function Mr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(ti.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Me(t);if(Number.isFinite(n))return n}return t}function Oe(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??ei(o),i=[],s=[],l="",c=!1;for(let h=0;h<o.length;h++){let g=o[h];c?g==='"'?o[h+1]==='"'?(l+='"',h++):c=!1:l+=g:g==='"'&&!l.trim()?(c=!0,l=""):g===a?(s.push(l),l=""):g===`
22
+ `;function jn(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 Gn(e,t){let[n]=(0,Hn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Bn=!1;function Qe(){if(Bn||typeof document>"u"||(Bn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=ea,document.head.appendChild(e)}var dt=C(V(),1),pe=typeof window<"u"&&typeof document<"u",ve=pe?dt.useLayoutEffect:dt.useEffect;function ft(){return typeof performance<"u"?performance.now():Date.now()}function K(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."},Wn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ta=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],na={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function ra(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function oa(e){return ra(ta,e)}function Kn(e,t){let n=oa(e);return{text:n?n[t]:e,...na[n?.id??"basic"]}}var Un={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()),Un[t.toLowerCase()]&&(t=Un[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 Xt(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 ht(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 Ve(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Xn(e){return .2126*Ve(e[0])+.7152*Ve(e[1])+.0722*Ve(e[2])}function Yt(e,t,n){let r=typeof e=="string"?Fe(e):e,o=typeof t=="string"?Fe(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Fe(n):n:null;o[3]<1&&a&&(o=ht(o,a));let i=r[3]<1?ht(r,o):r,s=Xn(i),l=Xn(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function aa(e){return[Ve(e[0]),Ve(e[1]),Ve(e[2])]}function Ut(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 Yn(e){let[t,n,r]=aa(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 ia([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[Ut(4.0767416621*o-3.3077115913*a+.2309699292*i),Ut(-1.2684380046*o+2.6097574011*a-.3413193965*i),Ut(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function gt(e,t,n){let r=Fe(e),o=Fe(t);if(!r||!o)return e;let a=Yn(r),i=Yn(o),s=Math.max(0,Math.min(1,n));return Xt(ia([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 qt(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Yt(a,e,n);i>o&&(o=i,r=a)}return r}function sa(e,t,n){let r=Fe(e),o=Fe(t);return!r||!o?e:Xt(ht([r[0],r[1],r[2],n],o))}function Y(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 qn(e,t){let n=qt(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Yt(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):qt(t,["#FFFFFF","#000000"])}function pt(e,t){let n=gt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:qn(e,n),raw:n}}function be(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Y(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=Y(e,"neutral");else if(s===0)r[i]=Y(e,"ink");else if(s===a-1)r[i]=Y(e,"neutral");else if(a===3)r[i]=Y(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?Y(e,"strong"):pt(e,1-l)}}),r}var Jt="mix:";function _e(e){return e({theme:Gt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Jt}${o}`}).map(n=>n.fill)}function Jn(e,t){return t?.startsWith(Jt)?e.mix("neutralStrong","neutral",Number(t.slice(Jt.length))):e.color(t)}function et(e,t,n){return be(e,t+1,n).slice(0,t)}function Zn(e,t,n,r="neutral"){let o=Y(e,"accent"),a=Y(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Qn(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Y(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=Y(e,"neutral"):s===0?r[i]=Y(e,"strong"):s===a-1?r[i]=Y(e,"neutral"):r[i]=pt(e,1-s/(a-1))}),r}function la(e,t,n=.1,r="accent"){let o=Math.max(0,Math.min(1,t)),a=n+(1-n)*o,i=sa(e.theme[r],e.theme.panel,a);return{fill:e.paint(r),opacity:a,text:qn(e,i),raw:i}}function Zt(e,t){let n=t.reverse?t.center===void 0?1-e:-e:e;if(t.steps){let r=t.center===void 0?0:-1,o=Math.max(0,Math.min(t.steps-1,Math.floor((n-r)/(1-r)*t.steps)));n=r+(1-r)*o/(t.steps-1)}return n}function bt(e,t,n,r){let o=Zt(t,r);return la(e,Math.abs(o),n,o<0?"neutralStrong":"accent")}function er(e,t,n){return{reverse:e,center:t,steps:n===void 0?void 0:Math.max(2,Math.min(12,Math.round(n)))}}var ye=C(V(),1);var xt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),Q="en-US",tr=new Map;function Qt(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=tr.get(r);return o||(o=new Intl.NumberFormat(e,n),tr.set(r,o)),o}function en(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function We(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=Q,...r}=t;return en(Qt(n,r).format(e))}var tn=e=>e!==0&&Math.abs(e)<.05,nn=(e,t,n="")=>`${We(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function yt(e,t={}){if(!Number.isFinite(e))return"-";if(tn(e)&&t.maximumFractionDigits===void 0)return nn(e,t.locale??Q,"%");let n=Math.abs(e);return`${We(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function ar(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=Q,...r}=t;if(K(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**d)/10**d;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+We(u,{locale:n,...r,maximumFractionDigits:d})+l}}return en(Qt(n,{notation:"compact",...r}).format(e))}var ca=(e,t=K(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Oe(e,t=Q,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Qt(t,o);return l=>Number.isFinite(l)?`${i}${en(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>yt(o,{locale:t});case"ratio":return o=>yt(o*100,{locale:t});case"compact":return o=>ar(o,{locale:t});case"currency":return r(ca(t));default:{let o=r({maximumFractionDigits:1});return a=>tn(a)?nn(a,t):o(a)}}}function ir(e,t=Q,n=0){return e!==void 0?Oe(e,t):n>=1e5?r=>tn(r)?nn(r,t):ar(r,{locale:t}):r=>We(r,{locale:t})}function ua(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var rn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,ma=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,da=["january","february","march","april","may","june","july","august","september","october","november","december"],nr=e=>{let t=e.toLowerCase();return t.length<3?0:da.findIndex(n=>n.startsWith(t))+1},rr=e=>+e+(+e<30?2e3:1900);function sr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var fa=[/^(\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})일)?$/],lr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,cr=/\{([^{}]+)\}/g;function kt(e,t){let n;for(let r of fa)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?[rr(n[3]),+n[2],+n[1],1]:[rr(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=lr.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=nr(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=nr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var ur=e=>ma.test(e)||kt(e)!==null;function mr(e){let t;for(let n of e){let r=typeof n=="string"?lr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function wt(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(rn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return wt(`${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=kt(n,t);if(r)return ua(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 or=new Map;function tt(e,t={month:"short",day:"numeric"}){let n=wt(e);if(!n)return"-";let{locale:r=Q,...o}=t,a=r+JSON.stringify(o),i=or.get(a);return i||(i=new Intl.DateTimeFormat(r,o),or.set(a,i)),i.format(n)}var on=C(L(),1),vt=(0,ye.createContext)({theme:Re,cssVars:!0});function ha(e,t=Re){return e?typeof e=="string"?Vt[e]??t:Kt(t,e):t}function $t(e){let t=(0,ye.useContext)(vt),n=e.base?Vt[e.base]:t.theme,r=(0,ye.useMemo)(()=>ha(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ye.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ye.useMemo)(()=>Wt(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,on.jsx)(vt.Provider,{value:i,children:(0,on.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var ga=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function fr(e){return ga.has(e)}function pa(e,t){let n=r=>t?`var(${mt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?fr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?fr(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)})`:gt(e[r],e[o],a)}}}function xe(e){let t=(0,ye.useContext)(vt);return(0,ye.useMemo)(()=>{let n=Kt(t.theme,e);return pa(n,t.cssVars)},[t.theme,t.cssVars,e])}function re(e){let t=(0,ye.useContext)(vt);return e??t.locale??Q}function hr(e){return e?Wt(e):{}}var Mt=C(V(),1),an=(0,Mt.createContext)(void 0);function gr(e){let t=(0,Mt.useContext)(an);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var A=C(L(),1),ba={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`},ya={en:ba,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var xa={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},sn=e=>ya[K(re(e))];function ln(e){let t=xe(e.theme),n=sn(e.locale),[r,o]=(0,Tt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.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((d,u)=>{let m=!s.has(d.label),f=m&&l===1,h=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ka,{p:t,item:d,off:!m}),(0,A.jsx)("span",{style:m?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,A.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,A.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":m,"aria-disabled":f||void 0,onClick:()=>{f||(i(d.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:h}):h},u)})});return i?(0,A.jsxs)(A.Fragment,{children:[c,(0,A.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:xa,children:r?n.shown(l,e.items.length):""})]}):c}function ka({p:e,item:t,off:n}){let r=Jn(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 wa(e){let t=xe(e.theme),n=Kn(e.level,K(re(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 va(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 pr(e){let t=xe(e.theme),n=sn(e.locale),[r,o]=(0,Tt.useState)(0);ve(()=>Qe(),[]);let a=()=>{o(m=>m+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,A.jsx)(ln,{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,d=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)(wa,{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:va(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,A.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,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||i?(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",{}),i]}):null]}),(0,A.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,A.jsx)(an.Provider,{value:r,children:(0,A.jsx)(Ge.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,A.jsxs)(A.Fragment,{children:[d,u]}):u]})}function cn(e){let t=xe(e.theme),n=sn(e.locale),r=e.height??220;if(ve(()=>Qe(),[]),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,a)=>(0,A.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,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 qe=C(V(),1);var oe=C(V(),1);var B=C(L(),1),Ct=60;var St={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function br(e){let{c:t,events:n}=e,r=(0,oe.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,ve(()=>{Qe()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,oe.useContext)(Ge),c=e.ariaLabel??l??e.kind,d=(0,oe.useMemo)(()=>s?`${n.length}${n.slice(0,Ct).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,oe.useMemo)(()=>(0,B.jsx)($a,{label:c,events:n,t:t.t}),[c,d,t.t]),m=(0,oe.useRef)(null);(0,oe.useEffect)(()=>{let x=()=>{m.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,oe.useEffect)(()=>{m.current=null},[t.width,t.height]);let f=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let T=t.active,D;switch(x.key){case"ArrowRight":case"ArrowDown":D=T===null?0:(T+1)%i;break;case"ArrowLeft":case"ArrowUp":D=T===null?i-1:(T-1+i)%i;break;case"Home":D=0;break;case"End":D=i-1;break;case"Escape":if(T===null)return;D=null;break;case"Enter":case" ":T!==null&&(x.preventDefault(),t.click(T));return;default:return}x.preventDefault(),t.setActive(D,"keyboard")},{via:h,node:g,setActive:k}=t;(0,oe.useEffect)(()=>{if(h!=="touch"||!g)return;let x=T=>{g.contains(T.target)||k(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[h,g,k]);let y=t.active!==null?n[t.active]:null,w=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,v=w&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,N=typeof e.renderTip=="function"&&y?e.renderTip(y):null,b=e.announce??(t.via==="keyboard"&&y?`${y.label}${y.series?` ${y.series}`:""}: ${y.formatted??y.value??""} (${(t.active??0)+1}/${i})`:""),S;if(w){let x=w.x*v,T=t.width*v,D=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(T-x-4).toFixed(1)}px - 100%))`,z=w.y<64;S={position:"absolute",left:x,top:w.y*v,transform:`translate(${D}, ${z?"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*v-8)}}let E=x=>{m.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},O=x=>x?T=>{let D=m.current??(m.current=T.currentTarget.getBoundingClientRect());D.width&&x((T.clientX-D.left)/D.width*t.width,(T.clientY-D.top)/D.height*t.height,T)}:void 0,I=O(e.onPointerMove),F=O(e.onPointerDown),P=I||F?x=>{x.pointerType==="touch"&&I?.(x),F?.(x)}:void 0,R=O(e.onPointerUp),$=hr(e.theme);return(0,B.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:E,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"),...$,...e.style},children:[t.pending?null:e.underlay,(0,B.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:I,onPointerDown:P,onPointerUp:R,onPointerCancel:R,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,B.jsx)("title",{id:o,children:c}),(0,B.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,B.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,w?(0,B.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:S,children:N??(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:w.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:w.title}),w.rows.map((x,T)=>(0,B.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,B.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,B.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,B.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},T))]})}):null,(0,B.jsx)("span",{className:"ztd-sr",style:St,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function $a({label:e,events:t,t:n}){return(0,B.jsx)("div",{className:"ztd-sr",style:St,children:(0,B.jsxs)("table",{children:[(0,B.jsx)("caption",{children:n.table(e)}),(0,B.jsxs)("tbody",{children:[t.slice(0,Ct).map((r,o)=>(0,B.jsxs)("tr",{children:[(0,B.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,B.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Ct?(0,B.jsx)("tr",{children:(0,B.jsx)("td",{colSpan:2,children:n.more(t.length-Ct)})}):null]})]})})}function Ie(e){let t=e.baseline??"central";return(0,B.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 p=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),me=p("label","string",!0,"Item name field"),q=p("value","number",!0,"Value field"),Ma=[me,q],Ta=[me,q],Ca=[p("label","string",!0,"Stage name"),p("value","number",!0,"Users at the stage")],Sa=[me,q],Aa=[p("label","string",!0,"Leaf (lowest level) name"),q,p("group","string",!1,"Parent group field")],Na=[p("label","string",!0,"Leaf name"),q,p("group","string",!1,"Parent group field")],Ra=[me,p("value","number",!0,"Change (total rows may omit it)"),p("type","string",!1,'"total" makes a total bar')],Fa=[me,q],_a=[p("x","string",!0,"Column field"),p("series","string",!0,"Stacked series field"),q],Pa=[p("x","string",!0,"Column field"),p("y","string",!0,"Row field"),q],Da=[p("axis","string",!0,"Metric (axis) field"),p("value","number",!0,"Value field",{multi:!0}),p("series","string",!1,"Series field")],La=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("size","number",!1,"Circle size"),p("label","string",!1,"Name")],xr=p("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Ea=[p("x","any",!0,"x field (date, number or category)"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables)"),p("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),xr],Oa=[p("x","any",!0,"x field"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("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}),xr],Ia=[p("x","any",!0,"x field"),p("y","number",!0,"y field",{multi:!0}),p("series","string",!1,"Series field")],za=[p("x","string",!0,"Category field"),p("y","number",!0,"Value field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("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})],Ba=[me,q],Ha=[p("value","number",!0,"Value field",{prop:"valueKey"}),p("target","number",!1,"Target field",{prop:"targetKey"})],ja=[me,p("value","number",!0,"Actual value field"),p("target","number",!1,"Target field")],Ga=[p("x","any",!1,"x field"),p("y","number",!0,"y field")],Va=[me,p("x","string",!1,"Period field (long tables)"),p("value","number",!1,"Value field (long tables)")],Wa=[me,p("start","number",!0,"Before value"),p("end","number",!0,"After value")],Ka=[me,q],Ua=[p("value","number",!0,"Value field"),p("group","string",!1,"Group (row) field"),p("label","string",!1,"Dot name")],Xa=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],Ya=[p("source","string",!0,"Source node"),p("target","string",!0,"Target node"),q],qa=[p("source","string",!0,"Sending group"),p("target","string",!0,"Receiving group"),q],Ja=[p("date","date",!0,"Date field"),q],Za=[p("x","any",!0,"Period field"),p("series","string",!0,"Item field"),p("rank","number",!1,"Rank field (1 is first)"),p("value","number",!1,"Value field (instead of rank, largest is first)")],Qa=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],ei=[p("label","string",!1,"Row name field")],ti=[p("x","date",!0,"Date (period) field"),p("open","number",!0,"Open price field"),p("high","number",!0,"High price field"),p("low","number",!0,"Low price field"),p("close","number",!0,"Close price field"),p("volume","number",!1,"Volume field")],ni=[me,q],ri=[p("x","any",!0,"Period field (date or category)"),p("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables, back row only)"),p("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],oi=[p("value","number",!1,"Sample value field (raw rows)"),p("group","string",!1,"Group field. Up to 2 groups overlap"),p("x0","number",!1,"Bin start (pre-binned rows)"),p("x1","number",!1,"Bin end (pre-binned rows)"),p("count","number",!1,"Samples in the bin (pre-binned rows)")],ai=[p("region","string",!0,"Region name or code, matched to a tile of options.map"),q],ii=[me,q,p("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],si=[p("source","string",!0,"Source node"),p("target","string",!0,"Target node"),p("value","number",!1,"Link weight. Without it every row counts 1")],li=[p("label","string",!0,"Row name. Items with the same name share a row"),p("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),p("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),p("group","string",!1,"Group field (one color per group, and the legend)"),p("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],ci=[p("label","string",!0,"Node name field"),p("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),p("group","string",!1,"Parent group field (flat rows, as in the treemap)"),p("id","string",!1,"Row id for id/parent rows. Defaults to the label"),p("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],ui=[p("region","string",!0,"Region name or code, matched to a region of options.map"),q],mi=[p("lon","number",!1,"Longitude (degrees)"),p("lat","number",!1,"Latitude (degrees)"),p("size","number",!1,"Value (circle area). Without it all circles match"),p("label","string",!1,"Place name"),p("region","string",!1,"Region of options.map, for rows without lon and lat"),p("group","string",!1,"Group field (one color per group)")],di=[p("source","string",!0,"Start: a name in options.places or a region"),p("target","string",!0,"End"),p("value","number",!1,"Amount. Without it each row counts 1")],fi=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("series","string",!1,"Series field (one color per series)"),p("label","string",!1,"Name")],yr={pie:Ma,donut:Ta,funnel:Ca,waffle:Sa,treemap:Aa,sunburst:Na,waterfall:Ra,pareto:Fa,marimekko:_a,heatmap:Pa,radar:Da,bubble:La,line:Ea,area:Oa,stream:Ia,bar:za,radialBar:Ba,gauge:Ha,bullet:ja,sparkline:Ga,slope:Va,dumbbell:Wa,lollipop:Ka,beeswarm:Ua,ridgeline:Xa,sankey:Ya,chord:qa,calendar:Ja,bump:Za,box:Qa,parallel:ei,candlestick:ti,segmented:ni,skyline:ri,histogram:oi,scatter:fi,tileMap:ai,barRace:ii,network:si,timeline:li,tree:ci,choropleth:ui,symbolMap:mi,flowMap:di},Ke={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function kr(e,t){return t==="ko"?e.nameKo:e.name}function wr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var vr=["line","area","bar","scatter"],$r=24,un=["line","area","bar","scatter","timeline"];function mn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Mr(e,t,n){return un.includes(e)&&!mn(e,t,n).length&&!(e==="scatter"&&At(n))}function At(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function Tr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var hi={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function Nt(e){let t=yr[e]?e:hi[e]??Object.keys(Ke).find(n=>n.toLowerCase()===e.toLowerCase()||Ke[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Ke[t]))return{type:t,component:Ke[t].component,name:Ke[t].name,nameKo:Ke[t].nameKo,encoding:yr[t]}}function Cr(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 Nt(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 Sr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function gi(e,t){if(e==null||typeof e!="object")return;let n=e;if(Sr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Sr(r,o))return;r=r[o]}return r}}function $e(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 ze(e,t){if(typeof e=="function")return e;let n=e??t;return r=>gi(r,n)}function Ue(e,t){let n=ze(e,t);return(r,o)=>$e(n(r,o))}function de(e,t){let n=ze(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 ee(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function pi(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,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var bi=/^[-+(]?[₩$€£¥]?\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(bi.test(t)||/^[-+]?\.\d+$/.test(t)){let n=$e(t);if(Number.isFinite(n))return n}return t}function Be(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??pi(o),i=[],s=[],l="",c=!1;for(let h=0;h<o.length;h++){let g=o[h];c?g==='"'?o[h+1]==='"'?(l+='"',h++):c=!1:l+=g:g==='"'&&!l.trim()?(c=!0,l=""):g===a?(s.push(l),l=""):g===`
24
24
  `||g==="\r"?(g==="\r"&&o[h+1]===`
25
- `&&h++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(h=>!(h.length===1&&h[0].trim()===""));if(!m.length)return[];let u=h=>n?Mr(h):h;if(!r)return m.map(h=>Object.fromEntries(h.map((g,y)=>[String(y),u(g)])));let d=[],f=new Set;return m[0].forEach((h,g)=>{let y=h.trim()||`col${g+1}`,x=y;for(let w=2;f.has(x);w++)x=`${y}_${w}`;f.add(x),d.push(x)}),m.slice(1).map(h=>Object.fromEntries(d.map((g,y)=>[g,u(h[y]??"")])))}function cn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?Mr(i[l]):i[l]??null])))}function ni(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function Tr(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 Pe(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Pe(JSON.parse(t))}catch{}return Oe(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?cn(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)?Pe(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?cn(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)?Pe(t.rows):Array.isArray(t.values)?cn(t.values):Array.isArray(t.items)?Pe(t.items):Array.isArray(t.results)?Pe(t.results):ni(t)}return[]}function At(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 un(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let f=i(d,c),h=f-i(d,c-1),g=0;for(let y=0;y<d;y++)g+=i(y,c)-i(y,c-1);m+=f,u+=(h/2+g)*f}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let f=0;f<n;f++){let h=e[f][l],g=Number.isFinite(h)?h:0;g>=0?(o[f][l]=u,u+=g,a[f][l]=u):(o[f][l]=d,d+=g,a[f][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function 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 Ar(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,f)=>{d>u&&(u=d,m=f)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var ri=Math.PI*2;function Ft(e,t,n){return e<t?t:e>n?n:e}function Fr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function G(e){return Math.round(e*100)/100}function mn(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=Ft(a.tl??0,0,i),l=Ft(a.tr??0,0,i),c=Ft(a.br??0,0,i),m=Ft(a.bl??0,0,i);return`M${G(e+s)},${G(t)}H${G(e+n-l)}`+(l?`A${G(l)},${G(l)} 0 0 1 ${G(e+n)},${G(t+l)}`:"")+`V${G(t+r-c)}`+(c?`A${G(c)},${G(c)} 0 0 1 ${G(e+n-c)},${G(t+r)}`:"")+`H${G(e+m)}`+(m?`A${G(m)},${G(m)} 0 0 1 ${G(e)},${G(t+r-m)}`:"")+`V${G(t+s)}`+(s?`A${G(s)},${G(s)} 0 0 1 ${G(e+s)},${G(t)}`:"")+"Z"}function Nr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function Pr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Rr(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 Nt=new Map;function oe(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Nt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);Pr(c)?i+=Rr(c):s+=Rr(c)}a=i+s*(n>=600?1.07:1),Nt.size>5e3&&Nt.clear(),Nt.set(o,a)}return a*t}function dn(e,t,n,r=400){if(e=e.trim(),oe(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;oe(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(Pr(s.charCodeAt(0))?2:3)?"":s+o}var Lr=S(E(),1),oi=e=>Array.isArray(e)&&e.length===2;function Dr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&oi(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var Ir=S(E(),1),xe=10.5;function ai(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=>Ve(i,{locale:n,maximumFractionDigits:a}))}function Er(e,t,n){let r=18;for(let o of ai(e,t,n))r=Math.max(r,oe(o,xe));return Math.ceil(r+8)}function _r(e,t,n=xe,r=8,o=400,a){let i=t.length;if(i<=1)return t.map((u,d)=>d);let s=t.map(u=>oe(u,n,o)),l=(u,d)=>Math.abs(e[d]-e[u])<(s[u]+s[d])/2+r,c=[];for(let u of a??[])c.some(d=>l(d,u))||c.push(u);let m=u=>!c.some(d=>l(d,u));for(let u=1;u<=i;u++){let d=c.slice();for(let f=0;f<i;f+=u)m(f)&&d.push(f);if(u>1&&(i-1)%u>u/2&&m(i-1)&&d.push(i-1),d.sort((f,h)=>f-h),d.every((f,h)=>!h||!l(d[h-1],f)))return d}return[0,i-1]}function fn(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 Ue(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=fn(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let f=fn(c[1]-c[0],n);if(f===l)break;l=f}return c}function Or(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=fn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function hn(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>Or(n,r,l),s}function gn(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]=Ue(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function ii(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let f of c){let h=Number((f*10**d).toPrecision(12));h>=e*(1-1e-9)&&h<=t*(1+1e-9)&&u.push(h)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Or(e,t,3)}function zr(e,t){let n=hn([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=()=>ii(e[0],e[1],Math.abs(t[1]-t[0])),r}function ze(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]}function pn(e){let t=[];for(let n=0;n<e.length;n++)Number.isFinite(e[n])&&t.push(e[n]);return t.length?(t.sort((n,r)=>n-r),t.length<24?t[t.length-1]:t[Math.min(t.length-1,Math.floor(t.length*.95))]||t[t.length-1]):1}var si=864e5;function Br(e,t,n,r=Q){let o=t-e;if(!(o>0))return[{t:e,label:et(e,{locale:r,month:"short",day:"numeric"})}];let a=o/si,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,f=!1)=>{let h=new Date(m),g=-1,y=0;for(;h.getTime()<=t&&y++<500;){if(h.getTime()>=e){let x=h.getFullYear(),w=f&&!l&&x!==g;i.push({t:h.getTime(),label:et(h,{locale:r,...d,...w?{year:"numeric"}:{}})}),g=x}u(h)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(d>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,h=>h.setFullYear(h.getFullYear()+d/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),h=f.getMonth()%d;h&&f.setMonth(f.getMonth()+(d-h)),c(f,g=>g.setMonth(g.getMonth()+d),{month:"short"},!0)}}return i}function Rt(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var li=(e,t,n)=>e==="date"?kt(t,n)?.getTime()??NaN:Me(t);function ci(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&sr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function tt(e,t,n,r,o={}){let a=Ge(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:Ge(n,"y"),c=!i&&r!==void 0?Ge(r,"series"):null,m=e.map(($,b)=>a($,b)),u=o.xType??ci(m),d=o.locale??Q,f,h,g;if(u==="band"){let $=m.map(T=>String(T??""));f=Se($);let b=new Map(f.map((T,L)=>[T,L]));h=f.map((T,L)=>L),g=Int32Array.from($,T=>b.get(T)??-1)}else{let $=u==="date"?o.dayFirst??lr(m):void 0,b=m.map(z=>li(u,z,$)),T=Array.from(new Set(b.filter(z=>Number.isFinite(z)))).sort((z,Z)=>z-Z),L=new Map(T.map((z,Z)=>[z,Z]));h=T,f=T.map(String),g=Int32Array.from(b,z=>L.get(z)??-1)}let y=o.dateFormat,x=$=>typeof $=="string"?xt($.trim())?.[3]:void 0,w=u==="date"&&m.length<5e3?x(m[0]):void 0,M=(w===2||w===3)&&m.every($=>x($)===w),v=M&&w===3;if(u==="date"&&!y){let $=h.length>1?h[h.length-1]-h[0]:0;y=M&&w===2||$>864e5*120?{month:"short"}:$<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},$>864e5*800&&(y={year:"numeric",month:"short"})}let p;if(u==="band")p=f;else if(v&&!o.dateFormat){let $=K(d)==="ko";p=h.map(b=>{let T=new Date(b),L=Math.floor(T.getMonth()/3)+1;return $?`${T.getFullYear()}년 ${L}분기`:`Q${L} ${T.getFullYear()}`})}else{let $=h.every(en),b=u==="date"?new Intl.DateTimeFormat(d,y):new Intl.NumberFormat(d,$?{useGrouping:!1}:{maximumFractionDigits:6});p=h.length>1e3?Rt(h.length,T=>b.format(h[T])):h.map(T=>b.format(T))}let N=s?[...s]:c?Se(e.map(($,b)=>String(c($,b)??""))):[""],_=new Map(N.map(($,b)=>[$,b])),I=N.map(()=>new Array(f.length).fill(NaN)),O=N.map(()=>new Array(f.length).fill(null)),R=o.aggregate??"sum",D=R==="mean"?N.map(()=>new Uint32Array(f.length)):null,F=($,b,T,L)=>{let z=I[$][b];R==="last"?I[$][b]=T:R==="count"?I[$][b]=(Number.isFinite(z)?z:0)+1:R==="mean"?Number.isFinite(T)&&(I[$][b]=(Number.isFinite(z)?z:0)+T,D[$][b]++):I[$][b]=Number.isFinite(z)?z+(Number.isFinite(T)?T:0):T,O[$][b]=L};for(let $=0;$<e.length;$++){let b=g[$];if(b<0)continue;let T=e[$];if(s)for(let L=0;L<s.length;L++)F(L,b,Me(T[s[L]]),T);else{let L=c?_.get(String(c(T,$)??""))??0:0;F(L,b,Me(l(T,$)),T)}}if(D)for(let $=0;$<I.length;$++)for(let b=0;b<f.length;b++)D[$][b]>1&&(I[$][b]/=D[$][b]);return{type:u,keys:f,xnum:h,labels:p,series:N,values:I,rows:O}}var ui=140,rt=12,Hr=14,bn=20,jr=12.5;function mi(e,t,n=kr){let r=Te(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function di(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+rt)/(ui+rt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function fi(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*rt)/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 nt=e=>e.filter(Number.isFinite);function Pt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Ke(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return nt(n)}function Vr(e,t,n,r,o,a){return tt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function hi(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let p=t.flat(),N=r.refLines??{},[_,I]=ze([...Pt(p,r.x??"x"),...nt([Number(N.x)])]),[O,R]=ze([...Pt(p,r.y??"y"),...nt([Number(N.y)])].filter(F=>!s||F>0)),D=r.zero??!1;return{y:c??(s?gn(O,R,i):Ue(O,R,i,{zero:D,pad:.08})),x:r.xDomain??Ue(_,I,Math.max(2,Math.round(o/110)),{zero:D,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),f=n.every(p=>p.keys.join("")===d),h=n.length>0&&n.every(p=>p.type!=="band"&&p.type===n[0].type),g=r.xDomain??(!m&&h?ze(n.flatMap(p=>nt(p.xnum))):void 0),y=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(y==="percent")return{x:g,sameKeys:f};if(c)return{y:c,x:g,sameKeys:f};let x=[];t.forEach((p,N)=>{let _=n[N];if(y==="stacked"||y==="auto"&&_.series.length>1){let O=un(_.values,"zero");O.y0.forEach(R=>x.push(...R)),O.y1.forEach(R=>x.push(...R))}else _.values.forEach(O=>x.push(...O));m&&!u&&r.line!==void 0&&Vr(e,p,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(O=>x.push(...O)),m||x.push(...Pt(p,r.lower),...Pt(p,r.upper))}),m&&x.push(0),u||x.push(...Dr(r.annotations));for(let p of r.referenceLines??[])x.push(p.y);r.signColors&&x.push(Number(r.baseline??0));let[w,M]=ze(nt(x).filter(p=>!s||p>0));return{y:s?gn(w,M,i):m?Ue(w,M,u?Math.max(2,Math.round(o/120)):i):Ue(w,M,i,{zero:r.zero??e==="area"}),x:g,sameKeys:f}}function gi(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=tt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?zr:hn)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=Er(c,rr(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(p=>p.series),d=r.endLabels??n.some(p=>p.series.length>1),f=m+6,h=a-(d?Math.min(a*.28,Math.max(...u.map(p=>oe(p,11,700)),20)+14):10),g=l.keys.length,[y,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,w=l.type==="number"?g>12:g>Br(y,x,Math.max(2,Math.floor((h-f)/64)),s).length;if(l.type==="band"||!g||w)return;let M=p=>f+(l.xnum[p]-y)/(x-y)*(h-f),v=p=>oe(l.labels[p],xe);for(let p=1;;p++){let N=Array.from({length:Math.ceil(g/p)},(_,I)=>I*p);if(p>=g||N.every((_,I)=>!I||M(_)-M(N[I-1])>=(v(_)+v(N[I-1]))/2+8))return N.map(_=>({value:l.xnum[_],label:l.labels[_]}))}}function pi(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 bi(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${pi(`${e}|${t}|${o}|${At(r)}`)}`}function yi(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 xi={en:{intro:(e,t)=>`${Ce(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 Wr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=mi(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=di(s,i,e.columns),{pw:c,ph:m}=fi(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(D=>Vr(t,D,n,n.y,n.series,n.aggregate)),f=u?hi(t,o,d,n,c,m):{sameKeys:!1},h=u?gi(t,o,d,n,f,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",y=u&&(!g||f.sameKeys),x=u&&(g||f.x!==void 0||f.sameKeys),w=new Set(yi(e.highlight,r)?[e.highlight].flat():[]),M=w.size>0,v=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,p=e.syncId??bi(t,e.by,n,e.data),N=yt(_e(n.format,e.locale),n.unit),_=xi[e.lang],I=[],O=r.map(D=>D===""?_.blank:D);return{panels:r.map((D,F)=>{let $=o[F],b=O[F],T=F%l,L;if(t!=="scatter"){let Z=d[F],Ee=le=>Z.values.reduce((ve,it)=>ve+(Number.isFinite(it[le])?it[le]:0),0),H=Z.keys.map((le,ve)=>ve).filter(le=>Z.values.some(ve=>Number.isFinite(ve[le]))),ee=H[H.length-1];I.push({first:H.length?Ee(H[0]):NaN,last:H.length?Ee(ee):NaN,total:H.reduce((le,ve)=>le+Ee(ve),0)}),t!=="bar"&&Z.series.length===1&&ee!==void 0&&(L=N(Z.values[0][ee]))}else I.push({first:NaN,last:NaN,total:$.length});let z={data:$,width:c,height:m,ariaLabel:e.title?`${e.title}, ${b}`:b,syncId:p,highlight:M?w.has(D)?v?()=>!0:void 0:"none":e.highlight,showYAxis:!y||T===0,showXAxis:!x||F+l>=i};return f.y&&(z.yDomain=f.y),f.x&&(z.xDomain=f.x),h&&(z.xTicks=h),{value:D,label:b,props:z,last:L,isPicked:w.has(D)}}),cols:l,pw:c,ph:m,isPanelPick:M,description:ki(t,e.by,O,I,a,N,_)}}function ki(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>Nr(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var ae=S(W(),1);function wi(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function vi(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function Ur(e,t=!0){let[n,r]=(0,ae.useState)({visible:!t,near:!t});return(0,ae.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=vi(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:wi(.25),rootMargin:"0px 0px -8% 0px"}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function Gr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Dt(e){let[t,n]=(0,ae.useState)(null),[r,o]=(0,ae.useState)(e??null),a=(0,ae.useCallback)(i=>{n(i),i&&e===void 0&&o(Gr(i))},[e]);return be(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(Gr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var $i=()=>()=>{};function Xe(){return(0,ae.useSyncExternalStore)($i,()=>!0,()=>!1)}var Kr="(prefers-reduced-motion: reduce)";function Lt(e="auto"){let[t,n]=(0,ae.useState)(()=>fe&&typeof window.matchMedia=="function"?window.matchMedia(Kr).matches:!1);return(0,ae.useEffect)(()=>{if(e!=="auto"||!fe||typeof window.matchMedia!="function")return;let r=window.matchMedia(Kr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var ke=S(E(),1),Ci=60,Mi=420;function Xr(e){let t=ge(),n=e.chartProps??{},[,r,o]=Dt(e.width),a=e.width??(o||480),i=ne(e.locale??n.locale),s=K(i),l=(0,Ye.useContext)(He),c=e.title??l,m=(0,Ye.useMemo)(()=>Wr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(y,x)=>typeof x=="function"?String(x):x),e.highlight,e.syncId,a,e.height,c,i,s]),u=`${(0,Ye.useId)().replace(/:/g,"")}fd`,d=Lt(n.reducedMotion??"auto"),f=Xe(),h=zn({motion:{enabled:n.animate!==!1&&!d&&fe},hydrated:f},{waiting:!1,generation:0}),g=e.chart;return(0,ke.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":u,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,ke.jsx)("p",{id:u,style:Tt,children:e.description??m.description}),(0,ke.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${m.cols}, minmax(0, 1fr))`,columnGap:rt,rowGap:Hr},children:m.panels.map((y,x)=>{let w=t.paint(y.isPicked?"accentText":m.isPanelPick?"muted":"ink");return(0,ke.jsxs)("div",{"data-facet":y.value,style:{minWidth:0,...On(h,!1,"fade",x*Ci,Mi)},children:[(0,ke.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:bn,fontSize:jr,fontWeight:700,lineHeight:`${bn}px`,color:w},children:[(0,ke.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.label}),y.last!==void 0?(0,ke.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:y.last}):null]}),(0,ke.jsx)(g,{...n,...y.props})]},y.value)})})]})}function we(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,f)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=f)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var ue=S(W(),1);async function Ti(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(K(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Oe(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 Oe(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Oe(a)}async function Si(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 Ti(a,t.parse,o,t.locale)}return t.select&&(r=Tr(r,t.select)),t.transform?t.transform(r):Pe(r)}function Yr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,ue.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ue.useState)(0),c=ne(t.locale),m=(0,ue.useRef)(t);m.current={...t,locale:c};let u=(0,ue.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],h=JSON.stringify(f.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),g=(0,ue.useRef)(!1);(0,ue.useEffect)(()=>{let x=u.current;if(!x||!r){i(v=>v.status==="loading"?{...v,status:"idle"}:v);return}let w=new AbortController,M=!0;return g.current=!0,i(v=>({...v,data:o?v.data:[],status:"loading",error:null})),Si(x,{...m.current,signal:w.signal}).then(v=>{M&&i({data:v,status:"success",error:null,updatedAt:Date.now()})}).catch(v=>{!M||w.signal.aborted||i(p=>({...p,status:"error",error:v instanceof Error?v:new Error(String(v))}))}).finally(()=>{M&&(g.current=!1)}),()=>{M=!1,g.current=!1,w.abort()}},[d,r,s,h,o]),(0,ue.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{g.current||l(w=>w+1)},n);return()=>clearInterval(x)},[n,r]);let y=(0,ue.useCallback)(()=>l(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:y}}var xn=S(E(),1),Ai=["csv","svg","png"],Fi=/^[=+\-@\t\r\n=+-@]/,Ni=/var\(|color-mix\(/;function qr(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?or(e.getTime()):String(e);return`"${(Fi.test(t)&&!Number.isFinite(Me(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Ri(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Pi(e,t){return`\uFEFF${[t.map(qr),...e.map(r=>t.map(o=>qr(r[o])))].map(r=>r.join(",")).join(`\r
25
+ `&&h++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let d=i.filter(h=>!(h.length===1&&h[0].trim()===""));if(!d.length)return[];let u=h=>n?Ar(h):h;if(!r)return d.map(h=>Object.fromEntries(h.map((g,k)=>[String(k),u(g)])));let m=[],f=new Set;return d[0].forEach((h,g)=>{let k=h.trim()||`col${g+1}`,y=k;for(let w=2;f.has(y);w++)y=`${k}_${w}`;f.add(y),m.push(y)}),d.slice(1).map(h=>Object.fromEntries(m.map((g,k)=>[g,u(h[k]??"")])))}function dn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?Ar(i[l]):i[l]??null])))}function yi(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function Nr(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 Pe(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Pe(JSON.parse(t))}catch{}return Be(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?dn(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)?Pe(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?dn(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)?Pe(t.rows):Array.isArray(t.values)?dn(t.values):Array.isArray(t.items)?Pe(t.items):Array.isArray(t.results)?Pe(t.results):yi(t)}return[]}function Rt(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 fn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let d=e[l][c];return Number.isFinite(d)&&d>0?d: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 d=0,u=0;for(let m=0;m<n;m++){let f=i(m,c),h=f-i(m,c-1),g=0;for(let k=0;k<m;k++)g+=i(k,c)-i(k,c-1);d+=f,u+=(h/2+g)*f}d&&(l-=u/d),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,m=0;for(let f=0;f<n;f++){let h=e[f][l],g=Number.isFinite(h)?h:0;g>=0?(o[f][l]=u,u+=g,a[f][l]=u):(o[f][l]=m,m+=g,a[f][l]=m)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let d=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let m=i(u,l);t==="expand"&&(m=c?m/c*100:0),o[u][l]=d,d+=m,a[u][l]=d}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let d=0;for(let u=0;u<r;u++)d+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;d/=r;for(let u=0;u<n;u++)for(let m=0;m<r;m++)o[u][m]-=d,a[u][m]-=d}return{y0:o,y1:a}}function Rr(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 Fr(e){let t=e.length,n=e.map(c=>{let d=0,u=-1/0;return c.forEach((m,f)=>{m>u&&(u=m,d=f)}),d}),r=e.map(c=>c.reduce((d,u)=>d+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,d)=>d).sort((c,d)=>n[c]-n[d]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var xi=Math.PI*2;function Ft(e,t,n){return e<t?t:e>n?n:e}function _r(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function W(e){return Math.round(e*100)/100}function hn(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=Ft(a.tl??0,0,i),l=Ft(a.tr??0,0,i),c=Ft(a.br??0,0,i),d=Ft(a.bl??0,0,i);return`M${W(e+s)},${W(t)}H${W(e+n-l)}`+(l?`A${W(l)},${W(l)} 0 0 1 ${W(e+n)},${W(t+l)}`:"")+`V${W(t+r-c)}`+(c?`A${W(c)},${W(c)} 0 0 1 ${W(e+n-c)},${W(t+r)}`:"")+`H${W(e+d)}`+(d?`A${W(d)},${W(d)} 0 0 1 ${W(e)},${W(t+r-d)}`:"")+`V${W(t+s)}`+(s?`A${W(s)},${W(s)} 0 0 1 ${W(e+s)},${W(t)}`:"")+"Z"}function Pr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function Lr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Dr(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 _t=new Map;function ae(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=_t.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);Lr(c)?i+=Dr(c):s+=Dr(c)}a=i+s*(n>=600?1.07:1),_t.size>5e3&&_t.clear(),_t.set(o,a)}return a*t}function gn(e,t,n,r=400){if(e=e.trim(),ae(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;ae(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(Lr(s.charCodeAt(0))?2:3)?"":s+o}var Or=C(L(),1),ki=e=>Array.isArray(e)&&e.length===2;function Er(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&ki(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var Br=C(L(),1),Me=10.5;function wi(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=>We(i,{locale:n,maximumFractionDigits:a}))}function Ir(e,t,n){let r=18;for(let o of wi(e,t,n))r=Math.max(r,ae(o,Me));return Math.ceil(r+8)}function zr(e,t,n=Me,r=8,o=400,a){let i=t.length;if(i<=1)return t.map((u,m)=>m);let s=t.map(u=>ae(u,n,o)),l=(u,m)=>Math.abs(e[m]-e[u])<(s[u]+s[m])/2+r,c=[];for(let u of a??[])c.some(m=>l(m,u))||c.push(u);let d=u=>!c.some(m=>l(m,u));for(let u=1;u<=i;u++){let m=c.slice();for(let f=0;f<i;f+=u)d(f)&&m.push(f);if(u>1&&(i-1)%u>u/2&&d(i-1)&&m.push(i-1),m.sort((f,h)=>f-h),m.every((f,h)=>!h||!l(m[h-1],f)))return m}return[0,i-1]}function pn(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 Xe(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=pn(i,n),c=[o,a];for(let d=0;d<4;d++){let u=Math.ceil(a/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-m<=l*.3?m:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let f=pn(c[1]-c[0],n);if(f===l)break;l=f}return c}function Hr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=pn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function bn(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>Hr(n,r,l),s}function yn(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]=Xe(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function vi(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,d=1)=>{let u=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let f of c){let h=Number((f*10**m).toPrecision(12));h>=e*(1-1e-9)&&h<=t*(1+1e-9)&&u.push(h)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Hr(e,t,3)}function jr(e,t){let n=bn([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=()=>vi(e[0],e[1],Math.abs(t[1]-t[0])),r}function He(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]}function xn(e){let t=[];for(let n=0;n<e.length;n++)Number.isFinite(e[n])&&t.push(e[n]);return t.length?(t.sort((n,r)=>n-r),t.length<24?t[t.length-1]:t[Math.min(t.length-1,Math.floor(t.length*.95))]||t[t.length-1]):1}var $i=864e5;function Gr(e,t,n,r=Q){let o=t-e;if(!(o>0))return[{t:e,label:tt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/$i,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(d,u,m,f=!1)=>{let h=new Date(d),g=-1,k=0;for(;h.getTime()<=t&&k++<500;){if(h.getTime()>=e){let y=h.getFullYear(),w=f&&!l&&y!==g;i.push({t:h.getTime(),label:tt(h,{locale:r,...m,...w?{year:"numeric"}:{}})}),g=y}u(h)}};if(a<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=d)??12,m=new Date(s);m.setMinutes(0,0,0),c(m,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(d,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),c(d,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=a/30.44,u=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(m>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,h=>h.setFullYear(h.getFullYear()+m/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),h=f.getMonth()%m;h&&f.setMonth(f.getMonth()+(m-h)),c(f,g=>g.setMonth(g.getMonth()+m),{month:"short"},!0)}}return i}function Pt(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var Mi=(e,t,n)=>e==="date"?wt(t,n)?.getTime()??NaN:$e(t);function Ti(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&ur(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function nt(e,t,n,r,o={}){let a=ze(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:ze(n,"y"),c=!i&&r!==void 0?ze(r,"series"):null,d=e.map(($,x)=>a($,x)),u=o.xType??Ti(d),m=o.locale??Q,f,h,g;if(u==="band"){let $=d.map(T=>String(T??""));f=ee($);let x=new Map(f.map((T,D)=>[T,D]));h=f.map((T,D)=>D),g=Int32Array.from($,T=>x.get(T)??-1)}else{let $=u==="date"?o.dayFirst??mr(d):void 0,x=d.map(z=>Mi(u,z,$)),T=Array.from(new Set(x.filter(z=>Number.isFinite(z)))).sort((z,Z)=>z-Z),D=new Map(T.map((z,Z)=>[z,Z]));h=T,f=T.map(String),g=Int32Array.from(x,z=>D.get(z)??-1)}let k=o.dateFormat,y=$=>typeof $=="string"?kt($.trim())?.[3]:void 0,w=u==="date"&&d.length<5e3?y(d[0]):void 0,v=(w===2||w===3)&&d.every($=>y($)===w),N=v&&w===3;if(u==="date"&&!k){let $=h.length>1?h[h.length-1]-h[0]:0;k=v&&w===2||$>864e5*120?{month:"short"}:$<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},$>864e5*800&&(k={year:"numeric",month:"short"})}let b;if(u==="band")b=f;else if(N&&!o.dateFormat){let $=K(m)==="ko";b=h.map(x=>{let T=new Date(x),D=Math.floor(T.getMonth()/3)+1;return $?`${T.getFullYear()}년 ${D}분기`:`Q${D} ${T.getFullYear()}`})}else{let $=h.every(rn),x=u==="date"?new Intl.DateTimeFormat(m,k):new Intl.NumberFormat(m,$?{useGrouping:!1}:{maximumFractionDigits:6});b=h.length>1e3?Pt(h.length,T=>x.format(h[T])):h.map(T=>x.format(T))}let S=s?[...s]:c?ee(e.map(($,x)=>String(c($,x)??""))):[""],E=new Map(S.map(($,x)=>[$,x])),O=S.map(()=>new Array(f.length).fill(NaN)),I=S.map(()=>new Array(f.length).fill(null)),F=o.aggregate??"sum",P=F==="mean"?S.map(()=>new Uint32Array(f.length)):null,R=($,x,T,D)=>{let z=O[$][x];F==="last"?O[$][x]=T:F==="count"?O[$][x]=(Number.isFinite(z)?z:0)+1:F==="mean"?Number.isFinite(T)&&(O[$][x]=(Number.isFinite(z)?z:0)+T,P[$][x]++):O[$][x]=Number.isFinite(z)?z+(Number.isFinite(T)?T:0):T,I[$][x]=D};for(let $=0;$<e.length;$++){let x=g[$];if(x<0)continue;let T=e[$];if(s)for(let D=0;D<s.length;D++)R(D,x,$e(T[s[D]]),T);else{let D=c?E.get(String(c(T,$)??""))??0:0;R(D,x,$e(l(T,$)),T)}}if(P)for(let $=0;$<O.length;$++)for(let x=0;x<f.length;x++)P[$][x]>1&&(O[$][x]/=P[$][x]);return{type:u,keys:f,xnum:h,labels:b,series:S,values:O,rows:I}}var Ci=140,ot=12,Vr=14,kn=20,Wr=12.5;function Si(e,t,n=$r){let r=de(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function Ai(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+ot)/(Ci+ot))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ni(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*ot)/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 rt=e=>e.filter(Number.isFinite);function Dt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Ue(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return rt(n)}function Kr(e,t,n,r,o,a){return nt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Ri(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),S=r.refLines??{},[E,O]=He([...Dt(b,r.x??"x"),...rt([Number(S.x)])]),[I,F]=He([...Dt(b,r.y??"y"),...rt([Number(S.y)])].filter(R=>!s||R>0)),P=r.zero??!1;return{y:c??(s?yn(I,F,i):Xe(I,F,i,{zero:P,pad:.08})),x:r.xDomain??Xe(E,O,Math.max(2,Math.round(o/110)),{zero:P,pad:.06}),sameKeys:!0}}let d=e==="bar",u=d&&r.orientation==="horizontal",m=n[0]?.keys.join(""),f=n.every(b=>b.keys.join("")===m),h=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),g=r.xDomain??(!d&&h?He(n.flatMap(b=>rt(b.xnum))):void 0),k=d?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(k==="percent")return{x:g,sameKeys:f};if(c)return{y:c,x:g,sameKeys:f};let y=[];t.forEach((b,S)=>{let E=n[S];if(k==="stacked"||k==="auto"&&E.series.length>1){let I=fn(E.values,"zero");I.y0.forEach(F=>y.push(...F)),I.y1.forEach(F=>y.push(...F))}else E.values.forEach(I=>y.push(...I));d&&!u&&r.line!==void 0&&Kr(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(I=>y.push(...I)),d||y.push(...Dt(b,r.lower),...Dt(b,r.upper))}),d&&y.push(0),u||y.push(...Er(r.annotations));for(let b of r.referenceLines??[])y.push(b.y);r.signColors&&y.push(Number(r.baseline??0));let[w,v]=He(rt(y).filter(b=>!s||b>0));return{y:s?yn(w,v,i):d?Xe(w,v,u?Math.max(2,Math.round(o/120)):i):Xe(w,v,i,{zero:r.zero??e==="area"}),x:g,sameKeys:f}}function Fi(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=nt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?jr:bn)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),d=Ir(c,ir(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),m=r.endLabels??n.some(b=>b.series.length>1),f=d+6,h=a-(m?Math.min(a*.28,Math.max(...u.map(b=>ae(b,11,700)),20)+14):10),g=l.keys.length,[k,y]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,w=l.type==="number"?g>12:g>Gr(k,y,Math.max(2,Math.floor((h-f)/64)),s).length;if(l.type==="band"||!g||w)return;let v=b=>f+(l.xnum[b]-k)/(y-k)*(h-f),N=b=>ae(l.labels[b],Me);for(let b=1;;b++){let S=Array.from({length:Math.ceil(g/b)},(E,O)=>O*b);if(b>=g||S.every((E,O)=>!O||v(E)-v(S[O-1])>=(N(E)+N(S[O-1]))/2+8))return S.map(E=>({value:l.xnum[E],label:l.labels[E]}))}}function _i(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 Pi(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${_i(`${e}|${t}|${o}|${Rt(r)}`)}`}function Di(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 Li={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:"(빈 값)"}},wn=18;function Ur(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Si(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Ai(s,i,e.columns),{pw:c,ph:d}=Ni(s,l,e.height),u=e.scale!=="free",m=t==="scatter"?[]:o.map(P=>Kr(t,P,n,n.y,n.series,n.aggregate)),f=u?Ri(t,o,m,n,c,d):{sameKeys:!1},h=u?Fi(t,o,m,n,f,c,d,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",k=u&&(!g||f.sameKeys),y=u&&(g||f.x!==void 0||f.sameKeys),w=new Set(Di(e.highlight,r)?[e.highlight].flat():[]),v=w.size>0,N=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??Pi(t,e.by,n,e.data),S=xt(Oe(n.format,e.locale),n.unit),E=Li[e.lang],O=[],I=r.map(P=>P===""?E.blank:P);return{panels:r.map((P,R)=>{let $=o[R],x=I[R],T=R%l,D;if(t!=="scatter"){let Z=m[R],Ee=ce=>Z.values.reduce((Te,st)=>Te+(Number.isFinite(st[ce])?st[ce]:0),0),H=Z.keys.map((ce,Te)=>Te).filter(ce=>Z.values.some(Te=>Number.isFinite(Te[ce]))),te=H[H.length-1];O.push({first:H.length?Ee(H[0]):NaN,last:H.length?Ee(te):NaN,total:H.reduce((ce,Te)=>ce+Ee(Te),0)}),t!=="bar"&&Z.series.length===1&&te!==void 0&&(D=S(Z.values[0][te]))}else O.push({first:NaN,last:NaN,total:$.length});let z={data:$,width:c,height:d,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:b,highlight:v?w.has(P)?N?()=>!0:void 0:"none":e.highlight,showYAxis:!k||T===0,showXAxis:!y||R+l>=i};return f.y&&(z.yDomain=f.y),f.x&&(z.xDomain=f.x),h&&(z.xTicks=h),{value:P,label:x,props:z,last:D,isPicked:w.has(P)}}),cols:l,pw:c,ph:d,isPanelPick:v,description:Ei(t,e.by,I,O,a,S,E)}}function Ei(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>Pr(r.map(d=>d[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let d=n.filter((u,m)=>r[m].last<r[m].first);s+=d.length?i.falling(`${d.slice(0,5).join(", ")}${d.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var ie=C(V(),1);function Oi(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Ii(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var Lt={threshold:.25,enoughPx:96,rootMargin:"0px"};function qr(e,t=!0){let[n,r]=(0,ie.useState)({visible:!t,near:!t});return(0,ie.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=Ii(i[i.length-1],Lt.threshold,Lt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Oi(Lt.threshold),rootMargin:Lt.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function Xr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Et(e){let[t,n]=(0,ie.useState)(null),[r,o]=(0,ie.useState)(e??null),a=(0,ie.useCallback)(i=>{n(i),i&&e===void 0&&o(Xr(i))},[e]);return ve(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(d=>d!==null&&Math.abs(d-c)<.5?d:c),s=()=>i(Xr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let d=c[c.length-1]?.contentRect;d?i(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var zi=()=>()=>{};function Ye(){return(0,ie.useSyncExternalStore)(zi,()=>!0,()=>!1)}var Yr="(prefers-reduced-motion: reduce)";function Ot(e="auto"){let[t,n]=(0,ie.useState)(()=>pe&&typeof window.matchMedia=="function"?window.matchMedia(Yr).matches:!1);return(0,ie.useEffect)(()=>{if(e!=="auto"||!pe||typeof window.matchMedia!="function")return;let r=window.matchMedia(Yr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var ke=C(L(),1),Bi=60,Hi=420;function Jr(e){let t=xe(),n=e.chartProps??{},[,r,o]=Et(e.width),a=e.width??(o||480),i=re(e.locale??n.locale),s=K(i),l=(0,qe.useContext)(Ge),c=e.title??l,d=e.chart.facetPlan,u=(0,qe.useMemo)(()=>{let y=Ur({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return d?d(y,n,i):y},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(y,w)=>typeof w=="function"?String(w):w),e.highlight,e.syncId,a,e.height,c,i,s,d]),m=`${(0,qe.useId)().replace(/:/g,"")}fd`,f=Ot(n.reducedMotion??"auto"),h=Ye(),g=Gn({motion:{enabled:n.animate!==!1&&!f&&pe},hydrated:h},{waiting:!1,generation:0}),k=e.chart;return(0,ke.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":m,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,ke.jsx)("p",{id:m,style:St,children:e.description??u.description}),(0,ke.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:ot,rowGap:Vr,...u.legend?{marginTop:wn}:null},children:u.panels.map((y,w)=>{let v=t.paint(y.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,ke.jsxs)("div",{"data-facet":y.value,style:{minWidth:0,...jn(g,!1,"fade",w*Bi,Hi)},children:[(0,ke.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:kn,fontSize:Wr,fontWeight:700,lineHeight:`${kn}px`,color:v},children:[(0,ke.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.label}),y.last!==void 0?(0,ke.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:y.last}):null]}),(0,ke.jsx)(k,{...n,...y.props})]},y.value)})}),u.legend?(0,ke.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:wn},children:u.legend}):null]})}var Zr=["max","min","first","last","none"];function we(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let d=-1,u=c==="max"?-1/0:1/0;r.forEach((m,f)=>{Number.isFinite(m)&&(c==="max"?m>u:m<u)&&(u=m,d=f)}),d>=0&&a.add(d)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,d)=>{d<i&&c!==null&&c!==void 0&&e(c,d)&&a.add(d)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((d,u)=>{d===c&&a.add(u)});return a}var fe=C(V(),1);async function ji(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(K(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Be(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 Be(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Be(a)}async function Gi(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 ji(a,t.parse,o,t.locale)}return t.select&&(r=Nr(r,t.select)),t.transform?t.transform(r):Pe(r)}function Qr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,fe.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,fe.useState)(0),c=re(t.locale),d=(0,fe.useRef)(t);d.current={...t,locale:c};let u=(0,fe.useRef)(e);u.current=e;let m=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],h=JSON.stringify(f.map(y=>typeof y=="object"?JSON.stringify(y):String(y))),g=(0,fe.useRef)(!1);(0,fe.useEffect)(()=>{let y=u.current;if(!y||!r){i(N=>N.status==="loading"?{...N,status:"idle"}:N);return}let w=new AbortController,v=!0;return g.current=!0,i(N=>({...N,data:o?N.data:[],status:"loading",error:null})),Gi(y,{...d.current,signal:w.signal}).then(N=>{v&&i({data:N,status:"success",error:null,updatedAt:Date.now()})}).catch(N=>{!v||w.signal.aborted||i(b=>({...b,status:"error",error:N instanceof Error?N:new Error(String(N))}))}).finally(()=>{v&&(g.current=!1)}),()=>{v=!1,g.current=!1,w.abort()}},[m,r,s,h,o]),(0,fe.useEffect)(()=>{if(!n||!r)return;let y=setInterval(()=>{g.current||l(w=>w+1)},n);return()=>clearInterval(y)},[n,r]);let k=(0,fe.useCallback)(()=>l(y=>y+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 $n=C(L(),1),Vi=["csv","svg","png"],Wi=/^[=+\-@\t\r\n=+-@]/,Ki=/var\(|color-mix\(/;function eo(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?sr(e.getTime()):String(e);return`"${(Wi.test(t)&&!Number.isFinite($e(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Ui(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Xi(e,t){return`\uFEFF${[t.map(eo),...e.map(r=>t.map(o=>eo(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
- `}function Di(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function yn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Jr=2,De=16;function Zr(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 Qr(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 eo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+De*2,i+De*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((h,g)=>{let y;for(let x of Array.from(h.attributes)){if(!Ni.test(x.value))continue;let w=(y??(y=getComputedStyle(h))).getPropertyValue(x.name);w&&m[g].setAttribute(x.name,Zr(w,u))}}),c.removeAttribute("style");for(let[h,g]of Object.entries({viewBox:`${-De} ${-De} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(h,String(g));let d=Zr(getComputedStyle(r).backgroundColor,u),f=o.parentElement?.querySelector("canvas")??null;if(n){let h=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Qr("rect",{x:-De,y:-De,width:s,height:l,fill:d}),h),f&&c.insertBefore(Qr("image",{href:f.toDataURL(),width:a,height:i}),h)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:f}}function Li(e,t){let n=eo(e,Jr,!1);if(!n)return;let r=Jr,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,De*r,De*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&yn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function to(e){let t=ge(e.theme),n=K(ne(e.locale))==="ko",r=Di(e.filename),o=(a,i)=>{if(a==="csv")return yn(new Blob([Pi(e.data,e.columns?.length?e.columns:Ri(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Li(i,r);let s=eo(i,1,!0);s&&yn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,xn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Ai.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,xn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var ro=S(E(),1);function no(e,t=Q){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?et(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(ir,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,ro.jsx)("div",{children:s},l)):null}}function oo(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 Oe(t.csv)}return null}var mo=S(W(),1);var X=S(W(),1);function ao(e,t){let n=ge(e.theme),[r,o,a]=Dt(e.width),i=Xe(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=Lt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&fe,d=Ur(r,e.animateOnView!==!1&&u),f=ne(e.locale),h=K(f),g=(0,X.useMemo)(()=>_e(e.format,f,t.format),[e.format,f,t.format]),y=(0,X.useCallback)(H=>bt(H,{locale:f}),[f]),x=(0,X.useMemo)(()=>yt(g,e.unit),[g,e.unit]),w=(0,X.useMemo)(()=>At(e.data),[e.data]),[M,v]=(0,X.useState)(null),[p,N]=(0,X.useState)(null),_=(0,X.useRef)([]),I=(0,X.useRef)(e.onHover);I.current=e.onHover;let O=(0,X.useRef)(e.onClick);O.current=e.onClick;let R=(0,X.useRef)(null),D=(0,X.useRef)(null),F=(0,X.useRef)(null),$=(0,X.useCallback)((H,ee="pointer")=>{if(F.current!==H){F.current=H;let le=H===null?null:_.current[H]??null;queueMicrotask(()=>I.current?.(le)),D.current?.(H)}R.current=H===null?null:ee,v(H),N(R.current)},[]),b=(0,X.useCallback)(H=>{R.current!=="keyboard"&&(R.current=H===null?null:"sync",v(H),N(R.current))},[]),T=(0,X.useCallback)(H=>{let ee=_.current[H];ee&&O.current?.(ee)},[]),L=dr(e.replayKey),z=e.width!==void 0||(a??0)>0,Z={enabled:u,active:d.visible&&z,near:d.near,replayKey:L,dataKey:w,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Ee=(0,X.useCallback)((H,ee=1)=>M===null||M===H?ee:ee*.38,[M]);return{p:n,width:s,height:c,measured:z,responsive:e.width===void 0,pending:fe&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:Z,fv:x,fmt:g,pct:y,locale:f,lang:h,t:h==="ko"?Hn:Bn,active:M,via:p,setActive:$,click:T,events:_,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Ee,sig:w,description:e.description,reduced:m,publish:D,applySync:b}}var U=S(W(),1);function Ei(e){return 1-Math.pow(1-e,3)}function _i(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ii(e){return e==="easeInOut"?_i:e==="linear"?t=>t:Ei}function Oi(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 qe(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 Et(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 io(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 so(e,t,n,r){if(!t||!n||t.length!==n.length)return qe(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of qe(s,n[i]))o.push(l)}return o.length===r?o:qe(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||!Et(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),io(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Et(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=so(s.cur,s.parts,i.parts,c),s.vel=so(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),io(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=Et(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=Et(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=qe(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=Ii(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=qe(s.from,c)),s.vel.length!==c&&(s.vel=qe(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,f=0;for(let h=0;h<c;h++){let g=s.from[h]-s.to[h],y=s.vel[h]+a*g;s.cur[h]=s.to[h]+(g+y*l)*u,s.curVel[h]=(s.vel[h]-a*y*l)*u,d&&f<.15&&(f=Math.max(f,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/a)))}m=a*l>=20||d&&f<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),f=Oi(this.easing,u)/o;for(let h=0;h<c;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*d,s.curVel[h]=(s.to[h]-s.from[h])*f;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},ot=new Set,It=0;function lo(e){It=0;let t=Array.from(ot);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||ot.delete(n)}ot.size&&typeof requestAnimationFrame<"u"&&(It=requestAnimationFrame(lo))}function co(e){return ot.add(e),!It&&typeof requestAnimationFrame<"u"&&(It=requestAnimationFrame(lo)),()=>{ot.delete(e)}}function zi(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 uo(e,t){let n=(0,U.useMemo)(()=>zi(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,U.useRef)(null),d=(0,U.useRef)("init"),f=(0,U.useRef)(null),h=(0,U.useRef)(s),g=(0,U.useRef)(i),y=(0,U.useRef)(!1),x=(0,U.useRef)(0),[,w]=(0,U.useState)(0),M=(0,U.useRef)(null),v=(0,U.useRef)(!0);u.current||(u.current=new _t,u.current.configure(l,c),u.current.snap(n),f.current=n);let p=u.current;if(p.configure(l,c),f.current!==n){let D=d.current,F=!Object.is(h.current,s);p.sameTargets(n)?p.refreshData(n):!r||D==="init"?p.snap(n):D==="idle"?p.hold(n):D==="running"||F?p.update(n,dt(),m):p.snap(n),f.current=n,h.current=s}let N=(0,U.useRef)(()=>!1);N.current=D=>{if(!v.current)return!1;let F=p.step(D);return!F&&d.current==="running"&&(d.current="done"),w($=>($+1)%1e9),F||(M.current=null),F};let _=(0,U.useCallback)(()=>{if(!fe||M.current||!p.animating)return;let D=F=>N.current(F);M.current=co(D)},[p]);be(()=>{let D=!Object.is(g.current,i);if(g.current=i,!r){(d.current!=="done"||p.animating)&&(p.snap(f.current??n),d.current="done",w(F=>F+1));return}d.current==="init"||D&&a?(p.hold(f.current??n),d.current="idle",y.current=!1,w(F=>F+1)):D&&(y.current=!0)},[r,i]),be(()=>{!r||!a||!y.current||(y.current=!1,p.hold(f.current??n),d.current="idle",w(D=>D+1))},[a,r]),(0,U.useEffect)(()=>{r&&o&&d.current==="idle"&&(p.start(dt()),x.current+=1,d.current="running",_(),w(D=>D+1))},[r,o,i,p,_]),(0,U.useEffect)(()=>{p.animating&&_()}),(0,U.useEffect)(()=>(v.current=!0,()=>{v.current=!1,M.current?.(),M.current=null}),[]);let I=dt(),O=p.elapsed(I),R=r&&d.current==="idle";return{items:p.items(),get:D=>p.get(D),elapsed:R?0:O,fade:(D,F=320)=>R?0:Number.isFinite(O)?Math.max(0,Math.min(1,(O-D)/F)):1,waiting:R,animating:p.animating,generation:x.current}}var kn=S(E(),1);function fo(e,t,n,r,o){if(r)return o==="categorical"?ye(e,t,n):qn(e,t,n);if(o==="categorical")return ye(e,t,n);let a=Y(e,"strong"),i=Y(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var Bi=S(W(),1);var wn=S(E(),1);var ho=e=>e?"neutralStrong":"accent";var Le=S(W(),1),po=S(E(),1);function go(e){let t=(0,Le.useRef)(null),n=(0,Le.useRef)(new Map),[r,o]=(0,Le.useState)(0),{width:a,height:i,draw:s,progress:l,version:c,clipRight:m,manualClear:u}=e;return(0,Le.useEffect)(()=>{let d=t.current;if(!d)return;let f=Math.min(2,window.devicePixelRatio||1),h=Math.max(1,Math.round(a*f)),g=Math.max(1,Math.round(i*f));d.width!==h&&(d.width=h),d.height!==g&&(d.height=g);let y=d.getContext("2d");if(!y)return;y.setTransform(f,0,0,f,0,0),u||y.clearRect(0,0,a,i);let x=getComputedStyle(d),w=new Map;s(y,l,(v,p)=>{let N=w.get(v);return N===void 0&&(N=x.getPropertyValue(v).trim(),w.set(v,N)),N||p}),n.current=w},[a,i,s,l,c,u,r]),(0,Le.useEffect)(()=>{let d=t.current;if(!d||typeof matchMedia!="function")return;let f=new AbortController,h=()=>o(w=>w+1),g=()=>{let w=getComputedStyle(d);for(let[M,v]of n.current)if(w.getPropertyValue(M).trim()!==v)return h()},y=()=>{matchMedia(`(resolution: ${devicePixelRatio}dppx)`).addEventListener?.("change",()=>{y(),h()},{once:!0,signal:f.signal})};y(),matchMedia("(prefers-color-scheme: dark)").addEventListener?.("change",g,{signal:f.signal});let x=new MutationObserver(g);for(let w=d.parentElement;w;w=w.parentElement)x.observe(w,{attributes:!0});return()=>{f.abort(),x.disconnect()}},[]),(0,po.jsx)("canvas",{ref:t,"aria-hidden":"true",style:{position:"absolute",left:0,top:0,width:"100%",height:"auto",aspectRatio:`${a} / ${i}`,pointerEvents:"none",clipPath:m?`inset(0 ${(m/Math.max(1,a)*100).toFixed(3)}% 0 0)`:void 0}})}var vn=S(E(),1);function bo(e,t,n,r){if(typeof e!="function")return we(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Hi=S(W(),1);var Cn=S(E(),1),ji={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}, ${Ce(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},yo={en:ji,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}일 이동평균`}},$n=["ink","muted","dim"];function xo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,$n.length)}var ie=S(W(),1);var Je=S(E(),1);function ko({p:e,right:t,steps:n,scale:r,labels:o,min:a}){let i=r.center,s=t-n*14-oe(o[1],10);return(0,Je.jsxs)("g",{"aria-hidden":"true",children:[Array.from({length:n},(l,c)=>{let m=pt(e,i===void 0?c/(n-1):2*c/(n-1)-1,a,r);return(0,Je.jsx)("rect",{x:s-6+c*14,y:3,width:12,height:9,rx:2,fill:m.fill,opacity:m.opacity},c)}),(0,Je.jsx)(Ie,{x:s-10,y:7.5,anchor:"end",size:10,fill:e.paint("muted"),children:o[0]}),(0,Je.jsx)(Ie,{x:t,y:7.5,anchor:"end",size:10,fill:e.paint("muted"),children:o[1]})]})}var se=S(E(),1),Vi={kind:"Heatmap",legend:["Less","More"],desc:(e,t,n,r)=>`${Ce(e,"row")} × ${Ce(t,"column")}, values from ${n} to ${r}`},Wi={en:Vi,ko:{kind:"히트맵",legend:["적음","많음"],desc:(e,t,n,r)=>`${e}행 × ${t}열, 값 ${n}에서 ${r}까지`}};function Mn(e){let t=ao(e,{height:C=>Math.max(180,Math.min(300,C*.48)),duration:600,stagger:0}),{p:n,width:r,height:o}=t,a=(0,ie.useMemo)(()=>{let C=Te(e.x,"x"),P=Te(e.y,"y"),j=Ke(e.value,"value"),V=Se(e.data.map((ce,de)=>C(ce,de))),q=Se(e.data.map((ce,de)=>P(ce,de))),Fe=new Map(V.map((ce,de)=>[ce,de])),me=new Map(q.map((ce,de)=>[ce,de])),te=new Float64Array(V.length*q.length).fill(NaN),$e=new Array(V.length*q.length).fill(null);e.data.forEach((ce,de)=>{let Sn=Fe.get(C(ce,de)),An=me.get(P(ce,de));if(Sn===void 0||An===void 0)return;let ct=An*V.length+Sn,Ot=j(ce,de);Number.isFinite(Ot)&&(te[ct]=Number.isFinite(te[ct])?te[ct]+Ot:Ot),$e[ct]=ce});let[Be,lt]=ze(te);return{xs:V,ys:q,vals:te,rows:$e,mn:Be,mx:lt}},[e.data,e.x,e.y,e.value]),i=a.xs.length,s=a.ys.length,l=i*s,c=t.hydrated&&l>(e.canvasThreshold??2500),m=e.legend===!1?0:20,u=Math.min(r*.3,Math.max(...a.ys.map(C=>oe(C,xe,500)),10)+8),d=20,f=u+4,h=m,g=(r-f)/Math.max(1,i),y=(o-h-d)/Math.max(1,s),x=Math.min(g,y)>14?2.5:Math.min(g,y)>5?1:0,w=Math.min(n.theme.radiusMark,Math.min(g,y)/4),M=(0,ie.useMemo)(()=>pn(a.vals),[a.vals]),v=Math.max(1e-9,M-a.mn)||1,p=(0,ie.useMemo)(()=>Jn(e.colorReverse,e.colorCenter,e.colorSteps),[e.colorReverse,e.colorCenter,e.colorSteps]),N=p.center,_=(0,ie.useMemo)(()=>N===void 0?0:Math.max(1e-9,pn(Array.from(a.vals,C=>Math.abs(C-N)))),[a.vals,N]),I=C=>pt(n,C,.08,p),O=(0,ie.useMemo)(()=>{let C=Array.from({length:l},(P,j)=>`${a.xs[j%i]}|${a.ys[Math.floor(j/i)]}`);return we(e.highlight,a.rows,C,Array.from(a.vals),e.colorReverse?"min":"max")},[a,l,i,e.highlight,e.colorReverse]),R=(0,ie.useMemo)(()=>{let C=[];for(let P=0;P<l;P++){let j=a.vals[P];Number.isFinite(j)&&C.push({i:P,col:P%i,row:Math.floor(P/i),value:j,t:N===void 0?Math.min(1,(j-a.mn)/v):Math.max(-1,Math.min(1,(j-N)/_)),datum:a.rows[P]})}return C},[a,l,i,v,N,_]),D=p.steps??5,F=t.motion.duration??600,$=(0,ie.useMemo)(()=>c?[{key:"__p",to:[1],from:[0],data:null}]:R.map(C=>({key:`h${C.i}`,to:[1],from:[0],delay:(C.col/Math.max(1,i-1)*.6+C.row/Math.max(1,s-1)*.4)*F*.9,data:C})),[R,c,i,s,F]),b=uo($,t.motion),T=e.showValues??"auto",L=t.fmt(a.mx),z=t.showLabels&&(T===!0||T==="auto"&&g>=oe(L,10.5,600)+8&&y>=15),Z=t.fv,Ee=(0,ie.useMemo)(()=>Rt(R.length,C=>{let P=R[C];return{datum:P.datum,index:P.i,key:`${a.xs[P.col]}|${a.ys[P.row]}`,label:`${a.ys[P.row]} · ${a.xs[P.col]}`,value:P.value,formatted:Z(P.value)}}),[R,a,Z]),H=(0,ie.useMemo)(()=>new Map(R.map((C,P)=>[C.i,P])),[R]),ee=(C,P)=>{let j=Math.floor((C-f)/g),V=Math.floor((P-h)/y);if(j<0||V<0||j>=i||V>=s)return null;let q=H.get(V*i+j);return q===void 0?null:q},le=null;if(t.active!==null&&R[t.active]){let C=R[t.active];le={x:f+C.col*g+g/2,y:h+C.row*y,title:`${a.ys[C.row]} · ${a.xs[C.col]}`,rows:[{label:t.t.value,value:t.fv(C.value),color:n.paint("accent")}]}}let ve=c?b.get("__p")?.[0]??1:1,it=(0,ie.useCallback)((C,P,j)=>{let V=j("--ztd-accent",n.theme.accent),q=j("--ztd-neutral-strong",n.theme.neutralStrong),Fe=V;C.fillStyle=V;for(let me of R){let te=me.col/Math.max(1,i-1)*.6+me.row/Math.max(1,s-1)*.4,$e=Math.max(0,Math.min(1,(P*1.25-te)*4));if($e<=0)continue;let Be=Yt(me.t,p),lt=Be<0?q:V;lt!==Fe&&(C.fillStyle=Fe=lt),C.globalAlpha=(.08+.92*Math.min(1,Math.abs(Be)))*$e,C.fillRect(f+me.col*g+x/2,h+me.row*y+x/2,Math.max(.5,g-x),Math.max(.5,y-x))}C.globalAlpha=1},[R,i,s,f,h,g,y,x,n.theme.accent,n.theme.neutralStrong,p]),Lo=(0,ie.useMemo)(()=>_r(a.xs.map((C,P)=>f+P*g+g/2),a.xs,xe,6),[a.xs,f,g]),Eo=y>=11?a.ys.map((C,P)=>P):a.ys.map((C,P)=>P).filter(C=>C%Math.ceil(12/Math.max(1,y))===0),st=Wi[t.lang],_o=e.description??`${st.kind}. ${st.desc(s,i,t.fv(a.mn),t.fv(a.mx))}.`,Io=e.legendLabels??st.legend;return(0,se.jsxs)(hr,{c:t,kind:st.kind,ariaLabel:e.ariaLabel,description:_o,events:Ee,tip:le,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(C,P,j)=>{let V=ee(C,P);V!==t.active&&t.setActive(V,j.pointerType==="touch"?"touch":"pointer")},onKey:C=>{let P=C.key==="ArrowDown"?1:C.key==="ArrowUp"?-1:0,j=t.active===null?null:R[t.active];if(!P||!j)return!1;for(let V=j.row+P;V>=0&&V<s;V+=P){let q=H.get(V*i+j.col);if(q!==void 0){t.setActive(q,"keyboard");break}}return!0},underlay:c?(0,se.jsx)(go,{width:r,height:o,draw:it,progress:ve,version:t.sig}):void 0,children:[e.legend!==!1?(0,se.jsx)(ko,{p:n,right:r,steps:D,scale:p,labels:Io,min:.08}):null,c?t.active!==null&&R[t.active]?(()=>{let C=R[t.active];return(0,se.jsx)("rect",{x:f+C.col*g,y:h+C.row*y,width:g,height:y,fill:"none",stroke:n.paint("ink"),strokeWidth:1.5,pointerEvents:"none"})})():null:b.items.map(C=>{let P=C.data;if(!P)return null;let j=I(P.t),V=f+P.col*g+x/2,q=h+P.row*y+x/2,Fe=Math.max(.5,g-x),me=Math.max(.5,y-x),te=H.get(P.i)??-1,$e=O.has(P.i);return(0,se.jsxs)("g",{opacity:C.v[0],children:[(0,se.jsx)("path",{d:mn(V,q,Fe,me,w),fill:j.fill,opacity:j.opacity*(t.active===null||t.active===te?1:.55),className:"ztd-mark",onPointerEnter:Be=>t.setActive(te,Be.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(te)}),$e||t.active===te?(0,se.jsx)("path",{d:mn(V-1,q-1,Fe+2,me+2,w+1),fill:"none",stroke:n.paint("ink"),strokeWidth:$e&&t.active!==te?1.5:2,pointerEvents:"none"}):null,z?(0,se.jsx)(Ie,{x:V+Fe/2,y:q+me/2,anchor:"middle",size:10.5,weight:$e?800:600,fill:j.text,children:t.fmt(P.value)}):null]},C.key)}),(0,se.jsxs)("g",{"aria-hidden":"true",children:[Eo.map(C=>(0,se.jsx)(Ie,{x:u,y:h+C*y+y/2,anchor:"end",size:xe,weight:500,fill:n.paint("muted"),children:dn(a.ys[C],u-2,xe,500)},C)),Lo.map(C=>(0,se.jsx)(Ie,{x:f+C*g+g/2,y:o-d+12,anchor:"middle",size:xe,fill:n.paint("muted"),children:a.xs[C]},C))]})]})}var Gi=S(W(),1);var Mo=S(E(),1),Ki={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ui={en:Ki,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},wo=(e,t)=>Ui[e].other(t);function vo(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,Fr(o.map(a=>a.value)))}}var $o=e=>Number.isFinite(e)&&e>0?e:0;function Co(e,t,n,r){return r==="emphasis"?Yn(e,t,n):ye(e,t,n)}var Xi=S(W(),1);var Fo=S(E(),1);function To(e,t){return t===!1?e.map((n,r)=>r):Ar(e)}function So(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return we(e,t,t,r,"max")}function Ao(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]=Y(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?Y(e,"neutral"):gt(e,1-i/Math.max(1,o.length-1))),r}var Ae=S(E(),1);function No(e,t){let n=St(e);return n?.type==="scatter"&&t?.size!==void 0?St("bubble"):n}function Yi(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 qi(e,t,n,r=!1){let o=No(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&sn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=Te(a.label,"label"),d=Ke(a.value,"value"),f=o.type==="waffle",h=t.map((v,p)=>({r:v,label:u(v,p),value:f?d(v,p):$o(d(v,p))})),{kept:g,other:y}=f?{kept:h,other:null}:vo(h,i.other,(v,p)=>({r:{},label:wo(K(n),v),value:p})),x=we(s,g.map(v=>v.r),g.map(v=>v.label),g.map(v=>v.value),f?"first":"max"),w=y?[...g,y]:g,M=Qe(v=>f?ye(v,w.length,x):Co(v,w.length,x,i.colorMode));return w.map((v,p)=>({label:v.label,color:M[p]}))}if(o.type==="candlestick"){let u=xo(Array.isArray(i.ma)?i.ma:void 0,t.length),d=yo[K(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((f,h)=>({label:d.maLegend(f),color:$n[h],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let u=Te(a.series,"series"),d=Se(t.map((g,y)=>u(g,y)));if(d.length<2)return[];let f=bo(s,t,d,u),h=Qe(g=>Xn(g,d.length,f));return c(d.map((g,y)=>({label:g,color:h[y],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=Te(a.series,"series");u=Se(t.map((v,p)=>M(v,p)))}let d=ln(o.type,a,i);if(d.length){let M=we(s,u,u,u.map(()=>0),"none"),v=Qe(N=>ye(N,u.length,M)),p=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((N,_)=>({label:N,color:v[_]}));return[...c(p),...d.map((N,_)=>({label:N,color:ho(_),shape:"line"}))]}if(u.length<2)return[];let h=o.type==="bar"&&i.layout==="diverging"&&s===void 0?Sr(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=h>=0?new Set([h]):we(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((M,v)=>({label:M,color:g.has(v)?"accent":"neutralStrong",shape:"square"})));let y=i.colorMode,x=M=>ye(M,u.length,g);if((o.type==="line"||o.type==="area")&&(x=M=>fo(M,u.length,g,o.type==="area",y)),o.type==="stream"){let M=tt(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),v=To(M.values,i.reorder),p=So(s,M.series,M.values);x=N=>Ao(N,v,p)}let w=Qe(x);return c(u.map((M,v)=>({label:M,color:w[v],...o.type==="line"&&{shape:"line"}})))}return[]}function Ji(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&xr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Zi(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function Ro(e,t){let{spec:n}=e,r=No(n.type,n.encoding),o=(0,at.useMemo)(()=>oo(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=yr(n,e.locale),s=ne(i),l=K(s),c=Yr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=vr(n),u=(0,at.useMemo)(()=>m?no(m,s):void 0,[m,s]),d=n.options?.hidden,f=Array.isArray(d)?d.map(String):[],h=f.join(""),[g,y]=(0,at.useState)(null);if(!r)return(0,Ae.jsx)(an,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let x=o??c.data,w=t[r.type],M={...n.options??{}},v={...Yi(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},p=n.card?.legend==="toggle"&&wr(r.type,n.encoding??{},M),N=g&&g.base===h?g.hidden:f;p&&(v.hidden=N);let _=F=>y($=>{let b=$&&$.base===h?$.hidden:f;return{base:h,hidden:b.includes(F)?b.filter(T=>T!==F):[...b,F]}}),I=v.height??220,O=Ji(n,r.type),R=a&&!x.length&&(c.loading||c.error||c.empty)?(0,Ae.jsx)(an,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:I,locale:i}):O?(0,Ae.jsx)(Xr,{chart:w,...Zi(r.type,O,v)}):(0,Ae.jsx)(w,{...v});if(n.card){let F=n.card,$=F.legend==="auto"||F.legend==="toggle"?qi(n,x,s,p):F.legend,b=$?.length?p?(0,Ae.jsx)(on,{items:$,hidden:N,onToggle:_,locale:i}):$:void 0,T=F.download?(0,Ae.jsx)(to,{data:x,columns:$r(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;R=(0,Ae.jsx)(fr,{number:F.number,title:F.title??br(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:i,children:R})}let D=e.theme??n.theme;return D&&(R=(0,Ae.jsx)(vt,{theme:D,children:R})),R}function Qi({cfg:e,components:t}){let n=Xe();return Ro({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Do(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Po.hydrateRoot)(r,(0,Tn.createElement)(vt,{theme:o.theme,cssVars:!0},(0,Tn.createElement)(Qi,{cfg:o,components:{[e]:t}})))}Do("heatmap",Mn);})();
27
+ `}function Yi(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function vn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var to=2,De=16;function no(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 ro(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 oo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+De*2,i+De*2],c=o.cloneNode(!0),d=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((h,g)=>{let k;for(let y of Array.from(h.attributes)){if(!Ki.test(y.value))continue;let w=(k??(k=getComputedStyle(h))).getPropertyValue(y.name);w&&d[g].setAttribute(y.name,no(w,u))}}),c.removeAttribute("style");for(let[h,g]of Object.entries({viewBox:`${-De} ${-De} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(h,String(g));let m=no(getComputedStyle(r).backgroundColor,u),f=o.parentElement?.querySelector("canvas")??null;if(n){let h=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(ro("rect",{x:-De,y:-De,width:s,height:l,fill:m}),h),f&&c.insertBefore(ro("image",{href:f.toDataURL(),width:a,height:i}),h)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:m,canvas:f}}function qi(e,t){let n=oo(e,to,!1);if(!n)return;let r=to,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,De*r,De*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&vn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function ao(e){let t=xe(e.theme),n=K(re(e.locale))==="ko",r=Yi(e.filename),o=(a,i)=>{if(a==="csv")return vn(new Blob([Xi(e.data,e.columns?.length?e.columns:Ui(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return qi(i,r);let s=oo(i,1,!0);s&&vn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,$n.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Vi.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,$n.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var so=C(L(),1);function io(e,t=Q){let n=Oe(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?tt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(cr,(d,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,so.jsx)("div",{children:s},l)):null}}function lo(e,t,n=!1){let r=de(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=ee(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}function co(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 Be(t.csv)}return null}var bo=C(V(),1);var X=C(V(),1);function uo(e,t){let n=xe(e.theme),[r,o,a]=Et(e.width),i=Ye(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,d=Ot(e.reducedMotion??"auto"),u=e.animate!==!1&&!d&&pe,m=qr(r,e.animateOnView!==!1&&u),f=re(e.locale),h=K(f),g=(0,X.useMemo)(()=>Oe(e.format,f,t.format),[e.format,f,t.format]),k=(0,X.useCallback)(H=>yt(H,{locale:f}),[f]),y=(0,X.useMemo)(()=>xt(g,e.unit),[g,e.unit]),w=(0,X.useMemo)(()=>Rt(e.data),[e.data]),[v,N]=(0,X.useState)(null),[b,S]=(0,X.useState)(null),E=(0,X.useRef)([]),O=(0,X.useRef)(e.onHover);O.current=e.onHover;let I=(0,X.useRef)(e.onClick);I.current=e.onClick;let F=(0,X.useRef)(null),P=(0,X.useRef)(null),R=(0,X.useRef)(null),$=(0,X.useCallback)((H,te="pointer")=>{if(R.current!==H){R.current=H;let ce=H===null?null:E.current[H]??null;queueMicrotask(()=>O.current?.(ce)),P.current?.(H)}F.current=H===null?null:te,N(H),S(F.current)},[]),x=(0,X.useCallback)(H=>{F.current!=="keyboard"&&(F.current=H===null?null:"sync",N(H),S(F.current))},[]),T=(0,X.useCallback)(H=>{let te=E.current[H];te&&I.current?.(te)},[]),D=gr(e.replayKey),z=e.width!==void 0||(a??0)>0,Z={enabled:u,active:m.visible&&z,near:m.near,replayKey:D,dataKey:w,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Ee=(0,X.useCallback)((H,te=1)=>v===null||v===H?te:te*.38,[v]);return{p:n,width:s,height:c,measured:z,responsive:e.width===void 0,pending:pe&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:Z,fv:y,fmt:g,pct:k,locale:f,lang:h,t:h==="ko"?Wn:Vn,active:v,via:b,setActive:$,click:T,events:E,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Ee,sig:w,description:e.description,reduced:d,publish:P,applySync:x}}var U=C(V(),1);function Ji(e){return 1-Math.pow(1-e,3)}function Zi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Qi(e){return e==="easeInOut"?Zi:e==="linear"?t=>t:Ji}function es(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 Je(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 It(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 mo(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 fo(e,t,n,r){if(!t||!n||t.length!==n.length)return Je(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of Je(s,n[i]))o.push(l)}return o.length===r?o:Je(e,r)}var zt=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||!It(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),mo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=It(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=fo(s.cur,s.parts,i.parts,c),s.vel=fo(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),mo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=It(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=It(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=Je(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=Qi(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Je(s.from,c)),s.vel.length!==c&&(s.vel=Je(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 d;if(this.easing==="spring"){let u=Math.exp(-a*l),m=a*l>=8&&a*l<20,f=0;for(let h=0;h<c;h++){let g=s.from[h]-s.to[h],k=s.vel[h]+a*g;s.cur[h]=s.to[h]+(g+k*l)*u,s.curVel[h]=(s.vel[h]-a*k*l)*u,m&&f<.15&&(f=Math.max(f,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/a)))}d=a*l>=20||m&&f<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),m=r(u),f=es(this.easing,u)/o;for(let h=0;h<c;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*m,s.curVel[h]=(s.to[h]-s.from[h])*f;d=u>=1,s.progress=m}if(d){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},at=new Set,Bt=0;function ho(e){Bt=0;let t=Array.from(at);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||at.delete(n)}at.size&&typeof requestAnimationFrame<"u"&&(Bt=requestAnimationFrame(ho))}function go(e){return at.add(e),!Bt&&typeof requestAnimationFrame<"u"&&(Bt=requestAnimationFrame(ho)),()=>{at.delete(e)}}function ts(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 po(e,t){let n=(0,U.useMemo)(()=>ts(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:d=0}=t,u=(0,U.useRef)(null),m=(0,U.useRef)("init"),f=(0,U.useRef)(null),h=(0,U.useRef)(s),g=(0,U.useRef)(i),k=(0,U.useRef)(!1),y=(0,U.useRef)(0),[,w]=(0,U.useState)(0),v=(0,U.useRef)(null),N=(0,U.useRef)(!0);u.current||(u.current=new zt,u.current.configure(l,c),u.current.snap(n),f.current=n);let b=u.current;if(b.configure(l,c),f.current!==n){let P=m.current,R=!Object.is(h.current,s);b.sameTargets(n)?b.refreshData(n):!r||P==="init"?b.snap(n):P==="idle"?b.hold(n):P==="running"||R?b.update(n,ft(),d):b.snap(n),f.current=n,h.current=s}let S=(0,U.useRef)(()=>!1);S.current=P=>{if(!N.current)return!1;let R=b.step(P);return!R&&m.current==="running"&&(m.current="done"),w($=>($+1)%1e9),R||(v.current=null),R};let E=(0,U.useCallback)(()=>{if(!pe||v.current||!b.animating)return;let P=R=>S.current(R);v.current=go(P)},[b]);ve(()=>{let P=!Object.is(g.current,i);if(g.current=i,!r){(m.current!=="done"||b.animating)&&(b.snap(f.current??n),m.current="done",w(R=>R+1));return}m.current==="init"||P&&a?(b.hold(f.current??n),m.current="idle",k.current=!1,w(R=>R+1)):P&&(k.current=!0)},[r,i]),ve(()=>{!r||!a||!k.current||(k.current=!1,b.hold(f.current??n),m.current="idle",w(P=>P+1))},[a,r]),(0,U.useEffect)(()=>{r&&o&&m.current==="idle"&&(b.start(ft()),y.current+=1,m.current="running",E(),w(P=>P+1))},[r,o,i,b,E]),(0,U.useEffect)(()=>{b.animating&&E()}),(0,U.useEffect)(()=>(N.current=!0,()=>{N.current=!1,v.current?.(),v.current=null}),[]);let O=ft(),I=b.elapsed(O),F=r&&m.current==="idle";return{items:b.items(),get:P=>b.get(P),elapsed:F?0:I,fade:(P,R=320)=>F?0:Number.isFinite(I)?Math.max(0,Math.min(1,(I-P)/R)):1,waiting:F,animating:b.animating,generation:y.current}}var Mn=C(L(),1);function yo(e,t,n,r,o){if(r)return o==="categorical"?be(e,t,n):Qn(e,t,n);if(o==="categorical")return be(e,t,n);let a=Y(e,"strong"),i=Y(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var ns=C(V(),1);var Tn=C(L(),1);var xo=e=>e?"neutralStrong":"accent";var Le=C(V(),1),wo=C(L(),1);function ko(e){let t=(0,Le.useRef)(null),n=(0,Le.useRef)(new Map),[r,o]=(0,Le.useState)(0),{width:a,height:i,draw:s,progress:l,version:c,clipRight:d,manualClear:u}=e;return(0,Le.useEffect)(()=>{let m=t.current;if(!m)return;let f=Math.min(2,window.devicePixelRatio||1),h=Math.max(1,Math.round(a*f)),g=Math.max(1,Math.round(i*f));m.width!==h&&(m.width=h),m.height!==g&&(m.height=g);let k=m.getContext("2d");if(!k)return;k.setTransform(f,0,0,f,0,0),u||k.clearRect(0,0,a,i);let y=getComputedStyle(m),w=new Map;s(k,l,(N,b)=>{let S=w.get(N);return S===void 0&&(S=y.getPropertyValue(N).trim(),w.set(N,S)),S||b}),n.current=w},[a,i,s,l,c,u,r]),(0,Le.useEffect)(()=>{let m=t.current;if(!m||typeof matchMedia!="function")return;let f=new AbortController,h=()=>o(w=>w+1),g=()=>{let w=getComputedStyle(m);for(let[v,N]of n.current)if(w.getPropertyValue(v).trim()!==N)return h()},k=()=>{matchMedia(`(resolution: ${devicePixelRatio}dppx)`).addEventListener?.("change",()=>{k(),h()},{once:!0,signal:f.signal})};k(),matchMedia("(prefers-color-scheme: dark)").addEventListener?.("change",g,{signal:f.signal});let y=new MutationObserver(g);for(let w=m.parentElement;w;w=w.parentElement)y.observe(w,{attributes:!0});return()=>{f.abort(),y.disconnect()}},[]),(0,wo.jsx)("canvas",{ref:t,"aria-hidden":"true",style:{position:"absolute",left:0,top:0,width:"100%",height:"auto",aspectRatio:`${a} / ${i}`,pointerEvents:"none",clipPath:d?`inset(0 ${(d/Math.max(1,a)*100).toFixed(3)}% 0 0)`:void 0}})}var Ze=C(L(),1);function vo({p:e,right:t,steps:n,scale:r,labels:o,min:a}){let i=r.center,s=t-n*14-ae(o[1],10);return(0,Ze.jsxs)("g",{"aria-hidden":"true",children:[Array.from({length:n},(l,c)=>{let d=bt(e,i===void 0?c/(n-1):2*c/(n-1)-1,a,r);return(0,Ze.jsx)("rect",{x:s-6+c*14,y:3,width:12,height:9,rx:2,fill:d.fill,opacity:d.opacity},c)}),(0,Ze.jsx)(Ie,{x:s-10,y:7.5,anchor:"end",size:10,fill:e.paint("muted"),children:o[0]}),(0,Ze.jsx)(Ie,{x:t,y:7.5,anchor:"end",size:10,fill:e.paint("muted"),children:o[1]})]})}var Cn=C(L(),1);function $o(e,t,n,r){if(typeof e!="function")return we(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var rs=C(V(),1);var An=C(L(),1),os={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`},Mo={en:os,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}일 이동평균`}},Sn=["ink","muted","dim"];function To(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Sn.length)}var se=C(V(),1);var le=C(L(),1),as={kind:"Heatmap",legend:["Less","More"],desc:(e,t,n,r)=>`${Se(e,"row")} × ${Se(t,"column")}, values from ${n} to ${r}`},is={en:as,ko:{kind:"히트맵",legend:["적음","많음"],desc:(e,t,n,r)=>`${e}행 × ${t}열, 값 ${n}에서 ${r}까지`}};function Nn(e){let t=uo(e,{height:M=>Math.max(180,Math.min(300,M*.48)),duration:600,stagger:0}),{p:n,width:r,height:o}=t,a=(0,se.useMemo)(()=>{let M=de(e.x,"x"),_=de(e.y,"y"),j=Ue(e.value,"value"),G=ee(e.data.map((ue,ge)=>M(ue,ge))),J=ee(e.data.map((ue,ge)=>_(ue,ge))),Ne=new Map(G.map((ue,ge)=>[ue,ge])),he=new Map(J.map((ue,ge)=>[ue,ge])),ne=new Float64Array(G.length*J.length).fill(NaN),Ce=new Array(G.length*J.length).fill(null);e.data.forEach((ue,ge)=>{let Fn=Ne.get(M(ue,ge)),_n=he.get(_(ue,ge));if(Fn===void 0||_n===void 0)return;let ut=_n*G.length+Fn,Ht=j(ue,ge);Number.isFinite(Ht)&&(ne[ut]=Number.isFinite(ne[ut])?ne[ut]+Ht:Ht),Ce[ut]=ue});let[je,ct]=He(ne);return{xs:G,ys:J,vals:ne,rows:Ce,mn:je,mx:ct}},[e.data,e.x,e.y,e.value]),i=a.xs.length,s=a.ys.length,l=i*s,c=t.hydrated&&l>(e.canvasThreshold??2500),d=e.legend===!1?0:20,u=Math.min(r*.3,Math.max(...a.ys.map(M=>ae(M,Me,500)),10)+8),m=20,f=u+4,h=d,g=(r-f)/Math.max(1,i),k=(o-h-m)/Math.max(1,s),y=Math.min(g,k)>14?2.5:Math.min(g,k)>5?1:0,w=Math.min(n.theme.radiusMark,Math.min(g,k)/4),v=(0,se.useMemo)(()=>xn(a.vals),[a.vals]),N=Math.max(1e-9,v-a.mn)||1,b=(0,se.useMemo)(()=>er(e.colorReverse,e.colorCenter,e.colorSteps),[e.colorReverse,e.colorCenter,e.colorSteps]),S=b.center,E=(0,se.useMemo)(()=>S===void 0?0:Math.max(1e-9,xn(Array.from(a.vals,M=>Math.abs(M-S)))),[a.vals,S]),O=M=>bt(n,M,.08,b),I=(0,se.useMemo)(()=>{let M=Array.from({length:l},(_,j)=>`${a.xs[j%i]}|${a.ys[Math.floor(j/i)]}`);return we(e.highlight,a.rows,M,Array.from(a.vals),e.colorReverse?"min":"max")},[a,l,i,e.highlight,e.colorReverse]),F=(0,se.useMemo)(()=>{let M=[];for(let _=0;_<l;_++){let j=a.vals[_];Number.isFinite(j)&&M.push({i:_,col:_%i,row:Math.floor(_/i),value:j,t:S===void 0?Math.min(1,(j-a.mn)/N):Math.max(-1,Math.min(1,(j-S)/E)),datum:a.rows[_]})}return M},[a,l,i,N,S,E]),P=b.steps??5,R=t.motion.duration??600,$=(0,se.useMemo)(()=>c?[{key:"__p",to:[1],from:[0],data:null}]:F.map(M=>({key:`h${M.i}`,to:[1],from:[0],delay:(M.col/Math.max(1,i-1)*.6+M.row/Math.max(1,s-1)*.4)*R*.9,data:M})),[F,c,i,s,R]),x=po($,t.motion),T=e.showValues??"auto",D=t.fmt(a.mx),z=t.showLabels&&(T===!0||T==="auto"&&g>=ae(D,10.5,600)+8&&k>=15),Z=t.fv,Ee=(0,se.useMemo)(()=>Pt(F.length,M=>{let _=F[M];return{datum:_.datum,index:_.i,key:`${a.xs[_.col]}|${a.ys[_.row]}`,label:`${a.ys[_.row]} · ${a.xs[_.col]}`,value:_.value,formatted:Z(_.value)}}),[F,a,Z]),H=(0,se.useMemo)(()=>new Map(F.map((M,_)=>[M.i,_])),[F]),te=(M,_)=>{let j=Math.floor((M-f)/g),G=Math.floor((_-h)/k);if(j<0||G<0||j>=i||G>=s)return null;let J=H.get(G*i+j);return J===void 0?null:J},ce=null;if(t.active!==null&&F[t.active]){let M=F[t.active];ce={x:f+M.col*g+g/2,y:h+M.row*k,title:`${a.ys[M.row]} · ${a.xs[M.col]}`,rows:[{label:t.t.value,value:t.fv(M.value),color:n.paint("accent")}]}}let Te=c?x.get("__p")?.[0]??1:1,st=(0,se.useCallback)((M,_,j)=>{let G=j("--ztd-accent",n.theme.accent),J=j("--ztd-neutral-strong",n.theme.neutralStrong),Ne=G;M.fillStyle=G;for(let he of F){let ne=he.col/Math.max(1,i-1)*.6+he.row/Math.max(1,s-1)*.4,Ce=Math.max(0,Math.min(1,(_*1.25-ne)*4));if(Ce<=0)continue;let je=Zt(he.t,b),ct=je<0?J:G;ct!==Ne&&(M.fillStyle=Ne=ct),M.globalAlpha=(.08+.92*Math.min(1,Math.abs(je)))*Ce,M.fillRect(f+he.col*g+y/2,h+he.row*k+y/2,Math.max(.5,g-y),Math.max(.5,k-y))}M.globalAlpha=1},[F,i,s,f,h,g,k,y,n.theme.accent,n.theme.neutralStrong,b]),Go=(0,se.useMemo)(()=>zr(a.xs.map((M,_)=>f+_*g+g/2),a.xs,Me,6),[a.xs,f,g]),Vo=k>=11?a.ys.map((M,_)=>_):a.ys.map((M,_)=>_).filter(M=>M%Math.ceil(12/Math.max(1,k))===0),lt=is[t.lang],Wo=e.description??`${lt.kind}. ${lt.desc(s,i,t.fv(a.mn),t.fv(a.mx))}.`,Ko=e.legendLabels??lt.legend;return(0,le.jsxs)(br,{c:t,kind:lt.kind,ariaLabel:e.ariaLabel,description:Wo,events:Ee,tip:ce,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(M,_,j)=>{let G=te(M,_);G!==t.active&&t.setActive(G,j.pointerType==="touch"?"touch":"pointer")},onKey:M=>{let _=M.key==="ArrowDown"?1:M.key==="ArrowUp"?-1:0,j=t.active===null?null:F[t.active];if(!_||!j)return!1;for(let G=j.row+_;G>=0&&G<s;G+=_){let J=H.get(G*i+j.col);if(J!==void 0){t.setActive(J,"keyboard");break}}return!0},underlay:c?(0,le.jsx)(ko,{width:r,height:o,draw:st,progress:Te,version:t.sig}):void 0,children:[e.legend!==!1?(0,le.jsx)(vo,{p:n,right:r,steps:P,scale:b,labels:Ko,min:.08}):null,c?t.active!==null&&F[t.active]?(()=>{let M=F[t.active];return(0,le.jsx)("rect",{x:f+M.col*g,y:h+M.row*k,width:g,height:k,fill:"none",stroke:n.paint("ink"),strokeWidth:1.5,pointerEvents:"none"})})():null:x.items.map(M=>{let _=M.data;if(!_)return null;let j=O(_.t),G=f+_.col*g+y/2,J=h+_.row*k+y/2,Ne=Math.max(.5,g-y),he=Math.max(.5,k-y),ne=H.get(_.i)??-1,Ce=I.has(_.i);return(0,le.jsxs)("g",{opacity:M.v[0],children:[(0,le.jsx)("path",{d:hn(G,J,Ne,he,w),fill:j.fill,opacity:j.opacity*(t.active===null||t.active===ne?1:.55),className:"ztd-mark",onPointerEnter:je=>t.setActive(ne,je.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(ne)}),Ce||t.active===ne?(0,le.jsx)("path",{d:hn(G-1,J-1,Ne+2,he+2,w+1),fill:"none",stroke:n.paint("ink"),strokeWidth:Ce&&t.active!==ne?1.5:2,pointerEvents:"none"}):null,z?(0,le.jsx)(Ie,{x:G+Ne/2,y:J+he/2,anchor:"middle",size:10.5,weight:Ce?800:600,fill:j.text,children:t.fmt(_.value)}):null]},M.key)}),(0,le.jsxs)("g",{"aria-hidden":"true",children:[Vo.map(M=>(0,le.jsx)(Ie,{x:u,y:h+M*k+k/2,anchor:"end",size:Me,weight:500,fill:n.paint("muted"),children:gn(a.ys[M],u-2,Me,500)},M)),Go.map(M=>(0,le.jsx)(Ie,{x:f+M*g+g/2,y:o-m+12,anchor:"middle",size:Me,fill:n.paint("muted"),children:a.xs[M]},M))]})]})}var ss=C(V(),1);var Ro=C(L(),1),ls={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Se(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},cs={en:ls,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Co=(e,t)=>cs[e].other(t);function So(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,_r(o.map(a=>a.value)))}}var Ao=e=>Number.isFinite(e)&&e>0?e:0;function No(e,t,n,r){return r==="emphasis"?Zn(e,t,n):be(e,t,n)}var us=C(V(),1);var Do=C(L(),1);function Fo(e,t){return t===!1?e.map((n,r)=>r):Fr(e)}function _o(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return we(e,t,t,r,"max")}function Po(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]=Y(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?Y(e,"neutral"):pt(e,1-i/Math.max(1,o.length-1))),r}function Lo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ee(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function Eo(e,t){return et(e,t+1,new Set)}var ms=C(V(),1);var Io=C(L(),1);function Oo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Zr.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Ae=C(L(),1);function zo(e,t,n){let r=Nt(e);return r?.type==="scatter"&&t?.size!==void 0&&!At(n)?Nt("bubble"):r}function ds(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 fs(e,t,n,r=!1){let o=zo(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&un.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(d.includes(o.type)){let u=de(a.label,"label"),m=Ue(a.value,"value"),f=o.type==="waffle",h=t.map((b,S)=>({r:b,label:u(b,S),value:f?m(b,S):Ao(m(b,S))})),{kept:g,other:k}=f?{kept:h,other:null}:So(h,i.other,(b,S)=>({r:{},label:Co(K(n),b),value:S})),y=we(s,g.map(b=>b.r),g.map(b=>b.label),g.map(b=>b.value),f?"first":"max"),w=k?[...g,k]:g,v=_e(b=>f?be(b,w.length,y):No(b,w.length,y,i.colorMode)),N=f&&i.shape==="arc";return w.map((b,S)=>({label:b.label,color:v[S],...N&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=To(Array.isArray(i.ma)?i.ma:void 0,t.length),m=Mo[K(n)];return[{label:m.up,color:i.upColor??"accent"},{label:m.down,color:i.downColor??"neutralStrong"},...u.map((f,h)=>({label:m.maLegend(f),color:Sn[h],shape:"line"}))]}if(o.type==="network"){let u=Lo(i.groups);if(u.length<2)return[];let m=_e(f=>Eo(f,u.length));return u.map((f,h)=>({label:f,color:m[h],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=de(a.group,"group"),m=ee(t.map((h,g)=>u(h,g)).filter(Boolean));if(m.length<2)return[];let f=_e(h=>et(h,m.length,new Set));return m.map((h,g)=>({label:h,color:f[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||At(i))return[];let u=de(a.series,"series"),m=ee(t.map((g,k)=>u(g,k)));if(m.length<2)return[];let f=$o(s,t,m,u),h=_e(g=>et(g,m.length,f));return c(m.map((g,k)=>({label:g,color:h[k],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",m=u?a.status:a.group;if(typeof m!="string")return[];let f=lo(t,m,u),h=_e(g=>be(g,f.length,Oo(s,f)));return c(f.map((g,k)=>({label:g,color:h[k],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let v=de(a.series,"series");u=ee(t.map((N,b)=>v(N,b)))}let m=mn(o.type,a,i);if(m.length){let v=we(s,u,u,u.map(()=>0),"none"),N=_e(S=>be(S,u.length,v)),b=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((S,E)=>({label:S,color:N[E]}));return[...c(b),...m.map((S,E)=>({label:S,color:xo(E),shape:"line"}))]}if(u.length<2)return[];let h=o.type==="bar"&&i.layout==="diverging"&&s===void 0?Rr(u.length,Array.isArray(i.negative)?i.negative.map(v=>u.indexOf(String(v))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=h>=0?new Set([h]):we(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,N)=>({label:v,color:g.has(N)?"accent":"neutralStrong",shape:"square"})));let k=i.colorMode,y=v=>be(v,u.length,g);if((o.type==="line"||o.type==="area")&&(y=v=>yo(v,u.length,g,o.type==="area",k)),o.type==="stream"){let v=nt(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),N=Fo(v.values,i.reorder),b=_o(s,v.series,v.values);y=S=>Po(S,N,b)}let w=_e(y);return c(u.map((v,N)=>({label:v,color:w[N],...o.type==="line"&&{shape:"line"}})))}return[]}function hs(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&vr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function gs(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function Bo(e,t){let{spec:n}=e,r=zo(n.type,n.encoding,n.options),o=(0,it.useMemo)(()=>co(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=wr(n,e.locale),s=re(i),l=K(s),c=Qr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),d=Tr(n),u=(0,it.useMemo)(()=>d?io(d,s):void 0,[d,s]),m=n.options?.hidden,f=Array.isArray(m)?m.map(String):[],h=f.join(""),[g,k]=(0,it.useState)(null);if(!r)return(0,Ae.jsx)(cn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let y=o??c.data,w=t[r.type],v={...n.options??{}},N={...ds(r,n.encoding),...v,...u?{tooltip:u}:{},data:y,...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"&&Mr(r.type,n.encoding??{},v),S=g&&g.base===h?g.hidden:f;b&&(N.hidden=S);let E=R=>k($=>{let x=$&&$.base===h?$.hidden:f;return{base:h,hidden:x.includes(R)?x.filter(T=>T!==R):[...x,R]}}),O=N.height??220,I=hs(n,r.type),F=a&&!y.length&&(c.loading||c.error||c.empty)?(0,Ae.jsx)(cn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:O,locale:i}):I?(0,Ae.jsx)(Jr,{chart:w,...gs(r.type,I,N)}):(0,Ae.jsx)(w,{...N});if(n.card){let R=n.card,$=R.legend==="auto"||R.legend==="toggle"?fs(n,y,s,b):R.legend,x=$?.length?b?(0,Ae.jsx)(ln,{items:$,hidden:S,onToggle:E,locale:i}):$:void 0,T=R.download?(0,Ae.jsx)(ao,{data:y,columns:Cr(n),filename:R.title??r.type,formats:Array.isArray(R.download)?R.download:void 0,locale:i}):void 0;F=(0,Ae.jsx)(pr,{number:R.number,title:R.title??kr(r,l),subtitle:R.subtitle,legend:x,actions:T,source:R.source||void 0,note:R.note||void 0,accent:R.accent,takeaway:R.takeaway,level:R.level,sample:R.sample,replay:R.replay!==!1,className:e.className,locale:i,children:F})}let P=e.theme??n.theme;return P&&(F=(0,Ae.jsx)($t,{theme:P,children:F})),F}function ps({cfg:e,components:t}){let n=Ye();return Bo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function jo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Ho.hydrateRoot)(r,(0,Rn.createElement)($t,{theme:o.theme,cssVars:!0},(0,Rn.createElement)(ps,{cfg:o,components:{[e]:t}})))}jo("heatmap",Nn);})();