ztd-charts-cli 0.6.0 → 0.8.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.d.ts +11 -1
- package/dist/api.js +5 -1
- package/dist/{chunk-4K4P2AWW.js → chunk-FB5WHEJX.js} +64 -18
- package/dist/cli.js +5 -4
- package/dist/client/NOTICE.md +39 -0
- package/dist/client/area.js +10 -10
- package/dist/client/bar.js +10 -10
- package/dist/client/barRace.js +28 -0
- 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/choropleth.js +28 -0
- package/dist/client/donut.js +10 -10
- package/dist/client/dumbbell.js +10 -10
- package/dist/client/flowMap.js +28 -0
- package/dist/client/funnel.js +10 -10
- package/dist/client/gauge.js +10 -10
- package/dist/client/geo-kr-sido.js +1 -0
- package/dist/client/geo-us-states.js +1 -0
- package/dist/client/geo-world.js +1 -0
- package/dist/client/heatmap.js +10 -10
- package/dist/client/histogram.js +10 -10
- package/dist/client/line.js +10 -10
- package/dist/client/lollipop.js +10 -10
- package/dist/client/marimekko.js +10 -10
- package/dist/client/network.js +28 -0
- 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 +10 -10
- package/dist/client/sunburst.js +10 -10
- package/dist/client/symbolMap.js +28 -0
- package/dist/client/tileMap.js +28 -0
- package/dist/client/timeline.js +28 -0
- package/dist/client/tree.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 ca=Object.create;var Ar=Object.defineProperty;var ua=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var da=Object.getPrototypeOf,fa=Object.prototype.hasOwnProperty;var xn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ha=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ma(t))!fa.call(e,o)&&o!==n&&Ar(e,o,{get:()=>t[o],enumerable:!(r=ua(t,o))||r.enumerable});return e};var R=(e,t,n)=>(n=e!=null?ca(da(e)):{},ha(t||!e||!e.__esModule?Ar(n,"default",{value:e,enumerable:!0}):n,e));var q=xn((Yl,Nr)=>{Nr.exports=globalThis.__ztdReact.react});var Rr=xn((ql,Fr)=>{Fr.exports=globalThis.__ztdReact["react-dom/client"]});var G=xn((uc,io)=>{io.exports=globalThis.__ztdReact["react/jsx-runtime"]});var cr=R(q(),1),Wi=R(Rr(),1);var Ct=R(q(),1);var Wt=R(q(),1);var _r=R(q(),1),nt=(0,_r.createContext)(void 0);var Er=R(q(),1);var ga=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Pr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Dr='"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:Pr,monoFamily:Dr,radius:18,radiusCode:14,radiusMark:4},kn={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:Pr,monoFamily:Dr,radius:18,radiusCode:14,radiusMark:4},wn={dark:De,light:kn};function Pt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function vn(e){let t={};for(let n of ga){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 $n(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 pa=`
|
|
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 Or(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 Ir(e,t){let[n]=(0,Er.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Lr=!1;function bt(){if(Lr||typeof document>"u"||(Lr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=pa,document.head.appendChild(e)}var Dt=R(q(),1),ye=typeof window<"u"&&typeof document<"u",Te=ye?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 Ce(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var zr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Br={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ba=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ya={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function xa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ka(e){return xa(ba,e)}function Hr(e,t){let n=ka(e);return{text:n?n[t]:e,...ya[n?.id??"basic"]}}var jr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function rt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),jr[t.toLowerCase()]&&(t=jr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function Vr(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function Tn(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 ot(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Gr(e){return .2126*ot(e[0])+.7152*ot(e[1])+.0722*ot(e[2])}function Cn(e,t,n){let r=typeof e=="string"?rt(e):e,o=typeof t=="string"?rt(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?rt(n):n:null;o[3]<1&&i&&(o=Tn(o,i));let a=r[3]<1?Tn(r,o):r,s=Gr(a),l=Gr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function wa(e){return[ot(e[0]),ot(e[1]),ot(e[2])]}function Mn(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 Wr(e){let[t,n,r]=wa(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function va([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[Mn(4.0767416621*o-3.3077115913*i+.2309699292*a),Mn(-1.2684380046*o+2.6097574011*i-.3413193965*a),Mn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Et(e,t,n){let r=rt(e),o=rt(t);if(!r||!o)return e;let i=Wr(r),a=Wr(o),s=Math.max(0,Math.min(1,n));return Vr(va([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Sn(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Cn(i,e,n);a>o&&(o=a,r=i)}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 $a(e,t){let n=Sn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Cn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Sn(t,["#FFFFFF","#000000"])}function Ot(e,t){let n=Et(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:$a(e,n),raw:n}}function xe(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=ne(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=ne(e,"neutral");else if(s===0)r[a]=ne(e,"ink");else if(s===i-1)r[a]=ne(e,"neutral");else if(i===3)r[a]=ne(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?ne(e,"strong"):Ot(e,1-l)}}),r}var An="mix:";function Le(e){return e({theme:kn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${An}${o}`}).map(n=>n.fill)}function Kr(e,t){return t?.startsWith(An)?e.mix("neutralStrong","neutral",Number(t.slice(An.length))):e.color(t)}function yt(e,t,n){return xe(e,t+1,n).slice(0,t)}function Ur(e,t,n,r="neutral"){let o=ne(e,"accent"),i=ne(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Xr(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=ne(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=ne(e,"neutral"):s===0?r[a]=ne(e,"strong"):s===i-1?r[a]=ne(e,"neutral"):r[a]=Ot(e,1-s/(i-1))}),r}var ke=R(q(),1);var It=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ae="en-US",Yr=new Map;function Nn(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=Yr.get(r);return o||(o=new Intl.NumberFormat(e,n),Yr.set(r,o)),o}function Fn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function at(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ae,...r}=t;return Fn(Nn(n,r).format(e))}var Rn=e=>e!==0&&Math.abs(e)<.05,_n=(e,t,n="")=>`${at(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function it(e,t={}){if(!Number.isFinite(e))return"-";if(Rn(e)&&t.maximumFractionDigits===void 0)return _n(e,t.locale??ae,"%");let n=Math.abs(e);return`${at(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Qr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ae,...r}=t;if(Z(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+at(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Fn(Nn(n,{notation:"compact",...r}).format(e))}var Ma=(e,t=Z(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function We(e,t=ae,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=Nn(t,o);return l=>Number.isFinite(l)?`${a}${Fn(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>it(o,{locale:t});case"ratio":return o=>it(o*100,{locale:t});case"compact":return o=>Qr(o,{locale:t});case"currency":return r(Ma(t));default:{let o=r({maximumFractionDigits:1});return i=>Rn(i)?_n(i,t):o(i)}}}function xt(e,t=ae,n=0){return e!==void 0?We(e,t):n>=1e5?r=>Rn(r)?_n(r,t):Qr(r,{locale:t}):r=>at(r,{locale:t})}function Ta(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Pn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Ca=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Sa=["january","february","march","april","may","june","july","august","september","october","november","december"],qr=e=>{let t=e.toLowerCase();return t.length<3?0:Sa.findIndex(n=>n.startsWith(t))+1},Jr=e=>+e+(+e<30?2e3:1900);function eo(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Aa=[/^(\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})일)?$/],to=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,no=/\{([^{}]+)\}/g;function zt(e,t){let n;for(let r of Aa)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?[Jr(n[3]),+n[2],+n[1],1]:[Jr(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=to.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=qr(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=qr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var ro=e=>Ca.test(e)||zt(e)!==null;function oo(e){let t;for(let n of e){let r=typeof n=="string"?to.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(Pn(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=zt(n,t);if(r)return Ta(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 Zr=new Map;function kt(e,t={month:"short",day:"numeric"}){let n=Bt(e);if(!n)return"-";let{locale:r=ae,...o}=t,i=r+JSON.stringify(o),a=Zr.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Zr.set(i,a)),a.format(n)}var Dn=R(G(),1),Ht=(0,ke.createContext)({theme:De,cssVars:!0});function Na(e,t=De){return e?typeof e=="string"?wn[e]??t:$n(t,e):t}function jt(e){let t=(0,ke.useContext)(Ht),n=e.base?wn[e.base]:t.theme,r=(0,ke.useMemo)(()=>Na(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,ke.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,ke.useMemo)(()=>vn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Dn.jsx)(Ht.Provider,{value:a,children:(0,Dn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Fa=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function ao(e){return Fa.has(e)}function Ra(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?ao(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?ao(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:Et(e[r],e[o],i)}}}function we(e){let t=(0,ke.useContext)(Ht);return(0,ke.useMemo)(()=>{let n=$n(t.theme,e);return Ra(n,t.cssVars)},[t.theme,t.cssVars,e])}function se(e){let t=(0,ke.useContext)(Ht);return e??t.locale??ae}function so(e){return e?vn(e):{}}var Gt=R(q(),1),Ln=(0,Gt.createContext)(void 0);function lo(e){let t=(0,Gt.useContext)(Ln);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=R(G(),1),_a={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`},Pa={en:_a,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Da={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},En=e=>Pa[Z(se(e))];function On(e){let t=we(e.theme),n=En(e.locale),[r,o]=(0,Wt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,_.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let f=!s.has(m.label),p=f&&l===1,d=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(La,{p:t,item:m,off:!f}),(0,_.jsx)("span",{style:f?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,_.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,_.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":f,"aria-disabled":p||void 0,onClick:()=>{p||(a(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 a?(0,_.jsxs)(_.Fragment,{children:[c,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Da,children:r?n.shown(l,e.items.length):""})]}):c}function La({p:e,item:t,off:n}){let r=Kr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,_.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,_.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,_.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,_.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function Ea(e){let t=we(e.theme),n=Hr(e.level,Z(se(e.locale)));return(0,_.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function Oa(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,_.jsxs)(_.Fragment,{children:[e.slice(0,r),(0,_.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function co(e){let t=we(e.theme),n=En(e.locale),[r,o]=(0,Wt.useState)(0);Te(()=>bt(),[]);let i=()=>{o(f=>f+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)(On,{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,_.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,_.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,_.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,_.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,_.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,_.jsx)(Ea,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,_.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,_.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,_.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,_.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:Oa(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,_.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,_.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,_.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,_.jsx)("span",{}),a]}):null]}),(0,_.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,_.jsx)(Ln.Provider,{value:r,children:(0,_.jsx)(nt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,_.jsxs)(_.Fragment,{children:[m,u]}):u]})}function In(e){let t=we(e.theme),n=En(e.locale),r=e.height??220;if(Te(()=>bt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,_.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,_.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,_.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,_.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,_.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,_.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,_.jsx)(_.Fragment,{children:e.children})}var ut=R(q(),1);var le=R(q(),1);var W=R(G(),1),Vt=60;var Kt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function uo(e){let{c:t,events:n}=e,r=(0,le.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Te(()=>{bt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,le.useContext)(nt),c=e.ariaLabel??l??e.kind,m=(0,le.useMemo)(()=>s?`${n.length}${n.slice(0,Vt).map(w=>`${w.label}${w.series??""}${w.formatted??w.value??""}`).join("")}`:"",[n,s]),u=(0,le.useMemo)(()=>(0,W.jsx)(Ia,{label:c,events:n,t:t.t}),[c,m,t.t]),f=(0,le.useRef)(null);(0,le.useEffect)(()=>{let w=()=>{f.current=null};return window.addEventListener("scroll",w,{capture:!0,passive:!0}),window.addEventListener("resize",w,{passive:!0}),()=>{window.removeEventListener("scroll",w,{capture:!0}),window.removeEventListener("resize",w)}},[]),(0,le.useEffect)(()=>{f.current=null},[t.width,t.height]);let p=w=>{if(w.target!==w.currentTarget)return;if(e.onKey?.(w)){w.preventDefault();return}let F=t.active,E;switch(w.key){case"ArrowRight":case"ArrowDown":E=F===null?0:(F+1)%a;break;case"ArrowLeft":case"ArrowUp":E=F===null?a-1:(F-1+a)%a;break;case"Home":E=0;break;case"End":E=a-1;break;case"Escape":if(F===null)return;E=null;break;case"Enter":case" ":F!==null&&(w.preventDefault(),t.click(F));return;default:return}w.preventDefault(),t.setActive(E,"keyboard")},{via:d,node:g,setActive:k}=t;(0,le.useEffect)(()=>{if(d!=="touch"||!g)return;let w=F=>{g.contains(F.target)||k(null)};return document.addEventListener("pointerdown",w),()=>document.removeEventListener("pointerdown",w)},[d,g,k]);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,A=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}/${a})`:""),S;if(v){let w=v.x*T,F=t.width*T,E=`clamp(${(4-w).toFixed(1)}px, -50%, calc(${(F-w-4).toFixed(1)}px - 100%))`,j=v.y<64;S={position:"absolute",left:w,top:v.y*T,transform:`translate(${E}, ${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 B=w=>{f.current=null,w.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},H=w=>w?F=>{let E=f.current??(f.current=F.currentTarget.getBoundingClientRect());E.width&&w((F.clientX-E.left)/E.width*t.width,(F.clientY-E.top)/E.height*t.height,F)}:void 0,L=H(e.onPointerMove),D=H(e.onPointerDown),N=L||D?w=>{w.pointerType==="touch"&&L?.(w),D?.(w)}:void 0,C=H(e.onPointerUp),$=so(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":i,tabIndex:s?0:void 0,onKeyDown:s?p:void 0,onBlur:w=>{t.via==="keyboard"&&!w.currentTarget.contains(w.relatedTarget)&&t.setActive(null)},onPointerLeave:B,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} ${i}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:L,onPointerDown:N,onPointerUp:C,onPointerCancel:C,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:i,children:a||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:S,children:A??(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((w,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(w.strong?"ink":"muted")},children:[w.color?(0,W.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:w.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,w.label]}),(0,W.jsx)("span",{style:{fontWeight:w.strong===!1?500:700},children:w.value})]},F))]})}):null,(0,W.jsx)("span",{className:"ztd-sr",style:Kt,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?u:null]})}function Ia({label:e,events:t,t:n}){return(0,W.jsx)("div",{className:"ztd-sr",style:Kt,children:(0,W.jsxs)("table",{children:[(0,W.jsx)("caption",{children:n.table(e)}),(0,W.jsxs)("tbody",{children:[t.slice(0,Vt).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>Vt?(0,W.jsx)("tr",{children:(0,W.jsx)("td",{colSpan:2,children:n.more(t.length-Vt)})}):null]})]})})}function Ee(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 y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),fe=y("label","string",!0,"Item name field"),oe=y("value","number",!0,"Value field"),za=[fe,oe],Ba=[fe,oe],Ha=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],ja=[fe,oe],Ga=[y("label","string",!0,"Leaf (lowest level) name"),oe,y("group","string",!1,"Parent group field")],Wa=[y("label","string",!0,"Leaf name"),oe,y("group","string",!1,"Parent group field")],Va=[fe,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],Ka=[fe,oe],Ua=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),oe],Xa=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),oe],Ya=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],qa=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],fo=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Ja=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),fo],Za=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),fo],Qa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],es=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],ts=[fe,oe],ns=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],rs=[fe,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],os=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],is=[fe,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],as=[fe,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],ss=[fe,oe],ls=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],cs=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],us=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),oe],ms=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),oe],ds=[y("date","date",!0,"Date field"),oe],fs=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],hs=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],gs=[y("label","string",!1,"Row name field")],ps=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],bs=[fe,oe],ys=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],xs=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],ks=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),oe],ws=[fe,oe,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],vs=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],$s=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Ms=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Ts=[y("region","string",!0,"Region name or code, matched to a region of options.map"),oe],Cs=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],Ss=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],As=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],mo={pie:za,donut:Ba,funnel:Ha,waffle:ja,treemap:Ga,sunburst:Wa,waterfall:Va,pareto:Ka,marimekko:Ua,heatmap:Xa,radar:Ya,bubble:qa,line:Ja,area:Za,stream:Qa,bar:es,radialBar:ts,gauge:ns,bullet:rs,sparkline:os,slope:is,dumbbell:as,lollipop:ss,beeswarm:ls,ridgeline:cs,sankey:us,chord:ms,calendar:ds,bump:fs,box:hs,parallel:gs,candlestick:ps,segmented:bs,skyline:ys,histogram:xs,scatter:As,tileMap:ks,barRace:ws,network:vs,timeline:$s,tree:Ms,choropleth:Ts,symbolMap:Cs,flowMap:Ss},st={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function ho(e,t){return t==="ko"?e.nameKo:e.name}function go(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var po=["line","area","bar","scatter"],bo=24,zn=["line","area","bar","scatter","timeline"];function Bn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function yo(e,t,n){return zn.includes(e)&&!Bn(e,t,n).length&&!(e==="scatter"&&Ut(n))}function Ut(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function xo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ns={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function Xt(e){let t=mo[e]?e:Ns[e]??Object.keys(st).find(n=>n.toLowerCase()===e.toLowerCase()||st[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!st[t]))return{type:t,component:st[t].component,name:st[t].name,nameKo:st[t].nameKo,encoding:mo[t]}}function ko(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of Xt(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function wt(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Fs(e,t){if(e==null||typeof e!="object")return;let n=e;if(wt(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!wt(r,o))return;r=r[o]}return r}}function he(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 Oe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Fs(r,n)}function Fe(e,t){let n=Oe(e,t);return(r,o)=>he(n(r,o))}function ge(e,t){let n=Oe(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function ve(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Rs(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
|
+
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var _s=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function wo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(_s.test(t)||/^[-+]?\.\d+$/.test(t)){let n=he(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 i=t.delimiter??Rs(o),a=[],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===i?(s.push(l),l=""):g===`
|
|
24
|
+
`||g==="\r"?(g==="\r"&&o[d+1]===`
|
|
25
|
+
`&&d++,s.push(l),a.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(d=>!(d.length===1&&d[0].trim()===""));if(!m.length)return[];let u=d=>n?wo(d):d;if(!r)return m.map(d=>Object.fromEntries(d.map((g,k)=>[String(k),u(g)])));let f=[],p=new Set;return m[0].forEach((d,g)=>{let k=d.trim()||`col${g+1}`,b=k;for(let v=2;p.has(b);v++)b=`${k}_${v}`;p.add(b),f.push(b)}),m.slice(1).map(d=>Object.fromEntries(f.map((g,k)=>[g,u(d[k]??"")])))}function Hn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?wo(a[l]):a[l]??null])))}function Ps(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function vo(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 Ie(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ie(JSON.parse(t))}catch{}return Ve(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Hn(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)?Ie(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Hn(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)?Ie(t.rows):Array.isArray(t.values)?Hn(t.values):Array.isArray(t.items)?Ie(t.items):Array.isArray(t.results)?Ie(t.results):Ps(t)}return[]}function Yt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function jn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let 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=a(f,c),d=p-a(f,c-1),g=0;for(let k=0;k<f;k++)g+=a(k,c)-a(k,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,i[p][l]=u):(o[p][l]=f,f+=g,i[p][l]=f)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let f=a(u,l);t==="expand"&&(f=c?f/c*100:0),o[u][l]=m,m+=f,i[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,i[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[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,i[u][f]-=m}return{y0:o,y1:i}}function $o(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 Mo(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]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Ds=Math.PI*2;function qt(e,t,n){return e<t?t:e>n?n:e}function To(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function M(e){return Math.round(e*100)/100}function Jt(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let i=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,a=Math.min(n,r)/2,s=qt(i.tl??0,0,a),l=qt(i.tr??0,0,a),c=qt(i.br??0,0,a),m=qt(i.bl??0,0,a);return`M${M(e+s)},${M(t)}H${M(e+n-l)}`+(l?`A${M(l)},${M(l)} 0 0 1 ${M(e+n)},${M(t+l)}`:"")+`V${M(t+r-c)}`+(c?`A${M(c)},${M(c)} 0 0 1 ${M(e+n-c)},${M(t+r)}`:"")+`H${M(e+m)}`+(m?`A${M(m)},${M(m)} 0 0 1 ${M(e)},${M(t+r-m)}`:"")+`V${M(t+s)}`+(s?`A${M(s)},${M(s)} 0 0 1 ${M(e+s)},${M(t)}`:"")+"Z"}function Ls(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${M(l[0])},${M(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${M(l[0])},${M(l[1])}`).join("");let o=[],i=[];for(let l=0;l<n-1;l++){let c=e[l+1][0]-e[l][0];o.push(c),i.push(c===0?0:(e[l+1][1]-e[l][1])/c)}let a=[i[0]];for(let l=1;l<n-1;l++)if(i[l-1]*i[l]<=0)a.push(0);else{let c=2*o[l]+o[l-1],m=o[l]+2*o[l-1];a.push((c+m)/(c/i[l-1]+m/i[l]))}a.push(i[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let c=o[l]/3;s+=`C${M(e[l][0]+c)},${M(e[l][1]+a[l]*c)} ${M(e[l+1][0]-c)},${M(e[l+1][1]-a[l+1]*c)} ${M(e[l+1][0])},${M(e[l+1][1])}`}return s}function Co(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return Ls(e);if(t==="step"){let n=`M${M(e[0][0])},${M(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${M(o)}V${M(e[r][1])}H${M(e[r][0])}`}return n}return Es(e)}function Es(e){if(!e.length)return"";let t=`M${M(e[0][0])},${M(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${M(e[n][0])},${M(e[n][1])}`;return t}function Ke(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 So(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function No(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Ao(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var Zt=new Map;function $e(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=Zt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);No(c)?a+=Ao(c):s+=Ao(c)}i=a+s*(n>=600?1.07:1),Zt.size>5e3&&Zt.clear(),Zt.set(o,i)}return i*t}function Gn(e,t,n,r=400){if(e=e.trim(),$e(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;$e(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(No(s.charCodeAt(0))?2:3)?"":s+o}var Ro=R(G(),1),Os=e=>Array.isArray(e)&&e.length===2;function Fo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Os(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var lt=R(G(),1),Ue=10.5;function _o(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>at(a,{locale:n,maximumFractionDigits:i}))}function Qt(e,t,n){let r=18;for(let o of _o(e,t,n))r=Math.max(r,$e(o,Ue));return Math.ceil(r+8)}function Po(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:_o(n,a,e.locale);return(0,lt.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,lt.jsxs)("g",{children:[(0,lt.jsx)("line",{x1:o,x2:i,y1:u,y2:u,stroke:t.paint(f?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:f?.7:1}),l?(0,lt.jsx)(Ee,{x:s?i+6:o-6,y:u,anchor:s?"start":"end",size:Ue,fill:t.paint("muted"),children:l[m]}):null]},c)})})}function Do(e,t,n){let r=[],o=-1/0;for(let i of e){let a=$e(i.label,Ue),s=Math.max(i.x-a/2,0);s<o+8||i.x-a/2<t||i.x+a/2>n||(r.push(i),o=s+a)}return r}function Wn(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 ze(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=Wn(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,f=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-f<=l*.3?f:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let p=Wn(c[1]-c[0],n);if(p===l)break;l=p}return c}function en(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Wn(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Xe(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>en(n,r,l),s}function Vn(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[i,a]=ze(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function Is(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(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=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:en(e,t,3)}function Lo(e,t){let n=Xe([Math.log10(e[0]),Math.log10(e[1])],t),r=(o=>o>0?n(Math.log10(o)):Number.NaN);return r.domain=e,r.range=t,r.invert=o=>10**n.invert(o),r.ticks=()=>Is(e[0],e[1],Math.abs(t[1]-t[0])),r}function Ye(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 zs=864e5;function Eo(e,t,n,r=ae){let o=t-e;if(!(o>0))return[{t:e,label:kt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/zs,a=[],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,k=0;for(;d.getTime()<=t&&k++<500;){if(d.getTime()>=e){let b=d.getFullYear(),v=p&&!l&&b!==g;a.push({t:d.getTime(),label:kt(d,{locale:r,...f,...v?{year:"numeric"}:{}})}),g=b}u(d)}};if(i<=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(i<=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(i<=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=i/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 a}function Oo(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var Bs=(e,t,n)=>e==="date"?Bt(t,n)?.getTime()??NaN:he(t);function Hs(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&ro(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function vt(e,t,n,r,o={}){let i=Oe(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Oe(n,"y"),c=!a&&r!==void 0?Oe(r,"series"):null,m=e.map(($,w)=>i($,w)),u=o.xType??Hs(m),f=o.locale??ae,p,d,g;if(u==="band"){let $=m.map(F=>String(F??""));p=ve($);let w=new Map(p.map((F,E)=>[F,E]));d=p.map((F,E)=>E),g=Int32Array.from($,F=>w.get(F)??-1)}else{let $=u==="date"?o.dayFirst??oo(m):void 0,w=m.map(j=>Bs(u,j,$)),F=Array.from(new Set(w.filter(j=>Number.isFinite(j)))).sort((j,ie)=>j-ie),E=new Map(F.map((j,ie)=>[j,ie]));d=F,p=F.map(String),g=Int32Array.from(w,j=>E.get(j)??-1)}let k=o.dateFormat,b=$=>typeof $=="string"?zt($.trim())?.[3]:void 0,v=u==="date"&&m.length<5e3?b(m[0]):void 0,T=(v===2||v===3)&&m.every($=>b($)===v),A=T&&v===3;if(u==="date"&&!k){let $=d.length>1?d[d.length-1]-d[0]:0;k=T&&v===2||$>864e5*120?{month:"short"}:$<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},$>864e5*800&&(k={year:"numeric",month:"short"})}let x;if(u==="band")x=p;else if(A&&!o.dateFormat){let $=Z(f)==="ko";x=d.map(w=>{let F=new Date(w),E=Math.floor(F.getMonth()/3)+1;return $?`${F.getFullYear()}년 ${E}분기`:`Q${E} ${F.getFullYear()}`})}else{let $=d.every(Pn),w=u==="date"?new Intl.DateTimeFormat(f,k):new Intl.NumberFormat(f,$?{useGrouping:!1}:{maximumFractionDigits:6});x=d.length>1e3?Oo(d.length,F=>w.format(d[F])):d.map(F=>w.format(F))}let S=s?[...s]:c?ve(e.map(($,w)=>String(c($,w)??""))):[""],B=new Map(S.map(($,w)=>[$,w])),H=S.map(()=>new Array(p.length).fill(NaN)),L=S.map(()=>new Array(p.length).fill(null)),D=o.aggregate??"sum",N=D==="mean"?S.map(()=>new Uint32Array(p.length)):null,C=($,w,F,E)=>{let j=H[$][w];D==="last"?H[$][w]=F:D==="count"?H[$][w]=(Number.isFinite(j)?j:0)+1:D==="mean"?Number.isFinite(F)&&(H[$][w]=(Number.isFinite(j)?j:0)+F,N[$][w]++):H[$][w]=Number.isFinite(j)?j+(Number.isFinite(F)?F:0):F,L[$][w]=E};for(let $=0;$<e.length;$++){let w=g[$];if(w<0)continue;let F=e[$];if(s)for(let E=0;E<s.length;E++)C(E,w,he(F[s[E]]),F);else{let E=c?B.get(String(c(F,$)??""))??0:0;C(E,w,he(l(F,$)),F)}}if(N)for(let $=0;$<H.length;$++)for(let w=0;w<p.length;w++)N[$][w]>1&&(H[$][w]/=N[$][w]);return{type:u,keys:p,xnum:d,labels:x,series:S,values:H,rows:L}}var js=140,Mt=12,Io=14,Kn=20,zo=12.5;function Gs(e,t,n=bo){let r=ge(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function Ws(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Mt)/(js+Mt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Vs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Mt)/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 $t=e=>e.filter(Number.isFinite);function tn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Fe(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return $t(n)}function Bo(e,t,n,r,o,i){return vt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Ks(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let x=t.flat(),S=r.refLines??{},[B,H]=Ye([...tn(x,r.x??"x"),...$t([Number(S.x)])]),[L,D]=Ye([...tn(x,r.y??"y"),...$t([Number(S.y)])].filter(C=>!s||C>0)),N=r.zero??!1;return{y:c??(s?Vn(L,D,a):ze(L,D,a,{zero:N,pad:.08})),x:r.xDomain??ze(B,H,Math.max(2,Math.round(o/110)),{zero:N,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?Ye(n.flatMap(x=>$t(x.xnum))):void 0),k=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(k==="percent")return{x:g,sameKeys:p};if(c)return{y:c,x:g,sameKeys:p};let b=[];t.forEach((x,S)=>{let B=n[S];if(k==="stacked"||k==="auto"&&B.series.length>1){let L=jn(B.values,"zero");L.y0.forEach(D=>b.push(...D)),L.y1.forEach(D=>b.push(...D))}else B.values.forEach(L=>b.push(...L));m&&!u&&r.line!==void 0&&Bo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(L=>b.push(...L)),m||b.push(...tn(x,r.lower),...tn(x,r.upper))}),m&&b.push(0),u||b.push(...Fo(r.annotations));for(let x of r.referenceLines??[])b.push(x.y);r.signColors&&b.push(Number(r.baseline??0));let[v,T]=Ye($t(b).filter(x=>!s||x>0));return{y:s?Vn(v,T,a):m?ze(v,T,u?Math.max(2,Math.round(o/120)):a):ze(v,T,a,{zero:r.zero??e==="area"}),x:g,sameKeys:p}}function Us(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=vt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?Lo:Xe)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=Qt(c,xt(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=i-(f?Math.min(i*.28,Math.max(...u.map(x=>$e(x,11,700)),20)+14):10),g=l.keys.length,[k,b]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?g>12:g>Eo(k,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]-k)/(b-k)*(d-p),A=x=>$e(l.labels[x],Ue);for(let x=1;;x++){let S=Array.from({length:Math.ceil(g/x)},(B,H)=>H*x);if(x>=g||S.every((B,H)=>!H||T(B)-T(S[H-1])>=(A(B)+A(S[H-1]))/2+8))return S.map(B=>({value:l.xnum[B],label:l.labels[B]}))}}function Xs(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 Ys(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${Xs(`${e}|${t}|${o}|${Yt(r)}`)}`}function qs(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 Js={en:{intro:(e,t)=>`${Ce(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},Un=18;function Ho(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Gs(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Ws(s,a,e.columns),{pw:c,ph:m}=Vs(s,l,e.height),u=e.scale!=="free",f=t==="scatter"?[]:o.map(N=>Bo(t,N,n,n.y,n.series,n.aggregate)),p=u?Ks(t,o,f,n,c,m):{sameKeys:!1},d=u?Us(t,o,f,n,p,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",k=u&&(!g||p.sameKeys),b=u&&(g||p.x!==void 0||p.sameKeys),v=new Set(qs(e.highlight,r)?[e.highlight].flat():[]),T=v.size>0,A=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??Ys(t,e.by,n,e.data),S=It(We(n.format,e.locale),n.unit),B=Js[e.lang],H=[],L=r.map(N=>N===""?B.blank:N);return{panels:r.map((N,C)=>{let $=o[C],w=L[C],F=C%l,E;if(t!=="scatter"){let ie=f[C],Se=ue=>ie.values.reduce((me,Je)=>me+(Number.isFinite(Je[ue])?Je[ue]:0),0),K=ie.keys.map((ue,me)=>me).filter(ue=>ie.values.some(me=>Number.isFinite(me[ue]))),re=K[K.length-1];H.push({first:K.length?Se(K[0]):NaN,last:K.length?Se(re):NaN,total:K.reduce((ue,me)=>ue+Se(me),0)}),t!=="bar"&&ie.series.length===1&&re!==void 0&&(E=S(ie.values[0][re]))}else H.push({first:NaN,last:NaN,total:$.length});let j={data:$,width:c,height:m,ariaLabel:e.title?`${e.title}, ${w}`:w,syncId:x,highlight:T?v.has(N)?A?()=>!0:void 0:"none":e.highlight,showYAxis:!k||F===0,showXAxis:!b||C+l>=a};return p.y&&(j.yDomain=p.y),p.x&&(j.xDomain=p.x),d&&(j.xTicks=d),{value:N,label:w,props:j,last:E,isPicked:v.has(N)}}),cols:l,pw:c,ph:m,isPanelPick:T,description:Zs(t,e.by,L,H,i,S,B)}}function Zs(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>So(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,f)=>r[f].last<r[f].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var ce=R(q(),1);function Qs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function el(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var nn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Wo(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(a=>{let s=el(a[a.length-1],nn.threshold,nn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Qs(nn.threshold),rootMargin:nn.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function jo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function rn(e){let[t,n]=(0,ce.useState)(null),[r,o]=(0,ce.useState)(e??null),i=(0,ce.useCallback)(a=>{n(a),a&&e===void 0&&o(jo(a))},[e]);return Te(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a(jo(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?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var tl=()=>()=>{};function ct(){return(0,ce.useSyncExternalStore)(tl,()=>!0,()=>!1)}var Go="(prefers-reduced-motion: reduce)";function on(e="auto"){let[t,n]=(0,ce.useState)(()=>ye&&typeof window.matchMedia=="function"?window.matchMedia(Go).matches:!1);return(0,ce.useEffect)(()=>{if(e!=="auto"||!ye||typeof window.matchMedia!="function")return;let r=window.matchMedia(Go),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=R(G(),1),nl=60,rl=420;function Vo(e){let t=we(),n=e.chartProps??{},[,r,o]=rn(e.width),i=e.width??(o||480),a=se(e.locale??n.locale),s=Z(a),l=(0,ut.useContext)(nt),c=e.title??l,m=e.chart.facetPlan,u=(0,ut.useMemo)(()=>{let b=Ho({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return m?m(b,n,a):b},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(b,v)=>typeof v=="function"?String(v):v),e.highlight,e.syncId,i,e.height,c,a,s,m]),f=`${(0,ut.useId)().replace(/:/g,"")}fd`,p=on(n.reducedMotion??"auto"),d=ct(),g=Ir({motion:{enabled:n.animate!==!1&&!p&&ye},hydrated:d},{waiting:!1,generation:0}),k=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":f,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:f,style:Kt,children:e.description??u.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Mt,rowGap:Io,...u.legend?{marginTop:Un}:null},children:u.panels.map((b,v)=>{let T=t.paint(b.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":b.value,style:{minWidth:0,...Or(g,!1,"fade",v*nl,rl)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Kn,fontSize:zo,fontWeight:700,lineHeight:`${Kn}px`,color:T},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.label}),b.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:b.last}):null]}),(0,Me.jsx)(k,{...n,...b.props})]},b.value)})}),u.legend?(0,Me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Un},children:u.legend}):null]})}var Ko=["max","min","first","last","none"];function pe(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let 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&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&i.add(u)});return i}var be=R(q(),1);async function ol(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(Z(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ve(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ve(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ve(i)}async function il(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await ol(i,t.parse,o,t.locale)}return t.select&&(r=vo(r,t.select)),t.transform?t.transform(r):Ie(r)}function Uo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,be.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,be.useState)(0),c=se(t.locale),m=(0,be.useRef)(t);m.current={...t,locale:c};let u=(0,be.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,be.useRef)(!1);(0,be.useEffect)(()=>{let b=u.current;if(!b||!r){a(A=>A.status==="loading"?{...A,status:"idle"}:A);return}let v=new AbortController,T=!0;return g.current=!0,a(A=>({...A,data:o?A.data:[],status:"loading",error:null})),il(b,{...m.current,signal:v.signal}).then(A=>{T&&a({data:A,status:"success",error:null,updatedAt:Date.now()})}).catch(A=>{!T||v.signal.aborted||a(x=>({...x,status:"error",error:A instanceof Error?A:new Error(String(A))}))}).finally(()=>{T&&(g.current=!1)}),()=>{T=!1,g.current=!1,v.abort()}},[f,r,s,d,o]),(0,be.useEffect)(()=>{if(!n||!r)return;let b=setInterval(()=>{g.current||l(v=>v+1)},n);return()=>clearInterval(b)},[n,r]);let k=(0,be.useCallback)(()=>l(b=>b+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:k}}var Yn=R(G(),1),al=["csv","svg","png"],sl=/^[=+\-@\t\r\n=+-@]/,ll=/var\(|color-mix\(/;function Xo(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?eo(e.getTime()):String(e);return`"${(sl.test(t)&&!Number.isFinite(he(t))?`'${t}`:t).replace(/"/g,'""')}"`}function cl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function ul(e,t){return`\uFEFF${[t.map(Xo),...e.map(r=>t.map(o=>Xo(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 ml(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Xn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Yo=2,Be=16;function qo(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Jo(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 Zo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+Be*2,a+Be*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((d,g)=>{let k;for(let b of Array.from(d.attributes)){if(!ll.test(b.value))continue;let v=(k??(k=getComputedStyle(d))).getPropertyValue(b.name);v&&m[g].setAttribute(b.name,qo(v,u))}}),c.removeAttribute("style");for(let[d,g]of Object.entries({viewBox:`${-Be} ${-Be} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(d,String(g));let f=qo(getComputedStyle(r).backgroundColor,u),p=o.parentElement?.querySelector("canvas")??null;if(n){let d=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Jo("rect",{x:-Be,y:-Be,width:s,height:l,fill:f}),d),p&&c.insertBefore(Jo("image",{href:p.toDataURL(),width:i,height:a}),d)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:f,canvas:p}}function dl(e,t){let n=Zo(e,Yo,!1);if(!n)return;let r=Yo,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,Be*r,Be*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Xn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Qo(e){let t=we(e.theme),n=Z(se(e.locale))==="ko",r=ml(e.filename),o=(i,a)=>{if(i==="csv")return Xn(new Blob([ul(e.data,e.columns?.length?e.columns:cl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return dl(a,r);let s=Zo(a,1,!0);s&&Xn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Yn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:al.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,Yn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:a},i)})})}var ti=R(G(),1);function ei(e,t=ae){let n=We(void 0,t),r=e.split(`
|
|
28
|
+
`),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?kt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(no,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,ti.jsx)("div",{children:s},l)):null}}var fl=e=>new Float64Array(e.map(he).filter(Number.isFinite)).sort(),hl=(e,t)=>t>=0&&t<=100?Ke(e,t/100):NaN;function ni(e,t){return hl(fl(e),t)}function qn(e){let t=/^p(\d+(?:\.\d+)?)$/.exec(e),n=t?Number(t[1]):NaN;return n>=0&&n<=100?n:NaN}function ai(e,t,n){let r=e.filter(d=>Number.isFinite(d)),o=r.length;if(!o)return t.map(()=>0);let i=r.reduce((d,g)=>d+g,0)/o,a=t.length>1?Math.abs(t[t.length-1]-t[0]):0,s=a>0?a/40:Math.abs(i)*.05||1,l=Math.sqrt(r.reduce((d,g)=>d+(g-i)**2,0)/o)||s,c=[...r].sort((d,g)=>d-g),m=Ke(c,.75)-Ke(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 A=0;for(let x=0;x<=512;x++){if(!v[x])continue;let S=(T-(g+x*b))/f;S>6||S<-6||(A+=v[x]*Math.exp(-.5*S*S))}return A*p})}return t.map(d=>{let g=0;for(let k of r){let b=(d-k)/f;b>6||b<-6||(g+=Math.exp(-.5*b*b))}return g*p})}var Zn=2;function si(e,t,n){return n!==void 0?!0:t!==void 0||!e?!1:["x0","x1","count"].every(r=>wt(e,r))&&!wt(e,"value")}var gl=50,pl=200,bl=[1,2,2.5,5,10],an=[[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]],He=e=>Number(e.toPrecision(12));function Jn(e,t=!1){let n=10**Math.floor(Math.log10(e)),r=bl.map(o=>He(o*n));return t?r.find(o=>o>=e*(1-1e-9))??He(10*n):r.reduce((o,i)=>Math.abs(Math.log(i/e))<Math.abs(Math.log(o/e))?i:o)}function ri(e,t,n){let r=Math.floor(e/n+1e-9)*n,o=Math.max(1,Math.ceil((t-r)/n-1e-9)),i=Array.from({length:o+1},(a,s)=>He(r+s*n));return i[0]>e&&i.unshift(He(i[0]-n)),i[i.length-1]<t&&i.push(He(i[i.length-1]+n)),i}function Qn(e,t,n,r=0){let o=[];for(let i=Math.floor(Math.log10(e))-r;i<=Math.ceil(Math.log10(t))+r;i++)for(let a of n)o.push(He(a*10**i));return o}function oi(e,t,n){let r=Qn(e,t,n,1),o=r.length-1;for(;o>0&&r[o]>e*(1+1e-9);)o--;let i=o+1;for(;i<r.length-1&&r[i]<t*(1-1e-9);)i++;return r.slice(o,i+1)}function ii(e){let t=e.length,n=Ke(e,.75)-Ke(e,.25);return t>=30&&n>0?2*n/Math.cbrt(t):(e[t-1]-e[0])/(Math.ceil(Math.log2(t))+1)}function yl(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 li(e,t={}){let n=t.log===!0,r=t.edges?yl(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 i=o[0],a=o[o.length-1],s=t.binWidth!==void 0&&t.binWidth>0&&!n?t.binWidth:void 0;if(i===a){if(n)return[He(i/2),He(i*2)];let f=s??1;return[i-f/2,i+f/2]}let l=t.bins!==void 0&&t.bins>=1?Math.round(t.bins):void 0,c=s!==void 0||l!==void 0?pl:gl;if(n){let f=l!==void 0?Math.log10(a/i)/l:ii(o.map(Math.log10)),p=k=>Math.abs(Math.log(1/k.length/f)),d=an.reduce((k,b,v)=>p(b)<p(an[k])?v:k,0),g=oi(i,a,an[d]);for(;g.length-1>c&&d>0;)g=oi(i,a,an[--d]);return g}let m=s??Jn(l!==void 0?(a-i)/l:ii(o));(a-i)/m>c&&(m=Jn((a-i)/c,!0));let u=ri(i,a,m);for(;u.length-1>c;)u=ri(i,a,m=Jn(m*1.01,!0));return u}function er(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 i=r+o>>1;e[i]<=t?r=i:o=i}return r}function ci(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 i=er(t,o);i<0?r++:n[i]++}return{counts:n,outside:r}}function ui(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 mi(e,t,n=!1){let r=ge(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=ve(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function di(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Ve(t.csv)}return null}var xi=R(q(),1);var ee=R(q(),1);function fi(e,t){let n=we(e.theme),[r,o,i]=rn(e.width),a=ct(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=on(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,f=Wo(r,e.animateOnView!==!1&&u),p=se(e.locale),d=Z(p),g=(0,ee.useMemo)(()=>We(e.format,p,t.format),[e.format,p,t.format]),k=(0,ee.useCallback)(K=>it(K,{locale:p}),[p]),b=(0,ee.useMemo)(()=>It(g,e.unit),[g,e.unit]),v=(0,ee.useMemo)(()=>Yt(e.data),[e.data]),[T,A]=(0,ee.useState)(null),[x,S]=(0,ee.useState)(null),B=(0,ee.useRef)([]),H=(0,ee.useRef)(e.onHover);H.current=e.onHover;let L=(0,ee.useRef)(e.onClick);L.current=e.onClick;let D=(0,ee.useRef)(null),N=(0,ee.useRef)(null),C=(0,ee.useRef)(null),$=(0,ee.useCallback)((K,re="pointer")=>{if(C.current!==K){C.current=K;let ue=K===null?null:B.current[K]??null;queueMicrotask(()=>H.current?.(ue)),N.current?.(K)}D.current=K===null?null:re,A(K),S(D.current)},[]),w=(0,ee.useCallback)(K=>{D.current!=="keyboard"&&(D.current=K===null?null:"sync",A(K),S(D.current))},[]),F=(0,ee.useCallback)(K=>{let re=B.current[K];re&&L.current?.(re)},[]),E=lo(e.replayKey),j=e.width!==void 0||(i??0)>0,ie={enabled:u,active:f.visible&&j,near:f.near,replayKey:E,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Se=(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:ye&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:ie,fv:b,fmt:g,pct:k,locale:p,lang:d,t:d==="ko"?Br:zr,active:T,via:x,setActive:$,click:F,events:B,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Se,sig:v,description:e.description,reduced:m,publish:N,applySync:w}}var Q=R(q(),1);function xl(e){return 1-Math.pow(1-e,3)}function kl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function wl(e){return e==="easeInOut"?kl:e==="linear"?t=>t:xl}function vl(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 mt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function sn(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 hi(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 gi(e,t,n,r){if(!t||!n||t.length!==n.length)return mt(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of mt(s,n[a]))o.push(l)}return o.length===r?o:mt(e,r)}var ln=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||!sn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),hi(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=sn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=gi(s.cur,s.parts,a.parts,c),s.vel=gi(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),hi(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=sn(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=sn(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=mt(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=wl(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=mt(s.from,c)),s.vel.length!==c&&(s.vel=mt(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(-i*l),f=i*l>=8&&i*l<20,p=0;for(let d=0;d<c;d++){let g=s.from[d]-s.to[d],k=s.vel[d]+i*g;s.cur[d]=s.to[d]+(g+k*l)*u,s.curVel[d]=(s.vel[d]-i*k*l)*u,f&&p<.15&&(p=Math.max(p,Math.abs(s.cur[d]-s.to[d]),Math.abs(s.curVel[d]/i)))}m=i*l>=20||f&&p<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),f=r(u),p=vl(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&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Tt=new Set,cn=0;function pi(e){cn=0;let t=Array.from(Tt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Tt.delete(n)}Tt.size&&typeof requestAnimationFrame<"u"&&(cn=requestAnimationFrame(pi))}function bi(e){return Tt.add(e),!cn&&typeof requestAnimationFrame<"u"&&(cn=requestAnimationFrame(pi)),()=>{Tt.delete(e)}}function $l(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 yi(e,t){let n=(0,Q.useMemo)(()=>$l(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,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)(a),k=(0,Q.useRef)(!1),b=(0,Q.useRef)(0),[,v]=(0,Q.useState)(0),T=(0,Q.useRef)(null),A=(0,Q.useRef)(!0);u.current||(u.current=new ln,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 N=f.current,C=!Object.is(d.current,s);x.sameTargets(n)?x.refreshData(n):!r||N==="init"?x.snap(n):N==="idle"?x.hold(n):N==="running"||C?x.update(n,Lt(),m):x.snap(n),p.current=n,d.current=s}let S=(0,Q.useRef)(()=>!1);S.current=N=>{if(!A.current)return!1;let C=x.step(N);return!C&&f.current==="running"&&(f.current="done"),v($=>($+1)%1e9),C||(T.current=null),C};let B=(0,Q.useCallback)(()=>{if(!ye||T.current||!x.animating)return;let N=C=>S.current(C);T.current=bi(N)},[x]);Te(()=>{let N=!Object.is(g.current,a);if(g.current=a,!r){(f.current!=="done"||x.animating)&&(x.snap(p.current??n),f.current="done",v(C=>C+1));return}f.current==="init"||N&&i?(x.hold(p.current??n),f.current="idle",k.current=!1,v(C=>C+1)):N&&(k.current=!0)},[r,a]),Te(()=>{!r||!i||!k.current||(k.current=!1,x.hold(p.current??n),f.current="idle",v(N=>N+1))},[i,r]),(0,Q.useEffect)(()=>{r&&o&&f.current==="idle"&&(x.start(Lt()),b.current+=1,f.current="running",B(),v(N=>N+1))},[r,o,a,x,B]),(0,Q.useEffect)(()=>{x.animating&&B()}),(0,Q.useEffect)(()=>(A.current=!0,()=>{A.current=!1,T.current?.(),T.current=null}),[]);let H=Lt(),L=x.elapsed(H),D=r&&f.current==="idle";return{items:x.items(),get:N=>x.get(N),elapsed:D?0:L,fade:(N,C=320)=>D?0:Number.isFinite(L)?Math.max(0,Math.min(1,(L-N)/C)):1,waiting:D,animating:x.animating,generation:b.current}}var tr=R(G(),1);function ki(e,t,n,r,o){if(r)return o==="categorical"?xe(e,t,n):Xr(e,t,n);if(o==="categorical")return xe(e,t,n);let i=ne(e,"strong"),a=ne(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Ml=R(q(),1);var nr=R(G(),1);var wi=e=>e?"neutralStrong":"accent";var rr=R(G(),1);function vi(e,t,n,r){if(typeof e!="function")return pe(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var Tl=R(q(),1);var ir=R(G(),1),Cl={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ce(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},$i={en:Cl,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},or=["ink","muted","dim"];function Mi(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,or.length)}var qe=R(q(),1);var z=R(G(),1),Sl={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=>Ce(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 = ${Ce(e,"sample")}`,groups:e=>Ce(e,"group"),hidden:(e,t)=>`Only the first ${e} of ${t} groups are drawn`},Al={en:Sl,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}개만 그려요`}},ar=e=>e,Nl=["p50","p95"],Ai=10,un=15,mn=16,Ti=96,Fl=e=>e==="p50"?void 0:e==="p99"?"1.5 2.5":"4 3";function Rl(e,t,n,r,o){let i=Fe(t,"value"),a=n?ge(n,"group"):()=>"",s=new Map,l=[];e.forEach((d,g)=>{let k=i(d,g);if(!Number.isFinite(k))return;let b=a(d,g),v=s.get(b);v||s.set(b,v={values:[],excluded:0}),o.log&&k<=0?v.excluded++:(v.values.push(k),r?.(d,g)&&l.push({g:b,v:k}))});let c=[...s.keys()].slice(0,Zn),m=c.length?li(c.flatMap(d=>s.get(d).values),o):[],u=c.map(d=>ci(s.get(d).values,m)),f=m.slice(1).map((d,g)=>({i:g,x0:m[g],x1:d,counts:u.map(k=>k.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=>er(m,d.v)).filter(d=>d>=0)),fnGroup:l.map(d=>c.indexOf(d.g)).find(d=>d>=0)??-1}}function _l(e,t,n,r){let o=Fe(t.x0,"x0"),i=Fe(t.x1,"x1"),a=Fe(t.count,"count"),s=t.group?ge(t.group,"group"):()=>"",l=new Map,c=new Map;e.forEach((g,k)=>{let b=o(g,k),v=i(g,k),T=a(g,k);if(!(Number.isFinite(b)&&Number.isFinite(v)&&v>b&&Number.isFinite(T)&&T>=0))return;let A=s(g,k);if(l.set(A,l.get(A)??0),r&&b<=0){l.set(A,l.get(A)+T);return}let x=`${b}|${v}`,S=c.get(x);S||c.set(x,S={x0:b,x1:v,by:new Map,picked:new Set}),S.by.set(A,(S.by.get(A)??0)+T),n?.(g,k)&&S.picked.add(A)});let m=[...l.keys()].slice(0,Zn),u=[],f=new Set;for(let g of[...c.values()].sort((k,b)=>k.x0-b.x0||k.x1-b.x1)){let k=u[u.length-1];k&&g.x0>k.x1&&u.push({i:u.length,x0:k.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,k)=>({name:g,n:u.reduce((b,v)=>b+v.counts[k],0),values:[],outside:0,excluded:l.get(g)})),d=m.findIndex(g=>[...c.values()].some(k=>k.picked.has(g)));return{bins:u,samples:p,groupCount:l.size,binned:!0,fnBins:f,fnGroup:d}}function Ci(e,t,n,r){let o=e.samples[t];if(!e.binned)return ni(o.values,n);let i=n/100*o.n,a=0;for(let s of e.bins){let l=s.counts[t];if(l>0&&a+l>=i){let c=(i-a)/l;return r?10**(Math.log10(s.x0)+c*(Math.log10(s.x1)-Math.log10(s.x0))):s.x0+c*(s.x1-s.x0)}a+=l}return NaN}function sr(e,t,n){let r=n?Math.log10:ar;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 Pl(e,t,n,r){let o=n.side!=="below",i=e.samples[t];if(!e.binned)return{n:i.values.filter(l=>o?l>n.value:l<n.value).length,est:!1};let a=0,s=!1;for(let l of e.bins){let c=sr(l,n,r);a+=l.counts[t]*c,c>0&&c<1&&l.counts[t]>0&&(s=!0)}return{n:Math.round(a),est:s}}function Si(e,t,n,r=-1/0,o=1/0){let i=t.length,a=l=>Math.min(e[l+1],o)>Math.max(e[l],r),s="";for(let l=0;l<i;l++){if(!a(l))continue;let c=l;for(;c+1<i&&a(c+1);)c++;let m=Math.max(e[l],r),u=Math.min(e[c+1],o);s+=`M${M(m)},${M(m===e[l]?Math.max(l?t[l-1]:n,t[l]):t[l])}V${M(t[l])}`;for(let f=l;f<c;f++)s+=`H${M(e[f+1])}V${M(t[f+1])}`;s+=`H${M(u)}`,u===e[c+1]&&(s+=`V${M(Math.max(c+1<i?t[c+1]:n,t[c]))}`),l=c}return s}function Dl(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 Ll(e,t,n){let r=[...e].sort((l,c)=>l.at-c.at),o=l=>{let c=[];return r.map(m=>{let u=$e(m.text,Ai,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(k=>f[k]).find(k=>d.every(([b,v])=>k+u/2+4<=b||k-u/2-4>=v));if(g!==void 0)return d.push([g-u/2,g+u/2]),{...m,x:g,w:u,row:p}}})},i=l=>Math.max(0,...l.map(c=>c.row)),a=o([0,1,2]),s=o([2,0,1]);return i(s)<i(a)?s:a}function El(e,t,n){let r=[];for(let o=Math.max(2,n);o<=Math.max(2,n)+4&&r.length<3;o++)r=en(e,t,o).filter(i=>i>=e-1e-9&&i<=t+1e-9);return r}function Ol(e,t,n){let r=i=>Qn(e,t,i).filter(a=>a>=e*.999999999&&a<=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 lr(e){let t=fi(e,{height:h=>Math.max(230,Math.min(310,h*.55)),duration:800}),{p:n,width:r,height:o}=t,i=Al[t.lang],a=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??Nl).filter(h=>Number.isFinite(qn(h))).join(","),g=typeof e.highlight=="function"?e.highlight:null,k=typeof e.highlight=="function"?void 0:e.highlight,{data:b,value:v,group:T,x0:A,x1:x,count:S,binWidth:B,bins:H}=e,L=(0,qe.useMemo)(()=>{let h=b.find(I=>I!==null&&typeof I=="object");if(si(h,v,S))return _l(b,{x0:A,x1:x,count:S,group:T},g,s);let O=p?p.split(",").map(Number):void 0;return Rl(b,v,T,g,{edges:O,binWidth:B,bins:H,log:s})},[b,v,T,A,x,S,p,B,H,s,g]),{bins:D,samples:N}=L,C=D.length,$=N.length>1,w=(0,qe.useMemo)(()=>L.samples.map((h,O)=>{let I=d?d.split(",").map(P=>({id:P,v:Ci(L,O,qn(P),s)})):[];return{median:I.find(P=>P.id==="p50")?.v??Ci(L,O,50,s),marks:I}}),[L,d,s]),F=(0,qe.useMemo)(()=>m===void 0?[]:L.samples.map((h,O)=>Pl(L,O,{value:m,side:u},s)),[L,m,u,s]),[E,j]=(0,qe.useMemo)(()=>Ye(L.bins.flatMap(h=>[h.x0,h.x1])),[L]),ie=e.kde===!0&&!L.binned,Se=(0,qe.useMemo)(()=>{if(!ie||!L.bins.length)return null;let h=s?Math.log10:ar,[O,I]=[h(E),h(j)],P=Array.from({length:Ti},(Y,V)=>O+(I-O)*V/(Ti-1)),J=(I-O)/L.bins.length;return{xs:P,curves:L.samples.map(Y=>ai(Y.values.map(h),P).map(V=>V*Y.n*J))}},[ie,L,s,E,j]),K=N.map(h=>h.name),re=$?g?L.fnGroup:[...pe(k,K,K,N.map(h=>h.n),"first")][0]??-1:-1,ue=D.map(h=>h.counts[0]),me=h=>i.range(a(h.x0),a(h.x1)),Je=$||c?new Set:g?L.fnBins:pe(k,D,D.map(me),ue,"max"),Ze=$&&re===0?1:0,dt=$?1-Ze:0,te=l==="dots"&&!$,je=l==="step",dn=s?Math.log10:ar,Qe=Math.max(0,...D.flatMap(h=>h.counts)),ur=Math.max(2,Math.round(o/70)),St=ze(0,Math.max(1,Qe,...Se?.curves.flat()??[]),ur),mr=Xe(St,[0,1]).ticks(ur).filter(h=>Number.isInteger(h)),dr=xt(void 0,t.locale,St[1]),fr=te?8:Qt(mr,dr,t.locale),et=fr+2,Ge=r-10,hr=Xe([dn(E),dn(j)],[et,Ge]),X=h=>hr(dn(h)),fn=h=>Number.isFinite(h)&&h>=E&&h<=j&&(!s||h>0),gr=N.reduce((h,O)=>h+O.outside,0),pr=N.reduce((h,O)=>h+O.excluded,0),At=[gr?i.outside(gr):"",pr?i.excluded(pr):""].filter(Boolean).join(" · "),Ki=Math.max(0,re),hn=t.pending||!C?[]:Ll([...(w[Ki]?.marks??[]).filter(h=>fn(h.v)).map(h=>({key:h.id,at:X(h.v),text:`${h.id} ${a(h.v)}`,fill:n.paint($?"accentText":"ink"),stroke:n.paint($?"accent":"ink"),dash:Fl(h.id)})),...c&&fn(c.value)?[{key:"threshold",at:X(c.value),text:c.label?`${c.label} ${a(c.value)}`:a(c.value),fill:n.paint($?"ink":"accentText"),stroke:n.paint($?"ink":"accent")}]:[]],4,r-4),br=t.showLabels?Math.max(0,...hn.map(h=>h.row+1)):0,Ui=At||te?mn:0,Nt=h=>6+Ui+h*(un+3),de=Nt(br)+(br?4:0),U=o-22,Xi=C?Math.min(...D.map(h=>X(h.x1)-X(h.x0))):10,yr=Math.max(1.5,Math.min(6,Xi/2-1)),xr=Math.min(yr,2.5),Ae=te?ui(Qe,(U-de)/(xr*2+1.5)):1,gn=Math.max(xr,Math.min(yr,((U-de)/Math.max(1,Math.ceil(Qe/Ae))-1.5)/2)),Ft=gn*2+1.5,ft=te?h=>U-h/Ae*Ft:Xe(St,[U,de]),pn=e.stagger??Math.min(28,520/Math.max(1,C)),Yi=(0,qe.useMemo)(()=>{let h=[];if(!je)for(let I of D)h.push({key:`${te?"d":"b"}${I.i}`,to:[te?1:ft(I.counts[Ze])],from:[te?0:U],enter:[te?0:U],delay:I.i*pn,data:{k:Ze,i:I.i}});let O=$?je?[Ze,dt]:[dt]:je?[0]:[];for(let I of O)h.push({key:`s${I}`,to:D.map(P=>ft(P.counts[I])),from:D.map(()=>U),enter:D.map(()=>U),delay:I===dt?120:0,data:{k:I,i:-1}});return h},[L,r,o,de,Ae,te,je,$,Ze,dt,pn,St[1]]),kr=yi(Yi,t.motion),ht=h=>it(h,{locale:t.locale,maximumFractionDigits:1}),gt=(h,O)=>N[h].n?O/N[h].n*100:0,wr=N.map((h,O)=>{let I=0;return D.map(P=>I+=P.counts[O])}),qi=D.map(h=>{let O=N.map((I,P)=>{let J=i.row(h.counts[P],ht(gt(P,h.counts[P])));return $?`${I.name} ${J}`:`${J}, ${i.rowCum(ht(gt(P,wr[P][h.i])))}`});return{datum:null,index:h.i,key:`b${h.i}`,label:me(h),value:h.counts.reduce((I,P)=>I+P,0),formatted:O.join(", ")}}),_e=n.paint("accent"),vr=h=>Je.has(h.i)||c!==void 0&&sr(h,c,s)>=.5,$r=h=>h===re?_e:n.paint(h===Ze&&!je?"neutral":"neutralStrong"),Mr=null;if(t.active!==null&&D[t.active]){let h=D[t.active],O=Math.max(...h.counts),I=P=>{let J=i.inBin(h.counts[P],ht(gt(P,h.counts[P]))),Y={label:i.cum,value:ht(gt(P,wr[P][h.i])),strong:!1};return $?[{label:N[P].name,value:J,color:$r(P),strong:P===re},Y]:[{label:i.count,value:J,color:vr(h)?_e:n.paint(te||je?"neutralStrong":"neutral"),strong:!0},Y]};Mr={x:(X(h.x0)+X(h.x1))/2,y:te?U-Math.ceil(O/Ae)*Ft:ft(O),title:me(h),rows:N.flatMap((P,J)=>I(J))}}let Tr=h=>{let O=N[h],I=w[h],P=F[h],J=V=>L.binned?i.about(a(V)):a(V),Y=[i.samples(O.n),i.median(J(I.median)),...I.marks.filter(V=>V.id!=="p50").map(V=>`${V.id} ${J(V.v)}`)];return!$&&Qe&&Y.push(i.peak(me(D[ue.indexOf(Qe)]),Qe)),P&&c&&Y.push(i.past(P.est?i.about(`${P.n}`):`${P.n}`,f,a(c.value),c.label??"",ht(gt(h,P.n)))),Y},bn=[At,te?i.dot(Ae):""].filter(Boolean),Ji=L.groupCount>N.length?` ${i.hidden(N.length,L.groupCount)}.`:"",Zi=C?$?`${i.kind}, ${i.groups(N.length)}. ${N.map((h,O)=>`${h.name}: ${Tr(O).join(", ")}`).join("; ")}${bn.length?`. ${bn.join(", ")}`:""}.${Ji}`:`${i.kind}. ${[...Tr(0),...bn].join(", ")}.`:"",Qi=e.description??Zi,pt=c&&fn(c.value)?X(c.value):null,Rt=C?[X(D[0].x0),...D.map(h=>X(h.x1))]:[],Cr=(h,O)=>h>0&&U-O<1?U-1:O,ea=(h,O,I)=>{let P=X(h.x0)+.5,J=X(h.x1)-.5,Y=J-P;if(Y<=0||h.counts[I]<=0)return null;let V=Cr(h.counts[I],O),Ne=Math.min(2,Y/4),_t=n.paint("neutral"),tt=c&&!$?sr(h,c,s):0;if(tt<=0||tt>=1||pt===null)return(0,z.jsx)("path",{d:Jt(P,V,Y,U-V,{tl:Ne,tr:Ne}),fill:tt>=1||Je.has(h.i)?_e:_t});let yn=Math.max(P,Math.min(J,pt)),[sa,la]=f?[_t,_e]:[_e,_t];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("path",{d:Jt(P,V,yn-P,U-V,{tl:Ne}),fill:sa}),(0,z.jsx)("path",{d:Jt(yn,V,J-yn,U-V,{tr:Ne}),fill:la})]})},ta=(h,O)=>{let I=O.map((Y,V)=>Cr(D[V]?.counts[h]??0,Y)),P=$&&h===dt&&re>=0,J=$?[]:c?pt===null?[]:[f?[pt,1/0]:[-1/0,pt]]:Dl(Je,C).map(([Y,V])=>[Rt[Y],Rt[V+1]]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("path",{d:Si(Rt,I,U),fill:"none",stroke:P?_e:n.paint("neutralStrong"),strokeWidth:P?2:1.6,strokeLinejoin:"round"}),J.map(([Y,V],Ne)=>(0,z.jsx)("path",{d:Si(Rt,I,U,Y,V),fill:"none",stroke:_e,strokeWidth:2,strokeLinejoin:"round"},Ne))]})},na=(h,O)=>{let I=h.counts[0],P=Math.floor(I/Ae),J=I%Ae>0,Y=Math.round(O*(P+(J?1:0))),V=M((X(h.x0)+X(h.x1))/2),Ne=vr(h)?_e:n.paint("neutralStrong");return(0,z.jsxs)(z.Fragment,{children:[Array.from({length:Math.min(Y,P)},(_t,tt)=>(0,z.jsx)("circle",{cx:V,cy:M(U-Ft*(tt+.5)),r:M(gn),fill:Ne},tt)),J&&Y>P?(0,z.jsx)("circle",{cx:V,cy:M(U-Ft*(P+.5)),r:M(gn-.65),fill:"none",stroke:Ne,strokeWidth:1.3}):null]})},ra=C?s?Ol(E,j,(Ge-et)/Math.max(1e-9,Math.log10(j/E))):El(E,j,Math.round((Ge-et)/70)):[],oa=xt(e.format,t.locale,Math.max(Math.abs(E),Math.abs(j))),ia=Do(ra.map(h=>({t:h,x:X(h),label:oa(h)})),0,r),Pe=t.active!==null?D[t.active]:void 0,aa=Pe&&(te||je||$),Sr=kr.fade(Math.min(700,C*pn)+200,320);return(0,z.jsxs)(uo,{c:t,kind:i.kind,ariaLabel:e.ariaLabel,description:Qi,events:qi,tip:Mr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[!te&&C?(0,z.jsx)(Po,{p:n,ticks:mr,y:ft,x0:fr,x1:r,fmt:dr,locale:t.locale}):null,aa?(0,z.jsx)("rect",{x:M(X(Pe.x0)),y:M(de),width:M(X(Pe.x1)-X(Pe.x0)),height:M(U-de),fill:n.paint("line"),opacity:.6,pointerEvents:"none"}):null,D.map(h=>(0,z.jsx)("rect",{x:M(X(h.x0)),y:M(de),width:M(Math.max(0,X(h.x1)-X(h.x0))),height:M(Math.max(0,U-de)),fill:"transparent",onPointerEnter:O=>t.setActive(h.i,O.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(h.i),style:{cursor:e.onClick?"pointer":void 0}},`h${h.i}`)),kr.items.map(h=>{let{k:O,i:I}=h.data,P=D[I];return(0,z.jsx)("g",{className:"ztd-mark",pointerEvents:"none",opacity:h.exiting?.4:I<0?1:t.dim(I),children:I<0?ta(O,h.v):P?te?na(P,h.v[0]):ea(P,h.v[0],O):null},h.key)}),Pe&&t.via==="keyboard"?(0,z.jsx)("rect",{x:M(X(Pe.x0)-1),y:M(de-2),width:M(X(Pe.x1)-X(Pe.x0)+2),height:M(U-de+4),rx:3,fill:"none",stroke:n.paint("ink"),strokeWidth:2,pointerEvents:"none"}):null,Se?.curves.map((h,O)=>(0,z.jsx)("path",{d:Co(h.map((I,P)=>[hr(Se.xs[P]),Math.max(de,ft(I))])),fill:"none",stroke:$?$r(O):n.paint("ink"),strokeWidth:1.6,opacity:Sr,pointerEvents:"none"},`k${O}`)),(0,z.jsxs)("g",{opacity:Sr,pointerEvents:"none","aria-hidden":"true",children:[hn.map(h=>(0,z.jsx)("line",{x1:M(h.at),x2:M(h.at),y1:t.showLabels?Nt(h.row)+un:de,y2:U,stroke:h.stroke,strokeWidth:h.key==="threshold"?1.5:1.4,strokeDasharray:h.dash},h.key)),t.showLabels?hn.map(h=>(0,z.jsxs)("g",{children:[(0,z.jsx)("rect",{x:M(h.x-h.w/2),y:Nt(h.row),width:M(h.w),height:un,rx:5,fill:n.paint("panel"),opacity:.92}),(0,z.jsx)(Ee,{x:h.x,y:Nt(h.row)+un/2,anchor:"middle",size:Ai,weight:700,fill:h.fill,children:h.text})]},h.key)):null]}),(0,z.jsxs)("g",{"aria-hidden":"true",children:[ia.map(h=>(0,z.jsx)(Ee,{x:h.x,y:U+11,anchor:"middle",size:Ue,fill:n.paint("muted"),children:h.label},h.t)),te&&C?(0,z.jsx)("line",{x1:et,x2:Ge,y1:M(U)+.5,y2:M(U)+.5,stroke:n.paint("dim"),shapeRendering:"crispEdges"}):null,At?(0,z.jsx)(Ee,{x:et,y:6+mn/2,size:10.5,fill:n.paint("muted"),children:Gn(At,Math.max(40,Ge-et-(te?110:0)),10.5)}):null,te?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("circle",{cx:M(Ge-$e(i.dot(Ae),10.5,600)-8),cy:6+mn/2,r:3.5,fill:n.paint("neutralStrong")}),(0,z.jsx)(Ee,{x:Ge,y:6+mn/2,anchor:"end",size:10.5,weight:600,fill:n.paint("muted"),children:i.dot(Ae)})]}):null,C?null:(0,z.jsx)(Ee,{x:r/2,y:o/2,anchor:"middle",size:12,fill:n.paint("muted"),children:t.t.empty})]})]})}var Il=R(q(),1);var Pi=R(G(),1),zl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Bl={en:zl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ni=(e,t)=>Bl[e].other(t);function Fi(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,To(o.map(i=>i.value)))}}var Ri=e=>Number.isFinite(e)&&e>0?e:0;function _i(e,t,n,r){return r==="emphasis"?Ur(e,t,n):xe(e,t,n)}var Hl=R(q(),1);var Oi=R(G(),1);function Di(e,t){return t===!1?e.map((n,r)=>r):Mo(e)}function Li(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return pe(e,t,t,r,"max")}function Ei(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=ne(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?ne(e,"neutral"):Ot(e,1-a/Math.max(1,o.length-1))),r}function Ii(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ve(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function zi(e,t){return yt(e,t+1,new Set)}var jl=R(q(),1);var Hi=R(G(),1);function Bi(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Ko.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var Re=R(G(),1);function ji(e,t,n){let r=Xt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Ut(n)?Xt("bubble"):r}function Gl(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function Wl(e,t,n,r=!1){let o=ji(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&zn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(f=>!l.has(f.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=ge(i.label,"label"),f=Fe(i.value,"value"),p=o.type==="waffle",d=t.map((x,S)=>({r:x,label:u(x,S),value:p?f(x,S):Ri(f(x,S))})),{kept:g,other:k}=p?{kept:d,other:null}:Fi(d,a.other,(x,S)=>({r:{},label:Ni(Z(n),x),value:S})),b=pe(s,g.map(x=>x.r),g.map(x=>x.label),g.map(x=>x.value),p?"first":"max"),v=k?[...g,k]:g,T=Le(x=>p?xe(x,v.length,b):_i(x,v.length,b,a.colorMode)),A=p&&a.shape==="arc";return v.map((x,S)=>({label:x.label,color:T[S],...A&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Mi(Array.isArray(a.ma)?a.ma:void 0,t.length),f=$i[Z(n)];return[{label:f.up,color:a.upColor??"accent"},{label:f.down,color:a.downColor??"neutralStrong"},...u.map((p,d)=>({label:f.maLegend(p),color:or[d],shape:"line"}))]}if(o.type==="network"){let u=Ii(a.groups);if(u.length<2)return[];let f=Le(p=>zi(p,u.length));return u.map((p,d)=>({label:p,color:f[d],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ge(i.group,"group"),f=ve(t.map((d,g)=>u(d,g)).filter(Boolean));if(f.length<2)return[];let p=Le(d=>yt(d,f.length,new Set));return f.map((d,g)=>({label:d,color:p[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||Ut(a))return[];let u=ge(i.series,"series"),f=ve(t.map((g,k)=>u(g,k)));if(f.length<2)return[];let p=vi(s,t,f,u),d=Le(g=>yt(g,f.length,p));return c(f.map((g,k)=>({label:g,color:d[k],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",f=u?i.status:i.group;if(typeof f!="string")return[];let p=mi(t,f,u),d=Le(g=>xe(g,p.length,Bi(s,p)));return c(p.map((g,k)=>({label:g,color:d[k],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let T=ge(i.series,"series");u=ve(t.map((A,x)=>T(A,x)))}let f=Bn(o.type,i,a);if(f.length){let T=pe(s,u,u,u.map(()=>0),"none"),A=Le(S=>xe(S,u.length,T)),x=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((S,B)=>({label:S,color:A[B]}));return[...c(x),...f.map((S,B)=>({label:S,color:wi(B),shape:"line"}))]}if(u.length<2)return[];let d=o.type==="bar"&&a.layout==="diverging"&&s===void 0?$o(u.length,Array.isArray(a.negative)?a.negative.map(T=>u.indexOf(String(T))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,g=d>=0?new Set([d]):pe(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((T,A)=>({label:T,color:g.has(A)?"accent":"neutralStrong",shape:"square"})));let k=a.colorMode,b=T=>xe(T,u.length,g);if((o.type==="line"||o.type==="area")&&(b=T=>ki(T,u.length,g,o.type==="area",k)),o.type==="stream"){let T=vt(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),A=Di(T.values,a.reorder),x=Li(s,T.series,T.values);b=S=>Ei(S,A,x)}let v=Le(b);return c(u.map((T,A)=>({label:T,color:v[A],...o.type==="line"&&{shape:"line"}})))}return[]}function Vl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&po.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Kl(e,t,n){let{data:r,width:o,height:i,highlight:a,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:i,highlight:a,syncId:s,title:l,description:c}}function Gi(e,t){let{spec:n}=e,r=ji(n.type,n.encoding,n.options),o=(0,Ct.useMemo)(()=>di(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=go(n,e.locale),s=se(a),l=Z(s),c=Uo(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=xo(n),u=(0,Ct.useMemo)(()=>m?ei(m,s):void 0,[m,s]),f=n.options?.hidden,p=Array.isArray(f)?f.map(String):[],d=p.join(""),[g,k]=(0,Ct.useState)(null);if(!r)return(0,Re.jsx)(In,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let b=o??c.data,v=t[r.type],T={...n.options??{}},A={...Gl(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:a},x=n.card?.legend==="toggle"&&yo(r.type,n.encoding??{},T),S=g&&g.base===d?g.hidden:p;x&&(A.hidden=S);let B=C=>k($=>{let w=$&&$.base===d?$.hidden:p;return{base:d,hidden:w.includes(C)?w.filter(F=>F!==C):[...w,C]}}),H=A.height??220,L=Vl(n,r.type),D=i&&!b.length&&(c.loading||c.error||c.empty)?(0,Re.jsx)(In,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:H,locale:a}):L?(0,Re.jsx)(Vo,{chart:v,...Kl(r.type,L,A)}):(0,Re.jsx)(v,{...A});if(n.card){let C=n.card,$=C.legend==="auto"||C.legend==="toggle"?Wl(n,b,s,x):C.legend,w=$?.length?x?(0,Re.jsx)(On,{items:$,hidden:S,onToggle:B,locale:a}):$:void 0,F=C.download?(0,Re.jsx)(Qo,{data:b,columns:ko(n),filename:C.title??r.type,formats:Array.isArray(C.download)?C.download:void 0,locale:a}):void 0;D=(0,Re.jsx)(co,{number:C.number,title:C.title??ho(r,l),subtitle:C.subtitle,legend:w,actions:F,source:C.source||void 0,note:C.note||void 0,accent:C.accent,takeaway:C.takeaway,level:C.level,sample:C.sample,replay:C.replay!==!1,className:e.className,locale:a,children:D})}let N=e.theme??n.theme;return N&&(D=(0,Re.jsx)(jt,{theme:N,children:D})),D}function Ul({cfg:e,components:t}){let n=ct();return Gi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Vi(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Wi.hydrateRoot)(r,(0,cr.createElement)(jt,{theme:o.theme,cssVars:!0},(0,cr.createElement)(Ul,{cfg:o,components:{[e]:t}})))}Vi("histogram",lr);})();
|