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/histogram.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var ei=Object.create;var Mr=Object.defineProperty;var ti=Object.getOwnPropertyDescriptor;var ni=Object.getOwnPropertyNames;var ri=Object.getPrototypeOf,oi=Object.prototype.hasOwnProperty;var pn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ai=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ni(t))!oi.call(e,o)&&o!==n&&Mr(e,o,{get:()=>t[o],enumerable:!(r=ti(t,o))||r.enumerable});return e};var L=(e,t,n)=>(n=e!=null?ei(ri(e)):{},ai(t||!e||!e.__esModule?Mr(n,"default",{value:e,enumerable:!0}):n,e));var J=pn((Pl,Cr)=>{Cr.exports=globalThis.__ztdReact.react});var Sr=pn((Dl,Tr)=>{Tr.exports=globalThis.__ztdReact["react-dom/client"]});var V=pn((Ul,no)=>{no.exports=globalThis.__ztdReact["react/jsx-runtime"]});var ar=L(J(),1),Ea=L(Sr(),1);var Ct=L(J(),1);var Vt=L(J(),1);var Ar=L(J(),1),et=(0,Ar.createContext)(void 0);var Pr=L(J(),1);var ii=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Fr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Nr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',De={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:Fr,monoFamily:Nr,radius:18,radiusCode:14,radiusMark:4},bn={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:Fr,monoFamily:Nr,radius:18,radiusCode:14,radiusMark:4},yn={dark:De,light:bn};function Pt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function xn(e){let t={};for(let n of ii){let r=e[n];typeof r=="string"&&(t[Pt(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 kn(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 si=`
|
|
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,${De.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,${De.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,${De.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 Qn=!1;function Je(){if(Qn||typeof document>"u"||(Qn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=ca,document.head.appendChild(e)}var ht=R(J(),1),ge=typeof window<"u"&&typeof document<"u",me=ge?ht.useLayoutEffect:ht.useEffect;function gt(){return typeof performance<"u"?performance.now():Date.now()}function Z(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function ve(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var er={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},tr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ma=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],da={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function fa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ha(e){return fa(ma,e)}function nr(e,t){let n=ha(e);return{text:n?n[t]:e,...da[n?.id??"basic"]}}var le=R(J(),1);var sr=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),de="en-US",rr=new Map;function Ut(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=rr.get(r);return o||(o=new Intl.NumberFormat(e,n),rr.set(r,o)),o}function qt(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function He(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=de,...r}=t;return qt(Ut(n,r).format(e))}var Yt=e=>e!==0&&Math.abs(e)<.05,Xt=(e,t,n="")=>`${He(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function ze(e,t={}){if(!Number.isFinite(e))return"-";if(Yt(e)&&t.maximumFractionDigits===void 0)return Xt(e,t.locale??de,"%");let n=Math.abs(e);return`${He(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function lr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=de,...r}=t;if(Z(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,h=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),m=Math.round(u*10**h)/10**h;if(i>0&&m>=a[i-1][0]/s){i--;continue}return(e<0&&m!==0?"-":"")+He(m,{locale:n,...r,maximumFractionDigits:h})+l}}return qt(Ut(n,{notation:"compact",...r}).format(e))}var ga=(e,t=Z(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Ze(e,t=de,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Ut(t,o);return l=>Number.isFinite(l)?`${i}${qt(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=>ze(o,{locale:t});case"ratio":return o=>ze(o*100,{locale:t});case"compact":return o=>lr(o,{locale:t});case"currency":return r(ga(t));default:{let o=r({maximumFractionDigits:1});return a=>Yt(a)?Xt(a,t):o(a)}}}function Jt(e,t=de,n=0){return e!==void 0?Ze(e,t):n>=1e5?r=>Yt(r)?Xt(r,t):lr(r,{locale:t}):r=>He(r,{locale:t})}function pa(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var ba=e=>Number.isInteger(e)&&e>=1e3&&e<=9999;var ya=["january","february","march","april","may","june","july","august","september","october","november","december"],or=e=>{let t=e.toLowerCase();return t.length<3?0:ya.findIndex(n=>n.startsWith(t))+1},ar=e=>+e+(+e<30?2e3:1900);function ur(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var xa=[/^(\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})일)?$/],ka=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,cr=/\{([^{}]+)\}/g;function va(e,t){let n;for(let r of xa)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?[ar(n[3]),+n[2],+n[1],1]:[ar(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=ka.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=or(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=or(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}function mr(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(ba(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return mr(`${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=va(n,t);if(r)return pa(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 ir=new Map;function dr(e,t={month:"short",day:"numeric"}){let n=mr(e);if(!n)return"-";let{locale:r=de,...o}=t,a=r+JSON.stringify(o),i=ir.get(a);return i||(i=new Intl.DateTimeFormat(r,o),ir.set(a,i)),i.format(n)}var fr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function hr(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),fr[t.toLowerCase()]&&(t=fr[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 wa(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 Zt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ca(e){return[Zt(e[0]),Zt(e[1]),Zt(e[2])]}function Qt(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]=Ca(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 $a([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[Qt(4.0767416621*o-3.3077115913*a+.2309699292*i),Qt(-1.2684380046*o+2.6097574011*a-.3413193965*i),Qt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function pr(e,t,n){let r=hr(e),o=hr(t);if(!r||!o)return e;let a=gr(r),i=gr(o),s=Math.max(0,Math.min(1,n));return wa($a([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)))}var en=R(j(),1),pt=(0,le.createContext)({theme:ke,cssVars:!0});function Ma(e,t=ke){return e?typeof e=="string"?Vt[e]??t:Gt(t,e):t}function yt(e){let t=(0,le.useContext)(pt),n=e.base?Vt[e.base]:t.theme,r=(0,le.useMemo)(()=>Ma(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,le.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,le.useMemo)(()=>Kt(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,en.jsx)(pt.Provider,{value:i,children:(0,en.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Ta=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function bt(e){return Ta.has(e)}function Sa(e,t){let n=r=>t?`var(${Wt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?bt(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?bt(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)})`:pr(e[r],e[o],a)}}}function pe(e){let t=(0,le.useContext)(pt);return(0,le.useMemo)(()=>{let n=Gt(t.theme,e);return Sa(n,t.cssVars)},[t.theme,t.cssVars,e])}function ue(e){let t=(0,le.useContext)(pt);return e??t.locale??de}function yr(e){return e?Kt(e):{}}var xt=R(J(),1),tn=(0,xt.createContext)(void 0);function xr(e){let t=(0,xt.useContext)(tn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var C=R(j(),1),Aa={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},Na={en:Aa,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ra={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},nn=e=>Na[Z(ue(e))];function rn(e){let t=pe(e.theme),n=nn(e.locale),[r,o]=(0,kt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(h=>!s.has(h.label)).length,u=(0,C.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((h,m)=>{let g=!s.has(h.label),y=g&&l===1,d=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Fa,{p:t,item:h,off:!g}),(0,C.jsx)("span",{style:g?void 0:{textDecoration:"line-through"},children:h.label})]});return(0,C.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,C.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":g,"aria-disabled":y||void 0,onClick:()=>{y||(i(h.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:y?"default":void 0},children:d}):d},m)})});return i?(0,C.jsxs)(C.Fragment,{children:[u,(0,C.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ra,children:r?n.shown(l,e.items.length):""})]}):u}function Fa({p:e,item:t,off:n}){let r=t.color?bt(t.color)?e.paint(t.color):t.color:e.paint("neutral"),o=t.shape??"square";return o==="line"||o==="dash"?(0,C.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,C.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,C.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,C.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 Pa(e){let t=pe(e.theme),n=nr(e.level,Z(ue(e.locale)));return(0,C.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 Da(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,C.jsxs)(C.Fragment,{children:[e.slice(0,r),(0,C.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function kr(e){let t=pe(e.theme),n=nn(e.locale),[r,o]=(0,kt.useState)(0);me(()=>Je(),[]);let a=()=>{o(g=>g+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,C.jsx)(rn,{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,h=e.source!==void 0||e.note!==void 0?(0,C.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,m=e.takeaway!==void 0||e.level||e.sample?(0,C.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,C.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,C.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,C.jsx)(Pa,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,C.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,C.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,C.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,C.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:Da(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,C.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,C.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,C.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,C.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,C.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,C.jsx)("span",{}),i]}):null]}),(0,C.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,C.jsx)(tn.Provider,{value:r,children:(0,C.jsx)(ft.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),h?(0,C.jsxs)(C.Fragment,{children:[h,m]}):m]})}function on(e){let t=pe(e.theme),n=nn(e.locale),r=e.height??220;if(me(()=>Je(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,C.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,C.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,C.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,C.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,C.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,C.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,C.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,C.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,C.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,C.jsx)(C.Fragment,{children:e.children})}function be(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 h=-1,m=u==="max"?-1/0:1/0;r.forEach((g,y)=>{Number.isFinite(g)&&(u==="max"?g>m:g<m)&&(m=g,h=y)}),h>=0&&a.add(h)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((u,h)=>{h<i&&u!==null&&u!==void 0&&e(u,h)&&a.add(h)}),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((h,m)=>{h===u&&a.add(m)});return a}function Qe(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 vr(e,t){return Qe(e+1,t).slice(0,e)}function et(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function La(e,t){if(e==null||typeof e!="object")return;let n=e;if(et(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!et(r,o))return;r=r[o]}return r}}function Re(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 an(e,t){if(typeof e=="function")return e;let n=e??t;return r=>La(r,n)}function Fe(e,t){let n=an(e,t);return(r,o)=>Re(n(r,o))}function Pe(e,t){let n=an(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 sn(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var se=R(J(),1);function Ea(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
|
-
`||
|
|
24
|
-
`||
|
|
25
|
-
`&&d++,s.push(l),i.push(s),s=[],l=""):l+=f}(l!==""||s.length)&&(s.push(l),i.push(s));let h=i.filter(d=>!(d.length===1&&d[0].trim()===""));if(!h.length)return[];let m=d=>n?wr(d):d;if(!r)return h.map(d=>Object.fromEntries(d.map((f,x)=>[String(x),m(f)])));let g=[],y=new Set;return h[0].forEach((d,f)=>{let x=d.trim()||`col${f+1}`,b=x;for(let v=2;y.has(b);v++)b=`${x}_${v}`;y.add(b),g.push(b)}),h.slice(1).map(d=>Object.fromEntries(g.map((f,x)=>[f,m(d[x]??"")])))}function ln(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"?wr(i[l]):i[l]??null])))}function Oa(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 Cr(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 we(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return we(JSON.parse(t))}catch{}return De(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?ln(e):typeof e[0]=="number"?e.map((t,n)=>({label:String(n+1),value:t})):e.filter(t=>t&&typeof t=="object"):[];if(typeof e=="object"){let t=e;return Array.isArray(t.data)?we(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?ln(t.rows,t.columns.map(n=>typeof n=="object"&&n&&"name"in n?String(n.name):String(n))):Array.isArray(t.rows)&&Array.isArray(t.fields)||Array.isArray(t.rows)?we(t.rows):Array.isArray(t.values)?ln(t.values):Array.isArray(t.items)?we(t.items):Array.isArray(t.results)?we(t.results):Oa(t)}return[]}function $r(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)}`}async function Ia(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(Z(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return De(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 De(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):De(a)}async function Ba(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 Ia(a,t.parse,o,t.locale)}return t.select&&(r=Cr(r,t.select)),t.transform?t.transform(r):we(r)}function Mr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,se.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,se.useState)(0),u=ue(t.locale),h=(0,se.useRef)(t);h.current={...t,locale:u};let m=(0,se.useRef)(e);m.current=e;let g=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",y=t.deps??[],d=JSON.stringify(y.map(b=>typeof b=="object"?JSON.stringify(b):String(b))),f=(0,se.useRef)(!1);(0,se.useEffect)(()=>{let b=m.current;if(!b||!r){i(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let v=new AbortController,P=!0;return f.current=!0,i(M=>({...M,data:o?M.data:[],status:"loading",error:null})),Ba(b,{...h.current,signal:v.signal}).then(M=>{P&&i({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!P||v.signal.aborted||i(S=>({...S,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{P&&(f.current=!1)}),()=>{P=!1,f.current=!1,v.abort()}},[g,r,s,d,o]),(0,se.useEffect)(()=>{if(!n||!r)return;let b=setInterval(()=>{f.current||l(v=>v+1)},n);return()=>clearInterval(b)},[n,r]);let x=(0,se.useCallback)(()=>l(b=>b+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 cn=R(j(),1),za=["csv","svg","png"],Ha=/^[=+\-@\t\r\n=+-@]/,ja=/var\(|color-mix\(/;function Tr(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?ur(e.getTime()):String(e);return`"${(Ha.test(t)&&!Number.isFinite(Re(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Va(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Wa(e,t){return`\uFEFF${[t.map(Tr),...e.map(r=>t.map(o=>Tr(r[o])))].map(r=>r.join(",")).join(`\r
|
|
22
|
+
`;function Dr(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function Lr(e,t){let[n]=(0,Pr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Rr=!1;function pt(){if(Rr||typeof document>"u"||(Rr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=si,document.head.appendChild(e)}var Dt=L(J(),1),he=typeof window<"u"&&typeof document<"u",we=he?Dt.useLayoutEffect:Dt.useEffect;function Lt(){return typeof performance<"u"?performance.now():Date.now()}function Z(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function ve(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Er={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},_r={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var li=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ci={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function ui(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function mi(e){return ui(li,e)}function Ir(e,t){let n=mi(e);return{text:n?n[t]:e,...ci[n?.id??"basic"]}}var Or={white:"#ffffff",black:"#000000",transparent:"#00000000"};function tt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Or[t.toLowerCase()]&&(t=Or[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 Hr(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 vn(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 nt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Br(e){return .2126*nt(e[0])+.7152*nt(e[1])+.0722*nt(e[2])}function $n(e,t,n){let r=typeof e=="string"?tt(e):e,o=typeof t=="string"?tt(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?tt(n):n:null;o[3]<1&&a&&(o=vn(o,a));let i=r[3]<1?vn(r,o):r,s=Br(i),l=Br(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function di(e){return[nt(e[0]),nt(e[1]),nt(e[2])]}function wn(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 zr(e){let[t,n,r]=di(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 fi([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[wn(4.0767416621*o-3.3077115913*a+.2309699292*i),wn(-1.2684380046*o+2.6097574011*a-.3413193965*i),wn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Et(e,t,n){let r=tt(e),o=tt(t);if(!r||!o)return e;let a=zr(r),i=zr(o),s=Math.max(0,Math.min(1,n));return Hr(fi([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 Mn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=$n(a,e,n);i>o&&(o=i,r=a)}return r}function ne(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 hi(e,t){let n=Mn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return $n(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Mn(t,["#FFFFFF","#000000"])}function _t(e,t){let n=Et(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:hi(e,n),raw:n}}function $e(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ne(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=ne(e,"neutral");else if(s===0)r[i]=ne(e,"ink");else if(s===a-1)r[i]=ne(e,"neutral");else if(a===3)r[i]=ne(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?ne(e,"strong"):_t(e,1-l)}}),r}var Cn="mix:";function bt(e){return e({theme:bn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Cn}${o}`}).map(n=>n.fill)}function jr(e,t){return t?.startsWith(Cn)?e.mix("neutralStrong","neutral",Number(t.slice(Cn.length))):e.color(t)}function Vr(e,t,n){return $e(e,t+1,n).slice(0,t)}function Wr(e,t,n,r="neutral"){let o=ne(e,"accent"),a=ne(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Gr(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ne(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=ne(e,"neutral"):s===0?r[i]=ne(e,"strong"):s===a-1?r[i]=ne(e,"neutral"):r[i]=_t(e,1-s/(a-1))}),r}var ge=L(J(),1);var It=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ie="en-US",Kr=new Map;function Tn(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Kr.get(r);return o||(o=new Intl.NumberFormat(e,n),Kr.set(r,o)),o}function Sn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function ot(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ie,...r}=t;return Sn(Tn(n,r).format(e))}var An=e=>e!==0&&Math.abs(e)<.05,Fn=(e,t,n="")=>`${ot(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function rt(e,t={}){if(!Number.isFinite(e))return"-";if(An(e)&&t.maximumFractionDigits===void 0)return Fn(e,t.locale??ie,"%");let n=Math.abs(e);return`${ot(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function qr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ie,...r}=t;if(Z(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],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+ot(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Sn(Tn(n,{notation:"compact",...r}).format(e))}var gi=(e,t=Z(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function He(e,t=ie,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Tn(t,o);return l=>Number.isFinite(l)?`${i}${Sn(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=>rt(o,{locale:t});case"ratio":return o=>rt(o*100,{locale:t});case"compact":return o=>qr(o,{locale:t});case"currency":return r(gi(t));default:{let o=r({maximumFractionDigits:1});return a=>An(a)?Fn(a,t):o(a)}}}function yt(e,t=ie,n=0){return e!==void 0?He(e,t):n>=1e5?r=>An(r)?Fn(r,t):qr(r,{locale:t}):r=>ot(r,{locale:t})}function pi(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Nn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,bi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,yi=["january","february","march","april","may","june","july","august","september","october","november","december"],Ur=e=>{let t=e.toLowerCase();return t.length<3?0:yi.findIndex(n=>n.startsWith(t))+1},Xr=e=>+e+(+e<30?2e3:1900);function Jr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var xi=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],Zr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Qr=/\{([^{}]+)\}/g;function Ot(e,t){let n;for(let r of xi)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[Xr(n[3]),+n[2],+n[1],1]:[Xr(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=Zr.exec(e)){let r=+n[1],o=+n[3],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=Ur(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=Ur(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var eo=e=>bi.test(e)||Ot(e)!==null;function to(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 Bt(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(Nn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Bt(`${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=Ot(n,t);if(r)return pi(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Yr=new Map;function xt(e,t={month:"short",day:"numeric"}){let n=Bt(e);if(!n)return"-";let{locale:r=ie,...o}=t,a=r+JSON.stringify(o),i=Yr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Yr.set(a,i)),i.format(n)}var Rn=L(V(),1),zt=(0,ge.createContext)({theme:De,cssVars:!0});function ki(e,t=De){return e?typeof e=="string"?yn[e]??t:kn(t,e):t}function Ht(e){let t=(0,ge.useContext)(zt),n=e.base?yn[e.base]:t.theme,r=(0,ge.useMemo)(()=>ki(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ge.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ge.useMemo)(()=>xn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Rn.jsx)(zt.Provider,{value:i,children:(0,Rn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var wi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function ro(e){return wi.has(e)}function vi(e,t){let n=r=>t?`var(${Pt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?ro(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?ro(r)?e[r]:r:e[o],mix:(r,o,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)})`:Et(e[r],e[o],a)}}}function pe(e){let t=(0,ge.useContext)(zt);return(0,ge.useMemo)(()=>{let n=kn(t.theme,e);return vi(n,t.cssVars)},[t.theme,t.cssVars,e])}function se(e){let t=(0,ge.useContext)(zt);return e??t.locale??ie}function oo(e){return e?xn(e):{}}var jt=L(J(),1),Pn=(0,jt.createContext)(void 0);function ao(e){let t=(0,jt.useContext)(Pn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=L(V(),1),$i={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`},Mi={en:$i,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ci={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Dn=e=>Mi[Z(se(e))];function Ln(e){let t=pe(e.theme),n=Dn(e.locale),[r,o]=(0,Vt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(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((m,u)=>{let f=!s.has(m.label),p=f&&l===1,d=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Ti,{p:t,item:m,off:!f}),(0,N.jsx)("span",{style:f?void 0:{textDecoration:"line-through"},children:m.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":f,"aria-disabled":p||void 0,onClick:()=>{p||(i(m.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:p?"default":void 0},children:d}):d},u)})});return i?(0,N.jsxs)(N.Fragment,{children:[c,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ci,children:r?n.shown(l,e.items.length):""})]}):c}function Ti({p:e,item:t,off:n}){let r=jr(e,t.color),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 Si(e){let t=pe(e.theme),n=Ir(e.level,Z(se(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 Ai(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 io(e){let t=pe(e.theme),n=Dn(e.locale),[r,o]=(0,Vt.useState)(0);we(()=>pt(),[]);let a=()=>{o(f=>f+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(Ln,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=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,u=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)(Si,{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:Ai(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(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)(Pn.Provider,{value:r,children:(0,N.jsx)(et.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,N.jsxs)(N.Fragment,{children:[m,u]}):u]})}function En(e){let t=pe(e.theme),n=Dn(e.locale),r=e.height??220;if(we(()=>pt(),[]),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})}var ct=L(J(),1);var le=L(J(),1);var W=L(V(),1),Wt=60;var Gt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function so(e){let{c:t,events:n}=e,r=(0,le.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,we(()=>{pt()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,le.useContext)(et),c=e.ariaLabel??l??e.kind,m=(0,le.useMemo)(()=>s?`${n.length}${n.slice(0,Wt).map(k=>`${k.label}${k.series??""}${k.formatted??k.value??""}`).join("")}`:"",[n,s]),u=(0,le.useMemo)(()=>(0,W.jsx)(Fi,{label:c,events:n,t:t.t}),[c,m,t.t]),f=(0,le.useRef)(null);(0,le.useEffect)(()=>{let k=()=>{f.current=null};return window.addEventListener("scroll",k,{capture:!0,passive:!0}),window.addEventListener("resize",k,{passive:!0}),()=>{window.removeEventListener("scroll",k,{capture:!0}),window.removeEventListener("resize",k)}},[]),(0,le.useEffect)(()=>{f.current=null},[t.width,t.height]);let p=k=>{if(k.target!==k.currentTarget)return;if(e.onKey?.(k)){k.preventDefault();return}let F=t.active,_;switch(k.key){case"ArrowRight":case"ArrowDown":_=F===null?0:(F+1)%i;break;case"ArrowLeft":case"ArrowUp":_=F===null?i-1:(F-1+i)%i;break;case"Home":_=0;break;case"End":_=i-1;break;case"Escape":if(F===null)return;_=null;break;case"Enter":case" ":F!==null&&(k.preventDefault(),t.click(F));return;default:return}k.preventDefault(),t.setActive(_,"keyboard")},{via:d,node:g,setActive:y}=t;(0,le.useEffect)(()=>{if(d!=="touch"||!g)return;let k=F=>{g.contains(F.target)||y(null)};return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[d,g,y]);let b=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,T=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&b?e.renderTip(b):null,x=e.announce??(t.via==="keyboard"&&b?`${b.label}${b.series?` ${b.series}`:""}: ${b.formatted??b.value??""} (${(t.active??0)+1}/${i})`:""),P;if(v){let k=v.x*T,F=t.width*T,_=`clamp(${(4-k).toFixed(1)}px, -50%, calc(${(F-k-4).toFixed(1)}px - 100%))`,j=v.y<64;P={position:"absolute",left:k,top:v.y*T,transform:`translate(${_}, ${j?"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*T-8)}}let z=k=>{f.current=null,k.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},H=k=>k?F=>{let _=f.current??(f.current=F.currentTarget.getBoundingClientRect());_.width&&k((F.clientX-_.left)/_.width*t.width,(F.clientY-_.top)/_.height*t.height,F)}:void 0,E=H(e.onPointerMove),D=H(e.onPointerDown),A=E||D?k=>{k.pointerType==="touch"&&E?.(k),D?.(k)}:void 0,S=H(e.onPointerUp),$=oo(e.theme);return(0,W.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?p:void 0,onBlur:k=>{t.via==="keyboard"&&!k.currentTarget.contains(k.relatedTarget)&&t.setActive(null)},onPointerLeave:z,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...$,...e.style},children:[t.pending?null:e.underlay,(0,W.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:E,onPointerDown:A,onPointerUp:S,onPointerCancel:S,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,W.jsx)("title",{id:o,children:c}),(0,W.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,W.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,W.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:P,children:M??(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map((k,F)=>(0,W.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(k.strong?"ink":"muted")},children:[k.color?(0,W.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:k.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,k.label]}),(0,W.jsx)("span",{style:{fontWeight:k.strong===!1?500:700},children:k.value})]},F))]})}):null,(0,W.jsx)("span",{className:"ztd-sr",style:Gt,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?u:null]})}function Fi({label:e,events:t,t:n}){return(0,W.jsx)("div",{className:"ztd-sr",style:Gt,children:(0,W.jsxs)("table",{children:[(0,W.jsx)("caption",{children:n.table(e)}),(0,W.jsxs)("tbody",{children:[t.slice(0,Wt).map((r,o)=>(0,W.jsxs)("tr",{children:[(0,W.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,W.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Wt?(0,W.jsx)("tr",{children:(0,W.jsx)("td",{colSpan:2,children:n.more(t.length-Wt)})}):null]})]})})}function Le(e){let t=e.baseline??"central";return(0,W.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 w=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),be=w("label","string",!0,"Item name field"),oe=w("value","number",!0,"Value field"),Ni=[be,oe],Ri=[be,oe],Pi=[w("label","string",!0,"Stage name"),w("value","number",!0,"Users at the stage")],Di=[be,oe],Li=[w("label","string",!0,"Leaf (lowest level) name"),oe,w("group","string",!1,"Parent group field")],Ei=[w("label","string",!0,"Leaf name"),oe,w("group","string",!1,"Parent group field")],_i=[be,w("value","number",!0,"Change (total rows may omit it)"),w("type","string",!1,'"total" makes a total bar')],Ii=[be,oe],Oi=[w("x","string",!0,"Column field"),w("series","string",!0,"Stacked series field"),oe],Bi=[w("x","string",!0,"Column field"),w("y","string",!0,"Row field"),oe],zi=[w("axis","string",!0,"Metric (axis) field"),w("value","number",!0,"Value field",{multi:!0}),w("series","string",!1,"Series field")],Hi=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("size","number",!1,"Circle size"),w("label","string",!1,"Name")],co=w("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),ji=[w("x","any",!0,"x field (date, number or category)"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables)"),w("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),co],Vi=[w("x","any",!0,"x field"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),co],Wi=[w("x","any",!0,"x field"),w("y","number",!0,"y field",{multi:!0}),w("series","string",!1,"Series field")],Gi=[w("x","string",!0,"Category field"),w("y","number",!0,"Value field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("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})],Ki=[be,oe],Ui=[w("value","number",!0,"Value field",{prop:"valueKey"}),w("target","number",!1,"Target field",{prop:"targetKey"})],Xi=[be,w("value","number",!0,"Actual value field"),w("target","number",!1,"Target field")],Yi=[w("x","any",!1,"x field"),w("y","number",!0,"y field")],qi=[be,w("x","string",!1,"Period field (long tables)"),w("value","number",!1,"Value field (long tables)")],Ji=[be,w("start","number",!0,"Before value"),w("end","number",!0,"After value")],Zi=[be,oe],Qi=[w("value","number",!0,"Value field"),w("group","string",!1,"Group (row) field"),w("label","string",!1,"Dot name")],es=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],ts=[w("source","string",!0,"Source node"),w("target","string",!0,"Target node"),oe],ns=[w("source","string",!0,"Sending group"),w("target","string",!0,"Receiving group"),oe],rs=[w("date","date",!0,"Date field"),oe],os=[w("x","any",!0,"Period field"),w("series","string",!0,"Item field"),w("rank","number",!1,"Rank field (1 is first)"),w("value","number",!1,"Value field (instead of rank, largest is first)")],as=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],is=[w("label","string",!1,"Row name field")],ss=[w("x","date",!0,"Date (period) field"),w("open","number",!0,"Open price field"),w("high","number",!0,"High price field"),w("low","number",!0,"Low price field"),w("close","number",!0,"Close price field"),w("volume","number",!1,"Volume field")],ls=[be,oe],cs=[w("x","any",!0,"Period field (date or category)"),w("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables, back row only)"),w("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],us=[w("value","number",!1,"Sample value field (raw rows)"),w("group","string",!1,"Group field. Up to 2 groups overlap"),w("x0","number",!1,"Bin start (pre-binned rows)"),w("x1","number",!1,"Bin end (pre-binned rows)"),w("count","number",!1,"Samples in the bin (pre-binned rows)")],ms=[w("region","string",!0,"Region name or code, matched to a tile of options.map"),oe],ds=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("series","string",!1,"Series field (one color per series)"),w("label","string",!1,"Name")],lo={pie:Ni,donut:Ri,funnel:Pi,waffle:Di,treemap:Li,sunburst:Ei,waterfall:_i,pareto:Ii,marimekko:Oi,heatmap:Bi,radar:zi,bubble:Hi,line:ji,area:Vi,stream:Wi,bar:Gi,radialBar:Ki,gauge:Ui,bullet:Xi,sparkline:Yi,slope:qi,dumbbell:Ji,lollipop:Zi,beeswarm:Qi,ridgeline:es,sankey:ts,chord:ns,calendar:rs,bump:os,box:as,parallel:is,candlestick:ss,segmented:ls,skyline:cs,histogram:us,scatter:ds,tileMap:ms},at={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 uo(e,t){return t==="ko"?e.nameKo:e.name}function mo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var fo=["line","area","bar","scatter"],ho=24,_n=["line","area","bar","scatter"];function In(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function go(e,t,n){return _n.includes(e)&&!In(e,t,n).length}function po(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var fs={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 Kt(e){let t=lo[e]?e:fs[e]??Object.keys(at).find(n=>n.toLowerCase()===e.toLowerCase()||at[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!at[t]))return{type:t,component:at[t].component,name:at[t].name,nameKo:at[t].nameKo,encoding:lo[t]}}function bo(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 Kt(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 kt(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function hs(e,t){if(e==null||typeof e!="object")return;let n=e;if(kt(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!kt(r,o))return;r=r[o]}return r}}function ye(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 je(e,t){if(typeof e=="function")return e;let n=e??t;return r=>hs(r,n)}function Ae(e,t){let n=je(e,t);return(r,o)=>ye(n(r,o))}function Fe(e,t){let n=je(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 gs(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
|
+
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var ps=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function yo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(ps.test(t)||/^[-+]?\.\d+$/.test(t)){let n=ye(t);if(Number.isFinite(n))return n}return t}function Ve(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??gs(o),i=[],s=[],l="",c=!1;for(let d=0;d<o.length;d++){let g=o[d];c?g==='"'?o[d+1]==='"'?(l+='"',d++):c=!1:l+=g:g==='"'&&!l.trim()?(c=!0,l=""):g===a?(s.push(l),l=""):g===`
|
|
24
|
+
`||g==="\r"?(g==="\r"&&o[d+1]===`
|
|
25
|
+
`&&d++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(d=>!(d.length===1&&d[0].trim()===""));if(!m.length)return[];let u=d=>n?yo(d):d;if(!r)return m.map(d=>Object.fromEntries(d.map((g,y)=>[String(y),u(g)])));let f=[],p=new Set;return m[0].forEach((d,g)=>{let y=d.trim()||`col${g+1}`,b=y;for(let v=2;p.has(b);v++)b=`${y}_${v}`;p.add(b),f.push(b)}),m.slice(1).map(d=>Object.fromEntries(f.map((g,y)=>[g,u(d[y]??"")])))}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"?yo(i[l]):i[l]??null])))}function bs(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function xo(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function Ee(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ee(JSON.parse(t))}catch{}return Ve(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)?Ee(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)?Ee(t.rows):Array.isArray(t.values)?On(t.values):Array.isArray(t.items)?Ee(t.items):Array.isArray(t.results)?Ee(t.results):bs(t)}return[]}function Ut(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 Bn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let f=0;f<n;f++){let p=i(f,c),d=p-i(f,c-1),g=0;for(let y=0;y<f;y++)g+=i(y,c)-i(y,c-1);m+=p,u+=(d/2+g)*p}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,f=0;for(let p=0;p<n;p++){let d=e[p][l],g=Number.isFinite(d)?d:0;g>=0?(o[p][l]=u,u+=g,a[p][l]=u):(o[p][l]=f,f+=g,a[p][l]=f)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let f=i(u,l);t==="expand"&&(f=c?f/c*100:0),o[u][l]=m,m+=f,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let f=0;f<r;f++)o[u][f]-=m,a[u][f]-=m}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 wo(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((f,p)=>{f>u&&(u=f,m=p)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var ys=Math.PI*2;function Xt(e,t,n){return e<t?t:e>n?n:e}function vo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function C(e){return Math.round(e*100)/100}function Yt(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=Xt(a.tl??0,0,i),l=Xt(a.tr??0,0,i),c=Xt(a.br??0,0,i),m=Xt(a.bl??0,0,i);return`M${C(e+s)},${C(t)}H${C(e+n-l)}`+(l?`A${C(l)},${C(l)} 0 0 1 ${C(e+n)},${C(t+l)}`:"")+`V${C(t+r-c)}`+(c?`A${C(c)},${C(c)} 0 0 1 ${C(e+n-c)},${C(t+r)}`:"")+`H${C(e+m)}`+(m?`A${C(m)},${C(m)} 0 0 1 ${C(e)},${C(t+r-m)}`:"")+`V${C(t+s)}`+(s?`A${C(s)},${C(s)} 0 0 1 ${C(e+s)},${C(t)}`:"")+"Z"}function xs(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${C(l[0])},${C(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${C(l[0])},${C(l[1])}`).join("");let o=[],a=[];for(let l=0;l<n-1;l++){let c=e[l+1][0]-e[l][0];o.push(c),a.push(c===0?0:(e[l+1][1]-e[l][1])/c)}let i=[a[0]];for(let l=1;l<n-1;l++)if(a[l-1]*a[l]<=0)i.push(0);else{let c=2*o[l]+o[l-1],m=o[l]+2*o[l-1];i.push((c+m)/(c/a[l-1]+m/a[l]))}i.push(a[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let c=o[l]/3;s+=`C${C(e[l][0]+c)},${C(e[l][1]+i[l]*c)} ${C(e[l+1][0]-c)},${C(e[l+1][1]-i[l+1]*c)} ${C(e[l+1][0])},${C(e[l+1][1])}`}return s}function $o(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return xs(e);if(t==="step"){let n=`M${C(e[0][0])},${C(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${C(o)}V${C(e[r][1])}H${C(e[r][0])}`}return n}return ks(e)}function ks(e){if(!e.length)return"";let t=`M${C(e[0][0])},${C(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${C(e[n][0])},${C(e[n][1])}`;return t}function We(e,t){if(!e.length)return NaN;let n=(e.length-1)*t,r=Math.floor(n),o=n-r;return e[r+1]!==void 0?e[r]+o*(e[r+1]-e[r]):e[r]}function Mo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function To(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Co(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 qt=new Map;function xe(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=qt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);To(c)?i+=Co(c):s+=Co(c)}a=i+s*(n>=600?1.07:1),qt.size>5e3&&qt.clear(),qt.set(o,a)}return a*t}function zn(e,t,n,r=400){if(e=e.trim(),xe(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;xe(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<(To(s.charCodeAt(0))?2:3)?"":s+o}var Ao=L(V(),1),ws=e=>Array.isArray(e)&&e.length===2;function So(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&ws(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var st=L(V(),1),Ge=10.5;function Fo(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=>ot(i,{locale:n,maximumFractionDigits:a}))}function Jt(e,t,n){let r=18;for(let o of Fo(e,t,n))r=Math.max(r,xe(o,Ge));return Math.ceil(r+8)}function No(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:Fo(n,i,e.locale);return(0,st.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,m)=>{let u=Math.round(r(c))+.5,f=c===0&&e.zero!==!1;return(0,st.jsxs)("g",{children:[(0,st.jsx)("line",{x1:o,x2:a,y1:u,y2:u,stroke:t.paint(f?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:f?.7:1}),l?(0,st.jsx)(Le,{x:s?a+6:o-6,y:u,anchor:s?"start":"end",size:Ge,fill:t.paint("muted"),children:l[m]}):null]},c)})})}function Ro(e,t,n){let r=[],o=-1/0;for(let a of e){let i=xe(a.label,Ge),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 Hn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function _e(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Hn(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,f=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-f<=l*.3?f:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let p=Hn(c[1]-c[0],n);if(p===l)break;l=p}return c}function Zt(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Hn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function Ke(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)=>Zt(n,r,l),s}function jn(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=_e(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function vs(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let f=Math.floor(r);f<=Math.ceil(o);f++)if(!(f%m))for(let p of c){let d=Number((p*10**f).toPrecision(12));d>=e*(1-1e-9)&&d<=t*(1+1e-9)&&u.push(d)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Zt(e,t,3)}function Po(e,t){let n=Ke([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=()=>vs(e[0],e[1],Math.abs(t[1]-t[0])),r}function Ue(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 $s=864e5;function Do(e,t,n,r=ie){let o=t-e;if(!(o>0))return[{t:e,label:xt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/$s,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,f,p=!1)=>{let d=new Date(m),g=-1,y=0;for(;d.getTime()<=t&&y++<500;){if(d.getTime()>=e){let b=d.getFullYear(),v=p&&!l&&b!==g;i.push({t:d.getTime(),label:xt(d,{locale:r,...f,...v?{year:"numeric"}:{}})}),g=b}u(d)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(p=>p>=m)??12,f=new Date(s);f.setMinutes(0,0,0),c(f,p=>p.setHours(p.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),f=[1,2,3,6,12,24,60].find(p=>p>=u)??120;if(f>=12){let p=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(p,d=>d.setFullYear(d.getFullYear()+f/12),{year:"numeric"})}else{let p=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),d=p.getMonth()%f;d&&p.setMonth(p.getMonth()+(f-d)),c(p,g=>g.setMonth(g.getMonth()+f),{month:"short"},!0)}}return i}function Lo(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 Ms=(e,t,n)=>e==="date"?Bt(t,n)?.getTime()??NaN:ye(t);function Cs(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&eo(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function wt(e,t,n,r,o={}){let a=je(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:je(n,"y"),c=!i&&r!==void 0?je(r,"series"):null,m=e.map(($,k)=>a($,k)),u=o.xType??Cs(m),f=o.locale??ie,p,d,g;if(u==="band"){let $=m.map(F=>String(F??""));p=it($);let k=new Map(p.map((F,_)=>[F,_]));d=p.map((F,_)=>_),g=Int32Array.from($,F=>k.get(F)??-1)}else{let $=u==="date"?o.dayFirst??to(m):void 0,k=m.map(j=>Ms(u,j,$)),F=Array.from(new Set(k.filter(j=>Number.isFinite(j)))).sort((j,ae)=>j-ae),_=new Map(F.map((j,ae)=>[j,ae]));d=F,p=F.map(String),g=Int32Array.from(k,j=>_.get(j)??-1)}let y=o.dateFormat,b=$=>typeof $=="string"?Ot($.trim())?.[3]:void 0,v=u==="date"&&m.length<5e3?b(m[0]):void 0,T=(v===2||v===3)&&m.every($=>b($)===v),M=T&&v===3;if(u==="date"&&!y){let $=d.length>1?d[d.length-1]-d[0]:0;y=T&&v===2||$>864e5*120?{month:"short"}:$<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},$>864e5*800&&(y={year:"numeric",month:"short"})}let x;if(u==="band")x=p;else if(M&&!o.dateFormat){let $=Z(f)==="ko";x=d.map(k=>{let F=new Date(k),_=Math.floor(F.getMonth()/3)+1;return $?`${F.getFullYear()}년 ${_}분기`:`Q${_} ${F.getFullYear()}`})}else{let $=d.every(Nn),k=u==="date"?new Intl.DateTimeFormat(f,y):new Intl.NumberFormat(f,$?{useGrouping:!1}:{maximumFractionDigits:6});x=d.length>1e3?Lo(d.length,F=>k.format(d[F])):d.map(F=>k.format(F))}let P=s?[...s]:c?it(e.map(($,k)=>String(c($,k)??""))):[""],z=new Map(P.map(($,k)=>[$,k])),H=P.map(()=>new Array(p.length).fill(NaN)),E=P.map(()=>new Array(p.length).fill(null)),D=o.aggregate??"sum",A=D==="mean"?P.map(()=>new Uint32Array(p.length)):null,S=($,k,F,_)=>{let j=H[$][k];D==="last"?H[$][k]=F:D==="count"?H[$][k]=(Number.isFinite(j)?j:0)+1:D==="mean"?Number.isFinite(F)&&(H[$][k]=(Number.isFinite(j)?j:0)+F,A[$][k]++):H[$][k]=Number.isFinite(j)?j+(Number.isFinite(F)?F:0):F,E[$][k]=_};for(let $=0;$<e.length;$++){let k=g[$];if(k<0)continue;let F=e[$];if(s)for(let _=0;_<s.length;_++)S(_,k,ye(F[s[_]]),F);else{let _=c?z.get(String(c(F,$)??""))??0:0;S(_,k,ye(l(F,$)),F)}}if(A)for(let $=0;$<H.length;$++)for(let k=0;k<p.length;k++)A[$][k]>1&&(H[$][k]/=A[$][k]);return{type:u,keys:p,xnum:d,labels:x,series:P,values:H,rows:E}}var Ts=140,$t=12,Eo=14,Vn=20,_o=12.5;function Ss(e,t,n=ho){let r=Fe(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function As(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+$t)/(Ts+$t))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Fs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*$t)/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 Qt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Ae(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return vt(n)}function Io(e,t,n,r,o,a){return wt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Ns(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let x=t.flat(),P=r.refLines??{},[z,H]=Ue([...Qt(x,r.x??"x"),...vt([Number(P.x)])]),[E,D]=Ue([...Qt(x,r.y??"y"),...vt([Number(P.y)])].filter(S=>!s||S>0)),A=r.zero??!1;return{y:c??(s?jn(E,D,i):_e(E,D,i,{zero:A,pad:.08})),x:r.xDomain??_e(z,H,Math.max(2,Math.round(o/110)),{zero:A,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",f=n[0]?.keys.join(""),p=n.every(x=>x.keys.join("")===f),d=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),g=r.xDomain??(!m&&d?Ue(n.flatMap(x=>vt(x.xnum))):void 0),y=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(y==="percent")return{x:g,sameKeys:p};if(c)return{y:c,x:g,sameKeys:p};let b=[];t.forEach((x,P)=>{let z=n[P];if(y==="stacked"||y==="auto"&&z.series.length>1){let E=Bn(z.values,"zero");E.y0.forEach(D=>b.push(...D)),E.y1.forEach(D=>b.push(...D))}else z.values.forEach(E=>b.push(...E));m&&!u&&r.line!==void 0&&Io(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>b.push(...E)),m||b.push(...Qt(x,r.lower),...Qt(x,r.upper))}),m&&b.push(0),u||b.push(...So(r.annotations));for(let x of r.referenceLines??[])b.push(x.y);r.signColors&&b.push(Number(r.baseline??0));let[v,T]=Ue(vt(b).filter(x=>!s||x>0));return{y:s?jn(v,T,i):m?_e(v,T,u?Math.max(2,Math.round(o/120)):i):_e(v,T,i,{zero:r.zero??e==="area"}),x:g,sameKeys:p}}function Rs(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=wt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?Po:Ke)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=Jt(c,yt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(x=>x.series),f=r.endLabels??n.some(x=>x.series.length>1),p=m+6,d=a-(f?Math.min(a*.28,Math.max(...u.map(x=>xe(x,11,700)),20)+14):10),g=l.keys.length,[y,b]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?g>12:g>Do(y,b,Math.max(2,Math.floor((d-p)/64)),s).length;if(l.type==="band"||!g||v)return;let T=x=>p+(l.xnum[x]-y)/(b-y)*(d-p),M=x=>xe(l.labels[x],Ge);for(let x=1;;x++){let P=Array.from({length:Math.ceil(g/x)},(z,H)=>H*x);if(x>=g||P.every((z,H)=>!H||T(z)-T(P[H-1])>=(M(z)+M(P[H-1]))/2+8))return P.map(z=>({value:l.xnum[z],label:l.labels[z]}))}}function Ps(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function Ds(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${Ps(`${e}|${t}|${o}|${Ut(r)}`)}`}function Ls(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 Es={en:{intro:(e,t)=>`${ve(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}};function Oo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Ss(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=As(s,i,e.columns),{pw:c,ph:m}=Fs(s,l,e.height),u=e.scale!=="free",f=t==="scatter"?[]:o.map(A=>Io(t,A,n,n.y,n.series,n.aggregate)),p=u?Ns(t,o,f,n,c,m):{sameKeys:!1},d=u?Rs(t,o,f,n,p,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",y=u&&(!g||p.sameKeys),b=u&&(g||p.x!==void 0||p.sameKeys),v=new Set(Ls(e.highlight,r)?[e.highlight].flat():[]),T=v.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??Ds(t,e.by,n,e.data),P=It(He(n.format,e.locale),n.unit),z=Es[e.lang],H=[],E=r.map(A=>A===""?z.blank:A);return{panels:r.map((A,S)=>{let $=o[S],k=E[S],F=S%l,_;if(t!=="scatter"){let ae=f[S],Ce=ue=>ae.values.reduce((me,Ye)=>me+(Number.isFinite(Ye[ue])?Ye[ue]:0),0),K=ae.keys.map((ue,me)=>me).filter(ue=>ae.values.some(me=>Number.isFinite(me[ue]))),re=K[K.length-1];H.push({first:K.length?Ce(K[0]):NaN,last:K.length?Ce(re):NaN,total:K.reduce((ue,me)=>ue+Ce(me),0)}),t!=="bar"&&ae.series.length===1&&re!==void 0&&(_=P(ae.values[0][re]))}else H.push({first:NaN,last:NaN,total:$.length});let j={data:$,width:c,height:m,ariaLabel:e.title?`${e.title}, ${k}`:k,syncId:x,highlight:T?v.has(A)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!y||F===0,showXAxis:!b||S+l>=i};return p.y&&(j.yDomain=p.y),p.x&&(j.xDomain=p.x),d&&(j.xTicks=d),{value:A,label:k,props:j,last:_,isPicked:v.has(A)}}),cols:l,pw:c,ph:m,isPanelPick:T,description:_s(t,e.by,E,H,a,P,z)}}function _s(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>Mo(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,f)=>r[f].last<r[f].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var ce=L(J(),1);function Is(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Os(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function Ho(e,t=!0){let[n,r]=(0,ce.useState)({visible:!t,near:!t});return(0,ce.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=Os(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Is(.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 Bo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function en(e){let[t,n]=(0,ce.useState)(null),[r,o]=(0,ce.useState)(e??null),a=(0,ce.useCallback)(i=>{n(i),i&&e===void 0&&o(Bo(i))},[e]);return we(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(Bo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var Bs=()=>()=>{};function lt(){return(0,ce.useSyncExternalStore)(Bs,()=>!0,()=>!1)}var zo="(prefers-reduced-motion: reduce)";function tn(e="auto"){let[t,n]=(0,ce.useState)(()=>he&&typeof window.matchMedia=="function"?window.matchMedia(zo).matches:!1);return(0,ce.useEffect)(()=>{if(e!=="auto"||!he||typeof window.matchMedia!="function")return;let r=window.matchMedia(zo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=L(V(),1),zs=60,Hs=420;function jo(e){let t=pe(),n=e.chartProps??{},[,r,o]=en(e.width),a=e.width??(o||480),i=se(e.locale??n.locale),s=Z(i),l=(0,ct.useContext)(et),c=e.title??l,m=(0,ct.useMemo)(()=>Oo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(y,b)=>typeof b=="function"?String(b):b),e.highlight,e.syncId,a,e.height,c,i,s]),u=`${(0,ct.useId)().replace(/:/g,"")}fd`,f=tn(n.reducedMotion??"auto"),p=lt(),d=Lr({motion:{enabled:n.animate!==!1&&!f&&he},hydrated:p},{waiting:!1,generation:0}),g=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":u,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:u,style:Gt,children:e.description??m.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${m.cols}, minmax(0, 1fr))`,columnGap:$t,rowGap:Eo},children:m.panels.map((y,b)=>{let v=t.paint(y.isPicked?"accentText":m.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":y.value,style:{minWidth:0,...Dr(d,!1,"fade",b*zs,Hs)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Vn,fontSize:_o,fontWeight:700,lineHeight:`${Vn}px`,color:v},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.label}),y.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:y.last}):null]}),(0,Me.jsx)(g,{...n,...y.props})]},y.value)})})]})}function ke(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((f,p)=>{Number.isFinite(f)&&(c==="max"?f>u:f<u)&&(u=f,m=p)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var fe=L(J(),1);async function js(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(Z(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ve(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 Ve(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ve(a)}async function Vs(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await js(a,t.parse,o,t.locale)}return t.select&&(r=xo(r,t.select)),t.transform?t.transform(r):Ee(r)}function Vo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,fe.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,fe.useState)(0),c=se(t.locale),m=(0,fe.useRef)(t);m.current={...t,locale:c};let u=(0,fe.useRef)(e);u.current=e;let f=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",p=t.deps??[],d=JSON.stringify(p.map(b=>typeof b=="object"?JSON.stringify(b):String(b))),g=(0,fe.useRef)(!1);(0,fe.useEffect)(()=>{let b=u.current;if(!b||!r){i(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let v=new AbortController,T=!0;return g.current=!0,i(M=>({...M,data:o?M.data:[],status:"loading",error:null})),Vs(b,{...m.current,signal:v.signal}).then(M=>{T&&i({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!T||v.signal.aborted||i(x=>({...x,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{T&&(g.current=!1)}),()=>{T=!1,g.current=!1,v.abort()}},[f,r,s,d,o]),(0,fe.useEffect)(()=>{if(!n||!r)return;let b=setInterval(()=>{g.current||l(v=>v+1)},n);return()=>clearInterval(b)},[n,r]);let y=(0,fe.useCallback)(()=>l(b=>b+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:y}}var Gn=L(V(),1),Ws=["csv","svg","png"],Gs=/^[=+\-@\t\r\n=+-@]/,Ks=/var\(|color-mix\(/;function Wo(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?Jr(e.getTime()):String(e);return`"${(Gs.test(t)&&!Number.isFinite(ye(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Us(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Xs(e,t){return`\uFEFF${[t.map(Wo),...e.map(r=>t.map(o=>Wo(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?dr(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(cr,(h,m)=>o(a,m.trim())??(l=!0,""));l||i.push(u)}return i.length?i.map((s,l)=>(0,Dr.jsx)("div",{children:s},l)):null}}var p=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ce=p("label","string",!0,"Item name field"),ee=p("value","number",!0,"Value field"),Ua=[ce,ee],qa=[ce,ee],Ya=[p("label","string",!0,"Stage name"),p("value","number",!0,"Users at the stage")],Xa=[ce,ee],Ja=[p("label","string",!0,"Leaf (lowest level) name"),ee,p("group","string",!1,"Parent group field")],Za=[p("label","string",!0,"Leaf name"),ee,p("group","string",!1,"Parent group field")],Qa=[ce,p("value","number",!0,"Change (total rows may omit it)"),p("type","string",!1,'"total" makes a total bar')],ei=[ce,ee],ti=[p("x","string",!0,"Column field"),p("series","string",!0,"Stacked series field"),ee],ni=[p("x","string",!0,"Column field"),p("y","string",!0,"Row field"),ee],ri=[p("axis","string",!0,"Metric (axis) field"),p("value","number",!0,"Value field",{multi:!0}),p("series","string",!1,"Series field")],oi=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("size","number",!1,"Circle size"),p("label","string",!1,"Name")],Er=p("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),ai=[p("x","any",!0,"x field (date, number or category)"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables)"),p("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Er],ii=[p("x","any",!0,"x field"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("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}),Er],si=[p("x","any",!0,"x field"),p("y","number",!0,"y field",{multi:!0}),p("series","string",!1,"Series field")],li=[p("x","string",!0,"Category field"),p("y","number",!0,"Value field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("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})],ui=[ce,ee],ci=[p("value","number",!0,"Value field",{prop:"valueKey"}),p("target","number",!1,"Target field",{prop:"targetKey"})],mi=[ce,p("value","number",!0,"Actual value field"),p("target","number",!1,"Target field")],di=[p("x","any",!1,"x field"),p("y","number",!0,"y field")],fi=[ce,p("x","string",!1,"Period field (long tables)"),p("value","number",!1,"Value field (long tables)")],hi=[ce,p("start","number",!0,"Before value"),p("end","number",!0,"After value")],gi=[ce,ee],pi=[p("value","number",!0,"Value field"),p("group","string",!1,"Group (row) field"),p("label","string",!1,"Dot name")],bi=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],yi=[p("source","string",!0,"Source node"),p("target","string",!0,"Target node"),ee],xi=[p("source","string",!0,"Sending group"),p("target","string",!0,"Receiving group"),ee],ki=[p("date","date",!0,"Date field"),ee],vi=[p("x","any",!0,"Period field"),p("series","string",!0,"Item field"),p("rank","number",!1,"Rank field (1 is first)"),p("value","number",!1,"Value field (instead of rank, largest is first)")],wi=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],Ci=[p("label","string",!1,"Row name field")],$i=[p("x","date",!0,"Date (period) field"),p("open","number",!0,"Open price field"),p("high","number",!0,"High price field"),p("low","number",!0,"Low price field"),p("close","number",!0,"Close price field"),p("volume","number",!1,"Volume field")],Mi=[ce,ee],Ti=[p("x","any",!0,"Period field (date or category)"),p("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables, back row only)"),p("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Si=[p("value","number",!1,"Sample value field (raw rows)"),p("group","string",!1,"Group field. Up to 2 groups overlap"),p("x0","number",!1,"Bin start (pre-binned rows)"),p("x1","number",!1,"Bin end (pre-binned rows)"),p("count","number",!1,"Samples in the bin (pre-binned rows)")],Ai=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("series","string",!1,"Series field (one color per series)"),p("label","string",!1,"Name")],Lr={pie:Ua,donut:qa,funnel:Ya,waffle:Xa,treemap:Ja,sunburst:Za,waterfall:Qa,pareto:ei,marimekko:ti,heatmap:ni,radar:ri,bubble:oi,line:ai,area:ii,stream:si,bar:li,radialBar:ui,gauge:ci,bullet:mi,sparkline:di,slope:fi,dumbbell:hi,lollipop:gi,beeswarm:pi,ridgeline:bi,sankey:yi,chord:xi,calendar:ki,bump:vi,box:wi,parallel:Ci,candlestick:$i,segmented:Mi,skyline:Ti,histogram:Si,scatter:Ai},je={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 _r(e,t){return t==="ko"?e.nameKo:e.name}function Or(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var mn=["line","area","bar","scatter"];function dn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"?[].concat(t.line??[]).map(String):[]}function Ir(e,t,n){return mn.includes(e)&&!dn(e,t,n).length}function Br(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ni={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 vt(e){let t=Lr[e]?e:Ni[e]??Object.keys(je).find(n=>n.toLowerCase()===e.toLowerCase()||je[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!je[t]))return{type:t,component:je[t].component,name:je[t].name,nameKo:je[t].nameKo,encoding:Lr[t]}}function zr(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 vt(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 Ri=Math.PI*2;function wt(e,t,n){return e<t?t:e>n?n:e}function Hr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function k(e){return Math.round(e*100)/100}function Ct(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=wt(a.tl??0,0,i),l=wt(a.tr??0,0,i),u=wt(a.br??0,0,i),h=wt(a.bl??0,0,i);return`M${k(e+s)},${k(t)}H${k(e+n-l)}`+(l?`A${k(l)},${k(l)} 0 0 1 ${k(e+n)},${k(t+l)}`:"")+`V${k(t+r-u)}`+(u?`A${k(u)},${k(u)} 0 0 1 ${k(e+n-u)},${k(t+r)}`:"")+`H${k(e+h)}`+(h?`A${k(h)},${k(h)} 0 0 1 ${k(e)},${k(t+r-h)}`:"")+`V${k(t+s)}`+(s?`A${k(s)},${k(s)} 0 0 1 ${k(e+s)},${k(t)}`:"")+"Z"}function Fi(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${k(l[0])},${k(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${k(l[0])},${k(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],h=o[l]+2*o[l-1];i.push((u+h)/(u/a[l-1]+h/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${k(e[l][0]+u)},${k(e[l][1]+i[l]*u)} ${k(e[l+1][0]-u)},${k(e[l+1][1]-i[l+1]*u)} ${k(e[l+1][0])},${k(e[l+1][1])}`}return s}function jr(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return Fi(e);if(t==="step"){let n=`M${k(e[0][0])},${k(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${k(o)}V${k(e[r][1])}H${k(e[r][0])}`}return n}return Pi(e)}function Pi(e){if(!e.length)return"";let t=`M${k(e[0][0])},${k(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${k(e[n][0])},${k(e[n][1])}`;return t}function Le(e,t){if(!e.length)return NaN;let n=(e.length-1)*t,r=Math.floor(n),o=n-r;return e[r+1]!==void 0?e[r]+o*(e[r+1]-e[r]):e[r]}var Di=e=>new Float64Array(e.map(Re).filter(Number.isFinite)).sort(),Li=(e,t)=>t>=0&&t<=100?Le(e,t/100):NaN;function Vr(e,t){return Li(Di(e),t)}function fn(e){let t=/^p(\d+(?:\.\d+)?)$/.exec(e),n=t?Number(t[1]):NaN;return n>=0&&n<=100?n:NaN}function Ur(e,t,n){let r=e.filter(d=>Number.isFinite(d)),o=r.length;if(!o)return t.map(()=>0);let a=r.reduce((d,f)=>d+f,0)/o,i=t.length>1?Math.abs(t[t.length-1]-t[0]):0,s=i>0?i/40:Math.abs(a)*.05||1,l=Math.sqrt(r.reduce((d,f)=>d+(f-a)**2,0)/o)||s,u=[...r].sort((d,f)=>d-f),h=Le(u,.75)-Le(u,.25),m=Math.min(l,h>0?h/1.34:l)||l,g=n??Math.max(1e-9,.9*m*Math.pow(o,-.2)),y=1/(Math.sqrt(2*Math.PI)*g*o);if(o>2e3){let f=u[0],b=(u[o-1]-f)/512||1,v=new Array(513).fill(0);for(let P of r)v[Math.min(512,Math.floor((P-f)/b))]++;return t.map(P=>{let M=0;for(let S=0;S<=512;S++){if(!v[S])continue;let B=(P-(f+S*b))/g;B>6||B<-6||(M+=v[S]*Math.exp(-.5*B*B))}return M*y})}return t.map(d=>{let f=0;for(let x of r){let b=(d-x)/g;b>6||b<-6||(f+=Math.exp(-.5*b*b))}return f*y})}var gn=2;function qr(e,t,n){return n!==void 0?!0:t!==void 0||!e?!1:["x0","x1","count"].every(r=>et(e,r))&&!et(e,"value")}var Ei=50,_i=200,Oi=[1,2,2.5,5,10],$t=[[1],[1,3],[1,2,5],[1,1.6,2.5,4,6.3],[1,1.25,1.6,2,2.5,3.15,4,5,6.3,8]],$e=e=>Number(e.toPrecision(12));function hn(e,t=!1){let n=10**Math.floor(Math.log10(e)),r=Oi.map(o=>$e(o*n));return t?r.find(o=>o>=e*(1-1e-9))??$e(10*n):r.reduce((o,a)=>Math.abs(Math.log(a/e))<Math.abs(Math.log(o/e))?a:o)}function Wr(e,t,n){let r=Math.floor(e/n+1e-9)*n,o=Math.max(1,Math.ceil((t-r)/n-1e-9)),a=Array.from({length:o+1},(i,s)=>$e(r+s*n));return a[0]>e&&a.unshift($e(a[0]-n)),a[a.length-1]<t&&a.push($e(a[a.length-1]+n)),a}function pn(e,t,n,r=0){let o=[];for(let a=Math.floor(Math.log10(e))-r;a<=Math.ceil(Math.log10(t))+r;a++)for(let i of n)o.push($e(i*10**a));return o}function Kr(e,t,n){let r=pn(e,t,n,1),o=r.length-1;for(;o>0&&r[o]>e*(1+1e-9);)o--;let a=o+1;for(;a<r.length-1&&r[a]<t*(1-1e-9);)a++;return r.slice(o,a+1)}function Gr(e){let t=e.length,n=Le(e,.75)-Le(e,.25);return t>=30&&n>0?2*n/Math.cbrt(t):(e[t-1]-e[0])/(Math.ceil(Math.log2(t))+1)}function Ii(e,t){let n=[...new Set(e.filter(r=>Number.isFinite(r)&&(!t||r>0)))].sort((r,o)=>r-o);return n.length>=2?n:null}function Yr(e,t={}){let n=t.log===!0,r=t.edges?Ii(t.edges,n):null;if(r)return r;let o=Float64Array.from(e.filter(g=>Number.isFinite(g)&&(!n||g>0))).sort();if(!o.length)return[];let a=o[0],i=o[o.length-1],s=t.binWidth!==void 0&&t.binWidth>0&&!n?t.binWidth:void 0;if(a===i){if(n)return[$e(a/2),$e(a*2)];let g=s??1;return[a-g/2,a+g/2]}let l=t.bins!==void 0&&t.bins>=1?Math.round(t.bins):void 0,u=s!==void 0||l!==void 0?_i:Ei;if(n){let g=l!==void 0?Math.log10(i/a)/l:Gr(o.map(Math.log10)),y=x=>Math.abs(Math.log(1/x.length/g)),d=$t.reduce((x,b,v)=>y(b)<y($t[x])?v:x,0),f=Kr(a,i,$t[d]);for(;f.length-1>u&&d>0;)f=Kr(a,i,$t[--d]);return f}let h=s??hn(l!==void 0?(i-a)/l:Gr(o));(i-a)/h>u&&(h=hn((i-a)/u,!0));let m=Wr(a,i,h);for(;m.length-1>u;)m=Wr(a,i,h=hn(h*1.01,!0));return m}function bn(e,t){let n=e.length-1;if(n<1||!(t>=e[0]&&t<=e[n]))return-1;let r=0,o=n;for(;o-r>1;){let a=r+o>>1;e[a]<=t?r=a:o=a}return r}function Xr(e,t){let n=new Array(Math.max(0,t.length-1)).fill(0),r=0;for(let o of e){if(!Number.isFinite(o))continue;let a=bn(t,o);a<0?r++:n[a]++}return{counts:n,outside:r}}function Jr(e,t){let n=Math.max(1,Math.floor(t));if(!(e>n))return 1;if(!Number.isFinite(e))return 1/0;for(let r=10**Math.max(0,Math.floor(Math.log10(e/n))-1);;r*=10)for(let o of[1,2,5])if(Math.ceil(e/(o*r))<=n)return o*r}function Zr(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return De(t.csv)}return null}var oe=R(J(),1);var O=R(j(),1),Mt=60;var Qr={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function eo(e){let{c:t,events:n}=e,r=(0,oe.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,me(()=>{Je()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,oe.useContext)(ft),u=e.ariaLabel??l??e.kind,h=(0,oe.useMemo)(()=>s?`${n.length}${n.slice(0,Mt).map(T=>`${T.label}${T.series??""}${T.formatted??T.value??""}`).join("")}`:"",[n,s]),m=(0,oe.useMemo)(()=>(0,O.jsx)(Bi,{label:u,events:n,t:t.t}),[u,h,t.t]),g=(0,oe.useRef)(null);(0,oe.useEffect)(()=>{let T=()=>{g.current=null};return window.addEventListener("scroll",T,{capture:!0,passive:!0}),window.addEventListener("resize",T,{passive:!0}),()=>{window.removeEventListener("scroll",T,{capture:!0}),window.removeEventListener("resize",T)}},[]),(0,oe.useEffect)(()=>{g.current=null},[t.width,t.height]);let y=T=>{if(T.target!==T.currentTarget)return;if(e.onKey?.(T)){T.preventDefault();return}let K=t.active,z;switch(T.key){case"ArrowRight":case"ArrowDown":z=K===null?0:(K+1)%i;break;case"ArrowLeft":case"ArrowUp":z=K===null?i-1:(K-1+i)%i;break;case"Home":z=0;break;case"End":z=i-1;break;case"Escape":if(K===null)return;z=null;break;case"Enter":case" ":K!==null&&(T.preventDefault(),t.click(K));return;default:return}T.preventDefault(),t.setActive(z,"keyboard")},{via:d,node:f,setActive:x}=t;(0,oe.useEffect)(()=>{if(d!=="touch"||!f)return;let T=K=>{f.contains(K.target)||x(null)};return document.addEventListener("pointerdown",T),()=>document.removeEventListener("pointerdown",T)},[d,f,x]);let b=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,P=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&b?e.renderTip(b):null,S=e.announce??(t.via==="keyboard"&&b?`${b.label}${b.series?` ${b.series}`:""}: ${b.formatted??b.value??""} (${(t.active??0)+1}/${i})`:""),B;if(v){let T=v.x*P,K=t.width*P,z=`clamp(${(4-T).toFixed(1)}px, -50%, calc(${(K-T-4).toFixed(1)}px - 100%))`,ne=v.y<64;B={position:"absolute",left:T,top:v.y*P,transform:`translate(${z}, ${ne?"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*P-8)}}let Q=T=>{g.current=null,T.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},te=T=>T?K=>{let z=g.current??(g.current=K.currentTarget.getBoundingClientRect());z.width&&T((K.clientX-z.left)/z.width*t.width,(K.clientY-z.top)/z.height*t.height,K)}:void 0,D=te(e.onPointerMove),L=te(e.onPointerDown),w=D||L?T=>{T.pointerType==="touch"&&D?.(T),L?.(T)}:void 0,F=te(e.onPointerUp),_=yr(e.theme);return(0,O.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?y:void 0,onBlur:T=>{t.via==="keyboard"&&!T.currentTarget.contains(T.relatedTarget)&&t.setActive(null)},onPointerLeave:Q,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"),..._,...e.style},children:[t.pending?null:e.underlay,(0,O.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:D,onPointerDown:w,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,O.jsx)("title",{id:o,children:u}),(0,O.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,O.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,O.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:B,children:M??(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map((T,K)=>(0,O.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,O.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(T.strong?"ink":"muted")},children:[T.color?(0,O.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:T.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,T.label]}),(0,O.jsx)("span",{style:{fontWeight:T.strong===!1?500:700},children:T.value})]},K))]})}):null,(0,O.jsx)("span",{className:"ztd-sr",style:Qr,"aria-live":"polite","aria-atomic":"true",children:S}),s&&!t.pending?m:null]})}function Bi({label:e,events:t,t:n}){return(0,O.jsx)("div",{className:"ztd-sr",style:Qr,children:(0,O.jsxs)("table",{children:[(0,O.jsx)("caption",{children:n.table(e)}),(0,O.jsxs)("tbody",{children:[t.slice(0,Mt).map((r,o)=>(0,O.jsxs)("tr",{children:[(0,O.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,O.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Mt?(0,O.jsx)("tr",{children:(0,O.jsx)("td",{colSpan:2,children:n.more(t.length-Mt)})}):null]})]})})}function Me(e){let t=e.baseline??"central";return(0,O.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 no(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function to(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var Tt=new Map;function Te(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Tt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);no(u)?i+=to(u):s+=to(u)}a=i+s*(n>=600?1.07:1),Tt.size>5e3&&Tt.clear(),Tt.set(o,a)}return a*t}function yn(e,t,n,r=400){if(e=e.trim(),Te(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;Te(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<(no(s.charCodeAt(0))?2:3)?"":s+o}var Ve=R(j(),1),tt=10.5;function ro(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=>He(i,{locale:n,maximumFractionDigits:a}))}function oo(e,t,n){let r=18;for(let o of ro(e,t,n))r=Math.max(r,Te(o,tt));return Math.ceil(r+8)}function ao(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:ro(n,i,e.locale);return(0,Ve.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((u,h)=>{let m=Math.round(r(u))+.5,g=u===0&&e.zero!==!1;return(0,Ve.jsxs)("g",{children:[(0,Ve.jsx)("line",{x1:o,x2:a,y1:m,y2:m,stroke:t.paint(g?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:g?.7:1}),l?(0,Ve.jsx)(Me,{x:s?a+6:o-6,y:m,anchor:s?"start":"end",size:tt,fill:t.paint("muted"),children:l[h]}):null]},u)})})}function io(e,t,n){let r=[],o=-1/0;for(let a of e){let i=Te(a.label,tt),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 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 so(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 h=0;h<4;h++){let m=Math.ceil(a/l-1e-9)*l,g=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-g<=l*.3?g:o-i*s,a===0?0:m-a<=l*.3?m:a+i*s];let y=xn(u[1]-u[0],n);if(y===l)break;l=y}return u}function kn(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 St(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)=>kn(n,r,l),s}function lo(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 q=R(J(),1);var ae=R(J(),1);function zi(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Hi(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function mo(e,t=!0){let[n,r]=(0,ae.useState)({visible:!t,near:!t});return(0,ae.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=Hi(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:zi(.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 uo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function fo(e){let[t,n]=(0,ae.useState)(null),[r,o]=(0,ae.useState)(e??null),a=(0,ae.useCallback)(i=>{n(i),i&&e===void 0&&o(uo(i))},[e]);return me(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=u=>o(h=>h!==null&&Math.abs(h-u)<.5?h:u),s=()=>i(uo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let h=u[u.length-1]?.contentRect;h?i(h.width>0?Math.round(h.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var ji=()=>()=>{};function At(){return(0,ae.useSyncExternalStore)(ji,()=>!0,()=>!1)}var co="(prefers-reduced-motion: reduce)";function ho(e="auto"){let[t,n]=(0,ae.useState)(()=>ge&&typeof window.matchMedia=="function"?window.matchMedia(co).matches:!1);return(0,ae.useEffect)(()=>{if(e!=="auto"||!ge||typeof window.matchMedia!="function")return;let r=window.matchMedia(co),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}function go(e,t){let n=pe(e.theme),[r,o,a]=fo(e.width),i=At(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,h=ho(e.reducedMotion??"auto"),m=e.animate!==!1&&!h&&ge,g=mo(r,e.animateOnView!==!1&&m),y=ue(e.locale),d=Z(y),f=(0,q.useMemo)(()=>Ze(e.format,y,t.format),[e.format,y,t.format]),x=(0,q.useCallback)(Y=>ze(Y,{locale:y}),[y]),b=(0,q.useMemo)(()=>sr(f,e.unit),[f,e.unit]),v=(0,q.useMemo)(()=>$r(e.data),[e.data]),[P,M]=(0,q.useState)(null),[S,B]=(0,q.useState)(null),Q=(0,q.useRef)([]),te=(0,q.useRef)(e.onHover);te.current=e.onHover;let D=(0,q.useRef)(e.onClick);D.current=e.onClick;let L=(0,q.useRef)(null),w=(0,q.useRef)(null),F=(0,q.useRef)(null),_=(0,q.useCallback)((Y,re="pointer")=>{if(F.current!==Y){F.current=Y;let at=Y===null?null:Q.current[Y]??null;queueMicrotask(()=>te.current?.(at)),w.current?.(Y)}L.current=Y===null?null:re,M(Y),B(L.current)},[]),T=(0,q.useCallback)(Y=>{L.current!=="keyboard"&&(L.current=Y===null?null:"sync",M(Y),B(L.current))},[]),K=(0,q.useCallback)(Y=>{let re=Q.current[Y];re&&D.current?.(re)},[]),z=xr(e.replayKey),ne=e.width!==void 0||(a??0)>0,ot={enabled:m,active:g.visible&&ne,near:g.near,replayKey:z,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Ke=(0,q.useCallback)((Y,re=1)=>P===null||P===Y?re:re*.38,[P]);return{p:n,width:s,height:u,measured:ne,responsive:e.width===void 0,pending:ge&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:ot,fv:b,fmt:f,pct:x,locale:y,lang:d,t:d==="ko"?tr:er,active:P,via:S,setActive:_,click:K,events:Q,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Ke,sig:v,description:e.description,reduced:h,publish:w,applySync:T}}var U=R(J(),1);function Vi(e){return 1-Math.pow(1-e,3)}function Wi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ki(e){return e==="easeInOut"?Wi:e==="linear"?t=>t:Vi}function Gi(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 We(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 Nt(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 po(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 bo(e,t,n,r){if(!t||!n||t.length!==n.length)return We(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 We(s,n[i]))o.push(l)}return o.length===r?o:We(e,r)}var Rt=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||!Nt(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),po(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Nt(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=bo(s.cur,s.parts,i.parts,u),s.vel=bo(s.curVel,s.parts,i.parts,u),s.parts=i.parts,s.to=i.to.slice(),po(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=Nt(s.from,s.to)&&s.vel.every(h=>Math.abs(h)<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=Nt(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=We(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=Ki(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=We(s.from,u)),s.vel.length!==u&&(s.vel=We(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 m=0;m<u;m++)s.cur[m]=s.from[m],s.curVel[m]=0;s.progress=0,n=!0;continue}let h;if(this.easing==="spring"){let m=Math.exp(-a*l),g=a*l>=8&&a*l<20,y=0;for(let d=0;d<u;d++){let f=s.from[d]-s.to[d],x=s.vel[d]+a*f;s.cur[d]=s.to[d]+(f+x*l)*m,s.curVel[d]=(s.vel[d]-a*x*l)*m,g&&y<.15&&(y=Math.max(y,Math.abs(s.cur[d]-s.to[d]),Math.abs(s.curVel[d]/a)))}h=a*l>=20||g&&y<.15,s.progress=Math.min(1,1-(1+a*l)*m)}else{let m=Math.min(1,l/o),g=r(m),y=Gi(this.easing,m)/o;for(let d=0;d<u;d++)s.cur[d]=s.from[d]+(s.to[d]-s.from[d])*g,s.curVel[d]=(s.to[d]-s.from[d])*y;h=m>=1,s.progress=g}if(h){for(let m=0;m<u;m++)s.cur[m]=s.to[m],s.curVel[m]=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}},nt=new Set,Ft=0;function yo(e){Ft=0;let t=Array.from(nt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||nt.delete(n)}nt.size&&typeof requestAnimationFrame<"u"&&(Ft=requestAnimationFrame(yo))}function xo(e){return nt.add(e),!Ft&&typeof requestAnimationFrame<"u"&&(Ft=requestAnimationFrame(yo)),()=>{nt.delete(e)}}function Ui(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 ko(e,t){let n=(0,U.useMemo)(()=>Ui(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:u=900,stagger:h=0}=t,m=(0,U.useRef)(null),g=(0,U.useRef)("init"),y=(0,U.useRef)(null),d=(0,U.useRef)(s),f=(0,U.useRef)(i),x=(0,U.useRef)(!1),b=(0,U.useRef)(0),[,v]=(0,U.useState)(0),P=(0,U.useRef)(null),M=(0,U.useRef)(!0);m.current||(m.current=new Rt,m.current.configure(l,u),m.current.snap(n),y.current=n);let S=m.current;if(S.configure(l,u),y.current!==n){let w=g.current,F=!Object.is(d.current,s);S.sameTargets(n)?S.refreshData(n):!r||w==="init"?S.snap(n):w==="idle"?S.hold(n):w==="running"||F?S.update(n,gt(),h):S.snap(n),y.current=n,d.current=s}let B=(0,U.useRef)(()=>!1);B.current=w=>{if(!M.current)return!1;let F=S.step(w);return!F&&g.current==="running"&&(g.current="done"),v(_=>(_+1)%1e9),F||(P.current=null),F};let Q=(0,U.useCallback)(()=>{if(!ge||P.current||!S.animating)return;let w=F=>B.current(F);P.current=xo(w)},[S]);me(()=>{let w=!Object.is(f.current,i);if(f.current=i,!r){(g.current!=="done"||S.animating)&&(S.snap(y.current??n),g.current="done",v(F=>F+1));return}g.current==="init"||w&&a?(S.hold(y.current??n),g.current="idle",x.current=!1,v(F=>F+1)):w&&(x.current=!0)},[r,i]),me(()=>{!r||!a||!x.current||(x.current=!1,S.hold(y.current??n),g.current="idle",v(w=>w+1))},[a,r]),(0,U.useEffect)(()=>{r&&o&&g.current==="idle"&&(S.start(gt()),b.current+=1,g.current="running",Q(),v(w=>w+1))},[r,o,i,S,Q]),(0,U.useEffect)(()=>{S.animating&&Q()}),(0,U.useEffect)(()=>(M.current=!0,()=>{M.current=!1,P.current?.(),P.current=null}),[]);let te=gt(),D=S.elapsed(te),L=r&&g.current==="idle";return{items:S.items(),get:w=>S.get(w),elapsed:L?0:D,fade:(w,F=320)=>L?0:Number.isFinite(D)?Math.max(0,Math.min(1,(D-w)/F)):1,waiting:L,animating:S.animating,generation:b.current}}var qi=R(J(),1);var wo=R(j(),1);var vo=e=>e?"neutralStrong":"accent";var vn=R(j(),1);function Co(e,t,n,r){if(typeof e!="function")return be(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 Yi=R(J(),1);var Cn=R(j(),1),Xi={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${ve(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},$o={en:Xi,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}일 이동평균`}},wn=["ink","muted","dim"];function Mo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,wn.length)}var Ee=R(J(),1);var E=R(j(),1),Ji={kind:"Histogram",count:"Count",cum:"Cumulative",range:(e,t)=>`${e} to ${t}`,inBin:(e,t)=>`${e} · ${t}`,row:(e,t)=>`${e} (${t})`,rowCum:e=>`cumulative ${e}`,samples:e=>ve(e,"sample"),median:e=>`median ${e}`,about:e=>`about ${e}`,peak:(e,t)=>`the tallest bin is ${e} (${t})`,past:(e,t,n,r,o)=>`${e} ${t?"above":"below"} ${r?`the ${r} of ${n}`:n} (${o})`,outside:e=>`${e} outside the edges`,excluded:e=>`${e} at or below 0 left out`,dot:e=>`1 dot = ${ve(e,"sample")}`,groups:e=>ve(e,"group"),hidden:(e,t)=>`Only the first ${e} of ${t} groups are drawn`},Zi={en:Ji,ko:{kind:"히스토그램",count:"건수",cum:"누적",range:(e,t)=>`${e} ~ ${t}`,inBin:(e,t)=>`${e}건 · ${t}`,row:(e,t)=>`${e}건(${t})`,rowCum:e=>`누적 ${e}`,samples:e=>`표본 ${e}개`,median:e=>`중앙값 ${e}`,about:e=>`약 ${e}`,peak:(e,t)=>`가장 많은 구간 ${e}(${t}건)`,past:(e,t,n,r,o)=>`${r?`${r} `:""}${n} ${t?"넘음":"미만"} ${e}건(${o})`,outside:e=>`범위 밖 ${e}개`,excluded:e=>`0 이하 ${e}개 제외`,dot:e=>`점 하나 = ${e}건`,groups:e=>`그룹 ${e}개`,hidden:(e,t)=>`그룹 ${t}개 중 앞의 ${e}개만 그려요`}},$n=e=>e,Qi=["p50","p95"],No=10,Pt=15,Dt=16,To=96,es=e=>e==="p50"?void 0:e==="p99"?"1.5 2.5":"4 3";function ts(e,t,n,r,o){let a=Fe(t,"value"),i=n?Pe(n,"group"):()=>"",s=new Map,l=[];e.forEach((d,f)=>{let x=a(d,f);if(!Number.isFinite(x))return;let b=i(d,f),v=s.get(b);v||s.set(b,v={values:[],excluded:0}),o.log&&x<=0?v.excluded++:(v.values.push(x),r?.(d,f)&&l.push({g:b,v:x}))});let u=[...s.keys()].slice(0,gn),h=u.length?Yr(u.flatMap(d=>s.get(d).values),o):[],m=u.map(d=>Xr(s.get(d).values,h)),g=h.slice(1).map((d,f)=>({i:f,x0:h[f],x1:d,counts:m.map(x=>x.counts[f])})),y=u.map((d,f)=>({name:d,n:s.get(d).values.length,values:s.get(d).values,outside:m[f].outside,excluded:s.get(d).excluded}));return{bins:g,samples:y,groupCount:s.size,binned:!1,fnBins:new Set(l.map(d=>bn(h,d.v)).filter(d=>d>=0)),fnGroup:l.map(d=>u.indexOf(d.g)).find(d=>d>=0)??-1}}function ns(e,t,n,r){let o=Fe(t.x0,"x0"),a=Fe(t.x1,"x1"),i=Fe(t.count,"count"),s=t.group?Pe(t.group,"group"):()=>"",l=new Map,u=new Map;e.forEach((f,x)=>{let b=o(f,x),v=a(f,x),P=i(f,x);if(!(Number.isFinite(b)&&Number.isFinite(v)&&v>b&&Number.isFinite(P)&&P>=0))return;let M=s(f,x);if(l.set(M,l.get(M)??0),r&&b<=0){l.set(M,l.get(M)+P);return}let S=`${b}|${v}`,B=u.get(S);B||u.set(S,B={x0:b,x1:v,by:new Map,picked:new Set}),B.by.set(M,(B.by.get(M)??0)+P),n?.(f,x)&&B.picked.add(M)});let h=[...l.keys()].slice(0,gn),m=[],g=new Set;for(let f of[...u.values()].sort((x,b)=>x.x0-b.x0||x.x1-b.x1)){let x=m[m.length-1];x&&f.x0>x.x1&&m.push({i:m.length,x0:x.x1,x1:f.x0,counts:h.map(()=>0)}),f.picked.size&&g.add(m.length),m.push({i:m.length,x0:f.x0,x1:f.x1,counts:h.map(b=>f.by.get(b)??0)})}let y=h.map((f,x)=>({name:f,n:m.reduce((b,v)=>b+v.counts[x],0),values:[],outside:0,excluded:l.get(f)})),d=h.findIndex(f=>[...u.values()].some(x=>x.picked.has(f)));return{bins:m,samples:y,groupCount:l.size,binned:!0,fnBins:g,fnGroup:d}}function So(e,t,n,r){let o=e.samples[t];if(!e.binned)return Vr(o.values,n);let a=n/100*o.n,i=0;for(let s of e.bins){let l=s.counts[t];if(l>0&&i+l>=a){let u=(a-i)/l;return r?10**(Math.log10(s.x0)+u*(Math.log10(s.x1)-Math.log10(s.x0))):s.x0+u*(s.x1-s.x0)}i+=l}return NaN}function Mn(e,t,n){let r=n?Math.log10:$n;if(n&&t.value<=0)return t.side==="below"?0:1;let o=(r(t.value)-r(e.x0))/(r(e.x1)-r(e.x0));return Math.max(0,Math.min(1,t.side==="below"?o:1-o))}function rs(e,t,n,r){let o=n.side!=="below",a=e.samples[t];if(!e.binned)return{n:a.values.filter(l=>o?l>n.value:l<n.value).length,est:!1};let i=0,s=!1;for(let l of e.bins){let u=Mn(l,n,r);i+=l.counts[t]*u,u>0&&u<1&&l.counts[t]>0&&(s=!0)}return{n:Math.round(i),est:s}}function Ao(e,t,n,r=-1/0,o=1/0){let a=t.length,i=l=>Math.min(e[l+1],o)>Math.max(e[l],r),s="";for(let l=0;l<a;l++){if(!i(l))continue;let u=l;for(;u+1<a&&i(u+1);)u++;let h=Math.max(e[l],r),m=Math.min(e[u+1],o);s+=`M${k(h)},${k(h===e[l]?Math.max(l?t[l-1]:n,t[l]):t[l])}V${k(t[l])}`;for(let g=l;g<u;g++)s+=`H${k(e[g+1])}V${k(t[g+1])}`;s+=`H${k(m)}`,m===e[u+1]&&(s+=`V${k(Math.max(u+1<a?t[u+1]:n,t[u]))}`),l=u}return s}function os(e,t){let n=[];for(let r=0;r<t;r++){if(!e.has(r))continue;let o=r;for(;e.has(o+1);)o++;n.push([r,o]),r=o}return n}function as(e,t,n){let r=[...e].sort((l,u)=>l.at-u.at),o=l=>{let u=[];return r.map(h=>{let m=Te(h.text,No,700)+10,g=[h.at,h.at+m/2-4,h.at-m/2+4].map(y=>Math.max(t+m/2,Math.min(n-m/2,y)));for(let y=0;;y++){let d=u[y]??(u[y]=[]),f=l.map(x=>g[x]).find(x=>d.every(([b,v])=>x+m/2+4<=b||x-m/2-4>=v));if(f!==void 0)return d.push([f-m/2,f+m/2]),{...h,x:f,w:m,row:y}}})},a=l=>Math.max(0,...l.map(u=>u.row)),i=o([0,1,2]),s=o([2,0,1]);return a(s)<a(i)?s:i}function is(e,t,n){let r=[];for(let o=Math.max(2,n);o<=Math.max(2,n)+4&&r.length<3;o++)r=kn(e,t,o).filter(a=>a>=e-1e-9&&a<=t+1e-9);return r}function ss(e,t,n){let r=a=>pn(e,t,a).filter(i=>i>=e*.999999999&&i<=t*1.000000001),o=r(n>=110?[1,2,5]:[1]);return o.length>=2?o:r([1,2,3,4,5,6,7,8,9])}function Tn(e){let t=go(e,{height:c=>Math.max(230,Math.min(310,c*.55)),duration:800}),{p:n,width:r,height:o}=t,a=Zi[t.lang],i=t.fv,s=e.log===!0,l=e.variant??"bars",u=e.threshold&&Number.isFinite(e.threshold.value)?e.threshold:void 0,h=u?.value,m=u?.side,g=m!=="below",y=e.edges?.join(","),d=(e.marks??Qi).filter(c=>Number.isFinite(fn(c))).join(","),f=typeof e.highlight=="function"?e.highlight:null,x=typeof e.highlight=="function"?void 0:e.highlight,{data:b,value:v,group:P,x0:M,x1:S,count:B,binWidth:Q,bins:te}=e,D=(0,Ee.useMemo)(()=>{let c=b.find(N=>N!==null&&typeof N=="object");if(qr(c,v,B))return ns(b,{x0:M,x1:S,count:B,group:P},f,s);let A=y?y.split(",").map(Number):void 0;return ts(b,v,P,f,{edges:A,binWidth:Q,bins:te,log:s})},[b,v,P,M,S,B,y,Q,te,s,f]),{bins:L,samples:w}=D,F=L.length,_=w.length>1,T=(0,Ee.useMemo)(()=>D.samples.map((c,A)=>{let N=d?d.split(",").map($=>({id:$,v:So(D,A,fn($),s)})):[];return{median:N.find($=>$.id==="p50")?.v??So(D,A,50,s),marks:N}}),[D,d,s]),K=(0,Ee.useMemo)(()=>h===void 0?[]:D.samples.map((c,A)=>rs(D,A,{value:h,side:m},s)),[D,h,m,s]),[z,ne]=(0,Ee.useMemo)(()=>lo(D.bins.flatMap(c=>[c.x0,c.x1])),[D]),ot=e.kde===!0&&!D.binned,Ke=(0,Ee.useMemo)(()=>{if(!ot||!D.bins.length)return null;let c=s?Math.log10:$n,[A,N]=[c(z),c(ne)],$=Array.from({length:To},(W,I)=>A+(N-A)*I/(To-1)),G=(N-A)/D.bins.length;return{xs:$,curves:D.samples.map(W=>Ur(W.values.map(c),$).map(I=>I*W.n*G))}},[ot,D,s,z,ne]),Y=w.map(c=>c.name),re=_?f?D.fnGroup:[...be(x,Y,Y,w.map(c=>c.n),"first")][0]??-1:-1,at=L.map(c=>c.counts[0]),it=c=>a.range(i(c.x0),i(c.x1)),Lt=_||u?new Set:f?D.fnBins:be(x,L,L.map(it),at,"max"),_e=_&&re===0?1:0,Ge=_?1-_e:0,X=l==="dots"&&!_,Ae=l==="step",Et=s?Math.log10:$n,Oe=Math.max(0,...L.flatMap(c=>c.counts)),An=Math.max(2,Math.round(o/70)),st=so(0,Math.max(1,Oe,...Ke?.curves.flat()??[]),An),Nn=St(st,[0,1]).ticks(An).filter(c=>Number.isInteger(c)),Rn=Jt(void 0,t.locale,st[1]),Fn=X?8:oo(Nn,Rn,t.locale),Ie=Fn+2,Ne=r-10,Pn=St([Et(z),Et(ne)],[Ie,Ne]),V=c=>Pn(Et(c)),_t=c=>Number.isFinite(c)&&c>=z&&c<=ne&&(!s||c>0),Dn=w.reduce((c,A)=>c+A.outside,0),Ln=w.reduce((c,A)=>c+A.excluded,0),lt=[Dn?a.outside(Dn):"",Ln?a.excluded(Ln):""].filter(Boolean).join(" · "),Io=Math.max(0,re),Ot=t.pending||!F?[]:as([...(T[Io]?.marks??[]).filter(c=>_t(c.v)).map(c=>({key:c.id,at:V(c.v),text:`${c.id} ${i(c.v)}`,fill:n.paint(_?"accentText":"ink"),stroke:n.paint(_?"accent":"ink"),dash:es(c.id)})),...u&&_t(u.value)?[{key:"threshold",at:V(u.value),text:u.label?`${u.label} ${i(u.value)}`:i(u.value),fill:n.paint(_?"ink":"accentText"),stroke:n.paint(_?"ink":"accent")}]:[]],4,r-4),En=t.showLabels?Math.max(0,...Ot.map(c=>c.row+1)):0,Bo=lt||X?Dt:0,ut=c=>6+Bo+c*(Pt+3),ie=ut(En)+(En?4:0),H=o-22,zo=F?Math.min(...L.map(c=>V(c.x1)-V(c.x0))):10,_n=Math.max(1.5,Math.min(6,zo/2-1)),On=Math.min(_n,2.5),fe=X?Jr(Oe,(H-ie)/(On*2+1.5)):1,It=Math.max(On,Math.min(_n,((H-ie)/Math.max(1,Math.ceil(Oe/fe))-1.5)/2)),ct=It*2+1.5,Ue=X?c=>H-c/fe*ct:St(st,[H,ie]),Bt=e.stagger??Math.min(28,520/Math.max(1,F)),Ho=(0,Ee.useMemo)(()=>{let c=[];if(!Ae)for(let N of L)c.push({key:`${X?"d":"b"}${N.i}`,to:[X?1:Ue(N.counts[_e])],from:[X?0:H],enter:[X?0:H],delay:N.i*Bt,data:{k:_e,i:N.i}});let A=_?Ae?[_e,Ge]:[Ge]:Ae?[0]:[];for(let N of A)c.push({key:`s${N}`,to:L.map($=>Ue($.counts[N])),from:L.map(()=>H),enter:L.map(()=>H),delay:N===Ge?120:0,data:{k:N,i:-1}});return c},[D,r,o,ie,fe,X,Ae,_,_e,Ge,Bt,st[1]]),In=ko(Ho,t.motion),qe=c=>ze(c,{locale:t.locale,maximumFractionDigits:1}),Ye=(c,A)=>w[c].n?A/w[c].n*100:0,Bn=w.map((c,A)=>{let N=0;return L.map($=>N+=$.counts[A])}),jo=L.map(c=>{let A=w.map((N,$)=>{let G=a.row(c.counts[$],qe(Ye($,c.counts[$])));return _?`${N.name} ${G}`:`${G}, ${a.rowCum(qe(Ye($,Bn[$][c.i])))}`});return{datum:null,index:c.i,key:`b${c.i}`,label:it(c),value:c.counts.reduce((N,$)=>N+$,0),formatted:A.join(", ")}}),ye=n.paint("accent"),zn=c=>Lt.has(c.i)||u!==void 0&&Mn(c,u,s)>=.5,Hn=c=>c===re?ye:n.paint(c===_e&&!Ae?"neutral":"neutralStrong"),jn=null;if(t.active!==null&&L[t.active]){let c=L[t.active],A=Math.max(...c.counts),N=$=>{let G=a.inBin(c.counts[$],qe(Ye($,c.counts[$]))),W={label:a.cum,value:qe(Ye($,Bn[$][c.i])),strong:!1};return _?[{label:w[$].name,value:G,color:Hn($),strong:$===re},W]:[{label:a.count,value:G,color:zn(c)?ye:n.paint(X||Ae?"neutralStrong":"neutral"),strong:!0},W]};jn={x:(V(c.x0)+V(c.x1))/2,y:X?H-Math.ceil(A/fe)*ct:Ue(A),title:it(c),rows:w.flatMap(($,G)=>N(G))}}let Vn=c=>{let A=w[c],N=T[c],$=K[c],G=I=>D.binned?a.about(i(I)):i(I),W=[a.samples(A.n),a.median(G(N.median)),...N.marks.filter(I=>I.id!=="p50").map(I=>`${I.id} ${G(I.v)}`)];return!_&&Oe&&W.push(a.peak(it(L[at.indexOf(Oe)]),Oe)),$&&u&&W.push(a.past($.est?a.about(`${$.n}`):`${$.n}`,g,i(u.value),u.label??"",qe(Ye(c,$.n)))),W},zt=[lt,X?a.dot(fe):""].filter(Boolean),Vo=D.groupCount>w.length?` ${a.hidden(w.length,D.groupCount)}.`:"",Wo=F?_?`${a.kind}, ${a.groups(w.length)}. ${w.map((c,A)=>`${c.name}: ${Vn(A).join(", ")}`).join("; ")}${zt.length?`. ${zt.join(", ")}`:""}.${Vo}`:`${a.kind}. ${[...Vn(0),...zt].join(", ")}.`:"",Ko=e.description??Wo,Xe=u&&_t(u.value)?V(u.value):null,mt=F?[V(L[0].x0),...L.map(c=>V(c.x1))]:[],Wn=(c,A)=>c>0&&H-A<1?H-1:A,Go=(c,A,N)=>{let $=V(c.x0)+.5,G=V(c.x1)-.5,W=G-$;if(W<=0||c.counts[N]<=0)return null;let I=Wn(c.counts[N],A),he=Math.min(2,W/4),dt=n.paint("neutral"),Be=u&&!_?Mn(c,u,s):0;if(Be<=0||Be>=1||Xe===null)return(0,E.jsx)("path",{d:Ct($,I,W,H-I,{tl:he,tr:he}),fill:Be>=1||Lt.has(c.i)?ye:dt});let Ht=Math.max($,Math.min(G,Xe)),[Qo,ea]=g?[dt,ye]:[ye,dt];return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:Ct($,I,Ht-$,H-I,{tl:he}),fill:Qo}),(0,E.jsx)("path",{d:Ct(Ht,I,G-Ht,H-I,{tr:he}),fill:ea})]})},Uo=(c,A)=>{let N=A.map((W,I)=>Wn(L[I]?.counts[c]??0,W)),$=_&&c===Ge&&re>=0,G=_?[]:u?Xe===null?[]:[g?[Xe,1/0]:[-1/0,Xe]]:os(Lt,F).map(([W,I])=>[mt[W],mt[I+1]]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:Ao(mt,N,H),fill:"none",stroke:$?ye:n.paint("neutralStrong"),strokeWidth:$?2:1.6,strokeLinejoin:"round"}),G.map(([W,I],he)=>(0,E.jsx)("path",{d:Ao(mt,N,H,W,I),fill:"none",stroke:ye,strokeWidth:2,strokeLinejoin:"round"},he))]})},qo=(c,A)=>{let N=c.counts[0],$=Math.floor(N/fe),G=N%fe>0,W=Math.round(A*($+(G?1:0))),I=k((V(c.x0)+V(c.x1))/2),he=zn(c)?ye:n.paint("neutralStrong");return(0,E.jsxs)(E.Fragment,{children:[Array.from({length:Math.min(W,$)},(dt,Be)=>(0,E.jsx)("circle",{cx:I,cy:k(H-ct*(Be+.5)),r:k(It),fill:he},Be)),G&&W>$?(0,E.jsx)("circle",{cx:I,cy:k(H-ct*($+.5)),r:k(It-.65),fill:"none",stroke:he,strokeWidth:1.3}):null]})},Yo=F?s?ss(z,ne,(Ne-Ie)/Math.max(1e-9,Math.log10(ne/z))):is(z,ne,Math.round((Ne-Ie)/70)):[],Xo=Jt(e.format,t.locale,Math.max(Math.abs(z),Math.abs(ne))),Jo=io(Yo.map(c=>({t:c,x:V(c),label:Xo(c)})),0,r),xe=t.active!==null?L[t.active]:void 0,Zo=xe&&(X||Ae||_),Kn=In.fade(Math.min(700,F*Bt)+200,320);return(0,E.jsxs)(eo,{c:t,kind:a.kind,ariaLabel:e.ariaLabel,description:Ko,events:jo,tip:jn,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[!X&&F?(0,E.jsx)(ao,{p:n,ticks:Nn,y:Ue,x0:Fn,x1:r,fmt:Rn,locale:t.locale}):null,Zo?(0,E.jsx)("rect",{x:k(V(xe.x0)),y:k(ie),width:k(V(xe.x1)-V(xe.x0)),height:k(H-ie),fill:n.paint("line"),opacity:.6,pointerEvents:"none"}):null,L.map(c=>(0,E.jsx)("rect",{x:k(V(c.x0)),y:k(ie),width:k(Math.max(0,V(c.x1)-V(c.x0))),height:k(Math.max(0,H-ie)),fill:"transparent",onPointerEnter:A=>t.setActive(c.i,A.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(c.i),style:{cursor:e.onClick?"pointer":void 0}},`h${c.i}`)),In.items.map(c=>{let{k:A,i:N}=c.data,$=L[N];return(0,E.jsx)("g",{className:"ztd-mark",pointerEvents:"none",opacity:c.exiting?.4:N<0?1:t.dim(N),children:N<0?Uo(A,c.v):$?X?qo($,c.v[0]):Go($,c.v[0],A):null},c.key)}),xe&&t.via==="keyboard"?(0,E.jsx)("rect",{x:k(V(xe.x0)-1),y:k(ie-2),width:k(V(xe.x1)-V(xe.x0)+2),height:k(H-ie+4),rx:3,fill:"none",stroke:n.paint("ink"),strokeWidth:2,pointerEvents:"none"}):null,Ke?.curves.map((c,A)=>(0,E.jsx)("path",{d:jr(c.map((N,$)=>[Pn(Ke.xs[$]),Math.max(ie,Ue(N))])),fill:"none",stroke:_?Hn(A):n.paint("ink"),strokeWidth:1.6,opacity:Kn,pointerEvents:"none"},`k${A}`)),(0,E.jsxs)("g",{opacity:Kn,pointerEvents:"none","aria-hidden":"true",children:[Ot.map(c=>(0,E.jsx)("line",{x1:k(c.at),x2:k(c.at),y1:t.showLabels?ut(c.row)+Pt:ie,y2:H,stroke:c.stroke,strokeWidth:c.key==="threshold"?1.5:1.4,strokeDasharray:c.dash},c.key)),t.showLabels?Ot.map(c=>(0,E.jsxs)("g",{children:[(0,E.jsx)("rect",{x:k(c.x-c.w/2),y:ut(c.row),width:k(c.w),height:Pt,rx:5,fill:n.paint("panel"),opacity:.92}),(0,E.jsx)(Me,{x:c.x,y:ut(c.row)+Pt/2,anchor:"middle",size:No,weight:700,fill:c.fill,children:c.text})]},c.key)):null]}),(0,E.jsxs)("g",{"aria-hidden":"true",children:[Jo.map(c=>(0,E.jsx)(Me,{x:c.x,y:H+11,anchor:"middle",size:tt,fill:n.paint("muted"),children:c.label},c.t)),X&&F?(0,E.jsx)("line",{x1:Ie,x2:Ne,y1:k(H)+.5,y2:k(H)+.5,stroke:n.paint("dim"),shapeRendering:"crispEdges"}):null,lt?(0,E.jsx)(Me,{x:Ie,y:6+Dt/2,size:10.5,fill:n.paint("muted"),children:yn(lt,Math.max(40,Ne-Ie-(X?110:0)),10.5)}):null,X?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("circle",{cx:k(Ne-Te(a.dot(fe),10.5,600)-8),cy:6+Dt/2,r:3.5,fill:n.paint("neutralStrong")}),(0,E.jsx)(Me,{x:Ne,y:6+Dt/2,anchor:"end",size:10.5,weight:600,fill:n.paint("muted"),children:a.dot(fe)})]}):null,F?null:(0,E.jsx)(Me,{x:r/2,y:o/2,anchor:"middle",size:12,fill:n.paint("muted"),children:t.t.empty})]})]})}var ls=R(J(),1);var Do=R(j(),1),us={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ve(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},cs={en:us,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ro=(e,t)=>cs[e].other(t);function Fo(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,Hr(o.map(a=>a.value)))}}var Po=e=>Number.isFinite(e)&&e>0?e:0;var Se=R(j(),1);function Lo(e,t){let n=vt(e);return n?.type==="scatter"&&t?.size!==void 0?vt("bubble"):n}function ms(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 ds(e,t,n,r=!1){let o=Lo(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&mn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),u=m=>m.filter(g=>!l.has(g.label)),h=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(h.includes(o.type)){let m=Pe(a.label,"label"),g=Fe(a.value,"value"),y=o.type==="waffle",d=t.map((M,S)=>({r:M,label:m(M,S),value:y?g(M,S):Po(g(M,S))})),{kept:f,other:x}=y?{kept:d,other:null}:Fo(d,i.other,(M,S)=>({r:{},label:Ro(Z(n),M),value:S})),b=be(s,f.map(M=>M.r),f.map(M=>M.label),f.map(M=>M.value),y?"first":"max"),v=x?[...f,x]:f,P=Qe(v.length,b);return v.map((M,S)=>({label:M.label,color:P[S]}))}if(o.type==="candlestick"){let m=Mo(Array.isArray(i.ma)?i.ma:void 0,t.length),g=$o[Z(n)];return[{label:g.up,color:i.upColor??"accent"},{label:g.down,color:i.downColor??"neutralStrong"},...m.map((y,d)=>({label:g.maLegend(y),color:wn[d],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let m=Pe(a.series,"series"),g=sn(t.map((d,f)=>m(d,f)));if(g.length<2)return[];let y=vr(g.length,Co(s,t,g,m));return u(g.map((d,f)=>({label:d,color:y[f],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let m=[];if(Array.isArray(a.y))m=a.y;else if(typeof a.series=="string"){let f=Pe(a.series,"series");m=sn(t.map((x,b)=>f(x,b)))}let g=dn(o.type,a,i);if(g.length){let f=Qe(m.length,be(s,m,m,m.map(()=>0),"none")),x=m.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:m.map((b,v)=>({label:b,color:f[v]}));return[...u(x),...g.map((b,v)=>({label:b,color:vo(v),shape:"line"}))]}if(m.length<2)return[];let y=be(s,m,m,m.map(()=>0),"first");if(o.type==="line"||o.type==="radar")return u(m.map((f,x)=>({label:f,color:y.has(x)?"accent":"neutralStrong",shape:o.type==="line"?"line":"square"})));let d=Qe(m.length,y);return u(m.map((f,x)=>({label:f,color:d[x]})))}return[]}function Eo(e,t){let{spec:n}=e,r=Lo(n.type,n.encoding),o=(0,rt.useMemo)(()=>Zr(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Or(n,e.locale),s=ue(i),l=Z(s),u=Mr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),h=Br(n),m=(0,rt.useMemo)(()=>h?Pr(h,s):void 0,[h,s]),g=n.options?.hidden,y=Array.isArray(g)?g.map(String):[],d=y.join(""),[f,x]=(0,rt.useState)(null);if(!r)return(0,Se.jsx)(on,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let b=o??u.data,v=t[r.type],P={...n.options??{}},M={...ms(r,n.encoding),...P,...m?{tooltip:m}:{},data:b,...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},S=n.card?.legend==="toggle"&&Ir(r.type,n.encoding??{},P),B=f&&f.base===d?f.hidden:y;S&&(M.hidden=B);let Q=w=>x(F=>{let _=F&&F.base===d?F.hidden:y;return{base:d,hidden:_.includes(w)?_.filter(T=>T!==w):[..._,w]}}),te=M.height??220,D=a&&!b.length&&(u.loading||u.error||u.empty)?(0,Se.jsx)(on,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:te,locale:i}):(0,Se.jsx)(v,{...M});if(n.card){let w=n.card,F=w.legend==="auto"||w.legend==="toggle"?ds(n,b,s,S):w.legend,_=F?.length?S?(0,Se.jsx)(rn,{items:F,hidden:B,onToggle:Q,locale:i}):F:void 0,T=w.download?(0,Se.jsx)(Fr,{data:b,columns:zr(n),filename:w.title??r.type,formats:Array.isArray(w.download)?w.download:void 0,locale:i}):void 0;D=(0,Se.jsx)(kr,{number:w.number,title:w.title??_r(r,l),subtitle:w.subtitle,legend:_,actions:T,source:w.source||void 0,note:w.note||void 0,accent:w.accent,takeaway:w.takeaway,level:w.level,sample:w.sample,replay:w.replay!==!1,className:e.className,locale:i,children:D})}let L=e.theme??n.theme;return L&&(D=(0,Se.jsx)(yt,{theme:L,children:D})),D}function fs({cfg:e,components:t}){let n=At();return Eo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Oo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,_o.hydrateRoot)(r,(0,Sn.createElement)(yt,{theme:o.theme,cssVars:!0},(0,Sn.createElement)(fs,{cfg:o,components:{[e]:t}})))}Oo("histogram",Tn);})();
|
|
27
|
+
`}function Ys(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Wn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Go=2,Ie=16;function Ko(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 Uo(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 Xo(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+Ie*2,i+Ie*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((d,g)=>{let y;for(let b of Array.from(d.attributes)){if(!Ks.test(b.value))continue;let v=(y??(y=getComputedStyle(d))).getPropertyValue(b.name);v&&m[g].setAttribute(b.name,Ko(v,u))}}),c.removeAttribute("style");for(let[d,g]of Object.entries({viewBox:`${-Ie} ${-Ie} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(d,String(g));let f=Ko(getComputedStyle(r).backgroundColor,u),p=o.parentElement?.querySelector("canvas")??null;if(n){let d=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Uo("rect",{x:-Ie,y:-Ie,width:s,height:l,fill:f}),d),p&&c.insertBefore(Uo("image",{href:p.toDataURL(),width:a,height:i}),d)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:f,canvas:p}}function qs(e,t){let n=Xo(e,Go,!1);if(!n)return;let r=Go,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,Ie*r,Ie*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&&Wn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Yo(e){let t=pe(e.theme),n=Z(se(e.locale))==="ko",r=Ys(e.filename),o=(a,i)=>{if(a==="csv")return Wn(new Blob([Xs(e.data,e.columns?.length?e.columns:Us(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return qs(i,r);let s=Xo(i,1,!0);s&&Wn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Gn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Ws.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Gn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick: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 Jo=L(V(),1);function qo(e,t=ie){let n=He(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?xt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Qr,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Jo.jsx)("div",{children:s},l)):null}}var Js=e=>new Float64Array(e.map(ye).filter(Number.isFinite)).sort(),Zs=(e,t)=>t>=0&&t<=100?We(e,t/100):NaN;function Zo(e,t){return Zs(Js(e),t)}function Kn(e){let t=/^p(\d+(?:\.\d+)?)$/.exec(e),n=t?Number(t[1]):NaN;return n>=0&&n<=100?n:NaN}function na(e,t,n){let r=e.filter(d=>Number.isFinite(d)),o=r.length;if(!o)return t.map(()=>0);let a=r.reduce((d,g)=>d+g,0)/o,i=t.length>1?Math.abs(t[t.length-1]-t[0]):0,s=i>0?i/40:Math.abs(a)*.05||1,l=Math.sqrt(r.reduce((d,g)=>d+(g-a)**2,0)/o)||s,c=[...r].sort((d,g)=>d-g),m=We(c,.75)-We(c,.25),u=Math.min(l,m>0?m/1.34:l)||l,f=n??Math.max(1e-9,.9*u*Math.pow(o,-.2)),p=1/(Math.sqrt(2*Math.PI)*f*o);if(o>2e3){let g=c[0],b=(c[o-1]-g)/512||1,v=new Array(513).fill(0);for(let T of r)v[Math.min(512,Math.floor((T-g)/b))]++;return t.map(T=>{let M=0;for(let x=0;x<=512;x++){if(!v[x])continue;let P=(T-(g+x*b))/f;P>6||P<-6||(M+=v[x]*Math.exp(-.5*P*P))}return M*p})}return t.map(d=>{let g=0;for(let y of r){let b=(d-y)/f;b>6||b<-6||(g+=Math.exp(-.5*b*b))}return g*p})}var Xn=2;function ra(e,t,n){return n!==void 0?!0:t!==void 0||!e?!1:["x0","x1","count"].every(r=>kt(e,r))&&!kt(e,"value")}var Qs=50,el=200,tl=[1,2,2.5,5,10],nn=[[1],[1,3],[1,2,5],[1,1.6,2.5,4,6.3],[1,1.25,1.6,2,2.5,3.15,4,5,6.3,8]],Oe=e=>Number(e.toPrecision(12));function Un(e,t=!1){let n=10**Math.floor(Math.log10(e)),r=tl.map(o=>Oe(o*n));return t?r.find(o=>o>=e*(1-1e-9))??Oe(10*n):r.reduce((o,a)=>Math.abs(Math.log(a/e))<Math.abs(Math.log(o/e))?a:o)}function Qo(e,t,n){let r=Math.floor(e/n+1e-9)*n,o=Math.max(1,Math.ceil((t-r)/n-1e-9)),a=Array.from({length:o+1},(i,s)=>Oe(r+s*n));return a[0]>e&&a.unshift(Oe(a[0]-n)),a[a.length-1]<t&&a.push(Oe(a[a.length-1]+n)),a}function Yn(e,t,n,r=0){let o=[];for(let a=Math.floor(Math.log10(e))-r;a<=Math.ceil(Math.log10(t))+r;a++)for(let i of n)o.push(Oe(i*10**a));return o}function ea(e,t,n){let r=Yn(e,t,n,1),o=r.length-1;for(;o>0&&r[o]>e*(1+1e-9);)o--;let a=o+1;for(;a<r.length-1&&r[a]<t*(1-1e-9);)a++;return r.slice(o,a+1)}function ta(e){let t=e.length,n=We(e,.75)-We(e,.25);return t>=30&&n>0?2*n/Math.cbrt(t):(e[t-1]-e[0])/(Math.ceil(Math.log2(t))+1)}function nl(e,t){let n=[...new Set(e.filter(r=>Number.isFinite(r)&&(!t||r>0)))].sort((r,o)=>r-o);return n.length>=2?n:null}function oa(e,t={}){let n=t.log===!0,r=t.edges?nl(t.edges,n):null;if(r)return r;let o=Float64Array.from(e.filter(f=>Number.isFinite(f)&&(!n||f>0))).sort();if(!o.length)return[];let a=o[0],i=o[o.length-1],s=t.binWidth!==void 0&&t.binWidth>0&&!n?t.binWidth:void 0;if(a===i){if(n)return[Oe(a/2),Oe(a*2)];let f=s??1;return[a-f/2,a+f/2]}let l=t.bins!==void 0&&t.bins>=1?Math.round(t.bins):void 0,c=s!==void 0||l!==void 0?el:Qs;if(n){let f=l!==void 0?Math.log10(i/a)/l:ta(o.map(Math.log10)),p=y=>Math.abs(Math.log(1/y.length/f)),d=nn.reduce((y,b,v)=>p(b)<p(nn[y])?v:y,0),g=ea(a,i,nn[d]);for(;g.length-1>c&&d>0;)g=ea(a,i,nn[--d]);return g}let m=s??Un(l!==void 0?(i-a)/l:ta(o));(i-a)/m>c&&(m=Un((i-a)/c,!0));let u=Qo(a,i,m);for(;u.length-1>c;)u=Qo(a,i,m=Un(m*1.01,!0));return u}function qn(e,t){let n=e.length-1;if(n<1||!(t>=e[0]&&t<=e[n]))return-1;let r=0,o=n;for(;o-r>1;){let a=r+o>>1;e[a]<=t?r=a:o=a}return r}function aa(e,t){let n=new Array(Math.max(0,t.length-1)).fill(0),r=0;for(let o of e){if(!Number.isFinite(o))continue;let a=qn(t,o);a<0?r++:n[a]++}return{counts:n,outside:r}}function ia(e,t){let n=Math.max(1,Math.floor(t));if(!(e>n))return 1;if(!Number.isFinite(e))return 1/0;for(let r=10**Math.max(0,Math.floor(Math.log10(e/n))-1);;r*=10)for(let o of[1,2,5])if(Math.ceil(e/(o*r))<=n)return o*r}function sa(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 Ve(t.csv)}return null}var ha=L(J(),1);var ee=L(J(),1);function la(e,t){let n=pe(e.theme),[r,o,a]=en(e.width),i=lt(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=tn(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&he,f=Ho(r,e.animateOnView!==!1&&u),p=se(e.locale),d=Z(p),g=(0,ee.useMemo)(()=>He(e.format,p,t.format),[e.format,p,t.format]),y=(0,ee.useCallback)(K=>rt(K,{locale:p}),[p]),b=(0,ee.useMemo)(()=>It(g,e.unit),[g,e.unit]),v=(0,ee.useMemo)(()=>Ut(e.data),[e.data]),[T,M]=(0,ee.useState)(null),[x,P]=(0,ee.useState)(null),z=(0,ee.useRef)([]),H=(0,ee.useRef)(e.onHover);H.current=e.onHover;let E=(0,ee.useRef)(e.onClick);E.current=e.onClick;let D=(0,ee.useRef)(null),A=(0,ee.useRef)(null),S=(0,ee.useRef)(null),$=(0,ee.useCallback)((K,re="pointer")=>{if(S.current!==K){S.current=K;let ue=K===null?null:z.current[K]??null;queueMicrotask(()=>H.current?.(ue)),A.current?.(K)}D.current=K===null?null:re,M(K),P(D.current)},[]),k=(0,ee.useCallback)(K=>{D.current!=="keyboard"&&(D.current=K===null?null:"sync",M(K),P(D.current))},[]),F=(0,ee.useCallback)(K=>{let re=z.current[K];re&&E.current?.(re)},[]),_=ao(e.replayKey),j=e.width!==void 0||(a??0)>0,ae={enabled:u,active:f.visible&&j,near:f.near,replayKey:_,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Ce=(0,ee.useCallback)((K,re=1)=>T===null||T===K?re:re*.38,[T]);return{p:n,width:s,height:c,measured:j,responsive:e.width===void 0,pending:he&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:ae,fv:b,fmt:g,pct:y,locale:p,lang:d,t:d==="ko"?_r:Er,active:T,via:x,setActive:$,click:F,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Ce,sig:v,description:e.description,reduced:m,publish:A,applySync:k}}var Q=L(J(),1);function rl(e){return 1-Math.pow(1-e,3)}function ol(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function al(e){return e==="easeInOut"?ol:e==="linear"?t=>t:rl}function il(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 ut(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 ca(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 ua(e,t,n,r){if(!t||!n||t.length!==n.length)return ut(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 ut(s,n[i]))o.push(l)}return o.length===r?o:ut(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),ca(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 c=i.to.length;s.from=ua(s.cur,s.parts,i.parts,c),s.vel=ua(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),ca(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(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=rn(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=ut(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=al(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=ut(s.from,c)),s.vel.length!==c&&(s.vel=ut(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),f=a*l>=8&&a*l<20,p=0;for(let d=0;d<c;d++){let g=s.from[d]-s.to[d],y=s.vel[d]+a*g;s.cur[d]=s.to[d]+(g+y*l)*u,s.curVel[d]=(s.vel[d]-a*y*l)*u,f&&p<.15&&(p=Math.max(p,Math.abs(s.cur[d]-s.to[d]),Math.abs(s.curVel[d]/a)))}m=a*l>=20||f&&p<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),f=r(u),p=il(this.easing,u)/o;for(let d=0;d<c;d++)s.cur[d]=s.from[d]+(s.to[d]-s.from[d])*f,s.curVel[d]=(s.to[d]-s.from[d])*p;m=u>=1,s.progress=f}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Mt=new Set,an=0;function ma(e){an=0;let t=Array.from(Mt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Mt.delete(n)}Mt.size&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(ma))}function da(e){return Mt.add(e),!an&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(ma)),()=>{Mt.delete(e)}}function sl(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 fa(e,t){let n=(0,Q.useMemo)(()=>sl(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,Q.useRef)(null),f=(0,Q.useRef)("init"),p=(0,Q.useRef)(null),d=(0,Q.useRef)(s),g=(0,Q.useRef)(i),y=(0,Q.useRef)(!1),b=(0,Q.useRef)(0),[,v]=(0,Q.useState)(0),T=(0,Q.useRef)(null),M=(0,Q.useRef)(!0);u.current||(u.current=new on,u.current.configure(l,c),u.current.snap(n),p.current=n);let x=u.current;if(x.configure(l,c),p.current!==n){let A=f.current,S=!Object.is(d.current,s);x.sameTargets(n)?x.refreshData(n):!r||A==="init"?x.snap(n):A==="idle"?x.hold(n):A==="running"||S?x.update(n,Lt(),m):x.snap(n),p.current=n,d.current=s}let P=(0,Q.useRef)(()=>!1);P.current=A=>{if(!M.current)return!1;let S=x.step(A);return!S&&f.current==="running"&&(f.current="done"),v($=>($+1)%1e9),S||(T.current=null),S};let z=(0,Q.useCallback)(()=>{if(!he||T.current||!x.animating)return;let A=S=>P.current(S);T.current=da(A)},[x]);we(()=>{let A=!Object.is(g.current,i);if(g.current=i,!r){(f.current!=="done"||x.animating)&&(x.snap(p.current??n),f.current="done",v(S=>S+1));return}f.current==="init"||A&&a?(x.hold(p.current??n),f.current="idle",y.current=!1,v(S=>S+1)):A&&(y.current=!0)},[r,i]),we(()=>{!r||!a||!y.current||(y.current=!1,x.hold(p.current??n),f.current="idle",v(A=>A+1))},[a,r]),(0,Q.useEffect)(()=>{r&&o&&f.current==="idle"&&(x.start(Lt()),b.current+=1,f.current="running",z(),v(A=>A+1))},[r,o,i,x,z]),(0,Q.useEffect)(()=>{x.animating&&z()}),(0,Q.useEffect)(()=>(M.current=!0,()=>{M.current=!1,T.current?.(),T.current=null}),[]);let H=Lt(),E=x.elapsed(H),D=r&&f.current==="idle";return{items:x.items(),get:A=>x.get(A),elapsed:D?0:E,fade:(A,S=320)=>D?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-A)/S)):1,waiting:D,animating:x.animating,generation:b.current}}var Jn=L(V(),1);function ga(e,t,n,r,o){if(r)return o==="categorical"?$e(e,t,n):Gr(e,t,n);if(o==="categorical")return $e(e,t,n);let a=ne(e,"strong"),i=ne(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var ll=L(J(),1);var Zn=L(V(),1);var pa=e=>e?"neutralStrong":"accent";var Qn=L(V(),1);function ba(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 cl=L(J(),1);var tr=L(V(),1),ul={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${ve(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},ya={en:ul,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 xa(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,er.length)}var Xe=L(J(),1);var B=L(V(),1),ml={kind:"Histogram",count:"Count",cum:"Cumulative",range:(e,t)=>`${e} to ${t}`,inBin:(e,t)=>`${e} · ${t}`,row:(e,t)=>`${e} (${t})`,rowCum:e=>`cumulative ${e}`,samples:e=>ve(e,"sample"),median:e=>`median ${e}`,about:e=>`about ${e}`,peak:(e,t)=>`the tallest bin is ${e} (${t})`,past:(e,t,n,r,o)=>`${e} ${t?"above":"below"} ${r?`the ${r} of ${n}`:n} (${o})`,outside:e=>`${e} outside the edges`,excluded:e=>`${e} at or below 0 left out`,dot:e=>`1 dot = ${ve(e,"sample")}`,groups:e=>ve(e,"group"),hidden:(e,t)=>`Only the first ${e} of ${t} groups are drawn`},dl={en:ml,ko:{kind:"히스토그램",count:"건수",cum:"누적",range:(e,t)=>`${e} ~ ${t}`,inBin:(e,t)=>`${e}건 · ${t}`,row:(e,t)=>`${e}건(${t})`,rowCum:e=>`누적 ${e}`,samples:e=>`표본 ${e}개`,median:e=>`중앙값 ${e}`,about:e=>`약 ${e}`,peak:(e,t)=>`가장 많은 구간 ${e}(${t}건)`,past:(e,t,n,r,o)=>`${r?`${r} `:""}${n} ${t?"넘음":"미만"} ${e}건(${o})`,outside:e=>`범위 밖 ${e}개`,excluded:e=>`0 이하 ${e}개 제외`,dot:e=>`점 하나 = ${e}건`,groups:e=>`그룹 ${e}개`,hidden:(e,t)=>`그룹 ${t}개 중 앞의 ${e}개만 그려요`}},nr=e=>e,fl=["p50","p95"],$a=10,sn=15,ln=16,ka=96,hl=e=>e==="p50"?void 0:e==="p99"?"1.5 2.5":"4 3";function gl(e,t,n,r,o){let a=Ae(t,"value"),i=n?Fe(n,"group"):()=>"",s=new Map,l=[];e.forEach((d,g)=>{let y=a(d,g);if(!Number.isFinite(y))return;let b=i(d,g),v=s.get(b);v||s.set(b,v={values:[],excluded:0}),o.log&&y<=0?v.excluded++:(v.values.push(y),r?.(d,g)&&l.push({g:b,v:y}))});let c=[...s.keys()].slice(0,Xn),m=c.length?oa(c.flatMap(d=>s.get(d).values),o):[],u=c.map(d=>aa(s.get(d).values,m)),f=m.slice(1).map((d,g)=>({i:g,x0:m[g],x1:d,counts:u.map(y=>y.counts[g])})),p=c.map((d,g)=>({name:d,n:s.get(d).values.length,values:s.get(d).values,outside:u[g].outside,excluded:s.get(d).excluded}));return{bins:f,samples:p,groupCount:s.size,binned:!1,fnBins:new Set(l.map(d=>qn(m,d.v)).filter(d=>d>=0)),fnGroup:l.map(d=>c.indexOf(d.g)).find(d=>d>=0)??-1}}function pl(e,t,n,r){let o=Ae(t.x0,"x0"),a=Ae(t.x1,"x1"),i=Ae(t.count,"count"),s=t.group?Fe(t.group,"group"):()=>"",l=new Map,c=new Map;e.forEach((g,y)=>{let b=o(g,y),v=a(g,y),T=i(g,y);if(!(Number.isFinite(b)&&Number.isFinite(v)&&v>b&&Number.isFinite(T)&&T>=0))return;let M=s(g,y);if(l.set(M,l.get(M)??0),r&&b<=0){l.set(M,l.get(M)+T);return}let x=`${b}|${v}`,P=c.get(x);P||c.set(x,P={x0:b,x1:v,by:new Map,picked:new Set}),P.by.set(M,(P.by.get(M)??0)+T),n?.(g,y)&&P.picked.add(M)});let m=[...l.keys()].slice(0,Xn),u=[],f=new Set;for(let g of[...c.values()].sort((y,b)=>y.x0-b.x0||y.x1-b.x1)){let y=u[u.length-1];y&&g.x0>y.x1&&u.push({i:u.length,x0:y.x1,x1:g.x0,counts:m.map(()=>0)}),g.picked.size&&f.add(u.length),u.push({i:u.length,x0:g.x0,x1:g.x1,counts:m.map(b=>g.by.get(b)??0)})}let p=m.map((g,y)=>({name:g,n:u.reduce((b,v)=>b+v.counts[y],0),values:[],outside:0,excluded:l.get(g)})),d=m.findIndex(g=>[...c.values()].some(y=>y.picked.has(g)));return{bins:u,samples:p,groupCount:l.size,binned:!0,fnBins:f,fnGroup:d}}function wa(e,t,n,r){let o=e.samples[t];if(!e.binned)return Zo(o.values,n);let a=n/100*o.n,i=0;for(let s of e.bins){let l=s.counts[t];if(l>0&&i+l>=a){let c=(a-i)/l;return r?10**(Math.log10(s.x0)+c*(Math.log10(s.x1)-Math.log10(s.x0))):s.x0+c*(s.x1-s.x0)}i+=l}return NaN}function rr(e,t,n){let r=n?Math.log10:nr;if(n&&t.value<=0)return t.side==="below"?0:1;let o=(r(t.value)-r(e.x0))/(r(e.x1)-r(e.x0));return Math.max(0,Math.min(1,t.side==="below"?o:1-o))}function bl(e,t,n,r){let o=n.side!=="below",a=e.samples[t];if(!e.binned)return{n:a.values.filter(l=>o?l>n.value:l<n.value).length,est:!1};let i=0,s=!1;for(let l of e.bins){let c=rr(l,n,r);i+=l.counts[t]*c,c>0&&c<1&&l.counts[t]>0&&(s=!0)}return{n:Math.round(i),est:s}}function va(e,t,n,r=-1/0,o=1/0){let a=t.length,i=l=>Math.min(e[l+1],o)>Math.max(e[l],r),s="";for(let l=0;l<a;l++){if(!i(l))continue;let c=l;for(;c+1<a&&i(c+1);)c++;let m=Math.max(e[l],r),u=Math.min(e[c+1],o);s+=`M${C(m)},${C(m===e[l]?Math.max(l?t[l-1]:n,t[l]):t[l])}V${C(t[l])}`;for(let f=l;f<c;f++)s+=`H${C(e[f+1])}V${C(t[f+1])}`;s+=`H${C(u)}`,u===e[c+1]&&(s+=`V${C(Math.max(c+1<a?t[c+1]:n,t[c]))}`),l=c}return s}function yl(e,t){let n=[];for(let r=0;r<t;r++){if(!e.has(r))continue;let o=r;for(;e.has(o+1);)o++;n.push([r,o]),r=o}return n}function xl(e,t,n){let r=[...e].sort((l,c)=>l.at-c.at),o=l=>{let c=[];return r.map(m=>{let u=xe(m.text,$a,700)+10,f=[m.at,m.at+u/2-4,m.at-u/2+4].map(p=>Math.max(t+u/2,Math.min(n-u/2,p)));for(let p=0;;p++){let d=c[p]??(c[p]=[]),g=l.map(y=>f[y]).find(y=>d.every(([b,v])=>y+u/2+4<=b||y-u/2-4>=v));if(g!==void 0)return d.push([g-u/2,g+u/2]),{...m,x:g,w:u,row:p}}})},a=l=>Math.max(0,...l.map(c=>c.row)),i=o([0,1,2]),s=o([2,0,1]);return a(s)<a(i)?s:i}function kl(e,t,n){let r=[];for(let o=Math.max(2,n);o<=Math.max(2,n)+4&&r.length<3;o++)r=Zt(e,t,o).filter(a=>a>=e-1e-9&&a<=t+1e-9);return r}function wl(e,t,n){let r=a=>Yn(e,t,a).filter(i=>i>=e*.999999999&&i<=t*1.000000001),o=r(n>=110?[1,2,5]:[1]);return o.length>=2?o:r([1,2,3,4,5,6,7,8,9])}function or(e){let t=la(e,{height:h=>Math.max(230,Math.min(310,h*.55)),duration:800}),{p:n,width:r,height:o}=t,a=dl[t.lang],i=t.fv,s=e.log===!0,l=e.variant??"bars",c=e.threshold&&Number.isFinite(e.threshold.value)?e.threshold:void 0,m=c?.value,u=c?.side,f=u!=="below",p=e.edges?.join(","),d=(e.marks??fl).filter(h=>Number.isFinite(Kn(h))).join(","),g=typeof e.highlight=="function"?e.highlight:null,y=typeof e.highlight=="function"?void 0:e.highlight,{data:b,value:v,group:T,x0:M,x1:x,count:P,binWidth:z,bins:H}=e,E=(0,Xe.useMemo)(()=>{let h=b.find(O=>O!==null&&typeof O=="object");if(ra(h,v,P))return pl(b,{x0:M,x1:x,count:P,group:T},g,s);let I=p?p.split(",").map(Number):void 0;return gl(b,v,T,g,{edges:I,binWidth:z,bins:H,log:s})},[b,v,T,M,x,P,p,z,H,s,g]),{bins:D,samples:A}=E,S=D.length,$=A.length>1,k=(0,Xe.useMemo)(()=>E.samples.map((h,I)=>{let O=d?d.split(",").map(R=>({id:R,v:wa(E,I,Kn(R),s)})):[];return{median:O.find(R=>R.id==="p50")?.v??wa(E,I,50,s),marks:O}}),[E,d,s]),F=(0,Xe.useMemo)(()=>m===void 0?[]:E.samples.map((h,I)=>bl(E,I,{value:m,side:u},s)),[E,m,u,s]),[_,j]=(0,Xe.useMemo)(()=>Ue(E.bins.flatMap(h=>[h.x0,h.x1])),[E]),ae=e.kde===!0&&!E.binned,Ce=(0,Xe.useMemo)(()=>{if(!ae||!E.bins.length)return null;let h=s?Math.log10:nr,[I,O]=[h(_),h(j)],R=Array.from({length:ka},(Y,G)=>I+(O-I)*G/(ka-1)),q=(O-I)/E.bins.length;return{xs:R,curves:E.samples.map(Y=>na(Y.values.map(h),R).map(G=>G*Y.n*q))}},[ae,E,s,_,j]),K=A.map(h=>h.name),re=$?g?E.fnGroup:[...ke(y,K,K,A.map(h=>h.n),"first")][0]??-1:-1,ue=D.map(h=>h.counts[0]),me=h=>a.range(i(h.x0),i(h.x1)),Ye=$||c?new Set:g?E.fnBins:ke(y,D,D.map(me),ue,"max"),qe=$&&re===0?1:0,mt=$?1-qe:0,te=l==="dots"&&!$,Be=l==="step",cn=s?Math.log10:nr,Je=Math.max(0,...D.flatMap(h=>h.counts)),ir=Math.max(2,Math.round(o/70)),Tt=_e(0,Math.max(1,Je,...Ce?.curves.flat()??[]),ir),sr=Ke(Tt,[0,1]).ticks(ir).filter(h=>Number.isInteger(h)),lr=yt(void 0,t.locale,Tt[1]),cr=te?8:Jt(sr,lr,t.locale),Ze=cr+2,ze=r-10,ur=Ke([cn(_),cn(j)],[Ze,ze]),X=h=>ur(cn(h)),un=h=>Number.isFinite(h)&&h>=_&&h<=j&&(!s||h>0),mr=A.reduce((h,I)=>h+I.outside,0),dr=A.reduce((h,I)=>h+I.excluded,0),St=[mr?a.outside(mr):"",dr?a.excluded(dr):""].filter(Boolean).join(" · "),Ia=Math.max(0,re),mn=t.pending||!S?[]:xl([...(k[Ia]?.marks??[]).filter(h=>un(h.v)).map(h=>({key:h.id,at:X(h.v),text:`${h.id} ${i(h.v)}`,fill:n.paint($?"accentText":"ink"),stroke:n.paint($?"accent":"ink"),dash:hl(h.id)})),...c&&un(c.value)?[{key:"threshold",at:X(c.value),text:c.label?`${c.label} ${i(c.value)}`:i(c.value),fill:n.paint($?"ink":"accentText"),stroke:n.paint($?"ink":"accent")}]:[]],4,r-4),fr=t.showLabels?Math.max(0,...mn.map(h=>h.row+1)):0,Oa=St||te?ln:0,At=h=>6+Oa+h*(sn+3),de=At(fr)+(fr?4:0),U=o-22,Ba=S?Math.min(...D.map(h=>X(h.x1)-X(h.x0))):10,hr=Math.max(1.5,Math.min(6,Ba/2-1)),gr=Math.min(hr,2.5),Te=te?ia(Je,(U-de)/(gr*2+1.5)):1,dn=Math.max(gr,Math.min(hr,((U-de)/Math.max(1,Math.ceil(Je/Te))-1.5)/2)),Ft=dn*2+1.5,dt=te?h=>U-h/Te*Ft:Ke(Tt,[U,de]),fn=e.stagger??Math.min(28,520/Math.max(1,S)),za=(0,Xe.useMemo)(()=>{let h=[];if(!Be)for(let O of D)h.push({key:`${te?"d":"b"}${O.i}`,to:[te?1:dt(O.counts[qe])],from:[te?0:U],enter:[te?0:U],delay:O.i*fn,data:{k:qe,i:O.i}});let I=$?Be?[qe,mt]:[mt]:Be?[0]:[];for(let O of I)h.push({key:`s${O}`,to:D.map(R=>dt(R.counts[O])),from:D.map(()=>U),enter:D.map(()=>U),delay:O===mt?120:0,data:{k:O,i:-1}});return h},[E,r,o,de,Te,te,Be,$,qe,mt,fn,Tt[1]]),pr=fa(za,t.motion),ft=h=>rt(h,{locale:t.locale,maximumFractionDigits:1}),ht=(h,I)=>A[h].n?I/A[h].n*100:0,br=A.map((h,I)=>{let O=0;return D.map(R=>O+=R.counts[I])}),Ha=D.map(h=>{let I=A.map((O,R)=>{let q=a.row(h.counts[R],ft(ht(R,h.counts[R])));return $?`${O.name} ${q}`:`${q}, ${a.rowCum(ft(ht(R,br[R][h.i])))}`});return{datum:null,index:h.i,key:`b${h.i}`,label:me(h),value:h.counts.reduce((O,R)=>O+R,0),formatted:I.join(", ")}}),Re=n.paint("accent"),yr=h=>Ye.has(h.i)||c!==void 0&&rr(h,c,s)>=.5,xr=h=>h===re?Re:n.paint(h===qe&&!Be?"neutral":"neutralStrong"),kr=null;if(t.active!==null&&D[t.active]){let h=D[t.active],I=Math.max(...h.counts),O=R=>{let q=a.inBin(h.counts[R],ft(ht(R,h.counts[R]))),Y={label:a.cum,value:ft(ht(R,br[R][h.i])),strong:!1};return $?[{label:A[R].name,value:q,color:xr(R),strong:R===re},Y]:[{label:a.count,value:q,color:yr(h)?Re:n.paint(te||Be?"neutralStrong":"neutral"),strong:!0},Y]};kr={x:(X(h.x0)+X(h.x1))/2,y:te?U-Math.ceil(I/Te)*Ft:dt(I),title:me(h),rows:A.flatMap((R,q)=>O(q))}}let wr=h=>{let I=A[h],O=k[h],R=F[h],q=G=>E.binned?a.about(i(G)):i(G),Y=[a.samples(I.n),a.median(q(O.median)),...O.marks.filter(G=>G.id!=="p50").map(G=>`${G.id} ${q(G.v)}`)];return!$&&Je&&Y.push(a.peak(me(D[ue.indexOf(Je)]),Je)),R&&c&&Y.push(a.past(R.est?a.about(`${R.n}`):`${R.n}`,f,i(c.value),c.label??"",ft(ht(h,R.n)))),Y},hn=[St,te?a.dot(Te):""].filter(Boolean),ja=E.groupCount>A.length?` ${a.hidden(A.length,E.groupCount)}.`:"",Va=S?$?`${a.kind}, ${a.groups(A.length)}. ${A.map((h,I)=>`${h.name}: ${wr(I).join(", ")}`).join("; ")}${hn.length?`. ${hn.join(", ")}`:""}.${ja}`:`${a.kind}. ${[...wr(0),...hn].join(", ")}.`:"",Wa=e.description??Va,gt=c&&un(c.value)?X(c.value):null,Nt=S?[X(D[0].x0),...D.map(h=>X(h.x1))]:[],vr=(h,I)=>h>0&&U-I<1?U-1:I,Ga=(h,I,O)=>{let R=X(h.x0)+.5,q=X(h.x1)-.5,Y=q-R;if(Y<=0||h.counts[O]<=0)return null;let G=vr(h.counts[O],I),Se=Math.min(2,Y/4),Rt=n.paint("neutral"),Qe=c&&!$?rr(h,c,s):0;if(Qe<=0||Qe>=1||gt===null)return(0,B.jsx)("path",{d:Yt(R,G,Y,U-G,{tl:Se,tr:Se}),fill:Qe>=1||Ye.has(h.i)?Re:Rt});let gn=Math.max(R,Math.min(q,gt)),[Za,Qa]=f?[Rt,Re]:[Re,Rt];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("path",{d:Yt(R,G,gn-R,U-G,{tl:Se}),fill:Za}),(0,B.jsx)("path",{d:Yt(gn,G,q-gn,U-G,{tr:Se}),fill:Qa})]})},Ka=(h,I)=>{let O=I.map((Y,G)=>vr(D[G]?.counts[h]??0,Y)),R=$&&h===mt&&re>=0,q=$?[]:c?gt===null?[]:[f?[gt,1/0]:[-1/0,gt]]:yl(Ye,S).map(([Y,G])=>[Nt[Y],Nt[G+1]]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("path",{d:va(Nt,O,U),fill:"none",stroke:R?Re:n.paint("neutralStrong"),strokeWidth:R?2:1.6,strokeLinejoin:"round"}),q.map(([Y,G],Se)=>(0,B.jsx)("path",{d:va(Nt,O,U,Y,G),fill:"none",stroke:Re,strokeWidth:2,strokeLinejoin:"round"},Se))]})},Ua=(h,I)=>{let O=h.counts[0],R=Math.floor(O/Te),q=O%Te>0,Y=Math.round(I*(R+(q?1:0))),G=C((X(h.x0)+X(h.x1))/2),Se=yr(h)?Re:n.paint("neutralStrong");return(0,B.jsxs)(B.Fragment,{children:[Array.from({length:Math.min(Y,R)},(Rt,Qe)=>(0,B.jsx)("circle",{cx:G,cy:C(U-Ft*(Qe+.5)),r:C(dn),fill:Se},Qe)),q&&Y>R?(0,B.jsx)("circle",{cx:G,cy:C(U-Ft*(R+.5)),r:C(dn-.65),fill:"none",stroke:Se,strokeWidth:1.3}):null]})},Xa=S?s?wl(_,j,(ze-Ze)/Math.max(1e-9,Math.log10(j/_))):kl(_,j,Math.round((ze-Ze)/70)):[],Ya=yt(e.format,t.locale,Math.max(Math.abs(_),Math.abs(j))),qa=Ro(Xa.map(h=>({t:h,x:X(h),label:Ya(h)})),0,r),Pe=t.active!==null?D[t.active]:void 0,Ja=Pe&&(te||Be||$),$r=pr.fade(Math.min(700,S*fn)+200,320);return(0,B.jsxs)(so,{c:t,kind:a.kind,ariaLabel:e.ariaLabel,description:Wa,events:Ha,tip:kr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[!te&&S?(0,B.jsx)(No,{p:n,ticks:sr,y:dt,x0:cr,x1:r,fmt:lr,locale:t.locale}):null,Ja?(0,B.jsx)("rect",{x:C(X(Pe.x0)),y:C(de),width:C(X(Pe.x1)-X(Pe.x0)),height:C(U-de),fill:n.paint("line"),opacity:.6,pointerEvents:"none"}):null,D.map(h=>(0,B.jsx)("rect",{x:C(X(h.x0)),y:C(de),width:C(Math.max(0,X(h.x1)-X(h.x0))),height:C(Math.max(0,U-de)),fill:"transparent",onPointerEnter:I=>t.setActive(h.i,I.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(h.i),style:{cursor:e.onClick?"pointer":void 0}},`h${h.i}`)),pr.items.map(h=>{let{k:I,i:O}=h.data,R=D[O];return(0,B.jsx)("g",{className:"ztd-mark",pointerEvents:"none",opacity:h.exiting?.4:O<0?1:t.dim(O),children:O<0?Ka(I,h.v):R?te?Ua(R,h.v[0]):Ga(R,h.v[0],I):null},h.key)}),Pe&&t.via==="keyboard"?(0,B.jsx)("rect",{x:C(X(Pe.x0)-1),y:C(de-2),width:C(X(Pe.x1)-X(Pe.x0)+2),height:C(U-de+4),rx:3,fill:"none",stroke:n.paint("ink"),strokeWidth:2,pointerEvents:"none"}):null,Ce?.curves.map((h,I)=>(0,B.jsx)("path",{d:$o(h.map((O,R)=>[ur(Ce.xs[R]),Math.max(de,dt(O))])),fill:"none",stroke:$?xr(I):n.paint("ink"),strokeWidth:1.6,opacity:$r,pointerEvents:"none"},`k${I}`)),(0,B.jsxs)("g",{opacity:$r,pointerEvents:"none","aria-hidden":"true",children:[mn.map(h=>(0,B.jsx)("line",{x1:C(h.at),x2:C(h.at),y1:t.showLabels?At(h.row)+sn:de,y2:U,stroke:h.stroke,strokeWidth:h.key==="threshold"?1.5:1.4,strokeDasharray:h.dash},h.key)),t.showLabels?mn.map(h=>(0,B.jsxs)("g",{children:[(0,B.jsx)("rect",{x:C(h.x-h.w/2),y:At(h.row),width:C(h.w),height:sn,rx:5,fill:n.paint("panel"),opacity:.92}),(0,B.jsx)(Le,{x:h.x,y:At(h.row)+sn/2,anchor:"middle",size:$a,weight:700,fill:h.fill,children:h.text})]},h.key)):null]}),(0,B.jsxs)("g",{"aria-hidden":"true",children:[qa.map(h=>(0,B.jsx)(Le,{x:h.x,y:U+11,anchor:"middle",size:Ge,fill:n.paint("muted"),children:h.label},h.t)),te&&S?(0,B.jsx)("line",{x1:Ze,x2:ze,y1:C(U)+.5,y2:C(U)+.5,stroke:n.paint("dim"),shapeRendering:"crispEdges"}):null,St?(0,B.jsx)(Le,{x:Ze,y:6+ln/2,size:10.5,fill:n.paint("muted"),children:zn(St,Math.max(40,ze-Ze-(te?110:0)),10.5)}):null,te?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("circle",{cx:C(ze-xe(a.dot(Te),10.5,600)-8),cy:6+ln/2,r:3.5,fill:n.paint("neutralStrong")}),(0,B.jsx)(Le,{x:ze,y:6+ln/2,anchor:"end",size:10.5,weight:600,fill:n.paint("muted"),children:a.dot(Te)})]}):null,S?null:(0,B.jsx)(Le,{x:r/2,y:o/2,anchor:"middle",size:12,fill:n.paint("muted"),children:t.t.empty})]})]})}var vl=L(J(),1);var Aa=L(V(),1),$l={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ve(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ml={en:$l,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ma=(e,t)=>Ml[e].other(t);function Ca(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,vo(o.map(a=>a.value)))}}var Ta=e=>Number.isFinite(e)&&e>0?e:0;function Sa(e,t,n,r){return r==="emphasis"?Wr(e,t,n):$e(e,t,n)}var Cl=L(J(),1);var Pa=L(V(),1);function Fa(e,t){return t===!1?e.map((n,r)=>r):wo(e)}function Na(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 Ra(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]=ne(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?ne(e,"neutral"):_t(e,1-i/Math.max(1,o.length-1))),r}var Ne=L(V(),1);function Da(e,t){let n=Kt(e);return n?.type==="scatter"&&t?.size!==void 0?Kt("bubble"):n}function Tl(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function Sl(e,t,n,r=!1){let o=Da(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&_n.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(f=>!l.has(f.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=Fe(a.label,"label"),f=Ae(a.value,"value"),p=o.type==="waffle",d=t.map((M,x)=>({r:M,label:u(M,x),value:p?f(M,x):Ta(f(M,x))})),{kept:g,other:y}=p?{kept:d,other:null}:Ca(d,i.other,(M,x)=>({r:{},label:Ma(Z(n),M),value:x})),b=ke(s,g.map(M=>M.r),g.map(M=>M.label),g.map(M=>M.value),p?"first":"max"),v=y?[...g,y]:g,T=bt(M=>p?$e(M,v.length,b):Sa(M,v.length,b,i.colorMode));return v.map((M,x)=>({label:M.label,color:T[x]}))}if(o.type==="candlestick"){let u=xa(Array.isArray(i.ma)?i.ma:void 0,t.length),f=ya[Z(n)];return[{label:f.up,color:i.upColor??"accent"},{label:f.down,color:i.downColor??"neutralStrong"},...u.map((p,d)=>({label:f.maLegend(p),color:er[d],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let u=Fe(a.series,"series"),f=it(t.map((g,y)=>u(g,y)));if(f.length<2)return[];let p=ba(s,t,f,u),d=bt(g=>Vr(g,f.length,p));return c(f.map((g,y)=>({label:g,color:d[y],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let T=Fe(a.series,"series");u=it(t.map((M,x)=>T(M,x)))}let f=In(o.type,a,i);if(f.length){let T=ke(s,u,u,u.map(()=>0),"none"),M=bt(P=>$e(P,u.length,T)),x=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((P,z)=>({label:P,color:M[z]}));return[...c(x),...f.map((P,z)=>({label:P,color:pa(z),shape:"line"}))]}if(u.length<2)return[];let d=o.type==="bar"&&i.layout==="diverging"&&s===void 0?ko(u.length,Array.isArray(i.negative)?i.negative.map(T=>u.indexOf(String(T))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=d>=0?new Set([d]):ke(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((T,M)=>({label:T,color:g.has(M)?"accent":"neutralStrong",shape:"square"})));let y=i.colorMode,b=T=>$e(T,u.length,g);if((o.type==="line"||o.type==="area")&&(b=T=>ga(T,u.length,g,o.type==="area",y)),o.type==="stream"){let T=wt(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),M=Fa(T.values,i.reorder),x=Na(s,T.series,T.values);b=P=>Ra(P,M,x)}let v=bt(b);return c(u.map((T,M)=>({label:T,color:v[M],...o.type==="line"&&{shape:"line"}})))}return[]}function Al(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&fo.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Fl(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function La(e,t){let{spec:n}=e,r=Da(n.type,n.encoding),o=(0,Ct.useMemo)(()=>sa(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=mo(n,e.locale),s=se(i),l=Z(s),c=Vo(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=po(n),u=(0,Ct.useMemo)(()=>m?qo(m,s):void 0,[m,s]),f=n.options?.hidden,p=Array.isArray(f)?f.map(String):[],d=p.join(""),[g,y]=(0,Ct.useState)(null);if(!r)return(0,Ne.jsx)(En,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let b=o??c.data,v=t[r.type],T={...n.options??{}},M={...Tl(r,n.encoding),...T,...u?{tooltip:u}:{},data:b,...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},x=n.card?.legend==="toggle"&&go(r.type,n.encoding??{},T),P=g&&g.base===d?g.hidden:p;x&&(M.hidden=P);let z=S=>y($=>{let k=$&&$.base===d?$.hidden:p;return{base:d,hidden:k.includes(S)?k.filter(F=>F!==S):[...k,S]}}),H=M.height??220,E=Al(n,r.type),D=a&&!b.length&&(c.loading||c.error||c.empty)?(0,Ne.jsx)(En,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:H,locale:i}):E?(0,Ne.jsx)(jo,{chart:v,...Fl(r.type,E,M)}):(0,Ne.jsx)(v,{...M});if(n.card){let S=n.card,$=S.legend==="auto"||S.legend==="toggle"?Sl(n,b,s,x):S.legend,k=$?.length?x?(0,Ne.jsx)(Ln,{items:$,hidden:P,onToggle:z,locale:i}):$:void 0,F=S.download?(0,Ne.jsx)(Yo,{data:b,columns:bo(n),filename:S.title??r.type,formats:Array.isArray(S.download)?S.download:void 0,locale:i}):void 0;D=(0,Ne.jsx)(io,{number:S.number,title:S.title??uo(r,l),subtitle:S.subtitle,legend:k,actions:F,source:S.source||void 0,note:S.note||void 0,accent:S.accent,takeaway:S.takeaway,level:S.level,sample:S.sample,replay:S.replay!==!1,className:e.className,locale:i,children:D})}let A=e.theme??n.theme;return A&&(D=(0,Ne.jsx)(Ht,{theme:A,children:D})),D}function Nl({cfg:e,components:t}){let n=lt();return La({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function _a(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Ea.hydrateRoot)(r,(0,ar.createElement)(Ht,{theme:o.theme,cssVars:!0},(0,ar.createElement)(Nl,{cfg:o,components:{[e]:t}})))}_a("histogram",or);})();
|