ztd-charts-cli 0.6.0 → 0.8.0

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