ztd-charts-cli 0.11.2 → 0.12.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.
Files changed (49) hide show
  1. package/dist/api.d.ts +32 -32
  2. package/dist/api.js +1 -1
  3. package/dist/{chunk-6RWRYJ22.js → chunk-KNBUVTZ2.js} +55 -31
  4. package/dist/cli.js +7 -2
  5. package/dist/client/area.js +5 -5
  6. package/dist/client/bar.js +9 -9
  7. package/dist/client/barRace.js +5 -5
  8. package/dist/client/beeswarm.js +5 -5
  9. package/dist/client/box.js +9 -9
  10. package/dist/client/bubble.js +7 -7
  11. package/dist/client/bullet.js +4 -4
  12. package/dist/client/bump.js +6 -6
  13. package/dist/client/calendar.js +5 -5
  14. package/dist/client/candlestick.js +6 -6
  15. package/dist/client/chord.js +5 -5
  16. package/dist/client/choropleth.js +4 -4
  17. package/dist/client/donut.js +6 -6
  18. package/dist/client/dumbbell.js +5 -5
  19. package/dist/client/flowMap.js +5 -5
  20. package/dist/client/funnel.js +9 -9
  21. package/dist/client/gauge.js +3 -3
  22. package/dist/client/heatmap.js +5 -5
  23. package/dist/client/histogram.js +5 -5
  24. package/dist/client/line.js +5 -5
  25. package/dist/client/lollipop.js +1 -1
  26. package/dist/client/marimekko.js +6 -6
  27. package/dist/client/network.js +8 -8
  28. package/dist/client/parallel.js +6 -6
  29. package/dist/client/pareto.js +1 -1
  30. package/dist/client/pie.js +6 -6
  31. package/dist/client/radar.js +7 -7
  32. package/dist/client/radialBar.js +1 -1
  33. package/dist/client/ridgeline.js +4 -4
  34. package/dist/client/sankey.js +10 -10
  35. package/dist/client/scatter.js +10 -10
  36. package/dist/client/segmented.js +5 -5
  37. package/dist/client/skyline.js +9 -9
  38. package/dist/client/slope.js +6 -6
  39. package/dist/client/sparkline.js +6 -6
  40. package/dist/client/stream.js +6 -6
  41. package/dist/client/sunburst.js +4 -4
  42. package/dist/client/symbolMap.js +3 -3
  43. package/dist/client/tileMap.js +4 -4
  44. package/dist/client/timeline.js +8 -8
  45. package/dist/client/tree.js +2 -2
  46. package/dist/client/treemap.js +3 -3
  47. package/dist/client/waffle.js +5 -5
  48. package/dist/client/waterfall.js +4 -4
  49. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- (()=>{var za=Object.create;var Jr=Object.defineProperty;var Ba=Object.getOwnPropertyDescriptor;var Ha=Object.getOwnPropertyNames;var ja=Object.getPrototypeOf,Ga=Object.prototype.hasOwnProperty;var Kn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Va=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ha(t))!Ga.call(e,o)&&o!==n&&Jr(e,o,{get:()=>t[o],enumerable:!(r=Ba(t,o))||r.enumerable});return e};var P=(e,t,n)=>(n=e!=null?za(ja(e)):{},Va(t||!e||!e.__esModule?Jr(n,"default",{value:e,enumerable:!0}):n,e));var Q=Kn((Nu,qr)=>{qr.exports=globalThis.__ztdReact.react});var Qr=Kn((Ru,Zr)=>{Zr.exports=globalThis.__ztdReact["react-dom/client"]});var V=Kn((Wu,No)=>{No.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Pr=P(Q(),1),$a=P(Qr(),1);var Ut=P(Q(),1);var cn=P(Q(),1);var eo=P(Q(),1),Ct=(0,eo.createContext)(void 0);var oo=P(Q(),1);var Wa=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],to='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',no='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',at={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:to,monoFamily:no,radius:18,radiusCode:14,radiusMark:4},Un={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:to,monoFamily:no,radius:18,radiusCode:14,radiusMark:4},Xn={dark:at,light:Un};function Jt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Yn(e){let t={};for(let n of Wa){let r=e[n];typeof r=="string"&&(t[Jt(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 Jn(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 Ka=`
1
+ (()=>{var za=Object.create;var Jr=Object.defineProperty;var Ba=Object.getOwnPropertyDescriptor;var Ha=Object.getOwnPropertyNames;var ja=Object.getPrototypeOf,Ga=Object.prototype.hasOwnProperty;var Kn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Va=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ha(t))!Ga.call(e,o)&&o!==n&&Jr(e,o,{get:()=>t[o],enumerable:!(r=Ba(t,o))||r.enumerable});return e};var P=(e,t,n)=>(n=e!=null?za(ja(e)):{},Va(t||!e||!e.__esModule?Jr(n,"default",{value:e,enumerable:!0}):n,e));var Q=Kn((Nu,Zr)=>{Zr.exports=globalThis.__ztdReact.react});var Qr=Kn((Ru,qr)=>{qr.exports=globalThis.__ztdReact["react-dom/client"]});var V=Kn((Wu,No)=>{No.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Pr=P(Q(),1),$a=P(Qr(),1);var Xt=P(Q(),1);var cn=P(Q(),1);var eo=P(Q(),1),St=(0,eo.createContext)(void 0);var oo=P(Q(),1);var Wa=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],to='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',no='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',at={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:to,monoFamily:no,radius:18,radiusCode:14,radiusMark:4},Xn={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:to,monoFamily:no,radius:18,radiusCode:14,radiusMark:4},Un={dark:at,light:Xn};function Jt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Yn(e){let t={};for(let n of Wa){let r=e[n];typeof r=="string"&&(t[Jt(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 Jn(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 Ka=`
2
2
  .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
3
  .ztd-root:focus{outline:none}
4
4
  .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${at.accent});outline-offset:3px;border-radius:6px}
@@ -19,10 +19,10 @@
19
19
  @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
20
  .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
21
  @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
- `;function io(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 ao(e,t){let[n]=(0,oo.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var ro=!1;function Ot(){if(ro||typeof document>"u"||(ro=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Ka,document.head.appendChild(e)}var qt=P(Q(),1),_e=typeof window<"u"&&typeof document<"u",Ve=_e?qt.useLayoutEffect:qt.useEffect;function Zt(){return typeof performance<"u"?performance.now():Date.now()}var We=P(Q(),1),Ua=(0,We.createContext)(void 0),Qt=new Map;function Xa(e,t){let n=Qt.get(e);return n||Qt.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||Qt.delete(e)}}function Ya(e,t,n){Qt.get(e)?.forEach(r=>r(t,n))}function Ja(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function so(e,t,n,r){let o=(0,We.useContext)(Ua),i=t??o,[a]=(0,We.useState)(()=>({})),s=(0,We.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=i?u=>Ya(i,u===null||s.current.keys[u]===void 0?null:{key:s.current.keys[u],label:s.current.labels[u]},a):null;let l=e.applySync;(0,We.useEffect)(()=>{if(i)return Xa(i,(u,d)=>{if(d===a)return;let c=u?Ja(s.current.keys,s.current.labels,u):-1;l(c<0?null:c)})},[i,a,l])}function te(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function De(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var lo={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},uo={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var qa=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Za={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Qa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function es(e){return Qa(qa,e)}function co(e,t){let n=es(e);return{text:n?n[t]:e,...Za[n?.id??"basic"]}}var mo={white:"#ffffff",black:"#000000",transparent:"#00000000"};function St(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),mo[t.toLowerCase()]&&(t=mo[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function go(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 Zn(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 At(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fo(e){return .2126*At(e[0])+.7152*At(e[1])+.0722*At(e[2])}function Qn(e,t,n){let r=typeof e=="string"?St(e):e,o=typeof t=="string"?St(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?St(n):n:null;o[3]<1&&i&&(o=Zn(o,i));let a=r[3]<1?Zn(r,o):r,s=fo(a),l=fo(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function ts(e){return[At(e[0]),At(e[1]),At(e[2])]}function qn(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 ho(e){let[t,n,r]=ts(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function ns([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[qn(4.0767416621*o-3.3077115913*i+.2309699292*a),qn(-1.2684380046*o+2.6097574011*i-.3413193965*a),qn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function en(e,t,n){let r=St(e),o=St(t);if(!r||!o)return e;let i=ho(r),a=ho(o),s=Math.max(0,Math.min(1,n));return go(ns([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function er(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Qn(i,e,n);a>o&&(o=a,r=i)}return r}function de(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function rs(e,t){let n=er(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Qn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):er(t,["#FFFFFF","#000000"])}function tn(e,t){let n=en(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:rs(e,n),raw:n}}function Le(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=de(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=de(e,"neutral");else if(s===0)r[a]=de(e,"ink");else if(s===i-1)r[a]=de(e,"neutral");else if(i===3)r[a]=de(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?de(e,"strong"):tn(e,1-l)}}),r}var tr="mix:";function st(e){return e({theme:Un,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${tr}${o}`}).map(n=>n.fill)}function po(e,t){return t?.startsWith(tr)?e.mix("neutralStrong","neutral",Number(t.slice(tr.length))):e.color(t)}function It(e,t,n){return Le(e,t+1,n).slice(0,t)}function bo(e,t,n,r="neutral"){let o=de(e,"accent"),i=de(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function yo(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=de(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=de(e,"neutral"):s===0?r[a]=de(e,"strong"):s===i-1?r[a]=de(e,"neutral"):r[a]=tn(e,1-s/(i-1))}),r}var Ee=P(Q(),1);var rn=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),he="en-US",xo=new Map;function nr(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=xo.get(r);return o||(o=new Intl.NumberFormat(e,n),xo.set(r,o)),o}function rr(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function lt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=he,...r}=t;return rr(nr(n,r).format(e))}var or=e=>e!==0&&Math.abs(e)<.05,ir=(e,t,n="")=>`${lt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function nn(e,t={}){if(!Number.isFinite(e))return"-";if(or(e)&&t.maximumFractionDigits===void 0)return ir(e,t.locale??he,"%");let n=Math.abs(e);return`${lt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function $o(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=he,...r}=t;if(te(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],u=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**d)/10**d;if(a>0&&c>=i[a-1][0]/s){a--;continue}return(e<0&&c!==0?"-":"")+lt(c,{locale:n,...r,maximumFractionDigits:d})+l}}return rr(nr(n,{notation:"compact",...r}).format(e))}var os=(e,t=te(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function pt(e,t=he,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=nr(t,o);return l=>Number.isFinite(l)?`${a}${rr(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>nn(o,{locale:t});case"ratio":return o=>nn(o*100,{locale:t});case"compact":return o=>$o(o,{locale:t});case"currency":return r(os(t));default:{let o=r({maximumFractionDigits:1});return i=>or(i)?ir(i,t):o(i)}}}function Nt(e,t=he,n=0){return e!==void 0?pt(e,t):n>=1e5?r=>or(r)?ir(r,t):$o(r,{locale:t}):r=>lt(r,{locale:t})}function is(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var ar=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,as=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,ss=["january","february","march","april","may","june","july","august","september","october","november","december"],ko=e=>{let t=e.toLowerCase();return t.length<3?0:ss.findIndex(n=>n.startsWith(t))+1},wo=e=>+e+(+e<30?2e3:1900);function Mo(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var ls=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],To=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Co=/\{([^{}]+)\}/g;function on(e,t){let n;for(let r of ls)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?[wo(n[3]),+n[2],+n[1],1]:[wo(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=To.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=ko(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=ko(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var So=e=>as.test(e)||on(e)!==null;function Ao(e){let t;for(let n of e){let r=typeof n=="string"?To.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function an(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(ar(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return an(`${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=on(n,t);if(r)return is(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 vo=new Map;function zt(e,t={month:"short",day:"numeric"}){let n=an(e);if(!n)return"-";let{locale:r=he,...o}=t,i=r+JSON.stringify(o),a=vo.get(i);return a||(a=new Intl.DateTimeFormat(r,o),vo.set(i,a)),a.format(n)}var sr=P(V(),1),sn=(0,Ee.createContext)({theme:at,cssVars:!0});function us(e,t=at){return e?typeof e=="string"?Xn[e]??t:Jn(t,e):t}function ln(e){let t=(0,Ee.useContext)(sn),n=e.base?Xn[e.base]:t.theme,r=(0,Ee.useMemo)(()=>us(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,Ee.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,Ee.useMemo)(()=>Yn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,sr.jsx)(sn.Provider,{value:a,children:(0,sr.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var cs=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Ro(e){return cs.has(e)}function ms(e,t){let n=r=>t?`var(${Jt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Ro(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Ro(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:en(e[r],e[o],i)}}}function Oe(e){let t=(0,Ee.useContext)(sn);return(0,Ee.useMemo)(()=>{let n=Jn(t.theme,e);return ms(n,t.cssVars)},[t.theme,t.cssVars,e])}function xe(e){let t=(0,Ee.useContext)(sn);return e??t.locale??he}function Fo(e){return e?Yn(e):{}}var un=P(Q(),1),lr=(0,un.createContext)(void 0);function Po(e){let t=(0,un.useContext)(lr);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=P(V(),1),ds={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`},fs={en:ds,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var hs={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},ur=e=>fs[te(xe(e))];function cr(e){let t=Oe(e.theme),n=ur(e.locale),[r,o]=(0,cn.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.label)).length,u=(0,_.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((d,c)=>{let m=!s.has(d.label),h=m&&l===1,f=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(gs,{p:t,item:d,off:!m}),(0,_.jsx)("span",{style:m?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,_.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,_.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":m,"aria-disabled":h||void 0,onClick:()=>{h||(a(d.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:f}):f},c)})});return a?(0,_.jsxs)(_.Fragment,{children:[u,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:hs,children:r?n.shown(l,e.items.length):""})]}):u}function gs({p:e,item:t,off:n}){let r=po(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,_.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,_.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,_.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,_.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function ps(e){let t=Oe(e.theme),n=co(e.level,te(xe(e.locale)));return(0,_.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function bs(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,_.jsxs)(_.Fragment,{children:[e.slice(0,r),(0,_.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function _o(e){let t=Oe(e.theme),n=ur(e.locale),[r,o]=(0,cn.useState)(0);Ve(()=>Ot(),[]);let i=()=>{o(m=>m+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)(cr,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,u=e.replay||e.onReplay,d=e.source!==void 0||e.note!==void 0?(0,_.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,c=e.takeaway!==void 0||e.level||e.sample?(0,_.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,_.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,_.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,_.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,_.jsx)(ps,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,_.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,_.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,_.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,_.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:bs(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,_.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,_.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,_.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,_.jsx)("span",{}),a]}):null]}),(0,_.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,_.jsx)(lr.Provider,{value:r,children:(0,_.jsx)(Ct.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,_.jsxs)(_.Fragment,{children:[d,c]}):c]})}function mr(e){let t=Oe(e.theme),n=ur(e.locale),r=e.height??220;if(Ve(()=>Ot(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,_.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,_.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,_.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,_.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,_.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,_.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,_.jsx)(_.Fragment,{children:e.children})}var _t=P(Q(),1);var ke=P(Q(),1);var Y=P(V(),1),mn=60,dr=8;function Do(e,t){return e.length>dr?[...e.slice(0,dr),{label:t(e.length-dr),value:""}]:e}var dn={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Lo(e){let{c:t,events:n}=e,r=(0,ke.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Ve(()=>{Ot()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,ke.useContext)(Ct),u=e.ariaLabel??l??e.kind,d=(0,ke.useMemo)(()=>s?`${n.length}${n.slice(0,mn).map(M=>`${M.label}${M.series??""}${M.formatted??M.value??""}`).join("")}`:"",[n,s]),c=(0,ke.useMemo)(()=>(0,Y.jsx)(ys,{label:u,events:n,t:t.t}),[u,d,t.t]),m=(0,ke.useRef)(null);(0,ke.useEffect)(()=>{let M=()=>{m.current=null};return window.addEventListener("scroll",M,{capture:!0,passive:!0}),window.addEventListener("resize",M,{passive:!0}),()=>{window.removeEventListener("scroll",M,{capture:!0}),window.removeEventListener("resize",M)}},[]),(0,ke.useEffect)(()=>{m.current=null},[t.width,t.height]);let h=M=>{if(M.target!==M.currentTarget)return;if(e.onKey?.(M)){M.preventDefault();return}let F=t.active,O;switch(M.key){case"ArrowRight":case"ArrowDown":O=F===null?0:(F+1)%a;break;case"ArrowLeft":case"ArrowUp":O=F===null?a-1:(F-1+a)%a;break;case"Home":O=0;break;case"End":O=a-1;break;case"Escape":if(F===null)return;O=null;break;case"Enter":case" ":F!==null&&(M.preventDefault(),t.click(F));return;default:return}M.preventDefault(),t.setActive(O,"keyboard")},{via:f,node:g,setActive:v}=t;(0,ke.useEffect)(()=>{if(f!=="touch"||!g)return;let M=F=>{g.contains(F.target)||v(null)};return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[f,g,v]);let x=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,C=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,b=typeof e.renderTip=="function"&&x?e.renderTip(x):null,w=e.announce??(t.via==="keyboard"&&x?`${x.label}${x.series?` ${x.series}`:""}: ${x.formatted??x.value??""} (${(t.active??0)+1}/${a})`:""),L;if($){let M=$.x*C,F=t.width*C,O=`clamp(${(4-M).toFixed(1)}px, -50%, calc(${(F-M-4).toFixed(1)}px - 100%))`,K=$.y<64;L={position:"absolute",left:M,top:$.y*C,transform:`translate(${O}, ${K?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*C-8)}}let E=M=>{m.current=null,M.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},H=M=>M?F=>{let O=m.current??(m.current=F.currentTarget.getBoundingClientRect());O.width&&M((F.clientX-O.left)/O.width*t.width,(F.clientY-O.top)/O.height*t.height,F)}:void 0,j=H(e.onPointerMove),B=H(e.onPointerDown),I=j||B?M=>{M.pointerType==="touch"&&j?.(M),B?.(M)}:void 0,N=H(e.onPointerUp),R=Fo(e.theme);return(0,Y.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":u,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:M=>{t.via==="keyboard"&&!M.currentTarget.contains(M.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"),...R,...e.style},children:[t.pending?null:e.underlay,(0,Y.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:j,onPointerDown:I,onPointerUp:N,onPointerCancel:N,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,Y.jsx)("title",{id:o,children:u}),(0,Y.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,Y.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,Y.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:L,children:b??(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.rows.map((M,F)=>(0,Y.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,Y.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(M.strong?"ink":"muted")},children:[M.color?(0,Y.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:M.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,M.label]}),(0,Y.jsx)("span",{style:{fontWeight:M.strong===!1?500:700},children:M.value})]},F))]})}):null,(0,Y.jsx)("span",{className:"ztd-sr",style:dn,"aria-live":"polite","aria-atomic":"true",children:w}),s&&!t.pending?c:null]})}function ys({label:e,events:t,t:n}){return(0,Y.jsx)("div",{className:"ztd-sr",style:dn,children:(0,Y.jsxs)("table",{children:[(0,Y.jsx)("caption",{children:n.table(e)}),(0,Y.jsxs)("tbody",{children:[t.slice(0,mn).map((r,o)=>(0,Y.jsxs)("tr",{children:[(0,Y.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,Y.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>mn?(0,Y.jsx)("tr",{children:(0,Y.jsx)("td",{colSpan:2,children:n.more(t.length-mn)})}):null]})]})})}function pe(e){let t=e.baseline??"central";return(0,Y.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var k=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),Ce=k("label","string",!0,"Item name field"),fe=k("value","number",!0,"Value field"),xs=[Ce,fe],ks=[Ce,fe],ws=[k("label","string",!0,"Stage name"),k("value","number",!0,"Users at the stage")],vs=[Ce,fe],$s=[k("label","string",!0,"Leaf (lowest level) name"),fe,k("group","string",!1,"Parent group field")],Ms=[k("label","string",!0,"Leaf name"),fe,k("group","string",!1,"Parent group field")],Ts=[Ce,k("value","number",!0,"Change (total rows may omit it)"),k("type","string",!1,'"total" makes a total bar')],Cs=[Ce,fe],Ss=[k("x","string",!0,"Column field"),k("series","string",!0,"Stacked series field"),fe],As=[k("x","string",!0,"Column field"),k("y","string",!0,"Row field"),fe],Ns=[k("axis","string",!0,"Metric (axis) field"),k("value","number",!0,"Value field",{multi:!0}),k("series","string",!1,"Series field")],Rs=[k("x","number",!0,"x value"),k("y","number",!0,"y value"),k("size","number",!1,"Circle size"),k("label","string",!1,"Name")],Oo=k("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Fs=[k("x","any",!0,"x field (date, number or category)"),k("y","number",!0,"y field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field (long tables)"),k("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Oo],Ps=[k("x","any",!0,"x field"),k("y","number",!0,"y field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field"),k("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}),Oo],_s=[k("x","any",!0,"x field"),k("y","number",!0,"y field",{multi:!0}),k("series","string",!1,"Series field")],Ds=[k("x","string",!0,"Category field"),k("y","number",!0,"Value field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field"),k("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})],Ls=[Ce,fe],Es=[k("value","number",!0,"Value field",{prop:"valueKey"}),k("target","number",!1,"Target field",{prop:"targetKey"})],Os=[Ce,k("value","number",!0,"Actual value field"),k("target","number",!1,"Target field")],Is=[k("x","any",!1,"x field"),k("y","number",!0,"y field")],zs=[Ce,k("x","string",!1,"Period field (long tables)"),k("value","number",!1,"Value field (long tables)")],Bs=[Ce,k("start","number",!0,"Before value"),k("end","number",!0,"After value")],Hs=[Ce,fe],js=[k("value","number",!0,"Value field"),k("group","string",!1,"Group (row) field"),k("label","string",!1,"Dot name")],Gs=[k("group","string",!0,"Group field"),k("value","number",!0,"Value field")],Vs=[k("source","string",!0,"Source node"),k("target","string",!0,"Target node"),fe],Ws=[k("source","string",!0,"Sending group"),k("target","string",!0,"Receiving group"),fe],Ks=[k("date","date",!0,"Date field"),fe],Us=[k("x","any",!0,"Period field"),k("series","string",!0,"Item field"),k("rank","number",!1,"Rank field (1 is first)"),k("value","number",!1,"Value field (instead of rank, largest is first)")],Xs=[k("group","string",!0,"Group field"),k("value","number",!0,"Value field")],Ys=[k("label","string",!1,"Row name field")],Js=[k("x","date",!0,"Date (period) field"),k("open","number",!0,"Open price field"),k("high","number",!0,"High price field"),k("low","number",!0,"Low price field"),k("close","number",!0,"Close price field"),k("volume","number",!1,"Volume field")],qs=[Ce,fe],Zs=[k("x","any",!0,"Period field (date or category)"),k("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field (long tables, back row only)"),k("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Qs=[k("value","number",!1,"Sample value field (raw rows)"),k("group","string",!1,"Group field. Up to 2 groups overlap"),k("x0","number",!1,"Bin start (pre-binned rows)"),k("x1","number",!1,"Bin end (pre-binned rows)"),k("count","number",!1,"Samples in the bin (pre-binned rows)")],el=[k("region","string",!0,"Region name or code, matched to a tile of options.map"),fe],tl=[Ce,fe,k("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],nl=[k("source","string",!0,"Source node"),k("target","string",!0,"Target node"),k("value","number",!1,"Link weight. Without it every row counts 1")],rl=[k("label","string",!0,"Row name. Items with the same name share a row"),k("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),k("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),k("group","string",!1,"Group field (one color per group, and the legend)"),k("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],ol=[k("label","string",!0,"Node name field"),k("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),k("group","string",!1,"Parent group field (flat rows, as in the treemap)"),k("id","string",!1,"Row id for id/parent rows. Defaults to the label"),k("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],il=[k("region","string",!0,"Region name or code, matched to a region of options.map"),fe],al=[k("lon","number",!1,"Longitude (degrees)"),k("lat","number",!1,"Latitude (degrees)"),k("size","number",!1,"Value (circle area). Without it all circles match"),k("label","string",!1,"Place name"),k("region","string",!1,"Region of options.map, for rows without lon and lat"),k("group","string",!1,"Group field (one color per group)")],sl=[k("source","string",!0,"Start: a name in options.places or a region"),k("target","string",!0,"End"),k("value","number",!1,"Amount. Without it each row counts 1")],ll=[k("x","number",!0,"x value"),k("y","number",!0,"y value"),k("series","string",!1,"Series field (one color per series)"),k("label","string",!1,"Name")],Eo={pie:xs,donut:ks,funnel:ws,waffle:vs,treemap:$s,sunburst:Ms,waterfall:Ts,pareto:Cs,marimekko:Ss,heatmap:As,radar:Ns,bubble:Rs,line:Fs,area:Ps,stream:_s,bar:Ds,radialBar:Ls,gauge:Es,bullet:Os,sparkline:Is,slope:zs,dumbbell:Bs,lollipop:Hs,beeswarm:js,ridgeline:Gs,sankey:Vs,chord:Ws,calendar:Ks,bump:Us,box:Xs,parallel:Ys,candlestick:Js,segmented:qs,skyline:Zs,histogram:Qs,scatter:ll,tileMap:el,barRace:tl,network:nl,timeline:rl,tree:ol,choropleth:il,symbolMap:al,flowMap:sl},Rt={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function Io(e,t){return t==="ko"?e.nameKo:e.name}function zo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Bo=["line","area","bar","scatter"],Ho=24,fr=["line","area","bar","scatter","timeline"];function hr(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function jo(e,t,n){return fr.includes(e)&&!hr(e,t,n).length&&!(e==="scatter"&&fn(n))}function fn(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function Go(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var ul={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function hn(e){let t=Eo[e]?e:ul[e]??Object.keys(Rt).find(n=>n.toLowerCase()===e.toLowerCase()||Rt[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Rt[t]))return{type:t,component:Rt[t].component,name:Rt[t].name,nameKo:Rt[t].nameKo,encoding:Eo[t]}}function Vo(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of hn(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function Wo(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function cl(e,t){if(e==null||typeof e!="object")return;let n=e;if(Wo(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Wo(r,o))return;r=r[o]}return r}}function Ke(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function bt(e,t){if(typeof e=="function")return e;let n=e??t;return r=>cl(r,n)}function yt(e,t){let n=bt(e,t);return(r,o)=>Ke(n(r,o))}function et(e,t){let n=bt(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function we(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function ml(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let u=e[l];if(u==='"')n=!n;else if(!n&&(u===`
22
+ `;function io(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 ao(e,t){let[n]=(0,oo.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var ro=!1;function Ot(){if(ro||typeof document>"u"||(ro=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Ka,document.head.appendChild(e)}var Zt=P(Q(),1),_e=typeof window<"u"&&typeof document<"u",Ve=_e?Zt.useLayoutEffect:Zt.useEffect;function qt(){return typeof performance<"u"?performance.now():Date.now()}var We=P(Q(),1),Xa=(0,We.createContext)(void 0),Qt=new Map;function Ua(e,t){let n=Qt.get(e);return n||Qt.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||Qt.delete(e)}}function Ya(e,t,n){Qt.get(e)?.forEach(r=>r(t,n))}function Ja(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function so(e,t,n,r){let o=(0,We.useContext)(Xa),i=t??o,[a]=(0,We.useState)(()=>({})),s=(0,We.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=i?u=>Ya(i,u===null||s.current.keys[u]===void 0?null:{key:s.current.keys[u],label:s.current.labels[u]},a):null;let l=e.applySync;(0,We.useEffect)(()=>{if(i)return Ua(i,(u,d)=>{if(d===a)return;let c=u?Ja(s.current.keys,s.current.labels,u):-1;l(c<0?null:c)})},[i,a,l])}function te(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Le(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var lo={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},uo={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var Za=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],qa={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Qa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function es(e){return Qa(Za,e)}function co(e,t){let n=es(e);return{text:n?n[t]:e,...qa[n?.id??"basic"]}}var mo={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ct(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),mo[t.toLowerCase()]&&(t=mo[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function go(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 qn(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 At(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fo(e){return .2126*At(e[0])+.7152*At(e[1])+.0722*At(e[2])}function Qn(e,t,n){let r=typeof e=="string"?Ct(e):e,o=typeof t=="string"?Ct(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?Ct(n):n:null;o[3]<1&&i&&(o=qn(o,i));let a=r[3]<1?qn(r,o):r,s=fo(a),l=fo(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function ts(e){return[At(e[0]),At(e[1]),At(e[2])]}function Zn(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 ho(e){let[t,n,r]=ts(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function ns([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[Zn(4.0767416621*o-3.3077115913*i+.2309699292*a),Zn(-1.2684380046*o+2.6097574011*i-.3413193965*a),Zn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function en(e,t,n){let r=Ct(e),o=Ct(t);if(!r||!o)return e;let i=ho(r),a=ho(o),s=Math.max(0,Math.min(1,n));return go(ns([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function er(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Qn(i,e,n);a>o&&(o=a,r=i)}return r}function de(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function rs(e,t){let n=er(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Qn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):er(t,["#FFFFFF","#000000"])}function tn(e,t){let n=en(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:rs(e,n),raw:n}}function De(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=de(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=de(e,"neutral");else if(s===0)r[a]=de(e,"ink");else if(s===i-1)r[a]=de(e,"neutral");else if(i===3)r[a]=de(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?de(e,"strong"):tn(e,1-l)}}),r}var tr="mix:";function st(e){return e({theme:Xn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${tr}${o}`}).map(n=>n.fill)}function po(e,t){return t?.startsWith(tr)?e.mix("neutralStrong","neutral",Number(t.slice(tr.length))):e.color(t)}function It(e,t,n){return De(e,t+1,n).slice(0,t)}function bo(e,t,n,r="neutral"){let o=de(e,"accent"),i=de(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function yo(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=de(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=de(e,"neutral"):s===0?r[a]=de(e,"strong"):s===i-1?r[a]=de(e,"neutral"):r[a]=tn(e,1-s/(i-1))}),r}var Ee=P(Q(),1);var rn=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),fe="en-US",xo=new Map;function nr(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=xo.get(r);return o||(o=new Intl.NumberFormat(e,n),xo.set(r,o)),o}function rr(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function lt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=fe,...r}=t;return rr(nr(n,r).format(e))}var or=e=>e!==0&&Math.abs(e)<.05,ir=(e,t,n="")=>`${lt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function nn(e,t={}){if(!Number.isFinite(e))return"-";if(or(e)&&t.maximumFractionDigits===void 0)return ir(e,t.locale??fe,"%");let n=Math.abs(e);return`${lt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function $o(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=fe,...r}=t;if(te(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],u=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**d)/10**d;if(a>0&&c>=i[a-1][0]/s){a--;continue}return(e<0&&c!==0?"-":"")+lt(c,{locale:n,...r,maximumFractionDigits:d})+l}}return rr(nr(n,{notation:"compact",...r}).format(e))}var os=(e,t=te(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function pt(e,t=fe,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=nr(t,o);return l=>Number.isFinite(l)?`${a}${rr(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>nn(o,{locale:t});case"ratio":return o=>nn(o*100,{locale:t});case"compact":return o=>$o(o,{locale:t});case"currency":return r(os(t));default:{let o=r({maximumFractionDigits:1});return i=>or(i)?ir(i,t):o(i)}}}function Nt(e,t=fe,n=0){return e!==void 0?pt(e,t):n>=1e5?r=>or(r)?ir(r,t):$o(r,{locale:t}):r=>lt(r,{locale:t})}function is(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var ar=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,as=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,ss=["january","february","march","april","may","june","july","august","september","october","november","december"],ko=e=>{let t=e.toLowerCase();return t.length<3?0:ss.findIndex(n=>n.startsWith(t))+1},wo=e=>+e+(+e<30?2e3:1900);function Mo(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var ls=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],To=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,So=/\{([^{}]+)\}/g;function on(e,t){let n;for(let r of ls)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?[wo(n[3]),+n[2],+n[1],1]:[wo(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=To.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=ko(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=ko(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Co=e=>as.test(e)||on(e)!==null;function Ao(e){let t;for(let n of e){let r=typeof n=="string"?To.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function an(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(ar(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return an(`${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=on(n,t);if(r)return is(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 vo=new Map;function zt(e,t={month:"short",day:"numeric"}){let n=an(e);if(!n)return"-";let{locale:r=fe,...o}=t,i=r+JSON.stringify(o),a=vo.get(i);return a||(a=new Intl.DateTimeFormat(r,o),vo.set(i,a)),a.format(n)}var sr=P(V(),1),sn=(0,Ee.createContext)({theme:at,cssVars:!0});function us(e,t=at){return e?typeof e=="string"?Un[e]??t:Jn(t,e):t}function ln(e){let t=(0,Ee.useContext)(sn),n=e.base?Un[e.base]:t.theme,r=(0,Ee.useMemo)(()=>us(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,Ee.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,Ee.useMemo)(()=>Yn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,sr.jsx)(sn.Provider,{value:a,children:(0,sr.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var cs=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Ro(e){return cs.has(e)}function ms(e,t){let n=r=>t?`var(${Jt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Ro(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Ro(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:en(e[r],e[o],i)}}}function Oe(e){let t=(0,Ee.useContext)(sn);return(0,Ee.useMemo)(()=>{let n=Jn(t.theme,e);return ms(n,t.cssVars)},[t.theme,t.cssVars,e])}function xe(e){let t=(0,Ee.useContext)(sn);return e??t.locale??fe}function Fo(e){return e?Yn(e):{}}var un=P(Q(),1),lr=(0,un.createContext)(void 0);function Po(e){let t=(0,un.useContext)(lr);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=P(V(),1),ds={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`},fs={en:ds,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var hs={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},ur=e=>fs[te(xe(e))];function cr(e){let t=Oe(e.theme),n=ur(e.locale),[r,o]=(0,cn.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.label)).length,u=(0,_.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((d,c)=>{let m=!s.has(d.label),h=m&&l===1,f=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(gs,{p:t,item:d,off:!m}),(0,_.jsx)("span",{style:m?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,_.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,_.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":m,"aria-disabled":h||void 0,onClick:()=>{h||(a(d.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:f}):f},c)})});return a?(0,_.jsxs)(_.Fragment,{children:[u,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:hs,children:r?n.shown(l,e.items.length):""})]}):u}function gs({p:e,item:t,off:n}){let r=po(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,_.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,_.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,_.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,_.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function ps(e){let t=Oe(e.theme),n=co(e.level,te(xe(e.locale)));return(0,_.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function bs(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,_.jsxs)(_.Fragment,{children:[e.slice(0,r),(0,_.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function _o(e){let t=Oe(e.theme),n=ur(e.locale),[r,o]=(0,cn.useState)(0);Ve(()=>Ot(),[]);let i=()=>{o(m=>m+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)(cr,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,u=e.replay||e.onReplay,d=e.source!==void 0||e.note!==void 0?(0,_.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,c=e.takeaway!==void 0||e.level||e.sample?(0,_.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,_.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,_.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,_.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,_.jsx)(ps,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,_.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,_.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,_.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,_.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:bs(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,_.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,_.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,_.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,_.jsx)("span",{}),a]}):null]}),(0,_.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,_.jsx)(lr.Provider,{value:r,children:(0,_.jsx)(St.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,_.jsxs)(_.Fragment,{children:[d,c]}):c]})}function mr(e){let t=Oe(e.theme),n=ur(e.locale),r=e.height??220;if(Ve(()=>Ot(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,_.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,_.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,_.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,_.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,_.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,_.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,_.jsx)(_.Fragment,{children:e.children})}var _t=P(Q(),1);var ke=P(Q(),1);var Y=P(V(),1),mn=60,dr=8;function Lo(e,t){return e.length>dr?[...e.slice(0,dr),{label:t(e.length-dr),value:""}]:e}var dn={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Do(e){let{c:t,events:n}=e,r=(0,ke.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Ve(()=>{Ot()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,ke.useContext)(St),u=e.ariaLabel??l??e.kind,d=(0,ke.useMemo)(()=>s?`${n.length}${n.slice(0,mn).map(M=>`${M.label}${M.series??""}${M.formatted??M.value??""}`).join("")}`:"",[n,s]),c=(0,ke.useMemo)(()=>(0,Y.jsx)(ys,{label:u,events:n,t:t.t}),[u,d,t.t]),m=(0,ke.useRef)(null);(0,ke.useEffect)(()=>{let M=()=>{m.current=null};return window.addEventListener("scroll",M,{capture:!0,passive:!0}),window.addEventListener("resize",M,{passive:!0}),()=>{window.removeEventListener("scroll",M,{capture:!0}),window.removeEventListener("resize",M)}},[]),(0,ke.useEffect)(()=>{m.current=null},[t.width,t.height]);let h=M=>{if(M.target!==M.currentTarget)return;if(e.onKey?.(M)){M.preventDefault();return}let F=t.active,O;switch(M.key){case"ArrowRight":case"ArrowDown":O=F===null?0:(F+1)%a;break;case"ArrowLeft":case"ArrowUp":O=F===null?a-1:(F-1+a)%a;break;case"Home":O=0;break;case"End":O=a-1;break;case"Escape":if(F===null)return;O=null;break;case"Enter":case" ":F!==null&&(M.preventDefault(),t.click(F));return;default:return}M.preventDefault(),t.setActive(O,"keyboard")},{via:f,node:g,setActive:v}=t;(0,ke.useEffect)(()=>{if(f!=="touch"||!g)return;let M=F=>{g.contains(F.target)||v(null)};return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[f,g,v]);let x=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,S=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,b=typeof e.renderTip=="function"&&x?e.renderTip(x):null,w=e.announce??(t.via==="keyboard"&&x?`${x.label}${x.series?` ${x.series}`:""}: ${x.formatted??x.value??""} (${(t.active??0)+1}/${a})`:""),D;if($){let M=$.x*S,F=t.width*S,O=`clamp(${(4-M).toFixed(1)}px, -50%, calc(${(F-M-4).toFixed(1)}px - 100%))`,K=$.y<64;D={position:"absolute",left:M,top:$.y*S,transform:`translate(${O}, ${K?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*S-8)}}let E=M=>{m.current=null,M.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},H=M=>M?F=>{let O=m.current??(m.current=F.currentTarget.getBoundingClientRect());O.width&&M((F.clientX-O.left)/O.width*t.width,(F.clientY-O.top)/O.height*t.height,F)}:void 0,j=H(e.onPointerMove),B=H(e.onPointerDown),I=j||B?M=>{M.pointerType==="touch"&&j?.(M),B?.(M)}:void 0,N=H(e.onPointerUp),R=Fo(e.theme);return(0,Y.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":u,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:M=>{t.via==="keyboard"&&!M.currentTarget.contains(M.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"),...R,...e.style},children:[t.pending?null:e.underlay,(0,Y.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:j,onPointerDown:I,onPointerUp:N,onPointerCancel:N,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,Y.jsx)("title",{id:o,children:u}),(0,Y.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,Y.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,Y.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:D,children:b??(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.rows.map((M,F)=>(0,Y.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,Y.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(M.strong?"ink":"muted")},children:[M.color?(0,Y.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:M.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,M.label]}),(0,Y.jsx)("span",{style:{fontWeight:M.strong===!1?500:700},children:M.value})]},F))]})}):null,(0,Y.jsx)("span",{className:"ztd-sr",style:dn,"aria-live":"polite","aria-atomic":"true",children:w}),s&&!t.pending?c:null]})}function ys({label:e,events:t,t:n}){return(0,Y.jsx)("div",{className:"ztd-sr",style:dn,children:(0,Y.jsxs)("table",{children:[(0,Y.jsx)("caption",{children:n.table(e)}),(0,Y.jsxs)("tbody",{children:[t.slice(0,mn).map((r,o)=>(0,Y.jsxs)("tr",{children:[(0,Y.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,Y.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>mn?(0,Y.jsx)("tr",{children:(0,Y.jsx)("td",{colSpan:2,children:n.more(t.length-mn)})}):null]})]})})}function pe(e){let t=e.baseline??"central";return(0,Y.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var k=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),Se=k("label","string",!0,"Item name field"),he=k("value","number",!0,"Value field"),xs=[Se,he],ks=[Se,he],ws=[k("label","string",!0,"Stage name"),k("value","number",!0,"Users at the stage")],vs=[Se,he],$s=[k("label","string",!0,"Leaf (lowest level) name"),he,k("group","string",!1,"Parent group field")],Ms=[k("label","string",!0,"Leaf name"),he,k("group","string",!1,"Parent group field")],Ts=[Se,k("value","number",!0,"Change (total rows may omit it)"),k("type","string",!1,'"total" makes a total bar')],Ss=[Se,he],Cs=[k("x","string",!0,"Column field"),k("series","string",!0,"Stacked series field"),he],As=[k("x","string",!0,"Column field"),k("y","string",!0,"Row field"),he],Ns=[k("axis","string",!0,"Metric (axis) field"),k("value","number",!0,"Value field",{multi:!0}),k("series","string",!1,"Series field")],Rs=[k("x","number",!0,"x value"),k("y","number",!0,"y value"),k("size","number",!1,"Circle size"),k("label","string",!1,"Name")],Oo=k("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Fs=[k("x","any",!0,"x field (date, number or category)"),k("y","number",!0,"y field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field (long tables)"),k("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Oo],Ps=[k("x","any",!0,"x field"),k("y","number",!0,"y field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field"),k("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}),Oo],_s=[k("x","any",!0,"x field"),k("y","number",!0,"y field",{multi:!0}),k("series","string",!1,"Series field")],Ls=[k("x","string",!0,"Category field"),k("y","number",!0,"Value field. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field"),k("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})],Ds=[Se,he],Es=[k("value","number",!0,"Value field",{prop:"valueKey"}),k("target","number",!1,"Target field",{prop:"targetKey"})],Os=[Se,k("value","number",!0,"Actual value field"),k("target","number",!1,"Target field")],Is=[k("x","any",!1,"x field"),k("y","number",!0,"y field")],zs=[Se,k("x","string",!1,"Period field (long tables)"),k("value","number",!1,"Value field (long tables)")],Bs=[Se,k("start","number",!0,"Before value"),k("end","number",!0,"After value")],Hs=[Se,he],js=[k("value","number",!0,"Value field"),k("group","string",!1,"Group (row) field"),k("label","string",!1,"Dot name")],Gs=[k("group","string",!0,"Group field"),k("value","number",!0,"Value field")],Vs=[k("source","string",!1,"Source node"),k("target","string",!1,"Target node"),k("dimensions","string",!1,"Stage columns of a wide table, left to right (2 to 6). Each row is one path, so source and target are not used. Without value, each row counts 1",{multi:!0}),k("value","number",!1,"Value field")],Ws=[k("source","string",!0,"Sending group"),k("target","string",!0,"Receiving group"),he],Ks=[k("date","date",!0,"Date field"),he],Xs=[k("x","any",!0,"Period field"),k("series","string",!0,"Item field"),k("rank","number",!1,"Rank field (1 is first)"),k("value","number",!1,"Value field (instead of rank, largest is first)")],Us=[k("group","string",!0,"Group field"),k("value","number",!0,"Value field")],Ys=[k("label","string",!1,"Row name field")],Js=[k("x","date",!0,"Date (period) field"),k("open","number",!0,"Open price field"),k("high","number",!0,"High price field"),k("low","number",!0,"Low price field"),k("close","number",!0,"Close price field"),k("volume","number",!1,"Volume field")],Zs=[Se,he],qs=[k("x","any",!0,"Period field (date or category)"),k("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),k("series","string",!1,"Series field (long tables, back row only)"),k("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Qs=[k("value","number",!1,"Sample value field (raw rows)"),k("group","string",!1,"Group field. Up to 2 groups overlap"),k("x0","number",!1,"Bin start (pre-binned rows)"),k("x1","number",!1,"Bin end (pre-binned rows)"),k("count","number",!1,"Samples in the bin (pre-binned rows)")],el=[k("region","string",!0,"Region name or code, matched to a tile of options.map"),he],tl=[Se,he,k("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],nl=[k("source","string",!0,"Source node"),k("target","string",!0,"Target node"),k("value","number",!1,"Link weight. Without it every row counts 1")],rl=[k("label","string",!0,"Row name. Items with the same name share a row"),k("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),k("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),k("group","string",!1,"Group field (one color per group, and the legend)"),k("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],ol=[k("label","string",!0,"Node name field"),k("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),k("group","string",!1,"Parent group field (flat rows, as in the treemap)"),k("id","string",!1,"Row id for id/parent rows. Defaults to the label"),k("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],il=[k("region","string",!0,"Region name or code, matched to a region of options.map"),he],al=[k("lon","number",!1,"Longitude (degrees)"),k("lat","number",!1,"Latitude (degrees)"),k("size","number",!1,"Value (circle area). Without it all circles match"),k("label","string",!1,"Place name"),k("region","string",!1,"Region of options.map, for rows without lon and lat"),k("group","string",!1,"Group field (one color per group)")],sl=[k("source","string",!0,"Start: a name in options.places or a region"),k("target","string",!0,"End"),k("value","number",!1,"Amount. Without it each row counts 1")],ll=[k("x","number",!0,"x value"),k("y","number",!0,"y value"),k("series","string",!1,"Series field (one color per series)"),k("label","string",!1,"Name")],Eo={pie:xs,donut:ks,funnel:ws,waffle:vs,treemap:$s,sunburst:Ms,waterfall:Ts,pareto:Ss,marimekko:Cs,heatmap:As,radar:Ns,bubble:Rs,line:Fs,area:Ps,stream:_s,bar:Ls,radialBar:Ds,gauge:Es,bullet:Os,sparkline:Is,slope:zs,dumbbell:Bs,lollipop:Hs,beeswarm:js,ridgeline:Gs,sankey:Vs,chord:Ws,calendar:Ks,bump:Xs,box:Us,parallel:Ys,candlestick:Js,segmented:Zs,skyline:qs,histogram:Qs,scatter:ll,tileMap:el,barRace:tl,network:nl,timeline:rl,tree:ol,choropleth:il,symbolMap:al,flowMap:sl},Rt={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function Io(e,t){return t==="ko"?e.nameKo:e.name}function zo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Bo=["line","area","bar","scatter"],Ho=24,fr=["line","area","bar","scatter","timeline"];function hr(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function jo(e,t,n){return fr.includes(e)&&!hr(e,t,n).length&&!(e==="scatter"&&fn(n))}function fn(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function Go(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var ul={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",butterfly:"bar",pyramid:"bar",populationPyramid:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",raincloud:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap",alluvial:"sankey",parallelSets:"sankey"};function hn(e){let t=Eo[e]?e:ul[e]??Object.keys(Rt).find(n=>n.toLowerCase()===e.toLowerCase()||Rt[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Rt[t]))return{type:t,component:Rt[t].component,name:Rt[t].name,nameKo:Rt[t].nameKo,encoding:Eo[t]}}function Vo(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of hn(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function Wo(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function cl(e,t){if(e==null||typeof e!="object")return;let n=e;if(Wo(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Wo(r,o))return;r=r[o]}return r}}function Ke(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function bt(e,t){if(typeof e=="function")return e;let n=e??t;return r=>cl(r,n)}function yt(e,t){let n=bt(e,t);return(r,o)=>Ke(n(r,o))}function et(e,t){let n=bt(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function we(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function ml(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let u=e[l];if(u==='"')n=!n;else if(!n&&(u===`
23
23
  `||u==="\r"))break;t.push(n?"":u)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let u=o(l);u>s&&(s=u,a=l)}return a}var dl=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function Ko(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(dl.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Ke(t);if(Number.isFinite(n))return n}return t}function xt(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??ml(o),a=[],s=[],l="",u=!1;for(let f=0;f<o.length;f++){let g=o[f];u?g==='"'?o[f+1]==='"'?(l+='"',f++):u=!1:l+=g:g==='"'&&!l.trim()?(u=!0,l=""):g===i?(s.push(l),l=""):g===`
24
24
  `||g==="\r"?(g==="\r"&&o[f+1]===`
25
- `&&f++,s.push(l),a.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),a.push(s));let d=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!d.length)return[];let c=f=>n?Ko(f):f;if(!r)return d.map(f=>Object.fromEntries(f.map((g,v)=>[String(v),c(g)])));let m=[],h=new Set;return d[0].forEach((f,g)=>{let v=f.trim()||`col${g+1}`,x=v;for(let $=2;h.has(x);$++)x=`${v}_${$}`;h.add(x),m.push(x)}),d.slice(1).map(f=>Object.fromEntries(m.map((g,v)=>[g,c(f[v]??"")])))}function gr(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?Ko(a[l]):a[l]??null])))}function fl(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function Uo(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 ut(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ut(JSON.parse(t))}catch{}return xt(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?gr(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)?ut(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?gr(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)?ut(t.rows):Array.isArray(t.values)?gr(t.values):Array.isArray(t.items)?ut(t.items):Array.isArray(t.results)?ut(t.results):fl(t)}return[]}function gn(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function Xo(e,t){let n=e.length;if(t>=n||t<3)return e.slice();let r=[e[0]],o=(n-2)/(t-2),i=0;for(let a=0;a<t-2;a++){let s=Math.floor((a+1)*o)+1,l=Math.min(Math.floor((a+2)*o)+1,n),u=0,d=0;for(let v=s;v<l;v++)u+=e[v].x,d+=e[v].y;let c=Math.max(1,l-s);u/=c,d/=c;let m=Math.floor(a*o)+1,h=Math.floor((a+1)*o)+1,f=m,g=-1;for(let v=m;v<h;v++){let x=Math.abs((e[i].x-u)*(e[v].y-e[i].y)-(e[i].x-e[v].x)*(d-e[i].y));x>g&&(g=x,f=v)}r.push(e[f]),i=f}return r.push(e[n-1]),r}function Ft(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,u)=>{let d=e[l][u];return Number.isFinite(d)&&d>0?d:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let u=1;u<r;u++){let d=0,c=0;for(let m=0;m<n;m++){let h=a(m,u),f=h-a(m,u-1),g=0;for(let v=0;v<m;v++)g+=a(v,u)-a(v,u-1);d+=h,c+=(f/2+g)*h}d&&(l-=c/d),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,m=0;for(let h=0;h<n;h++){let f=e[h][l],g=Number.isFinite(f)?f:0;g>=0?(o[h][l]=c,c+=g,i[h][l]=c):(o[h][l]=m,m+=g,i[h][l]=m)}continue}let u=0;for(let c=0;c<n;c++)u+=a(c,l);let d=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let m=a(c,l);t==="expand"&&(m=u?m/u*100:0),o[c][l]=d,d+=m,i[c][l]=d}}if(t==="wiggle"&&r){let l=1/0,u=-1/0;for(let c=0;c<r;c++)l=Math.min(l,o[0]?.[c]??0),u=Math.max(u,i[n-1]?.[c]??0);let d=0;for(let c=0;c<r;c++)d+=((o[0]?.[c]??0)+(i[n-1]?.[c]??0))/2;d/=r;for(let c=0;c<n;c++)for(let m=0;m<r;m++)o[c][m]-=d,i[c][m]-=d}return{y0:o,y1:i}}function Yo(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 Jo(e){let t=e.length,n=e.map(u=>{let d=0,c=-1/0;return u.forEach((m,h)=>{m>c&&(c=m,d=h)}),d}),r=e.map(u=>u.reduce((d,c)=>d+(Number.isFinite(c)?c:0),0)),o=Array.from({length:t},(u,d)=>d).sort((u,d)=>n[u]-n[d]),i=[],a=[],s=0,l=0;for(let u of o)s<l?(i.push(u),s+=r[u]):(a.push(u),l+=r[u]);return[...a.reverse(),...i]}var hl=Math.PI*2;function qo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function W(e){return Math.round(e*100)/100}function Zo(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${W(l[0])},${W(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${W(l[0])},${W(l[1])}`).join("");let o=[],i=[];for(let l=0;l<n-1;l++){let u=e[l+1][0]-e[l][0];o.push(u),i.push(u===0?0:(e[l+1][1]-e[l][1])/u)}let a=[i[0]];for(let l=1;l<n-1;l++)if(i[l-1]*i[l]<=0)a.push(0);else{let u=2*o[l]+o[l-1],d=o[l]+2*o[l-1];a.push((u+d)/(u/i[l-1]+d/i[l]))}a.push(i[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let u=o[l]/3;s+=`C${W(e[l][0]+u)},${W(e[l][1]+a[l]*u)} ${W(e[l+1][0]-u)},${W(e[l+1][1]-a[l+1]*u)} ${W(e[l+1][0])},${W(e[l+1][1])}`}return s}function pn(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return Zo(e);if(t==="step"){let n=`M${W(e[0][0])},${W(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${W(o)}V${W(e[r][1])}H${W(e[r][0])}`}return n}return gl(e)}function gl(e){if(!e.length)return"";let t=`M${W(e[0][0])},${W(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${W(e[n][0])},${W(e[n][1])}`;return t}function bn(e,t,n="smooth"){if(!e.length)return"";let r=[...t].reverse(),o=pn(e,n),i;return n==="smooth"?i=Zo(r.map(a=>[a[0],a[1]]),!1):n==="step"?i=pn(r,"step").replace(/^M/,"L"):i=r.map(a=>`L${W(a[0])},${W(a[1])}`).join(""),`${o}${i}Z`}function yn(e,t){let n=0,r=e.length-1;if(r<0)return-1;for(;r-n>1;){let o=n+r>>1;e[o]<t?n=o:r=o}return Math.abs(e[n]-t)<=Math.abs(e[r]-t)?n:r}function Qo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ei(e){let t=e.length,n=e.reduce((l,u)=>l+u.x,0)/t,r=e.reduce((l,u)=>l+u.y,0)/t,o=0,i=0,a=0;for(let l of e)o+=(l.x-n)*(l.y-r),i+=(l.x-n)**2,a+=(l.y-r)**2;let s=i?o/i:0;return{slope:s,r2:i&&a?o*o/(i*a):0,at:l=>r+s*(l-n)}}function ni(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function ti(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 xn=new Map;function ie(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=xn.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);ni(u)?a+=ti(u):s+=ti(u)}i=a+s*(n>=600?1.07:1),xn.size>5e3&&xn.clear(),xn.set(o,i)}return i*t}function Ue(e,t,n,r=400){if(e=e.trim(),ie(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ie(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(ni(s.charCodeAt(0))?2:3)?"":s+o}function ri(e,t,n=-1/0,r=1/0){let o=e.map((s,l)=>({y:s,i:l})).sort((s,l)=>s.y-l.y),i=new Array(e.length),a=o.map(s=>Math.max(n,Math.min(r,s.y)));for(let s=0;s<30;s++){let l=!1;for(let u=1;u<a.length;u++){let d=a[u]-a[u-1];if(d<t){let c=(t-d)/2;a[u-1]-=c,a[u]+=c,l=!0}}for(let u=0;u<a.length;u++)a[u]=Math.max(n,Math.min(r,a[u]));if(!l)break}for(let s=1;s<a.length;s++)a[s]-a[s-1]<t&&(a[s]=a[s-1]+t);if(a.length&&a[a.length-1]>r){let s=a[a.length-1]-r;for(let l=0;l<a.length;l++)a[l]-=s}return o.forEach((s,l)=>{i[s.i]=a[l]}),i}var q=P(V(),1),kt=e=>Array.isArray(e)&&e.length===2;function kn(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&kt(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var oi=e=>e?.find(t=>t.type==="forecast")?.from,pl=(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 pr(e,t,n){let r=t[0],o=1/0;for(let i of t){let a=yr(e,i.x,i.y,i.anchor),s=n.reduce((l,u)=>l+pl(a,u),0);if(s<o&&(r=i,o=s),s===0)break}return n.push(yr(e,r.x,r.y,r.anchor)),r}var br=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),bl=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function ii(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 ai(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 wn(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 si={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function li({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((i,a)=>{if(i.type==="band"&&kt(i.y)){let s=ai(t,i.y);if(!s)return;let[l,u]=s;o.push((0,q.jsxs)("g",{children:[(0,q.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,u-l),fill:n.paint("accent"),opacity:.1}),(0,q.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,q.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},a))}else if(i.type==="band"&&kt(i.x)||i.type==="forecast"){let s;if(i.type==="forecast"){let d=wn(t,i.from);s=d===null?null:[d,t.x1]}else s=ii(t,i.x);if(!s)return;let l=br(t,s[0]),u=br(t,s[1]);if(u-l<.5)return;o.push((0,q.jsx)("rect",{x:l,y:t.top,width:u-l,height:r,fill:n.paint("ink"),opacity:.05},a))}else if(i.type==="weekends"&&t.time&&t.time.t1-t.time.t0<=864e5*400){let s=Math.min(432e5,(t.time.t1-t.time.t0)/Math.max(1,t.time.n-1)/2),l=new Date(t.time.t0);l.setHours(0,0,0,0),l.setDate(l.getDate()-(l.getDay()+1)%7);for(let u=0;l.getTime()-s<=t.time.t1&&u<60;u++){let d=l.getTime();l.setDate(l.getDate()+2);let c=Math.max(t.x0,t.time.xt(d-s)),m=Math.min(t.x1,t.time.xt(l.getTime()-s));m>c&&o.push((0,q.jsx)("rect",{x:c,y:t.top,width:m-c,height:r,fill:n.paint("ink"),opacity:.045},`${a}w${u}`)),l.setDate(l.getDate()+5)}}}),(0,q.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var ui=(e,t)=>ie(e,10.5,t?700:500)+8;function yr(e,t,n,r="start",o){let i=ui(e,o);return{x:r==="end"?t-i:t,y:n-8,w:i,h:16}}function Bt({p:e,x:t,y:n,text:r,anchor:o="start",strong:i}){let a=yr(r,t,n,o,i);return(0,q.jsxs)("g",{children:[(0,q.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,q.jsx)(pe,{x:a.x+4,y:n,size:10.5,weight:i?700:500,fill:e.paint(i?"ink":"muted"),children:r})]})}function ci({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=si[t.lang],o=[],i=[],a=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let u=t.y(s.y);if(!Number.isFinite(u))return;let d=s.label?Ue(s.label,160,10.5):"",c=d?pr(d,[{x:t.x1-2,y:u-10,anchor:"end"},{x:t.x0+2,y:u-10,anchor:"start"},{x:t.x1-2,y:u+10,anchor:"end"},{x:t.x0+2,y:u+10,anchor:"start"}],a):null;o.push((0,q.jsxs)("g",{children:[(0,q.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("dim"),strokeDasharray:"4 3"}),c?(0,q.jsx)(Bt,{p:n,x:c.x,y:c.y,text:d,anchor:c.anchor}):null]},l))}else if(s.type==="band"&&s.label){let u=kt(s.y)?ai(t,s.y):[t.top,t.bottom],d=kt(s.x)?ii(t,s.x):[t.x0,t.x1];if(!d||!u)return;let[c,m]=u,h=Ue(s.label,160,10.5),f=Math.min(br(t,d[0]),t.x1-40)+4,g=pr(h,[{x:f,y:c+11,anchor:"start"},{x:f,y:m-11,anchor:"start"}],a);o.push((0,q.jsx)(Bt,{p:n,x:g.x,y:g.y,text:h},l))}else if(s.type==="forecast"){let u=wn(t,s.from);if(u===null)return;let d=Ue(s.label??r.forecast,120,10.5),c=Math.min(u+4,t.x1-50),m=pr(d,[{x:c,y:t.top+9,anchor:"start"},{x:c,y:t.bottom-9,anchor:"start"}],a);o.push((0,q.jsxs)("g",{children:[(0,q.jsx)("line",{x1:u,x2:u,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,q.jsx)(Bt,{p:n,x:m.x,y:m.y,text:d})]},l))}else if(s.type==="event"&&s.label){let u=t.xAt(s.x);if(!bl(t,u))return;let d=Ue(s.label,140,10.5,700),c=ui(d,!0),m=Math.max(t.x0,Math.min(u-c/2,t.x1-c)),h=i.findIndex(g=>g<m-4);h<0&&(h=i.length),i[h]=m+c;let f=t.top+9+h*18;o.push((0,q.jsxs)("g",{children:[(0,q.jsx)("line",{x1:u,x2:u,y1:f+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,q.jsx)("circle",{cx:u,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,q.jsx)(Bt,{p:n,x:m,y:f,text:d,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let u=t.points().filter(h=>Number.isFinite(h.x)&&Number.isFinite(h.y));if(u.length<2)return;let{at:d}=ei(u),c=u[0].x,m=u[u.length-1].x;o.push((0,q.jsxs)("g",{children:[(0,q.jsx)("line",{x1:c,x2:m,y1:d(c),y2:d(m),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,q.jsx)(Bt,{p:n,x:m-2,y:d(m)-11,text:Ue(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,q.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function mi(e,t,n,r){if(!e?.length)return"";let o=si[t],i=t==="ko",a=r??(l=>String(l??"")),s=e.map(l=>{let u=l.label?i?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&&kt(l.y)?i?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${u}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${u}`:l.type==="band"&&kt(l.x)?i?`${l.label??o.period} ${a(l.x[0])}~${a(l.x[1])}`:`${l.label??o.period} from ${a(l.x[0])} to ${a(l.x[1])}`:l.type==="line"&&typeof l.y=="number"?i?`기준선 ${n(l.y)}${u}`:`reference line at ${n(l.y)}${u}`:l.type==="event"?i?`${a(l.x)} ${l.label??""}`.trim():`${l.label??"event"} at ${a(l.x)}`:l.type==="forecast"?i?`${a(l.from)}부터 ${l.label??o.forecast}`:`${l.label??o.forecast.toLowerCase()} from ${a(l.from)}`:l.type==="trend"?i?l.label??"추세선":l.label??"trend line":l.type==="weekends"?o.weekends:""}).filter(Boolean);return s.length?` ${o.lead}: ${s.join(i?", ":"; ")}.`:""}var be=P(V(),1),Ie=10.5;function di(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>lt(a,{locale:n,maximumFractionDigits:i}))}function $n(e,t,n){let r=18;for(let o of di(e,t,n))r=Math.max(r,ie(o,Ie));return Math.ceil(r+8)}function fi(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:di(n,a,e.locale);return(0,be.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((u,d)=>{let c=Math.round(r(u))+.5,m=u===0&&e.zero!==!1;return(0,be.jsxs)("g",{children:[(0,be.jsx)("line",{x1:o,x2:i,y1:c,y2:c,stroke:t.paint(m?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:m?.7:1}),l?(0,be.jsx)(pe,{x:s?i+6:o-6,y:c,anchor:s?"start":"end",size:Ie,fill:t.paint("muted"),children:l[d]}):null]},u)})})}function xr(e,t,n){let r=[],o=-1/0;for(let i of e){let a=ie(i.label,Ie),s=Math.max(i.x-a/2,0);s<o+8||i.x-a/2<t||i.x+a/2>n||(r.push(i),o=s+a)}return r}function kr(e,t,n=Ie,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((c,m)=>m);let s=t.map(c=>ie(c,n,o)),l=(c,m)=>Math.abs(e[m]-e[c])<(s[c]+s[m])/2+r,u=[];for(let c of i??[])u.some(m=>l(m,c))||u.push(c);let d=c=>!u.some(m=>l(m,c));for(let c=1;c<=a;c++){let m=u.slice();for(let h=0;h<a;h+=c)d(h)&&m.push(h);if(c>1&&(a-1)%c>c/2&&d(a-1)&&m.push(a-1),m.sort((h,f)=>h-f),m.every((h,f)=>!f||!l(m[f-1],h)))return m}return[0,a-1]}var vn=e=>Math.round(e*10)/10;function hi(e){let{p:t}=e;return(0,be.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${vn(e.x)}px,0px)`},children:[(0,be.jsx)("line",{x1:0,x2:0,y1:e.top,y2:e.bottom,stroke:t.paint("dim"),strokeWidth:1}),e.dots?.map(n=>(0,be.jsxs)("g",{className:"ztd-guide",style:{transform:`translate(0px,${vn(n.y)}px)`},children:[(0,be.jsx)("circle",{r:n.strong?9:7,fill:n.color,opacity:.2}),(0,be.jsx)("circle",{r:n.strong?4.2:3.2,fill:n.color,stroke:t.paint("panel"),strokeWidth:2})]},n.k))]})}function gi(e){let{p:t}=e,n=Ue(e.label,160,Ie,700),r=ie(n,Ie,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,be.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${vn(o)}px,${vn(e.y)}px)`},children:[(0,be.jsx)("rect",{x:-r/2,y:-9,width:r,height:18,rx:9,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:3,paintOrder:"stroke"}),(0,be.jsx)(pe,{x:0,y:0,anchor:"middle",size:Ie,weight:700,fill:t.paint("onInk"),children:n})]})}function wr(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 ct(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=wr(a,n),u=[o,i];for(let d=0;d<4;d++){let c=Math.ceil(i/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-m<=l*.3?m:o-a*s,i===0?0:c-i<=l*.3?c:i+a*s];let h=wr(u[1]-u[0],n);if(h===l)break;l=h}return u}function pi(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=wr(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,u=0;l<=o+i*1e-9&&u<200;l+=i,u++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Se(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>pi(n,r,l),s}function Ht(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[i,a]=ct(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function yl(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(u,d=1)=>{let c=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let h of u){let f=Number((h*10**m).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:pi(e,t,3)}function Mn(e,t){let n=Se([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=()=>yl(e[0],e[1],Math.abs(t[1]-t[0])),r}function Xe(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 xl=864e5;function jt(e,t,n,r=he){let o=t-e;if(!(o>0))return[{t:e,label:zt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/xl,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(d,c,m,h=!1)=>{let f=new Date(d),g=-1,v=0;for(;f.getTime()<=t&&v++<500;){if(f.getTime()>=e){let x=f.getFullYear(),$=h&&!l&&x!==g;a.push({t:f.getTime(),label:zt(f,{locale:r,...m,...$?{year:"numeric"}:{}})}),g=x}c(f)}};if(i<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(h=>h>=d)??12,m=new Date(s);m.setMinutes(0,0,0),u(m,h=>h.setHours(h.getHours()+c),{hour:"numeric"})}else if(i<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(d,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),u(d,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=i/30.44,c=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(h=>h>=c)??120;if(m>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(h,f=>f.setFullYear(f.getFullYear()+m/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%m;f&&h.setMonth(h.getMonth()+(m-f)),u(h,g=>g.setMonth(g.getMonth()+m),{month:"short"},!0)}}return a}function Gt(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var Tn=(e,t,n)=>e==="date"?an(t,n)?.getTime()??NaN:Ke(t);function bi(e,t){let n=new Set(t?t.split(""):[]),r=e.series.flatMap((i,a)=>n.has(i)?[]:[a]);if(r.length===e.series.length)return[e,r];let o=i=>r.map(a=>i[a]);return[{...e,series:o(e.series),values:o(e.values),rows:o(e.rows),...e.rowValues&&{rowValues:o(e.rowValues)}},r]}function kl(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&So(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function wt(e,t,n,r,o={}){let i=bt(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:bt(n,"y"),u=!a&&r!==void 0?bt(r,"series"):null,d=e.map((R,M)=>i(R,M)),c=o.xType??kl(d),m=o.locale??he,h,f,g;if(c==="band"){let R=d.map(F=>String(F??""));h=we(R);let M=new Map(h.map((F,O)=>[F,O]));f=h.map((F,O)=>O),g=Int32Array.from(R,F=>M.get(F)??-1)}else{let R=c==="date"?o.dayFirst??Ao(d):void 0,M=d.map(K=>Tn(c,K,R)),F=Array.from(new Set(M.filter(K=>Number.isFinite(K)))).sort((K,le)=>K-le),O=new Map(F.map((K,le)=>[K,le]));f=F,h=F.map(String),g=Int32Array.from(M,K=>O.get(K)??-1)}let v=o.dateFormat,x=R=>typeof R=="string"?on(R.trim())?.[3]:void 0,$=c==="date"&&d.length<5e3?x(d[0]):void 0,C=($===2||$===3)&&d.every(R=>x(R)===$),b=C&&$===3;if(c==="date"&&!v){let R=f.length>1?f[f.length-1]-f[0]:0;v=C&&$===2||R>864e5*120?{month:"short"}:R<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},R>864e5*800&&(v={year:"numeric",month:"short"})}let w;if(c==="band")w=h;else if(b&&!o.dateFormat){let R=te(m)==="ko";w=f.map(M=>{let F=new Date(M),O=Math.floor(F.getMonth()/3)+1;return R?`${F.getFullYear()}년 ${O}분기`:`Q${O} ${F.getFullYear()}`})}else{let R=f.every(ar),M=c==="date"?new Intl.DateTimeFormat(m,v):new Intl.NumberFormat(m,R?{useGrouping:!1}:{maximumFractionDigits:6});w=f.length>1e3?Gt(f.length,F=>M.format(f[F])):f.map(F=>M.format(F))}let L=s?[...s]:u?we(e.map((R,M)=>String(u(R,M)??""))):[""],E=new Map(L.map((R,M)=>[R,M])),H=L.map(()=>new Array(h.length).fill(NaN)),j=L.map(()=>new Array(h.length).fill(null)),B=o.aggregate??"sum",I=B==="mean"?L.map(()=>new Uint32Array(h.length)):null,N=(R,M,F,O)=>{let K=H[R][M];B==="last"?H[R][M]=F:B==="count"?H[R][M]=(Number.isFinite(K)?K:0)+1:B==="mean"?Number.isFinite(F)&&(H[R][M]=(Number.isFinite(K)?K:0)+F,I[R][M]++):H[R][M]=Number.isFinite(K)?K+(Number.isFinite(F)?F:0):F,j[R][M]=O};for(let R=0;R<e.length;R++){let M=g[R];if(M<0)continue;let F=e[R];if(s)for(let O=0;O<s.length;O++)N(O,M,Ke(F[s[O]]),F);else{let O=u?E.get(String(u(F,R)??""))??0:0;N(O,M,Ke(l(F,R)),F)}}if(I)for(let R=0;R<H.length;R++)for(let M=0;M<h.length;M++)I[R][M]>1&&(H[R][M]/=I[R][M]);return{type:c,keys:h,xnum:f,labels:w,series:L,values:H,rows:j}}function yi(e,t){let n=e.keys.length;if(n<=t||t<2)return e;let r=n/t,o=[],i=[];for(let s=0;s<t;s++){let l=Math.floor(s*r),u=Math.min(n,Math.floor((s+1)*r));u<=l||(i.push([l,u]),o.push(s===0?0:s===t-1?n-1:Math.floor((l+u-1)/2)))}let a=e.values.map(s=>i.map(([l,u])=>{let d=0,c=0;for(let m=l;m<u;m++)Number.isFinite(s[m])&&(d+=s[m],c++);return c?d/c:NaN}));return{type:e.type,keys:o.map(s=>e.keys[s]),xnum:e.type==="band"?o.map((s,l)=>l):o.map(s=>e.xnum[s]),labels:Gt(o.length,s=>e.labels[o[s]]),series:e.series,values:a,rows:e.rows.map(s=>o.map(l=>s[l])),rowValues:e.values.map(s=>o.map(l=>s[l]))}}var wl=140,Wt=12,xi=14,vr=20,ki=12.5;function vl(e,t,n=Ho){let r=et(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),u=o.get(l);u?u.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function $l(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Wt)/(wl+Wt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ml(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Wt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var Vt=e=>e.filter(Number.isFinite);function Cn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=yt(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return Vt(n)}function wi(e,t,n,r,o,i){return wt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Tl(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,u=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let w=t.flat(),L=r.refLines??{},[E,H]=Xe([...Cn(w,r.x??"x"),...Vt([Number(L.x)])]),[j,B]=Xe([...Cn(w,r.y??"y"),...Vt([Number(L.y)])].filter(N=>!s||N>0)),I=r.zero??!1;return{y:u??(s?Ht(j,B,a):ct(j,B,a,{zero:I,pad:.08})),x:r.xDomain??ct(E,H,Math.max(2,Math.round(o/110)),{zero:I,pad:.06}),sameKeys:!0}}let d=e==="bar",c=d&&r.orientation==="horizontal",m=n[0]?.keys.join(""),h=n.every(w=>w.keys.join("")===m),f=n.length>0&&n.every(w=>w.type!=="band"&&w.type===n[0].type),g=r.xDomain??(!d&&f?Xe(n.flatMap(w=>Vt(w.xnum))):void 0),v=d?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(v==="percent")return{x:g,sameKeys:h};if(u)return{y:u,x:g,sameKeys:h};let x=[];t.forEach((w,L)=>{let E=n[L];if(v==="stacked"||v==="auto"&&E.series.length>1){let j=Ft(E.values,"zero");j.y0.forEach(B=>x.push(...B)),j.y1.forEach(B=>x.push(...B))}else E.values.forEach(j=>x.push(...j));d&&!c&&r.line!==void 0&&wi(e,w,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(j=>x.push(...j)),d||x.push(...Cn(w,r.lower),...Cn(w,r.upper))}),d&&x.push(0),c||x.push(...kn(r.annotations));for(let w of r.referenceLines??[])x.push(w.y);r.signColors&&x.push(Number(r.baseline??0));let[$,C]=Xe(Vt(x).filter(w=>!s||w>0));return{y:s?Ht($,C,a):d?ct($,C,c?Math.max(2,Math.round(o/120)):a):ct($,C,a,{zero:r.zero??e==="area"}),x:g,sameKeys:h}}function Cl(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=wt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),u=(r.yScale==="log"&&e==="line"?Mn:Se)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),d=$n(u,Nt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),c=n.flatMap(w=>w.series),m=r.endLabels??n.some(w=>w.series.length>1),h=d+6,f=i-(m?Math.min(i*.28,Math.max(...c.map(w=>ie(w,11,700)),20)+14):10),g=l.keys.length,[v,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=l.type==="number"?g>12:g>jt(v,x,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!g||$)return;let C=w=>h+(l.xnum[w]-v)/(x-v)*(f-h),b=w=>ie(l.labels[w],Ie);for(let w=1;;w++){let L=Array.from({length:Math.ceil(g/w)},(E,H)=>H*w);if(w>=g||L.every((E,H)=>!H||C(E)-C(L[H-1])>=(b(E)+b(L[H-1]))/2+8))return L.map(E=>({value:l.xnum[E],label:l.labels[E]}))}}function Sl(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 Al(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${Sl(`${e}|${t}|${o}|${gn(r)}`)}`}function Nl(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 Rl={en:{intro:(e,t)=>`${De(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:"(빈 값)"}},$r=18;function vi(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=vl(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=$l(s,a,e.columns),{pw:u,ph:d}=Ml(s,l,e.height),c=e.scale!=="free",m=t==="scatter"?[]:o.map(I=>wi(t,I,n,n.y,n.series,n.aggregate)),h=c?Tl(t,o,m,n,u,d):{sameKeys:!1},f=c?Cl(t,o,m,n,h,u,d,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",v=c&&(!g||h.sameKeys),x=c&&(g||h.x!==void 0||h.sameKeys),$=new Set(Nl(e.highlight,r)?[e.highlight].flat():[]),C=$.size>0,b=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,w=e.syncId??Al(t,e.by,n,e.data),L=rn(pt(n.format,e.locale),n.unit),E=Rl[e.lang],H=[],j=r.map(I=>I===""?E.blank:I);return{panels:r.map((I,N)=>{let R=o[N],M=j[N],F=N%l,O;if(t!=="scatter"){let le=m[N],Ye=$e=>le.values.reduce((He,Xt)=>He+(Number.isFinite(Xt[$e])?Xt[$e]:0),0),X=le.keys.map(($e,He)=>He).filter($e=>le.values.some(He=>Number.isFinite(He[$e]))),me=X[X.length-1];H.push({first:X.length?Ye(X[0]):NaN,last:X.length?Ye(me):NaN,total:X.reduce(($e,He)=>$e+Ye(He),0)}),t!=="bar"&&le.series.length===1&&me!==void 0&&(O=L(le.values[0][me]))}else H.push({first:NaN,last:NaN,total:R.length});let K={data:R,width:u,height:d,ariaLabel:e.title?`${e.title}, ${M}`:M,syncId:w,highlight:C?$.has(I)?b?()=>!0:void 0:"none":e.highlight,showYAxis:!v||F===0,showXAxis:!x||N+l>=a};return h.y&&(K.yDomain=h.y),h.x&&(K.xDomain=h.x),f&&(K.xTicks=f),{value:I,label:M,props:K,last:O,isPicked:$.has(I)}}),cols:l,pw:u,ph:d,isPanelPick:C,description:Fl(t,e.by,j,H,i,L,E)}}function Fl(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=u=>Qo(r.map(d=>d[u]));if(e==="line"||e==="area"){let u=l("last");u>=0&&(s+=a.endHigh(n[u],i(r[u].last)));let d=n.filter((c,m)=>r[m].last<r[m].first);s+=d.length?a.falling(`${d.slice(0,5).join(", ")}${d.length>5?a.more:""}`):a.noneFalling}else{let u=l("total");u>=0&&(s+=e==="bar"?a.total(n[u],i(r[u].total)):a.points(n[u],r[u].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var ve=P(Q(),1);function Pl(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function _l(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var Sn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Ti(e,t=!0){let[n,r]=(0,ve.useState)({visible:!t,near:!t});return(0,ve.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(a=>{let s=_l(a[a.length-1],Sn.threshold,Sn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Pl(Sn.threshold),rootMargin:Sn.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function $i(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function An(e){let[t,n]=(0,ve.useState)(null),[r,o]=(0,ve.useState)(e??null),i=(0,ve.useCallback)(a=>{n(a),a&&e===void 0&&o($i(a))},[e]);return Ve(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=u=>o(d=>d!==null&&Math.abs(d-u)<.5?d:u),s=()=>a($i(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let d=u[u.length-1]?.contentRect;d?a(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var Dl=()=>()=>{};function Pt(){return(0,ve.useSyncExternalStore)(Dl,()=>!0,()=>!1)}var Mi="(prefers-reduced-motion: reduce)";function Nn(e="auto"){let[t,n]=(0,ve.useState)(()=>_e&&typeof window.matchMedia=="function"?window.matchMedia(Mi).matches:!1);return(0,ve.useEffect)(()=>{if(e!=="auto"||!_e||typeof window.matchMedia!="function")return;let r=window.matchMedia(Mi),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var ze=P(V(),1),Ll=60,El=420;function Ci(e){let t=Oe(),n=e.chartProps??{},[,r,o]=An(e.width),i=e.width??(o||480),a=xe(e.locale??n.locale),s=te(a),l=(0,_t.useContext)(Ct),u=e.title??l,d=e.chart.facetPlan,c=(0,_t.useMemo)(()=>{let x=vi({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:u,locale:a,lang:s});return d?d(x,n,a):x},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(x,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,i,e.height,u,a,s,d]),m=`${(0,_t.useId)().replace(/:/g,"")}fd`,h=Nn(n.reducedMotion??"auto"),f=Pt(),g=ao({motion:{enabled:n.animate!==!1&&!h&&_e},hydrated:f},{waiting:!1,generation:0}),v=e.chart;return(0,ze.jsxs)("div",{ref:r,role:"group","aria-label":u,"aria-describedby":m,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,ze.jsx)("p",{id:m,style:dn,children:e.description??c.description}),(0,ze.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${c.cols}, minmax(0, 1fr))`,columnGap:Wt,rowGap:xi,...c.legend?{marginTop:$r}:null},children:c.panels.map((x,$)=>{let C=t.paint(x.isPicked?"accentText":c.isPanelPick?"muted":"ink");return(0,ze.jsxs)("div",{"data-facet":x.value,style:{minWidth:0,...io(g,!1,"fade",$*Ll,El)},children:[(0,ze.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:vr,fontSize:ki,fontWeight:700,lineHeight:`${vr}px`,color:C},children:[(0,ze.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.label}),x.last!==void 0?(0,ze.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:x.last}):null]}),(0,ze.jsx)(v,{...n,...x.props})]},x.value)})}),c.legend?(0,ze.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:$r},children:c.legend}):null]})}var Si=["max","min","first","last","none"];function Be(e,t,n,r,o="max"){let i=new Set,a=n.length,s=u=>{if(a&&u!=="none"){if(u==="first")i.add(0);else if(u==="last")i.add(a-1);else if(u==="max"||u==="min"){let d=-1,c=u==="max"?-1/0:1/0;r.forEach((m,h)=>{Number.isFinite(m)&&(u==="max"?m>c:m<c)&&(c=m,d=h)}),d>=0&&i.add(d)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((u,d)=>{d<a&&u!==null&&u!==void 0&&e(u,d)&&i.add(d)}),i;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<a&&i.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((d,c)=>{d===u&&i.add(c)});return i}var Ae=P(Q(),1);async function Ol(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(te(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return xt(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return xt(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):xt(i)}async function Il(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await Ol(i,t.parse,o,t.locale)}return t.select&&(r=Uo(r,t.select)),t.transform?t.transform(r):ut(r)}function Ai(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,Ae.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Ae.useState)(0),u=xe(t.locale),d=(0,Ae.useRef)(t);d.current={...t,locale:u};let c=(0,Ae.useRef)(e);c.current=e;let m=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),g=(0,Ae.useRef)(!1);(0,Ae.useEffect)(()=>{let x=c.current;if(!x||!r){a(b=>b.status==="loading"?{...b,status:"idle"}:b);return}let $=new AbortController,C=!0;return g.current=!0,a(b=>({...b,data:o?b.data:[],status:"loading",error:null})),Il(x,{...d.current,signal:$.signal}).then(b=>{C&&a({data:b,status:"success",error:null,updatedAt:Date.now()})}).catch(b=>{!C||$.signal.aborted||a(w=>({...w,status:"error",error:b instanceof Error?b:new Error(String(b))}))}).finally(()=>{C&&(g.current=!1)}),()=>{C=!1,g.current=!1,$.abort()}},[m,r,s,f,o]),(0,Ae.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{g.current||l($=>$+1)},n);return()=>clearInterval(x)},[n,r]);let v=(0,Ae.useCallback)(()=>l(x=>x+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:v}}var Tr=P(V(),1),zl=["csv","svg","png"],Bl=/^[=+\-@\t\r\n=+-@]/,Hl=/var\(|color-mix\(/;function Ni(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?Mo(e.getTime()):String(e);return`"${(Bl.test(t)&&!Number.isFinite(Ke(t))?`'${t}`:t).replace(/"/g,'""')}"`}function jl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Gl(e,t){return`\uFEFF${[t.map(Ni),...e.map(r=>t.map(o=>Ni(r[o])))].map(r=>r.join(",")).join(`\r
25
+ `&&f++,s.push(l),a.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),a.push(s));let d=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!d.length)return[];let c=f=>n?Ko(f):f;if(!r)return d.map(f=>Object.fromEntries(f.map((g,v)=>[String(v),c(g)])));let m=[],h=new Set;return d[0].forEach((f,g)=>{let v=f.trim()||`col${g+1}`,x=v;for(let $=2;h.has(x);$++)x=`${v}_${$}`;h.add(x),m.push(x)}),d.slice(1).map(f=>Object.fromEntries(m.map((g,v)=>[g,c(f[v]??"")])))}function gr(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?Ko(a[l]):a[l]??null])))}function fl(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function Xo(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function ut(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ut(JSON.parse(t))}catch{}return xt(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?gr(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)?ut(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?gr(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)?ut(t.rows):Array.isArray(t.values)?gr(t.values):Array.isArray(t.items)?ut(t.items):Array.isArray(t.results)?ut(t.results):fl(t)}return[]}function gn(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function Uo(e,t){let n=e.length;if(t>=n||t<3)return e.slice();let r=[e[0]],o=(n-2)/(t-2),i=0;for(let a=0;a<t-2;a++){let s=Math.floor((a+1)*o)+1,l=Math.min(Math.floor((a+2)*o)+1,n),u=0,d=0;for(let v=s;v<l;v++)u+=e[v].x,d+=e[v].y;let c=Math.max(1,l-s);u/=c,d/=c;let m=Math.floor(a*o)+1,h=Math.floor((a+1)*o)+1,f=m,g=-1;for(let v=m;v<h;v++){let x=Math.abs((e[i].x-u)*(e[v].y-e[i].y)-(e[i].x-e[v].x)*(d-e[i].y));x>g&&(g=x,f=v)}r.push(e[f]),i=f}return r.push(e[n-1]),r}function Ft(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,u)=>{let d=e[l][u];return Number.isFinite(d)&&d>0?d:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let u=1;u<r;u++){let d=0,c=0;for(let m=0;m<n;m++){let h=a(m,u),f=h-a(m,u-1),g=0;for(let v=0;v<m;v++)g+=a(v,u)-a(v,u-1);d+=h,c+=(f/2+g)*h}d&&(l-=c/d),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,m=0;for(let h=0;h<n;h++){let f=e[h][l],g=Number.isFinite(f)?f:0;g>=0?(o[h][l]=c,c+=g,i[h][l]=c):(o[h][l]=m,m+=g,i[h][l]=m)}continue}let u=0;for(let c=0;c<n;c++)u+=a(c,l);let d=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let m=a(c,l);t==="expand"&&(m=u?m/u*100:0),o[c][l]=d,d+=m,i[c][l]=d}}if(t==="wiggle"&&r){let l=1/0,u=-1/0;for(let c=0;c<r;c++)l=Math.min(l,o[0]?.[c]??0),u=Math.max(u,i[n-1]?.[c]??0);let d=0;for(let c=0;c<r;c++)d+=((o[0]?.[c]??0)+(i[n-1]?.[c]??0))/2;d/=r;for(let c=0;c<n;c++)for(let m=0;m<r;m++)o[c][m]-=d,i[c][m]-=d}return{y0:o,y1:i}}function Yo(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 Jo(e){let t=e.length,n=e.map(u=>{let d=0,c=-1/0;return u.forEach((m,h)=>{m>c&&(c=m,d=h)}),d}),r=e.map(u=>u.reduce((d,c)=>d+(Number.isFinite(c)?c:0),0)),o=Array.from({length:t},(u,d)=>d).sort((u,d)=>n[u]-n[d]),i=[],a=[],s=0,l=0;for(let u of o)s<l?(i.push(u),s+=r[u]):(a.push(u),l+=r[u]);return[...a.reverse(),...i]}var hl=Math.PI*2;function Zo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function W(e){return Math.round(e*100)/100}function qo(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${W(l[0])},${W(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${W(l[0])},${W(l[1])}`).join("");let o=[],i=[];for(let l=0;l<n-1;l++){let u=e[l+1][0]-e[l][0];o.push(u),i.push(u===0?0:(e[l+1][1]-e[l][1])/u)}let a=[i[0]];for(let l=1;l<n-1;l++)if(i[l-1]*i[l]<=0)a.push(0);else{let u=2*o[l]+o[l-1],d=o[l]+2*o[l-1];a.push((u+d)/(u/i[l-1]+d/i[l]))}a.push(i[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let u=o[l]/3;s+=`C${W(e[l][0]+u)},${W(e[l][1]+a[l]*u)} ${W(e[l+1][0]-u)},${W(e[l+1][1]-a[l+1]*u)} ${W(e[l+1][0])},${W(e[l+1][1])}`}return s}function pn(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return qo(e);if(t==="step"){let n=`M${W(e[0][0])},${W(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${W(o)}V${W(e[r][1])}H${W(e[r][0])}`}return n}return gl(e)}function gl(e){if(!e.length)return"";let t=`M${W(e[0][0])},${W(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${W(e[n][0])},${W(e[n][1])}`;return t}function bn(e,t,n="smooth"){if(!e.length)return"";let r=[...t].reverse(),o=pn(e,n),i;return n==="smooth"?i=qo(r.map(a=>[a[0],a[1]]),!1):n==="step"?i=pn(r,"step").replace(/^M/,"L"):i=r.map(a=>`L${W(a[0])},${W(a[1])}`).join(""),`${o}${i}Z`}function yn(e,t){let n=0,r=e.length-1;if(r<0)return-1;for(;r-n>1;){let o=n+r>>1;e[o]<t?n=o:r=o}return Math.abs(e[n]-t)<=Math.abs(e[r]-t)?n:r}function Qo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ei(e){let t=e.length,n=e.reduce((l,u)=>l+u.x,0)/t,r=e.reduce((l,u)=>l+u.y,0)/t,o=0,i=0,a=0;for(let l of e)o+=(l.x-n)*(l.y-r),i+=(l.x-n)**2,a+=(l.y-r)**2;let s=i?o/i:0;return{slope:s,r2:i&&a?o*o/(i*a):0,at:l=>r+s*(l-n)}}function ni(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function ti(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 xn=new Map;function ie(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=xn.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);ni(u)?a+=ti(u):s+=ti(u)}i=a+s*(n>=600?1.07:1),xn.size>5e3&&xn.clear(),xn.set(o,i)}return i*t}function Xe(e,t,n,r=400){if(e=e.trim(),ie(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ie(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(ni(s.charCodeAt(0))?2:3)?"":s+o}function ri(e,t,n=-1/0,r=1/0){let o=e.map((s,l)=>({y:s,i:l})).sort((s,l)=>s.y-l.y),i=new Array(e.length),a=o.map(s=>Math.max(n,Math.min(r,s.y)));for(let s=0;s<30;s++){let l=!1;for(let u=1;u<a.length;u++){let d=a[u]-a[u-1];if(d<t){let c=(t-d)/2;a[u-1]-=c,a[u]+=c,l=!0}}for(let u=0;u<a.length;u++)a[u]=Math.max(n,Math.min(r,a[u]));if(!l)break}for(let s=1;s<a.length;s++)a[s]-a[s-1]<t&&(a[s]=a[s-1]+t);if(a.length&&a[a.length-1]>r){let s=a[a.length-1]-r;for(let l=0;l<a.length;l++)a[l]-=s}return o.forEach((s,l)=>{i[s.i]=a[l]}),i}var Z=P(V(),1),kt=e=>Array.isArray(e)&&e.length===2;function kn(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&kt(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var oi=e=>e?.find(t=>t.type==="forecast")?.from,pl=(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 pr(e,t,n){let r=t[0],o=1/0;for(let i of t){let a=yr(e,i.x,i.y,i.anchor),s=n.reduce((l,u)=>l+pl(a,u),0);if(s<o&&(r=i,o=s),s===0)break}return n.push(yr(e,r.x,r.y,r.anchor)),r}var br=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),bl=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function ii(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 ai(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 wn(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 si={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function li({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((i,a)=>{if(i.type==="band"&&kt(i.y)){let s=ai(t,i.y);if(!s)return;let[l,u]=s;o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,u-l),fill:n.paint("accent"),opacity:.1}),(0,Z.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,Z.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},a))}else if(i.type==="band"&&kt(i.x)||i.type==="forecast"){let s;if(i.type==="forecast"){let d=wn(t,i.from);s=d===null?null:[d,t.x1]}else s=ii(t,i.x);if(!s)return;let l=br(t,s[0]),u=br(t,s[1]);if(u-l<.5)return;o.push((0,Z.jsx)("rect",{x:l,y:t.top,width:u-l,height:r,fill:n.paint("ink"),opacity:.05},a))}else if(i.type==="weekends"&&t.time&&t.time.t1-t.time.t0<=864e5*400){let s=Math.min(432e5,(t.time.t1-t.time.t0)/Math.max(1,t.time.n-1)/2),l=new Date(t.time.t0);l.setHours(0,0,0,0),l.setDate(l.getDate()-(l.getDay()+1)%7);for(let u=0;l.getTime()-s<=t.time.t1&&u<60;u++){let d=l.getTime();l.setDate(l.getDate()+2);let c=Math.max(t.x0,t.time.xt(d-s)),m=Math.min(t.x1,t.time.xt(l.getTime()-s));m>c&&o.push((0,Z.jsx)("rect",{x:c,y:t.top,width:m-c,height:r,fill:n.paint("ink"),opacity:.045},`${a}w${u}`)),l.setDate(l.getDate()+5)}}}),(0,Z.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var ui=(e,t)=>ie(e,10.5,t?700:500)+8;function yr(e,t,n,r="start",o){let i=ui(e,o);return{x:r==="end"?t-i:t,y:n-8,w:i,h:16}}function Bt({p:e,x:t,y:n,text:r,anchor:o="start",strong:i}){let a=yr(r,t,n,o,i);return(0,Z.jsxs)("g",{children:[(0,Z.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,Z.jsx)(pe,{x:a.x+4,y:n,size:10.5,weight:i?700:500,fill:e.paint(i?"ink":"muted"),children:r})]})}function ci({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=si[t.lang],o=[],i=[],a=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let u=t.y(s.y);if(!Number.isFinite(u))return;let d=s.label?Xe(s.label,160,10.5):"",c=d?pr(d,[{x:t.x1-2,y:u-10,anchor:"end"},{x:t.x0+2,y:u-10,anchor:"start"},{x:t.x1-2,y:u+10,anchor:"end"},{x:t.x0+2,y:u+10,anchor:"start"}],a):null;o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("dim"),strokeDasharray:"4 3"}),c?(0,Z.jsx)(Bt,{p:n,x:c.x,y:c.y,text:d,anchor:c.anchor}):null]},l))}else if(s.type==="band"&&s.label){let u=kt(s.y)?ai(t,s.y):[t.top,t.bottom],d=kt(s.x)?ii(t,s.x):[t.x0,t.x1];if(!d||!u)return;let[c,m]=u,h=Xe(s.label,160,10.5),f=Math.min(br(t,d[0]),t.x1-40)+4,g=pr(h,[{x:f,y:c+11,anchor:"start"},{x:f,y:m-11,anchor:"start"}],a);o.push((0,Z.jsx)(Bt,{p:n,x:g.x,y:g.y,text:h},l))}else if(s.type==="forecast"){let u=wn(t,s.from);if(u===null)return;let d=Xe(s.label??r.forecast,120,10.5),c=Math.min(u+4,t.x1-50),m=pr(d,[{x:c,y:t.top+9,anchor:"start"},{x:c,y:t.bottom-9,anchor:"start"}],a);o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("line",{x1:u,x2:u,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,Z.jsx)(Bt,{p:n,x:m.x,y:m.y,text:d})]},l))}else if(s.type==="event"&&s.label){let u=t.xAt(s.x);if(!bl(t,u))return;let d=Xe(s.label,140,10.5,700),c=ui(d,!0),m=Math.max(t.x0,Math.min(u-c/2,t.x1-c)),h=i.findIndex(g=>g<m-4);h<0&&(h=i.length),i[h]=m+c;let f=t.top+9+h*18;o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("line",{x1:u,x2:u,y1:f+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,Z.jsx)("circle",{cx:u,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,Z.jsx)(Bt,{p:n,x:m,y:f,text:d,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let u=t.points().filter(h=>Number.isFinite(h.x)&&Number.isFinite(h.y));if(u.length<2)return;let{at:d}=ei(u),c=u[0].x,m=u[u.length-1].x;o.push((0,Z.jsxs)("g",{children:[(0,Z.jsx)("line",{x1:c,x2:m,y1:d(c),y2:d(m),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,Z.jsx)(Bt,{p:n,x:m-2,y:d(m)-11,text:Xe(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,Z.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function mi(e,t,n,r){if(!e?.length)return"";let o=si[t],i=t==="ko",a=r??(l=>String(l??"")),s=e.map(l=>{let u=l.label?i?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&&kt(l.y)?i?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${u}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${u}`:l.type==="band"&&kt(l.x)?i?`${l.label??o.period} ${a(l.x[0])}~${a(l.x[1])}`:`${l.label??o.period} from ${a(l.x[0])} to ${a(l.x[1])}`:l.type==="line"&&typeof l.y=="number"?i?`기준선 ${n(l.y)}${u}`:`reference line at ${n(l.y)}${u}`:l.type==="event"?i?`${a(l.x)} ${l.label??""}`.trim():`${l.label??"event"} at ${a(l.x)}`:l.type==="forecast"?i?`${a(l.from)}부터 ${l.label??o.forecast}`:`${l.label??o.forecast.toLowerCase()} from ${a(l.from)}`:l.type==="trend"?i?l.label??"추세선":l.label??"trend line":l.type==="weekends"?o.weekends:""}).filter(Boolean);return s.length?` ${o.lead}: ${s.join(i?", ":"; ")}.`:""}var be=P(V(),1),Ie=10.5;function di(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>lt(a,{locale:n,maximumFractionDigits:i}))}function $n(e,t,n){let r=18;for(let o of di(e,t,n))r=Math.max(r,ie(o,Ie));return Math.ceil(r+8)}function fi(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:di(n,a,e.locale);return(0,be.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((u,d)=>{let c=Math.round(r(u))+.5,m=u===0&&e.zero!==!1;return(0,be.jsxs)("g",{children:[(0,be.jsx)("line",{x1:o,x2:i,y1:c,y2:c,stroke:t.paint(m?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:m?.7:1}),l?(0,be.jsx)(pe,{x:s?i+6:o-6,y:c,anchor:s?"start":"end",size:Ie,fill:t.paint("muted"),children:l[d]}):null]},u)})})}function xr(e,t,n){let r=[],o=-1/0;for(let i of e){let a=ie(i.label,Ie),s=Math.max(i.x-a/2,0);s<o+8||i.x-a/2<t||i.x+a/2>n||(r.push(i),o=s+a)}return r}function kr(e,t,n=Ie,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((c,m)=>m);let s=t.map(c=>ie(c,n,o)),l=(c,m)=>Math.abs(e[m]-e[c])<(s[c]+s[m])/2+r,u=[];for(let c of i??[])u.some(m=>l(m,c))||u.push(c);let d=c=>!u.some(m=>l(m,c));for(let c=1;c<=a;c++){let m=u.slice();for(let h=0;h<a;h+=c)d(h)&&m.push(h);if(c>1&&(a-1)%c>c/2&&d(a-1)&&m.push(a-1),m.sort((h,f)=>h-f),m.every((h,f)=>!f||!l(m[f-1],h)))return m}return[0,a-1]}var vn=e=>Math.round(e*10)/10;function hi(e){let{p:t}=e;return(0,be.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${vn(e.x)}px,0px)`},children:[(0,be.jsx)("line",{x1:0,x2:0,y1:e.top,y2:e.bottom,stroke:t.paint("dim"),strokeWidth:1}),e.dots?.map(n=>(0,be.jsxs)("g",{className:"ztd-guide",style:{transform:`translate(0px,${vn(n.y)}px)`},children:[(0,be.jsx)("circle",{r:n.strong?9:7,fill:n.color,opacity:.2}),(0,be.jsx)("circle",{r:n.strong?4.2:3.2,fill:n.color,stroke:t.paint("panel"),strokeWidth:2})]},n.k))]})}function gi(e){let{p:t}=e,n=Xe(e.label,160,Ie,700),r=ie(n,Ie,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,be.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${vn(o)}px,${vn(e.y)}px)`},children:[(0,be.jsx)("rect",{x:-r/2,y:-9,width:r,height:18,rx:9,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:3,paintOrder:"stroke"}),(0,be.jsx)(pe,{x:0,y:0,anchor:"middle",size:Ie,weight:700,fill:t.paint("onInk"),children:n})]})}function wr(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 ct(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=wr(a,n),u=[o,i];for(let d=0;d<4;d++){let c=Math.ceil(i/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-m<=l*.3?m:o-a*s,i===0?0:c-i<=l*.3?c:i+a*s];let h=wr(u[1]-u[0],n);if(h===l)break;l=h}return u}function pi(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=wr(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,u=0;l<=o+i*1e-9&&u<200;l+=i,u++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Ce(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>pi(n,r,l),s}function Ht(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[i,a]=ct(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function yl(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(u,d=1)=>{let c=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let h of u){let f=Number((h*10**m).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:pi(e,t,3)}function Mn(e,t){let n=Ce([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=()=>yl(e[0],e[1],Math.abs(t[1]-t[0])),r}function Ue(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var xl=864e5;function jt(e,t,n,r=fe){let o=t-e;if(!(o>0))return[{t:e,label:zt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/xl,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(d,c,m,h=!1)=>{let f=new Date(d),g=-1,v=0;for(;f.getTime()<=t&&v++<500;){if(f.getTime()>=e){let x=f.getFullYear(),$=h&&!l&&x!==g;a.push({t:f.getTime(),label:zt(f,{locale:r,...m,...$?{year:"numeric"}:{}})}),g=x}c(f)}};if(i<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(h=>h>=d)??12,m=new Date(s);m.setMinutes(0,0,0),u(m,h=>h.setHours(h.getHours()+c),{hour:"numeric"})}else if(i<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(d,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),u(d,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=i/30.44,c=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(h=>h>=c)??120;if(m>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(h,f=>f.setFullYear(f.getFullYear()+m/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%m;f&&h.setMonth(h.getMonth()+(m-f)),u(h,g=>g.setMonth(g.getMonth()+m),{month:"short"},!0)}}return a}function Gt(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var Tn=(e,t,n)=>e==="date"?an(t,n)?.getTime()??NaN:Ke(t);function bi(e,t){let n=new Set(t?t.split(""):[]),r=e.series.flatMap((i,a)=>n.has(i)?[]:[a]);if(r.length===e.series.length)return[e,r];let o=i=>r.map(a=>i[a]);return[{...e,series:o(e.series),values:o(e.values),rows:o(e.rows),...e.rowValues&&{rowValues:o(e.rowValues)}},r]}function kl(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Co(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function wt(e,t,n,r,o={}){let i=bt(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:bt(n,"y"),u=!a&&r!==void 0?bt(r,"series"):null,d=e.map((R,M)=>i(R,M)),c=o.xType??kl(d),m=o.locale??fe,h,f,g;if(c==="band"){let R=d.map(F=>String(F??""));h=we(R);let M=new Map(h.map((F,O)=>[F,O]));f=h.map((F,O)=>O),g=Int32Array.from(R,F=>M.get(F)??-1)}else{let R=c==="date"?o.dayFirst??Ao(d):void 0,M=d.map(K=>Tn(c,K,R)),F=Array.from(new Set(M.filter(K=>Number.isFinite(K)))).sort((K,le)=>K-le),O=new Map(F.map((K,le)=>[K,le]));f=F,h=F.map(String),g=Int32Array.from(M,K=>O.get(K)??-1)}let v=o.dateFormat,x=R=>typeof R=="string"?on(R.trim())?.[3]:void 0,$=c==="date"&&d.length<5e3?x(d[0]):void 0,S=($===2||$===3)&&d.every(R=>x(R)===$),b=S&&$===3;if(c==="date"&&!v){let R=f.length>1?f[f.length-1]-f[0]:0;v=S&&$===2||R>864e5*120?{month:"short"}:R<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},R>864e5*800&&(v={year:"numeric",month:"short"})}let w;if(c==="band")w=h;else if(b&&!o.dateFormat){let R=te(m)==="ko";w=f.map(M=>{let F=new Date(M),O=Math.floor(F.getMonth()/3)+1;return R?`${F.getFullYear()}년 ${O}분기`:`Q${O} ${F.getFullYear()}`})}else{let R=f.every(ar),M=c==="date"?new Intl.DateTimeFormat(m,v):new Intl.NumberFormat(m,R?{useGrouping:!1}:{maximumFractionDigits:6});w=f.length>1e3?Gt(f.length,F=>M.format(f[F])):f.map(F=>M.format(F))}let D=s?[...s]:u?we(e.map((R,M)=>String(u(R,M)??""))):[""],E=new Map(D.map((R,M)=>[R,M])),H=D.map(()=>new Array(h.length).fill(NaN)),j=D.map(()=>new Array(h.length).fill(null)),B=o.aggregate??"sum",I=B==="mean"?D.map(()=>new Uint32Array(h.length)):null,N=(R,M,F,O)=>{let K=H[R][M];B==="last"?H[R][M]=F:B==="count"?H[R][M]=(Number.isFinite(K)?K:0)+1:B==="mean"?Number.isFinite(F)&&(H[R][M]=(Number.isFinite(K)?K:0)+F,I[R][M]++):H[R][M]=Number.isFinite(K)?K+(Number.isFinite(F)?F:0):F,j[R][M]=O};for(let R=0;R<e.length;R++){let M=g[R];if(M<0)continue;let F=e[R];if(s)for(let O=0;O<s.length;O++)N(O,M,Ke(F[s[O]]),F);else{let O=u?E.get(String(u(F,R)??""))??0:0;N(O,M,Ke(l(F,R)),F)}}if(I)for(let R=0;R<H.length;R++)for(let M=0;M<h.length;M++)I[R][M]>1&&(H[R][M]/=I[R][M]);return{type:c,keys:h,xnum:f,labels:w,series:D,values:H,rows:j}}function yi(e,t){let n=e.keys.length;if(n<=t||t<2)return e;let r=n/t,o=[],i=[];for(let s=0;s<t;s++){let l=Math.floor(s*r),u=Math.min(n,Math.floor((s+1)*r));u<=l||(i.push([l,u]),o.push(s===0?0:s===t-1?n-1:Math.floor((l+u-1)/2)))}let a=e.values.map(s=>i.map(([l,u])=>{let d=0,c=0;for(let m=l;m<u;m++)Number.isFinite(s[m])&&(d+=s[m],c++);return c?d/c:NaN}));return{type:e.type,keys:o.map(s=>e.keys[s]),xnum:e.type==="band"?o.map((s,l)=>l):o.map(s=>e.xnum[s]),labels:Gt(o.length,s=>e.labels[o[s]]),series:e.series,values:a,rows:e.rows.map(s=>o.map(l=>s[l])),rowValues:e.values.map(s=>o.map(l=>s[l]))}}var wl=140,Wt=12,xi=14,vr=20,ki=12.5;function vl(e,t,n=Ho){let r=et(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),u=o.get(l);u?u.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function $l(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Wt)/(wl+Wt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ml(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Wt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var Vt=e=>e.filter(Number.isFinite);function Sn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=yt(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return Vt(n)}function wi(e,t,n,r,o,i){return wt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Tl(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,u=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let w=t.flat(),D=r.refLines??{},[E,H]=Ue([...Sn(w,r.x??"x"),...Vt([Number(D.x)])]),[j,B]=Ue([...Sn(w,r.y??"y"),...Vt([Number(D.y)])].filter(N=>!s||N>0)),I=r.zero??!1;return{y:u??(s?Ht(j,B,a):ct(j,B,a,{zero:I,pad:.08})),x:r.xDomain??ct(E,H,Math.max(2,Math.round(o/110)),{zero:I,pad:.06}),sameKeys:!0}}let d=e==="bar",c=d&&r.orientation==="horizontal",m=n[0]?.keys.join(""),h=n.every(w=>w.keys.join("")===m),f=n.length>0&&n.every(w=>w.type!=="band"&&w.type===n[0].type),g=r.xDomain??(!d&&f?Ue(n.flatMap(w=>Vt(w.xnum))):void 0),v=d?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(v==="percent")return{x:g,sameKeys:h};if(u)return{y:u,x:g,sameKeys:h};let x=[];t.forEach((w,D)=>{let E=n[D];if(v==="stacked"||v==="auto"&&E.series.length>1){let j=Ft(E.values,"zero");j.y0.forEach(B=>x.push(...B)),j.y1.forEach(B=>x.push(...B))}else E.values.forEach(j=>x.push(...j));d&&!c&&r.line!==void 0&&wi(e,w,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(j=>x.push(...j)),d||x.push(...Sn(w,r.lower),...Sn(w,r.upper))}),d&&x.push(0),c||x.push(...kn(r.annotations));for(let w of r.referenceLines??[])x.push(w.y);r.signColors&&x.push(Number(r.baseline??0));let[$,S]=Ue(Vt(x).filter(w=>!s||w>0));return{y:s?Ht($,S,a):d?ct($,S,c?Math.max(2,Math.round(o/120)):a):ct($,S,a,{zero:r.zero??e==="area"}),x:g,sameKeys:h}}function Sl(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=wt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),u=(r.yScale==="log"&&e==="line"?Mn:Ce)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),d=$n(u,Nt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),c=n.flatMap(w=>w.series),m=r.endLabels??n.some(w=>w.series.length>1),h=d+6,f=i-(m?Math.min(i*.28,Math.max(...c.map(w=>ie(w,11,700)),20)+14):10),g=l.keys.length,[v,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=l.type==="number"?g>12:g>jt(v,x,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!g||$)return;let S=w=>h+(l.xnum[w]-v)/(x-v)*(f-h),b=w=>ie(l.labels[w],Ie);for(let w=1;;w++){let D=Array.from({length:Math.ceil(g/w)},(E,H)=>H*w);if(w>=g||D.every((E,H)=>!H||S(E)-S(D[H-1])>=(b(E)+b(D[H-1]))/2+8))return D.map(E=>({value:l.xnum[E],label:l.labels[E]}))}}function Cl(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 Al(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${Cl(`${e}|${t}|${o}|${gn(r)}`)}`}function Nl(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 Rl={en:{intro:(e,t)=>`${Le(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:"(빈 값)"}},$r=18;function vi(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=vl(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=$l(s,a,e.columns),{pw:u,ph:d}=Ml(s,l,e.height),c=e.scale!=="free",m=t==="scatter"?[]:o.map(I=>wi(t,I,n,n.y,n.series,n.aggregate)),h=c?Tl(t,o,m,n,u,d):{sameKeys:!1},f=c?Sl(t,o,m,n,h,u,d,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",v=c&&(!g||h.sameKeys),x=c&&(g||h.x!==void 0||h.sameKeys),$=new Set(Nl(e.highlight,r)?[e.highlight].flat():[]),S=$.size>0,b=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,w=e.syncId??Al(t,e.by,n,e.data),D=rn(pt(n.format,e.locale),n.unit),E=Rl[e.lang],H=[],j=r.map(I=>I===""?E.blank:I);return{panels:r.map((I,N)=>{let R=o[N],M=j[N],F=N%l,O;if(t!=="scatter"){let le=m[N],Ye=$e=>le.values.reduce((He,Ut)=>He+(Number.isFinite(Ut[$e])?Ut[$e]:0),0),U=le.keys.map(($e,He)=>He).filter($e=>le.values.some(He=>Number.isFinite(He[$e]))),me=U[U.length-1];H.push({first:U.length?Ye(U[0]):NaN,last:U.length?Ye(me):NaN,total:U.reduce(($e,He)=>$e+Ye(He),0)}),t!=="bar"&&le.series.length===1&&me!==void 0&&(O=D(le.values[0][me]))}else H.push({first:NaN,last:NaN,total:R.length});let K={data:R,width:u,height:d,ariaLabel:e.title?`${e.title}, ${M}`:M,syncId:w,highlight:S?$.has(I)?b?()=>!0:void 0:"none":e.highlight,showYAxis:!v||F===0,showXAxis:!x||N+l>=a};return h.y&&(K.yDomain=h.y),h.x&&(K.xDomain=h.x),f&&(K.xTicks=f),{value:I,label:M,props:K,last:O,isPicked:$.has(I)}}),cols:l,pw:u,ph:d,isPanelPick:S,description:Fl(t,e.by,j,H,i,D,E)}}function Fl(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=u=>Qo(r.map(d=>d[u]));if(e==="line"||e==="area"){let u=l("last");u>=0&&(s+=a.endHigh(n[u],i(r[u].last)));let d=n.filter((c,m)=>r[m].last<r[m].first);s+=d.length?a.falling(`${d.slice(0,5).join(", ")}${d.length>5?a.more:""}`):a.noneFalling}else{let u=l("total");u>=0&&(s+=e==="bar"?a.total(n[u],i(r[u].total)):a.points(n[u],r[u].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var ve=P(Q(),1);function Pl(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function _l(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var Cn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Ti(e,t=!0){let[n,r]=(0,ve.useState)({visible:!t,near:!t});return(0,ve.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(a=>{let s=_l(a[a.length-1],Cn.threshold,Cn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Pl(Cn.threshold),rootMargin:Cn.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function $i(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function An(e){let[t,n]=(0,ve.useState)(null),[r,o]=(0,ve.useState)(e??null),i=(0,ve.useCallback)(a=>{n(a),a&&e===void 0&&o($i(a))},[e]);return Ve(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=u=>o(d=>d!==null&&Math.abs(d-u)<.5?d:u),s=()=>a($i(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let d=u[u.length-1]?.contentRect;d?a(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var Ll=()=>()=>{};function Pt(){return(0,ve.useSyncExternalStore)(Ll,()=>!0,()=>!1)}var Mi="(prefers-reduced-motion: reduce)";function Nn(e="auto"){let[t,n]=(0,ve.useState)(()=>_e&&typeof window.matchMedia=="function"?window.matchMedia(Mi).matches:!1);return(0,ve.useEffect)(()=>{if(e!=="auto"||!_e||typeof window.matchMedia!="function")return;let r=window.matchMedia(Mi),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var ze=P(V(),1),Dl=60,El=420;function Si(e){let t=Oe(),n=e.chartProps??{},[,r,o]=An(e.width),i=e.width??(o||480),a=xe(e.locale??n.locale),s=te(a),l=(0,_t.useContext)(St),u=e.title??l,d=e.chart.facetPlan,c=(0,_t.useMemo)(()=>{let x=vi({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:u,locale:a,lang:s});return d?d(x,n,a):x},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(x,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,i,e.height,u,a,s,d]),m=`${(0,_t.useId)().replace(/:/g,"")}fd`,h=Nn(n.reducedMotion??"auto"),f=Pt(),g=ao({motion:{enabled:n.animate!==!1&&!h&&_e},hydrated:f},{waiting:!1,generation:0}),v=e.chart;return(0,ze.jsxs)("div",{ref:r,role:"group","aria-label":u,"aria-describedby":m,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,ze.jsx)("p",{id:m,style:dn,children:e.description??c.description}),(0,ze.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${c.cols}, minmax(0, 1fr))`,columnGap:Wt,rowGap:xi,...c.legend?{marginTop:$r}:null},children:c.panels.map((x,$)=>{let S=t.paint(x.isPicked?"accentText":c.isPanelPick?"muted":"ink");return(0,ze.jsxs)("div",{"data-facet":x.value,style:{minWidth:0,...io(g,!1,"fade",$*Dl,El)},children:[(0,ze.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:vr,fontSize:ki,fontWeight:700,lineHeight:`${vr}px`,color:S},children:[(0,ze.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.label}),x.last!==void 0?(0,ze.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:x.last}):null]}),(0,ze.jsx)(v,{...n,...x.props})]},x.value)})}),c.legend?(0,ze.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:$r},children:c.legend}):null]})}var Ci=["max","min","first","last","none"];function Be(e,t,n,r,o="max"){let i=new Set,a=n.length,s=u=>{if(a&&u!=="none"){if(u==="first")i.add(0);else if(u==="last")i.add(a-1);else if(u==="max"||u==="min"){let d=-1,c=u==="max"?-1/0:1/0;r.forEach((m,h)=>{Number.isFinite(m)&&(u==="max"?m>c:m<c)&&(c=m,d=h)}),d>=0&&i.add(d)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((u,d)=>{d<a&&u!==null&&u!==void 0&&e(u,d)&&i.add(d)}),i;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<a&&i.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((d,c)=>{d===u&&i.add(c)});return i}var Ae=P(Q(),1);async function Ol(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(te(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return xt(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return xt(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):xt(i)}async function Il(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await Ol(i,t.parse,o,t.locale)}return t.select&&(r=Xo(r,t.select)),t.transform?t.transform(r):ut(r)}function Ai(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,Ae.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Ae.useState)(0),u=xe(t.locale),d=(0,Ae.useRef)(t);d.current={...t,locale:u};let c=(0,Ae.useRef)(e);c.current=e;let m=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),g=(0,Ae.useRef)(!1);(0,Ae.useEffect)(()=>{let x=c.current;if(!x||!r){a(b=>b.status==="loading"?{...b,status:"idle"}:b);return}let $=new AbortController,S=!0;return g.current=!0,a(b=>({...b,data:o?b.data:[],status:"loading",error:null})),Il(x,{...d.current,signal:$.signal}).then(b=>{S&&a({data:b,status:"success",error:null,updatedAt:Date.now()})}).catch(b=>{!S||$.signal.aborted||a(w=>({...w,status:"error",error:b instanceof Error?b:new Error(String(b))}))}).finally(()=>{S&&(g.current=!1)}),()=>{S=!1,g.current=!1,$.abort()}},[m,r,s,f,o]),(0,Ae.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{g.current||l($=>$+1)},n);return()=>clearInterval(x)},[n,r]);let v=(0,Ae.useCallback)(()=>l(x=>x+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:v}}var Tr=P(V(),1),zl=["csv","svg","png"],Bl=/^[=+\-@\t\r\n=+-@]/,Hl=/var\(|color-mix\(/;function Ni(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?Mo(e.getTime()):String(e);return`"${(Bl.test(t)&&!Number.isFinite(Ke(t))?`'${t}`:t).replace(/"/g,'""')}"`}function jl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Gl(e,t){return`\uFEFF${[t.map(Ni),...e.map(r=>t.map(o=>Ni(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
- `}function Vl(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Mr(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Ri=2,mt=16;function Fi(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Pi(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 _i(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+mt*2,a+mt*2],u=o.cloneNode(!0),d=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((f,g)=>{let v;for(let x of Array.from(f.attributes)){if(!Hl.test(x.value))continue;let $=(v??(v=getComputedStyle(f))).getPropertyValue(x.name);$&&d[g].setAttribute(x.name,Fi($,c))}}),u.removeAttribute("style");for(let[f,g]of Object.entries({viewBox:`${-mt} ${-mt} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(g));let m=Fi(getComputedStyle(r).backgroundColor,c),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(Pi("rect",{x:-mt,y:-mt,width:s,height:l,fill:m}),f),h&&u.insertBefore(Pi("image",{href:h.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:i,vh:a,bg:m,canvas:h}}function Wl(e,t){let n=_i(e,Ri,!1);if(!n)return;let r=Ri,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,mt*r,mt*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Mr(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Di(e){let t=Oe(e.theme),n=te(xe(e.locale))==="ko",r=Vl(e.filename),o=(i,a)=>{if(i==="csv")return Mr(new Blob([Gl(e.data,e.columns?.length?e.columns:jl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return Wl(a,r);let s=_i(a,1,!0);s&&Mr(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Tr.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:zl.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,Tr.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:a},i)})})}var Ei=P(V(),1);function Li(e,t=he){let n=pt(void 0,t),r=e.split(`
28
- `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?zt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,u=s.replace(Co,(d,c)=>o(i,c.trim())??(l=!0,""));l||a.push(u)}return a.length?a.map((s,l)=>(0,Ei.jsx)("div",{children:s},l)):null}}function Oi(e,t,n=!1){let r=et(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=we(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Ii(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 xt(t.csv)}return null}var re=P(Q(),1);var vt=P(Q(),1);var ae=P(V(),1),Kl={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}`},Bi={en:Kl,ko:{zoomHint:" Enter를 누르면 확대해요.",pickHint:" Enter를 누르면 이 구간을 골라요.",high:"최고",low:"최저",resetLabel:"전체 보기(확대 풀기)",reset:"전체 보기",extremes:(e,t)=>`, 최고 ${e}, 최저 ${t}`,range:(e,t)=>`${e}~${t}`}},Ul=4;function Xl(e){let[t,n]=(0,vt.useState)(null),[r,o]=(0,vt.useState)(!1),i=(0,vt.useRef)(null),a=(0,vt.useRef)(null),s=()=>{i.current=null,a.current=null,o(!1),n(null)},l=(m,h,f)=>!e.enabled||e.count<2||f.pointerType==="touch"||f.button!==0||!e.inPlot(m,h)?!1:(i.current={i:e.indexAt(m),x:m,moved:!1},f.currentTarget.setPointerCapture?.(f.pointerId),!0),u=m=>{let h=i.current;if(!h)return!1;if(!h.moved&&Math.abs(m-h.x)<Ul)return!0;h.moved=!0;let f=e.indexAt(m),g=Math.min(h.i,f),v=Math.max(h.i,f);return o(!0),n(x=>x?.from===g&&x.to===v?x:{from:g,to:v}),!0},d=(m,h,f)=>{let g=i.current;if(i.current=null,f.currentTarget.hasPointerCapture?.(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId),!g)return;if(o(!1),!g.moved||f.type==="pointercancel"){t&&(n(null),e.onCommit(null));return}let v=e.indexAt(m),x={from:Math.min(g.i,v),to:Math.max(g.i,v)},$=x.to>x.from;n($&&e.keep!==!1?x:null),e.onCommit($?x:null)},c=(m,h)=>{if(!e.enabled)return!1;if(m.key==="Escape"&&t)return s(),e.onCommit(null),!0;if(m.key==="Enter"&&t&&a.current!==null)return a.current=null,e.keep===!1&&n(null),e.onCommit(t),!0;if(!m.shiftKey||m.key!=="ArrowLeft"&&m.key!=="ArrowRight"||e.count<2)return!1;let f=m.key==="ArrowRight"?1:-1,g=a.current??h??(f>0?0:e.count-1),v=t&&a.current!==null?t.from===g?t.to:t.from:g,x=Math.max(0,Math.min(e.count-1,v+f));return a.current=g,n(x===g?null:{from:Math.min(g,x),to:Math.max(g,x)}),!0};return{range:t,dragging:r,keyboard:t!==null&&a.current!==null,down:l,move:u,up:d,key:c}}function Hi(e){let[t,n]=(0,vt.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 ji(e,t,n){let r=Bi[n.lang],o=e.brush==="zoom"?"zoom":e.brush?"select":null,i=Xl({enabled:o!==null,count:n.count,indexAt:n.indexAt,inPlot:n.inPlot,keep:o!=="zoom",onCommit:l=>{let u=l?n.toXRange(l):null;e.onBrush?.(u),o==="zoom"&&u&&u.to>u.from&&t.zoomTo([u.from,u.to])}}),a={onPointerDown:o?i.down:void 0,onPointerUp:o?i.up:void 0,onKey:o?l=>l.key==="Escape"&&t.view&&!i.range?(t.reset(),!0):i.key(l,n.active):void 0,overlay:t.view?(0,ae.jsx)(Yl,{p:n.p,onReset:t.reset,text:r}):null},s=i.keyboard?o==="zoom"?r.zoomHint:r.pickHint:"";return{brush:i,frame:a,hint:s,text:r}}function Gi(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e===0?null:(t-e)/Math.abs(e)}function Vi(e,t=he){let n=Math.round(e*1e3)/10;return`${n>0?"+":""}${lt(n,{locale:t,maximumFractionDigits:1})}%`}function Wi(e){let{p:t,top:n,bottom:r}=e,o=Math.min(e.x0,e.x1),i=Math.max(e.x0,e.x1),a=ie(e.main,11.5,800),s=ie(e.sub,10.5,500)+6,l=a+s+16,u=Math.max(2,Math.min(e.width-l-2,(o+i)/2-l/2)),d=n+4;return(0,ae.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,ae.jsx)("rect",{x:o,y:n,width:Math.max(1,i-o),height:Math.max(0,r-n),fill:t.paint("accent"),opacity:e.dragging?.1:.14}),(0,ae.jsx)("line",{x1:o,x2:o,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,ae.jsx)("line",{x1:i,x2:i,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,ae.jsx)("rect",{x:u,y:d,width:l,height:22,rx:8,fill:t.paint("panel"),stroke:t.paint("line")}),(0,ae.jsx)(pe,{x:u+8,y:d+11,size:11.5,weight:800,fill:t.paint("ink"),children:e.main}),(0,ae.jsx)(pe,{x:u+8+a+6,y:d+11,size:10.5,weight:500,fill:t.paint("muted"),children:e.sub})]})}function Ki(e){let{p:t,width:n,top:r,bottom:o,max:i,min:a}=e,s=Bi[e.lang];return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(zi,{p:t,x:i.x,y:i.y,text:`${s.high} ${i.text}`,below:i.y-26<r+30,width:n}),(0,ae.jsx)(zi,{p:t,x:a.x,y:a.y,text:`${s.low} ${a.text}`,below:a.y+26<o,width:n})]})}function zi(e){let{p:t}=e,n=ie(e.text,10.5,700)+12,r=18,o=Math.max(2,Math.min(e.width-n-2,e.x-n/2)),i=e.below?e.y+8:e.y-r-8;return(0,ae.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,ae.jsx)("circle",{cx:e.x,cy:e.y,r:3.5,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:2}),(0,ae.jsx)("rect",{x:o,y:i,width:n,height:r,rx:9,fill:t.paint("ink")}),(0,ae.jsx)(pe,{x:o+n/2,y:i+r/2,anchor:"middle",size:10.5,weight:700,fill:t.paint("onInk"),children:e.text})]})}function Yl(e){let{p:t}=e;return(0,ae.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 Jl=e=>Array.isArray(e);function Rn(e,t,n){let r=Jl(e)?e:[e];return n?t<r.length?r[t]:null:r[0]}function Xi(e,t,n,r,o,i){let a=typeof t=="function"||typeof n=="function"?new Map(o.map((s,l)=>[s,l])):null;return e.map((s,l)=>{let u=new Array(s.length).fill(NaN),d=new Array(s.length).fill(NaN),c=Rn(t,l,r),m=Rn(n,l,r);if(c===null||m===null)return{lo:u,hi:d};let h=yt(c,""),f=yt(m,"");for(let g=Math.max(0,i);g<s.length;g++){let v=s[g];if(v===null)continue;let x=a?.get(v)??-1,$=h(v,x),C=f(v,x);!Number.isFinite($)||!Number.isFinite(C)||(u[g]=Math.min($,C),d[g]=Math.max($,C))}return{lo:u,hi:d}})}var Cr=(e,t,n)=>Number.isFinite(e)&&Number.isFinite(t)&&(e<t||e>n);function ql(e,t){let n=[],r=-1;for(let o=0;o<=e.length;o++){let i=o<e.length&&Number.isFinite(e[o])&&Number.isFinite(t[o]);i&&r<0?r=o:!i&&r>=0&&(o-1>r&&n.push([r,o-1]),r=-1)}return n}function Zl(e,t,n,r,o,i,a){let s=t(i),l=t(a);if(!(l>=s))return;let u=Math.floor(s),d=Math.floor(l)-u+1,c=new Array(d).fill(1/0),m=new Array(d).fill(-1/0),h=0;for(let f=i;f<a;f++){let g=Math.min(n[f],n[f+1]),v=Math.max(r[f],r[f+1]),x=Math.floor(t(f+1))-u;for(let $=h;$<=x;$++)g<c[$]&&(c[$]=g),v>m[$]&&(m[$]=v);h=x}for(let f=0;f<d;f++){let g=Math.max(s,u+f),v=Math.min(l,u+f+1);v<=g&&f>0||(e.xl.push(g),e.xr.push(v),e.top.push(o(m[f])),e.bottom.push(o(c[f])))}}function Yi(e,t,n,r,o){let i=ql(t,n);if(!i.length)return null;let a=i.reduce((u,[d,c])=>u+c-d+1,0),s={runs:[],xl:[],xr:[],top:[],bottom:[]},l=a>o;for(let[u,d]of i)if(s.runs.push(s.top.length),l)Zl(s,e,t,n,r,u,d);else for(let c=u;c<=d;c++)s.xl.push(e(c)),s.top.push(r(n[c])),s.bottom.push(r(t[c]));return s.runs.push(s.top.length),s}function Ql(e,t,n,r,o,i){let a=W(n[o]),s=`M${W(e[o])},${a}`;for(let l=o+1;l<i;l++){let u=W(n[l]);u!==a&&(s+=`H${W(e[l])}V${a=u}`)}a=W(r[i-1]),s+=`H${W(t[i-1])}V${a}`;for(let l=i-2;l>=o;l--){let u=W(r[l]);u!==a&&(s+=`H${W(t[l])}V${a=u}`)}return`${s}H${W(e[o])}Z`}var Ui=(e,t,n,r)=>e.slice(n,r).map((o,i)=>[o,t[n+i]]);function Ji(e,t,n,r){let o="";for(let i=0;i+1<e.runs.length;i++){let a=e.runs[i],s=e.runs[i+1];s-a<1||(o+=e.xr.length?Ql(e.xl,e.xr,t,n,a,s):bn(Ui(e.xl,t,a,s),Ui(e.xl,n,a,s),r))}return o}var se=P(Q(),1);function qi(e,t){let n=Oe(e.theme),[r,o,i]=An(e.width),a=Pt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,d=Nn(e.reducedMotion??"auto"),c=e.animate!==!1&&!d&&_e,m=Ti(r,e.animateOnView!==!1&&c),h=xe(e.locale),f=te(h),g=(0,se.useMemo)(()=>pt(e.format,h,t.format),[e.format,h,t.format]),v=(0,se.useCallback)(X=>nn(X,{locale:h}),[h]),x=(0,se.useMemo)(()=>rn(g,e.unit),[g,e.unit]),$=(0,se.useMemo)(()=>gn(e.data),[e.data]),[C,b]=(0,se.useState)(null),[w,L]=(0,se.useState)(null),E=(0,se.useRef)([]),H=(0,se.useRef)(e.onHover);H.current=e.onHover;let j=(0,se.useRef)(e.onClick);j.current=e.onClick;let B=(0,se.useRef)(null),I=(0,se.useRef)(null),N=(0,se.useRef)(null),R=(0,se.useCallback)((X,me="pointer")=>{if(N.current!==X){N.current=X;let $e=X===null?null:E.current[X]??null;queueMicrotask(()=>H.current?.($e)),I.current?.(X)}B.current=X===null?null:me,b(X),L(B.current)},[]),M=(0,se.useCallback)(X=>{B.current!=="keyboard"&&(B.current=X===null?null:"sync",b(X),L(B.current))},[]),F=(0,se.useCallback)(X=>{let me=E.current[X];me&&j.current?.(me)},[]),O=Po(e.replayKey),K=e.width!==void 0||(i??0)>0,le={enabled:c,active:m.visible&&K,near:m.near,replayKey:O,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Ye=(0,se.useCallback)((X,me=1)=>C===null||C===X?me:me*.38,[C]);return{p:n,width:s,height:u,measured:K,responsive:e.width===void 0,pending:_e&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:le,fv:x,fmt:g,pct:v,locale:h,lang:f,t:f==="ko"?uo:lo,active:C,via:w,setActive:R,click:F,events:E,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Ye,sig:$,description:e.description,reduced:d,publish:I,applySync:M}}var ne=P(Q(),1);function eu(e){return 1-Math.pow(1-e,3)}function tu(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function nu(e){return e==="easeInOut"?tu:e==="linear"?t=>t:eu}function ru(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function Dt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function Fn(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 Zi(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 Qi(e,t,n,r){if(!t||!n||t.length!==n.length)return Dt(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Dt(s,n[a]))o.push(l)}return o.length===r?o:Dt(e,r)}var Pn=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||!Fn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Zi(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Fn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let u=a.to.length;s.from=Qi(s.cur,s.parts,a.parts,u),s.vel=Qi(s.curVel,s.parts,a.parts,u),s.parts=a.parts,s.to=a.to.slice(),Zi(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=Fn(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let u=this.make(a,a.enter??a.from??a.to,n+l,0);u.done=Fn(u.from,u.to),this.tracks.set(a.key,u)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Dt(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=nu(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,u=s.to.length;if(s.from.length!==u&&(s.from=Dt(s.from,u)),s.vel.length!==u&&(s.vel=Dt(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let d;if(this.easing==="spring"){let c=Math.exp(-i*l),m=i*l>=8&&i*l<20,h=0;for(let f=0;f<u;f++){let g=s.from[f]-s.to[f],v=s.vel[f]+i*g;s.cur[f]=s.to[f]+(g+v*l)*c,s.curVel[f]=(s.vel[f]-i*v*l)*c,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}d=i*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+i*l)*c)}else{let c=Math.min(1,l/o),m=r(c),h=ru(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*m,s.curVel[f]=(s.to[f]-s.from[f])*h;d=c>=1,s.progress=m}if(d){for(let c=0;c<u;c++)s.cur[c]=s.to[c],s.curVel[c]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Kt=new Set,_n=0;function ea(e){_n=0;let t=Array.from(Kt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Kt.delete(n)}Kt.size&&typeof requestAnimationFrame<"u"&&(_n=requestAnimationFrame(ea))}function ta(e){return Kt.add(e),!_n&&typeof requestAnimationFrame<"u"&&(_n=requestAnimationFrame(ea)),()=>{Kt.delete(e)}}function ou(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 na(e,t){let n=(0,ne.useMemo)(()=>ou(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:u=900,stagger:d=0}=t,c=(0,ne.useRef)(null),m=(0,ne.useRef)("init"),h=(0,ne.useRef)(null),f=(0,ne.useRef)(s),g=(0,ne.useRef)(a),v=(0,ne.useRef)(!1),x=(0,ne.useRef)(0),[,$]=(0,ne.useState)(0),C=(0,ne.useRef)(null),b=(0,ne.useRef)(!0);c.current||(c.current=new Pn,c.current.configure(l,u),c.current.snap(n),h.current=n);let w=c.current;if(w.configure(l,u),h.current!==n){let I=m.current,N=!Object.is(f.current,s);w.sameTargets(n)?w.refreshData(n):!r||I==="init"?w.snap(n):I==="idle"?w.hold(n):I==="running"||N?w.update(n,Zt(),d):w.snap(n),h.current=n,f.current=s}let L=(0,ne.useRef)(()=>!1);L.current=I=>{if(!b.current)return!1;let N=w.step(I);return!N&&m.current==="running"&&(m.current="done"),$(R=>(R+1)%1e9),N||(C.current=null),N};let E=(0,ne.useCallback)(()=>{if(!_e||C.current||!w.animating)return;let I=N=>L.current(N);C.current=ta(I)},[w]);Ve(()=>{let I=!Object.is(g.current,a);if(g.current=a,!r){(m.current!=="done"||w.animating)&&(w.snap(h.current??n),m.current="done",$(N=>N+1));return}m.current==="init"||I&&i?(w.hold(h.current??n),m.current="idle",v.current=!1,$(N=>N+1)):I&&(v.current=!0)},[r,a]),Ve(()=>{!r||!i||!v.current||(v.current=!1,w.hold(h.current??n),m.current="idle",$(I=>I+1))},[i,r]),(0,ne.useEffect)(()=>{r&&o&&m.current==="idle"&&(w.start(Zt()),x.current+=1,m.current="running",E(),$(I=>I+1))},[r,o,a,w,E]),(0,ne.useEffect)(()=>{w.animating&&E()}),(0,ne.useEffect)(()=>(b.current=!0,()=>{b.current=!1,C.current?.(),C.current=null}),[]);let H=Zt(),j=w.elapsed(H),B=r&&m.current==="idle";return{items:w.items(),get:I=>w.get(I),elapsed:B?0:j,fade:(I,N=320)=>B?0:Number.isFinite(j)?Math.max(0,Math.min(1,(j-I)/N)):1,waiting:B,animating:w.animating,generation:x.current}}var A=P(V(),1),iu={line:"Line chart",area:"Area chart",span:(e,t)=>`${e}: ${t}`,desc:(e,t,n,r,o)=>`${De(e,"series","series")} (${t}), x from ${n} to ${r}, ${De(o,"point")}`,lower:"low",upper:"high",band:e=>` Range ${e}.`,range:(e,t)=>`${e} to ${t}`,outside:(e,t)=>e?` ${De(e,"point")} outside the range: ${t}.`:" No points outside the range.",where:(e,t)=>`${e} (${t})`,logDropped:e=>` ${De(e,"value")} at or below 0 ${e===1?"is":"are"} not shown on the log scale.`},au={en:iu,ko:{line:"라인 차트",area:"영역 차트",span:(e,t)=>`${e} 구간 ${t}`,desc:(e,t,n,r,o)=>`계열 ${e}개(${t}), x ${n}부터 ${r}까지 ${o}개 지점`,lower:"하한",upper:"상한",band:e=>` 범위 ${e}.`,range:(e,t)=>`${e}~${t}`,outside:(e,t)=>e?` 범위 밖 ${e}개 지점: ${t}.`:" 범위 밖 지점 없음.",where:(e,t)=>`${e}(${t})`,logDropped:e=>` 로그 눈금이라 0 이하 값 ${e}개는 뺐어요.`}};function su(e,t,n){let r=Math.max(0,Math.min(t,n)),o=Math.min(e.keys.length-1,Math.max(t,n)),i=e.keys.slice(r,o+1);return{type:e.type,keys:i,xnum:e.type==="band"?i.map((a,s)=>s):e.xnum.slice(r,o+1),labels:e.labels.slice(r,o+1),series:e.series,values:e.values.map(a=>a.slice(r,o+1)),rows:e.rows.map(a=>a.slice(r,o+1))}}function lu(e,t,n){if(t!=="forecast")return 0;let r=e.keys.length;if(n===void 0)return r;if(e.type==="band"){let a=e.keys.indexOf(String(n));return a<0?r:a}let o=Tn(e.type,n);if(!Number.isFinite(o))return r;let i=e.xnum.findIndex(a=>a>=o);return i<0?r:i}function uu(e,t,n,r,o){let i=(d,c)=>e.series.length>1&&e.series[d]?o.where(c,e.series[d]):c,a=we(t.flatMap((d,c)=>d.lo.some(Number.isFinite)?[i(c,o.range(...n[c]))]:[]));if(!a.length)return"";let s=o.band(a.join(", "));if(!r)return s;let l=0,u=[];return t.forEach((d,c)=>{for(let m=0;m<d.lo.length;m++)Cr(e.values[c][m],d.lo[m],d.hi[m])&&(l++,u.length<5&&u.push(i(c,e.labels[m])))}),s+o.outside(l,`${u.join(", ")}${l>u.length?", …":""}`)}function ra(e,t,n,r){let o=Rn(e,t,n);return typeof o=="string"&&o?o:r}function cu(e,t,n,r){let o=e.keys.length;if(e.type==="band"){let l=o>1?(n-t)/(o-1):0;return u=>o>1?t+u*l:(t+n)/2}let[i,a]=r??Xe(e.xnum),s=Se([i,a===i?i+1:a],[t,n]);return Object.assign(l=>s(e.xnum[l]),{v:s})}function mu(e){let{c:t,model:n,xs:r,x0:o,x1:i,y:a,domain:s}=e,l=t.p,u;if(s&&n.type!=="band"&&e.fixed){let c=Se(s[1]===s[0]?[s[0],s[0]+1]:[s[0],s[1]],[o,i]);u=e.fixed.map(m=>({x:c(m.value),label:m.label}))}else if(s&&n.type!=="band"){let[c,m]=s[1]===s[0]?[s[0],s[0]+1]:s,h=n.type==="date",f=Math.max(2,Math.floor((i-6)/(h?64:70))),g=c>=1e3&&m<=9999?String:Nt(void 0,t.locale,Math.max(-c,m)),v=h?jt(c,m,f,t.locale).map(C=>({v:C.t,label:C.label})):Se([c,m],[0,1]).ticks(f).map(C=>({v:C,label:g(C)})),x=Se([c,m],[6,i]),$=Se([c,m],[o,i]);u=xr(v.map(C=>({...C,x:x(C.v)})),-6,t.width+2).map(C=>({x:$(C.v),label:C.label}))}else if(n.type==="date"&&n.keys.length>1){let c=n.xnum[0],m=n.xnum[n.xnum.length-1],h=Math.max(2,Math.floor((i-o)/64)),f=Se([c,m],[o,i]),g=jt(c,m,h,t.locale);if(g.length>=2&&n.keys.length>g.length)u=g.map(v=>({x:f(v.t),label:v.label}));else{let v=n.keys.map((x,$)=>r($));u=kr(v,n.labels).map(x=>({x:v[x],label:n.labels[x]}))}}else if(n.type==="number"&&n.keys.length>12){let[c,m]=Xe(n.xnum),h=Se([c,m],[o,i]),f=c>=1e3&&m<=9999?String:Nt(void 0,t.locale,Math.max(-c,m));u=h.ticks(Math.max(2,Math.floor((i-o)/70))).map(g=>({x:h(g),label:f(g)}))}else{let c=n.keys.map((m,h)=>r(h));u=kr(c,n.labels).map(m=>({x:c[m],label:n.labels[m]}))}let d=s&&n.type!=="band"?u:xr(u,-2,t.width+2);return(0,A.jsx)("g",{"aria-hidden":"true",children:d.map((c,m)=>(0,A.jsx)(pe,{x:c.x,y:a,anchor:"middle",size:Ie,fill:l.paint("muted"),children:c.label},m))})}function Sr(e,t,n,r,o){if(r)return o==="categorical"?Le(e,t,n):yo(e,t,n);if(o==="categorical")return Le(e,t,n);let i=de(e,"strong"),a=de(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}function du(e){let t=e.kind==="area",n=!t&&e.yScale==="log",r=qi(e,{height:p=>Math.max(200,Math.min(300,p*.5)),duration:1100,stagger:120}),{p:o,width:i,height:a}=r,s=au[r.lang],l=(0,re.useId)().replace(/:/g,""),u=(0,re.useMemo)(()=>wt(e.data,e.x,e.y,e.series,{xType:e.xType,locale:r.locale,aggregate:e.aggregate,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,e.xType,r.locale,e.aggregate,e.dayFirst]),[d,c]=(0,re.useMemo)(()=>{if(!n)return[u,0];let p=0,y=u.values.map(S=>S.map(T=>T<=0?(p++,Number.NaN):T));return p?[{...u,values:y},p]:[u,0]},[u,n]),m=d.series.length,h=t?e.stack??(m>1?"stacked":"none"):"none",f=Hi(r.sig),g=f.view,v=(0,re.useMemo)(()=>g?su(d,g[0],g[1]):d,[d,g]),x=Math.max(40,Math.round(e.maxPoints??i/2)),$=(0,re.useMemo)(()=>h!=="none"?yi(v,x):v,[v,h,x]),C=e.hidden?.join("")??"",[b,w]=(0,re.useMemo)(()=>bi($,C),[$,C]),L=b.rowValues??b.values,E=(0,re.useMemo)(()=>h==="none"?null:Ft(b.values,h==="percent"?"expand":"zero"),[b,h]),H=oi(e.annotations),{lower:j,upper:B}=e,I=lu(b,e.bandFrom,H),N=(0,re.useMemo)(()=>{if(j===void 0||B===void 0||h!=="none")return null;let p=Xi($.rows,j,B,Array.isArray(e.y),e.data,I),y=b===$?p:w.map(S=>p[S]);if(n)for(let S of y)S.lo.forEach((T,D)=>{T>0&&S.hi[D]>0||(S.lo[D]=S.hi[D]=Number.NaN)});return y.some(S=>S.lo.some(Number.isFinite))?y:null},[$,b,w,j,B,e.y,e.data,h,I,n]),R=(0,re.useMemo)(()=>{let p=[];return N?.forEach(y=>y.lo.forEach((S,T)=>Number.isFinite(S)&&p.push(S,y.hi[T]))),p.length?Xe(p):p},[N]),M=(0,re.useMemo)(()=>{let p=$.values.map(y=>y.reduce((S,T)=>S+(Number.isFinite(T)?T:0),0));return Be(e.highlight,$.series,$.series,p,"first")},[$,e.highlight]),F=(0,re.useMemo)(()=>Sr(o,m,M,t,e.colorMode),[t,e.colorMode,o,m,M]),O=(0,re.useMemo)(()=>b===$?M:new Set(w.flatMap((p,y)=>M.has(p)?[y]:[])),[b,$,M,w]),K=(0,re.useMemo)(()=>b===$?F:w.map(p=>F[p]),[b,$,F,w]),le=[];E?E.y1.forEach(p=>p.forEach(y=>le.push(y))):b.values.forEach(p=>p.forEach(y=>Number.isFinite(y)&&le.push(y))),le.push(...R);let Ye=e.referenceLines?.filter(p=>typeof p?.y=="number"&&Number.isFinite(p.y)&&(!n||p.y>0));Ye?.forEach(p=>le.push(p.y)),le.push(...kn(e.annotations).filter(p=>!n||p>0));let X=e.baseline??0,me=!!e.signColors&&h==="none"&&(!n||X>0);me&&le.push(X);let[$e,He]=Xe(le),Xt=e.yDomain&&(!n||e.yDomain[0]>0&&e.yDomain[1]>0)?e.yDomain:void 0,je=e.yLabel?22:10,Je=22,Ln=Math.max(2,Math.round(a/70)),dt=Xt??(n?Ht($e,He,Ln):h==="percent"?[0,100]:ct($e,He,Ln,{zero:e.zero??t})),_r=h==="percent"?p=>`${p}%`:Nt(e.format,r.locale,Math.max(Math.abs(dt[0]),Math.abs(dt[1]))),ee=(n?Mn:Se)(dt,[a-Je,je]),Dr=ee.ticks(Ln),En=e.showYAxis!==!1,On=En?$n(Dr,_r,r.locale):0,Lr=e.endLabels??m>1,Ta=p=>{for(let y=b.keys.length-1;y>=0;y--)if(Number.isFinite(b.values[p][y]))return y;return-1},Er=Lr?Math.min(i*.28,Math.max(...$.series.map(p=>ie(p,11,700)),20)+14):10,Ne=On+6,ge=i-Er,$t=g?void 0:e.xDomain,Me=cu(b,Ne,ge,$t),nt=(0,re.useMemo)(()=>b.keys.map((p,y)=>Me(y)),[b,Ne,ge,$t?.[0],$t?.[1]]),Lt=e.maxPoints??Math.max(60,Math.round((ge-Ne)*2)),In=e.curve??"smooth",Et=Math.min(dt[1],Math.max(dt[0],0)),ft=o.color(e.downColor,"neutralStrong"),ht=ee(X),gt=Me.v,Or=p=>gt?Tn(b.type,p):b.keys.indexOf(String(p)),Ca=p=>{let y=Or(p);return gt?Number.isFinite(y)?gt(y):null:y<0?null:Me(y)},Yt=b.xnum.length-1,zn={p:o,lang:r.lang,xAt:Ca,y:ee,x0:Ne,x1:ge,top:je,bottom:a-Je,half:gt||Yt<1?0:(Me(1)-Me(0))/2,time:b.type==="date"&&gt&&Yt>0?{t0:b.xnum[0],t1:b.xnum[Yt],n:Yt+1,xt:gt}:void 0,points:()=>{let p=[...O][0]??0;return nt.map((y,S)=>({x:y,y:ee(E?E.y1[p][S]:b.values[p][S])}))}},Mt=wn(zn,H),Sa=p=>{let y=Or(p),S=gt?b.xnum.indexOf(y):y;return S>=0?b.labels[S]:String(p??"")},Ir=(p,y)=>me&&O.has(p)&&y<X?ft:K[p].fill,Bn=!e.connectNulls&&!E&&b.keys.length>1,Hn=(0,re.useMemo)(()=>b.series.map((p,y)=>{let S=G=>E?E.y1[y][G]:b.values[y][G],T=[];for(let G=0;G<b.keys.length;G++){if(!Number.isFinite(S(G)))continue;let z=T[T.length-1];z&&(!Bn||z[z.length-1]===G-1)?z.push(G):T.push([G])}let D=T.reduce((G,z)=>G+z.length,0);D>Lt&&(T=T.map(G=>Xo(G.map(z=>({x:Me(z),y:S(z),k:z})),T.length>1?Math.max(3,Math.round(Lt*G.length/D)):Lt).map(z=>z.k)));let U=T.flat(),oe=0,ce=T.map(G=>[oe,oe+=G.length]),Re=U.map(G=>ee(S(G))),qe=E?U.map(G=>ee(E.y0[y][G])):t?U.map(()=>ee(Et)):void 0,ot={s:y,name:p,pts:Re,xs:U.map(G=>Me(G)),base:qe,sw:K[y],hi:O.has(y),idx:U,spans:ce},Te=N?.[y],it=Te?Yi(Me,Te.lo,Te.hi,ee,Lt):null;if(!Te||!it)return ot;let ye=e.outside?U.flatMap((G,z)=>Cr(b.values[y][G],Te.lo[G],Te.hi[G])?[z]:[]):void 0;return{...ot,band:it,out:ye}}),[b,E,K,O,Ne,ge,$t?.[0],$t?.[1],a,dt[0],dt[1],Lt,t,N,e.outside,Bn,n]),jn=r.motion.stagger??120,zr=(0,re.useMemo)(()=>[...Hn].sort((p,y)=>Number(p.hi)-Number(y.hi)),[Hn]),Aa=(0,re.useMemo)(()=>zr.map((p,y)=>{let S=ee(Et),T=p.band?[...p.band.top,...p.band.bottom]:[],D=p.band?[p.band.top.length,p.band.bottom.length]:[];if(t){let U=p.base??p.pts.map(()=>S);return{key:`s:${p.name}`,to:[1,...p.pts,...U,...T],from:[0,...p.pts.map(()=>S),...U.map(()=>S),...T.map(()=>S)],delay:y*jn*.5,parts:[1,p.pts.length,U.length,...D],data:p}}return{key:`s:${p.name}`,to:[1,...p.pts,...T],from:[0,...p.pts,...T],enter:[0,...p.pts,...T],delay:y*jn,parts:[1,p.pts.length,...D],data:p}}),[zr,jn,t,a,Et]),Br=na(Aa,r.motion),Hr=r.fv,Gn=r.fmt,Tt=(0,re.useMemo)(()=>{if(!N)return null;let p=Array.isArray(e.y),y=b.series.map((T,D)=>[ra(j,w[D],p,s.lower),ra(B,w[D],p,s.upper)]);return{range:(T,D)=>Number.isFinite(N[T].lo[D])?` (${y[T][0]} ${Gn(N[T].lo[D])} ~ ${y[T][1]} ${Gn(N[T].hi[D])})`:"",unnamed:typeof e.y=="string"?e.y:void 0,desc:uu(b,N,y,e.outside===!0,s)}},[N,e.y,b,w,j,B,s,Gn,e.outside]),Na=(0,re.useMemo)(()=>{if(!b.series.length)return[];let p=[...O][0]??0,y=(S,T,D)=>{let U=S||Tt?.unnamed;return`${U?`${U} `:""}${Hr(L[T][D])}${Tt?.range(T,D)??""}`};return Gt(b.keys.length,S=>{let T=L[p]?.[S];return{datum:b.rows[p]?.[S]??null,index:S,key:b.keys[S],label:b.labels[S],value:Number.isFinite(T)?T:null,formatted:b.series.map((D,U)=>Number.isFinite(L[U][S])?y(D,U,S):null).filter(Boolean).join(", ")}})},[b,L,O,Hr,Tt]),jr=(p,y)=>{let S=d.keys.indexOf(p);return S<0?y:S},{brush:rt,frame:Ra,hint:Fa,text:Gr}=ji(e,f,{p:o,active:r.active,lang:r.lang,count:b.keys.length,indexAt:p=>yn(nt,p),inPlot:(p,y)=>p>=Ne-4&&p<=ge+4&&y>=je&&y<=a-Je,toXRange:p=>{let y=b.keys[p.from],S=b.keys[p.to];return{from:jr(y,p.from),to:jr(S,p.to),fromKey:y,toKey:S,fromLabel:b.labels[p.from],toLabel:b.labels[p.to]}}}),ue=r.active;so(r,e.syncId,b.keys,b.labels);let Vr=null;if(ue!==null&&b.keys[ue]!==void 0&&!rt.dragging){let p=h==="percent"?Ft(L.map(T=>[T[ue]]),"expand"):null,y=b.series.map((T,D)=>({s:T,si:D,v:L[D][ue]})).filter(T=>Number.isFinite(T.v)).sort((T,D)=>D.v-T.v).map(T=>{let D=Tt?.range(T.si,ue),U=p?`${Math.round(p.y1[T.si][0]-p.y0[T.si][0])}% · ${r.fv(T.v)}`:r.fv(T.v);return{label:T.s||Tt?.unnamed||r.t.value,value:D?(0,A.jsxs)(A.Fragment,{children:[U,(0,A.jsx)("span",{style:{fontWeight:500,color:o.paint("muted")},children:D})]}):U,color:Ir(T.si,T.v),strong:O.has(T.si)}}),S=Math.min(...b.series.map((T,D)=>E?ee(E.y1[D][ue]):Number.isFinite(b.values[D][ue])?ee(b.values[D][ue]):a));Vr={x:Me(ue),y:Math.max(je,S),title:b.labels[ue],rows:Do(y,r.t.more)}}let Pa=p=>{if(!b.keys.length)return;let y=yn(nt,p);y>=0&&y!==r.active&&r.setActive(y,"pointer")},Wr=null,Kr;if(rt.range&&rt.range.to<b.keys.length){let{from:p,to:y}=rt.range,S=[...O][0]??0,T=b.values[S]??[],D=NaN,U=NaN,oe=-1,ce=-1;for(let ye=p;ye<=y;ye++){let G=T[ye];Number.isFinite(G)&&(Number.isFinite(D)||(D=G),U=G,(oe<0||G>T[oe])&&(oe=ye),(ce<0||G<T[ce])&&(ce=ye))}let Re=Gi(D,U),qe=Re!==null?Vi(Re,r.locale):Number.isFinite(U-D)?`${U-D>=0?"+":""}${r.fv(U-D)}`:"-",ot=Gr.range(b.labels[p],b.labels[y]),Te=ye=>ee(E?E.y1[S][ye]:T[ye]),it=a-Je;Wr=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Wi,{p:o,x0:nt[p],x1:nt[y],top:je,bottom:it,width:i,main:qe,sub:ot,dragging:rt.dragging}),oe>=0&&ce>=0&&oe!==ce?(0,A.jsx)(Ki,{p:o,lang:r.lang,width:i,top:je,bottom:it,max:{x:nt[oe],y:Te(oe),text:r.fv(T[oe])},min:{x:nt[ce],y:Te(ce),text:r.fv(T[ce])}}):null]}),rt.dragging||(Kr=`${s.span(ot,qe)}${oe>=0?Gr.extremes(r.fv(T[oe]),r.fv(T[ce])):""}.${Fa}`)}let _a=Lr?(()=>{let p=Hn.map(S=>{let T=Ta(S.s);if(T<0)return null;let D=ee(E?(E.y0[S.s][T]+E.y1[S.s][T])/2:b.values[S.s][T]);return{d:S,y:D}}).filter(S=>S!==null),y=ri(p.map(S=>S.y),14,je+4,a-Je-2);return p.map((S,T)=>({...S,ly:y[T]}))})():[],Da=r.motion.duration??1100,Ur=e.dots??"auto",La=Ur===!0||Ur==="auto"&&!t&&b.keys.length<=16,Xr=t?s.area:s.line,Ea=e.description??`${Xr}. ${s.desc(b.series.length,b.series.filter(Boolean).join(", ")||r.t.value,b.labels[0]??"",b.labels[b.labels.length-1]??"",b.keys.length)}.${Tt?.desc??""}${mi(e.annotations,r.lang,r.fv,Sa)}${c?s.logDropped(c):""}`,Vn=[],Yr=[];for(let p of Br.items){let y=p.data,S=p.v,T=y.xs.length,D=S[0],U=S.slice(1,1+T),oe=y.xs.map((z,J)=>[z,U[J]??U[U.length-1]??0]),ce=me&&y.hi,Re=y.spans,qe=Re.map(([z,J])=>pn(oe.slice(z,J),In)),ot=ce?Re.map(([z],J)=>`${qe[J]}V${W(ht)}H${W(y.xs[z])}Z`).join(""):"",Te=z=>Re.map(([J,Fe])=>bn(oe.slice(J,Fe),z.slice(J,Fe),In)).join(""),it=Bn?Re.filter(([z,J])=>J-z===1).map(([z])=>z):[],ye=(z,J)=>{let[Fe,Ze]=oe[z],Ge=ce&&Ze>ht?ft:y.sw.fill;return(0,A.jsx)("circle",{cx:Fe,cy:Ze,r:y.hi?3:2.2,fill:y.hi?Ge:o.paint("panel"),stroke:Ge,strokeWidth:y.hi?0:1.4,opacity:J},z)};if(y.band){let z=1+(t?2*T:T),J=y.band.top.length;Yr.push((0,A.jsx)("path",{d:Ji(y.band,S.slice(z,z+J),S.slice(z+J,z+2*J),In),fill:y.sw.fill,opacity:.16*D*(p.exiting?.4:1)},p.key))}let G=z=>y.out?.map(J=>{let[Fe,Ze]=oe[J];return(0,A.jsx)("circle",{cx:Fe,cy:Ze,r:3.6,fill:ce&&Ze>ht?ft:y.sw.fill,stroke:o.paint("panel"),strokeWidth:1.5,opacity:z(J)},`o${J}`)});if(t){let z=S.slice(1+T,1+2*T),J=y.xs.map((Pe,Z)=>[Pe,z[Z]??ee(Et)]),Fe=qe.join(""),Ze=ce?["up","dn"].map(Pe=>(0,A.jsx)("path",{d:ot,fill:Pe==="up"?y.sw.fill:ft,opacity:.5,clipPath:`url(#${l}${Pe})`},Pe)):(0,A.jsx)("path",{d:Te(J),fill:y.sw.fill,opacity:h==="none"?y.hi?.5:.28:1}),Ge=Pe=>(ce?["up","dn"]:[null]).map(Z=>(0,A.jsx)("path",{d:Fe,fill:"none",stroke:Z==="dn"?ft:h==="none"?y.sw.fill:o.paint("panel"),strokeWidth:h==="none"?y.hi?2.2:1.4:1.2,strokeLinejoin:"round",strokeDasharray:Pe?"5 4":void 0,opacity:Math.min(1,D*1.4),clipPath:Z?`url(#${l}${Z})`:void 0},Z??"s"));Vn.push((0,A.jsxs)("g",{opacity:p.exiting?.4:1,children:[Ze,Mt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("g",{clipPath:`url(#${l}pre)`,children:Ge(!1)}),(0,A.jsx)("g",{clipPath:`url(#${l}post)`,children:Ge(!0)})]}):Ge(!1),it.map(Pe=>ye(Pe,Math.min(1,D*1.4))),G(()=>Math.min(1,D*1.4))]},p.key))}else{let z=y.hi?2.6:1.7,J=D<.999,Fe=Z=>Math.max(0,Math.min(1,(D-(T>1?Z/(T-1):1))*8+(D>=.999?1:0))),Ze=J&&Re.length>1?Re.flatMap(([Z,Qe],Wn)=>Qe-Z>1?[[qe[Wn],Math.max(0,Math.min(1,(D*(T-1)-Z)/(Qe-1-Z)))]]:[]):[[qe.join(""),D]],Ge=Z=>(ce?["up","dn"]:[null]).flatMap(Qe=>Ze.map(([Wn,Oa],Ia)=>(0,A.jsx)("path",{d:Wn,fill:"none",stroke:Qe==="dn"?ft:y.sw.fill,strokeWidth:z,strokeLinejoin:"round",strokeLinecap:"round",pathLength:J?1:void 0,strokeDasharray:J?"1 1":Z?"5 4":void 0,strokeDashoffset:J?1-Oa:void 0,clipPath:Qe?`url(#${l}${Qe})`:void 0},`${Qe??"s"}${Ia}`))),Pe=e.area&&y.hi?ce?["up","dn"].map(Z=>(0,A.jsx)("path",{d:ot,fill:Z==="up"?y.sw.fill:ft,opacity:.16*D,clipPath:`url(#${l}${Z})`},Z)):(0,A.jsx)("path",{d:Te(oe.map(([Z])=>[Z,ee(Et)])),fill:`url(#${l}g)`,opacity:D}):null;Vn.push((0,A.jsxs)("g",{opacity:p.exiting?.4:1,children:[Pe,Mt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("g",{clipPath:`url(#${l}pre)`,children:Ge(!1)}),(0,A.jsx)("g",{clipPath:`url(#${l}post)`,children:Ge(!0)})]}):Ge(!1),(La?oe.map((Z,Qe)=>Qe):it).map(Z=>ye(Z,Fe(Z))),G(Fe)]},p.key))}}return(0,A.jsxs)(Lo,{c:r,kind:Xr,ariaLabel:e.ariaLabel,description:Ea,events:Na,tip:Vr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(p,y,S)=>{rt.move(p),S.pointerType==="touch"?r.setActive(yn(nt,p),"touch"):Pa(p)},...Ra,announce:Kr,defs:e.area||Mt!==null||me?(0,A.jsxs)(A.Fragment,{children:[e.area?(0,A.jsxs)("linearGradient",{id:`${l}g`,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,A.jsx)("stop",{offset:"0%",stopColor:o.paint("accent"),stopOpacity:.28}),(0,A.jsx)("stop",{offset:"100%",stopColor:o.paint("accent"),stopOpacity:0})]}):null,Mt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("clipPath",{id:`${l}pre`,children:(0,A.jsx)("rect",{x:-i,y:-a,width:i+Mt,height:a*3})}),(0,A.jsx)("clipPath",{id:`${l}post`,children:(0,A.jsx)("rect",{x:Mt,y:-a,width:i*2,height:a*3})})]}):null,me?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("clipPath",{id:`${l}up`,children:(0,A.jsx)("rect",{x:-i,y:-a,width:i*3,height:a+ht})}),(0,A.jsx)("clipPath",{id:`${l}dn`,children:(0,A.jsx)("rect",{x:-i,y:ht,width:i*3,height:a*2})})]}):null]}):null,children:[e.yLabel&&En?(0,A.jsx)(pe,{x:On,y:6,anchor:"start",size:10.5,fill:o.paint("muted"),children:e.yLabel}):null,(0,A.jsx)(fi,{p:o,ticks:Dr,y:ee,x0:On,x1:ge+4,fmt:_r,locale:r.locale,labels:En}),(0,A.jsx)(li,{list:e.annotations,g:zn}),me?(0,A.jsx)("line",{x1:Ne,x2:ge,y1:ht,y2:ht,stroke:o.paint("dim"),pointerEvents:"none"}):null,Ye?.map((p,y)=>(0,A.jsx)("line",{x1:Ne,x2:ge,y1:ee(p.y),y2:ee(p.y),stroke:o.paint("dim"),strokeDasharray:"3 3"},y)),(0,A.jsx)("rect",{x:Ne,y:je,width:Math.max(0,ge-Ne),height:Math.max(0,a-Je-je),fill:"transparent"}),Yr,Vn,(0,A.jsx)(ci,{list:e.annotations,g:zn}),ue!==null&&b.keys[ue]!==void 0?(0,A.jsx)(hi,{p:o,x:Me(ue),top:je,bottom:a-Je,dots:b.series.flatMap((p,y)=>{let S=E?E.y1[y][ue]:b.values[y][ue];return Number.isFinite(S)?[{k:y,y:ee(S),color:Ir(y,S),strong:O.has(y)}]:[]})}):null,Ye?.map((p,y)=>p.label?(0,A.jsxs)("g",{pointerEvents:"none",children:[(0,A.jsx)("rect",{x:ge-ie(p.label,10.5)-8,y:ee(p.y)-17,width:ie(p.label,10.5)+8,height:15,rx:5,fill:o.paint("panel"),opacity:.94}),(0,A.jsx)(pe,{x:ge-4,y:ee(p.y)-9.5,anchor:"end",size:10.5,fill:o.paint("muted"),children:p.label})]},`rl${y}`):null),_a.map(p=>(0,A.jsx)(pe,{x:ge+8,y:p.ly,size:11,weight:p.d.hi?800:500,fill:o.paint(p.d.hi?"ink":"muted"),opacity:Br.fade(Da*.75,300),children:Ue(p.d.name,Er-10,11,p.d.hi?800:500)},p.d.name)),Wr,e.showXAxis===!1?null:(0,A.jsx)(mu,{c:r,model:b,xs:Me,x0:Ne,x1:ge,y:a-Je+13,domain:$t,fixed:e.xTicks}),ue!==null&&b.keys[ue]!==void 0&&!rt.dragging?(0,A.jsx)(gi,{p:o,x:Me(ue),y:a-Je+13,label:b.labels[ue],width:i}):null]})}function Dn(e){return(0,A.jsx)(du,{...e,kind:"line"})}var fu=P(Q(),1);var Ar=P(V(),1);var oa=e=>e?"neutralStrong":"accent";var Nr=P(V(),1);function ia(e,t,n,r){if(typeof e!="function")return Be(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var hu=P(Q(),1);var Fr=P(V(),1),gu={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}, ${De(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},aa={en:gu,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}일 이동평균`}},Rr=["ink","muted","dim"];function sa(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Rr.length)}var pu=P(Q(),1);var da=P(V(),1),bu={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${De(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},yu={en:bu,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},la=(e,t)=>yu[e].other(t);function ua(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,qo(o.map(i=>i.value)))}}var ca=e=>Number.isFinite(e)&&e>0?e:0;function ma(e,t,n,r){return r==="emphasis"?bo(e,t,n):Le(e,t,n)}var xu=P(Q(),1);var pa=P(V(),1);function fa(e,t){return t===!1?e.map((n,r)=>r):Jo(e)}function ha(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return Be(e,t,t,r,"max")}function ga(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=de(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?de(e,"neutral"):tn(e,1-a/Math.max(1,o.length-1))),r}function ba(e){return!e||typeof e!="object"||Array.isArray(e)?[]:we(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ya(e,t){return It(e,t+1,new Set)}var ku=P(Q(),1);var ka=P(V(),1);var wu=26;var Td=wu*.62;function xa(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Si.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var tt=P(V(),1);function wa(e,t,n){let r=hn(e);return r?.type==="scatter"&&t?.size!==void 0&&!fn(n)?hn("bubble"):r}function $u(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 Mu(e,t,n,r=!1){let o=wa(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&fr.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),u=c=>c.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(d.includes(o.type)){let c=et(i.label,"label"),m=yt(i.value,"value"),h=o.type==="waffle",f=t.map((w,L)=>({r:w,label:c(w,L),value:h?m(w,L):ca(m(w,L))})),{kept:g,other:v}=h?{kept:f,other:null}:ua(f,a.other,(w,L)=>({r:{},label:la(te(n),w),value:L})),x=Be(s,g.map(w=>w.r),g.map(w=>w.label),g.map(w=>w.value),h?"first":"max"),$=v?[...g,v]:g,C=st(w=>h?Le(w,$.length,x):ma(w,$.length,x,a.colorMode)),b=h&&a.shape==="arc";return $.map((w,L)=>({label:w.label,color:C[L],...b&&{shape:"circle"}}))}if(o.type==="candlestick"){let c=sa(Array.isArray(a.ma)?a.ma:void 0,t.length),m=aa[te(n)];return[{label:m.up,color:a.upColor??"accent"},{label:m.down,color:a.downColor??"neutralStrong"},...c.map((h,f)=>({label:m.maLegend(h),color:Rr[f],shape:"line"}))]}if(o.type==="network"){let c=ba(a.groups);if(c.length<2)return[];let m=st(h=>ya(h,c.length));return c.map((h,f)=>({label:h,color:m[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let c=et(i.group,"group"),m=we(t.map((f,g)=>c(f,g)).filter(Boolean));if(m.length<2)return[];let h=st(f=>It(f,m.length,new Set));return m.map((f,g)=>({label:f,color:h[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||fn(a))return[];let c=et(i.series,"series"),m=we(t.map((g,v)=>c(g,v)));if(m.length<2)return[];let h=ia(s,t,m,c),f=st(g=>It(g,m.length,h));return u(m.map((g,v)=>({label:g,color:f[v],shape:"circle"})))}if(o.type==="timeline"){let c=typeof i.group!="string",m=c?i.status:i.group;if(typeof m!="string")return[];let h=Oi(t,m,c),f=st(g=>Le(g,h.length,xa(s,h)));return u(h.map((g,v)=>({label:g,color:f[v],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(i.y))c=i.y;else if(typeof i.series=="string"){let C=et(i.series,"series");c=we(t.map((b,w)=>C(b,w)))}let m=hr(o.type,i,a);if(m.length){let C=Be(s,c,c,c.map(()=>0),"none"),b=st(L=>Le(L,c.length,C)),w=c.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:c.map((L,E)=>({label:L,color:b[E]}));return[...u(w),...m.map((L,E)=>({label:L,color:oa(E),shape:"line"}))]}if(c.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?Yo(c.length,Array.isArray(a.negative)?a.negative.map(C=>c.indexOf(String(C))):[],typeof a.neutral=="string"?c.indexOf(a.neutral):-1):-1,g=f>=0?new Set([f]):Be(s,c,c,c.map(()=>0),"first");if(o.type==="radar")return u(c.map((C,b)=>({label:C,color:g.has(b)?"accent":"neutralStrong",shape:"square"})));let v=a.colorMode,x=C=>Le(C,c.length,g);if((o.type==="line"||o.type==="area")&&(x=C=>Sr(C,c.length,g,o.type==="area",v)),o.type==="stream"){let C=wt(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),b=fa(C.values,a.reorder),w=ha(s,C.series,C.values);x=L=>ga(L,b,w)}let $=st(x);return u(c.map((C,b)=>({label:C,color:$[b],...o.type==="line"&&{shape:"line"}})))}return[]}function Tu(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Bo.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Cu(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:u,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:i,highlight:a,syncId:s,title:l,description:u}}function va(e,t){let{spec:n}=e,r=wa(n.type,n.encoding,n.options),o=(0,Ut.useMemo)(()=>Ii(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=zo(n,e.locale),s=xe(a),l=te(s),u=Ai(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),d=Go(n),c=(0,Ut.useMemo)(()=>d?Li(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],f=h.join(""),[g,v]=(0,Ut.useState)(null);if(!r)return(0,tt.jsx)(mr,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??u.data,$=t[r.type],C={...n.options??{}},b={...$u(r,n.encoding),...C,...c?{tooltip:c}:{},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:a},w=n.card?.legend==="toggle"&&jo(r.type,n.encoding??{},C),L=g&&g.base===f?g.hidden:h;w&&(b.hidden=L);let E=N=>v(R=>{let M=R&&R.base===f?R.hidden:h;return{base:f,hidden:M.includes(N)?M.filter(F=>F!==N):[...M,N]}}),H=b.height??220,j=Tu(n,r.type),B=i&&!x.length&&(u.loading||u.error||u.empty)?(0,tt.jsx)(mr,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:H,locale:a}):j?(0,tt.jsx)(Ci,{chart:$,...Cu(r.type,j,b)}):(0,tt.jsx)($,{...b});if(n.card){let N=n.card,R=N.legend==="auto"||N.legend==="toggle"?Mu(n,x,s,w):N.legend,M=R?.length?w?(0,tt.jsx)(cr,{items:R,hidden:L,onToggle:E,locale:a}):R:void 0,F=N.download?(0,tt.jsx)(Di,{data:x,columns:Vo(n),filename:N.title??r.type,formats:Array.isArray(N.download)?N.download:void 0,locale:a}):void 0;B=(0,tt.jsx)(_o,{number:N.number,title:N.title??Io(r,l),subtitle:N.subtitle,legend:M,actions:F,source:N.source||void 0,note:N.note||void 0,accent:N.accent,takeaway:N.takeaway,level:N.level,sample:N.sample,replay:N.replay!==!1,className:e.className,locale:a,children:B})}let I=e.theme??n.theme;return I&&(B=(0,tt.jsx)(ln,{theme:I,children:B})),B}function Su({cfg:e,components:t}){let n=Pt();return va({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Ma(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,$a.hydrateRoot)(r,(0,Pr.createElement)(ln,{theme:o.theme,cssVars:!0},(0,Pr.createElement)(Su,{cfg:o,components:{[e]:t}})))}Ma("line",Dn);})();
27
+ `}function Vl(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Mr(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Ri=2,mt=16;function Fi(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Pi(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 _i(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+mt*2,a+mt*2],u=o.cloneNode(!0),d=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((f,g)=>{let v;for(let x of Array.from(f.attributes)){if(!Hl.test(x.value))continue;let $=(v??(v=getComputedStyle(f))).getPropertyValue(x.name);$&&d[g].setAttribute(x.name,Fi($,c))}}),u.removeAttribute("style");for(let[f,g]of Object.entries({viewBox:`${-mt} ${-mt} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(g));let m=Fi(getComputedStyle(r).backgroundColor,c),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(Pi("rect",{x:-mt,y:-mt,width:s,height:l,fill:m}),f),h&&u.insertBefore(Pi("image",{href:h.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:i,vh:a,bg:m,canvas:h}}function Wl(e,t){let n=_i(e,Ri,!1);if(!n)return;let r=Ri,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,mt*r,mt*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Mr(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Li(e){let t=Oe(e.theme),n=te(xe(e.locale))==="ko",r=Vl(e.filename),o=(i,a)=>{if(i==="csv")return Mr(new Blob([Gl(e.data,e.columns?.length?e.columns:jl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return Wl(a,r);let s=_i(a,1,!0);s&&Mr(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Tr.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:zl.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,Tr.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:a},i)})})}var Ei=P(V(),1);function Di(e,t=fe){let n=pt(void 0,t),r=e.split(`
28
+ `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?zt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,u=s.replace(So,(d,c)=>o(i,c.trim())??(l=!0,""));l||a.push(u)}return a.length?a.map((s,l)=>(0,Ei.jsx)("div",{children:s},l)):null}}function Oi(e,t,n=!1){let r=et(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=we(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Ii(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 xt(t.csv)}return null}var re=P(Q(),1);var vt=P(Q(),1);var ae=P(V(),1),Kl={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}`},Bi={en:Kl,ko:{zoomHint:" Enter를 누르면 확대해요.",pickHint:" Enter를 누르면 이 구간을 골라요.",high:"최고",low:"최저",resetLabel:"전체 보기(확대 풀기)",reset:"전체 보기",extremes:(e,t)=>`, 최고 ${e}, 최저 ${t}`,range:(e,t)=>`${e}~${t}`}},Xl=4;function Ul(e){let[t,n]=(0,vt.useState)(null),[r,o]=(0,vt.useState)(!1),i=(0,vt.useRef)(null),a=(0,vt.useRef)(null),s=()=>{i.current=null,a.current=null,o(!1),n(null)},l=(m,h,f)=>!e.enabled||e.count<2||f.pointerType==="touch"||f.button!==0||!e.inPlot(m,h)?!1:(i.current={i:e.indexAt(m),x:m,moved:!1},f.currentTarget.setPointerCapture?.(f.pointerId),!0),u=m=>{let h=i.current;if(!h)return!1;if(!h.moved&&Math.abs(m-h.x)<Xl)return!0;h.moved=!0;let f=e.indexAt(m),g=Math.min(h.i,f),v=Math.max(h.i,f);return o(!0),n(x=>x?.from===g&&x.to===v?x:{from:g,to:v}),!0},d=(m,h,f)=>{let g=i.current;if(i.current=null,f.currentTarget.hasPointerCapture?.(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId),!g)return;if(o(!1),!g.moved||f.type==="pointercancel"){t&&(n(null),e.onCommit(null));return}let v=e.indexAt(m),x={from:Math.min(g.i,v),to:Math.max(g.i,v)},$=x.to>x.from;n($&&e.keep!==!1?x:null),e.onCommit($?x:null)},c=(m,h)=>{if(!e.enabled)return!1;if(m.key==="Escape"&&t)return s(),e.onCommit(null),!0;if(m.key==="Enter"&&t&&a.current!==null)return a.current=null,e.keep===!1&&n(null),e.onCommit(t),!0;if(!m.shiftKey||m.key!=="ArrowLeft"&&m.key!=="ArrowRight"||e.count<2)return!1;let f=m.key==="ArrowRight"?1:-1,g=a.current??h??(f>0?0:e.count-1),v=t&&a.current!==null?t.from===g?t.to:t.from:g,x=Math.max(0,Math.min(e.count-1,v+f));return a.current=g,n(x===g?null:{from:Math.min(g,x),to:Math.max(g,x)}),!0};return{range:t,dragging:r,keyboard:t!==null&&a.current!==null,down:l,move:u,up:d,key:c}}function Hi(e){let[t,n]=(0,vt.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 ji(e,t,n){let r=Bi[n.lang],o=e.brush==="zoom"?"zoom":e.brush?"select":null,i=Ul({enabled:o!==null,count:n.count,indexAt:n.indexAt,inPlot:n.inPlot,keep:o!=="zoom",onCommit:l=>{let u=l?n.toXRange(l):null;e.onBrush?.(u),o==="zoom"&&u&&u.to>u.from&&t.zoomTo([u.from,u.to])}}),a={onPointerDown:o?i.down:void 0,onPointerUp:o?i.up:void 0,onKey:o?l=>l.key==="Escape"&&t.view&&!i.range?(t.reset(),!0):i.key(l,n.active):void 0,overlay:t.view?(0,ae.jsx)(Yl,{p:n.p,onReset:t.reset,text:r}):null},s=i.keyboard?o==="zoom"?r.zoomHint:r.pickHint:"";return{brush:i,frame:a,hint:s,text:r}}function Gi(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e===0?null:(t-e)/Math.abs(e)}function Vi(e,t=fe){let n=Math.round(e*1e3)/10;return`${n>0?"+":""}${lt(n,{locale:t,maximumFractionDigits:1})}%`}function Wi(e){let{p:t,top:n,bottom:r}=e,o=Math.min(e.x0,e.x1),i=Math.max(e.x0,e.x1),a=ie(e.main,11.5,800),s=ie(e.sub,10.5,500)+6,l=a+s+16,u=Math.max(2,Math.min(e.width-l-2,(o+i)/2-l/2)),d=n+4;return(0,ae.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,ae.jsx)("rect",{x:o,y:n,width:Math.max(1,i-o),height:Math.max(0,r-n),fill:t.paint("accent"),opacity:e.dragging?.1:.14}),(0,ae.jsx)("line",{x1:o,x2:o,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,ae.jsx)("line",{x1:i,x2:i,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,ae.jsx)("rect",{x:u,y:d,width:l,height:22,rx:8,fill:t.paint("panel"),stroke:t.paint("line")}),(0,ae.jsx)(pe,{x:u+8,y:d+11,size:11.5,weight:800,fill:t.paint("ink"),children:e.main}),(0,ae.jsx)(pe,{x:u+8+a+6,y:d+11,size:10.5,weight:500,fill:t.paint("muted"),children:e.sub})]})}function Ki(e){let{p:t,width:n,top:r,bottom:o,max:i,min:a}=e,s=Bi[e.lang];return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(zi,{p:t,x:i.x,y:i.y,text:`${s.high} ${i.text}`,below:i.y-26<r+30,width:n}),(0,ae.jsx)(zi,{p:t,x:a.x,y:a.y,text:`${s.low} ${a.text}`,below:a.y+26<o,width:n})]})}function zi(e){let{p:t}=e,n=ie(e.text,10.5,700)+12,r=18,o=Math.max(2,Math.min(e.width-n-2,e.x-n/2)),i=e.below?e.y+8:e.y-r-8;return(0,ae.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,ae.jsx)("circle",{cx:e.x,cy:e.y,r:3.5,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:2}),(0,ae.jsx)("rect",{x:o,y:i,width:n,height:r,rx:9,fill:t.paint("ink")}),(0,ae.jsx)(pe,{x:o+n/2,y:i+r/2,anchor:"middle",size:10.5,weight:700,fill:t.paint("onInk"),children:e.text})]})}function Yl(e){let{p:t}=e;return(0,ae.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 Jl=e=>Array.isArray(e);function Rn(e,t,n){let r=Jl(e)?e:[e];return n?t<r.length?r[t]:null:r[0]}function Ui(e,t,n,r,o,i){let a=typeof t=="function"||typeof n=="function"?new Map(o.map((s,l)=>[s,l])):null;return e.map((s,l)=>{let u=new Array(s.length).fill(NaN),d=new Array(s.length).fill(NaN),c=Rn(t,l,r),m=Rn(n,l,r);if(c===null||m===null)return{lo:u,hi:d};let h=yt(c,""),f=yt(m,"");for(let g=Math.max(0,i);g<s.length;g++){let v=s[g];if(v===null)continue;let x=a?.get(v)??-1,$=h(v,x),S=f(v,x);!Number.isFinite($)||!Number.isFinite(S)||(u[g]=Math.min($,S),d[g]=Math.max($,S))}return{lo:u,hi:d}})}var Sr=(e,t,n)=>Number.isFinite(e)&&Number.isFinite(t)&&(e<t||e>n);function Zl(e,t){let n=[],r=-1;for(let o=0;o<=e.length;o++){let i=o<e.length&&Number.isFinite(e[o])&&Number.isFinite(t[o]);i&&r<0?r=o:!i&&r>=0&&(o-1>r&&n.push([r,o-1]),r=-1)}return n}function ql(e,t,n,r,o,i,a){let s=t(i),l=t(a);if(!(l>=s))return;let u=Math.floor(s),d=Math.floor(l)-u+1,c=new Array(d).fill(1/0),m=new Array(d).fill(-1/0),h=0;for(let f=i;f<a;f++){let g=Math.min(n[f],n[f+1]),v=Math.max(r[f],r[f+1]),x=Math.floor(t(f+1))-u;for(let $=h;$<=x;$++)g<c[$]&&(c[$]=g),v>m[$]&&(m[$]=v);h=x}for(let f=0;f<d;f++){let g=Math.max(s,u+f),v=Math.min(l,u+f+1);v<=g&&f>0||(e.xl.push(g),e.xr.push(v),e.top.push(o(m[f])),e.bottom.push(o(c[f])))}}function Yi(e,t,n,r,o){let i=Zl(t,n);if(!i.length)return null;let a=i.reduce((u,[d,c])=>u+c-d+1,0),s={runs:[],xl:[],xr:[],top:[],bottom:[]},l=a>o;for(let[u,d]of i)if(s.runs.push(s.top.length),l)ql(s,e,t,n,r,u,d);else for(let c=u;c<=d;c++)s.xl.push(e(c)),s.top.push(r(n[c])),s.bottom.push(r(t[c]));return s.runs.push(s.top.length),s}function Ql(e,t,n,r,o,i){let a=W(n[o]),s=`M${W(e[o])},${a}`;for(let l=o+1;l<i;l++){let u=W(n[l]);u!==a&&(s+=`H${W(e[l])}V${a=u}`)}a=W(r[i-1]),s+=`H${W(t[i-1])}V${a}`;for(let l=i-2;l>=o;l--){let u=W(r[l]);u!==a&&(s+=`H${W(t[l])}V${a=u}`)}return`${s}H${W(e[o])}Z`}var Xi=(e,t,n,r)=>e.slice(n,r).map((o,i)=>[o,t[n+i]]);function Ji(e,t,n,r){let o="";for(let i=0;i+1<e.runs.length;i++){let a=e.runs[i],s=e.runs[i+1];s-a<1||(o+=e.xr.length?Ql(e.xl,e.xr,t,n,a,s):bn(Xi(e.xl,t,a,s),Xi(e.xl,n,a,s),r))}return o}var se=P(Q(),1);function Zi(e,t){let n=Oe(e.theme),[r,o,i]=An(e.width),a=Pt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,d=Nn(e.reducedMotion??"auto"),c=e.animate!==!1&&!d&&_e,m=Ti(r,e.animateOnView!==!1&&c),h=xe(e.locale),f=te(h),g=(0,se.useMemo)(()=>pt(e.format,h,t.format),[e.format,h,t.format]),v=(0,se.useCallback)(U=>nn(U,{locale:h}),[h]),x=(0,se.useMemo)(()=>rn(g,e.unit),[g,e.unit]),$=(0,se.useMemo)(()=>gn(e.data),[e.data]),[S,b]=(0,se.useState)(null),[w,D]=(0,se.useState)(null),E=(0,se.useRef)([]),H=(0,se.useRef)(e.onHover);H.current=e.onHover;let j=(0,se.useRef)(e.onClick);j.current=e.onClick;let B=(0,se.useRef)(null),I=(0,se.useRef)(null),N=(0,se.useRef)(null),R=(0,se.useCallback)((U,me="pointer")=>{if(N.current!==U){N.current=U;let $e=U===null?null:E.current[U]??null;queueMicrotask(()=>H.current?.($e)),I.current?.(U)}B.current=U===null?null:me,b(U),D(B.current)},[]),M=(0,se.useCallback)(U=>{B.current!=="keyboard"&&(B.current=U===null?null:"sync",b(U),D(B.current))},[]),F=(0,se.useCallback)(U=>{let me=E.current[U];me&&j.current?.(me)},[]),O=Po(e.replayKey),K=e.width!==void 0||(i??0)>0,le={enabled:c,active:m.visible&&K,near:m.near,replayKey:O,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Ye=(0,se.useCallback)((U,me=1)=>S===null||S===U?me:me*.38,[S]);return{p:n,width:s,height:u,measured:K,responsive:e.width===void 0,pending:_e&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:le,fv:x,fmt:g,pct:v,locale:h,lang:f,t:f==="ko"?uo:lo,active:S,via:w,setActive:R,click:F,events:E,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Ye,sig:$,description:e.description,reduced:d,publish:I,applySync:M}}var ne=P(Q(),1);function eu(e){return 1-Math.pow(1-e,3)}function tu(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function nu(e){return e==="easeInOut"?tu:e==="linear"?t=>t:eu}function ru(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 Lt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function Fn(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 qi(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 Qi(e,t,n,r){if(!t||!n||t.length!==n.length)return Lt(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Lt(s,n[a]))o.push(l)}return o.length===r?o:Lt(e,r)}var Pn=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||!Fn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),qi(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Fn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let u=a.to.length;s.from=Qi(s.cur,s.parts,a.parts,u),s.vel=Qi(s.curVel,s.parts,a.parts,u),s.parts=a.parts,s.to=a.to.slice(),qi(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=Fn(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let u=this.make(a,a.enter??a.from??a.to,n+l,0);u.done=Fn(u.from,u.to),this.tracks.set(a.key,u)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Lt(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=nu(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,u=s.to.length;if(s.from.length!==u&&(s.from=Lt(s.from,u)),s.vel.length!==u&&(s.vel=Lt(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let d;if(this.easing==="spring"){let c=Math.exp(-i*l),m=i*l>=8&&i*l<20,h=0;for(let f=0;f<u;f++){let g=s.from[f]-s.to[f],v=s.vel[f]+i*g;s.cur[f]=s.to[f]+(g+v*l)*c,s.curVel[f]=(s.vel[f]-i*v*l)*c,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}d=i*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+i*l)*c)}else{let c=Math.min(1,l/o),m=r(c),h=ru(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*m,s.curVel[f]=(s.to[f]-s.from[f])*h;d=c>=1,s.progress=m}if(d){for(let c=0;c<u;c++)s.cur[c]=s.to[c],s.curVel[c]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Kt=new Set,_n=0;function ea(e){_n=0;let t=Array.from(Kt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Kt.delete(n)}Kt.size&&typeof requestAnimationFrame<"u"&&(_n=requestAnimationFrame(ea))}function ta(e){return Kt.add(e),!_n&&typeof requestAnimationFrame<"u"&&(_n=requestAnimationFrame(ea)),()=>{Kt.delete(e)}}function ou(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 na(e,t){let n=(0,ne.useMemo)(()=>ou(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:u=900,stagger:d=0}=t,c=(0,ne.useRef)(null),m=(0,ne.useRef)("init"),h=(0,ne.useRef)(null),f=(0,ne.useRef)(s),g=(0,ne.useRef)(a),v=(0,ne.useRef)(!1),x=(0,ne.useRef)(0),[,$]=(0,ne.useState)(0),S=(0,ne.useRef)(null),b=(0,ne.useRef)(!0);c.current||(c.current=new Pn,c.current.configure(l,u),c.current.snap(n),h.current=n);let w=c.current;if(w.configure(l,u),h.current!==n){let I=m.current,N=!Object.is(f.current,s);w.sameTargets(n)?w.refreshData(n):!r||I==="init"?w.snap(n):I==="idle"?w.hold(n):I==="running"||N?w.update(n,qt(),d):w.snap(n),h.current=n,f.current=s}let D=(0,ne.useRef)(()=>!1);D.current=I=>{if(!b.current)return!1;let N=w.step(I);return!N&&m.current==="running"&&(m.current="done"),$(R=>(R+1)%1e9),N||(S.current=null),N};let E=(0,ne.useCallback)(()=>{if(!_e||S.current||!w.animating)return;let I=N=>D.current(N);S.current=ta(I)},[w]);Ve(()=>{let I=!Object.is(g.current,a);if(g.current=a,!r){(m.current!=="done"||w.animating)&&(w.snap(h.current??n),m.current="done",$(N=>N+1));return}m.current==="init"||I&&i?(w.hold(h.current??n),m.current="idle",v.current=!1,$(N=>N+1)):I&&(v.current=!0)},[r,a]),Ve(()=>{!r||!i||!v.current||(v.current=!1,w.hold(h.current??n),m.current="idle",$(I=>I+1))},[i,r]),(0,ne.useEffect)(()=>{r&&o&&m.current==="idle"&&(w.start(qt()),x.current+=1,m.current="running",E(),$(I=>I+1))},[r,o,a,w,E]),(0,ne.useEffect)(()=>{w.animating&&E()}),(0,ne.useEffect)(()=>(b.current=!0,()=>{b.current=!1,S.current?.(),S.current=null}),[]);let H=qt(),j=w.elapsed(H),B=r&&m.current==="idle";return{items:w.items(),get:I=>w.get(I),elapsed:B?0:j,fade:(I,N=320)=>B?0:Number.isFinite(j)?Math.max(0,Math.min(1,(j-I)/N)):1,waiting:B,animating:w.animating,generation:x.current}}var A=P(V(),1),iu={line:"Line chart",area:"Area chart",span:(e,t)=>`${e}: ${t}`,desc:(e,t,n,r,o)=>`${Le(e,"series","series")} (${t}), x from ${n} to ${r}, ${Le(o,"point")}`,lower:"low",upper:"high",band:e=>` Range ${e}.`,range:(e,t)=>`${e} to ${t}`,outside:(e,t)=>e?` ${Le(e,"point")} outside the range: ${t}.`:" No points outside the range.",where:(e,t)=>`${e} (${t})`,logDropped:e=>` ${Le(e,"value")} at or below 0 ${e===1?"is":"are"} not shown on the log scale.`},au={en:iu,ko:{line:"라인 차트",area:"영역 차트",span:(e,t)=>`${e} 구간 ${t}`,desc:(e,t,n,r,o)=>`계열 ${e}개(${t}), x ${n}부터 ${r}까지 ${o}개 지점`,lower:"하한",upper:"상한",band:e=>` 범위 ${e}.`,range:(e,t)=>`${e}~${t}`,outside:(e,t)=>e?` 범위 밖 ${e}개 지점: ${t}.`:" 범위 밖 지점 없음.",where:(e,t)=>`${e}(${t})`,logDropped:e=>` 로그 눈금이라 0 이하 값 ${e}개는 뺐어요.`}};function su(e,t,n){let r=Math.max(0,Math.min(t,n)),o=Math.min(e.keys.length-1,Math.max(t,n)),i=e.keys.slice(r,o+1);return{type:e.type,keys:i,xnum:e.type==="band"?i.map((a,s)=>s):e.xnum.slice(r,o+1),labels:e.labels.slice(r,o+1),series:e.series,values:e.values.map(a=>a.slice(r,o+1)),rows:e.rows.map(a=>a.slice(r,o+1))}}function lu(e,t,n){if(t!=="forecast")return 0;let r=e.keys.length;if(n===void 0)return r;if(e.type==="band"){let a=e.keys.indexOf(String(n));return a<0?r:a}let o=Tn(e.type,n);if(!Number.isFinite(o))return r;let i=e.xnum.findIndex(a=>a>=o);return i<0?r:i}function uu(e,t,n,r,o){let i=(d,c)=>e.series.length>1&&e.series[d]?o.where(c,e.series[d]):c,a=we(t.flatMap((d,c)=>d.lo.some(Number.isFinite)?[i(c,o.range(...n[c]))]:[]));if(!a.length)return"";let s=o.band(a.join(", "));if(!r)return s;let l=0,u=[];return t.forEach((d,c)=>{for(let m=0;m<d.lo.length;m++)Sr(e.values[c][m],d.lo[m],d.hi[m])&&(l++,u.length<5&&u.push(i(c,e.labels[m])))}),s+o.outside(l,`${u.join(", ")}${l>u.length?", …":""}`)}function ra(e,t,n,r){let o=Rn(e,t,n);return typeof o=="string"&&o?o:r}function cu(e,t,n,r){let o=e.keys.length;if(e.type==="band"){let l=o>1?(n-t)/(o-1):0;return u=>o>1?t+u*l:(t+n)/2}let[i,a]=r??Ue(e.xnum),s=Ce([i,a===i?i+1:a],[t,n]);return Object.assign(l=>s(e.xnum[l]),{v:s})}function mu(e){let{c:t,model:n,xs:r,x0:o,x1:i,y:a,domain:s}=e,l=t.p,u;if(s&&n.type!=="band"&&e.fixed){let c=Ce(s[1]===s[0]?[s[0],s[0]+1]:[s[0],s[1]],[o,i]);u=e.fixed.map(m=>({x:c(m.value),label:m.label}))}else if(s&&n.type!=="band"){let[c,m]=s[1]===s[0]?[s[0],s[0]+1]:s,h=n.type==="date",f=Math.max(2,Math.floor((i-6)/(h?64:70))),g=c>=1e3&&m<=9999?String:Nt(void 0,t.locale,Math.max(-c,m)),v=h?jt(c,m,f,t.locale).map(S=>({v:S.t,label:S.label})):Ce([c,m],[0,1]).ticks(f).map(S=>({v:S,label:g(S)})),x=Ce([c,m],[6,i]),$=Ce([c,m],[o,i]);u=xr(v.map(S=>({...S,x:x(S.v)})),-6,t.width+2).map(S=>({x:$(S.v),label:S.label}))}else if(n.type==="date"&&n.keys.length>1){let c=n.xnum[0],m=n.xnum[n.xnum.length-1],h=Math.max(2,Math.floor((i-o)/64)),f=Ce([c,m],[o,i]),g=jt(c,m,h,t.locale);if(g.length>=2&&n.keys.length>g.length)u=g.map(v=>({x:f(v.t),label:v.label}));else{let v=n.keys.map((x,$)=>r($));u=kr(v,n.labels).map(x=>({x:v[x],label:n.labels[x]}))}}else if(n.type==="number"&&n.keys.length>12){let[c,m]=Ue(n.xnum),h=Ce([c,m],[o,i]),f=c>=1e3&&m<=9999?String:Nt(void 0,t.locale,Math.max(-c,m));u=h.ticks(Math.max(2,Math.floor((i-o)/70))).map(g=>({x:h(g),label:f(g)}))}else{let c=n.keys.map((m,h)=>r(h));u=kr(c,n.labels).map(m=>({x:c[m],label:n.labels[m]}))}let d=s&&n.type!=="band"?u:xr(u,-2,t.width+2);return(0,A.jsx)("g",{"aria-hidden":"true",children:d.map((c,m)=>(0,A.jsx)(pe,{x:c.x,y:a,anchor:"middle",size:Ie,fill:l.paint("muted"),children:c.label},m))})}function Cr(e,t,n,r,o){if(r)return o==="categorical"?De(e,t,n):yo(e,t,n);if(o==="categorical")return De(e,t,n);let i=de(e,"strong"),a=de(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}function du(e){let t=e.kind==="area",n=!t&&e.yScale==="log",r=Zi(e,{height:p=>Math.max(200,Math.min(300,p*.5)),duration:1100,stagger:120}),{p:o,width:i,height:a}=r,s=au[r.lang],l=(0,re.useId)().replace(/:/g,""),u=(0,re.useMemo)(()=>wt(e.data,e.x,e.y,e.series,{xType:e.xType,locale:r.locale,aggregate:e.aggregate,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,e.xType,r.locale,e.aggregate,e.dayFirst]),[d,c]=(0,re.useMemo)(()=>{if(!n)return[u,0];let p=0,y=u.values.map(C=>C.map(T=>T<=0?(p++,Number.NaN):T));return p?[{...u,values:y},p]:[u,0]},[u,n]),m=d.series.length,h=t?e.stack??(m>1?"stacked":"none"):"none",f=Hi(r.sig),g=f.view,v=(0,re.useMemo)(()=>g?su(d,g[0],g[1]):d,[d,g]),x=Math.max(40,Math.round(e.maxPoints??i/2)),$=(0,re.useMemo)(()=>h!=="none"?yi(v,x):v,[v,h,x]),S=e.hidden?.join("")??"",[b,w]=(0,re.useMemo)(()=>bi($,S),[$,S]),D=b.rowValues??b.values,E=(0,re.useMemo)(()=>h==="none"?null:Ft(b.values,h==="percent"?"expand":"zero"),[b,h]),H=oi(e.annotations),{lower:j,upper:B}=e,I=lu(b,e.bandFrom,H),N=(0,re.useMemo)(()=>{if(j===void 0||B===void 0||h!=="none")return null;let p=Ui($.rows,j,B,Array.isArray(e.y),e.data,I),y=b===$?p:w.map(C=>p[C]);if(n)for(let C of y)C.lo.forEach((T,L)=>{T>0&&C.hi[L]>0||(C.lo[L]=C.hi[L]=Number.NaN)});return y.some(C=>C.lo.some(Number.isFinite))?y:null},[$,b,w,j,B,e.y,e.data,h,I,n]),R=(0,re.useMemo)(()=>{let p=[];return N?.forEach(y=>y.lo.forEach((C,T)=>Number.isFinite(C)&&p.push(C,y.hi[T]))),p.length?Ue(p):p},[N]),M=(0,re.useMemo)(()=>{let p=$.values.map(y=>y.reduce((C,T)=>C+(Number.isFinite(T)?T:0),0));return Be(e.highlight,$.series,$.series,p,"first")},[$,e.highlight]),F=(0,re.useMemo)(()=>Cr(o,m,M,t,e.colorMode),[t,e.colorMode,o,m,M]),O=(0,re.useMemo)(()=>b===$?M:new Set(w.flatMap((p,y)=>M.has(p)?[y]:[])),[b,$,M,w]),K=(0,re.useMemo)(()=>b===$?F:w.map(p=>F[p]),[b,$,F,w]),le=[];E?E.y1.forEach(p=>p.forEach(y=>le.push(y))):b.values.forEach(p=>p.forEach(y=>Number.isFinite(y)&&le.push(y))),le.push(...R);let Ye=e.referenceLines?.filter(p=>typeof p?.y=="number"&&Number.isFinite(p.y)&&(!n||p.y>0));Ye?.forEach(p=>le.push(p.y)),le.push(...kn(e.annotations).filter(p=>!n||p>0));let U=e.baseline??0,me=!!e.signColors&&h==="none"&&(!n||U>0);me&&le.push(U);let[$e,He]=Ue(le),Ut=e.yDomain&&(!n||e.yDomain[0]>0&&e.yDomain[1]>0)?e.yDomain:void 0,je=e.yLabel?22:10,Je=22,Dn=Math.max(2,Math.round(a/70)),dt=Ut??(n?Ht($e,He,Dn):h==="percent"?[0,100]:ct($e,He,Dn,{zero:e.zero??t})),_r=h==="percent"?p=>`${p}%`:Nt(e.format,r.locale,Math.max(Math.abs(dt[0]),Math.abs(dt[1]))),ee=(n?Mn:Ce)(dt,[a-Je,je]),Lr=ee.ticks(Dn),En=e.showYAxis!==!1,On=En?$n(Lr,_r,r.locale):0,Dr=e.endLabels??m>1,Ta=p=>{for(let y=b.keys.length-1;y>=0;y--)if(Number.isFinite(b.values[p][y]))return y;return-1},Er=Dr?Math.min(i*.28,Math.max(...$.series.map(p=>ie(p,11,700)),20)+14):10,Ne=On+6,ge=i-Er,$t=g?void 0:e.xDomain,Me=cu(b,Ne,ge,$t),nt=(0,re.useMemo)(()=>b.keys.map((p,y)=>Me(y)),[b,Ne,ge,$t?.[0],$t?.[1]]),Dt=e.maxPoints??Math.max(60,Math.round((ge-Ne)*2)),In=e.curve??"smooth",Et=Math.min(dt[1],Math.max(dt[0],0)),ft=o.color(e.downColor,"neutralStrong"),ht=ee(U),gt=Me.v,Or=p=>gt?Tn(b.type,p):b.keys.indexOf(String(p)),Sa=p=>{let y=Or(p);return gt?Number.isFinite(y)?gt(y):null:y<0?null:Me(y)},Yt=b.xnum.length-1,zn={p:o,lang:r.lang,xAt:Sa,y:ee,x0:Ne,x1:ge,top:je,bottom:a-Je,half:gt||Yt<1?0:(Me(1)-Me(0))/2,time:b.type==="date"&&gt&&Yt>0?{t0:b.xnum[0],t1:b.xnum[Yt],n:Yt+1,xt:gt}:void 0,points:()=>{let p=[...O][0]??0;return nt.map((y,C)=>({x:y,y:ee(E?E.y1[p][C]:b.values[p][C])}))}},Mt=wn(zn,H),Ca=p=>{let y=Or(p),C=gt?b.xnum.indexOf(y):y;return C>=0?b.labels[C]:String(p??"")},Ir=(p,y)=>me&&O.has(p)&&y<U?ft:K[p].fill,Bn=!e.connectNulls&&!E&&b.keys.length>1,Hn=(0,re.useMemo)(()=>b.series.map((p,y)=>{let C=G=>E?E.y1[y][G]:b.values[y][G],T=[];for(let G=0;G<b.keys.length;G++){if(!Number.isFinite(C(G)))continue;let z=T[T.length-1];z&&(!Bn||z[z.length-1]===G-1)?z.push(G):T.push([G])}let L=T.reduce((G,z)=>G+z.length,0);L>Dt&&(T=T.map(G=>Uo(G.map(z=>({x:Me(z),y:C(z),k:z})),T.length>1?Math.max(3,Math.round(Dt*G.length/L)):Dt).map(z=>z.k)));let X=T.flat(),oe=0,ce=T.map(G=>[oe,oe+=G.length]),Re=X.map(G=>ee(C(G))),Ze=E?X.map(G=>ee(E.y0[y][G])):t?X.map(()=>ee(Et)):void 0,ot={s:y,name:p,pts:Re,xs:X.map(G=>Me(G)),base:Ze,sw:K[y],hi:O.has(y),idx:X,spans:ce},Te=N?.[y],it=Te?Yi(Me,Te.lo,Te.hi,ee,Dt):null;if(!Te||!it)return ot;let ye=e.outside?X.flatMap((G,z)=>Sr(b.values[y][G],Te.lo[G],Te.hi[G])?[z]:[]):void 0;return{...ot,band:it,out:ye}}),[b,E,K,O,Ne,ge,$t?.[0],$t?.[1],a,dt[0],dt[1],Dt,t,N,e.outside,Bn,n]),jn=r.motion.stagger??120,zr=(0,re.useMemo)(()=>[...Hn].sort((p,y)=>Number(p.hi)-Number(y.hi)),[Hn]),Aa=(0,re.useMemo)(()=>zr.map((p,y)=>{let C=ee(Et),T=p.band?[...p.band.top,...p.band.bottom]:[],L=p.band?[p.band.top.length,p.band.bottom.length]:[];if(t){let X=p.base??p.pts.map(()=>C);return{key:`s:${p.name}`,to:[1,...p.pts,...X,...T],from:[0,...p.pts.map(()=>C),...X.map(()=>C),...T.map(()=>C)],delay:y*jn*.5,parts:[1,p.pts.length,X.length,...L],data:p}}return{key:`s:${p.name}`,to:[1,...p.pts,...T],from:[0,...p.pts,...T],enter:[0,...p.pts,...T],delay:y*jn,parts:[1,p.pts.length,...L],data:p}}),[zr,jn,t,a,Et]),Br=na(Aa,r.motion),Hr=r.fv,Gn=r.fmt,Tt=(0,re.useMemo)(()=>{if(!N)return null;let p=Array.isArray(e.y),y=b.series.map((T,L)=>[ra(j,w[L],p,s.lower),ra(B,w[L],p,s.upper)]);return{range:(T,L)=>Number.isFinite(N[T].lo[L])?` (${y[T][0]} ${Gn(N[T].lo[L])} ~ ${y[T][1]} ${Gn(N[T].hi[L])})`:"",unnamed:typeof e.y=="string"?e.y:void 0,desc:uu(b,N,y,e.outside===!0,s)}},[N,e.y,b,w,j,B,s,Gn,e.outside]),Na=(0,re.useMemo)(()=>{if(!b.series.length)return[];let p=[...O][0]??0,y=(C,T,L)=>{let X=C||Tt?.unnamed;return`${X?`${X} `:""}${Hr(D[T][L])}${Tt?.range(T,L)??""}`};return Gt(b.keys.length,C=>{let T=D[p]?.[C];return{datum:b.rows[p]?.[C]??null,index:C,key:b.keys[C],label:b.labels[C],value:Number.isFinite(T)?T:null,formatted:b.series.map((L,X)=>Number.isFinite(D[X][C])?y(L,X,C):null).filter(Boolean).join(", ")}})},[b,D,O,Hr,Tt]),jr=(p,y)=>{let C=d.keys.indexOf(p);return C<0?y:C},{brush:rt,frame:Ra,hint:Fa,text:Gr}=ji(e,f,{p:o,active:r.active,lang:r.lang,count:b.keys.length,indexAt:p=>yn(nt,p),inPlot:(p,y)=>p>=Ne-4&&p<=ge+4&&y>=je&&y<=a-Je,toXRange:p=>{let y=b.keys[p.from],C=b.keys[p.to];return{from:jr(y,p.from),to:jr(C,p.to),fromKey:y,toKey:C,fromLabel:b.labels[p.from],toLabel:b.labels[p.to]}}}),ue=r.active;so(r,e.syncId,b.keys,b.labels);let Vr=null;if(ue!==null&&b.keys[ue]!==void 0&&!rt.dragging){let p=h==="percent"?Ft(D.map(T=>[T[ue]]),"expand"):null,y=b.series.map((T,L)=>({s:T,si:L,v:D[L][ue]})).filter(T=>Number.isFinite(T.v)).sort((T,L)=>L.v-T.v).map(T=>{let L=Tt?.range(T.si,ue),X=p?`${Math.round(p.y1[T.si][0]-p.y0[T.si][0])}% · ${r.fv(T.v)}`:r.fv(T.v);return{label:T.s||Tt?.unnamed||r.t.value,value:L?(0,A.jsxs)(A.Fragment,{children:[X,(0,A.jsx)("span",{style:{fontWeight:500,color:o.paint("muted")},children:L})]}):X,color:Ir(T.si,T.v),strong:O.has(T.si)}}),C=Math.min(...b.series.map((T,L)=>E?ee(E.y1[L][ue]):Number.isFinite(b.values[L][ue])?ee(b.values[L][ue]):a));Vr={x:Me(ue),y:Math.max(je,C),title:b.labels[ue],rows:Lo(y,r.t.more)}}let Pa=p=>{if(!b.keys.length)return;let y=yn(nt,p);y>=0&&y!==r.active&&r.setActive(y,"pointer")},Wr=null,Kr;if(rt.range&&rt.range.to<b.keys.length){let{from:p,to:y}=rt.range,C=[...O][0]??0,T=b.values[C]??[],L=NaN,X=NaN,oe=-1,ce=-1;for(let ye=p;ye<=y;ye++){let G=T[ye];Number.isFinite(G)&&(Number.isFinite(L)||(L=G),X=G,(oe<0||G>T[oe])&&(oe=ye),(ce<0||G<T[ce])&&(ce=ye))}let Re=Gi(L,X),Ze=Re!==null?Vi(Re,r.locale):Number.isFinite(X-L)?`${X-L>=0?"+":""}${r.fv(X-L)}`:"-",ot=Gr.range(b.labels[p],b.labels[y]),Te=ye=>ee(E?E.y1[C][ye]:T[ye]),it=a-Je;Wr=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Wi,{p:o,x0:nt[p],x1:nt[y],top:je,bottom:it,width:i,main:Ze,sub:ot,dragging:rt.dragging}),oe>=0&&ce>=0&&oe!==ce?(0,A.jsx)(Ki,{p:o,lang:r.lang,width:i,top:je,bottom:it,max:{x:nt[oe],y:Te(oe),text:r.fv(T[oe])},min:{x:nt[ce],y:Te(ce),text:r.fv(T[ce])}}):null]}),rt.dragging||(Kr=`${s.span(ot,Ze)}${oe>=0?Gr.extremes(r.fv(T[oe]),r.fv(T[ce])):""}.${Fa}`)}let _a=Dr?(()=>{let p=Hn.map(C=>{let T=Ta(C.s);if(T<0)return null;let L=ee(E?(E.y0[C.s][T]+E.y1[C.s][T])/2:b.values[C.s][T]);return{d:C,y:L}}).filter(C=>C!==null),y=ri(p.map(C=>C.y),14,je+4,a-Je-2);return p.map((C,T)=>({...C,ly:y[T]}))})():[],La=r.motion.duration??1100,Xr=e.dots??"auto",Da=Xr===!0||Xr==="auto"&&!t&&b.keys.length<=16,Ur=t?s.area:s.line,Ea=e.description??`${Ur}. ${s.desc(b.series.length,b.series.filter(Boolean).join(", ")||r.t.value,b.labels[0]??"",b.labels[b.labels.length-1]??"",b.keys.length)}.${Tt?.desc??""}${mi(e.annotations,r.lang,r.fv,Ca)}${c?s.logDropped(c):""}`,Vn=[],Yr=[];for(let p of Br.items){let y=p.data,C=p.v,T=y.xs.length,L=C[0],X=C.slice(1,1+T),oe=y.xs.map((z,J)=>[z,X[J]??X[X.length-1]??0]),ce=me&&y.hi,Re=y.spans,Ze=Re.map(([z,J])=>pn(oe.slice(z,J),In)),ot=ce?Re.map(([z],J)=>`${Ze[J]}V${W(ht)}H${W(y.xs[z])}Z`).join(""):"",Te=z=>Re.map(([J,Fe])=>bn(oe.slice(J,Fe),z.slice(J,Fe),In)).join(""),it=Bn?Re.filter(([z,J])=>J-z===1).map(([z])=>z):[],ye=(z,J)=>{let[Fe,qe]=oe[z],Ge=ce&&qe>ht?ft:y.sw.fill;return(0,A.jsx)("circle",{cx:Fe,cy:qe,r:y.hi?3:2.2,fill:y.hi?Ge:o.paint("panel"),stroke:Ge,strokeWidth:y.hi?0:1.4,opacity:J},z)};if(y.band){let z=1+(t?2*T:T),J=y.band.top.length;Yr.push((0,A.jsx)("path",{d:Ji(y.band,C.slice(z,z+J),C.slice(z+J,z+2*J),In),fill:y.sw.fill,opacity:.16*L*(p.exiting?.4:1)},p.key))}let G=z=>y.out?.map(J=>{let[Fe,qe]=oe[J];return(0,A.jsx)("circle",{cx:Fe,cy:qe,r:3.6,fill:ce&&qe>ht?ft:y.sw.fill,stroke:o.paint("panel"),strokeWidth:1.5,opacity:z(J)},`o${J}`)});if(t){let z=C.slice(1+T,1+2*T),J=y.xs.map((Pe,q)=>[Pe,z[q]??ee(Et)]),Fe=Ze.join(""),qe=ce?["up","dn"].map(Pe=>(0,A.jsx)("path",{d:ot,fill:Pe==="up"?y.sw.fill:ft,opacity:.5,clipPath:`url(#${l}${Pe})`},Pe)):(0,A.jsx)("path",{d:Te(J),fill:y.sw.fill,opacity:h==="none"?y.hi?.5:.28:1}),Ge=Pe=>(ce?["up","dn"]:[null]).map(q=>(0,A.jsx)("path",{d:Fe,fill:"none",stroke:q==="dn"?ft:h==="none"?y.sw.fill:o.paint("panel"),strokeWidth:h==="none"?y.hi?2.2:1.4:1.2,strokeLinejoin:"round",strokeDasharray:Pe?"5 4":void 0,opacity:Math.min(1,L*1.4),clipPath:q?`url(#${l}${q})`:void 0},q??"s"));Vn.push((0,A.jsxs)("g",{opacity:p.exiting?.4:1,children:[qe,Mt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("g",{clipPath:`url(#${l}pre)`,children:Ge(!1)}),(0,A.jsx)("g",{clipPath:`url(#${l}post)`,children:Ge(!0)})]}):Ge(!1),it.map(Pe=>ye(Pe,Math.min(1,L*1.4))),G(()=>Math.min(1,L*1.4))]},p.key))}else{let z=y.hi?2.6:1.7,J=L<.999,Fe=q=>Math.max(0,Math.min(1,(L-(T>1?q/(T-1):1))*8+(L>=.999?1:0))),qe=J&&Re.length>1?Re.flatMap(([q,Qe],Wn)=>Qe-q>1?[[Ze[Wn],Math.max(0,Math.min(1,(L*(T-1)-q)/(Qe-1-q)))]]:[]):[[Ze.join(""),L]],Ge=q=>(ce?["up","dn"]:[null]).flatMap(Qe=>qe.map(([Wn,Oa],Ia)=>(0,A.jsx)("path",{d:Wn,fill:"none",stroke:Qe==="dn"?ft:y.sw.fill,strokeWidth:z,strokeLinejoin:"round",strokeLinecap:"round",pathLength:J?1:void 0,strokeDasharray:J?"1 1":q?"5 4":void 0,strokeDashoffset:J?1-Oa:void 0,clipPath:Qe?`url(#${l}${Qe})`:void 0},`${Qe??"s"}${Ia}`))),Pe=e.area&&y.hi?ce?["up","dn"].map(q=>(0,A.jsx)("path",{d:ot,fill:q==="up"?y.sw.fill:ft,opacity:.16*L,clipPath:`url(#${l}${q})`},q)):(0,A.jsx)("path",{d:Te(oe.map(([q])=>[q,ee(Et)])),fill:`url(#${l}g)`,opacity:L}):null;Vn.push((0,A.jsxs)("g",{opacity:p.exiting?.4:1,children:[Pe,Mt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("g",{clipPath:`url(#${l}pre)`,children:Ge(!1)}),(0,A.jsx)("g",{clipPath:`url(#${l}post)`,children:Ge(!0)})]}):Ge(!1),(Da?oe.map((q,Qe)=>Qe):it).map(q=>ye(q,Fe(q))),G(Fe)]},p.key))}}return(0,A.jsxs)(Do,{c:r,kind:Ur,ariaLabel:e.ariaLabel,description:Ea,events:Na,tip:Vr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(p,y,C)=>{rt.move(p),C.pointerType==="touch"?r.setActive(yn(nt,p),"touch"):Pa(p)},...Ra,announce:Kr,defs:e.area||Mt!==null||me?(0,A.jsxs)(A.Fragment,{children:[e.area?(0,A.jsxs)("linearGradient",{id:`${l}g`,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,A.jsx)("stop",{offset:"0%",stopColor:o.paint("accent"),stopOpacity:.28}),(0,A.jsx)("stop",{offset:"100%",stopColor:o.paint("accent"),stopOpacity:0})]}):null,Mt!==null?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("clipPath",{id:`${l}pre`,children:(0,A.jsx)("rect",{x:-i,y:-a,width:i+Mt,height:a*3})}),(0,A.jsx)("clipPath",{id:`${l}post`,children:(0,A.jsx)("rect",{x:Mt,y:-a,width:i*2,height:a*3})})]}):null,me?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("clipPath",{id:`${l}up`,children:(0,A.jsx)("rect",{x:-i,y:-a,width:i*3,height:a+ht})}),(0,A.jsx)("clipPath",{id:`${l}dn`,children:(0,A.jsx)("rect",{x:-i,y:ht,width:i*3,height:a*2})})]}):null]}):null,children:[e.yLabel&&En?(0,A.jsx)(pe,{x:On,y:6,anchor:"start",size:10.5,fill:o.paint("muted"),children:e.yLabel}):null,(0,A.jsx)(fi,{p:o,ticks:Lr,y:ee,x0:On,x1:ge+4,fmt:_r,locale:r.locale,labels:En}),(0,A.jsx)(li,{list:e.annotations,g:zn}),me?(0,A.jsx)("line",{x1:Ne,x2:ge,y1:ht,y2:ht,stroke:o.paint("dim"),pointerEvents:"none"}):null,Ye?.map((p,y)=>(0,A.jsx)("line",{x1:Ne,x2:ge,y1:ee(p.y),y2:ee(p.y),stroke:o.paint("dim"),strokeDasharray:"3 3"},y)),(0,A.jsx)("rect",{x:Ne,y:je,width:Math.max(0,ge-Ne),height:Math.max(0,a-Je-je),fill:"transparent"}),Yr,Vn,(0,A.jsx)(ci,{list:e.annotations,g:zn}),ue!==null&&b.keys[ue]!==void 0?(0,A.jsx)(hi,{p:o,x:Me(ue),top:je,bottom:a-Je,dots:b.series.flatMap((p,y)=>{let C=E?E.y1[y][ue]:b.values[y][ue];return Number.isFinite(C)?[{k:y,y:ee(C),color:Ir(y,C),strong:O.has(y)}]:[]})}):null,Ye?.map((p,y)=>p.label?(0,A.jsxs)("g",{pointerEvents:"none",children:[(0,A.jsx)("rect",{x:ge-ie(p.label,10.5)-8,y:ee(p.y)-17,width:ie(p.label,10.5)+8,height:15,rx:5,fill:o.paint("panel"),opacity:.94}),(0,A.jsx)(pe,{x:ge-4,y:ee(p.y)-9.5,anchor:"end",size:10.5,fill:o.paint("muted"),children:p.label})]},`rl${y}`):null),_a.map(p=>(0,A.jsx)(pe,{x:ge+8,y:p.ly,size:11,weight:p.d.hi?800:500,fill:o.paint(p.d.hi?"ink":"muted"),opacity:Br.fade(La*.75,300),children:Xe(p.d.name,Er-10,11,p.d.hi?800:500)},p.d.name)),Wr,e.showXAxis===!1?null:(0,A.jsx)(mu,{c:r,model:b,xs:Me,x0:Ne,x1:ge,y:a-Je+13,domain:$t,fixed:e.xTicks}),ue!==null&&b.keys[ue]!==void 0&&!rt.dragging?(0,A.jsx)(gi,{p:o,x:Me(ue),y:a-Je+13,label:b.labels[ue],width:i}):null]})}function Ln(e){return(0,A.jsx)(du,{...e,kind:"line"})}var fu=P(Q(),1);var Ar=P(V(),1);var oa=e=>e?"neutralStrong":"accent";var Nr=P(V(),1);function ia(e,t,n,r){if(typeof e!="function")return Be(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var hu=P(Q(),1);var Fr=P(V(),1),gu={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}, ${Le(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},aa={en:gu,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}일 이동평균`}},Rr=["ink","muted","dim"];function sa(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Rr.length)}var pu=P(Q(),1);var da=P(V(),1),bu={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Le(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},yu={en:bu,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},la=(e,t)=>yu[e].other(t);function ua(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,Zo(o.map(i=>i.value)))}}var ca=e=>Number.isFinite(e)&&e>0?e:0;function ma(e,t,n,r){return r==="emphasis"?bo(e,t,n):De(e,t,n)}var xu=P(Q(),1);var pa=P(V(),1);function fa(e,t){return t===!1?e.map((n,r)=>r):Jo(e)}function ha(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return Be(e,t,t,r,"max")}function ga(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=de(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?de(e,"neutral"):tn(e,1-a/Math.max(1,o.length-1))),r}function ba(e){return!e||typeof e!="object"||Array.isArray(e)?[]:we(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ya(e,t){return It(e,t+1,new Set)}var ku=P(Q(),1);var ka=P(V(),1);var wu=26;var Td=wu*.62;function xa(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Ci.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var tt=P(V(),1);function wa(e,t,n){let r=hn(e);return r?.type==="scatter"&&t?.size!==void 0&&!fn(n)?hn("bubble"):r}function $u(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 Mu(e,t,n,r=!1){let o=wa(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&fr.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),u=c=>c.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(d.includes(o.type)){let c=et(i.label,"label"),m=yt(i.value,"value"),h=o.type==="waffle",f=t.map((w,D)=>({r:w,label:c(w,D),value:h?m(w,D):ca(m(w,D))})),{kept:g,other:v}=h?{kept:f,other:null}:ua(f,a.other,(w,D)=>({r:{},label:la(te(n),w),value:D})),x=Be(s,g.map(w=>w.r),g.map(w=>w.label),g.map(w=>w.value),h?"first":"max"),$=v?[...g,v]:g,S=st(w=>h?De(w,$.length,x):ma(w,$.length,x,a.colorMode)),b=h&&a.shape==="arc";return $.map((w,D)=>({label:w.label,color:S[D],...b&&{shape:"circle"}}))}if(o.type==="candlestick"){let c=sa(Array.isArray(a.ma)?a.ma:void 0,t.length),m=aa[te(n)];return[{label:m.up,color:a.upColor??"accent"},{label:m.down,color:a.downColor??"neutralStrong"},...c.map((h,f)=>({label:m.maLegend(h),color:Rr[f],shape:"line"}))]}if(o.type==="network"){let c=ba(a.groups);if(c.length<2)return[];let m=st(h=>ya(h,c.length));return c.map((h,f)=>({label:h,color:m[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let c=et(i.group,"group"),m=we(t.map((f,g)=>c(f,g)).filter(Boolean));if(m.length<2)return[];let h=st(f=>It(f,m.length,new Set));return m.map((f,g)=>({label:f,color:h[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||fn(a))return[];let c=et(i.series,"series"),m=we(t.map((g,v)=>c(g,v)));if(m.length<2)return[];let h=ia(s,t,m,c),f=st(g=>It(g,m.length,h));return u(m.map((g,v)=>({label:g,color:f[v],shape:"circle"})))}if(o.type==="timeline"){let c=typeof i.group!="string",m=c?i.status:i.group;if(typeof m!="string")return[];let h=Oi(t,m,c),f=st(g=>De(g,h.length,xa(s,h)));return u(h.map((g,v)=>({label:g,color:f[v],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(i.y))c=i.y;else if(typeof i.series=="string"){let S=et(i.series,"series");c=we(t.map((b,w)=>S(b,w)))}let m=hr(o.type,i,a);if(m.length){let S=Be(s,c,c,c.map(()=>0),"none"),b=st(D=>De(D,c.length,S)),w=c.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:c.map((D,E)=>({label:D,color:b[E]}));return[...u(w),...m.map((D,E)=>({label:D,color:oa(E),shape:"line"}))]}if(c.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?Yo(c.length,Array.isArray(a.negative)?a.negative.map(S=>c.indexOf(String(S))):[],typeof a.neutral=="string"?c.indexOf(a.neutral):-1):-1,g=f>=0?new Set([f]):Be(s,c,c,c.map(()=>0),"first");if(o.type==="radar")return u(c.map((S,b)=>({label:S,color:g.has(b)?"accent":"neutralStrong",shape:"square"})));let v=a.colorMode,x=S=>De(S,c.length,g);if((o.type==="line"||o.type==="area")&&(x=S=>Cr(S,c.length,g,o.type==="area",v)),o.type==="stream"){let S=wt(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),b=fa(S.values,a.reorder),w=ha(s,S.series,S.values);x=D=>ga(D,b,w)}let $=st(x);return u(c.map((S,b)=>({label:S,color:$[b],...o.type==="line"&&{shape:"line"}})))}return[]}function Tu(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Bo.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Su(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:u,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:i,highlight:a,syncId:s,title:l,description:u}}function va(e,t){let{spec:n}=e,r=wa(n.type,n.encoding,n.options),o=(0,Xt.useMemo)(()=>Ii(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=zo(n,e.locale),s=xe(a),l=te(s),u=Ai(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),d=Go(n),c=(0,Xt.useMemo)(()=>d?Di(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],f=h.join(""),[g,v]=(0,Xt.useState)(null);if(!r)return(0,tt.jsx)(mr,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??u.data,$=t[r.type],S={...n.options??{}},b={...$u(r,n.encoding),...S,...c?{tooltip:c}:{},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:a},w=n.card?.legend==="toggle"&&jo(r.type,n.encoding??{},S),D=g&&g.base===f?g.hidden:h;w&&(b.hidden=D);let E=N=>v(R=>{let M=R&&R.base===f?R.hidden:h;return{base:f,hidden:M.includes(N)?M.filter(F=>F!==N):[...M,N]}}),H=b.height??220,j=Tu(n,r.type),B=i&&!x.length&&(u.loading||u.error||u.empty)?(0,tt.jsx)(mr,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:H,locale:a}):j?(0,tt.jsx)(Si,{chart:$,...Su(r.type,j,b)}):(0,tt.jsx)($,{...b});if(n.card){let N=n.card,R=N.legend==="auto"||N.legend==="toggle"?Mu(n,x,s,w):N.legend,M=R?.length?w?(0,tt.jsx)(cr,{items:R,hidden:D,onToggle:E,locale:a}):R:void 0,F=N.download?(0,tt.jsx)(Li,{data:x,columns:Vo(n),filename:N.title??r.type,formats:Array.isArray(N.download)?N.download:void 0,locale:a}):void 0;B=(0,tt.jsx)(_o,{number:N.number,title:N.title??Io(r,l),subtitle:N.subtitle,legend:M,actions:F,source:N.source||void 0,note:N.note||void 0,accent:N.accent,takeaway:N.takeaway,level:N.level,sample:N.sample,replay:N.replay!==!1,className:e.className,locale:a,children:B})}let I=e.theme??n.theme;return I&&(B=(0,tt.jsx)(ln,{theme:I,children:B})),B}function Cu({cfg:e,components:t}){let n=Pt();return va({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Ma(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,$a.hydrateRoot)(r,(0,Pr.createElement)(ln,{theme:o.theme,cssVars:!0},(0,Pr.createElement)(Cu,{cfg:o,components:{[e]:t}})))}Ma("line",Ln);})();