ztd-charts-cli 0.11.3 → 0.13.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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/api.js +1 -1
  3. package/dist/{chunk-VUZPZ5FT.js → chunk-LR5X5LI2.js} +53 -29
  4. package/dist/cli.js +6 -1
  5. package/dist/client/area.js +6 -6
  6. package/dist/client/bar.js +9 -9
  7. package/dist/client/barRace.js +6 -6
  8. package/dist/client/beeswarm.js +7 -7
  9. package/dist/client/box.js +9 -9
  10. package/dist/client/bubble.js +7 -7
  11. package/dist/client/bullet.js +6 -6
  12. package/dist/client/bump.js +6 -6
  13. package/dist/client/calendar.js +10 -10
  14. package/dist/client/candlestick.js +6 -6
  15. package/dist/client/chord.js +7 -7
  16. package/dist/client/choropleth.js +9 -9
  17. package/dist/client/cohort.js +28 -0
  18. package/dist/client/donut.js +6 -6
  19. package/dist/client/dumbbell.js +6 -6
  20. package/dist/client/flowMap.js +7 -7
  21. package/dist/client/funnel.js +9 -9
  22. package/dist/client/gauge.js +6 -6
  23. package/dist/client/heatmap.js +9 -9
  24. package/dist/client/histogram.js +6 -6
  25. package/dist/client/horizon.js +28 -0
  26. package/dist/client/line.js +6 -6
  27. package/dist/client/lollipop.js +6 -6
  28. package/dist/client/marimekko.js +6 -6
  29. package/dist/client/network.js +9 -9
  30. package/dist/client/parallel.js +6 -6
  31. package/dist/client/pareto.js +6 -6
  32. package/dist/client/pie.js +6 -6
  33. package/dist/client/radar.js +7 -7
  34. package/dist/client/radialBar.js +6 -6
  35. package/dist/client/ridgeline.js +6 -6
  36. package/dist/client/sankey.js +10 -10
  37. package/dist/client/scatter.js +10 -10
  38. package/dist/client/segmented.js +6 -6
  39. package/dist/client/skyline.js +7 -7
  40. package/dist/client/slope.js +6 -6
  41. package/dist/client/sparkTable.js +28 -0
  42. package/dist/client/sparkline.js +6 -6
  43. package/dist/client/stream.js +7 -7
  44. package/dist/client/sunburst.js +7 -7
  45. package/dist/client/symbolMap.js +7 -7
  46. package/dist/client/tileMap.js +6 -6
  47. package/dist/client/timeline.js +9 -9
  48. package/dist/client/tree.js +6 -6
  49. package/dist/client/treemap.js +7 -7
  50. package/dist/client/waffle.js +7 -7
  51. package/dist/client/waterfall.js +6 -6
  52. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- (()=>{var ca=Object.create;var Ar=Object.defineProperty;var ua=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var da=Object.getPrototypeOf,fa=Object.prototype.hasOwnProperty;var xn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ha=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ma(t))!fa.call(e,o)&&o!==n&&Ar(e,o,{get:()=>t[o],enumerable:!(r=ua(t,o))||r.enumerable});return e};var R=(e,t,n)=>(n=e!=null?ca(da(e)):{},ha(t||!e||!e.__esModule?Ar(n,"default",{value:e,enumerable:!0}):n,e));var q=xn((ql,Nr)=>{Nr.exports=globalThis.__ztdReact.react});var Rr=xn((Jl,Fr)=>{Fr.exports=globalThis.__ztdReact["react-dom/client"]});var G=xn((mc,io)=>{io.exports=globalThis.__ztdReact["react/jsx-runtime"]});var cr=R(q(),1),Wi=R(Rr(),1);var Ct=R(q(),1);var Wt=R(q(),1);var _r=R(q(),1),nt=(0,_r.createContext)(void 0);var Er=R(q(),1);var ga=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Pr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Dr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',De={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",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:Pr,monoFamily:Dr,radius:18,radiusCode:14,radiusMark:4},kn={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:Pr,monoFamily:Dr,radius:18,radiusCode:14,radiusMark:4},wn={dark:De,light:kn};function Pt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function $n(e){let t={};for(let n of ga){let r=e[n];typeof r=="string"&&(t[Pt(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 vn(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 pa=`
