ztd-charts-cli 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api.js +1 -1
- package/dist/{chunk-QVXYPBAX.js → chunk-4WXNLD5P.js} +54 -19
- 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/tileMap.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 Ta=Object.create;var tr=Object.defineProperty;var Sa=Object.getOwnPropertyDescriptor;var Aa=Object.getOwnPropertyNames;var Fa=Object.getPrototypeOf,Pa=Object.prototype.hasOwnProperty;var nn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Ra=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Aa(t))!Pa.call(e,o)&&o!==n&&tr(e,o,{get:()=>t[o],enumerable:!(r=Sa(t,o))||r.enumerable});return e};var R=(e,t,n)=>(n=e!=null?Ta(Fa(e)):{},Ra(t||!e||!e.__esModule?tr(n,"default",{value:e,enumerable:!0}):n,e));var X=nn((Ys,nr)=>{nr.exports=globalThis.__ztdReact.react});var or=nn((qs,rr)=>{rr.exports=globalThis.__ztdReact["react-dom/client"]});var O=nn((ml,Dr)=>{Dr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Hn=R(X(),1),ma=R(or(),1);var ht=R(X(),1);var Lt=R(X(),1);var ar=R(X(),1),Xe=(0,ar.createContext)(void 0);var cr=R(X(),1);var Na=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],ir='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',sr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',De={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:ir,monoFamily:sr,radius:18,radiusCode:14,radiusMark:4},rn={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:ir,monoFamily:sr,radius:18,radiusCode:14,radiusMark:4},on={dark:De,light:rn};function kt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function an(e){let t={};for(let n of Na){let r=e[n];typeof r=="string"&&(t[kt(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 sn(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 Da=`
|
|
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,${De.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,${De.accent});outline-offset:2px}
|
|
13
|
+
.ztd-card{transition:border-color .16s ease}
|
|
14
|
+
.ztd-card:hover{border-color:var(--ztd-dim,${De.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
|
+
`;function ur(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function mr(e,t){let[n]=(0,cr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var lr=!1;function it(){if(lr||typeof document>"u"||(lr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Da,document.head.appendChild(e)}var wt=R(X(),1),he=typeof window<"u"&&typeof document<"u",we=he?wt.useLayoutEffect:wt.useEffect;function vt(){return typeof performance<"u"?performance.now():Date.now()}var ve=R(X(),1),La=(0,ve.createContext)(void 0),$t=new Map;function Ea(e,t){let n=$t.get(e);return n||$t.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||$t.delete(e)}}function _a(e,t,n){$t.get(e)?.forEach(r=>r(t,n))}function Ia(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function dr(e,t,n,r){let o=(0,ve.useContext)(La),a=t??o,[i]=(0,ve.useState)(()=>({})),s=(0,ve.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=a?c=>_a(a,c===null||s.current.keys[c]===void 0?null:{key:s.current.keys[c],label:s.current.labels[c]},i):null;let l=e.applySync;(0,ve.useEffect)(()=>{if(a)return Ea(a,(c,d)=>{if(d===i)return;let u=c?Ia(s.current.keys,s.current.labels,c):-1;l(u<0?null:u)})},[a,i,l])}function Y(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ye(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var fr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},hr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var Oa=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Ba={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function za(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Ha(e){return za(Oa,e)}function gr(e,t){let n=Ha(e);return{text:n?n[t]:e,...Ba[n?.id??"basic"]}}var pr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function qe(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),pr[t.toLowerCase()]&&(t=pr[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 xr(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 cn(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function Ze(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function br(e){return .2126*Ze(e[0])+.7152*Ze(e[1])+.0722*Ze(e[2])}function un(e,t,n){let r=typeof e=="string"?qe(e):e,o=typeof t=="string"?qe(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?qe(n):n:null;o[3]<1&&a&&(o=cn(o,a));let i=r[3]<1?cn(r,o):r,s=br(i),l=br(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function ja(e){return[Ze(e[0]),Ze(e[1]),Ze(e[2])]}function ln(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 yr(e){let[t,n,r]=ja(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 Va([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[ln(4.0767416621*o-3.3077115913*a+.2309699292*i),ln(-1.2684380046*o+2.6097574011*a-.3413193965*i),ln(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Ct(e,t,n){let r=qe(e),o=qe(t);if(!r||!o)return e;let a=yr(r),i=yr(o),s=Math.max(0,Math.min(1,n));return xr(Va([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function mn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=un(a,e,n);i>o&&(o=i,r=a)}return r}function ee(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 fn(e,t){let n=mn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return un(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):mn(t,["#FFFFFF","#000000"])}function Mt(e,t){let n=Ct(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:fn(e,n),raw:n}}function $e(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ee(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=ee(e,"neutral");else if(s===0)r[i]=ee(e,"ink");else if(s===a-1)r[i]=ee(e,"neutral");else if(a===3)r[i]=ee(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?ee(e,"strong"):Mt(e,1-l)}}),r}var dn="mix:";function st(e){return e({theme:rn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${dn}${o}`}).map(n=>n.fill)}function kr(e,t){return t?.startsWith(dn)?e.mix("neutralStrong","neutral",Number(t.slice(dn.length))):e.color(t)}function wr(e,t,n){return $e(e,t+1,n).slice(0,t)}function vr(e,t,n,r="neutral"){let o=ee(e,"accent"),a=ee(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function $r(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ee(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=ee(e,"neutral"):s===0?r[i]=ee(e,"strong"):s===a-1?r[i]=ee(e,"neutral"):r[i]=Mt(e,1-s/(a-1))}),r}var ge=R(X(),1);var St=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ne="en-US",Cr=new Map;function hn(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=Cr.get(r);return o||(o=new Intl.NumberFormat(e,n),Cr.set(r,o)),o}function gn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Le(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ne,...r}=t;return gn(hn(n,r).format(e))}var pn=e=>e!==0&&Math.abs(e)<.05,bn=(e,t,n="")=>`${Le(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Tt(e,t={}){if(!Number.isFinite(e))return"-";if(pn(e)&&t.maximumFractionDigits===void 0)return bn(e,t.locale??ne,"%");let n=Math.abs(e);return`${Le(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Ar(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ne,...r}=t;if(Y(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**d)/10**d;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Le(u,{locale:n,...r,maximumFractionDigits:d})+l}}return gn(hn(n,{notation:"compact",...r}).format(e))}var Wa=(e,t=Y(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Ve(e,t=ne,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=hn(t,o);return l=>Number.isFinite(l)?`${i}${gn(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=>Tt(o,{locale:t});case"ratio":return o=>Tt(o*100,{locale:t});case"compact":return o=>Ar(o,{locale:t});case"currency":return r(Wa(t));default:{let o=r({maximumFractionDigits:1});return a=>pn(a)?bn(a,t):o(a)}}}function At(e,t=ne,n=0){return e!==void 0?Ve(e,t):n>=1e5?r=>pn(r)?bn(r,t):Ar(r,{locale:t}):r=>Le(r,{locale:t})}function Ga(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var yn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Ka=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Ua=["january","february","march","april","may","june","july","august","september","october","november","december"],Mr=e=>{let t=e.toLowerCase();return t.length<3?0:Ua.findIndex(n=>n.startsWith(t))+1},Tr=e=>+e+(+e<30?2e3:1900);function Fr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Xa=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],Pr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Rr=/\{([^{}]+)\}/g;function Ft(e,t){let n;for(let r of Xa)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[Tr(n[3]),+n[2],+n[1],1]:[Tr(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=Pr.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=Mr(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=Mr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Nr=e=>Ka.test(e)||Ft(e)!==null;function Pt(e){let t;for(let n of e){let r=typeof n=="string"?Pr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Ee(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(yn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Ee(`${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=Ft(n,t);if(r)return Ga(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 Sr=new Map;function _e(e,t={month:"short",day:"numeric"}){let n=Ee(e);if(!n)return"-";let{locale:r=ne,...o}=t,a=r+JSON.stringify(o),i=Sr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Sr.set(a,i)),i.format(n)}var xn=R(O(),1),Rt=(0,ge.createContext)({theme:De,cssVars:!0});function Ya(e,t=De){return e?typeof e=="string"?on[e]??t:sn(t,e):t}function Nt(e){let t=(0,ge.useContext)(Rt),n=e.base?on[e.base]:t.theme,r=(0,ge.useMemo)(()=>Ya(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ge.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ge.useMemo)(()=>an(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,xn.jsx)(Rt.Provider,{value:i,children:(0,xn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var qa=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Lr(e){return qa.has(e)}function Za(e,t){let n=r=>t?`var(${kt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Lr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Lr(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)})`:Ct(e[r],e[o],a)}}}function pe(e){let t=(0,ge.useContext)(Rt);return(0,ge.useMemo)(()=>{let n=sn(t.theme,e);return Za(n,t.cssVars)},[t.theme,t.cssVars,e])}function le(e){let t=(0,ge.useContext)(Rt);return e??t.locale??ne}function Er(e){return e?an(e):{}}var Dt=R(X(),1),kn=(0,Dt.createContext)(void 0);function _r(e){let t=(0,Dt.useContext)(kn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var P=R(O(),1),Ja={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`},Qa={en:Ja,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var ei={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},wn=e=>Qa[Y(le(e))];function vn(e){let t=pe(e.theme),n=wn(e.locale),[r,o]=(0,Lt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.label)).length,c=(0,P.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((d,u)=>{let m=!s.has(d.label),h=m&&l===1,g=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(ti,{p:t,item:d,off:!m}),(0,P.jsx)("span",{style:m?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,P.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,P.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":m,"aria-disabled":h||void 0,onClick:()=>{h||(i(d.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:g}):g},u)})});return i?(0,P.jsxs)(P.Fragment,{children:[c,(0,P.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:ei,children:r?n.shown(l,e.items.length):""})]}):c}function ti({p:e,item:t,off:n}){let r=kr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,P.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,P.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,P.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,P.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 ni(e){let t=pe(e.theme),n=gr(e.level,Y(le(e.locale)));return(0,P.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 ri(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,P.jsxs)(P.Fragment,{children:[e.slice(0,r),(0,P.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Ir(e){let t=pe(e.theme),n=wn(e.locale),[r,o]=(0,Lt.useState)(0);we(()=>it(),[]);let a=()=>{o(m=>m+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,P.jsx)(vn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,d=e.source!==void 0||e.note!==void 0?(0,P.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,P.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,P.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,P.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,P.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,P.jsx)(ni,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,P.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,P.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,P.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,P.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:ri(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,P.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,P.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,P.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,P.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,P.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,P.jsx)("span",{}),i]}):null]}),(0,P.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,P.jsx)(kn.Provider,{value:r,children:(0,P.jsx)(Xe.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,P.jsxs)(P.Fragment,{children:[d,u]}):u]})}function $n(e){let t=pe(e.theme),n=wn(e.locale),r=e.height??220;if(we(()=>it(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,P.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,P.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,P.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,P.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,P.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,P.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,P.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,P.jsx)(P.Fragment,{children:e.children})}var rt=R(X(),1);var ce=R(X(),1);var W=R(O(),1),Et=60;var _t={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Or(e){let{c:t,events:n}=e,r=(0,ce.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,we(()=>{it()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,ce.useContext)(Xe),c=e.ariaLabel??l??e.kind,d=(0,ce.useMemo)(()=>s?`${n.length}${n.slice(0,Et).map(k=>`${k.label}${k.series??""}${k.formatted??k.value??""}`).join("")}`:"",[n,s]),u=(0,ce.useMemo)(()=>(0,W.jsx)(oi,{label:c,events:n,t:t.t}),[c,d,t.t]),m=(0,ce.useRef)(null);(0,ce.useEffect)(()=>{let k=()=>{m.current=null};return window.addEventListener("scroll",k,{capture:!0,passive:!0}),window.addEventListener("resize",k,{passive:!0}),()=>{window.removeEventListener("scroll",k,{capture:!0}),window.removeEventListener("resize",k)}},[]),(0,ce.useEffect)(()=>{m.current=null},[t.width,t.height]);let h=k=>{if(k.target!==k.currentTarget)return;if(e.onKey?.(k)){k.preventDefault();return}let C=t.active,L;switch(k.key){case"ArrowRight":case"ArrowDown":L=C===null?0:(C+1)%i;break;case"ArrowLeft":case"ArrowUp":L=C===null?i-1:(C-1+i)%i;break;case"Home":L=0;break;case"End":L=i-1;break;case"Escape":if(C===null)return;L=null;break;case"Enter":case" ":C!==null&&(k.preventDefault(),t.click(C));return;default:return}k.preventDefault(),t.setActive(L,"keyboard")},{via:g,node:y,setActive:f}=t;(0,ce.useEffect)(()=>{if(g!=="touch"||!y)return;let k=C=>{y.contains(C.target)||f(null)};return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[g,y,f]);let x=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,T=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&x?e.renderTip(x):null,b=e.announce??(t.via==="keyboard"&&x?`${x.label}${x.series?` ${x.series}`:""}: ${x.formatted??x.value??""} (${(t.active??0)+1}/${i})`:""),D;if(v){let k=v.x*T,C=t.width*T,L=`clamp(${(4-k).toFixed(1)}px, -50%, calc(${(C-k-4).toFixed(1)}px - 100%))`,z=v.y<64;D={position:"absolute",left:k,top:v.y*T,transform:`translate(${L}, ${z?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*T-8)}}let E=k=>{m.current=null,k.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},I=k=>k?C=>{let L=m.current??(m.current=C.currentTarget.getBoundingClientRect());L.width&&k((C.clientX-L.left)/L.width*t.width,(C.clientY-L.top)/L.height*t.height,C)}:void 0,B=I(e.onPointerMove),_=I(e.onPointerDown),N=B||_?k=>{k.pointerType==="touch"&&B?.(k),_?.(k)}:void 0,F=I(e.onPointerUp),A=Er(e.theme);return(0,W.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:k=>{t.via==="keyboard"&&!k.currentTarget.contains(k.relatedTarget)&&t.setActive(null)},onPointerLeave:E,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...A,...e.style},children:[t.pending?null:e.underlay,(0,W.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:B,onPointerDown:N,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,W.jsx)("title",{id:o,children:c}),(0,W.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,W.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,W.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:D,children:M??(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map((k,C)=>(0,W.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(k.strong?"ink":"muted")},children:[k.color?(0,W.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:k.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,k.label]}),(0,W.jsx)("span",{style:{fontWeight:k.strong===!1?500:700},children:k.value})]},C))]})}):null,(0,W.jsx)("span",{className:"ztd-sr",style:_t,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function oi({label:e,events:t,t:n}){return(0,W.jsx)("div",{className:"ztd-sr",style:_t,children:(0,W.jsxs)("table",{children:[(0,W.jsx)("caption",{children:n.table(e)}),(0,W.jsxs)("tbody",{children:[t.slice(0,Et).map((r,o)=>(0,W.jsxs)("tr",{children:[(0,W.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,W.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Et?(0,W.jsx)("tr",{children:(0,W.jsx)("td",{colSpan:2,children:n.more(t.length-Et)})}):null]})]})})}function ae(e){let t=e.baseline??"central";return(0,W.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var w=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),be=w("label","string",!0,"Item name field"),re=w("value","number",!0,"Value field"),ai=[be,re],ii=[be,re],si=[w("label","string",!0,"Stage name"),w("value","number",!0,"Users at the stage")],li=[be,re],ci=[w("label","string",!0,"Leaf (lowest level) name"),re,w("group","string",!1,"Parent group field")],ui=[w("label","string",!0,"Leaf name"),re,w("group","string",!1,"Parent group field")],mi=[be,w("value","number",!0,"Change (total rows may omit it)"),w("type","string",!1,'"total" makes a total bar')],di=[be,re],fi=[w("x","string",!0,"Column field"),w("series","string",!0,"Stacked series field"),re],hi=[w("x","string",!0,"Column field"),w("y","string",!0,"Row field"),re],gi=[w("axis","string",!0,"Metric (axis) field"),w("value","number",!0,"Value field",{multi:!0}),w("series","string",!1,"Series field")],pi=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("size","number",!1,"Circle size"),w("label","string",!1,"Name")],zr=w("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),bi=[w("x","any",!0,"x field (date, number or category)"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables)"),w("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),zr],yi=[w("x","any",!0,"x field"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),zr],xi=[w("x","any",!0,"x field"),w("y","number",!0,"y field",{multi:!0}),w("series","string",!1,"Series field")],ki=[w("x","string",!0,"Category field"),w("y","number",!0,"Value field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],wi=[be,re],vi=[w("value","number",!0,"Value field",{prop:"valueKey"}),w("target","number",!1,"Target field",{prop:"targetKey"})],$i=[be,w("value","number",!0,"Actual value field"),w("target","number",!1,"Target field")],Ci=[w("x","any",!1,"x field"),w("y","number",!0,"y field")],Mi=[be,w("x","string",!1,"Period field (long tables)"),w("value","number",!1,"Value field (long tables)")],Ti=[be,w("start","number",!0,"Before value"),w("end","number",!0,"After value")],Si=[be,re],Ai=[w("value","number",!0,"Value field"),w("group","string",!1,"Group (row) field"),w("label","string",!1,"Dot name")],Fi=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],Pi=[w("source","string",!0,"Source node"),w("target","string",!0,"Target node"),re],Ri=[w("source","string",!0,"Sending group"),w("target","string",!0,"Receiving group"),re],Ni=[w("date","date",!0,"Date field"),re],Di=[w("x","any",!0,"Period field"),w("series","string",!0,"Item field"),w("rank","number",!1,"Rank field (1 is first)"),w("value","number",!1,"Value field (instead of rank, largest is first)")],Li=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],Ei=[w("label","string",!1,"Row name field")],_i=[w("x","date",!0,"Date (period) field"),w("open","number",!0,"Open price field"),w("high","number",!0,"High price field"),w("low","number",!0,"Low price field"),w("close","number",!0,"Close price field"),w("volume","number",!1,"Volume field")],Ii=[be,re],Oi=[w("x","any",!0,"Period field (date or category)"),w("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables, back row only)"),w("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Bi=[w("value","number",!1,"Sample value field (raw rows)"),w("group","string",!1,"Group field. Up to 2 groups overlap"),w("x0","number",!1,"Bin start (pre-binned rows)"),w("x1","number",!1,"Bin end (pre-binned rows)"),w("count","number",!1,"Samples in the bin (pre-binned rows)")],zi=[w("region","string",!0,"Region name or code, matched to a tile of options.map"),re],Hi=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("series","string",!1,"Series field (one color per series)"),w("label","string",!1,"Name")],Br={pie:ai,donut:ii,funnel:si,waffle:li,treemap:ci,sunburst:ui,waterfall:mi,pareto:di,marimekko:fi,heatmap:hi,radar:gi,bubble:pi,line:bi,area:yi,stream:xi,bar:ki,radialBar:wi,gauge:vi,bullet:$i,sparkline:Ci,slope:Mi,dumbbell:Ti,lollipop:Si,beeswarm:Ai,ridgeline:Fi,sankey:Pi,chord:Ri,calendar:Ni,bump:Di,box:Li,parallel:Ei,candlestick:_i,segmented:Ii,skyline:Oi,histogram:Bi,scatter:Hi,tileMap:zi},Je={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"}};function Hr(e,t){return t==="ko"?e.nameKo:e.name}function jr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Vr=["line","area","bar","scatter"],Wr=24,Cn=["line","area","bar","scatter"];function Mn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Gr(e,t,n){return Cn.includes(e)&&!Mn(e,t,n).length}function Kr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var ji={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap"};function It(e){let t=Br[e]?e:ji[e]??Object.keys(Je).find(n=>n.toLowerCase()===e.toLowerCase()||Je[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Je[t]))return{type:t,component:Je[t].component,name:Je[t].name,nameKo:Je[t].nameKo,encoding:Br[t]}}function Ur(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 It(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function Xr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Vi(e,t){if(e==null||typeof e!="object")return;let n=e;if(Xr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Xr(r,o))return;r=r[o]}return r}}function Fe(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 Ie(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Vi(r,n)}function Ce(e,t){let n=Ie(e,t);return(r,o)=>Fe(n(r,o))}function Qe(e,t){let n=Ie(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 et(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Wi(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
|
+
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var Gi=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function Yr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Gi.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Fe(t);if(Number.isFinite(n))return n}return t}function We(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Wi(o),i=[],s=[],l="",c=!1;for(let g=0;g<o.length;g++){let y=o[g];c?y==='"'?o[g+1]==='"'?(l+='"',g++):c=!1:l+=y:y==='"'&&!l.trim()?(c=!0,l=""):y===a?(s.push(l),l=""):y===`
|
|
24
|
+
`||y==="\r"?(y==="\r"&&o[g+1]===`
|
|
25
|
+
`&&g++,s.push(l),i.push(s),s=[],l=""):l+=y}(l!==""||s.length)&&(s.push(l),i.push(s));let d=i.filter(g=>!(g.length===1&&g[0].trim()===""));if(!d.length)return[];let u=g=>n?Yr(g):g;if(!r)return d.map(g=>Object.fromEntries(g.map((y,f)=>[String(f),u(y)])));let m=[],h=new Set;return d[0].forEach((g,y)=>{let f=g.trim()||`col${y+1}`,x=f;for(let v=2;h.has(x);v++)x=`${f}_${v}`;h.add(x),m.push(x)}),d.slice(1).map(g=>Object.fromEntries(m.map((y,f)=>[y,u(g[f]??"")])))}function Tn(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"?Yr(i[l]):i[l]??null])))}function Ki(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function qr(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 Oe(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Oe(JSON.parse(t))}catch{}return We(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Tn(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)?Oe(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Tn(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)?Oe(t.rows):Array.isArray(t.values)?Tn(t.values):Array.isArray(t.items)?Oe(t.items):Array.isArray(t.results)?Oe(t.results):Ki(t)}return[]}function Ot(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Sn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let d=e[l][c];return Number.isFinite(d)&&d>0?d:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let d=0,u=0;for(let m=0;m<n;m++){let h=i(m,c),g=h-i(m,c-1),y=0;for(let f=0;f<m;f++)y+=i(f,c)-i(f,c-1);d+=h,u+=(g/2+y)*h}d&&(l-=u/d),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,m=0;for(let h=0;h<n;h++){let g=e[h][l],y=Number.isFinite(g)?g:0;y>=0?(o[h][l]=u,u+=y,a[h][l]=u):(o[h][l]=m,m+=y,a[h][l]=m)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let d=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let m=i(u,l);t==="expand"&&(m=c?m/c*100:0),o[u][l]=d,d+=m,a[u][l]=d}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let d=0;for(let u=0;u<r;u++)d+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;d/=r;for(let u=0;u<n;u++)for(let m=0;m<r;m++)o[u][m]-=d,a[u][m]-=d}return{y0:o,y1:a}}function Zr(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function Jr(e){let t=e.length,n=e.map(c=>{let d=0,u=-1/0;return c.forEach((m,h)=>{m>u&&(u=m,d=h)}),d}),r=e.map(c=>c.reduce((d,u)=>d+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,d)=>d).sort((c,d)=>n[c]-n[d]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var Ui=Math.PI*2;function Qr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function eo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function to(e){let t=e.length,n=e.reduce((l,c)=>l+c.x,0)/t,r=e.reduce((l,c)=>l+c.y,0)/t,o=0,a=0,i=0;for(let l of e)o+=(l.x-n)*(l.y-r),a+=(l.x-n)**2,i+=(l.y-r)**2;let s=a?o/a:0;return{slope:s,r2:a&&i?o*o/(a*i):0,at:l=>r+s*(l-n)}}function ro(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function no(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 Bt=new Map;function Q(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Bt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);ro(c)?i+=no(c):s+=no(c)}a=i+s*(n>=600?1.07:1),Bt.size>5e3&&Bt.clear(),Bt.set(o,a)}return a*t}function Be(e,t,n,r=400){if(e=e.trim(),Q(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;Q(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<(ro(s.charCodeAt(0))?2:3)?"":s+o}var G=R(O(),1),Ge=e=>Array.isArray(e)&&e.length===2;function zt(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ge(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var Xi=(e,t)=>Math.max(0,Math.min(e.x+e.w,t.x+t.w)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.h,t.y+t.h)-Math.max(e.y,t.y));function An(e,t,n){let r=t[0],o=1/0;for(let a of t){let i=Pn(e,a.x,a.y,a.anchor),s=n.reduce((l,c)=>l+Xi(i,c),0);if(s<o&&(r=a,o=s),s===0)break}return n.push(Pn(e,r.x,r.y,r.anchor)),r}var Fn=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),Yi=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function oo(e,t){let n=e.xAt(t[0]),r=e.xAt(t[1]);return n===null||r===null?null:[Math.min(n,r)-e.half,Math.max(n,r)+e.half]}function ao(e,t){let n=e.y(Number(t[0])),r=e.y(Number(t[1]));return Number.isFinite(n)&&Number.isFinite(r)?[Math.max(e.top,Math.min(n,r)),Math.min(e.bottom,Math.max(n,r))]:null}function io(e,t){let n=t===void 0?null:e.xAt(t);return n===null||n>e.x1?null:Math.max(e.x0,n-(e.edge?e.half:0))}var so={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function lo({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=Math.max(0,t.bottom-t.top),o=[];return e.forEach((a,i)=>{if(a.type==="band"&&Ge(a.y)){let s=ao(t,a.y);if(!s)return;let[l,c]=s;o.push((0,G.jsxs)("g",{children:[(0,G.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,c-l),fill:n.paint("accent"),opacity:.1}),(0,G.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,G.jsx)("line",{x1:t.x0,x2:t.x1,y1:c,y2:c,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},i))}else if(a.type==="band"&&Ge(a.x)||a.type==="forecast"){let s;if(a.type==="forecast"){let d=io(t,a.from);s=d===null?null:[d,t.x1]}else s=oo(t,a.x);if(!s)return;let l=Fn(t,s[0]),c=Fn(t,s[1]);if(c-l<.5)return;o.push((0,G.jsx)("rect",{x:l,y:t.top,width:c-l,height:r,fill:n.paint("ink"),opacity:.05},i))}else if(a.type==="weekends"&&t.time&&t.time.t1-t.time.t0<=864e5*400){let s=Math.min(432e5,(t.time.t1-t.time.t0)/Math.max(1,t.time.n-1)/2),l=new Date(t.time.t0);l.setHours(0,0,0,0),l.setDate(l.getDate()-(l.getDay()+1)%7);for(let c=0;l.getTime()-s<=t.time.t1&&c<60;c++){let d=l.getTime();l.setDate(l.getDate()+2);let u=Math.max(t.x0,t.time.xt(d-s)),m=Math.min(t.x1,t.time.xt(l.getTime()-s));m>u&&o.push((0,G.jsx)("rect",{x:u,y:t.top,width:m-u,height:r,fill:n.paint("ink"),opacity:.045},`${i}w${c}`)),l.setDate(l.getDate()+5)}}}),(0,G.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var co=(e,t)=>Q(e,10.5,t?700:500)+8;function Pn(e,t,n,r="start",o){let a=co(e,o);return{x:r==="end"?t-a:t,y:n-8,w:a,h:16}}function lt({p:e,x:t,y:n,text:r,anchor:o="start",strong:a}){let i=Pn(r,t,n,o,a);return(0,G.jsxs)("g",{children:[(0,G.jsx)("rect",{x:i.x,y:i.y,width:i.w,height:i.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,G.jsx)(ae,{x:i.x+4,y:n,size:10.5,weight:a?700:500,fill:e.paint(a?"ink":"muted"),children:r})]})}function uo({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=so[t.lang],o=[],a=[],i=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let c=t.y(s.y);if(!Number.isFinite(c))return;let d=s.label?Be(s.label,160,10.5):"",u=d?An(d,[{x:t.x1-2,y:c-10,anchor:"end"},{x:t.x0+2,y:c-10,anchor:"start"},{x:t.x1-2,y:c+10,anchor:"end"},{x:t.x0+2,y:c+10,anchor:"start"}],i):null;o.push((0,G.jsxs)("g",{children:[(0,G.jsx)("line",{x1:t.x0,x2:t.x1,y1:c,y2:c,stroke:n.paint("dim"),strokeDasharray:"4 3"}),u?(0,G.jsx)(lt,{p:n,x:u.x,y:u.y,text:d,anchor:u.anchor}):null]},l))}else if(s.type==="band"&&s.label){let c=Ge(s.y)?ao(t,s.y):[t.top,t.bottom],d=Ge(s.x)?oo(t,s.x):[t.x0,t.x1];if(!d||!c)return;let[u,m]=c,h=Be(s.label,160,10.5),g=Math.min(Fn(t,d[0]),t.x1-40)+4,y=An(h,[{x:g,y:u+11,anchor:"start"},{x:g,y:m-11,anchor:"start"}],i);o.push((0,G.jsx)(lt,{p:n,x:y.x,y:y.y,text:h},l))}else if(s.type==="forecast"){let c=io(t,s.from);if(c===null)return;let d=Be(s.label??r.forecast,120,10.5),u=Math.min(c+4,t.x1-50),m=An(d,[{x:u,y:t.top+9,anchor:"start"},{x:u,y:t.bottom-9,anchor:"start"}],i);o.push((0,G.jsxs)("g",{children:[(0,G.jsx)("line",{x1:c,x2:c,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,G.jsx)(lt,{p:n,x:m.x,y:m.y,text:d})]},l))}else if(s.type==="event"&&s.label){let c=t.xAt(s.x);if(!Yi(t,c))return;let d=Be(s.label,140,10.5,700),u=co(d,!0),m=Math.max(t.x0,Math.min(c-u/2,t.x1-u)),h=a.findIndex(y=>y<m-4);h<0&&(h=a.length),a[h]=m+u;let g=t.top+9+h*18;o.push((0,G.jsxs)("g",{children:[(0,G.jsx)("line",{x1:c,x2:c,y1:g+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,G.jsx)("circle",{cx:c,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,G.jsx)(lt,{p:n,x:m,y:g,text:d,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let c=t.points().filter(h=>Number.isFinite(h.x)&&Number.isFinite(h.y));if(c.length<2)return;let{at:d}=to(c),u=c[0].x,m=c[c.length-1].x;o.push((0,G.jsxs)("g",{children:[(0,G.jsx)("line",{x1:u,x2:m,y1:d(u),y2:d(m),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,G.jsx)(lt,{p:n,x:m-2,y:d(m)-11,text:Be(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,G.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function mo(e,t,n,r){if(!e?.length)return"";let o=so[t],a=t==="ko",i=r??(l=>String(l??"")),s=e.map(l=>{let c=l.label?a?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&&Ge(l.y)?a?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${c}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${c}`:l.type==="band"&&Ge(l.x)?a?`${l.label??o.period} ${i(l.x[0])}~${i(l.x[1])}`:`${l.label??o.period} from ${i(l.x[0])} to ${i(l.x[1])}`:l.type==="line"&&typeof l.y=="number"?a?`기준선 ${n(l.y)}${c}`:`reference line at ${n(l.y)}${c}`:l.type==="event"?a?`${i(l.x)} ${l.label??""}`.trim():`${l.label??"event"} at ${i(l.x)}`:l.type==="forecast"?a?`${i(l.from)}부터 ${l.label??o.forecast}`:`${l.label??o.forecast.toLowerCase()} from ${i(l.from)}`:l.type==="trend"?a?l.label??"추세선":l.label??"trend line":l.type==="weekends"?o.weekends:""}).filter(Boolean);return s.length?` ${o.lead}: ${s.join(a?", ":"; ")}.`:""}var ie=R(O(),1),ye=10.5;function jt(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>Le(i,{locale:n,maximumFractionDigits:a}))}function Vt(e,t,n){let r=18;for(let o of jt(e,t,n))r=Math.max(r,Q(o,ye));return Math.ceil(r+8)}function fo(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:jt(n,i,e.locale);return(0,ie.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,d)=>{let u=Math.round(r(c))+.5,m=c===0&&e.zero!==!1;return(0,ie.jsxs)("g",{children:[(0,ie.jsx)("line",{x1:o,x2:a,y1:u,y2:u,stroke:t.paint(m?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:m?.7:1}),l?(0,ie.jsx)(ae,{x:s?a+6:o-6,y:u,anchor:s?"start":"end",size:ye,fill:t.paint("muted"),children:l[d]}):null]},c)})})}function ho(e,t,n){let r=[],o=-1/0;for(let a of e){let i=Q(a.label,ye),s=Math.max(a.x-i/2,0);s<o+8||a.x-i/2<t||a.x+i/2>n||(r.push(a),o=s+i)}return r}var Ht=e=>Math.round(e*10)/10;function go(e){let{p:t}=e;return(0,ie.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Ht(e.x)}px,0px)`},children:[(0,ie.jsx)("line",{x1:0,x2:0,y1:e.top,y2:e.bottom,stroke:t.paint("dim"),strokeWidth:1}),e.dots?.map(n=>(0,ie.jsxs)("g",{className:"ztd-guide",style:{transform:`translate(0px,${Ht(n.y)}px)`},children:[(0,ie.jsx)("circle",{r:n.strong?9:7,fill:n.color,opacity:.2}),(0,ie.jsx)("circle",{r:n.strong?4.2:3.2,fill:n.color,stroke:t.paint("panel"),strokeWidth:2})]},n.k))]})}function po(e){let{p:t}=e,n=Be(e.label,160,ye,700),r=Q(n,ye,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,ie.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Ht(o)}px,${Ht(e.y)}px)`},children:[(0,ie.jsx)("rect",{x:-r/2,y:-9,width:r,height:18,rx:9,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:3,paintOrder:"stroke"}),(0,ie.jsx)(ae,{x:0,y:0,anchor:"middle",size:ye,weight:700,fill:t.paint("onInk"),children:n})]})}function Rn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function ze(e,t,n=4,r={}){let o=e,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=Rn(i,n),c=[o,a];for(let d=0;d<4;d++){let u=Math.ceil(a/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-m<=l*.3?m:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let h=Rn(c[1]-c[0],n);if(h===l)break;l=h}return c}function bo(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Rn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function tt(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 Nn(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=ze(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function qi(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,d=1)=>{let u=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let h of c){let g=Number((h*10**m).toPrecision(12));g>=e*(1-1e-9)&&g<=t*(1+1e-9)&&u.push(g)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:bo(e,t,3)}function yo(e,t){let n=tt([Math.log10(e[0]),Math.log10(e[1])],t),r=(o=>o>0?n(Math.log10(o)):Number.NaN);return r.domain=e,r.range=t,r.invert=o=>10**n.invert(o),r.ticks=()=>qi(e[0],e[1],Math.abs(t[1]-t[0])),r}function ct(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 Zi=864e5;function Wt(e,t,n,r=ne){let o=t-e;if(!(o>0))return[{t:e,label:_e(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Zi,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(d,u,m,h=!1)=>{let g=new Date(d),y=-1,f=0;for(;g.getTime()<=t&&f++<500;){if(g.getTime()>=e){let x=g.getFullYear(),v=h&&!l&&x!==y;i.push({t:g.getTime(),label:_e(g,{locale:r,...m,...v?{year:"numeric"}:{}})}),y=x}u(g)}};if(a<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=d)??12,m=new Date(s);m.setMinutes(0,0,0),c(m,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(d,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),c(d,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=a/30.44,u=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(m>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,g=>g.setFullYear(g.getFullYear()+m/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),g=h.getMonth()%m;g&&h.setMonth(h.getMonth()+(m-g)),c(h,y=>y.setMonth(y.getMonth()+m),{month:"short"},!0)}}return i}function xo(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var Ji=(e,t,n)=>e==="date"?Ee(t,n)?.getTime()??NaN:Fe(t);function Qi(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Nr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function ut(e,t,n,r,o={}){let a=Ie(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:Ie(n,"y"),c=!i&&r!==void 0?Ie(r,"series"):null,d=e.map((A,k)=>a(A,k)),u=o.xType??Qi(d),m=o.locale??ne,h,g,y;if(u==="band"){let A=d.map(C=>String(C??""));h=et(A);let k=new Map(h.map((C,L)=>[C,L]));g=h.map((C,L)=>L),y=Int32Array.from(A,C=>k.get(C)??-1)}else{let A=u==="date"?o.dayFirst??Pt(d):void 0,k=d.map(z=>Ji(u,z,A)),C=Array.from(new Set(k.filter(z=>Number.isFinite(z)))).sort((z,V)=>z-V),L=new Map(C.map((z,V)=>[z,V]));g=C,h=C.map(String),y=Int32Array.from(k,z=>L.get(z)??-1)}let f=o.dateFormat,x=A=>typeof A=="string"?Ft(A.trim())?.[3]:void 0,v=u==="date"&&d.length<5e3?x(d[0]):void 0,T=(v===2||v===3)&&d.every(A=>x(A)===v),M=T&&v===3;if(u==="date"&&!f){let A=g.length>1?g[g.length-1]-g[0]:0;f=T&&v===2||A>864e5*120?{month:"short"}:A<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},A>864e5*800&&(f={year:"numeric",month:"short"})}let b;if(u==="band")b=h;else if(M&&!o.dateFormat){let A=Y(m)==="ko";b=g.map(k=>{let C=new Date(k),L=Math.floor(C.getMonth()/3)+1;return A?`${C.getFullYear()}년 ${L}분기`:`Q${L} ${C.getFullYear()}`})}else{let A=g.every(yn),k=u==="date"?new Intl.DateTimeFormat(m,f):new Intl.NumberFormat(m,A?{useGrouping:!1}:{maximumFractionDigits:6});b=g.length>1e3?xo(g.length,C=>k.format(g[C])):g.map(C=>k.format(C))}let D=s?[...s]:c?et(e.map((A,k)=>String(c(A,k)??""))):[""],E=new Map(D.map((A,k)=>[A,k])),I=D.map(()=>new Array(h.length).fill(NaN)),B=D.map(()=>new Array(h.length).fill(null)),_=o.aggregate??"sum",N=_==="mean"?D.map(()=>new Uint32Array(h.length)):null,F=(A,k,C,L)=>{let z=I[A][k];_==="last"?I[A][k]=C:_==="count"?I[A][k]=(Number.isFinite(z)?z:0)+1:_==="mean"?Number.isFinite(C)&&(I[A][k]=(Number.isFinite(z)?z:0)+C,N[A][k]++):I[A][k]=Number.isFinite(z)?z+(Number.isFinite(C)?C:0):C,B[A][k]=L};for(let A=0;A<e.length;A++){let k=y[A];if(k<0)continue;let C=e[A];if(s)for(let L=0;L<s.length;L++)F(L,k,Fe(C[s[L]]),C);else{let L=c?E.get(String(c(C,A)??""))??0:0;F(L,k,Fe(l(C,A)),C)}}if(N)for(let A=0;A<I.length;A++)for(let k=0;k<h.length;k++)N[A][k]>1&&(I[A][k]/=N[A][k]);return{type:u,keys:h,xnum:g,labels:b,series:D,values:I,rows:B}}var es=140,dt=12,ko=14,Dn=20,wo=12.5;function ts(e,t,n=Wr){let r=Qe(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function ns(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+dt)/(es+dt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function rs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*dt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var mt=e=>e.filter(Number.isFinite);function Gt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Ce(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return mt(n)}function vo(e,t,n,r,o,a){return ut(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function os(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),D=r.refLines??{},[E,I]=ct([...Gt(b,r.x??"x"),...mt([Number(D.x)])]),[B,_]=ct([...Gt(b,r.y??"y"),...mt([Number(D.y)])].filter(F=>!s||F>0)),N=r.zero??!1;return{y:c??(s?Nn(B,_,i):ze(B,_,i,{zero:N,pad:.08})),x:r.xDomain??ze(E,I,Math.max(2,Math.round(o/110)),{zero:N,pad:.06}),sameKeys:!0}}let d=e==="bar",u=d&&r.orientation==="horizontal",m=n[0]?.keys.join(""),h=n.every(b=>b.keys.join("")===m),g=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),y=r.xDomain??(!d&&g?ct(n.flatMap(b=>mt(b.xnum))):void 0),f=d?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(f==="percent")return{x:y,sameKeys:h};if(c)return{y:c,x:y,sameKeys:h};let x=[];t.forEach((b,D)=>{let E=n[D];if(f==="stacked"||f==="auto"&&E.series.length>1){let B=Sn(E.values,"zero");B.y0.forEach(_=>x.push(..._)),B.y1.forEach(_=>x.push(..._))}else E.values.forEach(B=>x.push(...B));d&&!u&&r.line!==void 0&&vo(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(B=>x.push(...B)),d||x.push(...Gt(b,r.lower),...Gt(b,r.upper))}),d&&x.push(0),u||x.push(...zt(r.annotations));for(let b of r.referenceLines??[])x.push(b.y);r.signColors&&x.push(Number(r.baseline??0));let[v,T]=ct(mt(x).filter(b=>!s||b>0));return{y:s?Nn(v,T,i):d?ze(v,T,u?Math.max(2,Math.round(o/120)):i):ze(v,T,i,{zero:r.zero??e==="area"}),x:y,sameKeys:h}}function as(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=ut(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?yo:tt)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),d=Vt(c,At(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),m=r.endLabels??n.some(b=>b.series.length>1),h=d+6,g=a-(m?Math.min(a*.28,Math.max(...u.map(b=>Q(b,11,700)),20)+14):10),y=l.keys.length,[f,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?y>12:y>Wt(f,x,Math.max(2,Math.floor((g-h)/64)),s).length;if(l.type==="band"||!y||v)return;let T=b=>h+(l.xnum[b]-f)/(x-f)*(g-h),M=b=>Q(l.labels[b],ye);for(let b=1;;b++){let D=Array.from({length:Math.ceil(y/b)},(E,I)=>I*b);if(b>=y||D.every((E,I)=>!I||T(E)-T(D[I-1])>=(M(E)+M(D[I-1]))/2+8))return D.map(E=>({value:l.xnum[E],label:l.labels[E]}))}}function is(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function ss(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${is(`${e}|${t}|${o}|${Ot(r)}`)}`}function ls(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var cs={en:{intro:(e,t)=>`${Ye(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}};function $o(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=ts(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=ns(s,i,e.columns),{pw:c,ph:d}=rs(s,l,e.height),u=e.scale!=="free",m=t==="scatter"?[]:o.map(N=>vo(t,N,n,n.y,n.series,n.aggregate)),h=u?os(t,o,m,n,c,d):{sameKeys:!1},g=u?as(t,o,m,n,h,c,d,e.locale):void 0,y=t==="bar"&&n.orientation==="horizontal",f=u&&(!y||h.sameKeys),x=u&&(y||h.x!==void 0||h.sameKeys),v=new Set(ls(e.highlight,r)?[e.highlight].flat():[]),T=v.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??ss(t,e.by,n,e.data),D=St(Ve(n.format,e.locale),n.unit),E=cs[e.lang],I=[],B=r.map(N=>N===""?E.blank:N);return{panels:r.map((N,F)=>{let A=o[F],k=B[F],C=F%l,L;if(t!=="scatter"){let V=m[F],K=de=>V.values.reduce((se,gt)=>se+(Number.isFinite(gt[de])?gt[de]:0),0),U=V.keys.map((de,se)=>se).filter(de=>V.values.some(se=>Number.isFinite(se[de]))),oe=U[U.length-1];I.push({first:U.length?K(U[0]):NaN,last:U.length?K(oe):NaN,total:U.reduce((de,se)=>de+K(se),0)}),t!=="bar"&&V.series.length===1&&oe!==void 0&&(L=D(V.values[0][oe]))}else I.push({first:NaN,last:NaN,total:A.length});let z={data:A,width:c,height:d,ariaLabel:e.title?`${e.title}, ${k}`:k,syncId:b,highlight:T?v.has(N)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!f||C===0,showXAxis:!x||F+l>=i};return h.y&&(z.yDomain=h.y),h.x&&(z.xDomain=h.x),g&&(z.xTicks=g),{value:N,label:k,props:z,last:L,isPicked:v.has(N)}}),cols:l,pw:c,ph:d,isPanelPick:T,description:us(t,e.by,B,I,a,D,E)}}function us(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>eo(r.map(d=>d[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let d=n.filter((u,m)=>r[m].last<r[m].first);s+=d.length?i.falling(`${d.slice(0,5).join(", ")}${d.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var ue=R(X(),1);function ms(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function ds(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function To(e,t=!0){let[n,r]=(0,ue.useState)({visible:!t,near:!t});return(0,ue.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=ds(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ms(.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 Co(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Kt(e){let[t,n]=(0,ue.useState)(null),[r,o]=(0,ue.useState)(e??null),a=(0,ue.useCallback)(i=>{n(i),i&&e===void 0&&o(Co(i))},[e]);return we(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(d=>d!==null&&Math.abs(d-c)<.5?d:c),s=()=>i(Co(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let d=c[c.length-1]?.contentRect;d?i(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var fs=()=>()=>{};function nt(){return(0,ue.useSyncExternalStore)(fs,()=>!0,()=>!1)}var Mo="(prefers-reduced-motion: reduce)";function Ut(e="auto"){let[t,n]=(0,ue.useState)(()=>he&&typeof window.matchMedia=="function"?window.matchMedia(Mo).matches:!1);return(0,ue.useEffect)(()=>{if(e!=="auto"||!he||typeof window.matchMedia!="function")return;let r=window.matchMedia(Mo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=R(O(),1),hs=60,gs=420;function So(e){let t=pe(),n=e.chartProps??{},[,r,o]=Kt(e.width),a=e.width??(o||480),i=le(e.locale??n.locale),s=Y(i),l=(0,rt.useContext)(Xe),c=e.title??l,d=(0,rt.useMemo)(()=>$o({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(f,x)=>typeof x=="function"?String(x):x),e.highlight,e.syncId,a,e.height,c,i,s]),u=`${(0,rt.useId)().replace(/:/g,"")}fd`,m=Ut(n.reducedMotion??"auto"),h=nt(),g=mr({motion:{enabled:n.animate!==!1&&!m&&he},hydrated:h},{waiting:!1,generation:0}),y=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":u,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:u,style:_t,children:e.description??d.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${d.cols}, minmax(0, 1fr))`,columnGap:dt,rowGap:ko},children:d.panels.map((f,x)=>{let v=t.paint(f.isPicked?"accentText":d.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":f.value,style:{minWidth:0,...ur(g,!1,"fade",x*hs,gs)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Dn,fontSize:wo,fontWeight:700,lineHeight:`${Dn}px`,color:v},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.label}),f.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:f.last}):null]}),(0,Me.jsx)(y,{...n,...f.props})]},f.value)})})]})}function Te(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let d=-1,u=c==="max"?-1/0:1/0;r.forEach((m,h)=>{Number.isFinite(m)&&(c==="max"?m>u:m<u)&&(u=m,d=h)}),d>=0&&a.add(d)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,d)=>{d<i&&c!==null&&c!==void 0&&e(c,d)&&a.add(d)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((d,u)=>{d===c&&a.add(u)});return a}var fe=R(X(),1);async function ps(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(Y(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return We(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 We(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):We(a)}async function bs(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 ps(a,t.parse,o,t.locale)}return t.select&&(r=qr(r,t.select)),t.transform?t.transform(r):Oe(r)}function Ao(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,fe.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,fe.useState)(0),c=le(t.locale),d=(0,fe.useRef)(t);d.current={...t,locale:c};let u=(0,fe.useRef)(e);u.current=e;let m=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],g=JSON.stringify(h.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),y=(0,fe.useRef)(!1);(0,fe.useEffect)(()=>{let x=u.current;if(!x||!r){i(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let v=new AbortController,T=!0;return y.current=!0,i(M=>({...M,data:o?M.data:[],status:"loading",error:null})),bs(x,{...d.current,signal:v.signal}).then(M=>{T&&i({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!T||v.signal.aborted||i(b=>({...b,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{T&&(y.current=!1)}),()=>{T=!1,y.current=!1,v.abort()}},[m,r,s,g,o]),(0,fe.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{y.current||l(v=>v+1)},n);return()=>clearInterval(x)},[n,r]);let f=(0,fe.useCallback)(()=>l(x=>x+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:f}}var En=R(O(),1),ys=["csv","svg","png"],xs=/^[=+\-@\t\r\n=+-@]/,ks=/var\(|color-mix\(/;function Fo(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?Fr(e.getTime()):String(e);return`"${(xs.test(t)&&!Number.isFinite(Fe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ws(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function vs(e,t){return`\uFEFF${[t.map(Fo),...e.map(r=>t.map(o=>Fo(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
|
+
`)}\r
|
|
27
|
+
`}function $s(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Ln(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Po=2,He=16;function Ro(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 No(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 Do(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+He*2,i+He*2],c=o.cloneNode(!0),d=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((g,y)=>{let f;for(let x of Array.from(g.attributes)){if(!ks.test(x.value))continue;let v=(f??(f=getComputedStyle(g))).getPropertyValue(x.name);v&&d[y].setAttribute(x.name,Ro(v,u))}}),c.removeAttribute("style");for(let[g,y]of Object.entries({viewBox:`${-He} ${-He} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(g,String(y));let m=Ro(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let g=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(No("rect",{x:-He,y:-He,width:s,height:l,fill:m}),g),h&&c.insertBefore(No("image",{href:h.toDataURL(),width:a,height:i}),g)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:m,canvas:h}}function Cs(e,t){let n=Do(e,Po,!1);if(!n)return;let r=Po,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,He*r,He*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&&Ln(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Lo(e){let t=pe(e.theme),n=Y(le(e.locale))==="ko",r=$s(e.filename),o=(a,i)=>{if(a==="csv")return Ln(new Blob([vs(e.data,e.columns?.length?e.columns:ws(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Cs(i,r);let s=Do(i,1,!0);s&&Ln(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,En.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:ys.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,En.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 _o=R(O(),1);function Eo(e,t=ne){let n=Ve(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?_e(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Rr,(d,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,_o.jsx)("div",{children:s},l)):null}}function Io(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 We(t.csv)}return null}var qo=R(X(),1);var Ke=R(X(),1);var Z=R(O(),1),Ms={zoomHint:" Press Enter to zoom in.",pickHint:" Press Enter to select.",high:"High",low:"Low",resetLabel:"Show all (reset zoom)",reset:"Show all",extremes:(e,t)=>`, high ${e}, low ${t}`,range:(e,t)=>`${e} to ${t}`},Bo={en:Ms,ko:{zoomHint:" Enter를 누르면 확대해요.",pickHint:" Enter를 누르면 이 구간을 골라요.",high:"최고",low:"최저",resetLabel:"전체 보기(확대 풀기)",reset:"전체 보기",extremes:(e,t)=>`, 최고 ${e}, 최저 ${t}`,range:(e,t)=>`${e}~${t}`}},Ts=4;function Ss(e){let[t,n]=(0,Ke.useState)(null),[r,o]=(0,Ke.useState)(!1),a=(0,Ke.useRef)(null),i=(0,Ke.useRef)(null),s=()=>{a.current=null,i.current=null,o(!1),n(null)},l=(m,h,g)=>!e.enabled||e.count<2||g.pointerType==="touch"||g.button!==0||!e.inPlot(m,h)?!1:(a.current={i:e.indexAt(m),x:m,moved:!1},g.currentTarget.setPointerCapture?.(g.pointerId),!0),c=m=>{let h=a.current;if(!h)return!1;if(!h.moved&&Math.abs(m-h.x)<Ts)return!0;h.moved=!0;let g=e.indexAt(m),y=Math.min(h.i,g),f=Math.max(h.i,g);return o(!0),n(x=>x?.from===y&&x.to===f?x:{from:y,to:f}),!0},d=(m,h,g)=>{let y=a.current;if(a.current=null,g.currentTarget.hasPointerCapture?.(g.pointerId)&&g.currentTarget.releasePointerCapture(g.pointerId),!y)return;if(o(!1),!y.moved||g.type==="pointercancel"){t&&(n(null),e.onCommit(null));return}let f=e.indexAt(m),x={from:Math.min(y.i,f),to:Math.max(y.i,f)},v=x.to>x.from;n(v&&e.keep!==!1?x:null),e.onCommit(v?x:null)},u=(m,h)=>{if(!e.enabled)return!1;if(m.key==="Escape"&&t)return s(),e.onCommit(null),!0;if(m.key==="Enter"&&t&&i.current!==null)return i.current=null,e.keep===!1&&n(null),e.onCommit(t),!0;if(!m.shiftKey||m.key!=="ArrowLeft"&&m.key!=="ArrowRight"||e.count<2)return!1;let g=m.key==="ArrowRight"?1:-1,y=i.current??h??(g>0?0:e.count-1),f=t&&i.current!==null?t.from===y?t.to:t.from:y,x=Math.max(0,Math.min(e.count-1,f+g));return i.current=y,n(x===y?null:{from:Math.min(y,x),to:Math.max(y,x)}),!0};return{range:t,dragging:r,keyboard:t!==null&&i.current!==null,down:l,move:c,up:d,key:u}}function zo(e){let[t,n]=(0,Ke.useState)(null);return t&&t.sig!==e&&n(null),{view:t&&t.sig===e?t.range:null,zoomTo:r=>n({sig:e,range:r}),reset:()=>n(null)}}function Ho(e,t,n){let r=Bo[n.lang],o=e.brush==="zoom"?"zoom":e.brush?"select":null,a=Ss({enabled:o!==null,count:n.count,indexAt:n.indexAt,inPlot:n.inPlot,keep:o!=="zoom",onCommit:l=>{let c=l?n.toXRange(l):null;e.onBrush?.(c),o==="zoom"&&c&&c.to>c.from&&t.zoomTo([c.from,c.to])}}),i={onPointerDown:o?a.down:void 0,onPointerUp:o?a.up:void 0,onKey:o?l=>l.key==="Escape"&&t.view&&!a.range?(t.reset(),!0):a.key(l,n.active):void 0,overlay:t.view?(0,Z.jsx)(As,{p:n.p,onReset:t.reset,text:r}):null},s=a.keyboard?o==="zoom"?r.zoomHint:r.pickHint:"";return{brush:a,frame:i,hint:s,text:r}}function Xt(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e===0?null:(t-e)/Math.abs(e)}function Yt(e,t=ne){let n=Math.round(e*1e3)/10;return`${n>0?"+":""}${Le(n,{locale:t,maximumFractionDigits:1})}%`}function jo(e){let{p:t,top:n,bottom:r}=e,o=Math.min(e.x0,e.x1),a=Math.max(e.x0,e.x1),i=Q(e.main,11.5,800),s=Q(e.sub,10.5,500)+6,l=i+s+16,c=Math.max(2,Math.min(e.width-l-2,(o+a)/2-l/2)),d=n+4;return(0,Z.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,Z.jsx)("rect",{x:o,y:n,width:Math.max(1,a-o),height:Math.max(0,r-n),fill:t.paint("accent"),opacity:e.dragging?.1:.14}),(0,Z.jsx)("line",{x1:o,x2:o,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,Z.jsx)("line",{x1:a,x2:a,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,Z.jsx)("rect",{x:c,y:d,width:l,height:22,rx:8,fill:t.paint("panel"),stroke:t.paint("line")}),(0,Z.jsx)(ae,{x:c+8,y:d+11,size:11.5,weight:800,fill:t.paint("ink"),children:e.main}),(0,Z.jsx)(ae,{x:c+8+i+6,y:d+11,size:10.5,weight:500,fill:t.paint("muted"),children:e.sub})]})}function Vo(e){let{p:t,width:n,top:r,bottom:o,max:a,min:i}=e,s=Bo[e.lang];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Oo,{p:t,x:a.x,y:a.y,text:`${s.high} ${a.text}`,below:a.y-26<r+30,width:n}),(0,Z.jsx)(Oo,{p:t,x:i.x,y:i.y,text:`${s.low} ${i.text}`,below:i.y+26<o,width:n})]})}function Oo(e){let{p:t}=e,n=Q(e.text,10.5,700)+12,r=18,o=Math.max(2,Math.min(e.width-n-2,e.x-n/2)),a=e.below?e.y+8:e.y-r-8;return(0,Z.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,Z.jsx)("circle",{cx:e.x,cy:e.y,r:3.5,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:2}),(0,Z.jsx)("rect",{x:o,y:a,width:n,height:r,rx:9,fill:t.paint("ink")}),(0,Z.jsx)(ae,{x:o+n/2,y:a+r/2,anchor:"middle",size:10.5,weight:700,fill:t.paint("onInk"),children:e.text})]})}function As(e){let{p:t}=e;return(0,Z.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onReset,"aria-label":e.text.resetLabel,style:{position:"absolute",top:0,right:0,height:24,padding:"0 10px",borderRadius:12,border:`1px solid ${t.paint("line")}`,background:t.paint("panel"),color:t.paint("muted"),fontSize:11.5,fontWeight:600,zIndex:4},children:e.text.reset})}var J=R(X(),1);function Wo(e,t){let n=pe(e.theme),[r,o,a]=Kt(e.width),i=nt(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,d=Ut(e.reducedMotion??"auto"),u=e.animate!==!1&&!d&&he,m=To(r,e.animateOnView!==!1&&u),h=le(e.locale),g=Y(h),y=(0,J.useMemo)(()=>Ve(e.format,h,t.format),[e.format,h,t.format]),f=(0,J.useCallback)(U=>Tt(U,{locale:h}),[h]),x=(0,J.useMemo)(()=>St(y,e.unit),[y,e.unit]),v=(0,J.useMemo)(()=>Ot(e.data),[e.data]),[T,M]=(0,J.useState)(null),[b,D]=(0,J.useState)(null),E=(0,J.useRef)([]),I=(0,J.useRef)(e.onHover);I.current=e.onHover;let B=(0,J.useRef)(e.onClick);B.current=e.onClick;let _=(0,J.useRef)(null),N=(0,J.useRef)(null),F=(0,J.useRef)(null),A=(0,J.useCallback)((U,oe="pointer")=>{if(F.current!==U){F.current=U;let de=U===null?null:E.current[U]??null;queueMicrotask(()=>I.current?.(de)),N.current?.(U)}_.current=U===null?null:oe,M(U),D(_.current)},[]),k=(0,J.useCallback)(U=>{_.current!=="keyboard"&&(_.current=U===null?null:"sync",M(U),D(_.current))},[]),C=(0,J.useCallback)(U=>{let oe=E.current[U];oe&&B.current?.(oe)},[]),L=_r(e.replayKey),z=e.width!==void 0||(a??0)>0,V={enabled:u,active:m.visible&&z,near:m.near,replayKey:L,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},K=(0,J.useCallback)((U,oe=1)=>T===null||T===U?oe:oe*.38,[T]);return{p:n,width:s,height:c,measured:z,responsive:e.width===void 0,pending:he&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:V,fv:x,fmt:y,pct:f,locale:h,lang:g,t:g==="ko"?hr:fr,active:T,via:b,setActive:A,click:C,events:E,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:K,sig:v,description:e.description,reduced:d,publish:N,applySync:k}}var q=R(X(),1);function Fs(e){return 1-Math.pow(1-e,3)}function Ps(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Rs(e){return e==="easeInOut"?Ps:e==="linear"?t=>t:Fs}function Ns(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 ot(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 qt(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 Go(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 Ko(e,t,n,r){if(!t||!n||t.length!==n.length)return ot(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 ot(s,n[i]))o.push(l)}return o.length===r?o:ot(e,r)}var Zt=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||!qt(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),Go(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=qt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=Ko(s.cur,s.parts,i.parts,c),s.vel=Ko(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Go(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=qt(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=qt(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=ot(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=Rs(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=ot(s.from,c)),s.vel.length!==c&&(s.vel=ot(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let d;if(this.easing==="spring"){let u=Math.exp(-a*l),m=a*l>=8&&a*l<20,h=0;for(let g=0;g<c;g++){let y=s.from[g]-s.to[g],f=s.vel[g]+a*y;s.cur[g]=s.to[g]+(y+f*l)*u,s.curVel[g]=(s.vel[g]-a*f*l)*u,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[g]-s.to[g]),Math.abs(s.curVel[g]/a)))}d=a*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),m=r(u),h=Ns(this.easing,u)/o;for(let g=0;g<c;g++)s.cur[g]=s.from[g]+(s.to[g]-s.from[g])*m,s.curVel[g]=(s.to[g]-s.from[g])*h;d=u>=1,s.progress=m}if(d){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&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}},ft=new Set,Jt=0;function Uo(e){Jt=0;let t=Array.from(ft);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||ft.delete(n)}ft.size&&typeof requestAnimationFrame<"u"&&(Jt=requestAnimationFrame(Uo))}function Xo(e){return ft.add(e),!Jt&&typeof requestAnimationFrame<"u"&&(Jt=requestAnimationFrame(Uo)),()=>{ft.delete(e)}}function Ds(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 Yo(e,t){let n=(0,q.useMemo)(()=>Ds(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:d=0}=t,u=(0,q.useRef)(null),m=(0,q.useRef)("init"),h=(0,q.useRef)(null),g=(0,q.useRef)(s),y=(0,q.useRef)(i),f=(0,q.useRef)(!1),x=(0,q.useRef)(0),[,v]=(0,q.useState)(0),T=(0,q.useRef)(null),M=(0,q.useRef)(!0);u.current||(u.current=new Zt,u.current.configure(l,c),u.current.snap(n),h.current=n);let b=u.current;if(b.configure(l,c),h.current!==n){let N=m.current,F=!Object.is(g.current,s);b.sameTargets(n)?b.refreshData(n):!r||N==="init"?b.snap(n):N==="idle"?b.hold(n):N==="running"||F?b.update(n,vt(),d):b.snap(n),h.current=n,g.current=s}let D=(0,q.useRef)(()=>!1);D.current=N=>{if(!M.current)return!1;let F=b.step(N);return!F&&m.current==="running"&&(m.current="done"),v(A=>(A+1)%1e9),F||(T.current=null),F};let E=(0,q.useCallback)(()=>{if(!he||T.current||!b.animating)return;let N=F=>D.current(F);T.current=Xo(N)},[b]);we(()=>{let N=!Object.is(y.current,i);if(y.current=i,!r){(m.current!=="done"||b.animating)&&(b.snap(h.current??n),m.current="done",v(F=>F+1));return}m.current==="init"||N&&a?(b.hold(h.current??n),m.current="idle",f.current=!1,v(F=>F+1)):N&&(f.current=!0)},[r,i]),we(()=>{!r||!a||!f.current||(f.current=!1,b.hold(h.current??n),m.current="idle",v(N=>N+1))},[a,r]),(0,q.useEffect)(()=>{r&&o&&m.current==="idle"&&(b.start(vt()),x.current+=1,m.current="running",E(),v(N=>N+1))},[r,o,i,b,E]),(0,q.useEffect)(()=>{b.animating&&E()}),(0,q.useEffect)(()=>(M.current=!0,()=>{M.current=!1,T.current?.(),T.current=null}),[]);let I=vt(),B=b.elapsed(I),_=r&&m.current==="idle";return{items:b.items(),get:N=>b.get(N),elapsed:_?0:B,fade:(N,F=320)=>_?0:Number.isFinite(B)?Math.max(0,Math.min(1,(B-N)/F)):1,waiting:_,animating:b.animating,generation:x.current}}var _n=R(O(),1);function Zo(e,t,n,r,o){if(r)return o==="categorical"?$e(e,t,n):$r(e,t,n);if(o==="categorical")return $e(e,t,n);let a=ee(e,"strong"),i=ee(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var Ls=R(X(),1);var In=R(O(),1);var Jo=e=>e?"neutralStrong":"accent";var On=R(O(),1);function Qo(e,t,n,r){if(typeof e!="function")return Te(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 me=R(X(),1);var j=R(O(),1),Es={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}, ${Ye(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Bn={en:Es,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}일 이동평균`}},Qt=["ink","muted","dim"];function zn(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Qt.length)}function _s(e,t,n){let r=Ie(t.x,"date"),o=Ce(t.open,"open"),a=Ce(t.high,"high"),i=Ce(t.low,"low"),s=Ce(t.close,"close"),l=t.volume===void 0?null:Ce(t.volume,"volume"),c=t.dayFirst??Pt(e.map((f,x)=>r(f,x))),d=e.map((f,x)=>{let v=r(f,x),T=typeof v=="number"&&Math.abs(v)<=1e10||typeof v=="string"&&/^\d{4}$/.test(v.trim())?null:Ee(v,c);return{d:f,i:x,xv:v,dt:T,t:T?T.getTime():x,c:s(f,x),o:o(f,x),h:a(f,x),l:i(f,x),v:l?l(f,x):NaN}}),u=d.every(f=>f.dt),m=d.filter(f=>Number.isFinite(f.c));u&&m.sort((f,x)=>f.t-x.t);let h=[],g=new Set,y=NaN;return m.forEach((f,x)=>{let v=Number.isFinite(f.o)?f.o:Number.isFinite(y)?y:f.c,T=Math.max(v,f.c,Number.isFinite(f.h)?f.h:-1/0),M=Math.min(v,f.c,Number.isFinite(f.l)?f.l:1/0),b=f.dt?_e(f.dt,{locale:n,year:"numeric",month:"short",day:"numeric"}):String(f.xv??x+1),D=f.dt?String(f.t):String(f.xv);g.has(D)&&(D=`${D}#${x}`),g.add(D),h.push({i:x,span:1,key:D,label:b,t:u?f.t:x,o:v,h:T,l:M,c:f.c,v:f.v,datum:f.d}),y=f.c}),{candles:h,dated:u}}function Is(e,t){if(e.length<=t||t<2)return e;let n=Math.ceil(e.length/t),r=[];for(let o=0;o<e.length;o+=n){let a=e.slice(o,o+n),i=a[0],s=a[a.length-1],l=-1/0,c=1/0,d=0,u=!1;for(let m of a)l=Math.max(l,m.h),c=Math.min(c,m.l),Number.isFinite(m.v)&&(d+=m.v,u=!0);r.push({i:i.i,span:a.reduce((m,h)=>m+h.span,0),key:i.key,label:a.length>1?`${i.label} ~ ${s.label}`:i.label,t:i.t,o:i.o,h:l,l:c,c:s.c,v:u?d:NaN,datum:s.datum})}return r}function Os(e,t){let n=new Array(e.length).fill(NaN);if(t<1)return n;let r=0;for(let o=0;o<e.length;o++)r+=e[o],o>=t&&(r-=e[o-t]),o>=t-1&&(n[o]=r/t);return n}function en(e){let t=Wo(e,{height:p=>Math.max(240,Math.min(340,p*.55)),duration:700,format:"number"}),{p:n,width:r,height:o}=t,a=(0,me.useMemo)(()=>_s(e.data,e,t.locale),[e.data,e.x,e.open,e.high,e.low,e.close,e.volume,e.dayFirst,t.locale]),i=a.dated,s=zo(t.sig),l=s.view,c=(0,me.useMemo)(()=>l?a.candles.slice(l[0],l[1]+1):a.candles,[a,l]),{up:d,down:u}=(0,me.useMemo)(()=>{let p=($,S)=>({fill:n.color($,S),text:fn(n,n.raw($,S))});return{up:p(e.upColor,"accent"),down:p(e.downColor,"neutralStrong")}},[n,e.upColor,e.downColor]),m=10,h=22,g=Math.max(40,r-56),y=Math.max(8,Math.round(e.maxCandles??g/4)),{cs:f,lo:x,hi:v,vmax:T,hasVolume:M}=(0,me.useMemo)(()=>{let p=Is(c,y),$=1/0,S=-1/0,H=0,Ne=!1;for(let Ae of p)$=Math.min($,Ae.l),S=Math.max(S,Ae.h),Number.isFinite(Ae.v)&&(H=Math.max(H,Ae.v),Ne=!0);let je=!Number.isFinite($);return{cs:p,lo:je?0:$,hi:je?1:S,vmax:H,hasVolume:e.volume!==void 0&&Ne}},[c,y,e.volume]),b=f.length,D=M?Math.max(28,(o-m-h)*.18):0,E=o-h-(M?D+8:0),I=Math.max(2,Math.round((E-m)/60)),B=zt(e.annotations),_=e.yDomain??ze(Math.min(x,...B),Math.max(v,...B),I,{zero:!1}),N=At(e.format,t.locale,0),F=tt(_,[0,1]).ticks(I),A=Math.max(Vt(F,N,t.locale),Q(N(v),10.5,700)+14)+4,k=4,C=r-A,L=b?(C-k)/b:1,z=Math.max(1,Math.min(18,L*.64)),V=p=>k+L*(p+.5),K=tt(_,[E,m]),U=p=>o-h-(T>0&&Number.isFinite(p)?p/T*D:0),oe=(0,me.useMemo)(()=>Te(e.highlight,f.map(p=>p.datum),f.map(p=>p.label),f.map(p=>p.c),"last"),[e.highlight,f]),de=oe.size?Math.max(...oe):-1,se=Math.min(700,12*b),gt=(0,me.useMemo)(()=>f.map((p,$)=>{let S=(K(p.o)+K(p.c))/2,H=o-h;return{key:p.key,to:[K(p.o),K(p.c),K(p.h),K(p.l),U(p.v)],from:[S,S,S,S,H],enter:[S,S,S,S,H],delay:b>1?$/(b-1)*se:0,data:$}}),[f,o,_[0],_[1],D,T,se]),pt=Yo(gt,t.motion),jn=(0,me.useMemo)(()=>{let p=a.candles.map($=>$.c);return zn(e.ma,p.length).map($=>({d:$,v:Os(p,$)}))},[e.ma,a]),Ue=(0,me.useMemo)(()=>jn.map(p=>({d:p.d,v:f.map($=>p.v[$.i+$.span-1])})),[jn,f]),fa=(0,me.useMemo)(()=>Ue.map(p=>{let $="";return p.v.forEach((S,H)=>{Number.isFinite(S)&&($+=`${$?"L":"M"}${V(H).toFixed(1)},${K(S).toFixed(1)}`)}),$}),[Ue,C,E,_[0],_[1]]),xe=t.fv,te=Bn[t.lang],ha=(0,me.useMemo)(()=>f.map((p,$)=>({datum:p.datum,index:$,key:p.key,label:p.label,value:p.c,formatted:te.ohlc(xe(p.o),xe(p.h),xe(p.l),xe(p.c))})),[f,xe,te]),ga=p=>p>0?f[p-1].c:NaN,Vn=p=>Math.max(0,Math.min(b-1,Math.floor((p-k)/L))),{brush:Se,frame:pa,hint:ba,text:bt}=Ho(e,s,{p:n,active:t.active,lang:t.lang,count:b,indexAt:Vn,inPlot:(p,$)=>p>=k&&p<=C&&$>=m&&$<=o-h,toXRange:p=>{let $=f[p.from],S=f[p.to];return{from:$.i,to:S.i+S.span-1,fromKey:$.key,toKey:S.key,fromLabel:$.label,toLabel:S.label}}});dr(t,e.syncId,f.map(p=>p.key),f.map(p=>p.label));let Wn=null;if(t.active!==null&&f[t.active]&&!Se.dragging){let p=f[t.active],$=Xt(ga(t.active),p.c),S=p.c>=p.o?d.fill:u.fill;Wn={x:V(t.active),y:K(p.h),title:p.label,rows:[{label:te.open,value:t.fv(p.o),strong:!1},{label:te.high,value:t.fv(p.h),strong:!1},{label:te.low,value:t.fv(p.l),strong:!1},{label:te.close,value:t.fv(p.c),color:S},...$!==null?[{label:te.change,value:Yt($,t.locale)}]:[],...Number.isFinite(p.v)?[{label:te.volume,value:t.fmt(p.v),strong:!1}]:[]]}}let Gn=null,Kn;if(Se.range&&Se.range.to<b){let{from:p,to:$}=Se.range,S=p,H=p;for(let ke=p;ke<=$;ke++)f[ke].h>f[S].h&&(S=ke),f[ke].l<f[H].l&&(H=ke);let Ne=Xt(f[p].o,f[$].c),je=Ne!==null?Yt(Ne,t.locale):"-",Ae=ke=>i?_e(ke.t,{locale:t.locale,month:"short",day:"numeric"}):ke.label,yt=bt.range(Ae(f[p]),Ae(f[$]));Gn=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(jo,{p:n,x0:V(p)-L/2,x1:V($)+L/2,top:m,bottom:o-h,width:r,main:je,sub:yt,dragging:Se.dragging}),(0,j.jsx)(Vo,{p:n,lang:t.lang,width:r,top:m,bottom:E,max:{x:V(S),y:K(f[S].h),text:t.fv(f[S].h)},min:{x:V(H),y:K(f[H].l),text:t.fv(f[H].l)}})]}),Se.dragging||(Kn=`${te.span(f[p].label,f[$].label,je)}${bt.extremes(t.fv(f[S].h),t.fv(f[H].l))}.${ba}`)}let Re=de>=0?f[de]:null,at=Re?Math.max(m+8,Math.min(E-8,K(Re.c))):null,Un=null;if(Re&&at!==null){let p=Re.c>=Re.o?d:u,$=N(Re.c),S=Q($,10.5,700)+10;Un=(0,j.jsxs)("g",{pointerEvents:"none",opacity:pt.fade(se+200,300),"aria-hidden":"true",children:[(0,j.jsx)("line",{x1:k,x2:C,y1:K(Re.c),y2:K(Re.c),stroke:p.fill,strokeWidth:1,strokeDasharray:"2 3",opacity:.85}),(0,j.jsx)("rect",{x:C+3,y:at-9,width:S,height:18,rx:5,fill:p.fill}),(0,j.jsx)(ae,{x:C+3+S/2,y:at,anchor:"middle",size:10.5,weight:700,fill:p.text,children:$})]})}let ya=(0,me.useMemo)(()=>{let p=[];if(b>1){let $=Math.max(2,Math.floor((C-k)/80));if(i){let S=0;for(let H of Wt(f[0].t,f[b-1].t,$,t.locale)){for(;S<b-1&&f[S+1].t<=H.t;)S++;p.push({x:V(S),label:H.label})}}else{let S=Math.max(1,Math.ceil(b/$));for(let H=0;H<b;H+=S)p.push({x:V(H),label:f[H].label})}}return ho(p,0,C+2)},[f,i,C,t.locale]),xa=(0,me.useMemo)(()=>{if(!b)return`${te.name}. ${te.empty}`;let p=Xt(f[0].o,f[b-1].c);return`${te.name}. ${te.desc(f[0].label,f[b-1].label,b,xe(f[0].o),xe(f[b-1].c))}${p!==null?` (${Yt(p,t.locale)})`:""}${bt.extremes(xe(v),xe(x))}.`},[f,b,x,v,xe,t.locale,te,bt]),Xn=Qt.map(p=>n.paint(p)),Yn=b>1&&(f[b-1].t-f[0].t)/(b-1)||1,qn=p=>{if(p<=f[0].t)return V(0)-(f[0].t-p)/Yn*L;if(p>=f[b-1].t)return V(b-1)+(p-f[b-1].t)/Yn*L;let $=0,S=b-1;for(;S-$>1;){let H=$+S>>1;f[H].t<=p?$=H:S=H}return V($)+(p-f[$].t)/(f[S].t-f[$].t||1)*L},Zn=p=>{let $=i?Ee(p)?.getTime():void 0;return f.findIndex(S=>i?S.t===$:S.key===String(p)||S.label===String(p))},ka=p=>{if(!b)return null;if(i){let S=Ee(p);return S?qn(S.getTime()):null}let $=Zn(p);return $<0?null:V($)},wa=p=>f[Zn(p)]?.label??String(p??""),Jn={p:n,lang:t.lang,xAt:ka,half:L/2,y:K,x0:k,x1:C,top:m+(Ue.length?14:0),bottom:E,time:i&&b>1?{t0:f[0].t,t1:f[b-1].t,n:b,xt:qn}:void 0,points:()=>f.map((p,$)=>({x:V($),y:K(p.c)}))},Qn=t.active!==null&&f[t.active]?t.active:b-1,er=k+2,va=Ue.map((p,$)=>{let S=`${te.ma(p.d)} ${Number.isFinite(p.v[Qn])?N(p.v[Qn]):"-"}`,H=(0,j.jsx)(ae,{x:er,y:m+2,size:10,weight:700,fill:Xn[$],children:S},p.d);return er+=Q(S,10,700)+10,H});return(0,j.jsxs)(Or,{c:t,kind:te.name,ariaLabel:e.ariaLabel,description:e.description??`${xa}${mo(e.annotations,t.lang,t.fv,wa)}`,events:ha,tip:Wn,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(p,$,S)=>{b&&(Se.move(p),t.setActive(Vn(p),S.pointerType==="touch"?"touch":"pointer"))},...pa,announce:Kn,children:[(0,j.jsx)(fo,{p:n,ticks:F,y:K,x0:k,x1:C,fmt:N,locale:t.locale,side:"right",zero:!1,labels:!1}),(0,j.jsx)("g",{"aria-hidden":"true",children:jt(F,N,t.locale).map((p,$)=>at!==null&&Math.abs(K(F[$])-at)<14?null:(0,j.jsx)(ae,{x:C+6,y:Math.round(K(F[$]))+.5,size:ye,fill:n.paint("muted"),children:p},F[$]))}),(0,j.jsx)("rect",{x:k,y:m,width:Math.max(0,C-k),height:Math.max(0,o-h-m),fill:"transparent"}),(0,j.jsx)(lo,{list:e.annotations,g:Jn}),M?(0,j.jsx)("line",{x1:k,x2:C,y1:o-h+.5,y2:o-h+.5,stroke:n.paint("line")}):null,pt.items.map(p=>{let $=p.data,S=f[$];if(!S)return null;let[H,Ne,je,Ae,yt]=p.v,tn=S.c>=S.o?d.fill:u.fill,xt=V($),$a=Math.min(H,Ne),Ca=Math.max(1,Math.abs(Ne-H)),Ma=t.active!==null&&t.active!==$?.55:1;return(0,j.jsxs)("g",{opacity:p.exiting?.3:Ma,children:[M&&Number.isFinite(S.v)?(0,j.jsx)("rect",{x:xt-z/2,y:yt,width:z,height:Math.max(0,o-h-yt),fill:tn,opacity:.32}):null,(0,j.jsx)("line",{x1:xt,x2:xt,y1:je,y2:Ae,stroke:tn,strokeWidth:1}),(0,j.jsx)("rect",{x:xt-z/2,y:$a,width:z,height:Ca,rx:z>=6?1.5:0,fill:tn})]},p.key)}),fa.map((p,$)=>p?(0,j.jsx)("path",{d:p,fill:"none",stroke:Xn[$],strokeWidth:$===0?1.4:1.2,strokeLinejoin:"round",opacity:pt.fade(se,400)*.9,pointerEvents:"none"},Ue[$].d):null),Ue.length>0?(0,j.jsx)("g",{"aria-hidden":"true",opacity:pt.fade(se,400),children:va}):null,(0,j.jsx)(uo,{list:e.annotations,g:Jn}),Un,t.active!==null&&f[t.active]&&!Se.dragging?(0,j.jsx)(go,{p:n,x:V(t.active),top:m,bottom:o-h,dots:[{k:0,y:K(f[t.active].c),color:f[t.active].c>=f[t.active].o?d.fill:u.fill,strong:!0}]}):null,Gn,(0,j.jsx)("g",{"aria-hidden":"true",children:ya.map((p,$)=>(0,j.jsx)(ae,{x:p.x,y:o-h+13,anchor:"middle",size:ye,fill:n.paint("muted"),children:p.label},$))}),t.active!==null&&f[t.active]&&!Se.dragging?(0,j.jsx)(po,{p:n,x:V(t.active),y:o-h+13,label:f[t.active].label,width:r}):null]})}var Bs=R(X(),1);var oa=R(O(),1),zs={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ye(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Hs={en:zs,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},ea=(e,t)=>Hs[e].other(t);function ta(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,Qr(o.map(a=>a.value)))}}var na=e=>Number.isFinite(e)&&e>0?e:0;function ra(e,t,n,r){return r==="emphasis"?vr(e,t,n):$e(e,t,n)}var js=R(X(),1);var la=R(O(),1);function aa(e,t){return t===!1?e.map((n,r)=>r):Jr(e)}function ia(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Te(e,t,t,r,"max")}function sa(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=ee(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?ee(e,"neutral"):Mt(e,1-i/Math.max(1,o.length-1))),r}var Pe=R(O(),1);function ca(e,t){let n=It(e);return n?.type==="scatter"&&t?.size!==void 0?It("bubble"):n}function Vs(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 Ws(e,t,n,r=!1){let o=ca(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Cn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(d.includes(o.type)){let u=Qe(a.label,"label"),m=Ce(a.value,"value"),h=o.type==="waffle",g=t.map((M,b)=>({r:M,label:u(M,b),value:h?m(M,b):na(m(M,b))})),{kept:y,other:f}=h?{kept:g,other:null}:ta(g,i.other,(M,b)=>({r:{},label:ea(Y(n),M),value:b})),x=Te(s,y.map(M=>M.r),y.map(M=>M.label),y.map(M=>M.value),h?"first":"max"),v=f?[...y,f]:y,T=st(M=>h?$e(M,v.length,x):ra(M,v.length,x,i.colorMode));return v.map((M,b)=>({label:M.label,color:T[b]}))}if(o.type==="candlestick"){let u=zn(Array.isArray(i.ma)?i.ma:void 0,t.length),m=Bn[Y(n)];return[{label:m.up,color:i.upColor??"accent"},{label:m.down,color:i.downColor??"neutralStrong"},...u.map((h,g)=>({label:m.maLegend(h),color:Qt[g],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let u=Qe(a.series,"series"),m=et(t.map((y,f)=>u(y,f)));if(m.length<2)return[];let h=Qo(s,t,m,u),g=st(y=>wr(y,m.length,h));return c(m.map((y,f)=>({label:y,color:g[f],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let T=Qe(a.series,"series");u=et(t.map((M,b)=>T(M,b)))}let m=Mn(o.type,a,i);if(m.length){let T=Te(s,u,u,u.map(()=>0),"none"),M=st(D=>$e(D,u.length,T)),b=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((D,E)=>({label:D,color:M[E]}));return[...c(b),...m.map((D,E)=>({label:D,color:Jo(E),shape:"line"}))]}if(u.length<2)return[];let g=o.type==="bar"&&i.layout==="diverging"&&s===void 0?Zr(u.length,Array.isArray(i.negative)?i.negative.map(T=>u.indexOf(String(T))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,y=g>=0?new Set([g]):Te(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((T,M)=>({label:T,color:y.has(M)?"accent":"neutralStrong",shape:"square"})));let f=i.colorMode,x=T=>$e(T,u.length,y);if((o.type==="line"||o.type==="area")&&(x=T=>Zo(T,u.length,y,o.type==="area",f)),o.type==="stream"){let T=ut(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),M=aa(T.values,i.reorder),b=ia(s,T.series,T.values);x=D=>sa(D,M,b)}let v=st(x);return c(u.map((T,M)=>({label:T,color:v[M],...o.type==="line"&&{shape:"line"}})))}return[]}function Gs(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Vr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ks(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function ua(e,t){let{spec:n}=e,r=ca(n.type,n.encoding),o=(0,ht.useMemo)(()=>Io(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=jr(n,e.locale),s=le(i),l=Y(s),c=Ao(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),d=Kr(n),u=(0,ht.useMemo)(()=>d?Eo(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],g=h.join(""),[y,f]=(0,ht.useState)(null);if(!r)return(0,Pe.jsx)($n,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let x=o??c.data,v=t[r.type],T={...n.options??{}},M={...Vs(r,n.encoding),...T,...u?{tooltip:u}:{},data:x,...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},b=n.card?.legend==="toggle"&&Gr(r.type,n.encoding??{},T),D=y&&y.base===g?y.hidden:h;b&&(M.hidden=D);let E=F=>f(A=>{let k=A&&A.base===g?A.hidden:h;return{base:g,hidden:k.includes(F)?k.filter(C=>C!==F):[...k,F]}}),I=M.height??220,B=Gs(n,r.type),_=a&&!x.length&&(c.loading||c.error||c.empty)?(0,Pe.jsx)($n,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:I,locale:i}):B?(0,Pe.jsx)(So,{chart:v,...Ks(r.type,B,M)}):(0,Pe.jsx)(v,{...M});if(n.card){let F=n.card,A=F.legend==="auto"||F.legend==="toggle"?Ws(n,x,s,b):F.legend,k=A?.length?b?(0,Pe.jsx)(vn,{items:A,hidden:D,onToggle:E,locale:i}):A:void 0,C=F.download?(0,Pe.jsx)(Lo,{data:x,columns:Ur(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;_=(0,Pe.jsx)(Ir,{number:F.number,title:F.title??Hr(r,l),subtitle:F.subtitle,legend:k,actions:C,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:_})}let N=e.theme??n.theme;return N&&(_=(0,Pe.jsx)(Nt,{theme:N,children:_})),_}function Us({cfg:e,components:t}){let n=nt();return ua({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function da(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ma.hydrateRoot)(r,(0,Hn.createElement)(Nt,{theme:o.theme,cssVars:!0},(0,Hn.createElement)(Us,{cfg:o,components:{[e]:t}})))}da("candlestick",en);})();
|