ztd-charts-cli 0.10.0 → 0.11.1
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.
- package/dist/api.js +1 -1
- package/dist/{chunk-QVGOP3IE.js → chunk-JTT5G6KW.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/area.js +6 -6
- package/dist/client/bar.js +5 -5
- package/dist/client/barRace.js +2 -2
- package/dist/client/beeswarm.js +2 -2
- package/dist/client/box.js +6 -6
- package/dist/client/bubble.js +6 -6
- package/dist/client/bullet.js +5 -5
- package/dist/client/bump.js +6 -6
- package/dist/client/calendar.js +5 -5
- package/dist/client/candlestick.js +4 -4
- package/dist/client/chord.js +5 -5
- package/dist/client/choropleth.js +5 -5
- package/dist/client/donut.js +6 -6
- package/dist/client/dumbbell.js +2 -2
- package/dist/client/flowMap.js +4 -4
- package/dist/client/funnel.js +2 -2
- package/dist/client/gauge.js +2 -2
- package/dist/client/heatmap.js +5 -5
- package/dist/client/histogram.js +5 -5
- package/dist/client/line.js +6 -6
- package/dist/client/lollipop.js +5 -5
- package/dist/client/marimekko.js +6 -6
- package/dist/client/network.js +5 -5
- package/dist/client/parallel.js +6 -6
- package/dist/client/pareto.js +5 -5
- package/dist/client/pie.js +6 -6
- package/dist/client/radar.js +6 -6
- package/dist/client/radialBar.js +2 -2
- package/dist/client/ridgeline.js +4 -4
- package/dist/client/sankey.js +4 -4
- package/dist/client/scatter.js +6 -6
- package/dist/client/segmented.js +2 -2
- package/dist/client/skyline.js +2 -2
- package/dist/client/slope.js +5 -5
- package/dist/client/sparkline.js +6 -6
- package/dist/client/stream.js +6 -6
- package/dist/client/sunburst.js +2 -2
- package/dist/client/symbolMap.js +5 -5
- package/dist/client/tileMap.js +6 -6
- package/dist/client/timeline.js +10 -10
- package/dist/client/tree.js +5 -5
- package/dist/client/treemap.js +2 -2
- package/dist/client/waffle.js +5 -5
- package/dist/client/waterfall.js +5 -5
- package/package.json +2 -2
package/dist/client/barRace.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var Aa=Object.create;var mr=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Fa=Object.getPrototypeOf,Pa=Object.prototype.hasOwnProperty;var cn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var _a=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ra(t))!Pa.call(e,o)&&o!==n&&mr(e,o,{get:()=>t[o],enumerable:!(r=Na(t,o))||r.enumerable});return e};var A=(e,t,n)=>(n=e!=null?Aa(Fa(e)):{},_a(t||!e||!e.__esModule?mr(n,"default",{value:e,enumerable:!0}):n,e));var Z=cn((
|
|
1
|
+
(()=>{var Aa=Object.create;var mr=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Fa=Object.getPrototypeOf,Pa=Object.prototype.hasOwnProperty;var cn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var _a=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ra(t))!Pa.call(e,o)&&o!==n&&mr(e,o,{get:()=>t[o],enumerable:!(r=Na(t,o))||r.enumerable});return e};var A=(e,t,n)=>(n=e!=null?Aa(Fa(e)):{},_a(t||!e||!e.__esModule?mr(n,"default",{value:e,enumerable:!0}):n,e));var Z=cn((il,dr)=>{dr.exports=globalThis.__ztdReact.react});var hr=cn((sl,fr)=>{fr.exports=globalThis.__ztdReact["react-dom/client"]});var G=cn((wl,jr)=>{jr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Zn=A(Z(),1),fa=A(hr(),1);var yt=A(Z(),1);var It=A(Z(),1);var gr=A(Z(),1),qe=(0,gr.createContext)(void 0);var xr=A(Z(),1);var Da=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],pr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',br='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Oe={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:pr,monoFamily:br,radius:18,radiusCode:14,radiusMark:4},un={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:pr,monoFamily:br,radius:18,radiusCode:14,radiusMark:4},mn={dark:Oe,light:un};function Tt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function dn(e){let t={};for(let n of Da){let r=e[n];typeof r=="string"&&(t[Tt(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 fn(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 La=`
|
|
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,${Oe.accent});outline-offset:3px;border-radius:6px}
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
`&&f++,s.push(c),i.push(s),s=[],c=""):c+=b}(c!==""||s.length)&&(s.push(c),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?oo(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((b,T)=>[String(T),u(b)])));let d=[],h=new Set;return m[0].forEach((f,b)=>{let T=f.trim()||`col${b+1}`,w=T;for(let k=2;h.has(w);k++)w=`${T}_${k}`;h.add(w),d.push(w)}),m.slice(1).map(f=>Object.fromEntries(d.map((b,T)=>[b,u(f[T]??"")])))}function Fn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,c)=>[s,r&&typeof i[c]=="string"?oo(i[c]):i[c]??null])))}function Zi(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,c)=>Object.fromEntries(a.map(l=>[l,e[l][c]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function ao(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 Be(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Be(JSON.parse(t))}catch{}return Ke(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Fn(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)?Be(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Fn(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)?Be(t.rows):Array.isArray(t.values)?Fn(t.values):Array.isArray(t.items)?Be(t.items):Array.isArray(t.results)?Be(t.results):Zi(t)}return[]}function Gt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Pn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(c,l)=>{let m=e[c][l];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let c=0;for(let l=1;l<r;l++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,l),f=h-i(d,l-1),b=0;for(let T=0;T<d;T++)b+=i(T,l)-i(T,l-1);m+=h,u+=(f/2+b)*h}m&&(c-=u/m),s[l]=c}}for(let c=0;c<r;c++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][c],b=Number.isFinite(f)?f:0;b>=0?(o[h][c]=u,u+=b,a[h][c]=u):(o[h][c]=d,d+=b,a[h][c]=d)}continue}let l=0;for(let u=0;u<n;u++)l+=i(u,c);let m=t==="silhouette"?-l/2:s[c];for(let u=0;u<n;u++){let d=i(u,c);t==="expand"&&(d=l?d/l*100:0),o[u][c]=m,m+=d,a[u][c]=m}}if(t==="wiggle"&&r){let c=1/0,l=-1/0;for(let u=0;u<r;u++)c=Math.min(c,o[0]?.[u]??0),l=Math.max(l,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function io(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 so(e){let t=e.length,n=e.map(l=>{let m=0,u=-1/0;return l.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(l=>l.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(l,m)=>m).sort((l,m)=>n[l]-n[m]),a=[],i=[],s=0,c=0;for(let l of o)s<c?(a.push(l),s+=r[l]):(i.push(l),c+=r[l]);return[...i.reverse(),...a]}var Qi=Math.PI*2;function Le(e,t,n){return e<t?t:e>n?n:e}function lo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function Q(e){return Math.round(e*100)/100}function _n(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=Le(a.tl??0,0,i),c=Le(a.tr??0,0,i),l=Le(a.br??0,0,i),m=Le(a.bl??0,0,i);return`M${Q(e+s)},${Q(t)}H${Q(e+n-c)}`+(c?`A${Q(c)},${Q(c)} 0 0 1 ${Q(e+n)},${Q(t+c)}`:"")+`V${Q(t+r-l)}`+(l?`A${Q(l)},${Q(l)} 0 0 1 ${Q(e+n-l)},${Q(t+r)}`:"")+`H${Q(e+m)}`+(m?`A${Q(m)},${Q(m)} 0 0 1 ${Q(e)},${Q(t+r-m)}`:"")+`V${Q(t+s)}`+(s?`A${Q(s)},${Q(s)} 0 0 1 ${Q(e+s)},${Q(t)}`:"")+"Z"}function co(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function mo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function uo(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 Vt=new Map;function ce(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Vt.get(o);if(a===void 0){let i=0,s=0;for(let c=0;c<r.length;c++){let l=r.charCodeAt(c);mo(l)?i+=uo(l):s+=uo(l)}a=i+s*(n>=600?1.07:1),Vt.size>5e3&&Vt.clear(),Vt.set(o,a)}return a*t}function Dn(e,t,n,r=400){if(e=e.trim(),ce(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let c=a+i+1>>1;ce(e.slice(0,c)+o,n,r)<=t?a=c:i=c-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(mo(s.charCodeAt(0))?2:3)?"":s+o}var ho=A(G(),1),es=e=>Array.isArray(e)&&e.length===2;function fo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&es(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var po=A(G(),1),Ln=10.5;function ts(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>tt(i,{locale:n,maximumFractionDigits:a}))}function go(e,t,n){let r=18;for(let o of ts(e,t,n))r=Math.max(r,ce(o,Ln));return Math.ceil(r+8)}function En(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 rt(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,c=En(i,n),l=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/c-1e-9)*c,d=Math.floor(o/c+1e-9)*c;l=[o===0?0:o-d<=c*.3?d:o-i*s,a===0?0:u-a<=c*.3?u:a+i*s];let h=En(l[1]-l[0],n);if(h===c)break;c=h}return l}function bo(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=En(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let c=s,l=0;c<=o+a*1e-9&&l<200;c+=a,l++)i.push(Number((Math.round(c/a)*a).toPrecision(12)));return i}function In(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(c=>o+(c-n)*i);return s.domain=e,s.range=t,s.invert=c=>i===0?n:n+(c-o)/i,s.ticks=(c=4)=>bo(n,r,c),s}function On(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=rt(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function ns(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(l,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of l){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let c=i([1,2,3,4,5,6,7,8,9]);return c.length>=2?c:bo(e,t,3)}function yo(e,t){let n=In([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=()=>ns(e[0],e[1],Math.abs(t[1]-t[0])),r}function ht(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 rs=864e5;function xo(e,t,n,r=me){let o=t-e;if(!(o>0))return[{t:e,label:dt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/rs,i=[],s=new Date(e),c=new Date(e).getFullYear()===new Date(t).getFullYear(),l=(m,u,d,h=!1)=>{let f=new Date(m),b=-1,T=0;for(;f.getTime()<=t&&T++<500;){if(f.getTime()>=e){let w=f.getFullYear(),k=h&&!c&&w!==b;i.push({t:f.getTime(),label:dt(f,{locale:r,...d,...k?{year:"numeric"}:{}})}),b=w}u(f)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),l(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());l(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),l(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);l(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),l(h,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return i}function ko(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let c=o(i);return c>=0?(r[c]||(a[c]=t(c),r[c]=1),a[c]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var zn=(e,t,n)=>e==="date"?_t(t,n)?.getTime()??NaN:Ne(t);function os(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Br(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ue(e,t,n,r,o={}){let a=We(t,"x"),i=Array.isArray(n),s=i?n:null,c=i?null:We(n,"y"),l=!i&&r!==void 0?We(r,"series"):null,m=e.map((v,x)=>a(v,x)),u=o.xType??os(m),d=o.locale??me,h,f,b;if(u==="band"){let v=m.map(M=>String(M??""));h=$e(v);let x=new Map(h.map((M,D)=>[M,D]));f=h.map((M,D)=>D),b=Int32Array.from(v,M=>x.get(M)??-1)}else{let v=u==="date"?o.dayFirst??Hr(m):void 0,x=m.map(U=>zn(u,U,v)),M=Array.from(new Set(x.filter(U=>Number.isFinite(U)))).sort((U,oe)=>U-oe),D=new Map(M.map((U,oe)=>[U,oe]));f=M,h=M.map(String),b=Int32Array.from(x,U=>D.get(U)??-1)}let T=o.dateFormat,w=v=>typeof v=="string"?Pt(v.trim())?.[3]:void 0,k=u==="date"&&m.length<5e3?w(m[0]):void 0,$=(k===2||k===3)&&m.every(v=>w(v)===k),P=$&&k===3;if(u==="date"&&!T){let v=f.length>1?f[f.length-1]-f[0]:0;T=$&&k===2||v>864e5*120?{month:"short"}:v<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},v>864e5*800&&(T={year:"numeric",month:"short"})}let y;if(u==="band")y=h;else if(P&&!o.dateFormat){let v=te(d)==="ko";y=f.map(x=>{let M=new Date(x),D=Math.floor(M.getMonth()/3)+1;return v?`${M.getFullYear()}년 ${D}분기`:`Q${D} ${M.getFullYear()}`})}else{let v=f.every($n),x=u==="date"?new Intl.DateTimeFormat(d,T):new Intl.NumberFormat(d,v?{useGrouping:!1}:{maximumFractionDigits:6});y=f.length>1e3?ko(f.length,M=>x.format(f[M])):f.map(M=>x.format(M))}let S=s?[...s]:l?$e(e.map((v,x)=>String(l(v,x)??""))):[""],H=new Map(S.map((v,x)=>[v,x])),I=S.map(()=>new Array(h.length).fill(NaN)),K=S.map(()=>new Array(h.length).fill(null)),V=o.aggregate??"sum",_=V==="mean"?S.map(()=>new Uint32Array(h.length)):null,F=(v,x,M,D)=>{let U=I[v][x];V==="last"?I[v][x]=M:V==="count"?I[v][x]=(Number.isFinite(U)?U:0)+1:V==="mean"?Number.isFinite(M)&&(I[v][x]=(Number.isFinite(U)?U:0)+M,_[v][x]++):I[v][x]=Number.isFinite(U)?U+(Number.isFinite(M)?M:0):M,K[v][x]=D};for(let v=0;v<e.length;v++){let x=b[v];if(x<0)continue;let M=e[v];if(s)for(let D=0;D<s.length;D++)F(D,x,Ne(M[s[D]]),M);else{let D=l?H.get(String(l(M,v)??""))??0:0;F(D,x,Ne(c(M,v)),M)}}if(_)for(let v=0;v<I.length;v++)for(let x=0;x<h.length;x++)_[v][x]>1&&(I[v][x]/=_[v][x]);return{type:u,keys:h,xnum:f,labels:y,series:S,values:I,rows:K}}var as=140,pt=12,wo=14,Bn=20,vo=12.5;function is(e,t,n=Qr){let r=De(t,t),o=new Map;e.forEach((i,s)=>{let c=r(i,s),l=o.get(c);l?l.push(i):o.set(c,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function ss(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+pt)/(as+pt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function ls(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*pt)/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 gt=e=>e.filter(Number.isFinite);function Wt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=jt(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return gt(n)}function $o(e,t,n,r,o,a){return Ue(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function cs(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),c=r.yDomain,l=c&&(!s||c[0]>0&&c[1]>0)?c:void 0;if(e==="scatter"){let y=t.flat(),S=r.refLines??{},[H,I]=ht([...Wt(y,r.x??"x"),...gt([Number(S.x)])]),[K,V]=ht([...Wt(y,r.y??"y"),...gt([Number(S.y)])].filter(F=>!s||F>0)),_=r.zero??!1;return{y:l??(s?On(K,V,i):rt(K,V,i,{zero:_,pad:.08})),x:r.xDomain??rt(H,I,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(y=>y.keys.join("")===d),f=n.length>0&&n.every(y=>y.type!=="band"&&y.type===n[0].type),b=r.xDomain??(!m&&f?ht(n.flatMap(y=>gt(y.xnum))):void 0),T=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(T==="percent")return{x:b,sameKeys:h};if(l)return{y:l,x:b,sameKeys:h};let w=[];t.forEach((y,S)=>{let H=n[S];if(T==="stacked"||T==="auto"&&H.series.length>1){let K=Pn(H.values,"zero");K.y0.forEach(V=>w.push(...V)),K.y1.forEach(V=>w.push(...V))}else H.values.forEach(K=>w.push(...K));m&&!u&&r.line!==void 0&&$o(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(K=>w.push(...K)),m||w.push(...Wt(y,r.lower),...Wt(y,r.upper))}),m&&w.push(0),u||w.push(...fo(r.annotations));for(let y of r.referenceLines??[])w.push(y.y);r.signColors&&w.push(Number(r.baseline??0));let[k,$]=ht(gt(w).filter(y=>!s||y>0));return{y:s?On(k,$,i):m?rt(k,$,u?Math.max(2,Math.round(o/120)):i):rt(k,$,i,{zero:r.zero??e==="area"}),x:b,sameKeys:h}}function us(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let c=Ue(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),l=(r.yScale==="log"&&e==="line"?yo:In)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=go(l,Er(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(y=>y.series),d=r.endLabels??n.some(y=>y.series.length>1),h=m+6,f=a-(d?Math.min(a*.28,Math.max(...u.map(y=>ce(y,11,700)),20)+14):10),b=c.keys.length,[T,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,k=c.type==="number"?b>12:b>xo(T,w,Math.max(2,Math.floor((f-h)/64)),s).length;if(c.type==="band"||!b||k)return;let $=y=>h+(c.xnum[y]-T)/(w-T)*(f-h),P=y=>ce(c.labels[y],Ln);for(let y=1;;y++){let S=Array.from({length:Math.ceil(b/y)},(H,I)=>I*y);if(y>=b||S.every((H,I)=>!I||$(H)-$(S[I-1])>=(P(H)+P(S[I-1]))/2+8))return S.map(H=>({value:c.xnum[H],label:c.labels[H]}))}}function ms(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 ds(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${ms(`${e}|${t}|${o}|${Gt(r)}`)}`}function fs(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 hs={en:{intro:(e,t)=>`${xe(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:"(빈 값)"}},Hn=18;function Mo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=is(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,c=ss(s,i,e.columns),{pw:l,ph:m}=ls(s,c,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(_=>$o(t,_,n,n.y,n.series,n.aggregate)),h=u?cs(t,o,d,n,l,m):{sameKeys:!1},f=u?us(t,o,d,n,h,l,m,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",T=u&&(!b||h.sameKeys),w=u&&(b||h.x!==void 0||h.sameKeys),k=new Set(fs(e.highlight,r)?[e.highlight].flat():[]),$=k.size>0,P=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??ds(t,e.by,n,e.data),S=et(_e(n.format,e.locale),n.unit),H=hs[e.lang],I=[],K=r.map(_=>_===""?H.blank:_);return{panels:r.map((_,F)=>{let v=o[F],x=K[F],M=F%c,D;if(t!=="scatter"){let oe=d[F],Fe=he=>oe.values.reduce((Ce,st)=>Ce+(Number.isFinite(st[he])?st[he]:0),0),X=oe.keys.map((he,Ce)=>Ce).filter(he=>oe.values.some(Ce=>Number.isFinite(Ce[he]))),se=X[X.length-1];I.push({first:X.length?Fe(X[0]):NaN,last:X.length?Fe(se):NaN,total:X.reduce((he,Ce)=>he+Fe(Ce),0)}),t!=="bar"&&oe.series.length===1&&se!==void 0&&(D=S(oe.values[0][se]))}else I.push({first:NaN,last:NaN,total:v.length});let U={data:v,width:l,height:m,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:y,highlight:$?k.has(_)?P?()=>!0:void 0:"none":e.highlight,showYAxis:!T||M===0,showXAxis:!w||F+c>=i};return h.y&&(U.yDomain=h.y),h.x&&(U.xDomain=h.x),f&&(U.xTicks=f),{value:_,label:x,props:U,last:D,isPicked:k.has(_)}}),cols:c,pw:l,ph:m,isPanelPick:$,description:gs(t,e.by,K,I,a,S,H)}}function gs(e,t,n,r,o,a,i){let s=i.intro(n.length,t),c=l=>co(r.map(m=>m[l]));if(e==="line"||e==="area"){let l=c("last");l>=0&&(s+=i.endHigh(n[l],a(r[l].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let l=c("total");l>=0&&(s+=e==="bar"?i.total(n[l],a(r[l].total)):i.points(n[l],r[l].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var fe=A(Z(),1);function ps(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function bs(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 Kt={threshold:.25,enoughPx:96,rootMargin:"0px"};function So(e,t=!0){let[n,r]=(0,fe.useState)({visible:!t,near:!t});return(0,fe.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=bs(i[i.length-1],Kt.threshold,Kt.enoughPx);r(c=>c.visible===s?c:{...c,visible:s,near:c.near||s})},{threshold:ps(Kt.threshold),rootMargin:Kt.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(c=>c.near===s.isIntersecting?c:{...c,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function To(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Ut(e){let[t,n]=(0,fe.useState)(null),[r,o]=(0,fe.useState)(e??null),a=(0,fe.useCallback)(i=>{n(i),i&&e===void 0&&o(To(i))},[e]);return Ae(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=l=>o(m=>m!==null&&Math.abs(m-l)<.5?m:l),s=()=>i(To(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let c=new ResizeObserver(l=>{let m=l[l.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return c.observe(t),()=>c.disconnect()},[t,e]),[t,a,r]}var ys=()=>()=>{};function ot(){return(0,fe.useSyncExternalStore)(ys,()=>!0,()=>!1)}var Co="(prefers-reduced-motion: reduce)";function Xt(e="auto"){let[t,n]=(0,fe.useState)(()=>ye&&typeof window.matchMedia=="function"?window.matchMedia(Co).matches:!1);return(0,fe.useEffect)(()=>{if(e!=="auto"||!ye||typeof window.matchMedia!="function")return;let r=window.matchMedia(Co),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=A(G(),1),xs=60,ks=420;function Ao(e){let t=ve(),n=e.chartProps??{},[,r,o]=Ut(e.width),a=e.width??(o||480),i=le(e.locale??n.locale),s=te(i),c=(0,at.useContext)(qe),l=e.title??c,m=e.chart.facetPlan,u=(0,at.useMemo)(()=>{let w=Mo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:l,locale:i,lang:s});return m?m(w,n,i):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,a,e.height,l,i,s,m]),d=`${(0,at.useId)().replace(/:/g,"")}fd`,h=Xt(n.reducedMotion??"auto"),f=ot(),b=wr({motion:{enabled:n.animate!==!1&&!h&&ye},hydrated:f},{waiting:!1,generation:0}),T=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":l,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:d,style:zt,children:e.description??u.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:pt,rowGap:wo,...u.legend?{marginTop:Hn}:null},children:u.panels.map((w,k)=>{let $=t.paint(w.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...kr(b,!1,"fade",k*xs,ks)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Bn,fontSize:vo,fontWeight:700,lineHeight:`${Bn}px`,color:$},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,Me.jsx)(T,{...n,...w.props})]},w.value)})}),u.legend?(0,Me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Hn},children:u.legend}):null]})}var No=["max","min","first","last","none"];function Te(e,t,n,r,o="max"){let a=new Set,i=n.length,s=l=>{if(i&&l!=="none"){if(l==="first")a.add(0);else if(l==="last")a.add(i-1);else if(l==="max"||l==="min"){let m=-1,u=l==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(l==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((l,m)=>{m<i&&l!==null&&l!==void 0&&e(l,m)&&a.add(m)}),a;let c=Array.isArray(e)?e:[e];for(let l of c)typeof l=="number"?l>=0&&l<i&&a.add(l):l==="max"||l==="min"||l==="first"||l==="last"||l==="none"?s(l):n.forEach((m,u)=>{m===l&&a.add(u)});return a}var be=A(Z(),1);async function ws(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(te(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ke(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ke(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ke(a)}async function vs(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await ws(a,t.parse,o,t.locale)}return t.select&&(r=ao(r,t.select)),t.transform?t.transform(r):Be(r)}function Ro(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,be.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,c]=(0,be.useState)(0),l=le(t.locale),m=(0,be.useRef)(t);m.current={...t,locale:l};let u=(0,be.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(w=>typeof w=="object"?JSON.stringify(w):String(w))),b=(0,be.useRef)(!1);(0,be.useEffect)(()=>{let w=u.current;if(!w||!r){i(P=>P.status==="loading"?{...P,status:"idle"}:P);return}let k=new AbortController,$=!0;return b.current=!0,i(P=>({...P,data:o?P.data:[],status:"loading",error:null})),vs(w,{...m.current,signal:k.signal}).then(P=>{$&&i({data:P,status:"success",error:null,updatedAt:Date.now()})}).catch(P=>{!$||k.signal.aborted||i(y=>({...y,status:"error",error:P instanceof Error?P:new Error(String(P))}))}).finally(()=>{$&&(b.current=!1)}),()=>{$=!1,b.current=!1,k.abort()}},[d,r,s,f,o]),(0,be.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||c(k=>k+1)},n);return()=>clearInterval(w)},[n,r]);let T=(0,be.useCallback)(()=>c(w=>w+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:T}}var Gn=A(G(),1),$s=["csv","svg","png"],Ms=/^[=+\-@\t\r\n=+-@]/,Ts=/var\(|color-mix\(/;function Fo(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?Ir(e.getTime()):String(e);return`"${(Ms.test(t)&&!Number.isFinite(Ne(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Cs(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Ss(e,t){return`\uFEFF${[t.map(Fo),...e.map(r=>t.map(o=>Fo(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
27
|
`}function As(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function jn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Po=2,He=16;function _o(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Do(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 Lo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,c]=[a+He*2,i+He*2],l=o.cloneNode(!0),m=l.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,b)=>{let T;for(let w of Array.from(f.attributes)){if(!Ts.test(w.value))continue;let k=(T??(T=getComputedStyle(f))).getPropertyValue(w.name);k&&m[b].setAttribute(w.name,_o(k,u))}}),l.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-He} ${-He} ${s} ${c}`,width:s*t,height:c*t,"font-family":getComputedStyle(o).fontFamily}))l.setAttribute(f,String(b));let d=_o(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=l.querySelector("desc")?.nextSibling??l.firstChild;l.insertBefore(Do("rect",{x:-He,y:-He,width:s,height:c,fill:d}),f),h&&l.insertBefore(Do("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(l),w:s,h:c,vw:a,vh:i,bg:d,canvas:h}}function Ns(e,t){let n=Lo(e,Po,!1);if(!n)return;let r=Po,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,He*r,He*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(c=>c&&jn(c,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Eo(e){let t=ve(e.theme),n=te(le(e.locale))==="ko",r=As(e.filename),o=(a,i)=>{if(a==="csv")return jn(new Blob([Ss(e.data,e.columns?.length?e.columns:Cs(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Ns(i,r);let s=Lo(i,1,!0);s&&jn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Gn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:$s.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Gn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:c=>o(a,c.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Oo=A(G(),1);function Io(e,t=me){let n=_e(void 0,t),r=e.split(`
|
|
28
|
-
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?dt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let c=!1,l=s.replace(zr,(m,u)=>o(a,u.trim())??(c=!0,""));c||i.push(l)}return i.length?i.map((s,c)=>(0,Oo.jsx)("div",{children:s},c)):null}}function zo(e,t,n=!1){let r=De(t,"group"),o=e.map((s,c)=>r(s,c)).filter(Boolean),a=$e(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,c)=>[s,c]).sort((s,c)=>i.get(s[0])-i.get(c[0])||s[1]-c[1]).map(([s])=>s)}function Bo(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 Ke(t.csv)}return null}var Wo=A(Z(),1);var re=A(Z(),1);function Ho(e,t){let n=ve(e.theme),[r,o,a]=Ut(e.width),i=ot(),s=e.width??(a||t.ssrWidth||480),c=typeof t.height=="function"?t.height(s):t.height,l=e.height??c,m=Xt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,d=So(r,e.animateOnView!==!1&&u),h=le(e.locale),f=te(h),b=(0,re.useMemo)(()=>_e(e.format,h,t.format),[e.format,h,t.format]),T=(0,re.useCallback)(X=>Ft(X,{locale:h}),[h]),w=(0,re.useMemo)(()=>et(b,e.unit),[b,e.unit]),k=(0,re.useMemo)(()=>Gt(e.data),[e.data]),[$,P]=(0,re.useState)(null),[y,S]=(0,re.useState)(null),H=(0,re.useRef)([]),I=(0,re.useRef)(e.onHover);I.current=e.onHover;let K=(0,re.useRef)(e.onClick);K.current=e.onClick;let V=(0,re.useRef)(null),_=(0,re.useRef)(null),F=(0,re.useRef)(null),v=(0,re.useCallback)((X,se="pointer")=>{if(F.current!==X){F.current=X;let he=X===null?null:H.current[X]??null;queueMicrotask(()=>I.current?.(he)),_.current?.(X)}V.current=X===null?null:se,P(X),S(V.current)},[]),x=(0,re.useCallback)(X=>{V.current!=="keyboard"&&(V.current=X===null?null:"sync",P(X),S(V.current))},[]),M=(0,re.useCallback)(X=>{let se=H.current[X];se&&K.current?.(se)},[]),D=Wr(e.replayKey),U=e.width!==void 0||(a??0)>0,oe={enabled:u,active:d.visible&&U,near:d.near,replayKey:D,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Fe=(0,re.useCallback)((X,se=1)=>$===null||$===X?se:se*.38,[$]);return{p:n,width:s,height:l,measured:U,responsive:e.width===void 0,pending:ye&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:oe,fv:w,fmt:b,pct:T,locale:h,lang:f,t:f==="ko"?$r:vr,active:$,via:y,setActive:v,click:M,events:H,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Fe,sig:k,description:e.description,reduced:m,publish:_,applySync:x}}var ne=A(Z(),1);function Rs(e){return 1-Math.pow(1-e,3)}function Fs(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ps(e){return e==="easeInOut"?Fs:e==="linear"?t=>t:Rs}function _s(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 it(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function Yt(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 jo(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 Go(e,t,n,r){if(!t||!n||t.length!==n.length)return it(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let c of it(s,n[i]))o.push(c)}return o.length===r?o:it(e,r)}var Jt=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||!Yt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),jo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Yt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),c=r>0?Math.min(a*r,240):0;if(s){let l=i.to.length;s.from=Go(s.cur,s.parts,i.parts,l),s.vel=Go(s.curVel,s.parts,i.parts,l),s.parts=i.parts,s.to=i.to.slice(),jo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):c),s.done=Yt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let l=this.make(i,i.enter??i.from??i.to,n+c,0);l.done=Yt(l.from,l.to),this.tracks.set(i.key,l)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=it(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Ps(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let c=(t-s.t0)/1e3,l=s.to.length;if(s.from.length!==l&&(s.from=it(s.from,l)),s.vel.length!==l&&(s.vel=it(s.vel,l)),s.cur.length!==l&&(s.cur=new Array(l).fill(0),s.curVel=new Array(l).fill(0)),!(c>0)){for(let u=0;u<l;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*c),d=a*c>=8&&a*c<20,h=0;for(let f=0;f<l;f++){let b=s.from[f]-s.to[f],T=s.vel[f]+a*b;s.cur[f]=s.to[f]+(b+T*c)*u,s.curVel[f]=(s.vel[f]-a*T*c)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*c>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*c)*u)}else{let u=Math.min(1,c/o),d=r(u),h=_s(this.easing,u)/o;for(let f=0;f<l;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<l;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},bt=new Set,qt=0;function Vo(e){qt=0;let t=Array.from(bt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||bt.delete(n)}bt.size&&typeof requestAnimationFrame<"u"&&(qt=requestAnimationFrame(Vo))}function Zt(e){return bt.add(e),!qt&&typeof requestAnimationFrame<"u"&&(qt=requestAnimationFrame(Vo)),()=>{bt.delete(e)}}function Ds(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 Vn(e,t){let n=(0,ne.useMemo)(()=>Ds(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:c="spring",duration:l=900,stagger:m=0}=t,u=(0,ne.useRef)(null),d=(0,ne.useRef)("init"),h=(0,ne.useRef)(null),f=(0,ne.useRef)(s),b=(0,ne.useRef)(i),T=(0,ne.useRef)(!1),w=(0,ne.useRef)(0),[,k]=(0,ne.useState)(0),$=(0,ne.useRef)(null),P=(0,ne.useRef)(!0);u.current||(u.current=new Jt,u.current.configure(c,l),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(c,l),h.current!==n){let _=d.current,F=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||_==="init"?y.snap(n):_==="idle"?y.hold(n):_==="running"||F?y.update(n,St(),m):y.snap(n),h.current=n,f.current=s}let S=(0,ne.useRef)(()=>!1);S.current=_=>{if(!P.current)return!1;let F=y.step(_);return!F&&d.current==="running"&&(d.current="done"),k(v=>(v+1)%1e9),F||($.current=null),F};let H=(0,ne.useCallback)(()=>{if(!ye||$.current||!y.animating)return;let _=F=>S.current(F);$.current=Zt(_)},[y]);Ae(()=>{let _=!Object.is(b.current,i);if(b.current=i,!r){(d.current!=="done"||y.animating)&&(y.snap(h.current??n),d.current="done",k(F=>F+1));return}d.current==="init"||_&&a?(y.hold(h.current??n),d.current="idle",T.current=!1,k(F=>F+1)):_&&(T.current=!0)},[r,i]),Ae(()=>{!r||!a||!T.current||(T.current=!1,y.hold(h.current??n),d.current="idle",k(_=>_+1))},[a,r]),(0,ne.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(St()),w.current+=1,d.current="running",H(),k(_=>_+1))},[r,o,i,y,H]),(0,ne.useEffect)(()=>{y.animating&&H()}),(0,ne.useEffect)(()=>(P.current=!0,()=>{P.current=!1,$.current?.(),$.current=null}),[]);let I=St(),K=y.elapsed(I),V=r&&d.current==="idle";return{items:y.items(),get:_=>y.get(_),elapsed:V?0:K,fade:(_,F=320)=>V?0:Number.isFinite(K)?Math.max(0,Math.min(1,(K-_)/F)):1,waiting:V,animating:y.animating,generation:w.current}}var Wn=A(G(),1);function Ko(e,t,n,r,o){if(r)return o==="categorical"?ke(e,t,n):Rr(e,t,n);if(o==="categorical")return ke(e,t,n);let a=ae(e,"strong"),i=ae(e,"accent");return Array.from({length:t},(s,c)=>n.has(c)?i:a)}var Ls=A(Z(),1);var Kn=A(G(),1);var Uo=e=>e?"neutralStrong":"accent";var W=A(Z(),1);var j=A(G(),1),Es={kind:"Bar race chart",play:"Play",pause:"Pause",prev:"Previous frame",next:"Next frame",frame:"Frame",rank:"Rank",nth:e=>`${e}${e%100>=11&&e%100<=13?"th":["th","st","nd","rd"][e%10]??"th"}`,up:e=>`up ${xe(e,"place")}`,down:e=>`down ${xe(e,"place")}`,desc:(e,t,n,r)=>`${xe(e,"item")} ranked over ${xe(t,"frame")}, from ${n} to ${r}`,lead:(e,t,n)=>`At ${e}, ${t} leads with ${n}`},Is={en:Es,ko:{kind:"막대 레이스",play:"재생",pause:"멈춤",prev:"이전 시점",next:"다음 시점",frame:"시점",rank:"순위",nth:e=>`${e}위`,up:e=>`${e}계단 오름`,down:e=>`${e}계단 내림`,desc:(e,t,n,r)=>`항목 ${e}개의 순위, ${n}부터 ${r}까지 시점 ${t}개`,lead:(e,t,n)=>`${e} 1위 ${t}, ${n}`}},Re=4,Os=10,zs=1e3,Bs=18,Xo=24,Hs=18,js=8,Qt={play:["M6.75 12C6.75 8.81 6.75 7.214 7.725 6.544C7.822 6.477 7.925 6.417 8.032 6.366C9.1 5.857 10.482 6.655 13.245 8.25C16.008 9.845 17.389 10.642 17.483 11.821C17.493 11.94 17.493 12.06 17.483 12.179C17.389 13.358 16.008 14.155 13.245 15.75C10.482 17.345 9.1 18.143 8.032 17.634C7.925 17.583 7.822 17.523 7.725 17.456C6.75 16.786 6.75 15.19 6.75 12Z"],pause:["M6.75 5.25L8.25 5.25C8.957 5.25 9.311 5.25 9.53 5.47C9.75 5.689 9.75 6.043 9.75 6.75L9.75 17.25C9.75 17.957 9.75 18.311 9.53 18.53C9.311 18.75 8.957 18.75 8.25 18.75L6.75 18.75C6.043 18.75 5.689 18.75 5.47 18.53C5.25 18.311 5.25 17.957 5.25 17.25L5.25 6.75C5.25 6.043 5.25 5.689 5.47 5.47C5.689 5.25 6.043 5.25 6.75 5.25Z","M15.75 5.25L17.25 5.25C17.957 5.25 18.311 5.25 18.53 5.47C18.75 5.689 18.75 6.043 18.75 6.75L18.75 17.25C18.75 17.957 18.75 18.311 18.53 18.53C18.311 18.75 17.957 18.75 17.25 18.75L15.75 18.75C15.043 18.75 14.689 18.75 14.47 18.53C14.25 18.311 14.25 17.957 14.25 17.25L14.25 6.75C14.25 6.043 14.25 5.689 14.47 5.47C14.689 5.25 15.043 5.25 15.75 5.25Z"],prev:["M18.75 12C18.75 8.969 18.75 7.453 17.824 6.816C17.731 6.753 17.633 6.696 17.532 6.648C16.517 6.164 15.205 6.922 12.58 8.437C9.954 9.953 8.642 10.711 8.553 11.831C8.544 11.943 8.544 12.057 8.553 12.169C8.642 13.289 9.954 14.047 12.58 15.563C15.205 17.078 16.517 17.836 17.532 17.352C17.633 17.304 17.731 17.247 17.824 17.184C18.75 16.547 18.75 15.031 18.75 12Z","M5.25 6.75V17.25"],next:["M5.25 12C5.25 8.969 5.25 7.453 6.176 6.816C6.269 6.753 6.367 6.696 6.468 6.648C7.483 6.164 8.795 6.922 11.42 8.437C14.046 9.953 15.358 10.711 15.447 11.831C15.456 11.943 15.456 12.057 15.447 12.169C15.358 13.289 14.046 14.047 11.421 15.563C8.795 17.078 7.483 17.836 6.468 17.352C6.367 17.304 6.269 17.247 6.176 17.184C5.25 16.547 5.25 15.031 5.25 12Z","M18.75 6.75V17.25"]};function Gs(e,t){if(t==null||t==="")return-1;if(e.type!=="band"){let o=zn(e.type,t),a=Number.isFinite(o)?e.xnum.indexOf(o):-1;if(a>=0)return a}let n=String(t),r=e.keys.indexOf(n);return r>=0?r:e.labels.indexOf(n)}function Xn(e){let t=le(e.locale),n=(0,W.useMemo)(()=>{let p=Ue(e.data,e.frame??"frame",e.value??"value",e.label??"label",{locale:t,aggregate:e.aggregate??"sum"});if(p.type==="date"&&new Set(p.labels).size<p.labels.length){let R=p.xnum.every(O=>new Date(O).getDate()===1),L=new Intl.DateTimeFormat(t,R?{year:"numeric",month:"short"}:{year:"numeric",month:"short",day:"numeric"});return{...p,labels:p.xnum.map(O=>L.format(O))}}return p},[e.data,e.frame,e.value,e.label,e.aggregate,t]),r=n.keys.length,o=n.series.length,a=Math.max(0,r-1),i=(0,W.useMemo)(()=>{let p=new Map;return R=>{let L=p.get(R);if(L)return L;p.size>=4&&p.clear();let O=[],E=new Int32Array(o);if(R>=0&&R<r)for(let C=0;C<o;C++)n.series[C]!==""&&Number.isFinite(n.values[C][R])&&O.push(C);return O.sort((C,z)=>n.values[z][R]-n.values[C][R]||C-z),O.forEach((C,z)=>E[C]=z+1),L={order:O,pos:E},p.set(R,L),L}},[n,r,o]),s=(0,W.useMemo)(()=>{let p=0,R=0,L=0,O=!0;for(let E=0;E<r;E++){let C=0;for(let z=0;z<o;z++){let B=n.values[z][E];!Number.isFinite(B)||n.series[z]===""||(C++,B>R&&(R=B),B<L&&(L=B),O&&!Number.isInteger(B)&&(O=!1))}p=Math.max(p,C)}return{most:p,hi:R,lo:L,ints:O}},[n,r,o]),c=typeof e.top=="number"&&e.top>=1?Math.min(50,Math.round(e.top)):Os,l=Math.max(1,Math.min(c,s.most)),m=typeof e.stepMs=="number"&&e.stepMs>0?Le(e.stepMs,100,6e4):zs,u=(0,W.useMemo)(()=>et(_e(e.format,t),e.unit),[e.format,t,e.unit]),d=(0,W.useMemo)(()=>{let p=Array.from({length:l},()=>[]),R=new Float64Array(r),L=new Float64Array(r),O=(C,z,B,ee,Y)=>{let q=(Math.max(0,B)-R[ee])/(L[ee]-R[ee]),ue=ce(u(B),11,700);for(let ge=C;ge<=z;ge++)p[ge].push(q,ue,Y?1:0)},E=(C,z)=>C.pos[z]&&C.pos[z]<=l?C.pos[z]-1:l;for(let C=0;C<r;C++){let z=i(C),B=C?i(C-1):null;for(let Y of z.order.slice(0,l))R[C]=Math.min(R[C],n.values[Y][C]),L[C]=Math.max(L[C],n.values[Y][C]);L[C]===R[C]&&(L[C]=R[C]+1);let ee=new Set([...z.order.slice(0,l),...B?B.order.slice(0,l):[]]);for(let Y of ee){let q=E(z,Y),ue=B?E(B,Y):q,ge=Math.min(ue,q),Je=Math.min(l-1,Math.max(ue,q)),Mt=q<l?!!(B&&B.pos[Y]&&B.pos[Y]!==z.pos[Y]):!0;B&&O(ge,Je,ue<l?n.values[Y][C-1]:n.values[Y][C],C-1,Mt),O(ge,Je,q<l?n.values[Y][C]:n.values[Y][C-1],C,Mt)}}return p},[i,n,r,l,u]),h=(0,W.useMemo)(()=>Math.max(0,...n.series.slice(0,2e3).map(p=>ce(p,1,800))),[n]),f=(0,W.useMemo)(()=>Math.max(0,...Array.from(n.labels,p=>ce(p,1,800))),[n]),b=e.showLabels!==!1,T=e.height,w=(0,W.useMemo)(()=>{let p=(O,E)=>{let C=Math.max(1,E/l),z=C>=12,B=C>=22?11.5:10.5,ee=b&&z,Y=Math.min(O*.3,Math.max(20,h*B)+10),q=ee?Math.max(ce(u(s.hi),11,700),ce(u(s.lo),11,700))+8:0,ue=ee&&r>1?ce(String(o),10,700)+18:0,ge=Y+6,Je=Math.max(ge+1,O-q-ue-4);return{plotH:E,rowH:C,showText:z,nameSize:B,showValues:ee,nameW:Y,markW:ue,x0:ge,x1:Je}},R=(O,E)=>{let C=B=>{let ee=0,Y=d[B];for(let q=0;q<Y.length;q+=3)ee=Math.max(ee,E.x0+Y[q]*(E.x1-E.x0)+(E.showValues?6+Y[q+1]+(Y[q+2]?E.markW:0):0));return ee},z=Math.min(72,E.plotH*.3,(E.x1-E.x0)*.6/Math.max(.1,f));for(let B=z;B>=Bs;B-=2){let ee=O-2-f*B-js,Y=Math.max(0,Math.floor((E.plotH-B*.82)/E.rowH)),q=!0;for(let ue=Y;ue<l&&q;ue++)q=C(ue)<=ee;if(q)return B}return 0},L=new Map;return(O,E)=>{let C=`${O}|${E}`,z=L.get(C);if(z)return z;let B=E===void 0?l*(O<400?26:30):Math.max(1,E-Re*2),ee=p(O,B),Y=f>0&&o?R(O,ee):0;return z=Y||!f||!o?{...ee,band:0,label:Y}:{...p(O,E===void 0?B:Math.max(1,B-Xo)),band:Xo,label:Hs},L.size>8&&L.clear(),L.set(C,z),z}},[d,l,r,o,h,f,b,u,s.hi,s.lo]),k=Ho(e,{height:p=>{let R=w(p);return R.plotH+Re*2+R.band},duration:700,stagger:40}),{p:$,width:P,height:y}=k,S=Is[k.lang],H=(0,W.useId)().replace(/:/g,""),I=(0,W.useMemo)(()=>{let p=Gs(n,e.startFrame);return p>=0?p:a},[n,e.startFrame,a]),[K,V]=(0,W.useState)(I),[_,F]=(0,W.useState)(I);_!==I&&(F(I),V(I));let v=Math.min(K,a),[x,M]=(0,W.useState)(!1),D=r>1&&!k.reduced,U=(0,W.useRef)("step"),oe=(0,W.useRef)(v);oe.current=v;let Fe=(0,W.useRef)(!1),X=(p,R)=>{U.current=R,oe.current=p,V(p)},se=k.motion.active;(0,W.useEffect)(()=>{if(!x||!D||!se)return;let p=0,R=0,L=null,O=C=>{if(R+=p?Math.min(C-p,m):0,p=C,R<m)return!0;R=0;let z=oe.current+1;return X(Math.min(z,a),"play"),z>=a&&M(!1),!0},E=()=>{L?.(),L=null,p=0,document.hidden||(L=Zt(O))};return E(),document.addEventListener("visibilitychange",E),()=>{L?.(),document.removeEventListener("visibilitychange",E)}},[x,D,se,m,a]);let he=(0,W.useRef)(!1);(0,W.useEffect)(()=>{!e.autoplay||he.current||!D||!k.motion.enabled||!se||(he.current=!0,e.startFrame===void 0&&X(0,"step"),M(!0))},[e.autoplay,e.startFrame,D,k.motion.enabled,se]);let Ce=()=>{if(x)return M(!1);Fe.current=!1,oe.current>=a&&X(0,"step"),M(!0)},st=(p,R=!1)=>{M(!1),Fe.current=!0;let L=Le(p,0,a);if(R&&k.active!==null){let O=Se[k.active]?.s,E=O===void 0?-1:i(L).order.slice(0,l).indexOf(O);k.setActive(E>=0?E:null,"keyboard")}L!==oe.current&&X(L,"step")},Ie=i(v),en=i(v-1),Qn=p=>en.pos[p]&&Ie.pos[p]?en.pos[p]-Ie.pos[p]:0,Se=(0,W.useMemo)(()=>Ie.order.slice(0,l).map((p,R)=>({s:p,slot:R,value:n.values[p][v],move:Qn(p)})),[Ie,en,l,n,v]),je=0,Ge=0;for(let p of Se)je=Math.min(je,p.value),Ge=Math.max(Ge,p.value);Ge===je&&(Ge=je+1);let Xe=(0,W.useMemo)(()=>{let p=n.rows.map(R=>R.findLast(L=>L!==null)??null);return Te(e.highlight,p,n.series,n.series.map((R,L)=>n.values[L][a]),"max")},[n,e.highlight,a]),er=(0,W.useMemo)(()=>Rt($,o,Xe),[$,o,Xe]),tr=U.current==="play",nr={...k.motion,dataKey:`${k.sig}|${v}`,stagger:0,duration:e.duration??(tr?m:700),easing:e.easing??(tr?"linear":k.motion.easing)},rr=k.motion.stagger??40,ga=(0,W.useMemo)(()=>Se.map(p=>({key:`r:${n.series[p.s]}`,to:[p.value,p.slot],from:[0,p.slot],enter:[p.value,l],exit:[p.value,l],delay:p.slot*rr,data:p})),[Se,n,l,rr]),pa=Vn(ga,nr),ba=(0,W.useMemo)(()=>[{key:"d",to:[je,Ge],data:null}],[je,Ge]),ya=Vn(ba,nr),[tn,or]=ya.get("d")??[je,Ge],xt=w(P,T===void 0?void 0:y),{plotH:kt,rowH:wt,showText:xa,nameSize:nn,showValues:ar,nameW:rn,x0:ir,x1:ka}=xt,lt=Math.max(1,wt*.7),{fv:Ve}=k,wa=(0,W.useMemo)(()=>n.series.map((p,R)=>Dn(p,rn-4,nn,Xe.has(R)?800:500)),[n,rn,nn,Xe]),va=or-tn>0?or-tn:1,Ye=p=>ir+(p-tn)/va*(ka-ir),sr=p=>Re+p*wt+(wt-lt)/2,vt=Math.min($.theme.radiusMark,lt/2),on=S.nth,an=p=>p>0?S.up(p):S.down(-p),lr=(0,W.useMemo)(()=>Se.map(p=>({datum:n.rows[p.s][v],index:p.slot,key:n.series[p.s],label:n.series[p.s],value:p.value,formatted:`${Ve(p.value)}, ${on(p.slot+1)}${p.move?`, ${an(p.move)}`:""}`})),[Se,n,v,Ve,S]),ct=n.labels[v]??"",cr=p=>{let R=Qn(p);return`${ct}, ${n.series[p]}, ${on(Ie.pos[p])}, ${Ve(n.values[p][v])}${R?`, ${an(R)}`:""}`},ur=[...Xe].find(p=>Ie.pos[p]>0)??Ie.order[0],$a=k.via==="keyboard"&&k.active!==null&&Se[k.active]?cr(Se[k.active].s):Fe.current&&!x&&ur!==void 0?cr(ur):"",sn=Se[0],Ma=e.description??(sn?`${S.kind}. ${S.desc(Ie.order.length,r,n.labels[0],n.labels[a])}. ${S.lead(ct,n.series[sn.s],Ve(sn.value))}.`:""),Pe=k.active!==null?Se[k.active]:void 0,Ta=Pe?{x:Ye(Math.max(0,Pe.value)),y:sr(Pe.slot),title:n.series[Pe.s],rows:[{label:ct,value:Ve(Pe.value),color:er[Pe.s].fill},{label:S.rank,value:`${on(Pe.slot+1)}${Pe.move?` (${an(Pe.move)})`:""}`,strong:!1}]}:null,$t=xt.label,Ca=xt.band?Re+kt+Re+xt.band-7:Re+kt-$t*.08,Sa=k.reduced&&k.hydrated;return(0,j.jsxs)(Ur,{c:k,kind:S.kind,ariaLabel:e.ariaLabel,description:Ma,events:lr,tip:Ta,renderTip:e.tooltip,announce:$a,className:e.className,style:e.style,theme:e.theme,onPointerMove:(p,R,L)=>{let O=Math.floor((R-Re)/wt);k.setActive(O>=0&&O<lr.length?O:null,L.pointerType==="touch"?"touch":"pointer")},onKey:p=>(p.key==="ArrowLeft"||p.key==="ArrowRight")&&r>1?(st(oe.current+(p.key==="ArrowRight"?1:-1),!0),!0):p.key===" "&&D?(Ce(),!0):!1,defs:(0,j.jsx)("clipPath",{id:`${H}c`,children:(0,j.jsx)("rect",{x:0,y:0,width:P,height:kt+Re*2})}),overlay:r>1&&o?(0,j.jsx)(Ws,{p:$,msg:S,frame:v,last:a,labels:n.labels,playing:x,stepOnly:Sa,canPlay:D,narrow:P<340,onToggle:Ce,onStep:st}):null,children:[o&&ct&&$t?(0,j.jsx)(ft,{x:P-2,y:Ca,anchor:"end",baseline:"auto",size:$t,weight:800,fill:$.paint("dim"),opacity:.45,letterSpacing:-$t*.03,children:ct}):null,s.lo<0?(0,j.jsx)("line",{x1:Ye(0),x2:Ye(0),y1:Re,y2:Re+kt,stroke:$.paint("line"),strokeWidth:1}):null,(0,j.jsx)("g",{clipPath:`url(#${H}c)`,children:pa.items.map(p=>{let R=p.data;if(p.exiting&&p.key!==`r:${n.series[R.s]}`)return null;let[L,O]=p.v,E=sr(O),C=Ye(Math.min(0,L)),z=Ye(Math.max(0,L)),B=Xe.has(R.s),ee=!p.exiting&&k.active===R.slot,q=Le(l-O,0,1)*(k.active===null||ee?1:.55),ue=Ve(p.progress>=1?R.value:s.ints?Math.round(L):L),ge=(L<0?Ye(0):z)+6,Je=B?800:500,Mt=$.paint(B?"ink":"muted"),ln=E+lt/2;return(0,j.jsxs)("g",{opacity:q<1?q:void 0,children:[(0,j.jsx)("path",{d:_n(C,E,z-C,lt,L<0?{tl:vt,bl:vt}:{tr:vt,br:vt}),fill:er[R.s].fill,className:"ztd-mark"}),ee&&k.via==="keyboard"?(0,j.jsx)("path",{d:_n(C-2,E-2,z-C+4,lt+4,4),fill:"none",stroke:$.paint("ink"),strokeWidth:2}):null,xa?(0,j.jsx)(ft,{x:rn,y:ln,anchor:"end",size:nn,weight:Je,fill:Mt,children:wa[R.s]}):null,ar?(0,j.jsx)(ft,{x:ge,y:ln,size:11,weight:B?800:700,fill:$.paint("ink"),children:ue}):null,ar&&R.move?(0,j.jsx)(Vs,{p:$,x:ge+ce(Ve(R.value),11,700)+6,y:ln,move:R.move}):null]},p.key)})})]})}function Vs({p:e,x:t,y:n,move:r}){let o=r>0,a=e.paint(o?"accentText":"muted");return(0,j.jsxs)("g",{"aria-hidden":"true",children:[(0,j.jsx)("path",{d:o?`M${t},${n+3}h7l-3.5,-6z`:`M${t},${n-3}h7l-3.5,6z`,fill:a}),(0,j.jsx)(ft,{x:t+9,y:n,size:10,weight:700,fill:a,children:Math.abs(r)})]})}function Un({d:e}){return(0,j.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.map((t,n)=>(0,j.jsx)("path",{d:t},n))})}function Ws(e){let{p:t,msg:n,frame:r,last:o}=e,a=(0,W.useRef)(null),i={background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},s={fontSize:11,color:t.paint("muted"),whiteSpace:"nowrap",flex:"none",fontVariantNumeric:"tabular-nums"},c=u=>{let d=a.current?.getBoundingClientRect();if(!d||!d.width)return;let h=Math.round(Le((u.clientX-d.left)/d.width,0,1)*o);h!==r&&e.onStep(h)},l=u=>{let d=Math.max(1,Math.round((o+1)/10)),h={ArrowLeft:r-1,ArrowDown:r-1,ArrowRight:r+1,ArrowUp:r+1,PageDown:r-d,PageUp:r+d,Home:0,End:o};u.key in h&&(u.preventDefault(),e.onStep(h[u.key]))},m=o?r/o*100:0;return(0,j.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:8},children:[e.stepOnly?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":n.prev,title:n.prev,disabled:r<=0,onClick:()=>e.onStep(r-1),style:{...i,opacity:r<=0?.4:void 0},children:(0,j.jsx)(Un,{d:Qt.prev})}),(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":n.next,title:n.next,disabled:r>=o,onClick:()=>e.onStep(r+1),style:{...i,opacity:r>=o?.4:void 0},children:(0,j.jsx)(Un,{d:Qt.next})})]}):(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":e.playing?n.pause:n.play,title:e.playing?n.pause:n.play,disabled:!e.canPlay,onClick:e.onToggle,style:i,children:(0,j.jsx)(Un,{d:e.playing?Qt.pause:Qt.play})}),e.narrow?null:(0,j.jsx)("span",{style:s,children:e.labels[0]}),(0,j.jsxs)("div",{ref:a,role:"slider",tabIndex:0,className:"ztd-btn","aria-label":n.frame,"aria-valuemin":0,"aria-valuemax":o,"aria-valuenow":r,"aria-valuetext":e.labels[r],onKeyDown:l,onPointerDown:u=>{u.currentTarget.setPointerCapture?.(u.pointerId),c(u)},onPointerMove:u=>{u.currentTarget.hasPointerCapture?.(u.pointerId)&&c(u)},style:{position:"relative",flex:1,minWidth:60,height:28,touchAction:"none",borderRadius:14},children:[(0,j.jsx)("span",{style:{position:"absolute",left:0,right:0,top:12,height:4,borderRadius:2,background:t.paint("line")}}),(0,j.jsx)("span",{style:{position:"absolute",left:0,width:`${m}%`,top:12,height:4,borderRadius:2,background:t.paint("accent")}}),(0,j.jsx)("span",{style:{position:"absolute",left:`calc(${m}% - 7px)`,top:7,width:14,height:14,boxSizing:"border-box",borderRadius:7,border:`2px solid ${t.paint("accent")}`,background:t.paint("panel")}})]}),e.narrow?null:(0,j.jsx)("span",{style:s,children:e.labels[o]})]})}var Yn=A(G(),1);function Yo(e,t,n,r){if(typeof e!="function")return Te(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let c=o.get(r(i,s));c!==void 0&&e(i,s)&&a.add(c)}),a}var Ks=A(Z(),1);var qn=A(G(),1),Us={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}, ${xe(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Jo={en:Us,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}일 이동평균`}},Jn=["ink","muted","dim"];function qo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Jn.length)}var Xs=A(Z(),1);var na=A(G(),1),Ys={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${xe(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Js={en:Ys,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Zo=(e,t)=>Js[e].other(t);function Qo(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,lo(o.map(a=>a.value)))}}var ea=e=>Number.isFinite(e)&&e>0?e:0;function ta(e,t,n,r){return r==="emphasis"?Rt(e,t,n):ke(e,t,n)}var qs=A(Z(),1);var ia=A(G(),1);function ra(e,t){return t===!1?e.map((n,r)=>r):so(e)}function oa(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Te(e,t,t,r,"max")}function aa(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=ae(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?ae(e,"neutral"):Nt(e,1-i/Math.max(1,o.length-1))),r}function sa(e){return!e||typeof e!="object"||Array.isArray(e)?[]:$e(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function la(e,t){return mt(e,t+1,new Set)}var Zs=A(Z(),1);var ua=A(G(),1);function ca(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!No.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Ee=A(G(),1);function ma(e,t,n){let r=Ht(e);return r?.type==="scatter"&&t?.size!==void 0&&!Bt(n)?Ht("bubble"):r}function Qs(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 el(e,t,n,r=!1){let o=ma(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,c=new Set(!r&&Nn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),l=u=>u.filter(d=>!c.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=De(a.label,"label"),d=jt(a.value,"value"),h=o.type==="waffle",f=t.map((y,S)=>({r:y,label:u(y,S),value:h?d(y,S):ea(d(y,S))})),{kept:b,other:T}=h?{kept:f,other:null}:Qo(f,i.other,(y,S)=>({r:{},label:Zo(te(n),y),value:S})),w=Te(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),h?"first":"max"),k=T?[...b,T]:b,$=ze(y=>h?ke(y,k.length,w):ta(y,k.length,w,i.colorMode)),P=h&&i.shape==="arc";return k.map((y,S)=>({label:y.label,color:$[S],...P&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=qo(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Jo[te(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:Jn[f],shape:"line"}))]}if(o.type==="network"){let u=sa(i.groups);if(u.length<2)return[];let d=ze(h=>la(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=De(a.group,"group"),d=$e(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=ze(f=>mt(f,d.length,new Set));return d.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Bt(i))return[];let u=De(a.series,"series"),d=$e(t.map((b,T)=>u(b,T)));if(d.length<2)return[];let h=Yo(s,t,d,u),f=ze(b=>mt(b,d.length,h));return l(d.map((b,T)=>({label:b,color:f[T],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let h=zo(t,d,u),f=ze(b=>ke(b,h.length,ca(s,h)));return l(h.map((b,T)=>({label:b,color:f[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let $=De(a.series,"series");u=$e(t.map((P,y)=>$(P,y)))}let d=Rn(o.type,a,i);if(d.length){let $=Te(s,u,u,u.map(()=>0),"none"),P=ze(S=>ke(S,u.length,$)),y=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((S,H)=>({label:S,color:P[H]}));return[...l(y),...d.map((S,H)=>({label:S,color:Uo(H),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?io(u.length,Array.isArray(i.negative)?i.negative.map($=>u.indexOf(String($))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,b=f>=0?new Set([f]):Te(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return l(u.map(($,P)=>({label:$,color:b.has(P)?"accent":"neutralStrong",shape:"square"})));let T=i.colorMode,w=$=>ke($,u.length,b);if((o.type==="line"||o.type==="area")&&(w=$=>Ko($,u.length,b,o.type==="area",T)),o.type==="stream"){let $=Ue(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),P=ra($.values,i.reorder),y=oa(s,$.series,$.values);w=S=>aa(S,P,y)}let k=ze(w);return l(u.map(($,P)=>({label:$,color:k[P],...o.type==="line"&&{shape:"line"}})))}return[]}function tl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Zr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function nl(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:c,description:l,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:c,description:l}}function da(e,t){let{spec:n}=e,r=ma(n.type,n.encoding,n.options),o=(0,yt.useMemo)(()=>Bo(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=qr(n,e.locale),s=le(i),c=te(s),l=Ro(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=to(n),u=(0,yt.useMemo)(()=>m?Io(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,T]=(0,yt.useState)(null);if(!r)return(0,Ee.jsx)(An,{error:c==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let w=o??l.data,k=t[r.type],$={...n.options??{}},P={...Qs(r,n.encoding),...$,...u?{tooltip:u}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},y=n.card?.legend==="toggle"&&eo(r.type,n.encoding??{},$),S=b&&b.base===f?b.hidden:h;y&&(P.hidden=S);let H=F=>T(v=>{let x=v&&v.base===f?v.hidden:h;return{base:f,hidden:x.includes(F)?x.filter(M=>M!==F):[...x,F]}}),I=P.height??220,K=tl(n,r.type),V=a&&!w.length&&(l.loading||l.error||l.empty)?(0,Ee.jsx)(An,{loading:l.loading,error:l.error,empty:l.empty,onRetry:l.reload,height:I,locale:i}):K?(0,Ee.jsx)(Ao,{chart:k,...nl(r.type,K,P)}):(0,Ee.jsx)(k,{...P});if(n.card){let F=n.card,v=F.legend==="auto"||F.legend==="toggle"?el(n,w,s,y):F.legend,x=v?.length?y?(0,Ee.jsx)(Sn,{items:v,hidden:S,onToggle:H,locale:i}):v:void 0,M=F.download?(0,Ee.jsx)(Eo,{data:w,columns:no(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;V=(0,Ee.jsx)(Kr,{number:F.number,title:F.title??Jr(r,c),subtitle:F.subtitle,legend:x,actions:M,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:V})}let _=e.theme??n.theme;return _&&(V=(0,Ee.jsx)(Lt,{theme:_,children:V})),V}function rl({cfg:e,components:t}){let n=ot();return da({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ha(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,fa.hydrateRoot)(r,(0,Zn.createElement)(Lt,{theme:o.theme,cssVars:!0},(0,Zn.createElement)(rl,{cfg:o,components:{[e]:t}})))}ha("barRace",Xn);})();
|
|
28
|
+
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?dt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let c=!1,l=s.replace(zr,(m,u)=>o(a,u.trim())??(c=!0,""));c||i.push(l)}return i.length?i.map((s,c)=>(0,Oo.jsx)("div",{children:s},c)):null}}function zo(e,t,n=!1){let r=De(t,"group"),o=e.map((s,c)=>r(s,c)).filter(Boolean),a=$e(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,c)=>[s,c]).sort((s,c)=>i.get(s[0])-i.get(c[0])||s[1]-c[1]).map(([s])=>s)}function Bo(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 Ke(t.csv)}return null}var Wo=A(Z(),1);var re=A(Z(),1);function Ho(e,t){let n=ve(e.theme),[r,o,a]=Ut(e.width),i=ot(),s=e.width??(a||t.ssrWidth||480),c=typeof t.height=="function"?t.height(s):t.height,l=e.height??c,m=Xt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,d=So(r,e.animateOnView!==!1&&u),h=le(e.locale),f=te(h),b=(0,re.useMemo)(()=>_e(e.format,h,t.format),[e.format,h,t.format]),T=(0,re.useCallback)(X=>Ft(X,{locale:h}),[h]),w=(0,re.useMemo)(()=>et(b,e.unit),[b,e.unit]),k=(0,re.useMemo)(()=>Gt(e.data),[e.data]),[$,P]=(0,re.useState)(null),[y,S]=(0,re.useState)(null),H=(0,re.useRef)([]),I=(0,re.useRef)(e.onHover);I.current=e.onHover;let K=(0,re.useRef)(e.onClick);K.current=e.onClick;let V=(0,re.useRef)(null),_=(0,re.useRef)(null),F=(0,re.useRef)(null),v=(0,re.useCallback)((X,se="pointer")=>{if(F.current!==X){F.current=X;let he=X===null?null:H.current[X]??null;queueMicrotask(()=>I.current?.(he)),_.current?.(X)}V.current=X===null?null:se,P(X),S(V.current)},[]),x=(0,re.useCallback)(X=>{V.current!=="keyboard"&&(V.current=X===null?null:"sync",P(X),S(V.current))},[]),M=(0,re.useCallback)(X=>{let se=H.current[X];se&&K.current?.(se)},[]),D=Wr(e.replayKey),U=e.width!==void 0||(a??0)>0,oe={enabled:u,active:d.visible&&U,near:d.near,replayKey:D,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Fe=(0,re.useCallback)((X,se=1)=>$===null||$===X?se:se*.38,[$]);return{p:n,width:s,height:l,measured:U,responsive:e.width===void 0,pending:ye&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:oe,fv:w,fmt:b,pct:T,locale:h,lang:f,t:f==="ko"?$r:vr,active:$,via:y,setActive:v,click:M,events:H,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Fe,sig:k,description:e.description,reduced:m,publish:_,applySync:x}}var ne=A(Z(),1);function Rs(e){return 1-Math.pow(1-e,3)}function Fs(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ps(e){return e==="easeInOut"?Fs:e==="linear"?t=>t:Rs}function _s(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 it(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function Yt(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 jo(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 Go(e,t,n,r){if(!t||!n||t.length!==n.length)return it(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let c of it(s,n[i]))o.push(c)}return o.length===r?o:it(e,r)}var Jt=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||!Yt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),jo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Yt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),c=r>0?Math.min(a*r,240):0;if(s){let l=i.to.length;s.from=Go(s.cur,s.parts,i.parts,l),s.vel=Go(s.curVel,s.parts,i.parts,l),s.parts=i.parts,s.to=i.to.slice(),jo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):c),s.done=Yt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let l=this.make(i,i.enter??i.from??i.to,n+c,0);l.done=Yt(l.from,l.to),this.tracks.set(i.key,l)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=it(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Ps(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let c=(t-s.t0)/1e3,l=s.to.length;if(s.from.length!==l&&(s.from=it(s.from,l)),s.vel.length!==l&&(s.vel=it(s.vel,l)),s.cur.length!==l&&(s.cur=new Array(l).fill(0),s.curVel=new Array(l).fill(0)),!(c>0)){for(let u=0;u<l;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*c),d=a*c>=8&&a*c<20,h=0;for(let f=0;f<l;f++){let b=s.from[f]-s.to[f],T=s.vel[f]+a*b;s.cur[f]=s.to[f]+(b+T*c)*u,s.curVel[f]=(s.vel[f]-a*T*c)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*c>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*c)*u)}else{let u=Math.min(1,c/o),d=r(u),h=_s(this.easing,u)/o;for(let f=0;f<l;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<l;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},bt=new Set,qt=0;function Vo(e){qt=0;let t=Array.from(bt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||bt.delete(n)}bt.size&&typeof requestAnimationFrame<"u"&&(qt=requestAnimationFrame(Vo))}function Zt(e){return bt.add(e),!qt&&typeof requestAnimationFrame<"u"&&(qt=requestAnimationFrame(Vo)),()=>{bt.delete(e)}}function Ds(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 Vn(e,t){let n=(0,ne.useMemo)(()=>Ds(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:c="spring",duration:l=900,stagger:m=0}=t,u=(0,ne.useRef)(null),d=(0,ne.useRef)("init"),h=(0,ne.useRef)(null),f=(0,ne.useRef)(s),b=(0,ne.useRef)(i),T=(0,ne.useRef)(!1),w=(0,ne.useRef)(0),[,k]=(0,ne.useState)(0),$=(0,ne.useRef)(null),P=(0,ne.useRef)(!0);u.current||(u.current=new Jt,u.current.configure(c,l),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(c,l),h.current!==n){let _=d.current,F=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||_==="init"?y.snap(n):_==="idle"?y.hold(n):_==="running"||F?y.update(n,St(),m):y.snap(n),h.current=n,f.current=s}let S=(0,ne.useRef)(()=>!1);S.current=_=>{if(!P.current)return!1;let F=y.step(_);return!F&&d.current==="running"&&(d.current="done"),k(v=>(v+1)%1e9),F||($.current=null),F};let H=(0,ne.useCallback)(()=>{if(!ye||$.current||!y.animating)return;let _=F=>S.current(F);$.current=Zt(_)},[y]);Ae(()=>{let _=!Object.is(b.current,i);if(b.current=i,!r){(d.current!=="done"||y.animating)&&(y.snap(h.current??n),d.current="done",k(F=>F+1));return}d.current==="init"||_&&a?(y.hold(h.current??n),d.current="idle",T.current=!1,k(F=>F+1)):_&&(T.current=!0)},[r,i]),Ae(()=>{!r||!a||!T.current||(T.current=!1,y.hold(h.current??n),d.current="idle",k(_=>_+1))},[a,r]),(0,ne.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(St()),w.current+=1,d.current="running",H(),k(_=>_+1))},[r,o,i,y,H]),(0,ne.useEffect)(()=>{y.animating&&H()}),(0,ne.useEffect)(()=>(P.current=!0,()=>{P.current=!1,$.current?.(),$.current=null}),[]);let I=St(),K=y.elapsed(I),V=r&&d.current==="idle";return{items:y.items(),get:_=>y.get(_),elapsed:V?0:K,fade:(_,F=320)=>V?0:Number.isFinite(K)?Math.max(0,Math.min(1,(K-_)/F)):1,waiting:V,animating:y.animating,generation:w.current}}var Wn=A(G(),1);function Ko(e,t,n,r,o){if(r)return o==="categorical"?ke(e,t,n):Rr(e,t,n);if(o==="categorical")return ke(e,t,n);let a=ae(e,"strong"),i=ae(e,"accent");return Array.from({length:t},(s,c)=>n.has(c)?i:a)}var Ls=A(Z(),1);var Kn=A(G(),1);var Uo=e=>e?"neutralStrong":"accent";var W=A(Z(),1);var j=A(G(),1),Es={kind:"Bar race chart",play:"Play",pause:"Pause",prev:"Previous frame",next:"Next frame",frame:"Frame",rank:"Rank",nth:e=>`${e}${e%100>=11&&e%100<=13?"th":["th","st","nd","rd"][e%10]??"th"}`,up:e=>`up ${xe(e,"place")}`,down:e=>`down ${xe(e,"place")}`,desc:(e,t,n,r)=>`${xe(e,"item")} ranked over ${xe(t,"frame")}, from ${n} to ${r}`,lead:(e,t,n)=>`At ${e}, ${t} leads with ${n}`},Is={en:Es,ko:{kind:"막대 레이스",play:"재생",pause:"멈춤",prev:"이전 시점",next:"다음 시점",frame:"시점",rank:"순위",nth:e=>`${e}위`,up:e=>`${e}계단 오름`,down:e=>`${e}계단 내림`,desc:(e,t,n,r)=>`항목 ${e}개의 순위, ${n}부터 ${r}까지 시점 ${t}개`,lead:(e,t,n)=>`${e} 1위 ${t}, ${n}`}},Re=4,Os=10,zs=1e3,Bs=18,Xo=24,Hs=18,js=8,Qt={play:["M6.75 12C6.75 8.81 6.75 7.214 7.725 6.544C7.822 6.477 7.925 6.417 8.032 6.366C9.1 5.857 10.482 6.655 13.245 8.25C16.008 9.845 17.389 10.642 17.483 11.821C17.493 11.94 17.493 12.06 17.483 12.179C17.389 13.358 16.008 14.155 13.245 15.75C10.482 17.345 9.1 18.143 8.032 17.634C7.925 17.583 7.822 17.523 7.725 17.456C6.75 16.786 6.75 15.19 6.75 12Z"],pause:["M6.75 5.25L8.25 5.25C8.957 5.25 9.311 5.25 9.53 5.47C9.75 5.689 9.75 6.043 9.75 6.75L9.75 17.25C9.75 17.957 9.75 18.311 9.53 18.53C9.311 18.75 8.957 18.75 8.25 18.75L6.75 18.75C6.043 18.75 5.689 18.75 5.47 18.53C5.25 18.311 5.25 17.957 5.25 17.25L5.25 6.75C5.25 6.043 5.25 5.689 5.47 5.47C5.689 5.25 6.043 5.25 6.75 5.25Z","M15.75 5.25L17.25 5.25C17.957 5.25 18.311 5.25 18.53 5.47C18.75 5.689 18.75 6.043 18.75 6.75L18.75 17.25C18.75 17.957 18.75 18.311 18.53 18.53C18.311 18.75 17.957 18.75 17.25 18.75L15.75 18.75C15.043 18.75 14.689 18.75 14.47 18.53C14.25 18.311 14.25 17.957 14.25 17.25L14.25 6.75C14.25 6.043 14.25 5.689 14.47 5.47C14.689 5.25 15.043 5.25 15.75 5.25Z"],prev:["M18.75 12C18.75 8.969 18.75 7.453 17.824 6.816C17.731 6.753 17.633 6.696 17.532 6.648C16.517 6.164 15.205 6.922 12.58 8.437C9.954 9.953 8.642 10.711 8.553 11.831C8.544 11.943 8.544 12.057 8.553 12.169C8.642 13.289 9.954 14.047 12.58 15.563C15.205 17.078 16.517 17.836 17.532 17.352C17.633 17.304 17.731 17.247 17.824 17.184C18.75 16.547 18.75 15.031 18.75 12Z","M5.25 6.75V17.25"],next:["M5.25 12C5.25 8.969 5.25 7.453 6.176 6.816C6.269 6.753 6.367 6.696 6.468 6.648C7.483 6.164 8.795 6.922 11.42 8.437C14.046 9.953 15.358 10.711 15.447 11.831C15.456 11.943 15.456 12.057 15.447 12.169C15.358 13.289 14.046 14.047 11.421 15.563C8.795 17.078 7.483 17.836 6.468 17.352C6.367 17.304 6.269 17.247 6.176 17.184C5.25 16.547 5.25 15.031 5.25 12Z","M18.75 6.75V17.25"]};function Gs(e,t){if(t==null||t==="")return-1;if(e.type!=="band"){let o=zn(e.type,t),a=Number.isFinite(o)?e.xnum.indexOf(o):-1;if(a>=0)return a}let n=String(t),r=e.keys.indexOf(n);return r>=0?r:e.labels.indexOf(n)}function Xn(e){let t=le(e.locale),n=(0,W.useMemo)(()=>{let p=Ue(e.data,e.frame??"frame",e.value??"value",e.label??"label",{locale:t,aggregate:e.aggregate??"sum"});if(p.type==="date"&&new Set(p.labels).size<p.labels.length){let R=p.xnum.every(O=>new Date(O).getDate()===1),L=new Intl.DateTimeFormat(t,R?{year:"numeric",month:"short"}:{year:"numeric",month:"short",day:"numeric"});return{...p,labels:p.xnum.map(O=>L.format(O))}}return p},[e.data,e.frame,e.value,e.label,e.aggregate,t]),r=n.keys.length,o=n.series.length,a=Math.max(0,r-1),i=(0,W.useMemo)(()=>{let p=new Map;return R=>{let L=p.get(R);if(L)return L;p.size>=4&&p.clear();let O=[],E=new Int32Array(o);if(R>=0&&R<r)for(let C=0;C<o;C++)n.series[C]!==""&&Number.isFinite(n.values[C][R])&&O.push(C);return O.sort((C,z)=>n.values[z][R]-n.values[C][R]||C-z),O.forEach((C,z)=>E[C]=z+1),L={order:O,pos:E},p.set(R,L),L}},[n,r,o]),s=(0,W.useMemo)(()=>{let p=0,R=0,L=0,O=!0;for(let E=0;E<r;E++){let C=0;for(let z=0;z<o;z++){let B=n.values[z][E];!Number.isFinite(B)||n.series[z]===""||(C++,B>R&&(R=B),B<L&&(L=B),O&&!Number.isInteger(B)&&(O=!1))}p=Math.max(p,C)}return{most:p,hi:R,lo:L,ints:O}},[n,r,o]),c=typeof e.top=="number"&&e.top>=1?Math.min(50,Math.round(e.top)):Os,l=Math.max(1,Math.min(c,s.most)),m=typeof e.stepMs=="number"&&e.stepMs>0?Le(e.stepMs,100,6e4):zs,u=(0,W.useMemo)(()=>et(_e(e.format,t),e.unit),[e.format,t,e.unit]),d=(0,W.useMemo)(()=>{let p=Array.from({length:l},()=>[]),R=new Float64Array(r),L=new Float64Array(r),O=(C,z,B,ee,Y)=>{let q=(Math.max(0,B)-R[ee])/(L[ee]-R[ee]),ue=ce(u(B),11,700);for(let ge=C;ge<=z;ge++)p[ge].push(q,ue,Y?1:0)},E=(C,z)=>C.pos[z]&&C.pos[z]<=l?C.pos[z]-1:l;for(let C=0;C<r;C++){let z=i(C),B=C?i(C-1):null;for(let Y of z.order.slice(0,l))R[C]=Math.min(R[C],n.values[Y][C]),L[C]=Math.max(L[C],n.values[Y][C]);L[C]===R[C]&&(L[C]=R[C]+1);let ee=new Set([...z.order.slice(0,l),...B?B.order.slice(0,l):[]]);for(let Y of ee){let q=E(z,Y),ue=B?E(B,Y):q,ge=Math.min(ue,q),Je=Math.min(l-1,Math.max(ue,q)),Mt=q<l?!!(B&&B.pos[Y]&&B.pos[Y]!==z.pos[Y]):!0;B&&O(ge,Je,ue<l?n.values[Y][C-1]:n.values[Y][C],C-1,Mt),O(ge,Je,q<l?n.values[Y][C]:n.values[Y][C-1],C,Mt)}}return p},[i,n,r,l,u]),h=(0,W.useMemo)(()=>Math.max(0,...n.series.slice(0,2e3).map(p=>ce(p,1,800))),[n]),f=(0,W.useMemo)(()=>Math.max(0,...Array.from(n.labels,p=>ce(p,1,800))),[n]),b=e.showLabels!==!1,T=e.height,w=(0,W.useMemo)(()=>{let p=(O,E)=>{let C=Math.max(1,E/l),z=C>=12,B=C>=22?11.5:10.5,ee=b&&z,Y=Math.min(O*.3,Math.max(20,h*B)+10),q=ee?Math.max(ce(u(s.hi),11,700),ce(u(s.lo),11,700))+8:0,ue=ee&&r>1?ce(String(o),10,700)+18:0,ge=Y+6,Je=Math.max(ge+1,O-q-ue-4);return{plotH:E,rowH:C,showText:z,nameSize:B,showValues:ee,nameW:Y,markW:ue,x0:ge,x1:Je}},R=(O,E)=>{let C=B=>{let ee=0,Y=d[B];for(let q=0;q<Y.length;q+=3)ee=Math.max(ee,E.x0+Y[q]*(E.x1-E.x0)+(E.showValues?6+Y[q+1]+(Y[q+2]?E.markW:0):0));return ee},z=Math.min(72,E.plotH*.3,(E.x1-E.x0)*.6/Math.max(.1,f));for(let B=z;B>=Bs;B-=2){let ee=O-2-f*B-js,Y=Math.max(0,Math.floor((E.plotH-B*.82)/E.rowH)),q=!0;for(let ue=Y;ue<l&&q;ue++)q=C(ue)<=ee;if(q)return B}return 0},L=new Map;return(O,E)=>{let C=`${O}|${E}`,z=L.get(C);if(z)return z;let B=E===void 0?l*(O<400?26:30):Math.max(1,E-Re*2),ee=p(O,B),Y=f>0&&o?R(O,ee):0;return z=Y||!f||!o?{...ee,band:0,label:Y}:{...p(O,E===void 0?B:Math.max(1,B-Xo)),band:Xo,label:Hs},L.size>8&&L.clear(),L.set(C,z),z}},[d,l,r,o,h,f,b,u,s.hi,s.lo]),k=Ho(e,{height:p=>{let R=w(p);return R.plotH+Re*2+R.band},duration:700,stagger:40}),{p:$,width:P,height:y}=k,S=Is[k.lang],H=(0,W.useId)().replace(/:/g,""),I=(0,W.useMemo)(()=>{let p=Gs(n,e.startFrame);return p>=0?p:a},[n,e.startFrame,a]),[K,V]=(0,W.useState)(I),[_,F]=(0,W.useState)(I);_!==I&&(F(I),V(I));let v=Math.min(K,a),[x,M]=(0,W.useState)(!1),D=r>1&&!k.reduced,U=(0,W.useRef)("step"),oe=(0,W.useRef)(v);oe.current=v;let Fe=(0,W.useRef)(!1),X=(p,R)=>{U.current=R,oe.current=p,V(p)},se=k.motion.active;(0,W.useEffect)(()=>{if(!x||!D||!se)return;let p=0,R=0,L=null,O=C=>{if(R+=p?Math.min(C-p,m):0,p=C,R<m)return!0;R=0;let z=oe.current+1;return X(Math.min(z,a),"play"),z>=a&&M(!1),!0},E=()=>{L?.(),L=null,p=0,document.hidden||(L=Zt(O))};return E(),document.addEventListener("visibilitychange",E),()=>{L?.(),document.removeEventListener("visibilitychange",E)}},[x,D,se,m,a]);let he=(0,W.useRef)(!1);(0,W.useEffect)(()=>{!e.autoplay||he.current||!D||!k.motion.enabled||!se||(he.current=!0,e.startFrame===void 0&&X(0,"step"),M(!0))},[e.autoplay,e.startFrame,D,k.motion.enabled,se]);let Ce=()=>{if(x)return M(!1);Fe.current=!1,oe.current>=a&&X(0,"step"),M(!0)},st=(p,R=!1)=>{M(!1),Fe.current=!0;let L=Le(p,0,a);if(R&&k.active!==null){let O=Se[k.active]?.s,E=O===void 0?-1:i(L).order.slice(0,l).indexOf(O);k.setActive(E>=0?E:null,"keyboard")}L!==oe.current&&X(L,"step")},Ie=i(v),en=i(v-1),Qn=p=>en.pos[p]&&Ie.pos[p]?en.pos[p]-Ie.pos[p]:0,Se=(0,W.useMemo)(()=>Ie.order.slice(0,l).map((p,R)=>({s:p,slot:R,value:n.values[p][v],move:Qn(p)})),[Ie,en,l,n,v]),je=0,Ge=0;for(let p of Se)je=Math.min(je,p.value),Ge=Math.max(Ge,p.value);Ge===je&&(Ge=je+1);let Xe=(0,W.useMemo)(()=>{let p=n.rows.map(R=>R.findLast(L=>L!==null)??null);return Te(e.highlight,p,n.series,n.series.map((R,L)=>n.values[L][a]),"max")},[n,e.highlight,a]),er=(0,W.useMemo)(()=>Rt($,o,Xe),[$,o,Xe]),tr=U.current==="play",nr={...k.motion,dataKey:`${k.sig}|${v}`,stagger:0,duration:e.duration??(tr?m:700),easing:e.easing??(tr?"linear":k.motion.easing)},rr=k.motion.stagger??40,ga=(0,W.useMemo)(()=>Se.map(p=>({key:`r:${n.series[p.s]}`,to:[p.value,p.slot],from:[0,p.slot],enter:[p.value,l],exit:[p.value,l],delay:p.slot*rr,data:p})),[Se,n,l,rr]),pa=Vn(ga,nr),ba=(0,W.useMemo)(()=>[{key:"d",to:[je,Ge],data:null}],[je,Ge]),ya=Vn(ba,nr),[tn,or]=ya.get("d")??[je,Ge],xt=w(P,T===void 0?void 0:y),{plotH:kt,rowH:wt,showText:xa,nameSize:nn,showValues:ar,nameW:rn,x0:ir,x1:ka}=xt,lt=Math.max(1,wt*.7),{fv:Ve}=k,wa=(0,W.useMemo)(()=>n.series.map((p,R)=>Dn(p,rn-4,nn,Xe.has(R)?800:500)),[n,rn,nn,Xe]),va=or-tn>0?or-tn:1,Ye=p=>ir+(p-tn)/va*(ka-ir),sr=p=>Re+p*wt+(wt-lt)/2,vt=Math.min($.theme.radiusMark,lt/2),on=S.nth,an=p=>p>0?S.up(p):S.down(-p),lr=(0,W.useMemo)(()=>Se.map(p=>({datum:n.rows[p.s][v],index:p.slot,key:n.series[p.s],label:n.series[p.s],value:p.value,formatted:`${Ve(p.value)}, ${on(p.slot+1)}${p.move?`, ${an(p.move)}`:""}`})),[Se,n,v,Ve,S]),ct=n.labels[v]??"",cr=p=>{let R=Qn(p);return`${ct}, ${n.series[p]}, ${on(Ie.pos[p])}, ${Ve(n.values[p][v])}${R?`, ${an(R)}`:""}`},ur=[...Xe].find(p=>Ie.pos[p]>0)??Ie.order[0],$a=k.via==="keyboard"&&k.active!==null&&Se[k.active]?cr(Se[k.active].s):Fe.current&&!x&&ur!==void 0?cr(ur):"",sn=Se[0],Ma=e.description??(sn?`${S.kind}. ${S.desc(Ie.order.length,r,n.labels[0],n.labels[a])}. ${S.lead(ct,n.series[sn.s],Ve(sn.value))}.`:""),Pe=k.active!==null?Se[k.active]:void 0,Ta=Pe?{x:Ye(Math.max(0,Pe.value)),y:sr(Pe.slot),title:n.series[Pe.s],rows:[{label:ct,value:Ve(Pe.value),color:er[Pe.s].fill},{label:S.rank,value:`${on(Pe.slot+1)}${Pe.move?` (${an(Pe.move)})`:""}`,strong:!1}]}:null,$t=xt.label,Ca=xt.band?Re+kt+Re+xt.band-7:Re+kt-$t*.08,Sa=k.reduced&&k.hydrated;return(0,j.jsxs)(Ur,{c:k,kind:S.kind,ariaLabel:e.ariaLabel,description:Ma,events:lr,tip:Ta,renderTip:e.tooltip,announce:$a,className:e.className,style:e.style,theme:e.theme,onPointerMove:(p,R,L)=>{let O=Math.floor((R-Re)/wt);k.setActive(O>=0&&O<lr.length?O:null,L.pointerType==="touch"?"touch":"pointer")},onKey:p=>(p.key==="ArrowLeft"||p.key==="ArrowRight")&&r>1?(st(oe.current+(p.key==="ArrowRight"?1:-1),!0),!0):p.key===" "&&D?(Ce(),!0):!1,defs:(0,j.jsx)("clipPath",{id:`${H}c`,children:(0,j.jsx)("rect",{x:0,y:0,width:P,height:kt+Re*2})}),overlay:r>1&&o?(0,j.jsx)(Ws,{p:$,msg:S,frame:v,last:a,labels:n.labels,playing:x,stepOnly:Sa,canPlay:D,narrow:P<340,onToggle:Ce,onStep:st}):null,children:[o&&ct&&$t?(0,j.jsx)(ft,{x:P-2,y:Ca,anchor:"end",baseline:"auto",size:$t,weight:800,fill:$.paint("dim"),opacity:.45,letterSpacing:-$t*.03,children:ct}):null,s.lo<0?(0,j.jsx)("line",{x1:Ye(0),x2:Ye(0),y1:Re,y2:Re+kt,stroke:$.paint("line"),strokeWidth:1}):null,(0,j.jsx)("g",{clipPath:`url(#${H}c)`,children:pa.items.map(p=>{let R=p.data;if(p.exiting&&p.key!==`r:${n.series[R.s]}`)return null;let[L,O]=p.v,E=sr(O),C=Ye(Math.min(0,L)),z=Ye(Math.max(0,L)),B=Xe.has(R.s),ee=!p.exiting&&k.active===R.slot,q=Le(l-O,0,1)*(k.active===null||ee?1:.55),ue=Ve(p.progress>=1?R.value:s.ints?Math.round(L):L),ge=(L<0?Ye(0):z)+6,Je=B?800:500,Mt=$.paint(B?"ink":"muted"),ln=E+lt/2;return(0,j.jsxs)("g",{opacity:q<1?q:void 0,children:[(0,j.jsx)("path",{d:_n(C,E,z-C,lt,L<0?{tl:vt,bl:vt}:{tr:vt,br:vt}),fill:er[R.s].fill,className:"ztd-mark"}),ee&&k.via==="keyboard"?(0,j.jsx)("path",{d:_n(C-2,E-2,z-C+4,lt+4,4),fill:"none",stroke:$.paint("ink"),strokeWidth:2}):null,xa?(0,j.jsx)(ft,{x:rn,y:ln,anchor:"end",size:nn,weight:Je,fill:Mt,children:wa[R.s]}):null,ar?(0,j.jsx)(ft,{x:ge,y:ln,size:11,weight:B?800:700,fill:$.paint("ink"),children:ue}):null,ar&&R.move?(0,j.jsx)(Vs,{p:$,x:ge+ce(Ve(R.value),11,700)+6,y:ln,move:R.move}):null]},p.key)})})]})}function Vs({p:e,x:t,y:n,move:r}){let o=r>0,a=e.paint(o?"accentText":"muted");return(0,j.jsxs)("g",{"aria-hidden":"true",children:[(0,j.jsx)("path",{d:o?`M${t},${n+3}h7l-3.5,-6z`:`M${t},${n-3}h7l-3.5,6z`,fill:a}),(0,j.jsx)(ft,{x:t+9,y:n,size:10,weight:700,fill:a,children:Math.abs(r)})]})}function Un({d:e}){return(0,j.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.map((t,n)=>(0,j.jsx)("path",{d:t},n))})}function Ws(e){let{p:t,msg:n,frame:r,last:o}=e,a=(0,W.useRef)(null),i={background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},s={fontSize:11,color:t.paint("muted"),whiteSpace:"nowrap",flex:"none",fontVariantNumeric:"tabular-nums"},c=u=>{let d=a.current?.getBoundingClientRect();if(!d||!d.width)return;let h=Math.round(Le((u.clientX-d.left)/d.width,0,1)*o);h!==r&&e.onStep(h)},l=u=>{let d=Math.max(1,Math.round((o+1)/10)),h={ArrowLeft:r-1,ArrowDown:r-1,ArrowRight:r+1,ArrowUp:r+1,PageDown:r-d,PageUp:r+d,Home:0,End:o};u.key in h&&(u.preventDefault(),e.onStep(h[u.key]))},m=o?r/o*100:0;return(0,j.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:8},children:[e.stepOnly?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":n.prev,title:n.prev,disabled:r<=0,onClick:()=>e.onStep(r-1),style:{...i,opacity:r<=0?.4:void 0},children:(0,j.jsx)(Un,{d:Qt.prev})}),(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":n.next,title:n.next,disabled:r>=o,onClick:()=>e.onStep(r+1),style:{...i,opacity:r>=o?.4:void 0},children:(0,j.jsx)(Un,{d:Qt.next})})]}):(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":e.playing?n.pause:n.play,title:e.playing?n.pause:n.play,disabled:!e.canPlay,onClick:e.onToggle,style:i,children:(0,j.jsx)(Un,{d:e.playing?Qt.pause:Qt.play})}),e.narrow?null:(0,j.jsx)("span",{style:s,children:e.labels[0]}),(0,j.jsxs)("div",{ref:a,role:"slider",tabIndex:0,className:"ztd-btn","aria-label":n.frame,"aria-valuemin":0,"aria-valuemax":o,"aria-valuenow":r,"aria-valuetext":e.labels[r],onKeyDown:l,onPointerDown:u=>{u.currentTarget.setPointerCapture?.(u.pointerId),c(u)},onPointerMove:u=>{u.currentTarget.hasPointerCapture?.(u.pointerId)&&c(u)},style:{position:"relative",flex:1,minWidth:60,height:28,touchAction:"none",borderRadius:14},children:[(0,j.jsx)("span",{style:{position:"absolute",left:0,right:0,top:12,height:4,borderRadius:2,background:t.paint("line")}}),(0,j.jsx)("span",{style:{position:"absolute",left:0,width:`${m}%`,top:12,height:4,borderRadius:2,background:t.paint("accent")}}),(0,j.jsx)("span",{style:{position:"absolute",left:`calc(${m}% - 7px)`,top:7,width:14,height:14,boxSizing:"border-box",borderRadius:7,border:`2px solid ${t.paint("accent")}`,background:t.paint("panel")}})]}),e.narrow?null:(0,j.jsx)("span",{style:s,children:e.labels[o]})]})}var Yn=A(G(),1);function Yo(e,t,n,r){if(typeof e!="function")return Te(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let c=o.get(r(i,s));c!==void 0&&e(i,s)&&a.add(c)}),a}var Ks=A(Z(),1);var qn=A(G(),1),Us={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}, ${xe(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Jo={en:Us,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}일 이동평균`}},Jn=["ink","muted","dim"];function qo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Jn.length)}var Xs=A(Z(),1);var na=A(G(),1),Ys={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${xe(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Js={en:Ys,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Zo=(e,t)=>Js[e].other(t);function Qo(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,lo(o.map(a=>a.value)))}}var ea=e=>Number.isFinite(e)&&e>0?e:0;function ta(e,t,n,r){return r==="emphasis"?Rt(e,t,n):ke(e,t,n)}var qs=A(Z(),1);var ia=A(G(),1);function ra(e,t){return t===!1?e.map((n,r)=>r):so(e)}function oa(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Te(e,t,t,r,"max")}function aa(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=ae(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?ae(e,"neutral"):Nt(e,1-i/Math.max(1,o.length-1))),r}function sa(e){return!e||typeof e!="object"||Array.isArray(e)?[]:$e(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function la(e,t){return mt(e,t+1,new Set)}var Zs=A(Z(),1);var ua=A(G(),1);var Qs=26;var Ou=Qs*.62;function ca(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!No.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Ee=A(G(),1);function ma(e,t,n){let r=Ht(e);return r?.type==="scatter"&&t?.size!==void 0&&!Bt(n)?Ht("bubble"):r}function el(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 tl(e,t,n,r=!1){let o=ma(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,c=new Set(!r&&Nn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),l=u=>u.filter(d=>!c.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=De(a.label,"label"),d=jt(a.value,"value"),h=o.type==="waffle",f=t.map((y,S)=>({r:y,label:u(y,S),value:h?d(y,S):ea(d(y,S))})),{kept:b,other:T}=h?{kept:f,other:null}:Qo(f,i.other,(y,S)=>({r:{},label:Zo(te(n),y),value:S})),w=Te(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),h?"first":"max"),k=T?[...b,T]:b,$=ze(y=>h?ke(y,k.length,w):ta(y,k.length,w,i.colorMode)),P=h&&i.shape==="arc";return k.map((y,S)=>({label:y.label,color:$[S],...P&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=qo(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Jo[te(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:Jn[f],shape:"line"}))]}if(o.type==="network"){let u=sa(i.groups);if(u.length<2)return[];let d=ze(h=>la(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=De(a.group,"group"),d=$e(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=ze(f=>mt(f,d.length,new Set));return d.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Bt(i))return[];let u=De(a.series,"series"),d=$e(t.map((b,T)=>u(b,T)));if(d.length<2)return[];let h=Yo(s,t,d,u),f=ze(b=>mt(b,d.length,h));return l(d.map((b,T)=>({label:b,color:f[T],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let h=zo(t,d,u),f=ze(b=>ke(b,h.length,ca(s,h)));return l(h.map((b,T)=>({label:b,color:f[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let $=De(a.series,"series");u=$e(t.map((P,y)=>$(P,y)))}let d=Rn(o.type,a,i);if(d.length){let $=Te(s,u,u,u.map(()=>0),"none"),P=ze(S=>ke(S,u.length,$)),y=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((S,H)=>({label:S,color:P[H]}));return[...l(y),...d.map((S,H)=>({label:S,color:Uo(H),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?io(u.length,Array.isArray(i.negative)?i.negative.map($=>u.indexOf(String($))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,b=f>=0?new Set([f]):Te(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return l(u.map(($,P)=>({label:$,color:b.has(P)?"accent":"neutralStrong",shape:"square"})));let T=i.colorMode,w=$=>ke($,u.length,b);if((o.type==="line"||o.type==="area")&&(w=$=>Ko($,u.length,b,o.type==="area",T)),o.type==="stream"){let $=Ue(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),P=ra($.values,i.reorder),y=oa(s,$.series,$.values);w=S=>aa(S,P,y)}let k=ze(w);return l(u.map(($,P)=>({label:$,color:k[P],...o.type==="line"&&{shape:"line"}})))}return[]}function nl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Zr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function rl(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:c,description:l,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:c,description:l}}function da(e,t){let{spec:n}=e,r=ma(n.type,n.encoding,n.options),o=(0,yt.useMemo)(()=>Bo(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=qr(n,e.locale),s=le(i),c=te(s),l=Ro(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=to(n),u=(0,yt.useMemo)(()=>m?Io(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,T]=(0,yt.useState)(null);if(!r)return(0,Ee.jsx)(An,{error:c==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let w=o??l.data,k=t[r.type],$={...n.options??{}},P={...el(r,n.encoding),...$,...u?{tooltip:u}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},y=n.card?.legend==="toggle"&&eo(r.type,n.encoding??{},$),S=b&&b.base===f?b.hidden:h;y&&(P.hidden=S);let H=F=>T(v=>{let x=v&&v.base===f?v.hidden:h;return{base:f,hidden:x.includes(F)?x.filter(M=>M!==F):[...x,F]}}),I=P.height??220,K=nl(n,r.type),V=a&&!w.length&&(l.loading||l.error||l.empty)?(0,Ee.jsx)(An,{loading:l.loading,error:l.error,empty:l.empty,onRetry:l.reload,height:I,locale:i}):K?(0,Ee.jsx)(Ao,{chart:k,...rl(r.type,K,P)}):(0,Ee.jsx)(k,{...P});if(n.card){let F=n.card,v=F.legend==="auto"||F.legend==="toggle"?tl(n,w,s,y):F.legend,x=v?.length?y?(0,Ee.jsx)(Sn,{items:v,hidden:S,onToggle:H,locale:i}):v:void 0,M=F.download?(0,Ee.jsx)(Eo,{data:w,columns:no(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;V=(0,Ee.jsx)(Kr,{number:F.number,title:F.title??Jr(r,c),subtitle:F.subtitle,legend:x,actions:M,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:V})}let _=e.theme??n.theme;return _&&(V=(0,Ee.jsx)(Lt,{theme:_,children:V})),V}function ol({cfg:e,components:t}){let n=ot();return da({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ha(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,fa.hydrateRoot)(r,(0,Zn.createElement)(Lt,{theme:o.theme,cssVars:!0},(0,Zn.createElement)(ol,{cfg:o,components:{[e]:t}})))}ha("barRace",Xn);})();
|
package/dist/client/beeswarm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var Mo=Object.create;var gn=Object.defineProperty;var To=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var So=Object.getPrototypeOf,Ao=Object.prototype.hasOwnProperty;var Nt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var No=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Co(t))!Ao.call(e,o)&&o!==n&&gn(e,o,{get:()=>t[o],enumerable:!(r=To(t,o))||r.enumerable});return e};var N=(e,t,n)=>(n=e!=null?Mo(So(e)):{},No(t||!e||!e.__esModule?gn(n,"default",{value:e,enumerable:!0}):n,e));var W=Nt((
|
|
1
|
+
(()=>{var Mo=Object.create;var gn=Object.defineProperty;var To=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var So=Object.getPrototypeOf,Ao=Object.prototype.hasOwnProperty;var Nt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var No=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Co(t))!Ao.call(e,o)&&o!==n&&gn(e,o,{get:()=>t[o],enumerable:!(r=To(t,o))||r.enumerable});return e};var N=(e,t,n)=>(n=e!=null?Mo(So(e)):{},No(t||!e||!e.__esModule?gn(n,"default",{value:e,enumerable:!0}):n,e));var W=Nt((Yi,pn)=>{pn.exports=globalThis.__ztdReact.react});var yn=Nt((qi,bn)=>{bn.exports=globalThis.__ztdReact["react-dom/client"]});var I=Nt((us,Un)=>{Un.exports=globalThis.__ztdReact["react/jsx-runtime"]});var fn=N(W(),1),vo=N(yn(),1);var Qe=N(W(),1);var dt=N(W(),1);var xn=N(W(),1),Ee=(0,xn.createContext)(void 0);var $n=N(W(),1);var Fo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],kn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',wn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Te={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:kn,monoFamily:wn,radius:18,radiusCode:14,radiusMark:4},Ft={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:kn,monoFamily:wn,radius:18,radiusCode:14,radiusMark:4},Rt={dark:Te,light:Ft};function et(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function _t(e){let t={};for(let n of Fo){let r=e[n];typeof r=="string"&&(t[et(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 Pt(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 Ro=`
|
|
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,${Te.accent});outline-offset:3px;border-radius:6px}
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
`&&m++,s.push(l),a.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),a.push(s));let f=a.filter(m=>!(m.length===1&&m[0].trim()===""));if(!f.length)return[];let u=m=>n?cr(m):m;if(!r)return f.map(m=>Object.fromEntries(m.map((g,w)=>[String(w),u(g)])));let d=[],h=new Set;return f[0].forEach((m,g)=>{let w=m.trim()||`col${g+1}`,x=w;for(let y=2;h.has(x);y++)x=`${w}_${y}`;h.add(x),d.push(x)}),f.slice(1).map(m=>Object.fromEntries(d.map((g,w)=>[g,u(m[w]??"")])))}function Jt(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"?cr(a[l]):a[l]??null])))}function Xa(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 ur(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 Se(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Se(JSON.parse(t))}catch{}return De(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Jt(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)?Se(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Jt(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)?Se(t.rows):Array.isArray(t.values)?Jt(t.values):Array.isArray(t.items)?Se(t.items):Array.isArray(t.results)?Se(t.results):Xa(t)}return[]}function yt(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 Zt(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 f=e[l][c];return Number.isFinite(f)&&f>0?f: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 f=0,u=0;for(let d=0;d<n;d++){let h=a(d,c),m=h-a(d,c-1),g=0;for(let w=0;w<d;w++)g+=a(w,c)-a(w,c-1);f+=h,u+=(m/2+g)*h}f&&(l-=u/f),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 m=e[h][l],g=Number.isFinite(m)?m:0;g>=0?(o[h][l]=u,u+=g,i[h][l]=u):(o[h][l]=d,d+=g,i[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let f=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]=f,f+=d,i[u][l]=f}}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 f=0;for(let u=0;u<r;u++)f+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;f/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=f,i[u][d]-=f}return{y0:o,y1:i}}function mr(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 dr(e){let t=e.length,n=e.map(c=>{let f=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,f=h)}),f}),r=e.map(c=>c.reduce((f,u)=>f+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,f)=>f).sort((c,f)=>n[c]-n[f]),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 Ya=Math.PI*2;function fr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function hr(e,t){if(!e.length)return NaN;let n=(e.length-1)*t,r=Math.floor(n),o=n-r;return e[r+1]!==void 0?e[r]+o*(e[r+1]-e[r]):e[r]}function gr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function br(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function pr(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 xt=new Map;function ke(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=xt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);br(c)?a+=pr(c):s+=pr(c)}i=a+s*(n>=600?1.07:1),xt.size>5e3&&xt.clear(),xt.set(o,i)}return i*t}function Qt(e,t,n,r=400){if(e=e.trim(),ke(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ke(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<(br(s.charCodeAt(0))?2:3)?"":s+o}var xr=N(I(),1),qa=e=>Array.isArray(e)&&e.length===2;function yr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&qa(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var wr=N(I(),1),Ue=10.5;function Ja(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=>ze(a,{locale:n,maximumFractionDigits:i}))}function kr(e,t,n){let r=18;for(let o of Ja(e,t,n))r=Math.max(r,ke(o,Ue));return Math.ceil(r+8)}function en(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 Ae(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=en(a,n),c=[o,i];for(let f=0;f<4;f++){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=en(c[1]-c[0],n);if(h===l)break;l=h}return c}function vr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=en(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 Xe(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)=>vr(n,r,l),s}function tn(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]=Ae(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function Za(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,f=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%f))for(let h of c){let m=Number((h*10**d).toPrecision(12));m>=e*(1-1e-9)&&m<=t*(1+1e-9)&&u.push(m)}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:vr(e,t,3)}function $r(e,t){let n=Xe([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=()=>Za(e[0],e[1],Math.abs(t[1]-t[0])),r}function Le(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 Qa=864e5;function Mr(e,t,n,r=ee){let o=t-e;if(!(o>0))return[{t:e,label:Ke(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Qa,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(f,u,d,h=!1)=>{let m=new Date(f),g=-1,w=0;for(;m.getTime()<=t&&w++<500;){if(m.getTime()>=e){let x=m.getFullYear(),y=h&&!l&&x!==g;a.push({t:m.getTime(),label:Ke(m,{locale:r,...d,...y?{year:"numeric"}:{}})}),g=x}u(m)}};if(i<=1.5){let f=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=f)??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 f=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(f,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());f.setDate(f.getDate()+(8-f.getDay())%7),c(f,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let f=i/30.44,u=Math.max(1,Math.ceil(f/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,m=>m.setFullYear(m.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),m=h.getMonth()%d;m&&h.setMonth(h.getMonth()+(d-m)),c(h,g=>g.setMonth(g.getMonth()+d),{month:"short"},!0)}}return a}function kt(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 ei=(e,t,n)=>e==="date"?lt(t,n)?.getTime()??NaN:xe(t);function ti(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Vn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ye(e,t,n,r,o={}){let i=_e(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:_e(n,"y"),c=!a&&r!==void 0?_e(r,"series"):null,f=e.map((S,k)=>i(S,k)),u=o.xType??ti(f),d=o.locale??ee,h,m,g;if(u==="band"){let S=f.map(T=>String(T??""));h=ie(S);let k=new Map(h.map((T,O)=>[T,O]));m=h.map((T,O)=>O),g=Int32Array.from(S,T=>k.get(T)??-1)}else{let S=u==="date"?o.dayFirst??Kn(f):void 0,k=f.map(B=>ei(u,B,S)),T=Array.from(new Set(k.filter(B=>Number.isFinite(B)))).sort((B,te)=>B-te),O=new Map(T.map((B,te)=>[B,te]));m=T,h=T.map(String),g=Int32Array.from(k,B=>O.get(B)??-1)}let w=o.dateFormat,x=S=>typeof S=="string"?st(S.trim())?.[3]:void 0,y=u==="date"&&f.length<5e3?x(f[0]):void 0,v=(y===2||y===3)&&f.every(S=>x(S)===y),M=v&&y===3;if(u==="date"&&!w){let S=m.length>1?m[m.length-1]-m[0]:0;w=v&&y===2||S>864e5*120?{month:"short"}:S<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},S>864e5*800&&(w={year:"numeric",month:"short"})}let p;if(u==="band")p=h;else if(M&&!o.dateFormat){let S=V(d)==="ko";p=m.map(k=>{let T=new Date(k),O=Math.floor(T.getMonth()/3)+1;return S?`${T.getFullYear()}년 ${O}분기`:`Q${O} ${T.getFullYear()}`})}else{let S=m.every(Gt),k=u==="date"?new Intl.DateTimeFormat(d,w):new Intl.NumberFormat(d,S?{useGrouping:!1}:{maximumFractionDigits:6});p=m.length>1e3?kt(m.length,T=>k.format(m[T])):m.map(T=>k.format(T))}let C=s?[...s]:c?ie(e.map((S,k)=>String(c(S,k)??""))):[""],D=new Map(C.map((S,k)=>[S,k])),L=C.map(()=>new Array(h.length).fill(NaN)),R=C.map(()=>new Array(h.length).fill(null)),E=o.aggregate??"sum",_=E==="mean"?C.map(()=>new Uint32Array(h.length)):null,A=(S,k,T,O)=>{let B=L[S][k];E==="last"?L[S][k]=T:E==="count"?L[S][k]=(Number.isFinite(B)?B:0)+1:E==="mean"?Number.isFinite(T)&&(L[S][k]=(Number.isFinite(B)?B:0)+T,_[S][k]++):L[S][k]=Number.isFinite(B)?B+(Number.isFinite(T)?T:0):T,R[S][k]=O};for(let S=0;S<e.length;S++){let k=g[S];if(k<0)continue;let T=e[S];if(s)for(let O=0;O<s.length;O++)A(O,k,xe(T[s[O]]),T);else{let O=c?D.get(String(c(T,S)??""))??0:0;A(O,k,xe(l(T,S)),T)}}if(_)for(let S=0;S<L.length;S++)for(let k=0;k<h.length;k++)_[S][k]>1&&(L[S][k]/=_[S][k]);return{type:u,keys:h,xnum:m,labels:p,series:C,values:L,rows:R}}var ni=140,Je=12,Tr=14,nn=20,Cr=12.5;function ri(e,t,n=or){let r=ae(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 oi(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Je)/(ni+Je))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function ai(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Je)/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 qe=e=>e.filter(Number.isFinite);function wt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Pe(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return qe(n)}function Sr(e,t,n,r,o,i){return Ye(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function ii(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 p=t.flat(),C=r.refLines??{},[D,L]=Le([...wt(p,r.x??"x"),...qe([Number(C.x)])]),[R,E]=Le([...wt(p,r.y??"y"),...qe([Number(C.y)])].filter(A=>!s||A>0)),_=r.zero??!1;return{y:c??(s?tn(R,E,a):Ae(R,E,a,{zero:_,pad:.08})),x:r.xDomain??Ae(D,L,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let f=e==="bar",u=f&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(p=>p.keys.join("")===d),m=n.length>0&&n.every(p=>p.type!=="band"&&p.type===n[0].type),g=r.xDomain??(!f&&m?Le(n.flatMap(p=>qe(p.xnum))):void 0),w=f?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(w==="percent")return{x:g,sameKeys:h};if(c)return{y:c,x:g,sameKeys:h};let x=[];t.forEach((p,C)=>{let D=n[C];if(w==="stacked"||w==="auto"&&D.series.length>1){let R=Zt(D.values,"zero");R.y0.forEach(E=>x.push(...E)),R.y1.forEach(E=>x.push(...E))}else D.values.forEach(R=>x.push(...R));f&&!u&&r.line!==void 0&&Sr(e,p,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(R=>x.push(...R)),f||x.push(...wt(p,r.lower),...wt(p,r.upper))}),f&&x.push(0),u||x.push(...yr(r.annotations));for(let p of r.referenceLines??[])x.push(p.y);r.signColors&&x.push(Number(r.baseline??0));let[y,v]=Le(qe(x).filter(p=>!s||p>0));return{y:s?tn(y,v,a):f?Ae(y,v,u?Math.max(2,Math.round(o/120)):a):Ae(y,v,a,{zero:r.zero??e==="area"}),x:g,sameKeys:h}}function si(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Ye(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?$r:Xe)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),f=kr(c,Hn(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(p=>p.series),d=r.endLabels??n.some(p=>p.series.length>1),h=f+6,m=i-(d?Math.min(i*.28,Math.max(...u.map(p=>ke(p,11,700)),20)+14):10),g=l.keys.length,[w,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,y=l.type==="number"?g>12:g>Mr(w,x,Math.max(2,Math.floor((m-h)/64)),s).length;if(l.type==="band"||!g||y)return;let v=p=>h+(l.xnum[p]-w)/(x-w)*(m-h),M=p=>ke(l.labels[p],Ue);for(let p=1;;p++){let C=Array.from({length:Math.ceil(g/p)},(D,L)=>L*p);if(p>=g||C.every((D,L)=>!L||v(D)-v(C[L-1])>=(M(D)+M(C[L-1]))/2+8))return C.map(D=>({value:l.xnum[D],label:l.labels[D]}))}}function li(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 ci(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${li(`${e}|${t}|${o}|${yt(r)}`)}`}function ui(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 mi={en:{intro:(e,t)=>`${ve(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:"(빈 값)"}},rn=18;function Ar(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=ri(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=oi(s,a,e.columns),{pw:c,ph:f}=ai(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(_=>Sr(t,_,n,n.y,n.series,n.aggregate)),h=u?ii(t,o,d,n,c,f):{sameKeys:!1},m=u?si(t,o,d,n,h,c,f,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",w=u&&(!g||h.sameKeys),x=u&&(g||h.x!==void 0||h.sameKeys),y=new Set(ui(e.highlight,r)?[e.highlight].flat():[]),v=y.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,p=e.syncId??ci(t,e.by,n,e.data),C=it(Re(n.format,e.locale),n.unit),D=mi[e.lang],L=[],R=r.map(_=>_===""?D.blank:_);return{panels:r.map((_,A)=>{let S=o[A],k=R[A],T=A%l,O;if(t!=="scatter"){let te=d[A],Me=de=>te.values.reduce((we,$)=>we+(Number.isFinite($[de])?$[de]:0),0),G=te.keys.map((de,we)=>we).filter(de=>te.values.some(we=>Number.isFinite(we[de]))),ne=G[G.length-1];L.push({first:G.length?Me(G[0]):NaN,last:G.length?Me(ne):NaN,total:G.reduce((de,we)=>de+Me(we),0)}),t!=="bar"&&te.series.length===1&&ne!==void 0&&(O=C(te.values[0][ne]))}else L.push({first:NaN,last:NaN,total:S.length});let B={data:S,width:c,height:f,ariaLabel:e.title?`${e.title}, ${k}`:k,syncId:p,highlight:v?y.has(_)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!w||T===0,showXAxis:!x||A+l>=a};return h.y&&(B.yDomain=h.y),h.x&&(B.xDomain=h.x),m&&(B.xTicks=m),{value:_,label:k,props:B,last:O,isPicked:y.has(_)}}),cols:l,pw:c,ph:f,isPanelPick:v,description:di(t,e.by,R,L,i,C,D)}}function di(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>gr(r.map(f=>f[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let f=n.filter((u,d)=>r[d].last<r[d].first);s+=f.length?a.falling(`${f.slice(0,5).join(", ")}${f.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 se=N(W(),1);function fi(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function hi(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 vt={threshold:.25,enoughPx:96,rootMargin:"0px"};function Rr(e,t=!0){let[n,r]=(0,se.useState)({visible:!t,near:!t});return(0,se.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=hi(a[a.length-1],vt.threshold,vt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:fi(vt.threshold),rootMargin:vt.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 Nr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function $t(e){let[t,n]=(0,se.useState)(null),[r,o]=(0,se.useState)(e??null),i=(0,se.useCallback)(a=>{n(a),a&&e===void 0&&o(Nr(a))},[e]);return ye(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(f=>f!==null&&Math.abs(f-c)<.5?f:c),s=()=>a(Nr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let f=c[c.length-1]?.contentRect;f?a(f.width>0?Math.round(f.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var gi=()=>()=>{};function He(){return(0,se.useSyncExternalStore)(gi,()=>!0,()=>!1)}var Fr="(prefers-reduced-motion: reduce)";function Mt(e="auto"){let[t,n]=(0,se.useState)(()=>fe&&typeof window.matchMedia=="function"?window.matchMedia(Fr).matches:!1);return(0,se.useEffect)(()=>{if(e!=="auto"||!fe||typeof window.matchMedia!="function")return;let r=window.matchMedia(Fr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var be=N(I(),1),pi=60,bi=420;function _r(e){let t=pe(),n=e.chartProps??{},[,r,o]=$t(e.width),i=e.width??(o||480),a=re(e.locale??n.locale),s=V(a),l=(0,je.useContext)(Ee),c=e.title??l,f=e.chart.facetPlan,u=(0,je.useMemo)(()=>{let x=Ar({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 f?f(x,n,a):x},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(x,y)=>typeof y=="function"?String(y):y),e.highlight,e.syncId,i,e.height,c,a,s,f]),d=`${(0,je.useId)().replace(/:/g,"")}fd`,h=Mt(n.reducedMotion??"auto"),m=He(),g=Tn({motion:{enabled:n.animate!==!1&&!h&&fe},hydrated:m},{waiting:!1,generation:0}),w=e.chart;return(0,be.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,be.jsx)("p",{id:d,style:ht,children:e.description??u.description}),(0,be.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Je,rowGap:Tr,...u.legend?{marginTop:rn}:null},children:u.panels.map((x,y)=>{let v=t.paint(x.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,be.jsxs)("div",{"data-facet":x.value,style:{minWidth:0,...Mn(g,!1,"fade",y*pi,bi)},children:[(0,be.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:nn,fontSize:Cr,fontWeight:700,lineHeight:`${nn}px`,color:v},children:[(0,be.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.label}),x.last!==void 0?(0,be.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:x.last}):null]}),(0,be.jsx)(w,{...n,...x.props})]},x.value)})}),u.legend?(0,be.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:rn},children:u.legend}):null]})}var Pr=["max","min","first","last","none"];function ue(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 f=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,f=h)}),f>=0&&i.add(f)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,f)=>{f<a&&c!==null&&c!==void 0&&e(c,f)&&i.add(f)}),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((f,u)=>{f===c&&i.add(u)});return i}var me=N(W(),1);async function yi(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(V(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return De(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 De(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):De(i)}async function xi(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 yi(i,t.parse,o,t.locale)}return t.select&&(r=ur(r,t.select)),t.transform?t.transform(r):Se(r)}function Dr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,me.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,me.useState)(0),c=re(t.locale),f=(0,me.useRef)(t);f.current={...t,locale:c};let u=(0,me.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],m=JSON.stringify(h.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),g=(0,me.useRef)(!1);(0,me.useEffect)(()=>{let x=u.current;if(!x||!r){a(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let y=new AbortController,v=!0;return g.current=!0,a(M=>({...M,data:o?M.data:[],status:"loading",error:null})),xi(x,{...f.current,signal:y.signal}).then(M=>{v&&a({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!v||y.signal.aborted||a(p=>({...p,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{v&&(g.current=!1)}),()=>{v=!1,g.current=!1,y.abort()}},[d,r,s,m,o]),(0,me.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{g.current||l(y=>y+1)},n);return()=>clearInterval(x)},[n,r]);let w=(0,me.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:w}}var an=N(I(),1),ki=["csv","svg","png"],wi=/^[=+\-@\t\r\n=+-@]/,vi=/var\(|color-mix\(/;function Lr(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?jn(e.getTime()):String(e);return`"${(wi.test(t)&&!Number.isFinite(xe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function $i(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Mi(e,t){return`\uFEFF${[t.map(Lr),...e.map(r=>t.map(o=>Lr(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
27
|
`}function Ti(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function on(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Er=2,Ne=16;function Or(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 Ir(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 zr(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+Ne*2,a+Ne*2],c=o.cloneNode(!0),f=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((m,g)=>{let w;for(let x of Array.from(m.attributes)){if(!vi.test(x.value))continue;let y=(w??(w=getComputedStyle(m))).getPropertyValue(x.name);y&&f[g].setAttribute(x.name,Or(y,u))}}),c.removeAttribute("style");for(let[m,g]of Object.entries({viewBox:`${-Ne} ${-Ne} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(m,String(g));let d=Or(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let m=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Ir("rect",{x:-Ne,y:-Ne,width:s,height:l,fill:d}),m),h&&c.insertBefore(Ir("image",{href:h.toDataURL(),width:i,height:a}),m)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:d,canvas:h}}function Ci(e,t){let n=zr(e,Er,!1);if(!n)return;let r=Er,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,Ne*r,Ne*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&&on(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Br(e){let t=pe(e.theme),n=V(re(e.locale))==="ko",r=Ti(e.filename),o=(i,a)=>{if(i==="csv")return on(new Blob([Mi(e.data,e.columns?.length?e.columns:$i(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return Ci(a,r);let s=zr(a,1,!0);s&&on(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,an.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:ki.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,an.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 jr=N(I(),1);function Hr(e,t=ee){let n=Re(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?Ke(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(Wn,(f,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,jr.jsx)("div",{children:s},l)):null}}function Gr(e,t,n={}){let o=2*(t+(n.padding??.6)),i=o*o,a=e.length,s=Array.from({length:a},(x,y)=>y).sort((x,y)=>e[x]-e[y]),l=new Float64Array(a),c=new Float64Array(a),f=new Array(a).fill(0),u=n.maxSpread??1/0,d=new Float64Array(64),h=new Float64Array(64),m=0,g=0,w=0;for(let x of s){let y=e[x];for(;m<g&&l[m]<y-o;)m++;g-m>d.length&&(d=new Float64Array(2*(g-m)),h=new Float64Array(d.length));let v=0;for(let p=m;p<g;p++){let C=y-l[p],D=i-1e-6-C*C;if(D<=0)continue;let L=Math.sqrt(D);d[v]=c[p]-L,h[v]=c[p]+L,v++}let M=0;if(v>0){let p=d.subarray(0,v).sort(),C=h.subarray(0,v).sort(),D=0,L=0,R=0;for(let E=0;E<v;)if(D<v&&p[D]<C[E]){if(L===0&&(R=p[D],R>=0))break;L++,D++}else{if(L--,L===0&&C[E]>0){let _=-R<C[E]-1e-6?R:C[E],A=_===R?C[E]:R;M=Math.abs(_)<=u?_:Math.abs(A)<=u?A:NaN;break}E++}}if(Number.isNaN(M)){f[x]=(w++*.6180339887498949%1*2-1)*u;continue}f[x]=M,l[g]=y,c[g]=M,g++}return f}function Wr(e,t,n=!1){let r=ae(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=ie(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 Vr(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 De(t.csv)}return null}var Zr=N(W(),1);var X=N(W(),1);function Kr(e,t){let n=pe(e.theme),[r,o,i]=$t(e.width),a=He(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,f=Mt(e.reducedMotion??"auto"),u=e.animate!==!1&&!f&&fe,d=Rr(r,e.animateOnView!==!1&&u),h=re(e.locale),m=V(h),g=(0,X.useMemo)(()=>Re(e.format,h,t.format),[e.format,h,t.format]),w=(0,X.useCallback)(G=>at(G,{locale:h}),[h]),x=(0,X.useMemo)(()=>it(g,e.unit),[g,e.unit]),y=(0,X.useMemo)(()=>yt(e.data),[e.data]),[v,M]=(0,X.useState)(null),[p,C]=(0,X.useState)(null),D=(0,X.useRef)([]),L=(0,X.useRef)(e.onHover);L.current=e.onHover;let R=(0,X.useRef)(e.onClick);R.current=e.onClick;let E=(0,X.useRef)(null),_=(0,X.useRef)(null),A=(0,X.useRef)(null),S=(0,X.useCallback)((G,ne="pointer")=>{if(A.current!==G){A.current=G;let de=G===null?null:D.current[G]??null;queueMicrotask(()=>L.current?.(de)),_.current?.(G)}E.current=G===null?null:ne,M(G),C(E.current)},[]),k=(0,X.useCallback)(G=>{E.current!=="keyboard"&&(E.current=G===null?null:"sync",M(G),C(E.current))},[]),T=(0,X.useCallback)(G=>{let ne=D.current[G];ne&&R.current?.(ne)},[]),O=qn(e.replayKey),B=e.width!==void 0||(i??0)>0,te={enabled:u,active:d.visible&&B,near:d.near,replayKey:O,dataKey:y,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Me=(0,X.useCallback)((G,ne=1)=>v===null||v===G?ne:ne*.38,[v]);return{p:n,width:s,height:c,measured:B,responsive:e.width===void 0,pending:fe&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:te,fv:x,fmt:g,pct:w,locale:h,lang:m,t:m==="ko"?Sn:Cn,active:v,via:p,setActive:S,click:T,events:D,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Me,sig:y,description:e.description,reduced:f,publish:_,applySync:k}}var K=N(W(),1);function Si(e){return 1-Math.pow(1-e,3)}function Ai(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ni(e){return e==="easeInOut"?Ai:e==="linear"?t=>t:Si}function Fi(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 Ge(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 Tt(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 Ur(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 Xr(e,t,n,r){if(!t||!n||t.length!==n.length)return Ge(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 Ge(s,n[a]))o.push(l)}return o.length===r?o:Ge(e,r)}var Ct=class{constructor(){this.tracks=new Map;this.seq=0;this.easing="spring";this.duration=900;this.omega=8.2;this.animating=!1;this.entranceStart=-1;this.maxDelay=0}configure(t,n){this.easing=t,this.duration=Math.max(1,n),this.omega=7.4/(this.duration/1e3)}sameTargets(t){let n=0;for(let r of this.tracks.values())r.exiting||n++;if(n!==t.length)return!1;for(let r of t){let o=this.tracks.get(r.key);if(!o||o.exiting||!Tt(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),Ur(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Tt(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=Xr(s.cur,s.parts,a.parts,c),s.vel=Xr(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Ur(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=Tt(s.from,s.to)&&s.vel.every(f=>Math.abs(f)<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=Tt(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=Ge(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=Ni(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=Ge(s.from,c)),s.vel.length!==c&&(s.vel=Ge(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 f;if(this.easing==="spring"){let u=Math.exp(-i*l),d=i*l>=8&&i*l<20,h=0;for(let m=0;m<c;m++){let g=s.from[m]-s.to[m],w=s.vel[m]+i*g;s.cur[m]=s.to[m]+(g+w*l)*u,s.curVel[m]=(s.vel[m]-i*w*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[m]-s.to[m]),Math.abs(s.curVel[m]/i)))}f=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=Fi(this.easing,u)/o;for(let m=0;m<c;m++)s.cur[m]=s.from[m]+(s.to[m]-s.from[m])*d,s.curVel[m]=(s.to[m]-s.from[m])*h;f=u>=1,s.progress=d}if(f){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}},Ze=new Set,St=0;function Yr(e){St=0;let t=Array.from(Ze);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ze.delete(n)}Ze.size&&typeof requestAnimationFrame<"u"&&(St=requestAnimationFrame(Yr))}function qr(e){return Ze.add(e),!St&&typeof requestAnimationFrame<"u"&&(St=requestAnimationFrame(Yr)),()=>{Ze.delete(e)}}function Ri(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 Jr(e,t){let n=(0,K.useMemo)(()=>Ri(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:f=0}=t,u=(0,K.useRef)(null),d=(0,K.useRef)("init"),h=(0,K.useRef)(null),m=(0,K.useRef)(s),g=(0,K.useRef)(a),w=(0,K.useRef)(!1),x=(0,K.useRef)(0),[,y]=(0,K.useState)(0),v=(0,K.useRef)(null),M=(0,K.useRef)(!0);u.current||(u.current=new Ct,u.current.configure(l,c),u.current.snap(n),h.current=n);let p=u.current;if(p.configure(l,c),h.current!==n){let _=d.current,A=!Object.is(m.current,s);p.sameTargets(n)?p.refreshData(n):!r||_==="init"?p.snap(n):_==="idle"?p.hold(n):_==="running"||A?p.update(n,nt(),f):p.snap(n),h.current=n,m.current=s}let C=(0,K.useRef)(()=>!1);C.current=_=>{if(!M.current)return!1;let A=p.step(_);return!A&&d.current==="running"&&(d.current="done"),y(S=>(S+1)%1e9),A||(v.current=null),A};let D=(0,K.useCallback)(()=>{if(!fe||v.current||!p.animating)return;let _=A=>C.current(A);v.current=qr(_)},[p]);ye(()=>{let _=!Object.is(g.current,a);if(g.current=a,!r){(d.current!=="done"||p.animating)&&(p.snap(h.current??n),d.current="done",y(A=>A+1));return}d.current==="init"||_&&i?(p.hold(h.current??n),d.current="idle",w.current=!1,y(A=>A+1)):_&&(w.current=!0)},[r,a]),ye(()=>{!r||!i||!w.current||(w.current=!1,p.hold(h.current??n),d.current="idle",y(_=>_+1))},[i,r]),(0,K.useEffect)(()=>{r&&o&&d.current==="idle"&&(p.start(nt()),x.current+=1,d.current="running",D(),y(_=>_+1))},[r,o,a,p,D]),(0,K.useEffect)(()=>{p.animating&&D()}),(0,K.useEffect)(()=>(M.current=!0,()=>{M.current=!1,v.current?.(),v.current=null}),[]);let L=nt(),R=p.elapsed(L),E=r&&d.current==="idle";return{items:p.items(),get:_=>p.get(_),elapsed:E?0:R,fade:(_,A=320)=>E?0:Number.isFinite(R)?Math.max(0,Math.min(1,(R-_)/A)):1,waiting:E,animating:p.animating,generation:x.current}}var sn=N(I(),1);function Qr(e,t,n,r,o){if(r)return o==="categorical"?he(e,t,n):Ln(e,t,n);if(o==="categorical")return he(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 _i=N(W(),1);var ln=N(I(),1);var eo=e=>e?"neutralStrong":"accent";var le=N(W(),1);var Fe=N(W(),1),no=N(I(),1);function to(e){let t=(0,Fe.useRef)(null),n=(0,Fe.useRef)(new Map),[r,o]=(0,Fe.useState)(0),{width:i,height:a,draw:s,progress:l,version:c,clipRight:f,manualClear:u}=e;return(0,Fe.useEffect)(()=>{let d=t.current;if(!d)return;let h=Math.min(2,window.devicePixelRatio||1),m=Math.max(1,Math.round(i*h)),g=Math.max(1,Math.round(a*h));d.width!==m&&(d.width=m),d.height!==g&&(d.height=g);let w=d.getContext("2d");if(!w)return;w.setTransform(h,0,0,h,0,0),u||w.clearRect(0,0,i,a);let x=getComputedStyle(d),y=new Map;s(w,l,(M,p)=>{let C=y.get(M);return C===void 0&&(C=x.getPropertyValue(M).trim(),y.set(M,C)),C||p}),n.current=y},[i,a,s,l,c,u,r]),(0,Fe.useEffect)(()=>{let d=t.current;if(!d||typeof matchMedia!="function")return;let h=new AbortController,m=()=>o(y=>y+1),g=()=>{let y=getComputedStyle(d);for(let[v,M]of n.current)if(y.getPropertyValue(v).trim()!==M)return m()},w=()=>{matchMedia(`(resolution: ${devicePixelRatio}dppx)`).addEventListener?.("change",()=>{w(),m()},{once:!0,signal:h.signal})};w(),matchMedia("(prefers-color-scheme: dark)").addEventListener?.("change",g,{signal:h.signal});let x=new MutationObserver(g);for(let y=d.parentElement;y;y=y.parentElement)x.observe(y,{attributes:!0});return()=>{h.abort(),x.disconnect()}},[]),(0,no.jsx)("canvas",{ref:t,"aria-hidden":"true",style:{position:"absolute",left:0,top:0,width:"100%",height:"auto",aspectRatio:`${i} / ${a}`,pointerEvents:"none",clipPath:f?`inset(0 ${(f/Math.max(1,i)*100).toFixed(3)}% 0 0)`:void 0}})}var J=N(I(),1),Pi={kind:"Beeswarm",group:"Group",med:"Median",nth:e=>`#${e}`,median:(e,t)=>`${e} median ${t}`,desc:(e,t,n)=>`${ve(e,"point")}${n?`, ${ve(t,"group")} (${n})`:""}`},Di={en:Pi,ko:{kind:"비스웜",group:"그룹",med:"중앙값",nth:e=>`${e}번`,median:(e,t)=>`${e} 중앙값 ${t}`,desc:(e,t,n)=>`점 ${e}개${n?`, 그룹 ${t}개(${n})`:""}`}};function cn(e){let t=(0,le.useMemo)(()=>{if(!e.group)return[""];let $=ae(e.group,"group"),P=Pe(e.value,"value");return ie(e.data.flatMap((j,z)=>Number.isFinite(P(j,z))?[$(j,z)]:[]))},[e.data,e.group,e.value]),n=Kr(e,{height:()=>Math.max(160,Math.min(380,t.length*78+30)),duration:900}),{p:r,width:o,height:i}=n,a=(0,le.useMemo)(()=>{let $=Pe(e.value,"value"),P=e.group?ae(e.group,"group"):()=>"",j=ae(e.label,"label");return e.data.map((z,Y)=>({d:z,i:Y,v:$(z,Y),g:P(z,Y),label:j(z,Y)})).filter(z=>Number.isFinite(z.v))},[e.data,e.value,e.group,e.label]),s=t,l=a.length,c=n.hydrated&&l>(e.canvasThreshold??2e3),f=(0,le.useMemo)(()=>{let $=new Map(s.map((j,z)=>[j,z])),P=s.map(()=>[]);return a.forEach((j,z)=>P[$.get(j.g)??0].push(z)),P},[s,a]),[u,d]=(0,le.useMemo)(()=>Le(a.map($=>$.v)),[a]),h=Ae(u,d,4,{zero:!1,pad:.04}),m=e.group?Math.min(o*.26,Math.max(...s.map($=>ke($,11.5,700)),20)+10):0,g=20,w=6,x=Xe(h,[m+10,o-10]),y=(i-w-g)/Math.max(1,s.length),v=l/Math.max(1,s.length),M=e.radius??Math.max(1.4,Math.min(5.5,Math.sqrt((o-m)*y*.5/Math.max(1,v))/2.4)),p=(0,le.useMemo)(()=>f.map($=>hr(Float64Array.from($,P=>a[P].v).sort(),.5)),[f,a]),C=(0,le.useMemo)(()=>e.group?ue(e.highlight,s,s,p,"max"):new Set,[e.group,e.highlight,s,p]),D=(0,le.useMemo)(()=>e.group?new Set:ue(e.highlight,a.map($=>$.d),a.map($=>$.label),a.map($=>$.v),"max"),[e.group,e.highlight,a]),L=n.pending,R=(0,le.useMemo)(()=>{if(L)return[];let $=new Array(l),P=e.group&&e.showMedian!==!1?7:0;return f.forEach((j,z)=>{let Y=j.map(Q=>x(a[Q].v)),Z=Gr(Y,M,{maxSpread:Math.max(M,(y-P)/2-M-1)});j.forEach((Q,hn)=>{let At=a[Q];$[Q]={i:Q,g:z,x:Y[hn],y:w+y*z+P+(y-P)/2+Z[hn],value:At.v,label:At.label,hi:e.group?C.has(z):D.has(Q),datum:At.d}})}),$},[L,a,f,o,i,M,y,C,D,h[0],h[1]]),E=n.motion.duration??900,_=(0,le.useMemo)(()=>c?[{key:"__p",to:[1],from:[0],data:null}]:R.map($=>({key:`b${$.i}`,to:[$.x,$.y,M],from:[$.x,w+y*$.g+y/2,0],enter:[$.x,$.y,0],delay:($.x-m)/Math.max(1,o-m)*E*.6,data:$})),[R,c,M,y,o,m,E]),A=Jr(_,n.motion),S=U(r,"accent"),k=n.fv,T=Di[n.lang],O=T.nth,B=(0,le.useMemo)(()=>kt(R.length,$=>{let P=R[$];return{datum:P.datum,index:P.i,key:`${P.i}`,label:P.label||`${s[P.g]?`${s[P.g]} `:""}${O(P.i+1)}`,series:s[P.g]||void 0,value:P.value,formatted:k(P.value)}}),[R,s,k,O]),te=($,P)=>{let j=-1,z=1/0;for(let Y=0;Y<R.length;Y++){let Z=R[Y],Q=(Z.x-$)**2+(Z.y-P)**2;Q<z&&(z=Q,j=Y)}return Math.sqrt(z)<=M+8?j:null},Me=null;if(n.active!==null&&R[n.active]){let $=R[n.active];Me={x:$.x,y:$.y-M,title:$.label||O($.i+1),rows:[...s[$.g]?[{label:T.group,value:s[$.g]}]:[],{label:n.t.value,value:n.fv($.value),color:$.hi?S.fill:r.paint("neutralStrong")}]}}let G=c?A.get("__p")?.[0]??1:1,ne=(0,le.useCallback)(($,P,j)=>{let z=j("--ztd-neutral-strong",r.theme.neutralStrong),Y=j("--ztd-accent",r.theme.accent);for(let Z of R){let Q=Math.max(0,Math.min(1,(P*1.5-(Z.x-m)/Math.max(1,o-m)*.5)*2));Q<=0||($.fillStyle=Z.hi?Y:z,$.globalAlpha=Z.hi?.95:.7,$.beginPath(),$.arc(Z.x,Z.y,M*Q,0,Math.PI*2),$.fill())}$.globalAlpha=1},[R,M,o,m,r.theme.neutralStrong,r.theme.accent]),de=x.ticks(Math.max(2,Math.round(o/110))),we=e.description??`${T.kind}. ${T.desc(l,s.length,e.group?s.map(($,P)=>T.median($,n.fv(p[P]))).join(", "):"")}.`;return(0,J.jsxs)(Zn,{c:n,kind:T.kind,ariaLabel:e.ariaLabel,description:we,events:B,tip:Me,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:($,P,j)=>{let z=te($,P);z!==n.active&&n.setActive(z,j.pointerType==="touch"?"touch":"pointer")},underlay:c?(0,J.jsx)(to,{width:o,height:i,draw:ne,progress:G,version:n.sig}):void 0,children:[(0,J.jsxs)("g",{"aria-hidden":"true",children:[de.map($=>(0,J.jsxs)("g",{children:[(0,J.jsx)("line",{x1:x($),x2:x($),y1:w,y2:i-g,stroke:r.paint("line")}),(0,J.jsx)(gt,{x:x($),y:i-g+11,anchor:"middle",size:Ue,fill:r.paint("muted"),children:n.fmt($)})]},$)),e.group?s.map(($,P)=>(0,J.jsxs)("g",{children:[P>0?(0,J.jsx)("line",{x1:m,x2:o,y1:w+y*P,y2:w+y*P,stroke:r.paint("line"),strokeDasharray:"2 3"}):null,(0,J.jsx)(gt,{x:m,y:w+y*P+y/2,anchor:"end",size:11.5,weight:C.has(P)?800:600,fill:r.paint(C.has(P)?"ink":"muted"),children:Qt($,m-4,11.5,700)})]},$)):null]}),c?n.active!==null&&R[n.active]?(0,J.jsx)("circle",{cx:R[n.active].x,cy:R[n.active].y,r:M+2,fill:"none",stroke:r.paint("ink"),strokeWidth:1.6,pointerEvents:"none"}):null:A.items.map($=>{let P=$.data;if(!P)return null;let[j,z,Y]=$.v,Z=n.active===P.i;return(0,J.jsx)("circle",{cx:j,cy:z,r:Math.max(0,Y),fill:P.hi?S.fill:r.paint("neutralStrong"),fillOpacity:P.hi?.95:.72,stroke:Z?r.paint("ink"):"none",strokeWidth:1.6,onPointerEnter:Q=>n.setActive(P.i,Q.pointerType==="touch"?"touch":"pointer"),onClick:()=>n.click(P.i)},$.key)}),e.showMedian!==!1&&e.group?s.map(($,P)=>{let j=x(p[P]),z=w+y*P+2,Y=`${T.med} ${n.fv(p[P])}`,Z=ke(Y,10,700)+10;return(0,J.jsxs)("g",{opacity:A.fade(E*.7,300),pointerEvents:"none",children:[(0,J.jsx)("line",{x1:j,x2:j,y1:z+10,y2:z+y-6,stroke:r.paint("ink"),strokeWidth:1.6,strokeDasharray:"3 2"}),(0,J.jsx)("rect",{x:j-Z/2,y:z-3,width:Z,height:14,rx:5,fill:r.paint("panel"),opacity:.92}),(0,J.jsx)(gt,{x:j,y:z+4,anchor:"middle",size:10,weight:700,fill:r.paint("ink"),children:Y})]},$)}):null]})}var un=N(I(),1);function ro(e,t,n,r){if(typeof e!="function")return ue(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 Li=N(W(),1);var dn=N(I(),1),Ei={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}, ${ve(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},oo={en:Ei,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}일 이동평균`}},mn=["ink","muted","dim"];function ao(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,mn.length)}var Oi=N(W(),1);var uo=N(I(),1),Ii={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ve(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},zi={en:Ii,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},io=(e,t)=>zi[e].other(t);function so(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((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,fr(o.map(i=>i.value)))}}var lo=e=>Number.isFinite(e)&&e>0?e:0;function co(e,t,n,r){return r==="emphasis"?Dn(e,t,n):he(e,t,n)}var Bi=N(W(),1);var go=N(I(),1);function mo(e,t){return t===!1?e.map((n,r)=>r):dr(e)}function fo(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return ue(e,t,t,r,"max")}function ho(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"):ot(e,1-a/Math.max(1,o.length-1))),r}function po(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ie(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function bo(e,t){return Ve(e,t+1,new Set)}var Hi=N(W(),1);var xo=N(I(),1);function yo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Pr.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var $e=N(I(),1);function ko(e,t,n){let r=bt(e);return r?.type==="scatter"&&t?.size!==void 0&&!pt(n)?bt("bubble"):r}function ji(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 Gi(e,t,n,r=!1){let o=ko(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&&Yt.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),f=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(f.includes(o.type)){let u=ae(i.label,"label"),d=Pe(i.value,"value"),h=o.type==="waffle",m=t.map((p,C)=>({r:p,label:u(p,C),value:h?d(p,C):lo(d(p,C))})),{kept:g,other:w}=h?{kept:m,other:null}:so(m,a.other,(p,C)=>({r:{},label:io(V(n),p),value:C})),x=ue(s,g.map(p=>p.r),g.map(p=>p.label),g.map(p=>p.value),h?"first":"max"),y=w?[...g,w]:g,v=Ce(p=>h?he(p,y.length,x):co(p,y.length,x,a.colorMode)),M=h&&a.shape==="arc";return y.map((p,C)=>({label:p.label,color:v[C],...M&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=ao(Array.isArray(a.ma)?a.ma:void 0,t.length),d=oo[V(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((h,m)=>({label:d.maLegend(h),color:mn[m],shape:"line"}))]}if(o.type==="network"){let u=po(a.groups);if(u.length<2)return[];let d=Ce(h=>bo(h,u.length));return u.map((h,m)=>({label:h,color:d[m],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ae(i.group,"group"),d=ie(t.map((m,g)=>u(m,g)).filter(Boolean));if(d.length<2)return[];let h=Ce(m=>Ve(m,d.length,new Set));return d.map((m,g)=>({label:m,color:h[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||pt(a))return[];let u=ae(i.series,"series"),d=ie(t.map((g,w)=>u(g,w)));if(d.length<2)return[];let h=ro(s,t,d,u),m=Ce(g=>Ve(g,d.length,h));return c(d.map((g,w)=>({label:g,color:m[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=Wr(t,d,u),m=Ce(g=>he(g,h.length,yo(s,h)));return c(h.map((g,w)=>({label:g,color:m[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=ae(i.series,"series");u=ie(t.map((M,p)=>v(M,p)))}let d=qt(o.type,i,a);if(d.length){let v=ue(s,u,u,u.map(()=>0),"none"),M=Ce(C=>he(C,u.length,v)),p=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((C,D)=>({label:C,color:M[D]}));return[...c(p),...d.map((C,D)=>({label:C,color:eo(D),shape:"line"}))]}if(u.length<2)return[];let m=o.type==="bar"&&a.layout==="diverging"&&s===void 0?mr(u.length,Array.isArray(a.negative)?a.negative.map(v=>u.indexOf(String(v))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,g=m>=0?new Set([m]):ue(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,M)=>({label:v,color:g.has(M)?"accent":"neutralStrong",shape:"square"})));let w=a.colorMode,x=v=>he(v,u.length,g);if((o.type==="line"||o.type==="area")&&(x=v=>Qr(v,u.length,g,o.type==="area",w)),o.type==="stream"){let v=Ye(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),M=mo(v.values,a.reorder),p=fo(s,v.series,v.values);x=C=>ho(C,M,p)}let y=Ce(x);return c(u.map((v,M)=>({label:v,color:y[M],...o.type==="line"&&{shape:"line"}})))}return[]}function Wi(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&rr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Vi(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...f}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:f,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function wo(e,t){let{spec:n}=e,r=ko(n.type,n.encoding,n.options),o=(0,Qe.useMemo)(()=>Vr(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=nr(n,e.locale),s=re(a),l=V(s),c=Dr(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),f=ir(n),u=(0,Qe.useMemo)(()=>f?Hr(f,s):void 0,[f,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],m=h.join(""),[g,w]=(0,Qe.useState)(null);if(!r)return(0,$e.jsx)(Xt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??c.data,y=t[r.type],v={...n.options??{}},M={...ji(r,n.encoding),...v,...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},p=n.card?.legend==="toggle"&&ar(r.type,n.encoding??{},v),C=g&&g.base===m?g.hidden:h;p&&(M.hidden=C);let D=A=>w(S=>{let k=S&&S.base===m?S.hidden:h;return{base:m,hidden:k.includes(A)?k.filter(T=>T!==A):[...k,A]}}),L=M.height??220,R=Wi(n,r.type),E=i&&!x.length&&(c.loading||c.error||c.empty)?(0,$e.jsx)(Xt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:L,locale:a}):R?(0,$e.jsx)(_r,{chart:y,...Vi(r.type,R,M)}):(0,$e.jsx)(y,{...M});if(n.card){let A=n.card,S=A.legend==="auto"||A.legend==="toggle"?Gi(n,x,s,p):A.legend,k=S?.length?p?(0,$e.jsx)(Ut,{items:S,hidden:C,onToggle:D,locale:a}):S:void 0,T=A.download?(0,$e.jsx)(Br,{data:x,columns:sr(n),filename:A.title??r.type,formats:Array.isArray(A.download)?A.download:void 0,locale:a}):void 0;E=(0,$e.jsx)(Jn,{number:A.number,title:A.title??tr(r,l),subtitle:A.subtitle,legend:k,actions:T,source:A.source||void 0,note:A.note||void 0,accent:A.accent,takeaway:A.takeaway,level:A.level,sample:A.sample,replay:A.replay!==!1,className:e.className,locale:a,children:E})}let _=e.theme??n.theme;return _&&(E=(0,$e.jsx)(ut,{theme:_,children:E})),E}function Ki({cfg:e,components:t}){let n=He();return wo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function $o(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,vo.hydrateRoot)(r,(0,fn.createElement)(ut,{theme:o.theme,cssVars:!0},(0,fn.createElement)(Ki,{cfg:o,components:{[e]:t}})))}$o("beeswarm",cn);})();
|
|
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?Ke(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(Wn,(f,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,jr.jsx)("div",{children:s},l)):null}}function Gr(e,t,n={}){let o=2*(t+(n.padding??.6)),i=o*o,a=e.length,s=Array.from({length:a},(x,y)=>y).sort((x,y)=>e[x]-e[y]),l=new Float64Array(a),c=new Float64Array(a),f=new Array(a).fill(0),u=n.maxSpread??1/0,d=new Float64Array(64),h=new Float64Array(64),m=0,g=0,w=0;for(let x of s){let y=e[x];for(;m<g&&l[m]<y-o;)m++;g-m>d.length&&(d=new Float64Array(2*(g-m)),h=new Float64Array(d.length));let v=0;for(let p=m;p<g;p++){let C=y-l[p],D=i-1e-6-C*C;if(D<=0)continue;let L=Math.sqrt(D);d[v]=c[p]-L,h[v]=c[p]+L,v++}let M=0;if(v>0){let p=d.subarray(0,v).sort(),C=h.subarray(0,v).sort(),D=0,L=0,R=0;for(let E=0;E<v;)if(D<v&&p[D]<C[E]){if(L===0&&(R=p[D],R>=0))break;L++,D++}else{if(L--,L===0&&C[E]>0){let _=-R<C[E]-1e-6?R:C[E],A=_===R?C[E]:R;M=Math.abs(_)<=u?_:Math.abs(A)<=u?A:NaN;break}E++}}if(Number.isNaN(M)){f[x]=(w++*.6180339887498949%1*2-1)*u;continue}f[x]=M,l[g]=y,c[g]=M,g++}return f}function Wr(e,t,n=!1){let r=ae(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=ie(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 Vr(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 De(t.csv)}return null}var Zr=N(W(),1);var X=N(W(),1);function Kr(e,t){let n=pe(e.theme),[r,o,i]=$t(e.width),a=He(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,f=Mt(e.reducedMotion??"auto"),u=e.animate!==!1&&!f&&fe,d=Rr(r,e.animateOnView!==!1&&u),h=re(e.locale),m=V(h),g=(0,X.useMemo)(()=>Re(e.format,h,t.format),[e.format,h,t.format]),w=(0,X.useCallback)(G=>at(G,{locale:h}),[h]),x=(0,X.useMemo)(()=>it(g,e.unit),[g,e.unit]),y=(0,X.useMemo)(()=>yt(e.data),[e.data]),[v,M]=(0,X.useState)(null),[p,C]=(0,X.useState)(null),D=(0,X.useRef)([]),L=(0,X.useRef)(e.onHover);L.current=e.onHover;let R=(0,X.useRef)(e.onClick);R.current=e.onClick;let E=(0,X.useRef)(null),_=(0,X.useRef)(null),A=(0,X.useRef)(null),S=(0,X.useCallback)((G,ne="pointer")=>{if(A.current!==G){A.current=G;let de=G===null?null:D.current[G]??null;queueMicrotask(()=>L.current?.(de)),_.current?.(G)}E.current=G===null?null:ne,M(G),C(E.current)},[]),k=(0,X.useCallback)(G=>{E.current!=="keyboard"&&(E.current=G===null?null:"sync",M(G),C(E.current))},[]),T=(0,X.useCallback)(G=>{let ne=D.current[G];ne&&R.current?.(ne)},[]),O=qn(e.replayKey),B=e.width!==void 0||(i??0)>0,te={enabled:u,active:d.visible&&B,near:d.near,replayKey:O,dataKey:y,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Me=(0,X.useCallback)((G,ne=1)=>v===null||v===G?ne:ne*.38,[v]);return{p:n,width:s,height:c,measured:B,responsive:e.width===void 0,pending:fe&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:te,fv:x,fmt:g,pct:w,locale:h,lang:m,t:m==="ko"?Sn:Cn,active:v,via:p,setActive:S,click:T,events:D,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Me,sig:y,description:e.description,reduced:f,publish:_,applySync:k}}var K=N(W(),1);function Si(e){return 1-Math.pow(1-e,3)}function Ai(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ni(e){return e==="easeInOut"?Ai:e==="linear"?t=>t:Si}function Fi(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 Ge(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 Tt(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 Ur(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 Xr(e,t,n,r){if(!t||!n||t.length!==n.length)return Ge(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 Ge(s,n[a]))o.push(l)}return o.length===r?o:Ge(e,r)}var Ct=class{constructor(){this.tracks=new Map;this.seq=0;this.easing="spring";this.duration=900;this.omega=8.2;this.animating=!1;this.entranceStart=-1;this.maxDelay=0}configure(t,n){this.easing=t,this.duration=Math.max(1,n),this.omega=7.4/(this.duration/1e3)}sameTargets(t){let n=0;for(let r of this.tracks.values())r.exiting||n++;if(n!==t.length)return!1;for(let r of t){let o=this.tracks.get(r.key);if(!o||o.exiting||!Tt(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),Ur(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Tt(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=Xr(s.cur,s.parts,a.parts,c),s.vel=Xr(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Ur(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=Tt(s.from,s.to)&&s.vel.every(f=>Math.abs(f)<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=Tt(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=Ge(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=Ni(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=Ge(s.from,c)),s.vel.length!==c&&(s.vel=Ge(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 f;if(this.easing==="spring"){let u=Math.exp(-i*l),d=i*l>=8&&i*l<20,h=0;for(let m=0;m<c;m++){let g=s.from[m]-s.to[m],w=s.vel[m]+i*g;s.cur[m]=s.to[m]+(g+w*l)*u,s.curVel[m]=(s.vel[m]-i*w*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[m]-s.to[m]),Math.abs(s.curVel[m]/i)))}f=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=Fi(this.easing,u)/o;for(let m=0;m<c;m++)s.cur[m]=s.from[m]+(s.to[m]-s.from[m])*d,s.curVel[m]=(s.to[m]-s.from[m])*h;f=u>=1,s.progress=d}if(f){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}},Ze=new Set,St=0;function Yr(e){St=0;let t=Array.from(Ze);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ze.delete(n)}Ze.size&&typeof requestAnimationFrame<"u"&&(St=requestAnimationFrame(Yr))}function qr(e){return Ze.add(e),!St&&typeof requestAnimationFrame<"u"&&(St=requestAnimationFrame(Yr)),()=>{Ze.delete(e)}}function Ri(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 Jr(e,t){let n=(0,K.useMemo)(()=>Ri(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:f=0}=t,u=(0,K.useRef)(null),d=(0,K.useRef)("init"),h=(0,K.useRef)(null),m=(0,K.useRef)(s),g=(0,K.useRef)(a),w=(0,K.useRef)(!1),x=(0,K.useRef)(0),[,y]=(0,K.useState)(0),v=(0,K.useRef)(null),M=(0,K.useRef)(!0);u.current||(u.current=new Ct,u.current.configure(l,c),u.current.snap(n),h.current=n);let p=u.current;if(p.configure(l,c),h.current!==n){let _=d.current,A=!Object.is(m.current,s);p.sameTargets(n)?p.refreshData(n):!r||_==="init"?p.snap(n):_==="idle"?p.hold(n):_==="running"||A?p.update(n,nt(),f):p.snap(n),h.current=n,m.current=s}let C=(0,K.useRef)(()=>!1);C.current=_=>{if(!M.current)return!1;let A=p.step(_);return!A&&d.current==="running"&&(d.current="done"),y(S=>(S+1)%1e9),A||(v.current=null),A};let D=(0,K.useCallback)(()=>{if(!fe||v.current||!p.animating)return;let _=A=>C.current(A);v.current=qr(_)},[p]);ye(()=>{let _=!Object.is(g.current,a);if(g.current=a,!r){(d.current!=="done"||p.animating)&&(p.snap(h.current??n),d.current="done",y(A=>A+1));return}d.current==="init"||_&&i?(p.hold(h.current??n),d.current="idle",w.current=!1,y(A=>A+1)):_&&(w.current=!0)},[r,a]),ye(()=>{!r||!i||!w.current||(w.current=!1,p.hold(h.current??n),d.current="idle",y(_=>_+1))},[i,r]),(0,K.useEffect)(()=>{r&&o&&d.current==="idle"&&(p.start(nt()),x.current+=1,d.current="running",D(),y(_=>_+1))},[r,o,a,p,D]),(0,K.useEffect)(()=>{p.animating&&D()}),(0,K.useEffect)(()=>(M.current=!0,()=>{M.current=!1,v.current?.(),v.current=null}),[]);let L=nt(),R=p.elapsed(L),E=r&&d.current==="idle";return{items:p.items(),get:_=>p.get(_),elapsed:E?0:R,fade:(_,A=320)=>E?0:Number.isFinite(R)?Math.max(0,Math.min(1,(R-_)/A)):1,waiting:E,animating:p.animating,generation:x.current}}var sn=N(I(),1);function Qr(e,t,n,r,o){if(r)return o==="categorical"?he(e,t,n):Ln(e,t,n);if(o==="categorical")return he(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 _i=N(W(),1);var ln=N(I(),1);var eo=e=>e?"neutralStrong":"accent";var le=N(W(),1);var Fe=N(W(),1),no=N(I(),1);function to(e){let t=(0,Fe.useRef)(null),n=(0,Fe.useRef)(new Map),[r,o]=(0,Fe.useState)(0),{width:i,height:a,draw:s,progress:l,version:c,clipRight:f,manualClear:u}=e;return(0,Fe.useEffect)(()=>{let d=t.current;if(!d)return;let h=Math.min(2,window.devicePixelRatio||1),m=Math.max(1,Math.round(i*h)),g=Math.max(1,Math.round(a*h));d.width!==m&&(d.width=m),d.height!==g&&(d.height=g);let w=d.getContext("2d");if(!w)return;w.setTransform(h,0,0,h,0,0),u||w.clearRect(0,0,i,a);let x=getComputedStyle(d),y=new Map;s(w,l,(M,p)=>{let C=y.get(M);return C===void 0&&(C=x.getPropertyValue(M).trim(),y.set(M,C)),C||p}),n.current=y},[i,a,s,l,c,u,r]),(0,Fe.useEffect)(()=>{let d=t.current;if(!d||typeof matchMedia!="function")return;let h=new AbortController,m=()=>o(y=>y+1),g=()=>{let y=getComputedStyle(d);for(let[v,M]of n.current)if(y.getPropertyValue(v).trim()!==M)return m()},w=()=>{matchMedia(`(resolution: ${devicePixelRatio}dppx)`).addEventListener?.("change",()=>{w(),m()},{once:!0,signal:h.signal})};w(),matchMedia("(prefers-color-scheme: dark)").addEventListener?.("change",g,{signal:h.signal});let x=new MutationObserver(g);for(let y=d.parentElement;y;y=y.parentElement)x.observe(y,{attributes:!0});return()=>{h.abort(),x.disconnect()}},[]),(0,no.jsx)("canvas",{ref:t,"aria-hidden":"true",style:{position:"absolute",left:0,top:0,width:"100%",height:"auto",aspectRatio:`${i} / ${a}`,pointerEvents:"none",clipPath:f?`inset(0 ${(f/Math.max(1,i)*100).toFixed(3)}% 0 0)`:void 0}})}var J=N(I(),1),Pi={kind:"Beeswarm",group:"Group",med:"Median",nth:e=>`#${e}`,median:(e,t)=>`${e} median ${t}`,desc:(e,t,n)=>`${ve(e,"point")}${n?`, ${ve(t,"group")} (${n})`:""}`},Di={en:Pi,ko:{kind:"비스웜",group:"그룹",med:"중앙값",nth:e=>`${e}번`,median:(e,t)=>`${e} 중앙값 ${t}`,desc:(e,t,n)=>`점 ${e}개${n?`, 그룹 ${t}개(${n})`:""}`}};function cn(e){let t=(0,le.useMemo)(()=>{if(!e.group)return[""];let $=ae(e.group,"group"),P=Pe(e.value,"value");return ie(e.data.flatMap((j,z)=>Number.isFinite(P(j,z))?[$(j,z)]:[]))},[e.data,e.group,e.value]),n=Kr(e,{height:()=>Math.max(160,Math.min(380,t.length*78+30)),duration:900}),{p:r,width:o,height:i}=n,a=(0,le.useMemo)(()=>{let $=Pe(e.value,"value"),P=e.group?ae(e.group,"group"):()=>"",j=ae(e.label,"label");return e.data.map((z,Y)=>({d:z,i:Y,v:$(z,Y),g:P(z,Y),label:j(z,Y)})).filter(z=>Number.isFinite(z.v))},[e.data,e.value,e.group,e.label]),s=t,l=a.length,c=n.hydrated&&l>(e.canvasThreshold??2e3),f=(0,le.useMemo)(()=>{let $=new Map(s.map((j,z)=>[j,z])),P=s.map(()=>[]);return a.forEach((j,z)=>P[$.get(j.g)??0].push(z)),P},[s,a]),[u,d]=(0,le.useMemo)(()=>Le(a.map($=>$.v)),[a]),h=Ae(u,d,4,{zero:!1,pad:.04}),m=e.group?Math.min(o*.26,Math.max(...s.map($=>ke($,11.5,700)),20)+10):0,g=20,w=6,x=Xe(h,[m+10,o-10]),y=(i-w-g)/Math.max(1,s.length),v=l/Math.max(1,s.length),M=e.radius??Math.max(1.4,Math.min(5.5,Math.sqrt((o-m)*y*.5/Math.max(1,v))/2.4)),p=(0,le.useMemo)(()=>f.map($=>hr(Float64Array.from($,P=>a[P].v).sort(),.5)),[f,a]),C=(0,le.useMemo)(()=>e.group?ue(e.highlight,s,s,p,"max"):new Set,[e.group,e.highlight,s,p]),D=(0,le.useMemo)(()=>e.group?new Set:ue(e.highlight,a.map($=>$.d),a.map($=>$.label),a.map($=>$.v),"max"),[e.group,e.highlight,a]),L=n.pending,R=(0,le.useMemo)(()=>{if(L)return[];let $=new Array(l),P=e.group&&e.showMedian!==!1?7:0;return f.forEach((j,z)=>{let Y=j.map(Q=>x(a[Q].v)),Z=Gr(Y,M,{maxSpread:Math.max(M,(y-P)/2-M-1)});j.forEach((Q,hn)=>{let At=a[Q];$[Q]={i:Q,g:z,x:Y[hn],y:w+y*z+P+(y-P)/2+Z[hn],value:At.v,label:At.label,hi:e.group?C.has(z):D.has(Q),datum:At.d}})}),$},[L,a,f,o,i,M,y,C,D,h[0],h[1]]),E=n.motion.duration??900,_=(0,le.useMemo)(()=>c?[{key:"__p",to:[1],from:[0],data:null}]:R.map($=>({key:`b${$.i}`,to:[$.x,$.y,M],from:[$.x,w+y*$.g+y/2,0],enter:[$.x,$.y,0],delay:($.x-m)/Math.max(1,o-m)*E*.6,data:$})),[R,c,M,y,o,m,E]),A=Jr(_,n.motion),S=U(r,"accent"),k=n.fv,T=Di[n.lang],O=T.nth,B=(0,le.useMemo)(()=>kt(R.length,$=>{let P=R[$];return{datum:P.datum,index:P.i,key:`${P.i}`,label:P.label||`${s[P.g]?`${s[P.g]} `:""}${O(P.i+1)}`,series:s[P.g]||void 0,value:P.value,formatted:k(P.value)}}),[R,s,k,O]),te=($,P)=>{let j=-1,z=1/0;for(let Y=0;Y<R.length;Y++){let Z=R[Y],Q=(Z.x-$)**2+(Z.y-P)**2;Q<z&&(z=Q,j=Y)}return Math.sqrt(z)<=M+8?j:null},Me=null;if(n.active!==null&&R[n.active]){let $=R[n.active];Me={x:$.x,y:$.y-M,title:$.label||O($.i+1),rows:[...s[$.g]?[{label:T.group,value:s[$.g]}]:[],{label:n.t.value,value:n.fv($.value),color:$.hi?S.fill:r.paint("neutralStrong")}]}}let G=c?A.get("__p")?.[0]??1:1,ne=(0,le.useCallback)(($,P,j)=>{let z=j("--ztd-neutral-strong",r.theme.neutralStrong),Y=j("--ztd-accent",r.theme.accent);for(let Z of R){let Q=Math.max(0,Math.min(1,(P*1.5-(Z.x-m)/Math.max(1,o-m)*.5)*2));Q<=0||($.fillStyle=Z.hi?Y:z,$.globalAlpha=Z.hi?.95:.7,$.beginPath(),$.arc(Z.x,Z.y,M*Q,0,Math.PI*2),$.fill())}$.globalAlpha=1},[R,M,o,m,r.theme.neutralStrong,r.theme.accent]),de=x.ticks(Math.max(2,Math.round(o/110))),we=e.description??`${T.kind}. ${T.desc(l,s.length,e.group?s.map(($,P)=>T.median($,n.fv(p[P]))).join(", "):"")}.`;return(0,J.jsxs)(Zn,{c:n,kind:T.kind,ariaLabel:e.ariaLabel,description:we,events:B,tip:Me,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:($,P,j)=>{let z=te($,P);z!==n.active&&n.setActive(z,j.pointerType==="touch"?"touch":"pointer")},underlay:c?(0,J.jsx)(to,{width:o,height:i,draw:ne,progress:G,version:n.sig}):void 0,children:[(0,J.jsxs)("g",{"aria-hidden":"true",children:[de.map($=>(0,J.jsxs)("g",{children:[(0,J.jsx)("line",{x1:x($),x2:x($),y1:w,y2:i-g,stroke:r.paint("line")}),(0,J.jsx)(gt,{x:x($),y:i-g+11,anchor:"middle",size:Ue,fill:r.paint("muted"),children:n.fmt($)})]},$)),e.group?s.map(($,P)=>(0,J.jsxs)("g",{children:[P>0?(0,J.jsx)("line",{x1:m,x2:o,y1:w+y*P,y2:w+y*P,stroke:r.paint("line"),strokeDasharray:"2 3"}):null,(0,J.jsx)(gt,{x:m,y:w+y*P+y/2,anchor:"end",size:11.5,weight:C.has(P)?800:600,fill:r.paint(C.has(P)?"ink":"muted"),children:Qt($,m-4,11.5,700)})]},$)):null]}),c?n.active!==null&&R[n.active]?(0,J.jsx)("circle",{cx:R[n.active].x,cy:R[n.active].y,r:M+2,fill:"none",stroke:r.paint("ink"),strokeWidth:1.6,pointerEvents:"none"}):null:A.items.map($=>{let P=$.data;if(!P)return null;let[j,z,Y]=$.v,Z=n.active===P.i;return(0,J.jsx)("circle",{cx:j,cy:z,r:Math.max(0,Y),fill:P.hi?S.fill:r.paint("neutralStrong"),fillOpacity:P.hi?.95:.72,stroke:Z?r.paint("ink"):"none",strokeWidth:1.6,onPointerEnter:Q=>n.setActive(P.i,Q.pointerType==="touch"?"touch":"pointer"),onClick:()=>n.click(P.i)},$.key)}),e.showMedian!==!1&&e.group?s.map(($,P)=>{let j=x(p[P]),z=w+y*P+2,Y=`${T.med} ${n.fv(p[P])}`,Z=ke(Y,10,700)+10;return(0,J.jsxs)("g",{opacity:A.fade(E*.7,300),pointerEvents:"none",children:[(0,J.jsx)("line",{x1:j,x2:j,y1:z+10,y2:z+y-6,stroke:r.paint("ink"),strokeWidth:1.6,strokeDasharray:"3 2"}),(0,J.jsx)("rect",{x:j-Z/2,y:z-3,width:Z,height:14,rx:5,fill:r.paint("panel"),opacity:.92}),(0,J.jsx)(gt,{x:j,y:z+4,anchor:"middle",size:10,weight:700,fill:r.paint("ink"),children:Y})]},$)}):null]})}var un=N(I(),1);function ro(e,t,n,r){if(typeof e!="function")return ue(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 Li=N(W(),1);var dn=N(I(),1),Ei={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}, ${ve(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},oo={en:Ei,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}일 이동평균`}},mn=["ink","muted","dim"];function ao(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,mn.length)}var Oi=N(W(),1);var uo=N(I(),1),Ii={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ve(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},zi={en:Ii,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},io=(e,t)=>zi[e].other(t);function so(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((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,fr(o.map(i=>i.value)))}}var lo=e=>Number.isFinite(e)&&e>0?e:0;function co(e,t,n,r){return r==="emphasis"?Dn(e,t,n):he(e,t,n)}var Bi=N(W(),1);var go=N(I(),1);function mo(e,t){return t===!1?e.map((n,r)=>r):dr(e)}function fo(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return ue(e,t,t,r,"max")}function ho(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"):ot(e,1-a/Math.max(1,o.length-1))),r}function po(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ie(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function bo(e,t){return Ve(e,t+1,new Set)}var Hi=N(W(),1);var xo=N(I(),1);var ji=26;var Rc=ji*.62;function yo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Pr.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var $e=N(I(),1);function ko(e,t,n){let r=bt(e);return r?.type==="scatter"&&t?.size!==void 0&&!pt(n)?bt("bubble"):r}function Gi(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 Wi(e,t,n,r=!1){let o=ko(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&&Yt.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),f=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(f.includes(o.type)){let u=ae(i.label,"label"),d=Pe(i.value,"value"),h=o.type==="waffle",m=t.map((p,C)=>({r:p,label:u(p,C),value:h?d(p,C):lo(d(p,C))})),{kept:g,other:w}=h?{kept:m,other:null}:so(m,a.other,(p,C)=>({r:{},label:io(V(n),p),value:C})),x=ue(s,g.map(p=>p.r),g.map(p=>p.label),g.map(p=>p.value),h?"first":"max"),y=w?[...g,w]:g,v=Ce(p=>h?he(p,y.length,x):co(p,y.length,x,a.colorMode)),M=h&&a.shape==="arc";return y.map((p,C)=>({label:p.label,color:v[C],...M&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=ao(Array.isArray(a.ma)?a.ma:void 0,t.length),d=oo[V(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((h,m)=>({label:d.maLegend(h),color:mn[m],shape:"line"}))]}if(o.type==="network"){let u=po(a.groups);if(u.length<2)return[];let d=Ce(h=>bo(h,u.length));return u.map((h,m)=>({label:h,color:d[m],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ae(i.group,"group"),d=ie(t.map((m,g)=>u(m,g)).filter(Boolean));if(d.length<2)return[];let h=Ce(m=>Ve(m,d.length,new Set));return d.map((m,g)=>({label:m,color:h[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||pt(a))return[];let u=ae(i.series,"series"),d=ie(t.map((g,w)=>u(g,w)));if(d.length<2)return[];let h=ro(s,t,d,u),m=Ce(g=>Ve(g,d.length,h));return c(d.map((g,w)=>({label:g,color:m[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=Wr(t,d,u),m=Ce(g=>he(g,h.length,yo(s,h)));return c(h.map((g,w)=>({label:g,color:m[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=ae(i.series,"series");u=ie(t.map((M,p)=>v(M,p)))}let d=qt(o.type,i,a);if(d.length){let v=ue(s,u,u,u.map(()=>0),"none"),M=Ce(C=>he(C,u.length,v)),p=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((C,D)=>({label:C,color:M[D]}));return[...c(p),...d.map((C,D)=>({label:C,color:eo(D),shape:"line"}))]}if(u.length<2)return[];let m=o.type==="bar"&&a.layout==="diverging"&&s===void 0?mr(u.length,Array.isArray(a.negative)?a.negative.map(v=>u.indexOf(String(v))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,g=m>=0?new Set([m]):ue(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,M)=>({label:v,color:g.has(M)?"accent":"neutralStrong",shape:"square"})));let w=a.colorMode,x=v=>he(v,u.length,g);if((o.type==="line"||o.type==="area")&&(x=v=>Qr(v,u.length,g,o.type==="area",w)),o.type==="stream"){let v=Ye(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),M=mo(v.values,a.reorder),p=fo(s,v.series,v.values);x=C=>ho(C,M,p)}let y=Ce(x);return c(u.map((v,M)=>({label:v,color:y[M],...o.type==="line"&&{shape:"line"}})))}return[]}function Vi(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&rr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ki(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...f}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:f,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function wo(e,t){let{spec:n}=e,r=ko(n.type,n.encoding,n.options),o=(0,Qe.useMemo)(()=>Vr(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=nr(n,e.locale),s=re(a),l=V(s),c=Dr(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),f=ir(n),u=(0,Qe.useMemo)(()=>f?Hr(f,s):void 0,[f,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],m=h.join(""),[g,w]=(0,Qe.useState)(null);if(!r)return(0,$e.jsx)(Xt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??c.data,y=t[r.type],v={...n.options??{}},M={...Gi(r,n.encoding),...v,...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},p=n.card?.legend==="toggle"&&ar(r.type,n.encoding??{},v),C=g&&g.base===m?g.hidden:h;p&&(M.hidden=C);let D=A=>w(S=>{let k=S&&S.base===m?S.hidden:h;return{base:m,hidden:k.includes(A)?k.filter(T=>T!==A):[...k,A]}}),L=M.height??220,R=Vi(n,r.type),E=i&&!x.length&&(c.loading||c.error||c.empty)?(0,$e.jsx)(Xt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:L,locale:a}):R?(0,$e.jsx)(_r,{chart:y,...Ki(r.type,R,M)}):(0,$e.jsx)(y,{...M});if(n.card){let A=n.card,S=A.legend==="auto"||A.legend==="toggle"?Wi(n,x,s,p):A.legend,k=S?.length?p?(0,$e.jsx)(Ut,{items:S,hidden:C,onToggle:D,locale:a}):S:void 0,T=A.download?(0,$e.jsx)(Br,{data:x,columns:sr(n),filename:A.title??r.type,formats:Array.isArray(A.download)?A.download:void 0,locale:a}):void 0;E=(0,$e.jsx)(Jn,{number:A.number,title:A.title??tr(r,l),subtitle:A.subtitle,legend:k,actions:T,source:A.source||void 0,note:A.note||void 0,accent:A.accent,takeaway:A.takeaway,level:A.level,sample:A.sample,replay:A.replay!==!1,className:e.className,locale:a,children:E})}let _=e.theme??n.theme;return _&&(E=(0,$e.jsx)(ut,{theme:_,children:E})),E}function Ui({cfg:e,components:t}){let n=He();return wo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function $o(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,vo.hydrateRoot)(r,(0,fn.createElement)(ut,{theme:o.theme,cssVars:!0},(0,fn.createElement)(Ui,{cfg:o,components:{[e]:t}})))}$o("beeswarm",cn);})();
|