1
+ (()=>{var ca=Object.create;var Ar=Object.defineProperty;var ua=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var da=Object.getPrototypeOf,fa=Object.prototype.hasOwnProperty;var xn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ha=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ma(t))!fa.call(e,o)&&o!==n&&Ar(e,o,{get:()=>t[o],enumerable:!(r=ua(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?ca(da(e)):{},ha(t||!e||!e.__esModule?Ar(n,"default",{value:e,enumerable:!0}):n,e));var q=xn((Ql,Nr)=>{Nr.exports=globalThis.__ztdReact.react});var Fr=xn((ec,Rr)=>{Rr.exports=globalThis.__ztdReact["react-dom/client"]});var G=xn((hc,io)=>{io.exports=globalThis.__ztdReact["react/jsx-runtime"]});var cr=F(q(),1),Wi=F(Fr(),1);var Ct=F(q(),1);var Wt=F(q(),1);var _r=F(q(),1),nt=(0,_r.createContext)(void 0);var Er=F(q(),1);var ga=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Pr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Dr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',De={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",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:Pr,monoFamily:Dr,radius:18,radiusCode:14,radiusMark:4},kn={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:Pr,monoFamily:Dr,radius:18,radiusCode:14,radiusMark:4},wn={dark:De,light:kn};function Pt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function vn(e){let t={};for(let n of ga){let r=e[n];typeof r=="string"&&(t[Pt(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 pa=`
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,${De.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 Or(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 Ir(e,t){let[n]=(0,Er.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Lr=!1;function bt(){if(Lr||typeof document>"u"||(Lr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=pa,document.head.appendChild(e)}var Dt=R(q(),1),ye=typeof window<"u"&&typeof document<"u",Te=ye?Dt.useLayoutEffect:Dt.useEffect;function Lt(){return typeof performance<"u"?performance.now():Date.now()}function Z(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ce(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var zr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Br={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ba=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ya={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function xa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ka(e){return xa(ba,e)}function Hr(e,t){let n=ka(e);return{text:n?n[t]:e,...ya[n?.id??"basic"]}}var jr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function rt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),jr[t.toLowerCase()]&&(t=jr[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 Vr(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 Tn(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 ot(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Gr(e){return .2126*ot(e[0])+.7152*ot(e[1])+.0722*ot(e[2])}function Cn(e,t,n){let r=typeof e=="string"?rt(e):e,o=typeof t=="string"?rt(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?rt(n):n:null;o[3]<1&&i&&(o=Tn(o,i));let a=r[3]<1?Tn(r,o):r,s=Gr(a),l=Gr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function wa(e){return[ot(e[0]),ot(e[1]),ot(e[2])]}function Mn(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 Wr(e){let[t,n,r]=wa(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 $a([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[Mn(4.0767416621*o-3.3077115913*i+.2309699292*a),Mn(-1.2684380046*o+2.6097574011*i-.3413193965*a),Mn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Et(e,t,n){let r=rt(e),o=rt(t);if(!r||!o)return e;let i=Wr(r),a=Wr(o),s=Math.max(0,Math.min(1,n));return Vr($a([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 Sn(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Cn(i,e,n);a>o&&(o=a,r=i)}return r}function ne(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function va(e,t){let n=Sn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Cn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Sn(t,["#FFFFFF","#000000"])}function Ot(e,t){let n=Et(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:va(e,n),raw:n}}function xe(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=ne(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=ne(e,"neutral");else if(s===0)r[a]=ne(e,"ink");else if(s===i-1)r[a]=ne(e,"neutral");else if(i===3)r[a]=ne(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?ne(e,"strong"):Ot(e,1-l)}}),r}var An="mix:";function Le(e){return e({theme:kn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${An}${o}`}).map(n=>n.fill)}function Kr(e,t){return t?.startsWith(An)?e.mix("neutralStrong","neutral",Number(t.slice(An.length))):e.color(t)}function yt(e,t,n){return xe(e,t+1,n).slice(0,t)}function Ur(e,t,n,r="neutral"){let o=ne(e,"accent"),i=ne(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Xr(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=ne(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=ne(e,"neutral"):s===0?r[a]=ne(e,"strong"):s===i-1?r[a]=ne(e,"neutral"):r[a]=Ot(e,1-s/(i-1))}),r}var ke=R(q(),1);var It=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ae="en-US",Yr=new Map;function Nn(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=Yr.get(r);return o||(o=new Intl.NumberFormat(e,n),Yr.set(r,o)),o}function Fn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function at(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ae,...r}=t;return Fn(Nn(n,r).format(e))}var Rn=e=>e!==0&&Math.abs(e)<.05,_n=(e,t,n="")=>`${at(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function it(e,t={}){if(!Number.isFinite(e))return"-";if(Rn(e)&&t.maximumFractionDigits===void 0)return _n(e,t.locale??ae,"%");let n=Math.abs(e);return`${at(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Qr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ae,...r}=t;if(Z(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,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+at(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Fn(Nn(n,{notation:"compact",...r}).format(e))}var Ma=(e,t=Z(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function We(e,t=ae,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=Nn(t,o);return l=>Number.isFinite(l)?`${a}${Fn(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=>it(o,{locale:t});case"ratio":return o=>it(o*100,{locale:t});case"compact":return o=>Qr(o,{locale:t});case"currency":return r(Ma(t));default:{let o=r({maximumFractionDigits:1});return i=>Rn(i)?_n(i,t):o(i)}}}function xt(e,t=ae,n=0){return e!==void 0?We(e,t):n>=1e5?r=>Rn(r)?_n(r,t):Qr(r,{locale:t}):r=>at(r,{locale:t})}function Ta(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Pn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Ca=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Sa=["january","february","march","april","may","june","july","august","september","october","november","december"],qr=e=>{let t=e.toLowerCase();return t.length<3?0:Sa.findIndex(n=>n.startsWith(t))+1},Jr=e=>+e+(+e<30?2e3:1900);function eo(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Aa=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],to=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,no=/\{([^{}]+)\}/g;function zt(e,t){let n;for(let r of Aa)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?[Jr(n[3]),+n[2],+n[1],1]:[Jr(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=to.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=qr(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=qr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var ro=e=>Ca.test(e)||zt(e)!==null;function oo(e){let t;for(let n of e){let r=typeof n=="string"?to.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Bt(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(Pn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Bt(`${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=zt(n,t);if(r)return Ta(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 Zr=new Map;function kt(e,t={month:"short",day:"numeric"}){let n=Bt(e);if(!n)return"-";let{locale:r=ae,...o}=t,i=r+JSON.stringify(o),a=Zr.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Zr.set(i,a)),a.format(n)}var Dn=R(G(),1),Ht=(0,ke.createContext)({theme:De,cssVars:!0});function Na(e,t=De){return e?typeof e=="string"?wn[e]??t:vn(t,e):t}function jt(e){let t=(0,ke.useContext)(Ht),n=e.base?wn[e.base]:t.theme,r=(0,ke.useMemo)(()=>Na(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,ke.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,ke.useMemo)(()=>$n(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Dn.jsx)(Ht.Provider,{value:a,children:(0,Dn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Fa=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function ao(e){return Fa.has(e)}function Ra(e,t){let n=r=>t?`var(${Pt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?ao(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?ao(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)})`:Et(e[r],e[o],i)}}}function we(e){let t=(0,ke.useContext)(Ht);return(0,ke.useMemo)(()=>{let n=vn(t.theme,e);return Ra(n,t.cssVars)},[t.theme,t.cssVars,e])}function se(e){let t=(0,ke.useContext)(Ht);return e??t.locale??ae}function so(e){return e?$n(e):{}}var Gt=R(q(),1),Ln=(0,Gt.createContext)(void 0);function lo(e){let t=(0,Gt.useContext)(Ln);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=R(G(),1),_a={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`},Pa={en:_a,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Da={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},En=e=>Pa[Z(se(e))];function On(e){let t=we(e.theme),n=En(e.locale),[r,o]=(0,Wt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.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((m,u)=>{let f=!s.has(m.label),p=f&&l===1,d=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(La,{p:t,item:m,off:!f}),(0,_.jsx)("span",{style:f?void 0:{textDecoration:"line-through"},children:m.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":f,"aria-disabled":p||void 0,onClick:()=>{p||(a(m.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:p?"default":void 0},children:d}):d},u)})});return a?(0,_.jsxs)(_.Fragment,{children:[c,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Da,children:r?n.shown(l,e.items.length):""})]}):c}function La({p:e,item:t,off:n}){let r=Kr(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 Ea(e){let t=we(e.theme),n=Hr(e.level,Z(se(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 Oa(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 co(e){let t=we(e.theme),n=En(e.locale),[r,o]=(0,Wt.useState)(0);Te(()=>bt(),[]);let i=()=>{o(f=>f+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)(On,{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,m=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)(Ea,{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:Oa(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)(Ln.Provider,{value:r,children:(0,_.jsx)(nt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,_.jsxs)(_.Fragment,{children:[m,u]}):u]})}function In(e){let t=we(e.theme),n=En(e.locale),r=e.height??220;if(Te(()=>bt(),[]),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 ut=R(q(),1);var le=R(q(),1);var W=R(G(),1),Vt=60;var Kt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function uo(e){let{c:t,events:n}=e,r=(0,le.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Te(()=>{bt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,le.useContext)(nt),c=e.ariaLabel??l??e.kind,m=(0,le.useMemo)(()=>s?`${n.length}${n.slice(0,Vt).map(w=>`${w.label}${w.series??""}${w.formatted??w.value??""}`).join("")}`:"",[n,s]),u=(0,le.useMemo)(()=>(0,W.jsx)(Ia,{label:c,events:n,t:t.t}),[c,m,t.t]),f=(0,le.useRef)(null);(0,le.useEffect)(()=>{let w=()=>{f.current=null};return window.addEventListener("scroll",w,{capture:!0,passive:!0}),window.addEventListener("resize",w,{passive:!0}),()=>{window.removeEventListener("scroll",w,{capture:!0}),window.removeEventListener("resize",w)}},[]),(0,le.useEffect)(()=>{f.current=null},[t.width,t.height]);let p=w=>{if(w.target!==w.currentTarget)return;if(e.onKey?.(w)){w.preventDefault();return}let F=t.active,E;switch(w.key){case"ArrowRight":case"ArrowDown":E=F===null?0:(F+1)%a;break;case"ArrowLeft":case"ArrowUp":E=F===null?a-1:(F-1+a)%a;break;case"Home":E=0;break;case"End":E=a-1;break;case"Escape":if(F===null)return;E=null;break;case"Enter":case" ":F!==null&&(w.preventDefault(),t.click(F));return;default:return}w.preventDefault(),t.setActive(E,"keyboard")},{via:d,node:g,setActive:k}=t;(0,le.useEffect)(()=>{if(d!=="touch"||!g)return;let w=F=>{g.contains(F.target)||k(null)};return document.addEventListener("pointerdown",w),()=>document.removeEventListener("pointerdown",w)},[d,g,k]);let b=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,T=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,A=typeof e.renderTip=="function"&&b?e.renderTip(b):null,x=e.announce??(t.via==="keyboard"&&b?`${b.label}${b.series?` ${b.series}`:""}: ${b.formatted??b.value??""} (${(t.active??0)+1}/${a})`:""),S;if($){let w=$.x*T,F=t.width*T,E=`clamp(${(4-w).toFixed(1)}px, -50%, calc(${(F-w-4).toFixed(1)}px - 100%))`,j=$.y<64;S={position:"absolute",left:w,top:$.y*T,transform:`translate(${E}, ${j?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*T-8)}}let B=w=>{f.current=null,w.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},H=w=>w?F=>{let E=f.current??(f.current=F.currentTarget.getBoundingClientRect());E.width&&w((F.clientX-E.left)/E.width*t.width,(F.clientY-E.top)/E.height*t.height,F)}:void 0,L=H(e.onPointerMove),D=H(e.onPointerDown),N=L||D?w=>{w.pointerType==="touch"&&L?.(w),D?.(w)}:void 0,C=H(e.onPointerUp),v=so(e.theme);return(0,W.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?p:void 0,onBlur:w=>{t.via==="keyboard"&&!w.currentTarget.contains(w.relatedTarget)&&t.setActive(null)},onPointerLeave:B,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"),...v,...e.style},children:[t.pending?null:e.underlay,(0,W.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:L,onPointerDown:N,onPointerUp:C,onPointerCancel:C,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,W.jsx)("title",{id:o,children:c}),(0,W.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,W.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,W.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:S,children:A??(0,W.jsxs)(W.Fragment,{children:[(0,W.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((w,F)=>(0,W.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(w.strong?"ink":"muted")},children:[w.color?(0,W.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:w.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,w.label]}),(0,W.jsx)("span",{style:{fontWeight:w.strong===!1?500:700},children:w.value})]},F))]})}):null,(0,W.jsx)("span",{className:"ztd-sr",style:Kt,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?u:null]})}function Ia({label:e,events:t,t:n}){return(0,W.jsx)("div",{className:"ztd-sr",style:Kt,children:(0,W.jsxs)("table",{children:[(0,W.jsx)("caption",{children:n.table(e)}),(0,W.jsxs)("tbody",{children:[t.slice(0,Vt).map((r,o)=>(0,W.jsxs)("tr",{children:[(0,W.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,W.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Vt?(0,W.jsx)("tr",{children:(0,W.jsx)("td",{colSpan:2,children:n.more(t.length-Vt)})}):null]})]})})}function Ee(e){let t=e.baseline??"central";return(0,W.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),fe=y("label","string",!0,"Item name field"),oe=y("value","number",!0,"Value field"),za=[fe,oe],Ba=[fe,oe],Ha=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],ja=[fe,oe],Ga=[y("label","string",!0,"Leaf (lowest level) name"),oe,y("group","string",!1,"Parent group field")],Wa=[y("label","string",!0,"Leaf name"),oe,y("group","string",!1,"Parent group field")],Va=[fe,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],Ka=[fe,oe],Ua=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),oe],Xa=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),oe],Ya=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],qa=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],fo=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Ja=[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}),fo],Za=[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}),fo],Qa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],es=[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})],ts=[fe,oe],ns=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],rs=[fe,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],os=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],is=[fe,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],as=[fe,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],ss=[fe,oe],ls=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],cs=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],us=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),oe],ms=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),oe],ds=[y("date","date",!0,"Date field"),oe],fs=[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)")],hs=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],gs=[y("label","string",!1,"Row name field")],ps=[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")],bs=[fe,oe],ys=[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})],xs=[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)")],ks=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),oe],ws=[fe,oe,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")],$s=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],vs=[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")],Ms=[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")],Ts=[y("region","string",!0,"Region name or code, matched to a region of options.map"),oe],Cs=[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)")],Ss=[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")],As=[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")],mo={pie:za,donut:Ba,funnel:Ha,waffle:ja,treemap:Ga,sunburst:Wa,waterfall:Va,pareto:Ka,marimekko:Ua,heatmap:Xa,radar:Ya,bubble:qa,line:Ja,area:Za,stream:Qa,bar:es,radialBar:ts,gauge:ns,bullet:rs,sparkline:os,slope:is,dumbbell:as,lollipop:ss,beeswarm:ls,ridgeline:cs,sankey:us,chord:ms,calendar:ds,bump:fs,box:hs,parallel:gs,candlestick:ps,segmented:bs,skyline:ys,histogram:xs,scatter:As,tileMap:ks,barRace:ws,network:$s,timeline:vs,tree:Ms,choropleth:Ts,symbolMap:Cs,flowMap:Ss},st={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 ho(e,t){return t==="ko"?e.nameKo:e.name}function go(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var po=["line","area","bar","scatter"],bo=24,zn=["line","area","bar","scatter","timeline"];function Bn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function yo(e,t,n){return zn.includes(e)&&!Bn(e,t,n).length&&!(e==="scatter"&&Ut(n))}function Ut(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function xo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ns={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",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 Xt(e){let t=mo[e]?e:Ns[e]??Object.keys(st).find(n=>n.toLowerCase()===e.toLowerCase()||st[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!st[t]))return{type:t,component:st[t].component,name:st[t].name,nameKo:st[t].nameKo,encoding:mo[t]}}function ko(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 Xt(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 wt(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Fs(e,t){if(e==null||typeof e!="object")return;let n=e;if(wt(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!wt(r,o))return;r=r[o]}return r}}function he(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 Oe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Fs(r,n)}function Fe(e,t){let n=Oe(e,t);return(r,o)=>he(n(r,o))}function ge(e,t){let n=Oe(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 $e(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Rs(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
23
- `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var _s=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function wo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(_s.test(t)||/^[-+]?\.\d+$/.test(t)){let n=he(t);if(Number.isFinite(n))return n}return t}function Ve(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??Rs(o),a=[],s=[],l="",c=!1;for(let d=0;d<o.length;d++){let g=o[d];c?g==='"'?o[d+1]==='"'?(l+='"',d++):c=!1:l+=g:g==='"'&&!l.trim()?(c=!0,l=""):g===i?(s.push(l),l=""):g===`
22
+ `;function Or(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 Ir(e,t){let[n]=(0,Er.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Lr=!1;function bt(){if(Lr||typeof document>"u"||(Lr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=pa,document.head.appendChild(e)}var Dt=F(q(),1),ye=typeof window<"u"&&typeof document<"u",Te=ye?Dt.useLayoutEffect:Dt.useEffect;function Lt(){return typeof performance<"u"?performance.now():Date.now()}function Z(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ce(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var zr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Br={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ba=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ya={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function xa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ka(e){return xa(ba,e)}function Hr(e,t){let n=ka(e);return{text:n?n[t]:e,...ya[n?.id??"basic"]}}var jr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function rt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),jr[t.toLowerCase()]&&(t=jr[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 Vr(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 Tn(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 ot(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Gr(e){return .2126*ot(e[0])+.7152*ot(e[1])+.0722*ot(e[2])}function Cn(e,t,n){let r=typeof e=="string"?rt(e):e,o=typeof t=="string"?rt(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?rt(n):n:null;o[3]<1&&i&&(o=Tn(o,i));let a=r[3]<1?Tn(r,o):r,s=Gr(a),l=Gr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function wa(e){return[ot(e[0]),ot(e[1]),ot(e[2])]}function Mn(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 Wr(e){let[t,n,r]=wa(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 va([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[Mn(4.0767416621*o-3.3077115913*i+.2309699292*a),Mn(-1.2684380046*o+2.6097574011*i-.3413193965*a),Mn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Et(e,t,n){let r=rt(e),o=rt(t);if(!r||!o)return e;let i=Wr(r),a=Wr(o),s=Math.max(0,Math.min(1,n));return Vr(va([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 Sn(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Cn(i,e,n);a>o&&(o=a,r=i)}return r}function ne(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function $a(e,t){let n=Sn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Cn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Sn(t,["#FFFFFF","#000000"])}function Ot(e,t){let n=Et(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:$a(e,n),raw:n}}function xe(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=ne(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=ne(e,"neutral");else if(s===0)r[a]=ne(e,"ink");else if(s===i-1)r[a]=ne(e,"neutral");else if(i===3)r[a]=ne(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?ne(e,"strong"):Ot(e,1-l)}}),r}var An="mix:";function Le(e){return e({theme:kn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${An}${o}`}).map(n=>n.fill)}function Kr(e,t){return t?.startsWith(An)?e.mix("neutralStrong","neutral",Number(t.slice(An.length))):e.color(t)}function yt(e,t,n){return xe(e,t+1,n).slice(0,t)}function Xr(e,t,n,r="neutral"){let o=ne(e,"accent"),i=ne(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Ur(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=ne(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=ne(e,"neutral"):s===0?r[a]=ne(e,"strong"):s===i-1?r[a]=ne(e,"neutral"):r[a]=Ot(e,1-s/(i-1))}),r}var ke=F(q(),1);var It=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ae="en-US",Yr=new Map;function Nn(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=Yr.get(r);return o||(o=new Intl.NumberFormat(e,n),Yr.set(r,o)),o}function Rn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function at(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ae,...r}=t;return Rn(Nn(n,r).format(e))}var Fn=e=>e!==0&&Math.abs(e)<.05,_n=(e,t,n="")=>`${at(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function it(e,t={}){if(!Number.isFinite(e))return"-";if(Fn(e)&&t.maximumFractionDigits===void 0)return _n(e,t.locale??ae,"%");let n=Math.abs(e);return`${at(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Qr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ae,...r}=t;if(Z(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,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+at(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Rn(Nn(n,{notation:"compact",...r}).format(e))}var Ma=(e,t=Z(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function We(e,t=ae,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=Nn(t,o);return l=>Number.isFinite(l)?`${a}${Rn(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=>it(o,{locale:t});case"ratio":return o=>it(o*100,{locale:t});case"compact":return o=>Qr(o,{locale:t});case"currency":return r(Ma(t));default:{let o=r({maximumFractionDigits:1});return i=>Fn(i)?_n(i,t):o(i)}}}function xt(e,t=ae,n=0){return e!==void 0?We(e,t):n>=1e5?r=>Fn(r)?_n(r,t):Qr(r,{locale:t}):r=>at(r,{locale:t})}function Ta(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Pn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Ca=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Sa=["january","february","march","april","may","june","july","august","september","october","november","december"],qr=e=>{let t=e.toLowerCase();return t.length<3?0:Sa.findIndex(n=>n.startsWith(t))+1},Jr=e=>+e+(+e<30?2e3:1900);function eo(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Aa=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],to=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,no=/\{([^{}]+)\}/g;function zt(e,t){let n;for(let r of Aa)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?[Jr(n[3]),+n[2],+n[1],1]:[Jr(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=to.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=qr(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=qr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var ro=e=>Ca.test(e)||zt(e)!==null;function oo(e){let t;for(let n of e){let r=typeof n=="string"?to.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Bt(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(Pn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Bt(`${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=zt(n,t);if(r)return Ta(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 Zr=new Map;function kt(e,t={month:"short",day:"numeric"}){let n=Bt(e);if(!n)return"-";let{locale:r=ae,...o}=t,i=r+JSON.stringify(o),a=Zr.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Zr.set(i,a)),a.format(n)}var Dn=F(G(),1),Ht=(0,ke.createContext)({theme:De,cssVars:!0});function Na(e,t=De){return e?typeof e=="string"?wn[e]??t:$n(t,e):t}function jt(e){let t=(0,ke.useContext)(Ht),n=e.base?wn[e.base]:t.theme,r=(0,ke.useMemo)(()=>Na(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,ke.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,ke.useMemo)(()=>vn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Dn.jsx)(Ht.Provider,{value:a,children:(0,Dn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Ra=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function ao(e){return Ra.has(e)}function Fa(e,t){let n=r=>t?`var(${Pt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?ao(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?ao(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)})`:Et(e[r],e[o],i)}}}function we(e){let t=(0,ke.useContext)(Ht);return(0,ke.useMemo)(()=>{let n=$n(t.theme,e);return Fa(n,t.cssVars)},[t.theme,t.cssVars,e])}function se(e){let t=(0,ke.useContext)(Ht);return e??t.locale??ae}function so(e){return e?vn(e):{}}var Gt=F(q(),1),Ln=(0,Gt.createContext)(void 0);function lo(e){let t=(0,Gt.useContext)(Ln);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=F(G(),1),_a={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`},Pa={en:_a,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Da={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},En=e=>Pa[Z(se(e))];function On(e){let t=we(e.theme),n=En(e.locale),[r,o]=(0,Wt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.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((m,u)=>{let f=!s.has(m.label),p=f&&l===1,d=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(La,{p:t,item:m,off:!f}),(0,_.jsx)("span",{style:f?void 0:{textDecoration:"line-through"},children:m.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":f,"aria-disabled":p||void 0,onClick:()=>{p||(a(m.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:p?"default":void 0},children:d}):d},u)})});return a?(0,_.jsxs)(_.Fragment,{children:[c,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Da,children:r?n.shown(l,e.items.length):""})]}):c}function La({p:e,item:t,off:n}){let r=Kr(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 Ea(e){let t=we(e.theme),n=Hr(e.level,Z(se(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 Oa(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 co(e){let t=we(e.theme),n=En(e.locale),[r,o]=(0,Wt.useState)(0);Te(()=>bt(),[]);let i=()=>{o(f=>f+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)(On,{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,m=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)(Ea,{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:Oa(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)(Ln.Provider,{value:r,children:(0,_.jsx)(nt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,_.jsxs)(_.Fragment,{children:[m,u]}):u]})}function In(e){let t=we(e.theme),n=En(e.locale),r=e.height??220;if(Te(()=>bt(),[]),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 ut=F(q(),1);var le=F(q(),1);var W=F(G(),1),Vt=60;var Kt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function uo(e){let{c:t,events:n}=e,r=(0,le.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Te(()=>{bt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,le.useContext)(nt),c=e.ariaLabel??l??e.kind,m=(0,le.useMemo)(()=>s?`${n.length}${n.slice(0,Vt).map(w=>`${w.label}${w.series??""}${w.formatted??w.value??""}`).join("")}`:"",[n,s]),u=(0,le.useMemo)(()=>(0,W.jsx)(Ia,{label:c,events:n,t:t.t}),[c,m,t.t]),f=(0,le.useRef)(null);(0,le.useEffect)(()=>{let w=()=>{f.current=null};return window.addEventListener("scroll",w,{capture:!0,passive:!0}),window.addEventListener("resize",w,{passive:!0}),()=>{window.removeEventListener("scroll",w,{capture:!0}),window.removeEventListener("resize",w)}},[]),(0,le.useEffect)(()=>{f.current=null},[t.width,t.height]);let p=w=>{if(w.target!==w.currentTarget)return;if(e.onKey?.(w)){w.preventDefault();return}let R=t.active,E;switch(w.key){case"ArrowRight":case"ArrowDown":E=R===null?0:(R+1)%a;break;case"ArrowLeft":case"ArrowUp":E=R===null?a-1:(R-1+a)%a;break;case"Home":E=0;break;case"End":E=a-1;break;case"Escape":if(R===null)return;E=null;break;case"Enter":case" ":R!==null&&(w.preventDefault(),t.click(R));return;default:return}w.preventDefault(),t.setActive(E,"keyboard")},{via:d,node:g,setActive:k}=t;(0,le.useEffect)(()=>{if(d!=="touch"||!g)return;let w=R=>{g.contains(R.target)||k(null)};return document.addEventListener("pointerdown",w),()=>document.removeEventListener("pointerdown",w)},[d,g,k]);let y=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,T=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,A=typeof e.renderTip=="function"&&y?e.renderTip(y):null,x=e.announce??(t.via==="keyboard"&&y?`${y.label}${y.series?` ${y.series}`:""}: ${y.formatted??y.value??""} (${(t.active??0)+1}/${a})`:""),S;if(v){let w=v.x*T,R=t.width*T,E=`clamp(${(4-w).toFixed(1)}px, -50%, calc(${(R-w-4).toFixed(1)}px - 100%))`,j=v.y<64;S={position:"absolute",left:w,top:v.y*T,transform:`translate(${E}, ${j?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*T-8)}}let B=w=>{f.current=null,w.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},H=w=>w?R=>{let E=f.current??(f.current=R.currentTarget.getBoundingClientRect());E.width&&w((R.clientX-E.left)/E.width*t.width,(R.clientY-E.top)/E.height*t.height,R)}:void 0,L=H(e.onPointerMove),D=H(e.onPointerDown),N=L||D?w=>{w.pointerType==="touch"&&L?.(w),D?.(w)}:void 0,C=H(e.onPointerUp),$=so(e.theme);return(0,W.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?p:void 0,onBlur:w=>{t.via==="keyboard"&&!w.currentTarget.contains(w.relatedTarget)&&t.setActive(null)},onPointerLeave:B,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"),...$,...e.style},children:[t.pending?null:e.underlay,(0,W.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:L,onPointerDown:N,onPointerUp:C,onPointerCancel:C,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,W.jsx)("title",{id:o,children:c}),(0,W.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,W.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,W.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:S,children:A??(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map((w,R)=>(0,W.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(w.strong?"ink":"muted")},children:[w.color?(0,W.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:w.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,w.label]}),(0,W.jsx)("span",{style:{fontWeight:w.strong===!1?500:700},children:w.value})]},R))]})}):null,(0,W.jsx)("span",{className:"ztd-sr",style:Kt,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?u:null]})}function Ia({label:e,events:t,t:n}){return(0,W.jsx)("div",{className:"ztd-sr",style:Kt,children:(0,W.jsxs)("table",{children:[(0,W.jsx)("caption",{children:n.table(e)}),(0,W.jsxs)("tbody",{children:[t.slice(0,Vt).map((r,o)=>(0,W.jsxs)("tr",{children:[(0,W.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,W.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Vt?(0,W.jsx)("tr",{children:(0,W.jsx)("td",{colSpan:2,children:n.more(t.length-Vt)})}):null]})]})})}function Ee(e){let t=e.baseline??"central";return(0,W.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var b=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),fe=b("label","string",!0,"Item name field"),oe=b("value","number",!0,"Value field"),za=[fe,oe],Ba=[fe,oe],Ha=[b("label","string",!0,"Stage name"),b("value","number",!0,"Users at the stage")],ja=[fe,oe],Ga=[b("label","string",!0,"Leaf (lowest level) name"),oe,b("group","string",!1,"Parent group field")],Wa=[b("label","string",!0,"Leaf name"),oe,b("group","string",!1,"Parent group field")],Va=[fe,b("value","number",!0,"Change (total rows may omit it)"),b("type","string",!1,'"total" makes a total bar')],Ka=[fe,oe],Xa=[b("x","string",!0,"Column field"),b("series","string",!0,"Stacked series field"),oe],Ua=[b("x","string",!0,"Column field"),b("y","string",!0,"Row field"),oe],Ya=[b("axis","string",!0,"Metric (axis) field"),b("value","number",!0,"Value field",{multi:!0}),b("series","string",!1,"Series field")],qa=[b("x","number",!0,"x value"),b("y","number",!0,"y value"),b("size","number",!1,"Circle size"),b("label","string",!1,"Name")],fo=b("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Ja=[b("x","any",!0,"x field (date, number or category)"),b("y","number",!0,"y field. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field (long tables)"),b("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),fo],Za=[b("x","any",!0,"x field"),b("y","number",!0,"y field. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field"),b("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}),fo],Qa=[b("x","any",!0,"x field"),b("y","number",!0,"y field",{multi:!0}),b("series","string",!1,"Series field")],es=[b("x","string",!0,"Category field"),b("y","number",!0,"Value field. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field"),b("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})],ts=[fe,oe],ns=[b("value","number",!0,"Value field",{prop:"valueKey"}),b("target","number",!1,"Target field",{prop:"targetKey"})],rs=[fe,b("value","number",!0,"Actual value field"),b("target","number",!1,"Target field")],os=[b("x","any",!1,"x field"),b("y","number",!0,"y field")],is=[fe,b("x","string",!1,"Period field (long tables)"),b("value","number",!1,"Value field (long tables)")],as=[fe,b("start","number",!0,"Before value"),b("end","number",!0,"After value")],ss=[fe,oe],ls=[b("value","number",!0,"Value field"),b("group","string",!1,"Group (row) field"),b("label","string",!1,"Dot name")],cs=[b("group","string",!0,"Group field"),b("value","number",!0,"Value field")],us=[b("source","string",!1,"Source node"),b("target","string",!1,"Target node"),b("dimensions","string",!1,"Stage columns of a wide table, left to right (2 to 6). Each row is one path, so source and target are not used. Without value, each row counts 1",{multi:!0}),b("value","number",!1,"Value field")],ms=[b("source","string",!0,"Sending group"),b("target","string",!0,"Receiving group"),oe],ds=[b("date","date",!0,"Date field"),oe],fs=[b("x","any",!0,"Period field"),b("series","string",!0,"Item field"),b("rank","number",!1,"Rank field (1 is first)"),b("value","number",!1,"Value field (instead of rank, largest is first)")],hs=[b("group","string",!0,"Group field"),b("value","number",!0,"Value field")],gs=[b("label","string",!1,"Row name field")],ps=[b("x","date",!0,"Date (period) field"),b("open","number",!0,"Open price field"),b("high","number",!0,"High price field"),b("low","number",!0,"Low price field"),b("close","number",!0,"Close price field"),b("volume","number",!1,"Volume field")],bs=[fe,oe],ys=[b("x","any",!0,"Period field (date or category)"),b("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field (long tables, back row only)"),b("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],xs=[b("value","number",!1,"Sample value field (raw rows)"),b("group","string",!1,"Group field. Up to 2 groups overlap"),b("x0","number",!1,"Bin start (pre-binned rows)"),b("x1","number",!1,"Bin end (pre-binned rows)"),b("count","number",!1,"Samples in the bin (pre-binned rows)")],ks=[b("region","string",!0,"Region name or code, matched to a tile of options.map"),oe],ws=[fe,oe,b("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")],vs=[b("source","string",!0,"Source node"),b("target","string",!0,"Target node"),b("value","number",!1,"Link weight. Without it every row counts 1")],$s=[b("label","string",!0,"Row name. Items with the same name share a row"),b("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),b("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),b("group","string",!1,"Group field (one color per group, and the legend)"),b("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")],Ms=[b("label","string",!0,"Node name field"),b("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),b("group","string",!1,"Parent group field (flat rows, as in the treemap)"),b("id","string",!1,"Row id for id/parent rows. Defaults to the label"),b("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Ts=[b("region","string",!0,"Region name or code, matched to a region of options.map"),oe],Cs=[b("lon","number",!1,"Longitude (degrees)"),b("lat","number",!1,"Latitude (degrees)"),b("size","number",!1,"Value (circle area). Without it all circles match"),b("label","string",!1,"Place name"),b("region","string",!1,"Region of options.map, for rows without lon and lat"),b("group","string",!1,"Group field (one color per group)")],Ss=[b("source","string",!0,"Start: a name in options.places or a region"),b("target","string",!0,"End"),b("value","number",!1,"Amount. Without it each row counts 1")],As=[b("cohort","any",!0,"Cohort: a name or a start date. Cohorts go in date order when all read as dates, otherwise in order of first appearance"),b("period","any",!0,"Periods since the cohort started: 0, 1, 2 ... In number order when all are numbers"),b("value","number",!0,"People still active, or the share still active (see options.valueType)"),b("size","number",!1,"Cohort size. The first value of each cohort counts")],Ns=[b("x","any",!0,"x field (date, number or category)"),b("y","number",!0,"y field. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field (long tables)")],Rs=[b("x","number",!0,"x value"),b("y","number",!0,"y value"),b("series","string",!1,"Series field (one color per series)"),b("label","string",!1,"Name")],Fs=[b("label","string",!0,"Row name field (one row per metric)"),b("x","any",!0,"Period field (date, number or category). Every row shares the same period axis"),oe,b("target","number",!1,"Target field. Each row uses its last filled value")],mo={pie:za,donut:Ba,funnel:Ha,waffle:ja,treemap:Ga,sunburst:Wa,waterfall:Va,pareto:Ka,marimekko:Xa,heatmap:Ua,radar:Ya,bubble:qa,line:Ja,area:Za,stream:Qa,bar:es,radialBar:ts,gauge:ns,bullet:rs,sparkline:os,slope:is,dumbbell:as,lollipop:ss,beeswarm:ls,ridgeline:cs,sankey:us,chord:ms,calendar:ds,bump:fs,box:hs,parallel:gs,candlestick:ps,segmented:bs,skyline:ys,histogram:xs,scatter:Rs,tileMap:ks,barRace:ws,network:vs,timeline:$s,tree:Ms,choropleth:Ts,symbolMap:Cs,flowMap:Ss,sparkTable:Fs,cohort:As,horizon:Ns},st={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:"흐름 지도"},sparkTable:{component:"SparkTable",name:"KPI table",nameKo:"지표 표"},cohort:{component:"CohortChart",name:"Cohort chart",nameKo:"코호트 차트"},horizon:{component:"HorizonChart",name:"Horizon chart",nameKo:"호라이즌 차트"}};function ho(e,t){return t==="ko"?e.nameKo:e.name}function go(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var po=["line","area","bar","scatter"],bo=24;var zn=["line","area","bar","scatter","timeline"];function Bn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function yo(e,t,n){return zn.includes(e)&&!Bn(e,t,n).length&&!(e==="scatter"&&Xt(n))}function Xt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function xo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var _s={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",butterfly:"bar",pyramid:"bar",populationPyramid:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",raincloud:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap",alluvial:"sankey",parallelSets:"sankey",kpiTable:"sparkTable",metricTable:"sparkTable",sparklineTable:"sparkTable",retention:"cohort",cohortTable:"cohort",retentionTable:"cohort",horizonChart:"horizon",horizonGraph:"horizon"};function Ut(e){let t=mo[e]?e:_s[e]??Object.keys(st).find(n=>n.toLowerCase()===e.toLowerCase()||st[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!st[t]))return{type:t,component:st[t].component,name:st[t].name,nameKo:st[t].nameKo,encoding:mo[t]}}function ko(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 Ut(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 wt(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ps(e,t){if(e==null||typeof e!="object")return;let n=e;if(wt(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!wt(r,o))return;r=r[o]}return r}}function he(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 Oe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ps(r,n)}function Re(e,t){let n=Oe(e,t);return(r,o)=>he(n(r,o))}function ge(e,t){let n=Oe(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 ve(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ds(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
23
+ `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var Ls=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function wo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Ls.test(t)||/^[-+]?\.\d+$/.test(t)){let n=he(t);if(Number.isFinite(n))return n}return t}function Ve(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??Ds(o),a=[],s=[],l="",c=!1;for(let d=0;d<o.length;d++){let g=o[d];c?g==='"'?o[d+1]==='"'?(l+='"',d++):c=!1:l+=g:g==='"'&&!l.trim()?(c=!0,l=""):g===i?(s.push(l),l=""):g===`
24
24
  `||g==="\r"?(g==="\r"&&o[d+1]===`
25
- `&&d++,s.push(l),a.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(d=>!(d.length===1&&d[0].trim()===""));if(!m.length)return[];let u=d=>n?wo(d):d;if(!r)return m.map(d=>Object.fromEntries(d.map((g,k)=>[String(k),u(g)])));let f=[],p=new Set;return m[0].forEach((d,g)=>{let k=d.trim()||`col${g+1}`,b=k;for(let $=2;p.has(b);$++)b=`${k}_${$}`;p.add(b),f.push(b)}),m.slice(1).map(d=>Object.fromEntries(f.map((g,k)=>[g,u(d[k]??"")])))}function Hn(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"?wo(a[l]):a[l]??null])))}function Ps(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 $o(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 Ie(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ie(JSON.parse(t))}catch{}return Ve(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Hn(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)?Ie(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Hn(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)?Ie(t.rows):Array.isArray(t.values)?Hn(t.values):Array.isArray(t.items)?Ie(t.items):Array.isArray(t.results)?Ie(t.results):Ps(t)}return[]}function Yt(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 jn(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 m=e[l][c];return Number.isFinite(m)&&m>0?m: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 m=0,u=0;for(let f=0;f<n;f++){let p=a(f,c),d=p-a(f,c-1),g=0;for(let k=0;k<f;k++)g+=a(k,c)-a(k,c-1);m+=p,u+=(d/2+g)*p}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,f=0;for(let p=0;p<n;p++){let d=e[p][l],g=Number.isFinite(d)?d:0;g>=0?(o[p][l]=u,u+=g,i[p][l]=u):(o[p][l]=f,f+=g,i[p][l]=f)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let f=a(u,l);t==="expand"&&(f=c?f/c*100:0),o[u][l]=m,m+=f,i[u][l]=m}}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 m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let f=0;f<r;f++)o[u][f]-=m,i[u][f]-=m}return{y0:o,y1:i}}function vo(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 Mo(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((f,p)=>{f>u&&(u=f,m=p)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),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 Ds=Math.PI*2;function qt(e,t,n){return e<t?t:e>n?n:e}function To(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function M(e){return Math.round(e*100)/100}function Jt(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=qt(i.tl??0,0,a),l=qt(i.tr??0,0,a),c=qt(i.br??0,0,a),m=qt(i.bl??0,0,a);return`M${M(e+s)},${M(t)}H${M(e+n-l)}`+(l?`A${M(l)},${M(l)} 0 0 1 ${M(e+n)},${M(t+l)}`:"")+`V${M(t+r-c)}`+(c?`A${M(c)},${M(c)} 0 0 1 ${M(e+n-c)},${M(t+r)}`:"")+`H${M(e+m)}`+(m?`A${M(m)},${M(m)} 0 0 1 ${M(e)},${M(t+r-m)}`:"")+`V${M(t+s)}`+(s?`A${M(s)},${M(s)} 0 0 1 ${M(e+s)},${M(t)}`:"")+"Z"}function Ls(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${M(l[0])},${M(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${M(l[0])},${M(l[1])}`).join("");let o=[],i=[];for(let l=0;l<n-1;l++){let c=e[l+1][0]-e[l][0];o.push(c),i.push(c===0?0:(e[l+1][1]-e[l][1])/c)}let a=[i[0]];for(let l=1;l<n-1;l++)if(i[l-1]*i[l]<=0)a.push(0);else{let c=2*o[l]+o[l-1],m=o[l]+2*o[l-1];a.push((c+m)/(c/i[l-1]+m/i[l]))}a.push(i[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let c=o[l]/3;s+=`C${M(e[l][0]+c)},${M(e[l][1]+a[l]*c)} ${M(e[l+1][0]-c)},${M(e[l+1][1]-a[l+1]*c)} ${M(e[l+1][0])},${M(e[l+1][1])}`}return s}function Co(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return Ls(e);if(t==="step"){let n=`M${M(e[0][0])},${M(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${M(o)}V${M(e[r][1])}H${M(e[r][0])}`}return n}return Es(e)}function Es(e){if(!e.length)return"";let t=`M${M(e[0][0])},${M(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${M(e[n][0])},${M(e[n][1])}`;return t}function Ke(e,t){if(!e.length)return NaN;let n=(e.length-1)*t,r=Math.floor(n),o=n-r;return e[r+1]!==void 0?e[r]+o*(e[r+1]-e[r]):e[r]}function So(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function No(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Ao(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var Zt=new Map;function ve(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=Zt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);No(c)?a+=Ao(c):s+=Ao(c)}i=a+s*(n>=600?1.07:1),Zt.size>5e3&&Zt.clear(),Zt.set(o,i)}return i*t}function Gn(e,t,n,r=400){if(e=e.trim(),ve(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ve(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<(No(s.charCodeAt(0))?2:3)?"":s+o}var Ro=R(G(),1),Os=e=>Array.isArray(e)&&e.length===2;function Fo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Os(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var lt=R(G(),1),Ue=10.5;function _o(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=>at(a,{locale:n,maximumFractionDigits:i}))}function Qt(e,t,n){let r=18;for(let o of _o(e,t,n))r=Math.max(r,ve(o,Ue));return Math.ceil(r+8)}function Po(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:_o(n,a,e.locale);return(0,lt.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,m)=>{let u=Math.round(r(c))+.5,f=c===0&&e.zero!==!1;return(0,lt.jsxs)("g",{children:[(0,lt.jsx)("line",{x1:o,x2:i,y1:u,y2:u,stroke:t.paint(f?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:f?.7:1}),l?(0,lt.jsx)(Ee,{x:s?i+6:o-6,y:u,anchor:s?"start":"end",size:Ue,fill:t.paint("muted"),children:l[m]}):null]},c)})})}function Do(e,t,n){let r=[],o=-1/0;for(let i of e){let a=ve(i.label,Ue),s=Math.max(i.x-a/2,0);s<o+8||i.x-a/2<t||i.x+a/2>n||(r.push(i),o=s+a)}return r}function Wn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function ze(e,t,n=4,r={}){let o=e,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=Wn(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,f=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-f<=l*.3?f:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let p=Wn(c[1]-c[0],n);if(p===l)break;l=p}return c}function en(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Wn(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 Xe(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)=>en(n,r,l),s}function Vn(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]=ze(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function Is(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,m=1)=>{let u=[];for(let f=Math.floor(r);f<=Math.ceil(o);f++)if(!(f%m))for(let p of c){let d=Number((p*10**f).toPrecision(12));d>=e*(1-1e-9)&&d<=t*(1+1e-9)&&u.push(d)}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:en(e,t,3)}function Lo(e,t){let n=Xe([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=()=>Is(e[0],e[1],Math.abs(t[1]-t[0])),r}function Ye(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 zs=864e5;function Eo(e,t,n,r=ae){let o=t-e;if(!(o>0))return[{t:e,label:kt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/zs,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,f,p=!1)=>{let d=new Date(m),g=-1,k=0;for(;d.getTime()<=t&&k++<500;){if(d.getTime()>=e){let b=d.getFullYear(),$=p&&!l&&b!==g;a.push({t:d.getTime(),label:kt(d,{locale:r,...f,...$?{year:"numeric"}:{}})}),g=b}u(d)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(p=>p>=m)??12,f=new Date(s);f.setMinutes(0,0,0),c(f,p=>p.setHours(p.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),f=[1,2,3,6,12,24,60].find(p=>p>=u)??120;if(f>=12){let p=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(p,d=>d.setFullYear(d.getFullYear()+f/12),{year:"numeric"})}else{let p=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),d=p.getMonth()%f;d&&p.setMonth(p.getMonth()+(f-d)),c(p,g=>g.setMonth(g.getMonth()+f),{month:"short"},!0)}}return a}function Oo(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 Bs=(e,t,n)=>e==="date"?Bt(t,n)?.getTime()??NaN:he(t);function Hs(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&ro(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function $t(e,t,n,r,o={}){let i=Oe(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Oe(n,"y"),c=!a&&r!==void 0?Oe(r,"series"):null,m=e.map((v,w)=>i(v,w)),u=o.xType??Hs(m),f=o.locale??ae,p,d,g;if(u==="band"){let v=m.map(F=>String(F??""));p=$e(v);let w=new Map(p.map((F,E)=>[F,E]));d=p.map((F,E)=>E),g=Int32Array.from(v,F=>w.get(F)??-1)}else{let v=u==="date"?o.dayFirst??oo(m):void 0,w=m.map(j=>Bs(u,j,v)),F=Array.from(new Set(w.filter(j=>Number.isFinite(j)))).sort((j,ie)=>j-ie),E=new Map(F.map((j,ie)=>[j,ie]));d=F,p=F.map(String),g=Int32Array.from(w,j=>E.get(j)??-1)}let k=o.dateFormat,b=v=>typeof v=="string"?zt(v.trim())?.[3]:void 0,$=u==="date"&&m.length<5e3?b(m[0]):void 0,T=($===2||$===3)&&m.every(v=>b(v)===$),A=T&&$===3;if(u==="date"&&!k){let v=d.length>1?d[d.length-1]-d[0]:0;k=T&&$===2||v>864e5*120?{month:"short"}:v<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},v>864e5*800&&(k={year:"numeric",month:"short"})}let x;if(u==="band")x=p;else if(A&&!o.dateFormat){let v=Z(f)==="ko";x=d.map(w=>{let F=new Date(w),E=Math.floor(F.getMonth()/3)+1;return v?`${F.getFullYear()}년 ${E}분기`:`Q${E} ${F.getFullYear()}`})}else{let v=d.every(Pn),w=u==="date"?new Intl.DateTimeFormat(f,k):new Intl.NumberFormat(f,v?{useGrouping:!1}:{maximumFractionDigits:6});x=d.length>1e3?Oo(d.length,F=>w.format(d[F])):d.map(F=>w.format(F))}let S=s?[...s]:c?$e(e.map((v,w)=>String(c(v,w)??""))):[""],B=new Map(S.map((v,w)=>[v,w])),H=S.map(()=>new Array(p.length).fill(NaN)),L=S.map(()=>new Array(p.length).fill(null)),D=o.aggregate??"sum",N=D==="mean"?S.map(()=>new Uint32Array(p.length)):null,C=(v,w,F,E)=>{let j=H[v][w];D==="last"?H[v][w]=F:D==="count"?H[v][w]=(Number.isFinite(j)?j:0)+1:D==="mean"?Number.isFinite(F)&&(H[v][w]=(Number.isFinite(j)?j:0)+F,N[v][w]++):H[v][w]=Number.isFinite(j)?j+(Number.isFinite(F)?F:0):F,L[v][w]=E};for(let v=0;v<e.length;v++){let w=g[v];if(w<0)continue;let F=e[v];if(s)for(let E=0;E<s.length;E++)C(E,w,he(F[s[E]]),F);else{let E=c?B.get(String(c(F,v)??""))??0:0;C(E,w,he(l(F,v)),F)}}if(N)for(let v=0;v<H.length;v++)for(let w=0;w<p.length;w++)N[v][w]>1&&(H[v][w]/=N[v][w]);return{type:u,keys:p,xnum:d,labels:x,series:S,values:H,rows:L}}var js=140,Mt=12,Io=14,Kn=20,zo=12.5;function Gs(e,t,n=bo){let r=ge(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 Ws(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Mt)/(js+Mt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Vs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Mt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var vt=e=>e.filter(Number.isFinite);function tn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Fe(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return vt(n)}function Bo(e,t,n,r,o,i){return $t(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Ks(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(),S=r.refLines??{},[B,H]=Ye([...tn(x,r.x??"x"),...vt([Number(S.x)])]),[L,D]=Ye([...tn(x,r.y??"y"),...vt([Number(S.y)])].filter(C=>!s||C>0)),N=r.zero??!1;return{y:c??(s?Vn(L,D,a):ze(L,D,a,{zero:N,pad:.08})),x:r.xDomain??ze(B,H,Math.max(2,Math.round(o/110)),{zero:N,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",f=n[0]?.keys.join(""),p=n.every(x=>x.keys.join("")===f),d=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),g=r.xDomain??(!m&&d?Ye(n.flatMap(x=>vt(x.xnum))):void 0),k=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(k==="percent")return{x:g,sameKeys:p};if(c)return{y:c,x:g,sameKeys:p};let b=[];t.forEach((x,S)=>{let B=n[S];if(k==="stacked"||k==="auto"&&B.series.length>1){let L=jn(B.values,"zero");L.y0.forEach(D=>b.push(...D)),L.y1.forEach(D=>b.push(...D))}else B.values.forEach(L=>b.push(...L));m&&!u&&r.line!==void 0&&Bo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(L=>b.push(...L)),m||b.push(...tn(x,r.lower),...tn(x,r.upper))}),m&&b.push(0),u||b.push(...Fo(r.annotations));for(let x of r.referenceLines??[])b.push(x.y);r.signColors&&b.push(Number(r.baseline??0));let[$,T]=Ye(vt(b).filter(x=>!s||x>0));return{y:s?Vn($,T,a):m?ze($,T,u?Math.max(2,Math.round(o/120)):a):ze($,T,a,{zero:r.zero??e==="area"}),x:g,sameKeys:p}}function Us(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=$t(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?Lo:Xe)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=Qt(c,xt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(x=>x.series),f=r.endLabels??n.some(x=>x.series.length>1),p=m+6,d=i-(f?Math.min(i*.28,Math.max(...u.map(x=>ve(x,11,700)),20)+14):10),g=l.keys.length,[k,b]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=l.type==="number"?g>12:g>Eo(k,b,Math.max(2,Math.floor((d-p)/64)),s).length;if(l.type==="band"||!g||$)return;let T=x=>p+(l.xnum[x]-k)/(b-k)*(d-p),A=x=>ve(l.labels[x],Ue);for(let x=1;;x++){let S=Array.from({length:Math.ceil(g/x)},(B,H)=>H*x);if(x>=g||S.every((B,H)=>!H||T(B)-T(S[H-1])>=(A(B)+A(S[H-1]))/2+8))return S.map(B=>({value:l.xnum[B],label:l.labels[B]}))}}function Xs(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 Ys(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${Xs(`${e}|${t}|${o}|${Yt(r)}`)}`}function qs(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 Js={en:{intro:(e,t)=>`${Ce(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:"(빈 값)"}},Un=18;function Ho(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Gs(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Ws(s,a,e.columns),{pw:c,ph:m}=Vs(s,l,e.height),u=e.scale!=="free",f=t==="scatter"?[]:o.map(N=>Bo(t,N,n,n.y,n.series,n.aggregate)),p=u?Ks(t,o,f,n,c,m):{sameKeys:!1},d=u?Us(t,o,f,n,p,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",k=u&&(!g||p.sameKeys),b=u&&(g||p.x!==void 0||p.sameKeys),$=new Set(qs(e.highlight,r)?[e.highlight].flat():[]),T=$.size>0,A=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??Ys(t,e.by,n,e.data),S=It(We(n.format,e.locale),n.unit),B=Js[e.lang],H=[],L=r.map(N=>N===""?B.blank:N);return{panels:r.map((N,C)=>{let v=o[C],w=L[C],F=C%l,E;if(t!=="scatter"){let ie=f[C],Se=ue=>ie.values.reduce((me,Je)=>me+(Number.isFinite(Je[ue])?Je[ue]:0),0),K=ie.keys.map((ue,me)=>me).filter(ue=>ie.values.some(me=>Number.isFinite(me[ue]))),re=K[K.length-1];H.push({first:K.length?Se(K[0]):NaN,last:K.length?Se(re):NaN,total:K.reduce((ue,me)=>ue+Se(me),0)}),t!=="bar"&&ie.series.length===1&&re!==void 0&&(E=S(ie.values[0][re]))}else H.push({first:NaN,last:NaN,total:v.length});let j={data:v,width:c,height:m,ariaLabel:e.title?`${e.title}, ${w}`:w,syncId:x,highlight:T?$.has(N)?A?()=>!0:void 0:"none":e.highlight,showYAxis:!k||F===0,showXAxis:!b||C+l>=a};return p.y&&(j.yDomain=p.y),p.x&&(j.xDomain=p.x),d&&(j.xTicks=d),{value:N,label:w,props:j,last:E,isPicked:$.has(N)}}),cols:l,pw:c,ph:m,isPanelPick:T,description:Zs(t,e.by,L,H,i,S,B)}}function Zs(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>So(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,f)=>r[f].last<r[f].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.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 ce=R(q(),1);function Qs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function el(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 nn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Wo(e,t=!0){let[n,r]=(0,ce.useState)({visible:!t,near:!t});return(0,ce.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=el(a[a.length-1],nn.threshold,nn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Qs(nn.threshold),rootMargin:nn.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 jo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function rn(e){let[t,n]=(0,ce.useState)(null),[r,o]=(0,ce.useState)(e??null),i=(0,ce.useCallback)(a=>{n(a),a&&e===void 0&&o(jo(a))},[e]);return Te(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a(jo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var tl=()=>()=>{};function ct(){return(0,ce.useSyncExternalStore)(tl,()=>!0,()=>!1)}var Go="(prefers-reduced-motion: reduce)";function on(e="auto"){let[t,n]=(0,ce.useState)(()=>ye&&typeof window.matchMedia=="function"?window.matchMedia(Go).matches:!1);return(0,ce.useEffect)(()=>{if(e!=="auto"||!ye||typeof window.matchMedia!="function")return;let r=window.matchMedia(Go),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=R(G(),1),nl=60,rl=420;function Vo(e){let t=we(),n=e.chartProps??{},[,r,o]=rn(e.width),i=e.width??(o||480),a=se(e.locale??n.locale),s=Z(a),l=(0,ut.useContext)(nt),c=e.title??l,m=e.chart.facetPlan,u=(0,ut.useMemo)(()=>{let b=Ho({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 m?m(b,n,a):b},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(b,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,i,e.height,c,a,s,m]),f=`${(0,ut.useId)().replace(/:/g,"")}fd`,p=on(n.reducedMotion??"auto"),d=ct(),g=Ir({motion:{enabled:n.animate!==!1&&!p&&ye},hydrated:d},{waiting:!1,generation:0}),k=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":f,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:f,style:Kt,children:e.description??u.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Mt,rowGap:Io,...u.legend?{marginTop:Un}:null},children:u.panels.map((b,$)=>{let T=t.paint(b.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":b.value,style:{minWidth:0,...Or(g,!1,"fade",$*nl,rl)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Kn,fontSize:zo,fontWeight:700,lineHeight:`${Kn}px`,color:T},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.label}),b.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:b.last}):null]}),(0,Me.jsx)(k,{...n,...b.props})]},b.value)})}),u.legend?(0,Me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Un},children:u.legend}):null]})}var Ko=["max","min","first","last","none"];function pe(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 m=-1,u=c==="max"?-1/0:1/0;r.forEach((f,p)=>{Number.isFinite(f)&&(c==="max"?f>u:f<u)&&(u=f,m=p)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),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((m,u)=>{m===c&&i.add(u)});return i}var be=R(q(),1);async function ol(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(Z(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ve(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 Ve(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ve(i)}async function il(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await ol(i,t.parse,o,t.locale)}return t.select&&(r=$o(r,t.select)),t.transform?t.transform(r):Ie(r)}function Uo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,be.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,be.useState)(0),c=se(t.locale),m=(0,be.useRef)(t);m.current={...t,locale:c};let u=(0,be.useRef)(e);u.current=e;let f=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",p=t.deps??[],d=JSON.stringify(p.map(b=>typeof b=="object"?JSON.stringify(b):String(b))),g=(0,be.useRef)(!1);(0,be.useEffect)(()=>{let b=u.current;if(!b||!r){a(A=>A.status==="loading"?{...A,status:"idle"}:A);return}let $=new AbortController,T=!0;return g.current=!0,a(A=>({...A,data:o?A.data:[],status:"loading",error:null})),il(b,{...m.current,signal:$.signal}).then(A=>{T&&a({data:A,status:"success",error:null,updatedAt:Date.now()})}).catch(A=>{!T||$.signal.aborted||a(x=>({...x,status:"error",error:A instanceof Error?A:new Error(String(A))}))}).finally(()=>{T&&(g.current=!1)}),()=>{T=!1,g.current=!1,$.abort()}},[f,r,s,d,o]),(0,be.useEffect)(()=>{if(!n||!r)return;let b=setInterval(()=>{g.current||l($=>$+1)},n);return()=>clearInterval(b)},[n,r]);let k=(0,be.useCallback)(()=>l(b=>b+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:k}}var Yn=R(G(),1),al=["csv","svg","png"],sl=/^[=+\-@\t\r\n=+-@]/,ll=/var\(|color-mix\(/;function Xo(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?eo(e.getTime()):String(e);return`"${(sl.test(t)&&!Number.isFinite(he(t))?`'${t}`:t).replace(/"/g,'""')}"`}function cl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function ul(e,t){return`\uFEFF${[t.map(Xo),...e.map(r=>t.map(o=>Xo(r[o])))].map(r=>r.join(",")).join(`\r
25
+ `&&d++,s.push(l),a.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(d=>!(d.length===1&&d[0].trim()===""));if(!m.length)return[];let u=d=>n?wo(d):d;if(!r)return m.map(d=>Object.fromEntries(d.map((g,k)=>[String(k),u(g)])));let f=[],p=new Set;return m[0].forEach((d,g)=>{let k=d.trim()||`col${g+1}`,y=k;for(let v=2;p.has(y);v++)y=`${k}_${v}`;p.add(y),f.push(y)}),m.slice(1).map(d=>Object.fromEntries(f.map((g,k)=>[g,u(d[k]??"")])))}function Hn(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"?wo(a[l]):a[l]??null])))}function Es(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 vo(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 Ie(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ie(JSON.parse(t))}catch{}return Ve(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Hn(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)?Ie(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Hn(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)?Ie(t.rows):Array.isArray(t.values)?Hn(t.values):Array.isArray(t.items)?Ie(t.items):Array.isArray(t.results)?Ie(t.results):Es(t)}return[]}function Yt(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 jn(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 m=e[l][c];return Number.isFinite(m)&&m>0?m: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 m=0,u=0;for(let f=0;f<n;f++){let p=a(f,c),d=p-a(f,c-1),g=0;for(let k=0;k<f;k++)g+=a(k,c)-a(k,c-1);m+=p,u+=(d/2+g)*p}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,f=0;for(let p=0;p<n;p++){let d=e[p][l],g=Number.isFinite(d)?d:0;g>=0?(o[p][l]=u,u+=g,i[p][l]=u):(o[p][l]=f,f+=g,i[p][l]=f)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let f=a(u,l);t==="expand"&&(f=c?f/c*100:0),o[u][l]=m,m+=f,i[u][l]=m}}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 m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let f=0;f<r;f++)o[u][f]-=m,i[u][f]-=m}return{y0:o,y1:i}}function $o(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 Mo(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((f,p)=>{f>u&&(u=f,m=p)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),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 Os=Math.PI*2;function qt(e,t,n){return e<t?t:e>n?n:e}function To(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function M(e){return Math.round(e*100)/100}function Jt(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=qt(i.tl??0,0,a),l=qt(i.tr??0,0,a),c=qt(i.br??0,0,a),m=qt(i.bl??0,0,a);return`M${M(e+s)},${M(t)}H${M(e+n-l)}`+(l?`A${M(l)},${M(l)} 0 0 1 ${M(e+n)},${M(t+l)}`:"")+`V${M(t+r-c)}`+(c?`A${M(c)},${M(c)} 0 0 1 ${M(e+n-c)},${M(t+r)}`:"")+`H${M(e+m)}`+(m?`A${M(m)},${M(m)} 0 0 1 ${M(e)},${M(t+r-m)}`:"")+`V${M(t+s)}`+(s?`A${M(s)},${M(s)} 0 0 1 ${M(e+s)},${M(t)}`:"")+"Z"}function Is(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${M(l[0])},${M(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${M(l[0])},${M(l[1])}`).join("");let o=[],i=[];for(let l=0;l<n-1;l++){let c=e[l+1][0]-e[l][0];o.push(c),i.push(c===0?0:(e[l+1][1]-e[l][1])/c)}let a=[i[0]];for(let l=1;l<n-1;l++)if(i[l-1]*i[l]<=0)a.push(0);else{let c=2*o[l]+o[l-1],m=o[l]+2*o[l-1];a.push((c+m)/(c/i[l-1]+m/i[l]))}a.push(i[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let c=o[l]/3;s+=`C${M(e[l][0]+c)},${M(e[l][1]+a[l]*c)} ${M(e[l+1][0]-c)},${M(e[l+1][1]-a[l+1]*c)} ${M(e[l+1][0])},${M(e[l+1][1])}`}return s}function Co(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return Is(e);if(t==="step"){let n=`M${M(e[0][0])},${M(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${M(o)}V${M(e[r][1])}H${M(e[r][0])}`}return n}return zs(e)}function zs(e){if(!e.length)return"";let t=`M${M(e[0][0])},${M(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${M(e[n][0])},${M(e[n][1])}`;return t}function Ke(e,t){if(!e.length)return NaN;let n=(e.length-1)*t,r=Math.floor(n),o=n-r;return e[r+1]!==void 0?e[r]+o*(e[r+1]-e[r]):e[r]}function So(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function No(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Ao(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var Zt=new Map;function $e(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=Zt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);No(c)?a+=Ao(c):s+=Ao(c)}i=a+s*(n>=600?1.07:1),Zt.size>5e3&&Zt.clear(),Zt.set(o,i)}return i*t}function Gn(e,t,n,r=400){if(e=e.trim(),$e(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;$e(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<(No(s.charCodeAt(0))?2:3)?"":s+o}var Fo=F(G(),1),Bs=e=>Array.isArray(e)&&e.length===2;function Ro(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Bs(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var lt=F(G(),1),Xe=10.5;function _o(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=>at(a,{locale:n,maximumFractionDigits:i}))}function Qt(e,t,n){let r=18;for(let o of _o(e,t,n))r=Math.max(r,$e(o,Xe));return Math.ceil(r+8)}function Po(e){let{p:t,ticks:n,y:r,x0:o,x1:i,fmt:a}=e,s=e.side==="right",l=e.labels===!1?null:_o(n,a,e.locale);return(0,lt.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,m)=>{let u=Math.round(r(c))+.5,f=c===0&&e.zero!==!1;return(0,lt.jsxs)("g",{children:[(0,lt.jsx)("line",{x1:o,x2:i,y1:u,y2:u,stroke:t.paint(f?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:f?.7:1}),l?(0,lt.jsx)(Ee,{x:s?i+6:o-6,y:u,anchor:s?"start":"end",size:Xe,fill:t.paint("muted"),children:l[m]}):null]},c)})})}function Do(e,t,n){let r=[],o=-1/0;for(let i of e){let a=$e(i.label,Xe),s=Math.max(i.x-a/2,0);s<o+8||i.x-a/2<t||i.x+a/2>n||(r.push(i),o=s+a)}return r}function Wn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function ze(e,t,n=4,r={}){let o=e,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=Wn(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,f=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-f<=l*.3?f:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let p=Wn(c[1]-c[0],n);if(p===l)break;l=p}return c}function en(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Wn(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 Ue(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)=>en(n,r,l),s}function Vn(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]=ze(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function Hs(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,m=1)=>{let u=[];for(let f=Math.floor(r);f<=Math.ceil(o);f++)if(!(f%m))for(let p of c){let d=Number((p*10**f).toPrecision(12));d>=e*(1-1e-9)&&d<=t*(1+1e-9)&&u.push(d)}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:en(e,t,3)}function Lo(e,t){let n=Ue([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=()=>Hs(e[0],e[1],Math.abs(t[1]-t[0])),r}function Ye(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 js=864e5;function Eo(e,t,n,r=ae){let o=t-e;if(!(o>0))return[{t:e,label:kt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/js,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,f,p=!1)=>{let d=new Date(m),g=-1,k=0;for(;d.getTime()<=t&&k++<500;){if(d.getTime()>=e){let y=d.getFullYear(),v=p&&!l&&y!==g;a.push({t:d.getTime(),label:kt(d,{locale:r,...f,...v?{year:"numeric"}:{}})}),g=y}u(d)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(p=>p>=m)??12,f=new Date(s);f.setMinutes(0,0,0),c(f,p=>p.setHours(p.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),f=[1,2,3,6,12,24,60].find(p=>p>=u)??120;if(f>=12){let p=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(p,d=>d.setFullYear(d.getFullYear()+f/12),{year:"numeric"})}else{let p=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),d=p.getMonth()%f;d&&p.setMonth(p.getMonth()+(f-d)),c(p,g=>g.setMonth(g.getMonth()+f),{month:"short"},!0)}}return a}function Oo(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 Gs=(e,t,n)=>e==="date"?Bt(t,n)?.getTime()??NaN:he(t);function Ws(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&ro(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function vt(e,t,n,r,o={}){let i=Oe(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Oe(n,"y"),c=!a&&r!==void 0?Oe(r,"series"):null,m=e.map(($,w)=>i($,w)),u=o.xType??Ws(m),f=o.locale??ae,p,d,g;if(u==="band"){let $=m.map(R=>String(R??""));p=ve($);let w=new Map(p.map((R,E)=>[R,E]));d=p.map((R,E)=>E),g=Int32Array.from($,R=>w.get(R)??-1)}else{let $=u==="date"?o.dayFirst??oo(m):void 0,w=m.map(j=>Gs(u,j,$)),R=Array.from(new Set(w.filter(j=>Number.isFinite(j)))).sort((j,ie)=>j-ie),E=new Map(R.map((j,ie)=>[j,ie]));d=R,p=R.map(String),g=Int32Array.from(w,j=>E.get(j)??-1)}let k=o.dateFormat,y=$=>typeof $=="string"?zt($.trim())?.[3]:void 0,v=u==="date"&&m.length<5e3?y(m[0]):void 0,T=(v===2||v===3)&&m.every($=>y($)===v),A=T&&v===3;if(u==="date"&&!k){let $=d.length>1?d[d.length-1]-d[0]:0;k=T&&v===2||$>864e5*120?{month:"short"}:$<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},$>864e5*800&&(k={year:"numeric",month:"short"})}let x;if(u==="band")x=p;else if(A&&!o.dateFormat){let $=Z(f)==="ko";x=d.map(w=>{let R=new Date(w),E=Math.floor(R.getMonth()/3)+1;return $?`${R.getFullYear()}년 ${E}분기`:`Q${E} ${R.getFullYear()}`})}else{let $=d.every(Pn),w=u==="date"?new Intl.DateTimeFormat(f,k):new Intl.NumberFormat(f,$?{useGrouping:!1}:{maximumFractionDigits:6});x=d.length>1e3?Oo(d.length,R=>w.format(d[R])):d.map(R=>w.format(R))}let S=s?[...s]:c?ve(e.map(($,w)=>String(c($,w)??""))):[""],B=new Map(S.map(($,w)=>[$,w])),H=S.map(()=>new Array(p.length).fill(NaN)),L=S.map(()=>new Array(p.length).fill(null)),D=o.aggregate??"sum",N=D==="mean"?S.map(()=>new Uint32Array(p.length)):null,C=($,w,R,E)=>{let j=H[$][w];D==="last"?H[$][w]=R:D==="count"?H[$][w]=(Number.isFinite(j)?j:0)+1:D==="mean"?Number.isFinite(R)&&(H[$][w]=(Number.isFinite(j)?j:0)+R,N[$][w]++):H[$][w]=Number.isFinite(j)?j+(Number.isFinite(R)?R:0):R,L[$][w]=E};for(let $=0;$<e.length;$++){let w=g[$];if(w<0)continue;let R=e[$];if(s)for(let E=0;E<s.length;E++)C(E,w,he(R[s[E]]),R);else{let E=c?B.get(String(c(R,$)??""))??0:0;C(E,w,he(l(R,$)),R)}}if(N)for(let $=0;$<H.length;$++)for(let w=0;w<p.length;w++)N[$][w]>1&&(H[$][w]/=N[$][w]);return{type:u,keys:p,xnum:d,labels:x,series:S,values:H,rows:L}}var Vs=140,Mt=12,Io=14,Kn=20,zo=12.5;function Ks(e,t,n=bo){let r=ge(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 Xs(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Mt)/(Vs+Mt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Us(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Mt)/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 $t=e=>e.filter(Number.isFinite);function tn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Re(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return $t(n)}function Bo(e,t,n,r,o,i){return vt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Ys(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(),S=r.refLines??{},[B,H]=Ye([...tn(x,r.x??"x"),...$t([Number(S.x)])]),[L,D]=Ye([...tn(x,r.y??"y"),...$t([Number(S.y)])].filter(C=>!s||C>0)),N=r.zero??!1;return{y:c??(s?Vn(L,D,a):ze(L,D,a,{zero:N,pad:.08})),x:r.xDomain??ze(B,H,Math.max(2,Math.round(o/110)),{zero:N,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",f=n[0]?.keys.join(""),p=n.every(x=>x.keys.join("")===f),d=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),g=r.xDomain??(!m&&d?Ye(n.flatMap(x=>$t(x.xnum))):void 0),k=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(k==="percent")return{x:g,sameKeys:p};if(c)return{y:c,x:g,sameKeys:p};let y=[];t.forEach((x,S)=>{let B=n[S];if(k==="stacked"||k==="auto"&&B.series.length>1){let L=jn(B.values,"zero");L.y0.forEach(D=>y.push(...D)),L.y1.forEach(D=>y.push(...D))}else B.values.forEach(L=>y.push(...L));m&&!u&&r.line!==void 0&&Bo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(L=>y.push(...L)),m||y.push(...tn(x,r.lower),...tn(x,r.upper))}),m&&y.push(0),u||y.push(...Ro(r.annotations));for(let x of r.referenceLines??[])y.push(x.y);r.signColors&&y.push(Number(r.baseline??0));let[v,T]=Ye($t(y).filter(x=>!s||x>0));return{y:s?Vn(v,T,a):m?ze(v,T,u?Math.max(2,Math.round(o/120)):a):ze(v,T,a,{zero:r.zero??e==="area"}),x:g,sameKeys:p}}function qs(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=vt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?Lo:Ue)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=Qt(c,xt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(x=>x.series),f=r.endLabels??n.some(x=>x.series.length>1),p=m+6,d=i-(f?Math.min(i*.28,Math.max(...u.map(x=>$e(x,11,700)),20)+14):10),g=l.keys.length,[k,y]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?g>12:g>Eo(k,y,Math.max(2,Math.floor((d-p)/64)),s).length;if(l.type==="band"||!g||v)return;let T=x=>p+(l.xnum[x]-k)/(y-k)*(d-p),A=x=>$e(l.labels[x],Xe);for(let x=1;;x++){let S=Array.from({length:Math.ceil(g/x)},(B,H)=>H*x);if(x>=g||S.every((B,H)=>!H||T(B)-T(S[H-1])>=(A(B)+A(S[H-1]))/2+8))return S.map(B=>({value:l.xnum[B],label:l.labels[B]}))}}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 Zs(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}|${Yt(r)}`)}`}function Qs(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 el={en:{intro:(e,t)=>`${Ce(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:"(빈 값)"}},Xn=18;function Ho(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Ks(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Xs(s,a,e.columns),{pw:c,ph:m}=Us(s,l,e.height),u=e.scale!=="free",f=t==="scatter"?[]:o.map(N=>Bo(t,N,n,n.y,n.series,n.aggregate)),p=u?Ys(t,o,f,n,c,m):{sameKeys:!1},d=u?qs(t,o,f,n,p,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",k=u&&(!g||p.sameKeys),y=u&&(g||p.x!==void 0||p.sameKeys),v=new Set(Qs(e.highlight,r)?[e.highlight].flat():[]),T=v.size>0,A=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??Zs(t,e.by,n,e.data),S=It(We(n.format,e.locale),n.unit),B=el[e.lang],H=[],L=r.map(N=>N===""?B.blank:N);return{panels:r.map((N,C)=>{let $=o[C],w=L[C],R=C%l,E;if(t!=="scatter"){let ie=f[C],Se=ue=>ie.values.reduce((me,Je)=>me+(Number.isFinite(Je[ue])?Je[ue]:0),0),K=ie.keys.map((ue,me)=>me).filter(ue=>ie.values.some(me=>Number.isFinite(me[ue]))),re=K[K.length-1];H.push({first:K.length?Se(K[0]):NaN,last:K.length?Se(re):NaN,total:K.reduce((ue,me)=>ue+Se(me),0)}),t!=="bar"&&ie.series.length===1&&re!==void 0&&(E=S(ie.values[0][re]))}else H.push({first:NaN,last:NaN,total:$.length});let j={data:$,width:c,height:m,ariaLabel:e.title?`${e.title}, ${w}`:w,syncId:x,highlight:T?v.has(N)?A?()=>!0:void 0:"none":e.highlight,showYAxis:!k||R===0,showXAxis:!y||C+l>=a};return p.y&&(j.yDomain=p.y),p.x&&(j.xDomain=p.x),d&&(j.xTicks=d),{value:N,label:w,props:j,last:E,isPicked:v.has(N)}}),cols:l,pw:c,ph:m,isPanelPick:T,description:tl(t,e.by,L,H,i,S,B)}}function tl(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>So(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,f)=>r[f].last<r[f].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.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 ce=F(q(),1);function nl(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function rl(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 nn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Wo(e,t=!0){let[n,r]=(0,ce.useState)({visible:!t,near:!t});return(0,ce.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=rl(a[a.length-1],nn.threshold,nn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:nl(nn.threshold),rootMargin:nn.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 jo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function rn(e){let[t,n]=(0,ce.useState)(null),[r,o]=(0,ce.useState)(e??null),i=(0,ce.useCallback)(a=>{n(a),a&&e===void 0&&o(jo(a))},[e]);return Te(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a(jo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var ol=()=>()=>{};function ct(){return(0,ce.useSyncExternalStore)(ol,()=>!0,()=>!1)}var Go="(prefers-reduced-motion: reduce)";function on(e="auto"){let[t,n]=(0,ce.useState)(()=>ye&&typeof window.matchMedia=="function"?window.matchMedia(Go).matches:!1);return(0,ce.useEffect)(()=>{if(e!=="auto"||!ye||typeof window.matchMedia!="function")return;let r=window.matchMedia(Go),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=F(G(),1),il=60,al=420;function Vo(e){let t=we(),n=e.chartProps??{},[,r,o]=rn(e.width),i=e.width??(o||480),a=se(e.locale??n.locale),s=Z(a),l=(0,ut.useContext)(nt),c=e.title??l,m=e.chart.facetPlan,u=(0,ut.useMemo)(()=>{let y=Ho({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 m?m(y,n,a):y},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(y,v)=>typeof v=="function"?String(v):v),e.highlight,e.syncId,i,e.height,c,a,s,m]),f=`${(0,ut.useId)().replace(/:/g,"")}fd`,p=on(n.reducedMotion??"auto"),d=ct(),g=Ir({motion:{enabled:n.animate!==!1&&!p&&ye},hydrated:d},{waiting:!1,generation:0}),k=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":f,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:f,style:Kt,children:e.description??u.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Mt,rowGap:Io,...u.legend?{marginTop:Xn}:null},children:u.panels.map((y,v)=>{let T=t.paint(y.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":y.value,style:{minWidth:0,...Or(g,!1,"fade",v*il,al)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Kn,fontSize:zo,fontWeight:700,lineHeight:`${Kn}px`,color:T},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.label}),y.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:y.last}):null]}),(0,Me.jsx)(k,{...n,...y.props})]},y.value)})}),u.legend?(0,Me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Xn},children:u.legend}):null]})}var Ko=["max","min","first","last","none"];function pe(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 m=-1,u=c==="max"?-1/0:1/0;r.forEach((f,p)=>{Number.isFinite(f)&&(c==="max"?f>u:f<u)&&(u=f,m=p)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),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((m,u)=>{m===c&&i.add(u)});return i}var be=F(q(),1);async function sl(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(Z(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ve(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 Ve(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ve(i)}async function ll(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 sl(i,t.parse,o,t.locale)}return t.select&&(r=vo(r,t.select)),t.transform?t.transform(r):Ie(r)}function Xo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,be.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,be.useState)(0),c=se(t.locale),m=(0,be.useRef)(t);m.current={...t,locale:c};let u=(0,be.useRef)(e);u.current=e;let f=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",p=t.deps??[],d=JSON.stringify(p.map(y=>typeof y=="object"?JSON.stringify(y):String(y))),g=(0,be.useRef)(!1);(0,be.useEffect)(()=>{let y=u.current;if(!y||!r){a(A=>A.status==="loading"?{...A,status:"idle"}:A);return}let v=new AbortController,T=!0;return g.current=!0,a(A=>({...A,data:o?A.data:[],status:"loading",error:null})),ll(y,{...m.current,signal:v.signal}).then(A=>{T&&a({data:A,status:"success",error:null,updatedAt:Date.now()})}).catch(A=>{!T||v.signal.aborted||a(x=>({...x,status:"error",error:A instanceof Error?A:new Error(String(A))}))}).finally(()=>{T&&(g.current=!1)}),()=>{T=!1,g.current=!1,v.abort()}},[f,r,s,d,o]),(0,be.useEffect)(()=>{if(!n||!r)return;let y=setInterval(()=>{g.current||l(v=>v+1)},n);return()=>clearInterval(y)},[n,r]);let k=(0,be.useCallback)(()=>l(y=>y+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:k}}var Yn=F(G(),1),cl=["csv","svg","png"],ul=/^[=+\-@\t\r\n=+-@]/,ml=/var\(|color-mix\(/;function Uo(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?eo(e.getTime()):String(e);return`"${(ul.test(t)&&!Number.isFinite(he(t))?`'${t}`:t).replace(/"/g,'""')}"`}function dl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function fl(e,t){return`\uFEFF${[t.map(Uo),...e.map(r=>t.map(o=>Uo(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
- `}function ml(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Xn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Yo=2,Be=16;function qo(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 Jo(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 Zo(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+Be*2,a+Be*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((d,g)=>{let k;for(let b of Array.from(d.attributes)){if(!ll.test(b.value))continue;let $=(k??(k=getComputedStyle(d))).getPropertyValue(b.name);$&&m[g].setAttribute(b.name,qo($,u))}}),c.removeAttribute("style");for(let[d,g]of Object.entries({viewBox:`${-Be} ${-Be} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(d,String(g));let f=qo(getComputedStyle(r).backgroundColor,u),p=o.parentElement?.querySelector("canvas")??null;if(n){let d=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Jo("rect",{x:-Be,y:-Be,width:s,height:l,fill:f}),d),p&&c.insertBefore(Jo("image",{href:p.toDataURL(),width:i,height:a}),d)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:f,canvas:p}}function dl(e,t){let n=Zo(e,Yo,!1);if(!n)return;let r=Yo,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,Be*r,Be*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&&Xn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Qo(e){let t=we(e.theme),n=Z(se(e.locale))==="ko",r=ml(e.filename),o=(i,a)=>{if(i==="csv")return Xn(new Blob([ul(e.data,e.columns?.length?e.columns:cl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return dl(a,r);let s=Zo(a,1,!0);s&&Xn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Yn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:al.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,Yn.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 ti=R(G(),1);function ei(e,t=ae){let n=We(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?kt(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(no,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,ti.jsx)("div",{children:s},l)):null}}var fl=e=>new Float64Array(e.map(he).filter(Number.isFinite)).sort(),hl=(e,t)=>t>=0&&t<=100?Ke(e,t/100):NaN;function ni(e,t){return hl(fl(e),t)}function qn(e){let t=/^p(\d+(?:\.\d+)?)$/.exec(e),n=t?Number(t[1]):NaN;return n>=0&&n<=100?n:NaN}function ai(e,t,n){let r=e.filter(d=>Number.isFinite(d)),o=r.length;if(!o)return t.map(()=>0);let i=r.reduce((d,g)=>d+g,0)/o,a=t.length>1?Math.abs(t[t.length-1]-t[0]):0,s=a>0?a/40:Math.abs(i)*.05||1,l=Math.sqrt(r.reduce((d,g)=>d+(g-i)**2,0)/o)||s,c=[...r].sort((d,g)=>d-g),m=Ke(c,.75)-Ke(c,.25),u=Math.min(l,m>0?m/1.34:l)||l,f=n??Math.max(1e-9,.9*u*Math.pow(o,-.2)),p=1/(Math.sqrt(2*Math.PI)*f*o);if(o>2e3){let g=c[0],b=(c[o-1]-g)/512||1,$=new Array(513).fill(0);for(let T of r)$[Math.min(512,Math.floor((T-g)/b))]++;return t.map(T=>{let A=0;for(let x=0;x<=512;x++){if(!$[x])continue;let S=(T-(g+x*b))/f;S>6||S<-6||(A+=$[x]*Math.exp(-.5*S*S))}return A*p})}return t.map(d=>{let g=0;for(let k of r){let b=(d-k)/f;b>6||b<-6||(g+=Math.exp(-.5*b*b))}return g*p})}var Zn=2;function si(e,t,n){return n!==void 0?!0:t!==void 0||!e?!1:["x0","x1","count"].every(r=>wt(e,r))&&!wt(e,"value")}var gl=50,pl=200,bl=[1,2,2.5,5,10],an=[[1],[1,3],[1,2,5],[1,1.6,2.5,4,6.3],[1,1.25,1.6,2,2.5,3.15,4,5,6.3,8]],He=e=>Number(e.toPrecision(12));function Jn(e,t=!1){let n=10**Math.floor(Math.log10(e)),r=bl.map(o=>He(o*n));return t?r.find(o=>o>=e*(1-1e-9))??He(10*n):r.reduce((o,i)=>Math.abs(Math.log(i/e))<Math.abs(Math.log(o/e))?i:o)}function ri(e,t,n){let r=Math.floor(e/n+1e-9)*n,o=Math.max(1,Math.ceil((t-r)/n-1e-9)),i=Array.from({length:o+1},(a,s)=>He(r+s*n));return i[0]>e&&i.unshift(He(i[0]-n)),i[i.length-1]<t&&i.push(He(i[i.length-1]+n)),i}function Qn(e,t,n,r=0){let o=[];for(let i=Math.floor(Math.log10(e))-r;i<=Math.ceil(Math.log10(t))+r;i++)for(let a of n)o.push(He(a*10**i));return o}function oi(e,t,n){let r=Qn(e,t,n,1),o=r.length-1;for(;o>0&&r[o]>e*(1+1e-9);)o--;let i=o+1;for(;i<r.length-1&&r[i]<t*(1-1e-9);)i++;return r.slice(o,i+1)}function ii(e){let t=e.length,n=Ke(e,.75)-Ke(e,.25);return t>=30&&n>0?2*n/Math.cbrt(t):(e[t-1]-e[0])/(Math.ceil(Math.log2(t))+1)}function yl(e,t){let n=[...new Set(e.filter(r=>Number.isFinite(r)&&(!t||r>0)))].sort((r,o)=>r-o);return n.length>=2?n:null}function li(e,t={}){let n=t.log===!0,r=t.edges?yl(t.edges,n):null;if(r)return r;let o=Float64Array.from(e.filter(f=>Number.isFinite(f)&&(!n||f>0))).sort();if(!o.length)return[];let i=o[0],a=o[o.length-1],s=t.binWidth!==void 0&&t.binWidth>0&&!n?t.binWidth:void 0;if(i===a){if(n)return[He(i/2),He(i*2)];let f=s??1;return[i-f/2,i+f/2]}let l=t.bins!==void 0&&t.bins>=1?Math.round(t.bins):void 0,c=s!==void 0||l!==void 0?pl:gl;if(n){let f=l!==void 0?Math.log10(a/i)/l:ii(o.map(Math.log10)),p=k=>Math.abs(Math.log(1/k.length/f)),d=an.reduce((k,b,$)=>p(b)<p(an[k])?$:k,0),g=oi(i,a,an[d]);for(;g.length-1>c&&d>0;)g=oi(i,a,an[--d]);return g}let m=s??Jn(l!==void 0?(a-i)/l:ii(o));(a-i)/m>c&&(m=Jn((a-i)/c,!0));let u=ri(i,a,m);for(;u.length-1>c;)u=ri(i,a,m=Jn(m*1.01,!0));return u}function er(e,t){let n=e.length-1;if(n<1||!(t>=e[0]&&t<=e[n]))return-1;let r=0,o=n;for(;o-r>1;){let i=r+o>>1;e[i]<=t?r=i:o=i}return r}function ci(e,t){let n=new Array(Math.max(0,t.length-1)).fill(0),r=0;for(let o of e){if(!Number.isFinite(o))continue;let i=er(t,o);i<0?r++:n[i]++}return{counts:n,outside:r}}function ui(e,t){let n=Math.max(1,Math.floor(t));if(!(e>n))return 1;if(!Number.isFinite(e))return 1/0;for(let r=10**Math.max(0,Math.floor(Math.log10(e/n))-1);;r*=10)for(let o of[1,2,5])if(Math.ceil(e/(o*r))<=n)return o*r}function mi(e,t,n=!1){let r=ge(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=$e(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 Ve(t.csv)}return null}var xi=R(q(),1);var ee=R(q(),1);function fi(e,t){let n=we(e.theme),[r,o,i]=rn(e.width),a=ct(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=on(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,f=Wo(r,e.animateOnView!==!1&&u),p=se(e.locale),d=Z(p),g=(0,ee.useMemo)(()=>We(e.format,p,t.format),[e.format,p,t.format]),k=(0,ee.useCallback)(K=>it(K,{locale:p}),[p]),b=(0,ee.useMemo)(()=>It(g,e.unit),[g,e.unit]),$=(0,ee.useMemo)(()=>Yt(e.data),[e.data]),[T,A]=(0,ee.useState)(null),[x,S]=(0,ee.useState)(null),B=(0,ee.useRef)([]),H=(0,ee.useRef)(e.onHover);H.current=e.onHover;let L=(0,ee.useRef)(e.onClick);L.current=e.onClick;let D=(0,ee.useRef)(null),N=(0,ee.useRef)(null),C=(0,ee.useRef)(null),v=(0,ee.useCallback)((K,re="pointer")=>{if(C.current!==K){C.current=K;let ue=K===null?null:B.current[K]??null;queueMicrotask(()=>H.current?.(ue)),N.current?.(K)}D.current=K===null?null:re,A(K),S(D.current)},[]),w=(0,ee.useCallback)(K=>{D.current!=="keyboard"&&(D.current=K===null?null:"sync",A(K),S(D.current))},[]),F=(0,ee.useCallback)(K=>{let re=B.current[K];re&&L.current?.(re)},[]),E=lo(e.replayKey),j=e.width!==void 0||(i??0)>0,ie={enabled:u,active:f.visible&&j,near:f.near,replayKey:E,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Se=(0,ee.useCallback)((K,re=1)=>T===null||T===K?re:re*.38,[T]);return{p:n,width:s,height:c,measured:j,responsive:e.width===void 0,pending:ye&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:ie,fv:b,fmt:g,pct:k,locale:p,lang:d,t:d==="ko"?Br:zr,active:T,via:x,setActive:v,click:F,events:B,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Se,sig:$,description:e.description,reduced:m,publish:N,applySync:w}}var Q=R(q(),1);function xl(e){return 1-Math.pow(1-e,3)}function kl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function wl(e){return e==="easeInOut"?kl:e==="linear"?t=>t:xl}function $l(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 mt(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 sn(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 hi(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 gi(e,t,n,r){if(!t||!n||t.length!==n.length)return mt(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 mt(s,n[a]))o.push(l)}return o.length===r?o:mt(e,r)}var ln=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||!sn(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),hi(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=sn(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=gi(s.cur,s.parts,a.parts,c),s.vel=gi(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),hi(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=sn(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<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=sn(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=mt(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=wl(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=mt(s.from,c)),s.vel.length!==c&&(s.vel=mt(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 m;if(this.easing==="spring"){let u=Math.exp(-i*l),f=i*l>=8&&i*l<20,p=0;for(let d=0;d<c;d++){let g=s.from[d]-s.to[d],k=s.vel[d]+i*g;s.cur[d]=s.to[d]+(g+k*l)*u,s.curVel[d]=(s.vel[d]-i*k*l)*u,f&&p<.15&&(p=Math.max(p,Math.abs(s.cur[d]-s.to[d]),Math.abs(s.curVel[d]/i)))}m=i*l>=20||f&&p<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),f=r(u),p=$l(this.easing,u)/o;for(let d=0;d<c;d++)s.cur[d]=s.from[d]+(s.to[d]-s.from[d])*f,s.curVel[d]=(s.to[d]-s.from[d])*p;m=u>=1,s.progress=f}if(m){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}},Tt=new Set,cn=0;function pi(e){cn=0;let t=Array.from(Tt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Tt.delete(n)}Tt.size&&typeof requestAnimationFrame<"u"&&(cn=requestAnimationFrame(pi))}function bi(e){return Tt.add(e),!cn&&typeof requestAnimationFrame<"u"&&(cn=requestAnimationFrame(pi)),()=>{Tt.delete(e)}}function vl(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 yi(e,t){let n=(0,Q.useMemo)(()=>vl(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,Q.useRef)(null),f=(0,Q.useRef)("init"),p=(0,Q.useRef)(null),d=(0,Q.useRef)(s),g=(0,Q.useRef)(a),k=(0,Q.useRef)(!1),b=(0,Q.useRef)(0),[,$]=(0,Q.useState)(0),T=(0,Q.useRef)(null),A=(0,Q.useRef)(!0);u.current||(u.current=new ln,u.current.configure(l,c),u.current.snap(n),p.current=n);let x=u.current;if(x.configure(l,c),p.current!==n){let N=f.current,C=!Object.is(d.current,s);x.sameTargets(n)?x.refreshData(n):!r||N==="init"?x.snap(n):N==="idle"?x.hold(n):N==="running"||C?x.update(n,Lt(),m):x.snap(n),p.current=n,d.current=s}let S=(0,Q.useRef)(()=>!1);S.current=N=>{if(!A.current)return!1;let C=x.step(N);return!C&&f.current==="running"&&(f.current="done"),$(v=>(v+1)%1e9),C||(T.current=null),C};let B=(0,Q.useCallback)(()=>{if(!ye||T.current||!x.animating)return;let N=C=>S.current(C);T.current=bi(N)},[x]);Te(()=>{let N=!Object.is(g.current,a);if(g.current=a,!r){(f.current!=="done"||x.animating)&&(x.snap(p.current??n),f.current="done",$(C=>C+1));return}f.current==="init"||N&&i?(x.hold(p.current??n),f.current="idle",k.current=!1,$(C=>C+1)):N&&(k.current=!0)},[r,a]),Te(()=>{!r||!i||!k.current||(k.current=!1,x.hold(p.current??n),f.current="idle",$(N=>N+1))},[i,r]),(0,Q.useEffect)(()=>{r&&o&&f.current==="idle"&&(x.start(Lt()),b.current+=1,f.current="running",B(),$(N=>N+1))},[r,o,a,x,B]),(0,Q.useEffect)(()=>{x.animating&&B()}),(0,Q.useEffect)(()=>(A.current=!0,()=>{A.current=!1,T.current?.(),T.current=null}),[]);let H=Lt(),L=x.elapsed(H),D=r&&f.current==="idle";return{items:x.items(),get:N=>x.get(N),elapsed:D?0:L,fade:(N,C=320)=>D?0:Number.isFinite(L)?Math.max(0,Math.min(1,(L-N)/C)):1,waiting:D,animating:x.animating,generation:b.current}}var tr=R(G(),1);function ki(e,t,n,r,o){if(r)return o==="categorical"?xe(e,t,n):Xr(e,t,n);if(o==="categorical")return xe(e,t,n);let i=ne(e,"strong"),a=ne(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Ml=R(q(),1);var nr=R(G(),1);var wi=e=>e?"neutralStrong":"accent";var rr=R(G(),1);function $i(e,t,n,r){if(typeof e!="function")return pe(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 Tl=R(q(),1);var ir=R(G(),1),Cl={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ce(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},vi={en:Cl,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},or=["ink","muted","dim"];function Mi(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,or.length)}var qe=R(q(),1);var z=R(G(),1),Sl={kind:"Histogram",count:"Count",cum:"Cumulative",range:(e,t)=>`${e} to ${t}`,inBin:(e,t)=>`${e} · ${t}`,row:(e,t)=>`${e} (${t})`,rowCum:e=>`cumulative ${e}`,samples:e=>Ce(e,"sample"),median:e=>`median ${e}`,about:e=>`about ${e}`,peak:(e,t)=>`the tallest bin is ${e} (${t})`,past:(e,t,n,r,o)=>`${e} ${t?"above":"below"} ${r?`the ${r} of ${n}`:n} (${o})`,outside:e=>`${e} outside the edges`,excluded:e=>`${e} at or below 0 left out`,dot:e=>`1 dot = ${Ce(e,"sample")}`,groups:e=>Ce(e,"group"),hidden:(e,t)=>`Only the first ${e} of ${t} groups are drawn`},Al={en:Sl,ko:{kind:"히스토그램",count:"건수",cum:"누적",range:(e,t)=>`${e} ~ ${t}`,inBin:(e,t)=>`${e}건 · ${t}`,row:(e,t)=>`${e}건(${t})`,rowCum:e=>`누적 ${e}`,samples:e=>`표본 ${e}개`,median:e=>`중앙값 ${e}`,about:e=>`약 ${e}`,peak:(e,t)=>`가장 많은 구간 ${e}(${t}건)`,past:(e,t,n,r,o)=>`${r?`${r} `:""}${n} ${t?"넘음":"미만"} ${e}건(${o})`,outside:e=>`범위 밖 ${e}개`,excluded:e=>`0 이하 ${e}개 제외`,dot:e=>`점 하나 = ${e}건`,groups:e=>`그룹 ${e}개`,hidden:(e,t)=>`그룹 ${t}개 중 앞의 ${e}개만 그려요`}},ar=e=>e,Nl=["p50","p95"],Ai=10,un=15,mn=16,Ti=96,Fl=e=>e==="p50"?void 0:e==="p99"?"1.5 2.5":"4 3";function Rl(e,t,n,r,o){let i=Fe(t,"value"),a=n?ge(n,"group"):()=>"",s=new Map,l=[];e.forEach((d,g)=>{let k=i(d,g);if(!Number.isFinite(k))return;let b=a(d,g),$=s.get(b);$||s.set(b,$={values:[],excluded:0}),o.log&&k<=0?$.excluded++:($.values.push(k),r?.(d,g)&&l.push({g:b,v:k}))});let c=[...s.keys()].slice(0,Zn),m=c.length?li(c.flatMap(d=>s.get(d).values),o):[],u=c.map(d=>ci(s.get(d).values,m)),f=m.slice(1).map((d,g)=>({i:g,x0:m[g],x1:d,counts:u.map(k=>k.counts[g])})),p=c.map((d,g)=>({name:d,n:s.get(d).values.length,values:s.get(d).values,outside:u[g].outside,excluded:s.get(d).excluded}));return{bins:f,samples:p,groupCount:s.size,binned:!1,fnBins:new Set(l.map(d=>er(m,d.v)).filter(d=>d>=0)),fnGroup:l.map(d=>c.indexOf(d.g)).find(d=>d>=0)??-1}}function _l(e,t,n,r){let o=Fe(t.x0,"x0"),i=Fe(t.x1,"x1"),a=Fe(t.count,"count"),s=t.group?ge(t.group,"group"):()=>"",l=new Map,c=new Map;e.forEach((g,k)=>{let b=o(g,k),$=i(g,k),T=a(g,k);if(!(Number.isFinite(b)&&Number.isFinite($)&&$>b&&Number.isFinite(T)&&T>=0))return;let A=s(g,k);if(l.set(A,l.get(A)??0),r&&b<=0){l.set(A,l.get(A)+T);return}let x=`${b}|${$}`,S=c.get(x);S||c.set(x,S={x0:b,x1:$,by:new Map,picked:new Set}),S.by.set(A,(S.by.get(A)??0)+T),n?.(g,k)&&S.picked.add(A)});let m=[...l.keys()].slice(0,Zn),u=[],f=new Set;for(let g of[...c.values()].sort((k,b)=>k.x0-b.x0||k.x1-b.x1)){let k=u[u.length-1];k&&g.x0>k.x1&&u.push({i:u.length,x0:k.x1,x1:g.x0,counts:m.map(()=>0)}),g.picked.size&&f.add(u.length),u.push({i:u.length,x0:g.x0,x1:g.x1,counts:m.map(b=>g.by.get(b)??0)})}let p=m.map((g,k)=>({name:g,n:u.reduce((b,$)=>b+$.counts[k],0),values:[],outside:0,excluded:l.get(g)})),d=m.findIndex(g=>[...c.values()].some(k=>k.picked.has(g)));return{bins:u,samples:p,groupCount:l.size,binned:!0,fnBins:f,fnGroup:d}}function Ci(e,t,n,r){let o=e.samples[t];if(!e.binned)return ni(o.values,n);let i=n/100*o.n,a=0;for(let s of e.bins){let l=s.counts[t];if(l>0&&a+l>=i){let c=(i-a)/l;return r?10**(Math.log10(s.x0)+c*(Math.log10(s.x1)-Math.log10(s.x0))):s.x0+c*(s.x1-s.x0)}a+=l}return NaN}function sr(e,t,n){let r=n?Math.log10:ar;if(n&&t.value<=0)return t.side==="below"?0:1;let o=(r(t.value)-r(e.x0))/(r(e.x1)-r(e.x0));return Math.max(0,Math.min(1,t.side==="below"?o:1-o))}function Pl(e,t,n,r){let o=n.side!=="below",i=e.samples[t];if(!e.binned)return{n:i.values.filter(l=>o?l>n.value:l<n.value).length,est:!1};let a=0,s=!1;for(let l of e.bins){let c=sr(l,n,r);a+=l.counts[t]*c,c>0&&c<1&&l.counts[t]>0&&(s=!0)}return{n:Math.round(a),est:s}}function Si(e,t,n,r=-1/0,o=1/0){let i=t.length,a=l=>Math.min(e[l+1],o)>Math.max(e[l],r),s="";for(let l=0;l<i;l++){if(!a(l))continue;let c=l;for(;c+1<i&&a(c+1);)c++;let m=Math.max(e[l],r),u=Math.min(e[c+1],o);s+=`M${M(m)},${M(m===e[l]?Math.max(l?t[l-1]:n,t[l]):t[l])}V${M(t[l])}`;for(let f=l;f<c;f++)s+=`H${M(e[f+1])}V${M(t[f+1])}`;s+=`H${M(u)}`,u===e[c+1]&&(s+=`V${M(Math.max(c+1<i?t[c+1]:n,t[c]))}`),l=c}return s}function Dl(e,t){let n=[];for(let r=0;r<t;r++){if(!e.has(r))continue;let o=r;for(;e.has(o+1);)o++;n.push([r,o]),r=o}return n}function Ll(e,t,n){let r=[...e].sort((l,c)=>l.at-c.at),o=l=>{let c=[];return r.map(m=>{let u=ve(m.text,Ai,700)+10,f=[m.at,m.at+u/2-4,m.at-u/2+4].map(p=>Math.max(t+u/2,Math.min(n-u/2,p)));for(let p=0;;p++){let d=c[p]??(c[p]=[]),g=l.map(k=>f[k]).find(k=>d.every(([b,$])=>k+u/2+4<=b||k-u/2-4>=$));if(g!==void 0)return d.push([g-u/2,g+u/2]),{...m,x:g,w:u,row:p}}})},i=l=>Math.max(0,...l.map(c=>c.row)),a=o([0,1,2]),s=o([2,0,1]);return i(s)<i(a)?s:a}function El(e,t,n){let r=[];for(let o=Math.max(2,n);o<=Math.max(2,n)+4&&r.length<3;o++)r=en(e,t,o).filter(i=>i>=e-1e-9&&i<=t+1e-9);return r}function Ol(e,t,n){let r=i=>Qn(e,t,i).filter(a=>a>=e*.999999999&&a<=t*1.000000001),o=r(n>=110?[1,2,5]:[1]);return o.length>=2?o:r([1,2,3,4,5,6,7,8,9])}function lr(e){let t=fi(e,{height:h=>Math.max(230,Math.min(310,h*.55)),duration:800}),{p:n,width:r,height:o}=t,i=Al[t.lang],a=t.fv,s=e.log===!0,l=e.variant??"bars",c=e.threshold&&Number.isFinite(e.threshold.value)?e.threshold:void 0,m=c?.value,u=c?.side,f=u!=="below",p=e.edges?.join(","),d=(e.marks??Nl).filter(h=>Number.isFinite(qn(h))).join(","),g=typeof e.highlight=="function"?e.highlight:null,k=typeof e.highlight=="function"?void 0:e.highlight,{data:b,value:$,group:T,x0:A,x1:x,count:S,binWidth:B,bins:H}=e,L=(0,qe.useMemo)(()=>{let h=b.find(I=>I!==null&&typeof I=="object");if(si(h,$,S))return _l(b,{x0:A,x1:x,count:S,group:T},g,s);let O=p?p.split(",").map(Number):void 0;return Rl(b,$,T,g,{edges:O,binWidth:B,bins:H,log:s})},[b,$,T,A,x,S,p,B,H,s,g]),{bins:D,samples:N}=L,C=D.length,v=N.length>1,w=(0,qe.useMemo)(()=>L.samples.map((h,O)=>{let I=d?d.split(",").map(P=>({id:P,v:Ci(L,O,qn(P),s)})):[];return{median:I.find(P=>P.id==="p50")?.v??Ci(L,O,50,s),marks:I}}),[L,d,s]),F=(0,qe.useMemo)(()=>m===void 0?[]:L.samples.map((h,O)=>Pl(L,O,{value:m,side:u},s)),[L,m,u,s]),[E,j]=(0,qe.useMemo)(()=>Ye(L.bins.flatMap(h=>[h.x0,h.x1])),[L]),ie=e.kde===!0&&!L.binned,Se=(0,qe.useMemo)(()=>{if(!ie||!L.bins.length)return null;let h=s?Math.log10:ar,[O,I]=[h(E),h(j)],P=Array.from({length:Ti},(Y,V)=>O+(I-O)*V/(Ti-1)),J=(I-O)/L.bins.length;return{xs:P,curves:L.samples.map(Y=>ai(Y.values.map(h),P).map(V=>V*Y.n*J))}},[ie,L,s,E,j]),K=N.map(h=>h.name),re=v?g?L.fnGroup:[...pe(k,K,K,N.map(h=>h.n),"first")][0]??-1:-1,ue=D.map(h=>h.counts[0]),me=h=>i.range(a(h.x0),a(h.x1)),Je=v||c?new Set:g?L.fnBins:pe(k,D,D.map(me),ue,"max"),Ze=v&&re===0?1:0,dt=v?1-Ze:0,te=l==="dots"&&!v,je=l==="step",dn=s?Math.log10:ar,Qe=Math.max(0,...D.flatMap(h=>h.counts)),ur=Math.max(2,Math.round(o/70)),St=ze(0,Math.max(1,Qe,...Se?.curves.flat()??[]),ur),mr=Xe(St,[0,1]).ticks(ur).filter(h=>Number.isInteger(h)),dr=xt(void 0,t.locale,St[1]),fr=te?8:Qt(mr,dr,t.locale),et=fr+2,Ge=r-10,hr=Xe([dn(E),dn(j)],[et,Ge]),X=h=>hr(dn(h)),fn=h=>Number.isFinite(h)&&h>=E&&h<=j&&(!s||h>0),gr=N.reduce((h,O)=>h+O.outside,0),pr=N.reduce((h,O)=>h+O.excluded,0),At=[gr?i.outside(gr):"",pr?i.excluded(pr):""].filter(Boolean).join(" · "),Ki=Math.max(0,re),hn=t.pending||!C?[]:Ll([...(w[Ki]?.marks??[]).filter(h=>fn(h.v)).map(h=>({key:h.id,at:X(h.v),text:`${h.id} ${a(h.v)}`,fill:n.paint(v?"accentText":"ink"),stroke:n.paint(v?"accent":"ink"),dash:Fl(h.id)})),...c&&fn(c.value)?[{key:"threshold",at:X(c.value),text:c.label?`${c.label} ${a(c.value)}`:a(c.value),fill:n.paint(v?"ink":"accentText"),stroke:n.paint(v?"ink":"accent")}]:[]],4,r-4),br=t.showLabels?Math.max(0,...hn.map(h=>h.row+1)):0,Ui=At||te?mn:0,Nt=h=>6+Ui+h*(un+3),de=Nt(br)+(br?4:0),U=o-22,Xi=C?Math.min(...D.map(h=>X(h.x1)-X(h.x0))):10,yr=Math.max(1.5,Math.min(6,Xi/2-1)),xr=Math.min(yr,2.5),Ae=te?ui(Qe,(U-de)/(xr*2+1.5)):1,gn=Math.max(xr,Math.min(yr,((U-de)/Math.max(1,Math.ceil(Qe/Ae))-1.5)/2)),Ft=gn*2+1.5,ft=te?h=>U-h/Ae*Ft:Xe(St,[U,de]),pn=e.stagger??Math.min(28,520/Math.max(1,C)),Yi=(0,qe.useMemo)(()=>{let h=[];if(!je)for(let I of D)h.push({key:`${te?"d":"b"}${I.i}`,to:[te?1:ft(I.counts[Ze])],from:[te?0:U],enter:[te?0:U],delay:I.i*pn,data:{k:Ze,i:I.i}});let O=v?je?[Ze,dt]:[dt]:je?[0]:[];for(let I of O)h.push({key:`s${I}`,to:D.map(P=>ft(P.counts[I])),from:D.map(()=>U),enter:D.map(()=>U),delay:I===dt?120:0,data:{k:I,i:-1}});return h},[L,r,o,de,Ae,te,je,v,Ze,dt,pn,St[1]]),kr=yi(Yi,t.motion),ht=h=>it(h,{locale:t.locale,maximumFractionDigits:1}),gt=(h,O)=>N[h].n?O/N[h].n*100:0,wr=N.map((h,O)=>{let I=0;return D.map(P=>I+=P.counts[O])}),qi=D.map(h=>{let O=N.map((I,P)=>{let J=i.row(h.counts[P],ht(gt(P,h.counts[P])));return v?`${I.name} ${J}`:`${J}, ${i.rowCum(ht(gt(P,wr[P][h.i])))}`});return{datum:null,index:h.i,key:`b${h.i}`,label:me(h),value:h.counts.reduce((I,P)=>I+P,0),formatted:O.join(", ")}}),_e=n.paint("accent"),$r=h=>Je.has(h.i)||c!==void 0&&sr(h,c,s)>=.5,vr=h=>h===re?_e:n.paint(h===Ze&&!je?"neutral":"neutralStrong"),Mr=null;if(t.active!==null&&D[t.active]){let h=D[t.active],O=Math.max(...h.counts),I=P=>{let J=i.inBin(h.counts[P],ht(gt(P,h.counts[P]))),Y={label:i.cum,value:ht(gt(P,wr[P][h.i])),strong:!1};return v?[{label:N[P].name,value:J,color:vr(P),strong:P===re},Y]:[{label:i.count,value:J,color:$r(h)?_e:n.paint(te||je?"neutralStrong":"neutral"),strong:!0},Y]};Mr={x:(X(h.x0)+X(h.x1))/2,y:te?U-Math.ceil(O/Ae)*Ft:ft(O),title:me(h),rows:N.flatMap((P,J)=>I(J))}}let Tr=h=>{let O=N[h],I=w[h],P=F[h],J=V=>L.binned?i.about(a(V)):a(V),Y=[i.samples(O.n),i.median(J(I.median)),...I.marks.filter(V=>V.id!=="p50").map(V=>`${V.id} ${J(V.v)}`)];return!v&&Qe&&Y.push(i.peak(me(D[ue.indexOf(Qe)]),Qe)),P&&c&&Y.push(i.past(P.est?i.about(`${P.n}`):`${P.n}`,f,a(c.value),c.label??"",ht(gt(h,P.n)))),Y},bn=[At,te?i.dot(Ae):""].filter(Boolean),Ji=L.groupCount>N.length?` ${i.hidden(N.length,L.groupCount)}.`:"",Zi=C?v?`${i.kind}, ${i.groups(N.length)}. ${N.map((h,O)=>`${h.name}: ${Tr(O).join(", ")}`).join("; ")}${bn.length?`. ${bn.join(", ")}`:""}.${Ji}`:`${i.kind}. ${[...Tr(0),...bn].join(", ")}.`:"",Qi=e.description??Zi,pt=c&&fn(c.value)?X(c.value):null,Rt=C?[X(D[0].x0),...D.map(h=>X(h.x1))]:[],Cr=(h,O)=>h>0&&U-O<1?U-1:O,ea=(h,O,I)=>{let P=X(h.x0)+.5,J=X(h.x1)-.5,Y=J-P;if(Y<=0||h.counts[I]<=0)return null;let V=Cr(h.counts[I],O),Ne=Math.min(2,Y/4),_t=n.paint("neutral"),tt=c&&!v?sr(h,c,s):0;if(tt<=0||tt>=1||pt===null)return(0,z.jsx)("path",{d:Jt(P,V,Y,U-V,{tl:Ne,tr:Ne}),fill:tt>=1||Je.has(h.i)?_e:_t});let yn=Math.max(P,Math.min(J,pt)),[sa,la]=f?[_t,_e]:[_e,_t];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("path",{d:Jt(P,V,yn-P,U-V,{tl:Ne}),fill:sa}),(0,z.jsx)("path",{d:Jt(yn,V,J-yn,U-V,{tr:Ne}),fill:la})]})},ta=(h,O)=>{let I=O.map((Y,V)=>Cr(D[V]?.counts[h]??0,Y)),P=v&&h===dt&&re>=0,J=v?[]:c?pt===null?[]:[f?[pt,1/0]:[-1/0,pt]]:Dl(Je,C).map(([Y,V])=>[Rt[Y],Rt[V+1]]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("path",{d:Si(Rt,I,U),fill:"none",stroke:P?_e:n.paint("neutralStrong"),strokeWidth:P?2:1.6,strokeLinejoin:"round"}),J.map(([Y,V],Ne)=>(0,z.jsx)("path",{d:Si(Rt,I,U,Y,V),fill:"none",stroke:_e,strokeWidth:2,strokeLinejoin:"round"},Ne))]})},na=(h,O)=>{let I=h.counts[0],P=Math.floor(I/Ae),J=I%Ae>0,Y=Math.round(O*(P+(J?1:0))),V=M((X(h.x0)+X(h.x1))/2),Ne=$r(h)?_e:n.paint("neutralStrong");return(0,z.jsxs)(z.Fragment,{children:[Array.from({length:Math.min(Y,P)},(_t,tt)=>(0,z.jsx)("circle",{cx:V,cy:M(U-Ft*(tt+.5)),r:M(gn),fill:Ne},tt)),J&&Y>P?(0,z.jsx)("circle",{cx:V,cy:M(U-Ft*(P+.5)),r:M(gn-.65),fill:"none",stroke:Ne,strokeWidth:1.3}):null]})},ra=C?s?Ol(E,j,(Ge-et)/Math.max(1e-9,Math.log10(j/E))):El(E,j,Math.round((Ge-et)/70)):[],oa=xt(e.format,t.locale,Math.max(Math.abs(E),Math.abs(j))),ia=Do(ra.map(h=>({t:h,x:X(h),label:oa(h)})),0,r),Pe=t.active!==null?D[t.active]:void 0,aa=Pe&&(te||je||v),Sr=kr.fade(Math.min(700,C*pn)+200,320);return(0,z.jsxs)(uo,{c:t,kind:i.kind,ariaLabel:e.ariaLabel,description:Qi,events:qi,tip:Mr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[!te&&C?(0,z.jsx)(Po,{p:n,ticks:mr,y:ft,x0:fr,x1:r,fmt:dr,locale:t.locale}):null,aa?(0,z.jsx)("rect",{x:M(X(Pe.x0)),y:M(de),width:M(X(Pe.x1)-X(Pe.x0)),height:M(U-de),fill:n.paint("line"),opacity:.6,pointerEvents:"none"}):null,D.map(h=>(0,z.jsx)("rect",{x:M(X(h.x0)),y:M(de),width:M(Math.max(0,X(h.x1)-X(h.x0))),height:M(Math.max(0,U-de)),fill:"transparent",onPointerEnter:O=>t.setActive(h.i,O.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(h.i),style:{cursor:e.onClick?"pointer":void 0}},`h${h.i}`)),kr.items.map(h=>{let{k:O,i:I}=h.data,P=D[I];return(0,z.jsx)("g",{className:"ztd-mark",pointerEvents:"none",opacity:h.exiting?.4:I<0?1:t.dim(I),children:I<0?ta(O,h.v):P?te?na(P,h.v[0]):ea(P,h.v[0],O):null},h.key)}),Pe&&t.via==="keyboard"?(0,z.jsx)("rect",{x:M(X(Pe.x0)-1),y:M(de-2),width:M(X(Pe.x1)-X(Pe.x0)+2),height:M(U-de+4),rx:3,fill:"none",stroke:n.paint("ink"),strokeWidth:2,pointerEvents:"none"}):null,Se?.curves.map((h,O)=>(0,z.jsx)("path",{d:Co(h.map((I,P)=>[hr(Se.xs[P]),Math.max(de,ft(I))])),fill:"none",stroke:v?vr(O):n.paint("ink"),strokeWidth:1.6,opacity:Sr,pointerEvents:"none"},`k${O}`)),(0,z.jsxs)("g",{opacity:Sr,pointerEvents:"none","aria-hidden":"true",children:[hn.map(h=>(0,z.jsx)("line",{x1:M(h.at),x2:M(h.at),y1:t.showLabels?Nt(h.row)+un:de,y2:U,stroke:h.stroke,strokeWidth:h.key==="threshold"?1.5:1.4,strokeDasharray:h.dash},h.key)),t.showLabels?hn.map(h=>(0,z.jsxs)("g",{children:[(0,z.jsx)("rect",{x:M(h.x-h.w/2),y:Nt(h.row),width:M(h.w),height:un,rx:5,fill:n.paint("panel"),opacity:.92}),(0,z.jsx)(Ee,{x:h.x,y:Nt(h.row)+un/2,anchor:"middle",size:Ai,weight:700,fill:h.fill,children:h.text})]},h.key)):null]}),(0,z.jsxs)("g",{"aria-hidden":"true",children:[ia.map(h=>(0,z.jsx)(Ee,{x:h.x,y:U+11,anchor:"middle",size:Ue,fill:n.paint("muted"),children:h.label},h.t)),te&&C?(0,z.jsx)("line",{x1:et,x2:Ge,y1:M(U)+.5,y2:M(U)+.5,stroke:n.paint("dim"),shapeRendering:"crispEdges"}):null,At?(0,z.jsx)(Ee,{x:et,y:6+mn/2,size:10.5,fill:n.paint("muted"),children:Gn(At,Math.max(40,Ge-et-(te?110:0)),10.5)}):null,te?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("circle",{cx:M(Ge-ve(i.dot(Ae),10.5,600)-8),cy:6+mn/2,r:3.5,fill:n.paint("neutralStrong")}),(0,z.jsx)(Ee,{x:Ge,y:6+mn/2,anchor:"end",size:10.5,weight:600,fill:n.paint("muted"),children:i.dot(Ae)})]}):null,C?null:(0,z.jsx)(Ee,{x:r/2,y:o/2,anchor:"middle",size:12,fill:n.paint("muted"),children:t.t.empty})]})]})}var Il=R(q(),1);var Pi=R(G(),1),zl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Bl={en:zl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ni=(e,t)=>Bl[e].other(t);function Fi(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,To(o.map(i=>i.value)))}}var Ri=e=>Number.isFinite(e)&&e>0?e:0;function _i(e,t,n,r){return r==="emphasis"?Ur(e,t,n):xe(e,t,n)}var Hl=R(q(),1);var Oi=R(G(),1);function Di(e,t){return t===!1?e.map((n,r)=>r):Mo(e)}function Li(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return pe(e,t,t,r,"max")}function Ei(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]=ne(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?ne(e,"neutral"):Ot(e,1-a/Math.max(1,o.length-1))),r}function Ii(e){return!e||typeof e!="object"||Array.isArray(e)?[]:$e(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function zi(e,t){return yt(e,t+1,new Set)}var jl=R(q(),1);var Hi=R(G(),1);var Gl=26;var Em=Gl*.62;function Bi(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Ko.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var Re=R(G(),1);function ji(e,t,n){let r=Xt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Ut(n)?Xt("bubble"):r}function Wl(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 Vl(e,t,n,r=!1){let o=ji(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&&zn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(f=>!l.has(f.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=ge(i.label,"label"),f=Fe(i.value,"value"),p=o.type==="waffle",d=t.map((x,S)=>({r:x,label:u(x,S),value:p?f(x,S):Ri(f(x,S))})),{kept:g,other:k}=p?{kept:d,other:null}:Fi(d,a.other,(x,S)=>({r:{},label:Ni(Z(n),x),value:S})),b=pe(s,g.map(x=>x.r),g.map(x=>x.label),g.map(x=>x.value),p?"first":"max"),$=k?[...g,k]:g,T=Le(x=>p?xe(x,$.length,b):_i(x,$.length,b,a.colorMode)),A=p&&a.shape==="arc";return $.map((x,S)=>({label:x.label,color:T[S],...A&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Mi(Array.isArray(a.ma)?a.ma:void 0,t.length),f=vi[Z(n)];return[{label:f.up,color:a.upColor??"accent"},{label:f.down,color:a.downColor??"neutralStrong"},...u.map((p,d)=>({label:f.maLegend(p),color:or[d],shape:"line"}))]}if(o.type==="network"){let u=Ii(a.groups);if(u.length<2)return[];let f=Le(p=>zi(p,u.length));return u.map((p,d)=>({label:p,color:f[d],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ge(i.group,"group"),f=$e(t.map((d,g)=>u(d,g)).filter(Boolean));if(f.length<2)return[];let p=Le(d=>yt(d,f.length,new Set));return f.map((d,g)=>({label:d,color:p[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||Ut(a))return[];let u=ge(i.series,"series"),f=$e(t.map((g,k)=>u(g,k)));if(f.length<2)return[];let p=$i(s,t,f,u),d=Le(g=>yt(g,f.length,p));return c(f.map((g,k)=>({label:g,color:d[k],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",f=u?i.status:i.group;if(typeof f!="string")return[];let p=mi(t,f,u),d=Le(g=>xe(g,p.length,Bi(s,p)));return c(p.map((g,k)=>({label:g,color:d[k],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 T=ge(i.series,"series");u=$e(t.map((A,x)=>T(A,x)))}let f=Bn(o.type,i,a);if(f.length){let T=pe(s,u,u,u.map(()=>0),"none"),A=Le(S=>xe(S,u.length,T)),x=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((S,B)=>({label:S,color:A[B]}));return[...c(x),...f.map((S,B)=>({label:S,color:wi(B),shape:"line"}))]}if(u.length<2)return[];let d=o.type==="bar"&&a.layout==="diverging"&&s===void 0?vo(u.length,Array.isArray(a.negative)?a.negative.map(T=>u.indexOf(String(T))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,g=d>=0?new Set([d]):pe(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((T,A)=>({label:T,color:g.has(A)?"accent":"neutralStrong",shape:"square"})));let k=a.colorMode,b=T=>xe(T,u.length,g);if((o.type==="line"||o.type==="area")&&(b=T=>ki(T,u.length,g,o.type==="area",k)),o.type==="stream"){let T=$t(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),A=Di(T.values,a.reorder),x=Li(s,T.series,T.values);b=S=>Ei(S,A,x)}let $=Le(b);return c(u.map((T,A)=>({label:T,color:$[A],...o.type==="line"&&{shape:"line"}})))}return[]}function Kl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&po.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ul(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function Gi(e,t){let{spec:n}=e,r=ji(n.type,n.encoding,n.options),o=(0,Ct.useMemo)(()=>di(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=go(n,e.locale),s=se(a),l=Z(s),c=Uo(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=xo(n),u=(0,Ct.useMemo)(()=>m?ei(m,s):void 0,[m,s]),f=n.options?.hidden,p=Array.isArray(f)?f.map(String):[],d=p.join(""),[g,k]=(0,Ct.useState)(null);if(!r)return(0,Re.jsx)(In,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let b=o??c.data,$=t[r.type],T={...n.options??{}},A={...Wl(r,n.encoding),...T,...u?{tooltip:u}:{},data:b,...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"&&yo(r.type,n.encoding??{},T),S=g&&g.base===d?g.hidden:p;x&&(A.hidden=S);let B=C=>k(v=>{let w=v&&v.base===d?v.hidden:p;return{base:d,hidden:w.includes(C)?w.filter(F=>F!==C):[...w,C]}}),H=A.height??220,L=Kl(n,r.type),D=i&&!b.length&&(c.loading||c.error||c.empty)?(0,Re.jsx)(In,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:H,locale:a}):L?(0,Re.jsx)(Vo,{chart:$,...Ul(r.type,L,A)}):(0,Re.jsx)($,{...A});if(n.card){let C=n.card,v=C.legend==="auto"||C.legend==="toggle"?Vl(n,b,s,x):C.legend,w=v?.length?x?(0,Re.jsx)(On,{items:v,hidden:S,onToggle:B,locale:a}):v:void 0,F=C.download?(0,Re.jsx)(Qo,{data:b,columns:ko(n),filename:C.title??r.type,formats:Array.isArray(C.download)?C.download:void 0,locale:a}):void 0;D=(0,Re.jsx)(co,{number:C.number,title:C.title??ho(r,l),subtitle:C.subtitle,legend:w,actions:F,source:C.source||void 0,note:C.note||void 0,accent:C.accent,takeaway:C.takeaway,level:C.level,sample:C.sample,replay:C.replay!==!1,className:e.className,locale:a,children:D})}let N=e.theme??n.theme;return N&&(D=(0,Re.jsx)(jt,{theme:N,children:D})),D}function Xl({cfg:e,components:t}){let n=ct();return Gi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Vi(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Wi.hydrateRoot)(r,(0,cr.createElement)(jt,{theme:o.theme,cssVars:!0},(0,cr.createElement)(Xl,{cfg:o,components:{[e]:t}})))}Vi("histogram",lr);})();
27
+ `}function hl(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Un(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Yo=2,Be=16;function qo(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 Jo(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 Zo(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+Be*2,a+Be*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((d,g)=>{let k;for(let y of Array.from(d.attributes)){if(!ml.test(y.value))continue;let v=(k??(k=getComputedStyle(d))).getPropertyValue(y.name);v&&m[g].setAttribute(y.name,qo(v,u))}}),c.removeAttribute("style");for(let[d,g]of Object.entries({viewBox:`${-Be} ${-Be} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(d,String(g));let f=qo(getComputedStyle(r).backgroundColor,u),p=o.parentElement?.querySelector("canvas")??null;if(n){let d=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Jo("rect",{x:-Be,y:-Be,width:s,height:l,fill:f}),d),p&&c.insertBefore(Jo("image",{href:p.toDataURL(),width:i,height:a}),d)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:f,canvas:p}}function gl(e,t){let n=Zo(e,Yo,!1);if(!n)return;let r=Yo,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,Be*r,Be*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&&Un(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Qo(e){let t=we(e.theme),n=Z(se(e.locale))==="ko",r=hl(e.filename),o=(i,a)=>{if(i==="csv")return Un(new Blob([fl(e.data,e.columns?.length?e.columns:dl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return gl(a,r);let s=Zo(a,1,!0);s&&Un(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Yn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:cl.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,Yn.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 ti=F(G(),1);function ei(e,t=ae){let n=We(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?kt(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(no,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,ti.jsx)("div",{children:s},l)):null}}var pl=e=>new Float64Array(e.map(he).filter(Number.isFinite)).sort(),bl=(e,t)=>t>=0&&t<=100?Ke(e,t/100):NaN;function ni(e,t){return bl(pl(e),t)}function qn(e){let t=/^p(\d+(?:\.\d+)?)$/.exec(e),n=t?Number(t[1]):NaN;return n>=0&&n<=100?n:NaN}function ai(e,t,n){let r=e.filter(d=>Number.isFinite(d)),o=r.length;if(!o)return t.map(()=>0);let i=r.reduce((d,g)=>d+g,0)/o,a=t.length>1?Math.abs(t[t.length-1]-t[0]):0,s=a>0?a/40:Math.abs(i)*.05||1,l=Math.sqrt(r.reduce((d,g)=>d+(g-i)**2,0)/o)||s,c=[...r].sort((d,g)=>d-g),m=Ke(c,.75)-Ke(c,.25),u=Math.min(l,m>0?m/1.34:l)||l,f=n??Math.max(1e-9,.9*u*Math.pow(o,-.2)),p=1/(Math.sqrt(2*Math.PI)*f*o);if(o>2e3){let g=c[0],y=(c[o-1]-g)/512||1,v=new Array(513).fill(0);for(let T of r)v[Math.min(512,Math.floor((T-g)/y))]++;return t.map(T=>{let A=0;for(let x=0;x<=512;x++){if(!v[x])continue;let S=(T-(g+x*y))/f;S>6||S<-6||(A+=v[x]*Math.exp(-.5*S*S))}return A*p})}return t.map(d=>{let g=0;for(let k of r){let y=(d-k)/f;y>6||y<-6||(g+=Math.exp(-.5*y*y))}return g*p})}var Zn=2;function si(e,t,n){return n!==void 0?!0:t!==void 0||!e?!1:["x0","x1","count"].every(r=>wt(e,r))&&!wt(e,"value")}var yl=50,xl=200,kl=[1,2,2.5,5,10],an=[[1],[1,3],[1,2,5],[1,1.6,2.5,4,6.3],[1,1.25,1.6,2,2.5,3.15,4,5,6.3,8]],He=e=>Number(e.toPrecision(12));function Jn(e,t=!1){let n=10**Math.floor(Math.log10(e)),r=kl.map(o=>He(o*n));return t?r.find(o=>o>=e*(1-1e-9))??He(10*n):r.reduce((o,i)=>Math.abs(Math.log(i/e))<Math.abs(Math.log(o/e))?i:o)}function ri(e,t,n){let r=Math.floor(e/n+1e-9)*n,o=Math.max(1,Math.ceil((t-r)/n-1e-9)),i=Array.from({length:o+1},(a,s)=>He(r+s*n));return i[0]>e&&i.unshift(He(i[0]-n)),i[i.length-1]<t&&i.push(He(i[i.length-1]+n)),i}function Qn(e,t,n,r=0){let o=[];for(let i=Math.floor(Math.log10(e))-r;i<=Math.ceil(Math.log10(t))+r;i++)for(let a of n)o.push(He(a*10**i));return o}function oi(e,t,n){let r=Qn(e,t,n,1),o=r.length-1;for(;o>0&&r[o]>e*(1+1e-9);)o--;let i=o+1;for(;i<r.length-1&&r[i]<t*(1-1e-9);)i++;return r.slice(o,i+1)}function ii(e){let t=e.length,n=Ke(e,.75)-Ke(e,.25);return t>=30&&n>0?2*n/Math.cbrt(t):(e[t-1]-e[0])/(Math.ceil(Math.log2(t))+1)}function wl(e,t){let n=[...new Set(e.filter(r=>Number.isFinite(r)&&(!t||r>0)))].sort((r,o)=>r-o);return n.length>=2?n:null}function li(e,t={}){let n=t.log===!0,r=t.edges?wl(t.edges,n):null;if(r)return r;let o=Float64Array.from(e.filter(f=>Number.isFinite(f)&&(!n||f>0))).sort();if(!o.length)return[];let i=o[0],a=o[o.length-1],s=t.binWidth!==void 0&&t.binWidth>0&&!n?t.binWidth:void 0;if(i===a){if(n)return[He(i/2),He(i*2)];let f=s??1;return[i-f/2,i+f/2]}let l=t.bins!==void 0&&t.bins>=1?Math.round(t.bins):void 0,c=s!==void 0||l!==void 0?xl:yl;if(n){let f=l!==void 0?Math.log10(a/i)/l:ii(o.map(Math.log10)),p=k=>Math.abs(Math.log(1/k.length/f)),d=an.reduce((k,y,v)=>p(y)<p(an[k])?v:k,0),g=oi(i,a,an[d]);for(;g.length-1>c&&d>0;)g=oi(i,a,an[--d]);return g}let m=s??Jn(l!==void 0?(a-i)/l:ii(o));(a-i)/m>c&&(m=Jn((a-i)/c,!0));let u=ri(i,a,m);for(;u.length-1>c;)u=ri(i,a,m=Jn(m*1.01,!0));return u}function er(e,t){let n=e.length-1;if(n<1||!(t>=e[0]&&t<=e[n]))return-1;let r=0,o=n;for(;o-r>1;){let i=r+o>>1;e[i]<=t?r=i:o=i}return r}function ci(e,t){let n=new Array(Math.max(0,t.length-1)).fill(0),r=0;for(let o of e){if(!Number.isFinite(o))continue;let i=er(t,o);i<0?r++:n[i]++}return{counts:n,outside:r}}function ui(e,t){let n=Math.max(1,Math.floor(t));if(!(e>n))return 1;if(!Number.isFinite(e))return 1/0;for(let r=10**Math.max(0,Math.floor(Math.log10(e/n))-1);;r*=10)for(let o of[1,2,5])if(Math.ceil(e/(o*r))<=n)return o*r}function mi(e,t,n=!1){let r=ge(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=ve(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 Ve(t.csv)}return null}var xi=F(q(),1);var ee=F(q(),1);function fi(e,t){let n=we(e.theme),[r,o,i]=rn(e.width),a=ct(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=on(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,f=Wo(r,e.animateOnView!==!1&&u),p=se(e.locale),d=Z(p),g=(0,ee.useMemo)(()=>We(e.format,p,t.format),[e.format,p,t.format]),k=(0,ee.useCallback)(K=>it(K,{locale:p}),[p]),y=(0,ee.useMemo)(()=>It(g,e.unit),[g,e.unit]),v=(0,ee.useMemo)(()=>Yt(e.data),[e.data]),[T,A]=(0,ee.useState)(null),[x,S]=(0,ee.useState)(null),B=(0,ee.useRef)([]),H=(0,ee.useRef)(e.onHover);H.current=e.onHover;let L=(0,ee.useRef)(e.onClick);L.current=e.onClick;let D=(0,ee.useRef)(null),N=(0,ee.useRef)(null),C=(0,ee.useRef)(null),$=(0,ee.useCallback)((K,re="pointer")=>{if(C.current!==K){C.current=K;let ue=K===null?null:B.current[K]??null;queueMicrotask(()=>H.current?.(ue)),N.current?.(K)}D.current=K===null?null:re,A(K),S(D.current)},[]),w=(0,ee.useCallback)(K=>{D.current!=="keyboard"&&(D.current=K===null?null:"sync",A(K),S(D.current))},[]),R=(0,ee.useCallback)(K=>{let re=B.current[K];re&&L.current?.(re)},[]),E=lo(e.replayKey),j=e.width!==void 0||(i??0)>0,ie={enabled:u,active:f.visible&&j,near:f.near,replayKey:E,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Se=(0,ee.useCallback)((K,re=1)=>T===null||T===K?re:re*.38,[T]);return{p:n,width:s,height:c,measured:j,responsive:e.width===void 0,pending:ye&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:ie,fv:y,fmt:g,pct:k,locale:p,lang:d,t:d==="ko"?Br:zr,active:T,via:x,setActive:$,click:R,events:B,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Se,sig:v,description:e.description,reduced:m,publish:N,applySync:w}}var Q=F(q(),1);function vl(e){return 1-Math.pow(1-e,3)}function $l(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ml(e){return e==="easeInOut"?$l:e==="linear"?t=>t:vl}function Tl(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 mt(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 sn(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 hi(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 gi(e,t,n,r){if(!t||!n||t.length!==n.length)return mt(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 mt(s,n[a]))o.push(l)}return o.length===r?o:mt(e,r)}var ln=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||!sn(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),hi(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=sn(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=gi(s.cur,s.parts,a.parts,c),s.vel=gi(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),hi(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=sn(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<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=sn(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=mt(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=Ml(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=mt(s.from,c)),s.vel.length!==c&&(s.vel=mt(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 m;if(this.easing==="spring"){let u=Math.exp(-i*l),f=i*l>=8&&i*l<20,p=0;for(let d=0;d<c;d++){let g=s.from[d]-s.to[d],k=s.vel[d]+i*g;s.cur[d]=s.to[d]+(g+k*l)*u,s.curVel[d]=(s.vel[d]-i*k*l)*u,f&&p<.15&&(p=Math.max(p,Math.abs(s.cur[d]-s.to[d]),Math.abs(s.curVel[d]/i)))}m=i*l>=20||f&&p<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),f=r(u),p=Tl(this.easing,u)/o;for(let d=0;d<c;d++)s.cur[d]=s.from[d]+(s.to[d]-s.from[d])*f,s.curVel[d]=(s.to[d]-s.from[d])*p;m=u>=1,s.progress=f}if(m){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}},Tt=new Set,cn=0;function pi(e){cn=0;let t=Array.from(Tt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Tt.delete(n)}Tt.size&&typeof requestAnimationFrame<"u"&&(cn=requestAnimationFrame(pi))}function bi(e){return Tt.add(e),!cn&&typeof requestAnimationFrame<"u"&&(cn=requestAnimationFrame(pi)),()=>{Tt.delete(e)}}function Cl(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 yi(e,t){let n=(0,Q.useMemo)(()=>Cl(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,Q.useRef)(null),f=(0,Q.useRef)("init"),p=(0,Q.useRef)(null),d=(0,Q.useRef)(s),g=(0,Q.useRef)(a),k=(0,Q.useRef)(!1),y=(0,Q.useRef)(0),[,v]=(0,Q.useState)(0),T=(0,Q.useRef)(null),A=(0,Q.useRef)(!0);u.current||(u.current=new ln,u.current.configure(l,c),u.current.snap(n),p.current=n);let x=u.current;if(x.configure(l,c),p.current!==n){let N=f.current,C=!Object.is(d.current,s);x.sameTargets(n)?x.refreshData(n):!r||N==="init"?x.snap(n):N==="idle"?x.hold(n):N==="running"||C?x.update(n,Lt(),m):x.snap(n),p.current=n,d.current=s}let S=(0,Q.useRef)(()=>!1);S.current=N=>{if(!A.current)return!1;let C=x.step(N);return!C&&f.current==="running"&&(f.current="done"),v($=>($+1)%1e9),C||(T.current=null),C};let B=(0,Q.useCallback)(()=>{if(!ye||T.current||!x.animating)return;let N=C=>S.current(C);T.current=bi(N)},[x]);Te(()=>{let N=!Object.is(g.current,a);if(g.current=a,!r){(f.current!=="done"||x.animating)&&(x.snap(p.current??n),f.current="done",v(C=>C+1));return}f.current==="init"||N&&i?(x.hold(p.current??n),f.current="idle",k.current=!1,v(C=>C+1)):N&&(k.current=!0)},[r,a]),Te(()=>{!r||!i||!k.current||(k.current=!1,x.hold(p.current??n),f.current="idle",v(N=>N+1))},[i,r]),(0,Q.useEffect)(()=>{r&&o&&f.current==="idle"&&(x.start(Lt()),y.current+=1,f.current="running",B(),v(N=>N+1))},[r,o,a,x,B]),(0,Q.useEffect)(()=>{x.animating&&B()}),(0,Q.useEffect)(()=>(A.current=!0,()=>{A.current=!1,T.current?.(),T.current=null}),[]);let H=Lt(),L=x.elapsed(H),D=r&&f.current==="idle";return{items:x.items(),get:N=>x.get(N),elapsed:D?0:L,fade:(N,C=320)=>D?0:Number.isFinite(L)?Math.max(0,Math.min(1,(L-N)/C)):1,waiting:D,animating:x.animating,generation:y.current}}var tr=F(G(),1);function ki(e,t,n,r,o){if(r)return o==="categorical"?xe(e,t,n):Ur(e,t,n);if(o==="categorical")return xe(e,t,n);let i=ne(e,"strong"),a=ne(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Sl=F(q(),1);var nr=F(G(),1);var wi=e=>e?"neutralStrong":"accent";var rr=F(G(),1);function vi(e,t,n,r){if(typeof e!="function")return pe(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 Al=F(q(),1);var ir=F(G(),1),Nl={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}, ${Ce(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},$i={en:Nl,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}일 이동평균`}},or=["ink","muted","dim"];function Mi(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,or.length)}var qe=F(q(),1);var z=F(G(),1),Rl={kind:"Histogram",count:"Count",cum:"Cumulative",range:(e,t)=>`${e} to ${t}`,inBin:(e,t)=>`${e} · ${t}`,row:(e,t)=>`${e} (${t})`,rowCum:e=>`cumulative ${e}`,samples:e=>Ce(e,"sample"),median:e=>`median ${e}`,about:e=>`about ${e}`,peak:(e,t)=>`the tallest bin is ${e} (${t})`,past:(e,t,n,r,o)=>`${e} ${t?"above":"below"} ${r?`the ${r} of ${n}`:n} (${o})`,outside:e=>`${e} outside the edges`,excluded:e=>`${e} at or below 0 left out`,dot:e=>`1 dot = ${Ce(e,"sample")}`,groups:e=>Ce(e,"group"),hidden:(e,t)=>`Only the first ${e} of ${t} groups are drawn`},Fl={en:Rl,ko:{kind:"히스토그램",count:"건수",cum:"누적",range:(e,t)=>`${e} ~ ${t}`,inBin:(e,t)=>`${e}건 · ${t}`,row:(e,t)=>`${e}건(${t})`,rowCum:e=>`누적 ${e}`,samples:e=>`표본 ${e}개`,median:e=>`중앙값 ${e}`,about:e=>`약 ${e}`,peak:(e,t)=>`가장 많은 구간 ${e}(${t}건)`,past:(e,t,n,r,o)=>`${r?`${r} `:""}${n} ${t?"넘음":"미만"} ${e}건(${o})`,outside:e=>`범위 밖 ${e}개`,excluded:e=>`0 이하 ${e}개 제외`,dot:e=>`점 하나 = ${e}건`,groups:e=>`그룹 ${e}개`,hidden:(e,t)=>`그룹 ${t}개 중 앞의 ${e}개만 그려요`}},ar=e=>e,_l=["p50","p95"],Ai=10,un=15,mn=16,Ti=96,Pl=e=>e==="p50"?void 0:e==="p99"?"1.5 2.5":"4 3";function Dl(e,t,n,r,o){let i=Re(t,"value"),a=n?ge(n,"group"):()=>"",s=new Map,l=[];e.forEach((d,g)=>{let k=i(d,g);if(!Number.isFinite(k))return;let y=a(d,g),v=s.get(y);v||s.set(y,v={values:[],excluded:0}),o.log&&k<=0?v.excluded++:(v.values.push(k),r?.(d,g)&&l.push({g:y,v:k}))});let c=[...s.keys()].slice(0,Zn),m=c.length?li(c.flatMap(d=>s.get(d).values),o):[],u=c.map(d=>ci(s.get(d).values,m)),f=m.slice(1).map((d,g)=>({i:g,x0:m[g],x1:d,counts:u.map(k=>k.counts[g])})),p=c.map((d,g)=>({name:d,n:s.get(d).values.length,values:s.get(d).values,outside:u[g].outside,excluded:s.get(d).excluded}));return{bins:f,samples:p,groupCount:s.size,binned:!1,fnBins:new Set(l.map(d=>er(m,d.v)).filter(d=>d>=0)),fnGroup:l.map(d=>c.indexOf(d.g)).find(d=>d>=0)??-1}}function Ll(e,t,n,r){let o=Re(t.x0,"x0"),i=Re(t.x1,"x1"),a=Re(t.count,"count"),s=t.group?ge(t.group,"group"):()=>"",l=new Map,c=new Map;e.forEach((g,k)=>{let y=o(g,k),v=i(g,k),T=a(g,k);if(!(Number.isFinite(y)&&Number.isFinite(v)&&v>y&&Number.isFinite(T)&&T>=0))return;let A=s(g,k);if(l.set(A,l.get(A)??0),r&&y<=0){l.set(A,l.get(A)+T);return}let x=`${y}|${v}`,S=c.get(x);S||c.set(x,S={x0:y,x1:v,by:new Map,picked:new Set}),S.by.set(A,(S.by.get(A)??0)+T),n?.(g,k)&&S.picked.add(A)});let m=[...l.keys()].slice(0,Zn),u=[],f=new Set;for(let g of[...c.values()].sort((k,y)=>k.x0-y.x0||k.x1-y.x1)){let k=u[u.length-1];k&&g.x0>k.x1&&u.push({i:u.length,x0:k.x1,x1:g.x0,counts:m.map(()=>0)}),g.picked.size&&f.add(u.length),u.push({i:u.length,x0:g.x0,x1:g.x1,counts:m.map(y=>g.by.get(y)??0)})}let p=m.map((g,k)=>({name:g,n:u.reduce((y,v)=>y+v.counts[k],0),values:[],outside:0,excluded:l.get(g)})),d=m.findIndex(g=>[...c.values()].some(k=>k.picked.has(g)));return{bins:u,samples:p,groupCount:l.size,binned:!0,fnBins:f,fnGroup:d}}function Ci(e,t,n,r){let o=e.samples[t];if(!e.binned)return ni(o.values,n);let i=n/100*o.n,a=0;for(let s of e.bins){let l=s.counts[t];if(l>0&&a+l>=i){let c=(i-a)/l;return r?10**(Math.log10(s.x0)+c*(Math.log10(s.x1)-Math.log10(s.x0))):s.x0+c*(s.x1-s.x0)}a+=l}return NaN}function sr(e,t,n){let r=n?Math.log10:ar;if(n&&t.value<=0)return t.side==="below"?0:1;let o=(r(t.value)-r(e.x0))/(r(e.x1)-r(e.x0));return Math.max(0,Math.min(1,t.side==="below"?o:1-o))}function El(e,t,n,r){let o=n.side!=="below",i=e.samples[t];if(!e.binned)return{n:i.values.filter(l=>o?l>n.value:l<n.value).length,est:!1};let a=0,s=!1;for(let l of e.bins){let c=sr(l,n,r);a+=l.counts[t]*c,c>0&&c<1&&l.counts[t]>0&&(s=!0)}return{n:Math.round(a),est:s}}function Si(e,t,n,r=-1/0,o=1/0){let i=t.length,a=l=>Math.min(e[l+1],o)>Math.max(e[l],r),s="";for(let l=0;l<i;l++){if(!a(l))continue;let c=l;for(;c+1<i&&a(c+1);)c++;let m=Math.max(e[l],r),u=Math.min(e[c+1],o);s+=`M${M(m)},${M(m===e[l]?Math.max(l?t[l-1]:n,t[l]):t[l])}V${M(t[l])}`;for(let f=l;f<c;f++)s+=`H${M(e[f+1])}V${M(t[f+1])}`;s+=`H${M(u)}`,u===e[c+1]&&(s+=`V${M(Math.max(c+1<i?t[c+1]:n,t[c]))}`),l=c}return s}function Ol(e,t){let n=[];for(let r=0;r<t;r++){if(!e.has(r))continue;let o=r;for(;e.has(o+1);)o++;n.push([r,o]),r=o}return n}function Il(e,t,n){let r=[...e].sort((l,c)=>l.at-c.at),o=l=>{let c=[];return r.map(m=>{let u=$e(m.text,Ai,700)+10,f=[m.at,m.at+u/2-4,m.at-u/2+4].map(p=>Math.max(t+u/2,Math.min(n-u/2,p)));for(let p=0;;p++){let d=c[p]??(c[p]=[]),g=l.map(k=>f[k]).find(k=>d.every(([y,v])=>k+u/2+4<=y||k-u/2-4>=v));if(g!==void 0)return d.push([g-u/2,g+u/2]),{...m,x:g,w:u,row:p}}})},i=l=>Math.max(0,...l.map(c=>c.row)),a=o([0,1,2]),s=o([2,0,1]);return i(s)<i(a)?s:a}function zl(e,t,n){let r=[];for(let o=Math.max(2,n);o<=Math.max(2,n)+4&&r.length<3;o++)r=en(e,t,o).filter(i=>i>=e-1e-9&&i<=t+1e-9);return r}function Bl(e,t,n){let r=i=>Qn(e,t,i).filter(a=>a>=e*.999999999&&a<=t*1.000000001),o=r(n>=110?[1,2,5]:[1]);return o.length>=2?o:r([1,2,3,4,5,6,7,8,9])}function lr(e){let t=fi(e,{height:h=>Math.max(230,Math.min(310,h*.55)),duration:800}),{p:n,width:r,height:o}=t,i=Fl[t.lang],a=t.fv,s=e.log===!0,l=e.variant??"bars",c=e.threshold&&Number.isFinite(e.threshold.value)?e.threshold:void 0,m=c?.value,u=c?.side,f=u!=="below",p=e.edges?.join(","),d=(e.marks??_l).filter(h=>Number.isFinite(qn(h))).join(","),g=typeof e.highlight=="function"?e.highlight:null,k=typeof e.highlight=="function"?void 0:e.highlight,{data:y,value:v,group:T,x0:A,x1:x,count:S,binWidth:B,bins:H}=e,L=(0,qe.useMemo)(()=>{let h=y.find(I=>I!==null&&typeof I=="object");if(si(h,v,S))return Ll(y,{x0:A,x1:x,count:S,group:T},g,s);let O=p?p.split(",").map(Number):void 0;return Dl(y,v,T,g,{edges:O,binWidth:B,bins:H,log:s})},[y,v,T,A,x,S,p,B,H,s,g]),{bins:D,samples:N}=L,C=D.length,$=N.length>1,w=(0,qe.useMemo)(()=>L.samples.map((h,O)=>{let I=d?d.split(",").map(P=>({id:P,v:Ci(L,O,qn(P),s)})):[];return{median:I.find(P=>P.id==="p50")?.v??Ci(L,O,50,s),marks:I}}),[L,d,s]),R=(0,qe.useMemo)(()=>m===void 0?[]:L.samples.map((h,O)=>El(L,O,{value:m,side:u},s)),[L,m,u,s]),[E,j]=(0,qe.useMemo)(()=>Ye(L.bins.flatMap(h=>[h.x0,h.x1])),[L]),ie=e.kde===!0&&!L.binned,Se=(0,qe.useMemo)(()=>{if(!ie||!L.bins.length)return null;let h=s?Math.log10:ar,[O,I]=[h(E),h(j)],P=Array.from({length:Ti},(Y,V)=>O+(I-O)*V/(Ti-1)),J=(I-O)/L.bins.length;return{xs:P,curves:L.samples.map(Y=>ai(Y.values.map(h),P).map(V=>V*Y.n*J))}},[ie,L,s,E,j]),K=N.map(h=>h.name),re=$?g?L.fnGroup:[...pe(k,K,K,N.map(h=>h.n),"first")][0]??-1:-1,ue=D.map(h=>h.counts[0]),me=h=>i.range(a(h.x0),a(h.x1)),Je=$||c?new Set:g?L.fnBins:pe(k,D,D.map(me),ue,"max"),Ze=$&&re===0?1:0,dt=$?1-Ze:0,te=l==="dots"&&!$,je=l==="step",dn=s?Math.log10:ar,Qe=Math.max(0,...D.flatMap(h=>h.counts)),ur=Math.max(2,Math.round(o/70)),St=ze(0,Math.max(1,Qe,...Se?.curves.flat()??[]),ur),mr=Ue(St,[0,1]).ticks(ur).filter(h=>Number.isInteger(h)),dr=xt(void 0,t.locale,St[1]),fr=te?8:Qt(mr,dr,t.locale),et=fr+2,Ge=r-10,hr=Ue([dn(E),dn(j)],[et,Ge]),U=h=>hr(dn(h)),fn=h=>Number.isFinite(h)&&h>=E&&h<=j&&(!s||h>0),gr=N.reduce((h,O)=>h+O.outside,0),pr=N.reduce((h,O)=>h+O.excluded,0),At=[gr?i.outside(gr):"",pr?i.excluded(pr):""].filter(Boolean).join(" · "),Ki=Math.max(0,re),hn=t.pending||!C?[]:Il([...(w[Ki]?.marks??[]).filter(h=>fn(h.v)).map(h=>({key:h.id,at:U(h.v),text:`${h.id} ${a(h.v)}`,fill:n.paint($?"accentText":"ink"),stroke:n.paint($?"accent":"ink"),dash:Pl(h.id)})),...c&&fn(c.value)?[{key:"threshold",at:U(c.value),text:c.label?`${c.label} ${a(c.value)}`:a(c.value),fill:n.paint($?"ink":"accentText"),stroke:n.paint($?"ink":"accent")}]:[]],4,r-4),br=t.showLabels?Math.max(0,...hn.map(h=>h.row+1)):0,Xi=At||te?mn:0,Nt=h=>6+Xi+h*(un+3),de=Nt(br)+(br?4:0),X=o-22,Ui=C?Math.min(...D.map(h=>U(h.x1)-U(h.x0))):10,yr=Math.max(1.5,Math.min(6,Ui/2-1)),xr=Math.min(yr,2.5),Ae=te?ui(Qe,(X-de)/(xr*2+1.5)):1,gn=Math.max(xr,Math.min(yr,((X-de)/Math.max(1,Math.ceil(Qe/Ae))-1.5)/2)),Rt=gn*2+1.5,ft=te?h=>X-h/Ae*Rt:Ue(St,[X,de]),pn=e.stagger??Math.min(28,520/Math.max(1,C)),Yi=(0,qe.useMemo)(()=>{let h=[];if(!je)for(let I of D)h.push({key:`${te?"d":"b"}${I.i}`,to:[te?1:ft(I.counts[Ze])],from:[te?0:X],enter:[te?0:X],delay:I.i*pn,data:{k:Ze,i:I.i}});let O=$?je?[Ze,dt]:[dt]:je?[0]:[];for(let I of O)h.push({key:`s${I}`,to:D.map(P=>ft(P.counts[I])),from:D.map(()=>X),enter:D.map(()=>X),delay:I===dt?120:0,data:{k:I,i:-1}});return h},[L,r,o,de,Ae,te,je,$,Ze,dt,pn,St[1]]),kr=yi(Yi,t.motion),ht=h=>it(h,{locale:t.locale,maximumFractionDigits:1}),gt=(h,O)=>N[h].n?O/N[h].n*100:0,wr=N.map((h,O)=>{let I=0;return D.map(P=>I+=P.counts[O])}),qi=D.map(h=>{let O=N.map((I,P)=>{let J=i.row(h.counts[P],ht(gt(P,h.counts[P])));return $?`${I.name} ${J}`:`${J}, ${i.rowCum(ht(gt(P,wr[P][h.i])))}`});return{datum:null,index:h.i,key:`b${h.i}`,label:me(h),value:h.counts.reduce((I,P)=>I+P,0),formatted:O.join(", ")}}),_e=n.paint("accent"),vr=h=>Je.has(h.i)||c!==void 0&&sr(h,c,s)>=.5,$r=h=>h===re?_e:n.paint(h===Ze&&!je?"neutral":"neutralStrong"),Mr=null;if(t.active!==null&&D[t.active]){let h=D[t.active],O=Math.max(...h.counts),I=P=>{let J=i.inBin(h.counts[P],ht(gt(P,h.counts[P]))),Y={label:i.cum,value:ht(gt(P,wr[P][h.i])),strong:!1};return $?[{label:N[P].name,value:J,color:$r(P),strong:P===re},Y]:[{label:i.count,value:J,color:vr(h)?_e:n.paint(te||je?"neutralStrong":"neutral"),strong:!0},Y]};Mr={x:(U(h.x0)+U(h.x1))/2,y:te?X-Math.ceil(O/Ae)*Rt:ft(O),title:me(h),rows:N.flatMap((P,J)=>I(J))}}let Tr=h=>{let O=N[h],I=w[h],P=R[h],J=V=>L.binned?i.about(a(V)):a(V),Y=[i.samples(O.n),i.median(J(I.median)),...I.marks.filter(V=>V.id!=="p50").map(V=>`${V.id} ${J(V.v)}`)];return!$&&Qe&&Y.push(i.peak(me(D[ue.indexOf(Qe)]),Qe)),P&&c&&Y.push(i.past(P.est?i.about(`${P.n}`):`${P.n}`,f,a(c.value),c.label??"",ht(gt(h,P.n)))),Y},bn=[At,te?i.dot(Ae):""].filter(Boolean),Ji=L.groupCount>N.length?` ${i.hidden(N.length,L.groupCount)}.`:"",Zi=C?$?`${i.kind}, ${i.groups(N.length)}. ${N.map((h,O)=>`${h.name}: ${Tr(O).join(", ")}`).join("; ")}${bn.length?`. ${bn.join(", ")}`:""}.${Ji}`:`${i.kind}. ${[...Tr(0),...bn].join(", ")}.`:"",Qi=e.description??Zi,pt=c&&fn(c.value)?U(c.value):null,Ft=C?[U(D[0].x0),...D.map(h=>U(h.x1))]:[],Cr=(h,O)=>h>0&&X-O<1?X-1:O,ea=(h,O,I)=>{let P=U(h.x0)+.5,J=U(h.x1)-.5,Y=J-P;if(Y<=0||h.counts[I]<=0)return null;let V=Cr(h.counts[I],O),Ne=Math.min(2,Y/4),_t=n.paint("neutral"),tt=c&&!$?sr(h,c,s):0;if(tt<=0||tt>=1||pt===null)return(0,z.jsx)("path",{d:Jt(P,V,Y,X-V,{tl:Ne,tr:Ne}),fill:tt>=1||Je.has(h.i)?_e:_t});let yn=Math.max(P,Math.min(J,pt)),[sa,la]=f?[_t,_e]:[_e,_t];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("path",{d:Jt(P,V,yn-P,X-V,{tl:Ne}),fill:sa}),(0,z.jsx)("path",{d:Jt(yn,V,J-yn,X-V,{tr:Ne}),fill:la})]})},ta=(h,O)=>{let I=O.map((Y,V)=>Cr(D[V]?.counts[h]??0,Y)),P=$&&h===dt&&re>=0,J=$?[]:c?pt===null?[]:[f?[pt,1/0]:[-1/0,pt]]:Ol(Je,C).map(([Y,V])=>[Ft[Y],Ft[V+1]]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("path",{d:Si(Ft,I,X),fill:"none",stroke:P?_e:n.paint("neutralStrong"),strokeWidth:P?2:1.6,strokeLinejoin:"round"}),J.map(([Y,V],Ne)=>(0,z.jsx)("path",{d:Si(Ft,I,X,Y,V),fill:"none",stroke:_e,strokeWidth:2,strokeLinejoin:"round"},Ne))]})},na=(h,O)=>{let I=h.counts[0],P=Math.floor(I/Ae),J=I%Ae>0,Y=Math.round(O*(P+(J?1:0))),V=M((U(h.x0)+U(h.x1))/2),Ne=vr(h)?_e:n.paint("neutralStrong");return(0,z.jsxs)(z.Fragment,{children:[Array.from({length:Math.min(Y,P)},(_t,tt)=>(0,z.jsx)("circle",{cx:V,cy:M(X-Rt*(tt+.5)),r:M(gn),fill:Ne},tt)),J&&Y>P?(0,z.jsx)("circle",{cx:V,cy:M(X-Rt*(P+.5)),r:M(gn-.65),fill:"none",stroke:Ne,strokeWidth:1.3}):null]})},ra=C?s?Bl(E,j,(Ge-et)/Math.max(1e-9,Math.log10(j/E))):zl(E,j,Math.round((Ge-et)/70)):[],oa=xt(e.format,t.locale,Math.max(Math.abs(E),Math.abs(j))),ia=Do(ra.map(h=>({t:h,x:U(h),label:oa(h)})),0,r),Pe=t.active!==null?D[t.active]:void 0,aa=Pe&&(te||je||$),Sr=kr.fade(Math.min(700,C*pn)+200,320);return(0,z.jsxs)(uo,{c:t,kind:i.kind,ariaLabel:e.ariaLabel,description:Qi,events:qi,tip:Mr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[!te&&C?(0,z.jsx)(Po,{p:n,ticks:mr,y:ft,x0:fr,x1:r,fmt:dr,locale:t.locale}):null,aa?(0,z.jsx)("rect",{x:M(U(Pe.x0)),y:M(de),width:M(U(Pe.x1)-U(Pe.x0)),height:M(X-de),fill:n.paint("line"),opacity:.6,pointerEvents:"none"}):null,D.map(h=>(0,z.jsx)("rect",{x:M(U(h.x0)),y:M(de),width:M(Math.max(0,U(h.x1)-U(h.x0))),height:M(Math.max(0,X-de)),fill:"transparent",onPointerEnter:O=>t.setActive(h.i,O.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(h.i),style:{cursor:e.onClick?"pointer":void 0}},`h${h.i}`)),kr.items.map(h=>{let{k:O,i:I}=h.data,P=D[I];return(0,z.jsx)("g",{className:"ztd-mark",pointerEvents:"none",opacity:h.exiting?.4:I<0?1:t.dim(I),children:I<0?ta(O,h.v):P?te?na(P,h.v[0]):ea(P,h.v[0],O):null},h.key)}),Pe&&t.via==="keyboard"?(0,z.jsx)("rect",{x:M(U(Pe.x0)-1),y:M(de-2),width:M(U(Pe.x1)-U(Pe.x0)+2),height:M(X-de+4),rx:3,fill:"none",stroke:n.paint("ink"),strokeWidth:2,pointerEvents:"none"}):null,Se?.curves.map((h,O)=>(0,z.jsx)("path",{d:Co(h.map((I,P)=>[hr(Se.xs[P]),Math.max(de,ft(I))])),fill:"none",stroke:$?$r(O):n.paint("ink"),strokeWidth:1.6,opacity:Sr,pointerEvents:"none"},`k${O}`)),(0,z.jsxs)("g",{opacity:Sr,pointerEvents:"none","aria-hidden":"true",children:[hn.map(h=>(0,z.jsx)("line",{x1:M(h.at),x2:M(h.at),y1:t.showLabels?Nt(h.row)+un:de,y2:X,stroke:h.stroke,strokeWidth:h.key==="threshold"?1.5:1.4,strokeDasharray:h.dash},h.key)),t.showLabels?hn.map(h=>(0,z.jsxs)("g",{children:[(0,z.jsx)("rect",{x:M(h.x-h.w/2),y:Nt(h.row),width:M(h.w),height:un,rx:5,fill:n.paint("panel"),opacity:.92}),(0,z.jsx)(Ee,{x:h.x,y:Nt(h.row)+un/2,anchor:"middle",size:Ai,weight:700,fill:h.fill,children:h.text})]},h.key)):null]}),(0,z.jsxs)("g",{"aria-hidden":"true",children:[ia.map(h=>(0,z.jsx)(Ee,{x:h.x,y:X+11,anchor:"middle",size:Xe,fill:n.paint("muted"),children:h.label},h.t)),te&&C?(0,z.jsx)("line",{x1:et,x2:Ge,y1:M(X)+.5,y2:M(X)+.5,stroke:n.paint("dim"),shapeRendering:"crispEdges"}):null,At?(0,z.jsx)(Ee,{x:et,y:6+mn/2,size:10.5,fill:n.paint("muted"),children:Gn(At,Math.max(40,Ge-et-(te?110:0)),10.5)}):null,te?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("circle",{cx:M(Ge-$e(i.dot(Ae),10.5,600)-8),cy:6+mn/2,r:3.5,fill:n.paint("neutralStrong")}),(0,z.jsx)(Ee,{x:Ge,y:6+mn/2,anchor:"end",size:10.5,weight:600,fill:n.paint("muted"),children:i.dot(Ae)})]}):null,C?null:(0,z.jsx)(Ee,{x:r/2,y:o/2,anchor:"middle",size:12,fill:n.paint("muted"),children:t.t.empty})]})]})}var Hl=F(q(),1);var Pi=F(G(),1),jl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ce(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Gl={en:jl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ni=(e,t)=>Gl[e].other(t);function Ri(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,To(o.map(i=>i.value)))}}var Fi=e=>Number.isFinite(e)&&e>0?e:0;function _i(e,t,n,r){return r==="emphasis"?Xr(e,t,n):xe(e,t,n)}var Wl=F(q(),1);var Oi=F(G(),1);function Di(e,t){return t===!1?e.map((n,r)=>r):Mo(e)}function Li(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return pe(e,t,t,r,"max")}function Ei(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]=ne(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?ne(e,"neutral"):Ot(e,1-a/Math.max(1,o.length-1))),r}function Ii(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ve(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function zi(e,t){return yt(e,t+1,new Set)}var Vl=F(q(),1);var Hi=F(G(),1);var Kl=26;var zm=Kl*.62;function Bi(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Ko.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var Fe=F(G(),1);function ji(e,t,n){let r=Ut(e);return r?.type==="scatter"&&t?.size!==void 0&&!Xt(n)?Ut("bubble"):r}function Xl(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 Ul(e,t,n,r=!1){let o=ji(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&&zn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(f=>!l.has(f.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=ge(i.label,"label"),f=Re(i.value,"value"),p=o.type==="waffle",d=t.map((x,S)=>({r:x,label:u(x,S),value:p?f(x,S):Fi(f(x,S))})),{kept:g,other:k}=p?{kept:d,other:null}:Ri(d,a.other,(x,S)=>({r:{},label:Ni(Z(n),x),value:S})),y=pe(s,g.map(x=>x.r),g.map(x=>x.label),g.map(x=>x.value),p?"first":"max"),v=k?[...g,k]:g,T=Le(x=>p?xe(x,v.length,y):_i(x,v.length,y,a.colorMode)),A=p&&a.shape==="arc";return v.map((x,S)=>({label:x.label,color:T[S],...A&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Mi(Array.isArray(a.ma)?a.ma:void 0,t.length),f=$i[Z(n)];return[{label:f.up,color:a.upColor??"accent"},{label:f.down,color:a.downColor??"neutralStrong"},...u.map((p,d)=>({label:f.maLegend(p),color:or[d],shape:"line"}))]}if(o.type==="network"){let u=Ii(a.groups);if(u.length<2)return[];let f=Le(p=>zi(p,u.length));return u.map((p,d)=>({label:p,color:f[d],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ge(i.group,"group"),f=ve(t.map((d,g)=>u(d,g)).filter(Boolean));if(f.length<2)return[];let p=Le(d=>yt(d,f.length,new Set));return f.map((d,g)=>({label:d,color:p[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||Xt(a))return[];let u=ge(i.series,"series"),f=ve(t.map((g,k)=>u(g,k)));if(f.length<2)return[];let p=vi(s,t,f,u),d=Le(g=>yt(g,f.length,p));return c(f.map((g,k)=>({label:g,color:d[k],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",f=u?i.status:i.group;if(typeof f!="string")return[];let p=mi(t,f,u),d=Le(g=>xe(g,p.length,Bi(s,p)));return c(p.map((g,k)=>({label:g,color:d[k],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 T=ge(i.series,"series");u=ve(t.map((A,x)=>T(A,x)))}let f=Bn(o.type,i,a);if(f.length){let T=pe(s,u,u,u.map(()=>0),"none"),A=Le(S=>xe(S,u.length,T)),x=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((S,B)=>({label:S,color:A[B]}));return[...c(x),...f.map((S,B)=>({label:S,color:wi(B),shape:"line"}))]}if(u.length<2)return[];let d=o.type==="bar"&&a.layout==="diverging"&&s===void 0?$o(u.length,Array.isArray(a.negative)?a.negative.map(T=>u.indexOf(String(T))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,g=d>=0?new Set([d]):pe(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((T,A)=>({label:T,color:g.has(A)?"accent":"neutralStrong",shape:"square"})));let k=a.colorMode,y=T=>xe(T,u.length,g);if((o.type==="line"||o.type==="area")&&(y=T=>ki(T,u.length,g,o.type==="area",k)),o.type==="stream"){let T=vt(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),A=Di(T.values,a.reorder),x=Li(s,T.series,T.values);y=S=>Ei(S,A,x)}let v=Le(y);return c(u.map((T,A)=>({label:T,color:v[A],...o.type==="line"&&{shape:"line"}})))}return[]}function Yl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&po.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function ql(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function Gi(e,t){let{spec:n}=e,r=ji(n.type,n.encoding,n.options),o=(0,Ct.useMemo)(()=>di(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=go(n,e.locale),s=se(a),l=Z(s),c=Xo(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=xo(n),u=(0,Ct.useMemo)(()=>m?ei(m,s):void 0,[m,s]),f=n.options?.hidden,p=Array.isArray(f)?f.map(String):[],d=p.join(""),[g,k]=(0,Ct.useState)(null);if(!r)return(0,Fe.jsx)(In,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let y=o??c.data,v=t[r.type],T={...n.options??{}},A={...Xl(r,n.encoding),...T,...u?{tooltip:u}:{},data:y,...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"&&yo(r.type,n.encoding??{},T),S=g&&g.base===d?g.hidden:p;x&&(A.hidden=S);let B=C=>k($=>{let w=$&&$.base===d?$.hidden:p;return{base:d,hidden:w.includes(C)?w.filter(R=>R!==C):[...w,C]}}),H=A.height??220,L=Yl(n,r.type),D=i&&!y.length&&(c.loading||c.error||c.empty)?(0,Fe.jsx)(In,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:H,locale:a}):L?(0,Fe.jsx)(Vo,{chart:v,...ql(r.type,L,A)}):(0,Fe.jsx)(v,{...A});if(n.card){let C=n.card,$=C.legend==="auto"||C.legend==="toggle"?Ul(n,y,s,x):C.legend,w=$?.length?x?(0,Fe.jsx)(On,{items:$,hidden:S,onToggle:B,locale:a}):$:void 0,R=C.download?(0,Fe.jsx)(Qo,{data:y,columns:ko(n),filename:C.title??r.type,formats:Array.isArray(C.download)?C.download:void 0,locale:a}):void 0;D=(0,Fe.jsx)(co,{number:C.number,title:C.title??ho(r,l),subtitle:C.subtitle,legend:w,actions:R,source:C.source||void 0,note:C.note||void 0,accent:C.accent,takeaway:C.takeaway,level:C.level,sample:C.sample,replay:C.replay!==!1,className:e.className,locale:a,children:D})}let N=e.theme??n.theme;return N&&(D=(0,Fe.jsx)(jt,{theme:N,children:D})),D}function Jl({cfg:e,components:t}){let n=ct();return Gi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Vi(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Wi.hydrateRoot)(r,(0,cr.createElement)(jt,{theme:o.theme,cssVars:!0},(0,cr.createElement)(Jl,{cfg:o,components:{[e]:t}})))}Vi("histogram",lr);})();