ztd-charts-cli 0.11.0 → 0.11.2

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.
package/dist/api.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  summarize,
21
21
  svgToPng,
22
22
  validate
23
- } from "./chunk-ZZGASY2Y.js";
23
+ } from "./chunk-6RWRYJ22.js";
24
24
  export {
25
25
  CHARTS,
26
26
  FETCH_TIMEOUT_MS,
@@ -9,7 +9,7 @@ import { langOf, mapExportName, renderSpecToHTML, renderSpecToSVG, resolveDef, r
9
9
 
10
10
  // src/messages.ts
11
11
  import { plural } from "ztd-charts/server";
12
- var VERSION = "0.11.0";
12
+ var VERSION = "0.11.2";
13
13
  var SCHEMA_URL = "https://unpkg.com/ztd-charts/schema/chart-spec.schema.json";
14
14
  var en = {
15
15
  help: `ztd-charts ${VERSION} CLI for 44 React chart types
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  resolveType,
14
14
  suggest,
15
15
  validate
16
- } from "./chunk-ZZGASY2Y.js";
16
+ } from "./chunk-6RWRYJ22.js";
17
17
 
18
18
  // src/cli.ts
19
19
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -1,7 +1,7 @@
1
- (()=>{var Aa=Object.create;var mr=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Fa=Object.getPrototypeOf,Pa=Object.prototype.hasOwnProperty;var cn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var _a=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ra(t))!Pa.call(e,o)&&o!==n&&mr(e,o,{get:()=>t[o],enumerable:!(r=Na(t,o))||r.enumerable});return e};var A=(e,t,n)=>(n=e!=null?Aa(Fa(e)):{},_a(t||!e||!e.__esModule?mr(n,"default",{value:e,enumerable:!0}):n,e));var Z=cn((il,dr)=>{dr.exports=globalThis.__ztdReact.react});var hr=cn((sl,fr)=>{fr.exports=globalThis.__ztdReact["react-dom/client"]});var G=cn((wl,jr)=>{jr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Zn=A(Z(),1),fa=A(hr(),1);var yt=A(Z(),1);var It=A(Z(),1);var gr=A(Z(),1),qe=(0,gr.createContext)(void 0);var xr=A(Z(),1);var Da=["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',br='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Oe={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:br,radius:18,radiusCode:14,radiusMark:4},un={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:pr,monoFamily:br,radius:18,radiusCode:14,radiusMark:4},mn={dark:Oe,light:un};function Tt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function dn(e){let t={};for(let n of Da){let r=e[n];typeof r=="string"&&(t[Tt(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 fn(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 La=`
1
+ (()=>{var Na=Object.create;var mr=Object.defineProperty;var Ra=Object.getOwnPropertyDescriptor;var Fa=Object.getOwnPropertyNames;var Pa=Object.getPrototypeOf,_a=Object.prototype.hasOwnProperty;var un=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Da=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Fa(t))!_a.call(e,o)&&o!==n&&mr(e,o,{get:()=>t[o],enumerable:!(r=Ra(t,o))||r.enumerable});return e};var A=(e,t,n)=>(n=e!=null?Na(Pa(e)):{},Da(t||!e||!e.__esModule?mr(n,"default",{value:e,enumerable:!0}):n,e));var Z=un((ll,dr)=>{dr.exports=globalThis.__ztdReact.react});var hr=un((cl,fr)=>{fr.exports=globalThis.__ztdReact["react-dom/client"]});var G=un(($l,jr)=>{jr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Zn=A(Z(),1),fa=A(hr(),1);var kt=A(Z(),1);var It=A(Z(),1);var gr=A(Z(),1),Qe=(0,gr.createContext)(void 0);var xr=A(Z(),1);var La=["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',br='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',ze={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:br,radius:18,radiusCode:14,radiusMark:4},mn={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:br,radius:18,radiusCode:14,radiusMark:4},dn={dark:ze,light:mn};function Ct(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function fn(e){let t={};for(let n of La){let r=e[n];typeof r=="string"&&(t[Ct(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 hn(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 Ea=`
2
2
  .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
3
  .ztd-root:focus{outline:none}
4
- .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Oe.accent});outline-offset:3px;border-radius:6px}
4
+ .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${ze.accent});outline-offset:3px;border-radius:6px}
5
5
  .ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
6
6
  .ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
7
7
  .ztd-tip{animation:ztd-fade .14s ease-out;transition:left .2s cubic-bezier(.22,1,.36,1),top .2s cubic-bezier(.22,1,.36,1)}
@@ -9,9 +9,9 @@
9
9
  .ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
10
10
  .ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
11
11
  .ztd-btn:focus{outline:none}
12
- .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Oe.accent});outline-offset:2px}
12
+ .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${ze.accent});outline-offset:2px}
13
13
  .ztd-card{transition:border-color .16s ease}
14
- .ztd-card:hover{border-color:var(--ztd-dim,${Oe.dim})}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${ze.dim})}
15
15
  @media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
16
16
  @keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
17
17
  @keyframes ztd-fade{from{opacity:0}to{opacity:1}}
@@ -19,10 +19,10 @@
19
19
  @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
20
  .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
21
  @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
