ztd-charts-cli 0.6.0 → 0.8.0

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