ztd-charts-cli 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +1 -1
- package/dist/{chunk-QVXYPBAX.js → chunk-4K4P2AWW.js} +28 -16
- package/dist/cli.js +1 -1
- package/dist/client/area.js +28 -0
- package/dist/client/bar.js +28 -0
- package/dist/client/beeswarm.js +28 -0
- package/dist/client/box.js +28 -0
- package/dist/client/bubble.js +28 -0
- package/dist/client/bullet.js +28 -0
- package/dist/client/bump.js +28 -0
- package/dist/client/calendar.js +28 -0
- package/dist/client/candlestick.js +28 -0
- package/dist/client/chord.js +28 -0
- package/dist/client/donut.js +28 -0
- package/dist/client/dumbbell.js +28 -0
- package/dist/client/funnel.js +28 -0
- package/dist/client/gauge.js +28 -0
- package/dist/client/heatmap.js +28 -0
- package/dist/client/histogram.js +28 -0
- package/dist/client/line.js +28 -0
- package/dist/client/lollipop.js +28 -0
- package/dist/client/marimekko.js +28 -0
- package/dist/client/parallel.js +28 -0
- package/dist/client/pareto.js +28 -0
- package/dist/client/pie.js +28 -0
- package/dist/client/radar.js +28 -0
- package/dist/client/radialBar.js +28 -0
- package/dist/client/react.js +66 -0
- package/dist/client/ridgeline.js +28 -0
- package/dist/client/sankey.js +28 -0
- package/dist/client/scatter.js +28 -0
- package/dist/client/segmented.js +28 -0
- package/dist/client/skyline.js +28 -0
- package/dist/client/slope.js +28 -0
- package/dist/client/sparkline.js +28 -0
- package/dist/client/stream.js +28 -0
- package/dist/client/sunburst.js +28 -0
- package/dist/client/treemap.js +28 -0
- package/dist/client/waffle.js +28 -0
- package/dist/client/waterfall.js +28 -0
- package/package.json +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
(()=>{var ir=Object.create;var wt=Object.defineProperty;var sr=Object.getOwnPropertyDescriptor;var lr=Object.getOwnPropertyNames;var ur=Object.getPrototypeOf,cr=Object.prototype.hasOwnProperty;var Ge=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var mr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of lr(t))!cr.call(e,o)&&o!==n&&wt(e,o,{get:()=>t[o],enumerable:!(r=sr(t,o))||r.enumerable});return e};var T=(e,t,n)=>(n=e!=null?ir(ur(e)):{},mr(t||!e||!e.__esModule?wt(n,"default",{value:e,enumerable:!0}):n,e));var z=Ge((ia,Ct)=>{Ct.exports=globalThis.__ztdReact.react});var Mt=Ge((sa,$t)=>{$t.exports=globalThis.__ztdReact["react-dom/client"]});var F=Ge((ya,qt)=>{qt.exports=globalThis.__ztdReact["react/jsx-runtime"]});var xt=T(z(),1),or=T(Mt(),1);var $e=T(z(),1);var Le=T(z(),1);var St=T(z(),1),Me=(0,St.createContext)(void 0);var hr=T(z(),1);var dr=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Tt='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',At='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',ae={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:Tt,monoFamily:At,radius:18,radiusCode:14,radiusMark:4},fr={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:Tt,monoFamily:At,radius:18,radiusCode:14,radiusMark:4},Ue={dark:ae,light:fr};function qe(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Ye(e){let t={};for(let n of dr){let r=e[n];typeof r=="string"&&(t[qe(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 Xe(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 gr=`
|
|
2
|
+
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
|
+
.ztd-root:focus{outline:none}
|
|
4
|
+
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${ae.accent});outline-offset:3px;border-radius:6px}
|
|
5
|
+
.ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
|
|
6
|
+
.ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
|
|
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)}
|
|
8
|
+
.ztd-guide{transition:transform .2s cubic-bezier(.22,1,.36,1)}
|
|
9
|
+
.ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
|
|
10
|
+
.ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
|
|
11
|
+
.ztd-btn:focus{outline:none}
|
|
12
|
+
.ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${ae.accent});outline-offset:2px}
|
|
13
|
+
.ztd-card{transition:border-color .16s ease}
|
|
14
|
+
.ztd-card:hover{border-color:var(--ztd-dim,${ae.dim})}
|
|
15
|
+
@media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
|
|
16
|
+
@keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
|
|
17
|
+
@keyframes ztd-fade{from{opacity:0}to{opacity:1}}
|
|
18
|
+
.ztd-pop{transform-box:fill-box;transform-origin:center}
|
|
19
|
+
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
|
+
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
|
+
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
+
`;var Rt=!1;function ye(){if(Rt||typeof document>"u"||(Rt=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=gr,document.head.appendChild(e)}var Se=T(z(),1),ne=typeof window<"u"&&typeof document<"u",ee=ne?Se.useLayoutEffect:Se.useEffect;function Te(){return typeof performance<"u"?performance.now():Date.now()}function H(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 Nt={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Ft={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var pr=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],br={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function yr(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function xr(e){return yr(pr,e)}function Pt(e,t){let n=xr(e);return{text:n?n[t]:e,...br[n?.id??"basic"]}}var X=T(z(),1);var It=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),re="en-US",Dt=new Map;function Je(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=Dt.get(r);return o||(o=new Intl.NumberFormat(e,n),Dt.set(r,o)),o}function Ze(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Qe(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=re,...r}=t;return Ze(Je(n,r).format(e))}var Ot=e=>e!==0&&Math.abs(e)<.05,Bt=(e,t,n="")=>`${Qe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ae(e,t={}){if(!Number.isFinite(e))return"-";if(Ot(e)&&t.maximumFractionDigits===void 0)return Bt(e,t.locale??re,"%");let n=Math.abs(e);return`${Qe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function kr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=re,...r}=t;if(H(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,g=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),m=Math.round(u*10**g)/10**g;if(i>0&&m>=a[i-1][0]/s){i--;continue}return(e<0&&m!==0?"-":"")+Qe(m,{locale:n,...r,maximumFractionDigits:g})+l}}return Ze(Je(n,{notation:"compact",...r}).format(e))}var vr=(e,t=H(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Re(e,t=re,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Je(t,o);return l=>Number.isFinite(l)?`${i}${Ze(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=>Ae(o,{locale:t});case"ratio":return o=>Ae(o*100,{locale:t});case"compact":return o=>kr(o,{locale:t});case"currency":return r(vr(t));default:{let o=r({maximumFractionDigits:1});return a=>Ot(a)?Bt(a,t):o(a)}}}function wr(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Cr=e=>Number.isInteger(e)&&e>=1e3&&e<=9999;var $r=["january","february","march","april","may","june","july","august","september","october","november","december"],Lt=e=>{let t=e.toLowerCase();return t.length<3?0:$r.findIndex(n=>n.startsWith(t))+1},Et=e=>+e+(+e<30?2e3:1900);function zt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Mr=[/^(\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})일)?$/],Sr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Ht=/\{([^{}]+)\}/g;function Tr(e,t){let n;for(let r of Mr)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?[Et(n[3]),+n[2],+n[1],1]:[Et(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=Sr.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=Lt(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=Lt(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}function jt(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(Cr(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return jt(`${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=Tr(n,t);if(r)return wr(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 _t=new Map;function Vt(e,t={month:"short",day:"numeric"}){let n=jt(e);if(!n)return"-";let{locale:r=re,...o}=t,a=r+JSON.stringify(o),i=_t.get(a);return i||(i=new Intl.DateTimeFormat(r,o),_t.set(a,i)),i.format(n)}var Wt={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Kt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Wt[t.toLowerCase()]&&(t=Wt[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 Ar(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 et(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Rr(e){return[et(e[0]),et(e[1]),et(e[2])]}function tt(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 Gt(e){let[t,n,r]=Rr(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 Nr([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[tt(4.0767416621*o-3.3077115913*a+.2309699292*i),tt(-1.2684380046*o+2.6097574011*a-.3413193965*i),tt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Ut(e,t,n){let r=Kt(e),o=Kt(t);if(!r||!o)return e;let a=Gt(r),i=Gt(o),s=Math.max(0,Math.min(1,n));return Ar(Nr([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 nt=T(F(),1),Ne=(0,X.createContext)({theme:ae,cssVars:!0});function Fr(e,t=ae){return e?typeof e=="string"?Ue[e]??t:Xe(t,e):t}function Pe(e){let t=(0,X.useContext)(Ne),n=e.base?Ue[e.base]:t.theme,r=(0,X.useMemo)(()=>Fr(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,X.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,X.useMemo)(()=>Ye(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,nt.jsx)(Ne.Provider,{value:i,children:(0,nt.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Pr=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Fe(e){return Pr.has(e)}function Dr(e,t){let n=r=>t?`var(${qe(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Fe(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Fe(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)})`:Ut(e[r],e[o],a)}}}function oe(e){let t=(0,X.useContext)(Ne);return(0,X.useMemo)(()=>{let n=Xe(t.theme,e);return Dr(n,t.cssVars)},[t.theme,t.cssVars,e])}function J(e){let t=(0,X.useContext)(Ne);return e??t.locale??re}function Yt(e){return e?Ye(e):{}}var De=T(z(),1),rt=(0,De.createContext)(void 0);function Xt(e){let t=(0,De.useContext)(rt);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var v=T(F(),1),Lr={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`},Er={en:Lr,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var _r={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},ot=e=>Er[H(J(e))];function at(e){let t=oe(e.theme),n=ot(e.locale),[r,o]=(0,Le.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(g=>!s.has(g.label)).length,u=(0,v.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((g,m)=>{let h=!s.has(g.label),y=h&&l===1,c=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(Ir,{p:t,item:g,off:!h}),(0,v.jsx)("span",{style:h?void 0:{textDecoration:"line-through"},children:g.label})]});return(0,v.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,v.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":h,"aria-disabled":y||void 0,onClick:()=>{y||(i(g.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:c}):c},m)})});return i?(0,v.jsxs)(v.Fragment,{children:[u,(0,v.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:_r,children:r?n.shown(l,e.items.length):""})]}):u}function Ir({p:e,item:t,off:n}){let r=t.color?Fe(t.color)?e.paint(t.color):t.color:e.paint("neutral"),o=t.shape??"square";return o==="line"||o==="dash"?(0,v.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,v.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,v.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,v.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 Or(e){let t=oe(e.theme),n=Pt(e.level,H(J(e.locale)));return(0,v.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 Br(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,v.jsxs)(v.Fragment,{children:[e.slice(0,r),(0,v.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Jt(e){let t=oe(e.theme),n=ot(e.locale),[r,o]=(0,Le.useState)(0);ee(()=>ye(),[]);let a=()=>{o(h=>h+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,v.jsx)(at,{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,g=e.source!==void 0||e.note!==void 0?(0,v.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,v.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,v.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,v.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,v.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,v.jsx)(Or,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,v.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,v.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,v.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,v.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,v.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:Br(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,v.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,v.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,v.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,v.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,v.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,v.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,v.jsx)("span",{}),i]}):null]}),(0,v.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,v.jsx)(rt.Provider,{value:r,children:(0,v.jsx)(Me.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),g?(0,v.jsxs)(v.Fragment,{children:[g,m]}):m]})}function it(e){let t=oe(e.theme),n=ot(e.locale),r=e.height??220;if(ee(()=>ye(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,v.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,v.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,v.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,v.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,v.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,v.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,v.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,v.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,v.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,v.jsx)(v.Fragment,{children:e.children})}function ie(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 g=-1,m=u==="max"?-1/0:1/0;r.forEach((h,y)=>{Number.isFinite(h)&&(u==="max"?h>m:h<m)&&(m=h,g=y)}),g>=0&&a.add(g)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((u,g)=>{g<i&&u!==null&&u!==void 0&&e(u,g)&&a.add(g)}),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((g,m)=>{g===u&&a.add(m)});return a}function Zt(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 xe(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 Qt(e,t){return xe(e+1,t).slice(0,e)}function en(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function zr(e,t){if(e==null||typeof e!="object")return;let n=e;if(en(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!en(r,o))return;r=r[o]}return r}}function ke(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 tn(e,t){if(typeof e=="function")return e;let n=e??t;return r=>zr(r,n)}function Ee(e,t){let n=tn(e,t);return(r,o)=>ke(n(r,o))}function me(e,t){let n=tn(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 ve(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var Y=T(z(),1);function Hr(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let u=e[l];if(u==='"')n=!n;else if(!n&&(u===`
|
|
23
|
+
`||u==="\r"))break;t.push(n?"":u)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let u=o(l);u>s&&(s=u,i=l)}return i}var jr=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function nn(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(jr.test(t)||/^[-+]?\.\d+$/.test(t)){let n=ke(t);if(Number.isFinite(n))return n}return t}function de(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Hr(o),i=[],s=[],l="",u=!1;for(let c=0;c<o.length;c++){let d=o[c];u?d==='"'?o[c+1]==='"'?(l+='"',c++):u=!1:l+=d:d==='"'&&!l.trim()?(u=!0,l=""):d===a?(s.push(l),l=""):d===`
|
|
24
|
+
`||d==="\r"?(d==="\r"&&o[c+1]===`
|
|
25
|
+
`&&c++,s.push(l),i.push(s),s=[],l=""):l+=d}(l!==""||s.length)&&(s.push(l),i.push(s));let g=i.filter(c=>!(c.length===1&&c[0].trim()===""));if(!g.length)return[];let m=c=>n?nn(c):c;if(!r)return g.map(c=>Object.fromEntries(c.map((d,w)=>[String(w),m(d)])));let h=[],y=new Set;return g[0].forEach((c,d)=>{let w=c.trim()||`col${d+1}`,k=w;for(let M=2;y.has(k);M++)k=`${w}_${M}`;y.add(k),h.push(k)}),g.slice(1).map(c=>Object.fromEntries(h.map((d,w)=>[d,m(c[w]??"")])))}function st(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"?nn(i[l]):i[l]??null])))}function Vr(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 rn(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 se(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return se(JSON.parse(t))}catch{}return de(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?st(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)?se(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?st(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)?se(t.rows):Array.isArray(t.values)?st(t.values):Array.isArray(t.items)?se(t.items):Array.isArray(t.results)?se(t.results):Vr(t)}return[]}function on(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 Wr(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(H(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 Kr(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 Wr(a,t.parse,o,t.locale)}return t.select&&(r=rn(r,t.select)),t.transform?t.transform(r):se(r)}function an(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,Y.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Y.useState)(0),u=J(t.locale),g=(0,Y.useRef)(t);g.current={...t,locale:u};let m=(0,Y.useRef)(e);m.current=e;let h=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",y=t.deps??[],c=JSON.stringify(y.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),d=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let k=m.current;if(!k||!r){i(C=>C.status==="loading"?{...C,status:"idle"}:C);return}let M=new AbortController,A=!0;return d.current=!0,i(C=>({...C,data:o?C.data:[],status:"loading",error:null})),Kr(k,{...g.current,signal:M.signal}).then(C=>{A&&i({data:C,status:"success",error:null,updatedAt:Date.now()})}).catch(C=>{!A||M.signal.aborted||i($=>({...$,status:"error",error:C instanceof Error?C:new Error(String(C))}))}).finally(()=>{A&&(d.current=!1)}),()=>{A=!1,d.current=!1,M.abort()}},[h,r,s,c,o]),(0,Y.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{d.current||l(M=>M+1)},n);return()=>clearInterval(k)},[n,r]);let w=(0,Y.useCallback)(()=>l(k=>k+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:w}}var ut=T(F(),1),Gr=["csv","svg","png"],Ur=/^[=+\-@\t\r\n=+-@]/,qr=/var\(|color-mix\(/;function sn(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?zt(e.getTime()):String(e);return`"${(Ur.test(t)&&!Number.isFinite(ke(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Yr(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Xr(e,t){return`\uFEFF${[t.map(sn),...e.map(r=>t.map(o=>sn(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
|
+
`)}\r
|
|
27
|
+
`}function Jr(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function lt(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var ln=2,le=16;function un(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function cn(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 mn(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+le*2,i+le*2],u=o.cloneNode(!0),g=u.querySelectorAll("*"),m=new Map;o.querySelectorAll("*").forEach((c,d)=>{let w;for(let k of Array.from(c.attributes)){if(!qr.test(k.value))continue;let M=(w??(w=getComputedStyle(c))).getPropertyValue(k.name);M&&g[d].setAttribute(k.name,un(M,m))}}),u.removeAttribute("style");for(let[c,d]of Object.entries({viewBox:`${-le} ${-le} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(c,String(d));let h=un(getComputedStyle(r).backgroundColor,m),y=o.parentElement?.querySelector("canvas")??null;if(n){let c=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(cn("rect",{x:-le,y:-le,width:s,height:l,fill:h}),c),y&&u.insertBefore(cn("image",{href:y.toDataURL(),width:a,height:i}),c)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:a,vh:i,bg:h,canvas:y}}function Zr(e,t){let n=mn(e,ln,!1);if(!n)return;let r=ln,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,le*r,le*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&<(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function dn(e){let t=oe(e.theme),n=H(J(e.locale))==="ko",r=Jr(e.filename),o=(a,i)=>{if(a==="csv")return lt(new Blob([Xr(e.data,e.columns?.length?e.columns:Yr(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Zr(i,r);let s=mn(i,1,!0);s&<(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,ut.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Gr.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,ut.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var hn=T(F(),1);function fn(e,t=re){let n=Re(void 0,t),r=e.split(`
|
|
28
|
+
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Vt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,u=s.replace(Ht,(g,m)=>o(a,m.trim())??(l=!0,""));l||i.push(u)}return i.length?i.map((s,l)=>(0,hn.jsx)("div",{children:s},l)):null}}var f=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),Z=f("label","string",!0,"Item name field"),j=f("value","number",!0,"Value field"),Qr=[Z,j],eo=[Z,j],to=[f("label","string",!0,"Stage name"),f("value","number",!0,"Users at the stage")],no=[Z,j],ro=[f("label","string",!0,"Leaf (lowest level) name"),j,f("group","string",!1,"Parent group field")],oo=[f("label","string",!0,"Leaf name"),j,f("group","string",!1,"Parent group field")],ao=[Z,f("value","number",!0,"Change (total rows may omit it)"),f("type","string",!1,'"total" makes a total bar')],io=[Z,j],so=[f("x","string",!0,"Column field"),f("series","string",!0,"Stacked series field"),j],lo=[f("x","string",!0,"Column field"),f("y","string",!0,"Row field"),j],uo=[f("axis","string",!0,"Metric (axis) field"),f("value","number",!0,"Value field",{multi:!0}),f("series","string",!1,"Series field")],co=[f("x","number",!0,"x value"),f("y","number",!0,"y value"),f("size","number",!1,"Circle size"),f("label","string",!1,"Name")],pn=f("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),mo=[f("x","any",!0,"x field (date, number or category)"),f("y","number",!0,"y field. An array for wide tables",{multi:!0}),f("series","string",!1,"Series field (long tables)"),f("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),pn],fo=[f("x","any",!0,"x field"),f("y","number",!0,"y field. An array for wide tables",{multi:!0}),f("series","string",!1,"Series field"),f("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}),pn],ho=[f("x","any",!0,"x field"),f("y","number",!0,"y field",{multi:!0}),f("series","string",!1,"Series field")],go=[f("x","string",!0,"Category field"),f("y","number",!0,"Value field. An array for wide tables",{multi:!0}),f("series","string",!1,"Series field"),f("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})],po=[Z,j],bo=[f("value","number",!0,"Value field",{prop:"valueKey"}),f("target","number",!1,"Target field",{prop:"targetKey"})],yo=[Z,f("value","number",!0,"Actual value field"),f("target","number",!1,"Target field")],xo=[f("x","any",!1,"x field"),f("y","number",!0,"y field")],ko=[Z,f("x","string",!1,"Period field (long tables)"),f("value","number",!1,"Value field (long tables)")],vo=[Z,f("start","number",!0,"Before value"),f("end","number",!0,"After value")],wo=[Z,j],Co=[f("value","number",!0,"Value field"),f("group","string",!1,"Group (row) field"),f("label","string",!1,"Dot name")],$o=[f("group","string",!0,"Group field"),f("value","number",!0,"Value field")],Mo=[f("source","string",!0,"Source node"),f("target","string",!0,"Target node"),j],So=[f("source","string",!0,"Sending group"),f("target","string",!0,"Receiving group"),j],To=[f("date","date",!0,"Date field"),j],Ao=[f("x","any",!0,"Period field"),f("series","string",!0,"Item field"),f("rank","number",!1,"Rank field (1 is first)"),f("value","number",!1,"Value field (instead of rank, largest is first)")],Ro=[f("group","string",!0,"Group field"),f("value","number",!0,"Value field")],No=[f("label","string",!1,"Row name field")],Fo=[f("x","date",!0,"Date (period) field"),f("open","number",!0,"Open price field"),f("high","number",!0,"High price field"),f("low","number",!0,"Low price field"),f("close","number",!0,"Close price field"),f("volume","number",!1,"Volume field")],Po=[Z,j],Do=[f("x","any",!0,"Period field (date or category)"),f("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),f("series","string",!1,"Series field (long tables, back row only)"),f("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Lo=[f("value","number",!1,"Sample value field (raw rows)"),f("group","string",!1,"Group field. Up to 2 groups overlap"),f("x0","number",!1,"Bin start (pre-binned rows)"),f("x1","number",!1,"Bin end (pre-binned rows)"),f("count","number",!1,"Samples in the bin (pre-binned rows)")],Eo=[f("x","number",!0,"x value"),f("y","number",!0,"y value"),f("series","string",!1,"Series field (one color per series)"),f("label","string",!1,"Name")],gn={pie:Qr,donut:eo,funnel:to,waffle:no,treemap:ro,sunburst:oo,waterfall:ao,pareto:io,marimekko:so,heatmap:lo,radar:uo,bubble:co,line:mo,area:fo,stream:ho,bar:go,radialBar:po,gauge:bo,bullet:yo,sparkline:xo,slope:ko,dumbbell:vo,lollipop:wo,beeswarm:Co,ridgeline:$o,sankey:Mo,chord:So,calendar:To,bump:Ao,box:Ro,parallel:No,candlestick:Fo,segmented:Po,skyline:Do,histogram:Lo,scatter:Eo},he={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 bn(e,t){return t==="ko"?e.nameKo:e.name}function yn(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var ct=["line","area","bar","scatter"];function mt(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"?[].concat(t.line??[]).map(String):[]}function xn(e,t,n){return ct.includes(e)&&!mt(e,t,n).length}function kn(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var _o={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 _e(e){let t=gn[e]?e:_o[e]??Object.keys(he).find(n=>n.toLowerCase()===e.toLowerCase()||he[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!he[t]))return{type:t,component:he[t].component,name:he[t].name,nameKo:he[t].nameKo,encoding:gn[t]}}function vn(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 _e(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 Io=Math.PI*2;function wn(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function Cn(e,t){let n=0,r=e.length-1;if(r<0)return-1;for(;r-n>1;){let o=n+r>>1;e[o]<t?n=o:r=o}return Math.abs(e[n]-t)<=Math.abs(e[r]-t)?n:r}function we(e,t){if(!e.length)return NaN;let n=(e.length-1)*t,r=Math.floor(n),o=n-r;return e[r+1]!==void 0?e[r]+o*(e[r+1]-e[r]):e[r]}function $n(e,t,n){let r=e.filter(c=>Number.isFinite(c)),o=r.length;if(!o)return t.map(()=>0);let a=r.reduce((c,d)=>c+d,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((c,d)=>c+(d-a)**2,0)/o)||s,u=[...r].sort((c,d)=>c-d),g=we(u,.75)-we(u,.25),m=Math.min(l,g>0?g/1.34:l)||l,h=n??Math.max(1e-9,.9*m*Math.pow(o,-.2)),y=1/(Math.sqrt(2*Math.PI)*h*o);if(o>2e3){let d=u[0],k=(u[o-1]-d)/512||1,M=new Array(513).fill(0);for(let A of r)M[Math.min(512,Math.floor((A-d)/k))]++;return t.map(A=>{let C=0;for(let $=0;$<=512;$++){if(!M[$])continue;let O=(A-(d+$*k))/h;O>6||O<-6||(C+=M[$]*Math.exp(-.5*O*O))}return C*y})}return t.map(c=>{let d=0;for(let w of r){let k=(c-w)/h;k>6||k<-6||(d+=Math.exp(-.5*k*k))}return d*y})}function Mn(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 G=T(z(),1);var N=T(F(),1),Ie=60;var Sn={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Tn(e){let{c:t,events:n}=e,r=(0,G.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,ee(()=>{ye()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,G.useContext)(Me),u=e.ariaLabel??l??e.kind,g=(0,G.useMemo)(()=>s?`${n.length}${n.slice(0,Ie).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),m=(0,G.useMemo)(()=>(0,N.jsx)(Oo,{label:u,events:n,t:t.t}),[u,g,t.t]),h=(0,G.useRef)(null);(0,G.useEffect)(()=>{let x=()=>{h.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,G.useEffect)(()=>{h.current=null},[t.width,t.height]);let y=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let R=t.active,P;switch(x.key){case"ArrowRight":case"ArrowDown":P=R===null?0:(R+1)%i;break;case"ArrowLeft":case"ArrowUp":P=R===null?i-1:(R-1+i)%i;break;case"Home":P=0;break;case"End":P=i-1;break;case"Escape":if(R===null)return;P=null;break;case"Enter":case" ":R!==null&&(x.preventDefault(),t.click(R));return;default:return}x.preventDefault(),t.setActive(P,"keyboard")},{via:c,node:d,setActive:w}=t;(0,G.useEffect)(()=>{if(c!=="touch"||!d)return;let x=R=>{d.contains(R.target)||w(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[c,d,w]);let k=t.active!==null?n[t.active]:null,M=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,A=M&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,C=typeof e.renderTip=="function"&&k?e.renderTip(k):null,$=e.announce??(t.via==="keyboard"&&k?`${k.label}${k.series?` ${k.series}`:""}: ${k.formatted??k.value??""} (${(t.active??0)+1}/${i})`:""),O;if(M){let x=M.x*A,R=t.width*A,P=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(R-x-4).toFixed(1)}px - 100%))`,K=M.y<64;O={position:"absolute",left:x,top:M.y*A,transform:`translate(${P}, ${K?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*A-8)}}let W=x=>{h.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},q=x=>x?R=>{let P=h.current??(h.current=R.currentTarget.getBoundingClientRect());P.width&&x((R.clientX-P.left)/P.width*t.width,(R.clientY-P.top)/P.height*t.height,R)}:void 0,B=q(e.onPointerMove),p=q(e.onPointerDown),b=B||p?x=>{x.pointerType==="touch"&&B?.(x),p?.(x)}:void 0,S=q(e.onPointerUp),D=Yt(e.theme);return(0,N.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:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:W,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"),...D,...e.style},children:[t.pending?null:e.underlay,(0,N.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:B,onPointerDown:b,onPointerUp:S,onPointerCancel:S,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,N.jsx)("title",{id:o,children:u}),(0,N.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,N.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,M?(0,N.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:O,children:C??(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:M.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:M.title}),M.rows.map((x,R)=>(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,N.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,N.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},R))]})}):null,(0,N.jsx)("span",{className:"ztd-sr",style:Sn,"aria-live":"polite","aria-atomic":"true",children:$}),s&&!t.pending?m:null]})}function Oo({label:e,events:t,t:n}){return(0,N.jsx)("div",{className:"ztd-sr",style:Sn,children:(0,N.jsxs)("table",{children:[(0,N.jsx)("caption",{children:n.table(e)}),(0,N.jsxs)("tbody",{children:[t.slice(0,Ie).map((r,o)=>(0,N.jsxs)("tr",{children:[(0,N.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,N.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Ie?(0,N.jsx)("tr",{children:(0,N.jsx)("td",{colSpan:2,children:n.more(t.length-Ie)})}):null]})]})})}function dt(e){let t=e.baseline??"central";return(0,N.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 Rn(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function An(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 Oe=new Map;function Be(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Oe.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);Rn(u)?i+=An(u):s+=An(u)}a=i+s*(n>=600?1.07:1),Oe.size>5e3&&Oe.clear(),Oe.set(o,a)}return a*t}function Nn(e,t,n,r=400){if(e=e.trim(),Be(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;Be(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<(Rn(s.charCodeAt(0))?2:3)?"":s+o}var Pn=T(F(),1),Fn=10.5;function ft(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 Dn(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=ft(i,n),u=[o,a];for(let g=0;g<4;g++){let m=Math.ceil(a/l-1e-9)*l,h=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-h<=l*.3?h:o-i*s,a===0?0:m-a<=l*.3?m:a+i*s];let y=ft(u[1]-u[0],n);if(y===l)break;l=y}return u}function Bo(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=ft(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 Ln(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)=>Bo(n,r,l),s}function En(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 I=T(z(),1);var U=T(z(),1);function zo(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Ho(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function On(e,t=!0){let[n,r]=(0,U.useState)({visible:!t,near:!t});return(0,U.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=Ho(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:zo(.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 _n(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Bn(e){let[t,n]=(0,U.useState)(null),[r,o]=(0,U.useState)(e??null),a=(0,U.useCallback)(i=>{n(i),i&&e===void 0&&o(_n(i))},[e]);return ee(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=u=>o(g=>g!==null&&Math.abs(g-u)<.5?g:u),s=()=>i(_n(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let g=u[u.length-1]?.contentRect;g?i(g.width>0?Math.round(g.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var jo=()=>()=>{};function ze(){return(0,U.useSyncExternalStore)(jo,()=>!0,()=>!1)}var In="(prefers-reduced-motion: reduce)";function zn(e="auto"){let[t,n]=(0,U.useState)(()=>ne&&typeof window.matchMedia=="function"?window.matchMedia(In).matches:!1);return(0,U.useEffect)(()=>{if(e!=="auto"||!ne||typeof window.matchMedia!="function")return;let r=window.matchMedia(In),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}function Hn(e,t){let n=oe(e.theme),[r,o,a]=Bn(e.width),i=ze(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,g=zn(e.reducedMotion??"auto"),m=e.animate!==!1&&!g&&ne,h=On(r,e.animateOnView!==!1&&m),y=J(e.locale),c=H(y),d=(0,I.useMemo)(()=>Re(e.format,y,t.format),[e.format,y,t.format]),w=(0,I.useCallback)(E=>Ae(E,{locale:y}),[y]),k=(0,I.useMemo)(()=>It(d,e.unit),[d,e.unit]),M=(0,I.useMemo)(()=>on(e.data),[e.data]),[A,C]=(0,I.useState)(null),[$,O]=(0,I.useState)(null),W=(0,I.useRef)([]),q=(0,I.useRef)(e.onHover);q.current=e.onHover;let B=(0,I.useRef)(e.onClick);B.current=e.onClick;let p=(0,I.useRef)(null),b=(0,I.useRef)(null),S=(0,I.useRef)(null),D=(0,I.useCallback)((E,te="pointer")=>{if(S.current!==E){S.current=E;let Ke=E===null?null:W.current[E]??null;queueMicrotask(()=>q.current?.(Ke)),b.current?.(E)}p.current=E===null?null:te,C(E),O(p.current)},[]),x=(0,I.useCallback)(E=>{p.current!=="keyboard"&&(p.current=E===null?null:"sync",C(E),O(p.current))},[]),R=(0,I.useCallback)(E=>{let te=W.current[E];te&&B.current?.(te)},[]),P=Xt(e.replayKey),K=e.width!==void 0||(a??0)>0,fe={enabled:m,active:h.visible&&K,near:h.near,replayKey:P,dataKey:M,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},pe=(0,I.useCallback)((E,te=1)=>A===null||A===E?te:te*.38,[A]);return{p:n,width:s,height:u,measured:K,responsive:e.width===void 0,pending:ne&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:fe,fv:k,fmt:d,pct:w,locale:y,lang:c,t:c==="ko"?Ft:Nt,active:A,via:$,setActive:D,click:R,events:W,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:pe,sig:M,description:e.description,reduced:g,publish:b,applySync:x}}var _=T(z(),1);function Vo(e){return 1-Math.pow(1-e,3)}function Wo(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ko(e){return e==="easeInOut"?Wo:e==="linear"?t=>t:Vo}function Go(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 ge(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 He(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 jn(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 Vn(e,t,n,r){if(!t||!n||t.length!==n.length)return ge(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 ge(s,n[i]))o.push(l)}return o.length===r?o:ge(e,r)}var je=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||!He(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),jn(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=He(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=Vn(s.cur,s.parts,i.parts,u),s.vel=Vn(s.curVel,s.parts,i.parts,u),s.parts=i.parts,s.to=i.to.slice(),jn(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=He(s.from,s.to)&&s.vel.every(g=>Math.abs(g)<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=He(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=ge(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=Ko(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=ge(s.from,u)),s.vel.length!==u&&(s.vel=ge(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 g;if(this.easing==="spring"){let m=Math.exp(-a*l),h=a*l>=8&&a*l<20,y=0;for(let c=0;c<u;c++){let d=s.from[c]-s.to[c],w=s.vel[c]+a*d;s.cur[c]=s.to[c]+(d+w*l)*m,s.curVel[c]=(s.vel[c]-a*w*l)*m,h&&y<.15&&(y=Math.max(y,Math.abs(s.cur[c]-s.to[c]),Math.abs(s.curVel[c]/a)))}g=a*l>=20||h&&y<.15,s.progress=Math.min(1,1-(1+a*l)*m)}else{let m=Math.min(1,l/o),h=r(m),y=Go(this.easing,m)/o;for(let c=0;c<u;c++)s.cur[c]=s.from[c]+(s.to[c]-s.from[c])*h,s.curVel[c]=(s.to[c]-s.from[c])*y;g=m>=1,s.progress=h}if(g){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}},Ce=new Set,Ve=0;function Wn(e){Ve=0;let t=Array.from(Ce);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ce.delete(n)}Ce.size&&typeof requestAnimationFrame<"u"&&(Ve=requestAnimationFrame(Wn))}function Kn(e){return Ce.add(e),!Ve&&typeof requestAnimationFrame<"u"&&(Ve=requestAnimationFrame(Wn)),()=>{Ce.delete(e)}}function Uo(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 Gn(e,t){let n=(0,_.useMemo)(()=>Uo(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:u=900,stagger:g=0}=t,m=(0,_.useRef)(null),h=(0,_.useRef)("init"),y=(0,_.useRef)(null),c=(0,_.useRef)(s),d=(0,_.useRef)(i),w=(0,_.useRef)(!1),k=(0,_.useRef)(0),[,M]=(0,_.useState)(0),A=(0,_.useRef)(null),C=(0,_.useRef)(!0);m.current||(m.current=new je,m.current.configure(l,u),m.current.snap(n),y.current=n);let $=m.current;if($.configure(l,u),y.current!==n){let b=h.current,S=!Object.is(c.current,s);$.sameTargets(n)?$.refreshData(n):!r||b==="init"?$.snap(n):b==="idle"?$.hold(n):b==="running"||S?$.update(n,Te(),g):$.snap(n),y.current=n,c.current=s}let O=(0,_.useRef)(()=>!1);O.current=b=>{if(!C.current)return!1;let S=$.step(b);return!S&&h.current==="running"&&(h.current="done"),M(D=>(D+1)%1e9),S||(A.current=null),S};let W=(0,_.useCallback)(()=>{if(!ne||A.current||!$.animating)return;let b=S=>O.current(S);A.current=Kn(b)},[$]);ee(()=>{let b=!Object.is(d.current,i);if(d.current=i,!r){(h.current!=="done"||$.animating)&&($.snap(y.current??n),h.current="done",M(S=>S+1));return}h.current==="init"||b&&a?($.hold(y.current??n),h.current="idle",w.current=!1,M(S=>S+1)):b&&(w.current=!0)},[r,i]),ee(()=>{!r||!a||!w.current||(w.current=!1,$.hold(y.current??n),h.current="idle",M(b=>b+1))},[a,r]),(0,_.useEffect)(()=>{r&&o&&h.current==="idle"&&($.start(Te()),k.current+=1,h.current="running",W(),M(b=>b+1))},[r,o,i,$,W]),(0,_.useEffect)(()=>{$.animating&&W()}),(0,_.useEffect)(()=>(C.current=!0,()=>{C.current=!1,A.current?.(),A.current=null}),[]);let q=Te(),B=$.elapsed(q),p=r&&h.current==="idle";return{items:$.items(),get:b=>$.get(b),elapsed:p?0:B,fade:(b,S=320)=>p?0:Number.isFinite(B)?Math.max(0,Math.min(1,(B-b)/S)):1,waiting:p,animating:$.animating,generation:k.current}}var qo=T(z(),1);var qn=T(F(),1);var Un=e=>e?"neutralStrong":"accent";var ht=T(F(),1);function Yn(e,t,n,r){if(typeof e!="function")return ie(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 Yo=T(z(),1);var pt=T(F(),1),Xo={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`},Xn={en:Xo,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}일 이동평균`}},gt=["ink","muted","dim"];function Jn(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,gt.length)}var Jo=T(z(),1);var tr=T(F(),1),Zo={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Qo={en:Zo,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Zn=(e,t)=>Qo[e].other(t);function Qn(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,wn(o.map(a=>a.value)))}}var er=e=>Number.isFinite(e)&&e>0?e:0;var We=T(z(),1);var V=T(F(),1),ea={kind:"Ridgeline",med:"Median",n:"Sample size",count:e=>`${e}`,summary:(e,t)=>`median ${e} (${ce(t,"value")})`,median:(e,t)=>`${e} median ${t}`,groups:e=>ce(e,"group")},ta={en:ea,ko:{kind:"릿지라인",med:"중앙값",n:"표본",count:e=>`${e}개`,summary:(e,t)=>`중앙값 ${e}(${t}개)`,median:(e,t)=>`${e} 중앙값 ${t}`,groups:e=>`그룹 ${e}개`}},bt=72;function yt(e){let t=(0,We.useMemo)(()=>ve(e.data.map((p,b)=>me(e.group,"group")(p,b))),[e.data,e.group]),n=Hn(e,{height:()=>Math.max(180,Math.min(380,t.length*36+60)),duration:900,stagger:90}),{p:r,width:o,height:a}=n,i=ta[n.lang],s=(0,We.useMemo)(()=>{let p=me(e.group,"group"),b=Ee(e.value,"value"),S=new Map;e.data.forEach((L,Q)=>{let be=b(L,Q);if(!Number.isFinite(be))return;let kt=p(L,Q),vt=S.get(kt);vt?vt.push(be):S.set(kt,[be])});let D=t.filter(L=>S.has(L)),x=[...S.values()].flat(),[R,P]=En(x),K=Dn(R,P,4,{zero:!1,pad:.06}),fe=Array.from({length:bt},(L,Q)=>K[0]+(K[1]-K[0])*Q/(bt-1)),pe=new Map(D.map(L=>[L,we([...S.get(L)].sort((Q,be)=>Q-be),.5)]));e.sort==="median"&&(D=[...D].sort((L,Q)=>pe.get(L)-pe.get(Q)));let E=D.map((L,Q)=>({g:Q,name:L,dens:$n(S.get(L),fe,e.bandwidth),median:pe.get(L),n:S.get(L).length,hi:!1,datum:null})),te=ie(e.highlight,D,D,E.map(L=>L.median),"max");E.forEach(L=>L.hi=te.has(L.g));let Ke=Math.max(...E.flatMap(L=>L.dens),1e-9);return{ridges:E,dom:K,xsv:fe,peak:Ke}},[e.data,e.group,e.value,e.bandwidth,e.sort,e.highlight,t]),l=Math.min(o*.26,Math.max(...s.ridges.map(p=>Be(p.name,11.5,700)),20)+10),u=20,g=8,m=Math.max(1,s.ridges.length),h=Math.max(1e-6,e.overlap??1.5),y=(a-g-u)/(m-1+h),c=y*h,d=Ln(s.dom,[l+8,o-8]),w=p=>g+c+y*p,k=n.motion.stagger??90,M=(0,We.useMemo)(()=>s.ridges.map((p,b)=>({key:`r:${p.name}`,to:p.dens.map(S=>S/s.peak*c),from:p.dens.map(()=>0),enter:p.dens.map(()=>0),delay:b*k,data:p})),[s,c,k]),A=Gn(M,n.motion),C=Zt(r,"accent"),$=s.ridges.map(p=>({datum:null,index:p.g,key:p.name,label:p.name,value:p.median,formatted:i.summary(n.fv(p.median),p.n)})),O=null;if(n.active!==null&&s.ridges[n.active]){let p=s.ridges[n.active];O={x:d(p.median),y:w(p.g)-c*.6,title:p.name,rows:[{label:i.med,value:n.fv(p.median),color:p.hi?C.fill:r.paint("neutralStrong")},{label:i.n,value:i.count(p.n)}]}}let W=d.ticks(Math.max(2,Math.round(o/110))),q=n.motion.duration??900,B=e.description??`${i.kind}. ${i.groups(m)}: ${s.ridges.map(p=>i.median(p.name,n.fv(p.median))).join(", ")}.`;return(0,V.jsxs)(Tn,{c:n,kind:i.kind,ariaLabel:e.ariaLabel,description:B,events:$,tip:O,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(p,b,S)=>{let D=Cn(s.xsv,d.invert(p)),x=-1;for(let R=s.ridges.length-1;R>=0;R--){let P=w(R),K=(s.ridges[R].dens[D]??0)/s.peak*c;if(b<=P+1&&b>=P-K-1){x=R;break}}x<0&&(x=Math.max(0,Math.min(m-1,Math.ceil((b-g-c)/y)))),x!==n.active&&n.setActive(x,S.pointerType==="touch"?"touch":"pointer")},children:[(0,V.jsx)("g",{"aria-hidden":"true",children:W.map(p=>(0,V.jsxs)("g",{children:[(0,V.jsx)("line",{x1:d(p),x2:d(p),y1:g,y2:a-u,stroke:r.paint("line")}),(0,V.jsx)(dt,{x:d(p),y:a-u+11,anchor:"middle",size:Fn,fill:r.paint("muted"),children:n.fmt(p)})]},p))}),A.items.map(p=>{let b=p.data,S=w(b.g),D=p.v.map((K,fe)=>`${d(s.xsv[fe]).toFixed(2)},${(S-K).toFixed(2)}`),x=`M${d(s.xsv[0]).toFixed(2)},${S}L${D.join("L")}L${d(s.xsv[bt-1]).toFixed(2)},${S}Z`,R=`M${D.join("L")}`,P=n.active===b.g;return(0,V.jsxs)("g",{className:"ztd-mark",opacity:p.exiting?.4:n.dim(b.g),children:[(0,V.jsx)("path",{d:x,fill:b.hi?C.fill:r.paint("neutral"),fillOpacity:b.hi?.88:.92}),(0,V.jsx)("path",{d:R,fill:"none",stroke:b.hi?C.fill:P?r.paint("ink"):r.paint("neutralStrong"),strokeWidth:b.hi||P?1.8:1.2,strokeLinejoin:"round"}),(0,V.jsx)("line",{x1:l+8,x2:o-8,y1:S,y2:S,stroke:r.paint("line2")})]},p.key)}),s.ridges.map(p=>(0,V.jsxs)("g",{pointerEvents:"none",children:[(0,V.jsx)(dt,{x:l,y:w(p.g)-6,anchor:"end",size:11.5,weight:p.hi?800:600,fill:r.paint(p.hi?"ink":"muted"),children:Nn(p.name,l-4,11.5,700)}),(0,V.jsx)("line",{x1:d(p.median),x2:d(p.median),y1:w(p.g)-5,y2:w(p.g),stroke:r.paint(p.hi?"onAccent":"ink"),strokeWidth:1.6,opacity:A.fade(p.g*k+q*.6,260)})]},p.name))]})}var ue=T(F(),1);function nr(e,t){let n=_e(e);return n?.type==="scatter"&&t?.size!==void 0?_e("bubble"):n}function na(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 ra(e,t,n,r=!1){let o=nr(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&ct.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),u=m=>m.filter(h=>!l.has(h.label)),g=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(g.includes(o.type)){let m=me(a.label,"label"),h=Ee(a.value,"value"),y=o.type==="waffle",c=t.map((C,$)=>({r:C,label:m(C,$),value:y?h(C,$):er(h(C,$))})),{kept:d,other:w}=y?{kept:c,other:null}:Qn(c,i.other,(C,$)=>({r:{},label:Zn(H(n),C),value:$})),k=ie(s,d.map(C=>C.r),d.map(C=>C.label),d.map(C=>C.value),y?"first":"max"),M=w?[...d,w]:d,A=xe(M.length,k);return M.map((C,$)=>({label:C.label,color:A[$]}))}if(o.type==="candlestick"){let m=Jn(Array.isArray(i.ma)?i.ma:void 0,t.length),h=Xn[H(n)];return[{label:h.up,color:i.upColor??"accent"},{label:h.down,color:i.downColor??"neutralStrong"},...m.map((y,c)=>({label:h.maLegend(y),color:gt[c],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let m=me(a.series,"series"),h=ve(t.map((c,d)=>m(c,d)));if(h.length<2)return[];let y=Qt(h.length,Yn(s,t,h,m));return u(h.map((c,d)=>({label:c,color:y[d],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 d=me(a.series,"series");m=ve(t.map((w,k)=>d(w,k)))}let h=mt(o.type,a,i);if(h.length){let d=xe(m.length,ie(s,m,m,m.map(()=>0),"none")),w=m.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:m.map((k,M)=>({label:k,color:d[M]}));return[...u(w),...h.map((k,M)=>({label:k,color:Un(M),shape:"line"}))]}if(m.length<2)return[];let y=ie(s,m,m,m.map(()=>0),"first");if(o.type==="line"||o.type==="radar")return u(m.map((d,w)=>({label:d,color:y.has(w)?"accent":"neutralStrong",shape:o.type==="line"?"line":"square"})));let c=xe(m.length,y);return u(m.map((d,w)=>({label:d,color:c[w]})))}return[]}function rr(e,t){let{spec:n}=e,r=nr(n.type,n.encoding),o=(0,$e.useMemo)(()=>Mn(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=yn(n,e.locale),s=J(i),l=H(s),u=an(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),g=kn(n),m=(0,$e.useMemo)(()=>g?fn(g,s):void 0,[g,s]),h=n.options?.hidden,y=Array.isArray(h)?h.map(String):[],c=y.join(""),[d,w]=(0,$e.useState)(null);if(!r)return(0,ue.jsx)(it,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??u.data,M=t[r.type],A={...n.options??{}},C={...na(r,n.encoding),...A,...m?{tooltip:m}:{},data:k,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},$=n.card?.legend==="toggle"&&xn(r.type,n.encoding??{},A),O=d&&d.base===c?d.hidden:y;$&&(C.hidden=O);let W=b=>w(S=>{let D=S&&S.base===c?S.hidden:y;return{base:c,hidden:D.includes(b)?D.filter(x=>x!==b):[...D,b]}}),q=C.height??220,B=a&&!k.length&&(u.loading||u.error||u.empty)?(0,ue.jsx)(it,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:q,locale:i}):(0,ue.jsx)(M,{...C});if(n.card){let b=n.card,S=b.legend==="auto"||b.legend==="toggle"?ra(n,k,s,$):b.legend,D=S?.length?$?(0,ue.jsx)(at,{items:S,hidden:O,onToggle:W,locale:i}):S:void 0,x=b.download?(0,ue.jsx)(dn,{data:k,columns:vn(n),filename:b.title??r.type,formats:Array.isArray(b.download)?b.download:void 0,locale:i}):void 0;B=(0,ue.jsx)(Jt,{number:b.number,title:b.title??bn(r,l),subtitle:b.subtitle,legend:D,actions:x,source:b.source||void 0,note:b.note||void 0,accent:b.accent,takeaway:b.takeaway,level:b.level,sample:b.sample,replay:b.replay!==!1,className:e.className,locale:i,children:B})}let p=e.theme??n.theme;return p&&(B=(0,ue.jsx)(Pe,{theme:p,children:B})),B}function oa({cfg:e,components:t}){let n=ze();return rr({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ar(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,or.hydrateRoot)(r,(0,xt.createElement)(Pe,{theme:o.theme,cssVars:!0},(0,xt.createElement)(oa,{cfg:o,components:{[e]:t}})))}ar("ridgeline",yt);})();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
(()=>{var ar=Object.create;var Ct=Object.defineProperty;var ir=Object.getOwnPropertyDescriptor;var sr=Object.getOwnPropertyNames;var lr=Object.getPrototypeOf,ur=Object.prototype.hasOwnProperty;var Ge=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var cr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of sr(t))!ur.call(e,o)&&o!==n&&Ct(e,o,{get:()=>t[o],enumerable:!(r=ir(t,o))||r.enumerable});return e};var L=(e,t,n)=>(n=e!=null?ar(lr(e)):{},cr(t||!e||!e.__esModule?Ct(n,"default",{value:e,enumerable:!0}):n,e));var W=Ge((oa,$t)=>{$t.exports=globalThis.__ztdReact.react});var Tt=Ge((aa,St)=>{St.exports=globalThis.__ztdReact["react-dom/client"]});var B=Ge((pa,qt)=>{qt.exports=globalThis.__ztdReact["react/jsx-runtime"]});var xt=L(W(),1),er=L(Tt(),1);var Ce=L(W(),1);var Ee=L(W(),1);var Mt=L(W(),1),Te=(0,Mt.createContext)(void 0);var fr=L(W(),1);var mr=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],At='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Rt='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',le={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:At,monoFamily:Rt,radius:18,radiusCode:14,radiusMark:4},dr={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:At,monoFamily:Rt,radius:18,radiusCode:14,radiusMark:4},Ue={dark:le,light:dr};function Ye(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function qe(e){let t={};for(let n of mr){let r=e[n];typeof r=="string"&&(t[Ye(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 Xe(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 hr=`
|
|
2
|
+
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
|
+
.ztd-root:focus{outline:none}
|
|
4
|
+
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${le.accent});outline-offset:3px;border-radius:6px}
|
|
5
|
+
.ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
|
|
6
|
+
.ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
|
|
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)}
|
|
8
|
+
.ztd-guide{transition:transform .2s cubic-bezier(.22,1,.36,1)}
|
|
9
|
+
.ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
|
|
10
|
+
.ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
|
|
11
|
+
.ztd-btn:focus{outline:none}
|
|
12
|
+
.ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${le.accent});outline-offset:2px}
|
|
13
|
+
.ztd-card{transition:border-color .16s ease}
|
|
14
|
+
.ztd-card:hover{border-color:var(--ztd-dim,${le.dim})}
|
|
15
|
+
@media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
|
|
16
|
+
@keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
|
|
17
|
+
@keyframes ztd-fade{from{opacity:0}to{opacity:1}}
|
|
18
|
+
.ztd-pop{transform-box:fill-box;transform-origin:center}
|
|
19
|
+
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
|
+
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
|
+
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
+
`;var Lt=!1;function xe(){if(Lt||typeof document>"u"||(Lt=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=hr,document.head.appendChild(e)}var Me=L(W(),1),oe=typeof window<"u"&&typeof document<"u",re=oe?Me.useLayoutEffect:Me.useEffect;function Ae(){return typeof performance<"u"?performance.now():Date.now()}function K(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function ue(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Nt={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Pt={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var gr=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],pr={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function yr(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function br(e){return yr(gr,e)}function Ft(e,t){let n=br(e);return{text:n?n[t]:e,...pr[n?.id??"basic"]}}var Q=L(W(),1);var It=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ae="en-US",Dt=new Map;function Je(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=Dt.get(r);return o||(o=new Intl.NumberFormat(e,n),Dt.set(r,o)),o}function Ze(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Qe(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ae,...r}=t;return Ze(Je(n,r).format(e))}var Bt=e=>e!==0&&Math.abs(e)<.05,zt=(e,t,n="")=>`${Qe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Re(e,t={}){if(!Number.isFinite(e))return"-";if(Bt(e)&&t.maximumFractionDigits===void 0)return zt(e,t.locale??ae,"%");let n=Math.abs(e);return`${Qe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function xr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ae,...r}=t;if(K(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,m]=a[i],u=o/s,y=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),d=Math.round(u*10**y)/10**y;if(i>0&&d>=a[i-1][0]/s){i--;continue}return(e<0&&d!==0?"-":"")+Qe(d,{locale:n,...r,maximumFractionDigits:y})+m}}return Ze(Je(n,{notation:"compact",...r}).format(e))}var kr=(e,t=K(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Le(e,t=ae,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Je(t,o);return m=>Number.isFinite(m)?`${i}${Ze(s.format(m))}${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=>Re(o,{locale:t});case"ratio":return o=>Re(o*100,{locale:t});case"compact":return o=>xr(o,{locale:t});case"currency":return r(kr(t));default:{let o=r({maximumFractionDigits:1});return a=>Bt(a)?zt(a,t):o(a)}}}function vr(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var wr=e=>Number.isInteger(e)&&e>=1e3&&e<=9999;var Cr=["january","february","march","april","may","june","july","august","september","october","november","december"],Et=e=>{let t=e.toLowerCase();return t.length<3?0:Cr.findIndex(n=>n.startsWith(t))+1},_t=e=>+e+(+e<30?2e3:1900);function Ht(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var $r=[/^(\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})일)?$/],Sr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,jt=/\{([^{}]+)\}/g;function Tr(e,t){let n;for(let r of $r)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?[_t(n[3]),+n[2],+n[1],1]:[_t(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=Sr.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=Et(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=Et(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}function Vt(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(wr(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Vt(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Tr(n,t);if(r)return vr(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 Ot=new Map;function Wt(e,t={month:"short",day:"numeric"}){let n=Vt(e);if(!n)return"-";let{locale:r=ae,...o}=t,a=r+JSON.stringify(o),i=Ot.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Ot.set(a,i)),i.format(n)}var Kt={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Gt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Kt[t.toLowerCase()]&&(t=Kt[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 Mr(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 et(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ar(e){return[et(e[0]),et(e[1]),et(e[2])]}function tt(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 Ut(e){let[t,n,r]=Ar(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 Rr([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[tt(4.0767416621*o-3.3077115913*a+.2309699292*i),tt(-1.2684380046*o+2.6097574011*a-.3413193965*i),tt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Yt(e,t,n){let r=Gt(e),o=Gt(t);if(!r||!o)return e;let a=Ut(r),i=Ut(o),s=Math.max(0,Math.min(1,n));return Mr(Rr([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 nt=L(B(),1),Ne=(0,Q.createContext)({theme:le,cssVars:!0});function Lr(e,t=le){return e?typeof e=="string"?Ue[e]??t:Xe(t,e):t}function Fe(e){let t=(0,Q.useContext)(Ne),n=e.base?Ue[e.base]:t.theme,r=(0,Q.useMemo)(()=>Lr(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,Q.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,Q.useMemo)(()=>qe(r),[r]),m=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,nt.jsx)(Ne.Provider,{value:i,children:(0,nt.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:m,children:e.children})})}var Nr=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Pe(e){return Nr.has(e)}function Pr(e,t){let n=r=>t?`var(${Ye(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Pe(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Pe(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)})`:Yt(e[r],e[o],a)}}}function ie(e){let t=(0,Q.useContext)(Ne);return(0,Q.useMemo)(()=>{let n=Xe(t.theme,e);return Pr(n,t.cssVars)},[t.theme,t.cssVars,e])}function ee(e){let t=(0,Q.useContext)(Ne);return e??t.locale??ae}function Xt(e){return e?qe(e):{}}var De=L(W(),1),rt=(0,De.createContext)(void 0);function Jt(e){let t=(0,De.useContext)(rt);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var v=L(B(),1),Fr={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`},Dr={en:Fr,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Er={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},ot=e=>Dr[K(ee(e))];function at(e){let t=ie(e.theme),n=ot(e.locale),[r,o]=(0,Ee.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),m=e.items.filter(y=>!s.has(y.label)).length,u=(0,v.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((y,d)=>{let p=!s.has(y.label),g=p&&m===1,f=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(_r,{p:t,item:y,off:!p}),(0,v.jsx)("span",{style:p?void 0:{textDecoration:"line-through"},children:y.label})]});return(0,v.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,v.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":p,"aria-disabled":g||void 0,onClick:()=>{g||(i(y.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:g?"default":void 0},children:f}):f},d)})});return i?(0,v.jsxs)(v.Fragment,{children:[u,(0,v.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Er,children:r?n.shown(m,e.items.length):""})]}):u}function _r({p:e,item:t,off:n}){let r=t.color?Pe(t.color)?e.paint(t.color):t.color:e.paint("neutral"),o=t.shape??"square";return o==="line"||o==="dash"?(0,v.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,v.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,v.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,v.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 Or(e){let t=ie(e.theme),n=Ft(e.level,K(ee(e.locale)));return(0,v.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 Ir(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,v.jsxs)(v.Fragment,{children:[e.slice(0,r),(0,v.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Zt(e){let t=ie(e.theme),n=ot(e.locale),[r,o]=(0,Ee.useState)(0);re(()=>xe(),[]);let a=()=>{o(p=>p+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,v.jsx)(at,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",m=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,u=e.replay||e.onReplay,y=e.source!==void 0||e.note!==void 0?(0,v.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,d=e.takeaway!==void 0||e.level||e.sample?(0,v.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,v.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,v.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,v.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,v.jsx)(Or,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,v.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,v.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,v.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[m?(0,v.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:m}):null,(0,v.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:Ir(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,v.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,v.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,v.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,v.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,v.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,v.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,v.jsx)("span",{}),i]}):null]}),(0,v.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,v.jsx)(rt.Provider,{value:r,children:(0,v.jsx)(Te.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),y?(0,v.jsxs)(v.Fragment,{children:[y,d]}):d]})}function it(e){let t=ie(e.theme),n=ot(e.locale),r=e.height??220;if(re(()=>xe(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,v.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,v.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,v.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,v.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,v.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,v.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,v.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,v.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,v.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,v.jsx)(v.Fragment,{children:e.children})}function ce(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 y=-1,d=u==="max"?-1/0:1/0;r.forEach((p,g)=>{Number.isFinite(p)&&(u==="max"?p>d:p<d)&&(d=p,y=g)}),y>=0&&a.add(y)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((u,y)=>{y<i&&u!==null&&u!==void 0&&e(u,y)&&a.add(y)}),a;let m=Array.isArray(e)?e:[e];for(let u of m)typeof u=="number"?u>=0&&u<i&&a.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((y,d)=>{y===u&&a.add(d)});return a}function Qt(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 ke(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 en(e,t){return ke(e+1,t).slice(0,e)}function tn(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Br(e,t){if(e==null||typeof e!="object")return;let n=e;if(tn(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!tn(r,o))return;r=r[o]}return r}}function ve(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 nn(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Br(r,n)}function _e(e,t){let n=nn(e,t);return(r,o)=>ve(n(r,o))}function he(e,t){let n=nn(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 st(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var Z=L(W(),1);function zr(e){let t=[],n=!1;for(let m=0;m<e.length&&m<4e3;m++){let u=e[m];if(u==='"')n=!n;else if(!n&&(u===`
|
|
23
|
+
`||u==="\r"))break;t.push(n?"":u)}let r=t.join(""),o=m=>r.split(m).length-1,a=[","," ",";","|"],i=",",s=0;for(let m of a){let u=o(m);u>s&&(s=u,i=m)}return i}var Hr=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function rn(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Hr.test(t)||/^[-+]?\.\d+$/.test(t)){let n=ve(t);if(Number.isFinite(n))return n}return t}function ge(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??zr(o),i=[],s=[],m="",u=!1;for(let f=0;f<o.length;f++){let x=o[f];u?x==='"'?o[f+1]==='"'?(m+='"',f++):u=!1:m+=x:x==='"'&&!m.trim()?(u=!0,m=""):x===a?(s.push(m),m=""):x===`
|
|
24
|
+
`||x==="\r"?(x==="\r"&&o[f+1]===`
|
|
25
|
+
`&&f++,s.push(m),i.push(s),s=[],m=""):m+=x}(m!==""||s.length)&&(s.push(m),i.push(s));let y=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!y.length)return[];let d=f=>n?rn(f):f;if(!r)return y.map(f=>Object.fromEntries(f.map((x,M)=>[String(M),d(x)])));let p=[],g=new Set;return y[0].forEach((f,x)=>{let M=f.trim()||`col${x+1}`,w=M;for(let S=2;g.has(w);S++)w=`${M}_${S}`;g.add(w),p.push(w)}),y.slice(1).map(f=>Object.fromEntries(p.map((x,M)=>[x,d(f[M]??"")])))}function lt(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,m)=>[s,r&&typeof i[m]=="string"?rn(i[m]):i[m]??null])))}function jr(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,m)=>Object.fromEntries(a.map(u=>[u,e[u][m]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function on(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 me(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return me(JSON.parse(t))}catch{}return ge(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?lt(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)?me(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?lt(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)?me(t.rows):Array.isArray(t.values)?lt(t.values):Array.isArray(t.items)?me(t.items):Array.isArray(t.results)?me(t.results):jr(t)}return[]}function an(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 Vr(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(K(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return ge(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 ge(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):ge(a)}async function Wr(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 Vr(a,t.parse,o,t.locale)}return t.select&&(r=on(r,t.select)),t.transform?t.transform(r):me(r)}function sn(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,Z.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,m]=(0,Z.useState)(0),u=ee(t.locale),y=(0,Z.useRef)(t);y.current={...t,locale:u};let d=(0,Z.useRef)(e);d.current=e;let p=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",g=t.deps??[],f=JSON.stringify(g.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),x=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{let w=d.current;if(!w||!r){i(T=>T.status==="loading"?{...T,status:"idle"}:T);return}let S=new AbortController,F=!0;return x.current=!0,i(T=>({...T,data:o?T.data:[],status:"loading",error:null})),Wr(w,{...y.current,signal:S.signal}).then(T=>{F&&i({data:T,status:"success",error:null,updatedAt:Date.now()})}).catch(T=>{!F||S.signal.aborted||i(C=>({...C,status:"error",error:T instanceof Error?T:new Error(String(T))}))}).finally(()=>{F&&(x.current=!1)}),()=>{F=!1,x.current=!1,S.abort()}},[p,r,s,f,o]),(0,Z.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{x.current||m(S=>S+1)},n);return()=>clearInterval(w)},[n,r]);let M=(0,Z.useCallback)(()=>m(w=>w+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:M}}var ct=L(B(),1),Kr=["csv","svg","png"],Gr=/^[=+\-@\t\r\n=+-@]/,Ur=/var\(|color-mix\(/;function ln(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?Ht(e.getTime()):String(e);return`"${(Gr.test(t)&&!Number.isFinite(ve(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Yr(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function qr(e,t){return`\uFEFF${[t.map(ln),...e.map(r=>t.map(o=>ln(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
|
+
`)}\r
|
|
27
|
+
`}function Xr(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function ut(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var un=2,de=16;function cn(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function mn(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 dn(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,m]=[a+de*2,i+de*2],u=o.cloneNode(!0),y=u.querySelectorAll("*"),d=new Map;o.querySelectorAll("*").forEach((f,x)=>{let M;for(let w of Array.from(f.attributes)){if(!Ur.test(w.value))continue;let S=(M??(M=getComputedStyle(f))).getPropertyValue(w.name);S&&y[x].setAttribute(w.name,cn(S,d))}}),u.removeAttribute("style");for(let[f,x]of Object.entries({viewBox:`${-de} ${-de} ${s} ${m}`,width:s*t,height:m*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(x));let p=cn(getComputedStyle(r).backgroundColor,d),g=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(mn("rect",{x:-de,y:-de,width:s,height:m,fill:p}),f),g&&u.insertBefore(mn("image",{href:g.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:m,vw:a,vh:i,bg:p,canvas:g}}function Jr(e,t){let n=dn(e,un,!1);if(!n)return;let r=un,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,de*r,de*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(m=>m&&ut(m,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function fn(e){let t=ie(e.theme),n=K(ee(e.locale))==="ko",r=Xr(e.filename),o=(a,i)=>{if(a==="csv")return ut(new Blob([qr(e.data,e.columns?.length?e.columns:Yr(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Jr(i,r);let s=dn(i,1,!0);s&&ut(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,ct.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Kr.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,ct.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:m=>o(a,m.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var gn=L(B(),1);function hn(e,t=ae){let n=Le(void 0,t),r=e.split(`
|
|
28
|
+
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Wt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let m=!1,u=s.replace(jt,(y,d)=>o(a,d.trim())??(m=!0,""));m||i.push(u)}return i.length?i.map((s,m)=>(0,gn.jsx)("div",{children:s},m)):null}}var h=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),te=h("label","string",!0,"Item name field"),q=h("value","number",!0,"Value field"),Zr=[te,q],Qr=[te,q],eo=[h("label","string",!0,"Stage name"),h("value","number",!0,"Users at the stage")],to=[te,q],no=[h("label","string",!0,"Leaf (lowest level) name"),q,h("group","string",!1,"Parent group field")],ro=[h("label","string",!0,"Leaf name"),q,h("group","string",!1,"Parent group field")],oo=[te,h("value","number",!0,"Change (total rows may omit it)"),h("type","string",!1,'"total" makes a total bar')],ao=[te,q],io=[h("x","string",!0,"Column field"),h("series","string",!0,"Stacked series field"),q],so=[h("x","string",!0,"Column field"),h("y","string",!0,"Row field"),q],lo=[h("axis","string",!0,"Metric (axis) field"),h("value","number",!0,"Value field",{multi:!0}),h("series","string",!1,"Series field")],uo=[h("x","number",!0,"x value"),h("y","number",!0,"y value"),h("size","number",!1,"Circle size"),h("label","string",!1,"Name")],yn=h("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),co=[h("x","any",!0,"x field (date, number or category)"),h("y","number",!0,"y field. An array for wide tables",{multi:!0}),h("series","string",!1,"Series field (long tables)"),h("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),yn],mo=[h("x","any",!0,"x field"),h("y","number",!0,"y field. An array for wide tables",{multi:!0}),h("series","string",!1,"Series field"),h("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}),yn],fo=[h("x","any",!0,"x field"),h("y","number",!0,"y field",{multi:!0}),h("series","string",!1,"Series field")],ho=[h("x","string",!0,"Category field"),h("y","number",!0,"Value field. An array for wide tables",{multi:!0}),h("series","string",!1,"Series field"),h("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})],go=[te,q],po=[h("value","number",!0,"Value field",{prop:"valueKey"}),h("target","number",!1,"Target field",{prop:"targetKey"})],yo=[te,h("value","number",!0,"Actual value field"),h("target","number",!1,"Target field")],bo=[h("x","any",!1,"x field"),h("y","number",!0,"y field")],xo=[te,h("x","string",!1,"Period field (long tables)"),h("value","number",!1,"Value field (long tables)")],ko=[te,h("start","number",!0,"Before value"),h("end","number",!0,"After value")],vo=[te,q],wo=[h("value","number",!0,"Value field"),h("group","string",!1,"Group (row) field"),h("label","string",!1,"Dot name")],Co=[h("group","string",!0,"Group field"),h("value","number",!0,"Value field")],$o=[h("source","string",!0,"Source node"),h("target","string",!0,"Target node"),q],So=[h("source","string",!0,"Sending group"),h("target","string",!0,"Receiving group"),q],To=[h("date","date",!0,"Date field"),q],Mo=[h("x","any",!0,"Period field"),h("series","string",!0,"Item field"),h("rank","number",!1,"Rank field (1 is first)"),h("value","number",!1,"Value field (instead of rank, largest is first)")],Ao=[h("group","string",!0,"Group field"),h("value","number",!0,"Value field")],Ro=[h("label","string",!1,"Row name field")],Lo=[h("x","date",!0,"Date (period) field"),h("open","number",!0,"Open price field"),h("high","number",!0,"High price field"),h("low","number",!0,"Low price field"),h("close","number",!0,"Close price field"),h("volume","number",!1,"Volume field")],No=[te,q],Po=[h("x","any",!0,"Period field (date or category)"),h("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),h("series","string",!1,"Series field (long tables, back row only)"),h("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Fo=[h("value","number",!1,"Sample value field (raw rows)"),h("group","string",!1,"Group field. Up to 2 groups overlap"),h("x0","number",!1,"Bin start (pre-binned rows)"),h("x1","number",!1,"Bin end (pre-binned rows)"),h("count","number",!1,"Samples in the bin (pre-binned rows)")],Do=[h("x","number",!0,"x value"),h("y","number",!0,"y value"),h("series","string",!1,"Series field (one color per series)"),h("label","string",!1,"Name")],pn={pie:Zr,donut:Qr,funnel:eo,waffle:to,treemap:no,sunburst:ro,waterfall:oo,pareto:ao,marimekko:io,heatmap:so,radar:lo,bubble:uo,line:co,area:mo,stream:fo,bar:ho,radialBar:go,gauge:po,bullet:yo,sparkline:bo,slope:xo,dumbbell:ko,lollipop:vo,beeswarm:wo,ridgeline:Co,sankey:$o,chord:So,calendar:To,bump:Mo,box:Ao,parallel:Ro,candlestick:Lo,segmented:No,skyline:Po,histogram:Fo,scatter:Do},ye={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 bn(e,t){return t==="ko"?e.nameKo:e.name}function xn(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var mt=["line","area","bar","scatter"];function dt(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"?[].concat(t.line??[]).map(String):[]}function kn(e,t,n){return mt.includes(e)&&!dt(e,t,n).length}function vn(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Eo={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 Oe(e){let t=pn[e]?e:Eo[e]??Object.keys(ye).find(n=>n.toLowerCase()===e.toLowerCase()||ye[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!ye[t]))return{type:t,component:ye[t].component,name:ye[t].name,nameKo:ye[t].nameKo,encoding:pn[t]}}function wn(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 Oe(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 _o=Math.PI*2;function Ie(e,t,n){return e<t?t:e>n?n:e}function Cn(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function I(e){return Math.round(e*100)/100}function $n(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=Ie(a.tl??0,0,i),m=Ie(a.tr??0,0,i),u=Ie(a.br??0,0,i),y=Ie(a.bl??0,0,i);return`M${I(e+s)},${I(t)}H${I(e+n-m)}`+(m?`A${I(m)},${I(m)} 0 0 1 ${I(e+n)},${I(t+m)}`:"")+`V${I(t+r-u)}`+(u?`A${I(u)},${I(u)} 0 0 1 ${I(e+n-u)},${I(t+r)}`:"")+`H${I(e+y)}`+(y?`A${I(y)},${I(y)} 0 0 1 ${I(e)},${I(t+r-y)}`:"")+`V${I(t+s)}`+(s?`A${I(s)},${I(s)} 0 0 1 ${I(e+s)},${I(t)}`:"")+"Z"}function Sn(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 ge(t.csv)}return null}var X=L(W(),1);var E=L(B(),1),Be=60;var Tn={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Mn(e){let{c:t,events:n}=e,r=(0,X.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,re(()=>{xe()},[]);let i=n.length,s=!e.noNav&&i>0,m=(0,X.useContext)(Te),u=e.ariaLabel??m??e.kind,y=(0,X.useMemo)(()=>s?`${n.length}${n.slice(0,Be).map(c=>`${c.label}${c.series??""}${c.formatted??c.value??""}`).join("")}`:"",[n,s]),d=(0,X.useMemo)(()=>(0,E.jsx)(Oo,{label:u,events:n,t:t.t}),[u,y,t.t]),p=(0,X.useRef)(null);(0,X.useEffect)(()=>{let c=()=>{p.current=null};return window.addEventListener("scroll",c,{capture:!0,passive:!0}),window.addEventListener("resize",c,{passive:!0}),()=>{window.removeEventListener("scroll",c,{capture:!0}),window.removeEventListener("resize",c)}},[]),(0,X.useEffect)(()=>{p.current=null},[t.width,t.height]);let g=c=>{if(c.target!==c.currentTarget)return;if(e.onKey?.(c)){c.preventDefault();return}let l=t.active,b;switch(c.key){case"ArrowRight":case"ArrowDown":b=l===null?0:(l+1)%i;break;case"ArrowLeft":case"ArrowUp":b=l===null?i-1:(l-1+i)%i;break;case"Home":b=0;break;case"End":b=i-1;break;case"Escape":if(l===null)return;b=null;break;case"Enter":case" ":l!==null&&(c.preventDefault(),t.click(l));return;default:return}c.preventDefault(),t.setActive(b,"keyboard")},{via:f,node:x,setActive:M}=t;(0,X.useEffect)(()=>{if(f!=="touch"||!x)return;let c=l=>{x.contains(l.target)||M(null)};return document.addEventListener("pointerdown",c),()=>document.removeEventListener("pointerdown",c)},[f,x,M]);let w=t.active!==null?n[t.active]:null,S=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,F=S&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,T=typeof e.renderTip=="function"&&w?e.renderTip(w):null,C=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${i})`:""),V;if(S){let c=S.x*F,l=t.width*F,b=`clamp(${(4-c).toFixed(1)}px, -50%, calc(${(l-c-4).toFixed(1)}px - 100%))`,k=S.y<64;V={position:"absolute",left:c,top:S.y*F,transform:`translate(${b}, ${k?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*F-8)}}let U=c=>{p.current=null,c.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},_=c=>c?l=>{let b=p.current??(p.current=l.currentTarget.getBoundingClientRect());b.width&&c((l.clientX-b.left)/b.width*t.width,(l.clientY-b.top)/b.height*t.height,l)}:void 0,D=_(e.onPointerMove),O=_(e.onPointerDown),$=D||O?c=>{c.pointerType==="touch"&&D?.(c),O?.(c)}:void 0,P=_(e.onPointerUp),G=Xt(e.theme);return(0,E.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?g:void 0,onBlur:c=>{t.via==="keyboard"&&!c.currentTarget.contains(c.relatedTarget)&&t.setActive(null)},onPointerLeave:U,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"),...G,...e.style},children:[t.pending?null:e.underlay,(0,E.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:$,onPointerUp:P,onPointerCancel:P,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,E.jsx)("title",{id:o,children:u}),(0,E.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,E.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,S?(0,E.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:V,children:T??(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:S.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:S.title}),S.rows.map((c,l)=>(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,E.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(c.strong?"ink":"muted")},children:[c.color?(0,E.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:c.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,c.label]}),(0,E.jsx)("span",{style:{fontWeight:c.strong===!1?500:700},children:c.value})]},l))]})}):null,(0,E.jsx)("span",{className:"ztd-sr",style:Tn,"aria-live":"polite","aria-atomic":"true",children:C}),s&&!t.pending?d:null]})}function Oo({label:e,events:t,t:n}){return(0,E.jsx)("div",{className:"ztd-sr",style:Tn,children:(0,E.jsxs)("table",{children:[(0,E.jsx)("caption",{children:n.table(e)}),(0,E.jsxs)("tbody",{children:[t.slice(0,Be).map((r,o)=>(0,E.jsxs)("tr",{children:[(0,E.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,E.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Be?(0,E.jsx)("tr",{children:(0,E.jsx)("td",{colSpan:2,children:n.more(t.length-Be)})}):null]})]})})}function ft(e){let t=e.baseline??"central";return(0,E.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 Rn(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function An(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 ze=new Map;function se(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=ze.get(o);if(a===void 0){let i=0,s=0;for(let m=0;m<r.length;m++){let u=r.charCodeAt(m);Rn(u)?i+=An(u):s+=An(u)}a=i+s*(n>=600?1.07:1),ze.size>5e3&&ze.clear(),ze.set(o,a)}return a*t}function Ln(e,t,n,r=400){if(e=e.trim(),se(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let m=a+i+1>>1;se(e.slice(0,m)+o,n,r)<=t?a=m:i=m-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(Rn(s.charCodeAt(0))?2:3)?"":s+o}var j=L(W(),1);var J=L(W(),1);function Io(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Bo(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function Fn(e,t=!0){let[n,r]=(0,J.useState)({visible:!t,near:!t});return(0,J.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=Bo(i[i.length-1],.25);r(m=>m.visible===s?m:{...m,visible:s,near:m.near||s})},{threshold:Io(.25),rootMargin:"0px 0px -8% 0px"}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(m=>m.near===s.isIntersecting?m:{...m,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 Nn(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Dn(e){let[t,n]=(0,J.useState)(null),[r,o]=(0,J.useState)(e??null),a=(0,J.useCallback)(i=>{n(i),i&&e===void 0&&o(Nn(i))},[e]);return re(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=u=>o(y=>y!==null&&Math.abs(y-u)<.5?y:u),s=()=>i(Nn(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let m=new ResizeObserver(u=>{let y=u[u.length-1]?.contentRect;y?i(y.width>0?Math.round(y.width*10)/10:0):s()});return m.observe(t),()=>m.disconnect()},[t,e]),[t,a,r]}var zo=()=>()=>{};function He(){return(0,J.useSyncExternalStore)(zo,()=>!0,()=>!1)}var Pn="(prefers-reduced-motion: reduce)";function En(e="auto"){let[t,n]=(0,J.useState)(()=>oe&&typeof window.matchMedia=="function"?window.matchMedia(Pn).matches:!1);return(0,J.useEffect)(()=>{if(e!=="auto"||!oe||typeof window.matchMedia!="function")return;let r=window.matchMedia(Pn),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}function _n(e,t){let n=ie(e.theme),[r,o,a]=Dn(e.width),i=He(),s=e.width??(a||t.ssrWidth||480),m=typeof t.height=="function"?t.height(s):t.height,u=e.height??m,y=En(e.reducedMotion??"auto"),d=e.animate!==!1&&!y&&oe,p=Fn(r,e.animateOnView!==!1&&d),g=ee(e.locale),f=K(g),x=(0,j.useMemo)(()=>Le(e.format,g,t.format),[e.format,g,t.format]),M=(0,j.useCallback)(R=>Re(R,{locale:g}),[g]),w=(0,j.useMemo)(()=>It(x,e.unit),[x,e.unit]),S=(0,j.useMemo)(()=>an(e.data),[e.data]),[F,T]=(0,j.useState)(null),[C,V]=(0,j.useState)(null),U=(0,j.useRef)([]),_=(0,j.useRef)(e.onHover);_.current=e.onHover;let D=(0,j.useRef)(e.onClick);D.current=e.onClick;let O=(0,j.useRef)(null),$=(0,j.useRef)(null),P=(0,j.useRef)(null),G=(0,j.useCallback)((R,z="pointer")=>{if(P.current!==R){P.current=R;let Y=R===null?null:U.current[R]??null;queueMicrotask(()=>_.current?.(Y)),$.current?.(R)}O.current=R===null?null:z,T(R),V(O.current)},[]),c=(0,j.useCallback)(R=>{O.current!=="keyboard"&&(O.current=R===null?null:"sync",T(R),V(O.current))},[]),l=(0,j.useCallback)(R=>{let z=U.current[R];z&&D.current?.(z)},[]),b=Jt(e.replayKey),k=e.width!==void 0||(a??0)>0,A={enabled:d,active:p.visible&&k,near:p.near,replayKey:b,dataKey:S,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},N=(0,j.useCallback)((R,z=1)=>F===null||F===R?z:z*.38,[F]);return{p:n,width:s,height:u,measured:k,responsive:e.width===void 0,pending:oe&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:A,fv:w,fmt:x,pct:M,locale:g,lang:f,t:f==="ko"?Pt:Nt,active:F,via:C,setActive:G,click:l,events:U,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:N,sig:S,description:e.description,reduced:y,publish:$,applySync:c}}var H=L(W(),1);function Ho(e){return 1-Math.pow(1-e,3)}function jo(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Vo(e){return e==="easeInOut"?jo:e==="linear"?t=>t:Ho}function Wo(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 be(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 je(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 On(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 In(e,t,n,r){if(!t||!n||t.length!==n.length)return be(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 m of be(s,n[i]))o.push(m)}return o.length===r?o:be(e,r)}var Ve=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||!je(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),On(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=je(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),m=r>0?Math.min(a*r,240):0;if(s){let u=i.to.length;s.from=In(s.cur,s.parts,i.parts,u),s.vel=In(s.curVel,s.parts,i.parts,u),s.parts=i.parts,s.to=i.to.slice(),On(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):m),s.done=je(s.from,s.to)&&s.vel.every(y=>Math.abs(y)<1e-6),s.progress=s.done?1:0}else{let u=this.make(i,i.enter??i.from??i.to,n+m,0);u.done=je(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=be(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=Vo(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let m=(t-s.t0)/1e3,u=s.to.length;if(s.from.length!==u&&(s.from=be(s.from,u)),s.vel.length!==u&&(s.vel=be(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(m>0)){for(let d=0;d<u;d++)s.cur[d]=s.from[d],s.curVel[d]=0;s.progress=0,n=!0;continue}let y;if(this.easing==="spring"){let d=Math.exp(-a*m),p=a*m>=8&&a*m<20,g=0;for(let f=0;f<u;f++){let x=s.from[f]-s.to[f],M=s.vel[f]+a*x;s.cur[f]=s.to[f]+(x+M*m)*d,s.curVel[f]=(s.vel[f]-a*M*m)*d,p&&g<.15&&(g=Math.max(g,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}y=a*m>=20||p&&g<.15,s.progress=Math.min(1,1-(1+a*m)*d)}else{let d=Math.min(1,m/o),p=r(d),g=Wo(this.easing,d)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*p,s.curVel[f]=(s.to[f]-s.from[f])*g;y=d>=1,s.progress=p}if(y){for(let d=0;d<u;d++)s.cur[d]=s.to[d],s.curVel[d]=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}},we=new Set,We=0;function Bn(e){We=0;let t=Array.from(we);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||we.delete(n)}we.size&&typeof requestAnimationFrame<"u"&&(We=requestAnimationFrame(Bn))}function zn(e){return we.add(e),!We&&typeof requestAnimationFrame<"u"&&(We=requestAnimationFrame(Bn)),()=>{we.delete(e)}}function Ko(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 Hn(e,t){let n=(0,H.useMemo)(()=>Ko(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:m="spring",duration:u=900,stagger:y=0}=t,d=(0,H.useRef)(null),p=(0,H.useRef)("init"),g=(0,H.useRef)(null),f=(0,H.useRef)(s),x=(0,H.useRef)(i),M=(0,H.useRef)(!1),w=(0,H.useRef)(0),[,S]=(0,H.useState)(0),F=(0,H.useRef)(null),T=(0,H.useRef)(!0);d.current||(d.current=new Ve,d.current.configure(m,u),d.current.snap(n),g.current=n);let C=d.current;if(C.configure(m,u),g.current!==n){let $=p.current,P=!Object.is(f.current,s);C.sameTargets(n)?C.refreshData(n):!r||$==="init"?C.snap(n):$==="idle"?C.hold(n):$==="running"||P?C.update(n,Ae(),y):C.snap(n),g.current=n,f.current=s}let V=(0,H.useRef)(()=>!1);V.current=$=>{if(!T.current)return!1;let P=C.step($);return!P&&p.current==="running"&&(p.current="done"),S(G=>(G+1)%1e9),P||(F.current=null),P};let U=(0,H.useCallback)(()=>{if(!oe||F.current||!C.animating)return;let $=P=>V.current(P);F.current=zn($)},[C]);re(()=>{let $=!Object.is(x.current,i);if(x.current=i,!r){(p.current!=="done"||C.animating)&&(C.snap(g.current??n),p.current="done",S(P=>P+1));return}p.current==="init"||$&&a?(C.hold(g.current??n),p.current="idle",M.current=!1,S(P=>P+1)):$&&(M.current=!0)},[r,i]),re(()=>{!r||!a||!M.current||(M.current=!1,C.hold(g.current??n),p.current="idle",S($=>$+1))},[a,r]),(0,H.useEffect)(()=>{r&&o&&p.current==="idle"&&(C.start(Ae()),w.current+=1,p.current="running",U(),S($=>$+1))},[r,o,i,C,U]),(0,H.useEffect)(()=>{C.animating&&U()}),(0,H.useEffect)(()=>(T.current=!0,()=>{T.current=!1,F.current?.(),F.current=null}),[]);let _=Ae(),D=C.elapsed(_),O=r&&p.current==="idle";return{items:C.items(),get:$=>C.get($),elapsed:O?0:D,fade:($,P=320)=>O?0:Number.isFinite(D)?Math.max(0,Math.min(1,(D-$)/P)):1,waiting:O,animating:C.animating,generation:w.current}}var Go=L(W(),1);var Vn=L(B(),1);var jn=e=>e?"neutralStrong":"accent";var ht=L(B(),1);function Wn(e,t,n,r){if(typeof e!="function")return ce(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 m=o.get(r(i,s));m!==void 0&&e(i,s)&&a.add(m)}),a}var Uo=L(W(),1);var pt=L(B(),1),Yo={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}, ${ue(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Kn={en:Yo,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}일 이동평균`}},gt=["ink","muted","dim"];function Gn(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,gt.length)}var qo=L(W(),1);var Xn=L(B(),1),Xo={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ue(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Jo={en:Xo,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Un=(e,t)=>Jo[e].other(t);function Yn(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,Cn(o.map(a=>a.value)))}}var qn=e=>Number.isFinite(e)&&e>0?e:0;var pe=L(W(),1);function yt(e,t,n){let{width:r,height:o,nodeWidth:a=10,iterations:i=24,align:s="justify",x0:m=0,y0:u=0}=n,y=new Map,d=[],p=(l,b)=>{let k=y.get(l);return k?b&&(k.label=b):(k={id:l,label:b??l,index:d.length,depth:0,layer:0,value:0,x0:0,x1:0,y0:0,y1:0,inLinks:[],outLinks:[]},y.set(l,k),d.push(k)),k};e.forEach(l=>p(l.id,l.label));let g=[];t.forEach(l=>{if(!(l.value>0)||l.source===l.target)return;let b=p(l.source),k=p(l.target),A={index:g.length,source:b,target:k,value:l.value,width:0,y0:0,y1:0};g.push(A),b.outLinks.push(A),k.inLinks.push(A)});for(let l of d)l.value=Math.max(l.inLinks.reduce((b,k)=>b+k.value,0),l.outLinks.reduce((b,k)=>b+k.value,0));let f=d.filter(l=>!l.inLinks.length);f.length||(f=d.slice(0,1));let x=new Map,M=new Set,w=l=>{x.set(l,1);for(let b of l.outLinks){let k=x.get(b.target);k===1?M.add(b):k||w(b.target)}x.set(l,2)};[...f,...d].forEach(l=>x.has(l)||w(l));let S=new Map;f.forEach(l=>S.set(l,0));let F=!0,T=0;for(;F&&T++<d.length+1;){F=!1;for(let l of g){if(M.has(l))continue;let b=(S.get(l.source)??0)+1;b>(S.get(l.target)??-1)&&b<=d.length&&(S.set(l.target,b),F=!0)}}for(let l of d)l.depth=S.get(l)??0;let C=Math.max(0,...d.map(l=>l.depth));for(let l of d)l.layer=s==="justify"&&!l.outLinks.length?C:l.depth;let V=C+1,U=V>1?(r-a)/(V-1):0;for(let l of d)l.x0=m+l.layer*U,l.x1=l.x0+a;let _=Array.from({length:V},()=>[]);d.forEach(l=>_[l.layer].push(l));let D=Math.max(1,..._.map(l=>l.length)),O=Math.min(n.nodePadding??12,o/D*.6),$=Math.min(..._.filter(l=>l.length).map(l=>(o-(l.length-1)*O)/Math.max(1e-9,l.reduce((b,k)=>b+k.value,0))));for(let l of _){let b=u;for(let k of l)k.y0=b,k.y1=b+k.value*$,b=k.y1+O}for(let l of g)l.width=l.value*$;let P=l=>(l.y0+l.y1)/2,G=l=>{l.sort((A,N)=>A.y0-N.y0);let b=u;for(let A of l){let N=b-A.y0;N>0&&(A.y0+=N,A.y1+=N),b=A.y1+O}if(b-O-(u+o)>0){let A=u+o;for(let N=l.length-1;N>=0;N--){let R=l[N],z=R.y1-A;z>0&&(R.y0-=z,R.y1-=z),A=R.y0-O}}},c=1;for(let l=0;l<i;l++){c*=.99;let b=Math.pow(.99,l);for(let k=_.length-2;k>=0;k--){for(let A of _[k]){if(!A.outLinks.length)continue;let N=0,R=0;for(let Y of A.outLinks)R+=P(Y.target)*Y.value,N+=Y.value;let z=(R/N-P(A))*b;A.y0+=z,A.y1+=z}G(_[k])}for(let k=1;k<_.length;k++){for(let A of _[k]){if(!A.inLinks.length)continue;let N=0,R=0;for(let Y of A.inLinks)R+=P(Y.source)*Y.value,N+=Y.value;let z=(R/N-P(A))*b;A.y0+=z,A.y1+=z}G(_[k])}}for(let l of d){l.outLinks.sort((N,R)=>N.target.y0-R.target.y0),l.inLinks.sort((N,R)=>N.source.y0-R.source.y0);let b=l.outLinks.reduce((N,R)=>N+R.width,0),k=l.inLinks.reduce((N,R)=>N+R.width,0),A=l.y0+Math.max(0,(l.y1-l.y0-b)/2);for(let N of l.outLinks)N.y0=A+N.width/2,A+=N.width;A=l.y0+Math.max(0,(l.y1-l.y0-k)/2);for(let N of l.inLinks)N.y1=A+N.width/2,A+=N.width}return{nodes:d,links:g}}function Jn(e,t=1){let n=e.source.x1,r=n+(e.target.x0-n)*t,o=e.y0+(e.y1-e.y0)*t,a=(n+r)/2,i=e.width/2,s=m=>Math.round(m*100)/100;return`M${s(n)},${s(e.y0-i)}C${s(a)},${s(e.y0-i)} ${s(a)},${s(o-i)} ${s(r)},${s(o-i)}L${s(r)},${s(o+i)}C${s(a)},${s(o+i)} ${s(a)},${s(e.y0+i)} ${s(n)},${s(e.y0+i)}Z`}var ne=L(B(),1),Zo={kind:"Sankey diagram",total:"Total",in:"In",out:"Out",flow:"Flow",flows:e=>ue(e,"flow"),from:e=>`Share of ${e}`,desc:(e,t)=>`${ue(e,"node")}, ${ue(t,"flow")}. Largest flows`},Qo={en:Zo,ko:{kind:"생키 다이어그램",total:"합계",in:"들어옴",out:"나감",flow:"흐름",flows:e=>`흐름 ${e}개`,from:e=>`${e} 중 비중`,desc:(e,t)=>`노드 ${e}개, 흐름 ${t}개. 큰 흐름`}};function bt(e){let t=_n(e,{height:c=>Math.max(220,Math.min(340,c*.6)),duration:1e3,stagger:70}),{p:n,width:r,height:o}=t,a=Qo[t.lang],i=(0,pe.useMemo)(()=>{let c=he(e.source,"source"),l=he(e.target,"target"),b=_e(e.value,"value");return e.data.map((k,A)=>({source:c(k,A),target:l(k,A),value:b(k,A)||0,d:k}))},[e.data,e.source,e.target,e.value]),s=(0,pe.useMemo)(()=>yt([],i,{width:100,height:100,iterations:0}),[i]),m=s.nodes.filter(c=>c.layer===0),u=Math.max(0,...s.nodes.map(c=>c.layer)),y=s.nodes.filter(c=>c.layer===u&&u>0),d=Math.min(r*.22,Math.max(0,...m.map(c=>Math.max(se(c.label,11.5,700),se(t.fmt(c.value),10.5))))+10),p=Math.min(r*.22,Math.max(0,...y.map(c=>Math.max(se(c.label,11.5,700),se(t.fmt(c.value),10.5))))+10),g=(0,pe.useMemo)(()=>yt([],i,{width:Math.max(60,r-d-p),height:o-8,x0:d,y0:4,nodeWidth:e.nodeWidth??10,nodePadding:e.nodePadding??14}),[i,r,o,d,p,e.nodeWidth,e.nodePadding]),f=(0,pe.useMemo)(()=>{let c=g.nodes.map(k=>k.label);if(e.highlight!==void 0)return ce(e.highlight,g.nodes,c,g.nodes.map(k=>k.value));let b=g.nodes.filter(k=>k.layer===u).sort((k,A)=>A.value-k.value)[0];return new Set(b?[b.index]:[])},[g,e.highlight,u]),x=c=>f.has(c.source.index)||f.has(c.target.index),M=t.motion.stagger??70,w=t.motion.duration??1e3,S=(0,pe.useMemo)(()=>{let c=[];return g.nodes.forEach(l=>{let b=(l.y0+l.y1)/2;c.push({key:`n:${l.id}`,to:[l.y0,l.y1],from:[b,b],enter:[b,b],delay:l.layer*M*2,data:{node:l}})}),g.links.forEach((l,b)=>c.push({key:`l:${l.source.id}>${l.target.id}`,to:[1,l.y0,l.y1,l.width],from:[0,l.y0,l.y1,l.width],enter:[0,l.y0,l.y1,l.width],delay:w*.25+l.source.layer*M*3+b%6*25,data:{link:l}})),c},[g,M,w]),F=Hn(S,t.motion),T=Qt(n,"accent"),C=g.nodes.length,V=t.fv,U=(0,pe.useMemo)(()=>{let c=new Map;for(let l of i)c.has(`${l.source}>${l.target}`)||c.set(`${l.source}>${l.target}`,l.d);return[...g.nodes.map(l=>({datum:null,index:l.index,key:l.id,label:l.label,value:l.value,formatted:V(l.value)})),...g.links.map((l,b)=>({datum:c.get(`${l.source.id}>${l.target.id}`)??null,index:C+b,key:`${l.source.id}>${l.target.id}`,label:`${l.source.label} → ${l.target.label}`,value:l.value,formatted:V(l.value)}))]},[g,i,C,V]),_=null,D=t.active;if(D!==null)if(D<C){let c=g.nodes[D];c&&(_={x:(c.x0+c.x1)/2,y:c.y0,title:c.label,rows:[{label:a.total,value:t.fv(c.value),color:f.has(c.index)?T.fill:n.paint("neutralStrong")},...c.inLinks.length?[{label:a.in,value:a.flows(c.inLinks.length)}]:[],...c.outLinks.length?[{label:a.out,value:a.flows(c.outLinks.length)}]:[]]})}else{let c=g.links[D-C];c&&(_={x:(c.source.x1+c.target.x0)/2,y:(c.y0+c.y1)/2-c.width/2,title:`${c.source.label} → ${c.target.label}`,rows:[{label:a.flow,value:t.fv(c.value),color:x(c)?T.fill:n.paint("neutral")},{label:a.from(c.source.label),value:t.pct(c.value/(c.source.value||1)*100)}]})}let O=D!==null&&D<C?g.nodes[D]:null,$=D!==null&&D>=C?g.links[D-C]:null,P=c=>O?c.source===O||c.target===O?.75:.12:$?c===$?.8:.12:x(c)?.55:.32,G=e.description??`${a.kind}. ${a.desc(C,g.links.length)}: ${[...g.links].sort((c,l)=>l.value-c.value).slice(0,3).map(c=>`${c.source.label}→${c.target.label} ${t.fv(c.value)}`).join(", ")}.`;return(0,ne.jsxs)(Mn,{c:t,kind:a.kind,ariaLabel:e.ariaLabel,description:G,events:U,tip:_,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,ne.jsx)("g",{children:F.items.map(c=>{let l=c.data.link;if(!l)return null;let b=g.links.indexOf(l),[k,A,N,R]=c.v;if(k<=.001)return null;let z=x(l);return(0,ne.jsx)("path",{className:"ztd-mark",d:Jn({source:l.source,target:l.target,y0:A,y1:N,width:R},k),fill:z?T.fill:n.paint("neutralStrong"),opacity:P(l)*Math.min(1,k*1.5),onPointerEnter:Y=>t.setActive(C+b,Y.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(C+b)},c.key)})}),F.items.map(c=>{let l=c.data.node;if(!l)return null;let[b,k]=c.v,A=f.has(l.index),N=D===l.index,R=l.layer===0,z=l.layer===u&&u>0,Y=R?l.x0-8:l.x1+8,kt=R?"end":"start",nr=R?d-10:z?p-10:Math.max(40,(g.nodes.find(Ke=>Ke.layer===l.layer+1)?.x0??r)-l.x1-16),$e=(l.y0+l.y1)/2,Se=l.y1-l.y0>=26,rr=!R&&!z,vt=Ln(l.label,nr,11.5,700),or=Math.max(se(vt,11.5,800),Se?se(t.fmt(l.value),10.5):0)+10,wt=Se?32:18;return(0,ne.jsxs)("g",{onPointerEnter:Ke=>t.setActive(l.index,Ke.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(l.index),children:[(0,ne.jsx)("path",{d:$n(l.x0,b,l.x1-l.x0,Math.max(1,k-b),2),fill:A?T.fill:n.paint("ink"),stroke:N&&t.via==="keyboard"?n.paint("accent"):"none",strokeWidth:2}),t.showLabels?(0,ne.jsxs)("g",{opacity:F.fade(l.layer*M*2+w*.35,300),pointerEvents:"none",children:[rr?(0,ne.jsx)("rect",{x:I(Y-5),y:I($e-wt/2),width:or,height:wt,rx:6,fill:n.paint("panel"),opacity:.94}):null,(0,ne.jsx)(ft,{x:Y,y:Se?$e-7:$e,anchor:kt,size:11.5,weight:A||N?800:600,fill:n.paint("ink"),children:vt}),Se?(0,ne.jsx)(ft,{x:Y,y:$e+8,anchor:kt,size:10.5,fill:n.paint("muted"),children:t.fmt(l.value)}):null]}):null]},c.key)})]})}var fe=L(B(),1);function Zn(e,t){let n=Oe(e);return n?.type==="scatter"&&t?.size!==void 0?Oe("bubble"):n}function ea(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 ta(e,t,n,r=!1){let o=Zn(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,m=new Set(!r&&mt.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),u=d=>d.filter(p=>!m.has(p.label)),y=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(y.includes(o.type)){let d=he(a.label,"label"),p=_e(a.value,"value"),g=o.type==="waffle",f=t.map((T,C)=>({r:T,label:d(T,C),value:g?p(T,C):qn(p(T,C))})),{kept:x,other:M}=g?{kept:f,other:null}:Yn(f,i.other,(T,C)=>({r:{},label:Un(K(n),T),value:C})),w=ce(s,x.map(T=>T.r),x.map(T=>T.label),x.map(T=>T.value),g?"first":"max"),S=M?[...x,M]:x,F=ke(S.length,w);return S.map((T,C)=>({label:T.label,color:F[C]}))}if(o.type==="candlestick"){let d=Gn(Array.isArray(i.ma)?i.ma:void 0,t.length),p=Kn[K(n)];return[{label:p.up,color:i.upColor??"accent"},{label:p.down,color:i.downColor??"neutralStrong"},...d.map((g,f)=>({label:p.maLegend(g),color:gt[f],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let d=he(a.series,"series"),p=st(t.map((f,x)=>d(f,x)));if(p.length<2)return[];let g=en(p.length,Wn(s,t,p,d));return u(p.map((f,x)=>({label:f,color:g[x],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let d=[];if(Array.isArray(a.y))d=a.y;else if(typeof a.series=="string"){let x=he(a.series,"series");d=st(t.map((M,w)=>x(M,w)))}let p=dt(o.type,a,i);if(p.length){let x=ke(d.length,ce(s,d,d,d.map(()=>0),"none")),M=d.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:d.map((w,S)=>({label:w,color:x[S]}));return[...u(M),...p.map((w,S)=>({label:w,color:jn(S),shape:"line"}))]}if(d.length<2)return[];let g=ce(s,d,d,d.map(()=>0),"first");if(o.type==="line"||o.type==="radar")return u(d.map((x,M)=>({label:x,color:g.has(M)?"accent":"neutralStrong",shape:o.type==="line"?"line":"square"})));let f=ke(d.length,g);return u(d.map((x,M)=>({label:x,color:f[M]})))}return[]}function Qn(e,t){let{spec:n}=e,r=Zn(n.type,n.encoding),o=(0,Ce.useMemo)(()=>Sn(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=xn(n,e.locale),s=ee(i),m=K(s),u=sn(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),y=vn(n),d=(0,Ce.useMemo)(()=>y?hn(y,s):void 0,[y,s]),p=n.options?.hidden,g=Array.isArray(p)?p.map(String):[],f=g.join(""),[x,M]=(0,Ce.useState)(null);if(!r)return(0,fe.jsx)(it,{error:m==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let w=o??u.data,S=t[r.type],F={...n.options??{}},T={...ea(r,n.encoding),...F,...d?{tooltip:d}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},C=n.card?.legend==="toggle"&&kn(r.type,n.encoding??{},F),V=x&&x.base===f?x.hidden:g;C&&(T.hidden=V);let U=$=>M(P=>{let G=P&&P.base===f?P.hidden:g;return{base:f,hidden:G.includes($)?G.filter(c=>c!==$):[...G,$]}}),_=T.height??220,D=a&&!w.length&&(u.loading||u.error||u.empty)?(0,fe.jsx)(it,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:_,locale:i}):(0,fe.jsx)(S,{...T});if(n.card){let $=n.card,P=$.legend==="auto"||$.legend==="toggle"?ta(n,w,s,C):$.legend,G=P?.length?C?(0,fe.jsx)(at,{items:P,hidden:V,onToggle:U,locale:i}):P:void 0,c=$.download?(0,fe.jsx)(fn,{data:w,columns:wn(n),filename:$.title??r.type,formats:Array.isArray($.download)?$.download:void 0,locale:i}):void 0;D=(0,fe.jsx)(Zt,{number:$.number,title:$.title??bn(r,m),subtitle:$.subtitle,legend:G,actions:c,source:$.source||void 0,note:$.note||void 0,accent:$.accent,takeaway:$.takeaway,level:$.level,sample:$.sample,replay:$.replay!==!1,className:e.className,locale:i,children:D})}let O=e.theme??n.theme;return O&&(D=(0,fe.jsx)(Fe,{theme:O,children:D})),D}function na({cfg:e,components:t}){let n=He();return Qn({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function tr(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,er.hydrateRoot)(r,(0,xt.createElement)(Fe,{theme:o.theme,cssVars:!0},(0,xt.createElement)(na,{cfg:o,components:{[e]:t}})))}tr("sankey",bt);})();
|