ztd-charts-cli 0.9.0 → 0.11.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 (48) hide show
  1. package/dist/api.js +1 -1
  2. package/dist/{chunk-GTATC42I.js → chunk-ZZGASY2Y.js} +1 -1
  3. package/dist/cli.js +1 -1
  4. package/dist/client/area.js +5 -5
  5. package/dist/client/bar.js +5 -5
  6. package/dist/client/barRace.js +3 -3
  7. package/dist/client/beeswarm.js +3 -3
  8. package/dist/client/box.js +6 -6
  9. package/dist/client/bubble.js +6 -6
  10. package/dist/client/bullet.js +5 -5
  11. package/dist/client/bump.js +6 -6
  12. package/dist/client/calendar.js +5 -5
  13. package/dist/client/candlestick.js +4 -4
  14. package/dist/client/chord.js +5 -5
  15. package/dist/client/choropleth.js +5 -5
  16. package/dist/client/donut.js +6 -6
  17. package/dist/client/dumbbell.js +3 -3
  18. package/dist/client/flowMap.js +4 -4
  19. package/dist/client/funnel.js +3 -3
  20. package/dist/client/gauge.js +3 -3
  21. package/dist/client/heatmap.js +5 -5
  22. package/dist/client/histogram.js +5 -5
  23. package/dist/client/line.js +5 -5
  24. package/dist/client/lollipop.js +6 -6
  25. package/dist/client/marimekko.js +6 -6
  26. package/dist/client/network.js +5 -5
  27. package/dist/client/parallel.js +6 -6
  28. package/dist/client/pareto.js +5 -5
  29. package/dist/client/pie.js +6 -6
  30. package/dist/client/radar.js +6 -6
  31. package/dist/client/radialBar.js +3 -3
  32. package/dist/client/ridgeline.js +4 -4
  33. package/dist/client/sankey.js +4 -4
  34. package/dist/client/scatter.js +6 -6
  35. package/dist/client/segmented.js +3 -3
  36. package/dist/client/skyline.js +9 -9
  37. package/dist/client/slope.js +5 -5
  38. package/dist/client/sparkline.js +6 -6
  39. package/dist/client/stream.js +6 -6
  40. package/dist/client/sunburst.js +6 -6
  41. package/dist/client/symbolMap.js +5 -5
  42. package/dist/client/tileMap.js +6 -6
  43. package/dist/client/timeline.js +10 -10
  44. package/dist/client/tree.js +5 -5
  45. package/dist/client/treemap.js +3 -3
  46. package/dist/client/waffle.js +5 -5
  47. package/dist/client/waterfall.js +5 -5
  48. package/package.json +2 -2
