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