- `;function kr(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 wr(e,t){let[n]=(0,xr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var yr=!1;function ut(){if(yr||typeof document>"u"||(yr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=La,document.head.appendChild(e)}var Ct=A(Z(),1),ye=typeof window<"u"&&typeof document<"u",Ae=ye?Ct.useLayoutEffect:Ct.useEffect;function St(){return typeof performance<"u"?performance.now():Date.now()}function te(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function xe(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var vr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},$r={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var Ea=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Ia={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Oa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function za(e){return Oa(Ea,e)}function Mr(e,t){let n=za(e);return{text:n?n[t]:e,...Ia[n?.id??"basic"]}}var Tr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ze(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Tr[t.toLowerCase()]&&(t=Tr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Ar(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 gn(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 Qe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Cr(e){return .2126*Qe(e[0])+.7152*Qe(e[1])+.0722*Qe(e[2])}function pn(e,t,n){let r=typeof e=="string"?Ze(e):e,o=typeof t=="string"?Ze(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ze(n):n:null;o[3]<1&&a&&(o=gn(o,a));let i=r[3]<1?gn(r,o):r,s=Cr(i),c=Cr(o);return(Math.max(s,c)+.05)/(Math.min(s,c)+.05)}function Ba(e){return[Qe(e[0]),Qe(e[1]),Qe(e[2])]}function hn(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 Sr(e){let[t,n,r]=Ba(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Ha([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[hn(4.0767416621*o-3.3077115913*a+.2309699292*i),hn(-1.2684380046*o+2.6097574011*a-.3413193965*i),hn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function At(e,t,n){let r=Ze(e),o=Ze(t);if(!r||!o)return e;let a=Sr(r),i=Sr(o),s=Math.max(0,Math.min(1,n));return Ar(Ha([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function bn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=pn(a,e,n);i>o&&(o=i,r=a)}return r}function ae(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 ja(e,t){let n=bn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return pn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):bn(t,["#FFFFFF","#000000"])}function Nt(e,t){let n=At(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:ja(e,n),raw:n}}function ke(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ae(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=ae(e,"neutral");else if(s===0)r[i]=ae(e,"ink");else if(s===a-1)r[i]=ae(e,"neutral");else if(a===3)r[i]=ae(e,"strong");else{let c=(s-1)/Math.max(1,a-2);r[i]=c<=.001?ae(e,"strong"):Nt(e,1-c)}}),r}var yn="mix:";function ze(e){return e({theme:un,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${yn}${o}`}).map(n=>n.fill)}function Nr(e,t){return t?.startsWith(yn)?e.mix("neutralStrong","neutral",Number(t.slice(yn.length))):e.color(t)}function mt(e,t,n){return ke(e,t+1,n).slice(0,t)}function Rt(e,t,n,r="neutral"){let o=ae(e,"accent"),a=ae(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Rr(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ae(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=ae(e,"neutral"):s===0?r[i]=ae(e,"strong"):s===a-1?r[i]=ae(e,"neutral"):r[i]=Nt(e,1-s/(a-1))}),r}var we=A(Z(),1);var et=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),me="en-US",Fr=new Map;function xn(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=Fr.get(r);return o||(o=new Intl.NumberFormat(e,n),Fr.set(r,o)),o}function kn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function tt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=me,...r}=t;return kn(xn(n,r).format(e))}var wn=e=>e!==0&&Math.abs(e)<.05,vn=(e,t,n="")=>`${tt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ft(e,t={}){if(!Number.isFinite(e))return"-";if(wn(e)&&t.maximumFractionDigits===void 0)return vn(e,t.locale??me,"%");let n=Math.abs(e);return`${tt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Lr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=me,...r}=t;if(te(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,c]=a[i],l=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||l<100?1:0)),u=Math.round(l*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+tt(u,{locale:n,...r,maximumFractionDigits:m})+c}}return kn(xn(n,{notation:"compact",...r}).format(e))}var Ga=(e,t=te(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function _e(e,t=me,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=xn(t,o);return c=>Number.isFinite(c)?`${i}${kn(s.format(c))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Ft(o,{locale:t});case"ratio":return o=>Ft(o*100,{locale:t});case"compact":return o=>Lr(o,{locale:t});case"currency":return r(Ga(t));default:{let o=r({maximumFractionDigits:1});return a=>wn(a)?vn(a,t):o(a)}}}function Er(e,t=me,n=0){return e!==void 0?_e(e,t):n>=1e5?r=>wn(r)?vn(r,t):Lr(r,{locale:t}):r=>tt(r,{locale:t})}function Va(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var $n=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Wa=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Ka=["january","february","march","april","may","june","july","august","september","october","november","december"],Pr=e=>{let t=e.toLowerCase();return t.length<3?0:Ka.findIndex(n=>n.startsWith(t))+1},_r=e=>+e+(+e<30?2e3:1900);function Ir(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Ua=[/^(\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})일)?$/],Or=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,zr=/\{([^{}]+)\}/g;function Pt(e,t){let n;for(let r of Ua)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?[_r(n[3]),+n[2],+n[1],1]:[_r(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=Or.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Pr(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=Pr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Br=e=>Wa.test(e)||Pt(e)!==null;function Hr(e){let t;for(let n of e){let r=typeof n=="string"?Or.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function _t(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if($n(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return _t(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Pt(n,t);if(r)return Va(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 Dr=new Map;function dt(e,t={month:"short",day:"numeric"}){let n=_t(e);if(!n)return"-";let{locale:r=me,...o}=t,a=r+JSON.stringify(o),i=Dr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Dr.set(a,i)),i.format(n)}var Mn=A(G(),1),Dt=(0,we.createContext)({theme:Oe,cssVars:!0});function Xa(e,t=Oe){return e?typeof e=="string"?mn[e]??t:fn(t,e):t}function Lt(e){let t=(0,we.useContext)(Dt),n=e.base?mn[e.base]:t.theme,r=(0,we.useMemo)(()=>Xa(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,we.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,we.useMemo)(()=>dn(r),[r]),c=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Mn.jsx)(Dt.Provider,{value:i,children:(0,Mn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:c,children:e.children})})}var Ya=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Gr(e){return Ya.has(e)}function Ja(e,t){let n=r=>t?`var(${Tt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Gr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Gr(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:At(e[r],e[o],a)}}}function ve(e){let t=(0,we.useContext)(Dt);return(0,we.useMemo)(()=>{let n=fn(t.theme,e);return Ja(n,t.cssVars)},[t.theme,t.cssVars,e])}function le(e){let t=(0,we.useContext)(Dt);return e??t.locale??me}function Vr(e){return e?dn(e):{}}var Et=A(Z(),1),Tn=(0,Et.createContext)(void 0);function Wr(e){let t=(0,Et.useContext)(Tn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=A(G(),1),qa={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`},Za={en:qa,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Qa={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Cn=e=>Za[te(le(e))];function Sn(e){let t=ve(e.theme),n=Cn(e.locale),[r,o]=(0,It.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),c=e.items.filter(m=>!s.has(m.label)).length,l=(0,N.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),h=d&&c===1,f=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ei,{p:t,item:m,off:!d}),(0,N.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":h||void 0,onClick:()=>{h||(i(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:h?"default":void 0},children:f}):f},u)})});return i?(0,N.jsxs)(N.Fragment,{children:[l,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Qa,children:r?n.shown(c,e.items.length):""})]}):l}function ei({p:e,item:t,off:n}){let r=Nr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function ti(e){let t=ve(e.theme),n=Mr(e.level,te(le(e.locale)));return(0,N.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function ni(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Kr(e){let t=ve(e.theme),n=Cn(e.locale),[r,o]=(0,It.useState)(0);Ae(()=>ut(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(Sn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",c=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,l=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,N.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,N.jsx)(ti,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[c?(0,N.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:c}):null,(0,N.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:ni(e.title,e.accent,t.paint("accentText"))}),e.actions,l?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,N.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(Tn.Provider,{value:r,children:(0,N.jsx)(qe.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,N.jsxs)(N.Fragment,{children:[m,u]}):u]})}function An(e){let t=ve(e.theme),n=Cn(e.locale),r=e.height??220;if(Ae(()=>ut(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,N.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,N.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}var at=A(Z(),1);var de=A(Z(),1);var J=A(G(),1),Ot=60;var zt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Ur(e){let{c:t,events:n}=e,r=(0,de.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,Ae(()=>{ut()},[]);let i=n.length,s=!e.noNav&&i>0,c=(0,de.useContext)(qe),l=e.ariaLabel??c??e.kind,m=(0,de.useMemo)(()=>s?`${n.length}${n.slice(0,Ot).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,de.useMemo)(()=>(0,J.jsx)(ri,{label:l,events:n,t:t.t}),[l,m,t.t]),d=(0,de.useRef)(null);(0,de.useEffect)(()=>{let x=()=>{d.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,de.useEffect)(()=>{d.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let M=t.active,D;switch(x.key){case"ArrowRight":case"ArrowDown":D=M===null?0:(M+1)%i;break;case"ArrowLeft":case"ArrowUp":D=M===null?i-1:(M-1+i)%i;break;case"Home":D=0;break;case"End":D=i-1;break;case"Escape":if(M===null)return;D=null;break;case"Enter":case" ":M!==null&&(x.preventDefault(),t.click(M));return;default:return}x.preventDefault(),t.setActive(D,"keyboard")},{via:f,node:b,setActive:T}=t;(0,de.useEffect)(()=>{if(f!=="touch"||!b)return;let x=M=>{b.contains(M.target)||T(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,b,T]);let w=t.active!==null?n[t.active]:null,k=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,$=k&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,P=typeof e.renderTip=="function"&&w?e.renderTip(w):null,y=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${i})`:""),S;if(k){let x=k.x*$,M=t.width*$,D=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(M-x-4).toFixed(1)}px - 100%))`,U=k.y<64;S={position:"absolute",left:x,top:k.y*$,transform:`translate(${D}, ${U?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*$-8)}}let H=x=>{d.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},I=x=>x?M=>{let D=d.current??(d.current=M.currentTarget.getBoundingClientRect());D.width&&x((M.clientX-D.left)/D.width*t.width,(M.clientY-D.top)/D.height*t.height,M)}:void 0,K=I(e.onPointerMove),V=I(e.onPointerDown),_=K||V?x=>{x.pointerType==="touch"&&K?.(x),V?.(x)}:void 0,F=I(e.onPointerUp),v=Vr(e.theme);return(0,J.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":l,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:H,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,J.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:K,onPointerDown:_,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,J.jsx)("title",{id:o,children:l}),(0,J.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,J.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,k?(0,J.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:S,children:P??(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:k.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:k.title}),k.rows.map((x,M)=>(0,J.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,J.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,J.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,J.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},M))]})}):null,(0,J.jsx)("span",{className:"ztd-sr",style:zt,"aria-live":"polite","aria-atomic":"true",children:y}),s&&!t.pending?u:null]})}function ri({label:e,events:t,t:n}){return(0,J.jsx)("div",{className:"ztd-sr",style:zt,children:(0,J.jsxs)("table",{children:[(0,J.jsx)("caption",{children:n.table(e)}),(0,J.jsxs)("tbody",{children:[t.slice(0,Ot).map((r,o)=>(0,J.jsxs)("tr",{children:[(0,J.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,J.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Ot?(0,J.jsx)("tr",{children:(0,J.jsx)("td",{colSpan:2,children:n.more(t.length-Ot)})}):null]})]})})}function ft(e){let t=e.baseline??"central";return(0,J.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var g=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),pe=g("label","string",!0,"Item name field"),ie=g("value","number",!0,"Value field"),oi=[pe,ie],ai=[pe,ie],ii=[g("label","string",!0,"Stage name"),g("value","number",!0,"Users at the stage")],si=[pe,ie],li=[g("label","string",!0,"Leaf (lowest level) name"),ie,g("group","string",!1,"Parent group field")],ci=[g("label","string",!0,"Leaf name"),ie,g("group","string",!1,"Parent group field")],ui=[pe,g("value","number",!0,"Change (total rows may omit it)"),g("type","string",!1,'"total" makes a total bar')],mi=[pe,ie],di=[g("x","string",!0,"Column field"),g("series","string",!0,"Stacked series field"),ie],fi=[g("x","string",!0,"Column field"),g("y","string",!0,"Row field"),ie],hi=[g("axis","string",!0,"Metric (axis) field"),g("value","number",!0,"Value field",{multi:!0}),g("series","string",!1,"Series field")],gi=[g("x","number",!0,"x value"),g("y","number",!0,"y value"),g("size","number",!1,"Circle size"),g("label","string",!1,"Name")],Yr=g("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),pi=[g("x","any",!0,"x field (date, number or category)"),g("y","number",!0,"y field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field (long tables)"),g("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Yr],bi=[g("x","any",!0,"x field"),g("y","number",!0,"y field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field"),g("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}),Yr],yi=[g("x","any",!0,"x field"),g("y","number",!0,"y field",{multi:!0}),g("series","string",!1,"Series field")],xi=[g("x","string",!0,"Category field"),g("y","number",!0,"Value field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field"),g("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})],ki=[pe,ie],wi=[g("value","number",!0,"Value field",{prop:"valueKey"}),g("target","number",!1,"Target field",{prop:"targetKey"})],vi=[pe,g("value","number",!0,"Actual value field"),g("target","number",!1,"Target field")],$i=[g("x","any",!1,"x field"),g("y","number",!0,"y field")],Mi=[pe,g("x","string",!1,"Period field (long tables)"),g("value","number",!1,"Value field (long tables)")],Ti=[pe,g("start","number",!0,"Before value"),g("end","number",!0,"After value")],Ci=[pe,ie],Si=[g("value","number",!0,"Value field"),g("group","string",!1,"Group (row) field"),g("label","string",!1,"Dot name")],Ai=[g("group","string",!0,"Group field"),g("value","number",!0,"Value field")],Ni=[g("source","string",!0,"Source node"),g("target","string",!0,"Target node"),ie],Ri=[g("source","string",!0,"Sending group"),g("target","string",!0,"Receiving group"),ie],Fi=[g("date","date",!0,"Date field"),ie],Pi=[g("x","any",!0,"Period field"),g("series","string",!0,"Item field"),g("rank","number",!1,"Rank field (1 is first)"),g("value","number",!1,"Value field (instead of rank, largest is first)")],_i=[g("group","string",!0,"Group field"),g("value","number",!0,"Value field")],Di=[g("label","string",!1,"Row name field")],Li=[g("x","date",!0,"Date (period) field"),g("open","number",!0,"Open price field"),g("high","number",!0,"High price field"),g("low","number",!0,"Low price field"),g("close","number",!0,"Close price field"),g("volume","number",!1,"Volume field")],Ei=[pe,ie],Ii=[g("x","any",!0,"Period field (date or category)"),g("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field (long tables, back row only)"),g("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Oi=[g("value","number",!1,"Sample value field (raw rows)"),g("group","string",!1,"Group field. Up to 2 groups overlap"),g("x0","number",!1,"Bin start (pre-binned rows)"),g("x1","number",!1,"Bin end (pre-binned rows)"),g("count","number",!1,"Samples in the bin (pre-binned rows)")],zi=[g("region","string",!0,"Region name or code, matched to a tile of options.map"),ie],Bi=[pe,ie,g("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")],Hi=[g("source","string",!0,"Source node"),g("target","string",!0,"Target node"),g("value","number",!1,"Link weight. Without it every row counts 1")],ji=[g("label","string",!0,"Row name. Items with the same name share a row"),g("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),g("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),g("group","string",!1,"Group field (one color per group, and the legend)"),g("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")],Gi=[g("label","string",!0,"Node name field"),g("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),g("group","string",!1,"Parent group field (flat rows, as in the treemap)"),g("id","string",!1,"Row id for id/parent rows. Defaults to the label"),g("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Vi=[g("region","string",!0,"Region name or code, matched to a region of options.map"),ie],Wi=[g("lon","number",!1,"Longitude (degrees)"),g("lat","number",!1,"Latitude (degrees)"),g("size","number",!1,"Value (circle area). Without it all circles match"),g("label","string",!1,"Place name"),g("region","string",!1,"Region of options.map, for rows without lon and lat"),g("group","string",!1,"Group field (one color per group)")],Ki=[g("source","string",!0,"Start: a name in options.places or a region"),g("target","string",!0,"End"),g("value","number",!1,"Amount. Without it each row counts 1")],Ui=[g("x","number",!0,"x value"),g("y","number",!0,"y value"),g("series","string",!1,"Series field (one color per series)"),g("label","string",!1,"Name")],Xr={pie:oi,donut:ai,funnel:ii,waffle:si,treemap:li,sunburst:ci,waterfall:ui,pareto:mi,marimekko:di,heatmap:fi,radar:hi,bubble:gi,line:pi,area:bi,stream:yi,bar:xi,radialBar:ki,gauge:wi,bullet:vi,sparkline:$i,slope:Mi,dumbbell:Ti,lollipop:Ci,beeswarm:Si,ridgeline:Ai,sankey:Ni,chord:Ri,calendar:Fi,bump:Pi,box:_i,parallel:Di,candlestick:Li,segmented:Ei,skyline:Ii,histogram:Oi,scatter:Ui,tileMap:zi,barRace:Bi,network:Hi,timeline:ji,tree:Gi,choropleth:Vi,symbolMap:Wi,flowMap:Ki},nt={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 Jr(e,t){return t==="ko"?e.nameKo:e.name}function qr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Zr=["line","area","bar","scatter"],Qr=24,Nn=["line","area","bar","scatter","timeline"];function Rn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function eo(e,t,n){return Nn.includes(e)&&!Rn(e,t,n).length&&!(e==="scatter"&&Bt(n))}function Bt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function to(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Xi={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",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 Ht(e){let t=Xr[e]?e:Xi[e]??Object.keys(nt).find(n=>n.toLowerCase()===e.toLowerCase()||nt[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!nt[t]))return{type:t,component:nt[t].component,name:nt[t].name,nameKo:nt[t].nameKo,encoding:Xr[t]}}function no(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of Ht(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function ro(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Yi(e,t){if(e==null||typeof e!="object")return;let n=e;if(ro(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!ro(r,o))return;r=r[o]}return r}}function Ne(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 We(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Yi(r,n)}function jt(e,t){let n=We(e,t);return(r,o)=>Ne(n(r,o))}function De(e,t){let n=We(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function $e(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ji(e){let t=[],n=!1;for(let c=0;c<e.length&&c<4e3;c++){let l=e[c];if(l==='"')n=!n;else if(!n&&(l===`
23
- `||l==="\r"))break;t.push(n?"":l)}let r=t.join(""),o=c=>r.split(c).length-1,a=[","," ",";","|"],i=",",s=0;for(let c of a){let l=o(c);l>s&&(s=l,i=c)}return i}var qi=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function oo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(qi.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Ne(t);if(Number.isFinite(n))return n}return t}function Ke(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Ji(o),i=[],s=[],c="",l=!1;for(let f=0;f<o.length;f++){let b=o[f];l?b==='"'?o[f+1]==='"'?(c+='"',f++):l=!1:c+=b:b==='"'&&!c.trim()?(l=!0,c=""):b===a?(s.push(c),c=""):b===`
22
+ `;function kr(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 wr(e,t){let[n]=(0,xr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var yr=!1;function mt(){if(yr||typeof document>"u"||(yr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Ea,document.head.appendChild(e)}var St=A(Z(),1),ye=typeof window<"u"&&typeof document<"u",Ae=ye?St.useLayoutEffect:St.useEffect;function At(){return typeof performance<"u"?performance.now():Date.now()}function te(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function xe(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var vr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},$r={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var Oa=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Ia={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function za(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Ba(e){return za(Oa,e)}function Mr(e,t){let n=Ba(e);return{text:n?n[t]:e,...Ia[n?.id??"basic"]}}var Tr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function _e(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Tr[t.toLowerCase()]&&(t=Tr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Ar(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 pn(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 et(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Cr(e){return .2126*et(e[0])+.7152*et(e[1])+.0722*et(e[2])}function dt(e,t,n){let r=typeof e=="string"?_e(e):e,o=typeof t=="string"?_e(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?_e(n):n:null;o[3]<1&&a&&(o=pn(o,a));let i=r[3]<1?pn(r,o):r,s=Cr(i),c=Cr(o);return(Math.max(s,c)+.05)/(Math.min(s,c)+.05)}function Ha(e){return[et(e[0]),et(e[1]),et(e[2])]}function gn(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 Sr(e){let[t,n,r]=Ha(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function ja([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[gn(4.0767416621*o-3.3077115913*a+.2309699292*i),gn(-1.2684380046*o+2.6097574011*a-.3413193965*i),gn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Nt(e,t,n){let r=_e(e),o=_e(t);if(!r||!o)return e;let a=Sr(r),i=Sr(o),s=Math.max(0,Math.min(1,n));return Ar(ja([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function bn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=dt(a,e,n);i>o&&(o=i,r=a)}return r}function ae(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 Ga(e,t){let n=bn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return dt(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):bn(t,["#FFFFFF","#000000"])}function Rt(e,t){let n=Nt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Ga(e,n),raw:n}}function ke(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ae(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=ae(e,"neutral");else if(s===0)r[i]=ae(e,"ink");else if(s===a-1)r[i]=ae(e,"neutral");else if(a===3)r[i]=ae(e,"strong");else{let c=(s-1)/Math.max(1,a-2);r[i]=c<=.001?ae(e,"strong"):Rt(e,1-c)}}),r}var yn="mix:";function Be(e){return e({theme:mn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${yn}${o}`}).map(n=>n.fill)}function Nr(e,t){return t?.startsWith(yn)?e.mix("neutralStrong","neutral",Number(t.slice(yn.length))):e.color(t)}function ft(e,t,n){return ke(e,t+1,n).slice(0,t)}function Ft(e,t,n,r="neutral"){let o=ae(e,"accent"),a=ae(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Rr(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ae(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=ae(e,"neutral"):s===0?r[i]=ae(e,"strong"):s===a-1?r[i]=ae(e,"neutral"):r[i]=Rt(e,1-s/(a-1))}),r}var we=A(Z(),1);var tt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),me="en-US",Fr=new Map;function xn(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=Fr.get(r);return o||(o=new Intl.NumberFormat(e,n),Fr.set(r,o)),o}function kn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function nt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=me,...r}=t;return kn(xn(n,r).format(e))}var wn=e=>e!==0&&Math.abs(e)<.05,vn=(e,t,n="")=>`${nt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Pt(e,t={}){if(!Number.isFinite(e))return"-";if(wn(e)&&t.maximumFractionDigits===void 0)return vn(e,t.locale??me,"%");let n=Math.abs(e);return`${nt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Lr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=me,...r}=t;if(te(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,c]=a[i],l=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||l<100?1:0)),u=Math.round(l*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+nt(u,{locale:n,...r,maximumFractionDigits:m})+c}}return kn(xn(n,{notation:"compact",...r}).format(e))}var Va=(e,t=te(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function De(e,t=me,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=xn(t,o);return c=>Number.isFinite(c)?`${i}${kn(s.format(c))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Pt(o,{locale:t});case"ratio":return o=>Pt(o*100,{locale:t});case"compact":return o=>Lr(o,{locale:t});case"currency":return r(Va(t));default:{let o=r({maximumFractionDigits:1});return a=>wn(a)?vn(a,t):o(a)}}}function Er(e,t=me,n=0){return e!==void 0?De(e,t):n>=1e5?r=>wn(r)?vn(r,t):Lr(r,{locale:t}):r=>nt(r,{locale:t})}function Wa(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var $n=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Ka=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Ua=["january","february","march","april","may","june","july","august","september","october","november","december"],Pr=e=>{let t=e.toLowerCase();return t.length<3?0:Ua.findIndex(n=>n.startsWith(t))+1},_r=e=>+e+(+e<30?2e3:1900);function Or(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Xa=[/^(\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})일)?$/],Ir=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,zr=/\{([^{}]+)\}/g;function _t(e,t){let n;for(let r of Xa)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?[_r(n[3]),+n[2],+n[1],1]:[_r(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=Ir.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Pr(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=Pr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Br=e=>Ka.test(e)||_t(e)!==null;function Hr(e){let t;for(let n of e){let r=typeof n=="string"?Ir.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Dt(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($n(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Dt(`${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=_t(n,t);if(r)return Wa(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 Dr=new Map;function ht(e,t={month:"short",day:"numeric"}){let n=Dt(e);if(!n)return"-";let{locale:r=me,...o}=t,a=r+JSON.stringify(o),i=Dr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Dr.set(a,i)),i.format(n)}var Mn=A(G(),1),Lt=(0,we.createContext)({theme:ze,cssVars:!0});function Ya(e,t=ze){return e?typeof e=="string"?dn[e]??t:hn(t,e):t}function Et(e){let t=(0,we.useContext)(Lt),n=e.base?dn[e.base]:t.theme,r=(0,we.useMemo)(()=>Ya(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,we.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,we.useMemo)(()=>fn(r),[r]),c=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Mn.jsx)(Lt.Provider,{value:i,children:(0,Mn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:c,children:e.children})})}var Ja=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Gr(e){return Ja.has(e)}function qa(e,t){let n=r=>t?`var(${Ct(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Gr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Gr(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Nt(e[r],e[o],a)}}}function ve(e){let t=(0,we.useContext)(Lt);return(0,we.useMemo)(()=>{let n=hn(t.theme,e);return qa(n,t.cssVars)},[t.theme,t.cssVars,e])}function le(e){let t=(0,we.useContext)(Lt);return e??t.locale??me}function Vr(e){return e?fn(e):{}}var Ot=A(Z(),1),Tn=(0,Ot.createContext)(void 0);function Wr(e){let t=(0,Ot.useContext)(Tn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=A(G(),1),Za={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`},Qa={en:Za,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var ei={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Cn=e=>Qa[te(le(e))];function Sn(e){let t=ve(e.theme),n=Cn(e.locale),[r,o]=(0,It.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),c=e.items.filter(m=>!s.has(m.label)).length,l=(0,N.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),h=d&&c===1,f=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ti,{p:t,item:m,off:!d}),(0,N.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":h||void 0,onClick:()=>{h||(i(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:h?"default":void 0},children:f}):f},u)})});return i?(0,N.jsxs)(N.Fragment,{children:[l,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:ei,children:r?n.shown(c,e.items.length):""})]}):l}function ti({p:e,item:t,off:n}){let r=Nr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function ni(e){let t=ve(e.theme),n=Mr(e.level,te(le(e.locale)));return(0,N.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function ri(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Kr(e){let t=ve(e.theme),n=Cn(e.locale),[r,o]=(0,It.useState)(0);Ae(()=>mt(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(Sn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",c=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,l=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,N.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,N.jsx)(ni,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[c?(0,N.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:c}):null,(0,N.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:ri(e.title,e.accent,t.paint("accentText"))}),e.actions,l?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,N.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(Tn.Provider,{value:r,children:(0,N.jsx)(Qe.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,N.jsxs)(N.Fragment,{children:[m,u]}):u]})}function An(e){let t=ve(e.theme),n=Cn(e.locale),r=e.height??220;if(Ae(()=>mt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,N.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,N.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}var it=A(Z(),1);var de=A(Z(),1);var J=A(G(),1),zt=60;var Bt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Ur(e){let{c:t,events:n}=e,r=(0,de.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,Ae(()=>{mt()},[]);let i=n.length,s=!e.noNav&&i>0,c=(0,de.useContext)(Qe),l=e.ariaLabel??c??e.kind,m=(0,de.useMemo)(()=>s?`${n.length}${n.slice(0,zt).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,de.useMemo)(()=>(0,J.jsx)(oi,{label:l,events:n,t:t.t}),[l,m,t.t]),d=(0,de.useRef)(null);(0,de.useEffect)(()=>{let x=()=>{d.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,de.useEffect)(()=>{d.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let M=t.active,D;switch(x.key){case"ArrowRight":case"ArrowDown":D=M===null?0:(M+1)%i;break;case"ArrowLeft":case"ArrowUp":D=M===null?i-1:(M-1+i)%i;break;case"Home":D=0;break;case"End":D=i-1;break;case"Escape":if(M===null)return;D=null;break;case"Enter":case" ":M!==null&&(x.preventDefault(),t.click(M));return;default:return}x.preventDefault(),t.setActive(D,"keyboard")},{via:f,node:b,setActive:T}=t;(0,de.useEffect)(()=>{if(f!=="touch"||!b)return;let x=M=>{b.contains(M.target)||T(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,b,T]);let w=t.active!==null?n[t.active]:null,k=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,$=k&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,P=typeof e.renderTip=="function"&&w?e.renderTip(w):null,y=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${i})`:""),S;if(k){let x=k.x*$,M=t.width*$,D=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(M-x-4).toFixed(1)}px - 100%))`,U=k.y<64;S={position:"absolute",left:x,top:k.y*$,transform:`translate(${D}, ${U?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*$-8)}}let H=x=>{d.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},O=x=>x?M=>{let D=d.current??(d.current=M.currentTarget.getBoundingClientRect());D.width&&x((M.clientX-D.left)/D.width*t.width,(M.clientY-D.top)/D.height*t.height,M)}:void 0,K=O(e.onPointerMove),V=O(e.onPointerDown),_=K||V?x=>{x.pointerType==="touch"&&K?.(x),V?.(x)}:void 0,F=O(e.onPointerUp),v=Vr(e.theme);return(0,J.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":l,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:H,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,J.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:K,onPointerDown:_,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,J.jsx)("title",{id:o,children:l}),(0,J.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,J.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,k?(0,J.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:S,children:P??(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:k.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:k.title}),k.rows.map((x,M)=>(0,J.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,J.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,J.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,J.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},M))]})}):null,(0,J.jsx)("span",{className:"ztd-sr",style:Bt,"aria-live":"polite","aria-atomic":"true",children:y}),s&&!t.pending?u:null]})}function oi({label:e,events:t,t:n}){return(0,J.jsx)("div",{className:"ztd-sr",style:Bt,children:(0,J.jsxs)("table",{children:[(0,J.jsx)("caption",{children:n.table(e)}),(0,J.jsxs)("tbody",{children:[t.slice(0,zt).map((r,o)=>(0,J.jsxs)("tr",{children:[(0,J.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,J.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>zt?(0,J.jsx)("tr",{children:(0,J.jsx)("td",{colSpan:2,children:n.more(t.length-zt)})}):null]})]})})}function gt(e){let t=e.baseline??"central";return(0,J.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var g=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),pe=g("label","string",!0,"Item name field"),ie=g("value","number",!0,"Value field"),ai=[pe,ie],ii=[pe,ie],si=[g("label","string",!0,"Stage name"),g("value","number",!0,"Users at the stage")],li=[pe,ie],ci=[g("label","string",!0,"Leaf (lowest level) name"),ie,g("group","string",!1,"Parent group field")],ui=[g("label","string",!0,"Leaf name"),ie,g("group","string",!1,"Parent group field")],mi=[pe,g("value","number",!0,"Change (total rows may omit it)"),g("type","string",!1,'"total" makes a total bar')],di=[pe,ie],fi=[g("x","string",!0,"Column field"),g("series","string",!0,"Stacked series field"),ie],hi=[g("x","string",!0,"Column field"),g("y","string",!0,"Row field"),ie],gi=[g("axis","string",!0,"Metric (axis) field"),g("value","number",!0,"Value field",{multi:!0}),g("series","string",!1,"Series field")],pi=[g("x","number",!0,"x value"),g("y","number",!0,"y value"),g("size","number",!1,"Circle size"),g("label","string",!1,"Name")],Yr=g("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),bi=[g("x","any",!0,"x field (date, number or category)"),g("y","number",!0,"y field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field (long tables)"),g("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Yr],yi=[g("x","any",!0,"x field"),g("y","number",!0,"y field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field"),g("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}),Yr],xi=[g("x","any",!0,"x field"),g("y","number",!0,"y field",{multi:!0}),g("series","string",!1,"Series field")],ki=[g("x","string",!0,"Category field"),g("y","number",!0,"Value field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field"),g("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})],wi=[pe,ie],vi=[g("value","number",!0,"Value field",{prop:"valueKey"}),g("target","number",!1,"Target field",{prop:"targetKey"})],$i=[pe,g("value","number",!0,"Actual value field"),g("target","number",!1,"Target field")],Mi=[g("x","any",!1,"x field"),g("y","number",!0,"y field")],Ti=[pe,g("x","string",!1,"Period field (long tables)"),g("value","number",!1,"Value field (long tables)")],Ci=[pe,g("start","number",!0,"Before value"),g("end","number",!0,"After value")],Si=[pe,ie],Ai=[g("value","number",!0,"Value field"),g("group","string",!1,"Group (row) field"),g("label","string",!1,"Dot name")],Ni=[g("group","string",!0,"Group field"),g("value","number",!0,"Value field")],Ri=[g("source","string",!0,"Source node"),g("target","string",!0,"Target node"),ie],Fi=[g("source","string",!0,"Sending group"),g("target","string",!0,"Receiving group"),ie],Pi=[g("date","date",!0,"Date field"),ie],_i=[g("x","any",!0,"Period field"),g("series","string",!0,"Item field"),g("rank","number",!1,"Rank field (1 is first)"),g("value","number",!1,"Value field (instead of rank, largest is first)")],Di=[g("group","string",!0,"Group field"),g("value","number",!0,"Value field")],Li=[g("label","string",!1,"Row name field")],Ei=[g("x","date",!0,"Date (period) field"),g("open","number",!0,"Open price field"),g("high","number",!0,"High price field"),g("low","number",!0,"Low price field"),g("close","number",!0,"Close price field"),g("volume","number",!1,"Volume field")],Oi=[pe,ie],Ii=[g("x","any",!0,"Period field (date or category)"),g("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field (long tables, back row only)"),g("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],zi=[g("value","number",!1,"Sample value field (raw rows)"),g("group","string",!1,"Group field. Up to 2 groups overlap"),g("x0","number",!1,"Bin start (pre-binned rows)"),g("x1","number",!1,"Bin end (pre-binned rows)"),g("count","number",!1,"Samples in the bin (pre-binned rows)")],Bi=[g("region","string",!0,"Region name or code, matched to a tile of options.map"),ie],Hi=[pe,ie,g("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")],ji=[g("source","string",!0,"Source node"),g("target","string",!0,"Target node"),g("value","number",!1,"Link weight. Without it every row counts 1")],Gi=[g("label","string",!0,"Row name. Items with the same name share a row"),g("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),g("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),g("group","string",!1,"Group field (one color per group, and the legend)"),g("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")],Vi=[g("label","string",!0,"Node name field"),g("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),g("group","string",!1,"Parent group field (flat rows, as in the treemap)"),g("id","string",!1,"Row id for id/parent rows. Defaults to the label"),g("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Wi=[g("region","string",!0,"Region name or code, matched to a region of options.map"),ie],Ki=[g("lon","number",!1,"Longitude (degrees)"),g("lat","number",!1,"Latitude (degrees)"),g("size","number",!1,"Value (circle area). Without it all circles match"),g("label","string",!1,"Place name"),g("region","string",!1,"Region of options.map, for rows without lon and lat"),g("group","string",!1,"Group field (one color per group)")],Ui=[g("source","string",!0,"Start: a name in options.places or a region"),g("target","string",!0,"End"),g("value","number",!1,"Amount. Without it each row counts 1")],Xi=[g("x","number",!0,"x value"),g("y","number",!0,"y value"),g("series","string",!1,"Series field (one color per series)"),g("label","string",!1,"Name")],Xr={pie:ai,donut:ii,funnel:si,waffle:li,treemap:ci,sunburst:ui,waterfall:mi,pareto:di,marimekko:fi,heatmap:hi,radar:gi,bubble:pi,line:bi,area:yi,stream:xi,bar:ki,radialBar:wi,gauge:vi,bullet:$i,sparkline:Mi,slope:Ti,dumbbell:Ci,lollipop:Si,beeswarm:Ai,ridgeline:Ni,sankey:Ri,chord:Fi,calendar:Pi,bump:_i,box:Di,parallel:Li,candlestick:Ei,segmented:Oi,skyline:Ii,histogram:zi,scatter:Xi,tileMap:Bi,barRace:Hi,network:ji,timeline:Gi,tree:Vi,choropleth:Wi,symbolMap:Ki,flowMap:Ui},rt={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function Jr(e,t){return t==="ko"?e.nameKo:e.name}function qr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Zr=["line","area","bar","scatter"],Qr=24,Nn=["line","area","bar","scatter","timeline"];function Rn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function eo(e,t,n){return Nn.includes(e)&&!Rn(e,t,n).length&&!(e==="scatter"&&Ht(n))}function Ht(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function to(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Yi={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 jt(e){let t=Xr[e]?e:Yi[e]??Object.keys(rt).find(n=>n.toLowerCase()===e.toLowerCase()||rt[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!rt[t]))return{type:t,component:rt[t].component,name:rt[t].name,nameKo:rt[t].nameKo,encoding:Xr[t]}}function no(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of jt(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function ro(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ji(e,t){if(e==null||typeof e!="object")return;let n=e;if(ro(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!ro(r,o))return;r=r[o]}return r}}function Ne(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 Ke(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ji(r,n)}function Gt(e,t){let n=Ke(e,t);return(r,o)=>Ne(n(r,o))}function Le(e,t){let n=Ke(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function $e(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function qi(e){let t=[],n=!1;for(let c=0;c<e.length&&c<4e3;c++){let l=e[c];if(l==='"')n=!n;else if(!n&&(l===`
23
+ `||l==="\r"))break;t.push(n?"":l)}let r=t.join(""),o=c=>r.split(c).length-1,a=[","," ",";","|"],i=",",s=0;for(let c of a){let l=o(c);l>s&&(s=l,i=c)}return i}var Zi=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function oo(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Zi.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Ne(t);if(Number.isFinite(n))return n}return t}function Ue(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??qi(o),i=[],s=[],c="",l=!1;for(let f=0;f<o.length;f++){let b=o[f];l?b==='"'?o[f+1]==='"'?(c+='"',f++):l=!1:c+=b:b==='"'&&!c.trim()?(l=!0,c=""):b===a?(s.push(c),c=""):b===`
24
24
  `||b==="\r"?(b==="\r"&&o[f+1]===`
25
- `&&f++,s.push(c),i.push(s),s=[],c=""):c+=b}(c!==""||s.length)&&(s.push(c),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?oo(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((b,T)=>[String(T),u(b)])));let d=[],h=new Set;return m[0].forEach((f,b)=>{let T=f.trim()||`col${b+1}`,w=T;for(let k=2;h.has(w);k++)w=`${T}_${k}`;h.add(w),d.push(w)}),m.slice(1).map(f=>Object.fromEntries(d.map((b,T)=>[b,u(f[T]??"")])))}function Fn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,c)=>[s,r&&typeof i[c]=="string"?oo(i[c]):i[c]??null])))}function Zi(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,c)=>Object.fromEntries(a.map(l=>[l,e[l][c]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function ao(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 Be(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Be(JSON.parse(t))}catch{}return Ke(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Fn(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)?Be(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Fn(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)?Be(t.rows):Array.isArray(t.values)?Fn(t.values):Array.isArray(t.items)?Be(t.items):Array.isArray(t.results)?Be(t.results):Zi(t)}return[]}function Gt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Pn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(c,l)=>{let m=e[c][l];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let c=0;for(let l=1;l<r;l++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,l),f=h-i(d,l-1),b=0;for(let T=0;T<d;T++)b+=i(T,l)-i(T,l-1);m+=h,u+=(f/2+b)*h}m&&(c-=u/m),s[l]=c}}for(let c=0;c<r;c++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][c],b=Number.isFinite(f)?f:0;b>=0?(o[h][c]=u,u+=b,a[h][c]=u):(o[h][c]=d,d+=b,a[h][c]=d)}continue}let l=0;for(let u=0;u<n;u++)l+=i(u,c);let m=t==="silhouette"?-l/2:s[c];for(let u=0;u<n;u++){let d=i(u,c);t==="expand"&&(d=l?d/l*100:0),o[u][c]=m,m+=d,a[u][c]=m}}if(t==="wiggle"&&r){let c=1/0,l=-1/0;for(let u=0;u<r;u++)c=Math.min(c,o[0]?.[u]??0),l=Math.max(l,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function io(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 so(e){let t=e.length,n=e.map(l=>{let m=0,u=-1/0;return l.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(l=>l.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(l,m)=>m).sort((l,m)=>n[l]-n[m]),a=[],i=[],s=0,c=0;for(let l of o)s<c?(a.push(l),s+=r[l]):(i.push(l),c+=r[l]);return[...i.reverse(),...a]}var Qi=Math.PI*2;function Le(e,t,n){return e<t?t:e>n?n:e}function lo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function Q(e){return Math.round(e*100)/100}function _n(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=Le(a.tl??0,0,i),c=Le(a.tr??0,0,i),l=Le(a.br??0,0,i),m=Le(a.bl??0,0,i);return`M${Q(e+s)},${Q(t)}H${Q(e+n-c)}`+(c?`A${Q(c)},${Q(c)} 0 0 1 ${Q(e+n)},${Q(t+c)}`:"")+`V${Q(t+r-l)}`+(l?`A${Q(l)},${Q(l)} 0 0 1 ${Q(e+n-l)},${Q(t+r)}`:"")+`H${Q(e+m)}`+(m?`A${Q(m)},${Q(m)} 0 0 1 ${Q(e)},${Q(t+r-m)}`:"")+`V${Q(t+s)}`+(s?`A${Q(s)},${Q(s)} 0 0 1 ${Q(e+s)},${Q(t)}`:"")+"Z"}function co(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function mo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function uo(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 Vt=new Map;function ce(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Vt.get(o);if(a===void 0){let i=0,s=0;for(let c=0;c<r.length;c++){let l=r.charCodeAt(c);mo(l)?i+=uo(l):s+=uo(l)}a=i+s*(n>=600?1.07:1),Vt.size>5e3&&Vt.clear(),Vt.set(o,a)}return a*t}function Dn(e,t,n,r=400){if(e=e.trim(),ce(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let c=a+i+1>>1;ce(e.slice(0,c)+o,n,r)<=t?a=c:i=c-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(mo(s.charCodeAt(0))?2:3)?"":s+o}var ho=A(G(),1),es=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"&&es(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var po=A(G(),1),Ln=10.5;function ts(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>tt(i,{locale:n,maximumFractionDigits:a}))}function go(e,t,n){let r=18;for(let o of ts(e,t,n))r=Math.max(r,ce(o,Ln));return Math.ceil(r+8)}function En(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 rt(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,c=En(i,n),l=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/c-1e-9)*c,d=Math.floor(o/c+1e-9)*c;l=[o===0?0:o-d<=c*.3?d:o-i*s,a===0?0:u-a<=c*.3?u:a+i*s];let h=En(l[1]-l[0],n);if(h===c)break;c=h}return l}function bo(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=En(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let c=s,l=0;c<=o+a*1e-9&&l<200;c+=a,l++)i.push(Number((Math.round(c/a)*a).toPrecision(12)));return i}function In(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(c=>o+(c-n)*i);return s.domain=e,s.range=t,s.invert=c=>i===0?n:n+(c-o)/i,s.ticks=(c=4)=>bo(n,r,c),s}function On(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=rt(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function ns(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(l,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of l){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let c=i([1,2,3,4,5,6,7,8,9]);return c.length>=2?c:bo(e,t,3)}function yo(e,t){let n=In([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=()=>ns(e[0],e[1],Math.abs(t[1]-t[0])),r}function ht(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 rs=864e5;function xo(e,t,n,r=me){let o=t-e;if(!(o>0))return[{t:e,label:dt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/rs,i=[],s=new Date(e),c=new Date(e).getFullYear()===new Date(t).getFullYear(),l=(m,u,d,h=!1)=>{let f=new Date(m),b=-1,T=0;for(;f.getTime()<=t&&T++<500;){if(f.getTime()>=e){let w=f.getFullYear(),k=h&&!c&&w!==b;i.push({t:f.getTime(),label:dt(f,{locale:r,...d,...k?{year:"numeric"}:{}})}),b=w}u(f)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),l(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());l(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),l(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);l(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),l(h,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return i}function ko(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let c=o(i);return c>=0?(r[c]||(a[c]=t(c),r[c]=1),a[c]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var zn=(e,t,n)=>e==="date"?_t(t,n)?.getTime()??NaN:Ne(t);function os(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Br(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ue(e,t,n,r,o={}){let a=We(t,"x"),i=Array.isArray(n),s=i?n:null,c=i?null:We(n,"y"),l=!i&&r!==void 0?We(r,"series"):null,m=e.map((v,x)=>a(v,x)),u=o.xType??os(m),d=o.locale??me,h,f,b;if(u==="band"){let v=m.map(M=>String(M??""));h=$e(v);let x=new Map(h.map((M,D)=>[M,D]));f=h.map((M,D)=>D),b=Int32Array.from(v,M=>x.get(M)??-1)}else{let v=u==="date"?o.dayFirst??Hr(m):void 0,x=m.map(U=>zn(u,U,v)),M=Array.from(new Set(x.filter(U=>Number.isFinite(U)))).sort((U,oe)=>U-oe),D=new Map(M.map((U,oe)=>[U,oe]));f=M,h=M.map(String),b=Int32Array.from(x,U=>D.get(U)??-1)}let T=o.dateFormat,w=v=>typeof v=="string"?Pt(v.trim())?.[3]:void 0,k=u==="date"&&m.length<5e3?w(m[0]):void 0,$=(k===2||k===3)&&m.every(v=>w(v)===k),P=$&&k===3;if(u==="date"&&!T){let v=f.length>1?f[f.length-1]-f[0]:0;T=$&&k===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&&(T={year:"numeric",month:"short"})}let y;if(u==="band")y=h;else if(P&&!o.dateFormat){let v=te(d)==="ko";y=f.map(x=>{let M=new Date(x),D=Math.floor(M.getMonth()/3)+1;return v?`${M.getFullYear()}년 ${D}분기`:`Q${D} ${M.getFullYear()}`})}else{let v=f.every($n),x=u==="date"?new Intl.DateTimeFormat(d,T):new Intl.NumberFormat(d,v?{useGrouping:!1}:{maximumFractionDigits:6});y=f.length>1e3?ko(f.length,M=>x.format(f[M])):f.map(M=>x.format(M))}let S=s?[...s]:l?$e(e.map((v,x)=>String(l(v,x)??""))):[""],H=new Map(S.map((v,x)=>[v,x])),I=S.map(()=>new Array(h.length).fill(NaN)),K=S.map(()=>new Array(h.length).fill(null)),V=o.aggregate??"sum",_=V==="mean"?S.map(()=>new Uint32Array(h.length)):null,F=(v,x,M,D)=>{let U=I[v][x];V==="last"?I[v][x]=M:V==="count"?I[v][x]=(Number.isFinite(U)?U:0)+1:V==="mean"?Number.isFinite(M)&&(I[v][x]=(Number.isFinite(U)?U:0)+M,_[v][x]++):I[v][x]=Number.isFinite(U)?U+(Number.isFinite(M)?M:0):M,K[v][x]=D};for(let v=0;v<e.length;v++){let x=b[v];if(x<0)continue;let M=e[v];if(s)for(let D=0;D<s.length;D++)F(D,x,Ne(M[s[D]]),M);else{let D=l?H.get(String(l(M,v)??""))??0:0;F(D,x,Ne(c(M,v)),M)}}if(_)for(let v=0;v<I.length;v++)for(let x=0;x<h.length;x++)_[v][x]>1&&(I[v][x]/=_[v][x]);return{type:u,keys:h,xnum:f,labels:y,series:S,values:I,rows:K}}var as=140,pt=12,wo=14,Bn=20,vo=12.5;function is(e,t,n=Qr){let r=De(t,t),o=new Map;e.forEach((i,s)=>{let c=r(i,s),l=o.get(c);l?l.push(i):o.set(c,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function ss(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+pt)/(as+pt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function ls(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*pt)/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 gt=e=>e.filter(Number.isFinite);function Wt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=jt(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return gt(n)}function $o(e,t,n,r,o,a){return Ue(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function cs(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),c=r.yDomain,l=c&&(!s||c[0]>0&&c[1]>0)?c:void 0;if(e==="scatter"){let y=t.flat(),S=r.refLines??{},[H,I]=ht([...Wt(y,r.x??"x"),...gt([Number(S.x)])]),[K,V]=ht([...Wt(y,r.y??"y"),...gt([Number(S.y)])].filter(F=>!s||F>0)),_=r.zero??!1;return{y:l??(s?On(K,V,i):rt(K,V,i,{zero:_,pad:.08})),x:r.xDomain??rt(H,I,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(y=>y.keys.join("")===d),f=n.length>0&&n.every(y=>y.type!=="band"&&y.type===n[0].type),b=r.xDomain??(!m&&f?ht(n.flatMap(y=>gt(y.xnum))):void 0),T=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(T==="percent")return{x:b,sameKeys:h};if(l)return{y:l,x:b,sameKeys:h};let w=[];t.forEach((y,S)=>{let H=n[S];if(T==="stacked"||T==="auto"&&H.series.length>1){let K=Pn(H.values,"zero");K.y0.forEach(V=>w.push(...V)),K.y1.forEach(V=>w.push(...V))}else H.values.forEach(K=>w.push(...K));m&&!u&&r.line!==void 0&&$o(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(K=>w.push(...K)),m||w.push(...Wt(y,r.lower),...Wt(y,r.upper))}),m&&w.push(0),u||w.push(...fo(r.annotations));for(let y of r.referenceLines??[])w.push(y.y);r.signColors&&w.push(Number(r.baseline??0));let[k,$]=ht(gt(w).filter(y=>!s||y>0));return{y:s?On(k,$,i):m?rt(k,$,u?Math.max(2,Math.round(o/120)):i):rt(k,$,i,{zero:r.zero??e==="area"}),x:b,sameKeys:h}}function us(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let c=Ue(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),l=(r.yScale==="log"&&e==="line"?yo:In)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=go(l,Er(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(y=>y.series),d=r.endLabels??n.some(y=>y.series.length>1),h=m+6,f=a-(d?Math.min(a*.28,Math.max(...u.map(y=>ce(y,11,700)),20)+14):10),b=c.keys.length,[T,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,k=c.type==="number"?b>12:b>xo(T,w,Math.max(2,Math.floor((f-h)/64)),s).length;if(c.type==="band"||!b||k)return;let $=y=>h+(c.xnum[y]-T)/(w-T)*(f-h),P=y=>ce(c.labels[y],Ln);for(let y=1;;y++){let S=Array.from({length:Math.ceil(b/y)},(H,I)=>I*y);if(y>=b||S.every((H,I)=>!I||$(H)-$(S[I-1])>=(P(H)+P(S[I-1]))/2+8))return S.map(H=>({value:c.xnum[H],label:c.labels[H]}))}}function ms(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 ds(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${ms(`${e}|${t}|${o}|${Gt(r)}`)}`}function fs(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 hs={en:{intro:(e,t)=>`${xe(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:"(빈 값)"}},Hn=18;function Mo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=is(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,c=ss(s,i,e.columns),{pw:l,ph:m}=ls(s,c,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(_=>$o(t,_,n,n.y,n.series,n.aggregate)),h=u?cs(t,o,d,n,l,m):{sameKeys:!1},f=u?us(t,o,d,n,h,l,m,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",T=u&&(!b||h.sameKeys),w=u&&(b||h.x!==void 0||h.sameKeys),k=new Set(fs(e.highlight,r)?[e.highlight].flat():[]),$=k.size>0,P=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??ds(t,e.by,n,e.data),S=et(_e(n.format,e.locale),n.unit),H=hs[e.lang],I=[],K=r.map(_=>_===""?H.blank:_);return{panels:r.map((_,F)=>{let v=o[F],x=K[F],M=F%c,D;if(t!=="scatter"){let oe=d[F],Fe=he=>oe.values.reduce((Ce,st)=>Ce+(Number.isFinite(st[he])?st[he]:0),0),X=oe.keys.map((he,Ce)=>Ce).filter(he=>oe.values.some(Ce=>Number.isFinite(Ce[he]))),se=X[X.length-1];I.push({first:X.length?Fe(X[0]):NaN,last:X.length?Fe(se):NaN,total:X.reduce((he,Ce)=>he+Fe(Ce),0)}),t!=="bar"&&oe.series.length===1&&se!==void 0&&(D=S(oe.values[0][se]))}else I.push({first:NaN,last:NaN,total:v.length});let U={data:v,width:l,height:m,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:y,highlight:$?k.has(_)?P?()=>!0:void 0:"none":e.highlight,showYAxis:!T||M===0,showXAxis:!w||F+c>=i};return h.y&&(U.yDomain=h.y),h.x&&(U.xDomain=h.x),f&&(U.xTicks=f),{value:_,label:x,props:U,last:D,isPicked:k.has(_)}}),cols:c,pw:l,ph:m,isPanelPick:$,description:gs(t,e.by,K,I,a,S,H)}}function gs(e,t,n,r,o,a,i){let s=i.intro(n.length,t),c=l=>co(r.map(m=>m[l]));if(e==="line"||e==="area"){let l=c("last");l>=0&&(s+=i.endHigh(n[l],a(r[l].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let l=c("total");l>=0&&(s+=e==="bar"?i.total(n[l],a(r[l].total)):i.points(n[l],r[l].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var fe=A(Z(),1);function ps(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function bs(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 Kt={threshold:.25,enoughPx:96,rootMargin:"0px"};function So(e,t=!0){let[n,r]=(0,fe.useState)({visible:!t,near:!t});return(0,fe.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=bs(i[i.length-1],Kt.threshold,Kt.enoughPx);r(c=>c.visible===s?c:{...c,visible:s,near:c.near||s})},{threshold:ps(Kt.threshold),rootMargin:Kt.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(c=>c.near===s.isIntersecting?c:{...c,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function To(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Ut(e){let[t,n]=(0,fe.useState)(null),[r,o]=(0,fe.useState)(e??null),a=(0,fe.useCallback)(i=>{n(i),i&&e===void 0&&o(To(i))},[e]);return Ae(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=l=>o(m=>m!==null&&Math.abs(m-l)<.5?m:l),s=()=>i(To(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let c=new ResizeObserver(l=>{let m=l[l.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return c.observe(t),()=>c.disconnect()},[t,e]),[t,a,r]}var ys=()=>()=>{};function ot(){return(0,fe.useSyncExternalStore)(ys,()=>!0,()=>!1)}var Co="(prefers-reduced-motion: reduce)";function Xt(e="auto"){let[t,n]=(0,fe.useState)(()=>ye&&typeof window.matchMedia=="function"?window.matchMedia(Co).matches:!1);return(0,fe.useEffect)(()=>{if(e!=="auto"||!ye||typeof window.matchMedia!="function")return;let r=window.matchMedia(Co),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=A(G(),1),xs=60,ks=420;function Ao(e){let t=ve(),n=e.chartProps??{},[,r,o]=Ut(e.width),a=e.width??(o||480),i=le(e.locale??n.locale),s=te(i),c=(0,at.useContext)(qe),l=e.title??c,m=e.chart.facetPlan,u=(0,at.useMemo)(()=>{let w=Mo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:l,locale:i,lang:s});return m?m(w,n,i):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,a,e.height,l,i,s,m]),d=`${(0,at.useId)().replace(/:/g,"")}fd`,h=Xt(n.reducedMotion??"auto"),f=ot(),b=wr({motion:{enabled:n.animate!==!1&&!h&&ye},hydrated:f},{waiting:!1,generation:0}),T=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":l,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:d,style:zt,children:e.description??u.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:pt,rowGap:wo,...u.legend?{marginTop:Hn}:null},children:u.panels.map((w,k)=>{let $=t.paint(w.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...kr(b,!1,"fade",k*xs,ks)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Bn,fontSize:vo,fontWeight:700,lineHeight:`${Bn}px`,color:$},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,Me.jsx)(T,{...n,...w.props})]},w.value)})}),u.legend?(0,Me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Hn},children:u.legend}):null]})}var No=["max","min","first","last","none"];function Te(e,t,n,r,o="max"){let a=new Set,i=n.length,s=l=>{if(i&&l!=="none"){if(l==="first")a.add(0);else if(l==="last")a.add(i-1);else if(l==="max"||l==="min"){let m=-1,u=l==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(l==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((l,m)=>{m<i&&l!==null&&l!==void 0&&e(l,m)&&a.add(m)}),a;let c=Array.isArray(e)?e:[e];for(let l of c)typeof l=="number"?l>=0&&l<i&&a.add(l):l==="max"||l==="min"||l==="first"||l==="last"||l==="none"?s(l):n.forEach((m,u)=>{m===l&&a.add(u)});return a}var be=A(Z(),1);async function ws(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(te(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ke(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ke(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ke(a)}async function vs(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await ws(a,t.parse,o,t.locale)}return t.select&&(r=ao(r,t.select)),t.transform?t.transform(r):Be(r)}function Ro(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,be.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,c]=(0,be.useState)(0),l=le(t.locale),m=(0,be.useRef)(t);m.current={...t,locale:l};let u=(0,be.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),b=(0,be.useRef)(!1);(0,be.useEffect)(()=>{let w=u.current;if(!w||!r){i(P=>P.status==="loading"?{...P,status:"idle"}:P);return}let k=new AbortController,$=!0;return b.current=!0,i(P=>({...P,data:o?P.data:[],status:"loading",error:null})),vs(w,{...m.current,signal:k.signal}).then(P=>{$&&i({data:P,status:"success",error:null,updatedAt:Date.now()})}).catch(P=>{!$||k.signal.aborted||i(y=>({...y,status:"error",error:P instanceof Error?P:new Error(String(P))}))}).finally(()=>{$&&(b.current=!1)}),()=>{$=!1,b.current=!1,k.abort()}},[d,r,s,f,o]),(0,be.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||c(k=>k+1)},n);return()=>clearInterval(w)},[n,r]);let T=(0,be.useCallback)(()=>c(w=>w+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:T}}var Gn=A(G(),1),$s=["csv","svg","png"],Ms=/^[=+\-@\t\r\n=+-@]/,Ts=/var\(|color-mix\(/;function Fo(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Ir(e.getTime()):String(e);return`"${(Ms.test(t)&&!Number.isFinite(Ne(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Cs(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Ss(e,t){return`\uFEFF${[t.map(Fo),...e.map(r=>t.map(o=>Fo(r[o])))].map(r=>r.join(",")).join(`\r
25
+ `&&f++,s.push(c),i.push(s),s=[],c=""):c+=b}(c!==""||s.length)&&(s.push(c),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?oo(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((b,T)=>[String(T),u(b)])));let d=[],h=new Set;return m[0].forEach((f,b)=>{let T=f.trim()||`col${b+1}`,w=T;for(let k=2;h.has(w);k++)w=`${T}_${k}`;h.add(w),d.push(w)}),m.slice(1).map(f=>Object.fromEntries(d.map((b,T)=>[b,u(f[T]??"")])))}function Fn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,c)=>[s,r&&typeof i[c]=="string"?oo(i[c]):i[c]??null])))}function Qi(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,c)=>Object.fromEntries(a.map(l=>[l,e[l][c]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function ao(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 He(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return He(JSON.parse(t))}catch{}return Ue(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Fn(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)?He(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Fn(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)?He(t.rows):Array.isArray(t.values)?Fn(t.values):Array.isArray(t.items)?He(t.items):Array.isArray(t.results)?He(t.results):Qi(t)}return[]}function Vt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Pn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(c,l)=>{let m=e[c][l];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let c=0;for(let l=1;l<r;l++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,l),f=h-i(d,l-1),b=0;for(let T=0;T<d;T++)b+=i(T,l)-i(T,l-1);m+=h,u+=(f/2+b)*h}m&&(c-=u/m),s[l]=c}}for(let c=0;c<r;c++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][c],b=Number.isFinite(f)?f:0;b>=0?(o[h][c]=u,u+=b,a[h][c]=u):(o[h][c]=d,d+=b,a[h][c]=d)}continue}let l=0;for(let u=0;u<n;u++)l+=i(u,c);let m=t==="silhouette"?-l/2:s[c];for(let u=0;u<n;u++){let d=i(u,c);t==="expand"&&(d=l?d/l*100:0),o[u][c]=m,m+=d,a[u][c]=m}}if(t==="wiggle"&&r){let c=1/0,l=-1/0;for(let u=0;u<r;u++)c=Math.min(c,o[0]?.[u]??0),l=Math.max(l,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function io(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 so(e){let t=e.length,n=e.map(l=>{let m=0,u=-1/0;return l.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(l=>l.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(l,m)=>m).sort((l,m)=>n[l]-n[m]),a=[],i=[],s=0,c=0;for(let l of o)s<c?(a.push(l),s+=r[l]):(i.push(l),c+=r[l]);return[...i.reverse(),...a]}var es=Math.PI*2;function Ee(e,t,n){return e<t?t:e>n?n:e}function lo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function Q(e){return Math.round(e*100)/100}function _n(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=Ee(a.tl??0,0,i),c=Ee(a.tr??0,0,i),l=Ee(a.br??0,0,i),m=Ee(a.bl??0,0,i);return`M${Q(e+s)},${Q(t)}H${Q(e+n-c)}`+(c?`A${Q(c)},${Q(c)} 0 0 1 ${Q(e+n)},${Q(t+c)}`:"")+`V${Q(t+r-l)}`+(l?`A${Q(l)},${Q(l)} 0 0 1 ${Q(e+n-l)},${Q(t+r)}`:"")+`H${Q(e+m)}`+(m?`A${Q(m)},${Q(m)} 0 0 1 ${Q(e)},${Q(t+r-m)}`:"")+`V${Q(t+s)}`+(s?`A${Q(s)},${Q(s)} 0 0 1 ${Q(e+s)},${Q(t)}`:"")+"Z"}function co(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function mo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function uo(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 Wt=new Map;function ce(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Wt.get(o);if(a===void 0){let i=0,s=0;for(let c=0;c<r.length;c++){let l=r.charCodeAt(c);mo(l)?i+=uo(l):s+=uo(l)}a=i+s*(n>=600?1.07:1),Wt.size>5e3&&Wt.clear(),Wt.set(o,a)}return a*t}function Dn(e,t,n,r=400){if(e=e.trim(),ce(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let c=a+i+1>>1;ce(e.slice(0,c)+o,n,r)<=t?a=c:i=c-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(mo(s.charCodeAt(0))?2:3)?"":s+o}var ho=A(G(),1),ts=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"&&ts(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var po=A(G(),1),Ln=10.5;function ns(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>nt(i,{locale:n,maximumFractionDigits:a}))}function go(e,t,n){let r=18;for(let o of ns(e,t,n))r=Math.max(r,ce(o,Ln));return Math.ceil(r+8)}function En(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 ot(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,c=En(i,n),l=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/c-1e-9)*c,d=Math.floor(o/c+1e-9)*c;l=[o===0?0:o-d<=c*.3?d:o-i*s,a===0?0:u-a<=c*.3?u:a+i*s];let h=En(l[1]-l[0],n);if(h===c)break;c=h}return l}function bo(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=En(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let c=s,l=0;c<=o+a*1e-9&&l<200;c+=a,l++)i.push(Number((Math.round(c/a)*a).toPrecision(12)));return i}function On(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(c=>o+(c-n)*i);return s.domain=e,s.range=t,s.invert=c=>i===0?n:n+(c-o)/i,s.ticks=(c=4)=>bo(n,r,c),s}function In(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=ot(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function rs(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(l,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of l){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let c=i([1,2,3,4,5,6,7,8,9]);return c.length>=2?c:bo(e,t,3)}function yo(e,t){let n=On([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=()=>rs(e[0],e[1],Math.abs(t[1]-t[0])),r}function pt(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 os=864e5;function xo(e,t,n,r=me){let o=t-e;if(!(o>0))return[{t:e,label:ht(e,{locale:r,month:"short",day:"numeric"})}];let a=o/os,i=[],s=new Date(e),c=new Date(e).getFullYear()===new Date(t).getFullYear(),l=(m,u,d,h=!1)=>{let f=new Date(m),b=-1,T=0;for(;f.getTime()<=t&&T++<500;){if(f.getTime()>=e){let w=f.getFullYear(),k=h&&!c&&w!==b;i.push({t:f.getTime(),label:ht(f,{locale:r,...d,...k?{year:"numeric"}:{}})}),b=w}u(f)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),l(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());l(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),l(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);l(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),l(h,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return i}function ko(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let c=o(i);return c>=0?(r[c]||(a[c]=t(c),r[c]=1),a[c]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var zn=(e,t,n)=>e==="date"?Dt(t,n)?.getTime()??NaN:Ne(t);function as(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Br(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Xe(e,t,n,r,o={}){let a=Ke(t,"x"),i=Array.isArray(n),s=i?n:null,c=i?null:Ke(n,"y"),l=!i&&r!==void 0?Ke(r,"series"):null,m=e.map((v,x)=>a(v,x)),u=o.xType??as(m),d=o.locale??me,h,f,b;if(u==="band"){let v=m.map(M=>String(M??""));h=$e(v);let x=new Map(h.map((M,D)=>[M,D]));f=h.map((M,D)=>D),b=Int32Array.from(v,M=>x.get(M)??-1)}else{let v=u==="date"?o.dayFirst??Hr(m):void 0,x=m.map(U=>zn(u,U,v)),M=Array.from(new Set(x.filter(U=>Number.isFinite(U)))).sort((U,oe)=>U-oe),D=new Map(M.map((U,oe)=>[U,oe]));f=M,h=M.map(String),b=Int32Array.from(x,U=>D.get(U)??-1)}let T=o.dateFormat,w=v=>typeof v=="string"?_t(v.trim())?.[3]:void 0,k=u==="date"&&m.length<5e3?w(m[0]):void 0,$=(k===2||k===3)&&m.every(v=>w(v)===k),P=$&&k===3;if(u==="date"&&!T){let v=f.length>1?f[f.length-1]-f[0]:0;T=$&&k===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&&(T={year:"numeric",month:"short"})}let y;if(u==="band")y=h;else if(P&&!o.dateFormat){let v=te(d)==="ko";y=f.map(x=>{let M=new Date(x),D=Math.floor(M.getMonth()/3)+1;return v?`${M.getFullYear()}년 ${D}분기`:`Q${D} ${M.getFullYear()}`})}else{let v=f.every($n),x=u==="date"?new Intl.DateTimeFormat(d,T):new Intl.NumberFormat(d,v?{useGrouping:!1}:{maximumFractionDigits:6});y=f.length>1e3?ko(f.length,M=>x.format(f[M])):f.map(M=>x.format(M))}let S=s?[...s]:l?$e(e.map((v,x)=>String(l(v,x)??""))):[""],H=new Map(S.map((v,x)=>[v,x])),O=S.map(()=>new Array(h.length).fill(NaN)),K=S.map(()=>new Array(h.length).fill(null)),V=o.aggregate??"sum",_=V==="mean"?S.map(()=>new Uint32Array(h.length)):null,F=(v,x,M,D)=>{let U=O[v][x];V==="last"?O[v][x]=M:V==="count"?O[v][x]=(Number.isFinite(U)?U:0)+1:V==="mean"?Number.isFinite(M)&&(O[v][x]=(Number.isFinite(U)?U:0)+M,_[v][x]++):O[v][x]=Number.isFinite(U)?U+(Number.isFinite(M)?M:0):M,K[v][x]=D};for(let v=0;v<e.length;v++){let x=b[v];if(x<0)continue;let M=e[v];if(s)for(let D=0;D<s.length;D++)F(D,x,Ne(M[s[D]]),M);else{let D=l?H.get(String(l(M,v)??""))??0:0;F(D,x,Ne(c(M,v)),M)}}if(_)for(let v=0;v<O.length;v++)for(let x=0;x<h.length;x++)_[v][x]>1&&(O[v][x]/=_[v][x]);return{type:u,keys:h,xnum:f,labels:y,series:S,values:O,rows:K}}var is=140,yt=12,wo=14,Bn=20,vo=12.5;function ss(e,t,n=Qr){let r=Le(t,t),o=new Map;e.forEach((i,s)=>{let c=r(i,s),l=o.get(c);l?l.push(i):o.set(c,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function ls(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+yt)/(is+yt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function cs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*yt)/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 bt=e=>e.filter(Number.isFinite);function Kt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Gt(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return bt(n)}function $o(e,t,n,r,o,a){return Xe(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function us(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),c=r.yDomain,l=c&&(!s||c[0]>0&&c[1]>0)?c:void 0;if(e==="scatter"){let y=t.flat(),S=r.refLines??{},[H,O]=pt([...Kt(y,r.x??"x"),...bt([Number(S.x)])]),[K,V]=pt([...Kt(y,r.y??"y"),...bt([Number(S.y)])].filter(F=>!s||F>0)),_=r.zero??!1;return{y:l??(s?In(K,V,i):ot(K,V,i,{zero:_,pad:.08})),x:r.xDomain??ot(H,O,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(y=>y.keys.join("")===d),f=n.length>0&&n.every(y=>y.type!=="band"&&y.type===n[0].type),b=r.xDomain??(!m&&f?pt(n.flatMap(y=>bt(y.xnum))):void 0),T=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(T==="percent")return{x:b,sameKeys:h};if(l)return{y:l,x:b,sameKeys:h};let w=[];t.forEach((y,S)=>{let H=n[S];if(T==="stacked"||T==="auto"&&H.series.length>1){let K=Pn(H.values,"zero");K.y0.forEach(V=>w.push(...V)),K.y1.forEach(V=>w.push(...V))}else H.values.forEach(K=>w.push(...K));m&&!u&&r.line!==void 0&&$o(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(K=>w.push(...K)),m||w.push(...Kt(y,r.lower),...Kt(y,r.upper))}),m&&w.push(0),u||w.push(...fo(r.annotations));for(let y of r.referenceLines??[])w.push(y.y);r.signColors&&w.push(Number(r.baseline??0));let[k,$]=pt(bt(w).filter(y=>!s||y>0));return{y:s?In(k,$,i):m?ot(k,$,u?Math.max(2,Math.round(o/120)):i):ot(k,$,i,{zero:r.zero??e==="area"}),x:b,sameKeys:h}}function ms(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let c=Xe(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),l=(r.yScale==="log"&&e==="line"?yo:On)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=go(l,Er(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(y=>y.series),d=r.endLabels??n.some(y=>y.series.length>1),h=m+6,f=a-(d?Math.min(a*.28,Math.max(...u.map(y=>ce(y,11,700)),20)+14):10),b=c.keys.length,[T,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,k=c.type==="number"?b>12:b>xo(T,w,Math.max(2,Math.floor((f-h)/64)),s).length;if(c.type==="band"||!b||k)return;let $=y=>h+(c.xnum[y]-T)/(w-T)*(f-h),P=y=>ce(c.labels[y],Ln);for(let y=1;;y++){let S=Array.from({length:Math.ceil(b/y)},(H,O)=>O*y);if(y>=b||S.every((H,O)=>!O||$(H)-$(S[O-1])>=(P(H)+P(S[O-1]))/2+8))return S.map(H=>({value:c.xnum[H],label:c.labels[H]}))}}function ds(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 fs(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${ds(`${e}|${t}|${o}|${Vt(r)}`)}`}function hs(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 gs={en:{intro:(e,t)=>`${xe(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:"(빈 값)"}},Hn=18;function Mo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=ss(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,c=ls(s,i,e.columns),{pw:l,ph:m}=cs(s,c,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(_=>$o(t,_,n,n.y,n.series,n.aggregate)),h=u?us(t,o,d,n,l,m):{sameKeys:!1},f=u?ms(t,o,d,n,h,l,m,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",T=u&&(!b||h.sameKeys),w=u&&(b||h.x!==void 0||h.sameKeys),k=new Set(hs(e.highlight,r)?[e.highlight].flat():[]),$=k.size>0,P=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??fs(t,e.by,n,e.data),S=tt(De(n.format,e.locale),n.unit),H=gs[e.lang],O=[],K=r.map(_=>_===""?H.blank:_);return{panels:r.map((_,F)=>{let v=o[F],x=K[F],M=F%c,D;if(t!=="scatter"){let oe=d[F],Fe=he=>oe.values.reduce((Ce,lt)=>Ce+(Number.isFinite(lt[he])?lt[he]:0),0),X=oe.keys.map((he,Ce)=>Ce).filter(he=>oe.values.some(Ce=>Number.isFinite(Ce[he]))),se=X[X.length-1];O.push({first:X.length?Fe(X[0]):NaN,last:X.length?Fe(se):NaN,total:X.reduce((he,Ce)=>he+Fe(Ce),0)}),t!=="bar"&&oe.series.length===1&&se!==void 0&&(D=S(oe.values[0][se]))}else O.push({first:NaN,last:NaN,total:v.length});let U={data:v,width:l,height:m,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:y,highlight:$?k.has(_)?P?()=>!0:void 0:"none":e.highlight,showYAxis:!T||M===0,showXAxis:!w||F+c>=i};return h.y&&(U.yDomain=h.y),h.x&&(U.xDomain=h.x),f&&(U.xTicks=f),{value:_,label:x,props:U,last:D,isPicked:k.has(_)}}),cols:c,pw:l,ph:m,isPanelPick:$,description:ps(t,e.by,K,O,a,S,H)}}function ps(e,t,n,r,o,a,i){let s=i.intro(n.length,t),c=l=>co(r.map(m=>m[l]));if(e==="line"||e==="area"){let l=c("last");l>=0&&(s+=i.endHigh(n[l],a(r[l].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let l=c("total");l>=0&&(s+=e==="bar"?i.total(n[l],a(r[l].total)):i.points(n[l],r[l].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var fe=A(Z(),1);function bs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function ys(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 Ut={threshold:.25,enoughPx:96,rootMargin:"0px"};function So(e,t=!0){let[n,r]=(0,fe.useState)({visible:!t,near:!t});return(0,fe.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=ys(i[i.length-1],Ut.threshold,Ut.enoughPx);r(c=>c.visible===s?c:{...c,visible:s,near:c.near||s})},{threshold:bs(Ut.threshold),rootMargin:Ut.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(c=>c.near===s.isIntersecting?c:{...c,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function To(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Xt(e){let[t,n]=(0,fe.useState)(null),[r,o]=(0,fe.useState)(e??null),a=(0,fe.useCallback)(i=>{n(i),i&&e===void 0&&o(To(i))},[e]);return Ae(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=l=>o(m=>m!==null&&Math.abs(m-l)<.5?m:l),s=()=>i(To(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let c=new ResizeObserver(l=>{let m=l[l.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return c.observe(t),()=>c.disconnect()},[t,e]),[t,a,r]}var xs=()=>()=>{};function at(){return(0,fe.useSyncExternalStore)(xs,()=>!0,()=>!1)}var Co="(prefers-reduced-motion: reduce)";function Yt(e="auto"){let[t,n]=(0,fe.useState)(()=>ye&&typeof window.matchMedia=="function"?window.matchMedia(Co).matches:!1);return(0,fe.useEffect)(()=>{if(e!=="auto"||!ye||typeof window.matchMedia!="function")return;let r=window.matchMedia(Co),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=A(G(),1),ks=60,ws=420;function Ao(e){let t=ve(),n=e.chartProps??{},[,r,o]=Xt(e.width),a=e.width??(o||480),i=le(e.locale??n.locale),s=te(i),c=(0,it.useContext)(Qe),l=e.title??c,m=e.chart.facetPlan,u=(0,it.useMemo)(()=>{let w=Mo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:l,locale:i,lang:s});return m?m(w,n,i):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,a,e.height,l,i,s,m]),d=`${(0,it.useId)().replace(/:/g,"")}fd`,h=Yt(n.reducedMotion??"auto"),f=at(),b=wr({motion:{enabled:n.animate!==!1&&!h&&ye},hydrated:f},{waiting:!1,generation:0}),T=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":l,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:d,style:Bt,children:e.description??u.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:yt,rowGap:wo,...u.legend?{marginTop:Hn}:null},children:u.panels.map((w,k)=>{let $=t.paint(w.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...kr(b,!1,"fade",k*ks,ws)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Bn,fontSize:vo,fontWeight:700,lineHeight:`${Bn}px`,color:$},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,Me.jsx)(T,{...n,...w.props})]},w.value)})}),u.legend?(0,Me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Hn},children:u.legend}):null]})}var No=["max","min","first","last","none"];function Te(e,t,n,r,o="max"){let a=new Set,i=n.length,s=l=>{if(i&&l!=="none"){if(l==="first")a.add(0);else if(l==="last")a.add(i-1);else if(l==="max"||l==="min"){let m=-1,u=l==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(l==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((l,m)=>{m<i&&l!==null&&l!==void 0&&e(l,m)&&a.add(m)}),a;let c=Array.isArray(e)?e:[e];for(let l of c)typeof l=="number"?l>=0&&l<i&&a.add(l):l==="max"||l==="min"||l==="first"||l==="last"||l==="none"?s(l):n.forEach((m,u)=>{m===l&&a.add(u)});return a}var be=A(Z(),1);async function vs(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(te(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ue(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ue(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ue(a)}async function $s(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await vs(a,t.parse,o,t.locale)}return t.select&&(r=ao(r,t.select)),t.transform?t.transform(r):He(r)}function Ro(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,be.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,c]=(0,be.useState)(0),l=le(t.locale),m=(0,be.useRef)(t);m.current={...t,locale:l};let u=(0,be.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),b=(0,be.useRef)(!1);(0,be.useEffect)(()=>{let w=u.current;if(!w||!r){i(P=>P.status==="loading"?{...P,status:"idle"}:P);return}let k=new AbortController,$=!0;return b.current=!0,i(P=>({...P,data:o?P.data:[],status:"loading",error:null})),$s(w,{...m.current,signal:k.signal}).then(P=>{$&&i({data:P,status:"success",error:null,updatedAt:Date.now()})}).catch(P=>{!$||k.signal.aborted||i(y=>({...y,status:"error",error:P instanceof Error?P:new Error(String(P))}))}).finally(()=>{$&&(b.current=!1)}),()=>{$=!1,b.current=!1,k.abort()}},[d,r,s,f,o]),(0,be.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||c(k=>k+1)},n);return()=>clearInterval(w)},[n,r]);let T=(0,be.useCallback)(()=>c(w=>w+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:T}}var Gn=A(G(),1),Ms=["csv","svg","png"],Ts=/^[=+\-@\t\r\n=+-@]/,Cs=/var\(|color-mix\(/;function Fo(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?Or(e.getTime()):String(e);return`"${(Ts.test(t)&&!Number.isFinite(Ne(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Ss(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function As(e,t){return`\uFEFF${[t.map(Fo),...e.map(r=>t.map(o=>Fo(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
- `}function As(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function jn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Po=2,He=16;function _o(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Do(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 Lo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,c]=[a+He*2,i+He*2],l=o.cloneNode(!0),m=l.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,b)=>{let T;for(let w of Array.from(f.attributes)){if(!Ts.test(w.value))continue;let k=(T??(T=getComputedStyle(f))).getPropertyValue(w.name);k&&m[b].setAttribute(w.name,_o(k,u))}}),l.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-He} ${-He} ${s} ${c}`,width:s*t,height:c*t,"font-family":getComputedStyle(o).fontFamily}))l.setAttribute(f,String(b));let d=_o(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=l.querySelector("desc")?.nextSibling??l.firstChild;l.insertBefore(Do("rect",{x:-He,y:-He,width:s,height:c,fill:d}),f),h&&l.insertBefore(Do("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(l),w:s,h:c,vw:a,vh:i,bg:d,canvas:h}}function Ns(e,t){let n=Lo(e,Po,!1);if(!n)return;let r=Po,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,He*r,He*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(c=>c&&jn(c,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Eo(e){let t=ve(e.theme),n=te(le(e.locale))==="ko",r=As(e.filename),o=(a,i)=>{if(a==="csv")return jn(new Blob([Ss(e.data,e.columns?.length?e.columns:Cs(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Ns(i,r);let s=Lo(i,1,!0);s&&jn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Gn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:$s.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Gn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:c=>o(a,c.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Oo=A(G(),1);function Io(e,t=me){let n=_e(void 0,t),r=e.split(`
28
- `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?dt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let c=!1,l=s.replace(zr,(m,u)=>o(a,u.trim())??(c=!0,""));c||i.push(l)}return i.length?i.map((s,c)=>(0,Oo.jsx)("div",{children:s},c)):null}}function zo(e,t,n=!1){let r=De(t,"group"),o=e.map((s,c)=>r(s,c)).filter(Boolean),a=$e(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,c)=>[s,c]).sort((s,c)=>i.get(s[0])-i.get(c[0])||s[1]-c[1]).map(([s])=>s)}function Bo(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 Ke(t.csv)}return null}var Wo=A(Z(),1);var re=A(Z(),1);function Ho(e,t){let n=ve(e.theme),[r,o,a]=Ut(e.width),i=ot(),s=e.width??(a||t.ssrWidth||480),c=typeof t.height=="function"?t.height(s):t.height,l=e.height??c,m=Xt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,d=So(r,e.animateOnView!==!1&&u),h=le(e.locale),f=te(h),b=(0,re.useMemo)(()=>_e(e.format,h,t.format),[e.format,h,t.format]),T=(0,re.useCallback)(X=>Ft(X,{locale:h}),[h]),w=(0,re.useMemo)(()=>et(b,e.unit),[b,e.unit]),k=(0,re.useMemo)(()=>Gt(e.data),[e.data]),[$,P]=(0,re.useState)(null),[y,S]=(0,re.useState)(null),H=(0,re.useRef)([]),I=(0,re.useRef)(e.onHover);I.current=e.onHover;let K=(0,re.useRef)(e.onClick);K.current=e.onClick;let V=(0,re.useRef)(null),_=(0,re.useRef)(null),F=(0,re.useRef)(null),v=(0,re.useCallback)((X,se="pointer")=>{if(F.current!==X){F.current=X;let he=X===null?null:H.current[X]??null;queueMicrotask(()=>I.current?.(he)),_.current?.(X)}V.current=X===null?null:se,P(X),S(V.current)},[]),x=(0,re.useCallback)(X=>{V.current!=="keyboard"&&(V.current=X===null?null:"sync",P(X),S(V.current))},[]),M=(0,re.useCallback)(X=>{let se=H.current[X];se&&K.current?.(se)},[]),D=Wr(e.replayKey),U=e.width!==void 0||(a??0)>0,oe={enabled:u,active:d.visible&&U,near:d.near,replayKey:D,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Fe=(0,re.useCallback)((X,se=1)=>$===null||$===X?se:se*.38,[$]);return{p:n,width:s,height:l,measured:U,responsive:e.width===void 0,pending:ye&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:oe,fv:w,fmt:b,pct:T,locale:h,lang:f,t:f==="ko"?$r:vr,active:$,via:y,setActive:v,click:M,events:H,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Fe,sig:k,description:e.description,reduced:m,publish:_,applySync:x}}var ne=A(Z(),1);function Rs(e){return 1-Math.pow(1-e,3)}function Fs(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ps(e){return e==="easeInOut"?Fs:e==="linear"?t=>t:Rs}function _s(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 it(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function Yt(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 jo(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 Go(e,t,n,r){if(!t||!n||t.length!==n.length)return it(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let c of it(s,n[i]))o.push(c)}return o.length===r?o:it(e,r)}var Jt=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||!Yt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),jo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Yt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),c=r>0?Math.min(a*r,240):0;if(s){let l=i.to.length;s.from=Go(s.cur,s.parts,i.parts,l),s.vel=Go(s.curVel,s.parts,i.parts,l),s.parts=i.parts,s.to=i.to.slice(),jo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):c),s.done=Yt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let l=this.make(i,i.enter??i.from??i.to,n+c,0);l.done=Yt(l.from,l.to),this.tracks.set(i.key,l)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=it(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Ps(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let c=(t-s.t0)/1e3,l=s.to.length;if(s.from.length!==l&&(s.from=it(s.from,l)),s.vel.length!==l&&(s.vel=it(s.vel,l)),s.cur.length!==l&&(s.cur=new Array(l).fill(0),s.curVel=new Array(l).fill(0)),!(c>0)){for(let u=0;u<l;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(-a*c),d=a*c>=8&&a*c<20,h=0;for(let f=0;f<l;f++){let b=s.from[f]-s.to[f],T=s.vel[f]+a*b;s.cur[f]=s.to[f]+(b+T*c)*u,s.curVel[f]=(s.vel[f]-a*T*c)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*c>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*c)*u)}else{let u=Math.min(1,c/o),d=r(u),h=_s(this.easing,u)/o;for(let f=0;f<l;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<l;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},bt=new Set,qt=0;function Vo(e){qt=0;let t=Array.from(bt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||bt.delete(n)}bt.size&&typeof requestAnimationFrame<"u"&&(qt=requestAnimationFrame(Vo))}function Zt(e){return bt.add(e),!qt&&typeof requestAnimationFrame<"u"&&(qt=requestAnimationFrame(Vo)),()=>{bt.delete(e)}}function Ds(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 Vn(e,t){let n=(0,ne.useMemo)(()=>Ds(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:c="spring",duration:l=900,stagger:m=0}=t,u=(0,ne.useRef)(null),d=(0,ne.useRef)("init"),h=(0,ne.useRef)(null),f=(0,ne.useRef)(s),b=(0,ne.useRef)(i),T=(0,ne.useRef)(!1),w=(0,ne.useRef)(0),[,k]=(0,ne.useState)(0),$=(0,ne.useRef)(null),P=(0,ne.useRef)(!0);u.current||(u.current=new Jt,u.current.configure(c,l),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(c,l),h.current!==n){let _=d.current,F=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||_==="init"?y.snap(n):_==="idle"?y.hold(n):_==="running"||F?y.update(n,St(),m):y.snap(n),h.current=n,f.current=s}let S=(0,ne.useRef)(()=>!1);S.current=_=>{if(!P.current)return!1;let F=y.step(_);return!F&&d.current==="running"&&(d.current="done"),k(v=>(v+1)%1e9),F||($.current=null),F};let H=(0,ne.useCallback)(()=>{if(!ye||$.current||!y.animating)return;let _=F=>S.current(F);$.current=Zt(_)},[y]);Ae(()=>{let _=!Object.is(b.current,i);if(b.current=i,!r){(d.current!=="done"||y.animating)&&(y.snap(h.current??n),d.current="done",k(F=>F+1));return}d.current==="init"||_&&a?(y.hold(h.current??n),d.current="idle",T.current=!1,k(F=>F+1)):_&&(T.current=!0)},[r,i]),Ae(()=>{!r||!a||!T.current||(T.current=!1,y.hold(h.current??n),d.current="idle",k(_=>_+1))},[a,r]),(0,ne.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(St()),w.current+=1,d.current="running",H(),k(_=>_+1))},[r,o,i,y,H]),(0,ne.useEffect)(()=>{y.animating&&H()}),(0,ne.useEffect)(()=>(P.current=!0,()=>{P.current=!1,$.current?.(),$.current=null}),[]);let I=St(),K=y.elapsed(I),V=r&&d.current==="idle";return{items:y.items(),get:_=>y.get(_),elapsed:V?0:K,fade:(_,F=320)=>V?0:Number.isFinite(K)?Math.max(0,Math.min(1,(K-_)/F)):1,waiting:V,animating:y.animating,generation:w.current}}var Wn=A(G(),1);function Ko(e,t,n,r,o){if(r)return o==="categorical"?ke(e,t,n):Rr(e,t,n);if(o==="categorical")return ke(e,t,n);let a=ae(e,"strong"),i=ae(e,"accent");return Array.from({length:t},(s,c)=>n.has(c)?i:a)}var Ls=A(Z(),1);var Kn=A(G(),1);var Uo=e=>e?"neutralStrong":"accent";var W=A(Z(),1);var j=A(G(),1),Es={kind:"Bar race chart",play:"Play",pause:"Pause",prev:"Previous frame",next:"Next frame",frame:"Frame",rank:"Rank",nth:e=>`${e}${e%100>=11&&e%100<=13?"th":["th","st","nd","rd"][e%10]??"th"}`,up:e=>`up ${xe(e,"place")}`,down:e=>`down ${xe(e,"place")}`,desc:(e,t,n,r)=>`${xe(e,"item")} ranked over ${xe(t,"frame")}, from ${n} to ${r}`,lead:(e,t,n)=>`At ${e}, ${t} leads with ${n}`},Is={en:Es,ko:{kind:"막대 레이스",play:"재생",pause:"멈춤",prev:"이전 시점",next:"다음 시점",frame:"시점",rank:"순위",nth:e=>`${e}위`,up:e=>`${e}계단 오름`,down:e=>`${e}계단 내림`,desc:(e,t,n,r)=>`항목 ${e}개의 순위, ${n}부터 ${r}까지 시점 ${t}개`,lead:(e,t,n)=>`${e} 1위 ${t}, ${n}`}},Re=4,Os=10,zs=1e3,Bs=18,Xo=24,Hs=18,js=8,Qt={play:["M6.75 12C6.75 8.81 6.75 7.214 7.725 6.544C7.822 6.477 7.925 6.417 8.032 6.366C9.1 5.857 10.482 6.655 13.245 8.25C16.008 9.845 17.389 10.642 17.483 11.821C17.493 11.94 17.493 12.06 17.483 12.179C17.389 13.358 16.008 14.155 13.245 15.75C10.482 17.345 9.1 18.143 8.032 17.634C7.925 17.583 7.822 17.523 7.725 17.456C6.75 16.786 6.75 15.19 6.75 12Z"],pause:["M6.75 5.25L8.25 5.25C8.957 5.25 9.311 5.25 9.53 5.47C9.75 5.689 9.75 6.043 9.75 6.75L9.75 17.25C9.75 17.957 9.75 18.311 9.53 18.53C9.311 18.75 8.957 18.75 8.25 18.75L6.75 18.75C6.043 18.75 5.689 18.75 5.47 18.53C5.25 18.311 5.25 17.957 5.25 17.25L5.25 6.75C5.25 6.043 5.25 5.689 5.47 5.47C5.689 5.25 6.043 5.25 6.75 5.25Z","M15.75 5.25L17.25 5.25C17.957 5.25 18.311 5.25 18.53 5.47C18.75 5.689 18.75 6.043 18.75 6.75L18.75 17.25C18.75 17.957 18.75 18.311 18.53 18.53C18.311 18.75 17.957 18.75 17.25 18.75L15.75 18.75C15.043 18.75 14.689 18.75 14.47 18.53C14.25 18.311 14.25 17.957 14.25 17.25L14.25 6.75C14.25 6.043 14.25 5.689 14.47 5.47C14.689 5.25 15.043 5.25 15.75 5.25Z"],prev:["M18.75 12C18.75 8.969 18.75 7.453 17.824 6.816C17.731 6.753 17.633 6.696 17.532 6.648C16.517 6.164 15.205 6.922 12.58 8.437C9.954 9.953 8.642 10.711 8.553 11.831C8.544 11.943 8.544 12.057 8.553 12.169C8.642 13.289 9.954 14.047 12.58 15.563C15.205 17.078 16.517 17.836 17.532 17.352C17.633 17.304 17.731 17.247 17.824 17.184C18.75 16.547 18.75 15.031 18.75 12Z","M5.25 6.75V17.25"],next:["M5.25 12C5.25 8.969 5.25 7.453 6.176 6.816C6.269 6.753 6.367 6.696 6.468 6.648C7.483 6.164 8.795 6.922 11.42 8.437C14.046 9.953 15.358 10.711 15.447 11.831C15.456 11.943 15.456 12.057 15.447 12.169C15.358 13.289 14.046 14.047 11.421 15.563C8.795 17.078 7.483 17.836 6.468 17.352C6.367 17.304 6.269 17.247 6.176 17.184C5.25 16.547 5.25 15.031 5.25 12Z","M18.75 6.75V17.25"]};function Gs(e,t){if(t==null||t==="")return-1;if(e.type!=="band"){let o=zn(e.type,t),a=Number.isFinite(o)?e.xnum.indexOf(o):-1;if(a>=0)return a}let n=String(t),r=e.keys.indexOf(n);return r>=0?r:e.labels.indexOf(n)}function Xn(e){let t=le(e.locale),n=(0,W.useMemo)(()=>{let p=Ue(e.data,e.frame??"frame",e.value??"value",e.label??"label",{locale:t,aggregate:e.aggregate??"sum"});if(p.type==="date"&&new Set(p.labels).size<p.labels.length){let R=p.xnum.every(O=>new Date(O).getDate()===1),L=new Intl.DateTimeFormat(t,R?{year:"numeric",month:"short"}:{year:"numeric",month:"short",day:"numeric"});return{...p,labels:p.xnum.map(O=>L.format(O))}}return p},[e.data,e.frame,e.value,e.label,e.aggregate,t]),r=n.keys.length,o=n.series.length,a=Math.max(0,r-1),i=(0,W.useMemo)(()=>{let p=new Map;return R=>{let L=p.get(R);if(L)return L;p.size>=4&&p.clear();let O=[],E=new Int32Array(o);if(R>=0&&R<r)for(let C=0;C<o;C++)n.series[C]!==""&&Number.isFinite(n.values[C][R])&&O.push(C);return O.sort((C,z)=>n.values[z][R]-n.values[C][R]||C-z),O.forEach((C,z)=>E[C]=z+1),L={order:O,pos:E},p.set(R,L),L}},[n,r,o]),s=(0,W.useMemo)(()=>{let p=0,R=0,L=0,O=!0;for(let E=0;E<r;E++){let C=0;for(let z=0;z<o;z++){let B=n.values[z][E];!Number.isFinite(B)||n.series[z]===""||(C++,B>R&&(R=B),B<L&&(L=B),O&&!Number.isInteger(B)&&(O=!1))}p=Math.max(p,C)}return{most:p,hi:R,lo:L,ints:O}},[n,r,o]),c=typeof e.top=="number"&&e.top>=1?Math.min(50,Math.round(e.top)):Os,l=Math.max(1,Math.min(c,s.most)),m=typeof e.stepMs=="number"&&e.stepMs>0?Le(e.stepMs,100,6e4):zs,u=(0,W.useMemo)(()=>et(_e(e.format,t),e.unit),[e.format,t,e.unit]),d=(0,W.useMemo)(()=>{let p=Array.from({length:l},()=>[]),R=new Float64Array(r),L=new Float64Array(r),O=(C,z,B,ee,Y)=>{let q=(Math.max(0,B)-R[ee])/(L[ee]-R[ee]),ue=ce(u(B),11,700);for(let ge=C;ge<=z;ge++)p[ge].push(q,ue,Y?1:0)},E=(C,z)=>C.pos[z]&&C.pos[z]<=l?C.pos[z]-1:l;for(let C=0;C<r;C++){let z=i(C),B=C?i(C-1):null;for(let Y of z.order.slice(0,l))R[C]=Math.min(R[C],n.values[Y][C]),L[C]=Math.max(L[C],n.values[Y][C]);L[C]===R[C]&&(L[C]=R[C]+1);let ee=new Set([...z.order.slice(0,l),...B?B.order.slice(0,l):[]]);for(let Y of ee){let q=E(z,Y),ue=B?E(B,Y):q,ge=Math.min(ue,q),Je=Math.min(l-1,Math.max(ue,q)),Mt=q<l?!!(B&&B.pos[Y]&&B.pos[Y]!==z.pos[Y]):!0;B&&O(ge,Je,ue<l?n.values[Y][C-1]:n.values[Y][C],C-1,Mt),O(ge,Je,q<l?n.values[Y][C]:n.values[Y][C-1],C,Mt)}}return p},[i,n,r,l,u]),h=(0,W.useMemo)(()=>Math.max(0,...n.series.slice(0,2e3).map(p=>ce(p,1,800))),[n]),f=(0,W.useMemo)(()=>Math.max(0,...Array.from(n.labels,p=>ce(p,1,800))),[n]),b=e.showLabels!==!1,T=e.height,w=(0,W.useMemo)(()=>{let p=(O,E)=>{let C=Math.max(1,E/l),z=C>=12,B=C>=22?11.5:10.5,ee=b&&z,Y=Math.min(O*.3,Math.max(20,h*B)+10),q=ee?Math.max(ce(u(s.hi),11,700),ce(u(s.lo),11,700))+8:0,ue=ee&&r>1?ce(String(o),10,700)+18:0,ge=Y+6,Je=Math.max(ge+1,O-q-ue-4);return{plotH:E,rowH:C,showText:z,nameSize:B,showValues:ee,nameW:Y,markW:ue,x0:ge,x1:Je}},R=(O,E)=>{let C=B=>{let ee=0,Y=d[B];for(let q=0;q<Y.length;q+=3)ee=Math.max(ee,E.x0+Y[q]*(E.x1-E.x0)+(E.showValues?6+Y[q+1]+(Y[q+2]?E.markW:0):0));return ee},z=Math.min(72,E.plotH*.3,(E.x1-E.x0)*.6/Math.max(.1,f));for(let B=z;B>=Bs;B-=2){let ee=O-2-f*B-js,Y=Math.max(0,Math.floor((E.plotH-B*.82)/E.rowH)),q=!0;for(let ue=Y;ue<l&&q;ue++)q=C(ue)<=ee;if(q)return B}return 0},L=new Map;return(O,E)=>{let C=`${O}|${E}`,z=L.get(C);if(z)return z;let B=E===void 0?l*(O<400?26:30):Math.max(1,E-Re*2),ee=p(O,B),Y=f>0&&o?R(O,ee):0;return z=Y||!f||!o?{...ee,band:0,label:Y}:{...p(O,E===void 0?B:Math.max(1,B-Xo)),band:Xo,label:Hs},L.size>8&&L.clear(),L.set(C,z),z}},[d,l,r,o,h,f,b,u,s.hi,s.lo]),k=Ho(e,{height:p=>{let R=w(p);return R.plotH+Re*2+R.band},duration:700,stagger:40}),{p:$,width:P,height:y}=k,S=Is[k.lang],H=(0,W.useId)().replace(/:/g,""),I=(0,W.useMemo)(()=>{let p=Gs(n,e.startFrame);return p>=0?p:a},[n,e.startFrame,a]),[K,V]=(0,W.useState)(I),[_,F]=(0,W.useState)(I);_!==I&&(F(I),V(I));let v=Math.min(K,a),[x,M]=(0,W.useState)(!1),D=r>1&&!k.reduced,U=(0,W.useRef)("step"),oe=(0,W.useRef)(v);oe.current=v;let Fe=(0,W.useRef)(!1),X=(p,R)=>{U.current=R,oe.current=p,V(p)},se=k.motion.active;(0,W.useEffect)(()=>{if(!x||!D||!se)return;let p=0,R=0,L=null,O=C=>{if(R+=p?Math.min(C-p,m):0,p=C,R<m)return!0;R=0;let z=oe.current+1;return X(Math.min(z,a),"play"),z>=a&&M(!1),!0},E=()=>{L?.(),L=null,p=0,document.hidden||(L=Zt(O))};return E(),document.addEventListener("visibilitychange",E),()=>{L?.(),document.removeEventListener("visibilitychange",E)}},[x,D,se,m,a]);let he=(0,W.useRef)(!1);(0,W.useEffect)(()=>{!e.autoplay||he.current||!D||!k.motion.enabled||!se||(he.current=!0,e.startFrame===void 0&&X(0,"step"),M(!0))},[e.autoplay,e.startFrame,D,k.motion.enabled,se]);let Ce=()=>{if(x)return M(!1);Fe.current=!1,oe.current>=a&&X(0,"step"),M(!0)},st=(p,R=!1)=>{M(!1),Fe.current=!0;let L=Le(p,0,a);if(R&&k.active!==null){let O=Se[k.active]?.s,E=O===void 0?-1:i(L).order.slice(0,l).indexOf(O);k.setActive(E>=0?E:null,"keyboard")}L!==oe.current&&X(L,"step")},Ie=i(v),en=i(v-1),Qn=p=>en.pos[p]&&Ie.pos[p]?en.pos[p]-Ie.pos[p]:0,Se=(0,W.useMemo)(()=>Ie.order.slice(0,l).map((p,R)=>({s:p,slot:R,value:n.values[p][v],move:Qn(p)})),[Ie,en,l,n,v]),je=0,Ge=0;for(let p of Se)je=Math.min(je,p.value),Ge=Math.max(Ge,p.value);Ge===je&&(Ge=je+1);let Xe=(0,W.useMemo)(()=>{let p=n.rows.map(R=>R.findLast(L=>L!==null)??null);return Te(e.highlight,p,n.series,n.series.map((R,L)=>n.values[L][a]),"max")},[n,e.highlight,a]),er=(0,W.useMemo)(()=>Rt($,o,Xe),[$,o,Xe]),tr=U.current==="play",nr={...k.motion,dataKey:`${k.sig}|${v}`,stagger:0,duration:e.duration??(tr?m:700),easing:e.easing??(tr?"linear":k.motion.easing)},rr=k.motion.stagger??40,ga=(0,W.useMemo)(()=>Se.map(p=>({key:`r:${n.series[p.s]}`,to:[p.value,p.slot],from:[0,p.slot],enter:[p.value,l],exit:[p.value,l],delay:p.slot*rr,data:p})),[Se,n,l,rr]),pa=Vn(ga,nr),ba=(0,W.useMemo)(()=>[{key:"d",to:[je,Ge],data:null}],[je,Ge]),ya=Vn(ba,nr),[tn,or]=ya.get("d")??[je,Ge],xt=w(P,T===void 0?void 0:y),{plotH:kt,rowH:wt,showText:xa,nameSize:nn,showValues:ar,nameW:rn,x0:ir,x1:ka}=xt,lt=Math.max(1,wt*.7),{fv:Ve}=k,wa=(0,W.useMemo)(()=>n.series.map((p,R)=>Dn(p,rn-4,nn,Xe.has(R)?800:500)),[n,rn,nn,Xe]),va=or-tn>0?or-tn:1,Ye=p=>ir+(p-tn)/va*(ka-ir),sr=p=>Re+p*wt+(wt-lt)/2,vt=Math.min($.theme.radiusMark,lt/2),on=S.nth,an=p=>p>0?S.up(p):S.down(-p),lr=(0,W.useMemo)(()=>Se.map(p=>({datum:n.rows[p.s][v],index:p.slot,key:n.series[p.s],label:n.series[p.s],value:p.value,formatted:`${Ve(p.value)}, ${on(p.slot+1)}${p.move?`, ${an(p.move)}`:""}`})),[Se,n,v,Ve,S]),ct=n.labels[v]??"",cr=p=>{let R=Qn(p);return`${ct}, ${n.series[p]}, ${on(Ie.pos[p])}, ${Ve(n.values[p][v])}${R?`, ${an(R)}`:""}`},ur=[...Xe].find(p=>Ie.pos[p]>0)??Ie.order[0],$a=k.via==="keyboard"&&k.active!==null&&Se[k.active]?cr(Se[k.active].s):Fe.current&&!x&&ur!==void 0?cr(ur):"",sn=Se[0],Ma=e.description??(sn?`${S.kind}. ${S.desc(Ie.order.length,r,n.labels[0],n.labels[a])}. ${S.lead(ct,n.series[sn.s],Ve(sn.value))}.`:""),Pe=k.active!==null?Se[k.active]:void 0,Ta=Pe?{x:Ye(Math.max(0,Pe.value)),y:sr(Pe.slot),title:n.series[Pe.s],rows:[{label:ct,value:Ve(Pe.value),color:er[Pe.s].fill},{label:S.rank,value:`${on(Pe.slot+1)}${Pe.move?` (${an(Pe.move)})`:""}`,strong:!1}]}:null,$t=xt.label,Ca=xt.band?Re+kt+Re+xt.band-7:Re+kt-$t*.08,Sa=k.reduced&&k.hydrated;return(0,j.jsxs)(Ur,{c:k,kind:S.kind,ariaLabel:e.ariaLabel,description:Ma,events:lr,tip:Ta,renderTip:e.tooltip,announce:$a,className:e.className,style:e.style,theme:e.theme,onPointerMove:(p,R,L)=>{let O=Math.floor((R-Re)/wt);k.setActive(O>=0&&O<lr.length?O:null,L.pointerType==="touch"?"touch":"pointer")},onKey:p=>(p.key==="ArrowLeft"||p.key==="ArrowRight")&&r>1?(st(oe.current+(p.key==="ArrowRight"?1:-1),!0),!0):p.key===" "&&D?(Ce(),!0):!1,defs:(0,j.jsx)("clipPath",{id:`${H}c`,children:(0,j.jsx)("rect",{x:0,y:0,width:P,height:kt+Re*2})}),overlay:r>1&&o?(0,j.jsx)(Ws,{p:$,msg:S,frame:v,last:a,labels:n.labels,playing:x,stepOnly:Sa,canPlay:D,narrow:P<340,onToggle:Ce,onStep:st}):null,children:[o&&ct&&$t?(0,j.jsx)(ft,{x:P-2,y:Ca,anchor:"end",baseline:"auto",size:$t,weight:800,fill:$.paint("dim"),opacity:.45,letterSpacing:-$t*.03,children:ct}):null,s.lo<0?(0,j.jsx)("line",{x1:Ye(0),x2:Ye(0),y1:Re,y2:Re+kt,stroke:$.paint("line"),strokeWidth:1}):null,(0,j.jsx)("g",{clipPath:`url(#${H}c)`,children:pa.items.map(p=>{let R=p.data;if(p.exiting&&p.key!==`r:${n.series[R.s]}`)return null;let[L,O]=p.v,E=sr(O),C=Ye(Math.min(0,L)),z=Ye(Math.max(0,L)),B=Xe.has(R.s),ee=!p.exiting&&k.active===R.slot,q=Le(l-O,0,1)*(k.active===null||ee?1:.55),ue=Ve(p.progress>=1?R.value:s.ints?Math.round(L):L),ge=(L<0?Ye(0):z)+6,Je=B?800:500,Mt=$.paint(B?"ink":"muted"),ln=E+lt/2;return(0,j.jsxs)("g",{opacity:q<1?q:void 0,children:[(0,j.jsx)("path",{d:_n(C,E,z-C,lt,L<0?{tl:vt,bl:vt}:{tr:vt,br:vt}),fill:er[R.s].fill,className:"ztd-mark"}),ee&&k.via==="keyboard"?(0,j.jsx)("path",{d:_n(C-2,E-2,z-C+4,lt+4,4),fill:"none",stroke:$.paint("ink"),strokeWidth:2}):null,xa?(0,j.jsx)(ft,{x:rn,y:ln,anchor:"end",size:nn,weight:Je,fill:Mt,children:wa[R.s]}):null,ar?(0,j.jsx)(ft,{x:ge,y:ln,size:11,weight:B?800:700,fill:$.paint("ink"),children:ue}):null,ar&&R.move?(0,j.jsx)(Vs,{p:$,x:ge+ce(Ve(R.value),11,700)+6,y:ln,move:R.move}):null]},p.key)})})]})}function Vs({p:e,x:t,y:n,move:r}){let o=r>0,a=e.paint(o?"accentText":"muted");return(0,j.jsxs)("g",{"aria-hidden":"true",children:[(0,j.jsx)("path",{d:o?`M${t},${n+3}h7l-3.5,-6z`:`M${t},${n-3}h7l-3.5,6z`,fill:a}),(0,j.jsx)(ft,{x:t+9,y:n,size:10,weight:700,fill:a,children:Math.abs(r)})]})}function Un({d:e}){return(0,j.jsx)("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:e.map((t,n)=>(0,j.jsx)("path",{d:t},n))})}function Ws(e){let{p:t,msg:n,frame:r,last:o}=e,a=(0,W.useRef)(null),i={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"},s={fontSize:11,color:t.paint("muted"),whiteSpace:"nowrap",flex:"none",fontVariantNumeric:"tabular-nums"},c=u=>{let d=a.current?.getBoundingClientRect();if(!d||!d.width)return;let h=Math.round(Le((u.clientX-d.left)/d.width,0,1)*o);h!==r&&e.onStep(h)},l=u=>{let d=Math.max(1,Math.round((o+1)/10)),h={ArrowLeft:r-1,ArrowDown:r-1,ArrowRight:r+1,ArrowUp:r+1,PageDown:r-d,PageUp:r+d,Home:0,End:o};u.key in h&&(u.preventDefault(),e.onStep(h[u.key]))},m=o?r/o*100:0;return(0,j.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:8},children:[e.stepOnly?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":n.prev,title:n.prev,disabled:r<=0,onClick:()=>e.onStep(r-1),style:{...i,opacity:r<=0?.4:void 0},children:(0,j.jsx)(Un,{d:Qt.prev})}),(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":n.next,title:n.next,disabled:r>=o,onClick:()=>e.onStep(r+1),style:{...i,opacity:r>=o?.4:void 0},children:(0,j.jsx)(Un,{d:Qt.next})})]}):(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":e.playing?n.pause:n.play,title:e.playing?n.pause:n.play,disabled:!e.canPlay,onClick:e.onToggle,style:i,children:(0,j.jsx)(Un,{d:e.playing?Qt.pause:Qt.play})}),e.narrow?null:(0,j.jsx)("span",{style:s,children:e.labels[0]}),(0,j.jsxs)("div",{ref:a,role:"slider",tabIndex:0,className:"ztd-btn","aria-label":n.frame,"aria-valuemin":0,"aria-valuemax":o,"aria-valuenow":r,"aria-valuetext":e.labels[r],onKeyDown:l,onPointerDown:u=>{u.currentTarget.setPointerCapture?.(u.pointerId),c(u)},onPointerMove:u=>{u.currentTarget.hasPointerCapture?.(u.pointerId)&&c(u)},style:{position:"relative",flex:1,minWidth:60,height:28,touchAction:"none",borderRadius:14},children:[(0,j.jsx)("span",{style:{position:"absolute",left:0,right:0,top:12,height:4,borderRadius:2,background:t.paint("line")}}),(0,j.jsx)("span",{style:{position:"absolute",left:0,width:`${m}%`,top:12,height:4,borderRadius:2,background:t.paint("accent")}}),(0,j.jsx)("span",{style:{position:"absolute",left:`calc(${m}% - 7px)`,top:7,width:14,height:14,boxSizing:"border-box",borderRadius:7,border:`2px solid ${t.paint("accent")}`,background:t.paint("panel")}})]}),e.narrow?null:(0,j.jsx)("span",{style:s,children:e.labels[o]})]})}var Yn=A(G(),1);function Yo(e,t,n,r){if(typeof e!="function")return Te(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let c=o.get(r(i,s));c!==void 0&&e(i,s)&&a.add(c)}),a}var Ks=A(Z(),1);var qn=A(G(),1),Us={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}, ${xe(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Jo={en:Us,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}일 이동평균`}},Jn=["ink","muted","dim"];function qo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Jn.length)}var Xs=A(Z(),1);var na=A(G(),1),Ys={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${xe(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Js={en:Ys,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Zo=(e,t)=>Js[e].other(t);function Qo(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,lo(o.map(a=>a.value)))}}var ea=e=>Number.isFinite(e)&&e>0?e:0;function ta(e,t,n,r){return r==="emphasis"?Rt(e,t,n):ke(e,t,n)}var qs=A(Z(),1);var ia=A(G(),1);function ra(e,t){return t===!1?e.map((n,r)=>r):so(e)}function oa(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Te(e,t,t,r,"max")}function aa(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=ae(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?ae(e,"neutral"):Nt(e,1-i/Math.max(1,o.length-1))),r}function sa(e){return!e||typeof e!="object"||Array.isArray(e)?[]:$e(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function la(e,t){return mt(e,t+1,new Set)}var Zs=A(Z(),1);var ua=A(G(),1);var Qs=26;var Ou=Qs*.62;function ca(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!No.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Ee=A(G(),1);function ma(e,t,n){let r=Ht(e);return r?.type==="scatter"&&t?.size!==void 0&&!Bt(n)?Ht("bubble"):r}function el(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function tl(e,t,n,r=!1){let o=ma(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,c=new Set(!r&&Nn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),l=u=>u.filter(d=>!c.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=De(a.label,"label"),d=jt(a.value,"value"),h=o.type==="waffle",f=t.map((y,S)=>({r:y,label:u(y,S),value:h?d(y,S):ea(d(y,S))})),{kept:b,other:T}=h?{kept:f,other:null}:Qo(f,i.other,(y,S)=>({r:{},label:Zo(te(n),y),value:S})),w=Te(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),h?"first":"max"),k=T?[...b,T]:b,$=ze(y=>h?ke(y,k.length,w):ta(y,k.length,w,i.colorMode)),P=h&&i.shape==="arc";return k.map((y,S)=>({label:y.label,color:$[S],...P&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=qo(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Jo[te(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:Jn[f],shape:"line"}))]}if(o.type==="network"){let u=sa(i.groups);if(u.length<2)return[];let d=ze(h=>la(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=De(a.group,"group"),d=$e(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=ze(f=>mt(f,d.length,new Set));return d.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Bt(i))return[];let u=De(a.series,"series"),d=$e(t.map((b,T)=>u(b,T)));if(d.length<2)return[];let h=Yo(s,t,d,u),f=ze(b=>mt(b,d.length,h));return l(d.map((b,T)=>({label:b,color:f[T],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let h=zo(t,d,u),f=ze(b=>ke(b,h.length,ca(s,h)));return l(h.map((b,T)=>({label:b,color:f[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let $=De(a.series,"series");u=$e(t.map((P,y)=>$(P,y)))}let d=Rn(o.type,a,i);if(d.length){let $=Te(s,u,u,u.map(()=>0),"none"),P=ze(S=>ke(S,u.length,$)),y=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((S,H)=>({label:S,color:P[H]}));return[...l(y),...d.map((S,H)=>({label:S,color:Uo(H),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?io(u.length,Array.isArray(i.negative)?i.negative.map($=>u.indexOf(String($))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,b=f>=0?new Set([f]):Te(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return l(u.map(($,P)=>({label:$,color:b.has(P)?"accent":"neutralStrong",shape:"square"})));let T=i.colorMode,w=$=>ke($,u.length,b);if((o.type==="line"||o.type==="area")&&(w=$=>Ko($,u.length,b,o.type==="area",T)),o.type==="stream"){let $=Ue(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),P=ra($.values,i.reorder),y=oa(s,$.series,$.values);w=S=>aa(S,P,y)}let k=ze(w);return l(u.map(($,P)=>({label:$,color:k[P],...o.type==="line"&&{shape:"line"}})))}return[]}function nl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Zr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function rl(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:c,description:l,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:c,description:l}}function da(e,t){let{spec:n}=e,r=ma(n.type,n.encoding,n.options),o=(0,yt.useMemo)(()=>Bo(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=qr(n,e.locale),s=le(i),c=te(s),l=Ro(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=to(n),u=(0,yt.useMemo)(()=>m?Io(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,T]=(0,yt.useState)(null);if(!r)return(0,Ee.jsx)(An,{error:c==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let w=o??l.data,k=t[r.type],$={...n.options??{}},P={...el(r,n.encoding),...$,...u?{tooltip:u}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},y=n.card?.legend==="toggle"&&eo(r.type,n.encoding??{},$),S=b&&b.base===f?b.hidden:h;y&&(P.hidden=S);let H=F=>T(v=>{let x=v&&v.base===f?v.hidden:h;return{base:f,hidden:x.includes(F)?x.filter(M=>M!==F):[...x,F]}}),I=P.height??220,K=nl(n,r.type),V=a&&!w.length&&(l.loading||l.error||l.empty)?(0,Ee.jsx)(An,{loading:l.loading,error:l.error,empty:l.empty,onRetry:l.reload,height:I,locale:i}):K?(0,Ee.jsx)(Ao,{chart:k,...rl(r.type,K,P)}):(0,Ee.jsx)(k,{...P});if(n.card){let F=n.card,v=F.legend==="auto"||F.legend==="toggle"?tl(n,w,s,y):F.legend,x=v?.length?y?(0,Ee.jsx)(Sn,{items:v,hidden:S,onToggle:H,locale:i}):v:void 0,M=F.download?(0,Ee.jsx)(Eo,{data:w,columns:no(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;V=(0,Ee.jsx)(Kr,{number:F.number,title:F.title??Jr(r,c),subtitle:F.subtitle,legend:x,actions:M,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:V})}let _=e.theme??n.theme;return _&&(V=(0,Ee.jsx)(Lt,{theme:_,children:V})),V}function ol({cfg:e,components:t}){let n=ot();return da({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ha(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,fa.hydrateRoot)(r,(0,Zn.createElement)(Lt,{theme:o.theme,cssVars:!0},(0,Zn.createElement)(ol,{cfg:o,components:{[e]:t}})))}ha("barRace",Xn);})();
27
+ `}function Ns(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function jn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Po=2,je=16;function _o(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Do(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 Lo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,c]=[a+je*2,i+je*2],l=o.cloneNode(!0),m=l.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,b)=>{let T;for(let w of Array.from(f.attributes)){if(!Cs.test(w.value))continue;let k=(T??(T=getComputedStyle(f))).getPropertyValue(w.name);k&&m[b].setAttribute(w.name,_o(k,u))}}),l.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-je} ${-je} ${s} ${c}`,width:s*t,height:c*t,"font-family":getComputedStyle(o).fontFamily}))l.setAttribute(f,String(b));let d=_o(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=l.querySelector("desc")?.nextSibling??l.firstChild;l.insertBefore(Do("rect",{x:-je,y:-je,width:s,height:c,fill:d}),f),h&&l.insertBefore(Do("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(l),w:s,h:c,vw:a,vh:i,bg:d,canvas:h}}function Rs(e,t){let n=Lo(e,Po,!1);if(!n)return;let r=Po,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,je*r,je*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(c=>c&&jn(c,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Eo(e){let t=ve(e.theme),n=te(le(e.locale))==="ko",r=Ns(e.filename),o=(a,i)=>{if(a==="csv")return jn(new Blob([As(e.data,e.columns?.length?e.columns:Ss(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Rs(i,r);let s=Lo(i,1,!0);s&&jn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Gn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Ms.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Gn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:c=>o(a,c.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Io=A(G(),1);function Oo(e,t=me){let n=De(void 0,t),r=e.split(`
28
+ `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?ht(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let c=!1,l=s.replace(zr,(m,u)=>o(a,u.trim())??(c=!0,""));c||i.push(l)}return i.length?i.map((s,c)=>(0,Io.jsx)("div",{children:s},c)):null}}function zo(e,t,n=!1){let r=Le(t,"group"),o=e.map((s,c)=>r(s,c)).filter(Boolean),a=$e(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,c)=>[s,c]).sort((s,c)=>i.get(s[0])-i.get(c[0])||s[1]-c[1]).map(([s])=>s)}function Bo(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 Ue(t.csv)}return null}var Wo=A(Z(),1);var re=A(Z(),1);function Ho(e,t){let n=ve(e.theme),[r,o,a]=Xt(e.width),i=at(),s=e.width??(a||t.ssrWidth||480),c=typeof t.height=="function"?t.height(s):t.height,l=e.height??c,m=Yt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ye,d=So(r,e.animateOnView!==!1&&u),h=le(e.locale),f=te(h),b=(0,re.useMemo)(()=>De(e.format,h,t.format),[e.format,h,t.format]),T=(0,re.useCallback)(X=>Pt(X,{locale:h}),[h]),w=(0,re.useMemo)(()=>tt(b,e.unit),[b,e.unit]),k=(0,re.useMemo)(()=>Vt(e.data),[e.data]),[$,P]=(0,re.useState)(null),[y,S]=(0,re.useState)(null),H=(0,re.useRef)([]),O=(0,re.useRef)(e.onHover);O.current=e.onHover;let K=(0,re.useRef)(e.onClick);K.current=e.onClick;let V=(0,re.useRef)(null),_=(0,re.useRef)(null),F=(0,re.useRef)(null),v=(0,re.useCallback)((X,se="pointer")=>{if(F.current!==X){F.current=X;let he=X===null?null:H.current[X]??null;queueMicrotask(()=>O.current?.(he)),_.current?.(X)}V.current=X===null?null:se,P(X),S(V.current)},[]),x=(0,re.useCallback)(X=>{V.current!=="keyboard"&&(V.current=X===null?null:"sync",P(X),S(V.current))},[]),M=(0,re.useCallback)(X=>{let se=H.current[X];se&&K.current?.(se)},[]),D=Wr(e.replayKey),U=e.width!==void 0||(a??0)>0,oe={enabled:u,active:d.visible&&U,near:d.near,replayKey:D,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Fe=(0,re.useCallback)((X,se=1)=>$===null||$===X?se:se*.38,[$]);return{p:n,width:s,height:l,measured:U,responsive:e.width===void 0,pending:ye&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:oe,fv:w,fmt:b,pct:T,locale:h,lang:f,t:f==="ko"?$r:vr,active:$,via:y,setActive:v,click:M,events:H,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Fe,sig:k,description:e.description,reduced:m,publish:_,applySync:x}}var ne=A(Z(),1);function Fs(e){return 1-Math.pow(1-e,3)}function Ps(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function _s(e){return e==="easeInOut"?Ps:e==="linear"?t=>t:Fs}function Ds(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 st(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function Jt(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 jo(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 Go(e,t,n,r){if(!t||!n||t.length!==n.length)return st(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let c of st(s,n[i]))o.push(c)}return o.length===r?o:st(e,r)}var qt=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||!Jt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),jo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Jt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),c=r>0?Math.min(a*r,240):0;if(s){let l=i.to.length;s.from=Go(s.cur,s.parts,i.parts,l),s.vel=Go(s.curVel,s.parts,i.parts,l),s.parts=i.parts,s.to=i.to.slice(),jo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):c),s.done=Jt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let l=this.make(i,i.enter??i.from??i.to,n+c,0);l.done=Jt(l.from,l.to),this.tracks.set(i.key,l)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=st(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=_s(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let c=(t-s.t0)/1e3,l=s.to.length;if(s.from.length!==l&&(s.from=st(s.from,l)),s.vel.length!==l&&(s.vel=st(s.vel,l)),s.cur.length!==l&&(s.cur=new Array(l).fill(0),s.curVel=new Array(l).fill(0)),!(c>0)){for(let u=0;u<l;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(-a*c),d=a*c>=8&&a*c<20,h=0;for(let f=0;f<l;f++){let b=s.from[f]-s.to[f],T=s.vel[f]+a*b;s.cur[f]=s.to[f]+(b+T*c)*u,s.curVel[f]=(s.vel[f]-a*T*c)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*c>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*c)*u)}else{let u=Math.min(1,c/o),d=r(u),h=Ds(this.easing,u)/o;for(let f=0;f<l;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<l;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},xt=new Set,Zt=0;function Vo(e){Zt=0;let t=Array.from(xt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||xt.delete(n)}xt.size&&typeof requestAnimationFrame<"u"&&(Zt=requestAnimationFrame(Vo))}function Qt(e){return xt.add(e),!Zt&&typeof requestAnimationFrame<"u"&&(Zt=requestAnimationFrame(Vo)),()=>{xt.delete(e)}}function Ls(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 Vn(e,t){let n=(0,ne.useMemo)(()=>Ls(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:c="spring",duration:l=900,stagger:m=0}=t,u=(0,ne.useRef)(null),d=(0,ne.useRef)("init"),h=(0,ne.useRef)(null),f=(0,ne.useRef)(s),b=(0,ne.useRef)(i),T=(0,ne.useRef)(!1),w=(0,ne.useRef)(0),[,k]=(0,ne.useState)(0),$=(0,ne.useRef)(null),P=(0,ne.useRef)(!0);u.current||(u.current=new qt,u.current.configure(c,l),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(c,l),h.current!==n){let _=d.current,F=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||_==="init"?y.snap(n):_==="idle"?y.hold(n):_==="running"||F?y.update(n,At(),m):y.snap(n),h.current=n,f.current=s}let S=(0,ne.useRef)(()=>!1);S.current=_=>{if(!P.current)return!1;let F=y.step(_);return!F&&d.current==="running"&&(d.current="done"),k(v=>(v+1)%1e9),F||($.current=null),F};let H=(0,ne.useCallback)(()=>{if(!ye||$.current||!y.animating)return;let _=F=>S.current(F);$.current=Qt(_)},[y]);Ae(()=>{let _=!Object.is(b.current,i);if(b.current=i,!r){(d.current!=="done"||y.animating)&&(y.snap(h.current??n),d.current="done",k(F=>F+1));return}d.current==="init"||_&&a?(y.hold(h.current??n),d.current="idle",T.current=!1,k(F=>F+1)):_&&(T.current=!0)},[r,i]),Ae(()=>{!r||!a||!T.current||(T.current=!1,y.hold(h.current??n),d.current="idle",k(_=>_+1))},[a,r]),(0,ne.useEffect)(()=>{r&&o&&d.current==="idle"&&(y.start(At()),w.current+=1,d.current="running",H(),k(_=>_+1))},[r,o,i,y,H]),(0,ne.useEffect)(()=>{y.animating&&H()}),(0,ne.useEffect)(()=>(P.current=!0,()=>{P.current=!1,$.current?.(),$.current=null}),[]);let O=At(),K=y.elapsed(O),V=r&&d.current==="idle";return{items:y.items(),get:_=>y.get(_),elapsed:V?0:K,fade:(_,F=320)=>V?0:Number.isFinite(K)?Math.max(0,Math.min(1,(K-_)/F)):1,waiting:V,animating:y.animating,generation:w.current}}var Wn=A(G(),1);function Ko(e,t,n,r,o){if(r)return o==="categorical"?ke(e,t,n):Rr(e,t,n);if(o==="categorical")return ke(e,t,n);let a=ae(e,"strong"),i=ae(e,"accent");return Array.from({length:t},(s,c)=>n.has(c)?i:a)}var Es=A(Z(),1);var Kn=A(G(),1);var Uo=e=>e?"neutralStrong":"accent";var W=A(Z(),1);var j=A(G(),1);function Os(e,t){let n=_e(e.ink);if(!n||!_e(e.panel))return 1;for(let r=1;r<=100;r++)if(dt([n[0],n[1],n[2],n[3]*r/100],e.panel,e.bg)>=t+.05)return r/100;return 1}var Is={kind:"Bar race chart",play:"Play",pause:"Pause",prev:"Previous frame",next:"Next frame",frame:"Frame",rank:"Rank",nth:e=>`${e}${e%100>=11&&e%100<=13?"th":["th","st","nd","rd"][e%10]??"th"}`,up:e=>`up ${xe(e,"place")}`,down:e=>`down ${xe(e,"place")}`,desc:(e,t,n,r)=>`${xe(e,"item")} ranked over ${xe(t,"frame")}, from ${n} to ${r}`,lead:(e,t,n)=>`At ${e}, ${t} leads with ${n}`},zs={en:Is,ko:{kind:"막대 레이스",play:"재생",pause:"멈춤",prev:"이전 시점",next:"다음 시점",frame:"시점",rank:"순위",nth:e=>`${e}위`,up:e=>`${e}계단 오름`,down:e=>`${e}계단 내림`,desc:(e,t,n,r)=>`항목 ${e}개의 순위, ${n}부터 ${r}까지 시점 ${t}개`,lead:(e,t,n)=>`${e} 1위 ${t}, ${n}`}},Re=4,Bs=10,Hs=1e3,js=18,Xo=24,Gs=18,Vs=8,en={play:["M6.75 12C6.75 8.81 6.75 7.214 7.725 6.544C7.822 6.477 7.925 6.417 8.032 6.366C9.1 5.857 10.482 6.655 13.245 8.25C16.008 9.845 17.389 10.642 17.483 11.821C17.493 11.94 17.493 12.06 17.483 12.179C17.389 13.358 16.008 14.155 13.245 15.75C10.482 17.345 9.1 18.143 8.032 17.634C7.925 17.583 7.822 17.523 7.725 17.456C6.75 16.786 6.75 15.19 6.75 12Z"],pause:["M6.75 5.25L8.25 5.25C8.957 5.25 9.311 5.25 9.53 5.47C9.75 5.689 9.75 6.043 9.75 6.75L9.75 17.25C9.75 17.957 9.75 18.311 9.53 18.53C9.311 18.75 8.957 18.75 8.25 18.75L6.75 18.75C6.043 18.75 5.689 18.75 5.47 18.53C5.25 18.311 5.25 17.957 5.25 17.25L5.25 6.75C5.25 6.043 5.25 5.689 5.47 5.47C5.689 5.25 6.043 5.25 6.75 5.25Z","M15.75 5.25L17.25 5.25C17.957 5.25 18.311 5.25 18.53 5.47C18.75 5.689 18.75 6.043 18.75 6.75L18.75 17.25C18.75 17.957 18.75 18.311 18.53 18.53C18.311 18.75 17.957 18.75 17.25 18.75L15.75 18.75C15.043 18.75 14.689 18.75 14.47 18.53C14.25 18.311 14.25 17.957 14.25 17.25L14.25 6.75C14.25 6.043 14.25 5.689 14.47 5.47C14.689 5.25 15.043 5.25 15.75 5.25Z"],prev:["M18.75 12C18.75 8.969 18.75 7.453 17.824 6.816C17.731 6.753 17.633 6.696 17.532 6.648C16.517 6.164 15.205 6.922 12.58 8.437C9.954 9.953 8.642 10.711 8.553 11.831C8.544 11.943 8.544 12.057 8.553 12.169C8.642 13.289 9.954 14.047 12.58 15.563C15.205 17.078 16.517 17.836 17.532 17.352C17.633 17.304 17.731 17.247 17.824 17.184C18.75 16.547 18.75 15.031 18.75 12Z","M5.25 6.75V17.25"],next:["M5.25 12C5.25 8.969 5.25 7.453 6.176 6.816C6.269 6.753 6.367 6.696 6.468 6.648C7.483 6.164 8.795 6.922 11.42 8.437C14.046 9.953 15.358 10.711 15.447 11.831C15.456 11.943 15.456 12.057 15.447 12.169C15.358 13.289 14.046 14.047 11.421 15.563C8.795 17.078 7.483 17.836 6.468 17.352C6.367 17.304 6.269 17.247 6.176 17.184C5.25 16.547 5.25 15.031 5.25 12Z","M18.75 6.75V17.25"]};function Ws(e,t){if(t==null||t==="")return-1;if(e.type!=="band"){let o=zn(e.type,t),a=Number.isFinite(o)?e.xnum.indexOf(o):-1;if(a>=0)return a}let n=String(t),r=e.keys.indexOf(n);return r>=0?r:e.labels.indexOf(n)}function Xn(e){let t=le(e.locale),n=(0,W.useMemo)(()=>{let p=Xe(e.data,e.frame??"frame",e.value??"value",e.label??"label",{locale:t,aggregate:e.aggregate??"sum"});if(p.type==="date"&&new Set(p.labels).size<p.labels.length){let R=p.xnum.every(I=>new Date(I).getDate()===1),L=new Intl.DateTimeFormat(t,R?{year:"numeric",month:"short"}:{year:"numeric",month:"short",day:"numeric"});return{...p,labels:p.xnum.map(I=>L.format(I))}}return p},[e.data,e.frame,e.value,e.label,e.aggregate,t]),r=n.keys.length,o=n.series.length,a=Math.max(0,r-1),i=(0,W.useMemo)(()=>{let p=new Map;return R=>{let L=p.get(R);if(L)return L;p.size>=4&&p.clear();let I=[],E=new Int32Array(o);if(R>=0&&R<r)for(let C=0;C<o;C++)n.series[C]!==""&&Number.isFinite(n.values[C][R])&&I.push(C);return I.sort((C,z)=>n.values[z][R]-n.values[C][R]||C-z),I.forEach((C,z)=>E[C]=z+1),L={order:I,pos:E},p.set(R,L),L}},[n,r,o]),s=(0,W.useMemo)(()=>{let p=0,R=0,L=0,I=!0;for(let E=0;E<r;E++){let C=0;for(let z=0;z<o;z++){let B=n.values[z][E];!Number.isFinite(B)||n.series[z]===""||(C++,B>R&&(R=B),B<L&&(L=B),I&&!Number.isInteger(B)&&(I=!1))}p=Math.max(p,C)}return{most:p,hi:R,lo:L,ints:I}},[n,r,o]),c=typeof e.top=="number"&&e.top>=1?Math.min(50,Math.round(e.top)):Bs,l=Math.max(1,Math.min(c,s.most)),m=typeof e.stepMs=="number"&&e.stepMs>0?Ee(e.stepMs,100,6e4):Hs,u=(0,W.useMemo)(()=>tt(De(e.format,t),e.unit),[e.format,t,e.unit]),d=(0,W.useMemo)(()=>{let p=Array.from({length:l},()=>[]),R=new Float64Array(r),L=new Float64Array(r),I=(C,z,B,ee,Y)=>{let q=(Math.max(0,B)-R[ee])/(L[ee]-R[ee]),ue=ce(u(B),11,700);for(let ge=C;ge<=z;ge++)p[ge].push(q,ue,Y?1:0)},E=(C,z)=>C.pos[z]&&C.pos[z]<=l?C.pos[z]-1:l;for(let C=0;C<r;C++){let z=i(C),B=C?i(C-1):null;for(let Y of z.order.slice(0,l))R[C]=Math.min(R[C],n.values[Y][C]),L[C]=Math.max(L[C],n.values[Y][C]);L[C]===R[C]&&(L[C]=R[C]+1);let ee=new Set([...z.order.slice(0,l),...B?B.order.slice(0,l):[]]);for(let Y of ee){let q=E(z,Y),ue=B?E(B,Y):q,ge=Math.min(ue,q),Ze=Math.min(l-1,Math.max(ue,q)),Tt=q<l?!!(B&&B.pos[Y]&&B.pos[Y]!==z.pos[Y]):!0;B&&I(ge,Ze,ue<l?n.values[Y][C-1]:n.values[Y][C],C-1,Tt),I(ge,Ze,q<l?n.values[Y][C]:n.values[Y][C-1],C,Tt)}}return p},[i,n,r,l,u]),h=(0,W.useMemo)(()=>Math.max(0,...n.series.slice(0,2e3).map(p=>ce(p,1,800))),[n]),f=(0,W.useMemo)(()=>Math.max(0,...Array.from(n.labels,p=>ce(p,1,800))),[n]),b=e.showLabels!==!1,T=e.height,w=(0,W.useMemo)(()=>{let p=(I,E)=>{let C=Math.max(1,E/l),z=C>=12,B=C>=22?11.5:10.5,ee=b&&z,Y=Math.min(I*.3,Math.max(20,h*B)+10),q=ee?Math.max(ce(u(s.hi),11,700),ce(u(s.lo),11,700))+8:0,ue=ee&&r>1?ce(String(o),10,700)+18:0,ge=Y+6,Ze=Math.max(ge+1,I-q-ue-4);return{plotH:E,rowH:C,showText:z,nameSize:B,showValues:ee,nameW:Y,markW:ue,x0:ge,x1:Ze}},R=(I,E)=>{let C=B=>{let ee=0,Y=d[B];for(let q=0;q<Y.length;q+=3)ee=Math.max(ee,E.x0+Y[q]*(E.x1-E.x0)+(E.showValues?6+Y[q+1]+(Y[q+2]?E.markW:0):0));return ee},z=Math.min(72,E.plotH*.3,(E.x1-E.x0)*.6/Math.max(.1,f));for(let B=z;B>=js;B-=2){let ee=I-2-f*B-Vs,Y=Math.max(0,Math.floor((E.plotH-B*.82)/E.rowH)),q=!0;for(let ue=Y;ue<l&&q;ue++)q=C(ue)<=ee;if(q)return B}return 0},L=new Map;return(I,E)=>{let C=`${I}|${E}`,z=L.get(C);if(z)return z;let B=E===void 0?l*(I<400?26:30):Math.max(1,E-Re*2),ee=p(I,B),Y=f>0&&o?R(I,ee):0;return z=Y||!f||!o?{...ee,band:0,label:Y}:{...p(I,E===void 0?B:Math.max(1,B-Xo)),band:Xo,label:Gs},L.size>8&&L.clear(),L.set(C,z),z}},[d,l,r,o,h,f,b,u,s.hi,s.lo]),k=Ho(e,{height:p=>{let R=w(p);return R.plotH+Re*2+R.band},duration:700,stagger:40}),{p:$,width:P,height:y}=k,S=zs[k.lang],H=(0,W.useId)().replace(/:/g,""),O=(0,W.useMemo)(()=>{let p=Ws(n,e.startFrame);return p>=0?p:a},[n,e.startFrame,a]),[K,V]=(0,W.useState)(O),[_,F]=(0,W.useState)(O);_!==O&&(F(O),V(O));let v=Math.min(K,a),[x,M]=(0,W.useState)(!1),D=r>1&&!k.reduced,U=(0,W.useRef)("step"),oe=(0,W.useRef)(v);oe.current=v;let Fe=(0,W.useRef)(!1),X=(p,R)=>{U.current=R,oe.current=p,V(p)},se=k.motion.active;(0,W.useEffect)(()=>{if(!x||!D||!se)return;let p=0,R=0,L=null,I=C=>{if(R+=p?Math.min(C-p,m):0,p=C,R<m)return!0;R=0;let z=oe.current+1;return X(Math.min(z,a),"play"),z>=a&&M(!1),!0},E=()=>{L?.(),L=null,p=0,document.hidden||(L=Qt(I))};return E(),document.addEventListener("visibilitychange",E),()=>{L?.(),document.removeEventListener("visibilitychange",E)}},[x,D,se,m,a]);let he=(0,W.useRef)(!1);(0,W.useEffect)(()=>{!e.autoplay||he.current||!D||!k.motion.enabled||!se||(he.current=!0,e.startFrame===void 0&&X(0,"step"),M(!0))},[e.autoplay,e.startFrame,D,k.motion.enabled,se]);let Ce=()=>{if(x)return M(!1);Fe.current=!1,oe.current>=a&&X(0,"step"),M(!0)},lt=(p,R=!1)=>{M(!1),Fe.current=!0;let L=Ee(p,0,a);if(R&&k.active!==null){let I=Se[k.active]?.s,E=I===void 0?-1:i(L).order.slice(0,l).indexOf(I);k.setActive(E>=0?E:null,"keyboard")}L!==oe.current&&X(L,"step")},Ie=i(v),tn=i(v-1),Qn=p=>tn.pos[p]&&Ie.pos[p]?tn.pos[p]-Ie.pos[p]:0,Se=(0,W.useMemo)(()=>Ie.order.slice(0,l).map((p,R)=>({s:p,slot:R,value:n.values[p][v],move:Qn(p)})),[Ie,tn,l,n,v]),Ge=0,Ve=0;for(let p of Se)Ge=Math.min(Ge,p.value),Ve=Math.max(Ve,p.value);Ve===Ge&&(Ve=Ge+1);let Ye=(0,W.useMemo)(()=>{let p=n.rows.map(R=>R.findLast(L=>L!==null)??null);return Te(e.highlight,p,n.series,n.series.map((R,L)=>n.values[L][a]),"max")},[n,e.highlight,a]),er=(0,W.useMemo)(()=>Ft($,o,Ye),[$,o,Ye]),tr=U.current==="play",nr={...k.motion,dataKey:`${k.sig}|${v}`,stagger:0,duration:e.duration??(tr?m:700),easing:e.easing??(tr?"linear":k.motion.easing)},rr=k.motion.stagger??40,ga=(0,W.useMemo)(()=>Se.map(p=>({key:`r:${n.series[p.s]}`,to:[p.value,p.slot],from:[0,p.slot],enter:[p.value,l],exit:[p.value,l],delay:p.slot*rr,data:p})),[Se,n,l,rr]),pa=Vn(ga,nr),ba=(0,W.useMemo)(()=>[{key:"d",to:[Ge,Ve],data:null}],[Ge,Ve]),ya=Vn(ba,nr),[nn,or]=ya.get("d")??[Ge,Ve],wt=w(P,T===void 0?void 0:y),{plotH:vt,rowH:$t,showText:xa,nameSize:rn,showValues:ar,nameW:on,x0:ir,x1:ka}=wt,ct=Math.max(1,$t*.7),{fv:We}=k,wa=(0,W.useMemo)(()=>n.series.map((p,R)=>Dn(p,on-4,rn,Ye.has(R)?800:500)),[n,on,rn,Ye]),va=or-nn>0?or-nn:1,Je=p=>ir+(p-nn)/va*(ka-ir),sr=p=>Re+p*$t+($t-ct)/2,Mt=Math.min($.theme.radiusMark,ct/2),an=S.nth,sn=p=>p>0?S.up(p):S.down(-p),lr=(0,W.useMemo)(()=>Se.map(p=>({datum:n.rows[p.s][v],index:p.slot,key:n.series[p.s],label:n.series[p.s],value:p.value,formatted:`${We(p.value)}, ${an(p.slot+1)}${p.move?`, ${sn(p.move)}`:""}`})),[Se,n,v,We,S]),ut=n.labels[v]??"",cr=p=>{let R=Qn(p);return`${ut}, ${n.series[p]}, ${an(Ie.pos[p])}, ${We(n.values[p][v])}${R?`, ${sn(R)}`:""}`},ur=[...Ye].find(p=>Ie.pos[p]>0)??Ie.order[0],$a=k.via==="keyboard"&&k.active!==null&&Se[k.active]?cr(Se[k.active].s):Fe.current&&!x&&ur!==void 0?cr(ur):"",ln=Se[0],Ma=e.description??(ln?`${S.kind}. ${S.desc(Ie.order.length,r,n.labels[0],n.labels[a])}. ${S.lead(ut,n.series[ln.s],We(ln.value))}.`:""),Pe=k.active!==null?Se[k.active]:void 0,Ta=Pe?{x:Je(Math.max(0,Pe.value)),y:sr(Pe.slot),title:n.series[Pe.s],rows:[{label:ut,value:We(Pe.value),color:er[Pe.s].fill},{label:S.rank,value:`${an(Pe.slot+1)}${Pe.move?` (${sn(Pe.move)})`:""}`,strong:!1}]}:null,qe=wt.label,Ca=wt.band?Re+vt+Re+wt.band-7:Re+vt-qe*.08,Sa=k.reduced&&k.hydrated,Aa=(0,W.useMemo)(()=>Os($.theme,qe>=18.66?3:4.5),[$.theme,qe]);return(0,j.jsxs)(Ur,{c:k,kind:S.kind,ariaLabel:e.ariaLabel,description:Ma,events:lr,tip:Ta,renderTip:e.tooltip,announce:$a,className:e.className,style:e.style,theme:e.theme,onPointerMove:(p,R,L)=>{let I=Math.floor((R-Re)/$t);k.setActive(I>=0&&I<lr.length?I:null,L.pointerType==="touch"?"touch":"pointer")},onKey:p=>(p.key==="ArrowLeft"||p.key==="ArrowRight")&&r>1?(lt(oe.current+(p.key==="ArrowRight"?1:-1),!0),!0):p.key===" "&&D?(Ce(),!0):!1,defs:(0,j.jsx)("clipPath",{id:`${H}c`,children:(0,j.jsx)("rect",{x:0,y:0,width:P,height:vt+Re*2})}),overlay:r>1&&o?(0,j.jsx)(Us,{p:$,msg:S,frame:v,last:a,labels:n.labels,playing:x,stepOnly:Sa,canPlay:D,narrow:P<340,onToggle:Ce,onStep:lt}):null,children:[o&&ut&&qe?(0,j.jsx)(gt,{x:P-2,y:Ca,anchor:"end",baseline:"auto",size:qe,weight:800,fill:$.paint("ink"),opacity:Aa,letterSpacing:-qe*.03,children:ut}):null,s.lo<0?(0,j.jsx)("line",{x1:Je(0),x2:Je(0),y1:Re,y2:Re+vt,stroke:$.paint("line"),strokeWidth:1}):null,(0,j.jsx)("g",{clipPath:`url(#${H}c)`,children:pa.items.map(p=>{let R=p.data;if(p.exiting&&p.key!==`r:${n.series[R.s]}`)return null;let[L,I]=p.v,E=sr(I),C=Je(Math.min(0,L)),z=Je(Math.max(0,L)),B=Ye.has(R.s),ee=!p.exiting&&k.active===R.slot,q=Ee(l-I,0,1)*(k.active===null||ee?1:.55),ue=We(p.progress>=1?R.value:s.ints?Math.round(L):L),ge=(L<0?Je(0):z)+6,Ze=B?800:500,Tt=$.paint(B?"ink":"muted"),cn=E+ct/2;return(0,j.jsxs)("g",{opacity:q<1?q:void 0,children:[(0,j.jsx)("path",{d:_n(C,E,z-C,ct,L<0?{tl:Mt,bl:Mt}:{tr:Mt,br:Mt}),fill:er[R.s].fill,className:"ztd-mark"}),ee&&k.via==="keyboard"?(0,j.jsx)("path",{d:_n(C-2,E-2,z-C+4,ct+4,4),fill:"none",stroke:$.paint("ink"),strokeWidth:2}):null,xa?(0,j.jsx)(gt,{x:on,y:cn,anchor:"end",size:rn,weight:Ze,fill:Tt,children:wa[R.s]}):null,ar?(0,j.jsx)(gt,{x:ge,y:cn,size:11,weight:B?800:700,fill:$.paint("ink"),children:ue}):null,ar&&R.move?(0,j.jsx)(Ks,{p:$,x:ge+ce(We(R.value),11,700)+6,y:cn,move:R.move}):null]},p.key)})})]})}function Ks({p:e,x:t,y:n,move:r}){let o=r>0,a=e.paint(o?"accentText":"muted");return(0,j.jsxs)("g",{"aria-hidden":"true",children:[(0,j.jsx)("path",{d:o?`M${t},${n+3}h7l-3.5,-6z`:`M${t},${n-3}h7l-3.5,6z`,fill:a}),(0,j.jsx)(gt,{x:t+9,y:n,size:10,weight:700,fill:a,children:Math.abs(r)})]})}function Un({d:e}){return(0,j.jsx)("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:e.map((t,n)=>(0,j.jsx)("path",{d:t},n))})}function Us(e){let{p:t,msg:n,frame:r,last:o}=e,a=(0,W.useRef)(null),i={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"},s={fontSize:11,color:t.paint("muted"),whiteSpace:"nowrap",flex:"none",fontVariantNumeric:"tabular-nums"},c=u=>{let d=a.current?.getBoundingClientRect();if(!d||!d.width)return;let h=Math.round(Ee((u.clientX-d.left)/d.width,0,1)*o);h!==r&&e.onStep(h)},l=u=>{let d=Math.max(1,Math.round((o+1)/10)),h={ArrowLeft:r-1,ArrowDown:r-1,ArrowRight:r+1,ArrowUp:r+1,PageDown:r-d,PageUp:r+d,Home:0,End:o};u.key in h&&(u.preventDefault(),e.onStep(h[u.key]))},m=o?r/o*100:0;return(0,j.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:8},children:[e.stepOnly?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":n.prev,title:n.prev,disabled:r<=0,onClick:()=>e.onStep(r-1),style:{...i,opacity:r<=0?.4:void 0},children:(0,j.jsx)(Un,{d:en.prev})}),(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":n.next,title:n.next,disabled:r>=o,onClick:()=>e.onStep(r+1),style:{...i,opacity:r>=o?.4:void 0},children:(0,j.jsx)(Un,{d:en.next})})]}):(0,j.jsx)("button",{type:"button",className:"ztd-btn","aria-label":e.playing?n.pause:n.play,title:e.playing?n.pause:n.play,disabled:!e.canPlay,onClick:e.onToggle,style:i,children:(0,j.jsx)(Un,{d:e.playing?en.pause:en.play})}),e.narrow?null:(0,j.jsx)("span",{style:s,children:e.labels[0]}),(0,j.jsxs)("div",{ref:a,role:"slider",tabIndex:0,className:"ztd-btn","aria-label":n.frame,"aria-valuemin":0,"aria-valuemax":o,"aria-valuenow":r,"aria-valuetext":e.labels[r],onKeyDown:l,onPointerDown:u=>{u.currentTarget.setPointerCapture?.(u.pointerId),c(u)},onPointerMove:u=>{u.currentTarget.hasPointerCapture?.(u.pointerId)&&c(u)},style:{position:"relative",flex:1,minWidth:60,height:28,touchAction:"none",borderRadius:14},children:[(0,j.jsx)("span",{style:{position:"absolute",left:0,right:0,top:12,height:4,borderRadius:2,background:t.paint("line")}}),(0,j.jsx)("span",{style:{position:"absolute",left:0,width:`${m}%`,top:12,height:4,borderRadius:2,background:t.paint("accent")}}),(0,j.jsx)("span",{style:{position:"absolute",left:`calc(${m}% - 7px)`,top:7,width:14,height:14,boxSizing:"border-box",borderRadius:7,border:`2px solid ${t.paint("accent")}`,background:t.paint("panel")}})]}),e.narrow?null:(0,j.jsx)("span",{style:s,children:e.labels[o]})]})}var Yn=A(G(),1);function Yo(e,t,n,r){if(typeof e!="function")return Te(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let c=o.get(r(i,s));c!==void 0&&e(i,s)&&a.add(c)}),a}var Xs=A(Z(),1);var qn=A(G(),1),Ys={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}, ${xe(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Jo={en:Ys,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}일 이동평균`}},Jn=["ink","muted","dim"];function qo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Jn.length)}var Js=A(Z(),1);var na=A(G(),1),qs={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${xe(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Zs={en:qs,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Zo=(e,t)=>Zs[e].other(t);function Qo(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,lo(o.map(a=>a.value)))}}var ea=e=>Number.isFinite(e)&&e>0?e:0;function ta(e,t,n,r){return r==="emphasis"?Ft(e,t,n):ke(e,t,n)}var Qs=A(Z(),1);var ia=A(G(),1);function ra(e,t){return t===!1?e.map((n,r)=>r):so(e)}function oa(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Te(e,t,t,r,"max")}function aa(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=ae(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?ae(e,"neutral"):Rt(e,1-i/Math.max(1,o.length-1))),r}function sa(e){return!e||typeof e!="object"||Array.isArray(e)?[]:$e(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function la(e,t){return ft(e,t+1,new Set)}var el=A(Z(),1);var ua=A(G(),1);var tl=26;var Hu=tl*.62;function ca(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!No.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Oe=A(G(),1);function ma(e,t,n){let r=jt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Ht(n)?jt("bubble"):r}function nl(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 rl(e,t,n,r=!1){let o=ma(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,c=new Set(!r&&Nn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),l=u=>u.filter(d=>!c.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=Le(a.label,"label"),d=Gt(a.value,"value"),h=o.type==="waffle",f=t.map((y,S)=>({r:y,label:u(y,S),value:h?d(y,S):ea(d(y,S))})),{kept:b,other:T}=h?{kept:f,other:null}:Qo(f,i.other,(y,S)=>({r:{},label:Zo(te(n),y),value:S})),w=Te(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),h?"first":"max"),k=T?[...b,T]:b,$=Be(y=>h?ke(y,k.length,w):ta(y,k.length,w,i.colorMode)),P=h&&i.shape==="arc";return k.map((y,S)=>({label:y.label,color:$[S],...P&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=qo(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Jo[te(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:Jn[f],shape:"line"}))]}if(o.type==="network"){let u=sa(i.groups);if(u.length<2)return[];let d=Be(h=>la(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=Le(a.group,"group"),d=$e(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=Be(f=>ft(f,d.length,new Set));return d.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Ht(i))return[];let u=Le(a.series,"series"),d=$e(t.map((b,T)=>u(b,T)));if(d.length<2)return[];let h=Yo(s,t,d,u),f=Be(b=>ft(b,d.length,h));return l(d.map((b,T)=>({label:b,color:f[T],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let h=zo(t,d,u),f=Be(b=>ke(b,h.length,ca(s,h)));return l(h.map((b,T)=>({label:b,color:f[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let $=Le(a.series,"series");u=$e(t.map((P,y)=>$(P,y)))}let d=Rn(o.type,a,i);if(d.length){let $=Te(s,u,u,u.map(()=>0),"none"),P=Be(S=>ke(S,u.length,$)),y=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((S,H)=>({label:S,color:P[H]}));return[...l(y),...d.map((S,H)=>({label:S,color:Uo(H),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?io(u.length,Array.isArray(i.negative)?i.negative.map($=>u.indexOf(String($))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,b=f>=0?new Set([f]):Te(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return l(u.map(($,P)=>({label:$,color:b.has(P)?"accent":"neutralStrong",shape:"square"})));let T=i.colorMode,w=$=>ke($,u.length,b);if((o.type==="line"||o.type==="area")&&(w=$=>Ko($,u.length,b,o.type==="area",T)),o.type==="stream"){let $=Xe(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),P=ra($.values,i.reorder),y=oa(s,$.series,$.values);w=S=>aa(S,P,y)}let k=Be(w);return l(u.map(($,P)=>({label:$,color:k[P],...o.type==="line"&&{shape:"line"}})))}return[]}function ol(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Zr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function al(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:c,description:l,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:c,description:l}}function da(e,t){let{spec:n}=e,r=ma(n.type,n.encoding,n.options),o=(0,kt.useMemo)(()=>Bo(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=qr(n,e.locale),s=le(i),c=te(s),l=Ro(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=to(n),u=(0,kt.useMemo)(()=>m?Oo(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,T]=(0,kt.useState)(null);if(!r)return(0,Oe.jsx)(An,{error:c==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let w=o??l.data,k=t[r.type],$={...n.options??{}},P={...nl(r,n.encoding),...$,...u?{tooltip:u}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},y=n.card?.legend==="toggle"&&eo(r.type,n.encoding??{},$),S=b&&b.base===f?b.hidden:h;y&&(P.hidden=S);let H=F=>T(v=>{let x=v&&v.base===f?v.hidden:h;return{base:f,hidden:x.includes(F)?x.filter(M=>M!==F):[...x,F]}}),O=P.height??220,K=ol(n,r.type),V=a&&!w.length&&(l.loading||l.error||l.empty)?(0,Oe.jsx)(An,{loading:l.loading,error:l.error,empty:l.empty,onRetry:l.reload,height:O,locale:i}):K?(0,Oe.jsx)(Ao,{chart:k,...al(r.type,K,P)}):(0,Oe.jsx)(k,{...P});if(n.card){let F=n.card,v=F.legend==="auto"||F.legend==="toggle"?rl(n,w,s,y):F.legend,x=v?.length?y?(0,Oe.jsx)(Sn,{items:v,hidden:S,onToggle:H,locale:i}):v:void 0,M=F.download?(0,Oe.jsx)(Eo,{data:w,columns:no(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;V=(0,Oe.jsx)(Kr,{number:F.number,title:F.title??Jr(r,c),subtitle:F.subtitle,legend:x,actions:M,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:V})}let _=e.theme??n.theme;return _&&(V=(0,Oe.jsx)(Et,{theme:_,children:V})),V}function il({cfg:e,components:t}){let n=at();return da({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ha(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,fa.hydrateRoot)(r,(0,Zn.createElement)(Et,{theme:o.theme,cssVars:!0},(0,Zn.createElement)(il,{cfg:o,components:{[e]:t}})))}ha("barRace",Xn);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztd-charts-cli",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "ztd-charts CLI: list charts, get JSON Schemas, validate specs, render SVG/PNG/HTML, start a project, and get chart suggestions from data",
5
5
  "license": "MIT",
6
6
  "author": "Junhan2",
@@ -35,7 +35,7 @@
35
35
  "@resvg/resvg-js": "^2.6.2",
36
36
  "react": "^19.3.1",
37
37
  "react-dom": "^19.3.1",
38
- "ztd-charts": "0.11.0"
38
+ "ztd-charts": "0.11.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/react": "^19.2.0",