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 Vo=Object.create;var _n=Object.defineProperty;var jo=Object.getOwnPropertyDescriptor;var Wo=Object.getOwnPropertyNames;var Ko=Object.getPrototypeOf,Go=Object.prototype.hasOwnProperty;var Vt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Uo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wo(t))!Go.call(e,o)&&o!==n&&_n(e,o,{get:()=>t[o],enumerable:!(r=jo(t,o))||r.enumerable});return e};var D=(e,t,n)=>(n=e!=null?Vo(Ko(e)):{},Uo(t||!e||!e.__esModule?_n(n,"default",{value:e,enumerable:!0}):n,e));var ee=Vt((Ui,In)=>{In.exports=globalThis.__ztdReact.react});var Bn=Vt((Yi,On)=>{On.exports=globalThis.__ztdReact["react-dom/client"]});var G=Vt((is,cr)=>{cr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var $n=D(ee(),1),_o=D(Bn(),1);var nt=D(ee(),1);var xt=D(ee(),1);var zn=D(ee(),1),lt=(0,zn.createContext)(void 0);var qo=D(ee(),1);var Yo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Hn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Vn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Ae={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:Hn,monoFamily:Vn,radius:18,radiusCode:14,radiusMark:4},Xo={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:Hn,monoFamily:Vn,radius:18,radiusCode:14,radiusMark:4},jt={dark:Ae,light:Xo};function Wt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Kt(e){let t={};for(let n of Yo){let r=e[n];typeof r=="string"&&(t[Wt(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 Gt(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 Jo=`
1
+ (()=>{var ea=Object.create;var Mr=Object.defineProperty;var ta=Object.getOwnPropertyDescriptor;var na=Object.getOwnPropertyNames;var ra=Object.getPrototypeOf,oa=Object.prototype.hasOwnProperty;var An=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ia=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of na(t))!oa.call(e,o)&&o!==n&&Mr(e,o,{get:()=>t[o],enumerable:!(r=ta(t,o))||r.enumerable});return e};var P=(e,t,n)=>(n=e!=null?ea(ra(e)):{},ia(t||!e||!e.__esModule?Mr(n,"default",{value:e,enumerable:!0}):n,e));var ee=An((Nl,Cr)=>{Cr.exports=globalThis.__ztdReact.react});var Ar=An((Fl,Sr)=>{Sr.exports=globalThis.__ztdReact["react-dom/client"]});var W=An((Wl,to)=>{to.exports=globalThis.__ztdReact["react/jsx-runtime"]});var fr=P(ee(),1),Bi=P(Ar(),1);var Ft=P(ee(),1);var Qt=P(ee(),1);var Nr=P(ee(),1),it=(0,Nr.createContext)(void 0);var Pr=P(ee(),1);var aa=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Fr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Rr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Ge={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:Fr,monoFamily:Rr,radius:18,radiusCode:14,radiusMark:4},Nn={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:Fr,monoFamily:Rr,radius:18,radiusCode:14,radiusMark:4},Fn={dark:Ge,light:Nn};function zt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Rn(e){let t={};for(let n of aa){let r=e[n];typeof r=="string"&&(t[zt(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function _n(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var sa=`
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,${Ae.accent});outline-offset:3px;border-radius:6px}
4
+ .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Ge.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,${Ae.accent});outline-offset:2px}
12
+ .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Ge.accent});outline-offset:2px}
13
13
  .ztd-card{transition:border-color .16s ease}
14
- .ztd-card:hover{border-color:var(--ztd-dim,${Ae.dim})}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${Ge.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 jn=!1;function Xe(){if(jn||typeof document>"u"||(jn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Jo,document.head.appendChild(e)}var ut=D(ee(),1),we=typeof window<"u"&&typeof document<"u",pe=we?ut.useLayoutEffect:ut.useEffect;function ct(){return typeof performance<"u"?performance.now():Date.now()}var be=D(ee(),1),Zo=(0,be.createContext)(void 0),mt=new Map;function Qo(e,t){let n=mt.get(e);return n||mt.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||mt.delete(e)}}function ea(e,t,n){mt.get(e)?.forEach(r=>r(t,n))}function ta(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function Wn(e,t,n,r){let o=(0,be.useContext)(Zo),a=t??o,[i]=(0,be.useState)(()=>({})),s=(0,be.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=a?u=>ea(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,be.useEffect)(()=>{if(a)return Qo(a,(u,f)=>{if(f===i)return;let c=u?ta(s.current.keys,s.current.labels,u):-1;l(c<0?null:c)})},[a,i,l])}function Z(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Be(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Kn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Gn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var na=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ra={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function oa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function aa(e){return oa(na,e)}function Un(e,t){let n=aa(e);return{text:n?n[t]:e,...ra[n?.id??"basic"]}}var de=D(ee(),1);var Zn=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ce="en-US",Yn=new Map;function Ut(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Yn.get(r);return o||(o=new Intl.NumberFormat(e,n),Yn.set(r,o)),o}function Yt(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function ze(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ce,...r}=t;return Yt(Ut(n,r).format(e))}var Xt=e=>e!==0&&Math.abs(e)<.05,qt=(e,t,n="")=>`${ze(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function dt(e,t={}){if(!Number.isFinite(e))return"-";if(Xt(e)&&t.maximumFractionDigits===void 0)return qt(e,t.locale??ce,"%");let n=Math.abs(e);return`${ze(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Qn(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ce,...r}=t;if(Z(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],u=o/s,f=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**f)/10**f;if(i>0&&c>=a[i-1][0]/s){i--;continue}return(e<0&&c!==0?"-":"")+ze(c,{locale:n,...r,maximumFractionDigits:f})+l}}return Yt(Ut(n,{notation:"compact",...r}).format(e))}var ia=(e,t=Z(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function qe(e,t=ce,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Ut(t,o);return l=>Number.isFinite(l)?`${i}${Yt(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=>dt(o,{locale:t});case"ratio":return o=>dt(o*100,{locale:t});case"compact":return o=>Qn(o,{locale:t});case"currency":return r(ia(t));default:{let o=r({maximumFractionDigits:1});return a=>Xt(a)?qt(a,t):o(a)}}}function er(e,t=ce,n=0){return e!==void 0?qe(e,t):n>=1e5?r=>Xt(r)?qt(r,t):Qn(r,{locale:t}):r=>ze(r,{locale:t})}function sa(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Jt=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,la=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,ua=["january","february","march","april","may","june","july","august","september","october","november","december"],Xn=e=>{let t=e.toLowerCase();return t.length<3?0:ua.findIndex(n=>n.startsWith(t))+1},qn=e=>+e+(+e<30?2e3:1900);function tr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var ca=[/^(\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})일)?$/],nr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,rr=/\{([^{}]+)\}/g;function ft(e,t){let n;for(let r of ca)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?[qn(n[3]),+n[2],+n[1],1]:[qn(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=nr.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=Xn(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=Xn(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Zt=e=>la.test(e)||ft(e)!==null;function or(e){let t;for(let n of e){let r=typeof n=="string"?nr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Je(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(Jt(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Je(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=ft(n,t);if(r)return sa(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 Jn=new Map;function ar(e,t={month:"short",day:"numeric"}){let n=Je(e);if(!n)return"-";let{locale:r=ce,...o}=t,a=r+JSON.stringify(o),i=Jn.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Jn.set(a,i)),i.format(n)}var ir={white:"#ffffff",black:"#000000",transparent:"#00000000"};function He(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),ir[t.toLowerCase()]&&(t=ir[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 en(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 Ve(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function sr(e){return .2126*Ve(e[0])+.7152*Ve(e[1])+.0722*Ve(e[2])}function tn(e,t,n){let r=typeof e=="string"?He(e):e,o=typeof t=="string"?He(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?He(n):n:null;o[3]<1&&a&&(o=en(o,a));let i=r[3]<1?en(r,o):r,s=sr(i),l=sr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function ma(e){return[Ve(e[0]),Ve(e[1]),Ve(e[2])]}function Qt(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function lr(e){let[t,n,r]=ma(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 da([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Qt(4.0767416621*o-3.3077115913*a+.2309699292*i),Qt(-1.2684380046*o+2.6097574011*a-.3413193965*i),Qt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function ht(e,t,n){let r=He(e),o=He(t);if(!r||!o)return e;let a=lr(r),i=lr(o),s=Math.max(0,Math.min(1,n));return ur(da([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 nn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=tn(a,e,n);i>o&&(o=i,r=a)}return r}var rn=D(G(),1),gt=(0,de.createContext)({theme:Ae,cssVars:!0});function fa(e,t=Ae){return e?typeof e=="string"?jt[e]??t:Gt(t,e):t}function bt(e){let t=(0,de.useContext)(gt),n=e.base?jt[e.base]:t.theme,r=(0,de.useMemo)(()=>fa(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,de.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,de.useMemo)(()=>Kt(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,rn.jsx)(gt.Provider,{value:i,children:(0,rn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var ha=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function pt(e){return ha.has(e)}function ga(e,t){let n=r=>t?`var(${Wt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?pt(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?pt(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)})`:ht(e[r],e[o],a)}}}function ve(e){let t=(0,de.useContext)(gt);return(0,de.useMemo)(()=>{let n=Gt(t.theme,e);return ga(n,t.cssVars)},[t.theme,t.cssVars,e])}function fe(e){let t=(0,de.useContext)(gt);return e??t.locale??ce}function mr(e){return e?Kt(e):{}}var yt=D(ee(),1),on=(0,yt.createContext)(void 0);function dr(e){let t=(0,yt.useContext)(on);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var $=D(G(),1),pa={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`},ba={en:pa,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var ya={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},an=e=>ba[Z(fe(e))];function sn(e){let t=ve(e.theme),n=an(e.locale),[r,o]=(0,xt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(f=>!s.has(f.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((f,c)=>{let d=!s.has(f.label),g=d&&l===1,h=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xa,{p:t,item:f,off:!d}),(0,$.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:f.label})]});return(0,$.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,$.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":g||void 0,onClick:()=>{g||(i(f.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:g?"default":void 0},children:h}):h},c)})});return i?(0,$.jsxs)($.Fragment,{children:[u,(0,$.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:ya,children:r?n.shown(l,e.items.length):""})]}):u}function xa({p:e,item:t,off:n}){let r=t.color?pt(t.color)?e.paint(t.color):t.color:e.paint("neutral"),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 ka(e){let t=ve(e.theme),n=Un(e.level,Z(fe(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 wa(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 fr(e){let t=ve(e.theme),n=an(e.locale),[r,o]=(0,xt.useState)(0);pe(()=>Xe(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,$.jsx)(sn,{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,f=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)(ka,{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:wa(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,$.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,$.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||i?(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",{}),i]}):null]}),(0,$.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,$.jsx)(on.Provider,{value:r,children:(0,$.jsx)(lt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),f?(0,$.jsxs)($.Fragment,{children:[f,c]}):c]})}function ln(e){let t=ve(e.theme),n=an(e.locale),r=e.height??220;if(pe(()=>Xe(),[]),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,a)=>(0,$.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,$.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})}function Ce(e,t,n,r,o="max"){let a=new Set,i=n.length,s=u=>{if(i&&u!=="none"){if(u==="first")a.add(0);else if(u==="last")a.add(i-1);else if(u==="max"||u==="min"){let f=-1,c=u==="max"?-1/0:1/0;r.forEach((d,g)=>{Number.isFinite(d)&&(u==="max"?d>c:d<c)&&(c=d,f=g)}),f>=0&&a.add(f)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((u,f)=>{f<i&&u!==null&&u!==void 0&&e(u,f)&&a.add(f)}),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((f,c)=>{f===u&&a.add(c)});return a}function Ne(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function va(e,t){let n=nn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return tn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):nn(t,["#FFFFFF","#000000"])}function Ca(e,t){let n=ht(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:va(e,n),raw:n}}function hr(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Ne(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=Ne(e,"neutral");else if(s===0)r[i]=Ne(e,"ink");else if(s===a-1)r[i]=Ne(e,"neutral");else if(a===3)r[i]=Ne(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?Ne(e,"strong"):Ca(e,1-l)}}),r}function Ze(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 gr(e,t){return Ze(e+1,t).slice(0,e)}function pr(e,t,n,r="neutral"){let o=Ne(e,"accent"),a=Ne(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function br(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function $a(e,t){if(e==null||typeof e!="object")return;let n=e;if(br(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!br(r,o))return;r=r[o]}return r}}function $e(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 je(e,t){if(typeof e=="function")return e;let n=e??t;return r=>$a(r,n)}function yr(e,t){let n=je(e,t);return(r,o)=>$e(n(r,o))}function kt(e,t){let n=je(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 We(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var me=D(ee(),1);function Ma(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 Ta=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function xr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Ta.test(t)||/^[-+]?\.\d+$/.test(t)){let n=$e(t);if(Number.isFinite(n))return n}return t}function Ee(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Ma(o),i=[],s=[],l="",u=!1;for(let h=0;h<o.length;h++){let b=o[h];u?b==='"'?o[h+1]==='"'?(l+='"',h++):u=!1:l+=b:b==='"'&&!l.trim()?(u=!0,l=""):b===a?(s.push(l),l=""):b===`
24
- `||b==="\r"?(b==="\r"&&o[h+1]===`
25
- `&&h++,s.push(l),i.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),i.push(s));let f=i.filter(h=>!(h.length===1&&h[0].trim()===""));if(!f.length)return[];let c=h=>n?xr(h):h;if(!r)return f.map(h=>Object.fromEntries(h.map((b,S)=>[String(S),c(b)])));let d=[],g=new Set;return f[0].forEach((h,b)=>{let S=h.trim()||`col${b+1}`,M=S;for(let T=2;g.has(M);T++)M=`${S}_${T}`;g.add(M),d.push(M)}),f.slice(1).map(h=>Object.fromEntries(d.map((b,S)=>[b,c(h[S]??"")])))}function un(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"?xr(i[l]):i[l]??null])))}function Sa(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 kr(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 Re(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Re(JSON.parse(t))}catch{}return Ee(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?un(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)?Re(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?un(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)?Re(t.rows):Array.isArray(t.values)?un(t.values):Array.isArray(t.items)?Re(t.items):Array.isArray(t.results)?Re(t.results):Sa(t)}return[]}function wr(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}async function Aa(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(Z(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ee(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 Ee(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ee(a)}async function Na(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 Aa(a,t.parse,o,t.locale)}return t.select&&(r=kr(r,t.select)),t.transform?t.transform(r):Re(r)}function vr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,me.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,me.useState)(0),u=fe(t.locale),f=(0,me.useRef)(t);f.current={...t,locale:u};let c=(0,me.useRef)(e);c.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",g=t.deps??[],h=JSON.stringify(g.map(M=>typeof M=="object"?JSON.stringify(M):String(M))),b=(0,me.useRef)(!1);(0,me.useEffect)(()=>{let M=c.current;if(!M||!r){i(N=>N.status==="loading"?{...N,status:"idle"}:N);return}let T=new AbortController,I=!0;return b.current=!0,i(N=>({...N,data:o?N.data:[],status:"loading",error:null})),Na(M,{...f.current,signal:T.signal}).then(N=>{I&&i({data:N,status:"success",error:null,updatedAt:Date.now()})}).catch(N=>{!I||T.signal.aborted||i(A=>({...A,status:"error",error:N instanceof Error?N:new Error(String(N))}))}).finally(()=>{I&&(b.current=!1)}),()=>{I=!1,b.current=!1,T.abort()}},[d,r,s,h,o]),(0,me.useEffect)(()=>{if(!n||!r)return;let M=setInterval(()=>{b.current||l(T=>T+1)},n);return()=>clearInterval(M)},[n,r]);let S=(0,me.useCallback)(()=>l(M=>M+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:S}}var mn=D(G(),1),Ra=["csv","svg","png"],Fa=/^[=+\-@\t\r\n=+-@]/,Da=/var\(|color-mix\(/;function Cr(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?tr(e.getTime()):String(e);return`"${(Fa.test(t)&&!Number.isFinite($e(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Pa(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function La(e,t){return`\uFEFF${[t.map(Cr),...e.map(r=>t.map(o=>Cr(r[o])))].map(r=>r.join(",")).join(`\r
22
+ `;function Dr(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 Lr(e,t){let[n]=(0,Pr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var _r=!1;function kt(){if(_r||typeof document>"u"||(_r=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=sa,document.head.appendChild(e)}var Bt=P(ee(),1),Me=typeof window<"u"&&typeof document<"u",Le=Me?Bt.useLayoutEffect:Bt.useEffect;function Ht(){return typeof performance<"u"?performance.now():Date.now()}var Ee=P(ee(),1),la=(0,Ee.createContext)(void 0),jt=new Map;function ca(e,t){let n=jt.get(e);return n||jt.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||jt.delete(e)}}function ua(e,t,n){jt.get(e)?.forEach(r=>r(t,n))}function ma(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function Er(e,t,n,r){let o=(0,Ee.useContext)(la),i=t??o,[a]=(0,Ee.useState)(()=>({})),s=(0,Ee.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=i?c=>ua(i,c===null||s.current.keys[c]===void 0?null:{key:s.current.keys[c],label:s.current.labels[c]},a):null;let l=e.applySync;(0,Ee.useEffect)(()=>{if(i)return ca(i,(c,f)=>{if(f===a)return;let u=c?ma(s.current.keys,s.current.labels,c):-1;l(u<0?null:u)})},[i,a,l])}function te(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ve(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Or={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Ir={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var da=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],fa={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function ha(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ga(e){return ha(da,e)}function zr(e,t){let n=ga(e);return{text:n?n[t]:e,...fa[n?.id??"basic"]}}var Br={white:"#ffffff",black:"#000000",transparent:"#00000000"};function at(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Br[t.toLowerCase()]&&(t=Br[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 Gr(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 Dn(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 st(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Hr(e){return .2126*st(e[0])+.7152*st(e[1])+.0722*st(e[2])}function Ln(e,t,n){let r=typeof e=="string"?at(e):e,o=typeof t=="string"?at(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?at(n):n:null;o[3]<1&&i&&(o=Dn(o,i));let a=r[3]<1?Dn(r,o):r,s=Hr(a),l=Hr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function pa(e){return[st(e[0]),st(e[1]),st(e[2])]}function Pn(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 jr(e){let[t,n,r]=pa(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 ba([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[Pn(4.0767416621*o-3.3077115913*i+.2309699292*a),Pn(-1.2684380046*o+2.6097574011*i-.3413193965*a),Pn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Gt(e,t,n){let r=at(e),o=at(t);if(!r||!o)return e;let i=jr(r),a=jr(o),s=Math.max(0,Math.min(1,n));return Gr(ba([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 En(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Ln(i,e,n);a>o&&(o=a,r=i)}return r}function oe(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 ya(e,t){let n=En(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Ln(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):En(t,["#FFFFFF","#000000"])}function Vt(e,t){let n=Gt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:ya(e,n),raw:n}}function ge(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=oe(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=oe(e,"neutral");else if(s===0)r[a]=oe(e,"ink");else if(s===i-1)r[a]=oe(e,"neutral");else if(i===3)r[a]=oe(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?oe(e,"strong"):Vt(e,1-l)}}),r}var On="mix:";function We(e){return e({theme:Nn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${On}${o}`}).map(n=>n.fill)}function Vr(e,t){return t?.startsWith(On)?e.mix("neutralStrong","neutral",Number(t.slice(On.length))):e.color(t)}function wt(e,t,n){return ge(e,t+1,n).slice(0,t)}function Wt(e,t,n,r="neutral"){let o=oe(e,"accent"),i=oe(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Wr(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=oe(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=oe(e,"neutral"):s===0?r[a]=oe(e,"strong"):s===i-1?r[a]=oe(e,"neutral"):r[a]=Vt(e,1-s/(i-1))}),r}var Ce=P(ee(),1);var Ut=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),fe="en-US",Kr=new Map;function In(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=Kr.get(r);return o||(o=new Intl.NumberFormat(e,n),Kr.set(r,o)),o}function zn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function lt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=fe,...r}=t;return zn(In(n,r).format(e))}var Bn=e=>e!==0&&Math.abs(e)<.05,Hn=(e,t,n="")=>`${lt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Kt(e,t={}){if(!Number.isFinite(e))return"-";if(Bn(e)&&t.maximumFractionDigits===void 0)return Hn(e,t.locale??fe,"%");let n=Math.abs(e);return`${lt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Jr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=fe,...r}=t;if(te(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],c=o/s,f=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**f)/10**f;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+lt(u,{locale:n,...r,maximumFractionDigits:f})+l}}return zn(In(n,{notation:"compact",...r}).format(e))}var xa=(e,t=te(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Je(e,t=fe,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=In(t,o);return l=>Number.isFinite(l)?`${a}${zn(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=>Kt(o,{locale:t});case"ratio":return o=>Kt(o*100,{locale:t});case"compact":return o=>Jr(o,{locale:t});case"currency":return r(xa(t));default:{let o=r({maximumFractionDigits:1});return i=>Bn(i)?Hn(i,t):o(i)}}}function Xt(e,t=fe,n=0){return e!==void 0?Je(e,t):n>=1e5?r=>Bn(r)?Hn(r,t):Jr(r,{locale:t}):r=>lt(r,{locale:t})}function ka(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var jn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,wa=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,va=["january","february","march","april","may","june","july","august","september","october","november","december"],Ur=e=>{let t=e.toLowerCase();return t.length<3?0:va.findIndex(n=>n.startsWith(t))+1},Xr=e=>+e+(+e<30?2e3:1900);function qr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var $a=[/^(\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})$/,Qr=/\{([^{}]+)\}/g;function Yt(e,t){let n;for(let r of $a)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?[Xr(n[3]),+n[2],+n[1],1]:[Xr(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],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=Ur(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=Ur(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Gn=e=>wa.test(e)||Yt(e)!==null;function eo(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 vt(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(jn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return vt(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Yt(n,t);if(r)return ka(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 Yr=new Map;function $t(e,t={month:"short",day:"numeric"}){let n=vt(e);if(!n)return"-";let{locale:r=fe,...o}=t,i=r+JSON.stringify(o),a=Yr.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Yr.set(i,a)),a.format(n)}var Vn=P(W(),1),Jt=(0,Ce.createContext)({theme:Ge,cssVars:!0});function Ta(e,t=Ge){return e?typeof e=="string"?Fn[e]??t:_n(t,e):t}function qt(e){let t=(0,Ce.useContext)(Jt),n=e.base?Fn[e.base]:t.theme,r=(0,Ce.useMemo)(()=>Ta(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,Ce.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,Ce.useMemo)(()=>Rn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Vn.jsx)(Jt.Provider,{value:a,children:(0,Vn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Ma=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function no(e){return Ma.has(e)}function Ca(e,t){let n=r=>t?`var(${zt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?no(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?no(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)})`:Gt(e[r],e[o],i)}}}function Se(e){let t=(0,Ce.useContext)(Jt);return(0,Ce.useMemo)(()=>{let n=_n(t.theme,e);return Ca(n,t.cssVars)},[t.theme,t.cssVars,e])}function pe(e){let t=(0,Ce.useContext)(Jt);return e??t.locale??fe}function ro(e){return e?Rn(e):{}}var Zt=P(ee(),1),Wn=(0,Zt.createContext)(void 0);function oo(e){let t=(0,Zt.useContext)(Wn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=P(W(),1),Sa={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`},Aa={en:Sa,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Na={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Kn=e=>Aa[te(pe(e))];function Un(e){let t=Se(e.theme),n=Kn(e.locale),[r,o]=(0,Qt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(f=>!s.has(f.label)).length,c=(0,_.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((f,u)=>{let d=!s.has(f.label),g=d&&l===1,m=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Fa,{p:t,item:f,off:!d}),(0,_.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:f.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":d,"aria-disabled":g||void 0,onClick:()=>{g||(a(f.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:g?"default":void 0},children:m}):m},u)})});return a?(0,_.jsxs)(_.Fragment,{children:[c,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Na,children:r?n.shown(l,e.items.length):""})]}):c}function Fa({p:e,item:t,off:n}){let r=Vr(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 Ra(e){let t=Se(e.theme),n=zr(e.level,te(pe(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 _a(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 io(e){let t=Se(e.theme),n=Kn(e.locale),[r,o]=(0,Qt.useState)(0);Le(()=>kt(),[]);let i=()=>{o(d=>d+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)(Un,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,f=e.source!==void 0||e.note!==void 0?(0,_.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,_.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,_.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,_.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,_.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,_.jsx)(Ra,{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:_a(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,_.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,_.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,_.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,_.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,_.jsx)("span",{}),a]}):null]}),(0,_.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,_.jsx)(Wn.Provider,{value:r,children:(0,_.jsx)(it.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),f?(0,_.jsxs)(_.Fragment,{children:[f,u]}):u]})}function Xn(e){let t=Se(e.theme),n=Kn(e.locale),r=e.height??220;if(Le(()=>kt(),[]),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 dt=P(ee(),1);var be=P(ee(),1);var X=P(W(),1),en=60;var tn={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function ao(e){let{c:t,events:n}=e,r=(0,be.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Le(()=>{kt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,be.useContext)(it),c=e.ariaLabel??l??e.kind,f=(0,be.useMemo)(()=>s?`${n.length}${n.slice(0,en).map(k=>`${k.label}${k.series??""}${k.formatted??k.value??""}`).join("")}`:"",[n,s]),u=(0,be.useMemo)(()=>(0,X.jsx)(Pa,{label:c,events:n,t:t.t}),[c,f,t.t]),d=(0,be.useRef)(null);(0,be.useEffect)(()=>{let k=()=>{d.current=null};return window.addEventListener("scroll",k,{capture:!0,passive:!0}),window.addEventListener("resize",k,{passive:!0}),()=>{window.removeEventListener("scroll",k,{capture:!0}),window.removeEventListener("resize",k)}},[]),(0,be.useEffect)(()=>{d.current=null},[t.width,t.height]);let g=k=>{if(k.target!==k.currentTarget)return;if(e.onKey?.(k)){k.preventDefault();return}let N=t.active,H;switch(k.key){case"ArrowRight":case"ArrowDown":H=N===null?0:(N+1)%a;break;case"ArrowLeft":case"ArrowUp":H=N===null?a-1:(N-1+a)%a;break;case"Home":H=0;break;case"End":H=a-1;break;case"Escape":if(N===null)return;H=null;break;case"Enter":case" ":N!==null&&(k.preventDefault(),t.click(N));return;default:return}k.preventDefault(),t.setActive(H,"keyboard")},{via:m,node:b,setActive:M}=t;(0,be.useEffect)(()=>{if(m!=="touch"||!b)return;let k=N=>{b.contains(N.target)||M(null)};return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[m,b,M]);let w=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,$=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,D=typeof e.renderTip=="function"&&w?e.renderTip(w):null,x=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${a})`:""),L;if(v){let k=v.x*$,N=t.width*$,H=`clamp(${(4-k).toFixed(1)}px, -50%, calc(${(N-k-4).toFixed(1)}px - 100%))`,G=v.y<64;L={position:"absolute",left:k,top:v.y*$,transform:`translate(${H}, ${G?"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*$-8)}}let z=k=>{d.current=null,k.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},B=k=>k?N=>{let H=d.current??(d.current=N.currentTarget.getBoundingClientRect());H.width&&k((N.clientX-H.left)/H.width*t.width,(N.clientY-H.top)/H.height*t.height,N)}:void 0,E=B(e.onPointerMove),I=B(e.onPointerDown),S=E||I?k=>{k.pointerType==="touch"&&E?.(k),I?.(k)}:void 0,R=B(e.onPointerUp),C=ro(e.theme);return(0,X.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?g:void 0,onBlur:k=>{t.via==="keyboard"&&!k.currentTarget.contains(k.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"),...C,...e.style},children:[t.pending?null:e.underlay,(0,X.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:E,onPointerDown:S,onPointerUp:R,onPointerCancel:R,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,X.jsx)("title",{id:o,children:c}),(0,X.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,X.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,X.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:L,children:D??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map((k,N)=>(0,X.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,X.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(k.strong?"ink":"muted")},children:[k.color?(0,X.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:k.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,k.label]}),(0,X.jsx)("span",{style:{fontWeight:k.strong===!1?500:700},children:k.value})]},N))]})}):null,(0,X.jsx)("span",{className:"ztd-sr",style:tn,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?u:null]})}function Pa({label:e,events:t,t:n}){return(0,X.jsx)("div",{className:"ztd-sr",style:tn,children:(0,X.jsxs)("table",{children:[(0,X.jsx)("caption",{children:n.table(e)}),(0,X.jsxs)("tbody",{children:[t.slice(0,en).map((r,o)=>(0,X.jsxs)("tr",{children:[(0,X.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,X.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>en?(0,X.jsx)("tr",{children:(0,X.jsx)("td",{colSpan:2,children:n.more(t.length-en)})}):null]})]})})}function me(e){let t=e.baseline??"central";return(0,X.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ke=y("label","string",!0,"Item name field"),ae=y("value","number",!0,"Value field"),Da=[ke,ae],La=[ke,ae],Ea=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],Oa=[ke,ae],Ia=[y("label","string",!0,"Leaf (lowest level) name"),ae,y("group","string",!1,"Parent group field")],za=[y("label","string",!0,"Leaf name"),ae,y("group","string",!1,"Parent group field")],Ba=[ke,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],Ha=[ke,ae],ja=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),ae],Ga=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),ae],Va=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],Wa=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],lo=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Ka=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),lo],Ua=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),lo],Xa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],Ya=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],Ja=[ke,ae],qa=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],Za=[ke,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],Qa=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],es=[ke,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],ts=[ke,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],ns=[ke,ae],rs=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],os=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],is=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),ae],as=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),ae],ss=[y("date","date",!0,"Date field"),ae],ls=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],cs=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],us=[y("label","string",!1,"Row name field")],ms=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],ds=[ke,ae],fs=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],hs=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],gs=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),ae],ps=[ke,ae,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],bs=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],ys=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],xs=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],ks=[y("region","string",!0,"Region name or code, matched to a region of options.map"),ae],ws=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],vs=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],$s=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],so={pie:Da,donut:La,funnel:Ea,waffle:Oa,treemap:Ia,sunburst:za,waterfall:Ba,pareto:Ha,marimekko:ja,heatmap:Ga,radar:Va,bubble:Wa,line:Ka,area:Ua,stream:Xa,bar:Ya,radialBar:Ja,gauge:qa,bullet:Za,sparkline:Qa,slope:es,dumbbell:ts,lollipop:ns,beeswarm:rs,ridgeline:os,sankey:is,chord:as,calendar:ss,bump:ls,box:cs,parallel:us,candlestick:ms,segmented:ds,skyline:fs,histogram:hs,scatter:$s,tileMap:gs,barRace:ps,network:bs,timeline:ys,tree:xs,choropleth:ks,symbolMap:ws,flowMap:vs},ct={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 co(e,t){return t==="ko"?e.nameKo:e.name}function uo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var mo=["line","area","bar","scatter"],fo=24,Yn=["line","area","bar","scatter","timeline"];function Jn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function ho(e,t,n){return Yn.includes(e)&&!Jn(e,t,n).length&&!(e==="scatter"&&nn(n))}function nn(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 Ts={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 rn(e){let t=so[e]?e:Ts[e]??Object.keys(ct).find(n=>n.toLowerCase()===e.toLowerCase()||ct[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!ct[t]))return{type:t,component:ct[t].component,name:ct[t].name,nameKo:ct[t].nameKo,encoding:so[t]}}function po(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 rn(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 bo(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ms(e,t){if(e==null||typeof e!="object")return;let n=e;if(bo(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!bo(r,o))return;r=r[o]}return r}}function Oe(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 qe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ms(r,n)}function on(e,t){let n=qe(e,t);return(r,o)=>Oe(n(r,o))}function Be(e,t){let n=qe(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 Ae(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Cs(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
23
+ `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var Ss=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function yo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Ss.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Oe(t);if(Number.isFinite(n))return n}return t}function Ze(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??Cs(o),a=[],s=[],l="",c=!1;for(let m=0;m<o.length;m++){let b=o[m];c?b==='"'?o[m+1]==='"'?(l+='"',m++):c=!1:l+=b:b==='"'&&!l.trim()?(c=!0,l=""):b===i?(s.push(l),l=""):b===`
24
+ `||b==="\r"?(b==="\r"&&o[m+1]===`
25
+ `&&m++,s.push(l),a.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),a.push(s));let f=a.filter(m=>!(m.length===1&&m[0].trim()===""));if(!f.length)return[];let u=m=>n?yo(m):m;if(!r)return f.map(m=>Object.fromEntries(m.map((b,M)=>[String(M),u(b)])));let d=[],g=new Set;return f[0].forEach((m,b)=>{let M=m.trim()||`col${b+1}`,w=M;for(let v=2;g.has(w);v++)w=`${M}_${v}`;g.add(w),d.push(w)}),f.slice(1).map(m=>Object.fromEntries(d.map((b,M)=>[b,u(m[M]??"")])))}function qn(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"?yo(a[l]):a[l]??null])))}function As(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function xo(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function Ke(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ke(JSON.parse(t))}catch{}return Ze(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?qn(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)?Ke(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?qn(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)?Ke(t.rows):Array.isArray(t.values)?qn(t.values):Array.isArray(t.items)?Ke(t.items):Array.isArray(t.results)?Ke(t.results):As(t)}return[]}function an(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 Tt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let f=e[l][c];return Number.isFinite(f)&&f>0?f:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let f=0,u=0;for(let d=0;d<n;d++){let g=a(d,c),m=g-a(d,c-1),b=0;for(let M=0;M<d;M++)b+=a(M,c)-a(M,c-1);f+=g,u+=(m/2+b)*g}f&&(l-=u/f),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let g=0;g<n;g++){let m=e[g][l],b=Number.isFinite(m)?m:0;b>=0?(o[g][l]=u,u+=b,i[g][l]=u):(o[g][l]=d,d+=b,i[g][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let f=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=a(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=f,f+=d,i[u][l]=f}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,i[n-1]?.[u]??0);let f=0;for(let u=0;u<r;u++)f+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;f/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=f,i[u][d]-=f}return{y0:o,y1:i}}function sn(e,t={}){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=new Array(r).fill(0),s=new Array(r).fill(0),l=t.neutral!==void 0&&t.neutral>=0&&t.neutral<n?t.neutral:-1,c=[...new Set(t.negative??[])].filter(u=>u>=0&&u<n&&u!==l),f=e.map((u,d)=>d).filter(u=>u!==l&&!c.includes(u));for(let u=0;u<r;u++){let d=0;for(let $=0;$<n;$++)Number.isFinite(e[$][u])&&(d+=Math.abs(e[$][u]));let g=t.percent?d?100/d:0:1,m=$=>Number.isFinite(e[$][u])&&!t.skip?.has($)?Math.abs(e[$][u])*g:0,b=l>=0?m(l)/2:0;l>=0&&(o[l][u]=-b,i[l][u]=b);let M=0-b,w=b,v=$=>{o[$][u]=M,M-=m($),i[$][u]=M};c.forEach(v);for(let $ of f)e[$][u]<0||(o[$][u]=w,w+=m($),i[$][u]=w);for(let $=f.length-1;$>=0;$--)e[f[$]][u]<0&&v(f[$]);a[u]=0-M-b,s[u]=w-b}return{y0:o,y1:i,neg:a,pos:s}}function ln(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 ko(e){let t=e.length,n=e.map(c=>{let f=0,u=-1/0;return c.forEach((d,g)=>{d>u&&(u=d,f=g)}),f}),r=e.map(c=>c.reduce((f,u)=>f+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,f)=>f).sort((c,f)=>n[c]-n[f]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Ns=Math.PI*2;function cn(e,t,n){return e<t?t:e>n?n:e}function wo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function J(e){return Math.round(e*100)/100}function Mt(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let i=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,a=Math.min(n,r)/2,s=cn(i.tl??0,0,a),l=cn(i.tr??0,0,a),c=cn(i.br??0,0,a),f=cn(i.bl??0,0,a);return`M${J(e+s)},${J(t)}H${J(e+n-l)}`+(l?`A${J(l)},${J(l)} 0 0 1 ${J(e+n)},${J(t+l)}`:"")+`V${J(t+r-c)}`+(c?`A${J(c)},${J(c)} 0 0 1 ${J(e+n-c)},${J(t+r)}`:"")+`H${J(e+f)}`+(f?`A${J(f)},${J(f)} 0 0 1 ${J(e)},${J(t+r-f)}`:"")+`V${J(t+s)}`+(s?`A${J(s)},${J(s)} 0 0 1 ${J(e+s)},${J(t)}`:"")+"Z"}function vo(e){if(!e.length)return"";let t=`M${J(e[0][0])},${J(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${J(e[n][0])},${J(e[n][1])}`;return t}function $o(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function To(e){let t=e.length,n=e.reduce((l,c)=>l+c.x,0)/t,r=e.reduce((l,c)=>l+c.y,0)/t,o=0,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 Co(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Mo(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 un=new Map;function ie(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=un.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);Co(c)?a+=Mo(c):s+=Mo(c)}i=a+s*(n>=600?1.07:1),un.size>5e3&&un.clear(),un.set(o,i)}return i*t}function Ne(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<(Co(s.charCodeAt(0))?2:3)?"":s+o}var Y=P(W(),1),Qe=e=>Array.isArray(e)&&e.length===2;function mn(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Qe(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var So=e=>e?.find(t=>t.type==="forecast")?.from,Fs=(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 Zn(e,t,n){let r=t[0],o=1/0;for(let i of t){let a=er(e,i.x,i.y,i.anchor),s=n.reduce((l,c)=>l+Fs(a,c),0);if(s<o&&(r=i,o=s),s===0)break}return n.push(er(e,r.x,r.y,r.anchor)),r}var Qn=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),Rs=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function Ao(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 No(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 Fo(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 Ro={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function _o({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"&&Qe(i.y)){let s=No(t,i.y);if(!s)return;let[l,c]=s;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,c-l),fill:n.paint("accent"),opacity:.1}),(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:c,y2:c,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},a))}else if(i.type==="band"&&Qe(i.x)||i.type==="forecast"){let s;if(i.type==="forecast"){let f=Fo(t,i.from);s=f===null?null:[f,t.x1]}else s=Ao(t,i.x);if(!s)return;let l=Qn(t,s[0]),c=Qn(t,s[1]);if(c-l<.5)return;o.push((0,Y.jsx)("rect",{x:l,y:t.top,width:c-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 c=0;l.getTime()-s<=t.time.t1&&c<60;c++){let f=l.getTime();l.setDate(l.getDate()+2);let u=Math.max(t.x0,t.time.xt(f-s)),d=Math.min(t.x1,t.time.xt(l.getTime()-s));d>u&&o.push((0,Y.jsx)("rect",{x:u,y:t.top,width:d-u,height:r,fill:n.paint("ink"),opacity:.045},`${a}w${c}`)),l.setDate(l.getDate()+5)}}}),(0,Y.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var Po=(e,t)=>ie(e,10.5,t?700:500)+8;function er(e,t,n,r="start",o){let i=Po(e,o);return{x:r==="end"?t-i:t,y:n-8,w:i,h:16}}function Ct({p:e,x:t,y:n,text:r,anchor:o="start",strong:i}){let a=er(r,t,n,o,i);return(0,Y.jsxs)("g",{children:[(0,Y.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,Y.jsx)(me,{x:a.x+4,y:n,size:10.5,weight:i?700:500,fill:e.paint(i?"ink":"muted"),children:r})]})}function Do({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=Ro[t.lang],o=[],i=[],a=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let c=t.y(s.y);if(!Number.isFinite(c))return;let f=s.label?Ne(s.label,160,10.5):"",u=f?Zn(f,[{x:t.x1-2,y:c-10,anchor:"end"},{x:t.x0+2,y:c-10,anchor:"start"},{x:t.x1-2,y:c+10,anchor:"end"},{x:t.x0+2,y:c+10,anchor:"start"}],a):null;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:t.x0,x2:t.x1,y1:c,y2:c,stroke:n.paint("dim"),strokeDasharray:"4 3"}),u?(0,Y.jsx)(Ct,{p:n,x:u.x,y:u.y,text:f,anchor:u.anchor}):null]},l))}else if(s.type==="band"&&s.label){let c=Qe(s.y)?No(t,s.y):[t.top,t.bottom],f=Qe(s.x)?Ao(t,s.x):[t.x0,t.x1];if(!f||!c)return;let[u,d]=c,g=Ne(s.label,160,10.5),m=Math.min(Qn(t,f[0]),t.x1-40)+4,b=Zn(g,[{x:m,y:u+11,anchor:"start"},{x:m,y:d-11,anchor:"start"}],a);o.push((0,Y.jsx)(Ct,{p:n,x:b.x,y:b.y,text:g},l))}else if(s.type==="forecast"){let c=Fo(t,s.from);if(c===null)return;let f=Ne(s.label??r.forecast,120,10.5),u=Math.min(c+4,t.x1-50),d=Zn(f,[{x:u,y:t.top+9,anchor:"start"},{x:u,y:t.bottom-9,anchor:"start"}],a);o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:c,x2:c,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,Y.jsx)(Ct,{p:n,x:d.x,y:d.y,text:f})]},l))}else if(s.type==="event"&&s.label){let c=t.xAt(s.x);if(!Rs(t,c))return;let f=Ne(s.label,140,10.5,700),u=Po(f,!0),d=Math.max(t.x0,Math.min(c-u/2,t.x1-u)),g=i.findIndex(b=>b<d-4);g<0&&(g=i.length),i[g]=d+u;let m=t.top+9+g*18;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:c,x2:c,y1:m+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,Y.jsx)("circle",{cx:c,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,Y.jsx)(Ct,{p:n,x:d,y:m,text:f,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let c=t.points().filter(g=>Number.isFinite(g.x)&&Number.isFinite(g.y));if(c.length<2)return;let{at:f}=To(c),u=c[0].x,d=c[c.length-1].x;o.push((0,Y.jsxs)("g",{children:[(0,Y.jsx)("line",{x1:u,x2:d,y1:f(u),y2:f(d),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,Y.jsx)(Ct,{p:n,x:d-2,y:f(d)-11,text:Ne(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,Y.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function Lo(e,t,n,r){if(!e?.length)return"";let o=Ro[t],i=t==="ko",a=r??(l=>String(l??"")),s=e.map(l=>{let c=l.label?i?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&&Qe(l.y)?i?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${c}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${c}`:l.type==="band"&&Qe(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)}${c}`:`reference line at ${n(l.y)}${c}`: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 ye=P(W(),1),we=10.5;function Oo(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 dn(e,t,n){let r=18;for(let o of Oo(e,t,n))r=Math.max(r,ie(o,we));return Math.ceil(r+8)}function Io(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:Oo(n,a,e.locale);return(0,ye.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,f)=>{let u=Math.round(r(c))+.5,d=c===0&&e.zero!==!1;return(0,ye.jsxs)("g",{children:[(0,ye.jsx)("line",{x1:o,x2:i,y1:u,y2:u,stroke:t.paint(d?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:d?.7:1}),l?(0,ye.jsx)(me,{x:s?i+6:o-6,y:u,anchor:s?"start":"end",size:we,fill:t.paint("muted"),children:l[f]}):null]},c)})})}function tr(e,t,n=we,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((u,d)=>d);let s=t.map(u=>ie(u,n,o)),l=(u,d)=>Math.abs(e[d]-e[u])<(s[u]+s[d])/2+r,c=[];for(let u of i??[])c.some(d=>l(d,u))||c.push(u);let f=u=>!c.some(d=>l(d,u));for(let u=1;u<=a;u++){let d=c.slice();for(let g=0;g<a;g+=u)f(g)&&d.push(g);if(u>1&&(a-1)%u>u/2&&f(a-1)&&d.push(a-1),d.sort((g,m)=>g-m),d.every((g,m)=>!m||!l(d[m-1],g)))return d}return[0,a-1]}function zo(e){let{p:t,labels:n,centers:r,y:o,width:i}=e,a=e.size??we,s=n.map((c,f)=>{let u=2*Math.max(0,Math.min(r[f],i-r[f]))-2;return Ne(c,Math.min(e.maxWidth??160,u),a,e.strong?.has(f)?700:500)}),l=tr(r,s,a,6,600,e.strong);return(0,ye.jsx)("g",{"aria-hidden":"true",children:l.map(c=>{let f=e.strong?.has(c);return(0,ye.jsxs)("g",{children:[(0,ye.jsx)(me,{x:r[c],y:o,anchor:"middle",size:a,weight:f?700:500,fill:t.paint(f?"ink":"muted"),children:s[c]}),e.sub?.[c]?(0,ye.jsx)(me,{x:r[c],y:o+a+3,anchor:"middle",size:a-1,fill:t.paint("muted"),children:e.sub[c]}):null]},c)})})}var Eo=e=>Math.round(e*10)/10;function Bo(e){let{p:t}=e,n=Ne(e.label,160,we,700),r=ie(n,we,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,ye.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Eo(o)}px,${Eo(e.y)}px)`},children:[(0,ye.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,ye.jsx)(me,{x:0,y:0,anchor:"middle",size:we,weight:700,fill:t.paint("onInk"),children:n})]})}function nr(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 Ue(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=nr(a,n),c=[o,i];for(let f=0;f<4;f++){let u=Math.ceil(i/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let g=nr(c[1]-c[0],n);if(g===l)break;l=g}return c}function Ho(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=nr(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function et(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)=>Ho(n,r,l),s}function rr(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]=Ue(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function _s(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,f=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%f))for(let g of c){let m=Number((g*10**d).toPrecision(12));m>=e*(1-1e-9)&&m<=t*(1+1e-9)&&u.push(m)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Ho(e,t,3)}function jo(e,t){let n=et([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=()=>_s(e[0],e[1],Math.abs(t[1]-t[0])),r}function ut(e,t,n=.2,r=n/2){let o=e.length,[i,a]=t,s=a-i,l=o?s/Math.max(1,o-n+r*2):s,c=l*(1-n),f=i+l*r,u=new Map(e.map((g,m)=>[g,m])),d=(g=>f+(u.get(g)??0)*l);return d.bandwidth=Math.max(0,c),d.step=l,d.domain=e,d.index=g=>u.get(g)??-1,d}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 Ps=864e5;function Go(e,t,n,r=fe){let o=t-e;if(!(o>0))return[{t:e,label:$t(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Ps,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(f,u,d,g=!1)=>{let m=new Date(f),b=-1,M=0;for(;m.getTime()<=t&&M++<500;){if(m.getTime()>=e){let w=m.getFullYear(),v=g&&!l&&w!==b;a.push({t:m.getTime(),label:$t(m,{locale:r,...d,...v?{year:"numeric"}:{}})}),b=w}u(m)}};if(i<=1.5){let f=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(g=>g>=f)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,g=>g.setHours(g.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(f,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());f.setDate(f.getDate()+(8-f.getDay())%7),c(f,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let f=i/30.44,u=Math.max(1,Math.ceil(f/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(g=>g>=u)??120;if(d>=12){let g=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(g,m=>m.setFullYear(m.getFullYear()+d/12),{year:"numeric"})}else{let g=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),m=g.getMonth()%d;m&&g.setMonth(g.getMonth()+(d-m)),c(g,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return a}function Vo(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 Ds=(e,t,n)=>e==="date"?vt(t,n)?.getTime()??NaN:Oe(t);function Wo(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 Ko(e){if(!Gn(e.trim()))return e;let t=vt(e)?.getTime();return t===void 0||!Number.isFinite(t)?e:String(t)}function Ls(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Gn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Xe(e,t,n,r,o={}){let i=qe(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:qe(n,"y"),c=!a&&r!==void 0?qe(r,"series"):null,f=e.map((C,k)=>i(C,k)),u=o.xType??Ls(f),d=o.locale??fe,g,m,b;if(u==="band"){let C=f.map(N=>String(N??""));g=Ae(C);let k=new Map(g.map((N,H)=>[N,H]));m=g.map((N,H)=>H),b=Int32Array.from(C,N=>k.get(N)??-1)}else{let C=u==="date"?o.dayFirst??eo(f):void 0,k=f.map(G=>Ds(u,G,C)),N=Array.from(new Set(k.filter(G=>Number.isFinite(G)))).sort((G,de)=>G-de),H=new Map(N.map((G,de)=>[G,de]));m=N,g=N.map(String),b=Int32Array.from(k,G=>H.get(G)??-1)}let M=o.dateFormat,w=C=>typeof C=="string"?Yt(C.trim())?.[3]:void 0,v=u==="date"&&f.length<5e3?w(f[0]):void 0,$=(v===2||v===3)&&f.every(C=>w(C)===v),D=$&&v===3;if(u==="date"&&!M){let C=m.length>1?m[m.length-1]-m[0]:0;M=$&&v===2||C>864e5*120?{month:"short"}:C<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},C>864e5*800&&(M={year:"numeric",month:"short"})}let x;if(u==="band")x=g;else if(D&&!o.dateFormat){let C=te(d)==="ko";x=m.map(k=>{let N=new Date(k),H=Math.floor(N.getMonth()/3)+1;return C?`${N.getFullYear()}년 ${H}분기`:`Q${H} ${N.getFullYear()}`})}else{let C=m.every(jn),k=u==="date"?new Intl.DateTimeFormat(d,M):new Intl.NumberFormat(d,C?{useGrouping:!1}:{maximumFractionDigits:6});x=m.length>1e3?Vo(m.length,N=>k.format(m[N])):m.map(N=>k.format(N))}let L=s?[...s]:c?Ae(e.map((C,k)=>String(c(C,k)??""))):[""],z=new Map(L.map((C,k)=>[C,k])),B=L.map(()=>new Array(g.length).fill(NaN)),E=L.map(()=>new Array(g.length).fill(null)),I=o.aggregate??"sum",S=I==="mean"?L.map(()=>new Uint32Array(g.length)):null,R=(C,k,N,H)=>{let G=B[C][k];I==="last"?B[C][k]=N:I==="count"?B[C][k]=(Number.isFinite(G)?G:0)+1:I==="mean"?Number.isFinite(N)&&(B[C][k]=(Number.isFinite(G)?G:0)+N,S[C][k]++):B[C][k]=Number.isFinite(G)?G+(Number.isFinite(N)?N:0):N,E[C][k]=H};for(let C=0;C<e.length;C++){let k=b[C];if(k<0)continue;let N=e[C];if(s)for(let H=0;H<s.length;H++)R(H,k,Oe(N[s[H]]),N);else{let H=c?z.get(String(c(N,C)??""))??0:0;R(H,k,Oe(l(N,C)),N)}}if(S)for(let C=0;C<B.length;C++)for(let k=0;k<g.length;k++)S[C][k]>1&&(B[C][k]/=S[C][k]);return{type:u,keys:g,xnum:m,labels:x,series:L,values:B,rows:E}}var Es=140,At=12,Uo=14,or=20,Xo=12.5;function Os(e,t,n=fo){let r=Be(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function Is(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+At)/(Es+At))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function zs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*At)/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 St=e=>e.filter(Number.isFinite);function fn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=on(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return St(n)}function Yo(e,t,n,r,o,i){return Xe(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Bs(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let x=t.flat(),L=r.refLines??{},[z,B]=tt([...fn(x,r.x??"x"),...St([Number(L.x)])]),[E,I]=tt([...fn(x,r.y??"y"),...St([Number(L.y)])].filter(R=>!s||R>0)),S=r.zero??!1;return{y:c??(s?rr(E,I,a):Ue(E,I,a,{zero:S,pad:.08})),x:r.xDomain??Ue(z,B,Math.max(2,Math.round(o/110)),{zero:S,pad:.06}),sameKeys:!0}}let f=e==="bar",u=f&&r.orientation==="horizontal",d=n[0]?.keys.join(""),g=n.every(x=>x.keys.join("")===d),m=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),b=r.xDomain??(!f&&m?tt(n.flatMap(x=>St(x.xnum))):void 0),M=f?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(M==="percent")return{x:b,sameKeys:g};if(c)return{y:c,x:b,sameKeys:g};let w=[];t.forEach((x,L)=>{let z=n[L];if(M==="stacked"||M==="auto"&&z.series.length>1){let E=Tt(z.values,"zero");E.y0.forEach(I=>w.push(...I)),E.y1.forEach(I=>w.push(...I))}else z.values.forEach(E=>w.push(...E));f&&!u&&r.line!==void 0&&Yo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>w.push(...E)),f||w.push(...fn(x,r.lower),...fn(x,r.upper))}),f&&w.push(0),u||w.push(...mn(r.annotations));for(let x of r.referenceLines??[])w.push(x.y);r.signColors&&w.push(Number(r.baseline??0));let[v,$]=tt(St(w).filter(x=>!s||x>0));return{y:s?rr(v,$,a):f?Ue(v,$,u?Math.max(2,Math.round(o/120)):a):Ue(v,$,a,{zero:r.zero??e==="area"}),x:b,sameKeys:g}}function Hs(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Xe(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?jo:et)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),f=dn(c,Xt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(x=>x.series),d=r.endLabels??n.some(x=>x.series.length>1),g=f+6,m=i-(d?Math.min(i*.28,Math.max(...u.map(x=>ie(x,11,700)),20)+14):10),b=l.keys.length,[M,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?b>12:b>Go(M,w,Math.max(2,Math.floor((m-g)/64)),s).length;if(l.type==="band"||!b||v)return;let $=x=>g+(l.xnum[x]-M)/(w-M)*(m-g),D=x=>ie(l.labels[x],we);for(let x=1;;x++){let L=Array.from({length:Math.ceil(b/x)},(z,B)=>B*x);if(x>=b||L.every((z,B)=>!B||$(z)-$(L[B-1])>=(D(z)+D(L[B-1]))/2+8))return L.map(z=>({value:l.xnum[z],label:l.labels[z]}))}}function js(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 Gs(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${js(`${e}|${t}|${o}|${an(r)}`)}`}function Vs(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 Ws={en:{intro:(e,t)=>`${Ve(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:"(빈 값)"}},ir=18;function Jo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Os(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Is(s,a,e.columns),{pw:c,ph:f}=zs(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(S=>Yo(t,S,n,n.y,n.series,n.aggregate)),g=u?Bs(t,o,d,n,c,f):{sameKeys:!1},m=u?Hs(t,o,d,n,g,c,f,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",M=u&&(!b||g.sameKeys),w=u&&(b||g.x!==void 0||g.sameKeys),v=new Set(Vs(e.highlight,r)?[e.highlight].flat():[]),$=v.size>0,D=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??Gs(t,e.by,n,e.data),L=Ut(Je(n.format,e.locale),n.unit),z=Ws[e.lang],B=[],E=r.map(S=>S===""?z.blank:S);return{panels:r.map((S,R)=>{let C=o[R],k=E[R],N=R%l,H;if(t!=="scatter"){let de=d[R],Re=ce=>de.values.reduce((he,ht)=>he+(Number.isFinite(ht[ce])?ht[ce]:0),0),K=de.keys.map((ce,he)=>he).filter(ce=>de.values.some(he=>Number.isFinite(he[ce]))),le=K[K.length-1];B.push({first:K.length?Re(K[0]):NaN,last:K.length?Re(le):NaN,total:K.reduce((ce,he)=>ce+Re(he),0)}),t!=="bar"&&de.series.length===1&&le!==void 0&&(H=L(de.values[0][le]))}else B.push({first:NaN,last:NaN,total:C.length});let G={data:C,width:c,height:f,ariaLabel:e.title?`${e.title}, ${k}`:k,syncId:x,highlight:$?v.has(S)?D?()=>!0:void 0:"none":e.highlight,showYAxis:!M||N===0,showXAxis:!w||R+l>=a};return g.y&&(G.yDomain=g.y),g.x&&(G.xDomain=g.x),m&&(G.xTicks=m),{value:S,label:k,props:G,last:H,isPicked:v.has(S)}}),cols:l,pw:c,ph:f,isPanelPick:$,description:Ks(t,e.by,E,B,i,L,z)}}function Ks(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>$o(r.map(f=>f[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let f=n.filter((u,d)=>r[d].last<r[d].first);s+=f.length?a.falling(`${f.slice(0,5).join(", ")}${f.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var xe=P(ee(),1);function Us(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Xs(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 hn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Qo(e,t=!0){let[n,r]=(0,xe.useState)({visible:!t,near:!t});return(0,xe.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=Xs(a[a.length-1],hn.threshold,hn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Us(hn.threshold),rootMargin:hn.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 qo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function gn(e){let[t,n]=(0,xe.useState)(null),[r,o]=(0,xe.useState)(e??null),i=(0,xe.useCallback)(a=>{n(a),a&&e===void 0&&o(qo(a))},[e]);return Le(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(f=>f!==null&&Math.abs(f-c)<.5?f:c),s=()=>a(qo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let f=c[c.length-1]?.contentRect;f?a(f.width>0?Math.round(f.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var Ys=()=>()=>{};function mt(){return(0,xe.useSyncExternalStore)(Ys,()=>!0,()=>!1)}var Zo="(prefers-reduced-motion: reduce)";function pn(e="auto"){let[t,n]=(0,xe.useState)(()=>Me&&typeof window.matchMedia=="function"?window.matchMedia(Zo).matches:!1);return(0,xe.useEffect)(()=>{if(e!=="auto"||!Me||typeof window.matchMedia!="function")return;let r=window.matchMedia(Zo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Fe=P(W(),1),Js=60,qs=420;function ei(e){let t=Se(),n=e.chartProps??{},[,r,o]=gn(e.width),i=e.width??(o||480),a=pe(e.locale??n.locale),s=te(a),l=(0,dt.useContext)(it),c=e.title??l,f=e.chart.facetPlan,u=(0,dt.useMemo)(()=>{let w=Jo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return f?f(w,n,a):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,v)=>typeof v=="function"?String(v):v),e.highlight,e.syncId,i,e.height,c,a,s,f]),d=`${(0,dt.useId)().replace(/:/g,"")}fd`,g=pn(n.reducedMotion??"auto"),m=mt(),b=Lr({motion:{enabled:n.animate!==!1&&!g&&Me},hydrated:m},{waiting:!1,generation:0}),M=e.chart;return(0,Fe.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Fe.jsx)("p",{id:d,style:tn,children:e.description??u.description}),(0,Fe.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:At,rowGap:Uo,...u.legend?{marginTop:ir}:null},children:u.panels.map((w,v)=>{let $=t.paint(w.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Fe.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...Dr(b,!1,"fade",v*Js,qs)},children:[(0,Fe.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:or,fontSize:Xo,fontWeight:700,lineHeight:`${or}px`,color:$},children:[(0,Fe.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,Fe.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,Fe.jsx)(M,{...n,...w.props})]},w.value)})}),u.legend?(0,Fe.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:ir},children:u.legend}):null]})}var ti=["max","min","first","last","none"];function ve(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let f=-1,u=c==="max"?-1/0:1/0;r.forEach((d,g)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,f=g)}),f>=0&&i.add(f)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,f)=>{f<a&&c!==null&&c!==void 0&&e(c,f)&&i.add(f)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((f,u)=>{f===c&&i.add(u)});return i}var $e=P(ee(),1);async function Zs(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 Ze(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 Ze(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ze(i)}async function Qs(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 Zs(i,t.parse,o,t.locale)}return t.select&&(r=xo(r,t.select)),t.transform?t.transform(r):Ke(r)}function ni(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,$e.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,$e.useState)(0),c=pe(t.locale),f=(0,$e.useRef)(t);f.current={...t,locale:c};let u=(0,$e.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",g=t.deps??[],m=JSON.stringify(g.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),b=(0,$e.useRef)(!1);(0,$e.useEffect)(()=>{let w=u.current;if(!w||!r){a(D=>D.status==="loading"?{...D,status:"idle"}:D);return}let v=new AbortController,$=!0;return b.current=!0,a(D=>({...D,data:o?D.data:[],status:"loading",error:null})),Qs(w,{...f.current,signal:v.signal}).then(D=>{$&&a({data:D,status:"success",error:null,updatedAt:Date.now()})}).catch(D=>{!$||v.signal.aborted||a(x=>({...x,status:"error",error:D instanceof Error?D:new Error(String(D))}))}).finally(()=>{$&&(b.current=!1)}),()=>{$=!1,b.current=!1,v.abort()}},[d,r,s,m,o]),(0,$e.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||l(v=>v+1)},n);return()=>clearInterval(w)},[n,r]);let M=(0,$e.useCallback)(()=>l(w=>w+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:M}}var sr=P(W(),1),el=["csv","svg","png"],tl=/^[=+\-@\t\r\n=+-@]/,nl=/var\(|color-mix\(/;function ri(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?qr(e.getTime()):String(e);return`"${(tl.test(t)&&!Number.isFinite(Oe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function rl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function ol(e,t){return`\uFEFF${[t.map(ri),...e.map(r=>t.map(o=>ri(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
- `}function Ea(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function cn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var $r=2,Fe=16;function Mr(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 Tr(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 Sr(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+Fe*2,i+Fe*2],u=o.cloneNode(!0),f=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((h,b)=>{let S;for(let M of Array.from(h.attributes)){if(!Da.test(M.value))continue;let T=(S??(S=getComputedStyle(h))).getPropertyValue(M.name);T&&f[b].setAttribute(M.name,Mr(T,c))}}),u.removeAttribute("style");for(let[h,b]of Object.entries({viewBox:`${-Fe} ${-Fe} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(h,String(b));let d=Mr(getComputedStyle(r).backgroundColor,c),g=o.parentElement?.querySelector("canvas")??null;if(n){let h=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(Tr("rect",{x:-Fe,y:-Fe,width:s,height:l,fill:d}),h),g&&u.insertBefore(Tr("image",{href:g.toDataURL(),width:a,height:i}),h)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:a,vh:i,bg:d,canvas:g}}function _a(e,t){let n=Sr(e,$r,!1);if(!n)return;let r=$r,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,Fe*r,Fe*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&&cn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Ar(e){let t=ve(e.theme),n=Z(fe(e.locale))==="ko",r=Ea(e.filename),o=(a,i)=>{if(a==="csv")return cn(new Blob([La(e.data,e.columns?.length?e.columns:Pa(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return _a(i,r);let s=Sr(i,1,!0);s&&cn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,mn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Ra.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,mn.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 Rr=D(G(),1);function Nr(e,t=ce){let n=qe(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?ar(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(rr,(f,c)=>o(a,c.trim())??(l=!0,""));l||i.push(u)}return i.length?i.map((s,l)=>(0,Rr.jsx)("div",{children:s},l)):null}}var x=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),he=x("label","string",!0,"Item name field"),oe=x("value","number",!0,"Value field"),Ia=[he,oe],Oa=[he,oe],Ba=[x("label","string",!0,"Stage name"),x("value","number",!0,"Users at the stage")],za=[he,oe],Ha=[x("label","string",!0,"Leaf (lowest level) name"),oe,x("group","string",!1,"Parent group field")],Va=[x("label","string",!0,"Leaf name"),oe,x("group","string",!1,"Parent group field")],ja=[he,x("value","number",!0,"Change (total rows may omit it)"),x("type","string",!1,'"total" makes a total bar')],Wa=[he,oe],Ka=[x("x","string",!0,"Column field"),x("series","string",!0,"Stacked series field"),oe],Ga=[x("x","string",!0,"Column field"),x("y","string",!0,"Row field"),oe],Ua=[x("axis","string",!0,"Metric (axis) field"),x("value","number",!0,"Value field",{multi:!0}),x("series","string",!1,"Series field")],Ya=[x("x","number",!0,"x value"),x("y","number",!0,"y value"),x("size","number",!1,"Circle size"),x("label","string",!1,"Name")],Dr=x("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Xa=[x("x","any",!0,"x field (date, number or category)"),x("y","number",!0,"y field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field (long tables)"),x("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Dr],qa=[x("x","any",!0,"x field"),x("y","number",!0,"y field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field"),x("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}),Dr],Ja=[x("x","any",!0,"x field"),x("y","number",!0,"y field",{multi:!0}),x("series","string",!1,"Series field")],Za=[x("x","string",!0,"Category field"),x("y","number",!0,"Value field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field"),x("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})],Qa=[he,oe],ei=[x("value","number",!0,"Value field",{prop:"valueKey"}),x("target","number",!1,"Target field",{prop:"targetKey"})],ti=[he,x("value","number",!0,"Actual value field"),x("target","number",!1,"Target field")],ni=[x("x","any",!1,"x field"),x("y","number",!0,"y field")],ri=[he,x("x","string",!1,"Period field (long tables)"),x("value","number",!1,"Value field (long tables)")],oi=[he,x("start","number",!0,"Before value"),x("end","number",!0,"After value")],ai=[he,oe],ii=[x("value","number",!0,"Value field"),x("group","string",!1,"Group (row) field"),x("label","string",!1,"Dot name")],si=[x("group","string",!0,"Group field"),x("value","number",!0,"Value field")],li=[x("source","string",!0,"Source node"),x("target","string",!0,"Target node"),oe],ui=[x("source","string",!0,"Sending group"),x("target","string",!0,"Receiving group"),oe],ci=[x("date","date",!0,"Date field"),oe],mi=[x("x","any",!0,"Period field"),x("series","string",!0,"Item field"),x("rank","number",!1,"Rank field (1 is first)"),x("value","number",!1,"Value field (instead of rank, largest is first)")],di=[x("group","string",!0,"Group field"),x("value","number",!0,"Value field")],fi=[x("label","string",!1,"Row name field")],hi=[x("x","date",!0,"Date (period) field"),x("open","number",!0,"Open price field"),x("high","number",!0,"High price field"),x("low","number",!0,"Low price field"),x("close","number",!0,"Close price field"),x("volume","number",!1,"Volume field")],gi=[he,oe],pi=[x("x","any",!0,"Period field (date or category)"),x("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field (long tables, back row only)"),x("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],bi=[x("value","number",!1,"Sample value field (raw rows)"),x("group","string",!1,"Group field. Up to 2 groups overlap"),x("x0","number",!1,"Bin start (pre-binned rows)"),x("x1","number",!1,"Bin end (pre-binned rows)"),x("count","number",!1,"Samples in the bin (pre-binned rows)")],yi=[x("x","number",!0,"x value"),x("y","number",!0,"y value"),x("series","string",!1,"Series field (one color per series)"),x("label","string",!1,"Name")],Fr={pie:Ia,donut:Oa,funnel:Ba,waffle:za,treemap:Ha,sunburst:Va,waterfall:ja,pareto:Wa,marimekko:Ka,heatmap:Ga,radar:Ua,bubble:Ya,line:Xa,area:qa,stream:Ja,bar:Za,radialBar:Qa,gauge:ei,bullet:ti,sparkline:ni,slope:ri,dumbbell:oi,lollipop:ai,beeswarm:ii,ridgeline:si,sankey:li,chord:ui,calendar:ci,bump:mi,box:di,parallel:fi,candlestick:hi,segmented:gi,skyline:pi,histogram:bi,scatter:yi},Ke={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 Pr(e,t){return t==="ko"?e.nameKo:e.name}function Lr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var dn=["line","area","bar","scatter"];function fn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"?[].concat(t.line??[]).map(String):[]}function Er(e,t,n){return dn.includes(e)&&!fn(e,t,n).length}function _r(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var xi={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 wt(e){let t=Fr[e]?e:xi[e]??Object.keys(Ke).find(n=>n.toLowerCase()===e.toLowerCase()||Ke[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Ke[t]))return{type:t,component:Ke[t].component,name:Ke[t].name,nameKo:Ke[t].nameKo,encoding:Fr[t]}}function Ir(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 wt(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 ki=Math.PI*2;function vt(e,t,n){return e<t?t:e>n?n:e}function Or(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function j(e){return Math.round(e*100)/100}function Qe(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=vt(a.tl??0,0,i),l=vt(a.tr??0,0,i),u=vt(a.br??0,0,i),f=vt(a.bl??0,0,i);return`M${j(e+s)},${j(t)}H${j(e+n-l)}`+(l?`A${j(l)},${j(l)} 0 0 1 ${j(e+n)},${j(t+l)}`:"")+`V${j(t+r-u)}`+(u?`A${j(u)},${j(u)} 0 0 1 ${j(e+n-u)},${j(t+r)}`:"")+`H${j(e+f)}`+(f?`A${j(f)},${j(f)} 0 0 1 ${j(e)},${j(t+r-f)}`:"")+`V${j(t+s)}`+(s?`A${j(s)},${j(s)} 0 0 1 ${j(e+s)},${j(t)}`:"")+"Z"}function Br(e){if(!e.length)return"";let t=`M${j(e[0][0])},${j(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${j(e[n][0])},${j(e[n][1])}`;return t}function zr(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 Hr(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 Ee(t.csv)}return null}var ae=D(ee(),1);var O=D(G(),1),Ct=60;var Vr={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function jr(e){let{c:t,events:n}=e,r=(0,ae.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,pe(()=>{Xe()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,ae.useContext)(lt),u=e.ariaLabel??l??e.kind,f=(0,ae.useMemo)(()=>s?`${n.length}${n.slice(0,Ct).map(y=>`${y.label}${y.series??""}${y.formatted??y.value??""}`).join("")}`:"",[n,s]),c=(0,ae.useMemo)(()=>(0,O.jsx)(wi,{label:u,events:n,t:t.t}),[u,f,t.t]),d=(0,ae.useRef)(null);(0,ae.useEffect)(()=>{let y=()=>{d.current=null};return window.addEventListener("scroll",y,{capture:!0,passive:!0}),window.addEventListener("resize",y,{passive:!0}),()=>{window.removeEventListener("scroll",y,{capture:!0}),window.removeEventListener("resize",y)}},[]),(0,ae.useEffect)(()=>{d.current=null},[t.width,t.height]);let g=y=>{if(y.target!==y.currentTarget)return;if(e.onKey?.(y)){y.preventDefault();return}let C=t.active,E;switch(y.key){case"ArrowRight":case"ArrowDown":E=C===null?0:(C+1)%i;break;case"ArrowLeft":case"ArrowUp":E=C===null?i-1:(C-1+i)%i;break;case"Home":E=0;break;case"End":E=i-1;break;case"Escape":if(C===null)return;E=null;break;case"Enter":case" ":C!==null&&(y.preventDefault(),t.click(C));return;default:return}y.preventDefault(),t.setActive(E,"keyboard")},{via:h,node:b,setActive:S}=t;(0,ae.useEffect)(()=>{if(h!=="touch"||!b)return;let y=C=>{b.contains(C.target)||S(null)};return document.addEventListener("pointerdown",y),()=>document.removeEventListener("pointerdown",y)},[h,b,S]);let M=t.active!==null?n[t.active]:null,T=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,I=T&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,N=typeof e.renderTip=="function"&&M?e.renderTip(M):null,A=e.announce??(t.via==="keyboard"&&M?`${M.label}${M.series?` ${M.series}`:""}: ${M.formatted??M.value??""} (${(t.active??0)+1}/${i})`:""),P;if(T){let y=T.x*I,C=t.width*I,E=`clamp(${(4-y).toFixed(1)}px, -50%, calc(${(C-y-4).toFixed(1)}px - 100%))`,W=T.y<64;P={position:"absolute",left:y,top:T.y*I,transform:`translate(${E}, ${W?"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*I-8)}}let Q=y=>{d.current=null,y.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},z=y=>y?C=>{let E=d.current??(d.current=C.currentTarget.getBoundingClientRect());E.width&&y((C.clientX-E.left)/E.width*t.width,(C.clientY-E.top)/E.height*t.height,C)}:void 0,U=z(e.onPointerMove),Y=z(e.onPointerDown),w=U||Y?y=>{y.pointerType==="touch"&&U?.(y),Y?.(y)}:void 0,_=z(e.onPointerUp),k=mr(e.theme);return(0,O.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":u,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?g:void 0,onBlur:y=>{t.via==="keyboard"&&!y.currentTarget.contains(y.relatedTarget)&&t.setActive(null)},onPointerLeave:Q,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...k,...e.style},children:[t.pending?null:e.underlay,(0,O.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:U,onPointerDown:w,onPointerUp:_,onPointerCancel:_,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,O.jsx)("title",{id:o,children:u}),(0,O.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,O.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,T?(0,O.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:P,children:N??(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:T.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:T.title}),T.rows.map((y,C)=>(0,O.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,O.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(y.strong?"ink":"muted")},children:[y.color?(0,O.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:y.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,y.label]}),(0,O.jsx)("span",{style:{fontWeight:y.strong===!1?500:700},children:y.value})]},C))]})}):null,(0,O.jsx)("span",{className:"ztd-sr",style:Vr,"aria-live":"polite","aria-atomic":"true",children:A}),s&&!t.pending?c:null]})}function wi({label:e,events:t,t:n}){return(0,O.jsx)("div",{className:"ztd-sr",style:Vr,children:(0,O.jsxs)("table",{children:[(0,O.jsx)("caption",{children:n.table(e)}),(0,O.jsxs)("tbody",{children:[t.slice(0,Ct).map((r,o)=>(0,O.jsxs)("tr",{children:[(0,O.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,O.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Ct?(0,O.jsx)("tr",{children:(0,O.jsx)("td",{colSpan:2,children:n.more(t.length-Ct)})}):null]})]})})}function ie(e){let t=e.baseline??"central";return(0,O.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}function Kr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Wr(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 $t=new Map;function se(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=$t.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);Kr(u)?i+=Wr(u):s+=Wr(u)}a=i+s*(n>=600?1.07:1),$t.size>5e3&&$t.clear(),$t.set(o,a)}return a*t}function ge(e,t,n,r=400){if(e=e.trim(),se(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;se(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<(Kr(s.charCodeAt(0))?2:3)?"":s+o}var le=D(G(),1),Me=10.5;function Ur(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=>ze(i,{locale:n,maximumFractionDigits:a}))}function Yr(e,t,n){let r=18;for(let o of Ur(e,t,n))r=Math.max(r,se(o,Me));return Math.ceil(r+8)}function Xr(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:Ur(n,i,e.locale);return(0,le.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((u,f)=>{let c=Math.round(r(u))+.5,d=u===0&&e.zero!==!1;return(0,le.jsxs)("g",{children:[(0,le.jsx)("line",{x1:o,x2:a,y1:c,y2:c,stroke:t.paint(d?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:d?.7:1}),l?(0,le.jsx)(ie,{x:s?a+6:o-6,y:c,anchor:s?"start":"end",size:Me,fill:t.paint("muted"),children:l[f]}):null]},u)})})}function hn(e,t,n=Me,r=8,o=400,a){let i=t.length;if(i<=1)return t.map((c,d)=>d);let s=t.map(c=>se(c,n,o)),l=(c,d)=>Math.abs(e[d]-e[c])<(s[c]+s[d])/2+r,u=[];for(let c of a??[])u.some(d=>l(d,c))||u.push(c);let f=c=>!u.some(d=>l(d,c));for(let c=1;c<=i;c++){let d=u.slice();for(let g=0;g<i;g+=c)f(g)&&d.push(g);if(c>1&&(i-1)%c>c/2&&f(i-1)&&d.push(i-1),d.sort((g,h)=>g-h),d.every((g,h)=>!h||!l(d[h-1],g)))return d}return[0,i-1]}function qr(e){let{p:t,labels:n,centers:r,y:o,width:a}=e,i=e.size??Me,s=n.map((u,f)=>{let c=2*Math.max(0,Math.min(r[f],a-r[f]))-2;return ge(u,Math.min(e.maxWidth??160,c),i,e.strong?.has(f)?700:500)}),l=hn(r,s,i,6,600,e.strong);return(0,le.jsx)("g",{"aria-hidden":"true",children:l.map(u=>{let f=e.strong?.has(u);return(0,le.jsxs)("g",{children:[(0,le.jsx)(ie,{x:r[u],y:o,anchor:"middle",size:i,weight:f?700:500,fill:t.paint(f?"ink":"muted"),children:s[u]}),e.sub?.[u]?(0,le.jsx)(ie,{x:r[u],y:o+i+3,anchor:"middle",size:i-1,fill:t.paint("muted"),children:e.sub[u]}):null]},u)})})}var Gr=e=>Math.round(e*10)/10;function Jr(e){let{p:t}=e,n=ge(e.label,160,Me,700),r=se(n,Me,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,le.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Gr(o)}px,${Gr(e.y)}px)`},children:[(0,le.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,le.jsx)(ie,{x:0,y:0,anchor:"middle",size:Me,weight:700,fill:t.paint("onInk"),children:n})]})}var V=D(G(),1),_e=e=>Array.isArray(e)&&e.length===2;function Zr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&_e(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var Qr=e=>e?.find(t=>t.type==="forecast")?.from,vi=(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 gn(e,t,n){let r=t[0],o=1/0;for(let a of t){let i=bn(e,a.x,a.y,a.anchor),s=n.reduce((l,u)=>l+vi(i,u),0);if(s<o&&(r=a,o=s),s===0)break}return n.push(bn(e,r.x,r.y,r.anchor)),r}var pn=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),Ci=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function eo(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 to(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 no(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 ro={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function oo({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"&&_e(a.y)){let s=to(t,a.y);if(!s)return;let[l,u]=s;o.push((0,V.jsxs)("g",{children:[(0,V.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,V.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,V.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"&&_e(a.x)||a.type==="forecast"){let s;if(a.type==="forecast"){let f=no(t,a.from);s=f===null?null:[f,t.x1]}else s=eo(t,a.x);if(!s)return;let l=pn(t,s[0]),u=pn(t,s[1]);if(u-l<.5)return;o.push((0,V.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 f=l.getTime();l.setDate(l.getDate()+2);let c=Math.max(t.x0,t.time.xt(f-s)),d=Math.min(t.x1,t.time.xt(l.getTime()-s));d>c&&o.push((0,V.jsx)("rect",{x:c,y:t.top,width:d-c,height:r,fill:n.paint("ink"),opacity:.045},`${i}w${u}`)),l.setDate(l.getDate()+5)}}}),(0,V.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var ao=(e,t)=>se(e,10.5,t?700:500)+8;function bn(e,t,n,r="start",o){let a=ao(e,o);return{x:r==="end"?t-a:t,y:n-8,w:a,h:16}}function et({p:e,x:t,y:n,text:r,anchor:o="start",strong:a}){let i=bn(r,t,n,o,a);return(0,V.jsxs)("g",{children:[(0,V.jsx)("rect",{x:i.x,y:i.y,width:i.w,height:i.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,V.jsx)(ie,{x:i.x+4,y:n,size:10.5,weight:a?700:500,fill:e.paint(a?"ink":"muted"),children:r})]})}function io({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=ro[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 f=s.label?ge(s.label,160,10.5):"",c=f?gn(f,[{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,V.jsxs)("g",{children:[(0,V.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("dim"),strokeDasharray:"4 3"}),c?(0,V.jsx)(et,{p:n,x:c.x,y:c.y,text:f,anchor:c.anchor}):null]},l))}else if(s.type==="band"&&s.label){let u=_e(s.y)?to(t,s.y):[t.top,t.bottom],f=_e(s.x)?eo(t,s.x):[t.x0,t.x1];if(!f||!u)return;let[c,d]=u,g=ge(s.label,160,10.5),h=Math.min(pn(t,f[0]),t.x1-40)+4,b=gn(g,[{x:h,y:c+11,anchor:"start"},{x:h,y:d-11,anchor:"start"}],i);o.push((0,V.jsx)(et,{p:n,x:b.x,y:b.y,text:g},l))}else if(s.type==="forecast"){let u=no(t,s.from);if(u===null)return;let f=ge(s.label??r.forecast,120,10.5),c=Math.min(u+4,t.x1-50),d=gn(f,[{x:c,y:t.top+9,anchor:"start"},{x:c,y:t.bottom-9,anchor:"start"}],i);o.push((0,V.jsxs)("g",{children:[(0,V.jsx)("line",{x1:u,x2:u,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,V.jsx)(et,{p:n,x:d.x,y:d.y,text:f})]},l))}else if(s.type==="event"&&s.label){let u=t.xAt(s.x);if(!Ci(t,u))return;let f=ge(s.label,140,10.5,700),c=ao(f,!0),d=Math.max(t.x0,Math.min(u-c/2,t.x1-c)),g=a.findIndex(b=>b<d-4);g<0&&(g=a.length),a[g]=d+c;let h=t.top+9+g*18;o.push((0,V.jsxs)("g",{children:[(0,V.jsx)("line",{x1:u,x2:u,y1:h+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,V.jsx)("circle",{cx:u,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,V.jsx)(et,{p:n,x:d,y:h,text:f,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let u=t.points().filter(g=>Number.isFinite(g.x)&&Number.isFinite(g.y));if(u.length<2)return;let{at:f}=zr(u),c=u[0].x,d=u[u.length-1].x;o.push((0,V.jsxs)("g",{children:[(0,V.jsx)("line",{x1:c,x2:d,y1:f(c),y2:f(d),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,V.jsx)(et,{p:n,x:d-2,y:f(d)-11,text:ge(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,V.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function so(e,t,n,r){if(!e?.length)return"";let o=ro[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"&&_e(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"&&_e(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?", ":"; ")}.`:""}function lo(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 yn(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 uo(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=yn(i,n),u=[o,a];for(let f=0;f<4;f++){let c=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:c-a<=l*.3?c:a+i*s];let g=yn(u[1]-u[0],n);if(g===l)break;l=g}return u}function $i(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=yn(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 Mt(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)=>$i(n,r,l),s}function Tt(e,t,n=.2,r=n/2){let o=e.length,[a,i]=t,s=i-a,l=o?s/Math.max(1,o-n+r*2):s,u=l*(1-n),f=a+l*r,c=new Map(e.map((g,h)=>[g,h])),d=(g=>f+(c.get(g)??0)*l);return d.bandwidth=Math.max(0,u),d.step=l,d.domain=e,d.index=g=>c.get(g)??-1,d}function co(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]}function mo(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 Mi=(e,t,n)=>e==="date"?Je(t,n)?.getTime()??NaN:$e(t);function fo(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 ho(e){if(!Zt(e.trim()))return e;let t=Je(e)?.getTime();return t===void 0||!Number.isFinite(t)?e:String(t)}function Ti(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Zt(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function xn(e,t,n,r,o={}){let a=je(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:je(n,"y"),u=!i&&r!==void 0?je(r,"series"):null,f=e.map((k,y)=>a(k,y)),c=o.xType??Ti(f),d=o.locale??ce,g,h,b;if(c==="band"){let k=f.map(C=>String(C??""));g=We(k);let y=new Map(g.map((C,E)=>[C,E]));h=g.map((C,E)=>E),b=Int32Array.from(k,C=>y.get(C)??-1)}else{let k=c==="date"?o.dayFirst??or(f):void 0,y=f.map(W=>Mi(c,W,k)),C=Array.from(new Set(y.filter(W=>Number.isFinite(W)))).sort((W,ye)=>W-ye),E=new Map(C.map((W,ye)=>[W,ye]));h=C,g=C.map(String),b=Int32Array.from(y,W=>E.get(W)??-1)}let S=o.dateFormat,M=k=>typeof k=="string"?ft(k.trim())?.[3]:void 0,T=c==="date"&&f.length<5e3?M(f[0]):void 0,I=(T===2||T===3)&&f.every(k=>M(k)===T),N=I&&T===3;if(c==="date"&&!S){let k=h.length>1?h[h.length-1]-h[0]:0;S=I&&T===2||k>864e5*120?{month:"short"}:k<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},k>864e5*800&&(S={year:"numeric",month:"short"})}let A;if(c==="band")A=g;else if(N&&!o.dateFormat){let k=Z(d)==="ko";A=h.map(y=>{let C=new Date(y),E=Math.floor(C.getMonth()/3)+1;return k?`${C.getFullYear()}년 ${E}분기`:`Q${E} ${C.getFullYear()}`})}else{let k=h.every(Jt),y=c==="date"?new Intl.DateTimeFormat(d,S):new Intl.NumberFormat(d,k?{useGrouping:!1}:{maximumFractionDigits:6});A=h.length>1e3?mo(h.length,C=>y.format(h[C])):h.map(C=>y.format(C))}let P=s?[...s]:u?We(e.map((k,y)=>String(u(k,y)??""))):[""],Q=new Map(P.map((k,y)=>[k,y])),z=P.map(()=>new Array(g.length).fill(NaN)),U=P.map(()=>new Array(g.length).fill(null)),Y=o.aggregate??"sum",w=Y==="mean"?P.map(()=>new Uint32Array(g.length)):null,_=(k,y,C,E)=>{let W=z[k][y];Y==="last"?z[k][y]=C:Y==="count"?z[k][y]=(Number.isFinite(W)?W:0)+1:Y==="mean"?Number.isFinite(C)&&(z[k][y]=(Number.isFinite(W)?W:0)+C,w[k][y]++):z[k][y]=Number.isFinite(W)?W+(Number.isFinite(C)?C:0):C,U[k][y]=E};for(let k=0;k<e.length;k++){let y=b[k];if(y<0)continue;let C=e[k];if(s)for(let E=0;E<s.length;E++)_(E,y,$e(C[s[E]]),C);else{let E=u?Q.get(String(u(C,k)??""))??0:0;_(E,y,$e(l(C,k)),C)}}if(w)for(let k=0;k<z.length;k++)for(let y=0;y<g.length;y++)w[k][y]>1&&(z[k][y]/=w[k][y]);return{type:c,keys:g,xnum:h,labels:A,series:P,values:z,rows:U}}var J=D(ee(),1);var ue=D(ee(),1);function Si(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Ai(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function bo(e,t=!0){let[n,r]=(0,ue.useState)({visible:!t,near:!t});return(0,ue.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=Ai(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Si(.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 go(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function yo(e){let[t,n]=(0,ue.useState)(null),[r,o]=(0,ue.useState)(e??null),a=(0,ue.useCallback)(i=>{n(i),i&&e===void 0&&o(go(i))},[e]);return pe(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=u=>o(f=>f!==null&&Math.abs(f-u)<.5?f:u),s=()=>i(go(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let f=u[u.length-1]?.contentRect;f?i(f.width>0?Math.round(f.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var Ni=()=>()=>{};function St(){return(0,ue.useSyncExternalStore)(Ni,()=>!0,()=>!1)}var po="(prefers-reduced-motion: reduce)";function xo(e="auto"){let[t,n]=(0,ue.useState)(()=>we&&typeof window.matchMedia=="function"?window.matchMedia(po).matches:!1);return(0,ue.useEffect)(()=>{if(e!=="auto"||!we||typeof window.matchMedia!="function")return;let r=window.matchMedia(po),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}function ko(e,t){let n=ve(e.theme),[r,o,a]=yo(e.width),i=St(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,f=xo(e.reducedMotion??"auto"),c=e.animate!==!1&&!f&&we,d=bo(r,e.animateOnView!==!1&&c),g=fe(e.locale),h=Z(g),b=(0,J.useMemo)(()=>qe(e.format,g,t.format),[e.format,g,t.format]),S=(0,J.useCallback)(K=>dt(K,{locale:g}),[g]),M=(0,J.useMemo)(()=>Zn(b,e.unit),[b,e.unit]),T=(0,J.useMemo)(()=>wr(e.data),[e.data]),[I,N]=(0,J.useState)(null),[A,P]=(0,J.useState)(null),Q=(0,J.useRef)([]),z=(0,J.useRef)(e.onHover);z.current=e.onHover;let U=(0,J.useRef)(e.onClick);U.current=e.onClick;let Y=(0,J.useRef)(null),w=(0,J.useRef)(null),_=(0,J.useRef)(null),k=(0,J.useCallback)((K,xe="pointer")=>{if(_.current!==K){_.current=K;let Pe=K===null?null:Q.current[K]??null;queueMicrotask(()=>z.current?.(Pe)),w.current?.(K)}Y.current=K===null?null:xe,N(K),P(Y.current)},[]),y=(0,J.useCallback)(K=>{Y.current!=="keyboard"&&(Y.current=K===null?null:"sync",N(K),P(Y.current))},[]),C=(0,J.useCallback)(K=>{let xe=Q.current[K];xe&&U.current?.(xe)},[]),E=dr(e.replayKey),W=e.width!==void 0||(a??0)>0,ye={enabled:c,active:d.visible&&W,near:d.near,replayKey:E,dataKey:T,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Te=(0,J.useCallback)((K,xe=1)=>I===null||I===K?xe:xe*.38,[I]);return{p:n,width:s,height:u,measured:W,responsive:e.width===void 0,pending:we&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:ye,fv:M,fmt:b,pct:S,locale:g,lang:h,t:h==="ko"?Gn:Kn,active:I,via:A,setActive:k,click:C,events:Q,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Te,sig:T,description:e.description,reduced:f,publish:w,applySync:y}}var q=D(ee(),1);function Ri(e){return 1-Math.pow(1-e,3)}function Fi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Di(e){return e==="easeInOut"?Fi:e==="linear"?t=>t:Ri}function Pi(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function Ge(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function At(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 wo(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 vo(e,t,n,r){if(!t||!n||t.length!==n.length)return Ge(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of Ge(s,n[i]))o.push(l)}return o.length===r?o:Ge(e,r)}var Nt=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||!At(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),wo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=At(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=vo(s.cur,s.parts,i.parts,u),s.vel=vo(s.curVel,s.parts,i.parts,u),s.parts=i.parts,s.to=i.to.slice(),wo(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=At(s.from,s.to)&&s.vel.every(f=>Math.abs(f)<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=At(u.from,u.to),this.tracks.set(i.key,u)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=Ge(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Di(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,u=s.to.length;if(s.from.length!==u&&(s.from=Ge(s.from,u)),s.vel.length!==u&&(s.vel=Ge(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let f;if(this.easing==="spring"){let c=Math.exp(-a*l),d=a*l>=8&&a*l<20,g=0;for(let h=0;h<u;h++){let b=s.from[h]-s.to[h],S=s.vel[h]+a*b;s.cur[h]=s.to[h]+(b+S*l)*c,s.curVel[h]=(s.vel[h]-a*S*l)*c,d&&g<.15&&(g=Math.max(g,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/a)))}f=a*l>=20||d&&g<.15,s.progress=Math.min(1,1-(1+a*l)*c)}else{let c=Math.min(1,l/o),d=r(c),g=Pi(this.easing,c)/o;for(let h=0;h<u;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*d,s.curVel[h]=(s.to[h]-s.from[h])*g;f=c>=1,s.progress=d}if(f){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}},tt=new Set,Rt=0;function Co(e){Rt=0;let t=Array.from(tt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||tt.delete(n)}tt.size&&typeof requestAnimationFrame<"u"&&(Rt=requestAnimationFrame(Co))}function $o(e){return tt.add(e),!Rt&&typeof requestAnimationFrame<"u"&&(Rt=requestAnimationFrame(Co)),()=>{tt.delete(e)}}function Li(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 Mo(e,t){let n=(0,q.useMemo)(()=>Li(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:u=900,stagger:f=0}=t,c=(0,q.useRef)(null),d=(0,q.useRef)("init"),g=(0,q.useRef)(null),h=(0,q.useRef)(s),b=(0,q.useRef)(i),S=(0,q.useRef)(!1),M=(0,q.useRef)(0),[,T]=(0,q.useState)(0),I=(0,q.useRef)(null),N=(0,q.useRef)(!0);c.current||(c.current=new Nt,c.current.configure(l,u),c.current.snap(n),g.current=n);let A=c.current;if(A.configure(l,u),g.current!==n){let w=d.current,_=!Object.is(h.current,s);A.sameTargets(n)?A.refreshData(n):!r||w==="init"?A.snap(n):w==="idle"?A.hold(n):w==="running"||_?A.update(n,ct(),f):A.snap(n),g.current=n,h.current=s}let P=(0,q.useRef)(()=>!1);P.current=w=>{if(!N.current)return!1;let _=A.step(w);return!_&&d.current==="running"&&(d.current="done"),T(k=>(k+1)%1e9),_||(I.current=null),_};let Q=(0,q.useCallback)(()=>{if(!we||I.current||!A.animating)return;let w=_=>P.current(_);I.current=$o(w)},[A]);pe(()=>{let w=!Object.is(b.current,i);if(b.current=i,!r){(d.current!=="done"||A.animating)&&(A.snap(g.current??n),d.current="done",T(_=>_+1));return}d.current==="init"||w&&a?(A.hold(g.current??n),d.current="idle",S.current=!1,T(_=>_+1)):w&&(S.current=!0)},[r,i]),pe(()=>{!r||!a||!S.current||(S.current=!1,A.hold(g.current??n),d.current="idle",T(w=>w+1))},[a,r]),(0,q.useEffect)(()=>{r&&o&&d.current==="idle"&&(A.start(ct()),M.current+=1,d.current="running",Q(),T(w=>w+1))},[r,o,i,A,Q]),(0,q.useEffect)(()=>{A.animating&&Q()}),(0,q.useEffect)(()=>(N.current=!0,()=>{N.current=!1,I.current?.(),I.current=null}),[]);let z=ct(),U=A.elapsed(z),Y=r&&d.current==="idle";return{items:A.items(),get:w=>A.get(w),elapsed:Y?0:U,fade:(w,_=320)=>Y?0:Number.isFinite(U)?Math.max(0,Math.min(1,(U-w)/_)):1,waiting:Y,animating:A.animating,generation:M.current}}function To(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 f=e[l][u];return Number.isFinite(f)&&f>0?f: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 f=0,c=0;for(let d=0;d<n;d++){let g=i(d,u),h=g-i(d,u-1),b=0;for(let S=0;S<d;S++)b+=i(S,u)-i(S,u-1);f+=g,c+=(h/2+b)*g}f&&(l-=c/f),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,d=0;for(let g=0;g<n;g++){let h=e[g][l],b=Number.isFinite(h)?h:0;b>=0?(o[g][l]=c,c+=b,a[g][l]=c):(o[g][l]=d,d+=b,a[g][l]=d)}continue}let u=0;for(let c=0;c<n;c++)u+=i(c,l);let f=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let d=i(c,l);t==="expand"&&(d=u?d/u*100:0),o[c][l]=f,f+=d,a[c][l]=f}}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 f=0;for(let c=0;c<r;c++)f+=((o[0]?.[c]??0)+(a[n-1]?.[c]??0))/2;f/=r;for(let c=0;c<n;c++)for(let d=0;d<r;d++)o[c][d]-=f,a[c][d]-=f}return{y0:o,y1:a}}var re=D(ee(),1);var B=D(G(),1),Ei={kind:"Bar chart",desc:(e,t,n)=>`${Be(e,"category","categories")}${t>1?`, ${t} series (${n})`:""}`,lines:e=>`, ${e.length>1?"lines":"line"}: ${e.join(", ")}`},_i={en:Ei,ko:{kind:"막대 차트",desc:(e,t,n)=>`${e}개 범주${t>1?`, 계열 ${t}개(${n})`:""}`,lines:e=>`, 선: ${e.join(", ")}`}};function Ft(e){let t=e.orientation==="horizontal",n=ko(e,{height:m=>t?Math.max(180,Math.min(320,m*.5)):Math.max(200,Math.min(290,m*.52)),duration:750,stagger:60}),{p:r,width:o,height:a}=n,i=e.layout??"grouped",s=(0,re.useMemo)(()=>xn(e.data,e.x,e.y,e.series,{xType:"band",locale:n.locale,aggregate:e.aggregate}),[e.data,e.x,e.y,e.series,n.locale,e.aggregate]),l=(0,re.useMemo)(()=>{if(!e.sort||s.series.length!==1)return s;let m=s.keys.map((p,v)=>v).sort((p,v)=>(s.values[0][v]||0)-(s.values[0][p]||0));return{...s,keys:m.map(p=>s.keys[p]),labels:m.map(p=>s.labels[p]),xnum:m.map((p,v)=>v),values:[m.map(p=>s.values[0][p])],rows:[m.map(p=>s.rows[0][p])]}},[s,e.sort]),u=l.series.length===1,f=u?"":e.hidden?.join("")??"",[c,d]=(0,re.useMemo)(()=>fo(l,f),[l,f]),g=c.series.length,h=!!e.line?.length&&!t&&i!=="percent",b=(0,re.useMemo)(()=>h?xn(e.data,e.x,Array.isArray(e.line)?e.line:[e.line],void 0,{xType:"band",locale:n.locale,aggregate:e.series===void 0?e.aggregate:"mean"}):null,[h,e.data,e.x,e.line,e.series,e.aggregate,n.locale]),S=(0,re.useMemo)(()=>new Map((b?.keys??[]).map((m,p)=>[m,p])),[b]),M=(m,p)=>{let v=S.get(c.keys[p]);return b&&v!==void 0?b.values[m][v]:Number.NaN},T=(0,re.useMemo)(()=>{if(u)return Ce(e.highlight,l.rows[0],l.labels,l.values[0],h?"none":"max");let m=l.values.map(p=>p.reduce((v,R)=>v+(Number.isFinite(R)?R:0),0));return Ce(e.highlight,l.series,l.series,m,h?"none":"first")},[l,u,e.highlight,h]),I=(0,re.useMemo)(()=>u?pr(r,l.keys.length,T):hr(r,l.series.length,T),[u,r,l.keys.length,T,l.series.length]),N=(0,re.useMemo)(()=>c===l?T:new Set(d.flatMap((m,p)=>T.has(m)?[p]:[])),[c,l,T,d]),A=(0,re.useMemo)(()=>c===l?I:d.map(m=>I[m]),[c,l,I,d]),P=(0,re.useMemo)(()=>{let m=[],p=i==="grouped"?null:To(c.values,i==="percent"?"expand":"zero");return c.keys.forEach((v,R)=>{c.series.forEach((L,F)=>{let H=c.values[F][R];if(!Number.isFinite(H))return;let ne=p?p.y0[F][R]:0,Ie=p?p.y1[F][R]:H;m.push({key:`${v}|${L}`,k:R,s:F,cat:c.labels[R],series:L,value:H,v0:ne,v1:Ie,sw:u?A[R]:A[F],hi:u?N.has(R):N.has(F)})})}),m},[c,i,A,u,N]),Q=P.flatMap(m=>[m.v0,m.v1]),z=t?void 0:e.annotations;if(i!=="percent"&&Q.push(...Zr(z)),b)for(let m of b.values)for(let p of m)Number.isFinite(p)&&Q.push(p);let[U,Y]=co(Q.length?Q:[0,1]),w=i==="percent"?[0,100]:uo(U,Y,t?Math.max(2,Math.round(o/120)):Math.max(2,Math.round(a/70))),_=i==="percent"?m=>`${m}%`:er(e.format,n.locale,Math.max(Math.abs(w[0]),Math.abs(w[1]))),k=n.showLabels&&(u||i!=="grouped"||g<=3),y=m=>i==="percent"?n.pct(m.v1-m.v0):n.fmt(m.value),C=t?Math.min(o*.32,Math.max(...c.labels.map(m=>se(m,11.5,600)),24)+10):0,E=t&&k&&i!=="percent"?Math.max(...P.map(m=>se(y(m),11,700)),0)+10:0,W=Mt(w,[0,1]).ticks(t?Math.max(2,Math.round(o/130)):Math.max(2,Math.round(a/70))),ye=t?C+6:Yr(W,_,n.locale),Te=t?4:k?16:8,K=t?18:22,xe=!t&&k&&U<0&&(u||i==="grouped")?16:0,Pe=t?ye:ye+4,rt=t?o-Math.max(8,E):o-2,X=t?Tt(c.keys,[Te,a-K],.3,.12):Tt(c.keys,[Pe,rt],g>1&&i==="grouped"?.24:.32,.12),te=t?Mt(w,[Pe,rt]):Mt(w,[a-K-xe,Te]),ke=i==="grouped"&&g>1?Tt(c.series,[0,X.bandwidth],.12,0):null,Se=Math.min(r.theme.radiusMark,(ke?ke.bandwidth:X.bandwidth)/4),ot=m=>X(c.keys[m])+X.bandwidth/2,Dt=m=>r.paint(kn(m)),Mn=Qr(z),Tn=Mn===void 0?-1:X.index(String(Mn)),Sn={p:r,lang:n.lang,xAt:m=>{let p=X.index(String(m));return p<0?null:X(c.keys[p])+X.bandwidth/2},half:X.step/2,edge:!0,y:te,x0:Pe,x1:rt,top:Te,bottom:a-K,points:()=>{if(i==="percent")return[];let m=[...N][0]??0;return c.keys.map((p,v)=>{let R=u?c.values[0][v]:i==="grouped"?c.values[m][v]:c.values.reduce((L,F)=>L+(Number.isFinite(F[v])?F[v]:0),0);return{x:X(p)+(ke?ke(c.series[m])+ke.bandwidth/2:X.bandwidth/2),y:te(R)}})}},Pt=m=>{let p=X(c.keys[m.k])+(ke?ke(m.series):0),v=ke?ke.bandwidth:X.bandwidth,R=te(m.v0),L=te(m.v1);return{pos:p,th:v,a:R,b:L}},An=(0,re.useMemo)(()=>u&&!t&&k?new Set(hn(P.map(m=>X(c.keys[m.k])+X.bandwidth/2),P.map(y),X.bandwidth<26?10:11,4,500,new Set(P.flatMap((m,p)=>m.hi?[p]:[])))):null,[P,u,t,k,i,o,a,n.fmt]),Ue=i==="grouped"||g===1,Nn=(m,p,v,R,L,F,H)=>{if(g===1?An!==null&&!An.has(p):R<H*.8)return null;let ne={x:v+R/2,y:m.v1<m.v0||m.value<0?Math.max(L,F)+8:Math.min(L,F)-8,size:R<26?10:11},Ie=ot(m.k);return b&&Math.abs(Ie-ne.x)<H/2+5&&b.series.some((_t,It)=>Math.abs(te(M(It,m.k))-ne.y)<ne.size/2+6)?null:ne},Rn=[];k&&!t&&z?.length&&Ue&&P.forEach((m,p)=>{let{pos:v,th:R,a:L,b:F}=Pt(m),H=se(y(m),11,700),ne=Nn(m,p,v,R,L,F,H);ne&&Rn.push({x:ne.x-H/2-1,y:ne.y-ne.size/2-1,w:H+2,h:ne.size+2})});let at=n.motion.stagger??60,Oo=(0,re.useMemo)(()=>P.map(m=>{let p=Pt(m),v=te(Math.max(w[0],Math.min(0,w[1])));return{key:m.key,to:[p.pos,p.th,p.a,p.b],from:[p.pos,p.th,i==="grouped"?v:p.a,i==="grouped"?v:p.a],enter:[p.pos,p.th,p.a,p.a],delay:m.k*at+m.s*(i==="grouped"?30:70),data:m}}),[P,o,a,w[0],w[1],at,i,t]),Lt=Mo(Oo,n.motion),Ye=(0,re.useMemo)(()=>{let m=[];return b?.series.forEach((p,v)=>c.keys.forEach((R,L)=>{let F=S.get(R);F===void 0||!Number.isFinite(b.values[v][F])||m.push({li:v,k:L,name:p,value:b.values[v][F],datum:b.rows[v][F]})})),m},[b,S,c]),Fn=P.map((m,p)=>({datum:c.rows[m.s]?.[m.k]??null,index:p,key:m.key,label:m.cat,series:m.series||void 0,value:m.value,formatted:`${n.fv(m.value)}${i==="percent"?` (${n.pct(m.v1-m.v0)})`:""}`}));Ye.forEach((m,p)=>Fn.push({datum:m.datum,index:P.length+p,key:`${c.keys[m.k]}|${m.name}`,label:c.labels[m.k],series:m.name,value:m.value,formatted:n.fv(m.value)}));let Bo=new Map(P.map((m,p)=>[m.key,p])),Dn=(0,re.useMemo)(()=>{let m=[...P,...Ye].map(p=>p.k);return{keys:m.map(p=>ho(c.keys[p])),labels:m.map(p=>c.labels[p])}},[P,Ye,c]);Wn(n,e.syncId,Dn.keys,Dn.labels);let Pn=n.active!==null&&n.active>=P.length?Ye[n.active-P.length]??null:null,Le=n.active!==null?Pn?.k??P[n.active]?.k??null:null,Et=null;if(b&&Le!==null){let m=Le,p=P[n.active??-1],v=typeof e.y=="string"?e.y:n.t.value,R=[...c.series.map((F,H)=>({label:F||v,value:Number.isFinite(c.values[H][m])?n.fv(c.values[H][m]):"-",color:(u?A[m]:A[H]).fill,strong:p?.s===H})),...b.series.map((F,H)=>({label:F,value:Number.isFinite(M(H,m))?n.fv(M(H,m)):"-",color:Dt(H),strong:Pn?.li===H}))],L=[...P.filter(F=>F.k===m).map(F=>Math.min(te(F.v0),te(F.v1))),...b.series.map((F,H)=>te(M(H,m))).filter(Number.isFinite)];Et={x:ot(m),y:Math.min(...L),title:c.labels[m],rows:R}}else if(n.active!==null&&P[n.active]){let m=P[n.active],p=Pt(m),v=g>1?c.series.map((R,L)=>({label:R,value:Number.isFinite(c.values[L][m.k])?n.fv(c.values[L][m.k]):"-",color:A[L].fill,strong:L===m.s})):[{label:n.t.value,value:n.fv(m.value),color:m.sw.fill}];Et=t?{x:Math.max(p.a,p.b),y:p.pos,title:m.cat,rows:v}:{x:p.pos+p.th/2,y:Math.min(p.a,p.b),title:m.cat,rows:v}}let it=_i[n.lang],Ln=`${it.kind}. ${it.desc(c.keys.length,g,c.series.join(", "))}${b?it.lines(b.series):""}. ${u?c.labels.map((m,p)=>`${m} ${n.fv(c.values[0][p])}`).slice(0,8).join(", "):""}`,zo=e.description??(z?.length?`${Ln.trimEnd().replace(/\.?$/,".")}${so(z,n.lang,n.fv)}`:Ln);return(0,B.jsxs)(jr,{c:n,kind:it.kind,ariaLabel:e.ariaLabel,description:zo,events:Fn,tip:Et,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[t?(0,B.jsx)("g",{"aria-hidden":"true",children:W.map(m=>(0,B.jsxs)("g",{children:[(0,B.jsx)("line",{x1:Math.round(te(m))+.5,x2:Math.round(te(m))+.5,y1:Te,y2:a-K,stroke:r.paint(m===0?"dim":"line")}),(0,B.jsx)(ie,{x:te(m),y:a-K+11,anchor:"middle",size:Me,fill:r.paint("muted"),children:_(m)})]},m))}):(0,B.jsx)(Xr,{p:r,ticks:W,y:te,x0:ye,x1:o,fmt:_,locale:n.locale}),(0,B.jsx)(oo,{list:z,g:Sn}),Lt.items.map(m=>{let p=m.data,[v,R,L,F]=m.v,H=Bo.get(p.key)??0,ne=p.v1<p.v0||p.value<0,Ie=i==="grouped"||p.s===g-1,_t=t?Ie?ne?{tl:Se,bl:Se}:{tr:Se,br:Se}:{}:Ie?ne?{bl:Se,br:Se}:{tl:Se,tr:Se}:{},It=t?Qe(Math.min(L,F),v,Math.abs(F-L),R,_t):Qe(v,Math.min(L,F),R,Math.abs(F-L),_t),Ot=Lt.fade(p.k*at+320,260),En=Tn>=0&&p.k>=Tn,Bt=En&&Ue,zt=null;if(k){let Oe=y(p),Ht=se(Oe,11,700),Ho=Math.abs(F-L);if(Ue){let st=t?null:Nn(p,H,v,R,L,F,Ht);zt=t?(0,B.jsx)(ie,{x:Math.max(L,F)+6,y:v+R/2,size:11,weight:p.hi?800:500,fill:r.paint(p.hi?"ink":"muted"),opacity:Ot,children:Oe}):st?(0,B.jsx)(ie,{x:st.x,y:st.y,anchor:"middle",size:st.size,weight:p.hi?800:500,fill:r.paint(p.hi?"ink":"muted"),opacity:Ot,children:Oe}):null}else Ho>=(t?Ht+10:16)&&(t?R>=14:R>=Ht+6)&&(zt=(0,B.jsx)(ie,{x:t?(L+F)/2:v+R/2,y:t?v+R/2:(L+F)/2,anchor:"middle",size:11,weight:700,fill:p.sw.text,opacity:Ot,children:Oe}))}return(0,B.jsxs)("g",{className:"ztd-mark",opacity:m.exiting?.4:Le===null||Le===p.k?1:.38,onPointerEnter:Oe=>n.setActive(H,Oe.pointerType==="touch"?"touch":"pointer"),onClick:()=>n.click(H),style:{cursor:e.onClick?"pointer":void 0},children:[Ue?t?(0,B.jsx)("rect",{x:Pe,y:v,width:Math.max(0,rt-Pe),height:R,fill:"transparent"}):(0,B.jsx)("rect",{x:v,y:Te,width:R,height:Math.max(0,a-K-Te),fill:"transparent"}):null,(0,B.jsx)("path",{d:It,fill:p.sw.fill,fillOpacity:En?.42:void 0,stroke:Bt?p.sw.fill:Ue?"none":r.paint("panel"),strokeWidth:Bt?1.2:1,strokeDasharray:Bt?"3 2":void 0}),n.active===H&&n.via==="keyboard"?(0,B.jsx)("path",{d:t?Qe(Math.min(L,F)-2,v-2,Math.abs(F-L)+4,R+4,4):Qe(v-2,Math.min(L,F)-2,R+4,Math.abs(F-L)+4,4),fill:"none",stroke:r.paint("ink"),strokeWidth:2}):null,zt]},m.key)}),b?(0,B.jsxs)("g",{opacity:Lt.fade((c.keys.length-1)*at+320,320),children:[b.series.map((m,p)=>(0,B.jsx)("path",{d:Ii(c.keys.map((v,R)=>[ot(R),te(M(p,R))])),fill:"none",stroke:Dt(p),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"},m)),Ye.map((m,p)=>{let v=P.length+p,R=ot(m.k),L=te(m.value);return(0,B.jsxs)("g",{className:"ztd-mark",onPointerEnter:F=>n.setActive(v,F.pointerType==="touch"?"touch":"pointer"),onClick:()=>n.click(v),style:{cursor:e.onClick?"pointer":void 0},children:[(0,B.jsx)("circle",{cx:R,cy:L,r:9,fill:"transparent"}),(0,B.jsx)("circle",{cx:R,cy:L,r:n.active===v?4.5:3,fill:Dt(m.li),stroke:r.paint("panel"),strokeWidth:1.5}),n.active===v&&n.via==="keyboard"?(0,B.jsx)("circle",{cx:R,cy:L,r:8,fill:"none",stroke:r.paint("ink"),strokeWidth:2}):null]},`${c.keys[m.k]}|${m.name}`)})]}):null,(0,B.jsx)(io,{list:z,g:{...Sn,avoid:Rn}}),t?(0,B.jsx)("g",{"aria-hidden":"true",children:c.keys.map((m,p)=>{let v=u&&N.has(p);return(0,B.jsx)(ie,{x:C,y:X(m)+X.bandwidth/2,anchor:"end",size:11.5,weight:v?800:500,fill:r.paint(v?"ink":"muted"),children:ge(c.labels[p],C-4,11.5,v?800:500)},m)})}):(0,B.jsx)(qr,{p:r,width:o,labels:c.labels,centers:c.keys.map(m=>X(m)+X.bandwidth/2),y:a-K+13,strong:u?N:void 0}),!t&&Le!==null?(0,B.jsx)(Jr,{p:r,x:X(c.keys[Le])+X.bandwidth/2,y:a-K+13,label:c.labels[Le],width:o}):null]})}function Ii(e){let t=e.map(n=>n[1]);return lo(t,t).map(([n,r])=>Br(e.slice(n,r+1))).join("")}var kn=e=>e?"neutralStrong":"accent";var wn=D(G(),1);function So(e,t,n,r){if(typeof e!="function")return Ce(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Oi=D(ee(),1);var Cn=D(G(),1),Bi={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}, ${Be(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Ao={en:Bi,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}일 이동평균`}},vn=["ink","muted","dim"];function No(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,vn.length)}var zi=D(ee(),1);var Po=D(G(),1),Hi={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Be(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Vi={en:Hi,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ro=(e,t)=>Vi[e].other(t);function Fo(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,Or(o.map(a=>a.value)))}}var Do=e=>Number.isFinite(e)&&e>0?e:0;var De=D(G(),1);function Lo(e,t){let n=wt(e);return n?.type==="scatter"&&t?.size!==void 0?wt("bubble"):n}function ji(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 Wi(e,t,n,r=!1){let o=Lo(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&dn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),u=c=>c.filter(d=>!l.has(d.label)),f=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(f.includes(o.type)){let c=kt(a.label,"label"),d=yr(a.value,"value"),g=o.type==="waffle",h=t.map((N,A)=>({r:N,label:c(N,A),value:g?d(N,A):Do(d(N,A))})),{kept:b,other:S}=g?{kept:h,other:null}:Fo(h,i.other,(N,A)=>({r:{},label:Ro(Z(n),N),value:A})),M=Ce(s,b.map(N=>N.r),b.map(N=>N.label),b.map(N=>N.value),g?"first":"max"),T=S?[...b,S]:b,I=Ze(T.length,M);return T.map((N,A)=>({label:N.label,color:I[A]}))}if(o.type==="candlestick"){let c=No(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Ao[Z(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...c.map((g,h)=>({label:d.maLegend(g),color:vn[h],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let c=kt(a.series,"series"),d=We(t.map((h,b)=>c(h,b)));if(d.length<2)return[];let g=gr(d.length,So(s,t,d,c));return u(d.map((h,b)=>({label:h,color:g[b],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 b=kt(a.series,"series");c=We(t.map((S,M)=>b(S,M)))}let d=fn(o.type,a,i);if(d.length){let b=Ze(c.length,Ce(s,c,c,c.map(()=>0),"none")),S=c.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:c.map((M,T)=>({label:M,color:b[T]}));return[...u(S),...d.map((M,T)=>({label:M,color:kn(T),shape:"line"}))]}if(c.length<2)return[];let g=Ce(s,c,c,c.map(()=>0),"first");if(o.type==="line"||o.type==="radar")return u(c.map((b,S)=>({label:b,color:g.has(S)?"accent":"neutralStrong",shape:o.type==="line"?"line":"square"})));let h=Ze(c.length,g);return u(c.map((b,S)=>({label:b,color:h[S]})))}return[]}function Eo(e,t){let{spec:n}=e,r=Lo(n.type,n.encoding),o=(0,nt.useMemo)(()=>Hr(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Lr(n,e.locale),s=fe(i),l=Z(s),u=vr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),f=_r(n),c=(0,nt.useMemo)(()=>f?Nr(f,s):void 0,[f,s]),d=n.options?.hidden,g=Array.isArray(d)?d.map(String):[],h=g.join(""),[b,S]=(0,nt.useState)(null);if(!r)return(0,De.jsx)(ln,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let M=o??u.data,T=t[r.type],I={...n.options??{}},N={...ji(r,n.encoding),...I,...c?{tooltip:c}:{},data:M,...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},A=n.card?.legend==="toggle"&&Er(r.type,n.encoding??{},I),P=b&&b.base===h?b.hidden:g;A&&(N.hidden=P);let Q=w=>S(_=>{let k=_&&_.base===h?_.hidden:g;return{base:h,hidden:k.includes(w)?k.filter(y=>y!==w):[...k,w]}}),z=N.height??220,U=a&&!M.length&&(u.loading||u.error||u.empty)?(0,De.jsx)(ln,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:z,locale:i}):(0,De.jsx)(T,{...N});if(n.card){let w=n.card,_=w.legend==="auto"||w.legend==="toggle"?Wi(n,M,s,A):w.legend,k=_?.length?A?(0,De.jsx)(sn,{items:_,hidden:P,onToggle:Q,locale:i}):_:void 0,y=w.download?(0,De.jsx)(Ar,{data:M,columns:Ir(n),filename:w.title??r.type,formats:Array.isArray(w.download)?w.download:void 0,locale:i}):void 0;U=(0,De.jsx)(fr,{number:w.number,title:w.title??Pr(r,l),subtitle:w.subtitle,legend:k,actions:y,source:w.source||void 0,note:w.note||void 0,accent:w.accent,takeaway:w.takeaway,level:w.level,sample:w.sample,replay:w.replay!==!1,className:e.className,locale:i,children:U})}let Y=e.theme??n.theme;return Y&&(U=(0,De.jsx)(bt,{theme:Y,children:U})),U}function Ki({cfg:e,components:t}){let n=St();return Eo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Io(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,_o.hydrateRoot)(r,(0,$n.createElement)(bt,{theme:o.theme,cssVars:!0},(0,$n.createElement)(Ki,{cfg:o,components:{[e]:t}})))}Io("bar",Ft);})();
27
+ `}function il(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function ar(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var oi=2,Ye=16;function ii(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 ai(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 si(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+Ye*2,a+Ye*2],c=o.cloneNode(!0),f=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((m,b)=>{let M;for(let w of Array.from(m.attributes)){if(!nl.test(w.value))continue;let v=(M??(M=getComputedStyle(m))).getPropertyValue(w.name);v&&f[b].setAttribute(w.name,ii(v,u))}}),c.removeAttribute("style");for(let[m,b]of Object.entries({viewBox:`${-Ye} ${-Ye} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(m,String(b));let d=ii(getComputedStyle(r).backgroundColor,u),g=o.parentElement?.querySelector("canvas")??null;if(n){let m=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(ai("rect",{x:-Ye,y:-Ye,width:s,height:l,fill:d}),m),g&&c.insertBefore(ai("image",{href:g.toDataURL(),width:i,height:a}),m)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:d,canvas:g}}function al(e,t){let n=si(e,oi,!1);if(!n)return;let r=oi,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,Ye*r,Ye*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&&ar(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function li(e){let t=Se(e.theme),n=te(pe(e.locale))==="ko",r=il(e.filename),o=(i,a)=>{if(i==="csv")return ar(new Blob([ol(e.data,e.columns?.length?e.columns:rl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return al(a,r);let s=si(a,1,!0);s&&ar(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,sr.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:el.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,sr.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 ui=P(W(),1);function ci(e,t=fe){let n=Je(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?$t(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(Qr,(f,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,ui.jsx)("div",{children:s},l)):null}}function mi(e,t,n=!1){let r=Be(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Ae(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function di(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Ze(t.csv)}return null}var ki=P(ee(),1);function fi(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}var re=P(ee(),1);function hi(e,t){let n=Se(e.theme),[r,o,i]=gn(e.width),a=mt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,f=pn(e.reducedMotion??"auto"),u=e.animate!==!1&&!f&&Me,d=Qo(r,e.animateOnView!==!1&&u),g=pe(e.locale),m=te(g),b=(0,re.useMemo)(()=>Je(e.format,g,t.format),[e.format,g,t.format]),M=(0,re.useCallback)(K=>Kt(K,{locale:g}),[g]),w=(0,re.useMemo)(()=>Ut(b,e.unit),[b,e.unit]),v=(0,re.useMemo)(()=>an(e.data),[e.data]),[$,D]=(0,re.useState)(null),[x,L]=(0,re.useState)(null),z=(0,re.useRef)([]),B=(0,re.useRef)(e.onHover);B.current=e.onHover;let E=(0,re.useRef)(e.onClick);E.current=e.onClick;let I=(0,re.useRef)(null),S=(0,re.useRef)(null),R=(0,re.useRef)(null),C=(0,re.useCallback)((K,le="pointer")=>{if(R.current!==K){R.current=K;let ce=K===null?null:z.current[K]??null;queueMicrotask(()=>B.current?.(ce)),S.current?.(K)}I.current=K===null?null:le,D(K),L(I.current)},[]),k=(0,re.useCallback)(K=>{I.current!=="keyboard"&&(I.current=K===null?null:"sync",D(K),L(I.current))},[]),N=(0,re.useCallback)(K=>{let le=z.current[K];le&&E.current?.(le)},[]),H=oo(e.replayKey),G=e.width!==void 0||(i??0)>0,de={enabled:u,active:d.visible&&G,near:d.near,replayKey:H,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Re=(0,re.useCallback)((K,le=1)=>$===null||$===K?le:le*.38,[$]);return{p:n,width:s,height:c,measured:G,responsive:e.width===void 0,pending:Me&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:de,fv:w,fmt:b,pct:M,locale:g,lang:m,t:m==="ko"?Ir:Or,active:$,via:x,setActive:C,click:N,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Re,sig:v,description:e.description,reduced:f,publish:S,applySync:k}}var ne=P(ee(),1);function sl(e){return 1-Math.pow(1-e,3)}function ll(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function cl(e){return e==="easeInOut"?ll:e==="linear"?t=>t:sl}function ul(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 ft(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 bn(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 gi(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 pi(e,t,n,r){if(!t||!n||t.length!==n.length)return ft(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 ft(s,n[a]))o.push(l)}return o.length===r?o:ft(e,r)}var yn=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||!bn(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),gi(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=bn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=pi(s.cur,s.parts,a.parts,c),s.vel=pi(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),gi(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=bn(s.from,s.to)&&s.vel.every(f=>Math.abs(f)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=bn(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=ft(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=cl(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=ft(s.from,c)),s.vel.length!==c&&(s.vel=ft(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let f;if(this.easing==="spring"){let u=Math.exp(-i*l),d=i*l>=8&&i*l<20,g=0;for(let m=0;m<c;m++){let b=s.from[m]-s.to[m],M=s.vel[m]+i*b;s.cur[m]=s.to[m]+(b+M*l)*u,s.curVel[m]=(s.vel[m]-i*M*l)*u,d&&g<.15&&(g=Math.max(g,Math.abs(s.cur[m]-s.to[m]),Math.abs(s.curVel[m]/i)))}f=i*l>=20||d&&g<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),d=r(u),g=ul(this.easing,u)/o;for(let m=0;m<c;m++)s.cur[m]=s.from[m]+(s.to[m]-s.from[m])*d,s.curVel[m]=(s.to[m]-s.from[m])*g;f=u>=1,s.progress=d}if(f){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Nt=new Set,xn=0;function bi(e){xn=0;let t=Array.from(Nt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Nt.delete(n)}Nt.size&&typeof requestAnimationFrame<"u"&&(xn=requestAnimationFrame(bi))}function yi(e){return Nt.add(e),!xn&&typeof requestAnimationFrame<"u"&&(xn=requestAnimationFrame(bi)),()=>{Nt.delete(e)}}function ml(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 xi(e,t){let n=(0,ne.useMemo)(()=>ml(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:f=0}=t,u=(0,ne.useRef)(null),d=(0,ne.useRef)("init"),g=(0,ne.useRef)(null),m=(0,ne.useRef)(s),b=(0,ne.useRef)(a),M=(0,ne.useRef)(!1),w=(0,ne.useRef)(0),[,v]=(0,ne.useState)(0),$=(0,ne.useRef)(null),D=(0,ne.useRef)(!0);u.current||(u.current=new yn,u.current.configure(l,c),u.current.snap(n),g.current=n);let x=u.current;if(x.configure(l,c),g.current!==n){let S=d.current,R=!Object.is(m.current,s);x.sameTargets(n)?x.refreshData(n):!r||S==="init"?x.snap(n):S==="idle"?x.hold(n):S==="running"||R?x.update(n,Ht(),f):x.snap(n),g.current=n,m.current=s}let L=(0,ne.useRef)(()=>!1);L.current=S=>{if(!D.current)return!1;let R=x.step(S);return!R&&d.current==="running"&&(d.current="done"),v(C=>(C+1)%1e9),R||($.current=null),R};let z=(0,ne.useCallback)(()=>{if(!Me||$.current||!x.animating)return;let S=R=>L.current(R);$.current=yi(S)},[x]);Le(()=>{let S=!Object.is(b.current,a);if(b.current=a,!r){(d.current!=="done"||x.animating)&&(x.snap(g.current??n),d.current="done",v(R=>R+1));return}d.current==="init"||S&&i?(x.hold(g.current??n),d.current="idle",M.current=!1,v(R=>R+1)):S&&(M.current=!0)},[r,a]),Le(()=>{!r||!i||!M.current||(M.current=!1,x.hold(g.current??n),d.current="idle",v(S=>S+1))},[i,r]),(0,ne.useEffect)(()=>{r&&o&&d.current==="idle"&&(x.start(Ht()),w.current+=1,d.current="running",z(),v(S=>S+1))},[r,o,a,x,z]),(0,ne.useEffect)(()=>{x.animating&&z()}),(0,ne.useEffect)(()=>(D.current=!0,()=>{D.current=!1,$.current?.(),$.current=null}),[]);let B=Ht(),E=x.elapsed(B),I=r&&d.current==="idle";return{items:x.items(),get:S=>x.get(S),elapsed:I?0:E,fade:(S,R=320)=>I?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-S)/R)):1,waiting:I,animating:x.animating,generation:w.current}}var lr=P(W(),1);function wi(e,t,n,r,o){if(r)return o==="categorical"?ge(e,t,n):Wr(e,t,n);if(o==="categorical")return ge(e,t,n);let i=oe(e,"strong"),a=oe(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var se=P(ee(),1);var j=P(W(),1),dl={kind:"Bar chart",desc:(e,t,n)=>`${Ve(e,"category","categories")}${t>1?`, ${t} series (${n})`:""}`,lines:e=>`, ${e.length>1?"lines":"line"}: ${e.join(", ")}`,sides:(e,t)=>`negative ${e}, positive ${t}`},fl={en:dl,ko:{kind:"막대 차트",desc:(e,t,n)=>`${e}개 범주${t>1?`, 계열 ${t}개(${n})`:""}`,lines:e=>`, 선: ${e.join(", ")}`,sides:(e,t)=>`음수 쪽 ${e}, 양수 쪽 ${t}`}},hl=12;function kn(e){let t=e.layout??"grouped",n=t==="diverging",r=e.orientation==="horizontal"||n&&e.orientation===void 0,o=hi(e,{height:h=>r?Math.max(180,Math.min(320,h*.5)):Math.max(200,Math.min(290,h*.52)),duration:750,stagger:60}),{p:i,width:a,height:s}=o,l=(0,se.useMemo)(()=>Xe(e.data,e.x,e.y,e.series,{xType:"band",locale:o.locale,aggregate:e.aggregate}),[e.data,e.x,e.y,e.series,o.locale,e.aggregate]),c=e.negative?.join("")??"",f=(0,se.useMemo)(()=>{if(!n)return null;let h=p=>l.series.indexOf(p);return{negative:(c?c.split(""):[]).map(h).filter(p=>p>=0),neutral:e.neutral===void 0?void 0:h(e.neutral),percent:e.percent===!0}},[n,l.series,c,e.neutral,e.percent]),u=(0,se.useMemo)(()=>{let h=p=>{let T=l.keys.map((A,F)=>F).sort((A,F)=>(p[F]||0)-(p[A]||0));return{...l,keys:T.map(A=>l.keys[A]),labels:T.map(A=>l.labels[A]),xnum:T.map((A,F)=>F),values:l.values.map(A=>T.map(F=>A[F])),rows:l.rows.map(A=>T.map(F=>A[F]))}};if(f&&(e.sort==="positive"||e.sort==="negative")){let p=sn(l.values,f);return h(e.sort==="positive"?p.pos:p.neg)}return!e.sort||l.series.length!==1?l:h(l.values[0])},[l,e.sort,f]),d=u.series.length===1,g=d?"":e.hidden?.join("")??"",[m,b]=(0,se.useMemo)(()=>Wo(u,g),[u,g]),M=m.series.length,w=!!e.line?.length&&!r&&t!=="percent"&&!n,v=(0,se.useMemo)(()=>w?Xe(e.data,e.x,Array.isArray(e.line)?e.line:[e.line],void 0,{xType:"band",locale:o.locale,aggregate:e.series===void 0?e.aggregate:"mean"}):null,[w,e.data,e.x,e.line,e.series,e.aggregate,o.locale]),$=(0,se.useMemo)(()=>new Map((v?.keys??[]).map((h,p)=>[h,p])),[v]),D=(h,p)=>{let T=$.get(m.keys[p]);return v&&T!==void 0?v.values[h][T]:Number.NaN},x=(0,se.useMemo)(()=>{if(d)return ve(e.highlight,u.rows[0],u.labels,u.values[0],w?"none":"max");let h=f&&e.highlight===void 0?ln(u.series.length,f.negative,f.neutral):-1;if(h>=0)return new Set([h]);let p=u.values.map(T=>T.reduce((A,F)=>A+(Number.isFinite(F)?F:0),0));return ve(e.highlight,u.series,u.series,p,w?"none":"first")},[u,d,e.highlight,w,f]),L=(0,se.useMemo)(()=>d?Wt(i,u.keys.length,x):ge(i,u.series.length,x),[d,i,u.keys.length,x,u.series.length]),z=(0,se.useMemo)(()=>m===u?x:new Set(b.flatMap((h,p)=>x.has(h)?[p]:[])),[m,u,x,b]),B=(0,se.useMemo)(()=>m===u?L:b.map(h=>L[h]),[m,u,L,b]),[E,I]=(0,se.useMemo)(()=>{if(!f)return[null,null];let h=sn(u.values,f);return[b.length===u.series.length?h:sn(u.values,{...f,skip:new Set(u.series.flatMap((p,T)=>b.includes(T)?[]:[T]))}),h]},[f,u,b]),S=(0,se.useMemo)(()=>{let h=[],p=E?{y0:b.map(T=>E.y0[T]),y1:b.map(T=>E.y1[T])}:t==="grouped"?null:Tt(m.values,t==="percent"?"expand":"zero");return m.keys.forEach((T,A)=>{let F=[];if(m.series.forEach((O,V)=>{let Z=m.values[V][A];if(!Number.isFinite(Z))return;let Te=p?p.y0[V][A]:0,Pe=p?p.y1[V][A]:Z;F.push({key:`${T}|${O}`,k:A,s:V,cat:m.labels[A],series:O,value:Z,v0:Te,v1:Pe,sw:d?B[A]:B[V],hi:d?z.has(A):z.has(V)})}),E){F.sort((U,xt)=>Math.min(U.v0,U.v1)-Math.min(xt.v0,xt.v1));let O=Math.min(...F.map(U=>Math.min(U.v0,U.v1))),V=Math.max(...F.map(U=>Math.max(U.v0,U.v1))),Z=U=>U.v0<0&&U.v1>0,Te=F.filter(U=>!Z(U)&&U.v1<U.v0).length,Pe=0,De=0;F.forEach(U=>{U.ring=Z(U)?0:U.v1<U.v0?Te-Pe++:++De,U.endLo=Math.min(U.v0,U.v1)===O,U.endHi=Math.max(U.v0,U.v1)===V})}h.push(...F)}),h},[m,t,B,d,z,E,b]),R=I?[...I.y0.flat(),...I.y1.flat()]:S.flatMap(h=>[h.v0,h.v1]),C=r||n?void 0:e.annotations;if(t!=="percent"&&R.push(...mn(C)),v)for(let h of v.values)for(let p of h)Number.isFinite(p)&&R.push(p);let[k,N]=tt(R.length?R:[0,1]),H=r?Math.max(2,Math.round(a/120)):Math.max(2,Math.round(s/70)),G=t==="percent"?[0,100]:e.yDomain??(n&&k<N?[k,N]:Ue(k,N,H)),de=t==="percent"||n&&e.percent?h=>`${h}%`:Xt(e.format,o.locale,Math.max(Math.abs(G[0]),Math.abs(G[1]))),Re=n?h=>de(Math.abs(h)):de,K=o.showLabels&&(d||t!=="grouped"||M<=3),le=h=>t==="percent"?o.pct(h.v1-h.v0):n?e.percent?o.pct(Math.abs(h.v1-h.v0)):o.fmt(Math.abs(h.value)):o.fmt(h.value),ce=h=>e.percent?o.pct(h):o.fmt(h),he=e.showYAxis!==!1,ht=e.showXAxis!==!1,wn=r&&he?Math.min(a*.32,Math.max(...m.labels.map(h=>ie(h,11.5,600)),24)+10):0,Rt=et(G,[0,1]).ticks(r?Math.max(2,Math.round(a/130)):Math.max(2,Math.round(s/70))),gt=r?wn+6:he?dn(Rt,Re,o.locale):0,je=r?4:K?16:8,_e=r?18:22,ji=I?(r?ut(m.keys,[je,s-_e],.3,.12):ut(m.keys,[gt+4,a-2],.32,.12)).step:0,Gi=I?Math.max(0,...[...I.neg,...I.pos].map(h=>ie(ce(h),11,600))):0,_t=K&&ji>=(r?hl:Gi+4),Vi=E&&_t?m.keys.map((h,p)=>[E.neg[p]>0?ce(E.neg[p]):null,E.pos[p]>0?ce(E.pos[p]):null]):[],hr=h=>I&&_t?Math.max(0,...[I,E??I].flatMap(p=>(h?p.pos:p.neg).map(T=>T>0?ie(ce(T),11,600)+10:0))):0,Wi=r&&K&&t!=="percent"?n?hr(1):Math.max(...S.map(h=>ie(le(h),11,700)),0)+10:0,Ki=!r&&(n?_t:K)&&k<0&&(d||t==="grouped"||n)?16:0,nt=r?gt+(n?hr(0):0):gt+4,Pt=r?a-Math.max(8,Wi):a-2,q=r?ut(m.keys,[je,s-_e],.3,.12):ut(m.keys,[nt,Pt],M>1&&t==="grouped"?.24:.32,.12),Q=r?et(G,[nt,Pt]):et(G,[s-_e-Ki,je]),Ie=t==="grouped"&&M>1?ut(m.series,[0,q.bandwidth],.12,0):null,ue=Math.min(i.theme.radiusMark,(Ie?Ie.bandwidth:q.bandwidth)/4),Dt=h=>q(m.keys[h])+q.bandwidth/2,vn=h=>i.paint(cr(h)),gr=So(C),pr=gr===void 0?-1:q.index(String(gr)),br={p:i,lang:o.lang,xAt:h=>{let p=q.index(String(h));return p<0?null:q(m.keys[p])+q.bandwidth/2},half:q.step/2,edge:!0,y:Q,x0:nt,x1:Pt,top:je,bottom:s-_e,points:()=>{if(t==="percent")return[];let h=[...z][0]??0;return m.keys.map((p,T)=>{let A=d?m.values[0][T]:t==="grouped"?m.values[h][T]:m.values.reduce((F,O)=>F+(Number.isFinite(O[T])?O[T]:0),0);return{x:q(p)+(Ie?Ie(m.series[h])+Ie.bandwidth/2:q.bandwidth/2),y:Q(A)}})}},$n=h=>{let p=q(m.keys[h.k])+(Ie?Ie(h.series):0),T=Ie?Ie.bandwidth:q.bandwidth,A=Q(h.v0),F=Q(h.v1);return{pos:p,th:T,a:A,b:F}},yr=(0,se.useMemo)(()=>d&&!r&&K?new Set(tr(S.map(h=>q(m.keys[h.k])+q.bandwidth/2),S.map(le),q.bandwidth<26?10:11,4,500,new Set(S.flatMap((h,p)=>h.hi?[p]:[])))):null,[S,d,r,K,t,a,s,o.fmt]),rt=t==="grouped"||M===1,xr=(h,p,T,A,F,O,V)=>{if(M===1?yr!==null&&!yr.has(p):A<V*.8)return null;let Z={x:T+A/2,y:h.v1<h.v0||h.value<0?Math.max(F,O)+8:Math.min(F,O)-8,size:A<26?10:11},Te=Dt(h.k);return v&&Math.abs(Te-Z.x)<V/2+5&&v.series.some((Pe,De)=>Math.abs(Q(D(De,h.k))-Z.y)<Z.size/2+6)?null:Z},kr=[];K&&!r&&C?.length&&rt&&S.forEach((h,p)=>{let{pos:T,th:A,a:F,b:O}=$n(h),V=ie(le(h),11,700),Z=xr(h,p,T,A,F,O,V);Z&&kr.push({x:Z.x-V/2-1,y:Z.y-Z.size/2-1,w:V+2,h:Z.size+2})});let pt=o.motion.stagger??60,Ui=(0,se.useMemo)(()=>S.map(h=>{let p=$n(h),T=Q(Math.max(G[0],Math.min(0,G[1]))),A=h.ring===0?Q(0):p.a;return{key:h.key,to:[p.pos,p.th,p.a,p.b],from:[p.pos,p.th,t==="grouped"?T:A,t==="grouped"?T:A],enter:[p.pos,p.th,A,A],delay:h.k*pt+(h.ring??h.s)*(t==="grouped"?30:70),data:h}}),[S,a,s,G[0],G[1],pt,t,r]),Lt=xi(Ui,o.motion),bt=(0,se.useMemo)(()=>{let h=[];return v?.series.forEach((p,T)=>m.keys.forEach((A,F)=>{let O=$.get(A);O===void 0||!Number.isFinite(v.values[T][O])||h.push({li:T,k:F,name:p,value:v.values[T][O],datum:v.rows[T][O]})})),h},[v,$,m]),Et=S.map((h,p)=>({datum:m.rows[h.s]?.[h.k]??null,index:p,key:h.key,label:h.cat,series:h.series||void 0,value:h.value,formatted:`${o.fv(h.value)}${t==="percent"||n&&e.percent?` (${o.pct(Math.abs(h.v1-h.v0))})`:""}`}));bt.forEach((h,p)=>Et.push({datum:h.datum,index:S.length+p,key:`${m.keys[h.k]}|${h.name}`,label:m.labels[h.k],series:h.name,value:h.value,formatted:o.fv(h.value)}));let Xi=new Map(S.map((h,p)=>[h.key,p])),wr=(0,se.useMemo)(()=>{let h=[...S,...bt].map(p=>p.k);return{keys:h.map(p=>Ko(m.keys[p])),labels:h.map(p=>m.labels[p])}},[S,bt,m]);Er(o,e.syncId,wr.keys,wr.labels);let vr=o.active!==null&&o.active>=S.length?bt[o.active-S.length]??null:null,ze=o.active!==null?vr?.k??S[o.active]?.k??null:null,Tn=null;if(v&&ze!==null){let h=ze,p=S[o.active??-1],T=typeof e.y=="string"?e.y:o.t.value,A=[...m.series.map((O,V)=>({label:O||T,value:Number.isFinite(m.values[V][h])?o.fv(m.values[V][h]):"-",color:(d?B[h]:B[V]).fill,strong:p?.s===V})),...v.series.map((O,V)=>({label:O,value:Number.isFinite(D(V,h))?o.fv(D(V,h)):"-",color:vn(V),strong:vr?.li===V}))],F=[...S.filter(O=>O.k===h).map(O=>Math.min(Q(O.v0),Q(O.v1))),...v.series.map((O,V)=>Q(D(V,h))).filter(Number.isFinite)];Tn={x:Dt(h),y:Math.min(...F),title:m.labels[h],rows:A}}else if(o.active!==null&&S[o.active]){let h=S[o.active],p=$n(h),T=M>1?m.series.map((A,F)=>({label:A,value:Number.isFinite(m.values[F][h.k])?o.fv(m.values[F][h.k]):"-",color:B[F].fill,strong:F===h.s})):[{label:o.t.value,value:o.fv(h.value),color:h.sw.fill}];Tn=r?{x:Math.max(p.a,p.b),y:p.pos,title:h.cat,rows:T}:{x:p.pos+p.th/2,y:Math.min(p.a,p.b),title:h.cat,rows:T}}let yt=fl[o.lang],$r=h=>E?`${m.labels[h]}: ${yt.sides(ce(E.neg[h]),ce(E.pos[h]))}`:"",Tr=`${yt.kind}. ${yt.desc(m.keys.length,M,m.series.join(", "))}${v?yt.lines(v.series):""}. ${E?m.keys.map((h,p)=>$r(p)).slice(0,8).join("; "):d?m.labels.map((h,p)=>`${h} ${o.fv(m.values[0][p])}`).slice(0,8).join(", "):""}`,Ot=E&&o.via==="keyboard"&&o.active!==null?S[o.active]:void 0,Yi=Ot?`${$r(Ot.k)}. ${Ot.series?`${Ot.series}: `:""}${Et[o.active??0].formatted} (${(o.active??0)+1}/${Et.length})`:void 0,Ji=h=>{let p=S.filter(T=>T.k===h);return[Math.min(0,...p.map(T=>Math.min(T.v0,T.v1))),Math.max(0,...p.map(T=>Math.max(T.v0,T.v1)))]},qi=e.description??(C?.length?`${Tr.trimEnd().replace(/\.?$/,".")}${Lo(C,o.lang,o.fv)}`:Tr);return(0,j.jsxs)(ao,{c:o,kind:yt.kind,ariaLabel:e.ariaLabel,description:qi,events:Et,tip:Tn,announce:Yi,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[r?(0,j.jsx)("g",{"aria-hidden":"true",children:Rt.map(h=>(0,j.jsxs)("g",{children:[(0,j.jsx)("line",{x1:Math.round(Q(h))+.5,x2:Math.round(Q(h))+.5,y1:je,y2:s-_e,stroke:i.paint(h===0?"dim":"line")}),ht?(0,j.jsx)(me,{x:Q(h),y:s-_e+11,anchor:"middle",size:we,fill:i.paint("muted"),children:Re(h)}):null]},h))}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Io,{p:i,ticks:Rt,y:Q,x0:gt,x1:a,fmt:Re,locale:o.locale,labels:he&&!n}),n&&he?(0,j.jsx)("g",{"aria-hidden":"true",children:Rt.map(h=>(0,j.jsx)(me,{x:gt-6,y:Math.round(Q(h))+.5,anchor:"end",size:we,fill:i.paint("muted"),children:Re(h)},h))}):null]}),(0,j.jsx)(_o,{list:C,g:br}),Lt.items.map(h=>{let p=h.data,[T,A,F,O]=h.v,V=Xi.get(p.key)??0,Z=p.v1<p.v0||p.value<0,Te=t==="grouped"||p.s===M-1,Pe=n?{...p.endLo&&(r?{tl:ue,bl:ue}:{bl:ue,br:ue}),...p.endHi&&(r?{tr:ue,br:ue}:{tl:ue,tr:ue})}:r?Te?Z?{tl:ue,bl:ue}:{tr:ue,br:ue}:{}:Te?Z?{bl:ue,br:ue}:{tl:ue,tr:ue}:{},De=r?Mt(Math.min(F,O),T,Math.abs(O-F),A,Pe):Mt(T,Math.min(F,O),A,Math.abs(O-F),Pe),U=Lt.fade(p.k*pt+320,260),xt=pr>=0&&p.k>=pr,Mn=xt&&rt,Cn=null,Zi=p.ring===1&&(p.v1<p.v0?p.endLo:p.endHi);if(K&&!(n&&(!_t||rt||p.ring===0||Zi))){let ot=le(p),Sn=ie(ot,11,700),Qi=Math.abs(O-F);if(rt){let It=r?null:xr(p,V,T,A,F,O,Sn);Cn=r?(0,j.jsx)(me,{x:Math.max(F,O)+6,y:T+A/2,size:11,weight:p.hi?800:500,fill:i.paint(p.hi?"ink":"muted"),opacity:U,children:ot}):It?(0,j.jsx)(me,{x:It.x,y:It.y,anchor:"middle",size:It.size,weight:p.hi?800:500,fill:i.paint(p.hi?"ink":"muted"),opacity:U,children:ot}):null}else Qi>=(r?Sn+10:16)&&(r?A>=14:A>=Sn+6)&&(Cn=(0,j.jsx)(me,{x:r?(F+O)/2:T+A/2,y:r?T+A/2:(F+O)/2,anchor:"middle",size:11,weight:700,fill:p.sw.text,opacity:U,children:ot}))}return(0,j.jsxs)("g",{className:"ztd-mark",opacity:h.exiting?.4:ze===null||ze===p.k?1:.38,onPointerEnter:ot=>o.setActive(V,ot.pointerType==="touch"?"touch":"pointer"),onClick:()=>o.click(V),style:{cursor:e.onClick?"pointer":void 0},children:[rt?r?(0,j.jsx)("rect",{x:nt,y:T,width:Math.max(0,Pt-nt),height:A,fill:"transparent"}):(0,j.jsx)("rect",{x:T,y:je,width:A,height:Math.max(0,s-_e-je),fill:"transparent"}):null,(0,j.jsx)("path",{d:De,fill:p.sw.fill,fillOpacity:xt?.42:void 0,stroke:Mn?p.sw.fill:rt?"none":i.paint("panel"),strokeWidth:Mn?1.2:1,strokeDasharray:Mn?"3 2":void 0}),o.active===V&&o.via==="keyboard"?(0,j.jsx)("path",{d:r?Mt(Math.min(F,O)-2,T-2,Math.abs(O-F)+4,A+4,4):Mt(T-2,Math.min(F,O)-2,A+4,Math.abs(O-F)+4,4),fill:"none",stroke:i.paint("ink"),strokeWidth:2}):null,Cn]},h.key)}),n?(0,j.jsxs)("g",{"aria-hidden":"true",children:[Vi.map(([h,p],T)=>{let[A,F]=Ji(T).map(Q),O=q(m.keys[T])+q.bandwidth/2,V=Lt.fade(T*pt+320,260)*(ze===null||ze===T?1:.38),Z=(Te,Pe,De)=>Te===null?null:(0,j.jsx)(me,{x:r?Pe+De*6:O,y:r?O:Pe-De*8,anchor:r?De<0?"end":"start":"middle",size:11,weight:600,fill:i.paint("ink"),opacity:V,children:Te},De);return(0,j.jsxs)("g",{children:[Z(h,A,-1),Z(p,F,1)]},m.keys[T])}),r?(0,j.jsx)("line",{x1:Math.round(Q(0))+.5,x2:Math.round(Q(0))+.5,y1:je,y2:s-_e,stroke:i.paint("ink"),strokeWidth:1.5}):(0,j.jsx)("line",{x1:nt,x2:a,y1:Math.round(Q(0))+.5,y2:Math.round(Q(0))+.5,stroke:i.paint("ink"),strokeWidth:1.5})]}):null,v?(0,j.jsxs)("g",{opacity:Lt.fade((m.keys.length-1)*pt+320,320),children:[v.series.map((h,p)=>(0,j.jsx)("path",{d:gl(m.keys.map((T,A)=>[Dt(A),Q(D(p,A))])),fill:"none",stroke:vn(p),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"},h)),bt.map((h,p)=>{let T=S.length+p,A=Dt(h.k),F=Q(h.value);return(0,j.jsxs)("g",{className:"ztd-mark",onPointerEnter:O=>o.setActive(T,O.pointerType==="touch"?"touch":"pointer"),onClick:()=>o.click(T),style:{cursor:e.onClick?"pointer":void 0},children:[(0,j.jsx)("circle",{cx:A,cy:F,r:9,fill:"transparent"}),(0,j.jsx)("circle",{cx:A,cy:F,r:o.active===T?4.5:3,fill:vn(h.li),stroke:i.paint("panel"),strokeWidth:1.5}),o.active===T&&o.via==="keyboard"?(0,j.jsx)("circle",{cx:A,cy:F,r:8,fill:"none",stroke:i.paint("ink"),strokeWidth:2}):null]},`${m.keys[h.k]}|${h.name}`)})]}):null,(0,j.jsx)(Do,{list:C,g:{...br,avoid:kr}}),r&&he?(0,j.jsx)("g",{"aria-hidden":"true",children:m.keys.map((h,p)=>{let T=d&&z.has(p);return(0,j.jsx)(me,{x:wn,y:q(h)+q.bandwidth/2,anchor:"end",size:11.5,weight:T?800:500,fill:i.paint(T?"ink":"muted"),children:Ne(m.labels[p],wn-4,11.5,T?800:500)},h)})}):null,!r&&ht?(0,j.jsx)(zo,{p:i,width:a,labels:m.labels,centers:m.keys.map(h=>q(h)+q.bandwidth/2),y:s-_e+13,strong:d?z:void 0}):null,!r&&ze!==null?(0,j.jsx)(Bo,{p:i,x:q(m.keys[ze])+q.bandwidth/2,y:s-_e+13,label:m.labels[ze],width:a}):null]})}function gl(e){let t=e.map(n=>n[1]);return fi(t,t).map(([n,r])=>vo(e.slice(n,r+1))).join("")}var cr=e=>e?"neutralStrong":"accent";var ur=P(W(),1);function vi(e,t,n,r){if(typeof e!="function")return ve(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 pl=P(ee(),1);var dr=P(W(),1),bl={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ve(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},$i={en:bl,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}일 이동평균`}},mr=["ink","muted","dim"];function Ti(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,mr.length)}var yl=P(ee(),1);var Ni=P(W(),1),xl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ve(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},kl={en:xl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Mi=(e,t)=>kl[e].other(t);function Ci(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,wo(o.map(i=>i.value)))}}var Si=e=>Number.isFinite(e)&&e>0?e:0;function Ai(e,t,n,r){return r==="emphasis"?Wt(e,t,n):ge(e,t,n)}var wl=P(ee(),1);var Pi=P(W(),1);function Fi(e,t){return t===!1?e.map((n,r)=>r):ko(e)}function Ri(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return ve(e,t,t,r,"max")}function _i(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]=oe(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?oe(e,"neutral"):Vt(e,1-a/Math.max(1,o.length-1))),r}function Di(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Ae(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function Li(e,t){return wt(e,t+1,new Set)}var vl=P(ee(),1);var Oi=P(W(),1);function Ei(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!ti.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var He=P(W(),1);function Ii(e,t,n){let r=rn(e);return r?.type==="scatter"&&t?.size!==void 0&&!nn(n)?rn("bubble"):r}function $l(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 Tl(e,t,n,r=!1){let o=Ii(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&&Yn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),f=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(f.includes(o.type)){let u=Be(i.label,"label"),d=on(i.value,"value"),g=o.type==="waffle",m=t.map((x,L)=>({r:x,label:u(x,L),value:g?d(x,L):Si(d(x,L))})),{kept:b,other:M}=g?{kept:m,other:null}:Ci(m,a.other,(x,L)=>({r:{},label:Mi(te(n),x),value:L})),w=ve(s,b.map(x=>x.r),b.map(x=>x.label),b.map(x=>x.value),g?"first":"max"),v=M?[...b,M]:b,$=We(x=>g?ge(x,v.length,w):Ai(x,v.length,w,a.colorMode)),D=g&&a.shape==="arc";return v.map((x,L)=>({label:x.label,color:$[L],...D&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Ti(Array.isArray(a.ma)?a.ma:void 0,t.length),d=$i[te(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...u.map((g,m)=>({label:d.maLegend(g),color:mr[m],shape:"line"}))]}if(o.type==="network"){let u=Di(a.groups);if(u.length<2)return[];let d=We(g=>Li(g,u.length));return u.map((g,m)=>({label:g,color:d[m],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=Be(i.group,"group"),d=Ae(t.map((m,b)=>u(m,b)).filter(Boolean));if(d.length<2)return[];let g=We(m=>wt(m,d.length,new Set));return d.map((m,b)=>({label:m,color:g[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||nn(a))return[];let u=Be(i.series,"series"),d=Ae(t.map((b,M)=>u(b,M)));if(d.length<2)return[];let g=vi(s,t,d,u),m=We(b=>wt(b,d.length,g));return c(d.map((b,M)=>({label:b,color:m[M],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",d=u?i.status:i.group;if(typeof d!="string")return[];let g=mi(t,d,u),m=We(b=>ge(b,g.length,Ei(s,g)));return c(g.map((b,M)=>({label:b,color:m[M],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let $=Be(i.series,"series");u=Ae(t.map((D,x)=>$(D,x)))}let d=Jn(o.type,i,a);if(d.length){let $=ve(s,u,u,u.map(()=>0),"none"),D=We(L=>ge(L,u.length,$)),x=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((L,z)=>({label:L,color:D[z]}));return[...c(x),...d.map((L,z)=>({label:L,color:cr(z),shape:"line"}))]}if(u.length<2)return[];let m=o.type==="bar"&&a.layout==="diverging"&&s===void 0?ln(u.length,Array.isArray(a.negative)?a.negative.map($=>u.indexOf(String($))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,b=m>=0?new Set([m]):ve(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map(($,D)=>({label:$,color:b.has(D)?"accent":"neutralStrong",shape:"square"})));let M=a.colorMode,w=$=>ge($,u.length,b);if((o.type==="line"||o.type==="area")&&(w=$=>wi($,u.length,b,o.type==="area",M)),o.type==="stream"){let $=Xe(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),D=Fi($.values,a.reorder),x=Ri(s,$.series,$.values);w=L=>_i(L,D,x)}let v=We(w);return c(u.map(($,D)=>({label:$,color:v[D],...o.type==="line"&&{shape:"line"}})))}return[]}function Ml(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&mo.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Cl(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...f}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:f,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function zi(e,t){let{spec:n}=e,r=Ii(n.type,n.encoding,n.options),o=(0,Ft.useMemo)(()=>di(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=uo(n,e.locale),s=pe(a),l=te(s),c=ni(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),f=go(n),u=(0,Ft.useMemo)(()=>f?ci(f,s):void 0,[f,s]),d=n.options?.hidden,g=Array.isArray(d)?d.map(String):[],m=g.join(""),[b,M]=(0,Ft.useState)(null);if(!r)return(0,He.jsx)(Xn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let w=o??c.data,v=t[r.type],$={...n.options??{}},D={...$l(r,n.encoding),...$,...u?{tooltip:u}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:a},x=n.card?.legend==="toggle"&&ho(r.type,n.encoding??{},$),L=b&&b.base===m?b.hidden:g;x&&(D.hidden=L);let z=R=>M(C=>{let k=C&&C.base===m?C.hidden:g;return{base:m,hidden:k.includes(R)?k.filter(N=>N!==R):[...k,R]}}),B=D.height??220,E=Ml(n,r.type),I=i&&!w.length&&(c.loading||c.error||c.empty)?(0,He.jsx)(Xn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:B,locale:a}):E?(0,He.jsx)(ei,{chart:v,...Cl(r.type,E,D)}):(0,He.jsx)(v,{...D});if(n.card){let R=n.card,C=R.legend==="auto"||R.legend==="toggle"?Tl(n,w,s,x):R.legend,k=C?.length?x?(0,He.jsx)(Un,{items:C,hidden:L,onToggle:z,locale:a}):C:void 0,N=R.download?(0,He.jsx)(li,{data:w,columns:po(n),filename:R.title??r.type,formats:Array.isArray(R.download)?R.download:void 0,locale:a}):void 0;I=(0,He.jsx)(io,{number:R.number,title:R.title??co(r,l),subtitle:R.subtitle,legend:k,actions:N,source:R.source||void 0,note:R.note||void 0,accent:R.accent,takeaway:R.takeaway,level:R.level,sample:R.sample,replay:R.replay!==!1,className:e.className,locale:a,children:I})}let S=e.theme??n.theme;return S&&(I=(0,He.jsx)(qt,{theme:S,children:I})),I}function Sl({cfg:e,components:t}){let n=mt();return zi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Hi(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Bi.hydrateRoot)(r,(0,fr.createElement)(qt,{theme:o.theme,cssVars:!0},(0,fr.createElement)(Sl,{cfg:o,components:{[e]:t}})))}Hi("bar",kn);})();