@@ -1,4 +1,4 @@
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=`
1
+ (()=>{var ea=Object.create;var Tr=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&&Tr(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?Tr(n,"default",{value:e,enumerable:!0}):n,e));var ee=An((Fl,Cr)=>{Cr.exports=globalThis.__ztdReact.react});var Ar=An((Rl,Sr)=>{Sr.exports=globalThis.__ztdReact["react-dom/client"]});var W=An((Kl,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","accent2","accent3","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",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily: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",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily: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
4
  .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Ge.accent});outline-offset:3px;border-radius:6px}
@@ -19,10 +19,10 @@
19
19
  @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
20
  .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
21
  @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
- `;function 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===`
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),Te=typeof window<"u"&&typeof document<"u",Le=Te?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})?)?$/,$a=["january","february","march","april","may","june","july","august","september","october","november","december"],Ur=e=>{let t=e.toLowerCase();return t.length<3?0:$a.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 va=[/^(\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 va)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 $t(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 $t(`${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 vt(e,t={month:"short",day:"numeric"}){let n=$t(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 Ma(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)(()=>Ma(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 Ta=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function no(e){return Ta.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:T}=t;(0,be.useEffect)(()=>{if(m!=="touch"||!b)return;let k=N=>{b.contains(N.target)||T(null)};return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[m,b,T]);let w=t.active!==null?n[t.active]:null,$=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($){let k=$.x*v,N=t.width*v,H=`clamp(${(4-k).toFixed(1)}px, -50%, calc(${(N-k-4).toFixed(1)}px - 100%))`,G=$.y<64;L={position:"absolute",left:k,top:$.y*v,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*v-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,$?(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:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.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)")],$s=[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")],vs=[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:vs,tileMap:gs,barRace:ps,network:bs,timeline:ys,tree:xs,choropleth:ks,symbolMap:ws,flowMap:$s},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 Ms={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:Ms[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 Ts(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=>Ts(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
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
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
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,T)=>[String(T),u(b)])));let d=[],g=new Set;return f[0].forEach((m,b)=>{let T=m.trim()||`col${b+1}`,w=T;for(let $=2;g.has(w);$++)w=`${T}_${$}`;g.add(w),d.push(w)}),f.slice(1).map(m=>Object.fromEntries(d.map((b,T)=>[b,u(m[T]??"")])))}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 Mt(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 T=0;T<d;T++)b+=a(T,c)-a(T,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 v=0;v<n;v++)Number.isFinite(e[v][u])&&(d+=Math.abs(e[v][u]));let g=t.percent?d?100/d:0:1,m=v=>Number.isFinite(e[v][u])&&!t.skip?.has(v)?Math.abs(e[v][u])*g:0,b=l>=0?m(l)/2:0;l>=0&&(o[l][u]=-b,i[l][u]=b);let T=0-b,w=b,$=v=>{o[v][u]=T,T-=m(v),i[v][u]=T};c.forEach($);for(let v of f)e[v][u]<0||(o[v][u]=w,w+=m(v),i[v][u]=w);for(let v=f.length-1;v>=0;v--)e[f[v]][u]<0&&$(f[v]);a[u]=0-T-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 Tt(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 $o(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 vo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function Mo(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 To(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+=To(c):s+=To(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}=Mo(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:vt(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,T=0;for(;m.getTime()<=t&&T++<500;){if(m.getTime()>=e){let w=m.getFullYear(),$=g&&!l&&w!==b;a.push({t:m.getTime(),label:vt(m,{locale:r,...d,...$?{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"?$t(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=$t(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 T=o.dateFormat,w=C=>typeof C=="string"?Yt(C.trim())?.[3]:void 0,$=u==="date"&&f.length<5e3?w(f[0]):void 0,v=($===2||$===3)&&f.every(C=>w(C)===$),D=v&&$===3;if(u==="date"&&!T){let C=m.length>1?m[m.length-1]-m[0]:0;T=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&&(T={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,T):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),T=f?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(T==="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(T==="stacked"||T==="auto"&&z.series.length>1){let E=Mt(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,[T,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=l.type==="number"?b>12:b>Go(T,w,Math.max(2,Math.floor((m-g)/64)),s).length;if(l.type==="band"||!b||$)return;let v=x=>g+(l.xnum[x]-T)/(w-T)*(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||v(z)-v(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",T=u&&(!b||g.sameKeys),w=u&&(b||g.x!==void 0||g.sameKeys),$=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:!T||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:$.has(S)}}),cols:l,pw:c,ph:f,isPanelPick:v,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=>vo(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)(()=>Te&&typeof window.matchMedia=="function"?window.matchMedia(Zo).matches:!1);return(0,xe.useEffect)(()=>{if(e!=="auto"||!Te||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,$)=>typeof $=="function"?String($):$),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&&Te},hydrated:m},{waiting:!1,generation:0}),T=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,$)=>{let v=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",$*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:v},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)(T,{...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 $e(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 ve=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,ve.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ve.useState)(0),c=pe(t.locale),f=(0,ve.useRef)(t);f.current={...t,locale:c};let u=(0,ve.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,ve.useRef)(!1);(0,ve.useEffect)(()=>{let w=u.current;if(!w||!r){a(D=>D.status==="loading"?{...D,status:"idle"}:D);return}let $=new AbortController,v=!0;return b.current=!0,a(D=>({...D,data:o?D.data:[],status:"loading",error:null})),Qs(w,{...f.current,signal:$.signal}).then(D=>{v&&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(()=>{v&&(b.current=!1)}),()=>{v=!1,b.current=!1,$.abort()}},[d,r,s,m,o]),(0,ve.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||l($=>$+1)},n);return()=>clearInterval(w)},[n,r]);let T=(0,ve.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:T}}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 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);})();
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 T;for(let w of Array.from(m.attributes)){if(!nl.test(w.value))continue;let $=(T??(T=getComputedStyle(m))).getPropertyValue(w.name);$&&f[b].setAttribute(w.name,ii($,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?vt(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&&Te,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]),T=(0,re.useCallback)(K=>Kt(K,{locale:g}),[g]),w=(0,re.useMemo)(()=>Ut(b,e.unit),[b,e.unit]),$=(0,re.useMemo)(()=>an(e.data),[e.data]),[v,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:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Re=(0,re.useCallback)((K,le=1)=>v===null||v===K?le:le*.38,[v]);return{p:n,width:s,height:c,measured:G,responsive:e.width===void 0,pending:Te&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:de,fv:w,fmt:b,pct:T,locale:g,lang:m,t:m==="ko"?Ir:Or,active:v,via:x,setActive:C,click:N,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Re,sig:$,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],T=s.vel[m]+i*b;s.cur[m]=s.to[m]+(b+T*l)*u,s.curVel[m]=(s.vel[m]-i*T*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),T=(0,ne.useRef)(!1),w=(0,ne.useRef)(0),[,$]=(0,ne.useState)(0),v=(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"),$(C=>(C+1)%1e9),R||(v.current=null),R};let z=(0,ne.useCallback)(()=>{if(!Te||v.current||!x.animating)return;let S=R=>L.current(R);v.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",$(R=>R+1));return}d.current==="init"||S&&i?(x.hold(g.current??n),d.current="idle",T.current=!1,$(R=>R+1)):S&&(T.current=!0)},[r,a]),Le(()=>{!r||!i||!T.current||(T.current=!1,x.hold(g.current??n),d.current="idle",$(S=>S+1))},[i,r]),(0,ne.useEffect)(()=>{r&&o&&d.current==="idle"&&(x.start(Ht()),w.current+=1,d.current="running",z(),$(S=>S+1))},[r,o,a,x,z]),(0,ne.useEffect)(()=>{x.animating&&z()}),(0,ne.useEffect)(()=>(D.current=!0,()=>{D.current=!1,v.current?.(),v.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 M=l.keys.map((A,F)=>F).sort((A,F)=>(p[F]||0)-(p[A]||0));return{...l,keys:M.map(A=>l.keys[A]),labels:M.map(A=>l.labels[A]),xnum:M.map((A,F)=>F),values:l.values.map(A=>M.map(F=>A[F])),rows:l.rows.map(A=>M.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]),T=m.series.length,w=!!e.line?.length&&!r&&t!=="percent"&&!n,$=(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]),v=(0,se.useMemo)(()=>new Map(($?.keys??[]).map((h,p)=>[h,p])),[$]),D=(h,p)=>{let M=v.get(m.keys[p]);return $&&M!==void 0?$.values[h][M]:Number.NaN},x=(0,se.useMemo)(()=>{if(d)return $e(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(M=>M.reduce((A,F)=>A+(Number.isFinite(F)?F:0),0));return $e(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,M)=>b.includes(M)?[]:[M]))}),h]},[f,u,b]),S=(0,se.useMemo)(()=>{let h=[],p=E?{y0:b.map(M=>E.y0[M]),y1:b.map(M=>E.y1[M])}:t==="grouped"?null:Mt(m.values,t==="percent"?"expand":"zero");return m.keys.forEach((M,A)=>{let F=[];if(m.series.forEach((O,V)=>{let Z=m.values[V][A];if(!Number.isFinite(Z))return;let Me=p?p.y0[V][A]:0,Pe=p?p.y1[V][A]:Z;F.push({key:`${M}|${O}`,k:A,s:V,cat:m.labels[A],series:O,value:Z,v0:Me,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,Me=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?Me-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)),$)for(let h of $.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"||T<=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(M=>M>0?ie(ce(M),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],T>1&&t==="grouped"?.24:.32,.12),Q=r?et(G,[nt,Pt]):et(G,[s-_e-Ki,je]),Ie=t==="grouped"&&T>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,$n=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,M)=>{let A=d?m.values[0][M]:t==="grouped"?m.values[h][M]:m.values.reduce((F,O)=>F+(Number.isFinite(O[M])?O[M]:0),0);return{x:q(p)+(Ie?Ie(m.series[h])+Ie.bandwidth/2:q.bandwidth/2),y:Q(A)}})}},vn=h=>{let p=q(m.keys[h.k])+(Ie?Ie(h.series):0),M=Ie?Ie.bandwidth:q.bandwidth,A=Q(h.v0),F=Q(h.v1);return{pos:p,th:M,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"||T===1,xr=(h,p,M,A,F,O,V)=>{if(T===1?yr!==null&&!yr.has(p):A<V*.8)return null;let Z={x:M+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},Me=Dt(h.k);return $&&Math.abs(Me-Z.x)<V/2+5&&$.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:M,th:A,a:F,b:O}=vn(h),V=ie(le(h),11,700),Z=xr(h,p,M,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=vn(h),M=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"?M:A,t==="grouped"?M: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 $?.series.forEach((p,M)=>m.keys.forEach((A,F)=>{let O=v.get(A);O===void 0||!Number.isFinite($.values[M][O])||h.push({li:M,k:F,name:p,value:$.values[M][O],datum:$.rows[M][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 $r=o.active!==null&&o.active>=S.length?bt[o.active-S.length]??null:null,ze=o.active!==null?$r?.k??S[o.active]?.k??null:null,Mn=null;if($&&ze!==null){let h=ze,p=S[o.active??-1],M=typeof e.y=="string"?e.y:o.t.value,A=[...m.series.map((O,V)=>({label:O||M,value:Number.isFinite(m.values[V][h])?o.fv(m.values[V][h]):"-",color:(d?B[h]:B[V]).fill,strong:p?.s===V})),...$.series.map((O,V)=>({label:O,value:Number.isFinite(D(V,h))?o.fv(D(V,h)):"-",color:$n(V),strong:$r?.li===V}))],F=[...S.filter(O=>O.k===h).map(O=>Math.min(Q(O.v0),Q(O.v1))),...$.series.map((O,V)=>Q(D(V,h))).filter(Number.isFinite)];Mn={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=vn(h),M=T>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}];Mn=r?{x:Math.max(p.a,p.b),y:p.pos,title:h.cat,rows:M}:{x:p.pos+p.th/2,y:Math.min(p.a,p.b),title:h.cat,rows:M}}let yt=fl[o.lang],vr=h=>E?`${m.labels[h]}: ${yt.sides(ce(E.neg[h]),ce(E.pos[h]))}`:"",Mr=`${yt.kind}. ${yt.desc(m.keys.length,T,m.series.join(", "))}${$?yt.lines($.series):""}. ${E?m.keys.map((h,p)=>vr(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?`${vr(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(M=>M.k===h);return[Math.min(0,...p.map(M=>Math.min(M.v0,M.v1))),Math.max(0,...p.map(M=>Math.max(M.v0,M.v1)))]},qi=e.description??(C?.length?`${Mr.trimEnd().replace(/\.?$/,".")}${Lo(C,o.lang,o.fv)}`:Mr);return(0,j.jsxs)(ao,{c:o,kind:yt.kind,ariaLabel:e.ariaLabel,description:qi,events:Et,tip:Mn,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,[M,A,F,O]=h.v,V=Xi.get(p.key)??0,Z=p.v1<p.v0||p.value<0,Me=t==="grouped"||p.s===T-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?Me?Z?{tl:ue,bl:ue}:{tr:ue,br:ue}:{}:Me?Z?{bl:ue,br:ue}:{tl:ue,tr:ue}:{},De=r?Tt(Math.min(F,O),M,Math.abs(O-F),A,Pe):Tt(M,Math.min(F,O),A,Math.abs(O-F),Pe),U=Lt.fade(p.k*pt+320,260),xt=pr>=0&&p.k>=pr,Tn=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,M,A,F,O,Sn);Cn=r?(0,j.jsx)(me,{x:Math.max(F,O)+6,y:M+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:M+A/2,y:r?M+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:M,width:Math.max(0,Pt-nt),height:A,fill:"transparent"}):(0,j.jsx)("rect",{x:M,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:Tn?p.sw.fill:rt?"none":i.paint("panel"),strokeWidth:Tn?1.2:1,strokeDasharray:Tn?"3 2":void 0}),o.active===V&&o.via==="keyboard"?(0,j.jsx)("path",{d:r?Tt(Math.min(F,O)-2,M-2,Math.abs(O-F)+4,A+4,4):Tt(M-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],M)=>{let[A,F]=Ji(M).map(Q),O=q(m.keys[M])+q.bandwidth/2,V=Lt.fade(M*pt+320,260)*(ze===null||ze===M?1:.38),Z=(Me,Pe,De)=>Me===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:Me},De);return(0,j.jsxs)("g",{children:[Z(h,A,-1),Z(p,F,1)]},m.keys[M])}),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,$?(0,j.jsxs)("g",{opacity:Lt.fade((m.keys.length-1)*pt+320,320),children:[$.series.map((h,p)=>(0,j.jsx)("path",{d:gl(m.keys.map((M,A)=>[Dt(A),Q(D(p,A))])),fill:"none",stroke:$n(p),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"},h)),bt.map((h,p)=>{let M=S.length+p,A=Dt(h.k),F=Q(h.value);return(0,j.jsxs)("g",{className:"ztd-mark",onPointerEnter:O=>o.setActive(M,O.pointerType==="touch"?"touch":"pointer"),onClick:()=>o.click(M),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===M?4.5:3,fill:$n(h.li),stroke:i.paint("panel"),strokeWidth:1.5}),o.active===M&&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 M=d&&z.has(p);return(0,j.jsx)(me,{x:wn,y:q(h)+q.bandwidth/2,anchor:"end",size:11.5,weight:M?800:500,fill:i.paint(M?"ink":"muted"),children:Ne(m.labels[p],wn-4,11.5,M?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])=>$o(e.slice(n,r+1))).join("")}var cr=e=>e?"neutralStrong":"accent";var ur=P(W(),1);function $i(e,t,n,r){if(typeof e!="function")return $e(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`},vi={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 Mi(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}개`}},Ti=(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 $e(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 $l=P(ee(),1);var Oi=P(W(),1);var vl=26;var bm=vl*.62;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 Ml(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:T}=g?{kept:m,other:null}:Ci(m,a.other,(x,L)=>({r:{},label:Ti(te(n),x),value:L})),w=$e(s,b.map(x=>x.r),b.map(x=>x.label),b.map(x=>x.value),g?"first":"max"),$=T?[...b,T]:b,v=We(x=>g?ge(x,$.length,w):Ai(x,$.length,w,a.colorMode)),D=g&&a.shape==="arc";return $.map((x,L)=>({label:x.label,color:v[L],...D&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Mi(Array.isArray(a.ma)?a.ma:void 0,t.length),d=vi[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,T)=>u(b,T)));if(d.length<2)return[];let g=$i(s,t,d,u),m=We(b=>wt(b,d.length,g));return c(d.map((b,T)=>({label:b,color:m[T],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,T)=>({label:b,color:m[T],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 v=Be(i.series,"series");u=Ae(t.map((D,x)=>v(D,x)))}let d=Jn(o.type,i,a);if(d.length){let v=$e(s,u,u,u.map(()=>0),"none"),D=We(L=>ge(L,u.length,v)),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(v=>u.indexOf(String(v))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,b=m>=0?new Set([m]):$e(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,D)=>({label:v,color:b.has(D)?"accent":"neutralStrong",shape:"square"})));let T=a.colorMode,w=v=>ge(v,u.length,b);if((o.type==="line"||o.type==="area")&&(w=v=>wi(v,u.length,b,o.type==="area",T)),o.type==="stream"){let v=Xe(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),D=Fi(v.values,a.reorder),x=Ri(s,v.series,v.values);w=L=>_i(L,D,x)}let $=We(w);return c(u.map((v,D)=>({label:v,color:$[D],...o.type==="line"&&{shape:"line"}})))}return[]}function Cl(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 Sl(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,T]=(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,$=t[r.type],v={...n.options??{}},D={...Ml(r,n.encoding),...v,...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??{},v),L=b&&b.base===m?b.hidden:g;x&&(D.hidden=L);let z=R=>T(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=Cl(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:$,...Sl(r.type,E,D)}):(0,He.jsx)($,{...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 Al({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)(Al,{cfg:o,components:{[e]:t}})))}Hi("bar",kn);})();