ztd-charts-cli 0.6.0 → 0.7.0

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