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/segmented.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var bo=Object.create;var cn=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty;var kt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var vo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xo(t))!wo.call(e,o)&&o!==n&&cn(e,o,{get:()=>t[o],enumerable:!(r=yo(t,o))||r.enumerable});return e};var S=(e,t,n)=>(n=e!=null?bo(ko(e)):{},vo(t||!e||!e.__esModule?cn(n,"default",{value:e,enumerable:!0}):n,e));var H=kt((
|
|
1
|
+
(()=>{var bo=Object.create;var cn=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty;var kt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var vo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xo(t))!wo.call(e,o)&&o!==n&&cn(e,o,{get:()=>t[o],enumerable:!(r=yo(t,o))||r.enumerable});return e};var S=(e,t,n)=>(n=e!=null?bo(ko(e)):{},vo(t||!e||!e.__esModule?cn(n,"default",{value:e,enumerable:!0}):n,e));var H=kt((ji,un)=>{un.exports=globalThis.__ztdReact.react});var dn=kt((Gi,mn)=>{mn.exports=globalThis.__ztdReact["react-dom/client"]});var E=kt((rs,Hn)=>{Hn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var sn=S(H(),1),go=S(dn(),1);var We=S(H(),1);var ot=S(H(),1);var fn=S(H(),1),Me=(0,fn.createContext)(void 0);var bn=S(H(),1);var $o=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],hn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',gn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',be={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},wt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},vt={dark:be,light:wt};function Ke(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function $t(e){let t={};for(let n of $o){let r=e[n];typeof r=="string"&&(t[Ke(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function Tt(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var To=`
|
|
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,${be.accent});outline-offset:3px;border-radius:6px}
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
`&&f++,s.push(l),i.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?rr(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((b,M)=>[String(M),u(b)])));let d=[],h=new Set;return m[0].forEach((f,b)=>{let M=f.trim()||`col${b+1}`,k=M;for(let T=2;h.has(k);T++)k=`${M}_${T}`;h.add(k),d.push(k)}),m.slice(1).map(f=>Object.fromEntries(d.map((b,M)=>[b,u(f[M]??"")])))}function jt(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?rr(i[l]):i[l]??null])))}function Ha(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function or(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function xe(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return xe(JSON.parse(t))}catch{}return $e(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)?xe(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)?xe(t.rows):Array.isArray(t.values)?jt(t.values):Array.isArray(t.items)?xe(t.items):Array.isArray(t.results)?xe(t.results):Ha(t)}return[]}function ct(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 Gt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,c),f=h-i(d,c-1),b=0;for(let M=0;M<d;M++)b+=i(M,c)-i(M,c-1);m+=h,u+=(f/2+b)*h}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][l],b=Number.isFinite(f)?f:0;b>=0?(o[h][l]=u,u+=b,a[h][l]=u):(o[h][l]=d,d+=b,a[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function ar(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function ir(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var ja=Math.PI*2;function ut(e,t,n){return e<t?t:e>n?n:e}function sr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function j(e){return Math.round(e*100)/100}function Vt(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=ut(a.tl??0,0,i),l=ut(a.tr??0,0,i),c=ut(a.br??0,0,i),m=ut(a.bl??0,0,i);return`M${j(e+s)},${j(t)}H${j(e+n-l)}`+(l?`A${j(l)},${j(l)} 0 0 1 ${j(e+n)},${j(t+l)}`:"")+`V${j(t+r-c)}`+(c?`A${j(c)},${j(c)} 0 0 1 ${j(e+n-c)},${j(t+r)}`:"")+`H${j(e+m)}`+(m?`A${j(m)},${j(m)} 0 0 1 ${j(e)},${j(t+r-m)}`:"")+`V${j(t+s)}`+(s?`A${j(s)},${j(s)} 0 0 1 ${j(e+s)},${j(t)}`:"")+"Z"}function lr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ur(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function cr(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var mt=new Map;function ue(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=mt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);ur(c)?i+=cr(c):s+=cr(c)}a=i+s*(n>=600?1.07:1),mt.size>5e3&&mt.clear(),mt.set(o,a)}return a*t}function Wt(e,t,n,r=400){if(e=e.trim(),ue(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;ue(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(ur(s.charCodeAt(0))?2:3)?"":s+o}var dr=S(E(),1),Ga=e=>Array.isArray(e)&&e.length===2;function mr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ga(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var hr=S(E(),1),Kt=10.5;function Va(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=>Ne(i,{locale:n,maximumFractionDigits:a}))}function fr(e,t,n){let r=18;for(let o of Va(e,t,n))r=Math.max(r,ue(o,Kt));return Math.ceil(r+8)}function Ut(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 _e(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Ut(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let h=Ut(c[1]-c[0],n);if(h===l)break;l=h}return c}function gr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Ut(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function Xt(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>gr(n,r,l),s}function Yt(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]=_e(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function Wa(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of c){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:gr(e,t,3)}function pr(e,t){let n=Xt([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=()=>Wa(e[0],e[1],Math.abs(t[1]-t[0])),r}function Be(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 Ka=864e5;function br(e,t,n,r=J){let o=t-e;if(!(o>0))return[{t:e,label:Ie(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Ka,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,h=!1)=>{let f=new Date(m),b=-1,M=0;for(;f.getTime()<=t&&M++<500;){if(f.getTime()>=e){let k=f.getFullYear(),T=h&&!l&&k!==b;i.push({t:f.getTime(),label:Ie(f,{locale:r,...d,...T?{year:"numeric"}:{}})}),b=k}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),c(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());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),c(h,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return i}function yr(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var Ua=(e,t,n)=>e==="date"?et(t,n)?.getTime()??NaN:he(t);function Xa(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&zn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function He(e,t,n,r,o={}){let a=ve(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:ve(n,"y"),c=!i&&r!==void 0?ve(r,"series"):null,m=e.map(($,g)=>a($,g)),u=o.xType??Xa(m),d=o.locale??J,h,f,b;if(u==="band"){let $=m.map(v=>String(v??""));h=ce($);let g=new Map(h.map((v,F)=>[v,F]));f=h.map((v,F)=>F),b=Int32Array.from($,v=>g.get(v)??-1)}else{let $=u==="date"?o.dayFirst??Bn(m):void 0,g=m.map(L=>Ua(u,L,$)),v=Array.from(new Set(g.filter(L=>Number.isFinite(L)))).sort((L,Y)=>L-Y),F=new Map(v.map((L,Y)=>[L,Y]));f=v,h=v.map(String),b=Int32Array.from(g,L=>F.get(L)??-1)}let M=o.dateFormat,k=$=>typeof $=="string"?Qe($.trim())?.[3]:void 0,T=u==="date"&&m.length<5e3?k(m[0]):void 0,C=(T===2||T===3)&&m.every($=>k($)===T),N=C&&T===3;if(u==="date"&&!M){let $=f.length>1?f[f.length-1]-f[0]:0;M=C&&T===2||$>864e5*120?{month:"short"}:$<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},$>864e5*800&&(M={year:"numeric",month:"short"})}let y;if(u==="band")y=h;else if(N&&!o.dateFormat){let $=G(d)==="ko";y=f.map(g=>{let v=new Date(g),F=Math.floor(v.getMonth()/3)+1;return $?`${v.getFullYear()}년 ${F}분기`:`Q${F} ${v.getFullYear()}`})}else{let $=f.every(Dt),g=u==="date"?new Intl.DateTimeFormat(d,M):new Intl.NumberFormat(d,$?{useGrouping:!1}:{maximumFractionDigits:6});y=f.length>1e3?yr(f.length,v=>g.format(f[v])):f.map(v=>g.format(v))}let R=s?[...s]:c?ce(e.map(($,g)=>String(c($,g)??""))):[""],P=new Map(R.map(($,g)=>[$,g])),O=R.map(()=>new Array(h.length).fill(NaN)),I=R.map(()=>new Array(h.length).fill(null)),D=o.aggregate??"sum",x=D==="mean"?R.map(()=>new Uint32Array(h.length)):null,w=($,g,v,F)=>{let L=O[$][g];D==="last"?O[$][g]=v:D==="count"?O[$][g]=(Number.isFinite(L)?L:0)+1:D==="mean"?Number.isFinite(v)&&(O[$][g]=(Number.isFinite(L)?L:0)+v,x[$][g]++):O[$][g]=Number.isFinite(L)?L+(Number.isFinite(v)?v:0):v,I[$][g]=F};for(let $=0;$<e.length;$++){let g=b[$];if(g<0)continue;let v=e[$];if(s)for(let F=0;F<s.length;F++)w(F,g,he(v[s[F]]),v);else{let F=c?P.get(String(c(v,$)??""))??0:0;w(F,g,he(l(v,$)),v)}}if(x)for(let $=0;$<O.length;$++)for(let g=0;g<h.length;g++)x[$][g]>1&&(O[$][g]/=x[$][g]);return{type:u,keys:h,xnum:f,labels:y,series:R,values:O,rows:I}}var Ya=140,Ge=12,xr=14,Jt=20,kr=12.5;function Ja(e,t,n=Zn){let r=le(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function qa(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Ge)/(Ya+Ge))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Za(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Ge)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var je=e=>e.filter(Number.isFinite);function dt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Fe(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return je(n)}function wr(e,t,n,r,o,a){return He(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Qa(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let y=t.flat(),R=r.refLines??{},[P,O]=Be([...dt(y,r.x??"x"),...je([Number(R.x)])]),[I,D]=Be([...dt(y,r.y??"y"),...je([Number(R.y)])].filter(w=>!s||w>0)),x=r.zero??!1;return{y:c??(s?Yt(I,D,i):_e(I,D,i,{zero:x,pad:.08})),x:r.xDomain??_e(P,O,Math.max(2,Math.round(o/110)),{zero:x,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?Be(n.flatMap(y=>je(y.xnum))):void 0),M=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(M==="percent")return{x:b,sameKeys:h};if(c)return{y:c,x:b,sameKeys:h};let k=[];t.forEach((y,R)=>{let P=n[R];if(M==="stacked"||M==="auto"&&P.series.length>1){let I=Gt(P.values,"zero");I.y0.forEach(D=>k.push(...D)),I.y1.forEach(D=>k.push(...D))}else P.values.forEach(I=>k.push(...I));m&&!u&&r.line!==void 0&&wr(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(I=>k.push(...I)),m||k.push(...dt(y,r.lower),...dt(y,r.upper))}),m&&k.push(0),u||k.push(...mr(r.annotations));for(let y of r.referenceLines??[])k.push(y.y);r.signColors&&k.push(Number(r.baseline??0));let[T,C]=Be(je(k).filter(y=>!s||y>0));return{y:s?Yt(T,C,i):m?_e(T,C,u?Math.max(2,Math.round(o/120)):i):_e(T,C,i,{zero:r.zero??e==="area"}),x:b,sameKeys:h}}function ei(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=He(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?pr:Xt)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=fr(c,Ln(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=>ue(y,11,700)),20)+14):10),b=l.keys.length,[M,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,T=l.type==="number"?b>12:b>br(M,k,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!b||T)return;let C=y=>h+(l.xnum[y]-M)/(k-M)*(f-h),N=y=>ue(l.labels[y],Kt);for(let y=1;;y++){let R=Array.from({length:Math.ceil(b/y)},(P,O)=>O*y);if(y>=b||R.every((P,O)=>!O||C(P)-C(R[O-1])>=(N(P)+N(R[O-1]))/2+8))return R.map(P=>({value:l.xnum[P],label:l.labels[P]}))}}function ti(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 ni(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${ti(`${e}|${t}|${o}|${ct(r)}`)}`}function ri(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 oi={en:{intro:(e,t)=>`${Ce(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},qt=18;function vr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Ja(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=qa(s,i,e.columns),{pw:c,ph:m}=Za(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(x=>wr(t,x,n,n.y,n.series,n.aggregate)),h=u?Qa(t,o,d,n,c,m):{sameKeys:!1},f=u?ei(t,o,d,n,h,c,m,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",M=u&&(!b||h.sameKeys),k=u&&(b||h.x!==void 0||h.sameKeys),T=new Set(ri(e.highlight,r)?[e.highlight].flat():[]),C=T.size>0,N=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??ni(t,e.by,n,e.data),R=Ze(we(n.format,e.locale),n.unit),P=oi[e.lang],O=[],I=r.map(x=>x===""?P.blank:x);return{panels:r.map((x,w)=>{let $=o[w],g=I[w],v=w%l,F;if(t!=="scatter"){let Y=d[w],z=oe=>Y.values.reduce((ge,ln)=>ge+(Number.isFinite(ln[oe])?ln[oe]:0),0),_=Y.keys.map((oe,ge)=>ge).filter(oe=>Y.values.some(ge=>Number.isFinite(ge[oe]))),X=_[_.length-1];O.push({first:_.length?z(_[0]):NaN,last:_.length?z(X):NaN,total:_.reduce((oe,ge)=>oe+z(ge),0)}),t!=="bar"&&Y.series.length===1&&X!==void 0&&(F=R(Y.values[0][X]))}else O.push({first:NaN,last:NaN,total:$.length});let L={data:$,width:c,height:m,ariaLabel:e.title?`${e.title}, ${g}`:g,syncId:y,highlight:C?T.has(x)?N?()=>!0:void 0:"none":e.highlight,showYAxis:!M||v===0,showXAxis:!k||w+l>=i};return h.y&&(L.yDomain=h.y),h.x&&(L.xDomain=h.x),f&&(L.xTicks=f),{value:x,label:g,props:L,last:F,isPicked:T.has(x)}}),cols:l,pw:c,ph:m,isPanelPick:C,description:ai(t,e.by,I,O,a,R,P)}}function ai(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>lr(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var te=S(H(),1);function ii(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function si(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 ft={threshold:.25,enoughPx:96,rootMargin:"0px"};function Mr(e,t=!0){let[n,r]=(0,te.useState)({visible:!t,near:!t});return(0,te.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=si(i[i.length-1],ft.threshold,ft.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ii(ft.threshold),rootMargin:ft.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function $r(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function ht(e){let[t,n]=(0,te.useState)(null),[r,o]=(0,te.useState)(e??null),a=(0,te.useCallback)(i=>{n(i),i&&e===void 0&&o($r(i))},[e]);return fe(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i($r(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var li=()=>()=>{};function Pe(){return(0,te.useSyncExternalStore)(li,()=>!0,()=>!1)}var Tr="(prefers-reduced-motion: reduce)";function gt(e="auto"){let[t,n]=(0,te.useState)(()=>ae&&typeof window.matchMedia=="function"?window.matchMedia(Tr).matches:!1);return(0,te.useEffect)(()=>{if(e!=="auto"||!ae||typeof window.matchMedia!="function")return;let r=window.matchMedia(Tr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var me=S(E(),1),ci=60,ui=420;function Cr(e){let t=se(),n=e.chartProps??{},[,r,o]=ht(e.width),a=e.width??(o||480),i=Q(e.locale??n.locale),s=G(i),l=(0,De.useContext)(Me),c=e.title??l,m=e.chart.facetPlan,u=(0,De.useMemo)(()=>{let k=vr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return m?m(k,n,i):k},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,T)=>typeof T=="function"?String(T):T),e.highlight,e.syncId,a,e.height,c,i,s,m]),d=`${(0,De.useId)().replace(/:/g,"")}fd`,h=gt(n.reducedMotion??"auto"),f=Pe(),b=xn({motion:{enabled:n.animate!==!1&&!h&&ae},hydrated:f},{waiting:!1,generation:0}),M=e.chart;return(0,me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,me.jsx)("p",{id:d,style:it,children:e.description??u.description}),(0,me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Ge,rowGap:xr,...u.legend?{marginTop:qt}:null},children:u.panels.map((k,T)=>{let C=t.paint(k.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,me.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...yn(b,!1,"fade",T*ci,ui)},children:[(0,me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Jt,fontSize:kr,fontWeight:700,lineHeight:`${Jt}px`,color:C},children:[(0,me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.label}),k.last!==void 0?(0,me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:k.last}):null]}),(0,me.jsx)(M,{...n,...k.props})]},k.value)})}),u.legend?(0,me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:qt},children:u.legend}):null]})}var Sr=["max","min","first","last","none"];function de(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="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((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var re=S(H(),1);async function mi(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(G(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return $e(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 $e(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):$e(a)}async function di(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 mi(a,t.parse,o,t.locale)}return t.select&&(r=or(r,t.select)),t.transform?t.transform(r):xe(r)}function Ar(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,re.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,re.useState)(0),c=Q(t.locale),m=(0,re.useRef)(t);m.current={...t,locale:c};let u=(0,re.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),b=(0,re.useRef)(!1);(0,re.useEffect)(()=>{let k=u.current;if(!k||!r){i(N=>N.status==="loading"?{...N,status:"idle"}:N);return}let T=new AbortController,C=!0;return b.current=!0,i(N=>({...N,data:o?N.data:[],status:"loading",error:null})),di(k,{...m.current,signal:T.signal}).then(N=>{C&&i({data:N,status:"success",error:null,updatedAt:Date.now()})}).catch(N=>{!C||T.signal.aborted||i(y=>({...y,status:"error",error:N instanceof Error?N:new Error(String(N))}))}).finally(()=>{C&&(b.current=!1)}),()=>{C=!1,b.current=!1,T.abort()}},[d,r,s,f,o]),(0,re.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{b.current||l(T=>T+1)},n);return()=>clearInterval(k)},[n,r]);let M=(0,re.useCallback)(()=>l(k=>k+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:M}}var Qt=S(E(),1),fi=["csv","svg","png"],hi=/^[=+\-@\t\r\n=+-@]/,gi=/var\(|color-mix\(/;function Nr(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?En(e.getTime()):String(e);return`"${(hi.test(t)&&!Number.isFinite(he(t))?`'${t}`:t).replace(/"/g,'""')}"`}function pi(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function bi(e,t){return`\uFEFF${[t.map(Nr),...e.map(r=>t.map(o=>Nr(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
27
|
`}function yi(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Zt(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Rr=2,ke=16;function Fr(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,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 _r(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Pr(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+ke*2,i+ke*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,b)=>{let M;for(let k of Array.from(f.attributes)){if(!gi.test(k.value))continue;let T=(M??(M=getComputedStyle(f))).getPropertyValue(k.name);T&&m[b].setAttribute(k.name,Fr(T,u))}}),c.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-ke} ${-ke} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(b));let d=Fr(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(_r("rect",{x:-ke,y:-ke,width:s,height:l,fill:d}),f),h&&c.insertBefore(_r("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:h}}function xi(e,t){let n=Pr(e,Rr,!1);if(!n)return;let r=Rr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let 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,ke*r,ke*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&Zt(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Dr(e){let t=se(e.theme),n=G(Q(e.locale))==="ko",r=yi(e.filename),o=(a,i)=>{if(a==="csv")return Zt(new Blob([bi(e.data,e.columns?.length?e.columns:pi(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return xi(i,r);let s=Pr(i,1,!0);s&&Zt(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Qt.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:fi.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Qt.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Er=S(E(),1);function Lr(e,t=J){let n=we(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?Ie(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(In,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Er.jsx)("div",{children:s},l)):null}}function Or(e,t,n=!1){let r=le(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=ce(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Ir(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return $e(t.csv)}return null}var Wr=S(H(),1);var W=S(H(),1);function zr(e,t){let n=se(e.theme),[r,o,a]=ht(e.width),i=Pe(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=gt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ae,d=Mr(r,e.animateOnView!==!1&&u),h=Q(e.locale),f=G(h),b=(0,W.useMemo)(()=>we(e.format,h,t.format),[e.format,h,t.format]),M=(0,W.useCallback)(_=>qe(_,{locale:h}),[h]),k=(0,W.useMemo)(()=>Ze(b,e.unit),[b,e.unit]),T=(0,W.useMemo)(()=>ct(e.data),[e.data]),[C,N]=(0,W.useState)(null),[y,R]=(0,W.useState)(null),P=(0,W.useRef)([]),O=(0,W.useRef)(e.onHover);O.current=e.onHover;let I=(0,W.useRef)(e.onClick);I.current=e.onClick;let D=(0,W.useRef)(null),x=(0,W.useRef)(null),w=(0,W.useRef)(null),$=(0,W.useCallback)((_,X="pointer")=>{if(w.current!==_){w.current=_;let oe=_===null?null:P.current[_]??null;queueMicrotask(()=>O.current?.(oe)),x.current?.(_)}D.current=_===null?null:X,N(_),R(D.current)},[]),g=(0,W.useCallback)(_=>{D.current!=="keyboard"&&(D.current=_===null?null:"sync",N(_),R(D.current))},[]),v=(0,W.useCallback)(_=>{let X=P.current[_];X&&I.current?.(X)},[]),F=Vn(e.replayKey),L=e.width!==void 0||(a??0)>0,Y={enabled:u,active:d.visible&&L,near:d.near,replayKey:F,dataKey:T,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},z=(0,W.useCallback)((_,X=1)=>C===null||C===_?X:X*.38,[C]);return{p:n,width:s,height:c,measured:L,responsive:e.width===void 0,pending:ae&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:Y,fv:k,fmt:b,pct:M,locale:h,lang:f,t:f==="ko"?wn:kn,active:C,via:y,setActive:$,click:v,events:P,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:z,sig:T,description:e.description,reduced:m,publish:x,applySync:g}}var V=S(H(),1);function ki(e){return 1-Math.pow(1-e,3)}function wi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function vi(e){return e==="easeInOut"?wi:e==="linear"?t=>t:ki}function $i(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 Le(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 pt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function Br(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function Hr(e,t,n,r){if(!t||!n||t.length!==n.length)return Le(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of Le(s,n[i]))o.push(l)}return o.length===r?o:Le(e,r)}var bt=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||!pt(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),Br(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=pt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=Hr(s.cur,s.parts,i.parts,c),s.vel=Hr(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Br(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=pt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=pt(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=Le(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=vi(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Le(s.from,c)),s.vel.length!==c&&(s.vel=Le(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,h=0;for(let f=0;f<c;f++){let b=s.from[f]-s.to[f],M=s.vel[f]+a*b;s.cur[f]=s.to[f]+(b+M*l)*u,s.curVel[f]=(s.vel[f]-a*M*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=$i(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&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}},Ve=new Set,yt=0;function jr(e){yt=0;let t=Array.from(Ve);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ve.delete(n)}Ve.size&&typeof requestAnimationFrame<"u"&&(yt=requestAnimationFrame(jr))}function Gr(e){return Ve.add(e),!yt&&typeof requestAnimationFrame<"u"&&(yt=requestAnimationFrame(jr)),()=>{Ve.delete(e)}}function Ti(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 Vr(e,t){let n=(0,V.useMemo)(()=>Ti(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,V.useRef)(null),d=(0,V.useRef)("init"),h=(0,V.useRef)(null),f=(0,V.useRef)(s),b=(0,V.useRef)(i),M=(0,V.useRef)(!1),k=(0,V.useRef)(0),[,T]=(0,V.useState)(0),C=(0,V.useRef)(null),N=(0,V.useRef)(!0);u.current||(u.current=new bt,u.current.configure(l,c),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(l,c),h.current!==n){let x=d.current,w=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||x==="init"?y.snap(n):x==="idle"?y.hold(n):x==="running"||w?y.update(n,Xe(),m):y.snap(n),h.current=n,f.current=s}let R=(0,V.useRef)(()=>!1);R.current=x=>{if(!N.current)return!1;let w=y.step(x);return!w&&d.current==="running"&&(d.current="done"),T($=>($+1)%1e9),w||(C.current=null),w};let P=(0,V.useCallback)(()=>{if(!ae||C.current||!y.animating)return;let x=w=>R.current(w);C.current=Gr(x)},[y]);fe(()=>{let x=!Object.is(b.current,i);if(b.current=i,!r){(d.current!=="done"||y.animating)&&(y.snap(h.current??n),d.current="done",T(w=>w+1));return}d.current==="init"||x&&a?(y.hold(h.current??n),d.current="idle",M.current=!1,T(w=>w+1)):x&&(M.current=!0)},[r,i]),fe(()=>{!r||!a||!M.current||(M.current=!1,y.hold(h.current??n),d.current="idle",T(x=>x+1))},[a,r]),(0,V.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(Xe()),k.current+=1,d.current="running",P(),T(x=>x+1))},[r,o,i,y,P]),(0,V.useEffect)(()=>{y.animating&&P()}),(0,V.useEffect)(()=>(N.current=!0,()=>{N.current=!1,C.current?.(),C.current=null}),[]);let O=Xe(),I=y.elapsed(O),D=r&&d.current==="idle";return{items:y.items(),get:x=>y.get(x),elapsed:D?0:I,fade:(x,w=320)=>D?0:Number.isFinite(I)?Math.max(0,Math.min(1,(I-x)/w)):1,waiting:D,animating:y.animating,generation:k.current}}var en=S(E(),1);function Kr(e,t,n,r,o){if(r)return o==="categorical"?Z(e,t,n):Nn(e,t,n);if(o==="categorical")return Z(e,t,n);let a=K(e,"strong"),i=K(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var Mi=S(H(),1);var tn=S(E(),1);var Ur=e=>e?"neutralStrong":"accent";var nn=S(E(),1);function Xr(e,t,n,r){if(typeof e!="function")return de(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Ci=S(H(),1);var on=S(E(),1),Si={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ce(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Yr={en:Si,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}일 이동평균`}},rn=["ink","muted","dim"];function Jr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,rn.length)}var Ai=S(H(),1);var to=S(E(),1),Ni={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ri={en:Ni,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},qr=(e,t)=>Ri[e].other(t);function Zr(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((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,sr(o.map(a=>a.value)))}}var Qr=e=>Number.isFinite(e)&&e>0?e:0;function eo(e,t,n,r){return r==="emphasis"?An(e,t,n):Z(e,t,n)}var Te=S(H(),1);var q=S(E(),1),Fi={kind:"Segmented bar",share:"Share",total:"Total"},_i={en:Fi,ko:{kind:"비율 막대",share:"비중",total:"합계"}},no=2,xt=26;function ro(e,t){return e>=420&&t>=4?2:1}function an(e){let t=e.variant!=="thin",n=t?28:8,r=e.list!==!1,o=e.data.length,a=zr(e,{height:x=>n+4+(r?18+Math.ceil(o/ro(x,o))*xt:0),duration:800,stagger:70,format:"number"}),{p:i,width:s,pct:l}=a,c=_i[a.lang],{parts:m,total:u}=(0,Te.useMemo)(()=>{let x=le(e.label,"label"),w=Fe(e.value,"value"),$=e.data.map((z,_)=>({d:z,i:_,label:x(z,_),value:Math.max(0,w(z,_)||0)})),g=e.sort===!1?$:[...$].sort((z,_)=>_.value-z.value),v=g.reduce((z,_)=>z+_.value,0),F=de(e.highlight,g.map(z=>z.d),g.map(z=>z.label),g.map(z=>z.value),"max"),L=Z(i,g.length,F);return{parts:g.map((z,_)=>{let X=v>0?z.value/v:0;return{i:z.i,label:z.label,value:z.value,share:X,pct:l(X*100),sw:L[_],hi:F.has(_),datum:z.d}}),total:v}},[e.data,e.label,e.value,e.sort,e.highlight,i,l]),d=(0,Te.useMemo)(()=>{let x=m.filter(g=>g.share>0),w=Math.max(0,s-no*Math.max(0,x.length-1)),$=0;return x.map(g=>{let v=w*g.share,F={q:g,key:`s:${g.label}`,x:$,w:v};return $+=v+no,F})},[m,s]),h=(0,Te.useMemo)(()=>new Map(d.map(x=>[x.q.i,x])),[d]),f=a.motion.stagger??70,b=(0,Te.useMemo)(()=>d.map((x,w)=>({key:x.key,to:[x.x,x.w],from:[x.x,0],enter:[x.x,0],delay:w*f,data:x.q.i})),[d,f]),M=Vr(b,a.motion),k=(0,Te.useMemo)(()=>new Map(m.map((x,w)=>[x.i,w])),[m]),T=a.fv,C=(0,Te.useMemo)(()=>m.map((x,w)=>({datum:x.datum,index:w,key:x.label,label:x.label,value:x.value,formatted:`${T(x.value)} (${x.pct})`})),[m,T]),N=2,y=null;if(a.active!==null&&m[a.active]){let x=m[a.active],w=h.get(x.i);w&&(y={x:w.x+w.w/2,y:N,title:x.label,rows:[{label:a.t.value,value:a.fv(x.value),color:x.sw.fill},{label:c.share,value:x.pct}]})}let R=ro(s,m.length),P=s/R,O=N+n+18,I=e.description??`${c.kind}. ${c.total} ${a.fv(u)}. ${m.map(x=>`${x.label} ${x.pct}`).join(", ")}.`,D=t?4:n/2;return(0,q.jsxs)(Kn,{c:a,kind:c.kind,ariaLabel:e.ariaLabel,description:I,events:C,tip:y,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[d.length?null:(0,q.jsx)("rect",{x:0,y:N,width:s,height:n,rx:D,fill:i.paint("neutralSoft")}),M.items.map(x=>{let w=k.get(x.data)??0,$=m[w];if(!$)return null;let[g,v]=x.v;if(v<.5)return null;let F=t&&a.showLabels&&v>=ue($.pct,11,700)+14;return(0,q.jsxs)("g",{className:"ztd-mark",opacity:x.exiting?.4:a.dim(w),onPointerEnter:L=>a.setActive(w,L.pointerType==="touch"?"touch":"pointer"),onClick:()=>a.click(w),style:{cursor:e.onClick?"pointer":void 0},children:[(0,q.jsx)("path",{d:Vt(g,N,v,n,Math.min(D,v/2)),fill:$.sw.fill}),a.active===w&&a.via==="keyboard"?(0,q.jsx)("path",{d:Vt(g-2,N-2,v+4,n+4,Math.min(D+2,v/2+2)),fill:"none",stroke:i.paint("ink"),strokeWidth:2}):null,F?(0,q.jsx)(ze,{x:g+8,y:N+n/2,size:11,weight:700,fill:$.sw.text,opacity:M.fade(w*f+300,240),children:$.pct}):null]},x.key)}),r?m.map((x,w)=>{let $=w%R,g=Math.floor(w/R),v=$*P,F=O+g*xt,L=v+P-(R>1&&$===0?16:0),Y=x.pct,z=a.fv(x.value),_=ue(Y,11.5,500),X=ue(z,12,x.hi?800:600),oe=L-v-18-_-X-18;return(0,q.jsxs)("g",{opacity:a.dim(w),onPointerEnter:ge=>a.setActive(w,ge.pointerType==="touch"?"touch":"pointer"),onClick:()=>a.click(w),children:[(0,q.jsx)("rect",{x:v,y:F-xt/2+2,width:Math.max(0,L-v),height:xt-4,fill:"transparent"}),(0,q.jsx)("rect",{x:v,y:F-5,width:10,height:10,rx:3,fill:x.sw.fill}),(0,q.jsx)(ze,{x:v+18,y:F,size:12,weight:x.hi?700:500,fill:i.paint(x.hi?"ink":"muted"),children:Wt(x.label,Math.max(24,oe),12,x.hi?700:500)}),(0,q.jsx)(ze,{x:L-_-10,y:F,anchor:"end",size:12,weight:x.hi?800:600,fill:i.paint("ink"),children:z}),(0,q.jsx)(ze,{x:L,y:F,anchor:"end",size:11.5,fill:i.paint("muted"),children:Y})]},`l${x.i}`)}):null]})}var Pi=S(H(),1);var so=S(E(),1);function oo(e,t){return t===!1?e.map((n,r)=>r):ir(e)}function ao(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return de(e,t,t,r,"max")}function io(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=K(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?K(e,"neutral"):Je(e,1-i/Math.max(1,o.length-1))),r}function lo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ce(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function co(e,t){return Oe(e,t+1,new Set)}var Di=S(H(),1);var mo=S(E(),1);function uo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Sr.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var pe=S(E(),1);function fo(e,t,n){let r=lt(e);return r?.type==="scatter"&&t?.size!==void 0&&!st(n)?lt("bubble"):r}function Li(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 Ei(e,t,n,r=!1){let o=fo(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Bt.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=le(a.label,"label"),d=Fe(a.value,"value"),h=o.type==="waffle",f=t.map((y,R)=>({r:y,label:u(y,R),value:h?d(y,R):Qr(d(y,R))})),{kept:b,other:M}=h?{kept:f,other:null}:Zr(f,i.other,(y,R)=>({r:{},label:qr(G(n),y),value:R})),k=de(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),h?"first":"max"),T=M?[...b,M]:b,C=ye(y=>h?Z(y,T.length,k):eo(y,T.length,k,i.colorMode)),N=h&&i.shape==="arc";return T.map((y,R)=>({label:y.label,color:C[R],...N&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Jr(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Yr[G(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:rn[f],shape:"line"}))]}if(o.type==="network"){let u=lo(i.groups);if(u.length<2)return[];let d=ye(h=>co(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=le(a.group,"group"),d=ce(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=ye(f=>Oe(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"||st(i))return[];let u=le(a.series,"series"),d=ce(t.map((b,M)=>u(b,M)));if(d.length<2)return[];let h=Xr(s,t,d,u),f=ye(b=>Oe(b,d.length,h));return c(d.map((b,M)=>({label:b,color:f[M],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=Or(t,d,u),f=ye(b=>Z(b,h.length,uo(s,h)));return c(h.map((b,M)=>({label:b,color:f[M],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 C=le(a.series,"series");u=ce(t.map((N,y)=>C(N,y)))}let d=Ht(o.type,a,i);if(d.length){let C=de(s,u,u,u.map(()=>0),"none"),N=ye(R=>Z(R,u.length,C)),y=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((R,P)=>({label:R,color:N[P]}));return[...c(y),...d.map((R,P)=>({label:R,color:Ur(P),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?ar(u.length,Array.isArray(i.negative)?i.negative.map(C=>u.indexOf(String(C))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,b=f>=0?new Set([f]):de(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((C,N)=>({label:C,color:b.has(N)?"accent":"neutralStrong",shape:"square"})));let M=i.colorMode,k=C=>Z(C,u.length,b);if((o.type==="line"||o.type==="area")&&(k=C=>Kr(C,u.length,b,o.type==="area",M)),o.type==="stream"){let C=He(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),N=oo(C.values,i.reorder),y=ao(s,C.series,C.values);k=R=>io(R,N,y)}let T=ye(k);return c(u.map((C,N)=>({label:C,color:T[N],...o.type==="line"&&{shape:"line"}})))}return[]}function Oi(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&qn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ii(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function ho(e,t){let{spec:n}=e,r=fo(n.type,n.encoding,n.options),o=(0,We.useMemo)(()=>Ir(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Jn(n,e.locale),s=Q(i),l=G(s),c=Ar(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=er(n),u=(0,We.useMemo)(()=>m?Lr(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,M]=(0,We.useState)(null);if(!r)return(0,pe.jsx)(zt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??c.data,T=t[r.type],C={...n.options??{}},N={...Li(r,n.encoding),...C,...u?{tooltip:u}:{},data:k,...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"&&Qn(r.type,n.encoding??{},C),R=b&&b.base===f?b.hidden:h;y&&(N.hidden=R);let P=w=>M($=>{let g=$&&$.base===f?$.hidden:h;return{base:f,hidden:g.includes(w)?g.filter(v=>v!==w):[...g,w]}}),O=N.height??220,I=Oi(n,r.type),D=a&&!k.length&&(c.loading||c.error||c.empty)?(0,pe.jsx)(zt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:O,locale:i}):I?(0,pe.jsx)(Cr,{chart:T,...Ii(r.type,I,N)}):(0,pe.jsx)(T,{...N});if(n.card){let w=n.card,$=w.legend==="auto"||w.legend==="toggle"?Ei(n,k,s,y):w.legend,g=$?.length?y?(0,pe.jsx)(It,{items:$,hidden:R,onToggle:P,locale:i}):$:void 0,v=w.download?(0,pe.jsx)(Dr,{data:k,columns:tr(n),filename:w.title??r.type,formats:Array.isArray(w.download)?w.download:void 0,locale:i}):void 0;D=(0,pe.jsx)(Wn,{number:w.number,title:w.title??Yn(r,l),subtitle:w.subtitle,legend:g,actions:v,source:w.source||void 0,note:w.note||void 0,accent:w.accent,takeaway:w.takeaway,level:w.level,sample:w.sample,replay:w.replay!==!1,className:e.className,locale:i,children:D})}let x=e.theme??n.theme;return x&&(D=(0,pe.jsx)(nt,{theme:x,children:D})),D}function zi({cfg:e,components:t}){let n=Pe();return ho({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function po(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,go.hydrateRoot)(r,(0,sn.createElement)(nt,{theme:o.theme,cssVars:!0},(0,sn.createElement)(zi,{cfg:o,components:{[e]:t}})))}po("segmented",an);})();
|
|
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?Ie(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(In,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Er.jsx)("div",{children:s},l)):null}}function Or(e,t,n=!1){let r=le(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=ce(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Ir(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return $e(t.csv)}return null}var Wr=S(H(),1);var W=S(H(),1);function zr(e,t){let n=se(e.theme),[r,o,a]=ht(e.width),i=Pe(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=gt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ae,d=Mr(r,e.animateOnView!==!1&&u),h=Q(e.locale),f=G(h),b=(0,W.useMemo)(()=>we(e.format,h,t.format),[e.format,h,t.format]),M=(0,W.useCallback)(_=>qe(_,{locale:h}),[h]),k=(0,W.useMemo)(()=>Ze(b,e.unit),[b,e.unit]),T=(0,W.useMemo)(()=>ct(e.data),[e.data]),[C,N]=(0,W.useState)(null),[y,R]=(0,W.useState)(null),P=(0,W.useRef)([]),O=(0,W.useRef)(e.onHover);O.current=e.onHover;let I=(0,W.useRef)(e.onClick);I.current=e.onClick;let D=(0,W.useRef)(null),x=(0,W.useRef)(null),w=(0,W.useRef)(null),$=(0,W.useCallback)((_,X="pointer")=>{if(w.current!==_){w.current=_;let oe=_===null?null:P.current[_]??null;queueMicrotask(()=>O.current?.(oe)),x.current?.(_)}D.current=_===null?null:X,N(_),R(D.current)},[]),g=(0,W.useCallback)(_=>{D.current!=="keyboard"&&(D.current=_===null?null:"sync",N(_),R(D.current))},[]),v=(0,W.useCallback)(_=>{let X=P.current[_];X&&I.current?.(X)},[]),F=Vn(e.replayKey),L=e.width!==void 0||(a??0)>0,Y={enabled:u,active:d.visible&&L,near:d.near,replayKey:F,dataKey:T,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},z=(0,W.useCallback)((_,X=1)=>C===null||C===_?X:X*.38,[C]);return{p:n,width:s,height:c,measured:L,responsive:e.width===void 0,pending:ae&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:Y,fv:k,fmt:b,pct:M,locale:h,lang:f,t:f==="ko"?wn:kn,active:C,via:y,setActive:$,click:v,events:P,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:z,sig:T,description:e.description,reduced:m,publish:x,applySync:g}}var V=S(H(),1);function ki(e){return 1-Math.pow(1-e,3)}function wi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function vi(e){return e==="easeInOut"?wi:e==="linear"?t=>t:ki}function $i(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 Le(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 pt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function Br(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function Hr(e,t,n,r){if(!t||!n||t.length!==n.length)return Le(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of Le(s,n[i]))o.push(l)}return o.length===r?o:Le(e,r)}var bt=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||!pt(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),Br(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=pt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=Hr(s.cur,s.parts,i.parts,c),s.vel=Hr(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Br(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=pt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=pt(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=Le(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=vi(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Le(s.from,c)),s.vel.length!==c&&(s.vel=Le(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,h=0;for(let f=0;f<c;f++){let b=s.from[f]-s.to[f],M=s.vel[f]+a*b;s.cur[f]=s.to[f]+(b+M*l)*u,s.curVel[f]=(s.vel[f]-a*M*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=$i(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&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}},Ve=new Set,yt=0;function jr(e){yt=0;let t=Array.from(Ve);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ve.delete(n)}Ve.size&&typeof requestAnimationFrame<"u"&&(yt=requestAnimationFrame(jr))}function Gr(e){return Ve.add(e),!yt&&typeof requestAnimationFrame<"u"&&(yt=requestAnimationFrame(jr)),()=>{Ve.delete(e)}}function Ti(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 Vr(e,t){let n=(0,V.useMemo)(()=>Ti(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,V.useRef)(null),d=(0,V.useRef)("init"),h=(0,V.useRef)(null),f=(0,V.useRef)(s),b=(0,V.useRef)(i),M=(0,V.useRef)(!1),k=(0,V.useRef)(0),[,T]=(0,V.useState)(0),C=(0,V.useRef)(null),N=(0,V.useRef)(!0);u.current||(u.current=new bt,u.current.configure(l,c),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(l,c),h.current!==n){let x=d.current,w=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||x==="init"?y.snap(n):x==="idle"?y.hold(n):x==="running"||w?y.update(n,Xe(),m):y.snap(n),h.current=n,f.current=s}let R=(0,V.useRef)(()=>!1);R.current=x=>{if(!N.current)return!1;let w=y.step(x);return!w&&d.current==="running"&&(d.current="done"),T($=>($+1)%1e9),w||(C.current=null),w};let P=(0,V.useCallback)(()=>{if(!ae||C.current||!y.animating)return;let x=w=>R.current(w);C.current=Gr(x)},[y]);fe(()=>{let x=!Object.is(b.current,i);if(b.current=i,!r){(d.current!=="done"||y.animating)&&(y.snap(h.current??n),d.current="done",T(w=>w+1));return}d.current==="init"||x&&a?(y.hold(h.current??n),d.current="idle",M.current=!1,T(w=>w+1)):x&&(M.current=!0)},[r,i]),fe(()=>{!r||!a||!M.current||(M.current=!1,y.hold(h.current??n),d.current="idle",T(x=>x+1))},[a,r]),(0,V.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(Xe()),k.current+=1,d.current="running",P(),T(x=>x+1))},[r,o,i,y,P]),(0,V.useEffect)(()=>{y.animating&&P()}),(0,V.useEffect)(()=>(N.current=!0,()=>{N.current=!1,C.current?.(),C.current=null}),[]);let O=Xe(),I=y.elapsed(O),D=r&&d.current==="idle";return{items:y.items(),get:x=>y.get(x),elapsed:D?0:I,fade:(x,w=320)=>D?0:Number.isFinite(I)?Math.max(0,Math.min(1,(I-x)/w)):1,waiting:D,animating:y.animating,generation:k.current}}var en=S(E(),1);function Kr(e,t,n,r,o){if(r)return o==="categorical"?Z(e,t,n):Nn(e,t,n);if(o==="categorical")return Z(e,t,n);let a=K(e,"strong"),i=K(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var Mi=S(H(),1);var tn=S(E(),1);var Ur=e=>e?"neutralStrong":"accent";var nn=S(E(),1);function Xr(e,t,n,r){if(typeof e!="function")return de(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Ci=S(H(),1);var on=S(E(),1),Si={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ce(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Yr={en:Si,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}일 이동평균`}},rn=["ink","muted","dim"];function Jr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,rn.length)}var Ai=S(H(),1);var to=S(E(),1),Ni={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ri={en:Ni,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},qr=(e,t)=>Ri[e].other(t);function Zr(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((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,sr(o.map(a=>a.value)))}}var Qr=e=>Number.isFinite(e)&&e>0?e:0;function eo(e,t,n,r){return r==="emphasis"?An(e,t,n):Z(e,t,n)}var Te=S(H(),1);var q=S(E(),1),Fi={kind:"Segmented bar",share:"Share",total:"Total"},_i={en:Fi,ko:{kind:"비율 막대",share:"비중",total:"합계"}},no=2,xt=26;function ro(e,t){return e>=420&&t>=4?2:1}function an(e){let t=e.variant!=="thin",n=t?28:8,r=e.list!==!1,o=e.data.length,a=zr(e,{height:x=>n+4+(r?18+Math.ceil(o/ro(x,o))*xt:0),duration:800,stagger:70,format:"number"}),{p:i,width:s,pct:l}=a,c=_i[a.lang],{parts:m,total:u}=(0,Te.useMemo)(()=>{let x=le(e.label,"label"),w=Fe(e.value,"value"),$=e.data.map((z,_)=>({d:z,i:_,label:x(z,_),value:Math.max(0,w(z,_)||0)})),g=e.sort===!1?$:[...$].sort((z,_)=>_.value-z.value),v=g.reduce((z,_)=>z+_.value,0),F=de(e.highlight,g.map(z=>z.d),g.map(z=>z.label),g.map(z=>z.value),"max"),L=Z(i,g.length,F);return{parts:g.map((z,_)=>{let X=v>0?z.value/v:0;return{i:z.i,label:z.label,value:z.value,share:X,pct:l(X*100),sw:L[_],hi:F.has(_),datum:z.d}}),total:v}},[e.data,e.label,e.value,e.sort,e.highlight,i,l]),d=(0,Te.useMemo)(()=>{let x=m.filter(g=>g.share>0),w=Math.max(0,s-no*Math.max(0,x.length-1)),$=0;return x.map(g=>{let v=w*g.share,F={q:g,key:`s:${g.label}`,x:$,w:v};return $+=v+no,F})},[m,s]),h=(0,Te.useMemo)(()=>new Map(d.map(x=>[x.q.i,x])),[d]),f=a.motion.stagger??70,b=(0,Te.useMemo)(()=>d.map((x,w)=>({key:x.key,to:[x.x,x.w],from:[x.x,0],enter:[x.x,0],delay:w*f,data:x.q.i})),[d,f]),M=Vr(b,a.motion),k=(0,Te.useMemo)(()=>new Map(m.map((x,w)=>[x.i,w])),[m]),T=a.fv,C=(0,Te.useMemo)(()=>m.map((x,w)=>({datum:x.datum,index:w,key:x.label,label:x.label,value:x.value,formatted:`${T(x.value)} (${x.pct})`})),[m,T]),N=2,y=null;if(a.active!==null&&m[a.active]){let x=m[a.active],w=h.get(x.i);w&&(y={x:w.x+w.w/2,y:N,title:x.label,rows:[{label:a.t.value,value:a.fv(x.value),color:x.sw.fill},{label:c.share,value:x.pct}]})}let R=ro(s,m.length),P=s/R,O=N+n+18,I=e.description??`${c.kind}. ${c.total} ${a.fv(u)}. ${m.map(x=>`${x.label} ${x.pct}`).join(", ")}.`,D=t?4:n/2;return(0,q.jsxs)(Kn,{c:a,kind:c.kind,ariaLabel:e.ariaLabel,description:I,events:C,tip:y,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[d.length?null:(0,q.jsx)("rect",{x:0,y:N,width:s,height:n,rx:D,fill:i.paint("neutralSoft")}),M.items.map(x=>{let w=k.get(x.data)??0,$=m[w];if(!$)return null;let[g,v]=x.v;if(v<.5)return null;let F=t&&a.showLabels&&v>=ue($.pct,11,700)+14;return(0,q.jsxs)("g",{className:"ztd-mark",opacity:x.exiting?.4:a.dim(w),onPointerEnter:L=>a.setActive(w,L.pointerType==="touch"?"touch":"pointer"),onClick:()=>a.click(w),style:{cursor:e.onClick?"pointer":void 0},children:[(0,q.jsx)("path",{d:Vt(g,N,v,n,Math.min(D,v/2)),fill:$.sw.fill}),a.active===w&&a.via==="keyboard"?(0,q.jsx)("path",{d:Vt(g-2,N-2,v+4,n+4,Math.min(D+2,v/2+2)),fill:"none",stroke:i.paint("ink"),strokeWidth:2}):null,F?(0,q.jsx)(ze,{x:g+8,y:N+n/2,size:11,weight:700,fill:$.sw.text,opacity:M.fade(w*f+300,240),children:$.pct}):null]},x.key)}),r?m.map((x,w)=>{let $=w%R,g=Math.floor(w/R),v=$*P,F=O+g*xt,L=v+P-(R>1&&$===0?16:0),Y=x.pct,z=a.fv(x.value),_=ue(Y,11.5,500),X=ue(z,12,x.hi?800:600),oe=L-v-18-_-X-18;return(0,q.jsxs)("g",{opacity:a.dim(w),onPointerEnter:ge=>a.setActive(w,ge.pointerType==="touch"?"touch":"pointer"),onClick:()=>a.click(w),children:[(0,q.jsx)("rect",{x:v,y:F-xt/2+2,width:Math.max(0,L-v),height:xt-4,fill:"transparent"}),(0,q.jsx)("rect",{x:v,y:F-5,width:10,height:10,rx:3,fill:x.sw.fill}),(0,q.jsx)(ze,{x:v+18,y:F,size:12,weight:x.hi?700:500,fill:i.paint(x.hi?"ink":"muted"),children:Wt(x.label,Math.max(24,oe),12,x.hi?700:500)}),(0,q.jsx)(ze,{x:L-_-10,y:F,anchor:"end",size:12,weight:x.hi?800:600,fill:i.paint("ink"),children:z}),(0,q.jsx)(ze,{x:L,y:F,anchor:"end",size:11.5,fill:i.paint("muted"),children:Y})]},`l${x.i}`)}):null]})}var Pi=S(H(),1);var so=S(E(),1);function oo(e,t){return t===!1?e.map((n,r)=>r):ir(e)}function ao(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return de(e,t,t,r,"max")}function io(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=K(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?K(e,"neutral"):Je(e,1-i/Math.max(1,o.length-1))),r}function lo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ce(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function co(e,t){return Oe(e,t+1,new Set)}var Di=S(H(),1);var mo=S(E(),1);var Li=26;var pc=Li*.62;function uo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Sr.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var pe=S(E(),1);function fo(e,t,n){let r=lt(e);return r?.type==="scatter"&&t?.size!==void 0&&!st(n)?lt("bubble"):r}function Ei(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 Oi(e,t,n,r=!1){let o=fo(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Bt.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=le(a.label,"label"),d=Fe(a.value,"value"),h=o.type==="waffle",f=t.map((y,R)=>({r:y,label:u(y,R),value:h?d(y,R):Qr(d(y,R))})),{kept:b,other:M}=h?{kept:f,other:null}:Zr(f,i.other,(y,R)=>({r:{},label:qr(G(n),y),value:R})),k=de(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),h?"first":"max"),T=M?[...b,M]:b,C=ye(y=>h?Z(y,T.length,k):eo(y,T.length,k,i.colorMode)),N=h&&i.shape==="arc";return T.map((y,R)=>({label:y.label,color:C[R],...N&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Jr(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Yr[G(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:rn[f],shape:"line"}))]}if(o.type==="network"){let u=lo(i.groups);if(u.length<2)return[];let d=ye(h=>co(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=le(a.group,"group"),d=ce(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=ye(f=>Oe(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"||st(i))return[];let u=le(a.series,"series"),d=ce(t.map((b,M)=>u(b,M)));if(d.length<2)return[];let h=Xr(s,t,d,u),f=ye(b=>Oe(b,d.length,h));return c(d.map((b,M)=>({label:b,color:f[M],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=Or(t,d,u),f=ye(b=>Z(b,h.length,uo(s,h)));return c(h.map((b,M)=>({label:b,color:f[M],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 C=le(a.series,"series");u=ce(t.map((N,y)=>C(N,y)))}let d=Ht(o.type,a,i);if(d.length){let C=de(s,u,u,u.map(()=>0),"none"),N=ye(R=>Z(R,u.length,C)),y=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((R,P)=>({label:R,color:N[P]}));return[...c(y),...d.map((R,P)=>({label:R,color:Ur(P),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?ar(u.length,Array.isArray(i.negative)?i.negative.map(C=>u.indexOf(String(C))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,b=f>=0?new Set([f]):de(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((C,N)=>({label:C,color:b.has(N)?"accent":"neutralStrong",shape:"square"})));let M=i.colorMode,k=C=>Z(C,u.length,b);if((o.type==="line"||o.type==="area")&&(k=C=>Kr(C,u.length,b,o.type==="area",M)),o.type==="stream"){let C=He(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),N=oo(C.values,i.reorder),y=ao(s,C.series,C.values);k=R=>io(R,N,y)}let T=ye(k);return c(u.map((C,N)=>({label:C,color:T[N],...o.type==="line"&&{shape:"line"}})))}return[]}function Ii(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&qn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function zi(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function ho(e,t){let{spec:n}=e,r=fo(n.type,n.encoding,n.options),o=(0,We.useMemo)(()=>Ir(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Jn(n,e.locale),s=Q(i),l=G(s),c=Ar(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=er(n),u=(0,We.useMemo)(()=>m?Lr(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,M]=(0,We.useState)(null);if(!r)return(0,pe.jsx)(zt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??c.data,T=t[r.type],C={...n.options??{}},N={...Ei(r,n.encoding),...C,...u?{tooltip:u}:{},data:k,...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"&&Qn(r.type,n.encoding??{},C),R=b&&b.base===f?b.hidden:h;y&&(N.hidden=R);let P=w=>M($=>{let g=$&&$.base===f?$.hidden:h;return{base:f,hidden:g.includes(w)?g.filter(v=>v!==w):[...g,w]}}),O=N.height??220,I=Ii(n,r.type),D=a&&!k.length&&(c.loading||c.error||c.empty)?(0,pe.jsx)(zt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:O,locale:i}):I?(0,pe.jsx)(Cr,{chart:T,...zi(r.type,I,N)}):(0,pe.jsx)(T,{...N});if(n.card){let w=n.card,$=w.legend==="auto"||w.legend==="toggle"?Oi(n,k,s,y):w.legend,g=$?.length?y?(0,pe.jsx)(It,{items:$,hidden:R,onToggle:P,locale:i}):$:void 0,v=w.download?(0,pe.jsx)(Dr,{data:k,columns:tr(n),filename:w.title??r.type,formats:Array.isArray(w.download)?w.download:void 0,locale:i}):void 0;D=(0,pe.jsx)(Wn,{number:w.number,title:w.title??Yn(r,l),subtitle:w.subtitle,legend:g,actions:v,source:w.source||void 0,note:w.note||void 0,accent:w.accent,takeaway:w.takeaway,level:w.level,sample:w.sample,replay:w.replay!==!1,className:e.className,locale:i,children:D})}let x=e.theme??n.theme;return x&&(D=(0,pe.jsx)(nt,{theme:x,children:D})),D}function Bi({cfg:e,components:t}){let n=Pe();return ho({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function po(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,go.hydrateRoot)(r,(0,sn.createElement)(nt,{theme:o.theme,cssVars:!0},(0,sn.createElement)(Bi,{cfg:o,components:{[e]:t}})))}po("segmented",an);})();
|
package/dist/client/skyline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var Ra=Object.create;var sr=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Pa=Object.getPrototypeOf,Da=Object.prototype.hasOwnProperty;var mn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var La=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _a(t))!Da.call(e,o)&&o!==n&&sr(e,o,{get:()=>t[o],enumerable:!(r=Fa(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?Ra(Pa(e)):{},La(t||!e||!e.__esModule?sr(n,"default",{value:e,enumerable:!0}):n,e));var Y=mn((
|
|
1
|
+
(()=>{var Ra=Object.create;var sr=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Pa=Object.getPrototypeOf,Da=Object.prototype.hasOwnProperty;var mn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var La=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _a(t))!Da.call(e,o)&&o!==n&&sr(e,o,{get:()=>t[o],enumerable:!(r=Fa(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?Ra(Pa(e)):{},La(t||!e||!e.__esModule?sr(n,"default",{value:e,enumerable:!0}):n,e));var Y=mn((wl,lr)=>{lr.exports=globalThis.__ztdReact.react});var ur=mn(($l,cr)=>{cr.exports=globalThis.__ztdReact["react-dom/client"]});var V=mn((Ol,Lr)=>{Lr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var qn=F(Y(),1),ga=F(ur(),1);var wt=F(Y(),1);var Bt=F(Y(),1);var mr=F(Y(),1),qe=(0,mr.createContext)(void 0);var gr=F(Y(),1);var Ea=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],dr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',fr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Le={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:dr,monoFamily:fr,radius:18,radiusCode:14,radiusMark:4},dn={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:dr,monoFamily:fr,radius:18,radiusCode:14,radiusMark:4},fn={dark:Le,light:dn};function Ct(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function hn(e){let t={};for(let n of Ea){let r=e[n];typeof r=="string"&&(t[Ct(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 gn(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 Oa=`
|
|
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,${Le.accent});outline-offset:3px;border-radius:6px}
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
`&&f++,s.push(l),a.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let c=f=>n?qr(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((b,T)=>[String(T),c(b)])));let d=[],g=new Set;return m[0].forEach((f,b)=>{let T=f.trim()||`col${b+1}`,w=T;for(let v=2;g.has(w);v++)w=`${T}_${v}`;g.add(w),d.push(w)}),m.slice(1).map(f=>Object.fromEntries(d.map((b,T)=>[b,c(f[T]??"")])))}function Ln(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"?qr(a[l]):a[l]??null])))}function rs(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(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function Zr(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 Ue(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Ln(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)?Ln(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)?Ln(t.values):Array.isArray(t.items)?Be(t.items):Array.isArray(t.results)?Be(t.results):rs(t)}return[]}function Kt(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 En(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,u)=>{let m=e[l][u];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let u=1;u<r;u++){let m=0,c=0;for(let d=0;d<n;d++){let g=a(d,u),f=g-a(d,u-1),b=0;for(let T=0;T<d;T++)b+=a(T,u)-a(T,u-1);m+=g,c+=(f/2+b)*g}m&&(l-=c/m),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,d=0;for(let g=0;g<n;g++){let f=e[g][l],b=Number.isFinite(f)?f:0;b>=0?(o[g][l]=c,c+=b,i[g][l]=c):(o[g][l]=d,d+=b,i[g][l]=d)}continue}let u=0;for(let c=0;c<n;c++)u+=a(c,l);let m=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let d=a(c,l);t==="expand"&&(d=u?d/u*100:0),o[c][l]=m,m+=d,i[c][l]=m}}if(t==="wiggle"&&r){let l=1/0,u=-1/0;for(let c=0;c<r;c++)l=Math.min(l,o[0]?.[c]??0),u=Math.max(u,i[n-1]?.[c]??0);let m=0;for(let c=0;c<r;c++)m+=((o[0]?.[c]??0)+(i[n-1]?.[c]??0))/2;m/=r;for(let c=0;c<n;c++)for(let d=0;d<r;d++)o[c][d]-=m,i[c][d]-=m}return{y0:o,y1:i}}function Qr(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 eo(e){let t=e.length,n=e.map(u=>{let m=0,c=-1/0;return u.forEach((d,g)=>{d>c&&(c=d,m=g)}),m}),r=e.map(u=>u.reduce((m,c)=>m+(Number.isFinite(c)?c:0),0)),o=Array.from({length:t},(u,m)=>m).sort((u,m)=>n[u]-n[m]),i=[],a=[],s=0,l=0;for(let u of o)s<l?(i.push(u),s+=r[u]):(a.push(u),l+=r[u]);return[...a.reverse(),...i]}var os=Math.PI*2;function to(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function no(e,t,n,r){return Math.max(0,Math.min(r-1,Math.round((e-t)/(n-t||1)*(r-1))))}function ro(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function as(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function oo(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 se(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 u=r.charCodeAt(l);as(u)?a+=oo(u):s+=oo(u)}i=a+s*(n>=600?1.07:1),Xt.size>5e3&&Xt.clear(),Xt.set(o,i)}return i*t}var io=F(V(),1),is=e=>Array.isArray(e)&&e.length===2;function ao(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&is(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var co=F(V(),1),pe=10.5;function ss(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=>tt(a,{locale:n,maximumFractionDigits:i}))}function so(e,t,n){let r=18;for(let o of ss(e,t,n))r=Math.max(r,se(o,pe));return Math.ceil(r+8)}function lo(e,t,n=pe,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((c,d)=>d);let s=t.map(c=>se(c,n,o)),l=(c,d)=>Math.abs(e[d]-e[c])<(s[c]+s[d])/2+r,u=[];for(let c of i??[])u.some(d=>l(d,c))||u.push(c);let m=c=>!u.some(d=>l(d,c));for(let c=1;c<=a;c++){let d=u.slice();for(let g=0;g<a;g+=c)m(g)&&d.push(g);if(c>1&&(a-1)%c>c/2&&m(a-1)&&d.push(a-1),d.sort((g,f)=>g-f),d.every((g,f)=>!f||!l(d[f-1],g)))return d}return[0,a-1]}function Ut(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 He(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=Ut(a,n),u=[o,i];for(let m=0;m<4;m++){let c=Math.ceil(i/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-d<=l*.3?d:o-a*s,i===0?0:c-i<=l*.3?c:i+a*s];let g=Ut(u[1]-u[0],n);if(g===l)break;l=g}return u}function uo(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.25]:[o*1.25,0];let a=Ut(i-o,n);return[Math.floor(o/a+1e-9)*a,Math.ceil(i/a-1e-9)*a]}function pt(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Ut(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,u=0;l<=o+i*1e-9&&u<200;l+=i,u++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function On(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)=>pt(n,r,l),s}function In(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]=He(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function ls(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(u,m=1)=>{let c=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let g of u){let f=Number((g*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},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:pt(e,t,3)}function mo(e,t){let n=On([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=()=>ls(e[0],e[1],Math.abs(t[1]-t[0])),r}function bt(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 cs=864e5;function fo(e,t,n,r=ie){let o=t-e;if(!(o>0))return[{t:e,label:gt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/cs,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(m,c,d,g=!1)=>{let f=new Date(m),b=-1,T=0;for(;f.getTime()<=t&&T++<500;){if(f.getTime()>=e){let w=f.getFullYear(),v=g&&!l&&w!==b;a.push({t:f.getTime(),label:gt(f,{locale:r,...d,...v?{year:"numeric"}:{}})}),b=w}c(f)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(g=>g>=m)??12,d=new Date(s);d.setMinutes(0,0,0),u(d,g=>g.setHours(g.getHours()+c),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(m,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),u(m,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,c=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(g=>g>=c)??120;if(d>=12){let g=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(g,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let g=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=g.getMonth()%d;f&&g.setMonth(g.getMonth()+(d-f)),u(g,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return a}function ho(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 us=(e,t,n)=>e==="date"?ht(t,n)?.getTime()??NaN:Re(t);function go(e){if(!Cn(e.trim()))return e;let t=ht(e)?.getTime();return t===void 0||!Number.isFinite(t)?e:String(t)}function ms(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Cn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function je(e,t,n,r,o={}){let i=Xe(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Xe(n,"y"),u=!a&&r!==void 0?Xe(r,"series"):null,m=e.map((C,$)=>i(C,$)),c=o.xType??ms(m),d=o.locale??ie,g,f,b;if(c==="band"){let C=m.map(h=>String(h??""));g=Te(C);let $=new Map(g.map((h,L)=>[h,L]));f=g.map((h,L)=>L),b=Int32Array.from(C,h=>$.get(h)??-1)}else{let C=c==="date"?o.dayFirst??Dr(m):void 0,$=m.map(W=>us(c,W,C)),h=Array.from(new Set($.filter(W=>Number.isFinite(W)))).sort((W,G)=>W-G),L=new Map(h.map((W,G)=>[W,G]));f=h,g=h.map(String),b=Int32Array.from($,W=>L.get(W)??-1)}let T=o.dateFormat,w=C=>typeof C=="string"?Et(C.trim())?.[3]:void 0,v=c==="date"&&m.length<5e3?w(m[0]):void 0,S=(v===2||v===3)&&m.every(C=>w(C)===v),R=S&&v===3;if(c==="date"&&!T){let C=f.length>1?f[f.length-1]-f[0]:0;T=S&&v===2||C>864e5*120?{month:"short"}:C<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},C>864e5*800&&(T={year:"numeric",month:"short"})}let y;if(c==="band")y=g;else if(R&&!o.dateFormat){let C=J(d)==="ko";y=f.map($=>{let h=new Date($),L=Math.floor(h.getMonth()/3)+1;return C?`${h.getFullYear()}년 ${L}분기`:`Q${L} ${h.getFullYear()}`})}else{let C=f.every(Sn),$=c==="date"?new Intl.DateTimeFormat(d,T):new Intl.NumberFormat(d,C?{useGrouping:!1}:{maximumFractionDigits:6});y=f.length>1e3?ho(f.length,h=>$.format(f[h])):f.map(h=>$.format(h))}let _=s?[...s]:u?Te(e.map((C,$)=>String(u(C,$)??""))):[""],z=new Map(_.map((C,$)=>[C,$])),O=_.map(()=>new Array(g.length).fill(NaN)),I=_.map(()=>new Array(g.length).fill(null)),B=o.aggregate??"sum",E=B==="mean"?_.map(()=>new Uint32Array(g.length)):null,N=(C,$,h,L)=>{let W=O[C][$];B==="last"?O[C][$]=h:B==="count"?O[C][$]=(Number.isFinite(W)?W:0)+1:B==="mean"?Number.isFinite(h)&&(O[C][$]=(Number.isFinite(W)?W:0)+h,E[C][$]++):O[C][$]=Number.isFinite(W)?W+(Number.isFinite(h)?h:0):h,I[C][$]=L};for(let C=0;C<e.length;C++){let $=b[C];if($<0)continue;let h=e[C];if(s)for(let L=0;L<s.length;L++)N(L,$,Re(h[s[L]]),h);else{let L=u?z.get(String(u(h,C)??""))??0:0;N(L,$,Re(l(h,C)),h)}}if(E)for(let C=0;C<O.length;C++)for(let $=0;$<g.length;$++)E[C][$]>1&&(O[C][$]/=E[C][$]);return{type:c,keys:g,xnum:f,labels:y,series:_,values:O,rows:I}}var ds=140,xt=12,po=14,zn=20,bo=12.5;function fs(e,t,n=Kr){let r=Fe(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),u=o.get(l);u?u.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 hs(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+xt)/(ds+xt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function gs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*xt)/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 yt=e=>e.filter(Number.isFinite);function Yt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Wt(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return yt(n)}function yo(e,t,n,r,o,i){return je(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function ps(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,u=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let y=t.flat(),_=r.refLines??{},[z,O]=bt([...Yt(y,r.x??"x"),...yt([Number(_.x)])]),[I,B]=bt([...Yt(y,r.y??"y"),...yt([Number(_.y)])].filter(N=>!s||N>0)),E=r.zero??!1;return{y:u??(s?In(I,B,a):He(I,B,a,{zero:E,pad:.08})),x:r.xDomain??He(z,O,Math.max(2,Math.round(o/110)),{zero:E,pad:.06}),sameKeys:!0}}let m=e==="bar",c=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),g=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?bt(n.flatMap(y=>yt(y.xnum))):void 0),T=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(T==="percent")return{x:b,sameKeys:g};if(u)return{y:u,x:b,sameKeys:g};let w=[];t.forEach((y,_)=>{let z=n[_];if(T==="stacked"||T==="auto"&&z.series.length>1){let I=En(z.values,"zero");I.y0.forEach(B=>w.push(...B)),I.y1.forEach(B=>w.push(...B))}else z.values.forEach(I=>w.push(...I));m&&!c&&r.line!==void 0&&yo(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(I=>w.push(...I)),m||w.push(...Yt(y,r.lower),...Yt(y,r.upper))}),m&&w.push(0),c||w.push(...ao(r.annotations));for(let y of r.referenceLines??[])w.push(y.y);r.signColors&&w.push(Number(r.baseline??0));let[v,S]=bt(yt(w).filter(y=>!s||y>0));return{y:s?In(v,S,a):m?He(v,S,c?Math.max(2,Math.round(o/120)):a):He(v,S,a,{zero:r.zero??e==="area"}),x:b,sameKeys:g}}function bs(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=je(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),u=(r.yScale==="log"&&e==="line"?mo:On)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=so(u,Lt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),c=n.flatMap(y=>y.series),d=r.endLabels??n.some(y=>y.series.length>1),g=m+6,f=i-(d?Math.min(i*.28,Math.max(...c.map(y=>se(y,11,700)),20)+14):10),b=l.keys.length,[T,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?b>12:b>fo(T,w,Math.max(2,Math.floor((f-g)/64)),s).length;if(l.type==="band"||!b||v)return;let S=y=>g+(l.xnum[y]-T)/(w-T)*(f-g),R=y=>se(l.labels[y],pe);for(let y=1;;y++){let _=Array.from({length:Math.ceil(b/y)},(z,O)=>O*y);if(y>=b||_.every((z,O)=>!O||S(z)-S(_[O-1])>=(R(z)+R(_[O-1]))/2+8))return _.map(z=>({value:l.xnum[z],label:l.labels[z]}))}}function ys(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 xs(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${ys(`${e}|${t}|${o}|${Kt(r)}`)}`}function ks(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 ws={en:{intro:(e,t)=>`${Ee(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:"(빈 값)"}},Bn=18;function xo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=fs(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=hs(s,a,e.columns),{pw:u,ph:m}=gs(s,l,e.height),c=e.scale!=="free",d=t==="scatter"?[]:o.map(E=>yo(t,E,n,n.y,n.series,n.aggregate)),g=c?ps(t,o,d,n,u,m):{sameKeys:!1},f=c?bs(t,o,d,n,g,u,m,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",T=c&&(!b||g.sameKeys),w=c&&(b||g.x!==void 0||g.sameKeys),v=new Set(ks(e.highlight,r)?[e.highlight].flat():[]),S=v.size>0,R=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??xs(t,e.by,n,e.data),_=Dt(Ke(n.format,e.locale),n.unit),z=ws[e.lang],O=[],I=r.map(E=>E===""?z.blank:E);return{panels:r.map((E,N)=>{let C=o[N],$=I[N],h=N%l,L;if(t!=="scatter"){let G=d[N],le=ce=>G.values.reduce((xe,it)=>xe+(Number.isFinite(it[ce])?it[ce]:0),0),K=G.keys.map((ce,xe)=>xe).filter(ce=>G.values.some(xe=>Number.isFinite(xe[ce]))),oe=K[K.length-1];O.push({first:K.length?le(K[0]):NaN,last:K.length?le(oe):NaN,total:K.reduce((ce,xe)=>ce+le(xe),0)}),t!=="bar"&&G.series.length===1&&oe!==void 0&&(L=_(G.values[0][oe]))}else O.push({first:NaN,last:NaN,total:C.length});let W={data:C,width:u,height:m,ariaLabel:e.title?`${e.title}, ${$}`:$,syncId:y,highlight:S?v.has(E)?R?()=>!0:void 0:"none":e.highlight,showYAxis:!T||h===0,showXAxis:!w||N+l>=a};return g.y&&(W.yDomain=g.y),g.x&&(W.xDomain=g.x),f&&(W.xTicks=f),{value:E,label:$,props:W,last:L,isPicked:v.has(E)}}),cols:l,pw:u,ph:m,isPanelPick:S,description:$s(t,e.by,I,O,i,_,z)}}function $s(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=u=>ro(r.map(m=>m[u]));if(e==="line"||e==="area"){let u=l("last");u>=0&&(s+=a.endHigh(n[u],i(r[u].last)));let m=n.filter((c,d)=>r[d].last<r[d].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let u=l("total");u>=0&&(s+=e==="bar"?a.total(n[u],i(r[u].total)):a.points(n[u],r[u].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var de=F(Y(),1);function vs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Ts(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 Jt={threshold:.25,enoughPx:96,rootMargin:"0px"};function $o(e,t=!0){let[n,r]=(0,de.useState)({visible:!t,near:!t});return(0,de.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=Ts(a[a.length-1],Jt.threshold,Jt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:vs(Jt.threshold),rootMargin:Jt.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 ko(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function qt(e){let[t,n]=(0,de.useState)(null),[r,o]=(0,de.useState)(e??null),i=(0,de.useCallback)(a=>{n(a),a&&e===void 0&&o(ko(a))},[e]);return Ae(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=u=>o(m=>m!==null&&Math.abs(m-u)<.5?m:u),s=()=>a(ko(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let m=u[u.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var Ms=()=>()=>{};function rt(){return(0,de.useSyncExternalStore)(Ms,()=>!0,()=>!1)}var wo="(prefers-reduced-motion: reduce)";function Zt(e="auto"){let[t,n]=(0,de.useState)(()=>ke&&typeof window.matchMedia=="function"?window.matchMedia(wo).matches:!1);return(0,de.useEffect)(()=>{if(e!=="auto"||!ke||typeof window.matchMedia!="function")return;let r=window.matchMedia(wo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=F(V(),1),Ss=60,Cs=420;function vo(e){let t=ve(),n=e.chartProps??{},[,r,o]=qt(e.width),i=e.width??(o||480),a=ue(e.locale??n.locale),s=J(a),l=(0,ot.useContext)(qe),u=e.title??l,m=e.chart.facetPlan,c=(0,ot.useMemo)(()=>{let w=xo({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:u,locale:a,lang:s});return m?m(w,n,a):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,v)=>typeof v=="function"?String(v):v),e.highlight,e.syncId,i,e.height,u,a,s,m]),d=`${(0,ot.useId)().replace(/:/g,"")}fd`,g=Zt(n.reducedMotion??"auto"),f=rt(),b=br({motion:{enabled:n.animate!==!1&&!g&&ke},hydrated:f},{waiting:!1,generation:0}),T=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":u,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:d,style:jt,children:e.description??c.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${c.cols}, minmax(0, 1fr))`,columnGap:xt,rowGap:po,...c.legend?{marginTop:Bn}:null},children:c.panels.map((w,v)=>{let S=t.paint(w.isPicked?"accentText":c.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...pr(b,!1,"fade",v*Ss,Cs)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:zn,fontSize:bo,fontWeight:700,lineHeight:`${zn}px`,color:S},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)})}),c.legend?(0,Me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Bn},children:c.legend}):null]})}var To=["max","min","first","last","none"];function be(e,t,n,r,o="max"){let i=new Set,a=n.length,s=u=>{if(a&&u!=="none"){if(u==="first")i.add(0);else if(u==="last")i.add(a-1);else if(u==="max"||u==="min"){let m=-1,c=u==="max"?-1/0:1/0;r.forEach((d,g)=>{Number.isFinite(d)&&(u==="max"?d>c:d<c)&&(c=d,m=g)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((u,m)=>{m<a&&u!==null&&u!==void 0&&e(u,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<a&&i.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((m,c)=>{m===u&&i.add(c)});return i}var ye=F(Y(),1);async function As(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(J(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ue(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 Ue(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ue(i)}async function Ns(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 As(i,t.parse,o,t.locale)}return t.select&&(r=Zr(r,t.select)),t.transform?t.transform(r):Be(r)}function Mo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,ye.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ye.useState)(0),u=ue(t.locale),m=(0,ye.useRef)(t);m.current={...t,locale:u};let c=(0,ye.useRef)(e);c.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",g=t.deps??[],f=JSON.stringify(g.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),b=(0,ye.useRef)(!1);(0,ye.useEffect)(()=>{let w=c.current;if(!w||!r){a(R=>R.status==="loading"?{...R,status:"idle"}:R);return}let v=new AbortController,S=!0;return b.current=!0,a(R=>({...R,data:o?R.data:[],status:"loading",error:null})),Ns(w,{...m.current,signal:v.signal}).then(R=>{S&&a({data:R,status:"success",error:null,updatedAt:Date.now()})}).catch(R=>{!S||v.signal.aborted||a(y=>({...y,status:"error",error:R instanceof Error?R:new Error(String(R))}))}).finally(()=>{S&&(b.current=!1)}),()=>{S=!1,b.current=!1,v.abort()}},[d,r,s,f,o]),(0,ye.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||l(v=>v+1)},n);return()=>clearInterval(w)},[n,r]);let T=(0,ye.useCallback)(()=>l(w=>w+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:T}}var jn=F(V(),1),Rs=["csv","svg","png"],Fs=/^[=+\-@\t\r\n=+-@]/,_s=/var\(|color-mix\(/;function So(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?Fr(e.getTime()):String(e);return`"${(Fs.test(t)&&!Number.isFinite(Re(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Ps(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Ds(e,t){return`\uFEFF${[t.map(So),...e.map(r=>t.map(o=>So(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
27
|
`}function Ls(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Hn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Co=2,Ge=16;function Ao(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 No(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 Ro(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+Ge*2,a+Ge*2],u=o.cloneNode(!0),m=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((f,b)=>{let T;for(let w of Array.from(f.attributes)){if(!_s.test(w.value))continue;let v=(T??(T=getComputedStyle(f))).getPropertyValue(w.name);v&&m[b].setAttribute(w.name,Ao(v,c))}}),u.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-Ge} ${-Ge} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(b));let d=Ao(getComputedStyle(r).backgroundColor,c),g=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(No("rect",{x:-Ge,y:-Ge,width:s,height:l,fill:d}),f),g&&u.insertBefore(No("image",{href:g.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:i,vh:a,bg:d,canvas:g}}function Es(e,t){let n=Ro(e,Co,!1);if(!n)return;let r=Co,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,Ge*r,Ge*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&&Hn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Fo(e){let t=ve(e.theme),n=J(ue(e.locale))==="ko",r=Ls(e.filename),o=(i,a)=>{if(i==="csv")return Hn(new Blob([Ds(e.data,e.columns?.length?e.columns:Ps(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return Es(a,r);let s=Ro(a,1,!0);s&&Hn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,jn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Rs.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,jn.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 Po=F(V(),1);function _o(e,t=ie){let n=Ke(void 0,t),r=e.split(`
|
|
28
|
-
`),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?gt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,u=s.replace(Pr,(m,c)=>o(i,c.trim())??(l=!0,""));l||a.push(u)}return a.length?a.map((s,l)=>(0,Po.jsx)("div",{children:s},l)):null}}function Do(e,t,n=!1){let r=Fe(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Te(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 Lo(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 Ue(t.csv)}return null}var jo=F(Y(),1);var ee=F(Y(),1);function Eo(e,t){let n=ve(e.theme),[r,o,i]=qt(e.width),a=rt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,m=Zt(e.reducedMotion??"auto"),c=e.animate!==!1&&!m&&ke,d=$o(r,e.animateOnView!==!1&&c),g=ue(e.locale),f=J(g),b=(0,ee.useMemo)(()=>Ke(e.format,g,t.format),[e.format,g,t.format]),T=(0,ee.useCallback)(K=>et(K,{locale:g}),[g]),w=(0,ee.useMemo)(()=>Dt(b,e.unit),[b,e.unit]),v=(0,ee.useMemo)(()=>Kt(e.data),[e.data]),[S,R]=(0,ee.useState)(null),[y,_]=(0,ee.useState)(null),z=(0,ee.useRef)([]),O=(0,ee.useRef)(e.onHover);O.current=e.onHover;let I=(0,ee.useRef)(e.onClick);I.current=e.onClick;let B=(0,ee.useRef)(null),E=(0,ee.useRef)(null),N=(0,ee.useRef)(null),C=(0,ee.useCallback)((K,oe="pointer")=>{if(N.current!==K){N.current=K;let ce=K===null?null:z.current[K]??null;queueMicrotask(()=>O.current?.(ce)),E.current?.(K)}B.current=K===null?null:oe,R(K),_(B.current)},[]),$=(0,ee.useCallback)(K=>{B.current!=="keyboard"&&(B.current=K===null?null:"sync",R(K),_(B.current))},[]),h=(0,ee.useCallback)(K=>{let oe=z.current[K];oe&&I.current?.(oe)},[]),L=Ir(e.replayKey),W=e.width!==void 0||(i??0)>0,G={enabled:c,active:d.visible&&W,near:d.near,replayKey:L,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},le=(0,ee.useCallback)((K,oe=1)=>S===null||S===K?oe:oe*.38,[S]);return{p:n,width:s,height:u,measured:W,responsive:e.width===void 0,pending:ke&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:G,fv:w,fmt:b,pct:T,locale:g,lang:f,t:f==="ko"?kr:xr,active:S,via:y,setActive:C,click:h,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:le,sig:v,description:e.description,reduced:m,publish:E,applySync:$}}var q=F(Y(),1);function Os(e){return 1-Math.pow(1-e,3)}function Is(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function zs(e){return e==="easeInOut"?Is:e==="linear"?t=>t:Os}function Bs(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 at(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 Qt(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 Oo(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 Io(e,t,n,r){if(!t||!n||t.length!==n.length)return at(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 at(s,n[a]))o.push(l)}return o.length===r?o:at(e,r)}var en=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||!Qt(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),Oo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Qt(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 u=a.to.length;s.from=Io(s.cur,s.parts,a.parts,u),s.vel=Io(s.curVel,s.parts,a.parts,u),s.parts=a.parts,s.to=a.to.slice(),Oo(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=Qt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let u=this.make(a,a.enter??a.from??a.to,n+l,0);u.done=Qt(u.from,u.to),this.tracks.set(a.key,u)}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=at(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=zs(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,u=s.to.length;if(s.from.length!==u&&(s.from=at(s.from,u)),s.vel.length!==u&&(s.vel=at(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let c=Math.exp(-i*l),d=i*l>=8&&i*l<20,g=0;for(let f=0;f<u;f++){let b=s.from[f]-s.to[f],T=s.vel[f]+i*b;s.cur[f]=s.to[f]+(b+T*l)*c,s.curVel[f]=(s.vel[f]-i*T*l)*c,d&&g<.15&&(g=Math.max(g,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&g<.15,s.progress=Math.min(1,1-(1+i*l)*c)}else{let c=Math.min(1,l/o),d=r(c),g=Bs(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*g;m=c>=1,s.progress=d}if(m){for(let c=0;c<u;c++)s.cur[c]=s.to[c],s.curVel[c]=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}},kt=new Set,tn=0;function zo(e){tn=0;let t=Array.from(kt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||kt.delete(n)}kt.size&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo))}function Bo(e){return kt.add(e),!tn&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo)),()=>{kt.delete(e)}}function Hs(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 Ho(e,t){let n=(0,q.useMemo)(()=>Hs(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:u=900,stagger:m=0}=t,c=(0,q.useRef)(null),d=(0,q.useRef)("init"),g=(0,q.useRef)(null),f=(0,q.useRef)(s),b=(0,q.useRef)(a),T=(0,q.useRef)(!1),w=(0,q.useRef)(0),[,v]=(0,q.useState)(0),S=(0,q.useRef)(null),R=(0,q.useRef)(!0);c.current||(c.current=new en,c.current.configure(l,u),c.current.snap(n),g.current=n);let y=c.current;if(y.configure(l,u),g.current!==n){let E=d.current,N=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||E==="init"?y.snap(n):E==="idle"?y.hold(n):E==="running"||N?y.update(n,Nt(),m):y.snap(n),g.current=n,f.current=s}let _=(0,q.useRef)(()=>!1);_.current=E=>{if(!R.current)return!1;let N=y.step(E);return!N&&d.current==="running"&&(d.current="done"),v(C=>(C+1)%1e9),N||(S.current=null),N};let z=(0,q.useCallback)(()=>{if(!ke||S.current||!y.animating)return;let E=N=>_.current(N);S.current=Bo(E)},[y]);Ae(()=>{let E=!Object.is(b.current,a);if(b.current=a,!r){(d.current!=="done"||y.animating)&&(y.snap(g.current??n),d.current="done",v(N=>N+1));return}d.current==="init"||E&&i?(y.hold(g.current??n),d.current="idle",T.current=!1,v(N=>N+1)):E&&(T.current=!0)},[r,a]),Ae(()=>{!r||!i||!T.current||(T.current=!1,y.hold(g.current??n),d.current="idle",v(E=>E+1))},[i,r]),(0,q.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(Nt()),w.current+=1,d.current="running",z(),v(E=>E+1))},[r,o,a,y,z]),(0,q.useEffect)(()=>{y.animating&&z()}),(0,q.useEffect)(()=>(R.current=!0,()=>{R.current=!1,S.current?.(),S.current=null}),[]);let O=Nt(),I=y.elapsed(O),B=r&&d.current==="idle";return{items:y.items(),get:E=>y.get(E),elapsed:B?0:I,fade:(E,N=320)=>B?0:Number.isFinite(I)?Math.max(0,Math.min(1,(I-E)/N)):1,waiting:B,animating:y.animating,generation:w.current}}var Gn=F(V(),1);function Go(e,t,n,r,o){if(r)return o==="categorical"?we(e,t,n):ft(e,t,n);if(o==="categorical")return we(e,t,n);let i=Q(e,"strong"),a=Q(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var js=F(Y(),1);var Vn=F(V(),1);var Vo=e=>e?"neutralStrong":"accent";var Wn=F(V(),1);function Wo(e,t,n,r){if(typeof e!="function")return be(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 Gs=F(Y(),1);var Xn=F(V(),1),Vs={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}, ${Ee(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Ko={en:Vs,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}일 이동평균`}},Kn=["ink","muted","dim"];function Xo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Kn.length)}var Ws=F(Y(),1);var Zo=F(V(),1),Ks={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ee(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Xs={en:Ks,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Uo=(e,t)=>Xs[e].other(t);function Yo(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,to(o.map(i=>i.value)))}}var Jo=e=>Number.isFinite(e)&&e>0?e:0;function qo(e,t,n,r){return r==="emphasis"?Pt(e,t,n):we(e,t,n)}var te=F(Y(),1);var A=F(V(),1),Us={kind:"Skyline",row:{back:"back",front:"front"},total:{back:"Back total",front:"Front total"},sum:"total",sumLabel:"Total",rate:"Front ÷ back",peak:e=>`Peak ${e}`,frontPeak:(e,t,n)=>`Front peak ${e} · ${t}${n?` (${n})`:""}`,range:(e,t)=>`${e}–${t}`,nothing:"Nothing to draw",ofBack:e=>`${e} of the back row`,cell:(e,t,n)=>`${e?`${e} `:""}${t}${n?` (${n})`:""}`,desc:(e,t,n,r)=>`${Ee(e,"series","series")} (${t}) stacked from ${n} to ${r}`,descPeak:(e,t)=>`Peak period ${e} at ${t}`,descFront:(e,t,n,r)=>`Front row (${e}) peaks at ${t} with ${n}${r?`, ${r} of the back row`:""}`,descFrontZero:e=>`The front row (${e}) is all zero`,merged:e=>`Neighboring periods are summed in groups of ${e}`,keys:"Use left and right arrows for periods, up and down to switch rows."},Ys={en:Us,ko:{kind:"스카이라인",row:{back:"뒷줄",front:"앞줄"},total:{back:"뒷줄 합계",front:"앞줄 합계"},sum:"합계",sumLabel:"합계",rate:"앞줄 ÷ 뒷줄",peak:e=>`최고 ${e}`,frontPeak:(e,t,n)=>`앞줄 최고 ${e} · ${t}${n?` (${n})`:""}`,range:(e,t)=>`${e}~${t}`,nothing:"그릴 값이 없어요",ofBack:e=>`뒷줄의 ${e}`,cell:(e,t,n)=>`${e?`${e} `:""}${t}${n?`(${n})`:""}`,desc:(e,t,n,r)=>`계열 ${e}개(${t})를 ${n}부터 ${r}까지 쌓았어요`,descPeak:(e,t)=>`가장 많은 기간 ${e} ${t}`,descFront:(e,t,n,r)=>`앞줄(${e})이 가장 많은 기간 ${t} ${n}${r?`, 뒷줄의 ${r}`:""}`,descFrontZero:e=>`앞줄(${e})은 모두 0이에요`,merged:e=>`이웃 기간을 ${e}개씩 합쳤어요`,keys:"←→로 기간을, ↑↓로 앞줄과 뒷줄을 옮겨요."}},Js={low:{cx:.8944271909999159,cy:.4472135954999579,face:.52,front:.14,gap:.05,depth:[.1,.32,.32]},high:{cx:.4472135954999579,cy:.8944271909999159,face:.54,front:.42,gap:.1,depth:[.1,.45,.42]}};var qs=20,Zs=40,Qs=.4,Qo=14,Un=10,el=20,_e=4,nn=26,ea=18,tl=["back","front"],nl=["back"],D=e=>Math.round(e*10)/10,Je=e=>e.map(([t,n])=>`${D(t)},${D(n)}`).join(" "),Ye=e=>e.reduce((t,n)=>t+n,0),ta=(e,t,n,r,o=400)=>{let i=se(t,n,o)/2;return Math.max(i+2,Math.min(r-i-2,e))};function rl(e,t){for(let n=1;n<t;n++){let r=Math.ceil(t/n);if(r<=Zs&&e/(r+.55)>=qs)return n}return Math.max(1,t)}function oa(e,t,n){let r=t-n*(Math.ceil(t/n)-1);return e===0?[0,r]:[r+(e-1)*n,r+e*n]}function na(e,t,n){return Array.from({length:Math.ceil(t/n)},(r,o)=>{let[i,a]=oa(o,t,n);return e.map(s=>Ye(s.slice(i,a).map(l=>Number.isFinite(l)&&l>0?l:0)))})}function ol(e){let t=Js[e.view??"high"],n=e.view==="low"||e.front.length?t.front:0,r=Math.min(t.depth[1],Math.max(t.depth[0],e.depth??t.depth[2])),o=I=>e.width-Un-(e.wall?I+14:8),i=0,a=0,s=[],l=[],u=[0,1];for(let I=0;I<3;I++){let B=rl(o(a),e.n);if(B===i)break;i=B,s=na(e.back,e.n,i),l=na(e.front,e.n,i),u=He(0,Math.max(0,...s.map(Ye),...l.map(Ye)),4);let E=e.tickFmt(u[1]);a=e.wall?Math.max(...pt(u[0],u[1],4).map(N=>se(E(N),pe))):0}let m=s.length,c=Math.max(1,o(a)/(m+.55)),d=t.face*c,g=e.height-e.below,f=e.legendH+el,b=(n+t.gap+r)*c*t.cy,T=e.view==="low"?1:Math.min(1,Qs*Math.max(0,g-f)/(b||1)),w=(n+t.gap)*c*T,v=w+r*c*T,S=g-v*t.cy,R=Math.max(0,S-f)/(u[1]||1),y=pt(u[0],u[1],4),_=y.length>1?(y[1]-y[0])*R:1/0,z=_>=Qo?1:_>0?Math.ceil(Qo/_):y.length,O=I=>Un+I*c;return{merge:i,shown:m,back:s,front:l,backTotal:s.map(Ye),frontTotal:l.map(Ye),ticks:y.filter((I,B)=>B%z===0),fmt:e.tickFmt(u[1]),k:R,s:c,w:d,floor:g,wallBase:S,top:f,cx:t.cx,cy:t.cy,lead:w,shift:[w*t.cx,w*t.cy],depthFront:n*c*T,depthBack:r*c*T,wallX:[Un+v*t.cx-6,O(m-1)+d+v*t.cx+6],slotX:O}}function al(e,t){return t?e==="ArrowUp"?"back":e==="ArrowDown"?"front":null:null}function il(e,t){let n=0;return e.map(r=>n+=r*t)}function sl(e,t){let{dx:n,dy:r}=e,o=e.base-t;return[[e.x,o],[e.x+n,o+r],[e.x+e.w+n,o+r],[e.x+e.w+n,e.base+r],[e.x+e.w,e.base],[e.x,e.base]]}function ll(e,t){return Array.from({length:t},(n,r)=>{let o=r%2===0?"accent2":"accent3",i=Math.max(.4,1-.3*Math.floor(r/2)),a=i===1?e.theme[o]:Qe(e.theme[o],e.theme.ink,i);return{role:"mix",fill:i===1?e.paint(o):e.mix(o,"ink",i),text:wn(e,a),raw:a}})}function cl(e,t,n){if(!n)return null;let r=s=>s>0?s:0,o=n.values.reduce((s,l)=>s+r(l),0);if(!(o>0))return null;let i=[],a=0;return n.values.forEach((s,l)=>{let u=e.x+e.w*a/o;a+=r(s);let m=e.x+e.w*a/o;m>u&&i.push((0,A.jsx)("polygon",{points:Je([[u,t],[m,t],[m+e.dx,t+e.dy],[u+e.dx,t+e.dy]]),fill:n.fills[l]??"none"},`l${l}`))}),i}function ra(e){let{p:t,g:n,cum:r,colors:o,hatch:i}=e,{dx:a,dy:s}=n,l=n.x+n.w,u=(v,S)=>Je([[l,v],[l+a,v+s],[l+a,S+s],[l,S]]),m=r[r.length-1]??0,c=n.base-m,d=[],g=[],f=0;if(r.forEach((v,S)=>{let R=n.base-f,y=n.base-v;v>f&&(d.push((0,A.jsx)("rect",{x:D(n.x),y:D(y),width:D(n.w),height:D(v-f),fill:o[S].fill},`f${S}`)),d.push((0,A.jsx)("polygon",{points:u(y,R),fill:o[S].fill},`s${S}`)),f>0&&g.push((0,A.jsx)("polyline",{points:Je([[n.x,R],[l,R],[l+a,R+s]]),fill:"none",stroke:t.paint("panel"),strokeWidth:1.2},`g${S}`))),f=v}),m<1&&!e.tile)return(0,A.jsx)("g",{children:d});let b=u(c,n.base),T=Je([[n.x,c],[l,c],[l+a,c+s],[n.x+a,c+s]]),w=cl(n,c,e.lidSplit);return(0,A.jsxs)("g",{children:[d,m>=1?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("polygon",{points:b,fill:"#000",fillOpacity:e.shade}),i?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("rect",{x:D(n.x),y:D(c),width:D(n.w),height:D(m),fill:i}),(0,A.jsx)("polygon",{points:b,fill:i})]}):null,g,(0,A.jsx)("line",{x1:D(l),x2:D(l),y1:D(c),y2:D(n.base),stroke:t.paint("panel"),strokeOpacity:.7})]}):null,w,(0,A.jsx)("polygon",{points:T,fill:w?"none":e.lid,stroke:e.lidStroke?t.paint(e.lidInk?"ink":"neutralStrong"):void 0,strokeOpacity:e.lidStroke?e.lidInk?.4:.55:void 0,strokeLinejoin:"round"}),e.lidHatch&&i?(0,A.jsx)("polygon",{points:T,fill:i}):null]})}function Yn(e){let{p:t}=e;return(0,A.jsx)("text",{x:D(e.x),y:D(e.y),dy:"0.35em",fontSize:e.size??11.5,fill:t.paint("ink"),textAnchor:"middle",fontWeight:700,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),stroke:t.paint("panel"),strokeWidth:4,strokeLinejoin:"round",paintOrder:"stroke",style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}function ul(e,t){let n=[],r=0,o=0;for(let i of e){let a=15+se(i.name,11.5);if(r>0){let s=i.divider?28:14;r+s+a>t?(r=0,o++):r+=s}n.push({x:r,line:o}),r+=a}return n}function ml(e){let{p:t,rates:n}=e,r=Math.max(0,...n.map(s=>s??0)),o=uo(0,r,2)[1],i=r>0?n.indexOf(r):-1,a=e.top+nn;return(0,A.jsxs)("g",{"aria-hidden":"true",children:[(0,A.jsx)(ze,{x:e.from,y:e.top-8,size:11,fill:t.paint("muted"),children:e.title}),(0,A.jsx)("line",{x1:D(e.from),x2:D(e.to),y1:D(e.top),y2:D(e.top),stroke:t.paint("line2")}),(0,A.jsx)("line",{x1:D(e.from),x2:D(e.to),y1:D(a),y2:D(a),stroke:t.paint("line")}),n.map((s,l)=>{if(s===null||s<=0)return null;let u=s/o*nn;return(0,A.jsx)("rect",{x:D(e.x(l)),y:D(a-u),width:D(e.w),height:D(u),rx:Math.min(1.5,u/2),fill:t.paint(l===i?"accent":"neutralStrong")},l)}),(0,A.jsx)(ze,{x:e.right,y:a,size:pe,fill:t.paint("muted"),children:"0"}),(0,A.jsx)(ze,{x:e.right,y:e.top,size:pe,fill:t.paint("muted"),children:e.pct(o)}),i>=0?(0,A.jsx)(Yn,{p:t,x:e.x(i)+e.w/2,y:a-r/o*nn-8,size:11,opacity:e.fade(i),children:e.pct(r)}):null]})}function Jn(e){let t=e.frontRate==="strip"&&e.front!==void 0,n=Eo(e,{height:p=>Math.max(300,Math.min(440,p*.58))+(t?40:0),duration:800,stagger:40}),{p:r,width:o,height:i}=n,a=Ys[n.lang],s=(0,te.useId)().replace(/:/g,""),[l,u]=(0,te.useState)("back"),m=(0,te.useMemo)(()=>e.front===void 0?[]:Array.isArray(e.front)?e.front:[e.front],[e.front]),c=(0,te.useMemo)(()=>je(e.data,e.x,e.y,e.series,{locale:n.locale,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,n.locale,e.dayFirst]),d=(0,te.useMemo)(()=>m.length?je(e.data,e.x,m,void 0,{locale:n.locale,xType:c.type,dayFirst:e.dayFirst}).values:[],[e.data,e.x,m,n.locale,c,e.dayFirst]),g=typeof e.y=="string"?e.y:n.t.value,f=(0,te.useMemo)(()=>c.series.map(p=>p||g),[c,g]),b=(0,te.useMemo)(()=>[...f,...m],[f,m]),T=f.length,w=m.length,v=w>0,S=v?l:"back",R=e.frontRate??"label",y=e.texture??"front",_=e.wall!==!1,z=e.view??"high",O=z==="high",I=t&&v,B=v&&!t&&n.showLabels,E=(0,te.useMemo)(()=>T>1||v?b.map((p,k)=>({name:p,divider:k===T&&T>0})):[],[b,T,v]),N=(0,te.useMemo)(()=>ul(E,o),[E,o]),C=N.length?(N[N.length-1].line+1)*ea+6:0,$=_e+(I?70:B?48:22),h=(0,te.useMemo)(()=>ol({width:o,height:i,back:c.values,front:d,n:c.keys.length,depth:e.depth,wall:_,view:z,legendH:C,below:$,tickFmt:p=>Lt(e.format,n.locale,p)}),[o,i,c,d,e.depth,_,z,C,$,e.format,n.locale]),{shown:L,merge:W}=h,G=(0,te.useMemo)(()=>{let p=c.keys.length;return Array.from({length:L},(k,M)=>{let[j,H]=oa(M,p,W),Z=H-1,re=j===Z;return{label:re?c.labels[j]:a.range(c.labels[j],c.labels[Z]),key:re?c.keys[j]:`${c.keys[j]}~${c.keys[Z]}`,sync:go(c.keys[j]),datum:re?c.rows[0]?.[j]??null:null}})},[L,W,c,a]),le=(0,te.useMemo)(()=>{let p=e.highlight,k=typeof p=="string"?b.includes(p):Array.isArray(p)&&p.some(U=>typeof U=="string"&&b.includes(U)),M=U=>O?U.size?We(r,w,U):ll(r,w):ft(r,w,U);if(T===1&&!k){let U=be(p,G.map(fe=>fe.datum),G.map(fe=>fe.label),h.backTotal,"max");return{periods:Pt(r,L,U),back:[Q(r,"neutral")],front:M(new Set),split:O}}let j=[...f.map((U,fe)=>Ye(h.back.map(he=>he[fe]))),...m.map((U,fe)=>Ye(h.front.map(he=>he[fe])))],H=be(typeof p=="function"?void 0:p,b,b,j,"first"),Z=(U,fe)=>new Set([...H].filter(he=>he>=U&&he<U+fe).map(he=>he-U)),re=Z(T,w);return{periods:null,back:ft(r,T,Z(0,T)),front:M(re),split:O&&re.size===0}},[e.highlight,b,T,w,G,h,r,L,f,m,O]),K=(p,k)=>k==="front"?le.front:le.periods?[le.periods[p]]:le.back,oe=Ft(Oe(r.theme.panel)??[0,0,0,1])<.4?.3:.16,ce=`url(#${s}h)`,xe=p=>y==="all"||y==="front"&&p==="front",it=r.mix("panel","neutralSoft",.5),ba=r.paint("neutral"),st=(p,k)=>{let M=k==="back"?h.depthBack:h.depthFront,j=k==="back"?h.shift:[0,0];return{x:h.slotX(p)+j[0],base:h.floor-j[1],w:h.w,dx:M*h.cx,dy:-M*h.cy}},De=(p,k)=>k==="back"?h.backTotal[p]:h.frontTotal[p],rn=(p,k)=>k==="back"?h.back[p]:h.front[p],on=(p,k)=>{let M=st(p,k);return M.base-De(p,k)*h.k+M.dy},lt=v?tl:nl,ya=n.motion.duration??800,an=Math.min(n.motion.stagger??40,600/Math.max(1,L-1)),xa=(0,te.useMemo)(()=>G.flatMap((p,k)=>lt.map(M=>{let j=il(M==="back"?h.back[k]:h.front[k],h.k),H=j.map(()=>0);return{key:`${p.key}|${M}`,to:j,from:H,enter:H,delay:k*an+(M==="front"?120:0),data:{i:k,r:M}}})),[h,G,lt,an]),Zn=Ho(xa,n.motion),Qn=new Map;for(let p of Zn.items)p.exiting||Qn.set(`${p.data.i}|${p.data.r}`,p);let sn=p=>Zn.fade(p*an+ya*.7,260),Se=n.fv,er=p=>et(p*100,{locale:n.locale,maximumFractionDigits:1}),ln=p=>h.backTotal[p]>0?h.frontTotal[p]/h.backTotal[p]:null,$t=p=>{let k=ln(p);return k===null?"":er(k)},tr=(p,k)=>(k==="back"?f:m).map((M,j)=>({name:M,v:rn(p,k)[j],sw:K(p,k)[j]})).reverse(),cn=(p,k)=>tr(p,k).map(M=>`${M.name} ${Se(M.v)}`).join(", "),vt=p=>(p==="back"?T:w)>1,ka=(p,k)=>{let M=vt(k)?[cn(p,k),`${a.sum} ${Se(De(p,k))}`]:[cn(p,k)];return k==="front"&&R!==!1&&ln(p)!==null&&M.push(a.ofBack($t(p))),`${G[p].label}${v?` ${a.row[k]}`:""}: ${M.join(", ")} (${p+1}/${L})`},ct=h.backTotal.every(p=>p===0)&&h.frontTotal.every(p=>p===0),wa=(0,te.useMemo)(()=>ct?[]:G.map((p,k)=>({datum:p.datum,index:k,key:p.key,label:p.label,series:v?a.row[S]:void 0,value:De(k,S),formatted:lt.map(M=>a.cell(v?a.row[M]:"",Se(De(k,M)),vt(M)?cn(k,M):"")).join(", ")})),[h,G,a,S,Se,f,m]),nr=(0,te.useMemo)(()=>({keys:G.map(p=>p.sync),labels:G.map(p=>p.label)}),[G]);yr(n,e.syncId,nr.keys,nr.labels);let ae=n.active!==null&&n.active<L&&!ct?n.active:null,$a=(p,k,M)=>{let j=st(p,"back"),H=(j.w+j.dx)/2,Z=j.x+H,re=Math.min(on(p,"back"),on(p,"front")),U=40+k.length*18;if(re-U-14>=2)return{x:Z,y:re,title:M,rows:k};let fe=Math.max(112,se(M,11.5,600),...k.map(un=>(un.color?15:0)+se(un.label??"",12)+16+se(un.value,12,700)))+24,he=H+12+fe/2,Na=Math.max(4,Math.min(re,i-U-4));return{x:Z+he+fe/2<=o-4?Z+he:Z-he,y:Na+U+14,title:M,rows:k}},rr=null;if(ae!==null){let p=[];for(let k of lt){let M=k===S;for(let j of tr(ae,k))p.push({label:j.name,value:Se(j.v),color:j.sw.fill,strong:vt(k)?M?void 0:!1:M});vt(k)&&p.push({label:v?a.total[k]:a.sumLabel,value:Se(De(ae,k)),strong:M})}v&&R!==!1&&p.push({label:a.rate,value:$t(ae)||"-",strong:!1}),rr=$a(ae,p,G[ae].label)}let va=ae!==null&&n.via==="keyboard"?ka(ae,S):void 0,Ve=h.backTotal.indexOf(Math.max(...h.backTotal)),Ce=v?h.frontTotal.indexOf(Math.max(...h.frontTotal)):-1,or=a.kind;if(L){let p=[a.kind,a.desc(T,f.join(", "),G[0].label,G[L-1].label),a.descPeak(G[Ve].label,Se(h.backTotal[Ve]))];v&&p.push(h.frontTotal[Ce]>0?a.descFront(m.join(", "),G[Ce].label,Se(h.frontTotal[Ce]),$t(Ce)):a.descFrontZero(m.join(", "))),W>1&&p.push(a.merged(W)),or=p.join(". ")}let Ta=`${e.description??`${or}.`}${v?` ${a.keys}`:""}`,ar=(0,te.useMemo)(()=>{let p=G.map((k,M)=>ta(h.slotX(M)+h.w/2,k.label,pe,o));return{xs:p,show:lo(p,G.map(k=>k.label),pe,6)}},[h,G,o]),ir=h.floor+_e+20,Tt=I?ir+nn+14:h.floor+_e+12,Ma=(p,k,M)=>{if(ct)return;let j=no(p,h.slotX(0)+h.s*.49,h.slotX(L-1)+h.s*.49,L),H=O?h.depthFront*h.cy+4:6,Z=!M&&v&&k>=h.floor-h.frontTotal[j]*h.k-H?"front":"back";Z!==l&&u(Z),j!==n.active&&n.setActive(j,M?"touch":"pointer")},Mt=h.top-10,ut=h.slotX(0)-8,mt=h.slotX(L-1)+h.w+8,St=h.lead+h.depthBack+8,Sa=Je([[ut,h.floor+_e],[mt,h.floor+_e],[mt+St*h.cx,h.floor+_e-St*h.cy],[ut+St*h.cx,h.floor+_e-St*h.cy]]),Ca=()=>{let p=st(Ve,"back"),k=a.peak(Se(h.backTotal[Ve])),M=Math.min(p.x+(p.w+p.dx)/2,(_?h.wallX[1]:o-2)-se(k,11.5,700)/2);return(0,A.jsx)(Yn,{p:r,x:M,y:on(Ve,"back")-11,opacity:sn(Ve),children:k})},Aa=()=>{let p=R==="label"?$t(Ce):"",k=a.frontPeak(G[Ce].label,Se(h.frontTotal[Ce]),p),M=h.slotX(Ce)+h.w/2;return(0,A.jsxs)("g",{opacity:sn(Ce),children:[(0,A.jsx)("line",{x1:D(M),x2:D(M),y1:D(Tt+8),y2:D(Tt+14),stroke:r.paint("muted")}),(0,A.jsx)(Yn,{p:r,x:ta(M,k,11,o,700),y:Tt+25,size:11,children:k})]})};return(0,A.jsxs)(Br,{c:n,kind:a.kind,ariaLabel:e.ariaLabel,description:Ta,events:wa,tip:rr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,announce:va,onPointerMove:(p,k,M)=>Ma(p,k,M.pointerType==="touch"),onKey:p=>{let k=al(p.key,v);return k===null?!1:(k!==l&&u(k),ae===null&&!ct&&n.setActive(0,"keyboard"),!0)},defs:y!=="none"?(0,A.jsx)("pattern",{id:`${s}h`,width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:(0,A.jsx)("rect",{width:1.6,height:4,fill:r.paint("panel"),fillOpacity:.55})}):void 0,children:[(0,A.jsx)("g",{"aria-hidden":"true",children:E.map((p,k)=>{let{x:M,line:j}=N[k],H=j*ea+9,Z=k>=T;return(0,A.jsxs)("g",{children:[p.divider&&M>0?(0,A.jsx)("line",{x1:M-14,x2:M-14,y1:H-7,y2:H+7,stroke:r.paint("line")}):null,(0,A.jsx)("rect",{x:M,y:H-5,width:10,height:10,rx:2,fill:Z?le.front[k-T].fill:le.back[k].fill}),xe(Z?"front":"back")?(0,A.jsx)("rect",{x:M,y:H-5,width:10,height:10,rx:2,fill:ce}):null,(0,A.jsx)(ze,{x:M+15,y:H,size:11.5,fill:r.paint("muted"),children:p.name})]},k)})}),ct?(0,A.jsx)(ze,{x:o/2,y:(h.top+h.floor)/2,anchor:"middle",size:13,fill:r.paint("muted"),children:a.nothing}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("g",{"aria-hidden":"true",children:[_?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("rect",{x:D(h.wallX[0]),y:D(Mt),width:D(Math.max(0,h.wallX[1]-h.wallX[0])),height:D(Math.max(0,h.wallBase-Mt)),fill:r.paint("line2"),fillOpacity:.6}),h.ticks.map(p=>{let k=h.wallBase-p*h.k;return(0,A.jsxs)("g",{children:[(0,A.jsx)("line",{x1:D(h.wallX[0]),x2:D(h.wallX[1]),y1:D(k),y2:D(k),stroke:r.paint("line")}),(0,A.jsx)(ze,{x:h.wallX[1]+6,y:k,size:pe,fill:r.paint("muted"),children:h.fmt(p)})]},p)})]}):null,(0,A.jsx)("polygon",{points:Sa,fill:r.paint("neutralSoft")}),(0,A.jsx)("rect",{x:D(ut),y:D(h.floor+_e),width:D(Math.max(0,mt-ut)),height:_e,fill:r.paint("line")})]}),G.map((p,k)=>(0,A.jsxs)("g",{className:"ztd-mark",opacity:ae===null||ae===k?1:.38,onClick:()=>n.click(k),style:{cursor:e.onClick?"pointer":void 0},children:[(0,A.jsx)("rect",{x:D(h.slotX(k)),y:D(Mt),width:D(h.s),height:D(Math.max(0,i-Mt)),fill:"transparent"}),lt.map(M=>{let j=Qn.get(`${k}|${M}`);if(!j)return null;let H=st(k,M),Z=De(k,M)*h.k;if(O)return De(k,M)===0?(0,A.jsx)("polygon",{points:Je([[H.x,H.base],[H.x+H.w,H.base],[H.x+H.w+H.dx,H.base+H.dy],[H.x+H.dx,H.base+H.dy]]),fill:"none",stroke:r.paint("neutralStrong"),strokeOpacity:.7,strokeDasharray:"2 2"},M):(0,A.jsx)(ra,{p:r,g:H,cum:j.v,colors:K(k,M),hatch:xe(M)?ce:null,lid:M==="back"?it:ba,lidSplit:M==="front"&&le.split?{fills:K(k,M).map(re=>re.fill),values:rn(k,M)}:void 0,lidStroke:!0,lidInk:M==="front",lidHatch:M==="front",shade:oe,tile:!0},M);if(Z>0&&Z<1){let re=rn(k,M),U=re.length-1;for(;U>0&&!(re[U]>0);)U--;return(0,A.jsx)("line",{x1:D(H.x),x2:D(H.x+H.w),y1:D(H.base-.5),y2:D(H.base-.5),stroke:K(k,M)[U].fill},M)}return(0,A.jsx)(ra,{p:r,g:H,cum:j.v,colors:K(k,M),hatch:xe(M)?ce:null,lid:M==="back"?it:r.paint("neutralSoft"),lidStroke:M==="back",shade:oe},M)}),ae===k&&n.via!=="sync"?(0,A.jsx)("polygon",{points:Je(sl(st(k,S),De(k,S)*h.k)),fill:"none",stroke:r.paint("ink"),strokeWidth:2,strokeLinejoin:"round",pointerEvents:"none"}):null]},p.key)),n.showLabels&&h.backTotal[Ve]>0?Ca():null,I?(0,A.jsx)(ml,{p:r,rates:G.map((p,k)=>ln(k)),x:h.slotX,w:h.w,from:ut,to:mt,top:ir,right:_?h.wallX[1]+6:mt+6,title:a.rate,pct:er,fade:sn}):null,(0,A.jsx)("g",{"aria-hidden":"true",children:ar.show.map(p=>(0,A.jsx)(ze,{x:ar.xs[p],y:Tt,anchor:"middle",size:pe,fill:r.paint(ae===p?"ink":"muted"),weight:ae===p?700:400,children:G[p].label},p))}),B&&h.frontTotal[Ce]>0?Aa():null]})]})}var dl=F(Y(),1);var la=F(V(),1);function aa(e,t){return t===!1?e.map((n,r)=>r):eo(e)}function ia(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return be(e,t,t,r,"max")}function sa(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]=Q(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?Q(e,"neutral"):_t(e,1-a/Math.max(1,o.length-1))),r}function ca(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Te(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ua(e,t){return We(e,t+1,new Set)}var fl=F(Y(),1);var da=F(V(),1);function ma(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!To.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var Pe=F(V(),1);function fa(e,t,n){let r=Vt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Gt(n)?Vt("bubble"):r}function hl(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 gl(e,t,n,r=!1){let o=fa(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&&Pn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),u=c=>c.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let c=Fe(i.label,"label"),d=Wt(i.value,"value"),g=o.type==="waffle",f=t.map((y,_)=>({r:y,label:c(y,_),value:g?d(y,_):Jo(d(y,_))})),{kept:b,other:T}=g?{kept:f,other:null}:Yo(f,a.other,(y,_)=>({r:{},label:Uo(J(n),y),value:_})),w=be(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),g?"first":"max"),v=T?[...b,T]:b,S=Ie(y=>g?we(y,v.length,w):qo(y,v.length,w,a.colorMode)),R=g&&a.shape==="arc";return v.map((y,_)=>({label:y.label,color:S[_],...R&&{shape:"circle"}}))}if(o.type==="candlestick"){let c=Xo(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Ko[J(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...c.map((g,f)=>({label:d.maLegend(g),color:Kn[f],shape:"line"}))]}if(o.type==="network"){let c=ca(a.groups);if(c.length<2)return[];let d=Ie(g=>ua(g,c.length));return c.map((g,f)=>({label:g,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let c=Fe(i.group,"group"),d=Te(t.map((f,b)=>c(f,b)).filter(Boolean));if(d.length<2)return[];let g=Ie(f=>We(f,d.length,new Set));return d.map((f,b)=>({label:f,color:g[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||Gt(a))return[];let c=Fe(i.series,"series"),d=Te(t.map((b,T)=>c(b,T)));if(d.length<2)return[];let g=Wo(s,t,d,c),f=Ie(b=>We(b,d.length,g));return u(d.map((b,T)=>({label:b,color:f[T],shape:"circle"})))}if(o.type==="timeline"){let c=typeof i.group!="string",d=c?i.status:i.group;if(typeof d!="string")return[];let g=Do(t,d,c),f=Ie(b=>we(b,g.length,ma(s,g)));return u(g.map((b,T)=>({label:b,color:f[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(i.y))c=i.y;else if(typeof i.series=="string"){let S=Fe(i.series,"series");c=Te(t.map((R,y)=>S(R,y)))}let d=Dn(o.type,i,a);if(d.length){let S=be(s,c,c,c.map(()=>0),"none"),R=Ie(_=>we(_,c.length,S)),y=c.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:c.map((_,z)=>({label:_,color:R[z]}));return[...u(y),...d.map((_,z)=>({label:_,color:Vo(z),shape:"line"}))]}if(c.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?Qr(c.length,Array.isArray(a.negative)?a.negative.map(S=>c.indexOf(String(S))):[],typeof a.neutral=="string"?c.indexOf(a.neutral):-1):-1,b=f>=0?new Set([f]):be(s,c,c,c.map(()=>0),"first");if(o.type==="radar")return u(c.map((S,R)=>({label:S,color:b.has(R)?"accent":"neutralStrong",shape:"square"})));let T=a.colorMode,w=S=>we(S,c.length,b);if((o.type==="line"||o.type==="area")&&(w=S=>Go(S,c.length,b,o.type==="area",T)),o.type==="stream"){let S=je(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),R=aa(S.values,a.reorder),y=ia(s,S.series,S.values);w=_=>sa(_,R,y)}let v=Ie(w);return u(c.map((S,R)=>({label:S,color:v[R],...o.type==="line"&&{shape:"line"}})))}return[]}function pl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Wr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function bl(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:u,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:u}}function ha(e,t){let{spec:n}=e,r=fa(n.type,n.encoding,n.options),o=(0,wt.useMemo)(()=>Lo(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Vr(n,e.locale),s=ue(a),l=J(s),u=Mo(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=Ur(n),c=(0,wt.useMemo)(()=>m?_o(m,s):void 0,[m,s]),d=n.options?.hidden,g=Array.isArray(d)?d.map(String):[],f=g.join(""),[b,T]=(0,wt.useState)(null);if(!r)return(0,Pe.jsx)(_n,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let w=o??u.data,v=t[r.type],S={...n.options??{}},R={...hl(r,n.encoding),...S,...c?{tooltip:c}:{},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:a},y=n.card?.legend==="toggle"&&Xr(r.type,n.encoding??{},S),_=b&&b.base===f?b.hidden:g;y&&(R.hidden=_);let z=N=>T(C=>{let $=C&&C.base===f?C.hidden:g;return{base:f,hidden:$.includes(N)?$.filter(h=>h!==N):[...$,N]}}),O=R.height??220,I=pl(n,r.type),B=i&&!w.length&&(u.loading||u.error||u.empty)?(0,Pe.jsx)(_n,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:O,locale:a}):I?(0,Pe.jsx)(vo,{chart:v,...bl(r.type,I,R)}):(0,Pe.jsx)(v,{...R});if(n.card){let N=n.card,C=N.legend==="auto"||N.legend==="toggle"?gl(n,w,s,y):N.legend,$=C?.length?y?(0,Pe.jsx)(Fn,{items:C,hidden:_,onToggle:z,locale:a}):C:void 0,h=N.download?(0,Pe.jsx)(Fo,{data:w,columns:Yr(n),filename:N.title??r.type,formats:Array.isArray(N.download)?N.download:void 0,locale:a}):void 0;B=(0,Pe.jsx)(zr,{number:N.number,title:N.title??Gr(r,l),subtitle:N.subtitle,legend:$,actions:h,source:N.source||void 0,note:N.note||void 0,accent:N.accent,takeaway:N.takeaway,level:N.level,sample:N.sample,replay:N.replay!==!1,className:e.className,locale:a,children:B})}let E=e.theme??n.theme;return E&&(B=(0,Pe.jsx)(It,{theme:E,children:B})),B}function yl({cfg:e,components:t}){let n=rt();return ha({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function pa(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ga.hydrateRoot)(r,(0,qn.createElement)(It,{theme:o.theme,cssVars:!0},(0,qn.createElement)(yl,{cfg:o,components:{[e]:t}})))}pa("skyline",Jn);})();
|
|
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?gt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,u=s.replace(Pr,(m,c)=>o(i,c.trim())??(l=!0,""));l||a.push(u)}return a.length?a.map((s,l)=>(0,Po.jsx)("div",{children:s},l)):null}}function Do(e,t,n=!1){let r=Fe(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Te(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 Lo(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 Ue(t.csv)}return null}var jo=F(Y(),1);var ee=F(Y(),1);function Eo(e,t){let n=ve(e.theme),[r,o,i]=qt(e.width),a=rt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,m=Zt(e.reducedMotion??"auto"),c=e.animate!==!1&&!m&&ke,d=$o(r,e.animateOnView!==!1&&c),g=ue(e.locale),f=J(g),b=(0,ee.useMemo)(()=>Ke(e.format,g,t.format),[e.format,g,t.format]),T=(0,ee.useCallback)(K=>et(K,{locale:g}),[g]),w=(0,ee.useMemo)(()=>Dt(b,e.unit),[b,e.unit]),v=(0,ee.useMemo)(()=>Kt(e.data),[e.data]),[S,R]=(0,ee.useState)(null),[y,_]=(0,ee.useState)(null),z=(0,ee.useRef)([]),O=(0,ee.useRef)(e.onHover);O.current=e.onHover;let I=(0,ee.useRef)(e.onClick);I.current=e.onClick;let B=(0,ee.useRef)(null),E=(0,ee.useRef)(null),N=(0,ee.useRef)(null),C=(0,ee.useCallback)((K,oe="pointer")=>{if(N.current!==K){N.current=K;let ce=K===null?null:z.current[K]??null;queueMicrotask(()=>O.current?.(ce)),E.current?.(K)}B.current=K===null?null:oe,R(K),_(B.current)},[]),$=(0,ee.useCallback)(K=>{B.current!=="keyboard"&&(B.current=K===null?null:"sync",R(K),_(B.current))},[]),h=(0,ee.useCallback)(K=>{let oe=z.current[K];oe&&I.current?.(oe)},[]),L=Ir(e.replayKey),W=e.width!==void 0||(i??0)>0,G={enabled:c,active:d.visible&&W,near:d.near,replayKey:L,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},le=(0,ee.useCallback)((K,oe=1)=>S===null||S===K?oe:oe*.38,[S]);return{p:n,width:s,height:u,measured:W,responsive:e.width===void 0,pending:ke&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:G,fv:w,fmt:b,pct:T,locale:g,lang:f,t:f==="ko"?kr:xr,active:S,via:y,setActive:C,click:h,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:le,sig:v,description:e.description,reduced:m,publish:E,applySync:$}}var q=F(Y(),1);function Os(e){return 1-Math.pow(1-e,3)}function Is(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function zs(e){return e==="easeInOut"?Is:e==="linear"?t=>t:Os}function Bs(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 at(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 Qt(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 Oo(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 Io(e,t,n,r){if(!t||!n||t.length!==n.length)return at(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 at(s,n[a]))o.push(l)}return o.length===r?o:at(e,r)}var en=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||!Qt(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),Oo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Qt(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 u=a.to.length;s.from=Io(s.cur,s.parts,a.parts,u),s.vel=Io(s.curVel,s.parts,a.parts,u),s.parts=a.parts,s.to=a.to.slice(),Oo(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=Qt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let u=this.make(a,a.enter??a.from??a.to,n+l,0);u.done=Qt(u.from,u.to),this.tracks.set(a.key,u)}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=at(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=zs(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,u=s.to.length;if(s.from.length!==u&&(s.from=at(s.from,u)),s.vel.length!==u&&(s.vel=at(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let c=Math.exp(-i*l),d=i*l>=8&&i*l<20,g=0;for(let f=0;f<u;f++){let b=s.from[f]-s.to[f],T=s.vel[f]+i*b;s.cur[f]=s.to[f]+(b+T*l)*c,s.curVel[f]=(s.vel[f]-i*T*l)*c,d&&g<.15&&(g=Math.max(g,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&g<.15,s.progress=Math.min(1,1-(1+i*l)*c)}else{let c=Math.min(1,l/o),d=r(c),g=Bs(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*g;m=c>=1,s.progress=d}if(m){for(let c=0;c<u;c++)s.cur[c]=s.to[c],s.curVel[c]=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}},kt=new Set,tn=0;function zo(e){tn=0;let t=Array.from(kt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||kt.delete(n)}kt.size&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo))}function Bo(e){return kt.add(e),!tn&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo)),()=>{kt.delete(e)}}function Hs(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 Ho(e,t){let n=(0,q.useMemo)(()=>Hs(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:u=900,stagger:m=0}=t,c=(0,q.useRef)(null),d=(0,q.useRef)("init"),g=(0,q.useRef)(null),f=(0,q.useRef)(s),b=(0,q.useRef)(a),T=(0,q.useRef)(!1),w=(0,q.useRef)(0),[,v]=(0,q.useState)(0),S=(0,q.useRef)(null),R=(0,q.useRef)(!0);c.current||(c.current=new en,c.current.configure(l,u),c.current.snap(n),g.current=n);let y=c.current;if(y.configure(l,u),g.current!==n){let E=d.current,N=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||E==="init"?y.snap(n):E==="idle"?y.hold(n):E==="running"||N?y.update(n,Nt(),m):y.snap(n),g.current=n,f.current=s}let _=(0,q.useRef)(()=>!1);_.current=E=>{if(!R.current)return!1;let N=y.step(E);return!N&&d.current==="running"&&(d.current="done"),v(C=>(C+1)%1e9),N||(S.current=null),N};let z=(0,q.useCallback)(()=>{if(!ke||S.current||!y.animating)return;let E=N=>_.current(N);S.current=Bo(E)},[y]);Ae(()=>{let E=!Object.is(b.current,a);if(b.current=a,!r){(d.current!=="done"||y.animating)&&(y.snap(g.current??n),d.current="done",v(N=>N+1));return}d.current==="init"||E&&i?(y.hold(g.current??n),d.current="idle",T.current=!1,v(N=>N+1)):E&&(T.current=!0)},[r,a]),Ae(()=>{!r||!i||!T.current||(T.current=!1,y.hold(g.current??n),d.current="idle",v(E=>E+1))},[i,r]),(0,q.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(Nt()),w.current+=1,d.current="running",z(),v(E=>E+1))},[r,o,a,y,z]),(0,q.useEffect)(()=>{y.animating&&z()}),(0,q.useEffect)(()=>(R.current=!0,()=>{R.current=!1,S.current?.(),S.current=null}),[]);let O=Nt(),I=y.elapsed(O),B=r&&d.current==="idle";return{items:y.items(),get:E=>y.get(E),elapsed:B?0:I,fade:(E,N=320)=>B?0:Number.isFinite(I)?Math.max(0,Math.min(1,(I-E)/N)):1,waiting:B,animating:y.animating,generation:w.current}}var Gn=F(V(),1);function Go(e,t,n,r,o){if(r)return o==="categorical"?we(e,t,n):ft(e,t,n);if(o==="categorical")return we(e,t,n);let i=Q(e,"strong"),a=Q(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var js=F(Y(),1);var Vn=F(V(),1);var Vo=e=>e?"neutralStrong":"accent";var Wn=F(V(),1);function Wo(e,t,n,r){if(typeof e!="function")return be(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 Gs=F(Y(),1);var Xn=F(V(),1),Vs={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}, ${Ee(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Ko={en:Vs,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}일 이동평균`}},Kn=["ink","muted","dim"];function Xo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Kn.length)}var Ws=F(Y(),1);var Zo=F(V(),1),Ks={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ee(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Xs={en:Ks,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Uo=(e,t)=>Xs[e].other(t);function Yo(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,to(o.map(i=>i.value)))}}var Jo=e=>Number.isFinite(e)&&e>0?e:0;function qo(e,t,n,r){return r==="emphasis"?Pt(e,t,n):we(e,t,n)}var te=F(Y(),1);var A=F(V(),1),Us={kind:"Skyline",row:{back:"back",front:"front"},total:{back:"Back total",front:"Front total"},sum:"total",sumLabel:"Total",rate:"Front ÷ back",peak:e=>`Peak ${e}`,frontPeak:(e,t,n)=>`Front peak ${e} · ${t}${n?` (${n})`:""}`,range:(e,t)=>`${e}–${t}`,nothing:"Nothing to draw",ofBack:e=>`${e} of the back row`,cell:(e,t,n)=>`${e?`${e} `:""}${t}${n?` (${n})`:""}`,desc:(e,t,n,r)=>`${Ee(e,"series","series")} (${t}) stacked from ${n} to ${r}`,descPeak:(e,t)=>`Peak period ${e} at ${t}`,descFront:(e,t,n,r)=>`Front row (${e}) peaks at ${t} with ${n}${r?`, ${r} of the back row`:""}`,descFrontZero:e=>`The front row (${e}) is all zero`,merged:e=>`Neighboring periods are summed in groups of ${e}`,keys:"Use left and right arrows for periods, up and down to switch rows."},Ys={en:Us,ko:{kind:"스카이라인",row:{back:"뒷줄",front:"앞줄"},total:{back:"뒷줄 합계",front:"앞줄 합계"},sum:"합계",sumLabel:"합계",rate:"앞줄 ÷ 뒷줄",peak:e=>`최고 ${e}`,frontPeak:(e,t,n)=>`앞줄 최고 ${e} · ${t}${n?` (${n})`:""}`,range:(e,t)=>`${e}~${t}`,nothing:"그릴 값이 없어요",ofBack:e=>`뒷줄의 ${e}`,cell:(e,t,n)=>`${e?`${e} `:""}${t}${n?`(${n})`:""}`,desc:(e,t,n,r)=>`계열 ${e}개(${t})를 ${n}부터 ${r}까지 쌓았어요`,descPeak:(e,t)=>`가장 많은 기간 ${e} ${t}`,descFront:(e,t,n,r)=>`앞줄(${e})이 가장 많은 기간 ${t} ${n}${r?`, 뒷줄의 ${r}`:""}`,descFrontZero:e=>`앞줄(${e})은 모두 0이에요`,merged:e=>`이웃 기간을 ${e}개씩 합쳤어요`,keys:"←→로 기간을, ↑↓로 앞줄과 뒷줄을 옮겨요."}},Js={low:{cx:.8944271909999159,cy:.4472135954999579,face:.52,front:.14,gap:.05,depth:[.1,.32,.32]},high:{cx:.4472135954999579,cy:.8944271909999159,face:.54,front:.42,gap:.1,depth:[.1,.45,.42]}};var qs=20,Zs=40,Qs=.4,Qo=14,Un=10,el=20,_e=4,nn=26,ea=18,tl=["back","front"],nl=["back"],D=e=>Math.round(e*10)/10,Je=e=>e.map(([t,n])=>`${D(t)},${D(n)}`).join(" "),Ye=e=>e.reduce((t,n)=>t+n,0),ta=(e,t,n,r,o=400)=>{let i=se(t,n,o)/2;return Math.max(i+2,Math.min(r-i-2,e))};function rl(e,t){for(let n=1;n<t;n++){let r=Math.ceil(t/n);if(r<=Zs&&e/(r+.55)>=qs)return n}return Math.max(1,t)}function oa(e,t,n){let r=t-n*(Math.ceil(t/n)-1);return e===0?[0,r]:[r+(e-1)*n,r+e*n]}function na(e,t,n){return Array.from({length:Math.ceil(t/n)},(r,o)=>{let[i,a]=oa(o,t,n);return e.map(s=>Ye(s.slice(i,a).map(l=>Number.isFinite(l)&&l>0?l:0)))})}function ol(e){let t=Js[e.view??"high"],n=e.view==="low"||e.front.length?t.front:0,r=Math.min(t.depth[1],Math.max(t.depth[0],e.depth??t.depth[2])),o=I=>e.width-Un-(e.wall?I+14:8),i=0,a=0,s=[],l=[],u=[0,1];for(let I=0;I<3;I++){let B=rl(o(a),e.n);if(B===i)break;i=B,s=na(e.back,e.n,i),l=na(e.front,e.n,i),u=He(0,Math.max(0,...s.map(Ye),...l.map(Ye)),4);let E=e.tickFmt(u[1]);a=e.wall?Math.max(...pt(u[0],u[1],4).map(N=>se(E(N),pe))):0}let m=s.length,c=Math.max(1,o(a)/(m+.55)),d=t.face*c,g=e.height-e.below,f=e.legendH+el,b=(n+t.gap+r)*c*t.cy,T=e.view==="low"?1:Math.min(1,Qs*Math.max(0,g-f)/(b||1)),w=(n+t.gap)*c*T,v=w+r*c*T,S=g-v*t.cy,R=Math.max(0,S-f)/(u[1]||1),y=pt(u[0],u[1],4),_=y.length>1?(y[1]-y[0])*R:1/0,z=_>=Qo?1:_>0?Math.ceil(Qo/_):y.length,O=I=>Un+I*c;return{merge:i,shown:m,back:s,front:l,backTotal:s.map(Ye),frontTotal:l.map(Ye),ticks:y.filter((I,B)=>B%z===0),fmt:e.tickFmt(u[1]),k:R,s:c,w:d,floor:g,wallBase:S,top:f,cx:t.cx,cy:t.cy,lead:w,shift:[w*t.cx,w*t.cy],depthFront:n*c*T,depthBack:r*c*T,wallX:[Un+v*t.cx-6,O(m-1)+d+v*t.cx+6],slotX:O}}function al(e,t){return t?e==="ArrowUp"?"back":e==="ArrowDown"?"front":null:null}function il(e,t){let n=0;return e.map(r=>n+=r*t)}function sl(e,t){let{dx:n,dy:r}=e,o=e.base-t;return[[e.x,o],[e.x+n,o+r],[e.x+e.w+n,o+r],[e.x+e.w+n,e.base+r],[e.x+e.w,e.base],[e.x,e.base]]}function ll(e,t){return Array.from({length:t},(n,r)=>{let o=r%2===0?"accent2":"accent3",i=Math.max(.4,1-.3*Math.floor(r/2)),a=i===1?e.theme[o]:Qe(e.theme[o],e.theme.ink,i);return{role:"mix",fill:i===1?e.paint(o):e.mix(o,"ink",i),text:wn(e,a),raw:a}})}function cl(e,t,n){if(!n)return null;let r=s=>s>0?s:0,o=n.values.reduce((s,l)=>s+r(l),0);if(!(o>0))return null;let i=[],a=0;return n.values.forEach((s,l)=>{let u=e.x+e.w*a/o;a+=r(s);let m=e.x+e.w*a/o;m>u&&i.push((0,A.jsx)("polygon",{points:Je([[u,t],[m,t],[m+e.dx,t+e.dy],[u+e.dx,t+e.dy]]),fill:n.fills[l]??"none"},`l${l}`))}),i}function ra(e){let{p:t,g:n,cum:r,colors:o,hatch:i}=e,{dx:a,dy:s}=n,l=n.x+n.w,u=(v,S)=>Je([[l,v],[l+a,v+s],[l+a,S+s],[l,S]]),m=r[r.length-1]??0,c=n.base-m,d=[],g=[],f=0;if(r.forEach((v,S)=>{let R=n.base-f,y=n.base-v;v>f&&(d.push((0,A.jsx)("rect",{x:D(n.x),y:D(y),width:D(n.w),height:D(v-f),fill:o[S].fill},`f${S}`)),d.push((0,A.jsx)("polygon",{points:u(y,R),fill:o[S].fill},`s${S}`)),f>0&&g.push((0,A.jsx)("polyline",{points:Je([[n.x,R],[l,R],[l+a,R+s]]),fill:"none",stroke:t.paint("panel"),strokeWidth:1.2},`g${S}`))),f=v}),m<1&&!e.tile)return(0,A.jsx)("g",{children:d});let b=u(c,n.base),T=Je([[n.x,c],[l,c],[l+a,c+s],[n.x+a,c+s]]),w=cl(n,c,e.lidSplit);return(0,A.jsxs)("g",{children:[d,m>=1?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("polygon",{points:b,fill:"#000",fillOpacity:e.shade}),i?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("rect",{x:D(n.x),y:D(c),width:D(n.w),height:D(m),fill:i}),(0,A.jsx)("polygon",{points:b,fill:i})]}):null,g,(0,A.jsx)("line",{x1:D(l),x2:D(l),y1:D(c),y2:D(n.base),stroke:t.paint("panel"),strokeOpacity:.7})]}):null,w,(0,A.jsx)("polygon",{points:T,fill:w?"none":e.lid,stroke:e.lidStroke?t.paint(e.lidInk?"ink":"neutralStrong"):void 0,strokeOpacity:e.lidStroke?e.lidInk?.4:.55:void 0,strokeLinejoin:"round"}),e.lidHatch&&i?(0,A.jsx)("polygon",{points:T,fill:i}):null]})}function Yn(e){let{p:t}=e;return(0,A.jsx)("text",{x:D(e.x),y:D(e.y),dy:"0.35em",fontSize:e.size??11.5,fill:t.paint("ink"),textAnchor:"middle",fontWeight:700,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),stroke:t.paint("panel"),strokeWidth:4,strokeLinejoin:"round",paintOrder:"stroke",style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}function ul(e,t){let n=[],r=0,o=0;for(let i of e){let a=15+se(i.name,11.5);if(r>0){let s=i.divider?28:14;r+s+a>t?(r=0,o++):r+=s}n.push({x:r,line:o}),r+=a}return n}function ml(e){let{p:t,rates:n}=e,r=Math.max(0,...n.map(s=>s??0)),o=uo(0,r,2)[1],i=r>0?n.indexOf(r):-1,a=e.top+nn;return(0,A.jsxs)("g",{"aria-hidden":"true",children:[(0,A.jsx)(ze,{x:e.from,y:e.top-8,size:11,fill:t.paint("muted"),children:e.title}),(0,A.jsx)("line",{x1:D(e.from),x2:D(e.to),y1:D(e.top),y2:D(e.top),stroke:t.paint("line2")}),(0,A.jsx)("line",{x1:D(e.from),x2:D(e.to),y1:D(a),y2:D(a),stroke:t.paint("line")}),n.map((s,l)=>{if(s===null||s<=0)return null;let u=s/o*nn;return(0,A.jsx)("rect",{x:D(e.x(l)),y:D(a-u),width:D(e.w),height:D(u),rx:Math.min(1.5,u/2),fill:t.paint(l===i?"accent":"neutralStrong")},l)}),(0,A.jsx)(ze,{x:e.right,y:a,size:pe,fill:t.paint("muted"),children:"0"}),(0,A.jsx)(ze,{x:e.right,y:e.top,size:pe,fill:t.paint("muted"),children:e.pct(o)}),i>=0?(0,A.jsx)(Yn,{p:t,x:e.x(i)+e.w/2,y:a-r/o*nn-8,size:11,opacity:e.fade(i),children:e.pct(r)}):null]})}function Jn(e){let t=e.frontRate==="strip"&&e.front!==void 0,n=Eo(e,{height:p=>Math.max(300,Math.min(440,p*.58))+(t?40:0),duration:800,stagger:40}),{p:r,width:o,height:i}=n,a=Ys[n.lang],s=(0,te.useId)().replace(/:/g,""),[l,u]=(0,te.useState)("back"),m=(0,te.useMemo)(()=>e.front===void 0?[]:Array.isArray(e.front)?e.front:[e.front],[e.front]),c=(0,te.useMemo)(()=>je(e.data,e.x,e.y,e.series,{locale:n.locale,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,n.locale,e.dayFirst]),d=(0,te.useMemo)(()=>m.length?je(e.data,e.x,m,void 0,{locale:n.locale,xType:c.type,dayFirst:e.dayFirst}).values:[],[e.data,e.x,m,n.locale,c,e.dayFirst]),g=typeof e.y=="string"?e.y:n.t.value,f=(0,te.useMemo)(()=>c.series.map(p=>p||g),[c,g]),b=(0,te.useMemo)(()=>[...f,...m],[f,m]),T=f.length,w=m.length,v=w>0,S=v?l:"back",R=e.frontRate??"label",y=e.texture??"front",_=e.wall!==!1,z=e.view??"high",O=z==="high",I=t&&v,B=v&&!t&&n.showLabels,E=(0,te.useMemo)(()=>T>1||v?b.map((p,k)=>({name:p,divider:k===T&&T>0})):[],[b,T,v]),N=(0,te.useMemo)(()=>ul(E,o),[E,o]),C=N.length?(N[N.length-1].line+1)*ea+6:0,$=_e+(I?70:B?48:22),h=(0,te.useMemo)(()=>ol({width:o,height:i,back:c.values,front:d,n:c.keys.length,depth:e.depth,wall:_,view:z,legendH:C,below:$,tickFmt:p=>Lt(e.format,n.locale,p)}),[o,i,c,d,e.depth,_,z,C,$,e.format,n.locale]),{shown:L,merge:W}=h,G=(0,te.useMemo)(()=>{let p=c.keys.length;return Array.from({length:L},(k,M)=>{let[j,H]=oa(M,p,W),Z=H-1,re=j===Z;return{label:re?c.labels[j]:a.range(c.labels[j],c.labels[Z]),key:re?c.keys[j]:`${c.keys[j]}~${c.keys[Z]}`,sync:go(c.keys[j]),datum:re?c.rows[0]?.[j]??null:null}})},[L,W,c,a]),le=(0,te.useMemo)(()=>{let p=e.highlight,k=typeof p=="string"?b.includes(p):Array.isArray(p)&&p.some(U=>typeof U=="string"&&b.includes(U)),M=U=>O?U.size?We(r,w,U):ll(r,w):ft(r,w,U);if(T===1&&!k){let U=be(p,G.map(fe=>fe.datum),G.map(fe=>fe.label),h.backTotal,"max");return{periods:Pt(r,L,U),back:[Q(r,"neutral")],front:M(new Set),split:O}}let j=[...f.map((U,fe)=>Ye(h.back.map(he=>he[fe]))),...m.map((U,fe)=>Ye(h.front.map(he=>he[fe])))],H=be(typeof p=="function"?void 0:p,b,b,j,"first"),Z=(U,fe)=>new Set([...H].filter(he=>he>=U&&he<U+fe).map(he=>he-U)),re=Z(T,w);return{periods:null,back:ft(r,T,Z(0,T)),front:M(re),split:O&&re.size===0}},[e.highlight,b,T,w,G,h,r,L,f,m,O]),K=(p,k)=>k==="front"?le.front:le.periods?[le.periods[p]]:le.back,oe=Ft(Oe(r.theme.panel)??[0,0,0,1])<.4?.3:.16,ce=`url(#${s}h)`,xe=p=>y==="all"||y==="front"&&p==="front",it=r.mix("panel","neutralSoft",.5),ba=r.paint("neutral"),st=(p,k)=>{let M=k==="back"?h.depthBack:h.depthFront,j=k==="back"?h.shift:[0,0];return{x:h.slotX(p)+j[0],base:h.floor-j[1],w:h.w,dx:M*h.cx,dy:-M*h.cy}},De=(p,k)=>k==="back"?h.backTotal[p]:h.frontTotal[p],rn=(p,k)=>k==="back"?h.back[p]:h.front[p],on=(p,k)=>{let M=st(p,k);return M.base-De(p,k)*h.k+M.dy},lt=v?tl:nl,ya=n.motion.duration??800,an=Math.min(n.motion.stagger??40,600/Math.max(1,L-1)),xa=(0,te.useMemo)(()=>G.flatMap((p,k)=>lt.map(M=>{let j=il(M==="back"?h.back[k]:h.front[k],h.k),H=j.map(()=>0);return{key:`${p.key}|${M}`,to:j,from:H,enter:H,delay:k*an+(M==="front"?120:0),data:{i:k,r:M}}})),[h,G,lt,an]),Zn=Ho(xa,n.motion),Qn=new Map;for(let p of Zn.items)p.exiting||Qn.set(`${p.data.i}|${p.data.r}`,p);let sn=p=>Zn.fade(p*an+ya*.7,260),Se=n.fv,er=p=>et(p*100,{locale:n.locale,maximumFractionDigits:1}),ln=p=>h.backTotal[p]>0?h.frontTotal[p]/h.backTotal[p]:null,$t=p=>{let k=ln(p);return k===null?"":er(k)},tr=(p,k)=>(k==="back"?f:m).map((M,j)=>({name:M,v:rn(p,k)[j],sw:K(p,k)[j]})).reverse(),cn=(p,k)=>tr(p,k).map(M=>`${M.name} ${Se(M.v)}`).join(", "),vt=p=>(p==="back"?T:w)>1,ka=(p,k)=>{let M=vt(k)?[cn(p,k),`${a.sum} ${Se(De(p,k))}`]:[cn(p,k)];return k==="front"&&R!==!1&&ln(p)!==null&&M.push(a.ofBack($t(p))),`${G[p].label}${v?` ${a.row[k]}`:""}: ${M.join(", ")} (${p+1}/${L})`},ct=h.backTotal.every(p=>p===0)&&h.frontTotal.every(p=>p===0),wa=(0,te.useMemo)(()=>ct?[]:G.map((p,k)=>({datum:p.datum,index:k,key:p.key,label:p.label,series:v?a.row[S]:void 0,value:De(k,S),formatted:lt.map(M=>a.cell(v?a.row[M]:"",Se(De(k,M)),vt(M)?cn(k,M):"")).join(", ")})),[h,G,a,S,Se,f,m]),nr=(0,te.useMemo)(()=>({keys:G.map(p=>p.sync),labels:G.map(p=>p.label)}),[G]);yr(n,e.syncId,nr.keys,nr.labels);let ae=n.active!==null&&n.active<L&&!ct?n.active:null,$a=(p,k,M)=>{let j=st(p,"back"),H=(j.w+j.dx)/2,Z=j.x+H,re=Math.min(on(p,"back"),on(p,"front")),U=40+k.length*18;if(re-U-14>=2)return{x:Z,y:re,title:M,rows:k};let fe=Math.max(112,se(M,11.5,600),...k.map(un=>(un.color?15:0)+se(un.label??"",12)+16+se(un.value,12,700)))+24,he=H+12+fe/2,Na=Math.max(4,Math.min(re,i-U-4));return{x:Z+he+fe/2<=o-4?Z+he:Z-he,y:Na+U+14,title:M,rows:k}},rr=null;if(ae!==null){let p=[];for(let k of lt){let M=k===S;for(let j of tr(ae,k))p.push({label:j.name,value:Se(j.v),color:j.sw.fill,strong:vt(k)?M?void 0:!1:M});vt(k)&&p.push({label:v?a.total[k]:a.sumLabel,value:Se(De(ae,k)),strong:M})}v&&R!==!1&&p.push({label:a.rate,value:$t(ae)||"-",strong:!1}),rr=$a(ae,p,G[ae].label)}let va=ae!==null&&n.via==="keyboard"?ka(ae,S):void 0,Ve=h.backTotal.indexOf(Math.max(...h.backTotal)),Ce=v?h.frontTotal.indexOf(Math.max(...h.frontTotal)):-1,or=a.kind;if(L){let p=[a.kind,a.desc(T,f.join(", "),G[0].label,G[L-1].label),a.descPeak(G[Ve].label,Se(h.backTotal[Ve]))];v&&p.push(h.frontTotal[Ce]>0?a.descFront(m.join(", "),G[Ce].label,Se(h.frontTotal[Ce]),$t(Ce)):a.descFrontZero(m.join(", "))),W>1&&p.push(a.merged(W)),or=p.join(". ")}let Ta=`${e.description??`${or}.`}${v?` ${a.keys}`:""}`,ar=(0,te.useMemo)(()=>{let p=G.map((k,M)=>ta(h.slotX(M)+h.w/2,k.label,pe,o));return{xs:p,show:lo(p,G.map(k=>k.label),pe,6)}},[h,G,o]),ir=h.floor+_e+20,Tt=I?ir+nn+14:h.floor+_e+12,Ma=(p,k,M)=>{if(ct)return;let j=no(p,h.slotX(0)+h.s*.49,h.slotX(L-1)+h.s*.49,L),H=O?h.depthFront*h.cy+4:6,Z=!M&&v&&k>=h.floor-h.frontTotal[j]*h.k-H?"front":"back";Z!==l&&u(Z),j!==n.active&&n.setActive(j,M?"touch":"pointer")},Mt=h.top-10,ut=h.slotX(0)-8,mt=h.slotX(L-1)+h.w+8,St=h.lead+h.depthBack+8,Sa=Je([[ut,h.floor+_e],[mt,h.floor+_e],[mt+St*h.cx,h.floor+_e-St*h.cy],[ut+St*h.cx,h.floor+_e-St*h.cy]]),Ca=()=>{let p=st(Ve,"back"),k=a.peak(Se(h.backTotal[Ve])),M=Math.min(p.x+(p.w+p.dx)/2,(_?h.wallX[1]:o-2)-se(k,11.5,700)/2);return(0,A.jsx)(Yn,{p:r,x:M,y:on(Ve,"back")-11,opacity:sn(Ve),children:k})},Aa=()=>{let p=R==="label"?$t(Ce):"",k=a.frontPeak(G[Ce].label,Se(h.frontTotal[Ce]),p),M=h.slotX(Ce)+h.w/2;return(0,A.jsxs)("g",{opacity:sn(Ce),children:[(0,A.jsx)("line",{x1:D(M),x2:D(M),y1:D(Tt+8),y2:D(Tt+14),stroke:r.paint("muted")}),(0,A.jsx)(Yn,{p:r,x:ta(M,k,11,o,700),y:Tt+25,size:11,children:k})]})};return(0,A.jsxs)(Br,{c:n,kind:a.kind,ariaLabel:e.ariaLabel,description:Ta,events:wa,tip:rr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,announce:va,onPointerMove:(p,k,M)=>Ma(p,k,M.pointerType==="touch"),onKey:p=>{let k=al(p.key,v);return k===null?!1:(k!==l&&u(k),ae===null&&!ct&&n.setActive(0,"keyboard"),!0)},defs:y!=="none"?(0,A.jsx)("pattern",{id:`${s}h`,width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:(0,A.jsx)("rect",{width:1.6,height:4,fill:r.paint("panel"),fillOpacity:.55})}):void 0,children:[(0,A.jsx)("g",{"aria-hidden":"true",children:E.map((p,k)=>{let{x:M,line:j}=N[k],H=j*ea+9,Z=k>=T;return(0,A.jsxs)("g",{children:[p.divider&&M>0?(0,A.jsx)("line",{x1:M-14,x2:M-14,y1:H-7,y2:H+7,stroke:r.paint("line")}):null,(0,A.jsx)("rect",{x:M,y:H-5,width:10,height:10,rx:2,fill:Z?le.front[k-T].fill:le.back[k].fill}),xe(Z?"front":"back")?(0,A.jsx)("rect",{x:M,y:H-5,width:10,height:10,rx:2,fill:ce}):null,(0,A.jsx)(ze,{x:M+15,y:H,size:11.5,fill:r.paint("muted"),children:p.name})]},k)})}),ct?(0,A.jsx)(ze,{x:o/2,y:(h.top+h.floor)/2,anchor:"middle",size:13,fill:r.paint("muted"),children:a.nothing}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("g",{"aria-hidden":"true",children:[_?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("rect",{x:D(h.wallX[0]),y:D(Mt),width:D(Math.max(0,h.wallX[1]-h.wallX[0])),height:D(Math.max(0,h.wallBase-Mt)),fill:r.paint("line2"),fillOpacity:.6}),h.ticks.map(p=>{let k=h.wallBase-p*h.k;return(0,A.jsxs)("g",{children:[(0,A.jsx)("line",{x1:D(h.wallX[0]),x2:D(h.wallX[1]),y1:D(k),y2:D(k),stroke:r.paint("line")}),(0,A.jsx)(ze,{x:h.wallX[1]+6,y:k,size:pe,fill:r.paint("muted"),children:h.fmt(p)})]},p)})]}):null,(0,A.jsx)("polygon",{points:Sa,fill:r.paint("neutralSoft")}),(0,A.jsx)("rect",{x:D(ut),y:D(h.floor+_e),width:D(Math.max(0,mt-ut)),height:_e,fill:r.paint("line")})]}),G.map((p,k)=>(0,A.jsxs)("g",{className:"ztd-mark",opacity:ae===null||ae===k?1:.38,onClick:()=>n.click(k),style:{cursor:e.onClick?"pointer":void 0},children:[(0,A.jsx)("rect",{x:D(h.slotX(k)),y:D(Mt),width:D(h.s),height:D(Math.max(0,i-Mt)),fill:"transparent"}),lt.map(M=>{let j=Qn.get(`${k}|${M}`);if(!j)return null;let H=st(k,M),Z=De(k,M)*h.k;if(O)return De(k,M)===0?(0,A.jsx)("polygon",{points:Je([[H.x,H.base],[H.x+H.w,H.base],[H.x+H.w+H.dx,H.base+H.dy],[H.x+H.dx,H.base+H.dy]]),fill:"none",stroke:r.paint("neutralStrong"),strokeOpacity:.7,strokeDasharray:"2 2"},M):(0,A.jsx)(ra,{p:r,g:H,cum:j.v,colors:K(k,M),hatch:xe(M)?ce:null,lid:M==="back"?it:ba,lidSplit:M==="front"&&le.split?{fills:K(k,M).map(re=>re.fill),values:rn(k,M)}:void 0,lidStroke:!0,lidInk:M==="front",lidHatch:M==="front",shade:oe,tile:!0},M);if(Z>0&&Z<1){let re=rn(k,M),U=re.length-1;for(;U>0&&!(re[U]>0);)U--;return(0,A.jsx)("line",{x1:D(H.x),x2:D(H.x+H.w),y1:D(H.base-.5),y2:D(H.base-.5),stroke:K(k,M)[U].fill},M)}return(0,A.jsx)(ra,{p:r,g:H,cum:j.v,colors:K(k,M),hatch:xe(M)?ce:null,lid:M==="back"?it:r.paint("neutralSoft"),lidStroke:M==="back",shade:oe},M)}),ae===k&&n.via!=="sync"?(0,A.jsx)("polygon",{points:Je(sl(st(k,S),De(k,S)*h.k)),fill:"none",stroke:r.paint("ink"),strokeWidth:2,strokeLinejoin:"round",pointerEvents:"none"}):null]},p.key)),n.showLabels&&h.backTotal[Ve]>0?Ca():null,I?(0,A.jsx)(ml,{p:r,rates:G.map((p,k)=>ln(k)),x:h.slotX,w:h.w,from:ut,to:mt,top:ir,right:_?h.wallX[1]+6:mt+6,title:a.rate,pct:er,fade:sn}):null,(0,A.jsx)("g",{"aria-hidden":"true",children:ar.show.map(p=>(0,A.jsx)(ze,{x:ar.xs[p],y:Tt,anchor:"middle",size:pe,fill:r.paint(ae===p?"ink":"muted"),weight:ae===p?700:400,children:G[p].label},p))}),B&&h.frontTotal[Ce]>0?Aa():null]})]})}var dl=F(Y(),1);var la=F(V(),1);function aa(e,t){return t===!1?e.map((n,r)=>r):eo(e)}function ia(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return be(e,t,t,r,"max")}function sa(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]=Q(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?Q(e,"neutral"):_t(e,1-a/Math.max(1,o.length-1))),r}function ca(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Te(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ua(e,t){return We(e,t+1,new Set)}var fl=F(Y(),1);var da=F(V(),1);var hl=26;var rm=hl*.62;function ma(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!To.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var Pe=F(V(),1);function fa(e,t,n){let r=Vt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Gt(n)?Vt("bubble"):r}function gl(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 pl(e,t,n,r=!1){let o=fa(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&&Pn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),u=c=>c.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let c=Fe(i.label,"label"),d=Wt(i.value,"value"),g=o.type==="waffle",f=t.map((y,_)=>({r:y,label:c(y,_),value:g?d(y,_):Jo(d(y,_))})),{kept:b,other:T}=g?{kept:f,other:null}:Yo(f,a.other,(y,_)=>({r:{},label:Uo(J(n),y),value:_})),w=be(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),g?"first":"max"),v=T?[...b,T]:b,S=Ie(y=>g?we(y,v.length,w):qo(y,v.length,w,a.colorMode)),R=g&&a.shape==="arc";return v.map((y,_)=>({label:y.label,color:S[_],...R&&{shape:"circle"}}))}if(o.type==="candlestick"){let c=Xo(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Ko[J(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...c.map((g,f)=>({label:d.maLegend(g),color:Kn[f],shape:"line"}))]}if(o.type==="network"){let c=ca(a.groups);if(c.length<2)return[];let d=Ie(g=>ua(g,c.length));return c.map((g,f)=>({label:g,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let c=Fe(i.group,"group"),d=Te(t.map((f,b)=>c(f,b)).filter(Boolean));if(d.length<2)return[];let g=Ie(f=>We(f,d.length,new Set));return d.map((f,b)=>({label:f,color:g[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||Gt(a))return[];let c=Fe(i.series,"series"),d=Te(t.map((b,T)=>c(b,T)));if(d.length<2)return[];let g=Wo(s,t,d,c),f=Ie(b=>We(b,d.length,g));return u(d.map((b,T)=>({label:b,color:f[T],shape:"circle"})))}if(o.type==="timeline"){let c=typeof i.group!="string",d=c?i.status:i.group;if(typeof d!="string")return[];let g=Do(t,d,c),f=Ie(b=>we(b,g.length,ma(s,g)));return u(g.map((b,T)=>({label:b,color:f[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(i.y))c=i.y;else if(typeof i.series=="string"){let S=Fe(i.series,"series");c=Te(t.map((R,y)=>S(R,y)))}let d=Dn(o.type,i,a);if(d.length){let S=be(s,c,c,c.map(()=>0),"none"),R=Ie(_=>we(_,c.length,S)),y=c.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:c.map((_,z)=>({label:_,color:R[z]}));return[...u(y),...d.map((_,z)=>({label:_,color:Vo(z),shape:"line"}))]}if(c.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?Qr(c.length,Array.isArray(a.negative)?a.negative.map(S=>c.indexOf(String(S))):[],typeof a.neutral=="string"?c.indexOf(a.neutral):-1):-1,b=f>=0?new Set([f]):be(s,c,c,c.map(()=>0),"first");if(o.type==="radar")return u(c.map((S,R)=>({label:S,color:b.has(R)?"accent":"neutralStrong",shape:"square"})));let T=a.colorMode,w=S=>we(S,c.length,b);if((o.type==="line"||o.type==="area")&&(w=S=>Go(S,c.length,b,o.type==="area",T)),o.type==="stream"){let S=je(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),R=aa(S.values,a.reorder),y=ia(s,S.series,S.values);w=_=>sa(_,R,y)}let v=Ie(w);return u(c.map((S,R)=>({label:S,color:v[R],...o.type==="line"&&{shape:"line"}})))}return[]}function bl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Wr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function yl(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:u,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:u}}function ha(e,t){let{spec:n}=e,r=fa(n.type,n.encoding,n.options),o=(0,wt.useMemo)(()=>Lo(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Vr(n,e.locale),s=ue(a),l=J(s),u=Mo(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=Ur(n),c=(0,wt.useMemo)(()=>m?_o(m,s):void 0,[m,s]),d=n.options?.hidden,g=Array.isArray(d)?d.map(String):[],f=g.join(""),[b,T]=(0,wt.useState)(null);if(!r)return(0,Pe.jsx)(_n,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let w=o??u.data,v=t[r.type],S={...n.options??{}},R={...gl(r,n.encoding),...S,...c?{tooltip:c}:{},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:a},y=n.card?.legend==="toggle"&&Xr(r.type,n.encoding??{},S),_=b&&b.base===f?b.hidden:g;y&&(R.hidden=_);let z=N=>T(C=>{let $=C&&C.base===f?C.hidden:g;return{base:f,hidden:$.includes(N)?$.filter(h=>h!==N):[...$,N]}}),O=R.height??220,I=bl(n,r.type),B=i&&!w.length&&(u.loading||u.error||u.empty)?(0,Pe.jsx)(_n,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:O,locale:a}):I?(0,Pe.jsx)(vo,{chart:v,...yl(r.type,I,R)}):(0,Pe.jsx)(v,{...R});if(n.card){let N=n.card,C=N.legend==="auto"||N.legend==="toggle"?pl(n,w,s,y):N.legend,$=C?.length?y?(0,Pe.jsx)(Fn,{items:C,hidden:_,onToggle:z,locale:a}):C:void 0,h=N.download?(0,Pe.jsx)(Fo,{data:w,columns:Yr(n),filename:N.title??r.type,formats:Array.isArray(N.download)?N.download:void 0,locale:a}):void 0;B=(0,Pe.jsx)(zr,{number:N.number,title:N.title??Gr(r,l),subtitle:N.subtitle,legend:$,actions:h,source:N.source||void 0,note:N.note||void 0,accent:N.accent,takeaway:N.takeaway,level:N.level,sample:N.sample,replay:N.replay!==!1,className:e.className,locale:a,children:B})}let E=e.theme??n.theme;return E&&(B=(0,Pe.jsx)(It,{theme:E,children:B})),B}function xl({cfg:e,components:t}){let n=rt();return ha({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function pa(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ga.hydrateRoot)(r,(0,qn.createElement)(It,{theme:o.theme,cssVars:!0},(0,qn.createElement)(xl,{cfg:o,components:{[e]:t}})))}pa("skyline",Jn);})();
|