ztd-charts-cli 0.10.0 → 0.11.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 (48) hide show
  1. package/dist/api.js +1 -1
  2. package/dist/{chunk-QVGOP3IE.js → chunk-ZZGASY2Y.js} +1 -1
  3. package/dist/cli.js +1 -1
  4. package/dist/client/area.js +6 -6
  5. package/dist/client/bar.js +5 -5
  6. package/dist/client/barRace.js +2 -2
  7. package/dist/client/beeswarm.js +2 -2
  8. package/dist/client/box.js +6 -6
  9. package/dist/client/bubble.js +6 -6
  10. package/dist/client/bullet.js +5 -5
  11. package/dist/client/bump.js +6 -6
  12. package/dist/client/calendar.js +5 -5
  13. package/dist/client/candlestick.js +4 -4
  14. package/dist/client/chord.js +5 -5
  15. package/dist/client/choropleth.js +5 -5
  16. package/dist/client/donut.js +6 -6
  17. package/dist/client/dumbbell.js +2 -2
  18. package/dist/client/flowMap.js +4 -4
  19. package/dist/client/funnel.js +2 -2
  20. package/dist/client/gauge.js +2 -2
  21. package/dist/client/heatmap.js +5 -5
  22. package/dist/client/histogram.js +5 -5
  23. package/dist/client/line.js +6 -6
  24. package/dist/client/lollipop.js +5 -5
  25. package/dist/client/marimekko.js +6 -6
  26. package/dist/client/network.js +5 -5
  27. package/dist/client/parallel.js +6 -6
  28. package/dist/client/pareto.js +5 -5
  29. package/dist/client/pie.js +6 -6
  30. package/dist/client/radar.js +6 -6
  31. package/dist/client/radialBar.js +2 -2
  32. package/dist/client/ridgeline.js +4 -4
  33. package/dist/client/sankey.js +4 -4
  34. package/dist/client/scatter.js +6 -6
  35. package/dist/client/segmented.js +2 -2
  36. package/dist/client/skyline.js +2 -2
  37. package/dist/client/slope.js +5 -5
  38. package/dist/client/sparkline.js +6 -6
  39. package/dist/client/stream.js +6 -6
  40. package/dist/client/sunburst.js +2 -2
  41. package/dist/client/symbolMap.js +5 -5
  42. package/dist/client/tileMap.js +6 -6
  43. package/dist/client/timeline.js +10 -10
  44. package/dist/client/tree.js +5 -5
  45. package/dist/client/treemap.js +2 -2
  46. package/dist/client/waffle.js +5 -5
  47. package/dist/client/waterfall.js +5 -5
  48. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- (()=>{var wo=Object.create;var fn=Object.defineProperty;var vo=Object.getOwnPropertyDescriptor;var $o=Object.getOwnPropertyNames;var Mo=Object.getPrototypeOf,To=Object.prototype.hasOwnProperty;var Mt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Co=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $o(t))!To.call(e,o)&&o!==n&&fn(e,o,{get:()=>t[o],enumerable:!(r=vo(t,o))||r.enumerable});return e};var C=(e,t,n)=>(n=e!=null?wo(Mo(e)):{},Co(t||!e||!e.__esModule?fn(n,"default",{value:e,enumerable:!0}):n,e));var W=Mt((Wi,hn)=>{hn.exports=globalThis.__ztdReact.react});var pn=Mt((Ki,gn)=>{gn.exports=globalThis.__ztdReact["react-dom/client"]});var I=Mt((is,Wn)=>{Wn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var mn=C(W(),1),bo=C(pn(),1);var Xe=C(W(),1);var lt=C(W(),1);var bn=C(W(),1),Ne=(0,bn.createContext)(void 0);var wn=C(W(),1);var So=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],yn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',xn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',xe={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:yn,monoFamily:xn,radius:18,radiusCode:14,radiusMark:4},Tt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:yn,monoFamily:xn,radius:18,radiusCode:14,radiusMark:4},Ct={dark:xe,light:Tt};function Je(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function St(e){let t={};for(let n of So){let r=e[n];typeof r=="string"&&(t[Je(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function At(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 Ao=`
1
+ (()=>{var wo=Object.create;var fn=Object.defineProperty;var vo=Object.getOwnPropertyDescriptor;var $o=Object.getOwnPropertyNames;var Mo=Object.getPrototypeOf,To=Object.prototype.hasOwnProperty;var Mt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Co=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $o(t))!To.call(e,o)&&o!==n&&fn(e,o,{get:()=>t[o],enumerable:!(r=vo(t,o))||r.enumerable});return e};var C=(e,t,n)=>(n=e!=null?wo(Mo(e)):{},Co(t||!e||!e.__esModule?fn(n,"default",{value:e,enumerable:!0}):n,e));var W=Mt((Ki,hn)=>{hn.exports=globalThis.__ztdReact.react});var pn=Mt((Ui,gn)=>{gn.exports=globalThis.__ztdReact["react-dom/client"]});var I=Mt((ss,Wn)=>{Wn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var mn=C(W(),1),bo=C(pn(),1);var Xe=C(W(),1);var lt=C(W(),1);var bn=C(W(),1),Ne=(0,bn.createContext)(void 0);var wn=C(W(),1);var So=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],yn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',xn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',xe={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:yn,monoFamily:xn,radius:18,radiusCode:14,radiusMark:4},Tt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:yn,monoFamily:xn,radius:18,radiusCode:14,radiusMark:4},Ct={dark:xe,light:Tt};function Je(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function St(e){let t={};for(let n of So){let r=e[n];typeof r=="string"&&(t[Je(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function At(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 Ao=`
2
2
  .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
3
  .ztd-root:focus{outline:none}
4
4
  .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${xe.accent});outline-offset:3px;border-radius:6px}
@@ -25,4 +25,4 @@
25
25
  `&&f++,s.push(l),a.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?sr(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((p,$)=>[String($),u(p)])));let d=[],h=new Set;return m[0].forEach((f,p)=>{let $=f.trim()||`col${p+1}`,x=$;for(let v=2;h.has(x);v++)x=`${$}_${v}`;h.add(x),d.push(x)}),m.slice(1).map(f=>Object.fromEntries(d.map((p,$)=>[p,u(f[$]??"")])))}function Kt(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?sr(a[l]):a[l]??null])))}function Wa(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function lr(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 ve(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ve(JSON.parse(t))}catch{}return Ce(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Kt(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)?ve(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Kt(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)?ve(t.rows):Array.isArray(t.values)?Kt(t.values):Array.isArray(t.items)?ve(t.items):Array.isArray(t.results)?ve(t.results):Wa(t)}return[]}function ft(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function Ut(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let h=a(d,c),f=h-a(d,c-1),p=0;for(let $=0;$<d;$++)p+=a($,c)-a($,c-1);m+=h,u+=(f/2+p)*h}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][l],p=Number.isFinite(f)?f:0;p>=0?(o[h][l]=u,u+=p,i[h][l]=u):(o[h][l]=d,d+=p,i[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=a(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,i[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,i[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,i[u][d]-=m}return{y0:o,y1:i}}function cr(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 ur(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Ka=Math.PI*2;function ht(e,t,n){return e<t?t:e>n?n:e}function mr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function D(e){return Math.round(e*100)/100}function Xt(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let i=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,a=Math.min(n,r)/2,s=ht(i.tl??0,0,a),l=ht(i.tr??0,0,a),c=ht(i.br??0,0,a),m=ht(i.bl??0,0,a);return`M${D(e+s)},${D(t)}H${D(e+n-l)}`+(l?`A${D(l)},${D(l)} 0 0 1 ${D(e+n)},${D(t+l)}`:"")+`V${D(t+r-c)}`+(c?`A${D(c)},${D(c)} 0 0 1 ${D(e+n-c)},${D(t+r)}`:"")+`H${D(e+m)}`+(m?`A${D(m)},${D(m)} 0 0 1 ${D(e)},${D(t+r-m)}`:"")+`V${D(t+s)}`+(s?`A${D(s)},${D(s)} 0 0 1 ${D(e+s)},${D(t)}`:"")+"Z"}function dr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function hr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function fr(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 gt=new Map;function de(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=gt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);hr(c)?a+=fr(c):s+=fr(c)}i=a+s*(n>=600?1.07:1),gt.size>5e3&&gt.clear(),gt.set(o,i)}return i*t}function Yt(e,t,n,r=400){if(e=e.trim(),de(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;de(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(hr(s.charCodeAt(0))?2:3)?"":s+o}var pr=C(I(),1),Ua=e=>Array.isArray(e)&&e.length===2;function gr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ua(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var yr=C(I(),1),Jt=10.5;function Xa(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>_e(a,{locale:n,maximumFractionDigits:i}))}function br(e,t,n){let r=18;for(let o of Xa(e,t,n))r=Math.max(r,de(o,Jt));return Math.ceil(r+8)}function qt(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function Le(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=qt(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let h=qt(c[1]-c[0],n);if(h===l)break;l=h}return c}function xr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=qt(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Zt(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>xr(n,r,l),s}function Qt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[i,a]=Le(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function Ya(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of c){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:xr(e,t,3)}function kr(e,t){let n=Zt([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=()=>Ya(e[0],e[1],Math.abs(t[1]-t[0])),r}function Ge(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var Ja=864e5;function wr(e,t,n,r=Q){let o=t-e;if(!(o>0))return[{t:e,label:He(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Ja,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,h=!1)=>{let f=new Date(m),p=-1,$=0;for(;f.getTime()<=t&&$++<500;){if(f.getTime()>=e){let x=f.getFullYear(),v=h&&!l&&x!==p;a.push({t:f.getTime(),label:He(f,{locale:r,...d,...v?{year:"numeric"}:{}})}),p=x}u(f)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),c(h,p=>p.setMonth(p.getMonth()+d),{month:"short"},!0)}}return a}function vr(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var qa=(e,t,n)=>e==="date"?ot(t,n)?.getTime()??NaN:pe(t);function Za(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Gn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ve(e,t,n,r,o={}){let i=Te(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Te(n,"y"),c=!a&&r!==void 0?Te(r,"series"):null,m=e.map((M,y)=>i(M,y)),u=o.xType??Za(m),d=o.locale??Q,h,f,p;if(u==="band"){let M=m.map(T=>String(T??""));h=me(M);let y=new Map(h.map((T,P)=>[T,P]));f=h.map((T,P)=>P),p=Int32Array.from(M,T=>y.get(T)??-1)}else{let M=u==="date"?o.dayFirst??Vn(m):void 0,y=m.map(H=>qa(u,H,M)),T=Array.from(new Set(y.filter(H=>Number.isFinite(H)))).sort((H,k)=>H-k),P=new Map(T.map((H,k)=>[H,k]));f=T,h=T.map(String),p=Int32Array.from(y,H=>P.get(H)??-1)}let $=o.dateFormat,x=M=>typeof M=="string"?rt(M.trim())?.[3]:void 0,v=u==="date"&&m.length<5e3?x(m[0]):void 0,w=(v===2||v===3)&&m.every(M=>x(M)===v),A=w&&v===3;if(u==="date"&&!$){let M=f.length>1?f[f.length-1]-f[0]:0;$=w&&v===2||M>864e5*120?{month:"short"}:M<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},M>864e5*800&&($={year:"numeric",month:"short"})}let b;if(u==="band")b=h;else if(A&&!o.dateFormat){let M=K(d)==="ko";b=f.map(y=>{let T=new Date(y),P=Math.floor(T.getMonth()/3)+1;return M?`${T.getFullYear()}년 ${P}분기`:`Q${P} ${T.getFullYear()}`})}else{let M=f.every(It),y=u==="date"?new Intl.DateTimeFormat(d,$):new Intl.NumberFormat(d,M?{useGrouping:!1}:{maximumFractionDigits:6});b=f.length>1e3?vr(f.length,T=>y.format(f[T])):f.map(T=>y.format(T))}let R=s?[...s]:c?me(e.map((M,y)=>String(c(M,y)??""))):[""],_=new Map(R.map((M,y)=>[M,y])),E=R.map(()=>new Array(h.length).fill(NaN)),B=R.map(()=>new Array(h.length).fill(null)),O=o.aggregate??"sum",F=O==="mean"?R.map(()=>new Uint32Array(h.length)):null,N=(M,y,T,P)=>{let H=E[M][y];O==="last"?E[M][y]=T:O==="count"?E[M][y]=(Number.isFinite(H)?H:0)+1:O==="mean"?Number.isFinite(T)&&(E[M][y]=(Number.isFinite(H)?H:0)+T,F[M][y]++):E[M][y]=Number.isFinite(H)?H+(Number.isFinite(T)?T:0):T,B[M][y]=P};for(let M=0;M<e.length;M++){let y=p[M];if(y<0)continue;let T=e[M];if(s)for(let P=0;P<s.length;P++)N(P,y,pe(T[s[P]]),T);else{let P=c?_.get(String(c(T,M)??""))??0:0;N(P,y,pe(l(T,M)),T)}}if(F)for(let M=0;M<E.length;M++)for(let y=0;y<h.length;y++)F[M][y]>1&&(E[M][y]/=F[M][y]);return{type:u,keys:h,xnum:f,labels:b,series:R,values:E,rows:B}}var Qa=140,Ke=12,$r=14,en=20,Mr=12.5;function ei(e,t,n=nr){let r=ue(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function ti(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Ke)/(Qa+Ke))),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)*Ke)/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 We=e=>e.filter(Number.isFinite);function pt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=De(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return We(n)}function Tr(e,t,n,r,o,i){return Ve(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function ri(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),R=r.refLines??{},[_,E]=Ge([...pt(b,r.x??"x"),...We([Number(R.x)])]),[B,O]=Ge([...pt(b,r.y??"y"),...We([Number(R.y)])].filter(N=>!s||N>0)),F=r.zero??!1;return{y:c??(s?Qt(B,O,a):Le(B,O,a,{zero:F,pad:.08})),x:r.xDomain??Le(_,E,Math.max(2,Math.round(o/110)),{zero:F,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(b=>b.keys.join("")===d),f=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),p=r.xDomain??(!m&&f?Ge(n.flatMap(b=>We(b.xnum))):void 0),$=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if($==="percent")return{x:p,sameKeys:h};if(c)return{y:c,x:p,sameKeys:h};let x=[];t.forEach((b,R)=>{let _=n[R];if($==="stacked"||$==="auto"&&_.series.length>1){let B=Ut(_.values,"zero");B.y0.forEach(O=>x.push(...O)),B.y1.forEach(O=>x.push(...O))}else _.values.forEach(B=>x.push(...B));m&&!u&&r.line!==void 0&&Tr(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(B=>x.push(...B)),m||x.push(...pt(b,r.lower),...pt(b,r.upper))}),m&&x.push(0),u||x.push(...gr(r.annotations));for(let b of r.referenceLines??[])x.push(b.y);r.signColors&&x.push(Number(r.baseline??0));let[v,w]=Ge(We(x).filter(b=>!s||b>0));return{y:s?Qt(v,w,a):m?Le(v,w,u?Math.max(2,Math.round(o/120)):a):Le(v,w,a,{zero:r.zero??e==="area"}),x:p,sameKeys:h}}function oi(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Ve(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?kr:Zt)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=br(c,zn(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),d=r.endLabels??n.some(b=>b.series.length>1),h=m+6,f=i-(d?Math.min(i*.28,Math.max(...u.map(b=>de(b,11,700)),20)+14):10),p=l.keys.length,[$,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?p>12:p>wr($,x,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!p||v)return;let w=b=>h+(l.xnum[b]-$)/(x-$)*(f-h),A=b=>de(l.labels[b],Jt);for(let b=1;;b++){let R=Array.from({length:Math.ceil(p/b)},(_,E)=>E*b);if(b>=p||R.every((_,E)=>!E||w(_)-w(R[E-1])>=(A(_)+A(R[E-1]))/2+8))return R.map(_=>({value:l.xnum[_],label:l.labels[_]}))}}function ai(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 ii(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${ai(`${e}|${t}|${o}|${ft(r)}`)}`}function si(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)=>`${ke(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:"(빈 값)"}},tn=18;function Cr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=ei(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=ti(s,a,e.columns),{pw:c,ph:m}=ni(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(F=>Tr(t,F,n,n.y,n.series,n.aggregate)),h=u?ri(t,o,d,n,c,m):{sameKeys:!1},f=u?oi(t,o,d,n,h,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",$=u&&(!p||h.sameKeys),x=u&&(p||h.x!==void 0||h.sameKeys),v=new Set(si(e.highlight,r)?[e.highlight].flat():[]),w=v.size>0,A=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??ii(t,e.by,n,e.data),R=nt(Me(n.format,e.locale),n.unit),_=li[e.lang],E=[],B=r.map(F=>F===""?_.blank:F);return{panels:r.map((F,N)=>{let M=o[N],y=B[N],T=N%l,P;if(t!=="scatter"){let k=d[N],G=Z=>k.values.reduce((z,J)=>z+(Number.isFinite(J[Z])?J[Z]:0),0),L=k.keys.map((Z,z)=>z).filter(Z=>k.values.some(z=>Number.isFinite(z[Z]))),V=L[L.length-1];E.push({first:L.length?G(L[0]):NaN,last:L.length?G(V):NaN,total:L.reduce((Z,z)=>Z+G(z),0)}),t!=="bar"&&k.series.length===1&&V!==void 0&&(P=R(k.values[0][V]))}else E.push({first:NaN,last:NaN,total:M.length});let H={data:M,width:c,height:m,ariaLabel:e.title?`${e.title}, ${y}`:y,syncId:b,highlight:w?v.has(F)?A?()=>!0:void 0:"none":e.highlight,showYAxis:!$||T===0,showXAxis:!x||N+l>=a};return h.y&&(H.yDomain=h.y),h.x&&(H.xDomain=h.x),f&&(H.xTicks=f),{value:F,label:y,props:H,last:P,isPicked:v.has(F)}}),cols:l,pw:c,ph:m,isPanelPick:w,description:ci(t,e.by,B,E,i,R,_)}}function ci(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>dr(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var ne=C(W(),1);function ui(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function mi(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 bt={threshold:.25,enoughPx:96,rootMargin:"0px"};function Nr(e,t=!0){let[n,r]=(0,ne.useState)({visible:!t,near:!t});return(0,ne.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(a=>{let s=mi(a[a.length-1],bt.threshold,bt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ui(bt.threshold),rootMargin:bt.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function Sr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function yt(e){let[t,n]=(0,ne.useState)(null),[r,o]=(0,ne.useState)(e??null),i=(0,ne.useCallback)(a=>{n(a),a&&e===void 0&&o(Sr(a))},[e]);return ge(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a(Sr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var di=()=>()=>{};function Ee(){return(0,ne.useSyncExternalStore)(di,()=>!0,()=>!1)}var Ar="(prefers-reduced-motion: reduce)";function xt(e="auto"){let[t,n]=(0,ne.useState)(()=>ie&&typeof window.matchMedia=="function"?window.matchMedia(Ar).matches:!1);return(0,ne.useEffect)(()=>{if(e!=="auto"||!ie||typeof window.matchMedia!="function")return;let r=window.matchMedia(Ar),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var fe=C(I(),1),fi=60,hi=420;function Rr(e){let t=ce(),n=e.chartProps??{},[,r,o]=yt(e.width),i=e.width??(o||480),a=ee(e.locale??n.locale),s=K(a),l=(0,Oe.useContext)(Ne),c=e.title??l,m=e.chart.facetPlan,u=(0,Oe.useMemo)(()=>{let x=Cr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return m?m(x,n,a):x},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(x,v)=>typeof v=="function"?String(v):v),e.highlight,e.syncId,i,e.height,c,a,s,m]),d=`${(0,Oe.useId)().replace(/:/g,"")}fd`,h=xt(n.reducedMotion??"auto"),f=Ee(),p=$n({motion:{enabled:n.animate!==!1&&!h&&ie},hydrated:f},{waiting:!1,generation:0}),$=e.chart;return(0,fe.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,fe.jsx)("p",{id:d,style:ut,children:e.description??u.description}),(0,fe.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Ke,rowGap:$r,...u.legend?{marginTop:tn}:null},children:u.panels.map((x,v)=>{let w=t.paint(x.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,fe.jsxs)("div",{"data-facet":x.value,style:{minWidth:0,...vn(p,!1,"fade",v*fi,hi)},children:[(0,fe.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:en,fontSize:Mr,fontWeight:700,lineHeight:`${en}px`,color:w},children:[(0,fe.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.label}),x.last!==void 0?(0,fe.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:x.last}):null]}),(0,fe.jsx)($,{...n,...x.props})]},x.value)})}),u.legend?(0,fe.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:tn},children:u.legend}):null]})}var Fr=["max","min","first","last","none"];function he(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&i.add(u)});return i}var ae=C(W(),1);async function gi(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(K(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ce(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ce(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ce(i)}async function pi(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await gi(i,t.parse,o,t.locale)}return t.select&&(r=lr(r,t.select)),t.transform?t.transform(r):ve(r)}function _r(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,ae.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ae.useState)(0),c=ee(t.locale),m=(0,ae.useRef)(t);m.current={...t,locale:c};let u=(0,ae.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),p=(0,ae.useRef)(!1);(0,ae.useEffect)(()=>{let x=u.current;if(!x||!r){a(A=>A.status==="loading"?{...A,status:"idle"}:A);return}let v=new AbortController,w=!0;return p.current=!0,a(A=>({...A,data:o?A.data:[],status:"loading",error:null})),pi(x,{...m.current,signal:v.signal}).then(A=>{w&&a({data:A,status:"success",error:null,updatedAt:Date.now()})}).catch(A=>{!w||v.signal.aborted||a(b=>({...b,status:"error",error:A instanceof Error?A:new Error(String(A))}))}).finally(()=>{w&&(p.current=!1)}),()=>{w=!1,p.current=!1,v.abort()}},[d,r,s,f,o]),(0,ae.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{p.current||l(v=>v+1)},n);return()=>clearInterval(x)},[n,r]);let $=(0,ae.useCallback)(()=>l(x=>x+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:$}}var rn=C(I(),1),bi=["csv","svg","png"],yi=/^[=+\-@\t\r\n=+-@]/,xi=/var\(|color-mix\(/;function Pr(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Bn(e.getTime()):String(e);return`"${(yi.test(t)&&!Number.isFinite(pe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ki(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function wi(e,t){return`\uFEFF${[t.map(Pr),...e.map(r=>t.map(o=>Pr(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
27
  `}function vi(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function nn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Dr=2,$e=16;function Lr(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Er(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 Or(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+$e*2,a+$e*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,p)=>{let $;for(let x of Array.from(f.attributes)){if(!xi.test(x.value))continue;let v=($??($=getComputedStyle(f))).getPropertyValue(x.name);v&&m[p].setAttribute(x.name,Lr(v,u))}}),c.removeAttribute("style");for(let[f,p]of Object.entries({viewBox:`${-$e} ${-$e} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(p));let d=Lr(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Er("rect",{x:-$e,y:-$e,width:s,height:l,fill:d}),f),h&&c.insertBefore(Er("image",{href:h.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:d,canvas:h}}function $i(e,t){let n=Or(e,Dr,!1);if(!n)return;let r=Dr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,$e*r,$e*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&nn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Ir(e){let t=ce(e.theme),n=K(ee(e.locale))==="ko",r=vi(e.filename),o=(i,a)=>{if(i==="csv")return nn(new Blob([wi(e.data,e.columns?.length?e.columns:ki(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return $i(a,r);let s=Or(a,1,!0);s&&nn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,rn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:bi.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,rn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:a},i)})})}var Br=C(I(),1);function zr(e,t=Q){let n=Me(void 0,t),r=e.split(`
28
- `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?He(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(jn,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,Br.jsx)("div",{children:s},l)):null}}function Hr(e,t,n=!1){let r=ue(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=me(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function jr(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Ce(t.csv)}return null}var Yr=C(W(),1);var Y=C(W(),1);function Gr(e,t){let n=ce(e.theme),[r,o,i]=yt(e.width),a=Ee(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=xt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ie,d=Nr(r,e.animateOnView!==!1&&u),h=ee(e.locale),f=K(h),p=(0,Y.useMemo)(()=>Me(e.format,h,t.format),[e.format,h,t.format]),$=(0,Y.useCallback)(L=>tt(L,{locale:h}),[h]),x=(0,Y.useMemo)(()=>nt(p,e.unit),[p,e.unit]),v=(0,Y.useMemo)(()=>ft(e.data),[e.data]),[w,A]=(0,Y.useState)(null),[b,R]=(0,Y.useState)(null),_=(0,Y.useRef)([]),E=(0,Y.useRef)(e.onHover);E.current=e.onHover;let B=(0,Y.useRef)(e.onClick);B.current=e.onClick;let O=(0,Y.useRef)(null),F=(0,Y.useRef)(null),N=(0,Y.useRef)(null),M=(0,Y.useCallback)((L,V="pointer")=>{if(N.current!==L){N.current=L;let Z=L===null?null:_.current[L]??null;queueMicrotask(()=>E.current?.(Z)),F.current?.(L)}O.current=L===null?null:V,A(L),R(O.current)},[]),y=(0,Y.useCallback)(L=>{O.current!=="keyboard"&&(O.current=L===null?null:"sync",A(L),R(O.current))},[]),T=(0,Y.useCallback)(L=>{let V=_.current[L];V&&B.current?.(V)},[]),P=Xn(e.replayKey),H=e.width!==void 0||(i??0)>0,k={enabled:u,active:d.visible&&H,near:d.near,replayKey:P,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},G=(0,Y.useCallback)((L,V=1)=>w===null||w===L?V:V*.38,[w]);return{p:n,width:s,height:c,measured:H,responsive:e.width===void 0,pending:ie&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:k,fv:x,fmt:p,pct:$,locale:h,lang:f,t:f==="ko"?Tn:Mn,active:w,via:b,setActive:M,click:T,events:_,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:G,sig:v,description:e.description,reduced:m,publish:F,applySync:y}}var X=C(W(),1);function Mi(e){return 1-Math.pow(1-e,3)}function Ti(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ci(e){return e==="easeInOut"?Ti:e==="linear"?t=>t:Mi}function Si(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function Ie(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function kt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function Vr(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function Wr(e,t,n,r){if(!t||!n||t.length!==n.length)return Ie(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Ie(s,n[a]))o.push(l)}return o.length===r?o:Ie(e,r)}var wt=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||!kt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Vr(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=kt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Wr(s.cur,s.parts,a.parts,c),s.vel=Wr(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Vr(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=kt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=kt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Ie(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Ci(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Ie(s.from,c)),s.vel.length!==c&&(s.vel=Ie(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-i*l),d=i*l>=8&&i*l<20,h=0;for(let f=0;f<c;f++){let p=s.from[f]-s.to[f],$=s.vel[f]+i*p;s.cur[f]=s.to[f]+(p+$*l)*u,s.curVel[f]=(s.vel[f]-i*$*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=Si(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ue=new Set,vt=0;function Kr(e){vt=0;let t=Array.from(Ue);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ue.delete(n)}Ue.size&&typeof requestAnimationFrame<"u"&&(vt=requestAnimationFrame(Kr))}function Ur(e){return Ue.add(e),!vt&&typeof requestAnimationFrame<"u"&&(vt=requestAnimationFrame(Kr)),()=>{Ue.delete(e)}}function Ai(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 Xr(e,t){let n=(0,X.useMemo)(()=>Ai(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,X.useRef)(null),d=(0,X.useRef)("init"),h=(0,X.useRef)(null),f=(0,X.useRef)(s),p=(0,X.useRef)(a),$=(0,X.useRef)(!1),x=(0,X.useRef)(0),[,v]=(0,X.useState)(0),w=(0,X.useRef)(null),A=(0,X.useRef)(!0);u.current||(u.current=new wt,u.current.configure(l,c),u.current.snap(n),h.current=n);let b=u.current;if(b.configure(l,c),h.current!==n){let F=d.current,N=!Object.is(f.current,s);b.sameTargets(n)?b.refreshData(n):!r||F==="init"?b.snap(n):F==="idle"?b.hold(n):F==="running"||N?b.update(n,Ze(),m):b.snap(n),h.current=n,f.current=s}let R=(0,X.useRef)(()=>!1);R.current=F=>{if(!A.current)return!1;let N=b.step(F);return!N&&d.current==="running"&&(d.current="done"),v(M=>(M+1)%1e9),N||(w.current=null),N};let _=(0,X.useCallback)(()=>{if(!ie||w.current||!b.animating)return;let F=N=>R.current(N);w.current=Ur(F)},[b]);ge(()=>{let F=!Object.is(p.current,a);if(p.current=a,!r){(d.current!=="done"||b.animating)&&(b.snap(h.current??n),d.current="done",v(N=>N+1));return}d.current==="init"||F&&i?(b.hold(h.current??n),d.current="idle",$.current=!1,v(N=>N+1)):F&&($.current=!0)},[r,a]),ge(()=>{!r||!i||!$.current||($.current=!1,b.hold(h.current??n),d.current="idle",v(F=>F+1))},[i,r]),(0,X.useEffect)(()=>{r&&o&&d.current==="idle"&&(b.start(Ze()),x.current+=1,d.current="running",_(),v(F=>F+1))},[r,o,a,b,_]),(0,X.useEffect)(()=>{b.animating&&_()}),(0,X.useEffect)(()=>(A.current=!0,()=>{A.current=!1,w.current?.(),w.current=null}),[]);let E=Ze(),B=b.elapsed(E),O=r&&d.current==="idle";return{items:b.items(),get:F=>b.get(F),elapsed:O?0:B,fade:(F,N=320)=>O?0:Number.isFinite(B)?Math.max(0,Math.min(1,(B-F)/N)):1,waiting:O,animating:b.animating,generation:x.current}}var on=C(I(),1);function Jr(e,t,n,r,o){if(r)return o==="categorical"?se(e,t,n):Pn(e,t,n);if(o==="categorical")return se(e,t,n);let i=U(e,"strong"),a=U(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Ni=C(W(),1);var an=C(I(),1);var qr=e=>e?"neutralStrong":"accent";var sn=C(I(),1);function Zr(e,t,n,r){if(typeof e!="function")return he(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var Ri=C(W(),1);var cn=C(I(),1),Fi={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}, ${ke(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Qr={en:Fi,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},ln=["ink","muted","dim"];function eo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,ln.length)}var $t=C(W(),1);var re=C(I(),1),_i={kind:"Funnel chart",header:"vs. previous",vsPrev:"vs. previous step",vsFirst:"vs. first step",count:"Count",drop:"Drop-off",rate:(e,t)=>`${t} of ${e?"first":"previous"} step`,steps:e=>ke(e,"step"),paren:e=>` (${e})`},Pi={en:_i,ko:{kind:"퍼널 차트",header:"전 단계 대비",vsPrev:"전 단계 대비",vsFirst:"첫 단계 대비",count:"인원",drop:"이탈",rate:(e,t)=>`${e?"첫 단계":"전 단계"} 대비 ${t}`,steps:e=>`${e}단계`,paren:e=>`(${e})`}};function un(e){let t=Gr(e,{height:k=>Math.max(180,Math.min(260,k*.56)),duration:800,stagger:110}),{p:n,width:r,height:o}=t,i=e.showRates!==!1,a=e.rateBase??"previous",{rows:s,rates:l,hi:c}=(0,$t.useMemo)(()=>{let k=ue(e.label,"label"),G=De(e.value,"value"),L=e.data.map((z,J)=>({d:z,i:J,label:k(z,J),value:Math.max(0,G(z,J)||0)})),V=L.map((z,J)=>J===0?null:a==="first"?L[0].value?z.value/L[0].value*100:0:L[J-1].value?z.value/L[J-1].value*100:0),Z;if(e.highlight!==void 0)Z=he(e.highlight,L.map(z=>z.d),L.map(z=>z.label),L.map(z=>z.value));else{let z=-1,J=1/0;V.forEach((ye,Ye)=>{ye!==null&&ye<J&&(J=ye,z=Ye)}),Z=new Set(z>=0?[z]:[])}return{rows:L,rates:V,hi:Z}},[e.data,e.label,e.value,e.highlight,a]),m=Math.min(120,Math.max(54,...s.map(k=>Math.max(de(k.label,11.5,700),de(t.fv(k.value),10.5)))))+8,u=Pi[t.lang],d=e.rateLabel??u.header,h=i?Math.max(44,de(d,10.5)*.6):0,f=i?18:4,p=m+6,$=Math.max(40,r-p-h-10),x=p+$/2,v=Math.max(1,s.length),w=(o-f-4)/v,A=Math.max(8,Math.min(34,w*.52)),b=Math.max(0,...s.map(k=>k.value))||1,R=$,_=(0,$t.useMemo)(()=>s.map((k,G)=>({i:G,label:k.label,value:k.value,rate:l[G],w:Math.max(10,k.value/b*R),hi:c.has(G),datum:k.d})),[s,l,c,b,R]),E=t.motion.stagger??110,B=(0,$t.useMemo)(()=>_.map((k,G)=>({key:`f:${k.label}`,to:[k.w,1],from:[k.w*.15,0],enter:[0,0],delay:G*E,data:k})),[_,E]),O=Xr(B,t.motion),F=new Map(O.items.filter(k=>!k.exiting).map(k=>[k.data.i,k])),N=k=>f+w*k+w/2,M=U(n,"neutral"),y=U(n,"accent"),T=_.map(k=>({datum:k.datum,index:k.i,key:k.label,label:k.label,value:k.value,formatted:`${t.fv(k.value)}${k.rate!==null?` · ${u.rate(a==="first",t.pct(k.rate))}`:""}`})),P=null;if(t.active!==null&&_[t.active]){let k=_[t.active];P={x,y:N(k.i)-A/2,title:k.label,rows:[{label:u.count,value:t.fv(k.value),color:k.hi?y.fill:M.fill},...k.rate!==null?[{label:a==="first"?u.vsFirst:u.vsPrev,value:t.pct(k.rate)}]:[],...k.i>0?[{label:u.drop,value:t.fv(_[k.i-1].value-k.value)}]:[]]}}let H=e.description??`${u.kind}. ${u.steps(_.length)}: ${_.map(k=>`${k.label} ${t.fv(k.value)}${k.rate!==null?u.paren(t.pct(k.rate)):""}`).join(", ")}.`;return(0,re.jsxs)(Jn,{c:t,kind:u.kind,ariaLabel:e.ariaLabel,description:H,events:T,tip:P,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[i?(0,re.jsx)(je,{x:r-2,y:8,anchor:"end",size:10.5,fill:n.paint("muted"),opacity:O.fade(0,300),children:d}):null,_.map((k,G)=>{let L=F.get(G);if(!L)return null;let V=L.v[0],Z=L.v[1],z=N(G),J=_[G+1]?F.get(G+1):void 0,ye=J?J.v[0]:0,Ye=J?J.v[1]:0,Se=z+A/2,Ae=z+w-A/2,dn=J&&Ye>.01?`M${D(x-V/2)},${D(Se-1)}C${D(x-V/2)},${D((Se+Ae)/2)} ${D(x-ye/2)},${D((Se+Ae)/2)} ${D(x-ye/2)},${D(Ae+1)}L${D(x+ye/2)},${D(Ae+1)}C${D(x+ye/2)},${D((Se+Ae)/2)} ${D(x+V/2)},${D((Se+Ae)/2)} ${D(x+V/2)},${D(Se-1)}Z`:"",xo=k.hi?y:M;return(0,re.jsxs)("g",{opacity:t.dim(G),className:"ztd-mark",onPointerEnter:ko=>t.setActive(G,ko.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(G),style:{cursor:e.onClick?"pointer":void 0},children:[(0,re.jsx)("rect",{x:p-m,y:z-w/2,width:r-p+m,height:w,fill:"transparent"}),dn?(0,re.jsx)("path",{d:dn,fill:n.paint("neutral"),opacity:.55*Math.min(Z,Ye)}):null,(0,re.jsx)("path",{d:Xt(x-V/2,z-A/2,V,A,Math.min(7,A/3)),fill:xo.fill,opacity:Z}),t.active===G&&t.via==="keyboard"?(0,re.jsx)("path",{d:Xt(x-V/2-3,z-A/2-3,V+6,A+6,8),fill:"none",stroke:n.paint("ink"),strokeWidth:2}):null,(0,re.jsxs)("g",{opacity:O.fade(G*(t.motion.stagger??110)+120,260),children:[(0,re.jsx)(je,{x:m,y:z-6,anchor:"end",size:11.5,weight:k.hi?800:600,fill:n.paint("ink"),children:Yt(k.label,m-4,11.5,700)}),(0,re.jsx)(je,{x:m,y:z+8,anchor:"end",size:10.5,fill:n.paint("muted"),children:t.fv(k.value)}),i&&k.rate!==null?(0,re.jsx)(je,{x:r-2,y:f+w*G,anchor:"end",size:12,weight:k.hi?800:500,fill:n.paint(k.hi?"ink":"muted"),children:t.pct(k.rate)}):null]})]},G)})]})}var Di=C(W(),1);var ao=C(I(),1),Li={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ke(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ei={en:Li,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},to=(e,t)=>Ei[e].other(t);function no(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,mr(o.map(i=>i.value)))}}var ro=e=>Number.isFinite(e)&&e>0?e:0;function oo(e,t,n,r){return r==="emphasis"?_n(e,t,n):se(e,t,n)}var Oi=C(W(),1);var co=C(I(),1);function io(e,t){return t===!1?e.map((n,r)=>r):ur(e)}function so(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return he(e,t,t,r,"max")}function lo(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=U(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?U(e,"neutral"):et(e,1-a/Math.max(1,o.length-1))),r}function uo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:me(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function mo(e,t){return Be(e,t+1,new Set)}var Ii=C(W(),1);var ho=C(I(),1);function fo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Fr.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var be=C(I(),1);function go(e,t,n){let r=dt(e);return r?.type==="scatter"&&t?.size!==void 0&&!mt(n)?dt("bubble"):r}function zi(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 Bi(e,t,n,r=!1){let o=go(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&Vt.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=ue(i.label,"label"),d=De(i.value,"value"),h=o.type==="waffle",f=t.map((b,R)=>({r:b,label:u(b,R),value:h?d(b,R):ro(d(b,R))})),{kept:p,other:$}=h?{kept:f,other:null}:no(f,a.other,(b,R)=>({r:{},label:to(K(n),b),value:R})),x=he(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),h?"first":"max"),v=$?[...p,$]:p,w=we(b=>h?se(b,v.length,x):oo(b,v.length,x,a.colorMode)),A=h&&a.shape==="arc";return v.map((b,R)=>({label:b.label,color:w[R],...A&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=eo(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Qr[K(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:ln[f],shape:"line"}))]}if(o.type==="network"){let u=uo(a.groups);if(u.length<2)return[];let d=we(h=>mo(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ue(i.group,"group"),d=me(t.map((f,p)=>u(f,p)).filter(Boolean));if(d.length<2)return[];let h=we(f=>Be(f,d.length,new Set));return d.map((f,p)=>({label:f,color:h[p],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||mt(a))return[];let u=ue(i.series,"series"),d=me(t.map((p,$)=>u(p,$)));if(d.length<2)return[];let h=Zr(s,t,d,u),f=we(p=>Be(p,d.length,h));return c(d.map((p,$)=>({label:p,color:f[$],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",d=u?i.status:i.group;if(typeof d!="string")return[];let h=Hr(t,d,u),f=we(p=>se(p,h.length,fo(s,h)));return c(h.map((p,$)=>({label:p,color:f[$],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let w=ue(i.series,"series");u=me(t.map((A,b)=>w(A,b)))}let d=Wt(o.type,i,a);if(d.length){let w=he(s,u,u,u.map(()=>0),"none"),A=we(R=>se(R,u.length,w)),b=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((R,_)=>({label:R,color:A[_]}));return[...c(b),...d.map((R,_)=>({label:R,color:qr(_),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?cr(u.length,Array.isArray(a.negative)?a.negative.map(w=>u.indexOf(String(w))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,p=f>=0?new Set([f]):he(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((w,A)=>({label:w,color:p.has(A)?"accent":"neutralStrong",shape:"square"})));let $=a.colorMode,x=w=>se(w,u.length,p);if((o.type==="line"||o.type==="area")&&(x=w=>Jr(w,u.length,p,o.type==="area",$)),o.type==="stream"){let w=Ve(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),A=io(w.values,a.reorder),b=so(s,w.series,w.values);x=R=>lo(R,A,b)}let v=we(x);return c(u.map((w,A)=>({label:w,color:v[A],...o.type==="line"&&{shape:"line"}})))}return[]}function Hi(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&tr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function ji(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function po(e,t){let{spec:n}=e,r=go(n.type,n.encoding,n.options),o=(0,Xe.useMemo)(()=>jr(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=er(n,e.locale),s=ee(a),l=K(s),c=_r(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=or(n),u=(0,Xe.useMemo)(()=>m?zr(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[p,$]=(0,Xe.useState)(null);if(!r)return(0,be.jsx)(Gt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??c.data,v=t[r.type],w={...n.options??{}},A={...zi(r,n.encoding),...w,...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:a},b=n.card?.legend==="toggle"&&rr(r.type,n.encoding??{},w),R=p&&p.base===f?p.hidden:h;b&&(A.hidden=R);let _=N=>$(M=>{let y=M&&M.base===f?M.hidden:h;return{base:f,hidden:y.includes(N)?y.filter(T=>T!==N):[...y,N]}}),E=A.height??220,B=Hi(n,r.type),O=i&&!x.length&&(c.loading||c.error||c.empty)?(0,be.jsx)(Gt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:E,locale:a}):B?(0,be.jsx)(Rr,{chart:v,...ji(r.type,B,A)}):(0,be.jsx)(v,{...A});if(n.card){let N=n.card,M=N.legend==="auto"||N.legend==="toggle"?Bi(n,x,s,b):N.legend,y=M?.length?b?(0,be.jsx)(jt,{items:M,hidden:R,onToggle:_,locale:a}):M:void 0,T=N.download?(0,be.jsx)(Ir,{data:x,columns:ar(n),filename:N.title??r.type,formats:Array.isArray(N.download)?N.download:void 0,locale:a}):void 0;O=(0,be.jsx)(Yn,{number:N.number,title:N.title??Qn(r,l),subtitle:N.subtitle,legend:y,actions:T,source:N.source||void 0,note:N.note||void 0,accent:N.accent,takeaway:N.takeaway,level:N.level,sample:N.sample,replay:N.replay!==!1,className:e.className,locale:a,children:O})}let F=e.theme??n.theme;return F&&(O=(0,be.jsx)(it,{theme:F,children:O})),O}function Gi({cfg:e,components:t}){let n=Ee();return po({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function yo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,bo.hydrateRoot)(r,(0,mn.createElement)(it,{theme:o.theme,cssVars:!0},(0,mn.createElement)(Gi,{cfg:o,components:{[e]:t}})))}yo("funnel",un);})();
28
+ `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?He(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(jn,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,Br.jsx)("div",{children:s},l)):null}}function Hr(e,t,n=!1){let r=ue(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=me(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function jr(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Ce(t.csv)}return null}var Yr=C(W(),1);var Y=C(W(),1);function Gr(e,t){let n=ce(e.theme),[r,o,i]=yt(e.width),a=Ee(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=xt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ie,d=Nr(r,e.animateOnView!==!1&&u),h=ee(e.locale),f=K(h),p=(0,Y.useMemo)(()=>Me(e.format,h,t.format),[e.format,h,t.format]),$=(0,Y.useCallback)(L=>tt(L,{locale:h}),[h]),x=(0,Y.useMemo)(()=>nt(p,e.unit),[p,e.unit]),v=(0,Y.useMemo)(()=>ft(e.data),[e.data]),[w,A]=(0,Y.useState)(null),[b,R]=(0,Y.useState)(null),_=(0,Y.useRef)([]),E=(0,Y.useRef)(e.onHover);E.current=e.onHover;let B=(0,Y.useRef)(e.onClick);B.current=e.onClick;let O=(0,Y.useRef)(null),F=(0,Y.useRef)(null),N=(0,Y.useRef)(null),M=(0,Y.useCallback)((L,V="pointer")=>{if(N.current!==L){N.current=L;let Z=L===null?null:_.current[L]??null;queueMicrotask(()=>E.current?.(Z)),F.current?.(L)}O.current=L===null?null:V,A(L),R(O.current)},[]),y=(0,Y.useCallback)(L=>{O.current!=="keyboard"&&(O.current=L===null?null:"sync",A(L),R(O.current))},[]),T=(0,Y.useCallback)(L=>{let V=_.current[L];V&&B.current?.(V)},[]),P=Xn(e.replayKey),H=e.width!==void 0||(i??0)>0,k={enabled:u,active:d.visible&&H,near:d.near,replayKey:P,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},G=(0,Y.useCallback)((L,V=1)=>w===null||w===L?V:V*.38,[w]);return{p:n,width:s,height:c,measured:H,responsive:e.width===void 0,pending:ie&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:k,fv:x,fmt:p,pct:$,locale:h,lang:f,t:f==="ko"?Tn:Mn,active:w,via:b,setActive:M,click:T,events:_,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:G,sig:v,description:e.description,reduced:m,publish:F,applySync:y}}var X=C(W(),1);function Mi(e){return 1-Math.pow(1-e,3)}function Ti(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ci(e){return e==="easeInOut"?Ti:e==="linear"?t=>t:Mi}function Si(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function Ie(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function kt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function Vr(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function Wr(e,t,n,r){if(!t||!n||t.length!==n.length)return Ie(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Ie(s,n[a]))o.push(l)}return o.length===r?o:Ie(e,r)}var wt=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||!kt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Vr(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=kt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Wr(s.cur,s.parts,a.parts,c),s.vel=Wr(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Vr(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=kt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=kt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Ie(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Ci(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Ie(s.from,c)),s.vel.length!==c&&(s.vel=Ie(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-i*l),d=i*l>=8&&i*l<20,h=0;for(let f=0;f<c;f++){let p=s.from[f]-s.to[f],$=s.vel[f]+i*p;s.cur[f]=s.to[f]+(p+$*l)*u,s.curVel[f]=(s.vel[f]-i*$*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=Si(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ue=new Set,vt=0;function Kr(e){vt=0;let t=Array.from(Ue);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ue.delete(n)}Ue.size&&typeof requestAnimationFrame<"u"&&(vt=requestAnimationFrame(Kr))}function Ur(e){return Ue.add(e),!vt&&typeof requestAnimationFrame<"u"&&(vt=requestAnimationFrame(Kr)),()=>{Ue.delete(e)}}function Ai(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 Xr(e,t){let n=(0,X.useMemo)(()=>Ai(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,X.useRef)(null),d=(0,X.useRef)("init"),h=(0,X.useRef)(null),f=(0,X.useRef)(s),p=(0,X.useRef)(a),$=(0,X.useRef)(!1),x=(0,X.useRef)(0),[,v]=(0,X.useState)(0),w=(0,X.useRef)(null),A=(0,X.useRef)(!0);u.current||(u.current=new wt,u.current.configure(l,c),u.current.snap(n),h.current=n);let b=u.current;if(b.configure(l,c),h.current!==n){let F=d.current,N=!Object.is(f.current,s);b.sameTargets(n)?b.refreshData(n):!r||F==="init"?b.snap(n):F==="idle"?b.hold(n):F==="running"||N?b.update(n,Ze(),m):b.snap(n),h.current=n,f.current=s}let R=(0,X.useRef)(()=>!1);R.current=F=>{if(!A.current)return!1;let N=b.step(F);return!N&&d.current==="running"&&(d.current="done"),v(M=>(M+1)%1e9),N||(w.current=null),N};let _=(0,X.useCallback)(()=>{if(!ie||w.current||!b.animating)return;let F=N=>R.current(N);w.current=Ur(F)},[b]);ge(()=>{let F=!Object.is(p.current,a);if(p.current=a,!r){(d.current!=="done"||b.animating)&&(b.snap(h.current??n),d.current="done",v(N=>N+1));return}d.current==="init"||F&&i?(b.hold(h.current??n),d.current="idle",$.current=!1,v(N=>N+1)):F&&($.current=!0)},[r,a]),ge(()=>{!r||!i||!$.current||($.current=!1,b.hold(h.current??n),d.current="idle",v(F=>F+1))},[i,r]),(0,X.useEffect)(()=>{r&&o&&d.current==="idle"&&(b.start(Ze()),x.current+=1,d.current="running",_(),v(F=>F+1))},[r,o,a,b,_]),(0,X.useEffect)(()=>{b.animating&&_()}),(0,X.useEffect)(()=>(A.current=!0,()=>{A.current=!1,w.current?.(),w.current=null}),[]);let E=Ze(),B=b.elapsed(E),O=r&&d.current==="idle";return{items:b.items(),get:F=>b.get(F),elapsed:O?0:B,fade:(F,N=320)=>O?0:Number.isFinite(B)?Math.max(0,Math.min(1,(B-F)/N)):1,waiting:O,animating:b.animating,generation:x.current}}var on=C(I(),1);function Jr(e,t,n,r,o){if(r)return o==="categorical"?se(e,t,n):Pn(e,t,n);if(o==="categorical")return se(e,t,n);let i=U(e,"strong"),a=U(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Ni=C(W(),1);var an=C(I(),1);var qr=e=>e?"neutralStrong":"accent";var sn=C(I(),1);function Zr(e,t,n,r){if(typeof e!="function")return he(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var Ri=C(W(),1);var cn=C(I(),1),Fi={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}, ${ke(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Qr={en:Fi,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},ln=["ink","muted","dim"];function eo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,ln.length)}var $t=C(W(),1);var re=C(I(),1),_i={kind:"Funnel chart",header:"vs. previous",vsPrev:"vs. previous step",vsFirst:"vs. first step",count:"Count",drop:"Drop-off",rate:(e,t)=>`${t} of ${e?"first":"previous"} step`,steps:e=>ke(e,"step"),paren:e=>` (${e})`},Pi={en:_i,ko:{kind:"퍼널 차트",header:"전 단계 대비",vsPrev:"전 단계 대비",vsFirst:"첫 단계 대비",count:"인원",drop:"이탈",rate:(e,t)=>`${e?"첫 단계":"전 단계"} 대비 ${t}`,steps:e=>`${e}단계`,paren:e=>`(${e})`}};function un(e){let t=Gr(e,{height:k=>Math.max(180,Math.min(260,k*.56)),duration:800,stagger:110}),{p:n,width:r,height:o}=t,i=e.showRates!==!1,a=e.rateBase??"previous",{rows:s,rates:l,hi:c}=(0,$t.useMemo)(()=>{let k=ue(e.label,"label"),G=De(e.value,"value"),L=e.data.map((z,J)=>({d:z,i:J,label:k(z,J),value:Math.max(0,G(z,J)||0)})),V=L.map((z,J)=>J===0?null:a==="first"?L[0].value?z.value/L[0].value*100:0:L[J-1].value?z.value/L[J-1].value*100:0),Z;if(e.highlight!==void 0)Z=he(e.highlight,L.map(z=>z.d),L.map(z=>z.label),L.map(z=>z.value));else{let z=-1,J=1/0;V.forEach((ye,Ye)=>{ye!==null&&ye<J&&(J=ye,z=Ye)}),Z=new Set(z>=0?[z]:[])}return{rows:L,rates:V,hi:Z}},[e.data,e.label,e.value,e.highlight,a]),m=Math.min(120,Math.max(54,...s.map(k=>Math.max(de(k.label,11.5,700),de(t.fv(k.value),10.5)))))+8,u=Pi[t.lang],d=e.rateLabel??u.header,h=i?Math.max(44,de(d,10.5)*.6):0,f=i?18:4,p=m+6,$=Math.max(40,r-p-h-10),x=p+$/2,v=Math.max(1,s.length),w=(o-f-4)/v,A=Math.max(8,Math.min(34,w*.52)),b=Math.max(0,...s.map(k=>k.value))||1,R=$,_=(0,$t.useMemo)(()=>s.map((k,G)=>({i:G,label:k.label,value:k.value,rate:l[G],w:Math.max(10,k.value/b*R),hi:c.has(G),datum:k.d})),[s,l,c,b,R]),E=t.motion.stagger??110,B=(0,$t.useMemo)(()=>_.map((k,G)=>({key:`f:${k.label}`,to:[k.w,1],from:[k.w*.15,0],enter:[0,0],delay:G*E,data:k})),[_,E]),O=Xr(B,t.motion),F=new Map(O.items.filter(k=>!k.exiting).map(k=>[k.data.i,k])),N=k=>f+w*k+w/2,M=U(n,"neutral"),y=U(n,"accent"),T=_.map(k=>({datum:k.datum,index:k.i,key:k.label,label:k.label,value:k.value,formatted:`${t.fv(k.value)}${k.rate!==null?` · ${u.rate(a==="first",t.pct(k.rate))}`:""}`})),P=null;if(t.active!==null&&_[t.active]){let k=_[t.active];P={x,y:N(k.i)-A/2,title:k.label,rows:[{label:u.count,value:t.fv(k.value),color:k.hi?y.fill:M.fill},...k.rate!==null?[{label:a==="first"?u.vsFirst:u.vsPrev,value:t.pct(k.rate)}]:[],...k.i>0?[{label:u.drop,value:t.fv(_[k.i-1].value-k.value)}]:[]]}}let H=e.description??`${u.kind}. ${u.steps(_.length)}: ${_.map(k=>`${k.label} ${t.fv(k.value)}${k.rate!==null?u.paren(t.pct(k.rate)):""}`).join(", ")}.`;return(0,re.jsxs)(Jn,{c:t,kind:u.kind,ariaLabel:e.ariaLabel,description:H,events:T,tip:P,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[i?(0,re.jsx)(je,{x:r-2,y:8,anchor:"end",size:10.5,fill:n.paint("muted"),opacity:O.fade(0,300),children:d}):null,_.map((k,G)=>{let L=F.get(G);if(!L)return null;let V=L.v[0],Z=L.v[1],z=N(G),J=_[G+1]?F.get(G+1):void 0,ye=J?J.v[0]:0,Ye=J?J.v[1]:0,Se=z+A/2,Ae=z+w-A/2,dn=J&&Ye>.01?`M${D(x-V/2)},${D(Se-1)}C${D(x-V/2)},${D((Se+Ae)/2)} ${D(x-ye/2)},${D((Se+Ae)/2)} ${D(x-ye/2)},${D(Ae+1)}L${D(x+ye/2)},${D(Ae+1)}C${D(x+ye/2)},${D((Se+Ae)/2)} ${D(x+V/2)},${D((Se+Ae)/2)} ${D(x+V/2)},${D(Se-1)}Z`:"",xo=k.hi?y:M;return(0,re.jsxs)("g",{opacity:t.dim(G),className:"ztd-mark",onPointerEnter:ko=>t.setActive(G,ko.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(G),style:{cursor:e.onClick?"pointer":void 0},children:[(0,re.jsx)("rect",{x:p-m,y:z-w/2,width:r-p+m,height:w,fill:"transparent"}),dn?(0,re.jsx)("path",{d:dn,fill:n.paint("neutral"),opacity:.55*Math.min(Z,Ye)}):null,(0,re.jsx)("path",{d:Xt(x-V/2,z-A/2,V,A,Math.min(7,A/3)),fill:xo.fill,opacity:Z}),t.active===G&&t.via==="keyboard"?(0,re.jsx)("path",{d:Xt(x-V/2-3,z-A/2-3,V+6,A+6,8),fill:"none",stroke:n.paint("ink"),strokeWidth:2}):null,(0,re.jsxs)("g",{opacity:O.fade(G*(t.motion.stagger??110)+120,260),children:[(0,re.jsx)(je,{x:m,y:z-6,anchor:"end",size:11.5,weight:k.hi?800:600,fill:n.paint("ink"),children:Yt(k.label,m-4,11.5,700)}),(0,re.jsx)(je,{x:m,y:z+8,anchor:"end",size:10.5,fill:n.paint("muted"),children:t.fv(k.value)}),i&&k.rate!==null?(0,re.jsx)(je,{x:r-2,y:f+w*G,anchor:"end",size:12,weight:k.hi?800:500,fill:n.paint(k.hi?"ink":"muted"),children:t.pct(k.rate)}):null]})]},G)})]})}var Di=C(W(),1);var ao=C(I(),1),Li={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ke(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ei={en:Li,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},to=(e,t)=>Ei[e].other(t);function no(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,mr(o.map(i=>i.value)))}}var ro=e=>Number.isFinite(e)&&e>0?e:0;function oo(e,t,n,r){return r==="emphasis"?_n(e,t,n):se(e,t,n)}var Oi=C(W(),1);var co=C(I(),1);function io(e,t){return t===!1?e.map((n,r)=>r):ur(e)}function so(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return he(e,t,t,r,"max")}function lo(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=U(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?U(e,"neutral"):et(e,1-a/Math.max(1,o.length-1))),r}function uo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:me(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function mo(e,t){return Be(e,t+1,new Set)}var Ii=C(W(),1);var ho=C(I(),1);var zi=26;var wc=zi*.62;function fo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Fr.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var be=C(I(),1);function go(e,t,n){let r=dt(e);return r?.type==="scatter"&&t?.size!==void 0&&!mt(n)?dt("bubble"):r}function Bi(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 Hi(e,t,n,r=!1){let o=go(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&Vt.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=ue(i.label,"label"),d=De(i.value,"value"),h=o.type==="waffle",f=t.map((b,R)=>({r:b,label:u(b,R),value:h?d(b,R):ro(d(b,R))})),{kept:p,other:$}=h?{kept:f,other:null}:no(f,a.other,(b,R)=>({r:{},label:to(K(n),b),value:R})),x=he(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),h?"first":"max"),v=$?[...p,$]:p,w=we(b=>h?se(b,v.length,x):oo(b,v.length,x,a.colorMode)),A=h&&a.shape==="arc";return v.map((b,R)=>({label:b.label,color:w[R],...A&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=eo(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Qr[K(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:ln[f],shape:"line"}))]}if(o.type==="network"){let u=uo(a.groups);if(u.length<2)return[];let d=we(h=>mo(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ue(i.group,"group"),d=me(t.map((f,p)=>u(f,p)).filter(Boolean));if(d.length<2)return[];let h=we(f=>Be(f,d.length,new Set));return d.map((f,p)=>({label:f,color:h[p],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||mt(a))return[];let u=ue(i.series,"series"),d=me(t.map((p,$)=>u(p,$)));if(d.length<2)return[];let h=Zr(s,t,d,u),f=we(p=>Be(p,d.length,h));return c(d.map((p,$)=>({label:p,color:f[$],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",d=u?i.status:i.group;if(typeof d!="string")return[];let h=Hr(t,d,u),f=we(p=>se(p,h.length,fo(s,h)));return c(h.map((p,$)=>({label:p,color:f[$],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let w=ue(i.series,"series");u=me(t.map((A,b)=>w(A,b)))}let d=Wt(o.type,i,a);if(d.length){let w=he(s,u,u,u.map(()=>0),"none"),A=we(R=>se(R,u.length,w)),b=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((R,_)=>({label:R,color:A[_]}));return[...c(b),...d.map((R,_)=>({label:R,color:qr(_),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?cr(u.length,Array.isArray(a.negative)?a.negative.map(w=>u.indexOf(String(w))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,p=f>=0?new Set([f]):he(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((w,A)=>({label:w,color:p.has(A)?"accent":"neutralStrong",shape:"square"})));let $=a.colorMode,x=w=>se(w,u.length,p);if((o.type==="line"||o.type==="area")&&(x=w=>Jr(w,u.length,p,o.type==="area",$)),o.type==="stream"){let w=Ve(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),A=io(w.values,a.reorder),b=so(s,w.series,w.values);x=R=>lo(R,A,b)}let v=we(x);return c(u.map((w,A)=>({label:w,color:v[A],...o.type==="line"&&{shape:"line"}})))}return[]}function ji(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&tr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Gi(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function po(e,t){let{spec:n}=e,r=go(n.type,n.encoding,n.options),o=(0,Xe.useMemo)(()=>jr(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=er(n,e.locale),s=ee(a),l=K(s),c=_r(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=or(n),u=(0,Xe.useMemo)(()=>m?zr(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[p,$]=(0,Xe.useState)(null);if(!r)return(0,be.jsx)(Gt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??c.data,v=t[r.type],w={...n.options??{}},A={...Bi(r,n.encoding),...w,...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:a},b=n.card?.legend==="toggle"&&rr(r.type,n.encoding??{},w),R=p&&p.base===f?p.hidden:h;b&&(A.hidden=R);let _=N=>$(M=>{let y=M&&M.base===f?M.hidden:h;return{base:f,hidden:y.includes(N)?y.filter(T=>T!==N):[...y,N]}}),E=A.height??220,B=ji(n,r.type),O=i&&!x.length&&(c.loading||c.error||c.empty)?(0,be.jsx)(Gt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:E,locale:a}):B?(0,be.jsx)(Rr,{chart:v,...Gi(r.type,B,A)}):(0,be.jsx)(v,{...A});if(n.card){let N=n.card,M=N.legend==="auto"||N.legend==="toggle"?Hi(n,x,s,b):N.legend,y=M?.length?b?(0,be.jsx)(jt,{items:M,hidden:R,onToggle:_,locale:a}):M:void 0,T=N.download?(0,be.jsx)(Ir,{data:x,columns:ar(n),filename:N.title??r.type,formats:Array.isArray(N.download)?N.download:void 0,locale:a}):void 0;O=(0,be.jsx)(Yn,{number:N.number,title:N.title??Qn(r,l),subtitle:N.subtitle,legend:y,actions:T,source:N.source||void 0,note:N.note||void 0,accent:N.accent,takeaway:N.takeaway,level:N.level,sample:N.sample,replay:N.replay!==!1,className:e.className,locale:a,children:O})}let F=e.theme??n.theme;return F&&(O=(0,be.jsx)(it,{theme:F,children:O})),O}function Vi({cfg:e,components:t}){let n=Ee();return po({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function yo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,bo.hydrateRoot)(r,(0,mn.createElement)(it,{theme:o.theme,cssVars:!0},(0,mn.createElement)(Vi,{cfg:o,components:{[e]:t}})))}yo("funnel",un);})();
@@ -1,4 +1,4 @@
1
- (()=>{var go=Object.create;var cn=Object.defineProperty;var po=Object.getOwnPropertyDescriptor;var bo=Object.getOwnPropertyNames;var yo=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty;var wt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ko=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of bo(t))!xo.call(e,o)&&o!==n&&cn(e,o,{get:()=>t[o],enumerable:!(r=po(t,o))||r.enumerable});return e};var S=(e,t,n)=>(n=e!=null?go(yo(e)):{},ko(t||!e||!e.__esModule?cn(n,"default",{value:e,enumerable:!0}):n,e));var H=wt((zi,un)=>{un.exports=globalThis.__ztdReact.react});var dn=wt((Bi,mn)=>{mn.exports=globalThis.__ztdReact["react-dom/client"]});var D=wt((es,Hn)=>{Hn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var ln=S(H(),1),fo=S(dn(),1);var Ke=S(H(),1);var it=S(H(),1);var fn=S(H(),1),Te=(0,fn.createContext)(void 0);var bn=S(H(),1);var wo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],hn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',gn='"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",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},vt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},$t={dark:pe,light:vt};function Xe(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Mt(e){let t={};for(let n of wo){let r=e[n];typeof r=="string"&&(t[Xe(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 Tt(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var vo=`
1
+ (()=>{var go=Object.create;var cn=Object.defineProperty;var po=Object.getOwnPropertyDescriptor;var bo=Object.getOwnPropertyNames;var yo=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty;var wt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ko=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of bo(t))!xo.call(e,o)&&o!==n&&cn(e,o,{get:()=>t[o],enumerable:!(r=po(t,o))||r.enumerable});return e};var S=(e,t,n)=>(n=e!=null?go(yo(e)):{},ko(t||!e||!e.__esModule?cn(n,"default",{value:e,enumerable:!0}):n,e));var H=wt((Bi,un)=>{un.exports=globalThis.__ztdReact.react});var dn=wt((Hi,mn)=>{mn.exports=globalThis.__ztdReact["react-dom/client"]});var D=wt((ts,Hn)=>{Hn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var ln=S(H(),1),fo=S(dn(),1);var Ke=S(H(),1);var it=S(H(),1);var fn=S(H(),1),Te=(0,fn.createContext)(void 0);var bn=S(H(),1);var wo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],hn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',gn='"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",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},vt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},$t={dark:pe,light:vt};function Xe(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Mt(e){let t={};for(let n of wo){let r=e[n];typeof r=="string"&&(t[Xe(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 Tt(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var vo=`
2
2
  .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
3
  .ztd-root:focus{outline:none}
4
4
  .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${pe.accent});outline-offset:3px;border-radius:6px}
@@ -25,4 +25,4 @@
25
25
  `&&f++,s.push(l),a.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?rr(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((b,w)=>[String(w),u(b)])));let d=[],h=new Set;return m[0].forEach((f,b)=>{let w=f.trim()||`col${b+1}`,y=w;for(let k=2;h.has(y);k++)y=`${w}_${k}`;h.add(y),d.push(y)}),m.slice(1).map(f=>Object.fromEntries(d.map((b,w)=>[b,u(f[w]??"")])))}function Gt(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?rr(a[l]):a[l]??null])))}function za(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function or(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 ye(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ye(JSON.parse(t))}catch{}return $e(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Gt(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)?ye(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Gt(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)?ye(t.rows):Array.isArray(t.values)?Gt(t.values):Array.isArray(t.items)?ye(t.items):Array.isArray(t.results)?ye(t.results):za(t)}return[]}function mt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function Wt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let h=a(d,c),f=h-a(d,c-1),b=0;for(let w=0;w<d;w++)b+=a(w,c)-a(w,c-1);m+=h,u+=(f/2+b)*h}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][l],b=Number.isFinite(f)?f:0;b>=0?(o[h][l]=u,u+=b,i[h][l]=u):(o[h][l]=d,d+=b,i[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=a(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,i[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,i[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,i[u][d]-=m}return{y0:o,y1:i}}function ar(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 ir(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Pe=Math.PI*2;function sr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function _e(e){return Math.round(e*100)/100}function ee(e,t,n,r){return[e+n*Math.sin(r),t-n*Math.cos(r)]}function Vt(e,t,n,r,o){let i=o-r;if(!(Math.abs(i)>1e-4))return"";let a=Math.abs(i)>=Pe-1e-4?r+(i>0?Pe-1e-4:-(Pe-1e-4)):o,[s,l]=ee(e,t,n,r),[c,m]=ee(e,t,n,a),u=Math.abs(a-r)>Math.PI?1:0;return`M${_e(s)},${_e(l)}A${_e(n)},${_e(n)} 0 ${u} ${i>0?1:0} ${_e(c)},${_e(m)}`}function lr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ur(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function cr(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 dt=new Map;function Me(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=dt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);ur(c)?a+=cr(c):s+=cr(c)}i=a+s*(n>=600?1.07:1),dt.size>5e3&&dt.clear(),dt.set(o,i)}return i*t}function Kt(e,t,n,r=400){if(e=e.trim(),Me(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;Me(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(ur(s.charCodeAt(0))?2:3)?"":s+o}var dr=S(D(),1),Ba=e=>Array.isArray(e)&&e.length===2;function mr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ba(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var hr=S(D(),1),Ut=10.5;function Ha(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>Ne(a,{locale:n,maximumFractionDigits:i}))}function fr(e,t,n){let r=18;for(let o of Ha(e,t,n))r=Math.max(r,Me(o,Ut));return Math.ceil(r+8)}function Xt(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function De(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=Xt(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let h=Xt(c[1]-c[0],n);if(h===l)break;l=h}return c}function gr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Xt(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Yt(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>gr(n,r,l),s}function Jt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[i,a]=De(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function ja(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of c){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:gr(e,t,3)}function pr(e,t){let n=Yt([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=()=>ja(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]}var Ga=864e5;function br(e,t,n,r=J){let o=t-e;if(!(o>0))return[{t:e,label:Be(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Ga,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,h=!1)=>{let f=new Date(m),b=-1,w=0;for(;f.getTime()<=t&&w++<500;){if(f.getTime()>=e){let y=f.getFullYear(),k=h&&!l&&y!==b;a.push({t:f.getTime(),label:Be(f,{locale:r,...d,...k?{year:"numeric"}:{}})}),b=y}u(f)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),c(h,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return a}function yr(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var Wa=(e,t,n)=>e==="date"?nt(t,n)?.getTime()??NaN:me(t);function Va(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&zn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function je(e,t,n,r,o={}){let i=we(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:we(n,"y"),c=!a&&r!==void 0?we(r,"series"):null,m=e.map((M,x)=>i(M,x)),u=o.xType??Va(m),d=o.locale??J,h,f,b;if(u==="band"){let M=m.map(T=>String(T??""));h=le(M);let x=new Map(h.map((T,F)=>[T,F]));f=h.map((T,F)=>F),b=Int32Array.from(M,T=>x.get(T)??-1)}else{let M=u==="date"?o.dayFirst??Bn(m):void 0,x=m.map(I=>Wa(u,I,M)),T=Array.from(new Set(x.filter(I=>Number.isFinite(I)))).sort((I,B)=>I-B),F=new Map(T.map((I,B)=>[I,B]));f=T,h=T.map(String),b=Int32Array.from(x,I=>F.get(I)??-1)}let w=o.dateFormat,y=M=>typeof M=="string"?tt(M.trim())?.[3]:void 0,k=u==="date"&&m.length<5e3?y(m[0]):void 0,v=(k===2||k===3)&&m.every(M=>y(M)===k),$=v&&k===3;if(u==="date"&&!w){let M=f.length>1?f[f.length-1]-f[0]:0;w=v&&k===2||M>864e5*120?{month:"short"}:M<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},M>864e5*800&&(w={year:"numeric",month:"short"})}let g;if(u==="band")g=h;else if($&&!o.dateFormat){let M=G(d)==="ko";g=f.map(x=>{let T=new Date(x),F=Math.floor(T.getMonth()/3)+1;return M?`${T.getFullYear()}년 ${F}분기`:`Q${F} ${T.getFullYear()}`})}else{let M=f.every(Lt),x=u==="date"?new Intl.DateTimeFormat(d,w):new Intl.NumberFormat(d,M?{useGrouping:!1}:{maximumFractionDigits:6});g=f.length>1e3?yr(f.length,T=>x.format(f[T])):f.map(T=>x.format(T))}let R=s?[...s]:c?le(e.map((M,x)=>String(c(M,x)??""))):[""],_=new Map(R.map((M,x)=>[M,x])),P=R.map(()=>new Array(h.length).fill(NaN)),L=R.map(()=>new Array(h.length).fill(null)),E=o.aggregate??"sum",N=E==="mean"?R.map(()=>new Uint32Array(h.length)):null,C=(M,x,T,F)=>{let I=P[M][x];E==="last"?P[M][x]=T:E==="count"?P[M][x]=(Number.isFinite(I)?I:0)+1:E==="mean"?Number.isFinite(T)&&(P[M][x]=(Number.isFinite(I)?I:0)+T,N[M][x]++):P[M][x]=Number.isFinite(I)?I+(Number.isFinite(T)?T:0):T,L[M][x]=F};for(let M=0;M<e.length;M++){let x=b[M];if(x<0)continue;let T=e[M];if(s)for(let F=0;F<s.length;F++)C(F,x,me(T[s[F]]),T);else{let F=c?_.get(String(c(T,M)??""))??0:0;C(F,x,me(l(T,M)),T)}}if(N)for(let M=0;M<P.length;M++)for(let x=0;x<h.length;x++)N[M][x]>1&&(P[M][x]/=N[M][x]);return{type:u,keys:h,xnum:f,labels:g,series:R,values:P,rows:L}}var Ka=140,We=12,xr=14,qt=20,kr=12.5;function Ua(e,t,n=Zn){let r=de(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function Xa(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+We)/(Ka+We))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ya(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*We)/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 Ge=e=>e.filter(Number.isFinite);function ft(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=ve(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return Ge(n)}function wr(e,t,n,r,o,i){return je(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Ja(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let g=t.flat(),R=r.refLines??{},[_,P]=He([...ft(g,r.x??"x"),...Ge([Number(R.x)])]),[L,E]=He([...ft(g,r.y??"y"),...Ge([Number(R.y)])].filter(C=>!s||C>0)),N=r.zero??!1;return{y:c??(s?Jt(L,E,a):De(L,E,a,{zero:N,pad:.08})),x:r.xDomain??De(_,P,Math.max(2,Math.round(o/110)),{zero:N,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(g=>g.keys.join("")===d),f=n.length>0&&n.every(g=>g.type!=="band"&&g.type===n[0].type),b=r.xDomain??(!m&&f?He(n.flatMap(g=>Ge(g.xnum))):void 0),w=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(w==="percent")return{x:b,sameKeys:h};if(c)return{y:c,x:b,sameKeys:h};let y=[];t.forEach((g,R)=>{let _=n[R];if(w==="stacked"||w==="auto"&&_.series.length>1){let L=Wt(_.values,"zero");L.y0.forEach(E=>y.push(...E)),L.y1.forEach(E=>y.push(...E))}else _.values.forEach(L=>y.push(...L));m&&!u&&r.line!==void 0&&wr(e,g,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(L=>y.push(...L)),m||y.push(...ft(g,r.lower),...ft(g,r.upper))}),m&&y.push(0),u||y.push(...mr(r.annotations));for(let g of r.referenceLines??[])y.push(g.y);r.signColors&&y.push(Number(r.baseline??0));let[k,v]=He(Ge(y).filter(g=>!s||g>0));return{y:s?Jt(k,v,a):m?De(k,v,u?Math.max(2,Math.round(o/120)):a):De(k,v,a,{zero:r.zero??e==="area"}),x:b,sameKeys:h}}function qa(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=je(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?pr:Yt)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=fr(c,Ln(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(g=>g.series),d=r.endLabels??n.some(g=>g.series.length>1),h=m+6,f=i-(d?Math.min(i*.28,Math.max(...u.map(g=>Me(g,11,700)),20)+14):10),b=l.keys.length,[w,y]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,k=l.type==="number"?b>12:b>br(w,y,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!b||k)return;let v=g=>h+(l.xnum[g]-w)/(y-w)*(f-h),$=g=>Me(l.labels[g],Ut);for(let g=1;;g++){let R=Array.from({length:Math.ceil(b/g)},(_,P)=>P*g);if(g>=b||R.every((_,P)=>!P||v(_)-v(R[P-1])>=($(_)+$(R[P-1]))/2+8))return R.map(_=>({value:l.xnum[_],label:l.labels[_]}))}}function Za(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 Qa(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${Za(`${e}|${t}|${o}|${mt(r)}`)}`}function ei(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 ti={en:{intro:(e,t)=>`${Ce(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},Zt=18;function vr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Ua(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Xa(s,a,e.columns),{pw:c,ph:m}=Ya(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(N=>wr(t,N,n,n.y,n.series,n.aggregate)),h=u?Ja(t,o,d,n,c,m):{sameKeys:!1},f=u?qa(t,o,d,n,h,c,m,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",w=u&&(!b||h.sameKeys),y=u&&(b||h.x!==void 0||h.sameKeys),k=new Set(ei(e.highlight,r)?[e.highlight].flat():[]),v=k.size>0,$=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,g=e.syncId??Qa(t,e.by,n,e.data),R=et(ke(n.format,e.locale),n.unit),_=ti[e.lang],P=[],L=r.map(N=>N===""?_.blank:N);return{panels:r.map((N,C)=>{let M=o[C],x=L[C],T=C%l,F;if(t!=="scatter"){let B=d[C],q=Y=>B.values.reduce((fe,Ue)=>fe+(Number.isFinite(Ue[Y])?Ue[Y]:0),0),O=B.keys.map((Y,fe)=>fe).filter(Y=>B.values.some(fe=>Number.isFinite(fe[Y]))),U=O[O.length-1];P.push({first:O.length?q(O[0]):NaN,last:O.length?q(U):NaN,total:O.reduce((Y,fe)=>Y+q(fe),0)}),t!=="bar"&&B.series.length===1&&U!==void 0&&(F=R(B.values[0][U]))}else P.push({first:NaN,last:NaN,total:M.length});let I={data:M,width:c,height:m,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:g,highlight:v?k.has(N)?$?()=>!0:void 0:"none":e.highlight,showYAxis:!w||T===0,showXAxis:!y||C+l>=a};return h.y&&(I.yDomain=h.y),h.x&&(I.xDomain=h.x),f&&(I.xTicks=f),{value:N,label:x,props:I,last:F,isPicked:k.has(N)}}),cols:l,pw:c,ph:m,isPanelPick:v,description:ni(t,e.by,L,P,i,R,_)}}function ni(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>lr(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var te=S(H(),1);function ri(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function oi(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 ht={threshold:.25,enoughPx:96,rootMargin:"0px"};function Tr(e,t=!0){let[n,r]=(0,te.useState)({visible:!t,near:!t});return(0,te.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(a=>{let s=oi(a[a.length-1],ht.threshold,ht.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ri(ht.threshold),rootMargin:ht.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function $r(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function gt(e){let[t,n]=(0,te.useState)(null),[r,o]=(0,te.useState)(e??null),i=(0,te.useCallback)(a=>{n(a),a&&e===void 0&&o($r(a))},[e]);return ue(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a($r(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var ai=()=>()=>{};function Le(){return(0,te.useSyncExternalStore)(ai,()=>!0,()=>!1)}var Mr="(prefers-reduced-motion: reduce)";function pt(e="auto"){let[t,n]=(0,te.useState)(()=>oe&&typeof window.matchMedia=="function"?window.matchMedia(Mr).matches:!1);return(0,te.useEffect)(()=>{if(e!=="auto"||!oe||typeof window.matchMedia!="function")return;let r=window.matchMedia(Mr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var ce=S(D(),1),ii=60,si=420;function Cr(e){let t=se(),n=e.chartProps??{},[,r,o]=gt(e.width),i=e.width??(o||480),a=Z(e.locale??n.locale),s=G(a),l=(0,Ee.useContext)(Te),c=e.title??l,m=e.chart.facetPlan,u=(0,Ee.useMemo)(()=>{let y=vr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return m?m(y,n,a):y},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(y,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,i,e.height,c,a,s,m]),d=`${(0,Ee.useId)().replace(/:/g,"")}fd`,h=pt(n.reducedMotion??"auto"),f=Le(),b=xn({motion:{enabled:n.animate!==!1&&!h&&oe},hydrated:f},{waiting:!1,generation:0}),w=e.chart;return(0,ce.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,ce.jsx)("p",{id:d,style:lt,children:e.description??u.description}),(0,ce.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:We,rowGap:xr,...u.legend?{marginTop:Zt}:null},children:u.panels.map((y,k)=>{let v=t.paint(y.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,ce.jsxs)("div",{"data-facet":y.value,style:{minWidth:0,...yn(b,!1,"fade",k*ii,si)},children:[(0,ce.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:qt,fontSize:kr,fontWeight:700,lineHeight:`${qt}px`,color:v},children:[(0,ce.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.label}),y.last!==void 0?(0,ce.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:y.last}):null]}),(0,ce.jsx)(w,{...n,...y.props})]},y.value)})}),u.legend?(0,ce.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Zt},children:u.legend}):null]})}var Sr=["max","min","first","last","none"];function he(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&i.add(u)});return i}var re=S(H(),1);async function li(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(G(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return $e(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return $e(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):$e(i)}async function ci(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await li(i,t.parse,o,t.locale)}return t.select&&(r=or(r,t.select)),t.transform?t.transform(r):ye(r)}function Ar(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,re.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,re.useState)(0),c=Z(t.locale),m=(0,re.useRef)(t);m.current={...t,locale:c};let u=(0,re.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(y=>typeof y=="object"?JSON.stringify(y):String(y))),b=(0,re.useRef)(!1);(0,re.useEffect)(()=>{let y=u.current;if(!y||!r){a($=>$.status==="loading"?{...$,status:"idle"}:$);return}let k=new AbortController,v=!0;return b.current=!0,a($=>({...$,data:o?$.data:[],status:"loading",error:null})),ci(y,{...m.current,signal:k.signal}).then($=>{v&&a({data:$,status:"success",error:null,updatedAt:Date.now()})}).catch($=>{!v||k.signal.aborted||a(g=>({...g,status:"error",error:$ instanceof Error?$:new Error(String($))}))}).finally(()=>{v&&(b.current=!1)}),()=>{v=!1,b.current=!1,k.abort()}},[d,r,s,f,o]),(0,re.useEffect)(()=>{if(!n||!r)return;let y=setInterval(()=>{b.current||l(k=>k+1)},n);return()=>clearInterval(y)},[n,r]);let w=(0,re.useCallback)(()=>l(y=>y+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:w}}var en=S(D(),1),ui=["csv","svg","png"],mi=/^[=+\-@\t\r\n=+-@]/,di=/var\(|color-mix\(/;function Nr(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?En(e.getTime()):String(e);return`"${(mi.test(t)&&!Number.isFinite(me(t))?`'${t}`:t).replace(/"/g,'""')}"`}function fi(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function hi(e,t){return`\uFEFF${[t.map(Nr),...e.map(r=>t.map(o=>Nr(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
27
  `}function gi(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Qt(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Rr=2,xe=16;function Fr(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function _r(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Pr(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+xe*2,a+xe*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,b)=>{let w;for(let y of Array.from(f.attributes)){if(!di.test(y.value))continue;let k=(w??(w=getComputedStyle(f))).getPropertyValue(y.name);k&&m[b].setAttribute(y.name,Fr(k,u))}}),c.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-xe} ${-xe} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(b));let d=Fr(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(_r("rect",{x:-xe,y:-xe,width:s,height:l,fill:d}),f),h&&c.insertBefore(_r("image",{href:h.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:d,canvas:h}}function pi(e,t){let n=Pr(e,Rr,!1);if(!n)return;let r=Rr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,xe*r,xe*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Qt(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Dr(e){let t=se(e.theme),n=G(Z(e.locale))==="ko",r=gi(e.filename),o=(i,a)=>{if(i==="csv")return Qt(new Blob([hi(e.data,e.columns?.length?e.columns:fi(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return pi(a,r);let s=Pr(a,1,!0);s&&Qt(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,en.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:ui.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,en.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:a},i)})})}var Er=S(D(),1);function Lr(e,t=J){let n=ke(void 0,t),r=e.split(`
28
- `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Be(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(In,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,Er.jsx)("div",{children:s},l)):null}}function Or(e,t,n=!1){let r=de(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=le(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Ir(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 $e(t.csv)}return null}var Vr=S(H(),1);var K=S(H(),1);function zr(e,t){let n=se(e.theme),[r,o,i]=gt(e.width),a=Le(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=pt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&oe,d=Tr(r,e.animateOnView!==!1&&u),h=Z(e.locale),f=G(h),b=(0,K.useMemo)(()=>ke(e.format,h,t.format),[e.format,h,t.format]),w=(0,K.useCallback)(O=>Qe(O,{locale:h}),[h]),y=(0,K.useMemo)(()=>et(b,e.unit),[b,e.unit]),k=(0,K.useMemo)(()=>mt(e.data),[e.data]),[v,$]=(0,K.useState)(null),[g,R]=(0,K.useState)(null),_=(0,K.useRef)([]),P=(0,K.useRef)(e.onHover);P.current=e.onHover;let L=(0,K.useRef)(e.onClick);L.current=e.onClick;let E=(0,K.useRef)(null),N=(0,K.useRef)(null),C=(0,K.useRef)(null),M=(0,K.useCallback)((O,U="pointer")=>{if(C.current!==O){C.current=O;let Y=O===null?null:_.current[O]??null;queueMicrotask(()=>P.current?.(Y)),N.current?.(O)}E.current=O===null?null:U,$(O),R(E.current)},[]),x=(0,K.useCallback)(O=>{E.current!=="keyboard"&&(E.current=O===null?null:"sync",$(O),R(E.current))},[]),T=(0,K.useCallback)(O=>{let U=_.current[O];U&&L.current?.(U)},[]),F=Wn(e.replayKey),I=e.width!==void 0||(i??0)>0,B={enabled:u,active:d.visible&&I,near:d.near,replayKey:F,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},q=(0,K.useCallback)((O,U=1)=>v===null||v===O?U:U*.38,[v]);return{p:n,width:s,height:c,measured:I,responsive:e.width===void 0,pending:oe&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:B,fv:y,fmt:b,pct:w,locale:h,lang:f,t:f==="ko"?wn:kn,active:v,via:g,setActive:M,click:T,events:_,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:q,sig:k,description:e.description,reduced:m,publish:N,applySync:x}}var W=S(H(),1);function bi(e){return 1-Math.pow(1-e,3)}function yi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function xi(e){return e==="easeInOut"?yi:e==="linear"?t=>t:bi}function ki(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function Oe(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function bt(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 Br(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function Hr(e,t,n,r){if(!t||!n||t.length!==n.length)return Oe(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Oe(s,n[a]))o.push(l)}return o.length===r?o:Oe(e,r)}var yt=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||!bt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Br(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=bt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Hr(s.cur,s.parts,a.parts,c),s.vel=Hr(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Br(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=bt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=bt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Oe(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=xi(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Oe(s.from,c)),s.vel.length!==c&&(s.vel=Oe(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-i*l),d=i*l>=8&&i*l<20,h=0;for(let f=0;f<c;f++){let b=s.from[f]-s.to[f],w=s.vel[f]+i*b;s.cur[f]=s.to[f]+(b+w*l)*u,s.curVel[f]=(s.vel[f]-i*w*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=ki(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ve=new Set,xt=0;function jr(e){xt=0;let t=Array.from(Ve);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ve.delete(n)}Ve.size&&typeof requestAnimationFrame<"u"&&(xt=requestAnimationFrame(jr))}function Gr(e){return Ve.add(e),!xt&&typeof requestAnimationFrame<"u"&&(xt=requestAnimationFrame(jr)),()=>{Ve.delete(e)}}function wi(e){let t=new Map,n=!1;for(let r of e){let o=(t.get(r.key)??0)+1;t.set(r.key,o),o>1&&(n=!0)}return n?(t.clear(),e.map(r=>{let o=(t.get(r.key)??0)+1;return t.set(r.key,o),o>1?{...r,key:`${r.key}#${o}`}:r})):e}function Wr(e,t){let n=(0,W.useMemo)(()=>wi(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,W.useRef)(null),d=(0,W.useRef)("init"),h=(0,W.useRef)(null),f=(0,W.useRef)(s),b=(0,W.useRef)(a),w=(0,W.useRef)(!1),y=(0,W.useRef)(0),[,k]=(0,W.useState)(0),v=(0,W.useRef)(null),$=(0,W.useRef)(!0);u.current||(u.current=new yt,u.current.configure(l,c),u.current.snap(n),h.current=n);let g=u.current;if(g.configure(l,c),h.current!==n){let N=d.current,C=!Object.is(f.current,s);g.sameTargets(n)?g.refreshData(n):!r||N==="init"?g.snap(n):N==="idle"?g.hold(n):N==="running"||C?g.update(n,Je(),m):g.snap(n),h.current=n,f.current=s}let R=(0,W.useRef)(()=>!1);R.current=N=>{if(!$.current)return!1;let C=g.step(N);return!C&&d.current==="running"&&(d.current="done"),k(M=>(M+1)%1e9),C||(v.current=null),C};let _=(0,W.useCallback)(()=>{if(!oe||v.current||!g.animating)return;let N=C=>R.current(C);v.current=Gr(N)},[g]);ue(()=>{let N=!Object.is(b.current,a);if(b.current=a,!r){(d.current!=="done"||g.animating)&&(g.snap(h.current??n),d.current="done",k(C=>C+1));return}d.current==="init"||N&&i?(g.hold(h.current??n),d.current="idle",w.current=!1,k(C=>C+1)):N&&(w.current=!0)},[r,a]),ue(()=>{!r||!i||!w.current||(w.current=!1,g.hold(h.current??n),d.current="idle",k(N=>N+1))},[i,r]),(0,W.useEffect)(()=>{r&&o&&d.current==="idle"&&(g.start(Je()),y.current+=1,d.current="running",_(),k(N=>N+1))},[r,o,a,g,_]),(0,W.useEffect)(()=>{g.animating&&_()}),(0,W.useEffect)(()=>($.current=!0,()=>{$.current=!1,v.current?.(),v.current=null}),[]);let P=Je(),L=g.elapsed(P),E=r&&d.current==="idle";return{items:g.items(),get:N=>g.get(N),elapsed:E?0:L,fade:(N,C=320)=>E?0:Number.isFinite(L)?Math.max(0,Math.min(1,(L-N)/C)):1,waiting:E,animating:g.animating,generation:y.current}}var tn=S(D(),1);function Kr(e,t,n,r,o){if(r)return o==="categorical"?ae(e,t,n):Nn(e,t,n);if(o==="categorical")return ae(e,t,n);let i=V(e,"strong"),a=V(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var vi=S(H(),1);var nn=S(D(),1);var Ur=e=>e?"neutralStrong":"accent";var rn=S(D(),1);function Xr(e,t,n,r){if(typeof e!="function")return he(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var $i=S(H(),1);var an=S(D(),1),Mi={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ce(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Yr={en:Mi,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},on=["ink","muted","dim"];function Jr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,on.length)}var Ti=S(H(),1);var to=S(D(),1),Ci={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Si={en:Ci,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},qr=(e,t)=>Si[e].other(t);function Zr(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,sr(o.map(i=>i.value)))}}var Qr=e=>Number.isFinite(e)&&e>0?e:0;function eo(e,t,n,r){return r==="emphasis"?An(e,t,n):ae(e,t,n)}var kt=S(H(),1);var j=S(D(),1),Ai={radial:"Radial bar chart",gauge:"Gauge",vsTarget:"vs. target",current:"Current",target:"Target",targetWord:"target",achieved:"Achieved",range:"Range",rangeWord:"range",span:(e,t)=>`${e} to ${t}`},Ni={en:Ai,ko:{radial:"방사형 막대",gauge:"게이지",vsTarget:"목표 대비",current:"현재",target:"목표",targetWord:"목표",achieved:"달성률",range:"범위",rangeWord:"범위",span:(e,t)=>`${e}~${t}`}};function Ri(e){let{cx:t,cy:n,r,len:o,start:i,span:a,lit:s,on:l,off:c}=e,m=Math.max(2,Math.round(e.count??Math.max(24,Math.min(64,(r-o/2)*a/8)))),u=(0,kt.useMemo)(()=>{let d=(r-o/2)*a/(m-1),h=Math.max(1.6,Math.min(3.4,d*.42));return Array.from({length:m},(f,b)=>{let w=i+a*(b/(m-1)),[y,k]=ee(t,n,r-o,w),[v,$]=ee(t,n,r-1,w),g=R=>(0,j.jsx)("line",{x1:y,y1:k,x2:v,y2:$,stroke:R,strokeWidth:h,strokeLinecap:"round"},b);return{on:g(l),off:g(c)}})},[t,n,r,o,i,a,m,l,c]);return(0,j.jsx)("g",{"aria-hidden":"true",children:u.map((d,h)=>s>.002&&h/(m-1)<=s+1e-6?d.on:d.off)})}function sn(e){let t=(0,kt.useMemo)(()=>e.data??[{value:e.value??0,target:e.target}],[e.data,e.value,e.target]),n=e.variant??"arc",r=zr({...e,data:t},{height:B=>n==="semi"?Math.max(150,Math.min(210,B*.5)):Math.max(180,Math.min(240,B*.6)),duration:1100,format:"integer"}),{p:o,width:i,height:a}=r,s=ve(e.valueKey,"value"),l=ve(e.targetKey,"target"),c=e.value??(t[0]?s(t[0],0):0),m=e.target??(t[0]?l(t[0],0):NaN),u=e.min??0,d=e.max??100,h=Math.max(0,Math.min(1,(c-u)/(d-u||1))),f=Number.isFinite(m)?Math.max(0,Math.min(1,(m-u)/(d-u||1))):NaN,w=(n==="ring"?360:n==="semi"?180:240)/360*Pe,y=n==="ring"?0:-w/2,k=n==="semi"?Math.max(30,Math.min(a-26,i/2-10)):Math.max(30,Math.min(a/2-6,i/2-10)),v=i/2,$=n==="semi"?a-18:n==="ring"?a/2:a/2+k*.12,g=Math.max(8,Math.min(n==="ring"?16:20,k*.17)),R=(0,kt.useMemo)(()=>[{key:"v",to:[h,c],from:[0,u],enter:[0,u],data:null}],[h,c,u]),_=Wr(R,r.motion),P=_.get("v")??[h,c],L=V(o,"accent"),E=e.bands?.filter(B=>B>u&&B<d)??[],N=Ni[r.lang],C=e.label??r.t.value,M=N.span(r.fmt(u),r.fmt(d)),x=e.value===void 0&&!t.length?[]:[{datum:t[0]??null,index:0,key:"value",label:C,value:c,formatted:`${r.fv(c)}${Number.isFinite(m)?` / ${N.targetWord} ${r.fv(m)}`:""}`}],T=r.active===0?{x:v,y:$-k,title:C,rows:[{label:N.current,value:r.fv(c),color:L.fill},...Number.isFinite(m)?[{label:N.target,value:r.fv(m)},...m?[{label:N.achieved,value:r.pct(c/m*100)}]:[]]:[],{label:N.range,value:M}]}:null,F=Math.max(18,Math.min(42,k*.42)),I=e.description??`${N.gauge}. ${C} ${r.fv(c)}, ${N.rangeWord} ${M}${Number.isFinite(m)?`, ${N.targetWord} ${r.fv(m)}`:""}.`;return(0,j.jsxs)(Kn,{c:r,kind:N.gauge,ariaLabel:e.ariaLabel,description:I,events:x,tip:T,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,j.jsxs)("g",{onPointerEnter:B=>r.setActive(0,B.pointerType==="touch"?"touch":"pointer"),children:[n==="ticks"?(0,j.jsx)(Ri,{cx:v,cy:$,r:k,len:g*1.3,start:y,span:w,count:e.ticks,lit:P[0],on:L.fill,off:o.paint("neutralSoft")}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:Vt(v,$,k-g/2,y,y+w),fill:"none",stroke:o.paint("neutralSoft"),strokeWidth:g,strokeLinecap:n==="ring"?"butt":"round"}),E.map((B,q)=>{let O=(B-u)/(d-u),[U,Y]=ee(v,$,k-g-3,y+w*O),[fe,Ue]=ee(v,$,k+2,y+w*O);return(0,j.jsx)("line",{x1:U,y1:Y,x2:fe,y2:Ue,stroke:o.paint("panel"),strokeWidth:2},q)}),P[0]>.002?(0,j.jsx)("path",{d:Vt(v,$,k-g/2,y,y+w*P[0]),fill:"none",stroke:L.fill,strokeWidth:g,strokeLinecap:"round"}):null]}),Number.isFinite(f)?(()=>{let[B,q]=ee(v,$,k-g-4,y+w*f),[O,U]=ee(v,$,k+4,y+w*f);return(0,j.jsx)("line",{x1:B,y1:q,x2:O,y2:U,stroke:o.paint("ink"),strokeWidth:2.5,strokeLinecap:"round",opacity:_.fade(500,300)})})():null]}),(0,j.jsx)(Re,{x:v,y:n==="semi"?$-F*.55:$-(e.label?F*.18:0),anchor:"middle",size:F,weight:800,fill:o.paint("ink"),letterSpacing:-1,children:r.fv(P[1])}),e.label?(0,j.jsx)(Re,{x:v,y:n==="semi"?$-6:$+F*.5,anchor:"middle",size:11.5,fill:o.paint("muted"),children:Kt(e.label,k*1.5,11.5)}):null,n!=="ring"?(0,j.jsx)("g",{"aria-hidden":"true",children:(()=>{let[B,q]=ee(v,$,k-g/2,y),[O,U]=ee(v,$,k-g/2,y+w),Y=n==="semi"?12:g/2+10;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Re,{x:B,y:q+Y,anchor:"middle",size:10,fill:o.paint("muted"),children:r.fmt(u)}),(0,j.jsx)(Re,{x:O,y:U+Y,anchor:"middle",size:10,fill:o.paint("muted"),children:r.fmt(d)})]})})()}):null,Number.isFinite(m)&&r.showLabels&&n!=="ring"?(()=>{let[B,q]=ee(v,$,k+14,y+w*f),O=Math.sin(y+w*f);return(0,j.jsx)(Re,{x:B,y:q,anchor:O>.2?"start":O<-.2?"end":"middle",size:10.5,weight:700,fill:o.paint("ink"),opacity:_.fade(600,300),children:`${N.target} ${r.fmt(m)}`})})():null]})}var Fi=S(H(),1);var ao=S(D(),1);function no(e,t){return t===!1?e.map((n,r)=>r):ir(e)}function ro(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return he(e,t,t,r,"max")}function oo(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=V(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?V(e,"neutral"):Ze(e,1-a/Math.max(1,o.length-1))),r}function io(e){return!e||typeof e!="object"||Array.isArray(e)?[]:le(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function so(e,t){return ze(e,t+1,new Set)}var _i=S(H(),1);var co=S(D(),1);function lo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Sr.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var ge=S(D(),1);function uo(e,t,n){let r=ut(e);return r?.type==="scatter"&&t?.size!==void 0&&!ct(n)?ut("bubble"):r}function Pi(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 Di(e,t,n,r=!1){let o=uo(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&Ht.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=de(i.label,"label"),d=ve(i.value,"value"),h=o.type==="waffle",f=t.map((g,R)=>({r:g,label:u(g,R),value:h?d(g,R):Qr(d(g,R))})),{kept:b,other:w}=h?{kept:f,other:null}:Zr(f,a.other,(g,R)=>({r:{},label:qr(G(n),g),value:R})),y=he(s,b.map(g=>g.r),b.map(g=>g.label),b.map(g=>g.value),h?"first":"max"),k=w?[...b,w]:b,v=be(g=>h?ae(g,k.length,y):eo(g,k.length,y,a.colorMode)),$=h&&a.shape==="arc";return k.map((g,R)=>({label:g.label,color:v[R],...$&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Jr(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Yr[G(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:on[f],shape:"line"}))]}if(o.type==="network"){let u=io(a.groups);if(u.length<2)return[];let d=be(h=>so(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=de(i.group,"group"),d=le(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=be(f=>ze(f,d.length,new Set));return d.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||ct(a))return[];let u=de(i.series,"series"),d=le(t.map((b,w)=>u(b,w)));if(d.length<2)return[];let h=Xr(s,t,d,u),f=be(b=>ze(b,d.length,h));return c(d.map((b,w)=>({label:b,color:f[w],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",d=u?i.status:i.group;if(typeof d!="string")return[];let h=Or(t,d,u),f=be(b=>ae(b,h.length,lo(s,h)));return c(h.map((b,w)=>({label:b,color:f[w],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let v=de(i.series,"series");u=le(t.map(($,g)=>v($,g)))}let d=jt(o.type,i,a);if(d.length){let v=he(s,u,u,u.map(()=>0),"none"),$=be(R=>ae(R,u.length,v)),g=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((R,_)=>({label:R,color:$[_]}));return[...c(g),...d.map((R,_)=>({label:R,color:Ur(_),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?ar(u.length,Array.isArray(a.negative)?a.negative.map(v=>u.indexOf(String(v))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,b=f>=0?new Set([f]):he(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,$)=>({label:v,color:b.has($)?"accent":"neutralStrong",shape:"square"})));let w=a.colorMode,y=v=>ae(v,u.length,b);if((o.type==="line"||o.type==="area")&&(y=v=>Kr(v,u.length,b,o.type==="area",w)),o.type==="stream"){let v=je(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),$=no(v.values,a.reorder),g=ro(s,v.series,v.values);y=R=>oo(R,$,g)}let k=be(y);return c(u.map((v,$)=>({label:v,color:k[$],...o.type==="line"&&{shape:"line"}})))}return[]}function Li(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&qn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ei(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function mo(e,t){let{spec:n}=e,r=uo(n.type,n.encoding,n.options),o=(0,Ke.useMemo)(()=>Ir(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Jn(n,e.locale),s=Z(a),l=G(s),c=Ar(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=er(n),u=(0,Ke.useMemo)(()=>m?Lr(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,w]=(0,Ke.useState)(null);if(!r)return(0,ge.jsx)(Bt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let y=o??c.data,k=t[r.type],v={...n.options??{}},$={...Pi(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:a},g=n.card?.legend==="toggle"&&Qn(r.type,n.encoding??{},v),R=b&&b.base===f?b.hidden:h;g&&($.hidden=R);let _=C=>w(M=>{let x=M&&M.base===f?M.hidden:h;return{base:f,hidden:x.includes(C)?x.filter(T=>T!==C):[...x,C]}}),P=$.height??220,L=Li(n,r.type),E=i&&!y.length&&(c.loading||c.error||c.empty)?(0,ge.jsx)(Bt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:P,locale:a}):L?(0,ge.jsx)(Cr,{chart:k,...Ei(r.type,L,$)}):(0,ge.jsx)(k,{...$});if(n.card){let C=n.card,M=C.legend==="auto"||C.legend==="toggle"?Di(n,y,s,g):C.legend,x=M?.length?g?(0,ge.jsx)(zt,{items:M,hidden:R,onToggle:_,locale:a}):M:void 0,T=C.download?(0,ge.jsx)(Dr,{data:y,columns:tr(n),filename:C.title??r.type,formats:Array.isArray(C.download)?C.download:void 0,locale:a}):void 0;E=(0,ge.jsx)(Vn,{number:C.number,title:C.title??Yn(r,l),subtitle:C.subtitle,legend:x,actions:T,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:a,children:E})}let N=e.theme??n.theme;return N&&(E=(0,ge.jsx)(ot,{theme:N,children:E})),E}function Oi({cfg:e,components:t}){let n=Le();return mo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ho(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,fo.hydrateRoot)(r,(0,ln.createElement)(ot,{theme:o.theme,cssVars:!0},(0,ln.createElement)(Oi,{cfg:o,components:{[e]:t}})))}ho("gauge",sn);})();
28
+ `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Be(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(In,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,Er.jsx)("div",{children:s},l)):null}}function Or(e,t,n=!1){let r=de(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=le(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Ir(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 $e(t.csv)}return null}var Vr=S(H(),1);var K=S(H(),1);function zr(e,t){let n=se(e.theme),[r,o,i]=gt(e.width),a=Le(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=pt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&oe,d=Tr(r,e.animateOnView!==!1&&u),h=Z(e.locale),f=G(h),b=(0,K.useMemo)(()=>ke(e.format,h,t.format),[e.format,h,t.format]),w=(0,K.useCallback)(O=>Qe(O,{locale:h}),[h]),y=(0,K.useMemo)(()=>et(b,e.unit),[b,e.unit]),k=(0,K.useMemo)(()=>mt(e.data),[e.data]),[v,$]=(0,K.useState)(null),[g,R]=(0,K.useState)(null),_=(0,K.useRef)([]),P=(0,K.useRef)(e.onHover);P.current=e.onHover;let L=(0,K.useRef)(e.onClick);L.current=e.onClick;let E=(0,K.useRef)(null),N=(0,K.useRef)(null),C=(0,K.useRef)(null),M=(0,K.useCallback)((O,U="pointer")=>{if(C.current!==O){C.current=O;let Y=O===null?null:_.current[O]??null;queueMicrotask(()=>P.current?.(Y)),N.current?.(O)}E.current=O===null?null:U,$(O),R(E.current)},[]),x=(0,K.useCallback)(O=>{E.current!=="keyboard"&&(E.current=O===null?null:"sync",$(O),R(E.current))},[]),T=(0,K.useCallback)(O=>{let U=_.current[O];U&&L.current?.(U)},[]),F=Wn(e.replayKey),I=e.width!==void 0||(i??0)>0,B={enabled:u,active:d.visible&&I,near:d.near,replayKey:F,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},q=(0,K.useCallback)((O,U=1)=>v===null||v===O?U:U*.38,[v]);return{p:n,width:s,height:c,measured:I,responsive:e.width===void 0,pending:oe&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:B,fv:y,fmt:b,pct:w,locale:h,lang:f,t:f==="ko"?wn:kn,active:v,via:g,setActive:M,click:T,events:_,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:q,sig:k,description:e.description,reduced:m,publish:N,applySync:x}}var W=S(H(),1);function bi(e){return 1-Math.pow(1-e,3)}function yi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function xi(e){return e==="easeInOut"?yi:e==="linear"?t=>t:bi}function ki(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function Oe(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function bt(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 Br(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function Hr(e,t,n,r){if(!t||!n||t.length!==n.length)return Oe(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Oe(s,n[a]))o.push(l)}return o.length===r?o:Oe(e,r)}var yt=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||!bt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Br(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=bt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Hr(s.cur,s.parts,a.parts,c),s.vel=Hr(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Br(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=bt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=bt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Oe(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=xi(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Oe(s.from,c)),s.vel.length!==c&&(s.vel=Oe(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-i*l),d=i*l>=8&&i*l<20,h=0;for(let f=0;f<c;f++){let b=s.from[f]-s.to[f],w=s.vel[f]+i*b;s.cur[f]=s.to[f]+(b+w*l)*u,s.curVel[f]=(s.vel[f]-i*w*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=ki(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ve=new Set,xt=0;function jr(e){xt=0;let t=Array.from(Ve);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ve.delete(n)}Ve.size&&typeof requestAnimationFrame<"u"&&(xt=requestAnimationFrame(jr))}function Gr(e){return Ve.add(e),!xt&&typeof requestAnimationFrame<"u"&&(xt=requestAnimationFrame(jr)),()=>{Ve.delete(e)}}function wi(e){let t=new Map,n=!1;for(let r of e){let o=(t.get(r.key)??0)+1;t.set(r.key,o),o>1&&(n=!0)}return n?(t.clear(),e.map(r=>{let o=(t.get(r.key)??0)+1;return t.set(r.key,o),o>1?{...r,key:`${r.key}#${o}`}:r})):e}function Wr(e,t){let n=(0,W.useMemo)(()=>wi(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,W.useRef)(null),d=(0,W.useRef)("init"),h=(0,W.useRef)(null),f=(0,W.useRef)(s),b=(0,W.useRef)(a),w=(0,W.useRef)(!1),y=(0,W.useRef)(0),[,k]=(0,W.useState)(0),v=(0,W.useRef)(null),$=(0,W.useRef)(!0);u.current||(u.current=new yt,u.current.configure(l,c),u.current.snap(n),h.current=n);let g=u.current;if(g.configure(l,c),h.current!==n){let N=d.current,C=!Object.is(f.current,s);g.sameTargets(n)?g.refreshData(n):!r||N==="init"?g.snap(n):N==="idle"?g.hold(n):N==="running"||C?g.update(n,Je(),m):g.snap(n),h.current=n,f.current=s}let R=(0,W.useRef)(()=>!1);R.current=N=>{if(!$.current)return!1;let C=g.step(N);return!C&&d.current==="running"&&(d.current="done"),k(M=>(M+1)%1e9),C||(v.current=null),C};let _=(0,W.useCallback)(()=>{if(!oe||v.current||!g.animating)return;let N=C=>R.current(C);v.current=Gr(N)},[g]);ue(()=>{let N=!Object.is(b.current,a);if(b.current=a,!r){(d.current!=="done"||g.animating)&&(g.snap(h.current??n),d.current="done",k(C=>C+1));return}d.current==="init"||N&&i?(g.hold(h.current??n),d.current="idle",w.current=!1,k(C=>C+1)):N&&(w.current=!0)},[r,a]),ue(()=>{!r||!i||!w.current||(w.current=!1,g.hold(h.current??n),d.current="idle",k(N=>N+1))},[i,r]),(0,W.useEffect)(()=>{r&&o&&d.current==="idle"&&(g.start(Je()),y.current+=1,d.current="running",_(),k(N=>N+1))},[r,o,a,g,_]),(0,W.useEffect)(()=>{g.animating&&_()}),(0,W.useEffect)(()=>($.current=!0,()=>{$.current=!1,v.current?.(),v.current=null}),[]);let P=Je(),L=g.elapsed(P),E=r&&d.current==="idle";return{items:g.items(),get:N=>g.get(N),elapsed:E?0:L,fade:(N,C=320)=>E?0:Number.isFinite(L)?Math.max(0,Math.min(1,(L-N)/C)):1,waiting:E,animating:g.animating,generation:y.current}}var tn=S(D(),1);function Kr(e,t,n,r,o){if(r)return o==="categorical"?ae(e,t,n):Nn(e,t,n);if(o==="categorical")return ae(e,t,n);let i=V(e,"strong"),a=V(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var vi=S(H(),1);var nn=S(D(),1);var Ur=e=>e?"neutralStrong":"accent";var rn=S(D(),1);function Xr(e,t,n,r){if(typeof e!="function")return he(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var $i=S(H(),1);var an=S(D(),1),Mi={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ce(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Yr={en:Mi,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},on=["ink","muted","dim"];function Jr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,on.length)}var Ti=S(H(),1);var to=S(D(),1),Ci={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Si={en:Ci,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},qr=(e,t)=>Si[e].other(t);function Zr(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,sr(o.map(i=>i.value)))}}var Qr=e=>Number.isFinite(e)&&e>0?e:0;function eo(e,t,n,r){return r==="emphasis"?An(e,t,n):ae(e,t,n)}var kt=S(H(),1);var j=S(D(),1),Ai={radial:"Radial bar chart",gauge:"Gauge",vsTarget:"vs. target",current:"Current",target:"Target",targetWord:"target",achieved:"Achieved",range:"Range",rangeWord:"range",span:(e,t)=>`${e} to ${t}`},Ni={en:Ai,ko:{radial:"방사형 막대",gauge:"게이지",vsTarget:"목표 대비",current:"현재",target:"목표",targetWord:"목표",achieved:"달성률",range:"범위",rangeWord:"범위",span:(e,t)=>`${e}~${t}`}};function Ri(e){let{cx:t,cy:n,r,len:o,start:i,span:a,lit:s,on:l,off:c}=e,m=Math.max(2,Math.round(e.count??Math.max(24,Math.min(64,(r-o/2)*a/8)))),u=(0,kt.useMemo)(()=>{let d=(r-o/2)*a/(m-1),h=Math.max(1.6,Math.min(3.4,d*.42));return Array.from({length:m},(f,b)=>{let w=i+a*(b/(m-1)),[y,k]=ee(t,n,r-o,w),[v,$]=ee(t,n,r-1,w),g=R=>(0,j.jsx)("line",{x1:y,y1:k,x2:v,y2:$,stroke:R,strokeWidth:h,strokeLinecap:"round"},b);return{on:g(l),off:g(c)}})},[t,n,r,o,i,a,m,l,c]);return(0,j.jsx)("g",{"aria-hidden":"true",children:u.map((d,h)=>s>.002&&h/(m-1)<=s+1e-6?d.on:d.off)})}function sn(e){let t=(0,kt.useMemo)(()=>e.data??[{value:e.value??0,target:e.target}],[e.data,e.value,e.target]),n=e.variant??"arc",r=zr({...e,data:t},{height:B=>n==="semi"?Math.max(150,Math.min(210,B*.5)):Math.max(180,Math.min(240,B*.6)),duration:1100,format:"integer"}),{p:o,width:i,height:a}=r,s=ve(e.valueKey,"value"),l=ve(e.targetKey,"target"),c=e.value??(t[0]?s(t[0],0):0),m=e.target??(t[0]?l(t[0],0):NaN),u=e.min??0,d=e.max??100,h=Math.max(0,Math.min(1,(c-u)/(d-u||1))),f=Number.isFinite(m)?Math.max(0,Math.min(1,(m-u)/(d-u||1))):NaN,w=(n==="ring"?360:n==="semi"?180:240)/360*Pe,y=n==="ring"?0:-w/2,k=n==="semi"?Math.max(30,Math.min(a-26,i/2-10)):Math.max(30,Math.min(a/2-6,i/2-10)),v=i/2,$=n==="semi"?a-18:n==="ring"?a/2:a/2+k*.12,g=Math.max(8,Math.min(n==="ring"?16:20,k*.17)),R=(0,kt.useMemo)(()=>[{key:"v",to:[h,c],from:[0,u],enter:[0,u],data:null}],[h,c,u]),_=Wr(R,r.motion),P=_.get("v")??[h,c],L=V(o,"accent"),E=e.bands?.filter(B=>B>u&&B<d)??[],N=Ni[r.lang],C=e.label??r.t.value,M=N.span(r.fmt(u),r.fmt(d)),x=e.value===void 0&&!t.length?[]:[{datum:t[0]??null,index:0,key:"value",label:C,value:c,formatted:`${r.fv(c)}${Number.isFinite(m)?` / ${N.targetWord} ${r.fv(m)}`:""}`}],T=r.active===0?{x:v,y:$-k,title:C,rows:[{label:N.current,value:r.fv(c),color:L.fill},...Number.isFinite(m)?[{label:N.target,value:r.fv(m)},...m?[{label:N.achieved,value:r.pct(c/m*100)}]:[]]:[],{label:N.range,value:M}]}:null,F=Math.max(18,Math.min(42,k*.42)),I=e.description??`${N.gauge}. ${C} ${r.fv(c)}, ${N.rangeWord} ${M}${Number.isFinite(m)?`, ${N.targetWord} ${r.fv(m)}`:""}.`;return(0,j.jsxs)(Kn,{c:r,kind:N.gauge,ariaLabel:e.ariaLabel,description:I,events:x,tip:T,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,j.jsxs)("g",{onPointerEnter:B=>r.setActive(0,B.pointerType==="touch"?"touch":"pointer"),children:[n==="ticks"?(0,j.jsx)(Ri,{cx:v,cy:$,r:k,len:g*1.3,start:y,span:w,count:e.ticks,lit:P[0],on:L.fill,off:o.paint("neutralSoft")}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("path",{d:Vt(v,$,k-g/2,y,y+w),fill:"none",stroke:o.paint("neutralSoft"),strokeWidth:g,strokeLinecap:n==="ring"?"butt":"round"}),E.map((B,q)=>{let O=(B-u)/(d-u),[U,Y]=ee(v,$,k-g-3,y+w*O),[fe,Ue]=ee(v,$,k+2,y+w*O);return(0,j.jsx)("line",{x1:U,y1:Y,x2:fe,y2:Ue,stroke:o.paint("panel"),strokeWidth:2},q)}),P[0]>.002?(0,j.jsx)("path",{d:Vt(v,$,k-g/2,y,y+w*P[0]),fill:"none",stroke:L.fill,strokeWidth:g,strokeLinecap:"round"}):null]}),Number.isFinite(f)?(()=>{let[B,q]=ee(v,$,k-g-4,y+w*f),[O,U]=ee(v,$,k+4,y+w*f);return(0,j.jsx)("line",{x1:B,y1:q,x2:O,y2:U,stroke:o.paint("ink"),strokeWidth:2.5,strokeLinecap:"round",opacity:_.fade(500,300)})})():null]}),(0,j.jsx)(Re,{x:v,y:n==="semi"?$-F*.55:$-(e.label?F*.18:0),anchor:"middle",size:F,weight:800,fill:o.paint("ink"),letterSpacing:-1,children:r.fv(P[1])}),e.label?(0,j.jsx)(Re,{x:v,y:n==="semi"?$-6:$+F*.5,anchor:"middle",size:11.5,fill:o.paint("muted"),children:Kt(e.label,k*1.5,11.5)}):null,n!=="ring"?(0,j.jsx)("g",{"aria-hidden":"true",children:(()=>{let[B,q]=ee(v,$,k-g/2,y),[O,U]=ee(v,$,k-g/2,y+w),Y=n==="semi"?12:g/2+10;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Re,{x:B,y:q+Y,anchor:"middle",size:10,fill:o.paint("muted"),children:r.fmt(u)}),(0,j.jsx)(Re,{x:O,y:U+Y,anchor:"middle",size:10,fill:o.paint("muted"),children:r.fmt(d)})]})})()}):null,Number.isFinite(m)&&r.showLabels&&n!=="ring"?(()=>{let[B,q]=ee(v,$,k+14,y+w*f),O=Math.sin(y+w*f);return(0,j.jsx)(Re,{x:B,y:q,anchor:O>.2?"start":O<-.2?"end":"middle",size:10.5,weight:700,fill:o.paint("ink"),opacity:_.fade(600,300),children:`${N.target} ${r.fmt(m)}`})})():null]})}var Fi=S(H(),1);var ao=S(D(),1);function no(e,t){return t===!1?e.map((n,r)=>r):ir(e)}function ro(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return he(e,t,t,r,"max")}function oo(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=V(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?V(e,"neutral"):Ze(e,1-a/Math.max(1,o.length-1))),r}function io(e){return!e||typeof e!="object"||Array.isArray(e)?[]:le(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function so(e,t){return ze(e,t+1,new Set)}var _i=S(H(),1);var co=S(D(),1);var Pi=26;var dc=Pi*.62;function lo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Sr.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var ge=S(D(),1);function uo(e,t,n){let r=ut(e);return r?.type==="scatter"&&t?.size!==void 0&&!ct(n)?ut("bubble"):r}function Di(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 Li(e,t,n,r=!1){let o=uo(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&Ht.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=de(i.label,"label"),d=ve(i.value,"value"),h=o.type==="waffle",f=t.map((g,R)=>({r:g,label:u(g,R),value:h?d(g,R):Qr(d(g,R))})),{kept:b,other:w}=h?{kept:f,other:null}:Zr(f,a.other,(g,R)=>({r:{},label:qr(G(n),g),value:R})),y=he(s,b.map(g=>g.r),b.map(g=>g.label),b.map(g=>g.value),h?"first":"max"),k=w?[...b,w]:b,v=be(g=>h?ae(g,k.length,y):eo(g,k.length,y,a.colorMode)),$=h&&a.shape==="arc";return k.map((g,R)=>({label:g.label,color:v[R],...$&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Jr(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Yr[G(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:on[f],shape:"line"}))]}if(o.type==="network"){let u=io(a.groups);if(u.length<2)return[];let d=be(h=>so(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=de(i.group,"group"),d=le(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=be(f=>ze(f,d.length,new Set));return d.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||ct(a))return[];let u=de(i.series,"series"),d=le(t.map((b,w)=>u(b,w)));if(d.length<2)return[];let h=Xr(s,t,d,u),f=be(b=>ze(b,d.length,h));return c(d.map((b,w)=>({label:b,color:f[w],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",d=u?i.status:i.group;if(typeof d!="string")return[];let h=Or(t,d,u),f=be(b=>ae(b,h.length,lo(s,h)));return c(h.map((b,w)=>({label:b,color:f[w],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let v=de(i.series,"series");u=le(t.map(($,g)=>v($,g)))}let d=jt(o.type,i,a);if(d.length){let v=he(s,u,u,u.map(()=>0),"none"),$=be(R=>ae(R,u.length,v)),g=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((R,_)=>({label:R,color:$[_]}));return[...c(g),...d.map((R,_)=>({label:R,color:Ur(_),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?ar(u.length,Array.isArray(a.negative)?a.negative.map(v=>u.indexOf(String(v))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,b=f>=0?new Set([f]):he(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,$)=>({label:v,color:b.has($)?"accent":"neutralStrong",shape:"square"})));let w=a.colorMode,y=v=>ae(v,u.length,b);if((o.type==="line"||o.type==="area")&&(y=v=>Kr(v,u.length,b,o.type==="area",w)),o.type==="stream"){let v=je(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),$=no(v.values,a.reorder),g=ro(s,v.series,v.values);y=R=>oo(R,$,g)}let k=be(y);return c(u.map((v,$)=>({label:v,color:k[$],...o.type==="line"&&{shape:"line"}})))}return[]}function Ei(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&qn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Oi(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function mo(e,t){let{spec:n}=e,r=uo(n.type,n.encoding,n.options),o=(0,Ke.useMemo)(()=>Ir(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Jn(n,e.locale),s=Z(a),l=G(s),c=Ar(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=er(n),u=(0,Ke.useMemo)(()=>m?Lr(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,w]=(0,Ke.useState)(null);if(!r)return(0,ge.jsx)(Bt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let y=o??c.data,k=t[r.type],v={...n.options??{}},$={...Di(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:a},g=n.card?.legend==="toggle"&&Qn(r.type,n.encoding??{},v),R=b&&b.base===f?b.hidden:h;g&&($.hidden=R);let _=C=>w(M=>{let x=M&&M.base===f?M.hidden:h;return{base:f,hidden:x.includes(C)?x.filter(T=>T!==C):[...x,C]}}),P=$.height??220,L=Ei(n,r.type),E=i&&!y.length&&(c.loading||c.error||c.empty)?(0,ge.jsx)(Bt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:P,locale:a}):L?(0,ge.jsx)(Cr,{chart:k,...Oi(r.type,L,$)}):(0,ge.jsx)(k,{...$});if(n.card){let C=n.card,M=C.legend==="auto"||C.legend==="toggle"?Li(n,y,s,g):C.legend,x=M?.length?g?(0,ge.jsx)(zt,{items:M,hidden:R,onToggle:_,locale:a}):M:void 0,T=C.download?(0,ge.jsx)(Dr,{data:y,columns:tr(n),filename:C.title??r.type,formats:Array.isArray(C.download)?C.download:void 0,locale:a}):void 0;E=(0,ge.jsx)(Vn,{number:C.number,title:C.title??Yn(r,l),subtitle:C.subtitle,legend:x,actions:T,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:a,children:E})}let N=e.theme??n.theme;return N&&(E=(0,ge.jsx)(ot,{theme:N,children:E})),E}function Ii({cfg:e,components:t}){let n=Le();return mo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ho(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,fo.hydrateRoot)(r,(0,ln.createElement)(ot,{theme:o.theme,cssVars:!0},(0,ln.createElement)(Ii,{cfg:o,components:{[e]:t}})))}ho("gauge",sn);})();