ztd-charts-cli 0.6.0 → 0.7.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/README.md +1 -1
- package/dist/api.js +1 -1
- package/dist/{chunk-4K4P2AWW.js → chunk-4WXNLD5P.js} +29 -6
- package/dist/cli.js +1 -1
- package/dist/client/area.js +9 -9
- package/dist/client/bar.js +10 -10
- package/dist/client/beeswarm.js +10 -10
- package/dist/client/box.js +10 -10
- package/dist/client/bubble.js +10 -10
- package/dist/client/bullet.js +10 -10
- package/dist/client/bump.js +10 -10
- package/dist/client/calendar.js +10 -10
- package/dist/client/candlestick.js +10 -10
- package/dist/client/chord.js +10 -10
- package/dist/client/donut.js +10 -10
- package/dist/client/dumbbell.js +10 -10
- package/dist/client/funnel.js +10 -10
- package/dist/client/gauge.js +10 -10
- package/dist/client/heatmap.js +10 -10
- package/dist/client/histogram.js +10 -10
- package/dist/client/line.js +9 -9
- package/dist/client/lollipop.js +10 -10
- package/dist/client/marimekko.js +10 -10
- package/dist/client/parallel.js +10 -10
- package/dist/client/pareto.js +10 -10
- package/dist/client/pie.js +10 -10
- package/dist/client/radar.js +10 -10
- package/dist/client/radialBar.js +10 -10
- package/dist/client/ridgeline.js +10 -10
- package/dist/client/sankey.js +10 -10
- package/dist/client/scatter.js +10 -10
- package/dist/client/segmented.js +10 -10
- package/dist/client/skyline.js +10 -10
- package/dist/client/slope.js +10 -10
- package/dist/client/sparkline.js +10 -10
- package/dist/client/stream.js +9 -9
- package/dist/client/sunburst.js +10 -10
- package/dist/client/tileMap.js +28 -0
- package/dist/client/treemap.js +9 -9
- package/dist/client/waffle.js +10 -10
- package/dist/client/waterfall.js +10 -10
- package/package.json +2 -2
package/dist/client/line.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var Ni=Object.create;var Kr=Object.defineProperty;var Pi=Object.getOwnPropertyDescriptor;var Ri=Object.getOwnPropertyNames;var Di=Object.getPrototypeOf,Li=Object.prototype.hasOwnProperty;var Vn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Ei=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ri(t))!Li.call(e,o)&&o!==n&&Kr(e,o,{get:()=>t[o],enumerable:!(r=Pi(t,o))||r.enumerable});return e};var L=(e,t,n)=>(n=e!=null?Ni(Di(e)):{},Ei(t||!e||!e.__esModule?Kr(n,"default",{value:e,enumerable:!0}):n,e));var ee=Vn((mu,Ur)=>{Ur.exports=globalThis.__ztdReact.react});var Yr=Vn((du,Xr)=>{Xr.exports=globalThis.__ztdReact["react-dom/client"]});var G=Vn((Su,To)=>{To.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Ar=L(ee(),1),hi=L(Yr(),1);var Kt=L(ee(),1);var un=L(ee(),1);var qr=L(ee(),1),$t=(0,qr.createContext)(void 0);var eo=L(ee(),1);var _i=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Zr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Jr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',ot={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:Zr,monoFamily:Jr,radius:18,radiusCode:14,radiusMark:4},Wn={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:Zr,monoFamily:Jr,radius:18,radiusCode:14,radiusMark:4},Gn={dark:ot,light:Wn};function Yt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Kn(e){let t={};for(let n of _i){let r=e[n];typeof r=="string"&&(t[Yt(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 Un(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 Ii=`
|
|
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,${ot.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,${ot.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,${ot.dim})}
|
|
15
15
|
@media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
|
|
16
16
|
@keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
|
|
17
17
|
@keyframes ztd-fade{from{opacity:0}to{opacity:1}}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
20
|
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
21
|
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
-
`;var Ar=!1;function kt(){if(Ar||typeof document>"u"||(Ar=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=li,document.head.appendChild(e)}var Dt=D(re(),1),ze=typeof window<"u"&&typeof document<"u",De=ze?Dt.useLayoutEffect:Dt.useEffect;function Lt(){return typeof performance<"u"?performance.now():Date.now()}var Le=D(re(),1),ui=(0,Le.createContext)(void 0),Et=new Map;function ci(e,t){let n=Et.get(e);return n||Et.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||Et.delete(e)}}function mi(e,t,n){Et.get(e)?.forEach(r=>r(t,n))}function di(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function Nr(e,t,n,r){let o=(0,Le.useContext)(ui),a=t??o,[i]=(0,Le.useState)(()=>({})),s=(0,Le.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=a?u=>mi(a,u===null||s.current.keys[u]===void 0?null:{key:s.current.keys[u],label:s.current.labels[u]},i):null;let l=e.applySync;(0,Le.useEffect)(()=>{if(a)return ci(a,(u,d)=>{if(d===i)return;let c=u?di(s.current.keys,s.current.labels,u):-1;l(c<0?null:c)})},[a,i,l])}function le(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function He(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Rr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Fr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var fi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],hi={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function gi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function pi(e){return gi(fi,e)}function Pr(e,t){let n=pi(e);return{text:n?n[t]:e,...hi[n?.id??"basic"]}}var Ae=D(re(),1);var Br=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ce="en-US",Dr=new Map;function vn(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=Dr.get(r);return o||(o=new Intl.NumberFormat(e,n),Dr.set(r,o)),o}function Cn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function qe(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ce,...r}=t;return Cn(vn(n,r).format(e))}var $n=e=>e!==0&&Math.abs(e)<.05,Mn=(e,t,n="")=>`${qe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function _t(e,t={}){if(!Number.isFinite(e))return"-";if($n(e)&&t.maximumFractionDigits===void 0)return Mn(e,t.locale??ce,"%");let n=Math.abs(e);return`${qe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Or(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ce,...r}=t;if(le(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],u=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**d)/10**d;if(i>0&&c>=a[i-1][0]/s){i--;continue}return(e<0&&c!==0?"-":"")+qe(c,{locale:n,...r,maximumFractionDigits:d})+l}}return Cn(vn(n,{notation:"compact",...r}).format(e))}var bi=(e,t=le(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function wt(e,t=ce,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=vn(t,o);return l=>Number.isFinite(l)?`${i}${Cn(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>_t(o,{locale:t});case"ratio":return o=>_t(o*100,{locale:t});case"compact":return o=>Or(o,{locale:t});case"currency":return r(bi(t));default:{let o=r({maximumFractionDigits:1});return a=>$n(a)?Mn(a,t):o(a)}}}function Tn(e,t=ce,n=0){return e!==void 0?wt(e,t):n>=1e5?r=>$n(r)?Mn(r,t):Or(r,{locale:t}):r=>qe(r,{locale:t})}function yi(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Sn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,xi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,ki=["january","february","march","april","may","june","july","august","september","october","november","december"],Lr=e=>{let t=e.toLowerCase();return t.length<3?0:ki.findIndex(n=>n.startsWith(t))+1},Er=e=>+e+(+e<30?2e3:1900);function Ir(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var wi=[/^(\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})$/,Hr=/\{([^{}]+)\}/g;function Bt(e,t){let n;for(let r of wi)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?[Er(n[3]),+n[2],+n[1],1]:[Er(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],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Lr(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=Lr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Vr=e=>xi.test(e)||Bt(e)!==null;function jr(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 Ot(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(Sn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Ot(`${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=Bt(n,t);if(r)return yi(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 _r=new Map;function vt(e,t={month:"short",day:"numeric"}){let n=Ot(e);if(!n)return"-";let{locale:r=ce,...o}=t,a=r+JSON.stringify(o),i=_r.get(a);return i||(i=new Intl.DateTimeFormat(r,o),_r.set(a,i)),i.format(n)}var Wr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function mt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Wr[t.toLowerCase()]&&(t=Wr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Ur(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 Nn(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 dt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Kr(e){return .2126*dt(e[0])+.7152*dt(e[1])+.0722*dt(e[2])}function Rn(e,t,n){let r=typeof e=="string"?mt(e):e,o=typeof t=="string"?mt(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?mt(n):n:null;o[3]<1&&a&&(o=Nn(o,a));let i=r[3]<1?Nn(r,o):r,s=Kr(i),l=Kr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function vi(e){return[dt(e[0]),dt(e[1]),dt(e[2])]}function An(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]=vi(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Ci([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[An(4.0767416621*o-3.3077115913*a+.2309699292*i),An(-1.2684380046*o+2.6097574011*a-.3413193965*i),An(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function It(e,t,n){let r=mt(e),o=mt(t);if(!r||!o)return e;let a=Gr(r),i=Gr(o),s=Math.max(0,Math.min(1,n));return Ur(Ci([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Fn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Rn(a,e,n);i>o&&(o=i,r=a)}return r}var Pn=D(V(),1),zt=(0,Ae.createContext)({theme:Xe,cssVars:!0});function $i(e,t=Xe){return e?typeof e=="string"?yn[e]??t:wn(t,e):t}function Vt(e){let t=(0,Ae.useContext)(zt),n=e.base?yn[e.base]:t.theme,r=(0,Ae.useMemo)(()=>$i(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,Ae.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,Ae.useMemo)(()=>kn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Pn.jsx)(zt.Provider,{value:i,children:(0,Pn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Mi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Ht(e){return Mi.has(e)}function Ti(e,t){let n=r=>t?`var(${xn(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Ht(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Ht(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:It(e[r],e[o],a)}}}function Ve(e){let t=(0,Ae.useContext)(zt);return(0,Ae.useMemo)(()=>{let n=wn(t.theme,e);return Ti(n,t.cssVars)},[t.theme,t.cssVars,e])}function Ne(e){let t=(0,Ae.useContext)(zt);return e??t.locale??ce}function Xr(e){return e?kn(e):{}}var jt=D(re(),1),Dn=(0,jt.createContext)(void 0);function qr(e){let t=(0,jt.useContext)(Dn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=D(V(),1),Si={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`},Ai={en:Si,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ni={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Ln=e=>Ai[le(Ne(e))];function En(e){let t=Ve(e.theme),n=Ln(e.locale),[r,o]=(0,Wt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.label)).length,u=(0,N.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,c)=>{let m=!s.has(d.label),h=m&&l===1,f=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Ri,{p:t,item:d,off:!m}),(0,N.jsx)("span",{style:m?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":m,"aria-disabled":h||void 0,onClick:()=>{h||(i(d.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:f}):f},c)})});return i?(0,N.jsxs)(N.Fragment,{children:[u,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ni,children:r?n.shown(l,e.items.length):""})]}):u}function Ri({p:e,item:t,off:n}){let r=t.color?Ht(t.color)?e.paint(t.color):t.color:e.paint("neutral"),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.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,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.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 Fi(e){let t=Ve(e.theme),n=Pr(e.level,le(Ne(e.locale)));return(0,N.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 Pi(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Zr(e){let t=Ve(e.theme),n=Ln(e.locale),[r,o]=(0,Wt.useState)(0);De(()=>kt(),[]);let a=()=>{o(m=>m+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(En,{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,u=e.replay||e.onReplay,d=e.source!==void 0||e.note!==void 0?(0,N.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,c=e.takeaway!==void 0||e.level||e.sample?(0,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.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,N.jsx)(Fi,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.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,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,N.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,N.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:Pi(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,N.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,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(Dn.Provider,{value:r,children:(0,N.jsx)(Pt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,N.jsxs)(N.Fragment,{children:[d,c]}):c]})}function _n(e){let t=Ve(e.theme),n=Ln(e.locale),r=e.height??220;if(De(()=>kt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.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,N.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,N.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}function Ze(e,t,n,r,o="max"){let a=new Set,i=n.length,s=u=>{if(i&&u!=="none"){if(u==="first")a.add(0);else if(u==="last")a.add(i-1);else if(u==="max"||u==="min"){let d=-1,c=u==="max"?-1/0:1/0;r.forEach((m,h)=>{Number.isFinite(m)&&(u==="max"?m>c:m<c)&&(c=m,d=h)}),d>=0&&a.add(d)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((u,d)=>{d<i&&u!==null&&u!==void 0&&e(u,d)&&a.add(d)}),a;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<i&&a.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((d,c)=>{d===u&&a.add(c)});return a}function ye(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 Di(e,t){let n=Fn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Rn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Fn(t,["#FFFFFF","#000000"])}function Jr(e,t){let n=It(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Di(e,n),raw:n}}function Bn(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ye(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=ye(e,"neutral");else if(s===0)r[i]=ye(e,"ink");else if(s===a-1)r[i]=ye(e,"neutral");else if(a===3)r[i]=ye(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?ye(e,"strong"):Jr(e,1-l)}}),r}function Ct(e,t){let n=new Array(e),r=[];for(let a=0;a<e;a++)t.has(a)?n[a]="accent":r.push(a);let o=r.length;return r.forEach((a,i)=>{o===1?n[a]="neutral":i===0?n[a]="ink":i===o-1?n[a]="neutral":n[a]="neutralStrong"}),n}function Qr(e,t){return Ct(e+1,t).slice(0,e)}function eo(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ye(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=ye(e,"neutral"):s===0?r[i]=ye(e,"strong"):s===a-1?r[i]=ye(e,"neutral"):r[i]=Jr(e,1-s/(a-1))}),r}function to(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Li(e,t){if(e==null||typeof e!="object")return;let n=e;if(to(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!to(r,o))return;r=r[o]}return r}}function je(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 ft(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Li(r,n)}function $t(e,t){let n=ft(e,t);return(r,o)=>je(n(r,o))}function Kt(e,t){let n=ft(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function Je(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var Ce=D(re(),1);function Ei(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let u=e[l];if(u==='"')n=!n;else if(!n&&(u===`
|
|
23
|
-
`||u==="\r"))break;t.push(n?"":u)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let u=o(l);u>s&&(s=u,i=l)}return i}var
|
|
22
|
+
`;function to(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 no(e,t){let[n]=(0,eo.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Qr=!1;function _t(){if(Qr||typeof document>"u"||(Qr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Ii,document.head.appendChild(e)}var qt=L(ee(),1),Pe=typeof window<"u"&&typeof document<"u",ze=Pe?qt.useLayoutEffect:qt.useEffect;function Zt(){return typeof performance<"u"?performance.now():Date.now()}var He=L(ee(),1),Oi=(0,He.createContext)(void 0),Jt=new Map;function Bi(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 zi(e,t,n){Jt.get(e)?.forEach(r=>r(t,n))}function Hi(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function ro(e,t,n,r){let o=(0,He.useContext)(Oi),a=t??o,[i]=(0,He.useState)(()=>({})),s=(0,He.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=a?u=>zi(a,u===null||s.current.keys[u]===void 0?null:{key:s.current.keys[u],label:s.current.labels[u]},i):null;let l=e.applySync;(0,He.useEffect)(()=>{if(a)return Bi(a,(u,d)=>{if(d===i)return;let c=u?Hi(s.current.keys,s.current.labels,u):-1;l(c<0?null:c)})},[a,i,l])}function te(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Re(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var oo={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},ao={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ji=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Vi={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Wi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Gi(e){return Wi(ji,e)}function io(e,t){let n=Gi(e);return{text:n?n[t]:e,...Vi[n?.id??"basic"]}}var so={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ct(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),so[t.toLowerCase()]&&(t=so[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function co(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 Yn(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 Mt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function lo(e){return .2126*Mt(e[0])+.7152*Mt(e[1])+.0722*Mt(e[2])}function qn(e,t,n){let r=typeof e=="string"?Ct(e):e,o=typeof t=="string"?Ct(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ct(n):n:null;o[3]<1&&a&&(o=Yn(o,a));let i=r[3]<1?Yn(r,o):r,s=lo(i),l=lo(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Ki(e){return[Mt(e[0]),Mt(e[1]),Mt(e[2])]}function Xn(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 uo(e){let[t,n,r]=Ki(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Ui([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Xn(4.0767416621*o-3.3077115913*a+.2309699292*i),Xn(-1.2684380046*o+2.6097574011*a-.3413193965*i),Xn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Qt(e,t,n){let r=Ct(e),o=Ct(t);if(!r||!o)return e;let a=uo(r),i=uo(o),s=Math.max(0,Math.min(1,n));return co(Ui([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Zn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=qn(a,e,n);i>o&&(o=i,r=a)}return r}function de(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 Xi(e,t){let n=Zn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return qn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Zn(t,["#FFFFFF","#000000"])}function en(e,t){let n=Qt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Xi(e,n),raw:n}}function je(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=de(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=de(e,"neutral");else if(s===0)r[i]=de(e,"ink");else if(s===a-1)r[i]=de(e,"neutral");else if(a===3)r[i]=de(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?de(e,"strong"):en(e,1-l)}}),r}var Jn="mix:";function It(e){return e({theme:Wn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Jn}${o}`}).map(n=>n.fill)}function mo(e,t){return t?.startsWith(Jn)?e.mix("neutralStrong","neutral",Number(t.slice(Jn.length))):e.color(t)}function fo(e,t,n){return je(e,t+1,n).slice(0,t)}function ho(e,t,n,r="neutral"){let o=de(e,"accent"),a=de(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function go(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=de(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=de(e,"neutral"):s===0?r[i]=de(e,"strong"):s===a-1?r[i]=de(e,"neutral"):r[i]=en(e,1-s/(a-1))}),r}var De=L(ee(),1);var nn=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),fe="en-US",po=new Map;function Qn(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=po.get(r);return o||(o=new Intl.NumberFormat(e,n),po.set(r,o)),o}function er(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function at(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=fe,...r}=t;return er(Qn(n,r).format(e))}var tr=e=>e!==0&&Math.abs(e)<.05,nr=(e,t,n="")=>`${at(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function tn(e,t={}){if(!Number.isFinite(e))return"-";if(tr(e)&&t.maximumFractionDigits===void 0)return nr(e,t.locale??fe,"%");let n=Math.abs(e);return`${at(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function ko(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=fe,...r}=t;if(te(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],u=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**d)/10**d;if(i>0&&c>=a[i-1][0]/s){i--;continue}return(e<0&&c!==0?"-":"")+at(c,{locale:n,...r,maximumFractionDigits:d})+l}}return er(Qn(n,{notation:"compact",...r}).format(e))}var Yi=(e,t=te(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function ht(e,t=fe,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Qn(t,o);return l=>Number.isFinite(l)?`${i}${er(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>tn(o,{locale:t});case"ratio":return o=>tn(o*100,{locale:t});case"compact":return o=>ko(o,{locale:t});case"currency":return r(Yi(t));default:{let o=r({maximumFractionDigits:1});return a=>tr(a)?nr(a,t):o(a)}}}function Tt(e,t=fe,n=0){return e!==void 0?ht(e,t):n>=1e5?r=>tr(r)?nr(r,t):ko(r,{locale:t}):r=>at(r,{locale:t})}function qi(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var rr=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Zi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Ji=["january","february","march","april","may","june","july","august","september","october","november","december"],bo=e=>{let t=e.toLowerCase();return t.length<3?0:Ji.findIndex(n=>n.startsWith(t))+1},yo=e=>+e+(+e<30?2e3:1900);function wo(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Qi=[/^(\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})일)?$/],vo=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,$o=/\{([^{}]+)\}/g;function rn(e,t){let n;for(let r of Qi)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?[yo(n[3]),+n[2],+n[1],1]:[yo(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=vo.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=bo(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=bo(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Co=e=>Zi.test(e)||rn(e)!==null;function Mo(e){let t;for(let n of e){let r=typeof n=="string"?vo.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function on(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(rr(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return on(`${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=rn(n,t);if(r)return qi(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 xo=new Map;function Ot(e,t={month:"short",day:"numeric"}){let n=on(e);if(!n)return"-";let{locale:r=fe,...o}=t,a=r+JSON.stringify(o),i=xo.get(a);return i||(i=new Intl.DateTimeFormat(r,o),xo.set(a,i)),i.format(n)}var or=L(G(),1),an=(0,De.createContext)({theme:ot,cssVars:!0});function es(e,t=ot){return e?typeof e=="string"?Gn[e]??t:Un(t,e):t}function sn(e){let t=(0,De.useContext)(an),n=e.base?Gn[e.base]:t.theme,r=(0,De.useMemo)(()=>es(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,De.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,De.useMemo)(()=>Kn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,or.jsx)(an.Provider,{value:i,children:(0,or.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var ts=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function So(e){return ts.has(e)}function ns(e,t){let n=r=>t?`var(${Yt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?So(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?So(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Qt(e[r],e[o],a)}}}function Le(e){let t=(0,De.useContext)(an);return(0,De.useMemo)(()=>{let n=Un(t.theme,e);return ns(n,t.cssVars)},[t.theme,t.cssVars,e])}function xe(e){let t=(0,De.useContext)(an);return e??t.locale??fe}function Ao(e){return e?Kn(e):{}}var ln=L(ee(),1),ar=(0,ln.createContext)(void 0);function Fo(e){let t=(0,ln.useContext)(ar);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var R=L(G(),1),rs={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`},os={en:rs,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var as={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},ir=e=>os[te(xe(e))];function sr(e){let t=Le(e.theme),n=ir(e.locale),[r,o]=(0,un.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.label)).length,u=(0,R.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,c)=>{let m=!s.has(d.label),h=m&&l===1,f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(is,{p:t,item:d,off:!m}),(0,R.jsx)("span",{style:m?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,R.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,R.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":m,"aria-disabled":h||void 0,onClick:()=>{h||(i(d.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:f}):f},c)})});return i?(0,R.jsxs)(R.Fragment,{children:[u,(0,R.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:as,children:r?n.shown(l,e.items.length):""})]}):u}function is({p:e,item:t,off:n}){let r=mo(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,R.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,R.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,R.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,R.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 ss(e){let t=Le(e.theme),n=io(e.level,te(xe(e.locale)));return(0,R.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 ls(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,R.jsxs)(R.Fragment,{children:[e.slice(0,r),(0,R.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function No(e){let t=Le(e.theme),n=ir(e.locale),[r,o]=(0,un.useState)(0);ze(()=>_t(),[]);let a=()=>{o(m=>m+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,R.jsx)(sr,{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,u=e.replay||e.onReplay,d=e.source!==void 0||e.note!==void 0?(0,R.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,c=e.takeaway!==void 0||e.level||e.sample?(0,R.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,R.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,R.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,R.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,R.jsx)(ss,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,R.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,R.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,R.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,R.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:ls(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,R.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,R.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,R.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,R.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,R.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,R.jsx)("span",{}),i]}):null]}),(0,R.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,R.jsx)(ar.Provider,{value:r,children:(0,R.jsx)($t.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,R.jsxs)(R.Fragment,{children:[d,c]}):c]})}function lr(e){let t=Le(e.theme),n=ir(e.locale),r=e.height??220;if(ze(()=>_t(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,R.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,R.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,R.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,R.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,R.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,R.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,R.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,R.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,R.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,R.jsx)(R.Fragment,{children:e.children})}var Rt=L(ee(),1);var ke=L(ee(),1);var Y=L(G(),1),cn=60,ur=8;function Po(e,t){return e.length>ur?[...e.slice(0,ur),{label:t(e.length-ur),value:""}]:e}var mn={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Ro(e){let{c:t,events:n}=e,r=(0,ke.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,ze(()=>{_t()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,ke.useContext)($t),u=e.ariaLabel??l??e.kind,d=(0,ke.useMemo)(()=>s?`${n.length}${n.slice(0,cn).map(w=>`${w.label}${w.series??""}${w.formatted??w.value??""}`).join("")}`:"",[n,s]),c=(0,ke.useMemo)(()=>(0,Y.jsx)(us,{label:u,events:n,t:t.t}),[u,d,t.t]),m=(0,ke.useRef)(null);(0,ke.useEffect)(()=>{let w=()=>{m.current=null};return window.addEventListener("scroll",w,{capture:!0,passive:!0}),window.addEventListener("resize",w,{passive:!0}),()=>{window.removeEventListener("scroll",w,{capture:!0}),window.removeEventListener("resize",w)}},[]),(0,ke.useEffect)(()=>{m.current=null},[t.width,t.height]);let h=w=>{if(w.target!==w.currentTarget)return;if(e.onKey?.(w)){w.preventDefault();return}let P=t.active,_;switch(w.key){case"ArrowRight":case"ArrowDown":_=P===null?0:(P+1)%i;break;case"ArrowLeft":case"ArrowUp":_=P===null?i-1:(P-1+i)%i;break;case"Home":_=0;break;case"End":_=i-1;break;case"Escape":if(P===null)return;_=null;break;case"Enter":case" ":P!==null&&(w.preventDefault(),t.click(P));return;default:return}w.preventDefault(),t.setActive(_,"keyboard")},{via:f,node:p,setActive:x}=t;(0,ke.useEffect)(()=>{if(f!=="touch"||!p)return;let w=P=>{p.contains(P.target)||x(null)};return document.addEventListener("pointerdown",w),()=>document.removeEventListener("pointerdown",w)},[f,p,x]);let k=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,S=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,b=typeof e.renderTip=="function"&&k?e.renderTip(k):null,v=e.announce??(t.via==="keyboard"&&k?`${k.label}${k.series?` ${k.series}`:""}: ${k.formatted??k.value??""} (${(t.active??0)+1}/${i})`:""),O;if($){let w=$.x*S,P=t.width*S,_=`clamp(${(4-w).toFixed(1)}px, -50%, calc(${(P-w-4).toFixed(1)}px - 100%))`,K=$.y<64;O={position:"absolute",left:w,top:$.y*S,transform:`translate(${_}, ${K?"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*S-8)}}let E=w=>{m.current=null,w.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},H=w=>w?P=>{let _=m.current??(m.current=P.currentTarget.getBoundingClientRect());_.width&&w((P.clientX-_.left)/_.width*t.width,(P.clientY-_.top)/_.height*t.height,P)}:void 0,j=H(e.onPointerMove),z=H(e.onPointerDown),I=j||z?w=>{w.pointerType==="touch"&&j?.(w),z?.(w)}:void 0,F=H(e.onPointerUp),N=Ao(e.theme);return(0,Y.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":u,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:w=>{t.via==="keyboard"&&!w.currentTarget.contains(w.relatedTarget)&&t.setActive(null)},onPointerLeave:E,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...N,...e.style},children:[t.pending?null:e.underlay,(0,Y.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:j,onPointerDown:I,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,Y.jsx)("title",{id:o,children:u}),(0,Y.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,Y.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,Y.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:O,children:b??(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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((w,P)=>(0,Y.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,Y.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(w.strong?"ink":"muted")},children:[w.color?(0,Y.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:w.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,w.label]}),(0,Y.jsx)("span",{style:{fontWeight:w.strong===!1?500:700},children:w.value})]},P))]})}):null,(0,Y.jsx)("span",{className:"ztd-sr",style:mn,"aria-live":"polite","aria-atomic":"true",children:v}),s&&!t.pending?c:null]})}function us({label:e,events:t,t:n}){return(0,Y.jsx)("div",{className:"ztd-sr",style:mn,children:(0,Y.jsxs)("table",{children:[(0,Y.jsx)("caption",{children:n.table(e)}),(0,Y.jsxs)("tbody",{children:[t.slice(0,cn).map((r,o)=>(0,Y.jsxs)("tr",{children:[(0,Y.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,Y.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>cn?(0,Y.jsx)("tr",{children:(0,Y.jsx)("td",{colSpan:2,children:n.more(t.length-cn)})}):null]})]})})}function pe(e){let t=e.baseline??"central";return(0,Y.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 C=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),Ee=C("label","string",!0,"Item name field"),he=C("value","number",!0,"Value field"),cs=[Ee,he],ms=[Ee,he],ds=[C("label","string",!0,"Stage name"),C("value","number",!0,"Users at the stage")],fs=[Ee,he],hs=[C("label","string",!0,"Leaf (lowest level) name"),he,C("group","string",!1,"Parent group field")],gs=[C("label","string",!0,"Leaf name"),he,C("group","string",!1,"Parent group field")],ps=[Ee,C("value","number",!0,"Change (total rows may omit it)"),C("type","string",!1,'"total" makes a total bar')],bs=[Ee,he],ys=[C("x","string",!0,"Column field"),C("series","string",!0,"Stacked series field"),he],xs=[C("x","string",!0,"Column field"),C("y","string",!0,"Row field"),he],ks=[C("axis","string",!0,"Metric (axis) field"),C("value","number",!0,"Value field",{multi:!0}),C("series","string",!1,"Series field")],ws=[C("x","number",!0,"x value"),C("y","number",!0,"y value"),C("size","number",!1,"Circle size"),C("label","string",!1,"Name")],Lo=C("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),vs=[C("x","any",!0,"x field (date, number or category)"),C("y","number",!0,"y field. An array for wide tables",{multi:!0}),C("series","string",!1,"Series field (long tables)"),C("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Lo],$s=[C("x","any",!0,"x field"),C("y","number",!0,"y field. An array for wide tables",{multi:!0}),C("series","string",!1,"Series field"),C("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],Cs=[C("x","any",!0,"x field"),C("y","number",!0,"y field",{multi:!0}),C("series","string",!1,"Series field")],Ms=[C("x","string",!0,"Category field"),C("y","number",!0,"Value field. An array for wide tables",{multi:!0}),C("series","string",!1,"Series field"),C("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})],Ts=[Ee,he],Ss=[C("value","number",!0,"Value field",{prop:"valueKey"}),C("target","number",!1,"Target field",{prop:"targetKey"})],As=[Ee,C("value","number",!0,"Actual value field"),C("target","number",!1,"Target field")],Fs=[C("x","any",!1,"x field"),C("y","number",!0,"y field")],Ns=[Ee,C("x","string",!1,"Period field (long tables)"),C("value","number",!1,"Value field (long tables)")],Ps=[Ee,C("start","number",!0,"Before value"),C("end","number",!0,"After value")],Rs=[Ee,he],Ds=[C("value","number",!0,"Value field"),C("group","string",!1,"Group (row) field"),C("label","string",!1,"Dot name")],Ls=[C("group","string",!0,"Group field"),C("value","number",!0,"Value field")],Es=[C("source","string",!0,"Source node"),C("target","string",!0,"Target node"),he],_s=[C("source","string",!0,"Sending group"),C("target","string",!0,"Receiving group"),he],Is=[C("date","date",!0,"Date field"),he],Os=[C("x","any",!0,"Period field"),C("series","string",!0,"Item field"),C("rank","number",!1,"Rank field (1 is first)"),C("value","number",!1,"Value field (instead of rank, largest is first)")],Bs=[C("group","string",!0,"Group field"),C("value","number",!0,"Value field")],zs=[C("label","string",!1,"Row name field")],Hs=[C("x","date",!0,"Date (period) field"),C("open","number",!0,"Open price field"),C("high","number",!0,"High price field"),C("low","number",!0,"Low price field"),C("close","number",!0,"Close price field"),C("volume","number",!1,"Volume field")],js=[Ee,he],Vs=[C("x","any",!0,"Period field (date or category)"),C("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),C("series","string",!1,"Series field (long tables, back row only)"),C("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Ws=[C("value","number",!1,"Sample value field (raw rows)"),C("group","string",!1,"Group field. Up to 2 groups overlap"),C("x0","number",!1,"Bin start (pre-binned rows)"),C("x1","number",!1,"Bin end (pre-binned rows)"),C("count","number",!1,"Samples in the bin (pre-binned rows)")],Gs=[C("region","string",!0,"Region name or code, matched to a tile of options.map"),he],Ks=[C("x","number",!0,"x value"),C("y","number",!0,"y value"),C("series","string",!1,"Series field (one color per series)"),C("label","string",!1,"Name")],Do={pie:cs,donut:ms,funnel:ds,waffle:fs,treemap:hs,sunburst:gs,waterfall:ps,pareto:bs,marimekko:ys,heatmap:xs,radar:ks,bubble:ws,line:vs,area:$s,stream:Cs,bar:Ms,radialBar:Ts,gauge:Ss,bullet:As,sparkline:Fs,slope:Ns,dumbbell:Ps,lollipop:Rs,beeswarm:Ds,ridgeline:Ls,sankey:Es,chord:_s,calendar:Is,bump:Os,box:Bs,parallel:zs,candlestick:Hs,segmented:js,skyline:Vs,histogram:Ws,scatter:Ks,tileMap:Gs},St={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:"타일 격자 지도"}};function Eo(e,t){return t==="ko"?e.nameKo:e.name}function _o(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Io=["line","area","bar","scatter"],Oo=24,cr=["line","area","bar","scatter"];function mr(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Bo(e,t,n){return cr.includes(e)&&!mr(e,t,n).length}function zo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Us={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"};function dn(e){let t=Do[e]?e:Us[e]??Object.keys(St).find(n=>n.toLowerCase()===e.toLowerCase()||St[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!St[t]))return{type:t,component:St[t].component,name:St[t].name,nameKo:St[t].nameKo,encoding:Do[t]}}function Ho(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of dn(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function jo(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Xs(e,t){if(e==null||typeof e!="object")return;let n=e;if(jo(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!jo(r,o))return;r=r[o]}return r}}function Je(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 At(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Xs(r,n)}function gt(e,t){let n=At(e,t);return(r,o)=>Je(n(r,o))}function Ft(e,t){let n=At(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function it(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ys(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let u=e[l];if(u==='"')n=!n;else if(!n&&(u===`
|
|
23
|
+
`||u==="\r"))break;t.push(n?"":u)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let u=o(l);u>s&&(s=u,i=l)}return i}var qs=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function Vo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(qs.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Je(t);if(Number.isFinite(n))return n}return t}function pt(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Ys(o),i=[],s=[],l="",u=!1;for(let f=0;f<o.length;f++){let p=o[f];u?p==='"'?o[f+1]==='"'?(l+='"',f++):u=!1:l+=p:p==='"'&&!l.trim()?(u=!0,l=""):p===a?(s.push(l),l=""):p===`
|
|
24
24
|
`||p==="\r"?(p==="\r"&&o[f+1]===`
|
|
25
|
-
`&&f++,s.push(l),i.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),i.push(s));let d=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!d.length)return[];let c=f=>n?no(f):f;if(!r)return d.map(f=>Object.fromEntries(f.map((p,k)=>[String(k),c(p)])));let m=[],h=new Set;return d[0].forEach((f,p)=>{let k=f.trim()||`col${p+1}`,C=k;for(let $=2;h.has(C);$++)C=`${k}_${$}`;h.add(C),m.push(C)}),d.slice(1).map(f=>Object.fromEntries(m.map((p,k)=>[p,c(f[k]??"")])))}function On(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?no(i[l]):i[l]??null])))}function Bi(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function ro(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 Qe(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Qe(JSON.parse(t))}catch{}return it(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?On(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)?Qe(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?On(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)?Qe(t.rows):Array.isArray(t.values)?On(t.values):Array.isArray(t.items)?Qe(t.items):Array.isArray(t.results)?Qe(t.results):Bi(t)}return[]}function oo(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function ao(e,t){let n=e.length;if(t>=n||t<3)return e.slice();let r=[e[0]],o=(n-2)/(t-2),a=0;for(let i=0;i<t-2;i++){let s=Math.floor((i+1)*o)+1,l=Math.min(Math.floor((i+2)*o)+1,n),u=0,d=0;for(let k=s;k<l;k++)u+=e[k].x,d+=e[k].y;let c=Math.max(1,l-s);u/=c,d/=c;let m=Math.floor(i*o)+1,h=Math.floor((i+1)*o)+1,f=m,p=-1;for(let k=m;k<h;k++){let C=Math.abs((e[a].x-u)*(e[k].y-e[a].y)-(e[a].x-e[k].x)*(d-e[a].y));C>p&&(p=C,f=k)}r.push(e[f]),a=f}return r.push(e[n-1]),r}async function Oi(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(le(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return it(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return it(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):it(a)}async function Ii(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await Oi(a,t.parse,o,t.locale)}return t.select&&(r=ro(r,t.select)),t.transform?t.transform(r):Qe(r)}function io(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,Ce.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Ce.useState)(0),u=Ne(t.locale),d=(0,Ce.useRef)(t);d.current={...t,locale:u};let c=(0,Ce.useRef)(e);c.current=e;let m=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(C=>typeof C=="object"?JSON.stringify(C):String(C))),p=(0,Ce.useRef)(!1);(0,Ce.useEffect)(()=>{let C=c.current;if(!C||!r){i(b=>b.status==="loading"?{...b,status:"idle"}:b);return}let $=new AbortController,B=!0;return p.current=!0,i(b=>({...b,data:o?b.data:[],status:"loading",error:null})),Ii(C,{...d.current,signal:$.signal}).then(b=>{B&&i({data:b,status:"success",error:null,updatedAt:Date.now()})}).catch(b=>{!B||$.signal.aborted||i(R=>({...R,status:"error",error:b instanceof Error?b:new Error(String(b))}))}).finally(()=>{B&&(p.current=!1)}),()=>{B=!1,p.current=!1,$.abort()}},[m,r,s,f,o]),(0,Ce.useEffect)(()=>{if(!n||!r)return;let C=setInterval(()=>{p.current||l($=>$+1)},n);return()=>clearInterval(C)},[n,r]);let k=(0,Ce.useCallback)(()=>l(C=>C+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:k}}var zn=D(V(),1),zi=["csv","svg","png"],Hi=/^[=+\-@\t\r\n=+-@]/,Vi=/var\(|color-mix\(/;function so(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Ir(e.getTime()):String(e);return`"${(Hi.test(t)&&!Number.isFinite(je(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ji(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Wi(e,t){return`\uFEFF${[t.map(so),...e.map(r=>t.map(o=>so(r[o])))].map(r=>r.join(",")).join(`\r
|
|
25
|
+
`&&f++,s.push(l),i.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),i.push(s));let d=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!d.length)return[];let c=f=>n?Vo(f):f;if(!r)return d.map(f=>Object.fromEntries(f.map((p,x)=>[String(x),c(p)])));let m=[],h=new Set;return d[0].forEach((f,p)=>{let x=f.trim()||`col${p+1}`,k=x;for(let $=2;h.has(k);$++)k=`${x}_${$}`;h.add(k),m.push(k)}),d.slice(1).map(f=>Object.fromEntries(m.map((p,x)=>[p,c(f[x]??"")])))}function dr(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?Vo(i[l]):i[l]??null])))}function Zs(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function Wo(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 st(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return st(JSON.parse(t))}catch{}return pt(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?dr(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)?st(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?dr(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)?st(t.rows):Array.isArray(t.values)?dr(t.values):Array.isArray(t.items)?st(t.items):Array.isArray(t.results)?st(t.results):Zs(t)}return[]}function fn(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Go(e,t){let n=e.length;if(t>=n||t<3)return e.slice();let r=[e[0]],o=(n-2)/(t-2),a=0;for(let i=0;i<t-2;i++){let s=Math.floor((i+1)*o)+1,l=Math.min(Math.floor((i+2)*o)+1,n),u=0,d=0;for(let x=s;x<l;x++)u+=e[x].x,d+=e[x].y;let c=Math.max(1,l-s);u/=c,d/=c;let m=Math.floor(i*o)+1,h=Math.floor((i+1)*o)+1,f=m,p=-1;for(let x=m;x<h;x++){let k=Math.abs((e[a].x-u)*(e[x].y-e[a].y)-(e[a].x-e[x].x)*(d-e[a].y));k>p&&(p=k,f=x)}r.push(e[f]),a=f}return r.push(e[n-1]),r}function Nt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,u)=>{let d=e[l][u];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 u=1;u<r;u++){let d=0,c=0;for(let m=0;m<n;m++){let h=i(m,u),f=h-i(m,u-1),p=0;for(let x=0;x<m;x++)p+=i(x,u)-i(x,u-1);d+=h,c+=(f/2+p)*h}d&&(l-=c/d),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,m=0;for(let h=0;h<n;h++){let f=e[h][l],p=Number.isFinite(f)?f:0;p>=0?(o[h][l]=c,c+=p,a[h][l]=c):(o[h][l]=m,m+=p,a[h][l]=m)}continue}let u=0;for(let c=0;c<n;c++)u+=i(c,l);let d=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let m=i(c,l);t==="expand"&&(m=u?m/u*100:0),o[c][l]=d,d+=m,a[c][l]=d}}if(t==="wiggle"&&r){let l=1/0,u=-1/0;for(let c=0;c<r;c++)l=Math.min(l,o[0]?.[c]??0),u=Math.max(u,a[n-1]?.[c]??0);let d=0;for(let c=0;c<r;c++)d+=((o[0]?.[c]??0)+(a[n-1]?.[c]??0))/2;d/=r;for(let c=0;c<n;c++)for(let m=0;m<r;m++)o[c][m]-=d,a[c][m]-=d}return{y0:o,y1:a}}function Ko(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 Uo(e){let t=e.length,n=e.map(u=>{let d=0,c=-1/0;return u.forEach((m,h)=>{m>c&&(c=m,d=h)}),d}),r=e.map(u=>u.reduce((d,c)=>d+(Number.isFinite(c)?c:0),0)),o=Array.from({length:t},(u,d)=>d).sort((u,d)=>n[u]-n[d]),a=[],i=[],s=0,l=0;for(let u of o)s<l?(a.push(u),s+=r[u]):(i.push(u),l+=r[u]);return[...i.reverse(),...a]}var Js=Math.PI*2;function Xo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function W(e){return Math.round(e*100)/100}function Yo(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${W(l[0])},${W(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${W(l[0])},${W(l[1])}`).join("");let o=[],a=[];for(let l=0;l<n-1;l++){let u=e[l+1][0]-e[l][0];o.push(u),a.push(u===0?0:(e[l+1][1]-e[l][1])/u)}let i=[a[0]];for(let l=1;l<n-1;l++)if(a[l-1]*a[l]<=0)i.push(0);else{let u=2*o[l]+o[l-1],d=o[l]+2*o[l-1];i.push((u+d)/(u/a[l-1]+d/a[l]))}i.push(a[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let u=o[l]/3;s+=`C${W(e[l][0]+u)},${W(e[l][1]+i[l]*u)} ${W(e[l+1][0]-u)},${W(e[l+1][1]-i[l+1]*u)} ${W(e[l+1][0])},${W(e[l+1][1])}`}return s}function hn(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return Yo(e);if(t==="step"){let n=`M${W(e[0][0])},${W(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${W(o)}V${W(e[r][1])}H${W(e[r][0])}`}return n}return Qs(e)}function Qs(e){if(!e.length)return"";let t=`M${W(e[0][0])},${W(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${W(e[n][0])},${W(e[n][1])}`;return t}function gn(e,t,n="smooth"){if(!e.length)return"";let r=[...t].reverse(),o=hn(e,n),a;return n==="smooth"?a=Yo(r.map(i=>[i[0],i[1]]),!1):n==="step"?a=hn(r,"step").replace(/^M/,"L"):a=r.map(i=>`L${W(i[0])},${W(i[1])}`).join(""),`${o}${a}Z`}function pn(e,t){let n=0,r=e.length-1;if(r<0)return-1;for(;r-n>1;){let o=n+r>>1;e[o]<t?n=o:r=o}return Math.abs(e[n]-t)<=Math.abs(e[r]-t)?n:r}function qo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function Zo(e){let t=e.length,n=e.reduce((l,u)=>l+u.x,0)/t,r=e.reduce((l,u)=>l+u.y,0)/t,o=0,a=0,i=0;for(let l of e)o+=(l.x-n)*(l.y-r),a+=(l.x-n)**2,i+=(l.y-r)**2;let s=a?o/a:0;return{slope:s,r2:a&&i?o*o/(a*i):0,at:l=>r+s*(l-n)}}function Qo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Jo(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 bn=new Map;function ae(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=bn.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);Qo(u)?i+=Jo(u):s+=Jo(u)}a=i+s*(n>=600?1.07:1),bn.size>5e3&&bn.clear(),bn.set(o,a)}return a*t}function Ve(e,t,n,r=400){if(e=e.trim(),ae(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;ae(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(Qo(s.charCodeAt(0))?2:3)?"":s+o}function ea(e,t,n=-1/0,r=1/0){let o=e.map((s,l)=>({y:s,i:l})).sort((s,l)=>s.y-l.y),a=new Array(e.length),i=o.map(s=>Math.max(n,Math.min(r,s.y)));for(let s=0;s<30;s++){let l=!1;for(let u=1;u<i.length;u++){let d=i[u]-i[u-1];if(d<t){let c=(t-d)/2;i[u-1]-=c,i[u]+=c,l=!0}}for(let u=0;u<i.length;u++)i[u]=Math.max(n,Math.min(r,i[u]));if(!l)break}for(let s=1;s<i.length;s++)i[s]-i[s-1]<t&&(i[s]=i[s-1]+t);if(i.length&&i[i.length-1]>r){let s=i[i.length-1]-r;for(let l=0;l<i.length;l++)i[l]-=s}return o.forEach((s,l)=>{a[s.i]=i[l]}),a}var Z=L(G(),1),bt=e=>Array.isArray(e)&&e.length===2;function yn(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&bt(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var ta=e=>e?.find(t=>t.type==="forecast")?.from,el=(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 fr(e,t,n){let r=t[0],o=1/0;for(let a of t){let i=gr(e,a.x,a.y,a.anchor),s=n.reduce((l,u)=>l+el(i,u),0);if(s<o&&(r=a,o=s),s===0)break}return n.push(gr(e,r.x,r.y,r.anchor)),r}var hr=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),tl=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function na(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 ra(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 xn(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 oa={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function aa({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((a,i)=>{if(a.type==="band"&&bt(a.y)){let s=ra(t,a.y);if(!s)return;let[l,u]=s;o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,u-l),fill:n.paint("accent"),opacity:.1}),(0,Z.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,Z.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},i))}else if(a.type==="band"&&bt(a.x)||a.type==="forecast"){let s;if(a.type==="forecast"){let d=xn(t,a.from);s=d===null?null:[d,t.x1]}else s=na(t,a.x);if(!s)return;let l=hr(t,s[0]),u=hr(t,s[1]);if(u-l<.5)return;o.push((0,Z.jsx)("rect",{x:l,y:t.top,width:u-l,height:r,fill:n.paint("ink"),opacity:.05},i))}else if(a.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 u=0;l.getTime()-s<=t.time.t1&&u<60;u++){let d=l.getTime();l.setDate(l.getDate()+2);let c=Math.max(t.x0,t.time.xt(d-s)),m=Math.min(t.x1,t.time.xt(l.getTime()-s));m>c&&o.push((0,Z.jsx)("rect",{x:c,y:t.top,width:m-c,height:r,fill:n.paint("ink"),opacity:.045},`${i}w${u}`)),l.setDate(l.getDate()+5)}}}),(0,Z.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var ia=(e,t)=>ae(e,10.5,t?700:500)+8;function gr(e,t,n,r="start",o){let a=ia(e,o);return{x:r==="end"?t-a:t,y:n-8,w:a,h:16}}function Bt({p:e,x:t,y:n,text:r,anchor:o="start",strong:a}){let i=gr(r,t,n,o,a);return(0,Z.jsxs)("g",{children:[(0,Z.jsx)("rect",{x:i.x,y:i.y,width:i.w,height:i.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,Z.jsx)(pe,{x:i.x+4,y:n,size:10.5,weight:a?700:500,fill:e.paint(a?"ink":"muted"),children:r})]})}function sa({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=oa[t.lang],o=[],a=[],i=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let u=t.y(s.y);if(!Number.isFinite(u))return;let d=s.label?Ve(s.label,160,10.5):"",c=d?fr(d,[{x:t.x1-2,y:u-10,anchor:"end"},{x:t.x0+2,y:u-10,anchor:"start"},{x:t.x1-2,y:u+10,anchor:"end"},{x:t.x0+2,y:u+10,anchor:"start"}],i):null;o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("dim"),strokeDasharray:"4 3"}),c?(0,Z.jsx)(Bt,{p:n,x:c.x,y:c.y,text:d,anchor:c.anchor}):null]},l))}else if(s.type==="band"&&s.label){let u=bt(s.y)?ra(t,s.y):[t.top,t.bottom],d=bt(s.x)?na(t,s.x):[t.x0,t.x1];if(!d||!u)return;let[c,m]=u,h=Ve(s.label,160,10.5),f=Math.min(hr(t,d[0]),t.x1-40)+4,p=fr(h,[{x:f,y:c+11,anchor:"start"},{x:f,y:m-11,anchor:"start"}],i);o.push((0,Z.jsx)(Bt,{p:n,x:p.x,y:p.y,text:h},l))}else if(s.type==="forecast"){let u=xn(t,s.from);if(u===null)return;let d=Ve(s.label??r.forecast,120,10.5),c=Math.min(u+4,t.x1-50),m=fr(d,[{x:c,y:t.top+9,anchor:"start"},{x:c,y:t.bottom-9,anchor:"start"}],i);o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("line",{x1:u,x2:u,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,Z.jsx)(Bt,{p:n,x:m.x,y:m.y,text:d})]},l))}else if(s.type==="event"&&s.label){let u=t.xAt(s.x);if(!tl(t,u))return;let d=Ve(s.label,140,10.5,700),c=ia(d,!0),m=Math.max(t.x0,Math.min(u-c/2,t.x1-c)),h=a.findIndex(p=>p<m-4);h<0&&(h=a.length),a[h]=m+c;let f=t.top+9+h*18;o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("line",{x1:u,x2:u,y1:f+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,Z.jsx)("circle",{cx:u,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,Z.jsx)(Bt,{p:n,x:m,y:f,text:d,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let u=t.points().filter(h=>Number.isFinite(h.x)&&Number.isFinite(h.y));if(u.length<2)return;let{at:d}=Zo(u),c=u[0].x,m=u[u.length-1].x;o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("line",{x1:c,x2:m,y1:d(c),y2:d(m),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,Z.jsx)(Bt,{p:n,x:m-2,y:d(m)-11,text:Ve(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,Z.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function la(e,t,n,r){if(!e?.length)return"";let o=oa[t],a=t==="ko",i=r??(l=>String(l??"")),s=e.map(l=>{let u=l.label?a?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&&bt(l.y)?a?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${u}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${u}`:l.type==="band"&&bt(l.x)?a?`${l.label??o.period} ${i(l.x[0])}~${i(l.x[1])}`:`${l.label??o.period} from ${i(l.x[0])} to ${i(l.x[1])}`:l.type==="line"&&typeof l.y=="number"?a?`기준선 ${n(l.y)}${u}`:`reference line at ${n(l.y)}${u}`:l.type==="event"?a?`${i(l.x)} ${l.label??""}`.trim():`${l.label??"event"} at ${i(l.x)}`:l.type==="forecast"?a?`${i(l.from)}부터 ${l.label??o.forecast}`:`${l.label??o.forecast.toLowerCase()} from ${i(l.from)}`:l.type==="trend"?a?l.label??"추세선":l.label??"trend line":l.type==="weekends"?o.weekends:""}).filter(Boolean);return s.length?` ${o.lead}: ${s.join(a?", ":"; ")}.`:""}var be=L(G(),1),_e=10.5;function ua(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>at(i,{locale:n,maximumFractionDigits:a}))}function wn(e,t,n){let r=18;for(let o of ua(e,t,n))r=Math.max(r,ae(o,_e));return Math.ceil(r+8)}function ca(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:ua(n,i,e.locale);return(0,be.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((u,d)=>{let c=Math.round(r(u))+.5,m=u===0&&e.zero!==!1;return(0,be.jsxs)("g",{children:[(0,be.jsx)("line",{x1:o,x2:a,y1:c,y2:c,stroke:t.paint(m?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:m?.7:1}),l?(0,be.jsx)(pe,{x:s?a+6:o-6,y:c,anchor:s?"start":"end",size:_e,fill:t.paint("muted"),children:l[d]}):null]},u)})})}function pr(e,t,n){let r=[],o=-1/0;for(let a of e){let i=ae(a.label,_e),s=Math.max(a.x-i/2,0);s<o+8||a.x-i/2<t||a.x+i/2>n||(r.push(a),o=s+i)}return r}function br(e,t,n=_e,r=8,o=400,a){let i=t.length;if(i<=1)return t.map((c,m)=>m);let s=t.map(c=>ae(c,n,o)),l=(c,m)=>Math.abs(e[m]-e[c])<(s[c]+s[m])/2+r,u=[];for(let c of a??[])u.some(m=>l(m,c))||u.push(c);let d=c=>!u.some(m=>l(m,c));for(let c=1;c<=i;c++){let m=u.slice();for(let h=0;h<i;h+=c)d(h)&&m.push(h);if(c>1&&(i-1)%c>c/2&&d(i-1)&&m.push(i-1),m.sort((h,f)=>h-f),m.every((h,f)=>!f||!l(m[f-1],h)))return m}return[0,i-1]}var kn=e=>Math.round(e*10)/10;function ma(e){let{p:t}=e;return(0,be.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${kn(e.x)}px,0px)`},children:[(0,be.jsx)("line",{x1:0,x2:0,y1:e.top,y2:e.bottom,stroke:t.paint("dim"),strokeWidth:1}),e.dots?.map(n=>(0,be.jsxs)("g",{className:"ztd-guide",style:{transform:`translate(0px,${kn(n.y)}px)`},children:[(0,be.jsx)("circle",{r:n.strong?9:7,fill:n.color,opacity:.2}),(0,be.jsx)("circle",{r:n.strong?4.2:3.2,fill:n.color,stroke:t.paint("panel"),strokeWidth:2})]},n.k))]})}function da(e){let{p:t}=e,n=Ve(e.label,160,_e,700),r=ae(n,_e,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,be.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${kn(o)}px,${kn(e.y)}px)`},children:[(0,be.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,be.jsx)(pe,{x:0,y:0,anchor:"middle",size:_e,weight:700,fill:t.paint("onInk"),children:n})]})}function yr(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 lt(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=yr(i,n),u=[o,a];for(let d=0;d<4;d++){let c=Math.ceil(a/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-m<=l*.3?m:o-i*s,a===0?0:c-a<=l*.3?c:a+i*s];let h=yr(u[1]-u[0],n);if(h===l)break;l=h}return u}function fa(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=yr(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,u=0;l<=o+a*1e-9&&u<200;l+=a,u++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function Me(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>fa(n,r,l),s}function zt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=lt(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function nl(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(u,d=1)=>{let c=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let h of u){let f=Number((h*10**m).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:fa(e,t,3)}function vn(e,t){let n=Me([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=()=>nl(e[0],e[1],Math.abs(t[1]-t[0])),r}function We(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 rl=864e5;function Ht(e,t,n,r=fe){let o=t-e;if(!(o>0))return[{t:e,label:Ot(e,{locale:r,month:"short",day:"numeric"})}];let a=o/rl,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(d,c,m,h=!1)=>{let f=new Date(d),p=-1,x=0;for(;f.getTime()<=t&&x++<500;){if(f.getTime()>=e){let k=f.getFullYear(),$=h&&!l&&k!==p;i.push({t:f.getTime(),label:Ot(f,{locale:r,...m,...$?{year:"numeric"}:{}})}),p=k}c(f)}};if(a<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(h=>h>=d)??12,m=new Date(s);m.setMinutes(0,0,0),u(m,h=>h.setHours(h.getHours()+c),{hour:"numeric"})}else if(a<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(d,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),u(d,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=a/30.44,c=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(h=>h>=c)??120;if(m>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(h,f=>f.setFullYear(f.getFullYear()+m/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%m;f&&h.setMonth(h.getMonth()+(m-f)),u(h,p=>p.setMonth(p.getMonth()+m),{month:"short"},!0)}}return i}function jt(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var $n=(e,t,n)=>e==="date"?on(t,n)?.getTime()??NaN:Je(t);function ha(e,t){let n=new Set(t?t.split(""):[]),r=e.series.flatMap((a,i)=>n.has(a)?[]:[i]);if(r.length===e.series.length)return[e,r];let o=a=>r.map(i=>a[i]);return[{...e,series:o(e.series),values:o(e.values),rows:o(e.rows),...e.rowValues&&{rowValues:o(e.rowValues)}},r]}function ol(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Co(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function yt(e,t,n,r,o={}){let a=At(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:At(n,"y"),u=!i&&r!==void 0?At(r,"series"):null,d=e.map((N,w)=>a(N,w)),c=o.xType??ol(d),m=o.locale??fe,h,f,p;if(c==="band"){let N=d.map(P=>String(P??""));h=it(N);let w=new Map(h.map((P,_)=>[P,_]));f=h.map((P,_)=>_),p=Int32Array.from(N,P=>w.get(P)??-1)}else{let N=c==="date"?o.dayFirst??Mo(d):void 0,w=d.map(K=>$n(c,K,N)),P=Array.from(new Set(w.filter(K=>Number.isFinite(K)))).sort((K,le)=>K-le),_=new Map(P.map((K,le)=>[K,le]));f=P,h=P.map(String),p=Int32Array.from(w,K=>_.get(K)??-1)}let x=o.dateFormat,k=N=>typeof N=="string"?rn(N.trim())?.[3]:void 0,$=c==="date"&&d.length<5e3?k(d[0]):void 0,S=($===2||$===3)&&d.every(N=>k(N)===$),b=S&&$===3;if(c==="date"&&!x){let N=f.length>1?f[f.length-1]-f[0]:0;x=S&&$===2||N>864e5*120?{month:"short"}:N<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},N>864e5*800&&(x={year:"numeric",month:"short"})}let v;if(c==="band")v=h;else if(b&&!o.dateFormat){let N=te(m)==="ko";v=f.map(w=>{let P=new Date(w),_=Math.floor(P.getMonth()/3)+1;return N?`${P.getFullYear()}년 ${_}분기`:`Q${_} ${P.getFullYear()}`})}else{let N=f.every(rr),w=c==="date"?new Intl.DateTimeFormat(m,x):new Intl.NumberFormat(m,N?{useGrouping:!1}:{maximumFractionDigits:6});v=f.length>1e3?jt(f.length,P=>w.format(f[P])):f.map(P=>w.format(P))}let O=s?[...s]:u?it(e.map((N,w)=>String(u(N,w)??""))):[""],E=new Map(O.map((N,w)=>[N,w])),H=O.map(()=>new Array(h.length).fill(NaN)),j=O.map(()=>new Array(h.length).fill(null)),z=o.aggregate??"sum",I=z==="mean"?O.map(()=>new Uint32Array(h.length)):null,F=(N,w,P,_)=>{let K=H[N][w];z==="last"?H[N][w]=P:z==="count"?H[N][w]=(Number.isFinite(K)?K:0)+1:z==="mean"?Number.isFinite(P)&&(H[N][w]=(Number.isFinite(K)?K:0)+P,I[N][w]++):H[N][w]=Number.isFinite(K)?K+(Number.isFinite(P)?P:0):P,j[N][w]=_};for(let N=0;N<e.length;N++){let w=p[N];if(w<0)continue;let P=e[N];if(s)for(let _=0;_<s.length;_++)F(_,w,Je(P[s[_]]),P);else{let _=u?E.get(String(u(P,N)??""))??0:0;F(_,w,Je(l(P,N)),P)}}if(I)for(let N=0;N<H.length;N++)for(let w=0;w<h.length;w++)I[N][w]>1&&(H[N][w]/=I[N][w]);return{type:c,keys:h,xnum:f,labels:v,series:O,values:H,rows:j}}function ga(e,t){let n=e.keys.length;if(n<=t||t<2)return e;let r=n/t,o=[],a=[];for(let s=0;s<t;s++){let l=Math.floor(s*r),u=Math.min(n,Math.floor((s+1)*r));u<=l||(a.push([l,u]),o.push(s===0?0:s===t-1?n-1:Math.floor((l+u-1)/2)))}let i=e.values.map(s=>a.map(([l,u])=>{let d=0,c=0;for(let m=l;m<u;m++)Number.isFinite(s[m])&&(d+=s[m],c++);return c?d/c:NaN}));return{type:e.type,keys:o.map(s=>e.keys[s]),xnum:e.type==="band"?o.map((s,l)=>l):o.map(s=>e.xnum[s]),labels:jt(o.length,s=>e.labels[o[s]]),series:e.series,values:i,rows:e.rows.map(s=>o.map(l=>s[l])),rowValues:e.values.map(s=>o.map(l=>s[l]))}}var al=140,Wt=12,pa=14,xr=20,ba=12.5;function il(e,t,n=Oo){let r=Ft(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),u=o.get(l);u?u.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function sl(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Wt)/(al+Wt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function ll(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Wt)/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 Vt=e=>e.filter(Number.isFinite);function Cn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=gt(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return Vt(n)}function ya(e,t,n,r,o,a){return yt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function ul(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,u=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let v=t.flat(),O=r.refLines??{},[E,H]=We([...Cn(v,r.x??"x"),...Vt([Number(O.x)])]),[j,z]=We([...Cn(v,r.y??"y"),...Vt([Number(O.y)])].filter(F=>!s||F>0)),I=r.zero??!1;return{y:u??(s?zt(j,z,i):lt(j,z,i,{zero:I,pad:.08})),x:r.xDomain??lt(E,H,Math.max(2,Math.round(o/110)),{zero:I,pad:.06}),sameKeys:!0}}let d=e==="bar",c=d&&r.orientation==="horizontal",m=n[0]?.keys.join(""),h=n.every(v=>v.keys.join("")===m),f=n.length>0&&n.every(v=>v.type!=="band"&&v.type===n[0].type),p=r.xDomain??(!d&&f?We(n.flatMap(v=>Vt(v.xnum))):void 0),x=d?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(x==="percent")return{x:p,sameKeys:h};if(u)return{y:u,x:p,sameKeys:h};let k=[];t.forEach((v,O)=>{let E=n[O];if(x==="stacked"||x==="auto"&&E.series.length>1){let j=Nt(E.values,"zero");j.y0.forEach(z=>k.push(...z)),j.y1.forEach(z=>k.push(...z))}else E.values.forEach(j=>k.push(...j));d&&!c&&r.line!==void 0&&ya(e,v,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(j=>k.push(...j)),d||k.push(...Cn(v,r.lower),...Cn(v,r.upper))}),d&&k.push(0),c||k.push(...yn(r.annotations));for(let v of r.referenceLines??[])k.push(v.y);r.signColors&&k.push(Number(r.baseline??0));let[$,S]=We(Vt(k).filter(v=>!s||v>0));return{y:s?zt($,S,i):d?lt($,S,c?Math.max(2,Math.round(o/120)):i):lt($,S,i,{zero:r.zero??e==="area"}),x:p,sameKeys:h}}function cl(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=yt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),u=(r.yScale==="log"&&e==="line"?vn:Me)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),d=wn(u,Tt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),c=n.flatMap(v=>v.series),m=r.endLabels??n.some(v=>v.series.length>1),h=d+6,f=a-(m?Math.min(a*.28,Math.max(...c.map(v=>ae(v,11,700)),20)+14):10),p=l.keys.length,[x,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=l.type==="number"?p>12:p>Ht(x,k,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!p||$)return;let S=v=>h+(l.xnum[v]-x)/(k-x)*(f-h),b=v=>ae(l.labels[v],_e);for(let v=1;;v++){let O=Array.from({length:Math.ceil(p/v)},(E,H)=>H*v);if(v>=p||O.every((E,H)=>!H||S(E)-S(O[H-1])>=(b(E)+b(O[H-1]))/2+8))return O.map(E=>({value:l.xnum[E],label:l.labels[E]}))}}function ml(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 dl(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${ml(`${e}|${t}|${o}|${fn(r)}`)}`}function fl(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 hl={en:{intro:(e,t)=>`${Re(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:"(빈 값)"}};function xa(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=il(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=sl(s,i,e.columns),{pw:u,ph:d}=ll(s,l,e.height),c=e.scale!=="free",m=t==="scatter"?[]:o.map(I=>ya(t,I,n,n.y,n.series,n.aggregate)),h=c?ul(t,o,m,n,u,d):{sameKeys:!1},f=c?cl(t,o,m,n,h,u,d,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",x=c&&(!p||h.sameKeys),k=c&&(p||h.x!==void 0||h.sameKeys),$=new Set(fl(e.highlight,r)?[e.highlight].flat():[]),S=$.size>0,b=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,v=e.syncId??dl(t,e.by,n,e.data),O=nn(ht(n.format,e.locale),n.unit),E=hl[e.lang],H=[],j=r.map(I=>I===""?E.blank:I);return{panels:r.map((I,F)=>{let N=o[F],w=j[F],P=F%l,_;if(t!=="scatter"){let le=m[F],Ue=ve=>le.values.reduce((Ie,Ut)=>Ie+(Number.isFinite(Ut[ve])?Ut[ve]:0),0),X=le.keys.map((ve,Ie)=>Ie).filter(ve=>le.values.some(Ie=>Number.isFinite(Ie[ve]))),me=X[X.length-1];H.push({first:X.length?Ue(X[0]):NaN,last:X.length?Ue(me):NaN,total:X.reduce((ve,Ie)=>ve+Ue(Ie),0)}),t!=="bar"&&le.series.length===1&&me!==void 0&&(_=O(le.values[0][me]))}else H.push({first:NaN,last:NaN,total:N.length});let K={data:N,width:u,height:d,ariaLabel:e.title?`${e.title}, ${w}`:w,syncId:v,highlight:S?$.has(I)?b?()=>!0:void 0:"none":e.highlight,showYAxis:!x||P===0,showXAxis:!k||F+l>=i};return h.y&&(K.yDomain=h.y),h.x&&(K.xDomain=h.x),f&&(K.xTicks=f),{value:I,label:w,props:K,last:_,isPicked:$.has(I)}}),cols:l,pw:u,ph:d,isPanelPick:S,description:gl(t,e.by,j,H,a,O,E)}}function gl(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=u=>qo(r.map(d=>d[u]));if(e==="line"||e==="area"){let u=l("last");u>=0&&(s+=i.endHigh(n[u],a(r[u].last)));let d=n.filter((c,m)=>r[m].last<r[m].first);s+=d.length?i.falling(`${d.slice(0,5).join(", ")}${d.length>5?i.more:""}`):i.noneFalling}else{let u=l("total");u>=0&&(s+=e==="bar"?i.total(n[u],a(r[u].total)):i.points(n[u],r[u].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var we=L(ee(),1);function pl(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function bl(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function va(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(i=>{let s=bl(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:pl(.25),rootMargin:"0px 0px -8% 0px"}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function ka(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Mn(e){let[t,n]=(0,we.useState)(null),[r,o]=(0,we.useState)(e??null),a=(0,we.useCallback)(i=>{n(i),i&&e===void 0&&o(ka(i))},[e]);return ze(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=u=>o(d=>d!==null&&Math.abs(d-u)<.5?d:u),s=()=>i(ka(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let d=u[u.length-1]?.contentRect;d?i(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var yl=()=>()=>{};function Pt(){return(0,we.useSyncExternalStore)(yl,()=>!0,()=>!1)}var wa="(prefers-reduced-motion: reduce)";function Tn(e="auto"){let[t,n]=(0,we.useState)(()=>Pe&&typeof window.matchMedia=="function"?window.matchMedia(wa).matches:!1);return(0,we.useEffect)(()=>{if(e!=="auto"||!Pe||typeof window.matchMedia!="function")return;let r=window.matchMedia(wa),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Ge=L(G(),1),xl=60,kl=420;function $a(e){let t=Le(),n=e.chartProps??{},[,r,o]=Mn(e.width),a=e.width??(o||480),i=xe(e.locale??n.locale),s=te(i),l=(0,Rt.useContext)($t),u=e.title??l,d=(0,Rt.useMemo)(()=>xa({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:u,locale:i,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(x,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,a,e.height,u,i,s]),c=`${(0,Rt.useId)().replace(/:/g,"")}fd`,m=Tn(n.reducedMotion??"auto"),h=Pt(),f=no({motion:{enabled:n.animate!==!1&&!m&&Pe},hydrated:h},{waiting:!1,generation:0}),p=e.chart;return(0,Ge.jsxs)("div",{ref:r,role:"group","aria-label":u,"aria-describedby":c,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Ge.jsx)("p",{id:c,style:mn,children:e.description??d.description}),(0,Ge.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${d.cols}, minmax(0, 1fr))`,columnGap:Wt,rowGap:pa},children:d.panels.map((x,k)=>{let $=t.paint(x.isPicked?"accentText":d.isPanelPick?"muted":"ink");return(0,Ge.jsxs)("div",{"data-facet":x.value,style:{minWidth:0,...to(f,!1,"fade",k*xl,kl)},children:[(0,Ge.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:xr,fontSize:ba,fontWeight:700,lineHeight:`${xr}px`,color:$},children:[(0,Ge.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.label}),x.last!==void 0?(0,Ge.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:x.last}):null]}),(0,Ge.jsx)(p,{...n,...x.props})]},x.value)})})]})}function Ke(e,t,n,r,o="max"){let a=new Set,i=n.length,s=u=>{if(i&&u!=="none"){if(u==="first")a.add(0);else if(u==="last")a.add(i-1);else if(u==="max"||u==="min"){let d=-1,c=u==="max"?-1/0:1/0;r.forEach((m,h)=>{Number.isFinite(m)&&(u==="max"?m>c:m<c)&&(c=m,d=h)}),d>=0&&a.add(d)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((u,d)=>{d<i&&u!==null&&u!==void 0&&e(u,d)&&a.add(d)}),a;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<i&&a.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((d,c)=>{d===u&&a.add(c)});return a}var Te=L(ee(),1);async function wl(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(te(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return pt(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return pt(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):pt(a)}async function vl(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await wl(a,t.parse,o,t.locale)}return t.select&&(r=Wo(r,t.select)),t.transform?t.transform(r):st(r)}function Ca(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,Te.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Te.useState)(0),u=xe(t.locale),d=(0,Te.useRef)(t);d.current={...t,locale:u};let c=(0,Te.useRef)(e);c.current=e;let m=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),p=(0,Te.useRef)(!1);(0,Te.useEffect)(()=>{let k=c.current;if(!k||!r){i(b=>b.status==="loading"?{...b,status:"idle"}:b);return}let $=new AbortController,S=!0;return p.current=!0,i(b=>({...b,data:o?b.data:[],status:"loading",error:null})),vl(k,{...d.current,signal:$.signal}).then(b=>{S&&i({data:b,status:"success",error:null,updatedAt:Date.now()})}).catch(b=>{!S||$.signal.aborted||i(v=>({...v,status:"error",error:b instanceof Error?b:new Error(String(b))}))}).finally(()=>{S&&(p.current=!1)}),()=>{S=!1,p.current=!1,$.abort()}},[m,r,s,f,o]),(0,Te.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{p.current||l($=>$+1)},n);return()=>clearInterval(k)},[n,r]);let x=(0,Te.useCallback)(()=>l(k=>k+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:x}}var wr=L(G(),1),$l=["csv","svg","png"],Cl=/^[=+\-@\t\r\n=+-@]/,Ml=/var\(|color-mix\(/;function Ma(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?wo(e.getTime()):String(e);return`"${(Cl.test(t)&&!Number.isFinite(Je(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Tl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Sl(e,t){return`\uFEFF${[t.map(Ma),...e.map(r=>t.map(o=>Ma(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
|
-
`}function
|
|
28
|
-
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?vt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,u=s.replace(Hr,(d,c)=>o(a,c.trim())??(l=!0,""));l||i.push(u)}return i.length?i.map((s,l)=>(0,go.jsx)("div",{children:s},l)):null}}var v=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),Re=v("label","string",!0,"Item name field"),fe=v("value","number",!0,"Value field"),Ui=[Re,fe],Yi=[Re,fe],Xi=[v("label","string",!0,"Stage name"),v("value","number",!0,"Users at the stage")],qi=[Re,fe],Zi=[v("label","string",!0,"Leaf (lowest level) name"),fe,v("group","string",!1,"Parent group field")],Ji=[v("label","string",!0,"Leaf name"),fe,v("group","string",!1,"Parent group field")],Qi=[Re,v("value","number",!0,"Change (total rows may omit it)"),v("type","string",!1,'"total" makes a total bar')],es=[Re,fe],ts=[v("x","string",!0,"Column field"),v("series","string",!0,"Stacked series field"),fe],ns=[v("x","string",!0,"Column field"),v("y","string",!0,"Row field"),fe],rs=[v("axis","string",!0,"Metric (axis) field"),v("value","number",!0,"Value field",{multi:!0}),v("series","string",!1,"Series field")],os=[v("x","number",!0,"x value"),v("y","number",!0,"y value"),v("size","number",!1,"Circle size"),v("label","string",!1,"Name")],bo=v("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),as=[v("x","any",!0,"x field (date, number or category)"),v("y","number",!0,"y field. An array for wide tables",{multi:!0}),v("series","string",!1,"Series field (long tables)"),v("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),bo],is=[v("x","any",!0,"x field"),v("y","number",!0,"y field. An array for wide tables",{multi:!0}),v("series","string",!1,"Series field"),v("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}),bo],ss=[v("x","any",!0,"x field"),v("y","number",!0,"y field",{multi:!0}),v("series","string",!1,"Series field")],ls=[v("x","string",!0,"Category field"),v("y","number",!0,"Value field. An array for wide tables",{multi:!0}),v("series","string",!1,"Series field"),v("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})],us=[Re,fe],cs=[v("value","number",!0,"Value field",{prop:"valueKey"}),v("target","number",!1,"Target field",{prop:"targetKey"})],ms=[Re,v("value","number",!0,"Actual value field"),v("target","number",!1,"Target field")],ds=[v("x","any",!1,"x field"),v("y","number",!0,"y field")],fs=[Re,v("x","string",!1,"Period field (long tables)"),v("value","number",!1,"Value field (long tables)")],hs=[Re,v("start","number",!0,"Before value"),v("end","number",!0,"After value")],gs=[Re,fe],ps=[v("value","number",!0,"Value field"),v("group","string",!1,"Group (row) field"),v("label","string",!1,"Dot name")],bs=[v("group","string",!0,"Group field"),v("value","number",!0,"Value field")],ys=[v("source","string",!0,"Source node"),v("target","string",!0,"Target node"),fe],xs=[v("source","string",!0,"Sending group"),v("target","string",!0,"Receiving group"),fe],ks=[v("date","date",!0,"Date field"),fe],ws=[v("x","any",!0,"Period field"),v("series","string",!0,"Item field"),v("rank","number",!1,"Rank field (1 is first)"),v("value","number",!1,"Value field (instead of rank, largest is first)")],vs=[v("group","string",!0,"Group field"),v("value","number",!0,"Value field")],Cs=[v("label","string",!1,"Row name field")],$s=[v("x","date",!0,"Date (period) field"),v("open","number",!0,"Open price field"),v("high","number",!0,"High price field"),v("low","number",!0,"Low price field"),v("close","number",!0,"Close price field"),v("volume","number",!1,"Volume field")],Ms=[Re,fe],Ts=[v("x","any",!0,"Period field (date or category)"),v("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),v("series","string",!1,"Series field (long tables, back row only)"),v("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Ss=[v("value","number",!1,"Sample value field (raw rows)"),v("group","string",!1,"Group field. Up to 2 groups overlap"),v("x0","number",!1,"Bin start (pre-binned rows)"),v("x1","number",!1,"Bin end (pre-binned rows)"),v("count","number",!1,"Samples in the bin (pre-binned rows)")],As=[v("x","number",!0,"x value"),v("y","number",!0,"y value"),v("series","string",!1,"Series field (one color per series)"),v("label","string",!1,"Name")],po={pie:Ui,donut:Yi,funnel:Xi,waffle:qi,treemap:Zi,sunburst:Ji,waterfall:Qi,pareto:es,marimekko:ts,heatmap:ns,radar:rs,bubble:os,line:as,area:is,stream:ss,bar:ls,radialBar:us,gauge:cs,bullet:ms,sparkline:ds,slope:fs,dumbbell:hs,lollipop:gs,beeswarm:ps,ridgeline:bs,sankey:ys,chord:xs,calendar:ks,bump:ws,box:vs,parallel:Cs,candlestick:$s,segmented:Ms,skyline:Ts,histogram:Ss,scatter:As},ht={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"}};function yo(e,t){return t==="ko"?e.nameKo:e.name}function xo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Hn=["line","area","bar","scatter"];function Vn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"?[].concat(t.line??[]).map(String):[]}function ko(e,t,n){return Hn.includes(e)&&!Vn(e,t,n).length}function wo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ns={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram"};function Gt(e){let t=po[e]?e:Ns[e]??Object.keys(ht).find(n=>n.toLowerCase()===e.toLowerCase()||ht[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!ht[t]))return{type:t,component:ht[t].component,name:ht[t].name,nameKo:ht[t].nameKo,encoding:po[t]}}function vo(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of Gt(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}var Rs=Math.PI*2;function Co(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function I(e){return Math.round(e*100)/100}function $o(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${I(l[0])},${I(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${I(l[0])},${I(l[1])}`).join("");let o=[],a=[];for(let l=0;l<n-1;l++){let u=e[l+1][0]-e[l][0];o.push(u),a.push(u===0?0:(e[l+1][1]-e[l][1])/u)}let i=[a[0]];for(let l=1;l<n-1;l++)if(a[l-1]*a[l]<=0)i.push(0);else{let u=2*o[l]+o[l-1],d=o[l]+2*o[l-1];i.push((u+d)/(u/a[l-1]+d/a[l]))}i.push(a[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let u=o[l]/3;s+=`C${I(e[l][0]+u)},${I(e[l][1]+i[l]*u)} ${I(e[l+1][0]-u)},${I(e[l+1][1]-i[l+1]*u)} ${I(e[l+1][0])},${I(e[l+1][1])}`}return s}function Ut(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return $o(e);if(t==="step"){let n=`M${I(e[0][0])},${I(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${I(o)}V${I(e[r][1])}H${I(e[r][0])}`}return n}return Fs(e)}function Fs(e){if(!e.length)return"";let t=`M${I(e[0][0])},${I(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${I(e[n][0])},${I(e[n][1])}`;return t}function Yt(e,t,n="smooth"){if(!e.length)return"";let r=[...t].reverse(),o=Ut(e,n),a;return n==="smooth"?a=$o(r.map(i=>[i[0],i[1]]),!1):n==="step"?a=Ut(r,"step").replace(/^M/,"L"):a=r.map(i=>`L${I(i[0])},${I(i[1])}`).join(""),`${o}${a}Z`}function Xt(e,t){let n=0,r=e.length-1;if(r<0)return-1;for(;r-n>1;){let o=n+r>>1;e[o]<t?n=o:r=o}return Math.abs(e[n]-t)<=Math.abs(e[r]-t)?n:r}function Mo(e){let t=e.length,n=e.reduce((l,u)=>l+u.x,0)/t,r=e.reduce((l,u)=>l+u.y,0)/t,o=0,a=0,i=0;for(let l of e)o+=(l.x-n)*(l.y-r),a+=(l.x-n)**2,i+=(l.y-r)**2;let s=a?o/a:0;return{slope:s,r2:a&&i?o*o/(a*i):0,at:l=>r+s*(l-n)}}function To(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 it(t.csv)}return null}var te=D(re(),1);var xe=D(re(),1);var j=D(V(),1),qt=60,jn=8;function So(e,t){return e.length>jn?[...e.slice(0,jn),{label:t(e.length-jn),value:""}]:e}var Ao={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function No(e){let{c:t,events:n}=e,r=(0,xe.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,De(()=>{kt()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,xe.useContext)(Pt),u=e.ariaLabel??l??e.kind,d=(0,xe.useMemo)(()=>s?`${n.length}${n.slice(0,qt).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),c=(0,xe.useMemo)(()=>(0,j.jsx)(Ps,{label:u,events:n,t:t.t}),[u,d,t.t]),m=(0,xe.useRef)(null);(0,xe.useEffect)(()=>{let x=()=>{m.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,xe.useEffect)(()=>{m.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let A=t.active,L;switch(x.key){case"ArrowRight":case"ArrowDown":L=A===null?0:(A+1)%i;break;case"ArrowLeft":case"ArrowUp":L=A===null?i-1:(A-1+i)%i;break;case"Home":L=0;break;case"End":L=i-1;break;case"Escape":if(A===null)return;L=null;break;case"Enter":case" ":A!==null&&(x.preventDefault(),t.click(A));return;default:return}x.preventDefault(),t.setActive(L,"keyboard")},{via:f,node:p,setActive:k}=t;(0,xe.useEffect)(()=>{if(f!=="touch"||!p)return;let x=A=>{p.contains(A.target)||k(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,p,k]);let C=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,B=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,b=typeof e.renderTip=="function"&&C?e.renderTip(C):null,R=e.announce??(t.via==="keyboard"&&C?`${C.label}${C.series?` ${C.series}`:""}: ${C.formatted??C.value??""} (${(t.active??0)+1}/${i})`:""),X;if($){let x=$.x*B,A=t.width*B,L=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(A-x-4).toFixed(1)}px - 100%))`,Y=$.y<64;X={position:"absolute",left:x,top:$.y*B,transform:`translate(${L}, ${Y?"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*B-8)}}let z=x=>{m.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},Z=x=>x?A=>{let L=m.current??(m.current=A.currentTarget.getBoundingClientRect());L.width&&x((A.clientX-L.left)/L.width*t.width,(A.clientY-L.top)/L.height*t.height,A)}:void 0,U=Z(e.onPointerMove),G=Z(e.onPointerDown),P=U||G?x=>{x.pointerType==="touch"&&U?.(x),G?.(x)}:void 0,E=Z(e.onPointerUp),S=Xr(e.theme);return(0,j.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":u,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.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,j.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:U,onPointerDown:P,onPointerUp:E,onPointerCancel:E,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,j.jsx)("title",{id:o,children:u}),(0,j.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,j.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,j.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:X,children:b??(0,j.jsxs)(j.Fragment,{children:[(0,j.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((x,A)=>(0,j.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,j.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,j.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,j.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},A))]})}):null,(0,j.jsx)("span",{className:"ztd-sr",style:Ao,"aria-live":"polite","aria-atomic":"true",children:R}),s&&!t.pending?c:null]})}function Ps({label:e,events:t,t:n}){return(0,j.jsx)("div",{className:"ztd-sr",style:Ao,children:(0,j.jsxs)("table",{children:[(0,j.jsx)("caption",{children:n.table(e)}),(0,j.jsxs)("tbody",{children:[t.slice(0,qt).map((r,o)=>(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,j.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>qt?(0,j.jsx)("tr",{children:(0,j.jsx)("td",{colSpan:2,children:n.more(t.length-qt)})}):null]})]})})}function he(e){let t=e.baseline??"central";return(0,j.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}function Fo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Ro(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 Zt=new Map;function ue(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Zt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);Fo(u)?i+=Ro(u):s+=Ro(u)}a=i+s*(n>=600?1.07:1),Zt.size>5e3&&Zt.clear(),Zt.set(o,a)}return a*t}function Ee(e,t,n,r=400){if(e=e.trim(),ue(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;ue(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(Fo(s.charCodeAt(0))?2:3)?"":s+o}function Po(e,t,n=-1/0,r=1/0){let o=e.map((s,l)=>({y:s,i:l})).sort((s,l)=>s.y-l.y),a=new Array(e.length),i=o.map(s=>Math.max(n,Math.min(r,s.y)));for(let s=0;s<30;s++){let l=!1;for(let u=1;u<i.length;u++){let d=i[u]-i[u-1];if(d<t){let c=(t-d)/2;i[u-1]-=c,i[u]+=c,l=!0}}for(let u=0;u<i.length;u++)i[u]=Math.max(n,Math.min(r,i[u]));if(!l)break}for(let s=1;s<i.length;s++)i[s]-i[s-1]<t&&(i[s]=i[s-1]+t);if(i.length&&i[i.length-1]>r){let s=i[i.length-1]-r;for(let l=0;l<i.length;l++)i[l]-=s}return o.forEach((s,l)=>{a[s.i]=i[l]}),a}var ge=D(V(),1),We=10.5;function Do(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>qe(i,{locale:n,maximumFractionDigits:a}))}function Lo(e,t,n){let r=18;for(let o of Do(e,t,n))r=Math.max(r,ue(o,We));return Math.ceil(r+8)}function Eo(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:Do(n,i,e.locale);return(0,ge.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((u,d)=>{let c=Math.round(r(u))+.5,m=u===0&&e.zero!==!1;return(0,ge.jsxs)("g",{children:[(0,ge.jsx)("line",{x1:o,x2:a,y1:c,y2:c,stroke:t.paint(m?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:m?.7:1}),l?(0,ge.jsx)(he,{x:s?a+6:o-6,y:c,anchor:s?"start":"end",size:We,fill:t.paint("muted"),children:l[d]}):null]},u)})})}function _o(e,t,n){let r=[],o=-1/0;for(let a of e){let i=ue(a.label,We),s=Math.max(a.x-i/2,0);s<o+8||a.x-i/2<t||a.x+i/2>n||(r.push(a),o=s+i)}return r}function Wn(e,t,n=We,r=8,o=400,a){let i=t.length;if(i<=1)return t.map((c,m)=>m);let s=t.map(c=>ue(c,n,o)),l=(c,m)=>Math.abs(e[m]-e[c])<(s[c]+s[m])/2+r,u=[];for(let c of a??[])u.some(m=>l(m,c))||u.push(c);let d=c=>!u.some(m=>l(m,c));for(let c=1;c<=i;c++){let m=u.slice();for(let h=0;h<i;h+=c)d(h)&&m.push(h);if(c>1&&(i-1)%c>c/2&&d(i-1)&&m.push(i-1),m.sort((h,f)=>h-f),m.every((h,f)=>!f||!l(m[f-1],h)))return m}return[0,i-1]}var Jt=e=>Math.round(e*10)/10;function Bo(e){let{p:t}=e;return(0,ge.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Jt(e.x)}px,0px)`},children:[(0,ge.jsx)("line",{x1:0,x2:0,y1:e.top,y2:e.bottom,stroke:t.paint("dim"),strokeWidth:1}),e.dots?.map(n=>(0,ge.jsxs)("g",{className:"ztd-guide",style:{transform:`translate(0px,${Jt(n.y)}px)`},children:[(0,ge.jsx)("circle",{r:n.strong?9:7,fill:n.color,opacity:.2}),(0,ge.jsx)("circle",{r:n.strong?4.2:3.2,fill:n.color,stroke:t.paint("panel"),strokeWidth:2})]},n.k))]})}function Oo(e){let{p:t}=e,n=Ee(e.label,160,We,700),r=ue(n,We,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,ge.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Jt(o)}px,${Jt(e.y)}px)`},children:[(0,ge.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,ge.jsx)(he,{x:0,y:0,anchor:"middle",size:We,weight:700,fill:t.paint("onInk"),children:n})]})}var st=D(re(),1);var oe=D(V(),1),Ds={zoomHint:" Press Enter to zoom in.",pickHint:" Press Enter to select.",high:"High",low:"Low",resetLabel:"Show all (reset zoom)",reset:"Show all",extremes:(e,t)=>`, high ${e}, low ${t}`,range:(e,t)=>`${e} to ${t}`},zo={en:Ds,ko:{zoomHint:" Enter를 누르면 확대해요.",pickHint:" Enter를 누르면 이 구간을 골라요.",high:"최고",low:"최저",resetLabel:"전체 보기(확대 풀기)",reset:"전체 보기",extremes:(e,t)=>`, 최고 ${e}, 최저 ${t}`,range:(e,t)=>`${e}~${t}`}},Ls=4;function Es(e){let[t,n]=(0,st.useState)(null),[r,o]=(0,st.useState)(!1),a=(0,st.useRef)(null),i=(0,st.useRef)(null),s=()=>{a.current=null,i.current=null,o(!1),n(null)},l=(m,h,f)=>!e.enabled||e.count<2||f.pointerType==="touch"||f.button!==0||!e.inPlot(m,h)?!1:(a.current={i:e.indexAt(m),x:m,moved:!1},f.currentTarget.setPointerCapture?.(f.pointerId),!0),u=m=>{let h=a.current;if(!h)return!1;if(!h.moved&&Math.abs(m-h.x)<Ls)return!0;h.moved=!0;let f=e.indexAt(m),p=Math.min(h.i,f),k=Math.max(h.i,f);return o(!0),n(C=>C?.from===p&&C.to===k?C:{from:p,to:k}),!0},d=(m,h,f)=>{let p=a.current;if(a.current=null,f.currentTarget.hasPointerCapture?.(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId),!p)return;if(o(!1),!p.moved||f.type==="pointercancel"){t&&(n(null),e.onCommit(null));return}let k=e.indexAt(m),C={from:Math.min(p.i,k),to:Math.max(p.i,k)},$=C.to>C.from;n($&&e.keep!==!1?C:null),e.onCommit($?C:null)},c=(m,h)=>{if(!e.enabled)return!1;if(m.key==="Escape"&&t)return s(),e.onCommit(null),!0;if(m.key==="Enter"&&t&&i.current!==null)return i.current=null,e.keep===!1&&n(null),e.onCommit(t),!0;if(!m.shiftKey||m.key!=="ArrowLeft"&&m.key!=="ArrowRight"||e.count<2)return!1;let f=m.key==="ArrowRight"?1:-1,p=i.current??h??(f>0?0:e.count-1),k=t&&i.current!==null?t.from===p?t.to:t.from:p,C=Math.max(0,Math.min(e.count-1,k+f));return i.current=p,n(C===p?null:{from:Math.min(p,C),to:Math.max(p,C)}),!0};return{range:t,dragging:r,keyboard:t!==null&&i.current!==null,down:l,move:u,up:d,key:c}}function Ho(e){let[t,n]=(0,st.useState)(null);return t&&t.sig!==e&&n(null),{view:t&&t.sig===e?t.range:null,zoomTo:r=>n({sig:e,range:r}),reset:()=>n(null)}}function Vo(e,t,n){let r=zo[n.lang],o=e.brush==="zoom"?"zoom":e.brush?"select":null,a=Es({enabled:o!==null,count:n.count,indexAt:n.indexAt,inPlot:n.inPlot,keep:o!=="zoom",onCommit:l=>{let u=l?n.toXRange(l):null;e.onBrush?.(u),o==="zoom"&&u&&u.to>u.from&&t.zoomTo([u.from,u.to])}}),i={onPointerDown:o?a.down:void 0,onPointerUp:o?a.up:void 0,onKey:o?l=>l.key==="Escape"&&t.view&&!a.range?(t.reset(),!0):a.key(l,n.active):void 0,overlay:t.view?(0,oe.jsx)(_s,{p:n.p,onReset:t.reset,text:r}):null},s=a.keyboard?o==="zoom"?r.zoomHint:r.pickHint:"";return{brush:a,frame:i,hint:s,text:r}}function jo(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e===0?null:(t-e)/Math.abs(e)}function Wo(e,t=ce){let n=Math.round(e*1e3)/10;return`${n>0?"+":""}${qe(n,{locale:t,maximumFractionDigits:1})}%`}function Ko(e){let{p:t,top:n,bottom:r}=e,o=Math.min(e.x0,e.x1),a=Math.max(e.x0,e.x1),i=ue(e.main,11.5,800),s=ue(e.sub,10.5,500)+6,l=i+s+16,u=Math.max(2,Math.min(e.width-l-2,(o+a)/2-l/2)),d=n+4;return(0,oe.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,oe.jsx)("rect",{x:o,y:n,width:Math.max(1,a-o),height:Math.max(0,r-n),fill:t.paint("accent"),opacity:e.dragging?.1:.14}),(0,oe.jsx)("line",{x1:o,x2:o,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,oe.jsx)("line",{x1:a,x2:a,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,oe.jsx)("rect",{x:u,y:d,width:l,height:22,rx:8,fill:t.paint("panel"),stroke:t.paint("line")}),(0,oe.jsx)(he,{x:u+8,y:d+11,size:11.5,weight:800,fill:t.paint("ink"),children:e.main}),(0,oe.jsx)(he,{x:u+8+i+6,y:d+11,size:10.5,weight:500,fill:t.paint("muted"),children:e.sub})]})}function Go(e){let{p:t,width:n,top:r,bottom:o,max:a,min:i}=e,s=zo[e.lang];return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Io,{p:t,x:a.x,y:a.y,text:`${s.high} ${a.text}`,below:a.y-26<r+30,width:n}),(0,oe.jsx)(Io,{p:t,x:i.x,y:i.y,text:`${s.low} ${i.text}`,below:i.y+26<o,width:n})]})}function Io(e){let{p:t}=e,n=ue(e.text,10.5,700)+12,r=18,o=Math.max(2,Math.min(e.width-n-2,e.x-n/2)),a=e.below?e.y+8:e.y-r-8;return(0,oe.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,oe.jsx)("circle",{cx:e.x,cy:e.y,r:3.5,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:2}),(0,oe.jsx)("rect",{x:o,y:a,width:n,height:r,rx:9,fill:t.paint("ink")}),(0,oe.jsx)(he,{x:o+n/2,y:a+r/2,anchor:"middle",size:10.5,weight:700,fill:t.paint("onInk"),children:e.text})]})}function _s(e){let{p:t}=e;return(0,oe.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onReset,"aria-label":e.text.resetLabel,style:{position:"absolute",top:0,right:0,height:24,padding:"0 10px",borderRadius:12,border:`1px solid ${t.paint("line")}`,background:t.paint("panel"),color:t.paint("muted"),fontSize:11.5,fontWeight:600,zIndex:4},children:e.text.reset})}var K=D(V(),1),lt=e=>Array.isArray(e)&&e.length===2;function Uo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&<(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var Yo=e=>e?.find(t=>t.type==="forecast")?.from,Bs=(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 Kn(e,t,n){let r=t[0],o=1/0;for(let a of t){let i=Un(e,a.x,a.y,a.anchor),s=n.reduce((l,u)=>l+Bs(i,u),0);if(s<o&&(r=a,o=s),s===0)break}return n.push(Un(e,r.x,r.y,r.anchor)),r}var Gn=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),Os=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function Xo(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 qo(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 Qt(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 Zo={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function Jo({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((a,i)=>{if(a.type==="band"&<(a.y)){let s=qo(t,a.y);if(!s)return;let[l,u]=s;o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,u-l),fill:n.paint("accent"),opacity:.1}),(0,K.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,K.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},i))}else if(a.type==="band"&<(a.x)||a.type==="forecast"){let s;if(a.type==="forecast"){let d=Qt(t,a.from);s=d===null?null:[d,t.x1]}else s=Xo(t,a.x);if(!s)return;let l=Gn(t,s[0]),u=Gn(t,s[1]);if(u-l<.5)return;o.push((0,K.jsx)("rect",{x:l,y:t.top,width:u-l,height:r,fill:n.paint("ink"),opacity:.05},i))}else if(a.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 u=0;l.getTime()-s<=t.time.t1&&u<60;u++){let d=l.getTime();l.setDate(l.getDate()+2);let c=Math.max(t.x0,t.time.xt(d-s)),m=Math.min(t.x1,t.time.xt(l.getTime()-s));m>c&&o.push((0,K.jsx)("rect",{x:c,y:t.top,width:m-c,height:r,fill:n.paint("ink"),opacity:.045},`${i}w${u}`)),l.setDate(l.getDate()+5)}}}),(0,K.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var Qo=(e,t)=>ue(e,10.5,t?700:500)+8;function Un(e,t,n,r="start",o){let a=Qo(e,o);return{x:r==="end"?t-a:t,y:n-8,w:a,h:16}}function Mt({p:e,x:t,y:n,text:r,anchor:o="start",strong:a}){let i=Un(r,t,n,o,a);return(0,K.jsxs)("g",{children:[(0,K.jsx)("rect",{x:i.x,y:i.y,width:i.w,height:i.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,K.jsx)(he,{x:i.x+4,y:n,size:10.5,weight:a?700:500,fill:e.paint(a?"ink":"muted"),children:r})]})}function ea({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=Zo[t.lang],o=[],a=[],i=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let u=t.y(s.y);if(!Number.isFinite(u))return;let d=s.label?Ee(s.label,160,10.5):"",c=d?Kn(d,[{x:t.x1-2,y:u-10,anchor:"end"},{x:t.x0+2,y:u-10,anchor:"start"},{x:t.x1-2,y:u+10,anchor:"end"},{x:t.x0+2,y:u+10,anchor:"start"}],i):null;o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("dim"),strokeDasharray:"4 3"}),c?(0,K.jsx)(Mt,{p:n,x:c.x,y:c.y,text:d,anchor:c.anchor}):null]},l))}else if(s.type==="band"&&s.label){let u=lt(s.y)?qo(t,s.y):[t.top,t.bottom],d=lt(s.x)?Xo(t,s.x):[t.x0,t.x1];if(!d||!u)return;let[c,m]=u,h=Ee(s.label,160,10.5),f=Math.min(Gn(t,d[0]),t.x1-40)+4,p=Kn(h,[{x:f,y:c+11,anchor:"start"},{x:f,y:m-11,anchor:"start"}],i);o.push((0,K.jsx)(Mt,{p:n,x:p.x,y:p.y,text:h},l))}else if(s.type==="forecast"){let u=Qt(t,s.from);if(u===null)return;let d=Ee(s.label??r.forecast,120,10.5),c=Math.min(u+4,t.x1-50),m=Kn(d,[{x:c,y:t.top+9,anchor:"start"},{x:c,y:t.bottom-9,anchor:"start"}],i);o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:u,x2:u,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,K.jsx)(Mt,{p:n,x:m.x,y:m.y,text:d})]},l))}else if(s.type==="event"&&s.label){let u=t.xAt(s.x);if(!Os(t,u))return;let d=Ee(s.label,140,10.5,700),c=Qo(d,!0),m=Math.max(t.x0,Math.min(u-c/2,t.x1-c)),h=a.findIndex(p=>p<m-4);h<0&&(h=a.length),a[h]=m+c;let f=t.top+9+h*18;o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:u,x2:u,y1:f+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,K.jsx)("circle",{cx:u,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,K.jsx)(Mt,{p:n,x:m,y:f,text:d,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let u=t.points().filter(h=>Number.isFinite(h.x)&&Number.isFinite(h.y));if(u.length<2)return;let{at:d}=Mo(u),c=u[0].x,m=u[u.length-1].x;o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:c,x2:m,y1:d(c),y2:d(m),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,K.jsx)(Mt,{p:n,x:m-2,y:d(m)-11,text:Ee(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,K.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function ta(e,t,n,r){if(!e?.length)return"";let o=Zo[t],a=t==="ko",i=r??(l=>String(l??"")),s=e.map(l=>{let u=l.label?a?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&<(l.y)?a?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${u}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${u}`:l.type==="band"&<(l.x)?a?`${l.label??o.period} ${i(l.x[0])}~${i(l.x[1])}`:`${l.label??o.period} from ${i(l.x[0])} to ${i(l.x[1])}`:l.type==="line"&&typeof l.y=="number"?a?`기준선 ${n(l.y)}${u}`:`reference line at ${n(l.y)}${u}`:l.type==="event"?a?`${i(l.x)} ${l.label??""}`.trim():`${l.label??"event"} at ${i(l.x)}`:l.type==="forecast"?a?`${i(l.from)}부터 ${l.label??o.forecast}`:`${l.label??o.forecast.toLowerCase()} from ${i(l.from)}`:l.type==="trend"?a?l.label??"추세선":l.label??"trend line":l.type==="weekends"?o.weekends:""}).filter(Boolean);return s.length?` ${o.lead}: ${s.join(a?", ":"; ")}.`:""}var Is=e=>Array.isArray(e);function en(e,t,n){let r=Is(e)?e:[e];return n?t<r.length?r[t]:null:r[0]}function ra(e,t,n,r,o,a){let i=typeof t=="function"||typeof n=="function"?new Map(o.map((s,l)=>[s,l])):null;return e.map((s,l)=>{let u=new Array(s.length).fill(NaN),d=new Array(s.length).fill(NaN),c=en(t,l,r),m=en(n,l,r);if(c===null||m===null)return{lo:u,hi:d};let h=$t(c,""),f=$t(m,"");for(let p=Math.max(0,a);p<s.length;p++){let k=s[p];if(k===null)continue;let C=i?.get(k)??-1,$=h(k,C),B=f(k,C);!Number.isFinite($)||!Number.isFinite(B)||(u[p]=Math.min($,B),d[p]=Math.max($,B))}return{lo:u,hi:d}})}var Yn=(e,t,n)=>Number.isFinite(e)&&Number.isFinite(t)&&(e<t||e>n);function zs(e,t){let n=[],r=-1;for(let o=0;o<=e.length;o++){let a=o<e.length&&Number.isFinite(e[o])&&Number.isFinite(t[o]);a&&r<0?r=o:!a&&r>=0&&(o-1>r&&n.push([r,o-1]),r=-1)}return n}function Hs(e,t,n,r,o,a,i){let s=t(a),l=t(i);if(!(l>=s))return;let u=Math.floor(s),d=Math.floor(l)-u+1,c=new Array(d).fill(1/0),m=new Array(d).fill(-1/0),h=0;for(let f=a;f<i;f++){let p=Math.min(n[f],n[f+1]),k=Math.max(r[f],r[f+1]),C=Math.floor(t(f+1))-u;for(let $=h;$<=C;$++)p<c[$]&&(c[$]=p),k>m[$]&&(m[$]=k);h=C}for(let f=0;f<d;f++){let p=Math.max(s,u+f),k=Math.min(l,u+f+1);k<=p&&f>0||(e.xl.push(p),e.xr.push(k),e.top.push(o(m[f])),e.bottom.push(o(c[f])))}}function oa(e,t,n,r,o){let a=zs(t,n);if(!a.length)return null;let i=a.reduce((u,[d,c])=>u+c-d+1,0),s={runs:[],xl:[],xr:[],top:[],bottom:[]},l=i>o;for(let[u,d]of a)if(s.runs.push(s.top.length),l)Hs(s,e,t,n,r,u,d);else for(let c=u;c<=d;c++)s.xl.push(e(c)),s.top.push(r(n[c])),s.bottom.push(r(t[c]));return s.runs.push(s.top.length),s}function Vs(e,t,n,r,o,a){let i=I(n[o]),s=`M${I(e[o])},${i}`;for(let l=o+1;l<a;l++){let u=I(n[l]);u!==i&&(s+=`H${I(e[l])}V${i=u}`)}i=I(r[a-1]),s+=`H${I(t[a-1])}V${i}`;for(let l=a-2;l>=o;l--){let u=I(r[l]);u!==i&&(s+=`H${I(t[l])}V${i=u}`)}return`${s}H${I(e[o])}Z`}var na=(e,t,n,r)=>e.slice(n,r).map((o,a)=>[o,t[n+a]]);function aa(e,t,n,r){let o="";for(let a=0;a+1<e.runs.length;a++){let i=e.runs[a],s=e.runs[a+1];s-i<1||(o+=e.xr.length?Vs(e.xl,e.xr,t,n,i,s):Yt(na(e.xl,t,i,s),na(e.xl,n,i,s),r))}return o}function Xn(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 qn(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Xn(i,n),u=[o,a];for(let d=0;d<4;d++){let c=Math.ceil(a/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-m<=l*.3?m:o-i*s,a===0?0:c-a<=l*.3?c:a+i*s];let h=Xn(u[1]-u[0],n);if(h===l)break;l=h}return u}function ia(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Xn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,u=0;l<=o+a*1e-9&&u<200;l+=a,u++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function gt(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>ia(n,r,l),s}function sa(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=qn(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function js(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(u,d=1)=>{let c=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let h of u){let f=Number((h*10**m).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:ia(e,t,3)}function la(e,t){let n=gt([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=()=>js(e[0],e[1],Math.abs(t[1]-t[0])),r}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 Ws=864e5;function ua(e,t,n,r=ce){let o=t-e;if(!(o>0))return[{t:e,label:vt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Ws,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(d,c,m,h=!1)=>{let f=new Date(d),p=-1,k=0;for(;f.getTime()<=t&&k++<500;){if(f.getTime()>=e){let C=f.getFullYear(),$=h&&!l&&C!==p;i.push({t:f.getTime(),label:vt(f,{locale:r,...m,...$?{year:"numeric"}:{}})}),p=C}c(f)}};if(a<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(h=>h>=d)??12,m=new Date(s);m.setMinutes(0,0,0),u(m,h=>h.setHours(h.getHours()+c),{hour:"numeric"})}else if(a<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(d,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),u(d,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=a/30.44,c=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(h=>h>=c)??120;if(m>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(h,f=>f.setFullYear(f.getFullYear()+m/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%m;f&&h.setMonth(h.getMonth()+(m-f)),u(h,p=>p.setMonth(p.getMonth()+m),{month:"short"},!0)}}return i}function St(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var tn=(e,t,n)=>e==="date"?Ot(t,n)?.getTime()??NaN:je(t);function ca(e,t){let n=new Set(t?t.split(""):[]),r=e.series.flatMap((a,i)=>n.has(a)?[]:[i]);if(r.length===e.series.length)return[e,r];let o=a=>r.map(i=>a[i]);return[{...e,series:o(e.series),values:o(e.values),rows:o(e.rows),...e.rowValues&&{rowValues:o(e.rowValues)}},r]}function Ks(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Vr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function ma(e,t,n,r,o={}){let a=ft(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:ft(n,"y"),u=!i&&r!==void 0?ft(r,"series"):null,d=e.map((S,x)=>a(S,x)),c=o.xType??Ks(d),m=o.locale??ce,h,f,p;if(c==="band"){let S=d.map(A=>String(A??""));h=Je(S);let x=new Map(h.map((A,L)=>[A,L]));f=h.map((A,L)=>L),p=Int32Array.from(S,A=>x.get(A)??-1)}else{let S=c==="date"?o.dayFirst??jr(d):void 0,x=d.map(Y=>tn(c,Y,S)),A=Array.from(new Set(x.filter(Y=>Number.isFinite(Y)))).sort((Y,pe)=>Y-pe),L=new Map(A.map((Y,pe)=>[Y,pe]));f=A,h=A.map(String),p=Int32Array.from(x,Y=>L.get(Y)??-1)}let k=o.dateFormat,C=S=>typeof S=="string"?Bt(S.trim())?.[3]:void 0,$=c==="date"&&d.length<5e3?C(d[0]):void 0,B=($===2||$===3)&&d.every(S=>C(S)===$),b=B&&$===3;if(c==="date"&&!k){let S=f.length>1?f[f.length-1]-f[0]:0;k=B&&$===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&&(k={year:"numeric",month:"short"})}let R;if(c==="band")R=h;else if(b&&!o.dateFormat){let S=le(m)==="ko";R=f.map(x=>{let A=new Date(x),L=Math.floor(A.getMonth()/3)+1;return S?`${A.getFullYear()}년 ${L}분기`:`Q${L} ${A.getFullYear()}`})}else{let S=f.every(Sn),x=c==="date"?new Intl.DateTimeFormat(m,k):new Intl.NumberFormat(m,S?{useGrouping:!1}:{maximumFractionDigits:6});R=f.length>1e3?St(f.length,A=>x.format(f[A])):f.map(A=>x.format(A))}let X=s?[...s]:u?Je(e.map((S,x)=>String(u(S,x)??""))):[""],z=new Map(X.map((S,x)=>[S,x])),Z=X.map(()=>new Array(h.length).fill(NaN)),U=X.map(()=>new Array(h.length).fill(null)),G=o.aggregate??"sum",P=G==="mean"?X.map(()=>new Uint32Array(h.length)):null,E=(S,x,A,L)=>{let Y=Z[S][x];G==="last"?Z[S][x]=A:G==="count"?Z[S][x]=(Number.isFinite(Y)?Y:0)+1:G==="mean"?Number.isFinite(A)&&(Z[S][x]=(Number.isFinite(Y)?Y:0)+A,P[S][x]++):Z[S][x]=Number.isFinite(Y)?Y+(Number.isFinite(A)?A:0):A,U[S][x]=L};for(let S=0;S<e.length;S++){let x=p[S];if(x<0)continue;let A=e[S];if(s)for(let L=0;L<s.length;L++)E(L,x,je(A[s[L]]),A);else{let L=u?z.get(String(u(A,S)??""))??0:0;E(L,x,je(l(A,S)),A)}}if(P)for(let S=0;S<Z.length;S++)for(let x=0;x<h.length;x++)P[S][x]>1&&(Z[S][x]/=P[S][x]);return{type:c,keys:h,xnum:f,labels:R,series:X,values:Z,rows:U}}function da(e,t){let n=e.keys.length;if(n<=t||t<2)return e;let r=n/t,o=[],a=[];for(let s=0;s<t;s++){let l=Math.floor(s*r),u=Math.min(n,Math.floor((s+1)*r));u<=l||(a.push([l,u]),o.push(s===0?0:s===t-1?n-1:Math.floor((l+u-1)/2)))}let i=e.values.map(s=>a.map(([l,u])=>{let d=0,c=0;for(let m=l;m<u;m++)Number.isFinite(s[m])&&(d+=s[m],c++);return c?d/c:NaN}));return{type:e.type,keys:o.map(s=>e.keys[s]),xnum:e.type==="band"?o.map((s,l)=>l):o.map(s=>e.xnum[s]),labels:St(o.length,s=>e.labels[o[s]]),series:e.series,values:i,rows:e.rows.map(s=>o.map(l=>s[l])),rowValues:e.values.map(s=>o.map(l=>s[l]))}}var ae=D(re(),1);var ke=D(re(),1);function Gs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Us(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function ga(e,t=!0){let[n,r]=(0,ke.useState)({visible:!t,near:!t});return(0,ke.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=Us(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Gs(.25),rootMargin:"0px 0px -8% 0px"}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function fa(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function pa(e){let[t,n]=(0,ke.useState)(null),[r,o]=(0,ke.useState)(e??null),a=(0,ke.useCallback)(i=>{n(i),i&&e===void 0&&o(fa(i))},[e]);return De(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=u=>o(d=>d!==null&&Math.abs(d-u)<.5?d:u),s=()=>i(fa(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let d=u[u.length-1]?.contentRect;d?i(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var Ys=()=>()=>{};function nn(){return(0,ke.useSyncExternalStore)(Ys,()=>!0,()=>!1)}var ha="(prefers-reduced-motion: reduce)";function ba(e="auto"){let[t,n]=(0,ke.useState)(()=>ze&&typeof window.matchMedia=="function"?window.matchMedia(ha).matches:!1);return(0,ke.useEffect)(()=>{if(e!=="auto"||!ze||typeof window.matchMedia!="function")return;let r=window.matchMedia(ha),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}function ya(e,t){let n=Ve(e.theme),[r,o,a]=pa(e.width),i=nn(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,d=ba(e.reducedMotion??"auto"),c=e.animate!==!1&&!d&&ze,m=ga(r,e.animateOnView!==!1&&c),h=Ne(e.locale),f=le(h),p=(0,ae.useMemo)(()=>wt(e.format,h,t.format),[e.format,h,t.format]),k=(0,ae.useCallback)(Q=>_t(Q,{locale:h}),[h]),C=(0,ae.useMemo)(()=>Br(p,e.unit),[p,e.unit]),$=(0,ae.useMemo)(()=>oo(e.data),[e.data]),[B,b]=(0,ae.useState)(null),[R,X]=(0,ae.useState)(null),z=(0,ae.useRef)([]),Z=(0,ae.useRef)(e.onHover);Z.current=e.onHover;let U=(0,ae.useRef)(e.onClick);U.current=e.onClick;let G=(0,ae.useRef)(null),P=(0,ae.useRef)(null),E=(0,ae.useRef)(null),S=(0,ae.useCallback)((Q,me="pointer")=>{if(E.current!==Q){E.current=Q;let Rt=Q===null?null:z.current[Q]??null;queueMicrotask(()=>Z.current?.(Rt)),P.current?.(Q)}G.current=Q===null?null:me,b(Q),X(G.current)},[]),x=(0,ae.useCallback)(Q=>{G.current!=="keyboard"&&(G.current=Q===null?null:"sync",b(Q),X(G.current))},[]),A=(0,ae.useCallback)(Q=>{let me=z.current[Q];me&&U.current?.(me)},[]),L=qr(e.replayKey),Y=e.width!==void 0||(a??0)>0,pe={enabled:c,active:m.visible&&Y,near:m.near,replayKey:L,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},bt=(0,ae.useCallback)((Q,me=1)=>B===null||B===Q?me:me*.38,[B]);return{p:n,width:s,height:u,measured:Y,responsive:e.width===void 0,pending:ze&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:pe,fv:C,fmt:p,pct:k,locale:h,lang:f,t:f==="ko"?Fr:Rr,active:B,via:R,setActive:S,click:A,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:bt,sig:$,description:e.description,reduced:d,publish:P,applySync:x}}var ee=D(re(),1);function Xs(e){return 1-Math.pow(1-e,3)}function qs(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Zs(e){return e==="easeInOut"?qs:e==="linear"?t=>t:Xs}function Js(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 pt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function rn(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 xa(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 ka(e,t,n,r){if(!t||!n||t.length!==n.length)return pt(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of pt(s,n[i]))o.push(l)}return o.length===r?o:pt(e,r)}var on=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||!rn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),xa(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=rn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let u=i.to.length;s.from=ka(s.cur,s.parts,i.parts,u),s.vel=ka(s.curVel,s.parts,i.parts,u),s.parts=i.parts,s.to=i.to.slice(),xa(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=rn(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let u=this.make(i,i.enter??i.from??i.to,n+l,0);u.done=rn(u.from,u.to),this.tracks.set(i.key,u)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=pt(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Zs(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,u=s.to.length;if(s.from.length!==u&&(s.from=pt(s.from,u)),s.vel.length!==u&&(s.vel=pt(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let d;if(this.easing==="spring"){let c=Math.exp(-a*l),m=a*l>=8&&a*l<20,h=0;for(let f=0;f<u;f++){let p=s.from[f]-s.to[f],k=s.vel[f]+a*p;s.cur[f]=s.to[f]+(p+k*l)*c,s.curVel[f]=(s.vel[f]-a*k*l)*c,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}d=a*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+a*l)*c)}else{let c=Math.min(1,l/o),m=r(c),h=Js(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*m,s.curVel[f]=(s.to[f]-s.from[f])*h;d=c>=1,s.progress=m}if(d){for(let c=0;c<u;c++)s.cur[c]=s.to[c],s.curVel[c]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},At=new Set,an=0;function wa(e){an=0;let t=Array.from(At);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||At.delete(n)}At.size&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(wa))}function va(e){return At.add(e),!an&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(wa)),()=>{At.delete(e)}}function Qs(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 Ca(e,t){let n=(0,ee.useMemo)(()=>Qs(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:u=900,stagger:d=0}=t,c=(0,ee.useRef)(null),m=(0,ee.useRef)("init"),h=(0,ee.useRef)(null),f=(0,ee.useRef)(s),p=(0,ee.useRef)(i),k=(0,ee.useRef)(!1),C=(0,ee.useRef)(0),[,$]=(0,ee.useState)(0),B=(0,ee.useRef)(null),b=(0,ee.useRef)(!0);c.current||(c.current=new on,c.current.configure(l,u),c.current.snap(n),h.current=n);let R=c.current;if(R.configure(l,u),h.current!==n){let P=m.current,E=!Object.is(f.current,s);R.sameTargets(n)?R.refreshData(n):!r||P==="init"?R.snap(n):P==="idle"?R.hold(n):P==="running"||E?R.update(n,Lt(),d):R.snap(n),h.current=n,f.current=s}let X=(0,ee.useRef)(()=>!1);X.current=P=>{if(!b.current)return!1;let E=R.step(P);return!E&&m.current==="running"&&(m.current="done"),$(S=>(S+1)%1e9),E||(B.current=null),E};let z=(0,ee.useCallback)(()=>{if(!ze||B.current||!R.animating)return;let P=E=>X.current(E);B.current=va(P)},[R]);De(()=>{let P=!Object.is(p.current,i);if(p.current=i,!r){(m.current!=="done"||R.animating)&&(R.snap(h.current??n),m.current="done",$(E=>E+1));return}m.current==="init"||P&&a?(R.hold(h.current??n),m.current="idle",k.current=!1,$(E=>E+1)):P&&(k.current=!0)},[r,i]),De(()=>{!r||!a||!k.current||(k.current=!1,R.hold(h.current??n),m.current="idle",$(P=>P+1))},[a,r]),(0,ee.useEffect)(()=>{r&&o&&m.current==="idle"&&(R.start(Lt()),C.current+=1,m.current="running",z(),$(P=>P+1))},[r,o,i,R,z]),(0,ee.useEffect)(()=>{R.animating&&z()}),(0,ee.useEffect)(()=>(b.current=!0,()=>{b.current=!1,B.current?.(),B.current=null}),[]);let Z=Lt(),U=R.elapsed(Z),G=r&&m.current==="idle";return{items:R.items(),get:P=>R.get(P),elapsed:G?0:U,fade:(P,E=320)=>G?0:Number.isFinite(U)?Math.max(0,Math.min(1,(U-P)/E)):1,waiting:G,animating:R.animating,generation:C.current}}function Zn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,u)=>{let d=e[l][u];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 u=1;u<r;u++){let d=0,c=0;for(let m=0;m<n;m++){let h=i(m,u),f=h-i(m,u-1),p=0;for(let k=0;k<m;k++)p+=i(k,u)-i(k,u-1);d+=h,c+=(f/2+p)*h}d&&(l-=c/d),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,m=0;for(let h=0;h<n;h++){let f=e[h][l],p=Number.isFinite(f)?f:0;p>=0?(o[h][l]=c,c+=p,a[h][l]=c):(o[h][l]=m,m+=p,a[h][l]=m)}continue}let u=0;for(let c=0;c<n;c++)u+=i(c,l);let d=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let m=i(c,l);t==="expand"&&(m=u?m/u*100:0),o[c][l]=d,d+=m,a[c][l]=d}}if(t==="wiggle"&&r){let l=1/0,u=-1/0;for(let c=0;c<r;c++)l=Math.min(l,o[0]?.[c]??0),u=Math.max(u,a[n-1]?.[c]??0);let d=0;for(let c=0;c<r;c++)d+=((o[0]?.[c]??0)+(a[n-1]?.[c]??0))/2;d/=r;for(let c=0;c<n;c++)for(let m=0;m<r;m++)o[c][m]-=d,a[c][m]-=d}return{y0:o,y1:a}}var T=D(V(),1),el={line:"Line chart",area:"Area chart",span:(e,t)=>`${e}: ${t}`,desc:(e,t,n,r,o)=>`${He(e,"series","series")} (${t}), x from ${n} to ${r}, ${He(o,"point")}`,lower:"low",upper:"high",band:e=>` Range ${e}.`,range:(e,t)=>`${e} to ${t}`,outside:(e,t)=>e?` ${He(e,"point")} outside the range: ${t}.`:" No points outside the range.",where:(e,t)=>`${e} (${t})`,logDropped:e=>` ${He(e,"value")} at or below 0 ${e===1?"is":"are"} not shown on the log scale.`},tl={en:el,ko:{line:"라인 차트",area:"영역 차트",span:(e,t)=>`${e} 구간 ${t}`,desc:(e,t,n,r,o)=>`계열 ${e}개(${t}), x ${n}부터 ${r}까지 ${o}개 지점`,lower:"하한",upper:"상한",band:e=>` 범위 ${e}.`,range:(e,t)=>`${e}~${t}`,outside:(e,t)=>e?` 범위 밖 ${e}개 지점: ${t}.`:" 범위 밖 지점 없음.",where:(e,t)=>`${e}(${t})`,logDropped:e=>` 로그 눈금이라 0 이하 값 ${e}개는 뺐어요.`}};function nl(e,t,n){let r=Math.max(0,Math.min(t,n)),o=Math.min(e.keys.length-1,Math.max(t,n)),a=e.keys.slice(r,o+1);return{type:e.type,keys:a,xnum:e.type==="band"?a.map((i,s)=>s):e.xnum.slice(r,o+1),labels:e.labels.slice(r,o+1),series:e.series,values:e.values.map(i=>i.slice(r,o+1)),rows:e.rows.map(i=>i.slice(r,o+1))}}function rl(e,t,n){if(t!=="forecast")return 0;let r=e.keys.length;if(n===void 0)return r;if(e.type==="band"){let i=e.keys.indexOf(String(n));return i<0?r:i}let o=tn(e.type,n);if(!Number.isFinite(o))return r;let a=e.xnum.findIndex(i=>i>=o);return a<0?r:a}function ol(e,t,n,r,o){let a=(d,c)=>e.series.length>1&&e.series[d]?o.where(c,e.series[d]):c,i=Je(t.flatMap((d,c)=>d.lo.some(Number.isFinite)?[a(c,o.range(...n[c]))]:[]));if(!i.length)return"";let s=o.band(i.join(", "));if(!r)return s;let l=0,u=[];return t.forEach((d,c)=>{for(let m=0;m<d.lo.length;m++)Yn(e.values[c][m],d.lo[m],d.hi[m])&&(l++,u.length<5&&u.push(a(c,e.labels[m])))}),s+o.outside(l,`${u.join(", ")}${l>u.length?", …":""}`)}function $a(e,t,n,r){let o=en(e,t,n);return typeof o=="string"&&o?o:r}function al(e,t,n){let r=e.keys.length;if(e.type==="band"){let s=r>1?(n-t)/(r-1):0;return l=>r>1?t+l*s:(t+n)/2}let[o,a]=Tt(e.xnum),i=gt([o,a===o?o+1:a],[t,n]);return Object.assign(s=>i(e.xnum[s]),{v:i})}function il(e){let{c:t,model:n,xs:r,x0:o,x1:a,y:i}=e,s=t.p,l;if(n.type==="date"&&n.keys.length>1){let d=n.xnum[0],c=n.xnum[n.xnum.length-1],m=Math.max(2,Math.floor((a-o)/64)),h=gt([d,c],[o,a]),f=ua(d,c,m,t.locale);if(f.length>=2&&n.keys.length>f.length)l=f.map(p=>({x:h(p.t),label:p.label}));else{let p=n.keys.map((k,C)=>r(C));l=Wn(p,n.labels).map(k=>({x:p[k],label:n.labels[k]}))}}else if(n.type==="number"&&n.keys.length>12){let[d,c]=Tt(n.xnum),m=gt([d,c],[o,a]),h=d>=1e3&&c<=9999?String:Tn(void 0,t.locale,Math.max(-d,c));l=m.ticks(Math.max(2,Math.floor((a-o)/70))).map(f=>({x:m(f),label:h(f)}))}else{let d=n.keys.map((c,m)=>r(m));l=Wn(d,n.labels).map(c=>({x:d[c],label:n.labels[c]}))}let u=_o(l,-2,t.width+2);return(0,T.jsx)("g",{"aria-hidden":"true",children:u.map((d,c)=>(0,T.jsx)(he,{x:d.x,y:i,anchor:"middle",size:We,fill:s.paint("muted"),children:d.label},c))})}function sl(e){let t=e.kind==="area",n=!t&&e.yScale==="log",r=ya(e,{height:g=>Math.max(200,Math.min(300,g*.5)),duration:1100,stagger:120}),{p:o,width:a,height:i}=r,s=tl[r.lang],l=(0,te.useId)().replace(/:/g,""),u=(0,te.useMemo)(()=>ma(e.data,e.x,e.y,e.series,{xType:e.xType,locale:r.locale,aggregate:e.aggregate,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,e.xType,r.locale,e.aggregate,e.dayFirst]),[d,c]=(0,te.useMemo)(()=>{if(!n)return[u,0];let g=0,y=u.values.map(M=>M.map(w=>w<=0?(g++,Number.NaN):w));return g?[{...u,values:y},g]:[u,0]},[u,n]),m=d.series.length,h=t?e.stack??(m>1?"stacked":"none"):"none",f=Ho(r.sig),p=f.view,k=(0,te.useMemo)(()=>p?nl(d,p[0],p[1]):d,[d,p]),C=Math.max(40,Math.round(e.maxPoints??a/2)),$=(0,te.useMemo)(()=>h!=="none"?da(k,C):k,[k,h,C]),B=e.hidden?.join("")??"",[b,R]=(0,te.useMemo)(()=>ca($,B),[$,B]),X=b.rowValues??b.values,z=(0,te.useMemo)(()=>h==="none"?null:Zn(b.values,h==="percent"?"expand":"zero"),[b,h]),Z=Yo(e.annotations),{lower:U,upper:G}=e,P=rl(b,e.bandFrom,Z),E=(0,te.useMemo)(()=>{if(U===void 0||G===void 0||h!=="none")return null;let g=ra($.rows,U,G,Array.isArray(e.y),e.data,P),y=b===$?g:R.map(M=>g[M]);if(n)for(let M of y)M.lo.forEach((w,F)=>{w>0&&M.hi[F]>0||(M.lo[F]=M.hi[F]=Number.NaN)});return y.some(M=>M.lo.some(Number.isFinite))?y:null},[$,b,R,U,G,e.y,e.data,h,P,n]),S=(0,te.useMemo)(()=>{let g=[];return E?.forEach(y=>y.lo.forEach((M,w)=>Number.isFinite(M)&&g.push(M,y.hi[w]))),g.length?Tt(g):g},[E]),x=(0,te.useMemo)(()=>{let g=$.values.map(y=>y.reduce((M,w)=>M+(Number.isFinite(w)?w:0),0));return Ze(e.highlight,$.series,$.series,g,"first")},[$,e.highlight]),A=(0,te.useMemo)(()=>{if(t)return e.colorMode==="categorical"?Bn(o,m,x):eo(o,m,x);if(e.colorMode==="categorical")return Bn(o,m,x);let g=ye(o,"strong"),y=ye(o,"accent");return $.series.map((M,w)=>x.has(w)?y:g)},[t,e.colorMode,o,m,x,$.series]),L=(0,te.useMemo)(()=>b===$?x:new Set(R.flatMap((g,y)=>x.has(g)?[y]:[])),[b,$,x,R]),Y=(0,te.useMemo)(()=>b===$?A:R.map(g=>A[g]),[b,$,A,R]),pe=[];z?z.y1.forEach(g=>g.forEach(y=>pe.push(y))):b.values.forEach(g=>g.forEach(y=>Number.isFinite(y)&&pe.push(y))),pe.push(...S);let bt=n?e.referenceLines?.filter(g=>g.y>0):e.referenceLines;bt?.forEach(g=>pe.push(g.y)),pe.push(...Uo(e.annotations).filter(g=>!n||g>0));let Q=e.baseline??0,me=!!e.signColors&&h==="none"&&(!n||Q>0);me&&pe.push(Q);let[Rt,rr]=Tt(pe),Oa=e.yDomain&&(!n||e.yDomain[0]>0&&e.yDomain[1]>0)?e.yDomain:void 0,Fe=e.yLabel?22:10,_e=22,sn=Math.max(2,Math.round(i/70)),nt=Oa??(n?sa(Rt,rr,sn):h==="percent"?[0,100]:qn(Rt,rr,sn,{zero:e.zero??t})),or=h==="percent"?g=>`${g}%`:Tn(e.format,r.locale,Math.max(Math.abs(nt[0]),Math.abs(nt[1]))),J=(n?la:gt)(nt,[i-_e,Fe]),ar=J.ticks(sn),ln=Lo(ar,or,r.locale),ir=e.endLabels??m>1,Ia=g=>{for(let y=b.keys.length-1;y>=0;y--)if(Number.isFinite(b.values[g][y]))return y;return-1},sr=ir?Math.min(a*.28,Math.max(...$.series.map(g=>ue(g,11,700)),20)+14):10,$e=ln+6,de=a-sr,we=al(b,$e,de),Ke=(0,te.useMemo)(()=>b.keys.map((g,y)=>we(y)),[b,$e,de]),yt=e.maxPoints??Math.max(60,Math.round((de-$e)*2)),un=e.curve??"smooth",xt=Math.min(nt[1],Math.max(nt[0],0)),rt=o.color(e.downColor,"neutralStrong"),ot=J(Q),at=we.v,lr=g=>at?tn(b.type,g):b.keys.indexOf(String(g)),za=g=>{let y=lr(g);return at?Number.isFinite(y)?at(y):null:y<0?null:we(y)},Ft=b.xnum.length-1,cn={p:o,lang:r.lang,xAt:za,y:J,x0:$e,x1:de,top:Fe,bottom:i-_e,half:at||Ft<1?0:(we(1)-we(0))/2,time:b.type==="date"&&at&&Ft>0?{t0:b.xnum[0],t1:b.xnum[Ft],n:Ft+1,xt:at}:void 0,points:()=>{let g=[...L][0]??0;return Ke.map((y,M)=>({x:y,y:J(z?z.y1[g][M]:b.values[g][M])}))}},ut=Qt(cn,Z),Ha=g=>{let y=lr(g),M=at?b.xnum.indexOf(y):y;return M>=0?b.labels[M]:String(g??"")},ur=(g,y)=>me&&L.has(g)&&y<Q?rt:Y[g].fill,mn=!e.connectNulls&&!z&&b.keys.length>1,dn=(0,te.useMemo)(()=>b.series.map((g,y)=>{let M=O=>z?z.y1[y][O]:b.values[y][O],w=[];for(let O=0;O<b.keys.length;O++){if(!Number.isFinite(M(O)))continue;let _=w[w.length-1];_&&(!mn||_[_.length-1]===O-1)?_.push(O):w.push([O])}let F=w.reduce((O,_)=>O+_.length,0);F>yt&&(w=w.map(O=>ao(O.map(_=>({x:we(_),y:M(_),k:_})),w.length>1?Math.max(3,Math.round(yt*O.length/F)):yt).map(_=>_.k)));let H=w.flat(),ne=0,se=w.map(O=>[ne,ne+=O.length]),Me=H.map(O=>J(M(O))),Be=z?H.map(O=>J(z.y0[y][O])):t?H.map(()=>J(xt)):void 0,Ue={s:y,name:g,pts:Me,xs:H.map(O=>we(O)),base:Be,sw:Y[y],hi:L.has(y),idx:H,spans:se},ve=E?.[y],Ye=ve?oa(we,ve.lo,ve.hi,J,yt):null;if(!ve||!Ye)return Ue;let be=e.outside?H.flatMap((O,_)=>Yn(b.values[y][O],ve.lo[O],ve.hi[O])?[_]:[]):void 0;return{...Ue,band:Ye,out:be}}),[b,z,Y,L,$e,de,i,nt[0],nt[1],yt,t,E,e.outside,mn,n]),fn=r.motion.stagger??120,cr=(0,te.useMemo)(()=>[...dn].sort((g,y)=>Number(g.hi)-Number(y.hi)),[dn]),Va=(0,te.useMemo)(()=>cr.map((g,y)=>{let M=J(xt),w=g.band?[...g.band.top,...g.band.bottom]:[],F=g.band?[g.band.top.length,g.band.bottom.length]:[];if(t){let H=g.base??g.pts.map(()=>M);return{key:`s:${g.name}`,to:[1,...g.pts,...H,...w],from:[0,...g.pts.map(()=>M),...H.map(()=>M),...w.map(()=>M)],delay:y*fn*.5,parts:[1,g.pts.length,H.length,...F],data:g}}return{key:`s:${g.name}`,to:[1,...g.pts,...w],from:[0,...g.pts,...w],enter:[0,...g.pts,...w],delay:y*fn,parts:[1,g.pts.length,...F],data:g}}),[cr,fn,t,i,xt]),mr=Ca(Va,r.motion),dr=r.fv,hn=r.fmt,ct=(0,te.useMemo)(()=>{if(!E)return null;let g=Array.isArray(e.y),y=b.series.map((w,F)=>[$a(U,R[F],g,s.lower),$a(G,R[F],g,s.upper)]);return{range:(w,F)=>Number.isFinite(E[w].lo[F])?` (${y[w][0]} ${hn(E[w].lo[F])} ~ ${y[w][1]} ${hn(E[w].hi[F])})`:"",unnamed:typeof e.y=="string"?e.y:void 0,desc:ol(b,E,y,e.outside===!0,s)}},[E,e.y,b,R,U,G,s,hn,e.outside]),ja=(0,te.useMemo)(()=>{if(!b.series.length)return[];let g=[...L][0]??0,y=(M,w,F)=>{let H=M||ct?.unnamed;return`${H?`${H} `:""}${dr(X[w][F])}${ct?.range(w,F)??""}`};return St(b.keys.length,M=>{let w=X[g]?.[M];return{datum:b.rows[g]?.[M]??null,index:M,key:b.keys[M],label:b.labels[M],value:Number.isFinite(w)?w:null,formatted:b.series.map((F,H)=>Number.isFinite(X[H][M])?y(F,H,M):null).filter(Boolean).join(", ")}})},[b,X,L,dr,ct]),fr=(g,y)=>{let M=d.keys.indexOf(g);return M<0?y:M},{brush:Ge,frame:Wa,hint:Ka,text:hr}=Vo(e,f,{p:o,active:r.active,lang:r.lang,count:b.keys.length,indexAt:g=>Xt(Ke,g),inPlot:(g,y)=>g>=$e-4&&g<=de+4&&y>=Fe&&y<=i-_e,toXRange:g=>{let y=b.keys[g.from],M=b.keys[g.to];return{from:fr(y,g.from),to:fr(M,g.to),fromKey:y,toKey:M,fromLabel:b.labels[g.from],toLabel:b.labels[g.to]}}}),ie=r.active;Nr(r,e.syncId,b.keys,b.labels);let gr=null;if(ie!==null&&b.keys[ie]!==void 0&&!Ge.dragging){let g=h==="percent"?Zn(X.map(w=>[w[ie]]),"expand"):null,y=b.series.map((w,F)=>({s:w,si:F,v:X[F][ie]})).filter(w=>Number.isFinite(w.v)).sort((w,F)=>F.v-w.v).map(w=>{let F=ct?.range(w.si,ie),H=g?`${Math.round(g.y1[w.si][0]-g.y0[w.si][0])}% · ${r.fv(w.v)}`:r.fv(w.v);return{label:w.s||ct?.unnamed||r.t.value,value:F?(0,T.jsxs)(T.Fragment,{children:[H,(0,T.jsx)("span",{style:{fontWeight:500,color:o.paint("muted")},children:F})]}):H,color:ur(w.si,w.v),strong:L.has(w.si)}}),M=Math.min(...b.series.map((w,F)=>z?J(z.y1[F][ie]):Number.isFinite(b.values[F][ie])?J(b.values[F][ie]):i));gr={x:we(ie),y:Math.max(Fe,M),title:b.labels[ie],rows:So(y,r.t.more)}}let Ga=g=>{if(!b.keys.length)return;let y=Xt(Ke,g);y>=0&&y!==r.active&&r.setActive(y,"pointer")},pr=null,br;if(Ge.range&&Ge.range.to<b.keys.length){let{from:g,to:y}=Ge.range,M=[...L][0]??0,w=b.values[M]??[],F=NaN,H=NaN,ne=-1,se=-1;for(let be=g;be<=y;be++){let O=w[be];Number.isFinite(O)&&(Number.isFinite(F)||(F=O),H=O,(ne<0||O>w[ne])&&(ne=be),(se<0||O<w[se])&&(se=be))}let Me=jo(F,H),Be=Me!==null?Wo(Me,r.locale):Number.isFinite(H-F)?`${H-F>=0?"+":""}${r.fv(H-F)}`:"-",Ue=hr.range(b.labels[g],b.labels[y]),ve=be=>J(z?z.y1[M][be]:w[be]),Ye=i-_e;pr=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(Ko,{p:o,x0:Ke[g],x1:Ke[y],top:Fe,bottom:Ye,width:a,main:Be,sub:Ue,dragging:Ge.dragging}),ne>=0&&se>=0&&ne!==se?(0,T.jsx)(Go,{p:o,lang:r.lang,width:a,top:Fe,bottom:Ye,max:{x:Ke[ne],y:ve(ne),text:r.fv(w[ne])},min:{x:Ke[se],y:ve(se),text:r.fv(w[se])}}):null]}),Ge.dragging||(br=`${s.span(Ue,Be)}${ne>=0?hr.extremes(r.fv(w[ne]),r.fv(w[se])):""}.${Ka}`)}let Ua=ir?(()=>{let g=dn.map(M=>{let w=Ia(M.s);if(w<0)return null;let F=J(z?(z.y0[M.s][w]+z.y1[M.s][w])/2:b.values[M.s][w]);return{d:M,y:F}}).filter(M=>M!==null),y=Po(g.map(M=>M.y),14,Fe+4,i-_e-2);return g.map((M,w)=>({...M,ly:y[w]}))})():[],Ya=r.motion.duration??1100,yr=e.dots??"auto",Xa=yr===!0||yr==="auto"&&!t&&b.keys.length<=16,xr=t?s.area:s.line,qa=e.description??`${xr}. ${s.desc(b.series.length,b.series.filter(Boolean).join(", ")||r.t.value,b.labels[0]??"",b.labels[b.labels.length-1]??"",b.keys.length)}.${ct?.desc??""}${ta(e.annotations,r.lang,r.fv,Ha)}${c?s.logDropped(c):""}`,gn=[],kr=[];for(let g of mr.items){let y=g.data,M=g.v,w=y.xs.length,F=M[0],H=M.slice(1,1+w),ne=y.xs.map((_,W)=>[_,H[W]??H[H.length-1]??0]),se=me&&y.hi,Me=y.spans,Be=Me.map(([_,W])=>Ut(ne.slice(_,W),un)),Ue=se?Me.map(([_],W)=>`${Be[W]}V${I(ot)}H${I(y.xs[_])}Z`).join(""):"",ve=_=>Me.map(([W,Te])=>Yt(ne.slice(W,Te),_.slice(W,Te),un)).join(""),Ye=mn?Me.filter(([_,W])=>W-_===1).map(([_])=>_):[],be=(_,W)=>{let[Te,Oe]=ne[_],Pe=se&&Oe>ot?rt:y.sw.fill;return(0,T.jsx)("circle",{cx:Te,cy:Oe,r:y.hi?3:2.2,fill:y.hi?Pe:o.paint("panel"),stroke:Pe,strokeWidth:y.hi?0:1.4,opacity:W},_)};if(y.band){let _=1+(t?2*w:w),W=y.band.top.length;kr.push((0,T.jsx)("path",{d:aa(y.band,M.slice(_,_+W),M.slice(_+W,_+2*W),un),fill:y.sw.fill,opacity:.16*F*(g.exiting?.4:1)},g.key))}let O=_=>y.out?.map(W=>{let[Te,Oe]=ne[W];return(0,T.jsx)("circle",{cx:Te,cy:Oe,r:3.6,fill:se&&Oe>ot?rt:y.sw.fill,stroke:o.paint("panel"),strokeWidth:1.5,opacity:_(W)},`o${W}`)});if(t){let _=M.slice(1+w,1+2*w),W=y.xs.map((Se,q)=>[Se,_[q]??J(xt)]),Te=Be.join(""),Oe=se?["up","dn"].map(Se=>(0,T.jsx)("path",{d:Ue,fill:Se==="up"?y.sw.fill:rt,opacity:.5,clipPath:`url(#${l}${Se})`},Se)):(0,T.jsx)("path",{d:ve(W),fill:y.sw.fill,opacity:h==="none"?y.hi?.5:.28:1}),Pe=Se=>(se?["up","dn"]:[null]).map(q=>(0,T.jsx)("path",{d:Te,fill:"none",stroke:q==="dn"?rt:h==="none"?y.sw.fill:o.paint("panel"),strokeWidth:h==="none"?y.hi?2.2:1.4:1.2,strokeLinejoin:"round",strokeDasharray:Se?"5 4":void 0,opacity:Math.min(1,F*1.4),clipPath:q?`url(#${l}${q})`:void 0},q??"s"));gn.push((0,T.jsxs)("g",{opacity:g.exiting?.4:1,children:[Oe,ut!==null?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("g",{clipPath:`url(#${l}pre)`,children:Pe(!1)}),(0,T.jsx)("g",{clipPath:`url(#${l}post)`,children:Pe(!0)})]}):Pe(!1),Ye.map(Se=>be(Se,Math.min(1,F*1.4))),O(()=>Math.min(1,F*1.4))]},g.key))}else{let _=y.hi?2.6:1.7,W=F<.999,Te=q=>Math.max(0,Math.min(1,(F-(w>1?q/(w-1):1))*8+(F>=.999?1:0))),Oe=W&&Me.length>1?Me.flatMap(([q,Ie],pn)=>Ie-q>1?[[Be[pn],Math.max(0,Math.min(1,(F*(w-1)-q)/(Ie-1-q)))]]:[]):[[Be.join(""),F]],Pe=q=>(se?["up","dn"]:[null]).flatMap(Ie=>Oe.map(([pn,Za],Ja)=>(0,T.jsx)("path",{d:pn,fill:"none",stroke:Ie==="dn"?rt:y.sw.fill,strokeWidth:_,strokeLinejoin:"round",strokeLinecap:"round",pathLength:W?1:void 0,strokeDasharray:W?"1 1":q?"5 4":void 0,strokeDashoffset:W?1-Za:void 0,clipPath:Ie?`url(#${l}${Ie})`:void 0},`${Ie??"s"}${Ja}`))),Se=e.area&&y.hi?se?["up","dn"].map(q=>(0,T.jsx)("path",{d:Ue,fill:q==="up"?y.sw.fill:rt,opacity:.16*F,clipPath:`url(#${l}${q})`},q)):(0,T.jsx)("path",{d:ve(ne.map(([q])=>[q,J(xt)])),fill:`url(#${l}g)`,opacity:F}):null;gn.push((0,T.jsxs)("g",{opacity:g.exiting?.4:1,children:[Se,ut!==null?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("g",{clipPath:`url(#${l}pre)`,children:Pe(!1)}),(0,T.jsx)("g",{clipPath:`url(#${l}post)`,children:Pe(!0)})]}):Pe(!1),(Xa?ne.map((q,Ie)=>Ie):Ye).map(q=>be(q,Te(q))),O(Te)]},g.key))}}return(0,T.jsxs)(No,{c:r,kind:xr,ariaLabel:e.ariaLabel,description:qa,events:ja,tip:gr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(g,y,M)=>{Ge.move(g),M.pointerType==="touch"?r.setActive(Xt(Ke,g),"touch"):Ga(g)},...Wa,announce:br,defs:e.area||ut!==null||me?(0,T.jsxs)(T.Fragment,{children:[e.area?(0,T.jsxs)("linearGradient",{id:`${l}g`,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,T.jsx)("stop",{offset:"0%",stopColor:o.paint("accent"),stopOpacity:.28}),(0,T.jsx)("stop",{offset:"100%",stopColor:o.paint("accent"),stopOpacity:0})]}):null,ut!==null?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("clipPath",{id:`${l}pre`,children:(0,T.jsx)("rect",{x:-a,y:-i,width:a+ut,height:i*3})}),(0,T.jsx)("clipPath",{id:`${l}post`,children:(0,T.jsx)("rect",{x:ut,y:-i,width:a*2,height:i*3})})]}):null,me?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("clipPath",{id:`${l}up`,children:(0,T.jsx)("rect",{x:-a,y:-i,width:a*3,height:i+ot})}),(0,T.jsx)("clipPath",{id:`${l}dn`,children:(0,T.jsx)("rect",{x:-a,y:ot,width:a*3,height:i*2})})]}):null]}):null,children:[e.yLabel?(0,T.jsx)(he,{x:ln,y:6,anchor:"start",size:10.5,fill:o.paint("muted"),children:e.yLabel}):null,(0,T.jsx)(Eo,{p:o,ticks:ar,y:J,x0:ln,x1:de+4,fmt:or,locale:r.locale}),(0,T.jsx)(Jo,{list:e.annotations,g:cn}),me?(0,T.jsx)("line",{x1:$e,x2:de,y1:ot,y2:ot,stroke:o.paint("dim"),pointerEvents:"none"}):null,bt?.map((g,y)=>(0,T.jsx)("line",{x1:$e,x2:de,y1:J(g.y),y2:J(g.y),stroke:o.paint("dim"),strokeDasharray:"3 3"},y)),(0,T.jsx)("rect",{x:$e,y:Fe,width:Math.max(0,de-$e),height:Math.max(0,i-_e-Fe),fill:"transparent"}),kr,gn,(0,T.jsx)(ea,{list:e.annotations,g:cn}),ie!==null&&b.keys[ie]!==void 0?(0,T.jsx)(Bo,{p:o,x:we(ie),top:Fe,bottom:i-_e,dots:b.series.flatMap((g,y)=>{let M=z?z.y1[y][ie]:b.values[y][ie];return Number.isFinite(M)?[{k:y,y:J(M),color:ur(y,M),strong:L.has(y)}]:[]})}):null,bt?.map((g,y)=>g.label?(0,T.jsxs)("g",{pointerEvents:"none",children:[(0,T.jsx)("rect",{x:de-ue(g.label,10.5)-8,y:J(g.y)-17,width:ue(g.label,10.5)+8,height:15,rx:5,fill:o.paint("panel"),opacity:.94}),(0,T.jsx)(he,{x:de-4,y:J(g.y)-9.5,anchor:"end",size:10.5,fill:o.paint("muted"),children:g.label})]},`rl${y}`):null),Ua.map(g=>(0,T.jsx)(he,{x:de+8,y:g.ly,size:11,weight:g.d.hi?800:500,fill:o.paint(g.d.hi?"ink":"muted"),opacity:mr.fade(Ya*.75,300),children:Ee(g.d.name,sr-10,11,g.d.hi?800:500)},g.d.name)),pr,(0,T.jsx)(il,{c:r,model:b,xs:we,x0:$e,x1:de,y:i-_e+13}),ie!==null&&b.keys[ie]!==void 0&&!Ge.dragging?(0,T.jsx)(Oo,{p:o,x:we(ie),y:i-_e+13,label:b.labels[ie],width:a}):null]})}function Jn(e){return(0,T.jsx)(sl,{...e,kind:"line"})}var ll=D(re(),1);var Ta=D(V(),1);var Ma=e=>e?"neutralStrong":"accent";var Qn=D(V(),1);function Sa(e,t,n,r){if(typeof e!="function")return Ze(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var ul=D(re(),1);var tr=D(V(),1),cl={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}, ${He(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Aa={en:cl,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}일 이동평균`}},er=["ink","muted","dim"];function Na(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,er.length)}var ml=D(re(),1);var Da=D(V(),1),dl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${He(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},fl={en:dl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ra=(e,t)=>fl[e].other(t);function Fa(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,Co(o.map(a=>a.value)))}}var Pa=e=>Number.isFinite(e)&&e>0?e:0;var tt=D(V(),1);function La(e,t){let n=Gt(e);return n?.type==="scatter"&&t?.size!==void 0?Gt("bubble"):n}function hl(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function gl(e,t,n,r=!1){let o=La(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Hn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),u=c=>c.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(d.includes(o.type)){let c=Kt(a.label,"label"),m=$t(a.value,"value"),h=o.type==="waffle",f=t.map((b,R)=>({r:b,label:c(b,R),value:h?m(b,R):Pa(m(b,R))})),{kept:p,other:k}=h?{kept:f,other:null}:Fa(f,i.other,(b,R)=>({r:{},label:Ra(le(n),b),value:R})),C=Ze(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),h?"first":"max"),$=k?[...p,k]:p,B=Ct($.length,C);return $.map((b,R)=>({label:b.label,color:B[R]}))}if(o.type==="candlestick"){let c=Na(Array.isArray(i.ma)?i.ma:void 0,t.length),m=Aa[le(n)];return[{label:m.up,color:i.upColor??"accent"},{label:m.down,color:i.downColor??"neutralStrong"},...c.map((h,f)=>({label:m.maLegend(h),color:er[f],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let c=Kt(a.series,"series"),m=Je(t.map((f,p)=>c(f,p)));if(m.length<2)return[];let h=Qr(m.length,Sa(s,t,m,c));return u(m.map((f,p)=>({label:f,color:h[p],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(a.y))c=a.y;else if(typeof a.series=="string"){let p=Kt(a.series,"series");c=Je(t.map((k,C)=>p(k,C)))}let m=Vn(o.type,a,i);if(m.length){let p=Ct(c.length,Ze(s,c,c,c.map(()=>0),"none")),k=c.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:c.map((C,$)=>({label:C,color:p[$]}));return[...u(k),...m.map((C,$)=>({label:C,color:Ma($),shape:"line"}))]}if(c.length<2)return[];let h=Ze(s,c,c,c.map(()=>0),"first");if(o.type==="line"||o.type==="radar")return u(c.map((p,k)=>({label:p,color:h.has(k)?"accent":"neutralStrong",shape:o.type==="line"?"line":"square"})));let f=Ct(c.length,h);return u(c.map((p,k)=>({label:p,color:f[k]})))}return[]}function Ea(e,t){let{spec:n}=e,r=La(n.type,n.encoding),o=(0,Nt.useMemo)(()=>To(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=xo(n,e.locale),s=Ne(i),l=le(s),u=io(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),d=wo(n),c=(0,Nt.useMemo)(()=>d?ho(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],f=h.join(""),[p,k]=(0,Nt.useState)(null);if(!r)return(0,tt.jsx)(_n,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let C=o??u.data,$=t[r.type],B={...n.options??{}},b={...hl(r,n.encoding),...B,...c?{tooltip:c}:{},data:C,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},R=n.card?.legend==="toggle"&&ko(r.type,n.encoding??{},B),X=p&&p.base===f?p.hidden:h;R&&(b.hidden=X);let z=P=>k(E=>{let S=E&&E.base===f?E.hidden:h;return{base:f,hidden:S.includes(P)?S.filter(x=>x!==P):[...S,P]}}),Z=b.height??220,U=a&&!C.length&&(u.loading||u.error||u.empty)?(0,tt.jsx)(_n,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:Z,locale:i}):(0,tt.jsx)($,{...b});if(n.card){let P=n.card,E=P.legend==="auto"||P.legend==="toggle"?gl(n,C,s,R):P.legend,S=E?.length?R?(0,tt.jsx)(En,{items:E,hidden:X,onToggle:z,locale:i}):E:void 0,x=P.download?(0,tt.jsx)(fo,{data:C,columns:vo(n),filename:P.title??r.type,formats:Array.isArray(P.download)?P.download:void 0,locale:i}):void 0;U=(0,tt.jsx)(Zr,{number:P.number,title:P.title??yo(r,l),subtitle:P.subtitle,legend:S,actions:x,source:P.source||void 0,note:P.note||void 0,accent:P.accent,takeaway:P.takeaway,level:P.level,sample:P.sample,replay:P.replay!==!1,className:e.className,locale:i,children:U})}let G=e.theme??n.theme;return G&&(U=(0,tt.jsx)(Vt,{theme:G,children:U})),U}function pl({cfg:e,components:t}){let n=nn();return Ea({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Ba(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,_a.hydrateRoot)(r,(0,nr.createElement)(Vt,{theme:o.theme,cssVars:!0},(0,nr.createElement)(pl,{cfg:o,components:{[e]:t}})))}Ba("line",Jn);})();
|
|
27
|
+
`}function Al(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function kr(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Ta=2,ut=16;function Sa(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Aa(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 Fa(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+ut*2,i+ut*2],u=o.cloneNode(!0),d=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((f,p)=>{let x;for(let k of Array.from(f.attributes)){if(!Ml.test(k.value))continue;let $=(x??(x=getComputedStyle(f))).getPropertyValue(k.name);$&&d[p].setAttribute(k.name,Sa($,c))}}),u.removeAttribute("style");for(let[f,p]of Object.entries({viewBox:`${-ut} ${-ut} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(p));let m=Sa(getComputedStyle(r).backgroundColor,c),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(Aa("rect",{x:-ut,y:-ut,width:s,height:l,fill:m}),f),h&&u.insertBefore(Aa("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:a,vh:i,bg:m,canvas:h}}function Fl(e,t){let n=Fa(e,Ta,!1);if(!n)return;let r=Ta,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,ut*r,ut*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&kr(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Na(e){let t=Le(e.theme),n=te(xe(e.locale))==="ko",r=Al(e.filename),o=(a,i)=>{if(a==="csv")return kr(new Blob([Sl(e.data,e.columns?.length?e.columns:Tl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Fl(i,r);let s=Fa(i,1,!0);s&&kr(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,wr.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:$l.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,wr.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Ra=L(G(),1);function Pa(e,t=fe){let n=ht(void 0,t),r=e.split(`
|
|
28
|
+
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Ot(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,u=s.replace($o,(d,c)=>o(a,c.trim())??(l=!0,""));l||i.push(u)}return i.length?i.map((s,l)=>(0,Ra.jsx)("div",{children:s},l)):null}}function Da(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 pt(t.csv)}return null}var re=L(ee(),1);var xt=L(ee(),1);var ie=L(G(),1),Nl={zoomHint:" Press Enter to zoom in.",pickHint:" Press Enter to select.",high:"High",low:"Low",resetLabel:"Show all (reset zoom)",reset:"Show all",extremes:(e,t)=>`, high ${e}, low ${t}`,range:(e,t)=>`${e} to ${t}`},Ea={en:Nl,ko:{zoomHint:" Enter를 누르면 확대해요.",pickHint:" Enter를 누르면 이 구간을 골라요.",high:"최고",low:"최저",resetLabel:"전체 보기(확대 풀기)",reset:"전체 보기",extremes:(e,t)=>`, 최고 ${e}, 최저 ${t}`,range:(e,t)=>`${e}~${t}`}},Pl=4;function Rl(e){let[t,n]=(0,xt.useState)(null),[r,o]=(0,xt.useState)(!1),a=(0,xt.useRef)(null),i=(0,xt.useRef)(null),s=()=>{a.current=null,i.current=null,o(!1),n(null)},l=(m,h,f)=>!e.enabled||e.count<2||f.pointerType==="touch"||f.button!==0||!e.inPlot(m,h)?!1:(a.current={i:e.indexAt(m),x:m,moved:!1},f.currentTarget.setPointerCapture?.(f.pointerId),!0),u=m=>{let h=a.current;if(!h)return!1;if(!h.moved&&Math.abs(m-h.x)<Pl)return!0;h.moved=!0;let f=e.indexAt(m),p=Math.min(h.i,f),x=Math.max(h.i,f);return o(!0),n(k=>k?.from===p&&k.to===x?k:{from:p,to:x}),!0},d=(m,h,f)=>{let p=a.current;if(a.current=null,f.currentTarget.hasPointerCapture?.(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId),!p)return;if(o(!1),!p.moved||f.type==="pointercancel"){t&&(n(null),e.onCommit(null));return}let x=e.indexAt(m),k={from:Math.min(p.i,x),to:Math.max(p.i,x)},$=k.to>k.from;n($&&e.keep!==!1?k:null),e.onCommit($?k:null)},c=(m,h)=>{if(!e.enabled)return!1;if(m.key==="Escape"&&t)return s(),e.onCommit(null),!0;if(m.key==="Enter"&&t&&i.current!==null)return i.current=null,e.keep===!1&&n(null),e.onCommit(t),!0;if(!m.shiftKey||m.key!=="ArrowLeft"&&m.key!=="ArrowRight"||e.count<2)return!1;let f=m.key==="ArrowRight"?1:-1,p=i.current??h??(f>0?0:e.count-1),x=t&&i.current!==null?t.from===p?t.to:t.from:p,k=Math.max(0,Math.min(e.count-1,x+f));return i.current=p,n(k===p?null:{from:Math.min(p,k),to:Math.max(p,k)}),!0};return{range:t,dragging:r,keyboard:t!==null&&i.current!==null,down:l,move:u,up:d,key:c}}function _a(e){let[t,n]=(0,xt.useState)(null);return t&&t.sig!==e&&n(null),{view:t&&t.sig===e?t.range:null,zoomTo:r=>n({sig:e,range:r}),reset:()=>n(null)}}function Ia(e,t,n){let r=Ea[n.lang],o=e.brush==="zoom"?"zoom":e.brush?"select":null,a=Rl({enabled:o!==null,count:n.count,indexAt:n.indexAt,inPlot:n.inPlot,keep:o!=="zoom",onCommit:l=>{let u=l?n.toXRange(l):null;e.onBrush?.(u),o==="zoom"&&u&&u.to>u.from&&t.zoomTo([u.from,u.to])}}),i={onPointerDown:o?a.down:void 0,onPointerUp:o?a.up:void 0,onKey:o?l=>l.key==="Escape"&&t.view&&!a.range?(t.reset(),!0):a.key(l,n.active):void 0,overlay:t.view?(0,ie.jsx)(Dl,{p:n.p,onReset:t.reset,text:r}):null},s=a.keyboard?o==="zoom"?r.zoomHint:r.pickHint:"";return{brush:a,frame:i,hint:s,text:r}}function Oa(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e===0?null:(t-e)/Math.abs(e)}function Ba(e,t=fe){let n=Math.round(e*1e3)/10;return`${n>0?"+":""}${at(n,{locale:t,maximumFractionDigits:1})}%`}function za(e){let{p:t,top:n,bottom:r}=e,o=Math.min(e.x0,e.x1),a=Math.max(e.x0,e.x1),i=ae(e.main,11.5,800),s=ae(e.sub,10.5,500)+6,l=i+s+16,u=Math.max(2,Math.min(e.width-l-2,(o+a)/2-l/2)),d=n+4;return(0,ie.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,ie.jsx)("rect",{x:o,y:n,width:Math.max(1,a-o),height:Math.max(0,r-n),fill:t.paint("accent"),opacity:e.dragging?.1:.14}),(0,ie.jsx)("line",{x1:o,x2:o,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,ie.jsx)("line",{x1:a,x2:a,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,ie.jsx)("rect",{x:u,y:d,width:l,height:22,rx:8,fill:t.paint("panel"),stroke:t.paint("line")}),(0,ie.jsx)(pe,{x:u+8,y:d+11,size:11.5,weight:800,fill:t.paint("ink"),children:e.main}),(0,ie.jsx)(pe,{x:u+8+i+6,y:d+11,size:10.5,weight:500,fill:t.paint("muted"),children:e.sub})]})}function Ha(e){let{p:t,width:n,top:r,bottom:o,max:a,min:i}=e,s=Ea[e.lang];return(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(La,{p:t,x:a.x,y:a.y,text:`${s.high} ${a.text}`,below:a.y-26<r+30,width:n}),(0,ie.jsx)(La,{p:t,x:i.x,y:i.y,text:`${s.low} ${i.text}`,below:i.y+26<o,width:n})]})}function La(e){let{p:t}=e,n=ae(e.text,10.5,700)+12,r=18,o=Math.max(2,Math.min(e.width-n-2,e.x-n/2)),a=e.below?e.y+8:e.y-r-8;return(0,ie.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,ie.jsx)("circle",{cx:e.x,cy:e.y,r:3.5,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:2}),(0,ie.jsx)("rect",{x:o,y:a,width:n,height:r,rx:9,fill:t.paint("ink")}),(0,ie.jsx)(pe,{x:o+n/2,y:a+r/2,anchor:"middle",size:10.5,weight:700,fill:t.paint("onInk"),children:e.text})]})}function Dl(e){let{p:t}=e;return(0,ie.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onReset,"aria-label":e.text.resetLabel,style:{position:"absolute",top:0,right:0,height:24,padding:"0 10px",borderRadius:12,border:`1px solid ${t.paint("line")}`,background:t.paint("panel"),color:t.paint("muted"),fontSize:11.5,fontWeight:600,zIndex:4},children:e.text.reset})}var Ll=e=>Array.isArray(e);function Sn(e,t,n){let r=Ll(e)?e:[e];return n?t<r.length?r[t]:null:r[0]}function Va(e,t,n,r,o,a){let i=typeof t=="function"||typeof n=="function"?new Map(o.map((s,l)=>[s,l])):null;return e.map((s,l)=>{let u=new Array(s.length).fill(NaN),d=new Array(s.length).fill(NaN),c=Sn(t,l,r),m=Sn(n,l,r);if(c===null||m===null)return{lo:u,hi:d};let h=gt(c,""),f=gt(m,"");for(let p=Math.max(0,a);p<s.length;p++){let x=s[p];if(x===null)continue;let k=i?.get(x)??-1,$=h(x,k),S=f(x,k);!Number.isFinite($)||!Number.isFinite(S)||(u[p]=Math.min($,S),d[p]=Math.max($,S))}return{lo:u,hi:d}})}var vr=(e,t,n)=>Number.isFinite(e)&&Number.isFinite(t)&&(e<t||e>n);function El(e,t){let n=[],r=-1;for(let o=0;o<=e.length;o++){let a=o<e.length&&Number.isFinite(e[o])&&Number.isFinite(t[o]);a&&r<0?r=o:!a&&r>=0&&(o-1>r&&n.push([r,o-1]),r=-1)}return n}function _l(e,t,n,r,o,a,i){let s=t(a),l=t(i);if(!(l>=s))return;let u=Math.floor(s),d=Math.floor(l)-u+1,c=new Array(d).fill(1/0),m=new Array(d).fill(-1/0),h=0;for(let f=a;f<i;f++){let p=Math.min(n[f],n[f+1]),x=Math.max(r[f],r[f+1]),k=Math.floor(t(f+1))-u;for(let $=h;$<=k;$++)p<c[$]&&(c[$]=p),x>m[$]&&(m[$]=x);h=k}for(let f=0;f<d;f++){let p=Math.max(s,u+f),x=Math.min(l,u+f+1);x<=p&&f>0||(e.xl.push(p),e.xr.push(x),e.top.push(o(m[f])),e.bottom.push(o(c[f])))}}function Wa(e,t,n,r,o){let a=El(t,n);if(!a.length)return null;let i=a.reduce((u,[d,c])=>u+c-d+1,0),s={runs:[],xl:[],xr:[],top:[],bottom:[]},l=i>o;for(let[u,d]of a)if(s.runs.push(s.top.length),l)_l(s,e,t,n,r,u,d);else for(let c=u;c<=d;c++)s.xl.push(e(c)),s.top.push(r(n[c])),s.bottom.push(r(t[c]));return s.runs.push(s.top.length),s}function Il(e,t,n,r,o,a){let i=W(n[o]),s=`M${W(e[o])},${i}`;for(let l=o+1;l<a;l++){let u=W(n[l]);u!==i&&(s+=`H${W(e[l])}V${i=u}`)}i=W(r[a-1]),s+=`H${W(t[a-1])}V${i}`;for(let l=a-2;l>=o;l--){let u=W(r[l]);u!==i&&(s+=`H${W(t[l])}V${i=u}`)}return`${s}H${W(e[o])}Z`}var ja=(e,t,n,r)=>e.slice(n,r).map((o,a)=>[o,t[n+a]]);function Ga(e,t,n,r){let o="";for(let a=0;a+1<e.runs.length;a++){let i=e.runs[a],s=e.runs[a+1];s-i<1||(o+=e.xr.length?Il(e.xl,e.xr,t,n,i,s):gn(ja(e.xl,t,i,s),ja(e.xl,n,i,s),r))}return o}var se=L(ee(),1);function Ka(e,t){let n=Le(e.theme),[r,o,a]=Mn(e.width),i=Pt(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,d=Tn(e.reducedMotion??"auto"),c=e.animate!==!1&&!d&&Pe,m=va(r,e.animateOnView!==!1&&c),h=xe(e.locale),f=te(h),p=(0,se.useMemo)(()=>ht(e.format,h,t.format),[e.format,h,t.format]),x=(0,se.useCallback)(X=>tn(X,{locale:h}),[h]),k=(0,se.useMemo)(()=>nn(p,e.unit),[p,e.unit]),$=(0,se.useMemo)(()=>fn(e.data),[e.data]),[S,b]=(0,se.useState)(null),[v,O]=(0,se.useState)(null),E=(0,se.useRef)([]),H=(0,se.useRef)(e.onHover);H.current=e.onHover;let j=(0,se.useRef)(e.onClick);j.current=e.onClick;let z=(0,se.useRef)(null),I=(0,se.useRef)(null),F=(0,se.useRef)(null),N=(0,se.useCallback)((X,me="pointer")=>{if(F.current!==X){F.current=X;let ve=X===null?null:E.current[X]??null;queueMicrotask(()=>H.current?.(ve)),I.current?.(X)}z.current=X===null?null:me,b(X),O(z.current)},[]),w=(0,se.useCallback)(X=>{z.current!=="keyboard"&&(z.current=X===null?null:"sync",b(X),O(z.current))},[]),P=(0,se.useCallback)(X=>{let me=E.current[X];me&&j.current?.(me)},[]),_=Fo(e.replayKey),K=e.width!==void 0||(a??0)>0,le={enabled:c,active:m.visible&&K,near:m.near,replayKey:_,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Ue=(0,se.useCallback)((X,me=1)=>S===null||S===X?me:me*.38,[S]);return{p:n,width:s,height:u,measured:K,responsive:e.width===void 0,pending:Pe&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:le,fv:k,fmt:p,pct:x,locale:h,lang:f,t:f==="ko"?ao:oo,active:S,via:v,setActive:N,click:P,events:E,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Ue,sig:$,description:e.description,reduced:d,publish:I,applySync:w}}var ne=L(ee(),1);function Ol(e){return 1-Math.pow(1-e,3)}function Bl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function zl(e){return e==="easeInOut"?Bl:e==="linear"?t=>t:Ol}function Hl(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 Dt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function An(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 Ua(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 Xa(e,t,n,r){if(!t||!n||t.length!==n.length)return Dt(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of Dt(s,n[i]))o.push(l)}return o.length===r?o:Dt(e,r)}var Fn=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||!An(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Ua(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=An(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let u=i.to.length;s.from=Xa(s.cur,s.parts,i.parts,u),s.vel=Xa(s.curVel,s.parts,i.parts,u),s.parts=i.parts,s.to=i.to.slice(),Ua(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=An(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let u=this.make(i,i.enter??i.from??i.to,n+l,0);u.done=An(u.from,u.to),this.tracks.set(i.key,u)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=Dt(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=zl(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,u=s.to.length;if(s.from.length!==u&&(s.from=Dt(s.from,u)),s.vel.length!==u&&(s.vel=Dt(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let d;if(this.easing==="spring"){let c=Math.exp(-a*l),m=a*l>=8&&a*l<20,h=0;for(let f=0;f<u;f++){let p=s.from[f]-s.to[f],x=s.vel[f]+a*p;s.cur[f]=s.to[f]+(p+x*l)*c,s.curVel[f]=(s.vel[f]-a*x*l)*c,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}d=a*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+a*l)*c)}else{let c=Math.min(1,l/o),m=r(c),h=Hl(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*m,s.curVel[f]=(s.to[f]-s.from[f])*h;d=c>=1,s.progress=m}if(d){for(let c=0;c<u;c++)s.cur[c]=s.to[c],s.curVel[c]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Gt=new Set,Nn=0;function Ya(e){Nn=0;let t=Array.from(Gt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Gt.delete(n)}Gt.size&&typeof requestAnimationFrame<"u"&&(Nn=requestAnimationFrame(Ya))}function qa(e){return Gt.add(e),!Nn&&typeof requestAnimationFrame<"u"&&(Nn=requestAnimationFrame(Ya)),()=>{Gt.delete(e)}}function jl(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 Za(e,t){let n=(0,ne.useMemo)(()=>jl(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:u=900,stagger:d=0}=t,c=(0,ne.useRef)(null),m=(0,ne.useRef)("init"),h=(0,ne.useRef)(null),f=(0,ne.useRef)(s),p=(0,ne.useRef)(i),x=(0,ne.useRef)(!1),k=(0,ne.useRef)(0),[,$]=(0,ne.useState)(0),S=(0,ne.useRef)(null),b=(0,ne.useRef)(!0);c.current||(c.current=new Fn,c.current.configure(l,u),c.current.snap(n),h.current=n);let v=c.current;if(v.configure(l,u),h.current!==n){let I=m.current,F=!Object.is(f.current,s);v.sameTargets(n)?v.refreshData(n):!r||I==="init"?v.snap(n):I==="idle"?v.hold(n):I==="running"||F?v.update(n,Zt(),d):v.snap(n),h.current=n,f.current=s}let O=(0,ne.useRef)(()=>!1);O.current=I=>{if(!b.current)return!1;let F=v.step(I);return!F&&m.current==="running"&&(m.current="done"),$(N=>(N+1)%1e9),F||(S.current=null),F};let E=(0,ne.useCallback)(()=>{if(!Pe||S.current||!v.animating)return;let I=F=>O.current(F);S.current=qa(I)},[v]);ze(()=>{let I=!Object.is(p.current,i);if(p.current=i,!r){(m.current!=="done"||v.animating)&&(v.snap(h.current??n),m.current="done",$(F=>F+1));return}m.current==="init"||I&&a?(v.hold(h.current??n),m.current="idle",x.current=!1,$(F=>F+1)):I&&(x.current=!0)},[r,i]),ze(()=>{!r||!a||!x.current||(x.current=!1,v.hold(h.current??n),m.current="idle",$(I=>I+1))},[a,r]),(0,ne.useEffect)(()=>{r&&o&&m.current==="idle"&&(v.start(Zt()),k.current+=1,m.current="running",E(),$(I=>I+1))},[r,o,i,v,E]),(0,ne.useEffect)(()=>{v.animating&&E()}),(0,ne.useEffect)(()=>(b.current=!0,()=>{b.current=!1,S.current?.(),S.current=null}),[]);let H=Zt(),j=v.elapsed(H),z=r&&m.current==="idle";return{items:v.items(),get:I=>v.get(I),elapsed:z?0:j,fade:(I,F=320)=>z?0:Number.isFinite(j)?Math.max(0,Math.min(1,(j-I)/F)):1,waiting:z,animating:v.animating,generation:k.current}}var A=L(G(),1),Vl={line:"Line chart",area:"Area chart",span:(e,t)=>`${e}: ${t}`,desc:(e,t,n,r,o)=>`${Re(e,"series","series")} (${t}), x from ${n} to ${r}, ${Re(o,"point")}`,lower:"low",upper:"high",band:e=>` Range ${e}.`,range:(e,t)=>`${e} to ${t}`,outside:(e,t)=>e?` ${Re(e,"point")} outside the range: ${t}.`:" No points outside the range.",where:(e,t)=>`${e} (${t})`,logDropped:e=>` ${Re(e,"value")} at or below 0 ${e===1?"is":"are"} not shown on the log scale.`},Wl={en:Vl,ko:{line:"라인 차트",area:"영역 차트",span:(e,t)=>`${e} 구간 ${t}`,desc:(e,t,n,r,o)=>`계열 ${e}개(${t}), x ${n}부터 ${r}까지 ${o}개 지점`,lower:"하한",upper:"상한",band:e=>` 범위 ${e}.`,range:(e,t)=>`${e}~${t}`,outside:(e,t)=>e?` 범위 밖 ${e}개 지점: ${t}.`:" 범위 밖 지점 없음.",where:(e,t)=>`${e}(${t})`,logDropped:e=>` 로그 눈금이라 0 이하 값 ${e}개는 뺐어요.`}};function Gl(e,t,n){let r=Math.max(0,Math.min(t,n)),o=Math.min(e.keys.length-1,Math.max(t,n)),a=e.keys.slice(r,o+1);return{type:e.type,keys:a,xnum:e.type==="band"?a.map((i,s)=>s):e.xnum.slice(r,o+1),labels:e.labels.slice(r,o+1),series:e.series,values:e.values.map(i=>i.slice(r,o+1)),rows:e.rows.map(i=>i.slice(r,o+1))}}function Kl(e,t,n){if(t!=="forecast")return 0;let r=e.keys.length;if(n===void 0)return r;if(e.type==="band"){let i=e.keys.indexOf(String(n));return i<0?r:i}let o=$n(e.type,n);if(!Number.isFinite(o))return r;let a=e.xnum.findIndex(i=>i>=o);return a<0?r:a}function Ul(e,t,n,r,o){let a=(d,c)=>e.series.length>1&&e.series[d]?o.where(c,e.series[d]):c,i=it(t.flatMap((d,c)=>d.lo.some(Number.isFinite)?[a(c,o.range(...n[c]))]:[]));if(!i.length)return"";let s=o.band(i.join(", "));if(!r)return s;let l=0,u=[];return t.forEach((d,c)=>{for(let m=0;m<d.lo.length;m++)vr(e.values[c][m],d.lo[m],d.hi[m])&&(l++,u.length<5&&u.push(a(c,e.labels[m])))}),s+o.outside(l,`${u.join(", ")}${l>u.length?", …":""}`)}function Ja(e,t,n,r){let o=Sn(e,t,n);return typeof o=="string"&&o?o:r}function Xl(e,t,n,r){let o=e.keys.length;if(e.type==="band"){let l=o>1?(n-t)/(o-1):0;return u=>o>1?t+u*l:(t+n)/2}let[a,i]=r??We(e.xnum),s=Me([a,i===a?a+1:i],[t,n]);return Object.assign(l=>s(e.xnum[l]),{v:s})}function Yl(e){let{c:t,model:n,xs:r,x0:o,x1:a,y:i,domain:s}=e,l=t.p,u;if(s&&n.type!=="band"&&e.fixed){let c=Me(s[1]===s[0]?[s[0],s[0]+1]:[s[0],s[1]],[o,a]);u=e.fixed.map(m=>({x:c(m.value),label:m.label}))}else if(s&&n.type!=="band"){let[c,m]=s[1]===s[0]?[s[0],s[0]+1]:s,h=n.type==="date",f=Math.max(2,Math.floor((a-6)/(h?64:70))),p=c>=1e3&&m<=9999?String:Tt(void 0,t.locale,Math.max(-c,m)),x=h?Ht(c,m,f,t.locale).map(S=>({v:S.t,label:S.label})):Me([c,m],[0,1]).ticks(f).map(S=>({v:S,label:p(S)})),k=Me([c,m],[6,a]),$=Me([c,m],[o,a]);u=pr(x.map(S=>({...S,x:k(S.v)})),-6,t.width+2).map(S=>({x:$(S.v),label:S.label}))}else if(n.type==="date"&&n.keys.length>1){let c=n.xnum[0],m=n.xnum[n.xnum.length-1],h=Math.max(2,Math.floor((a-o)/64)),f=Me([c,m],[o,a]),p=Ht(c,m,h,t.locale);if(p.length>=2&&n.keys.length>p.length)u=p.map(x=>({x:f(x.t),label:x.label}));else{let x=n.keys.map((k,$)=>r($));u=br(x,n.labels).map(k=>({x:x[k],label:n.labels[k]}))}}else if(n.type==="number"&&n.keys.length>12){let[c,m]=We(n.xnum),h=Me([c,m],[o,a]),f=c>=1e3&&m<=9999?String:Tt(void 0,t.locale,Math.max(-c,m));u=h.ticks(Math.max(2,Math.floor((a-o)/70))).map(p=>({x:h(p),label:f(p)}))}else{let c=n.keys.map((m,h)=>r(h));u=br(c,n.labels).map(m=>({x:c[m],label:n.labels[m]}))}let d=s&&n.type!=="band"?u:pr(u,-2,t.width+2);return(0,A.jsx)("g",{"aria-hidden":"true",children:d.map((c,m)=>(0,A.jsx)(pe,{x:c.x,y:i,anchor:"middle",size:_e,fill:l.paint("muted"),children:c.label},m))})}function $r(e,t,n,r,o){if(r)return o==="categorical"?je(e,t,n):go(e,t,n);if(o==="categorical")return je(e,t,n);let a=de(e,"strong"),i=de(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}function ql(e){let t=e.kind==="area",n=!t&&e.yScale==="log",r=Ka(e,{height:g=>Math.max(200,Math.min(300,g*.5)),duration:1100,stagger:120}),{p:o,width:a,height:i}=r,s=Wl[r.lang],l=(0,re.useId)().replace(/:/g,""),u=(0,re.useMemo)(()=>yt(e.data,e.x,e.y,e.series,{xType:e.xType,locale:r.locale,aggregate:e.aggregate,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,e.xType,r.locale,e.aggregate,e.dayFirst]),[d,c]=(0,re.useMemo)(()=>{if(!n)return[u,0];let g=0,y=u.values.map(T=>T.map(M=>M<=0?(g++,Number.NaN):M));return g?[{...u,values:y},g]:[u,0]},[u,n]),m=d.series.length,h=t?e.stack??(m>1?"stacked":"none"):"none",f=_a(r.sig),p=f.view,x=(0,re.useMemo)(()=>p?Gl(d,p[0],p[1]):d,[d,p]),k=Math.max(40,Math.round(e.maxPoints??a/2)),$=(0,re.useMemo)(()=>h!=="none"?ga(x,k):x,[x,h,k]),S=e.hidden?.join("")??"",[b,v]=(0,re.useMemo)(()=>ha($,S),[$,S]),O=b.rowValues??b.values,E=(0,re.useMemo)(()=>h==="none"?null:Nt(b.values,h==="percent"?"expand":"zero"),[b,h]),H=ta(e.annotations),{lower:j,upper:z}=e,I=Kl(b,e.bandFrom,H),F=(0,re.useMemo)(()=>{if(j===void 0||z===void 0||h!=="none")return null;let g=Va($.rows,j,z,Array.isArray(e.y),e.data,I),y=b===$?g:v.map(T=>g[T]);if(n)for(let T of y)T.lo.forEach((M,D)=>{M>0&&T.hi[D]>0||(T.lo[D]=T.hi[D]=Number.NaN)});return y.some(T=>T.lo.some(Number.isFinite))?y:null},[$,b,v,j,z,e.y,e.data,h,I,n]),N=(0,re.useMemo)(()=>{let g=[];return F?.forEach(y=>y.lo.forEach((T,M)=>Number.isFinite(T)&&g.push(T,y.hi[M]))),g.length?We(g):g},[F]),w=(0,re.useMemo)(()=>{let g=$.values.map(y=>y.reduce((T,M)=>T+(Number.isFinite(M)?M:0),0));return Ke(e.highlight,$.series,$.series,g,"first")},[$,e.highlight]),P=(0,re.useMemo)(()=>$r(o,m,w,t,e.colorMode),[t,e.colorMode,o,m,w]),_=(0,re.useMemo)(()=>b===$?w:new Set(v.flatMap((g,y)=>w.has(g)?[y]:[])),[b,$,w,v]),K=(0,re.useMemo)(()=>b===$?P:v.map(g=>P[g]),[b,$,P,v]),le=[];E?E.y1.forEach(g=>g.forEach(y=>le.push(y))):b.values.forEach(g=>g.forEach(y=>Number.isFinite(y)&&le.push(y))),le.push(...N);let Ue=e.referenceLines?.filter(g=>typeof g?.y=="number"&&Number.isFinite(g.y)&&(!n||g.y>0));Ue?.forEach(g=>le.push(g.y)),le.push(...yn(e.annotations).filter(g=>!n||g>0));let X=e.baseline??0,me=!!e.signColors&&h==="none"&&(!n||X>0);me&&le.push(X);let[ve,Ie]=We(le),Ut=e.yDomain&&(!n||e.yDomain[0]>0&&e.yDomain[1]>0)?e.yDomain:void 0,Oe=e.yLabel?22:10,Xe=22,Rn=Math.max(2,Math.round(i/70)),ct=Ut??(n?zt(ve,Ie,Rn):h==="percent"?[0,100]:lt(ve,Ie,Rn,{zero:e.zero??t})),Fr=h==="percent"?g=>`${g}%`:Tt(e.format,r.locale,Math.max(Math.abs(ct[0]),Math.abs(ct[1]))),Q=(n?vn:Me)(ct,[i-Xe,Oe]),Nr=Q.ticks(Rn),Dn=e.showYAxis!==!1,Ln=Dn?wn(Nr,Fr,r.locale):0,Pr=e.endLabels??m>1,pi=g=>{for(let y=b.keys.length-1;y>=0;y--)if(Number.isFinite(b.values[g][y]))return y;return-1},Rr=Pr?Math.min(a*.28,Math.max(...$.series.map(g=>ae(g,11,700)),20)+14):10,Se=Ln+6,ge=a-Rr,kt=p?void 0:e.xDomain,$e=Xl(b,Se,ge,kt),et=(0,re.useMemo)(()=>b.keys.map((g,y)=>$e(y)),[b,Se,ge,kt?.[0],kt?.[1]]),Lt=e.maxPoints??Math.max(60,Math.round((ge-Se)*2)),En=e.curve??"smooth",Et=Math.min(ct[1],Math.max(ct[0],0)),mt=o.color(e.downColor,"neutralStrong"),dt=Q(X),ft=$e.v,Dr=g=>ft?$n(b.type,g):b.keys.indexOf(String(g)),bi=g=>{let y=Dr(g);return ft?Number.isFinite(y)?ft(y):null:y<0?null:$e(y)},Xt=b.xnum.length-1,_n={p:o,lang:r.lang,xAt:bi,y:Q,x0:Se,x1:ge,top:Oe,bottom:i-Xe,half:ft||Xt<1?0:($e(1)-$e(0))/2,time:b.type==="date"&&ft&&Xt>0?{t0:b.xnum[0],t1:b.xnum[Xt],n:Xt+1,xt:ft}:void 0,points:()=>{let g=[..._][0]??0;return et.map((y,T)=>({x:y,y:Q(E?E.y1[g][T]:b.values[g][T])}))}},wt=xn(_n,H),yi=g=>{let y=Dr(g),T=ft?b.xnum.indexOf(y):y;return T>=0?b.labels[T]:String(g??"")},Lr=(g,y)=>me&&_.has(g)&&y<X?mt:K[g].fill,In=!e.connectNulls&&!E&&b.keys.length>1,On=(0,re.useMemo)(()=>b.series.map((g,y)=>{let T=V=>E?E.y1[y][V]:b.values[y][V],M=[];for(let V=0;V<b.keys.length;V++){if(!Number.isFinite(T(V)))continue;let B=M[M.length-1];B&&(!In||B[B.length-1]===V-1)?B.push(V):M.push([V])}let D=M.reduce((V,B)=>V+B.length,0);D>Lt&&(M=M.map(V=>Go(V.map(B=>({x:$e(B),y:T(B),k:B})),M.length>1?Math.max(3,Math.round(Lt*V.length/D)):Lt).map(B=>B.k)));let U=M.flat(),oe=0,ce=M.map(V=>[oe,oe+=V.length]),Ae=U.map(V=>Q(T(V))),Ye=E?U.map(V=>Q(E.y0[y][V])):t?U.map(()=>Q(Et)):void 0,nt={s:y,name:g,pts:Ae,xs:U.map(V=>$e(V)),base:Ye,sw:K[y],hi:_.has(y),idx:U,spans:ce},Ce=F?.[y],rt=Ce?Wa($e,Ce.lo,Ce.hi,Q,Lt):null;if(!Ce||!rt)return nt;let ye=e.outside?U.flatMap((V,B)=>vr(b.values[y][V],Ce.lo[V],Ce.hi[V])?[B]:[]):void 0;return{...nt,band:rt,out:ye}}),[b,E,K,_,Se,ge,kt?.[0],kt?.[1],i,ct[0],ct[1],Lt,t,F,e.outside,In,n]),Bn=r.motion.stagger??120,Er=(0,re.useMemo)(()=>[...On].sort((g,y)=>Number(g.hi)-Number(y.hi)),[On]),xi=(0,re.useMemo)(()=>Er.map((g,y)=>{let T=Q(Et),M=g.band?[...g.band.top,...g.band.bottom]:[],D=g.band?[g.band.top.length,g.band.bottom.length]:[];if(t){let U=g.base??g.pts.map(()=>T);return{key:`s:${g.name}`,to:[1,...g.pts,...U,...M],from:[0,...g.pts.map(()=>T),...U.map(()=>T),...M.map(()=>T)],delay:y*Bn*.5,parts:[1,g.pts.length,U.length,...D],data:g}}return{key:`s:${g.name}`,to:[1,...g.pts,...M],from:[0,...g.pts,...M],enter:[0,...g.pts,...M],delay:y*Bn,parts:[1,g.pts.length,...D],data:g}}),[Er,Bn,t,i,Et]),_r=Za(xi,r.motion),Ir=r.fv,zn=r.fmt,vt=(0,re.useMemo)(()=>{if(!F)return null;let g=Array.isArray(e.y),y=b.series.map((M,D)=>[Ja(j,v[D],g,s.lower),Ja(z,v[D],g,s.upper)]);return{range:(M,D)=>Number.isFinite(F[M].lo[D])?` (${y[M][0]} ${zn(F[M].lo[D])} ~ ${y[M][1]} ${zn(F[M].hi[D])})`:"",unnamed:typeof e.y=="string"?e.y:void 0,desc:Ul(b,F,y,e.outside===!0,s)}},[F,e.y,b,v,j,z,s,zn,e.outside]),ki=(0,re.useMemo)(()=>{if(!b.series.length)return[];let g=[..._][0]??0,y=(T,M,D)=>{let U=T||vt?.unnamed;return`${U?`${U} `:""}${Ir(O[M][D])}${vt?.range(M,D)??""}`};return jt(b.keys.length,T=>{let M=O[g]?.[T];return{datum:b.rows[g]?.[T]??null,index:T,key:b.keys[T],label:b.labels[T],value:Number.isFinite(M)?M:null,formatted:b.series.map((D,U)=>Number.isFinite(O[U][T])?y(D,U,T):null).filter(Boolean).join(", ")}})},[b,O,_,Ir,vt]),Or=(g,y)=>{let T=d.keys.indexOf(g);return T<0?y:T},{brush:tt,frame:wi,hint:vi,text:Br}=Ia(e,f,{p:o,active:r.active,lang:r.lang,count:b.keys.length,indexAt:g=>pn(et,g),inPlot:(g,y)=>g>=Se-4&&g<=ge+4&&y>=Oe&&y<=i-Xe,toXRange:g=>{let y=b.keys[g.from],T=b.keys[g.to];return{from:Or(y,g.from),to:Or(T,g.to),fromKey:y,toKey:T,fromLabel:b.labels[g.from],toLabel:b.labels[g.to]}}}),ue=r.active;ro(r,e.syncId,b.keys,b.labels);let zr=null;if(ue!==null&&b.keys[ue]!==void 0&&!tt.dragging){let g=h==="percent"?Nt(O.map(M=>[M[ue]]),"expand"):null,y=b.series.map((M,D)=>({s:M,si:D,v:O[D][ue]})).filter(M=>Number.isFinite(M.v)).sort((M,D)=>D.v-M.v).map(M=>{let D=vt?.range(M.si,ue),U=g?`${Math.round(g.y1[M.si][0]-g.y0[M.si][0])}% · ${r.fv(M.v)}`:r.fv(M.v);return{label:M.s||vt?.unnamed||r.t.value,value:D?(0,A.jsxs)(A.Fragment,{children:[U,(0,A.jsx)("span",{style:{fontWeight:500,color:o.paint("muted")},children:D})]}):U,color:Lr(M.si,M.v),strong:_.has(M.si)}}),T=Math.min(...b.series.map((M,D)=>E?Q(E.y1[D][ue]):Number.isFinite(b.values[D][ue])?Q(b.values[D][ue]):i));zr={x:$e(ue),y:Math.max(Oe,T),title:b.labels[ue],rows:Po(y,r.t.more)}}let $i=g=>{if(!b.keys.length)return;let y=pn(et,g);y>=0&&y!==r.active&&r.setActive(y,"pointer")},Hr=null,jr;if(tt.range&&tt.range.to<b.keys.length){let{from:g,to:y}=tt.range,T=[..._][0]??0,M=b.values[T]??[],D=NaN,U=NaN,oe=-1,ce=-1;for(let ye=g;ye<=y;ye++){let V=M[ye];Number.isFinite(V)&&(Number.isFinite(D)||(D=V),U=V,(oe<0||V>M[oe])&&(oe=ye),(ce<0||V<M[ce])&&(ce=ye))}let Ae=Oa(D,U),Ye=Ae!==null?Ba(Ae,r.locale):Number.isFinite(U-D)?`${U-D>=0?"+":""}${r.fv(U-D)}`:"-",nt=Br.range(b.labels[g],b.labels[y]),Ce=ye=>Q(E?E.y1[T][ye]:M[ye]),rt=i-Xe;Hr=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(za,{p:o,x0:et[g],x1:et[y],top:Oe,bottom:rt,width:a,main:Ye,sub:nt,dragging:tt.dragging}),oe>=0&&ce>=0&&oe!==ce?(0,A.jsx)(Ha,{p:o,lang:r.lang,width:a,top:Oe,bottom:rt,max:{x:et[oe],y:Ce(oe),text:r.fv(M[oe])},min:{x:et[ce],y:Ce(ce),text:r.fv(M[ce])}}):null]}),tt.dragging||(jr=`${s.span(nt,Ye)}${oe>=0?Br.extremes(r.fv(M[oe]),r.fv(M[ce])):""}.${vi}`)}let Ci=Pr?(()=>{let g=On.map(T=>{let M=pi(T.s);if(M<0)return null;let D=Q(E?(E.y0[T.s][M]+E.y1[T.s][M])/2:b.values[T.s][M]);return{d:T,y:D}}).filter(T=>T!==null),y=ea(g.map(T=>T.y),14,Oe+4,i-Xe-2);return g.map((T,M)=>({...T,ly:y[M]}))})():[],Mi=r.motion.duration??1100,Vr=e.dots??"auto",Ti=Vr===!0||Vr==="auto"&&!t&&b.keys.length<=16,Wr=t?s.area:s.line,Si=e.description??`${Wr}. ${s.desc(b.series.length,b.series.filter(Boolean).join(", ")||r.t.value,b.labels[0]??"",b.labels[b.labels.length-1]??"",b.keys.length)}.${vt?.desc??""}${la(e.annotations,r.lang,r.fv,yi)}${c?s.logDropped(c):""}`,Hn=[],Gr=[];for(let g of _r.items){let y=g.data,T=g.v,M=y.xs.length,D=T[0],U=T.slice(1,1+M),oe=y.xs.map((B,q)=>[B,U[q]??U[U.length-1]??0]),ce=me&&y.hi,Ae=y.spans,Ye=Ae.map(([B,q])=>hn(oe.slice(B,q),En)),nt=ce?Ae.map(([B],q)=>`${Ye[q]}V${W(dt)}H${W(y.xs[B])}Z`).join(""):"",Ce=B=>Ae.map(([q,Fe])=>gn(oe.slice(q,Fe),B.slice(q,Fe),En)).join(""),rt=In?Ae.filter(([B,q])=>q-B===1).map(([B])=>B):[],ye=(B,q)=>{let[Fe,qe]=oe[B],Be=ce&&qe>dt?mt:y.sw.fill;return(0,A.jsx)("circle",{cx:Fe,cy:qe,r:y.hi?3:2.2,fill:y.hi?Be:o.paint("panel"),stroke:Be,strokeWidth:y.hi?0:1.4,opacity:q},B)};if(y.band){let B=1+(t?2*M:M),q=y.band.top.length;Gr.push((0,A.jsx)("path",{d:Ga(y.band,T.slice(B,B+q),T.slice(B+q,B+2*q),En),fill:y.sw.fill,opacity:.16*D*(g.exiting?.4:1)},g.key))}let V=B=>y.out?.map(q=>{let[Fe,qe]=oe[q];return(0,A.jsx)("circle",{cx:Fe,cy:qe,r:3.6,fill:ce&&qe>dt?mt:y.sw.fill,stroke:o.paint("panel"),strokeWidth:1.5,opacity:B(q)},`o${q}`)});if(t){let B=T.slice(1+M,1+2*M),q=y.xs.map((Ne,J)=>[Ne,B[J]??Q(Et)]),Fe=Ye.join(""),qe=ce?["up","dn"].map(Ne=>(0,A.jsx)("path",{d:nt,fill:Ne==="up"?y.sw.fill:mt,opacity:.5,clipPath:`url(#${l}${Ne})`},Ne)):(0,A.jsx)("path",{d:Ce(q),fill:y.sw.fill,opacity:h==="none"?y.hi?.5:.28:1}),Be=Ne=>(ce?["up","dn"]:[null]).map(J=>(0,A.jsx)("path",{d:Fe,fill:"none",stroke:J==="dn"?mt:h==="none"?y.sw.fill:o.paint("panel"),strokeWidth:h==="none"?y.hi?2.2:1.4:1.2,strokeLinejoin:"round",strokeDasharray:Ne?"5 4":void 0,opacity:Math.min(1,D*1.4),clipPath:J?`url(#${l}${J})`:void 0},J??"s"));Hn.push((0,A.jsxs)("g",{opacity:g.exiting?.4:1,children:[qe,wt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("g",{clipPath:`url(#${l}pre)`,children:Be(!1)}),(0,A.jsx)("g",{clipPath:`url(#${l}post)`,children:Be(!0)})]}):Be(!1),rt.map(Ne=>ye(Ne,Math.min(1,D*1.4))),V(()=>Math.min(1,D*1.4))]},g.key))}else{let B=y.hi?2.6:1.7,q=D<.999,Fe=J=>Math.max(0,Math.min(1,(D-(M>1?J/(M-1):1))*8+(D>=.999?1:0))),qe=q&&Ae.length>1?Ae.flatMap(([J,Ze],jn)=>Ze-J>1?[[Ye[jn],Math.max(0,Math.min(1,(D*(M-1)-J)/(Ze-1-J)))]]:[]):[[Ye.join(""),D]],Be=J=>(ce?["up","dn"]:[null]).flatMap(Ze=>qe.map(([jn,Ai],Fi)=>(0,A.jsx)("path",{d:jn,fill:"none",stroke:Ze==="dn"?mt:y.sw.fill,strokeWidth:B,strokeLinejoin:"round",strokeLinecap:"round",pathLength:q?1:void 0,strokeDasharray:q?"1 1":J?"5 4":void 0,strokeDashoffset:q?1-Ai:void 0,clipPath:Ze?`url(#${l}${Ze})`:void 0},`${Ze??"s"}${Fi}`))),Ne=e.area&&y.hi?ce?["up","dn"].map(J=>(0,A.jsx)("path",{d:nt,fill:J==="up"?y.sw.fill:mt,opacity:.16*D,clipPath:`url(#${l}${J})`},J)):(0,A.jsx)("path",{d:Ce(oe.map(([J])=>[J,Q(Et)])),fill:`url(#${l}g)`,opacity:D}):null;Hn.push((0,A.jsxs)("g",{opacity:g.exiting?.4:1,children:[Ne,wt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("g",{clipPath:`url(#${l}pre)`,children:Be(!1)}),(0,A.jsx)("g",{clipPath:`url(#${l}post)`,children:Be(!0)})]}):Be(!1),(Ti?oe.map((J,Ze)=>Ze):rt).map(J=>ye(J,Fe(J))),V(Fe)]},g.key))}}return(0,A.jsxs)(Ro,{c:r,kind:Wr,ariaLabel:e.ariaLabel,description:Si,events:ki,tip:zr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(g,y,T)=>{tt.move(g),T.pointerType==="touch"?r.setActive(pn(et,g),"touch"):$i(g)},...wi,announce:jr,defs:e.area||wt!==null||me?(0,A.jsxs)(A.Fragment,{children:[e.area?(0,A.jsxs)("linearGradient",{id:`${l}g`,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,A.jsx)("stop",{offset:"0%",stopColor:o.paint("accent"),stopOpacity:.28}),(0,A.jsx)("stop",{offset:"100%",stopColor:o.paint("accent"),stopOpacity:0})]}):null,wt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("clipPath",{id:`${l}pre`,children:(0,A.jsx)("rect",{x:-a,y:-i,width:a+wt,height:i*3})}),(0,A.jsx)("clipPath",{id:`${l}post`,children:(0,A.jsx)("rect",{x:wt,y:-i,width:a*2,height:i*3})})]}):null,me?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("clipPath",{id:`${l}up`,children:(0,A.jsx)("rect",{x:-a,y:-i,width:a*3,height:i+dt})}),(0,A.jsx)("clipPath",{id:`${l}dn`,children:(0,A.jsx)("rect",{x:-a,y:dt,width:a*3,height:i*2})})]}):null]}):null,children:[e.yLabel&&Dn?(0,A.jsx)(pe,{x:Ln,y:6,anchor:"start",size:10.5,fill:o.paint("muted"),children:e.yLabel}):null,(0,A.jsx)(ca,{p:o,ticks:Nr,y:Q,x0:Ln,x1:ge+4,fmt:Fr,locale:r.locale,labels:Dn}),(0,A.jsx)(aa,{list:e.annotations,g:_n}),me?(0,A.jsx)("line",{x1:Se,x2:ge,y1:dt,y2:dt,stroke:o.paint("dim"),pointerEvents:"none"}):null,Ue?.map((g,y)=>(0,A.jsx)("line",{x1:Se,x2:ge,y1:Q(g.y),y2:Q(g.y),stroke:o.paint("dim"),strokeDasharray:"3 3"},y)),(0,A.jsx)("rect",{x:Se,y:Oe,width:Math.max(0,ge-Se),height:Math.max(0,i-Xe-Oe),fill:"transparent"}),Gr,Hn,(0,A.jsx)(sa,{list:e.annotations,g:_n}),ue!==null&&b.keys[ue]!==void 0?(0,A.jsx)(ma,{p:o,x:$e(ue),top:Oe,bottom:i-Xe,dots:b.series.flatMap((g,y)=>{let T=E?E.y1[y][ue]:b.values[y][ue];return Number.isFinite(T)?[{k:y,y:Q(T),color:Lr(y,T),strong:_.has(y)}]:[]})}):null,Ue?.map((g,y)=>g.label?(0,A.jsxs)("g",{pointerEvents:"none",children:[(0,A.jsx)("rect",{x:ge-ae(g.label,10.5)-8,y:Q(g.y)-17,width:ae(g.label,10.5)+8,height:15,rx:5,fill:o.paint("panel"),opacity:.94}),(0,A.jsx)(pe,{x:ge-4,y:Q(g.y)-9.5,anchor:"end",size:10.5,fill:o.paint("muted"),children:g.label})]},`rl${y}`):null),Ci.map(g=>(0,A.jsx)(pe,{x:ge+8,y:g.ly,size:11,weight:g.d.hi?800:500,fill:o.paint(g.d.hi?"ink":"muted"),opacity:_r.fade(Mi*.75,300),children:Ve(g.d.name,Rr-10,11,g.d.hi?800:500)},g.d.name)),Hr,e.showXAxis===!1?null:(0,A.jsx)(Yl,{c:r,model:b,xs:$e,x0:Se,x1:ge,y:i-Xe+13,domain:kt,fixed:e.xTicks}),ue!==null&&b.keys[ue]!==void 0&&!tt.dragging?(0,A.jsx)(da,{p:o,x:$e(ue),y:i-Xe+13,label:b.labels[ue],width:a}):null]})}function Pn(e){return(0,A.jsx)(ql,{...e,kind:"line"})}var Zl=L(ee(),1);var Cr=L(G(),1);var Qa=e=>e?"neutralStrong":"accent";var Mr=L(G(),1);function ei(e,t,n,r){if(typeof e!="function")return Ke(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Jl=L(ee(),1);var Sr=L(G(),1),Ql={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}, ${Re(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},ti={en:Ql,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}일 이동평균`}},Tr=["ink","muted","dim"];function ni(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Tr.length)}var eu=L(ee(),1);var si=L(G(),1),tu={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Re(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},nu={en:tu,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},ri=(e,t)=>nu[e].other(t);function oi(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,Xo(o.map(a=>a.value)))}}var ai=e=>Number.isFinite(e)&&e>0?e:0;function ii(e,t,n,r){return r==="emphasis"?ho(e,t,n):je(e,t,n)}var ru=L(ee(),1);var mi=L(G(),1);function li(e,t){return t===!1?e.map((n,r)=>r):Uo(e)}function ui(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Ke(e,t,t,r,"max")}function ci(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=de(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?de(e,"neutral"):en(e,1-i/Math.max(1,o.length-1))),r}var Qe=L(G(),1);function di(e,t){let n=dn(e);return n?.type==="scatter"&&t?.size!==void 0?dn("bubble"):n}function au(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 iu(e,t,n,r=!1){let o=di(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&cr.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),u=c=>c.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(d.includes(o.type)){let c=Ft(a.label,"label"),m=gt(a.value,"value"),h=o.type==="waffle",f=t.map((b,v)=>({r:b,label:c(b,v),value:h?m(b,v):ai(m(b,v))})),{kept:p,other:x}=h?{kept:f,other:null}:oi(f,i.other,(b,v)=>({r:{},label:ri(te(n),b),value:v})),k=Ke(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),h?"first":"max"),$=x?[...p,x]:p,S=It(b=>h?je(b,$.length,k):ii(b,$.length,k,i.colorMode));return $.map((b,v)=>({label:b.label,color:S[v]}))}if(o.type==="candlestick"){let c=ni(Array.isArray(i.ma)?i.ma:void 0,t.length),m=ti[te(n)];return[{label:m.up,color:i.upColor??"accent"},{label:m.down,color:i.downColor??"neutralStrong"},...c.map((h,f)=>({label:m.maLegend(h),color:Tr[f],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let c=Ft(a.series,"series"),m=it(t.map((p,x)=>c(p,x)));if(m.length<2)return[];let h=ei(s,t,m,c),f=It(p=>fo(p,m.length,h));return u(m.map((p,x)=>({label:p,color:f[x],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(a.y))c=a.y;else if(typeof a.series=="string"){let S=Ft(a.series,"series");c=it(t.map((b,v)=>S(b,v)))}let m=mr(o.type,a,i);if(m.length){let S=Ke(s,c,c,c.map(()=>0),"none"),b=It(O=>je(O,c.length,S)),v=c.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:c.map((O,E)=>({label:O,color:b[E]}));return[...u(v),...m.map((O,E)=>({label:O,color:Qa(E),shape:"line"}))]}if(c.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?Ko(c.length,Array.isArray(i.negative)?i.negative.map(S=>c.indexOf(String(S))):[],typeof i.neutral=="string"?c.indexOf(i.neutral):-1):-1,p=f>=0?new Set([f]):Ke(s,c,c,c.map(()=>0),"first");if(o.type==="radar")return u(c.map((S,b)=>({label:S,color:p.has(b)?"accent":"neutralStrong",shape:"square"})));let x=i.colorMode,k=S=>je(S,c.length,p);if((o.type==="line"||o.type==="area")&&(k=S=>$r(S,c.length,p,o.type==="area",x)),o.type==="stream"){let S=yt(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),b=li(S.values,i.reorder),v=ui(s,S.series,S.values);k=O=>ci(O,b,v)}let $=It(k);return u(c.map((S,b)=>({label:S,color:$[b],...o.type==="line"&&{shape:"line"}})))}return[]}function su(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Io.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function lu(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:u,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:a,highlight:i,syncId:s,title:l,description:u}}function fi(e,t){let{spec:n}=e,r=di(n.type,n.encoding),o=(0,Kt.useMemo)(()=>Da(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=_o(n,e.locale),s=xe(i),l=te(s),u=Ca(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),d=zo(n),c=(0,Kt.useMemo)(()=>d?Pa(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],f=h.join(""),[p,x]=(0,Kt.useState)(null);if(!r)return(0,Qe.jsx)(lr,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??u.data,$=t[r.type],S={...n.options??{}},b={...au(r,n.encoding),...S,...c?{tooltip:c}:{},data:k,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},v=n.card?.legend==="toggle"&&Bo(r.type,n.encoding??{},S),O=p&&p.base===f?p.hidden:h;v&&(b.hidden=O);let E=F=>x(N=>{let w=N&&N.base===f?N.hidden:h;return{base:f,hidden:w.includes(F)?w.filter(P=>P!==F):[...w,F]}}),H=b.height??220,j=su(n,r.type),z=a&&!k.length&&(u.loading||u.error||u.empty)?(0,Qe.jsx)(lr,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:H,locale:i}):j?(0,Qe.jsx)($a,{chart:$,...lu(r.type,j,b)}):(0,Qe.jsx)($,{...b});if(n.card){let F=n.card,N=F.legend==="auto"||F.legend==="toggle"?iu(n,k,s,v):F.legend,w=N?.length?v?(0,Qe.jsx)(sr,{items:N,hidden:O,onToggle:E,locale:i}):N:void 0,P=F.download?(0,Qe.jsx)(Na,{data:k,columns:Ho(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;z=(0,Qe.jsx)(No,{number:F.number,title:F.title??Eo(r,l),subtitle:F.subtitle,legend:w,actions:P,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:z})}let I=e.theme??n.theme;return I&&(z=(0,Qe.jsx)(sn,{theme:I,children:z})),z}function uu({cfg:e,components:t}){let n=Pt();return fi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function gi(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,Ar.createElement)(sn,{theme:o.theme,cssVars:!0},(0,Ar.createElement)(uu,{cfg:o,components:{[e]:t}})))}gi("line",Pn);})();
|