ztd-charts-cli 0.11.2 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +32 -32
- package/dist/api.js +1 -1
- package/dist/{chunk-6RWRYJ22.js → chunk-KNBUVTZ2.js} +55 -31
- package/dist/cli.js +7 -2
- package/dist/client/area.js +5 -5
- package/dist/client/bar.js +9 -9
- package/dist/client/barRace.js +5 -5
- package/dist/client/beeswarm.js +5 -5
- package/dist/client/box.js +9 -9
- package/dist/client/bubble.js +7 -7
- package/dist/client/bullet.js +4 -4
- package/dist/client/bump.js +6 -6
- package/dist/client/calendar.js +5 -5
- package/dist/client/candlestick.js +6 -6
- package/dist/client/chord.js +5 -5
- package/dist/client/choropleth.js +4 -4
- package/dist/client/donut.js +6 -6
- package/dist/client/dumbbell.js +5 -5
- package/dist/client/flowMap.js +5 -5
- package/dist/client/funnel.js +9 -9
- package/dist/client/gauge.js +3 -3
- package/dist/client/heatmap.js +5 -5
- package/dist/client/histogram.js +5 -5
- package/dist/client/line.js +5 -5
- package/dist/client/lollipop.js +1 -1
- package/dist/client/marimekko.js +6 -6
- package/dist/client/network.js +8 -8
- package/dist/client/parallel.js +6 -6
- package/dist/client/pareto.js +1 -1
- package/dist/client/pie.js +6 -6
- package/dist/client/radar.js +7 -7
- package/dist/client/radialBar.js +1 -1
- package/dist/client/ridgeline.js +4 -4
- package/dist/client/sankey.js +10 -10
- package/dist/client/scatter.js +10 -10
- package/dist/client/segmented.js +5 -5
- package/dist/client/skyline.js +9 -9
- package/dist/client/slope.js +6 -6
- package/dist/client/sparkline.js +6 -6
- package/dist/client/stream.js +6 -6
- package/dist/client/sunburst.js +4 -4
- package/dist/client/symbolMap.js +3 -3
- package/dist/client/tileMap.js +4 -4
- package/dist/client/timeline.js +8 -8
- package/dist/client/tree.js +2 -2
- package/dist/client/treemap.js +3 -3
- package/dist/client/waffle.js +5 -5
- package/dist/client/waterfall.js +4 -4
- package/package.json +2 -2
package/dist/client/bar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var ta=Object.create;var Sr=Object.defineProperty;var na=Object.getOwnPropertyDescriptor;var ra=Object.getOwnPropertyNames;var oa=Object.getPrototypeOf,ia=Object.prototype.hasOwnProperty;var Nn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var aa=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ra(t))!ia.call(e,o)&&o!==n&&Sr(e,o,{get:()=>t[o],enumerable:!(r=na(t,o))||r.enumerable});return e};var P=(e,t,n)=>(n=e!=null?ta(oa(e)):{},aa(t||!e||!e.__esModule?Sr(n,"default",{value:e,enumerable:!0}):n,e));var ee=Nn((Fl,Cr)=>{Cr.exports=globalThis.__ztdReact.react});var Nr=Nn((_l,Ar)=>{Ar.exports=globalThis.__ztdReact["react-dom/client"]});var W=Nn((Ul,no)=>{no.exports=globalThis.__ztdReact["react/jsx-runtime"]});var hr=P(ee(),1),Hi=P(Nr(),1);var Ft=P(ee(),1);var en=P(ee(),1);var Rr=P(ee(),1),at=(0,Rr.createContext)(void 0);var Dr=P(ee(),1);var sa=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Fr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',_r='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Ve={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:Fr,monoFamily:_r,radius:18,radiusCode:14,radiusMark:4},Rn={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:Fr,monoFamily:_r,radius:18,radiusCode:14,radiusMark:4},Fn={dark:Ve,light:Rn};function Bt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function _n(e){let t={};for(let n of sa){let r=e[n];typeof r=="string"&&(t[Bt(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 Pn(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var la=`
|
|
2
2
|
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
3
|
.ztd-root:focus{outline:none}
|
|
4
|
-
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${
|
|
4
|
+
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Ve.accent});outline-offset:3px;border-radius:6px}
|
|
5
5
|
.ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
|
|
6
6
|
.ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
|
|
7
7
|
.ztd-tip{animation:ztd-fade .14s ease-out;transition:left .2s cubic-bezier(.22,1,.36,1),top .2s cubic-bezier(.22,1,.36,1)}
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
.ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
|
|
10
10
|
.ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
|
|
11
11
|
.ztd-btn:focus{outline:none}
|
|
12
|
-
.ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${
|
|
12
|
+
.ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Ve.accent});outline-offset:2px}
|
|
13
13
|
.ztd-card{transition:border-color .16s ease}
|
|
14
|
-
.ztd-card:hover{border-color:var(--ztd-dim,${
|
|
14
|
+
.ztd-card:hover{border-color:var(--ztd-dim,${Ve.dim})}
|
|
15
15
|
@media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
|
|
16
16
|
@keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
|
|
17
17
|
@keyframes ztd-fade{from{opacity:0}to{opacity:1}}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
20
|
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
21
|
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
-
`;function Dr(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function Lr(e,t){let[n]=(0,Pr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var _r=!1;function kt(){if(_r||typeof document>"u"||(_r=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=sa,document.head.appendChild(e)}var Bt=P(ee(),1),Te=typeof window<"u"&&typeof document<"u",Le=Te?Bt.useLayoutEffect:Bt.useEffect;function Ht(){return typeof performance<"u"?performance.now():Date.now()}var Ee=P(ee(),1),la=(0,Ee.createContext)(void 0),jt=new Map;function ca(e,t){let n=jt.get(e);return n||jt.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||jt.delete(e)}}function ua(e,t,n){jt.get(e)?.forEach(r=>r(t,n))}function ma(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function Er(e,t,n,r){let o=(0,Ee.useContext)(la),i=t??o,[a]=(0,Ee.useState)(()=>({})),s=(0,Ee.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=i?c=>ua(i,c===null||s.current.keys[c]===void 0?null:{key:s.current.keys[c],label:s.current.labels[c]},a):null;let l=e.applySync;(0,Ee.useEffect)(()=>{if(i)return ca(i,(c,f)=>{if(f===a)return;let u=c?ma(s.current.keys,s.current.labels,c):-1;l(u<0?null:u)})},[i,a,l])}function te(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ve(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Or={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Ir={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var da=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],fa={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function ha(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ga(e){return ha(da,e)}function zr(e,t){let n=ga(e);return{text:n?n[t]:e,...fa[n?.id??"basic"]}}var Br={white:"#ffffff",black:"#000000",transparent:"#00000000"};function at(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Br[t.toLowerCase()]&&(t=Br[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function Gr(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function Dn(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function st(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Hr(e){return .2126*st(e[0])+.7152*st(e[1])+.0722*st(e[2])}function Ln(e,t,n){let r=typeof e=="string"?at(e):e,o=typeof t=="string"?at(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?at(n):n:null;o[3]<1&&i&&(o=Dn(o,i));let a=r[3]<1?Dn(r,o):r,s=Hr(a),l=Hr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function pa(e){return[st(e[0]),st(e[1]),st(e[2])]}function Pn(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function jr(e){let[t,n,r]=pa(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function ba([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[Pn(4.0767416621*o-3.3077115913*i+.2309699292*a),Pn(-1.2684380046*o+2.6097574011*i-.3413193965*a),Pn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Gt(e,t,n){let r=at(e),o=at(t);if(!r||!o)return e;let i=jr(r),a=jr(o),s=Math.max(0,Math.min(1,n));return Gr(ba([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function En(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Ln(i,e,n);a>o&&(o=a,r=i)}return r}function oe(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function ya(e,t){let n=En(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Ln(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):En(t,["#FFFFFF","#000000"])}function Vt(e,t){let n=Gt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:ya(e,n),raw:n}}function ge(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=oe(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=oe(e,"neutral");else if(s===0)r[a]=oe(e,"ink");else if(s===i-1)r[a]=oe(e,"neutral");else if(i===3)r[a]=oe(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?oe(e,"strong"):Vt(e,1-l)}}),r}var On="mix:";function We(e){return e({theme:Nn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${On}${o}`}).map(n=>n.fill)}function Vr(e,t){return t?.startsWith(On)?e.mix("neutralStrong","neutral",Number(t.slice(On.length))):e.color(t)}function wt(e,t,n){return ge(e,t+1,n).slice(0,t)}function Wt(e,t,n,r="neutral"){let o=oe(e,"accent"),i=oe(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Wr(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=oe(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=oe(e,"neutral"):s===0?r[a]=oe(e,"strong"):s===i-1?r[a]=oe(e,"neutral"):r[a]=Vt(e,1-s/(i-1))}),r}var Ce=P(ee(),1);var Ut=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),fe="en-US",Kr=new Map;function In(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Kr.get(r);return o||(o=new Intl.NumberFormat(e,n),Kr.set(r,o)),o}function zn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function lt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=fe,...r}=t;return zn(In(n,r).format(e))}var Bn=e=>e!==0&&Math.abs(e)<.05,Hn=(e,t,n="")=>`${lt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Kt(e,t={}){if(!Number.isFinite(e))return"-";if(Bn(e)&&t.maximumFractionDigits===void 0)return Hn(e,t.locale??fe,"%");let n=Math.abs(e);return`${lt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Jr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=fe,...r}=t;if(te(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],c=o/s,f=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**f)/10**f;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+lt(u,{locale:n,...r,maximumFractionDigits:f})+l}}return zn(In(n,{notation:"compact",...r}).format(e))}var xa=(e,t=te(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Je(e,t=fe,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=In(t,o);return l=>Number.isFinite(l)?`${a}${zn(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Kt(o,{locale:t});case"ratio":return o=>Kt(o*100,{locale:t});case"compact":return o=>Jr(o,{locale:t});case"currency":return r(xa(t));default:{let o=r({maximumFractionDigits:1});return i=>Bn(i)?Hn(i,t):o(i)}}}function Xt(e,t=fe,n=0){return e!==void 0?Je(e,t):n>=1e5?r=>Bn(r)?Hn(r,t):Jr(r,{locale:t}):r=>lt(r,{locale:t})}function ka(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var jn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,wa=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,$a=["january","february","march","april","may","june","july","august","september","october","november","december"],Ur=e=>{let t=e.toLowerCase();return t.length<3?0:$a.findIndex(n=>n.startsWith(t))+1},Xr=e=>+e+(+e<30?2e3:1900);function qr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var va=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],Zr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Qr=/\{([^{}]+)\}/g;function Yt(e,t){let n;for(let r of va)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[Xr(n[3]),+n[2],+n[1],1]:[Xr(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=Zr.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Ur(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=Ur(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Gn=e=>wa.test(e)||Yt(e)!==null;function eo(e){let t;for(let n of e){let r=typeof n=="string"?Zr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function $t(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(jn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return $t(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Yt(n,t);if(r)return ka(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Yr=new Map;function vt(e,t={month:"short",day:"numeric"}){let n=$t(e);if(!n)return"-";let{locale:r=fe,...o}=t,i=r+JSON.stringify(o),a=Yr.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Yr.set(i,a)),a.format(n)}var Vn=P(W(),1),Jt=(0,Ce.createContext)({theme:Ge,cssVars:!0});function Ma(e,t=Ge){return e?typeof e=="string"?Fn[e]??t:_n(t,e):t}function qt(e){let t=(0,Ce.useContext)(Jt),n=e.base?Fn[e.base]:t.theme,r=(0,Ce.useMemo)(()=>Ma(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,Ce.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,Ce.useMemo)(()=>Rn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Vn.jsx)(Jt.Provider,{value:a,children:(0,Vn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Ta=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function no(e){return Ta.has(e)}function Ca(e,t){let n=r=>t?`var(${zt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?no(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?no(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:Gt(e[r],e[o],i)}}}function Se(e){let t=(0,Ce.useContext)(Jt);return(0,Ce.useMemo)(()=>{let n=_n(t.theme,e);return Ca(n,t.cssVars)},[t.theme,t.cssVars,e])}function pe(e){let t=(0,Ce.useContext)(Jt);return e??t.locale??fe}function ro(e){return e?Rn(e):{}}var Zt=P(ee(),1),Wn=(0,Zt.createContext)(void 0);function oo(e){let t=(0,Zt.useContext)(Wn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=P(W(),1),Sa={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},Aa={en:Sa,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Na={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Kn=e=>Aa[te(pe(e))];function Un(e){let t=Se(e.theme),n=Kn(e.locale),[r,o]=(0,Qt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(f=>!s.has(f.label)).length,c=(0,_.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((f,u)=>{let d=!s.has(f.label),g=d&&l===1,m=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Fa,{p:t,item:f,off:!d}),(0,_.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:f.label})]});return(0,_.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,_.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":g||void 0,onClick:()=>{g||(a(f.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:g?"default":void 0},children:m}):m},u)})});return a?(0,_.jsxs)(_.Fragment,{children:[c,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Na,children:r?n.shown(l,e.items.length):""})]}):c}function Fa({p:e,item:t,off:n}){let r=Vr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,_.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,_.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,_.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,_.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function Ra(e){let t=Se(e.theme),n=zr(e.level,te(pe(e.locale)));return(0,_.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function _a(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,_.jsxs)(_.Fragment,{children:[e.slice(0,r),(0,_.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function io(e){let t=Se(e.theme),n=Kn(e.locale),[r,o]=(0,Qt.useState)(0);Le(()=>kt(),[]);let i=()=>{o(d=>d+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)(Un,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,f=e.source!==void 0||e.note!==void 0?(0,_.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,_.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,_.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,_.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,_.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,_.jsx)(Ra,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,_.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,_.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,_.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,_.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:_a(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,_.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,_.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,_.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,_.jsx)("span",{}),a]}):null]}),(0,_.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,_.jsx)(Wn.Provider,{value:r,children:(0,_.jsx)(it.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),f?(0,_.jsxs)(_.Fragment,{children:[f,u]}):u]})}function Xn(e){let t=Se(e.theme),n=Kn(e.locale),r=e.height??220;if(Le(()=>kt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,_.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,_.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,_.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,_.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,_.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,_.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,_.jsx)(_.Fragment,{children:e.children})}var dt=P(ee(),1);var be=P(ee(),1);var X=P(W(),1),en=60;var tn={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function ao(e){let{c:t,events:n}=e,r=(0,be.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Le(()=>{kt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,be.useContext)(it),c=e.ariaLabel??l??e.kind,f=(0,be.useMemo)(()=>s?`${n.length}${n.slice(0,en).map(k=>`${k.label}${k.series??""}${k.formatted??k.value??""}`).join("")}`:"",[n,s]),u=(0,be.useMemo)(()=>(0,X.jsx)(Pa,{label:c,events:n,t:t.t}),[c,f,t.t]),d=(0,be.useRef)(null);(0,be.useEffect)(()=>{let k=()=>{d.current=null};return window.addEventListener("scroll",k,{capture:!0,passive:!0}),window.addEventListener("resize",k,{passive:!0}),()=>{window.removeEventListener("scroll",k,{capture:!0}),window.removeEventListener("resize",k)}},[]),(0,be.useEffect)(()=>{d.current=null},[t.width,t.height]);let g=k=>{if(k.target!==k.currentTarget)return;if(e.onKey?.(k)){k.preventDefault();return}let N=t.active,H;switch(k.key){case"ArrowRight":case"ArrowDown":H=N===null?0:(N+1)%a;break;case"ArrowLeft":case"ArrowUp":H=N===null?a-1:(N-1+a)%a;break;case"Home":H=0;break;case"End":H=a-1;break;case"Escape":if(N===null)return;H=null;break;case"Enter":case" ":N!==null&&(k.preventDefault(),t.click(N));return;default:return}k.preventDefault(),t.setActive(H,"keyboard")},{via:m,node:b,setActive:T}=t;(0,be.useEffect)(()=>{if(m!=="touch"||!b)return;let k=N=>{b.contains(N.target)||T(null)};return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[m,b,T]);let w=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,v=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,D=typeof e.renderTip=="function"&&w?e.renderTip(w):null,x=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${a})`:""),L;if($){let k=$.x*v,N=t.width*v,H=`clamp(${(4-k).toFixed(1)}px, -50%, calc(${(N-k-4).toFixed(1)}px - 100%))`,G=$.y<64;L={position:"absolute",left:k,top:$.y*v,transform:`translate(${H}, ${G?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*v-8)}}let z=k=>{d.current=null,k.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},B=k=>k?N=>{let H=d.current??(d.current=N.currentTarget.getBoundingClientRect());H.width&&k((N.clientX-H.left)/H.width*t.width,(N.clientY-H.top)/H.height*t.height,N)}:void 0,E=B(e.onPointerMove),I=B(e.onPointerDown),S=E||I?k=>{k.pointerType==="touch"&&E?.(k),I?.(k)}:void 0,R=B(e.onPointerUp),C=ro(e.theme);return(0,X.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?g:void 0,onBlur:k=>{t.via==="keyboard"&&!k.currentTarget.contains(k.relatedTarget)&&t.setActive(null)},onPointerLeave:z,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...C,...e.style},children:[t.pending?null:e.underlay,(0,X.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:E,onPointerDown:S,onPointerUp:R,onPointerCancel:R,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,X.jsx)("title",{id:o,children:c}),(0,X.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,X.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,X.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:L,children:D??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.rows.map((k,N)=>(0,X.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,X.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(k.strong?"ink":"muted")},children:[k.color?(0,X.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:k.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,k.label]}),(0,X.jsx)("span",{style:{fontWeight:k.strong===!1?500:700},children:k.value})]},N))]})}):null,(0,X.jsx)("span",{className:"ztd-sr",style:tn,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?u:null]})}function Pa({label:e,events:t,t:n}){return(0,X.jsx)("div",{className:"ztd-sr",style:tn,children:(0,X.jsxs)("table",{children:[(0,X.jsx)("caption",{children:n.table(e)}),(0,X.jsxs)("tbody",{children:[t.slice(0,en).map((r,o)=>(0,X.jsxs)("tr",{children:[(0,X.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,X.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>en?(0,X.jsx)("tr",{children:(0,X.jsx)("td",{colSpan:2,children:n.more(t.length-en)})}):null]})]})})}function me(e){let t=e.baseline??"central";return(0,X.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ke=y("label","string",!0,"Item name field"),ae=y("value","number",!0,"Value field"),Da=[ke,ae],La=[ke,ae],Ea=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],Oa=[ke,ae],Ia=[y("label","string",!0,"Leaf (lowest level) name"),ae,y("group","string",!1,"Parent group field")],za=[y("label","string",!0,"Leaf name"),ae,y("group","string",!1,"Parent group field")],Ba=[ke,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],Ha=[ke,ae],ja=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),ae],Ga=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),ae],Va=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],Wa=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],lo=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Ka=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),lo],Ua=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),lo],Xa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],Ya=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],Ja=[ke,ae],qa=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],Za=[ke,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],Qa=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],es=[ke,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],ts=[ke,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],ns=[ke,ae],rs=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],os=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],is=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),ae],as=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),ae],ss=[y("date","date",!0,"Date field"),ae],ls=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],cs=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],us=[y("label","string",!1,"Row name field")],ms=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],ds=[ke,ae],fs=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],hs=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],gs=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),ae],ps=[ke,ae,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],bs=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],ys=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],xs=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],ks=[y("region","string",!0,"Region name or code, matched to a region of options.map"),ae],ws=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],$s=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],vs=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],so={pie:Da,donut:La,funnel:Ea,waffle:Oa,treemap:Ia,sunburst:za,waterfall:Ba,pareto:Ha,marimekko:ja,heatmap:Ga,radar:Va,bubble:Wa,line:Ka,area:Ua,stream:Xa,bar:Ya,radialBar:Ja,gauge:qa,bullet:Za,sparkline:Qa,slope:es,dumbbell:ts,lollipop:ns,beeswarm:rs,ridgeline:os,sankey:is,chord:as,calendar:ss,bump:ls,box:cs,parallel:us,candlestick:ms,segmented:ds,skyline:fs,histogram:hs,scatter:vs,tileMap:gs,barRace:ps,network:bs,timeline:ys,tree:xs,choropleth:ks,symbolMap:ws,flowMap:$s},ct={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function co(e,t){return t==="ko"?e.nameKo:e.name}function uo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var mo=["line","area","bar","scatter"],fo=24,Yn=["line","area","bar","scatter","timeline"];function Jn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function ho(e,t,n){return Yn.includes(e)&&!Jn(e,t,n).length&&!(e==="scatter"&&nn(n))}function nn(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function go(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ms={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function rn(e){let t=so[e]?e:Ms[e]??Object.keys(ct).find(n=>n.toLowerCase()===e.toLowerCase()||ct[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!ct[t]))return{type:t,component:ct[t].component,name:ct[t].name,nameKo:ct[t].nameKo,encoding:so[t]}}function po(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of rn(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function bo(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ts(e,t){if(e==null||typeof e!="object")return;let n=e;if(bo(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!bo(r,o))return;r=r[o]}return r}}function Oe(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function qe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ts(r,n)}function on(e,t){let n=qe(e,t);return(r,o)=>Oe(n(r,o))}function Be(e,t){let n=qe(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function Ae(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Cs(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
|
-
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var
|
|
22
|
+
`;function Lr(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function Er(e,t){let[n]=(0,Dr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Pr=!1;function wt(){if(Pr||typeof document>"u"||(Pr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=la,document.head.appendChild(e)}var Ht=P(ee(),1),Ce=typeof window<"u"&&typeof document<"u",Ee=Ce?Ht.useLayoutEffect:Ht.useEffect;function jt(){return typeof performance<"u"?performance.now():Date.now()}var Oe=P(ee(),1),ca=(0,Oe.createContext)(void 0),Gt=new Map;function ua(e,t){let n=Gt.get(e);return n||Gt.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||Gt.delete(e)}}function ma(e,t,n){Gt.get(e)?.forEach(r=>r(t,n))}function da(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function Or(e,t,n,r){let o=(0,Oe.useContext)(ca),i=t??o,[a]=(0,Oe.useState)(()=>({})),s=(0,Oe.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=i?c=>ma(i,c===null||s.current.keys[c]===void 0?null:{key:s.current.keys[c],label:s.current.labels[c]},a):null;let l=e.applySync;(0,Oe.useEffect)(()=>{if(i)return ua(i,(c,d)=>{if(d===a)return;let u=c?da(s.current.keys,s.current.labels,c):-1;l(u<0?null:u)})},[i,a,l])}function te(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function We(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Ir={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},zr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var fa=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ha={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function ga(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function pa(e){return ga(fa,e)}function Br(e,t){let n=pa(e);return{text:n?n[t]:e,...ha[n?.id??"basic"]}}var Hr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function st(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Hr[t.toLowerCase()]&&(t=Hr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function Vr(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function Ln(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function lt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function jr(e){return .2126*lt(e[0])+.7152*lt(e[1])+.0722*lt(e[2])}function En(e,t,n){let r=typeof e=="string"?st(e):e,o=typeof t=="string"?st(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?st(n):n:null;o[3]<1&&i&&(o=Ln(o,i));let a=r[3]<1?Ln(r,o):r,s=jr(a),l=jr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function ba(e){return[lt(e[0]),lt(e[1]),lt(e[2])]}function Dn(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function Gr(e){let[t,n,r]=ba(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function ya([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[Dn(4.0767416621*o-3.3077115913*i+.2309699292*a),Dn(-1.2684380046*o+2.6097574011*i-.3413193965*a),Dn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Vt(e,t,n){let r=st(e),o=st(t);if(!r||!o)return e;let i=Gr(r),a=Gr(o),s=Math.max(0,Math.min(1,n));return Vr(ya([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function On(e,t,n){let r=t[0],o=-1;for(let i of t){let a=En(i,e,n);a>o&&(o=a,r=i)}return r}function ie(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function xa(e,t){let n=On(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return En(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):On(t,["#FFFFFF","#000000"])}function Wt(e,t){let n=Vt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:xa(e,n),raw:n}}function be(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=ie(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=ie(e,"neutral");else if(s===0)r[a]=ie(e,"ink");else if(s===i-1)r[a]=ie(e,"neutral");else if(i===3)r[a]=ie(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?ie(e,"strong"):Wt(e,1-l)}}),r}var In="mix:";function Ke(e){return e({theme:Rn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${In}${o}`}).map(n=>n.fill)}function Wr(e,t){return t?.startsWith(In)?e.mix("neutralStrong","neutral",Number(t.slice(In.length))):e.color(t)}function $t(e,t,n){return be(e,t+1,n).slice(0,t)}function Kt(e,t,n,r="neutral"){let o=ie(e,"accent"),i=ie(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Kr(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=ie(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=ie(e,"neutral"):s===0?r[a]=ie(e,"strong"):s===i-1?r[a]=ie(e,"neutral"):r[a]=Wt(e,1-s/(i-1))}),r}var Ae=P(ee(),1);var Xt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ge="en-US",Ur=new Map;function zn(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Ur.get(r);return o||(o=new Intl.NumberFormat(e,n),Ur.set(r,o)),o}function Bn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function ct(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ge,...r}=t;return Bn(zn(n,r).format(e))}var Hn=e=>e!==0&&Math.abs(e)<.05,jn=(e,t,n="")=>`${ct(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ut(e,t={}){if(!Number.isFinite(e))return"-";if(Hn(e)&&t.maximumFractionDigits===void 0)return jn(e,t.locale??ge,"%");let n=Math.abs(e);return`${ct(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function qr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ge,...r}=t;if(te(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],c=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**d)/10**d;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+ct(u,{locale:n,...r,maximumFractionDigits:d})+l}}return Bn(zn(n,{notation:"compact",...r}).format(e))}var ka=(e,t=te(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function qe(e,t=ge,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=zn(t,o);return l=>Number.isFinite(l)?`${a}${Bn(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Ut(o,{locale:t});case"ratio":return o=>Ut(o*100,{locale:t});case"compact":return o=>qr(o,{locale:t});case"currency":return r(ka(t));default:{let o=r({maximumFractionDigits:1});return i=>Hn(i)?jn(i,t):o(i)}}}function Yt(e,t=ge,n=0){return e!==void 0?qe(e,t):n>=1e5?r=>Hn(r)?jn(r,t):qr(r,{locale:t}):r=>ct(r,{locale:t})}function wa(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Gn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,$a=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,va=["january","february","march","april","may","june","july","august","september","october","november","december"],Xr=e=>{let t=e.toLowerCase();return t.length<3?0:va.findIndex(n=>n.startsWith(t))+1},Yr=e=>+e+(+e<30?2e3:1900);function Zr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Ma=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],Qr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,eo=/\{([^{}]+)\}/g;function Jt(e,t){let n;for(let r of Ma)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[Yr(n[3]),+n[2],+n[1],1]:[Yr(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=Qr.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Xr(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=Xr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Vn=e=>$a.test(e)||Jt(e)!==null;function to(e){let t;for(let n of e){let r=typeof n=="string"?Qr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function vt(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(Gn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return vt(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Jt(n,t);if(r)return wa(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Jr=new Map;function Mt(e,t={month:"short",day:"numeric"}){let n=vt(e);if(!n)return"-";let{locale:r=ge,...o}=t,i=r+JSON.stringify(o),a=Jr.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Jr.set(i,a)),a.format(n)}var Wn=P(W(),1),qt=(0,Ae.createContext)({theme:Ve,cssVars:!0});function Ta(e,t=Ve){return e?typeof e=="string"?Fn[e]??t:Pn(t,e):t}function Zt(e){let t=(0,Ae.useContext)(qt),n=e.base?Fn[e.base]:t.theme,r=(0,Ae.useMemo)(()=>Ta(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,Ae.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,Ae.useMemo)(()=>_n(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Wn.jsx)(qt.Provider,{value:a,children:(0,Wn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Sa=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function ro(e){return Sa.has(e)}function Ca(e,t){let n=r=>t?`var(${Bt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?ro(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?ro(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:Vt(e[r],e[o],i)}}}function Ne(e){let t=(0,Ae.useContext)(qt);return(0,Ae.useMemo)(()=>{let n=Pn(t.theme,e);return Ca(n,t.cssVars)},[t.theme,t.cssVars,e])}function ye(e){let t=(0,Ae.useContext)(qt);return e??t.locale??ge}function oo(e){return e?_n(e):{}}var Qt=P(ee(),1),Kn=(0,Qt.createContext)(void 0);function io(e){let t=(0,Qt.useContext)(Kn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=P(W(),1),Aa={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},Na={en:Aa,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ra={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Un=e=>Na[te(ye(e))];function Xn(e){let t=Ne(e.theme),n=Un(e.locale),[r,o]=(0,en.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.label)).length,c=(0,_.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((d,u)=>{let f=!s.has(d.label),g=f&&l===1,m=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Fa,{p:t,item:d,off:!f}),(0,_.jsx)("span",{style:f?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,_.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,_.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":f,"aria-disabled":g||void 0,onClick:()=>{g||(a(d.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:g?"default":void 0},children:m}):m},u)})});return a?(0,_.jsxs)(_.Fragment,{children:[c,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ra,children:r?n.shown(l,e.items.length):""})]}):c}function Fa({p:e,item:t,off:n}){let r=Wr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,_.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,_.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,_.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,_.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function _a(e){let t=Ne(e.theme),n=Br(e.level,te(ye(e.locale)));return(0,_.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function Pa(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,_.jsxs)(_.Fragment,{children:[e.slice(0,r),(0,_.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function ao(e){let t=Ne(e.theme),n=Un(e.locale),[r,o]=(0,en.useState)(0);Ee(()=>wt(),[]);let i=()=>{o(f=>f+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)(Xn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,d=e.source!==void 0||e.note!==void 0?(0,_.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,_.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,_.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,_.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,_.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,_.jsx)(_a,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,_.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,_.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,_.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,_.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:Pa(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,_.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,_.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,_.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,_.jsx)("span",{}),a]}):null]}),(0,_.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,_.jsx)(Kn.Provider,{value:r,children:(0,_.jsx)(at.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,_.jsxs)(_.Fragment,{children:[d,u]}):u]})}function Yn(e){let t=Ne(e.theme),n=Un(e.locale),r=e.height??220;if(Ee(()=>wt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,_.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,_.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,_.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,_.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,_.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,_.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,_.jsx)(_.Fragment,{children:e.children})}var ft=P(ee(),1);var xe=P(ee(),1);var X=P(W(),1),tn=60;var nn={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function so(e){let{c:t,events:n}=e,r=(0,xe.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Ee(()=>{wt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,xe.useContext)(at),c=e.ariaLabel??l??e.kind,d=(0,xe.useMemo)(()=>s?`${n.length}${n.slice(0,tn).map(k=>`${k.label}${k.series??""}${k.formatted??k.value??""}`).join("")}`:"",[n,s]),u=(0,xe.useMemo)(()=>(0,X.jsx)(Da,{label:c,events:n,t:t.t}),[c,d,t.t]),f=(0,xe.useRef)(null);(0,xe.useEffect)(()=>{let k=()=>{f.current=null};return window.addEventListener("scroll",k,{capture:!0,passive:!0}),window.addEventListener("resize",k,{passive:!0}),()=>{window.removeEventListener("scroll",k,{capture:!0}),window.removeEventListener("resize",k)}},[]),(0,xe.useEffect)(()=>{f.current=null},[t.width,t.height]);let g=k=>{if(k.target!==k.currentTarget)return;if(e.onKey?.(k)){k.preventDefault();return}let N=t.active,H;switch(k.key){case"ArrowRight":case"ArrowDown":H=N===null?0:(N+1)%a;break;case"ArrowLeft":case"ArrowUp":H=N===null?a-1:(N-1+a)%a;break;case"Home":H=0;break;case"End":H=a-1;break;case"Escape":if(N===null)return;H=null;break;case"Enter":case" ":N!==null&&(k.preventDefault(),t.click(N));return;default:return}k.preventDefault(),t.setActive(H,"keyboard")},{via:m,node:b,setActive:T}=t;(0,xe.useEffect)(()=>{if(m!=="touch"||!b)return;let k=N=>{b.contains(N.target)||T(null)};return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[m,b,T]);let w=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,v=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,D=typeof e.renderTip=="function"&&w?e.renderTip(w):null,x=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${a})`:""),L;if($){let k=$.x*v,N=t.width*v,H=`clamp(${(4-k).toFixed(1)}px, -50%, calc(${(N-k-4).toFixed(1)}px - 100%))`,G=$.y<64;L={position:"absolute",left:k,top:$.y*v,transform:`translate(${H}, ${G?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*v-8)}}let z=k=>{f.current=null,k.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},B=k=>k?N=>{let H=f.current??(f.current=N.currentTarget.getBoundingClientRect());H.width&&k((N.clientX-H.left)/H.width*t.width,(N.clientY-H.top)/H.height*t.height,N)}:void 0,O=B(e.onPointerMove),I=B(e.onPointerDown),C=O||I?k=>{k.pointerType==="touch"&&O?.(k),I?.(k)}:void 0,F=B(e.onPointerUp),S=oo(e.theme);return(0,X.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?g:void 0,onBlur:k=>{t.via==="keyboard"&&!k.currentTarget.contains(k.relatedTarget)&&t.setActive(null)},onPointerLeave:z,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...S,...e.style},children:[t.pending?null:e.underlay,(0,X.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:O,onPointerDown:C,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,X.jsx)("title",{id:o,children:c}),(0,X.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,X.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,X.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:L,children:D??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.rows.map((k,N)=>(0,X.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,X.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(k.strong?"ink":"muted")},children:[k.color?(0,X.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:k.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,k.label]}),(0,X.jsx)("span",{style:{fontWeight:k.strong===!1?500:700},children:k.value})]},N))]})}):null,(0,X.jsx)("span",{className:"ztd-sr",style:nn,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?u:null]})}function Da({label:e,events:t,t:n}){return(0,X.jsx)("div",{className:"ztd-sr",style:nn,children:(0,X.jsxs)("table",{children:[(0,X.jsx)("caption",{children:n.table(e)}),(0,X.jsxs)("tbody",{children:[t.slice(0,tn).map((r,o)=>(0,X.jsxs)("tr",{children:[(0,X.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,X.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>tn?(0,X.jsx)("tr",{children:(0,X.jsx)("td",{colSpan:2,children:n.more(t.length-tn)})}):null]})]})})}function de(e){let t=e.baseline??"central";return(0,X.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ve=y("label","string",!0,"Item name field"),ue=y("value","number",!0,"Value field"),La=[ve,ue],Ea=[ve,ue],Oa=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],Ia=[ve,ue],za=[y("label","string",!0,"Leaf (lowest level) name"),ue,y("group","string",!1,"Parent group field")],Ba=[y("label","string",!0,"Leaf name"),ue,y("group","string",!1,"Parent group field")],Ha=[ve,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],ja=[ve,ue],Ga=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),ue],Va=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),ue],Wa=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],Ka=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],co=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Ua=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),co],Xa=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),co],Ya=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],Ja=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],qa=[ve,ue],Za=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],Qa=[ve,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],es=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],ts=[ve,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],ns=[ve,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],rs=[ve,ue],os=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],is=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],as=[y("source","string",!1,"Source node"),y("target","string",!1,"Target node"),y("dimensions","string",!1,"Stage columns of a wide table, left to right (2 to 6). Each row is one path, so source and target are not used. Without value, each row counts 1",{multi:!0}),y("value","number",!1,"Value field")],ss=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),ue],ls=[y("date","date",!0,"Date field"),ue],cs=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],us=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],ms=[y("label","string",!1,"Row name field")],ds=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],fs=[ve,ue],hs=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],gs=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],ps=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),ue],bs=[ve,ue,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],ys=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],xs=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],ks=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],ws=[y("region","string",!0,"Region name or code, matched to a region of options.map"),ue],$s=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],vs=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],Ms=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],lo={pie:La,donut:Ea,funnel:Oa,waffle:Ia,treemap:za,sunburst:Ba,waterfall:Ha,pareto:ja,marimekko:Ga,heatmap:Va,radar:Wa,bubble:Ka,line:Ua,area:Xa,stream:Ya,bar:Ja,radialBar:qa,gauge:Za,bullet:Qa,sparkline:es,slope:ts,dumbbell:ns,lollipop:rs,beeswarm:os,ridgeline:is,sankey:as,chord:ss,calendar:ls,bump:cs,box:us,parallel:ms,candlestick:ds,segmented:fs,skyline:hs,histogram:gs,scatter:Ms,tileMap:ps,barRace:bs,network:ys,timeline:xs,tree:ks,choropleth:ws,symbolMap:$s,flowMap:vs},ut={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function uo(e,t){return t==="ko"?e.nameKo:e.name}function mo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var fo=["line","area","bar","scatter"],ho=24,Jn=["line","area","bar","scatter","timeline"];function qn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function go(e,t,n){return Jn.includes(e)&&!qn(e,t,n).length&&!(e==="scatter"&&rn(n))}function rn(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function po(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ts={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",butterfly:"bar",pyramid:"bar",populationPyramid:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",raincloud:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap",alluvial:"sankey",parallelSets:"sankey"};function on(e){let t=lo[e]?e:Ts[e]??Object.keys(ut).find(n=>n.toLowerCase()===e.toLowerCase()||ut[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!ut[t]))return{type:t,component:ut[t].component,name:ut[t].name,nameKo:ut[t].nameKo,encoding:lo[t]}}function bo(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of on(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function yo(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ss(e,t){if(e==null||typeof e!="object")return;let n=e;if(yo(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!yo(r,o))return;r=r[o]}return r}}function Ie(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function Ze(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ss(r,n)}function an(e,t){let n=Ze(e,t);return(r,o)=>Ie(n(r,o))}function He(e,t){let n=Ze(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function Re(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Cs(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
|
+
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var As=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function xo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(As.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Ie(t);if(Number.isFinite(n))return n}return t}function Qe(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??Cs(o),a=[],s=[],l="",c=!1;for(let m=0;m<o.length;m++){let b=o[m];c?b==='"'?o[m+1]==='"'?(l+='"',m++):c=!1:l+=b:b==='"'&&!l.trim()?(c=!0,l=""):b===i?(s.push(l),l=""):b===`
|
|
24
24
|
`||b==="\r"?(b==="\r"&&o[m+1]===`
|
|
25
|
-
`&&m++,s.push(l),a.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),a.push(s));let f=a.filter(m=>!(m.length===1&&m[0].trim()===""));if(!f.length)return[];let u=m=>n?yo(m):m;if(!r)return f.map(m=>Object.fromEntries(m.map((b,T)=>[String(T),u(b)])));let d=[],g=new Set;return f[0].forEach((m,b)=>{let T=m.trim()||`col${b+1}`,w=T;for(let $=2;g.has(w);$++)w=`${T}_${$}`;g.add(w),d.push(w)}),f.slice(1).map(m=>Object.fromEntries(d.map((b,T)=>[b,u(m[T]??"")])))}function qn(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"?yo(a[l]):a[l]??null])))}function As(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function xo(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 Ke(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ke(JSON.parse(t))}catch{}return Ze(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?qn(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)?Ke(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?qn(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)?Ke(t.rows):Array.isArray(t.values)?qn(t.values):Array.isArray(t.items)?Ke(t.items):Array.isArray(t.results)?Ke(t.results):As(t)}return[]}function an(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 Mt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let f=e[l][c];return Number.isFinite(f)&&f>0?f:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let f=0,u=0;for(let d=0;d<n;d++){let g=a(d,c),m=g-a(d,c-1),b=0;for(let T=0;T<d;T++)b+=a(T,c)-a(T,c-1);f+=g,u+=(m/2+b)*g}f&&(l-=u/f),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let g=0;g<n;g++){let m=e[g][l],b=Number.isFinite(m)?m:0;b>=0?(o[g][l]=u,u+=b,i[g][l]=u):(o[g][l]=d,d+=b,i[g][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let f=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=a(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=f,f+=d,i[u][l]=f}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,i[n-1]?.[u]??0);let f=0;for(let u=0;u<r;u++)f+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;f/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=f,i[u][d]-=f}return{y0:o,y1:i}}function sn(e,t={}){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=new Array(r).fill(0),s=new Array(r).fill(0),l=t.neutral!==void 0&&t.neutral>=0&&t.neutral<n?t.neutral:-1,c=[...new Set(t.negative??[])].filter(u=>u>=0&&u<n&&u!==l),f=e.map((u,d)=>d).filter(u=>u!==l&&!c.includes(u));for(let u=0;u<r;u++){let d=0;for(let v=0;v<n;v++)Number.isFinite(e[v][u])&&(d+=Math.abs(e[v][u]));let g=t.percent?d?100/d:0:1,m=v=>Number.isFinite(e[v][u])&&!t.skip?.has(v)?Math.abs(e[v][u])*g:0,b=l>=0?m(l)/2:0;l>=0&&(o[l][u]=-b,i[l][u]=b);let T=0-b,w=b,$=v=>{o[v][u]=T,T-=m(v),i[v][u]=T};c.forEach($);for(let v of f)e[v][u]<0||(o[v][u]=w,w+=m(v),i[v][u]=w);for(let v=f.length-1;v>=0;v--)e[f[v]][u]<0&&$(f[v]);a[u]=0-T-b,s[u]=w-b}return{y0:o,y1:i,neg:a,pos:s}}function ln(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 ko(e){let t=e.length,n=e.map(c=>{let f=0,u=-1/0;return c.forEach((d,g)=>{d>u&&(u=d,f=g)}),f}),r=e.map(c=>c.reduce((f,u)=>f+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,f)=>f).sort((c,f)=>n[c]-n[f]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Ns=Math.PI*2;function cn(e,t,n){return e<t?t:e>n?n:e}function wo(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 Tt(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let i=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,a=Math.min(n,r)/2,s=cn(i.tl??0,0,a),l=cn(i.tr??0,0,a),c=cn(i.br??0,0,a),f=cn(i.bl??0,0,a);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+f)}`+(f?`A${J(f)},${J(f)} 0 0 1 ${J(e)},${J(t+r-f)}`:"")+`V${J(t+s)}`+(s?`A${J(s)},${J(s)} 0 0 1 ${J(e+s)},${J(t)}`:"")+"Z"}function $o(e){if(!e.length)return"";let t=`M${J(e[0][0])},${J(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${J(e[n][0])},${J(e[n][1])}`;return t}function vo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function Mo(e){let t=e.length,n=e.reduce((l,c)=>l+c.x,0)/t,r=e.reduce((l,c)=>l+c.y,0)/t,o=0,i=0,a=0;for(let l of e)o+=(l.x-n)*(l.y-r),i+=(l.x-n)**2,a+=(l.y-r)**2;let s=i?o/i:0;return{slope:s,r2:i&&a?o*o/(i*a):0,at:l=>r+s*(l-n)}}function Co(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function To(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 un=new Map;function ie(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=un.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);Co(c)?a+=To(c):s+=To(c)}i=a+s*(n>=600?1.07:1),un.size>5e3&&un.clear(),un.set(o,i)}return i*t}function Ne(e,t,n,r=400){if(e=e.trim(),ie(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ie(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(Co(s.charCodeAt(0))?2:3)?"":s+o}var Y=P(W(),1),Qe=e=>Array.isArray(e)&&e.length===2;function mn(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Qe(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var So=e=>e?.find(t=>t.type==="forecast")?.from,Fs=(e,t)=>Math.max(0,Math.min(e.x+e.w,t.x+t.w)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.h,t.y+t.h)-Math.max(e.y,t.y));function Zn(e,t,n){let r=t[0],o=1/0;for(let i of t){let a=er(e,i.x,i.y,i.anchor),s=n.reduce((l,c)=>l+Fs(a,c),0);if(s<o&&(r=i,o=s),s===0)break}return n.push(er(e,r.x,r.y,r.anchor)),r}var Qn=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),Rs=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function Ao(e,t){let n=e.xAt(t[0]),r=e.xAt(t[1]);return n===null||r===null?null:[Math.min(n,r)-e.half,Math.max(n,r)+e.half]}function No(e,t){let n=e.y(Number(t[0])),r=e.y(Number(t[1]));return Number.isFinite(n)&&Number.isFinite(r)?[Math.max(e.top,Math.min(n,r)),Math.min(e.bottom,Math.max(n,r))]:null}function Fo(e,t){let n=t===void 0?null:e.xAt(t);return n===null||n>e.x1?null:Math.max(e.x0,n-(e.edge?e.half:0))}var Ro={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function _o({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=Math.max(0,t.bottom-t.top),o=[];return e.forEach((i,a)=>{if(i.type==="band"&&Qe(i.y)){let s=No(t,i.y);if(!s)return;let[l,c]=s;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,c-l),fill:n.paint("accent"),opacity:.1}),(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:c,y2:c,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},a))}else if(i.type==="band"&&Qe(i.x)||i.type==="forecast"){let s;if(i.type==="forecast"){let f=Fo(t,i.from);s=f===null?null:[f,t.x1]}else s=Ao(t,i.x);if(!s)return;let l=Qn(t,s[0]),c=Qn(t,s[1]);if(c-l<.5)return;o.push((0,Y.jsx)("rect",{x:l,y:t.top,width:c-l,height:r,fill:n.paint("ink"),opacity:.05},a))}else if(i.type==="weekends"&&t.time&&t.time.t1-t.time.t0<=864e5*400){let s=Math.min(432e5,(t.time.t1-t.time.t0)/Math.max(1,t.time.n-1)/2),l=new Date(t.time.t0);l.setHours(0,0,0,0),l.setDate(l.getDate()-(l.getDay()+1)%7);for(let c=0;l.getTime()-s<=t.time.t1&&c<60;c++){let f=l.getTime();l.setDate(l.getDate()+2);let u=Math.max(t.x0,t.time.xt(f-s)),d=Math.min(t.x1,t.time.xt(l.getTime()-s));d>u&&o.push((0,Y.jsx)("rect",{x:u,y:t.top,width:d-u,height:r,fill:n.paint("ink"),opacity:.045},`${a}w${c}`)),l.setDate(l.getDate()+5)}}}),(0,Y.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var Po=(e,t)=>ie(e,10.5,t?700:500)+8;function er(e,t,n,r="start",o){let i=Po(e,o);return{x:r==="end"?t-i:t,y:n-8,w:i,h:16}}function Ct({p:e,x:t,y:n,text:r,anchor:o="start",strong:i}){let a=er(r,t,n,o,i);return(0,Y.jsxs)("g",{children:[(0,Y.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,Y.jsx)(me,{x:a.x+4,y:n,size:10.5,weight:i?700:500,fill:e.paint(i?"ink":"muted"),children:r})]})}function Do({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=Ro[t.lang],o=[],i=[],a=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let c=t.y(s.y);if(!Number.isFinite(c))return;let f=s.label?Ne(s.label,160,10.5):"",u=f?Zn(f,[{x:t.x1-2,y:c-10,anchor:"end"},{x:t.x0+2,y:c-10,anchor:"start"},{x:t.x1-2,y:c+10,anchor:"end"},{x:t.x0+2,y:c+10,anchor:"start"}],a):null;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:c,y2:c,stroke:n.paint("dim"),strokeDasharray:"4 3"}),u?(0,Y.jsx)(Ct,{p:n,x:u.x,y:u.y,text:f,anchor:u.anchor}):null]},l))}else if(s.type==="band"&&s.label){let c=Qe(s.y)?No(t,s.y):[t.top,t.bottom],f=Qe(s.x)?Ao(t,s.x):[t.x0,t.x1];if(!f||!c)return;let[u,d]=c,g=Ne(s.label,160,10.5),m=Math.min(Qn(t,f[0]),t.x1-40)+4,b=Zn(g,[{x:m,y:u+11,anchor:"start"},{x:m,y:d-11,anchor:"start"}],a);o.push((0,Y.jsx)(Ct,{p:n,x:b.x,y:b.y,text:g},l))}else if(s.type==="forecast"){let c=Fo(t,s.from);if(c===null)return;let f=Ne(s.label??r.forecast,120,10.5),u=Math.min(c+4,t.x1-50),d=Zn(f,[{x:u,y:t.top+9,anchor:"start"},{x:u,y:t.bottom-9,anchor:"start"}],a);o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:c,x2:c,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,Y.jsx)(Ct,{p:n,x:d.x,y:d.y,text:f})]},l))}else if(s.type==="event"&&s.label){let c=t.xAt(s.x);if(!Rs(t,c))return;let f=Ne(s.label,140,10.5,700),u=Po(f,!0),d=Math.max(t.x0,Math.min(c-u/2,t.x1-u)),g=i.findIndex(b=>b<d-4);g<0&&(g=i.length),i[g]=d+u;let m=t.top+9+g*18;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:c,x2:c,y1:m+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,Y.jsx)("circle",{cx:c,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,Y.jsx)(Ct,{p:n,x:d,y:m,text:f,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let c=t.points().filter(g=>Number.isFinite(g.x)&&Number.isFinite(g.y));if(c.length<2)return;let{at:f}=Mo(c),u=c[0].x,d=c[c.length-1].x;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:u,x2:d,y1:f(u),y2:f(d),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,Y.jsx)(Ct,{p:n,x:d-2,y:f(d)-11,text:Ne(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,Y.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function Lo(e,t,n,r){if(!e?.length)return"";let o=Ro[t],i=t==="ko",a=r??(l=>String(l??"")),s=e.map(l=>{let c=l.label?i?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&&Qe(l.y)?i?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${c}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${c}`:l.type==="band"&&Qe(l.x)?i?`${l.label??o.period} ${a(l.x[0])}~${a(l.x[1])}`:`${l.label??o.period} from ${a(l.x[0])} to ${a(l.x[1])}`:l.type==="line"&&typeof l.y=="number"?i?`기준선 ${n(l.y)}${c}`:`reference line at ${n(l.y)}${c}`:l.type==="event"?i?`${a(l.x)} ${l.label??""}`.trim():`${l.label??"event"} at ${a(l.x)}`:l.type==="forecast"?i?`${a(l.from)}부터 ${l.label??o.forecast}`:`${l.label??o.forecast.toLowerCase()} from ${a(l.from)}`:l.type==="trend"?i?l.label??"추세선":l.label??"trend line":l.type==="weekends"?o.weekends:""}).filter(Boolean);return s.length?` ${o.lead}: ${s.join(i?", ":"; ")}.`:""}var ye=P(W(),1),we=10.5;function Oo(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=>lt(a,{locale:n,maximumFractionDigits:i}))}function dn(e,t,n){let r=18;for(let o of Oo(e,t,n))r=Math.max(r,ie(o,we));return Math.ceil(r+8)}function Io(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:Oo(n,a,e.locale);return(0,ye.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,f)=>{let u=Math.round(r(c))+.5,d=c===0&&e.zero!==!1;return(0,ye.jsxs)("g",{children:[(0,ye.jsx)("line",{x1:o,x2:i,y1:u,y2:u,stroke:t.paint(d?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:d?.7:1}),l?(0,ye.jsx)(me,{x:s?i+6:o-6,y:u,anchor:s?"start":"end",size:we,fill:t.paint("muted"),children:l[f]}):null]},c)})})}function tr(e,t,n=we,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((u,d)=>d);let s=t.map(u=>ie(u,n,o)),l=(u,d)=>Math.abs(e[d]-e[u])<(s[u]+s[d])/2+r,c=[];for(let u of i??[])c.some(d=>l(d,u))||c.push(u);let f=u=>!c.some(d=>l(d,u));for(let u=1;u<=a;u++){let d=c.slice();for(let g=0;g<a;g+=u)f(g)&&d.push(g);if(u>1&&(a-1)%u>u/2&&f(a-1)&&d.push(a-1),d.sort((g,m)=>g-m),d.every((g,m)=>!m||!l(d[m-1],g)))return d}return[0,a-1]}function zo(e){let{p:t,labels:n,centers:r,y:o,width:i}=e,a=e.size??we,s=n.map((c,f)=>{let u=2*Math.max(0,Math.min(r[f],i-r[f]))-2;return Ne(c,Math.min(e.maxWidth??160,u),a,e.strong?.has(f)?700:500)}),l=tr(r,s,a,6,600,e.strong);return(0,ye.jsx)("g",{"aria-hidden":"true",children:l.map(c=>{let f=e.strong?.has(c);return(0,ye.jsxs)("g",{children:[(0,ye.jsx)(me,{x:r[c],y:o,anchor:"middle",size:a,weight:f?700:500,fill:t.paint(f?"ink":"muted"),children:s[c]}),e.sub?.[c]?(0,ye.jsx)(me,{x:r[c],y:o+a+3,anchor:"middle",size:a-1,fill:t.paint("muted"),children:e.sub[c]}):null]},c)})})}var Eo=e=>Math.round(e*10)/10;function Bo(e){let{p:t}=e,n=Ne(e.label,160,we,700),r=ie(n,we,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,ye.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Eo(o)}px,${Eo(e.y)}px)`},children:[(0,ye.jsx)("rect",{x:-r/2,y:-9,width:r,height:18,rx:9,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:3,paintOrder:"stroke"}),(0,ye.jsx)(me,{x:0,y:0,anchor:"middle",size:we,weight:700,fill:t.paint("onInk"),children:n})]})}function nr(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 Ue(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=nr(a,n),c=[o,i];for(let f=0;f<4;f++){let u=Math.ceil(i/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let g=nr(c[1]-c[0],n);if(g===l)break;l=g}return c}function Ho(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=nr(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function et(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)=>Ho(n,r,l),s}function rr(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]=Ue(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function _s(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,f=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%f))for(let g of c){let m=Number((g*10**d).toPrecision(12));m>=e*(1-1e-9)&&m<=t*(1+1e-9)&&u.push(m)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Ho(e,t,3)}function jo(e,t){let n=et([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=()=>_s(e[0],e[1],Math.abs(t[1]-t[0])),r}function ut(e,t,n=.2,r=n/2){let o=e.length,[i,a]=t,s=a-i,l=o?s/Math.max(1,o-n+r*2):s,c=l*(1-n),f=i+l*r,u=new Map(e.map((g,m)=>[g,m])),d=(g=>f+(u.get(g)??0)*l);return d.bandwidth=Math.max(0,c),d.step=l,d.domain=e,d.index=g=>u.get(g)??-1,d}function tt(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 Ps=864e5;function Go(e,t,n,r=fe){let o=t-e;if(!(o>0))return[{t:e,label:vt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Ps,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(f,u,d,g=!1)=>{let m=new Date(f),b=-1,T=0;for(;m.getTime()<=t&&T++<500;){if(m.getTime()>=e){let w=m.getFullYear(),$=g&&!l&&w!==b;a.push({t:m.getTime(),label:vt(m,{locale:r,...d,...$?{year:"numeric"}:{}})}),b=w}u(m)}};if(i<=1.5){let f=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(g=>g>=f)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,g=>g.setHours(g.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(f,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());f.setDate(f.getDate()+(8-f.getDay())%7),c(f,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let f=i/30.44,u=Math.max(1,Math.ceil(f/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(g=>g>=u)??120;if(d>=12){let g=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(g,m=>m.setFullYear(m.getFullYear()+d/12),{year:"numeric"})}else{let g=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),m=g.getMonth()%d;m&&g.setMonth(g.getMonth()+(d-m)),c(g,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return a}function Vo(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 Ds=(e,t,n)=>e==="date"?$t(t,n)?.getTime()??NaN:Oe(t);function Wo(e,t){let n=new Set(t?t.split(""):[]),r=e.series.flatMap((i,a)=>n.has(i)?[]:[a]);if(r.length===e.series.length)return[e,r];let o=i=>r.map(a=>i[a]);return[{...e,series:o(e.series),values:o(e.values),rows:o(e.rows),...e.rowValues&&{rowValues:o(e.rowValues)}},r]}function Ko(e){if(!Gn(e.trim()))return e;let t=$t(e)?.getTime();return t===void 0||!Number.isFinite(t)?e:String(t)}function Ls(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Gn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Xe(e,t,n,r,o={}){let i=qe(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:qe(n,"y"),c=!a&&r!==void 0?qe(r,"series"):null,f=e.map((C,k)=>i(C,k)),u=o.xType??Ls(f),d=o.locale??fe,g,m,b;if(u==="band"){let C=f.map(N=>String(N??""));g=Ae(C);let k=new Map(g.map((N,H)=>[N,H]));m=g.map((N,H)=>H),b=Int32Array.from(C,N=>k.get(N)??-1)}else{let C=u==="date"?o.dayFirst??eo(f):void 0,k=f.map(G=>Ds(u,G,C)),N=Array.from(new Set(k.filter(G=>Number.isFinite(G)))).sort((G,de)=>G-de),H=new Map(N.map((G,de)=>[G,de]));m=N,g=N.map(String),b=Int32Array.from(k,G=>H.get(G)??-1)}let T=o.dateFormat,w=C=>typeof C=="string"?Yt(C.trim())?.[3]:void 0,$=u==="date"&&f.length<5e3?w(f[0]):void 0,v=($===2||$===3)&&f.every(C=>w(C)===$),D=v&&$===3;if(u==="date"&&!T){let C=m.length>1?m[m.length-1]-m[0]:0;T=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 x;if(u==="band")x=g;else if(D&&!o.dateFormat){let C=te(d)==="ko";x=m.map(k=>{let N=new Date(k),H=Math.floor(N.getMonth()/3)+1;return C?`${N.getFullYear()}년 ${H}분기`:`Q${H} ${N.getFullYear()}`})}else{let C=m.every(jn),k=u==="date"?new Intl.DateTimeFormat(d,T):new Intl.NumberFormat(d,C?{useGrouping:!1}:{maximumFractionDigits:6});x=m.length>1e3?Vo(m.length,N=>k.format(m[N])):m.map(N=>k.format(N))}let L=s?[...s]:c?Ae(e.map((C,k)=>String(c(C,k)??""))):[""],z=new Map(L.map((C,k)=>[C,k])),B=L.map(()=>new Array(g.length).fill(NaN)),E=L.map(()=>new Array(g.length).fill(null)),I=o.aggregate??"sum",S=I==="mean"?L.map(()=>new Uint32Array(g.length)):null,R=(C,k,N,H)=>{let G=B[C][k];I==="last"?B[C][k]=N:I==="count"?B[C][k]=(Number.isFinite(G)?G:0)+1:I==="mean"?Number.isFinite(N)&&(B[C][k]=(Number.isFinite(G)?G:0)+N,S[C][k]++):B[C][k]=Number.isFinite(G)?G+(Number.isFinite(N)?N:0):N,E[C][k]=H};for(let C=0;C<e.length;C++){let k=b[C];if(k<0)continue;let N=e[C];if(s)for(let H=0;H<s.length;H++)R(H,k,Oe(N[s[H]]),N);else{let H=c?z.get(String(c(N,C)??""))??0:0;R(H,k,Oe(l(N,C)),N)}}if(S)for(let C=0;C<B.length;C++)for(let k=0;k<g.length;k++)S[C][k]>1&&(B[C][k]/=S[C][k]);return{type:u,keys:g,xnum:m,labels:x,series:L,values:B,rows:E}}var Es=140,At=12,Uo=14,or=20,Xo=12.5;function Os(e,t,n=fo){let r=Be(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function Is(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+At)/(Es+At))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function zs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*At)/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 St=e=>e.filter(Number.isFinite);function fn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=on(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return St(n)}function Yo(e,t,n,r,o,i){return Xe(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Bs(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let x=t.flat(),L=r.refLines??{},[z,B]=tt([...fn(x,r.x??"x"),...St([Number(L.x)])]),[E,I]=tt([...fn(x,r.y??"y"),...St([Number(L.y)])].filter(R=>!s||R>0)),S=r.zero??!1;return{y:c??(s?rr(E,I,a):Ue(E,I,a,{zero:S,pad:.08})),x:r.xDomain??Ue(z,B,Math.max(2,Math.round(o/110)),{zero:S,pad:.06}),sameKeys:!0}}let f=e==="bar",u=f&&r.orientation==="horizontal",d=n[0]?.keys.join(""),g=n.every(x=>x.keys.join("")===d),m=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),b=r.xDomain??(!f&&m?tt(n.flatMap(x=>St(x.xnum))):void 0),T=f?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(T==="percent")return{x:b,sameKeys:g};if(c)return{y:c,x:b,sameKeys:g};let w=[];t.forEach((x,L)=>{let z=n[L];if(T==="stacked"||T==="auto"&&z.series.length>1){let E=Mt(z.values,"zero");E.y0.forEach(I=>w.push(...I)),E.y1.forEach(I=>w.push(...I))}else z.values.forEach(E=>w.push(...E));f&&!u&&r.line!==void 0&&Yo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>w.push(...E)),f||w.push(...fn(x,r.lower),...fn(x,r.upper))}),f&&w.push(0),u||w.push(...mn(r.annotations));for(let x of r.referenceLines??[])w.push(x.y);r.signColors&&w.push(Number(r.baseline??0));let[$,v]=tt(St(w).filter(x=>!s||x>0));return{y:s?rr($,v,a):f?Ue($,v,u?Math.max(2,Math.round(o/120)):a):Ue($,v,a,{zero:r.zero??e==="area"}),x:b,sameKeys:g}}function Hs(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Xe(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?jo:et)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),f=dn(c,Xt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(x=>x.series),d=r.endLabels??n.some(x=>x.series.length>1),g=f+6,m=i-(d?Math.min(i*.28,Math.max(...u.map(x=>ie(x,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,$=l.type==="number"?b>12:b>Go(T,w,Math.max(2,Math.floor((m-g)/64)),s).length;if(l.type==="band"||!b||$)return;let v=x=>g+(l.xnum[x]-T)/(w-T)*(m-g),D=x=>ie(l.labels[x],we);for(let x=1;;x++){let L=Array.from({length:Math.ceil(b/x)},(z,B)=>B*x);if(x>=b||L.every((z,B)=>!B||v(z)-v(L[B-1])>=(D(z)+D(L[B-1]))/2+8))return L.map(z=>({value:l.xnum[z],label:l.labels[z]}))}}function js(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 Gs(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${js(`${e}|${t}|${o}|${an(r)}`)}`}function Vs(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)=>`${Ve(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},ir=18;function Jo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Os(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Is(s,a,e.columns),{pw:c,ph:f}=zs(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(S=>Yo(t,S,n,n.y,n.series,n.aggregate)),g=u?Bs(t,o,d,n,c,f):{sameKeys:!1},m=u?Hs(t,o,d,n,g,c,f,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",T=u&&(!b||g.sameKeys),w=u&&(b||g.x!==void 0||g.sameKeys),$=new Set(Vs(e.highlight,r)?[e.highlight].flat():[]),v=$.size>0,D=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??Gs(t,e.by,n,e.data),L=Ut(Je(n.format,e.locale),n.unit),z=Ws[e.lang],B=[],E=r.map(S=>S===""?z.blank:S);return{panels:r.map((S,R)=>{let C=o[R],k=E[R],N=R%l,H;if(t!=="scatter"){let de=d[R],Re=ce=>de.values.reduce((he,ht)=>he+(Number.isFinite(ht[ce])?ht[ce]:0),0),K=de.keys.map((ce,he)=>he).filter(ce=>de.values.some(he=>Number.isFinite(he[ce]))),le=K[K.length-1];B.push({first:K.length?Re(K[0]):NaN,last:K.length?Re(le):NaN,total:K.reduce((ce,he)=>ce+Re(he),0)}),t!=="bar"&&de.series.length===1&&le!==void 0&&(H=L(de.values[0][le]))}else B.push({first:NaN,last:NaN,total:C.length});let G={data:C,width:c,height:f,ariaLabel:e.title?`${e.title}, ${k}`:k,syncId:x,highlight:v?$.has(S)?D?()=>!0:void 0:"none":e.highlight,showYAxis:!T||N===0,showXAxis:!w||R+l>=a};return g.y&&(G.yDomain=g.y),g.x&&(G.xDomain=g.x),m&&(G.xTicks=m),{value:S,label:k,props:G,last:H,isPicked:$.has(S)}}),cols:l,pw:c,ph:f,isPanelPick:v,description:Ks(t,e.by,E,B,i,L,z)}}function Ks(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>vo(r.map(f=>f[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let f=n.filter((u,d)=>r[d].last<r[d].first);s+=f.length?a.falling(`${f.slice(0,5).join(", ")}${f.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var xe=P(ee(),1);function Us(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Xs(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 hn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Qo(e,t=!0){let[n,r]=(0,xe.useState)({visible:!t,near:!t});return(0,xe.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=Xs(a[a.length-1],hn.threshold,hn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Us(hn.threshold),rootMargin:hn.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 qo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function gn(e){let[t,n]=(0,xe.useState)(null),[r,o]=(0,xe.useState)(e??null),i=(0,xe.useCallback)(a=>{n(a),a&&e===void 0&&o(qo(a))},[e]);return Le(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(f=>f!==null&&Math.abs(f-c)<.5?f:c),s=()=>a(qo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let f=c[c.length-1]?.contentRect;f?a(f.width>0?Math.round(f.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var Ys=()=>()=>{};function mt(){return(0,xe.useSyncExternalStore)(Ys,()=>!0,()=>!1)}var Zo="(prefers-reduced-motion: reduce)";function pn(e="auto"){let[t,n]=(0,xe.useState)(()=>Te&&typeof window.matchMedia=="function"?window.matchMedia(Zo).matches:!1);return(0,xe.useEffect)(()=>{if(e!=="auto"||!Te||typeof window.matchMedia!="function")return;let r=window.matchMedia(Zo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Fe=P(W(),1),Js=60,qs=420;function ei(e){let t=Se(),n=e.chartProps??{},[,r,o]=gn(e.width),i=e.width??(o||480),a=pe(e.locale??n.locale),s=te(a),l=(0,dt.useContext)(it),c=e.title??l,f=e.chart.facetPlan,u=(0,dt.useMemo)(()=>{let w=Jo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return f?f(w,n,a):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,i,e.height,c,a,s,f]),d=`${(0,dt.useId)().replace(/:/g,"")}fd`,g=pn(n.reducedMotion??"auto"),m=mt(),b=Lr({motion:{enabled:n.animate!==!1&&!g&&Te},hydrated:m},{waiting:!1,generation:0}),T=e.chart;return(0,Fe.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Fe.jsx)("p",{id:d,style:tn,children:e.description??u.description}),(0,Fe.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:At,rowGap:Uo,...u.legend?{marginTop:ir}:null},children:u.panels.map((w,$)=>{let v=t.paint(w.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Fe.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...Dr(b,!1,"fade",$*Js,qs)},children:[(0,Fe.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:or,fontSize:Xo,fontWeight:700,lineHeight:`${or}px`,color:v},children:[(0,Fe.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,Fe.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,Fe.jsx)(T,{...n,...w.props})]},w.value)})}),u.legend?(0,Fe.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:ir},children:u.legend}):null]})}var ti=["max","min","first","last","none"];function $e(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let f=-1,u=c==="max"?-1/0:1/0;r.forEach((d,g)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,f=g)}),f>=0&&i.add(f)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,f)=>{f<a&&c!==null&&c!==void 0&&e(c,f)&&i.add(f)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((f,u)=>{f===c&&i.add(u)});return i}var ve=P(ee(),1);async function Zs(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(te(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ze(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 Ze(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ze(i)}async function Qs(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 Zs(i,t.parse,o,t.locale)}return t.select&&(r=xo(r,t.select)),t.transform?t.transform(r):Ke(r)}function ni(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,ve.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ve.useState)(0),c=pe(t.locale),f=(0,ve.useRef)(t);f.current={...t,locale:c};let u=(0,ve.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",g=t.deps??[],m=JSON.stringify(g.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),b=(0,ve.useRef)(!1);(0,ve.useEffect)(()=>{let w=u.current;if(!w||!r){a(D=>D.status==="loading"?{...D,status:"idle"}:D);return}let $=new AbortController,v=!0;return b.current=!0,a(D=>({...D,data:o?D.data:[],status:"loading",error:null})),Qs(w,{...f.current,signal:$.signal}).then(D=>{v&&a({data:D,status:"success",error:null,updatedAt:Date.now()})}).catch(D=>{!v||$.signal.aborted||a(x=>({...x,status:"error",error:D instanceof Error?D:new Error(String(D))}))}).finally(()=>{v&&(b.current=!1)}),()=>{v=!1,b.current=!1,$.abort()}},[d,r,s,m,o]),(0,ve.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||l($=>$+1)},n);return()=>clearInterval(w)},[n,r]);let T=(0,ve.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 sr=P(W(),1),el=["csv","svg","png"],tl=/^[=+\-@\t\r\n=+-@]/,nl=/var\(|color-mix\(/;function ri(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?qr(e.getTime()):String(e);return`"${(tl.test(t)&&!Number.isFinite(Oe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function rl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function ol(e,t){return`\uFEFF${[t.map(ri),...e.map(r=>t.map(o=>ri(r[o])))].map(r=>r.join(",")).join(`\r
|
|
25
|
+
`&&m++,s.push(l),a.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),a.push(s));let d=a.filter(m=>!(m.length===1&&m[0].trim()===""));if(!d.length)return[];let u=m=>n?xo(m):m;if(!r)return d.map(m=>Object.fromEntries(m.map((b,T)=>[String(T),u(b)])));let f=[],g=new Set;return d[0].forEach((m,b)=>{let T=m.trim()||`col${b+1}`,w=T;for(let $=2;g.has(w);$++)w=`${T}_${$}`;g.add(w),f.push(w)}),d.slice(1).map(m=>Object.fromEntries(f.map((b,T)=>[b,u(m[T]??"")])))}function Zn(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"?xo(a[l]):a[l]??null])))}function Ns(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function ko(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function Ue(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ue(JSON.parse(t))}catch{}return Qe(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Zn(e):typeof e[0]=="number"?e.map((t,n)=>({label:String(n+1),value:t})):e.filter(t=>t&&typeof t=="object"):[];if(typeof e=="object"){let t=e;return Array.isArray(t.data)?Ue(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Zn(t.rows,t.columns.map(n=>typeof n=="object"&&n&&"name"in n?String(n.name):String(n))):Array.isArray(t.rows)&&Array.isArray(t.fields)||Array.isArray(t.rows)?Ue(t.rows):Array.isArray(t.values)?Zn(t.values):Array.isArray(t.items)?Ue(t.items):Array.isArray(t.results)?Ue(t.results):Ns(t)}return[]}function sn(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 Tt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let d=e[l][c];return Number.isFinite(d)&&d>0?d:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let d=0,u=0;for(let f=0;f<n;f++){let g=a(f,c),m=g-a(f,c-1),b=0;for(let T=0;T<f;T++)b+=a(T,c)-a(T,c-1);d+=g,u+=(m/2+b)*g}d&&(l-=u/d),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,f=0;for(let g=0;g<n;g++){let m=e[g][l],b=Number.isFinite(m)?m:0;b>=0?(o[g][l]=u,u+=b,i[g][l]=u):(o[g][l]=f,f+=b,i[g][l]=f)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let d=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let f=a(u,l);t==="expand"&&(f=c?f/c*100:0),o[u][l]=d,d+=f,i[u][l]=d}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,i[n-1]?.[u]??0);let d=0;for(let u=0;u<r;u++)d+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;d/=r;for(let u=0;u<n;u++)for(let f=0;f<r;f++)o[u][f]-=d,i[u][f]-=d}return{y0:o,y1:i}}function ln(e,t={}){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=new Array(r).fill(0),s=new Array(r).fill(0),l=t.neutral!==void 0&&t.neutral>=0&&t.neutral<n?t.neutral:-1,c=[...new Set(t.negative??[])].filter(u=>u>=0&&u<n&&u!==l),d=e.map((u,f)=>f).filter(u=>u!==l&&!c.includes(u));for(let u=0;u<r;u++){let f=0;for(let v=0;v<n;v++)Number.isFinite(e[v][u])&&(f+=Math.abs(e[v][u]));let g=t.percent?f?100/f:0:1,m=v=>Number.isFinite(e[v][u])&&!t.skip?.has(v)?Math.abs(e[v][u])*g:0,b=l>=0?m(l)/2:0;l>=0&&(o[l][u]=-b,i[l][u]=b);let T=0-b,w=b,$=v=>{o[v][u]=T,T-=m(v),i[v][u]=T};c.forEach($);for(let v of d)e[v][u]<0||(o[v][u]=w,w+=m(v),i[v][u]=w);for(let v=d.length-1;v>=0;v--)e[d[v]][u]<0&&$(d[v]);a[u]=0-T-b,s[u]=w-b}return{y0:o,y1:i,neg:a,pos:s}}function cn(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 wo(e){let t=e.length,n=e.map(c=>{let d=0,u=-1/0;return c.forEach((f,g)=>{f>u&&(u=f,d=g)}),d}),r=e.map(c=>c.reduce((d,u)=>d+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,d)=>d).sort((c,d)=>n[c]-n[d]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Rs=Math.PI*2;function un(e,t,n){return e<t?t:e>n?n:e}function $o(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 St(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let i=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,a=Math.min(n,r)/2,s=un(i.tl??0,0,a),l=un(i.tr??0,0,a),c=un(i.br??0,0,a),d=un(i.bl??0,0,a);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+d)}`+(d?`A${J(d)},${J(d)} 0 0 1 ${J(e)},${J(t+r-d)}`:"")+`V${J(t+s)}`+(s?`A${J(s)},${J(s)} 0 0 1 ${J(e+s)},${J(t)}`:"")+"Z"}function vo(e){if(!e.length)return"";let t=`M${J(e[0][0])},${J(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${J(e[n][0])},${J(e[n][1])}`;return t}function Mo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function To(e){let t=e.length,n=e.reduce((l,c)=>l+c.x,0)/t,r=e.reduce((l,c)=>l+c.y,0)/t,o=0,i=0,a=0;for(let l of e)o+=(l.x-n)*(l.y-r),i+=(l.x-n)**2,a+=(l.y-r)**2;let s=i?o/i:0;return{slope:s,r2:i&&a?o*o/(i*a):0,at:l=>r+s*(l-n)}}function Co(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function So(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 mn=new Map;function oe(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=mn.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);Co(c)?a+=So(c):s+=So(c)}i=a+s*(n>=600?1.07:1),mn.size>5e3&&mn.clear(),mn.set(o,i)}return i*t}function Fe(e,t,n,r=400){if(e=e.trim(),oe(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;oe(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(Co(s.charCodeAt(0))?2:3)?"":s+o}var Y=P(W(),1),et=e=>Array.isArray(e)&&e.length===2;function dn(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&et(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var Ao=e=>e?.find(t=>t.type==="forecast")?.from,Fs=(e,t)=>Math.max(0,Math.min(e.x+e.w,t.x+t.w)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.h,t.y+t.h)-Math.max(e.y,t.y));function Qn(e,t,n){let r=t[0],o=1/0;for(let i of t){let a=tr(e,i.x,i.y,i.anchor),s=n.reduce((l,c)=>l+Fs(a,c),0);if(s<o&&(r=i,o=s),s===0)break}return n.push(tr(e,r.x,r.y,r.anchor)),r}var er=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),_s=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function No(e,t){let n=e.xAt(t[0]),r=e.xAt(t[1]);return n===null||r===null?null:[Math.min(n,r)-e.half,Math.max(n,r)+e.half]}function Ro(e,t){let n=e.y(Number(t[0])),r=e.y(Number(t[1]));return Number.isFinite(n)&&Number.isFinite(r)?[Math.max(e.top,Math.min(n,r)),Math.min(e.bottom,Math.max(n,r))]:null}function Fo(e,t){let n=t===void 0?null:e.xAt(t);return n===null||n>e.x1?null:Math.max(e.x0,n-(e.edge?e.half:0))}var _o={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function Po({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=Math.max(0,t.bottom-t.top),o=[];return e.forEach((i,a)=>{if(i.type==="band"&&et(i.y)){let s=Ro(t,i.y);if(!s)return;let[l,c]=s;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,c-l),fill:n.paint("accent"),opacity:.1}),(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:c,y2:c,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},a))}else if(i.type==="band"&&et(i.x)||i.type==="forecast"){let s;if(i.type==="forecast"){let d=Fo(t,i.from);s=d===null?null:[d,t.x1]}else s=No(t,i.x);if(!s)return;let l=er(t,s[0]),c=er(t,s[1]);if(c-l<.5)return;o.push((0,Y.jsx)("rect",{x:l,y:t.top,width:c-l,height:r,fill:n.paint("ink"),opacity:.05},a))}else if(i.type==="weekends"&&t.time&&t.time.t1-t.time.t0<=864e5*400){let s=Math.min(432e5,(t.time.t1-t.time.t0)/Math.max(1,t.time.n-1)/2),l=new Date(t.time.t0);l.setHours(0,0,0,0),l.setDate(l.getDate()-(l.getDay()+1)%7);for(let c=0;l.getTime()-s<=t.time.t1&&c<60;c++){let d=l.getTime();l.setDate(l.getDate()+2);let u=Math.max(t.x0,t.time.xt(d-s)),f=Math.min(t.x1,t.time.xt(l.getTime()-s));f>u&&o.push((0,Y.jsx)("rect",{x:u,y:t.top,width:f-u,height:r,fill:n.paint("ink"),opacity:.045},`${a}w${c}`)),l.setDate(l.getDate()+5)}}}),(0,Y.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var Do=(e,t)=>oe(e,10.5,t?700:500)+8;function tr(e,t,n,r="start",o){let i=Do(e,o);return{x:r==="end"?t-i:t,y:n-8,w:i,h:16}}function Ct({p:e,x:t,y:n,text:r,anchor:o="start",strong:i}){let a=tr(r,t,n,o,i);return(0,Y.jsxs)("g",{children:[(0,Y.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,Y.jsx)(de,{x:a.x+4,y:n,size:10.5,weight:i?700:500,fill:e.paint(i?"ink":"muted"),children:r})]})}function Lo({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=_o[t.lang],o=[],i=[],a=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let c=t.y(s.y);if(!Number.isFinite(c))return;let d=s.label?Fe(s.label,160,10.5):"",u=d?Qn(d,[{x:t.x1-2,y:c-10,anchor:"end"},{x:t.x0+2,y:c-10,anchor:"start"},{x:t.x1-2,y:c+10,anchor:"end"},{x:t.x0+2,y:c+10,anchor:"start"}],a):null;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:c,y2:c,stroke:n.paint("dim"),strokeDasharray:"4 3"}),u?(0,Y.jsx)(Ct,{p:n,x:u.x,y:u.y,text:d,anchor:u.anchor}):null]},l))}else if(s.type==="band"&&s.label){let c=et(s.y)?Ro(t,s.y):[t.top,t.bottom],d=et(s.x)?No(t,s.x):[t.x0,t.x1];if(!d||!c)return;let[u,f]=c,g=Fe(s.label,160,10.5),m=Math.min(er(t,d[0]),t.x1-40)+4,b=Qn(g,[{x:m,y:u+11,anchor:"start"},{x:m,y:f-11,anchor:"start"}],a);o.push((0,Y.jsx)(Ct,{p:n,x:b.x,y:b.y,text:g},l))}else if(s.type==="forecast"){let c=Fo(t,s.from);if(c===null)return;let d=Fe(s.label??r.forecast,120,10.5),u=Math.min(c+4,t.x1-50),f=Qn(d,[{x:u,y:t.top+9,anchor:"start"},{x:u,y:t.bottom-9,anchor:"start"}],a);o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:c,x2:c,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,Y.jsx)(Ct,{p:n,x:f.x,y:f.y,text:d})]},l))}else if(s.type==="event"&&s.label){let c=t.xAt(s.x);if(!_s(t,c))return;let d=Fe(s.label,140,10.5,700),u=Do(d,!0),f=Math.max(t.x0,Math.min(c-u/2,t.x1-u)),g=i.findIndex(b=>b<f-4);g<0&&(g=i.length),i[g]=f+u;let m=t.top+9+g*18;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:c,x2:c,y1:m+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,Y.jsx)("circle",{cx:c,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,Y.jsx)(Ct,{p:n,x:f,y:m,text:d,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let c=t.points().filter(g=>Number.isFinite(g.x)&&Number.isFinite(g.y));if(c.length<2)return;let{at:d}=To(c),u=c[0].x,f=c[c.length-1].x;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:u,x2:f,y1:d(u),y2:d(f),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,Y.jsx)(Ct,{p:n,x:f-2,y:d(f)-11,text:Fe(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,Y.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function Eo(e,t,n,r){if(!e?.length)return"";let o=_o[t],i=t==="ko",a=r??(l=>String(l??"")),s=e.map(l=>{let c=l.label?i?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&&et(l.y)?i?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${c}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${c}`:l.type==="band"&&et(l.x)?i?`${l.label??o.period} ${a(l.x[0])}~${a(l.x[1])}`:`${l.label??o.period} from ${a(l.x[0])} to ${a(l.x[1])}`:l.type==="line"&&typeof l.y=="number"?i?`기준선 ${n(l.y)}${c}`:`reference line at ${n(l.y)}${c}`:l.type==="event"?i?`${a(l.x)} ${l.label??""}`.trim():`${l.label??"event"} at ${a(l.x)}`:l.type==="forecast"?i?`${a(l.from)}부터 ${l.label??o.forecast}`:`${l.label??o.forecast.toLowerCase()} from ${a(l.from)}`:l.type==="trend"?i?l.label??"추세선":l.label??"trend line":l.type==="weekends"?o.weekends:""}).filter(Boolean);return s.length?` ${o.lead}: ${s.join(i?", ":"; ")}.`:""}var ke=P(W(),1),Me=10.5;function Io(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=>ct(a,{locale:n,maximumFractionDigits:i}))}function fn(e,t,n){let r=18;for(let o of Io(e,t,n))r=Math.max(r,oe(o,Me));return Math.ceil(r+8)}function zo(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:Io(n,a,e.locale);return(0,ke.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,d)=>{let u=Math.round(r(c))+.5,f=c===0&&e.zero!==!1;return(0,ke.jsxs)("g",{children:[(0,ke.jsx)("line",{x1:o,x2:i,y1:u,y2:u,stroke:t.paint(f?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:f?.7:1}),l?(0,ke.jsx)(de,{x:s?i+6:o-6,y:u,anchor:s?"start":"end",size:Me,fill:t.paint("muted"),children:l[d]}):null]},c)})})}function nr(e,t,n=Me,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((u,f)=>f);let s=t.map(u=>oe(u,n,o)),l=(u,f)=>Math.abs(e[f]-e[u])<(s[u]+s[f])/2+r,c=[];for(let u of i??[])c.some(f=>l(f,u))||c.push(u);let d=u=>!c.some(f=>l(f,u));for(let u=1;u<=a;u++){let f=c.slice();for(let g=0;g<a;g+=u)d(g)&&f.push(g);if(u>1&&(a-1)%u>u/2&&d(a-1)&&f.push(a-1),f.sort((g,m)=>g-m),f.every((g,m)=>!m||!l(f[m-1],g)))return f}return[0,a-1]}function Bo(e){let{p:t,labels:n,centers:r,y:o,width:i}=e,a=e.size??Me,s=n.map((c,d)=>{let u=2*Math.max(0,Math.min(r[d],i-r[d]))-2;return Fe(c,Math.min(e.maxWidth??160,u),a,e.strong?.has(d)?700:500)}),l=nr(r,s,a,6,600,e.strong);return(0,ke.jsx)("g",{"aria-hidden":"true",children:l.map(c=>{let d=e.strong?.has(c);return(0,ke.jsxs)("g",{children:[(0,ke.jsx)(de,{x:r[c],y:o,anchor:"middle",size:a,weight:d?700:500,fill:t.paint(d?"ink":"muted"),children:s[c]}),e.sub?.[c]?(0,ke.jsx)(de,{x:r[c],y:o+a+3,anchor:"middle",size:a-1,fill:t.paint("muted"),children:e.sub[c]}):null]},c)})})}var Oo=e=>Math.round(e*10)/10;function Ho(e){let{p:t}=e,n=Fe(e.label,160,Me,700),r=oe(n,Me,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,ke.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Oo(o)}px,${Oo(e.y)}px)`},children:[(0,ke.jsx)("rect",{x:-r/2,y:-9,width:r,height:18,rx:9,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:3,paintOrder:"stroke"}),(0,ke.jsx)(de,{x:0,y:0,anchor:"middle",size:Me,weight:700,fill:t.paint("onInk"),children:n})]})}function rr(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function Xe(e,t,n=4,r={}){let o=e,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=rr(a,n),c=[o,i];for(let d=0;d<4;d++){let u=Math.ceil(i/l-1e-9)*l,f=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-f<=l*.3?f:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let g=rr(c[1]-c[0],n);if(g===l)break;l=g}return c}function jo(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=rr(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function tt(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)=>jo(n,r,l),s}function or(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]=Xe(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function Ps(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,d=1)=>{let u=[];for(let f=Math.floor(r);f<=Math.ceil(o);f++)if(!(f%d))for(let g of c){let m=Number((g*10**f).toPrecision(12));m>=e*(1-1e-9)&&m<=t*(1+1e-9)&&u.push(m)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:jo(e,t,3)}function Go(e,t){let n=tt([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=()=>Ps(e[0],e[1],Math.abs(t[1]-t[0])),r}function mt(e,t,n=.2,r=n/2){let o=e.length,[i,a]=t,s=a-i,l=o?s/Math.max(1,o-n+r*2):s,c=l*(1-n),d=i+l*r,u=new Map(e.map((g,m)=>[g,m])),f=(g=>d+(u.get(g)??0)*l);return f.bandwidth=Math.max(0,c),f.step=l,f.domain=e,f.index=g=>u.get(g)??-1,f}function nt(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 Ds=864e5;function Vo(e,t,n,r=ge){let o=t-e;if(!(o>0))return[{t:e,label:Mt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Ds,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(d,u,f,g=!1)=>{let m=new Date(d),b=-1,T=0;for(;m.getTime()<=t&&T++<500;){if(m.getTime()>=e){let w=m.getFullYear(),$=g&&!l&&w!==b;a.push({t:m.getTime(),label:Mt(m,{locale:r,...f,...$?{year:"numeric"}:{}})}),b=w}u(m)}};if(i<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(g=>g>=d)??12,f=new Date(s);f.setMinutes(0,0,0),c(f,g=>g.setHours(g.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(d,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),c(d,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=i/30.44,u=Math.max(1,Math.ceil(d/Math.max(1,n))),f=[1,2,3,6,12,24,60].find(g=>g>=u)??120;if(f>=12){let g=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(g,m=>m.setFullYear(m.getFullYear()+f/12),{year:"numeric"})}else{let g=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),m=g.getMonth()%f;m&&g.setMonth(g.getMonth()+(f-m)),c(g,b=>b.setMonth(b.getMonth()+f),{month:"short"},!0)}}return a}function Wo(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 Ls=(e,t,n)=>e==="date"?vt(t,n)?.getTime()??NaN:Ie(t);function Ko(e,t){let n=new Set(t?t.split(""):[]),r=e.series.flatMap((i,a)=>n.has(i)?[]:[a]);if(r.length===e.series.length)return[e,r];let o=i=>r.map(a=>i[a]);return[{...e,series:o(e.series),values:o(e.values),rows:o(e.rows),...e.rowValues&&{rowValues:o(e.rowValues)}},r]}function Uo(e){if(!Vn(e.trim()))return e;let t=vt(e)?.getTime();return t===void 0||!Number.isFinite(t)?e:String(t)}function Es(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Vn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ye(e,t,n,r,o={}){let i=Ze(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Ze(n,"y"),c=!a&&r!==void 0?Ze(r,"series"):null,d=e.map((S,k)=>i(S,k)),u=o.xType??Es(d),f=o.locale??ge,g,m,b;if(u==="band"){let S=d.map(N=>String(N??""));g=Re(S);let k=new Map(g.map((N,H)=>[N,H]));m=g.map((N,H)=>H),b=Int32Array.from(S,N=>k.get(N)??-1)}else{let S=u==="date"?o.dayFirst??to(d):void 0,k=d.map(G=>Ls(u,G,S)),N=Array.from(new Set(k.filter(G=>Number.isFinite(G)))).sort((G,fe)=>G-fe),H=new Map(N.map((G,fe)=>[G,fe]));m=N,g=N.map(String),b=Int32Array.from(k,G=>H.get(G)??-1)}let T=o.dateFormat,w=S=>typeof S=="string"?Jt(S.trim())?.[3]:void 0,$=u==="date"&&d.length<5e3?w(d[0]):void 0,v=($===2||$===3)&&d.every(S=>w(S)===$),D=v&&$===3;if(u==="date"&&!T){let S=m.length>1?m[m.length-1]-m[0]:0;T=v&&$===2||S>864e5*120?{month:"short"}:S<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},S>864e5*800&&(T={year:"numeric",month:"short"})}let x;if(u==="band")x=g;else if(D&&!o.dateFormat){let S=te(f)==="ko";x=m.map(k=>{let N=new Date(k),H=Math.floor(N.getMonth()/3)+1;return S?`${N.getFullYear()}년 ${H}분기`:`Q${H} ${N.getFullYear()}`})}else{let S=m.every(Gn),k=u==="date"?new Intl.DateTimeFormat(f,T):new Intl.NumberFormat(f,S?{useGrouping:!1}:{maximumFractionDigits:6});x=m.length>1e3?Wo(m.length,N=>k.format(m[N])):m.map(N=>k.format(N))}let L=s?[...s]:c?Re(e.map((S,k)=>String(c(S,k)??""))):[""],z=new Map(L.map((S,k)=>[S,k])),B=L.map(()=>new Array(g.length).fill(NaN)),O=L.map(()=>new Array(g.length).fill(null)),I=o.aggregate??"sum",C=I==="mean"?L.map(()=>new Uint32Array(g.length)):null,F=(S,k,N,H)=>{let G=B[S][k];I==="last"?B[S][k]=N:I==="count"?B[S][k]=(Number.isFinite(G)?G:0)+1:I==="mean"?Number.isFinite(N)&&(B[S][k]=(Number.isFinite(G)?G:0)+N,C[S][k]++):B[S][k]=Number.isFinite(G)?G+(Number.isFinite(N)?N:0):N,O[S][k]=H};for(let S=0;S<e.length;S++){let k=b[S];if(k<0)continue;let N=e[S];if(s)for(let H=0;H<s.length;H++)F(H,k,Ie(N[s[H]]),N);else{let H=c?z.get(String(c(N,S)??""))??0:0;F(H,k,Ie(l(N,S)),N)}}if(C)for(let S=0;S<B.length;S++)for(let k=0;k<g.length;k++)C[S][k]>1&&(B[S][k]/=C[S][k]);return{type:u,keys:g,xnum:m,labels:x,series:L,values:B,rows:O}}var Os=140,Nt=12,Xo=14,ir=20,Yo=12.5;function Is(e,t,n=ho){let r=He(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function zs(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Nt)/(Os+Nt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Bs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Nt)/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 At=e=>e.filter(Number.isFinite);function hn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=an(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return At(n)}function Jo(e,t,n,r,o,i){return Ye(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Hs(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let x=t.flat(),L=r.refLines??{},[z,B]=nt([...hn(x,r.x??"x"),...At([Number(L.x)])]),[O,I]=nt([...hn(x,r.y??"y"),...At([Number(L.y)])].filter(F=>!s||F>0)),C=r.zero??!1;return{y:c??(s?or(O,I,a):Xe(O,I,a,{zero:C,pad:.08})),x:r.xDomain??Xe(z,B,Math.max(2,Math.round(o/110)),{zero:C,pad:.06}),sameKeys:!0}}let d=e==="bar",u=d&&r.orientation==="horizontal",f=n[0]?.keys.join(""),g=n.every(x=>x.keys.join("")===f),m=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),b=r.xDomain??(!d&&m?nt(n.flatMap(x=>At(x.xnum))):void 0),T=d?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(T==="percent")return{x:b,sameKeys:g};if(c)return{y:c,x:b,sameKeys:g};let w=[];t.forEach((x,L)=>{let z=n[L];if(T==="stacked"||T==="auto"&&z.series.length>1){let O=Tt(z.values,"zero");O.y0.forEach(I=>w.push(...I)),O.y1.forEach(I=>w.push(...I))}else z.values.forEach(O=>w.push(...O));d&&!u&&r.line!==void 0&&Jo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(O=>w.push(...O)),d||w.push(...hn(x,r.lower),...hn(x,r.upper))}),d&&w.push(0),u||w.push(...dn(r.annotations));for(let x of r.referenceLines??[])w.push(x.y);r.signColors&&w.push(Number(r.baseline??0));let[$,v]=nt(At(w).filter(x=>!s||x>0));return{y:s?or($,v,a):d?Xe($,v,u?Math.max(2,Math.round(o/120)):a):Xe($,v,a,{zero:r.zero??e==="area"}),x:b,sameKeys:g}}function js(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Ye(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?Go:tt)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),d=fn(c,Yt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(x=>x.series),f=r.endLabels??n.some(x=>x.series.length>1),g=d+6,m=i-(f?Math.min(i*.28,Math.max(...u.map(x=>oe(x,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,$=l.type==="number"?b>12:b>Vo(T,w,Math.max(2,Math.floor((m-g)/64)),s).length;if(l.type==="band"||!b||$)return;let v=x=>g+(l.xnum[x]-T)/(w-T)*(m-g),D=x=>oe(l.labels[x],Me);for(let x=1;;x++){let L=Array.from({length:Math.ceil(b/x)},(z,B)=>B*x);if(x>=b||L.every((z,B)=>!B||v(z)-v(L[B-1])>=(D(z)+D(L[B-1]))/2+8))return L.map(z=>({value:l.xnum[z],label:l.labels[z]}))}}function Gs(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 Vs(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${Gs(`${e}|${t}|${o}|${sn(r)}`)}`}function Ws(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 Ks={en:{intro:(e,t)=>`${We(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:"(빈 값)"}},ar=18;function qo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Is(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=zs(s,a,e.columns),{pw:c,ph:d}=Bs(s,l,e.height),u=e.scale!=="free",f=t==="scatter"?[]:o.map(C=>Jo(t,C,n,n.y,n.series,n.aggregate)),g=u?Hs(t,o,f,n,c,d):{sameKeys:!1},m=u?js(t,o,f,n,g,c,d,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",T=u&&(!b||g.sameKeys),w=u&&(b||g.x!==void 0||g.sameKeys),$=new Set(Ws(e.highlight,r)?[e.highlight].flat():[]),v=$.size>0,D=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??Vs(t,e.by,n,e.data),L=Xt(qe(n.format,e.locale),n.unit),z=Ks[e.lang],B=[],O=r.map(C=>C===""?z.blank:C);return{panels:r.map((C,F)=>{let S=o[F],k=O[F],N=F%l,H;if(t!=="scatter"){let fe=f[F],Pe=le=>fe.values.reduce((he,gt)=>he+(Number.isFinite(gt[le])?gt[le]:0),0),K=fe.keys.map((le,he)=>he).filter(le=>fe.values.some(he=>Number.isFinite(he[le]))),se=K[K.length-1];B.push({first:K.length?Pe(K[0]):NaN,last:K.length?Pe(se):NaN,total:K.reduce((le,he)=>le+Pe(he),0)}),t!=="bar"&&fe.series.length===1&&se!==void 0&&(H=L(fe.values[0][se]))}else B.push({first:NaN,last:NaN,total:S.length});let G={data:S,width:c,height:d,ariaLabel:e.title?`${e.title}, ${k}`:k,syncId:x,highlight:v?$.has(C)?D?()=>!0:void 0:"none":e.highlight,showYAxis:!T||N===0,showXAxis:!w||F+l>=a};return g.y&&(G.yDomain=g.y),g.x&&(G.xDomain=g.x),m&&(G.xTicks=m),{value:C,label:k,props:G,last:H,isPicked:$.has(C)}}),cols:l,pw:c,ph:d,isPanelPick:v,description:Us(t,e.by,O,B,i,L,z)}}function Us(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>Mo(r.map(d=>d[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let d=n.filter((u,f)=>r[f].last<r[f].first);s+=d.length?a.falling(`${d.slice(0,5).join(", ")}${d.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var we=P(ee(),1);function Xs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Ys(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 gn={threshold:.25,enoughPx:96,rootMargin:"0px"};function ei(e,t=!0){let[n,r]=(0,we.useState)({visible:!t,near:!t});return(0,we.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=Ys(a[a.length-1],gn.threshold,gn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Xs(gn.threshold),rootMargin:gn.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 Zo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function pn(e){let[t,n]=(0,we.useState)(null),[r,o]=(0,we.useState)(e??null),i=(0,we.useCallback)(a=>{n(a),a&&e===void 0&&o(Zo(a))},[e]);return Ee(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(d=>d!==null&&Math.abs(d-c)<.5?d:c),s=()=>a(Zo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let d=c[c.length-1]?.contentRect;d?a(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var Js=()=>()=>{};function dt(){return(0,we.useSyncExternalStore)(Js,()=>!0,()=>!1)}var Qo="(prefers-reduced-motion: reduce)";function bn(e="auto"){let[t,n]=(0,we.useState)(()=>Ce&&typeof window.matchMedia=="function"?window.matchMedia(Qo).matches:!1);return(0,we.useEffect)(()=>{if(e!=="auto"||!Ce||typeof window.matchMedia!="function")return;let r=window.matchMedia(Qo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var _e=P(W(),1),qs=60,Zs=420;function ti(e){let t=Ne(),n=e.chartProps??{},[,r,o]=pn(e.width),i=e.width??(o||480),a=ye(e.locale??n.locale),s=te(a),l=(0,ft.useContext)(at),c=e.title??l,d=e.chart.facetPlan,u=(0,ft.useMemo)(()=>{let w=qo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return d?d(w,n,a):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,i,e.height,c,a,s,d]),f=`${(0,ft.useId)().replace(/:/g,"")}fd`,g=bn(n.reducedMotion??"auto"),m=dt(),b=Er({motion:{enabled:n.animate!==!1&&!g&&Ce},hydrated:m},{waiting:!1,generation:0}),T=e.chart;return(0,_e.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":f,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,_e.jsx)("p",{id:f,style:nn,children:e.description??u.description}),(0,_e.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Nt,rowGap:Xo,...u.legend?{marginTop:ar}:null},children:u.panels.map((w,$)=>{let v=t.paint(w.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,_e.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...Lr(b,!1,"fade",$*qs,Zs)},children:[(0,_e.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:ir,fontSize:Yo,fontWeight:700,lineHeight:`${ir}px`,color:v},children:[(0,_e.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,_e.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,_e.jsx)(T,{...n,...w.props})]},w.value)})}),u.legend?(0,_e.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:ar},children:u.legend}):null]})}var ni=["max","min","first","last","none"];function Te(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let d=-1,u=c==="max"?-1/0:1/0;r.forEach((f,g)=>{Number.isFinite(f)&&(c==="max"?f>u:f<u)&&(u=f,d=g)}),d>=0&&i.add(d)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,d)=>{d<a&&c!==null&&c!==void 0&&e(c,d)&&i.add(d)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((d,u)=>{d===c&&i.add(u)});return i}var Se=P(ee(),1);async function Qs(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(te(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Qe(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 Qe(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Qe(i)}async function el(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 Qs(i,t.parse,o,t.locale)}return t.select&&(r=ko(r,t.select)),t.transform?t.transform(r):Ue(r)}function ri(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,Se.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Se.useState)(0),c=ye(t.locale),d=(0,Se.useRef)(t);d.current={...t,locale:c};let u=(0,Se.useRef)(e);u.current=e;let f=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",g=t.deps??[],m=JSON.stringify(g.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),b=(0,Se.useRef)(!1);(0,Se.useEffect)(()=>{let w=u.current;if(!w||!r){a(D=>D.status==="loading"?{...D,status:"idle"}:D);return}let $=new AbortController,v=!0;return b.current=!0,a(D=>({...D,data:o?D.data:[],status:"loading",error:null})),el(w,{...d.current,signal:$.signal}).then(D=>{v&&a({data:D,status:"success",error:null,updatedAt:Date.now()})}).catch(D=>{!v||$.signal.aborted||a(x=>({...x,status:"error",error:D instanceof Error?D:new Error(String(D))}))}).finally(()=>{v&&(b.current=!1)}),()=>{v=!1,b.current=!1,$.abort()}},[f,r,s,m,o]),(0,Se.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||l($=>$+1)},n);return()=>clearInterval(w)},[n,r]);let T=(0,Se.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 lr=P(W(),1),tl=["csv","svg","png"],nl=/^[=+\-@\t\r\n=+-@]/,rl=/var\(|color-mix\(/;function oi(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?Zr(e.getTime()):String(e);return`"${(nl.test(t)&&!Number.isFinite(Ie(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ol(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function il(e,t){return`\uFEFF${[t.map(oi),...e.map(r=>t.map(o=>oi(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
|
-
`}function
|
|
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?vt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(Qr,(f,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,ui.jsx)("div",{children:s},l)):null}}function mi(e,t,n=!1){let r=Be(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Ae(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 di(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 Ze(t.csv)}return null}var ki=P(ee(),1);function fi(e,t){let n=[],r=-1;for(let o=0;o<=e.length;o++){let i=o<e.length&&Number.isFinite(e[o])&&Number.isFinite(t[o]);i&&r<0?r=o:!i&&r>=0&&(o-1>r&&n.push([r,o-1]),r=-1)}return n}var re=P(ee(),1);function hi(e,t){let n=Se(e.theme),[r,o,i]=gn(e.width),a=mt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,f=pn(e.reducedMotion??"auto"),u=e.animate!==!1&&!f&&Te,d=Qo(r,e.animateOnView!==!1&&u),g=pe(e.locale),m=te(g),b=(0,re.useMemo)(()=>Je(e.format,g,t.format),[e.format,g,t.format]),T=(0,re.useCallback)(K=>Kt(K,{locale:g}),[g]),w=(0,re.useMemo)(()=>Ut(b,e.unit),[b,e.unit]),$=(0,re.useMemo)(()=>an(e.data),[e.data]),[v,D]=(0,re.useState)(null),[x,L]=(0,re.useState)(null),z=(0,re.useRef)([]),B=(0,re.useRef)(e.onHover);B.current=e.onHover;let E=(0,re.useRef)(e.onClick);E.current=e.onClick;let I=(0,re.useRef)(null),S=(0,re.useRef)(null),R=(0,re.useRef)(null),C=(0,re.useCallback)((K,le="pointer")=>{if(R.current!==K){R.current=K;let ce=K===null?null:z.current[K]??null;queueMicrotask(()=>B.current?.(ce)),S.current?.(K)}I.current=K===null?null:le,D(K),L(I.current)},[]),k=(0,re.useCallback)(K=>{I.current!=="keyboard"&&(I.current=K===null?null:"sync",D(K),L(I.current))},[]),N=(0,re.useCallback)(K=>{let le=z.current[K];le&&E.current?.(le)},[]),H=oo(e.replayKey),G=e.width!==void 0||(i??0)>0,de={enabled:u,active:d.visible&&G,near:d.near,replayKey:H,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Re=(0,re.useCallback)((K,le=1)=>v===null||v===K?le:le*.38,[v]);return{p:n,width:s,height:c,measured:G,responsive:e.width===void 0,pending:Te&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:de,fv:w,fmt:b,pct:T,locale:g,lang:m,t:m==="ko"?Ir:Or,active:v,via:x,setActive:C,click:N,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Re,sig:$,description:e.description,reduced:f,publish:S,applySync:k}}var ne=P(ee(),1);function sl(e){return 1-Math.pow(1-e,3)}function ll(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function cl(e){return e==="easeInOut"?ll:e==="linear"?t=>t:sl}function ul(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 ft(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 bn(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 gi(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 pi(e,t,n,r){if(!t||!n||t.length!==n.length)return ft(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 ft(s,n[a]))o.push(l)}return o.length===r?o:ft(e,r)}var yn=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||!bn(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),gi(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=bn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=pi(s.cur,s.parts,a.parts,c),s.vel=pi(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),gi(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=bn(s.from,s.to)&&s.vel.every(f=>Math.abs(f)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=bn(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=ft(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=cl(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=ft(s.from,c)),s.vel.length!==c&&(s.vel=ft(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let f;if(this.easing==="spring"){let u=Math.exp(-i*l),d=i*l>=8&&i*l<20,g=0;for(let m=0;m<c;m++){let b=s.from[m]-s.to[m],T=s.vel[m]+i*b;s.cur[m]=s.to[m]+(b+T*l)*u,s.curVel[m]=(s.vel[m]-i*T*l)*u,d&&g<.15&&(g=Math.max(g,Math.abs(s.cur[m]-s.to[m]),Math.abs(s.curVel[m]/i)))}f=i*l>=20||d&&g<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),d=r(u),g=ul(this.easing,u)/o;for(let m=0;m<c;m++)s.cur[m]=s.from[m]+(s.to[m]-s.from[m])*d,s.curVel[m]=(s.to[m]-s.from[m])*g;f=u>=1,s.progress=d}if(f){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Nt=new Set,xn=0;function bi(e){xn=0;let t=Array.from(Nt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Nt.delete(n)}Nt.size&&typeof requestAnimationFrame<"u"&&(xn=requestAnimationFrame(bi))}function yi(e){return Nt.add(e),!xn&&typeof requestAnimationFrame<"u"&&(xn=requestAnimationFrame(bi)),()=>{Nt.delete(e)}}function ml(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 xi(e,t){let n=(0,ne.useMemo)(()=>ml(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:f=0}=t,u=(0,ne.useRef)(null),d=(0,ne.useRef)("init"),g=(0,ne.useRef)(null),m=(0,ne.useRef)(s),b=(0,ne.useRef)(a),T=(0,ne.useRef)(!1),w=(0,ne.useRef)(0),[,$]=(0,ne.useState)(0),v=(0,ne.useRef)(null),D=(0,ne.useRef)(!0);u.current||(u.current=new yn,u.current.configure(l,c),u.current.snap(n),g.current=n);let x=u.current;if(x.configure(l,c),g.current!==n){let S=d.current,R=!Object.is(m.current,s);x.sameTargets(n)?x.refreshData(n):!r||S==="init"?x.snap(n):S==="idle"?x.hold(n):S==="running"||R?x.update(n,Ht(),f):x.snap(n),g.current=n,m.current=s}let L=(0,ne.useRef)(()=>!1);L.current=S=>{if(!D.current)return!1;let R=x.step(S);return!R&&d.current==="running"&&(d.current="done"),$(C=>(C+1)%1e9),R||(v.current=null),R};let z=(0,ne.useCallback)(()=>{if(!Te||v.current||!x.animating)return;let S=R=>L.current(R);v.current=yi(S)},[x]);Le(()=>{let S=!Object.is(b.current,a);if(b.current=a,!r){(d.current!=="done"||x.animating)&&(x.snap(g.current??n),d.current="done",$(R=>R+1));return}d.current==="init"||S&&i?(x.hold(g.current??n),d.current="idle",T.current=!1,$(R=>R+1)):S&&(T.current=!0)},[r,a]),Le(()=>{!r||!i||!T.current||(T.current=!1,x.hold(g.current??n),d.current="idle",$(S=>S+1))},[i,r]),(0,ne.useEffect)(()=>{r&&o&&d.current==="idle"&&(x.start(Ht()),w.current+=1,d.current="running",z(),$(S=>S+1))},[r,o,a,x,z]),(0,ne.useEffect)(()=>{x.animating&&z()}),(0,ne.useEffect)(()=>(D.current=!0,()=>{D.current=!1,v.current?.(),v.current=null}),[]);let B=Ht(),E=x.elapsed(B),I=r&&d.current==="idle";return{items:x.items(),get:S=>x.get(S),elapsed:I?0:E,fade:(S,R=320)=>I?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-S)/R)):1,waiting:I,animating:x.animating,generation:w.current}}var lr=P(W(),1);function wi(e,t,n,r,o){if(r)return o==="categorical"?ge(e,t,n):Wr(e,t,n);if(o==="categorical")return ge(e,t,n);let i=oe(e,"strong"),a=oe(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var se=P(ee(),1);var j=P(W(),1),dl={kind:"Bar chart",desc:(e,t,n)=>`${Ve(e,"category","categories")}${t>1?`, ${t} series (${n})`:""}`,lines:e=>`, ${e.length>1?"lines":"line"}: ${e.join(", ")}`,sides:(e,t)=>`negative ${e}, positive ${t}`},fl={en:dl,ko:{kind:"막대 차트",desc:(e,t,n)=>`${e}개 범주${t>1?`, 계열 ${t}개(${n})`:""}`,lines:e=>`, 선: ${e.join(", ")}`,sides:(e,t)=>`음수 쪽 ${e}, 양수 쪽 ${t}`}},hl=12;function kn(e){let t=e.layout??"grouped",n=t==="diverging",r=e.orientation==="horizontal"||n&&e.orientation===void 0,o=hi(e,{height:h=>r?Math.max(180,Math.min(320,h*.5)):Math.max(200,Math.min(290,h*.52)),duration:750,stagger:60}),{p:i,width:a,height:s}=o,l=(0,se.useMemo)(()=>Xe(e.data,e.x,e.y,e.series,{xType:"band",locale:o.locale,aggregate:e.aggregate}),[e.data,e.x,e.y,e.series,o.locale,e.aggregate]),c=e.negative?.join("")??"",f=(0,se.useMemo)(()=>{if(!n)return null;let h=p=>l.series.indexOf(p);return{negative:(c?c.split(""):[]).map(h).filter(p=>p>=0),neutral:e.neutral===void 0?void 0:h(e.neutral),percent:e.percent===!0}},[n,l.series,c,e.neutral,e.percent]),u=(0,se.useMemo)(()=>{let h=p=>{let M=l.keys.map((A,F)=>F).sort((A,F)=>(p[F]||0)-(p[A]||0));return{...l,keys:M.map(A=>l.keys[A]),labels:M.map(A=>l.labels[A]),xnum:M.map((A,F)=>F),values:l.values.map(A=>M.map(F=>A[F])),rows:l.rows.map(A=>M.map(F=>A[F]))}};if(f&&(e.sort==="positive"||e.sort==="negative")){let p=sn(l.values,f);return h(e.sort==="positive"?p.pos:p.neg)}return!e.sort||l.series.length!==1?l:h(l.values[0])},[l,e.sort,f]),d=u.series.length===1,g=d?"":e.hidden?.join("")??"",[m,b]=(0,se.useMemo)(()=>Wo(u,g),[u,g]),T=m.series.length,w=!!e.line?.length&&!r&&t!=="percent"&&!n,$=(0,se.useMemo)(()=>w?Xe(e.data,e.x,Array.isArray(e.line)?e.line:[e.line],void 0,{xType:"band",locale:o.locale,aggregate:e.series===void 0?e.aggregate:"mean"}):null,[w,e.data,e.x,e.line,e.series,e.aggregate,o.locale]),v=(0,se.useMemo)(()=>new Map(($?.keys??[]).map((h,p)=>[h,p])),[$]),D=(h,p)=>{let M=v.get(m.keys[p]);return $&&M!==void 0?$.values[h][M]:Number.NaN},x=(0,se.useMemo)(()=>{if(d)return $e(e.highlight,u.rows[0],u.labels,u.values[0],w?"none":"max");let h=f&&e.highlight===void 0?ln(u.series.length,f.negative,f.neutral):-1;if(h>=0)return new Set([h]);let p=u.values.map(M=>M.reduce((A,F)=>A+(Number.isFinite(F)?F:0),0));return $e(e.highlight,u.series,u.series,p,w?"none":"first")},[u,d,e.highlight,w,f]),L=(0,se.useMemo)(()=>d?Wt(i,u.keys.length,x):ge(i,u.series.length,x),[d,i,u.keys.length,x,u.series.length]),z=(0,se.useMemo)(()=>m===u?x:new Set(b.flatMap((h,p)=>x.has(h)?[p]:[])),[m,u,x,b]),B=(0,se.useMemo)(()=>m===u?L:b.map(h=>L[h]),[m,u,L,b]),[E,I]=(0,se.useMemo)(()=>{if(!f)return[null,null];let h=sn(u.values,f);return[b.length===u.series.length?h:sn(u.values,{...f,skip:new Set(u.series.flatMap((p,M)=>b.includes(M)?[]:[M]))}),h]},[f,u,b]),S=(0,se.useMemo)(()=>{let h=[],p=E?{y0:b.map(M=>E.y0[M]),y1:b.map(M=>E.y1[M])}:t==="grouped"?null:Mt(m.values,t==="percent"?"expand":"zero");return m.keys.forEach((M,A)=>{let F=[];if(m.series.forEach((O,V)=>{let Z=m.values[V][A];if(!Number.isFinite(Z))return;let Me=p?p.y0[V][A]:0,Pe=p?p.y1[V][A]:Z;F.push({key:`${M}|${O}`,k:A,s:V,cat:m.labels[A],series:O,value:Z,v0:Me,v1:Pe,sw:d?B[A]:B[V],hi:d?z.has(A):z.has(V)})}),E){F.sort((U,xt)=>Math.min(U.v0,U.v1)-Math.min(xt.v0,xt.v1));let O=Math.min(...F.map(U=>Math.min(U.v0,U.v1))),V=Math.max(...F.map(U=>Math.max(U.v0,U.v1))),Z=U=>U.v0<0&&U.v1>0,Me=F.filter(U=>!Z(U)&&U.v1<U.v0).length,Pe=0,De=0;F.forEach(U=>{U.ring=Z(U)?0:U.v1<U.v0?Me-Pe++:++De,U.endLo=Math.min(U.v0,U.v1)===O,U.endHi=Math.max(U.v0,U.v1)===V})}h.push(...F)}),h},[m,t,B,d,z,E,b]),R=I?[...I.y0.flat(),...I.y1.flat()]:S.flatMap(h=>[h.v0,h.v1]),C=r||n?void 0:e.annotations;if(t!=="percent"&&R.push(...mn(C)),$)for(let h of $.values)for(let p of h)Number.isFinite(p)&&R.push(p);let[k,N]=tt(R.length?R:[0,1]),H=r?Math.max(2,Math.round(a/120)):Math.max(2,Math.round(s/70)),G=t==="percent"?[0,100]:e.yDomain??(n&&k<N?[k,N]:Ue(k,N,H)),de=t==="percent"||n&&e.percent?h=>`${h}%`:Xt(e.format,o.locale,Math.max(Math.abs(G[0]),Math.abs(G[1]))),Re=n?h=>de(Math.abs(h)):de,K=o.showLabels&&(d||t!=="grouped"||T<=3),le=h=>t==="percent"?o.pct(h.v1-h.v0):n?e.percent?o.pct(Math.abs(h.v1-h.v0)):o.fmt(Math.abs(h.value)):o.fmt(h.value),ce=h=>e.percent?o.pct(h):o.fmt(h),he=e.showYAxis!==!1,ht=e.showXAxis!==!1,wn=r&&he?Math.min(a*.32,Math.max(...m.labels.map(h=>ie(h,11.5,600)),24)+10):0,Rt=et(G,[0,1]).ticks(r?Math.max(2,Math.round(a/130)):Math.max(2,Math.round(s/70))),gt=r?wn+6:he?dn(Rt,Re,o.locale):0,je=r?4:K?16:8,_e=r?18:22,ji=I?(r?ut(m.keys,[je,s-_e],.3,.12):ut(m.keys,[gt+4,a-2],.32,.12)).step:0,Gi=I?Math.max(0,...[...I.neg,...I.pos].map(h=>ie(ce(h),11,600))):0,_t=K&&ji>=(r?hl:Gi+4),Vi=E&&_t?m.keys.map((h,p)=>[E.neg[p]>0?ce(E.neg[p]):null,E.pos[p]>0?ce(E.pos[p]):null]):[],hr=h=>I&&_t?Math.max(0,...[I,E??I].flatMap(p=>(h?p.pos:p.neg).map(M=>M>0?ie(ce(M),11,600)+10:0))):0,Wi=r&&K&&t!=="percent"?n?hr(1):Math.max(...S.map(h=>ie(le(h),11,700)),0)+10:0,Ki=!r&&(n?_t:K)&&k<0&&(d||t==="grouped"||n)?16:0,nt=r?gt+(n?hr(0):0):gt+4,Pt=r?a-Math.max(8,Wi):a-2,q=r?ut(m.keys,[je,s-_e],.3,.12):ut(m.keys,[nt,Pt],T>1&&t==="grouped"?.24:.32,.12),Q=r?et(G,[nt,Pt]):et(G,[s-_e-Ki,je]),Ie=t==="grouped"&&T>1?ut(m.series,[0,q.bandwidth],.12,0):null,ue=Math.min(i.theme.radiusMark,(Ie?Ie.bandwidth:q.bandwidth)/4),Dt=h=>q(m.keys[h])+q.bandwidth/2,$n=h=>i.paint(cr(h)),gr=So(C),pr=gr===void 0?-1:q.index(String(gr)),br={p:i,lang:o.lang,xAt:h=>{let p=q.index(String(h));return p<0?null:q(m.keys[p])+q.bandwidth/2},half:q.step/2,edge:!0,y:Q,x0:nt,x1:Pt,top:je,bottom:s-_e,points:()=>{if(t==="percent")return[];let h=[...z][0]??0;return m.keys.map((p,M)=>{let A=d?m.values[0][M]:t==="grouped"?m.values[h][M]:m.values.reduce((F,O)=>F+(Number.isFinite(O[M])?O[M]:0),0);return{x:q(p)+(Ie?Ie(m.series[h])+Ie.bandwidth/2:q.bandwidth/2),y:Q(A)}})}},vn=h=>{let p=q(m.keys[h.k])+(Ie?Ie(h.series):0),M=Ie?Ie.bandwidth:q.bandwidth,A=Q(h.v0),F=Q(h.v1);return{pos:p,th:M,a:A,b:F}},yr=(0,se.useMemo)(()=>d&&!r&&K?new Set(tr(S.map(h=>q(m.keys[h.k])+q.bandwidth/2),S.map(le),q.bandwidth<26?10:11,4,500,new Set(S.flatMap((h,p)=>h.hi?[p]:[])))):null,[S,d,r,K,t,a,s,o.fmt]),rt=t==="grouped"||T===1,xr=(h,p,M,A,F,O,V)=>{if(T===1?yr!==null&&!yr.has(p):A<V*.8)return null;let Z={x:M+A/2,y:h.v1<h.v0||h.value<0?Math.max(F,O)+8:Math.min(F,O)-8,size:A<26?10:11},Me=Dt(h.k);return $&&Math.abs(Me-Z.x)<V/2+5&&$.series.some((Pe,De)=>Math.abs(Q(D(De,h.k))-Z.y)<Z.size/2+6)?null:Z},kr=[];K&&!r&&C?.length&&rt&&S.forEach((h,p)=>{let{pos:M,th:A,a:F,b:O}=vn(h),V=ie(le(h),11,700),Z=xr(h,p,M,A,F,O,V);Z&&kr.push({x:Z.x-V/2-1,y:Z.y-Z.size/2-1,w:V+2,h:Z.size+2})});let pt=o.motion.stagger??60,Ui=(0,se.useMemo)(()=>S.map(h=>{let p=vn(h),M=Q(Math.max(G[0],Math.min(0,G[1]))),A=h.ring===0?Q(0):p.a;return{key:h.key,to:[p.pos,p.th,p.a,p.b],from:[p.pos,p.th,t==="grouped"?M:A,t==="grouped"?M:A],enter:[p.pos,p.th,A,A],delay:h.k*pt+(h.ring??h.s)*(t==="grouped"?30:70),data:h}}),[S,a,s,G[0],G[1],pt,t,r]),Lt=xi(Ui,o.motion),bt=(0,se.useMemo)(()=>{let h=[];return $?.series.forEach((p,M)=>m.keys.forEach((A,F)=>{let O=v.get(A);O===void 0||!Number.isFinite($.values[M][O])||h.push({li:M,k:F,name:p,value:$.values[M][O],datum:$.rows[M][O]})})),h},[$,v,m]),Et=S.map((h,p)=>({datum:m.rows[h.s]?.[h.k]??null,index:p,key:h.key,label:h.cat,series:h.series||void 0,value:h.value,formatted:`${o.fv(h.value)}${t==="percent"||n&&e.percent?` (${o.pct(Math.abs(h.v1-h.v0))})`:""}`}));bt.forEach((h,p)=>Et.push({datum:h.datum,index:S.length+p,key:`${m.keys[h.k]}|${h.name}`,label:m.labels[h.k],series:h.name,value:h.value,formatted:o.fv(h.value)}));let Xi=new Map(S.map((h,p)=>[h.key,p])),wr=(0,se.useMemo)(()=>{let h=[...S,...bt].map(p=>p.k);return{keys:h.map(p=>Ko(m.keys[p])),labels:h.map(p=>m.labels[p])}},[S,bt,m]);Er(o,e.syncId,wr.keys,wr.labels);let $r=o.active!==null&&o.active>=S.length?bt[o.active-S.length]??null:null,ze=o.active!==null?$r?.k??S[o.active]?.k??null:null,Mn=null;if($&&ze!==null){let h=ze,p=S[o.active??-1],M=typeof e.y=="string"?e.y:o.t.value,A=[...m.series.map((O,V)=>({label:O||M,value:Number.isFinite(m.values[V][h])?o.fv(m.values[V][h]):"-",color:(d?B[h]:B[V]).fill,strong:p?.s===V})),...$.series.map((O,V)=>({label:O,value:Number.isFinite(D(V,h))?o.fv(D(V,h)):"-",color:$n(V),strong:$r?.li===V}))],F=[...S.filter(O=>O.k===h).map(O=>Math.min(Q(O.v0),Q(O.v1))),...$.series.map((O,V)=>Q(D(V,h))).filter(Number.isFinite)];Mn={x:Dt(h),y:Math.min(...F),title:m.labels[h],rows:A}}else if(o.active!==null&&S[o.active]){let h=S[o.active],p=vn(h),M=T>1?m.series.map((A,F)=>({label:A,value:Number.isFinite(m.values[F][h.k])?o.fv(m.values[F][h.k]):"-",color:B[F].fill,strong:F===h.s})):[{label:o.t.value,value:o.fv(h.value),color:h.sw.fill}];Mn=r?{x:Math.max(p.a,p.b),y:p.pos,title:h.cat,rows:M}:{x:p.pos+p.th/2,y:Math.min(p.a,p.b),title:h.cat,rows:M}}let yt=fl[o.lang],vr=h=>E?`${m.labels[h]}: ${yt.sides(ce(E.neg[h]),ce(E.pos[h]))}`:"",Mr=`${yt.kind}. ${yt.desc(m.keys.length,T,m.series.join(", "))}${$?yt.lines($.series):""}. ${E?m.keys.map((h,p)=>vr(p)).slice(0,8).join("; "):d?m.labels.map((h,p)=>`${h} ${o.fv(m.values[0][p])}`).slice(0,8).join(", "):""}`,Ot=E&&o.via==="keyboard"&&o.active!==null?S[o.active]:void 0,Yi=Ot?`${vr(Ot.k)}. ${Ot.series?`${Ot.series}: `:""}${Et[o.active??0].formatted} (${(o.active??0)+1}/${Et.length})`:void 0,Ji=h=>{let p=S.filter(M=>M.k===h);return[Math.min(0,...p.map(M=>Math.min(M.v0,M.v1))),Math.max(0,...p.map(M=>Math.max(M.v0,M.v1)))]},qi=e.description??(C?.length?`${Mr.trimEnd().replace(/\.?$/,".")}${Lo(C,o.lang,o.fv)}`:Mr);return(0,j.jsxs)(ao,{c:o,kind:yt.kind,ariaLabel:e.ariaLabel,description:qi,events:Et,tip:Mn,announce:Yi,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[r?(0,j.jsx)("g",{"aria-hidden":"true",children:Rt.map(h=>(0,j.jsxs)("g",{children:[(0,j.jsx)("line",{x1:Math.round(Q(h))+.5,x2:Math.round(Q(h))+.5,y1:je,y2:s-_e,stroke:i.paint(h===0?"dim":"line")}),ht?(0,j.jsx)(me,{x:Q(h),y:s-_e+11,anchor:"middle",size:we,fill:i.paint("muted"),children:Re(h)}):null]},h))}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Io,{p:i,ticks:Rt,y:Q,x0:gt,x1:a,fmt:Re,locale:o.locale,labels:he&&!n}),n&&he?(0,j.jsx)("g",{"aria-hidden":"true",children:Rt.map(h=>(0,j.jsx)(me,{x:gt-6,y:Math.round(Q(h))+.5,anchor:"end",size:we,fill:i.paint("muted"),children:Re(h)},h))}):null]}),(0,j.jsx)(_o,{list:C,g:br}),Lt.items.map(h=>{let p=h.data,[M,A,F,O]=h.v,V=Xi.get(p.key)??0,Z=p.v1<p.v0||p.value<0,Me=t==="grouped"||p.s===T-1,Pe=n?{...p.endLo&&(r?{tl:ue,bl:ue}:{bl:ue,br:ue}),...p.endHi&&(r?{tr:ue,br:ue}:{tl:ue,tr:ue})}:r?Me?Z?{tl:ue,bl:ue}:{tr:ue,br:ue}:{}:Me?Z?{bl:ue,br:ue}:{tl:ue,tr:ue}:{},De=r?Tt(Math.min(F,O),M,Math.abs(O-F),A,Pe):Tt(M,Math.min(F,O),A,Math.abs(O-F),Pe),U=Lt.fade(p.k*pt+320,260),xt=pr>=0&&p.k>=pr,Tn=xt&&rt,Cn=null,Zi=p.ring===1&&(p.v1<p.v0?p.endLo:p.endHi);if(K&&!(n&&(!_t||rt||p.ring===0||Zi))){let ot=le(p),Sn=ie(ot,11,700),Qi=Math.abs(O-F);if(rt){let It=r?null:xr(p,V,M,A,F,O,Sn);Cn=r?(0,j.jsx)(me,{x:Math.max(F,O)+6,y:M+A/2,size:11,weight:p.hi?800:500,fill:i.paint(p.hi?"ink":"muted"),opacity:U,children:ot}):It?(0,j.jsx)(me,{x:It.x,y:It.y,anchor:"middle",size:It.size,weight:p.hi?800:500,fill:i.paint(p.hi?"ink":"muted"),opacity:U,children:ot}):null}else Qi>=(r?Sn+10:16)&&(r?A>=14:A>=Sn+6)&&(Cn=(0,j.jsx)(me,{x:r?(F+O)/2:M+A/2,y:r?M+A/2:(F+O)/2,anchor:"middle",size:11,weight:700,fill:p.sw.text,opacity:U,children:ot}))}return(0,j.jsxs)("g",{className:"ztd-mark",opacity:h.exiting?.4:ze===null||ze===p.k?1:.38,onPointerEnter:ot=>o.setActive(V,ot.pointerType==="touch"?"touch":"pointer"),onClick:()=>o.click(V),style:{cursor:e.onClick?"pointer":void 0},children:[rt?r?(0,j.jsx)("rect",{x:nt,y:M,width:Math.max(0,Pt-nt),height:A,fill:"transparent"}):(0,j.jsx)("rect",{x:M,y:je,width:A,height:Math.max(0,s-_e-je),fill:"transparent"}):null,(0,j.jsx)("path",{d:De,fill:p.sw.fill,fillOpacity:xt?.42:void 0,stroke:Tn?p.sw.fill:rt?"none":i.paint("panel"),strokeWidth:Tn?1.2:1,strokeDasharray:Tn?"3 2":void 0}),o.active===V&&o.via==="keyboard"?(0,j.jsx)("path",{d:r?Tt(Math.min(F,O)-2,M-2,Math.abs(O-F)+4,A+4,4):Tt(M-2,Math.min(F,O)-2,A+4,Math.abs(O-F)+4,4),fill:"none",stroke:i.paint("ink"),strokeWidth:2}):null,Cn]},h.key)}),n?(0,j.jsxs)("g",{"aria-hidden":"true",children:[Vi.map(([h,p],M)=>{let[A,F]=Ji(M).map(Q),O=q(m.keys[M])+q.bandwidth/2,V=Lt.fade(M*pt+320,260)*(ze===null||ze===M?1:.38),Z=(Me,Pe,De)=>Me===null?null:(0,j.jsx)(me,{x:r?Pe+De*6:O,y:r?O:Pe-De*8,anchor:r?De<0?"end":"start":"middle",size:11,weight:600,fill:i.paint("ink"),opacity:V,children:Me},De);return(0,j.jsxs)("g",{children:[Z(h,A,-1),Z(p,F,1)]},m.keys[M])}),r?(0,j.jsx)("line",{x1:Math.round(Q(0))+.5,x2:Math.round(Q(0))+.5,y1:je,y2:s-_e,stroke:i.paint("ink"),strokeWidth:1.5}):(0,j.jsx)("line",{x1:nt,x2:a,y1:Math.round(Q(0))+.5,y2:Math.round(Q(0))+.5,stroke:i.paint("ink"),strokeWidth:1.5})]}):null,$?(0,j.jsxs)("g",{opacity:Lt.fade((m.keys.length-1)*pt+320,320),children:[$.series.map((h,p)=>(0,j.jsx)("path",{d:gl(m.keys.map((M,A)=>[Dt(A),Q(D(p,A))])),fill:"none",stroke:$n(p),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"},h)),bt.map((h,p)=>{let M=S.length+p,A=Dt(h.k),F=Q(h.value);return(0,j.jsxs)("g",{className:"ztd-mark",onPointerEnter:O=>o.setActive(M,O.pointerType==="touch"?"touch":"pointer"),onClick:()=>o.click(M),style:{cursor:e.onClick?"pointer":void 0},children:[(0,j.jsx)("circle",{cx:A,cy:F,r:9,fill:"transparent"}),(0,j.jsx)("circle",{cx:A,cy:F,r:o.active===M?4.5:3,fill:$n(h.li),stroke:i.paint("panel"),strokeWidth:1.5}),o.active===M&&o.via==="keyboard"?(0,j.jsx)("circle",{cx:A,cy:F,r:8,fill:"none",stroke:i.paint("ink"),strokeWidth:2}):null]},`${m.keys[h.k]}|${h.name}`)})]}):null,(0,j.jsx)(Do,{list:C,g:{...br,avoid:kr}}),r&&he?(0,j.jsx)("g",{"aria-hidden":"true",children:m.keys.map((h,p)=>{let M=d&&z.has(p);return(0,j.jsx)(me,{x:wn,y:q(h)+q.bandwidth/2,anchor:"end",size:11.5,weight:M?800:500,fill:i.paint(M?"ink":"muted"),children:Ne(m.labels[p],wn-4,11.5,M?800:500)},h)})}):null,!r&&ht?(0,j.jsx)(zo,{p:i,width:a,labels:m.labels,centers:m.keys.map(h=>q(h)+q.bandwidth/2),y:s-_e+13,strong:d?z:void 0}):null,!r&&ze!==null?(0,j.jsx)(Bo,{p:i,x:q(m.keys[ze])+q.bandwidth/2,y:s-_e+13,label:m.labels[ze],width:a}):null]})}function gl(e){let t=e.map(n=>n[1]);return fi(t,t).map(([n,r])=>$o(e.slice(n,r+1))).join("")}var cr=e=>e?"neutralStrong":"accent";var ur=P(W(),1);function $i(e,t,n,r){if(typeof e!="function")return $e(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 pl=P(ee(),1);var dr=P(W(),1),bl={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ve(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},vi={en:bl,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}일 이동평균`}},mr=["ink","muted","dim"];function Mi(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,mr.length)}var yl=P(ee(),1);var Ni=P(W(),1),xl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ve(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},kl={en:xl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ti=(e,t)=>kl[e].other(t);function Ci(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,wo(o.map(i=>i.value)))}}var Si=e=>Number.isFinite(e)&&e>0?e:0;function Ai(e,t,n,r){return r==="emphasis"?Wt(e,t,n):ge(e,t,n)}var wl=P(ee(),1);var Pi=P(W(),1);function Fi(e,t){return t===!1?e.map((n,r)=>r):ko(e)}function Ri(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return $e(e,t,t,r,"max")}function _i(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]=oe(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?oe(e,"neutral"):Vt(e,1-a/Math.max(1,o.length-1))),r}function Di(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Ae(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function Li(e,t){return wt(e,t+1,new Set)}var $l=P(ee(),1);var Oi=P(W(),1);var vl=26;var bm=vl*.62;function Ei(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!ti.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var He=P(W(),1);function Ii(e,t,n){let r=rn(e);return r?.type==="scatter"&&t?.size!==void 0&&!nn(n)?rn("bubble"):r}function Ml(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function Tl(e,t,n,r=!1){let o=Ii(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&&Yn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),f=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(f.includes(o.type)){let u=Be(i.label,"label"),d=on(i.value,"value"),g=o.type==="waffle",m=t.map((x,L)=>({r:x,label:u(x,L),value:g?d(x,L):Si(d(x,L))})),{kept:b,other:T}=g?{kept:m,other:null}:Ci(m,a.other,(x,L)=>({r:{},label:Ti(te(n),x),value:L})),w=$e(s,b.map(x=>x.r),b.map(x=>x.label),b.map(x=>x.value),g?"first":"max"),$=T?[...b,T]:b,v=We(x=>g?ge(x,$.length,w):Ai(x,$.length,w,a.colorMode)),D=g&&a.shape==="arc";return $.map((x,L)=>({label:x.label,color:v[L],...D&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Mi(Array.isArray(a.ma)?a.ma:void 0,t.length),d=vi[te(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((g,m)=>({label:d.maLegend(g),color:mr[m],shape:"line"}))]}if(o.type==="network"){let u=Di(a.groups);if(u.length<2)return[];let d=We(g=>Li(g,u.length));return u.map((g,m)=>({label:g,color:d[m],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=Be(i.group,"group"),d=Ae(t.map((m,b)=>u(m,b)).filter(Boolean));if(d.length<2)return[];let g=We(m=>wt(m,d.length,new Set));return d.map((m,b)=>({label:m,color:g[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||nn(a))return[];let u=Be(i.series,"series"),d=Ae(t.map((b,T)=>u(b,T)));if(d.length<2)return[];let g=$i(s,t,d,u),m=We(b=>wt(b,d.length,g));return c(d.map((b,T)=>({label:b,color:m[T],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",d=u?i.status:i.group;if(typeof d!="string")return[];let g=mi(t,d,u),m=We(b=>ge(b,g.length,Ei(s,g)));return c(g.map((b,T)=>({label:b,color:m[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let v=Be(i.series,"series");u=Ae(t.map((D,x)=>v(D,x)))}let d=Jn(o.type,i,a);if(d.length){let v=$e(s,u,u,u.map(()=>0),"none"),D=We(L=>ge(L,u.length,v)),x=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((L,z)=>({label:L,color:D[z]}));return[...c(x),...d.map((L,z)=>({label:L,color:cr(z),shape:"line"}))]}if(u.length<2)return[];let m=o.type==="bar"&&a.layout==="diverging"&&s===void 0?ln(u.length,Array.isArray(a.negative)?a.negative.map(v=>u.indexOf(String(v))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,b=m>=0?new Set([m]):$e(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,D)=>({label:v,color:b.has(D)?"accent":"neutralStrong",shape:"square"})));let T=a.colorMode,w=v=>ge(v,u.length,b);if((o.type==="line"||o.type==="area")&&(w=v=>wi(v,u.length,b,o.type==="area",T)),o.type==="stream"){let v=Xe(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),D=Fi(v.values,a.reorder),x=Ri(s,v.series,v.values);w=L=>_i(L,D,x)}let $=We(w);return c(u.map((v,D)=>({label:v,color:$[D],...o.type==="line"&&{shape:"line"}})))}return[]}function Cl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&mo.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Sl(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...f}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:f,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function zi(e,t){let{spec:n}=e,r=Ii(n.type,n.encoding,n.options),o=(0,Ft.useMemo)(()=>di(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=uo(n,e.locale),s=pe(a),l=te(s),c=ni(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),f=go(n),u=(0,Ft.useMemo)(()=>f?ci(f,s):void 0,[f,s]),d=n.options?.hidden,g=Array.isArray(d)?d.map(String):[],m=g.join(""),[b,T]=(0,Ft.useState)(null);if(!r)return(0,He.jsx)(Xn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let w=o??c.data,$=t[r.type],v={...n.options??{}},D={...Ml(r,n.encoding),...v,...u?{tooltip:u}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:a},x=n.card?.legend==="toggle"&&ho(r.type,n.encoding??{},v),L=b&&b.base===m?b.hidden:g;x&&(D.hidden=L);let z=R=>T(C=>{let k=C&&C.base===m?C.hidden:g;return{base:m,hidden:k.includes(R)?k.filter(N=>N!==R):[...k,R]}}),B=D.height??220,E=Cl(n,r.type),I=i&&!w.length&&(c.loading||c.error||c.empty)?(0,He.jsx)(Xn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:B,locale:a}):E?(0,He.jsx)(ei,{chart:$,...Sl(r.type,E,D)}):(0,He.jsx)($,{...D});if(n.card){let R=n.card,C=R.legend==="auto"||R.legend==="toggle"?Tl(n,w,s,x):R.legend,k=C?.length?x?(0,He.jsx)(Un,{items:C,hidden:L,onToggle:z,locale:a}):C:void 0,N=R.download?(0,He.jsx)(li,{data:w,columns:po(n),filename:R.title??r.type,formats:Array.isArray(R.download)?R.download:void 0,locale:a}):void 0;I=(0,He.jsx)(io,{number:R.number,title:R.title??co(r,l),subtitle:R.subtitle,legend:k,actions:N,source:R.source||void 0,note:R.note||void 0,accent:R.accent,takeaway:R.takeaway,level:R.level,sample:R.sample,replay:R.replay!==!1,className:e.className,locale:a,children:I})}let S=e.theme??n.theme;return S&&(I=(0,He.jsx)(qt,{theme:S,children:I})),I}function Al({cfg:e,components:t}){let n=mt();return zi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Hi(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Bi.hydrateRoot)(r,(0,fr.createElement)(qt,{theme:o.theme,cssVars:!0},(0,fr.createElement)(Al,{cfg:o,components:{[e]:t}})))}Hi("bar",kn);})();
|
|
27
|
+
`}function al(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function sr(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var ii=2,Je=16;function ai(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 si(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 li(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+Je*2,a+Je*2],c=o.cloneNode(!0),d=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((m,b)=>{let T;for(let w of Array.from(m.attributes)){if(!rl.test(w.value))continue;let $=(T??(T=getComputedStyle(m))).getPropertyValue(w.name);$&&d[b].setAttribute(w.name,ai($,u))}}),c.removeAttribute("style");for(let[m,b]of Object.entries({viewBox:`${-Je} ${-Je} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(m,String(b));let f=ai(getComputedStyle(r).backgroundColor,u),g=o.parentElement?.querySelector("canvas")??null;if(n){let m=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(si("rect",{x:-Je,y:-Je,width:s,height:l,fill:f}),m),g&&c.insertBefore(si("image",{href:g.toDataURL(),width:i,height:a}),m)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:f,canvas:g}}function sl(e,t){let n=li(e,ii,!1);if(!n)return;let r=ii,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,Je*r,Je*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&&sr(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function ci(e){let t=Ne(e.theme),n=te(ye(e.locale))==="ko",r=al(e.filename),o=(i,a)=>{if(i==="csv")return sr(new Blob([il(e.data,e.columns?.length?e.columns:ol(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return sl(a,r);let s=li(a,1,!0);s&&sr(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,lr.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:tl.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,lr.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 mi=P(W(),1);function ui(e,t=ge){let n=qe(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?Mt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(eo,(d,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,mi.jsx)("div",{children:s},l)):null}}function di(e,t,n=!1){let r=He(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Re(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 fi(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 Qe(t.csv)}return null}var wi=P(ee(),1);function hi(e,t){let n=[],r=-1;for(let o=0;o<=e.length;o++){let i=o<e.length&&Number.isFinite(e[o])&&Number.isFinite(t[o]);i&&r<0?r=o:!i&&r>=0&&(o-1>r&&n.push([r,o-1]),r=-1)}return n}var re=P(ee(),1);function gi(e,t){let n=Ne(e.theme),[r,o,i]=pn(e.width),a=dt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,d=bn(e.reducedMotion??"auto"),u=e.animate!==!1&&!d&&Ce,f=ei(r,e.animateOnView!==!1&&u),g=ye(e.locale),m=te(g),b=(0,re.useMemo)(()=>qe(e.format,g,t.format),[e.format,g,t.format]),T=(0,re.useCallback)(K=>Ut(K,{locale:g}),[g]),w=(0,re.useMemo)(()=>Xt(b,e.unit),[b,e.unit]),$=(0,re.useMemo)(()=>sn(e.data),[e.data]),[v,D]=(0,re.useState)(null),[x,L]=(0,re.useState)(null),z=(0,re.useRef)([]),B=(0,re.useRef)(e.onHover);B.current=e.onHover;let O=(0,re.useRef)(e.onClick);O.current=e.onClick;let I=(0,re.useRef)(null),C=(0,re.useRef)(null),F=(0,re.useRef)(null),S=(0,re.useCallback)((K,se="pointer")=>{if(F.current!==K){F.current=K;let le=K===null?null:z.current[K]??null;queueMicrotask(()=>B.current?.(le)),C.current?.(K)}I.current=K===null?null:se,D(K),L(I.current)},[]),k=(0,re.useCallback)(K=>{I.current!=="keyboard"&&(I.current=K===null?null:"sync",D(K),L(I.current))},[]),N=(0,re.useCallback)(K=>{let se=z.current[K];se&&O.current?.(se)},[]),H=io(e.replayKey),G=e.width!==void 0||(i??0)>0,fe={enabled:u,active:f.visible&&G,near:f.near,replayKey:H,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Pe=(0,re.useCallback)((K,se=1)=>v===null||v===K?se:se*.38,[v]);return{p:n,width:s,height:c,measured:G,responsive:e.width===void 0,pending:Ce&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:fe,fv:w,fmt:b,pct:T,locale:g,lang:m,t:m==="ko"?zr:Ir,active:v,via:x,setActive:S,click:N,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Pe,sig:$,description:e.description,reduced:d,publish:C,applySync:k}}var ne=P(ee(),1);function ll(e){return 1-Math.pow(1-e,3)}function cl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function ul(e){return e==="easeInOut"?cl:e==="linear"?t=>t:ll}function ml(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 ht(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 yn(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 pi(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 bi(e,t,n,r){if(!t||!n||t.length!==n.length)return ht(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 ht(s,n[a]))o.push(l)}return o.length===r?o:ht(e,r)}var xn=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||!yn(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),pi(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=yn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=bi(s.cur,s.parts,a.parts,c),s.vel=bi(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),pi(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=yn(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=yn(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=ht(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=ul(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=ht(s.from,c)),s.vel.length!==c&&(s.vel=ht(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let d;if(this.easing==="spring"){let u=Math.exp(-i*l),f=i*l>=8&&i*l<20,g=0;for(let m=0;m<c;m++){let b=s.from[m]-s.to[m],T=s.vel[m]+i*b;s.cur[m]=s.to[m]+(b+T*l)*u,s.curVel[m]=(s.vel[m]-i*T*l)*u,f&&g<.15&&(g=Math.max(g,Math.abs(s.cur[m]-s.to[m]),Math.abs(s.curVel[m]/i)))}d=i*l>=20||f&&g<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),f=r(u),g=ml(this.easing,u)/o;for(let m=0;m<c;m++)s.cur[m]=s.from[m]+(s.to[m]-s.from[m])*f,s.curVel[m]=(s.to[m]-s.from[m])*g;d=u>=1,s.progress=f}if(d){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&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}},Rt=new Set,kn=0;function yi(e){kn=0;let t=Array.from(Rt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Rt.delete(n)}Rt.size&&typeof requestAnimationFrame<"u"&&(kn=requestAnimationFrame(yi))}function xi(e){return Rt.add(e),!kn&&typeof requestAnimationFrame<"u"&&(kn=requestAnimationFrame(yi)),()=>{Rt.delete(e)}}function dl(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 ki(e,t){let n=(0,ne.useMemo)(()=>dl(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:d=0}=t,u=(0,ne.useRef)(null),f=(0,ne.useRef)("init"),g=(0,ne.useRef)(null),m=(0,ne.useRef)(s),b=(0,ne.useRef)(a),T=(0,ne.useRef)(!1),w=(0,ne.useRef)(0),[,$]=(0,ne.useState)(0),v=(0,ne.useRef)(null),D=(0,ne.useRef)(!0);u.current||(u.current=new xn,u.current.configure(l,c),u.current.snap(n),g.current=n);let x=u.current;if(x.configure(l,c),g.current!==n){let C=f.current,F=!Object.is(m.current,s);x.sameTargets(n)?x.refreshData(n):!r||C==="init"?x.snap(n):C==="idle"?x.hold(n):C==="running"||F?x.update(n,jt(),d):x.snap(n),g.current=n,m.current=s}let L=(0,ne.useRef)(()=>!1);L.current=C=>{if(!D.current)return!1;let F=x.step(C);return!F&&f.current==="running"&&(f.current="done"),$(S=>(S+1)%1e9),F||(v.current=null),F};let z=(0,ne.useCallback)(()=>{if(!Ce||v.current||!x.animating)return;let C=F=>L.current(F);v.current=xi(C)},[x]);Ee(()=>{let C=!Object.is(b.current,a);if(b.current=a,!r){(f.current!=="done"||x.animating)&&(x.snap(g.current??n),f.current="done",$(F=>F+1));return}f.current==="init"||C&&i?(x.hold(g.current??n),f.current="idle",T.current=!1,$(F=>F+1)):C&&(T.current=!0)},[r,a]),Ee(()=>{!r||!i||!T.current||(T.current=!1,x.hold(g.current??n),f.current="idle",$(C=>C+1))},[i,r]),(0,ne.useEffect)(()=>{r&&o&&f.current==="idle"&&(x.start(jt()),w.current+=1,f.current="running",z(),$(C=>C+1))},[r,o,a,x,z]),(0,ne.useEffect)(()=>{x.animating&&z()}),(0,ne.useEffect)(()=>(D.current=!0,()=>{D.current=!1,v.current?.(),v.current=null}),[]);let B=jt(),O=x.elapsed(B),I=r&&f.current==="idle";return{items:x.items(),get:C=>x.get(C),elapsed:I?0:O,fade:(C,F=320)=>I?0:Number.isFinite(O)?Math.max(0,Math.min(1,(O-C)/F)):1,waiting:I,animating:x.animating,generation:w.current}}var cr=P(W(),1);function $i(e,t,n,r,o){if(r)return o==="categorical"?be(e,t,n):Kr(e,t,n);if(o==="categorical")return be(e,t,n);let i=ie(e,"strong"),a=ie(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var ae=P(ee(),1);var j=P(W(),1),fl={kind:"Bar chart",desc:(e,t,n)=>`${We(e,"category","categories")}${t>1?`, ${t} series (${n})`:""}`,lines:e=>`, ${e.length>1?"lines":"line"}: ${e.join(", ")}`,sides:(e,t)=>`negative ${e}, positive ${t}`},hl={en:fl,ko:{kind:"막대 차트",desc:(e,t,n)=>`${e}개 범주${t>1?`, 계열 ${t}개(${n})`:""}`,lines:e=>`, 선: ${e.join(", ")}`,sides:(e,t)=>`음수 쪽 ${e}, 양수 쪽 ${t}`}},gl=12;function wn(e){let t=e.layout??"grouped",n=t==="diverging",r=e.orientation==="horizontal"||n&&e.orientation===void 0,o=gi(e,{height:h=>r?Math.max(180,Math.min(320,h*.5)):Math.max(200,Math.min(290,h*.52)),duration:750,stagger:60}),{p:i,width:a,height:s}=o,l=(0,ae.useMemo)(()=>Ye(e.data,e.x,e.y,e.series,{xType:"band",locale:o.locale,aggregate:e.aggregate}),[e.data,e.x,e.y,e.series,o.locale,e.aggregate]),c=e.negative?.join("")??"",d=(0,ae.useMemo)(()=>{if(!n)return null;let h=p=>l.series.indexOf(p);return{negative:(c?c.split(""):[]).map(h).filter(p=>p>=0),neutral:e.neutral===void 0?void 0:h(e.neutral),percent:e.percent===!0}},[n,l.series,c,e.neutral,e.percent]),u=(0,ae.useMemo)(()=>{let h=p=>{let M=l.keys.map((A,R)=>R).sort((A,R)=>(p[R]||0)-(p[A]||0));return{...l,keys:M.map(A=>l.keys[A]),labels:M.map(A=>l.labels[A]),xnum:M.map((A,R)=>R),values:l.values.map(A=>M.map(R=>A[R])),rows:l.rows.map(A=>M.map(R=>A[R]))}};if(d&&(e.sort==="positive"||e.sort==="negative")){let p=ln(l.values,d);return h(e.sort==="positive"?p.pos:p.neg)}return!e.sort||l.series.length!==1?l:h(l.values[0])},[l,e.sort,d]),f=u.series.length===1,g=f?"":e.hidden?.join("")??"",[m,b]=(0,ae.useMemo)(()=>Ko(u,g),[u,g]),T=m.series.length,w=!!e.line?.length&&!r&&t!=="percent"&&!n,$=(0,ae.useMemo)(()=>w?Ye(e.data,e.x,Array.isArray(e.line)?e.line:[e.line],void 0,{xType:"band",locale:o.locale,aggregate:e.series===void 0?e.aggregate:"mean"}):null,[w,e.data,e.x,e.line,e.series,e.aggregate,o.locale]),v=(0,ae.useMemo)(()=>new Map(($?.keys??[]).map((h,p)=>[h,p])),[$]),D=(h,p)=>{let M=v.get(m.keys[p]);return $&&M!==void 0?$.values[h][M]:Number.NaN},x=(0,ae.useMemo)(()=>{if(f)return Te(e.highlight,u.rows[0],u.labels,u.values[0],w?"none":"max");let h=d&&e.highlight===void 0?cn(u.series.length,d.negative,d.neutral):-1;if(h>=0)return new Set([h]);let p=u.values.map(M=>M.reduce((A,R)=>A+(Number.isFinite(R)?R:0),0));return Te(e.highlight,u.series,u.series,p,w?"none":"first")},[u,f,e.highlight,w,d]),L=(0,ae.useMemo)(()=>f?Kt(i,u.keys.length,x):be(i,u.series.length,x),[f,i,u.keys.length,x,u.series.length]),z=(0,ae.useMemo)(()=>m===u?x:new Set(b.flatMap((h,p)=>x.has(h)?[p]:[])),[m,u,x,b]),B=(0,ae.useMemo)(()=>m===u?L:b.map(h=>L[h]),[m,u,L,b]),[O,I]=(0,ae.useMemo)(()=>{if(!d)return[null,null];let h=ln(u.values,d);return[b.length===u.series.length?h:ln(u.values,{...d,skip:new Set(u.series.flatMap((p,M)=>b.includes(M)?[]:[M]))}),h]},[d,u,b]),C=(0,ae.useMemo)(()=>{let h=[],p=O?{y0:b.map(M=>O.y0[M]),y1:b.map(M=>O.y1[M])}:t==="grouped"?null:Tt(m.values,t==="percent"?"expand":"zero");return m.keys.forEach((M,A)=>{let R=[];if(m.series.forEach((E,V)=>{let Q=m.values[V][A];if(!Number.isFinite(Q))return;let pe=p?p.y0[V][A]:0,$e=p?p.y1[V][A]:Q;R.push({key:`${M}|${E}`,k:A,s:V,cat:m.labels[A],series:E,value:Q,v0:pe,v1:$e,sw:f?B[A]:B[V],hi:f?z.has(A):z.has(V)})}),O){R.sort((U,kt)=>Math.min(U.v0,U.v1)-Math.min(kt.v0,kt.v1));let E=Math.min(...R.map(U=>Math.min(U.v0,U.v1))),V=Math.max(...R.map(U=>Math.max(U.v0,U.v1))),Q=U=>U.v0<0&&U.v1>0,pe=R.filter(U=>!Q(U)&&U.v1<U.v0).length,$e=0,Le=0;R.forEach(U=>{U.ring=Q(U)?0:U.v1<U.v0?pe-$e++:++Le,U.endLo=Math.min(U.v0,U.v1)===E,U.endHi=Math.max(U.v0,U.v1)===V})}h.push(...R)}),h},[m,t,B,f,z,O,b]),F=I?[...I.y0.flat(),...I.y1.flat()]:C.flatMap(h=>[h.v0,h.v1]),S=r||n?void 0:e.annotations;if(t!=="percent"&&F.push(...dn(S)),$)for(let h of $.values)for(let p of h)Number.isFinite(p)&&F.push(p);let[k,N]=nt(F.length?F:[0,1]),H=r?Math.max(2,Math.round(a/120)):Math.max(2,Math.round(s/70)),G=t==="percent"?[0,100]:e.yDomain??(n&&k<N?[k,N]:Xe(k,N,H)),fe=t==="percent"||n&&e.percent?h=>`${h}%`:Yt(e.format,o.locale,Math.max(Math.abs(G[0]),Math.abs(G[1]))),Pe=n?h=>fe(Math.abs(h)):fe,K=o.showLabels&&(f||t!=="grouped"||T<=3),se=h=>t==="percent"?o.pct(h.v1-h.v0):n?e.percent?o.pct(Math.abs(h.v1-h.v0)):o.fmt(Math.abs(h.value)):o.fmt(h.value),le=h=>e.percent?o.pct(h):o.fmt(h),he=e.showYAxis!==!1,gt=e.showXAxis!==!1,me=d&&r&&he&&e.centerLabels===!0&&(d.neutral??-1)<0?Math.min(a*.34,Math.max(0,...m.labels.map(h=>oe(h,11.5,600)))+16):0,$n=r&&he&&!me?Math.min(a*.32,Math.max(...m.labels.map(h=>oe(h,11.5,600)),24)+10):0,_t=tt(G,[0,1]).ticks(r?Math.max(2,Math.round(a/130)):Math.max(2,Math.round(s/70))),pt=r?$n+6:he?fn(_t,Pe,o.locale):0,Ge=r?4:K?16:8,De=r?18:22,Gi=I?(r?mt(m.keys,[Ge,s-De],.3,.12):mt(m.keys,[pt+4,a-2],.32,.12)).step:0,Vi=I?Math.max(0,...[...I.neg,...I.pos].map(h=>oe(le(h),11,600))):0,Pt=K&&Gi>=(r?gl:Vi+4),Wi=O&&Pt?m.keys.map((h,p)=>[O.neg[p]>0?le(O.neg[p]):null,O.pos[p]>0?le(O.pos[p]):null]):[],gr=h=>I&&Pt?Math.max(0,...[I,O??I].flatMap(p=>(h?p.pos:p.neg).map(M=>M>0?oe(le(M),11,600)+10:0))):0,Ki=r&&K&&t!=="percent"?n?gr(1):Math.max(...C.map(h=>oe(se(h),11,700)),0)+10:0,Ui=!r&&(n?Pt:K)&&k<0&&(f||t==="grouped"||n)?16:0,rt=r?pt+(n?gr(0):0):pt+4,Dt=r?a-Math.max(8,Ki):a-2,q=r?mt(m.keys,[Ge,s-De],.3,.12):mt(m.keys,[rt,Dt],T>1&&t==="grouped"?.24:.32,.12),Z=r?tt(G,[rt,Dt-me]):tt(G,[s-De-Ui,Ge]),ze=t==="grouped"&&T>1?mt(m.series,[0,q.bandwidth],.12,0):null,ce=Math.min(i.theme.radiusMark,(ze?ze.bandwidth:q.bandwidth)/4),Lt=h=>q(m.keys[h])+q.bandwidth/2,vn=h=>i.paint(ur(h)),pr=Ao(S),br=pr===void 0?-1:q.index(String(pr)),yr={p:i,lang:o.lang,xAt:h=>{let p=q.index(String(h));return p<0?null:q(m.keys[p])+q.bandwidth/2},half:q.step/2,edge:!0,y:Z,x0:rt,x1:Dt,top:Ge,bottom:s-De,points:()=>{if(t==="percent")return[];let h=[...z][0]??0;return m.keys.map((p,M)=>{let A=f?m.values[0][M]:t==="grouped"?m.values[h][M]:m.values.reduce((R,E)=>R+(Number.isFinite(E[M])?E[M]:0),0);return{x:q(p)+(ze?ze(m.series[h])+ze.bandwidth/2:q.bandwidth/2),y:Z(A)}})}},Mn=h=>{let p=q(m.keys[h.k])+(ze?ze(h.series):0),M=ze?ze.bandwidth:q.bandwidth,A=me&&h.value>=0&&!d?.negative.includes(b[h.s])?me:0,R=Z(h.v0)+A,E=Z(h.v1)+A;return{pos:p,th:M,a:R,b:E}},xr=(0,ae.useMemo)(()=>f&&!r&&K?new Set(nr(C.map(h=>q(m.keys[h.k])+q.bandwidth/2),C.map(se),q.bandwidth<26?10:11,4,500,new Set(C.flatMap((h,p)=>h.hi?[p]:[])))):null,[C,f,r,K,t,a,s,o.fmt]),ot=t==="grouped"||T===1,kr=(h,p,M,A,R,E,V)=>{if(T===1?xr!==null&&!xr.has(p):A<V*.8)return null;let Q={x:M+A/2,y:h.v1<h.v0||h.value<0?Math.max(R,E)+8:Math.min(R,E)-8,size:A<26?10:11},pe=Lt(h.k);return $&&Math.abs(pe-Q.x)<V/2+5&&$.series.some(($e,Le)=>Math.abs(Z(D(Le,h.k))-Q.y)<Q.size/2+6)?null:Q},wr=[];K&&!r&&S?.length&&ot&&C.forEach((h,p)=>{let{pos:M,th:A,a:R,b:E}=Mn(h),V=oe(se(h),11,700),Q=kr(h,p,M,A,R,E,V);Q&&wr.push({x:Q.x-V/2-1,y:Q.y-Q.size/2-1,w:V+2,h:Q.size+2})});let bt=o.motion.stagger??60,Xi=(0,ae.useMemo)(()=>C.map(h=>{let p=Mn(h),M=Z(Math.max(G[0],Math.min(0,G[1]))),A=h.ring===0?Z(0):p.a;return{key:h.key,to:[p.pos,p.th,p.a,p.b],from:[p.pos,p.th,t==="grouped"?M:A,t==="grouped"?M:A],enter:[p.pos,p.th,A,A],delay:h.k*bt+(h.ring??h.s)*(t==="grouped"?30:70),data:h}}),[C,a,s,G[0],G[1],bt,t,r,me]),Et=ki(Xi,o.motion),yt=(0,ae.useMemo)(()=>{let h=[];return $?.series.forEach((p,M)=>m.keys.forEach((A,R)=>{let E=v.get(A);E===void 0||!Number.isFinite($.values[M][E])||h.push({li:M,k:R,name:p,value:$.values[M][E],datum:$.rows[M][E]})})),h},[$,v,m]),Ot=C.map((h,p)=>({datum:m.rows[h.s]?.[h.k]??null,index:p,key:h.key,label:h.cat,series:h.series||void 0,value:h.value,formatted:`${o.fv(h.value)}${t==="percent"||n&&e.percent?` (${o.pct(Math.abs(h.v1-h.v0))})`:""}`}));yt.forEach((h,p)=>Ot.push({datum:h.datum,index:C.length+p,key:`${m.keys[h.k]}|${h.name}`,label:m.labels[h.k],series:h.name,value:h.value,formatted:o.fv(h.value)}));let Yi=new Map(C.map((h,p)=>[h.key,p])),$r=(0,ae.useMemo)(()=>{let h=[...C,...yt].map(p=>p.k);return{keys:h.map(p=>Uo(m.keys[p])),labels:h.map(p=>m.labels[p])}},[C,yt,m]);Or(o,e.syncId,$r.keys,$r.labels);let vr=o.active!==null&&o.active>=C.length?yt[o.active-C.length]??null:null,Be=o.active!==null?vr?.k??C[o.active]?.k??null:null,Tn=null;if($&&Be!==null){let h=Be,p=C[o.active??-1],M=typeof e.y=="string"?e.y:o.t.value,A=[...m.series.map((E,V)=>({label:E||M,value:Number.isFinite(m.values[V][h])?o.fv(m.values[V][h]):"-",color:(f?B[h]:B[V]).fill,strong:p?.s===V})),...$.series.map((E,V)=>({label:E,value:Number.isFinite(D(V,h))?o.fv(D(V,h)):"-",color:vn(V),strong:vr?.li===V}))],R=[...C.filter(E=>E.k===h).map(E=>Math.min(Z(E.v0),Z(E.v1))),...$.series.map((E,V)=>Z(D(V,h))).filter(Number.isFinite)];Tn={x:Lt(h),y:Math.min(...R),title:m.labels[h],rows:A}}else if(o.active!==null&&C[o.active]){let h=C[o.active],p=Mn(h),M=T>1?m.series.map((A,R)=>({label:A,value:Number.isFinite(m.values[R][h.k])?o.fv(m.values[R][h.k]):"-",color:B[R].fill,strong:R===h.s})):[{label:o.t.value,value:o.fv(h.value),color:h.sw.fill}];Tn=r?{x:Math.max(p.a,p.b),y:p.pos,title:h.cat,rows:M}:{x:p.pos+p.th/2,y:Math.min(p.a,p.b),title:h.cat,rows:M}}let xt=hl[o.lang],Mr=h=>O?`${m.labels[h]}: ${xt.sides(le(O.neg[h]),le(O.pos[h]))}`:"",Tr=`${xt.kind}. ${xt.desc(m.keys.length,T,m.series.join(", "))}${$?xt.lines($.series):""}. ${O?m.keys.map((h,p)=>Mr(p)).slice(0,8).join("; "):f?m.labels.map((h,p)=>`${h} ${o.fv(m.values[0][p])}`).slice(0,8).join(", "):""}`,It=O&&o.via==="keyboard"&&o.active!==null?C[o.active]:void 0,Ji=It?`${Mr(It.k)}. ${It.series?`${It.series}: `:""}${Ot[o.active??0].formatted} (${(o.active??0)+1}/${Ot.length})`:void 0,qi=h=>{let p=C.filter(M=>M.k===h);return[Math.min(0,...p.map(M=>Math.min(M.v0,M.v1))),Math.max(0,...p.map(M=>Math.max(M.v0,M.v1)))]},Zi=e.description??(S?.length?`${Tr.trimEnd().replace(/\.?$/,".")}${Eo(S,o.lang,o.fv)}`:Tr);return(0,j.jsxs)(so,{c:o,kind:xt.kind,ariaLabel:e.ariaLabel,description:Zi,events:Ot,tip:Tn,announce:Ji,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[r?(0,j.jsx)("g",{"aria-hidden":"true",children:_t.flatMap(h=>(me&&!h?[Z(0),Z(0)+me]:[Z(h)+(h>0?me:0)]).map((p,M)=>[h,p,M])).map(([h,p,M])=>(0,j.jsxs)("g",{children:[(0,j.jsx)("line",{x1:Math.round(p)+.5,x2:Math.round(p)+.5,y1:Ge,y2:s-De,stroke:i.paint(h===0?"dim":"line")}),gt?(0,j.jsx)(de,{x:p,y:s-De+11,anchor:"middle",size:Me,fill:i.paint("muted"),children:Pe(h)}):null]},`${h}:${M}`))}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(zo,{p:i,ticks:_t,y:Z,x0:pt,x1:a,fmt:Pe,locale:o.locale,labels:he&&!n}),n&&he?(0,j.jsx)("g",{"aria-hidden":"true",children:_t.map(h=>(0,j.jsx)(de,{x:pt-6,y:Math.round(Z(h))+.5,anchor:"end",size:Me,fill:i.paint("muted"),children:Pe(h)},h))}):null]}),(0,j.jsx)(Po,{list:S,g:yr}),Et.items.map(h=>{let p=h.data,[M,A,R,E]=h.v,V=Yi.get(p.key)??0,Q=p.v1<p.v0||p.value<0,pe=t==="grouped"||p.s===T-1,$e=n?{...p.endLo&&(r?{tl:ce,bl:ce}:{bl:ce,br:ce}),...p.endHi&&(r?{tr:ce,br:ce}:{tl:ce,tr:ce})}:r?pe?Q?{tl:ce,bl:ce}:{tr:ce,br:ce}:{}:pe?Q?{bl:ce,br:ce}:{tl:ce,tr:ce}:{},Le=r?St(Math.min(R,E),M,Math.abs(E-R),A,$e):St(M,Math.min(R,E),A,Math.abs(E-R),$e),U=Et.fade(p.k*bt+320,260),kt=br>=0&&p.k>=br,Sn=kt&&ot,Cn=null,Qi=p.ring===1&&(p.v1<p.v0?p.endLo:p.endHi);if(K&&!(n&&(!Pt||ot||p.ring===0||Qi))){let it=se(p),An=oe(it,11,700),ea=Math.abs(E-R);if(ot){let zt=r?null:kr(p,V,M,A,R,E,An);Cn=r?(0,j.jsx)(de,{x:Math.max(R,E)+6,y:M+A/2,size:11,weight:p.hi?800:500,fill:i.paint(p.hi?"ink":"muted"),opacity:U,children:it}):zt?(0,j.jsx)(de,{x:zt.x,y:zt.y,anchor:"middle",size:zt.size,weight:p.hi?800:500,fill:i.paint(p.hi?"ink":"muted"),opacity:U,children:it}):null}else ea>=(r?An+10:16)&&(r?A>=14:A>=An+6)&&(Cn=(0,j.jsx)(de,{x:r?(R+E)/2:M+A/2,y:r?M+A/2:(R+E)/2,anchor:"middle",size:11,weight:700,fill:p.sw.text,opacity:U,children:it}))}return(0,j.jsxs)("g",{className:"ztd-mark",opacity:h.exiting?.4:Be===null||Be===p.k?1:.38,onPointerEnter:it=>o.setActive(V,it.pointerType==="touch"?"touch":"pointer"),onClick:()=>o.click(V),style:{cursor:e.onClick?"pointer":void 0},children:[ot?r?(0,j.jsx)("rect",{x:rt,y:M,width:Math.max(0,Dt-rt),height:A,fill:"transparent"}):(0,j.jsx)("rect",{x:M,y:Ge,width:A,height:Math.max(0,s-De-Ge),fill:"transparent"}):null,(0,j.jsx)("path",{d:Le,fill:p.sw.fill,fillOpacity:kt?.42:void 0,stroke:Sn?p.sw.fill:ot?"none":i.paint("panel"),strokeWidth:Sn?1.2:1,strokeDasharray:Sn?"3 2":void 0}),o.active===V&&o.via==="keyboard"?(0,j.jsx)("path",{d:r?St(Math.min(R,E)-2,M-2,Math.abs(E-R)+4,A+4,4):St(M-2,Math.min(R,E)-2,A+4,Math.abs(E-R)+4,4),fill:"none",stroke:i.paint("ink"),strokeWidth:2}):null,Cn]},h.key)}),n?(0,j.jsxs)("g",{"aria-hidden":"true",children:[Wi.map(([h,p],M)=>{let[A,R]=qi(M).map((pe,$e)=>Z(pe)+$e*me),E=q(m.keys[M])+q.bandwidth/2,V=Et.fade(M*bt+320,260)*(Be===null||Be===M?1:.38),Q=(pe,$e,Le)=>pe===null?null:(0,j.jsx)(de,{x:r?$e+Le*6:E,y:r?E:$e-Le*8,anchor:r?Le<0?"end":"start":"middle",size:11,weight:600,fill:i.paint("ink"),opacity:V,children:pe},Le);return(0,j.jsxs)("g",{children:[Q(h,A,-1),Q(p,R,1)]},m.keys[M])}),me?null:r?(0,j.jsx)("line",{x1:Math.round(Z(0))+.5,x2:Math.round(Z(0))+.5,y1:Ge,y2:s-De,stroke:i.paint("ink"),strokeWidth:1.5}):(0,j.jsx)("line",{x1:rt,x2:a,y1:Math.round(Z(0))+.5,y2:Math.round(Z(0))+.5,stroke:i.paint("ink"),strokeWidth:1.5})]}):null,$?(0,j.jsxs)("g",{opacity:Et.fade((m.keys.length-1)*bt+320,320),children:[$.series.map((h,p)=>(0,j.jsx)("path",{d:pl(m.keys.map((M,A)=>[Lt(A),Z(D(p,A))])),fill:"none",stroke:vn(p),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"},h)),yt.map((h,p)=>{let M=C.length+p,A=Lt(h.k),R=Z(h.value);return(0,j.jsxs)("g",{className:"ztd-mark",onPointerEnter:E=>o.setActive(M,E.pointerType==="touch"?"touch":"pointer"),onClick:()=>o.click(M),style:{cursor:e.onClick?"pointer":void 0},children:[(0,j.jsx)("circle",{cx:A,cy:R,r:9,fill:"transparent"}),(0,j.jsx)("circle",{cx:A,cy:R,r:o.active===M?4.5:3,fill:vn(h.li),stroke:i.paint("panel"),strokeWidth:1.5}),o.active===M&&o.via==="keyboard"?(0,j.jsx)("circle",{cx:A,cy:R,r:8,fill:"none",stroke:i.paint("ink"),strokeWidth:2}):null]},`${m.keys[h.k]}|${h.name}`)})]}):null,(0,j.jsx)(Lo,{list:S,g:{...yr,avoid:wr}}),r&&he?(0,j.jsx)("g",{"aria-hidden":"true",children:m.keys.map((h,p)=>{let M=f&&z.has(p);return(0,j.jsx)(de,{x:me?Z(0)+me/2:$n,y:q(h)+q.bandwidth/2,anchor:me?"middle":"end",size:11.5,weight:M?800:500,fill:i.paint(M?"ink":"muted"),children:Fe(m.labels[p],me?me-16:$n-4,11.5,M?800:500)},h)})}):null,!r&>?(0,j.jsx)(Bo,{p:i,width:a,labels:m.labels,centers:m.keys.map(h=>q(h)+q.bandwidth/2),y:s-De+13,strong:f?z:void 0}):null,!r&&Be!==null?(0,j.jsx)(Ho,{p:i,x:q(m.keys[Be])+q.bandwidth/2,y:s-De+13,label:m.labels[Be],width:a}):null]})}function pl(e){let t=e.map(n=>n[1]);return hi(t,t).map(([n,r])=>vo(e.slice(n,r+1))).join("")}var ur=e=>e?"neutralStrong":"accent";var mr=P(W(),1);function vi(e,t,n,r){if(typeof e!="function")return Te(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 bl=P(ee(),1);var fr=P(W(),1),yl={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}, ${We(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Mi={en:yl,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}일 이동평균`}},dr=["ink","muted","dim"];function Ti(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,dr.length)}var xl=P(ee(),1);var Ri=P(W(),1),kl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${We(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},wl={en:kl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Si=(e,t)=>wl[e].other(t);function Ci(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,$o(o.map(i=>i.value)))}}var Ai=e=>Number.isFinite(e)&&e>0?e:0;function Ni(e,t,n,r){return r==="emphasis"?Kt(e,t,n):be(e,t,n)}var $l=P(ee(),1);var Di=P(W(),1);function Fi(e,t){return t===!1?e.map((n,r)=>r):wo(e)}function _i(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return Te(e,t,t,r,"max")}function Pi(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]=ie(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?ie(e,"neutral"):Wt(e,1-a/Math.max(1,o.length-1))),r}function Li(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Re(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function Ei(e,t){return $t(e,t+1,new Set)}var vl=P(ee(),1);var Ii=P(W(),1);var Ml=26;var ym=Ml*.62;function Oi(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!ni.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var je=P(W(),1);function zi(e,t,n){let r=on(e);return r?.type==="scatter"&&t?.size!==void 0&&!rn(n)?on("bubble"):r}function Tl(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 Sl(e,t,n,r=!1){let o=zi(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&&Jn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(f=>!l.has(f.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(d.includes(o.type)){let u=He(i.label,"label"),f=an(i.value,"value"),g=o.type==="waffle",m=t.map((x,L)=>({r:x,label:u(x,L),value:g?f(x,L):Ai(f(x,L))})),{kept:b,other:T}=g?{kept:m,other:null}:Ci(m,a.other,(x,L)=>({r:{},label:Si(te(n),x),value:L})),w=Te(s,b.map(x=>x.r),b.map(x=>x.label),b.map(x=>x.value),g?"first":"max"),$=T?[...b,T]:b,v=Ke(x=>g?be(x,$.length,w):Ni(x,$.length,w,a.colorMode)),D=g&&a.shape==="arc";return $.map((x,L)=>({label:x.label,color:v[L],...D&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Ti(Array.isArray(a.ma)?a.ma:void 0,t.length),f=Mi[te(n)];return[{label:f.up,color:a.upColor??"accent"},{label:f.down,color:a.downColor??"neutralStrong"},...u.map((g,m)=>({label:f.maLegend(g),color:dr[m],shape:"line"}))]}if(o.type==="network"){let u=Li(a.groups);if(u.length<2)return[];let f=Ke(g=>Ei(g,u.length));return u.map((g,m)=>({label:g,color:f[m],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=He(i.group,"group"),f=Re(t.map((m,b)=>u(m,b)).filter(Boolean));if(f.length<2)return[];let g=Ke(m=>$t(m,f.length,new Set));return f.map((m,b)=>({label:m,color:g[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||rn(a))return[];let u=He(i.series,"series"),f=Re(t.map((b,T)=>u(b,T)));if(f.length<2)return[];let g=vi(s,t,f,u),m=Ke(b=>$t(b,f.length,g));return c(f.map((b,T)=>({label:b,color:m[T],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",f=u?i.status:i.group;if(typeof f!="string")return[];let g=di(t,f,u),m=Ke(b=>be(b,g.length,Oi(s,g)));return c(g.map((b,T)=>({label:b,color:m[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let v=He(i.series,"series");u=Re(t.map((D,x)=>v(D,x)))}let f=qn(o.type,i,a);if(f.length){let v=Te(s,u,u,u.map(()=>0),"none"),D=Ke(L=>be(L,u.length,v)),x=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((L,z)=>({label:L,color:D[z]}));return[...c(x),...f.map((L,z)=>({label:L,color:ur(z),shape:"line"}))]}if(u.length<2)return[];let m=o.type==="bar"&&a.layout==="diverging"&&s===void 0?cn(u.length,Array.isArray(a.negative)?a.negative.map(v=>u.indexOf(String(v))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,b=m>=0?new Set([m]):Te(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,D)=>({label:v,color:b.has(D)?"accent":"neutralStrong",shape:"square"})));let T=a.colorMode,w=v=>be(v,u.length,b);if((o.type==="line"||o.type==="area")&&(w=v=>$i(v,u.length,b,o.type==="area",T)),o.type==="stream"){let v=Ye(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),D=Fi(v.values,a.reorder),x=_i(s,v.series,v.values);w=L=>Pi(L,D,x)}let $=Ke(w);return c(u.map((v,D)=>({label:v,color:$[D],...o.type==="line"&&{shape:"line"}})))}return[]}function Cl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&fo.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Al(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function Bi(e,t){let{spec:n}=e,r=zi(n.type,n.encoding,n.options),o=(0,Ft.useMemo)(()=>fi(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=mo(n,e.locale),s=ye(a),l=te(s),c=ri(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),d=po(n),u=(0,Ft.useMemo)(()=>d?ui(d,s):void 0,[d,s]),f=n.options?.hidden,g=Array.isArray(f)?f.map(String):[],m=g.join(""),[b,T]=(0,Ft.useState)(null);if(!r)return(0,je.jsx)(Yn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let w=o??c.data,$=t[r.type],v={...n.options??{}},D={...Tl(r,n.encoding),...v,...u?{tooltip:u}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:a},x=n.card?.legend==="toggle"&&go(r.type,n.encoding??{},v),L=b&&b.base===m?b.hidden:g;x&&(D.hidden=L);let z=F=>T(S=>{let k=S&&S.base===m?S.hidden:g;return{base:m,hidden:k.includes(F)?k.filter(N=>N!==F):[...k,F]}}),B=D.height??220,O=Cl(n,r.type),I=i&&!w.length&&(c.loading||c.error||c.empty)?(0,je.jsx)(Yn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:B,locale:a}):O?(0,je.jsx)(ti,{chart:$,...Al(r.type,O,D)}):(0,je.jsx)($,{...D});if(n.card){let F=n.card,S=F.legend==="auto"||F.legend==="toggle"?Sl(n,w,s,x):F.legend,k=S?.length?x?(0,je.jsx)(Xn,{items:S,hidden:L,onToggle:z,locale:a}):S:void 0,N=F.download?(0,je.jsx)(ci,{data:w,columns:bo(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:a}):void 0;I=(0,je.jsx)(ao,{number:F.number,title:F.title??uo(r,l),subtitle:F.subtitle,legend:k,actions:N,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:a,children:I})}let C=e.theme??n.theme;return C&&(I=(0,je.jsx)(Zt,{theme:C,children:I})),I}function Nl({cfg:e,components:t}){let n=dt();return Bi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ji(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Hi.hydrateRoot)(r,(0,hr.createElement)(Zt,{theme:o.theme,cssVars:!0},(0,hr.createElement)(Nl,{cfg:o,components:{[e]:t}})))}ji("bar",wn);})();
|