import{S as I,i as z,s as L,e as _,a as c,b as d,q as C,j as g,R as H,f as p,m as v,g as h,h as k,o as j,u as G,v as J,x as K,y as P,z as Q,C as U}from"./index.65fb5956.js";function w(s,e){return Math.floor(Math.random()*(e-s)+s)}const V=(s,e=1)=>{let n=[[255,99,132],[54,162,235],[240,176,26],[153,102,255],[75,192,192],[255,159,64],[194,88,74],[44,102,219],[44,163,23],[191,46,217],[160,162,162],[163,151,27]];if(s<n.length)var l=n[s];else var l=[w(64,196),w(64,196),w(64,196)];return"rgba("+l[0]+", "+l[1]+", "+l[2]+", "+e+")"};function T(s,e,n){const l=s.slice();return l[9]=e[n][0],l[15]=e[n][1],l[12]=n,l}function M(s,e,n){const l=s.slice();return l[9]=e[n][0],l[10]=e[n][1],l[12]=n,l}function N(s,e,n){const l=s.slice();return l[10]=e[n][0],l[13]=e[n][1],l[12]=n,l}function X(s){let e,n,l=s[3]&&O(),o=s[1],a=[];for(let t=0;t<o.length;t+=1)a[t]=R(T(s,o,t));return{c(){l&&l.c(),e=v(),n=_("div");for(let t=0;t<a.length;t+=1)a[t].c();c(n,"class","textfield p-2 bg-white dark:bg-gray-800 rounded box-border max-w-full leading-8 break-word svelte-261fjf")},m(t,i){l&&l.m(t,i),d(t,e,i),d(t,n,i);for(let f=0;f<a.length;f+=1)a[f].m(n,null)},p(t,i){if(t[3]?l||(l=O(),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),i&2){o=t[1];let f;for(f=0;f<o.length;f+=1){const r=T(t,o,f);a[f]?a[f].p(r,i):(a[f]=R(r),a[f].c(),a[f].m(n,null))}for(;f<a.length;f+=1)a[f].d(1);a.length=o.length}},d(t){l&&l.d(t),t&&g(e),t&&g(n),j(a,t)}}}function Y(s){let e,n,l=s[3]&&S(s),o=s[1],a=[];for(let t=0;t<o.length;t+=1)a[t]=E(M(s,o,t));return{c(){l&&l.c(),e=v(),n=_("div");for(let t=0;t<a.length;t+=1)a[t].c();c(n,"class","textfield p-2 bg-white dark:bg-gray-800 rounded box-border max-w-full leading-8 break-word svelte-261fjf")},m(t,i){l&&l.m(t,i),d(t,e,i),d(t,n,i);for(let f=0;f<a.length;f+=1)a[f].m(n,null)},p(t,i){if(t[3]?l?l.p(t,i):(l=S(t),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),i&11){o=t[1];let f;for(f=0;f<o.length;f+=1){const r=M(t,o,f);a[f]?a[f].p(r,i):(a[f]=E(r),a[f].c(),a[f].m(n,null))}for(;f<a.length;f+=1)a[f].d(1);a.length=o.length}},d(t){l&&l.d(t),t&&g(e),t&&g(n),j(a,t)}}}function O(s){let e;return{c(){e=_("div"),e.innerHTML=`<span class="svelte-261fjf">-1</span> 
				<span class="svelte-261fjf">0</span> 
				<span class="svelte-261fjf">+1</span>`,c(e,"class","color_legend flex px-2 py-1 justify-between rounded mb-3 font-semibold svelte-261fjf"),H(e,"background","-webkit-linear-gradient(to right,#8d83d6,(255,255,255,0),#eb4d4b)"),H(e,"background","linear-gradient(to right,#8d83d6,rgba(255,255,255,0),#eb4d4b)")},m(n,l){d(n,e,l)},d(n){n&&g(e)}}}function R(s){let e,n,l=s[9]+"",o,a,t;return{c(){e=_("span"),n=_("span"),o=p(l),a=v(),c(n,"class","text dark:text-white svelte-261fjf"),c(e,"class","textspan p-1 mr-0.5 bg-opacity-20 dark:bg-opacity-80 rounded-sm svelte-261fjf"),c(e,"style",t="background-color: rgba("+(s[15]<0?"141, 131, 214,"+-s[15]:"235, 77, 75,"+s[15])+")")},m(i,f){d(i,e,f),h(e,n),h(n,o),h(e,a)},p(i,f){f&2&&l!==(l=i[9]+"")&&k(o,l),f&2&&t!==(t="background-color: rgba("+(i[15]<0?"141, 131, 214,"+-i[15]:"235, 77, 75,"+i[15])+")")&&c(e,"style",t)},d(i){i&&g(e)}}}function S(s){let e,n=Object.entries(s[0]),l=[];for(let o=0;o<n.length;o+=1)l[o]=q(N(s,n,o));return{c(){e=_("div");for(let o=0;o<l.length;o+=1)l[o].c();c(e,"class","category-legend flex flex-wrap gap-1 mb-2 svelte-261fjf")},m(o,a){d(o,e,a);for(let t=0;t<l.length;t+=1)l[t].m(e,null)},p(o,a){if(a&1){n=Object.entries(o[0]);let t;for(t=0;t<n.length;t+=1){const i=N(o,n,t);l[t]?l[t].p(i,a):(l[t]=q(i),l[t].c(),l[t].m(e,null))}for(;t<l.length;t+=1)l[t].d(1);l.length=n.length}},d(o){o&&g(e),j(l,o)}}}function q(s){let e,n=s[10]+"",l,o,a;return{c(){e=_("div"),l=p(n),o=v(),c(e,"class","category-label px-2 py-1 rounded text-white font-semibold svelte-261fjf"),c(e,"style",a="background-color:"+s[13])},m(t,i){d(t,e,i),h(e,l),h(e,o)},p(t,i){i&1&&n!==(n=t[10]+"")&&k(l,n),i&1&&a!==(a="background-color:"+t[13])&&c(e,"style",a)},d(t){t&&g(e)}}}function D(s){let e,n=s[10]+"",l,o;return{c(){e=_("span"),l=p(n),c(e,"class","inline-category text-xs text-white ml-0.5 px-0.5 rounded-sm svelte-261fjf"),c(e,"style",o=s[10]===null?"":`background-color: ${s[0][s[10]]}`)},m(a,t){d(a,e,t),h(e,l)},p(a,t){t&2&&n!==(n=a[10]+"")&&k(l,n),t&3&&o!==(o=a[10]===null?"":`background-color: ${a[0][a[10]]}`)&&c(e,"style",o)},d(a){a&&g(e)}}}function E(s){let e,n,l=s[9]+"",o,a,t,i,f=!s[3]&&s[10]!==null&&D(s);return{c(){e=_("span"),n=_("span"),o=p(l),a=v(),f&&f.c(),t=v(),c(n,"class","text dark:text-white svelte-261fjf"),c(e,"class","textspan p-1 mr-0.5 bg-opacity-20 dark:bg-opacity-80 rounded-sm svelte-261fjf"),c(e,"style",i=s[10]===null?"":`color: ${s[0][s[10]]}; background-color: ${s[0][s[10]].replace("1)","var(--tw-bg-opacity))")}`)},m(r,m){d(r,e,m),h(e,n),h(n,o),h(e,a),f&&f.m(e,null),h(e,t)},p(r,m){m&2&&l!==(l=r[9]+"")&&k(o,l),!r[3]&&r[10]!==null?f?f.p(r,m):(f=D(r),f.c(),f.m(e,t)):f&&(f.d(1),f=null),m&3&&i!==(i=r[10]===null?"":`color: ${r[0][r[10]]}; background-color: ${r[0][r[10]].replace("1)","var(--tw-bg-opacity))")}`)&&c(e,"style",i)},d(r){r&&g(e),f&&f.d()}}}function Z(s){let e;function n(a,t){return a[4]==="categories"?Y:X}let l=n(s),o=l(s);return{c(){e=_("div"),o.c(),c(e,"class","output-highlightedtext svelte-261fjf"),c(e,"theme",s[2])},m(a,t){d(a,e,t),o.m(e,null)},p(a,[t]){l===(l=n(a))&&o?o.p(a,t):(o.d(1),o=l(a),o&&(o.c(),o.m(e,null))),t&4&&c(e,"theme",a[2])},i:C,o:C,d(a){a&&g(e),o.d()}}}function x(s,e,n){let{value:l=[]}=e,{theme:o="default"}=e,{show_legend:a=!1}=e,{color_map:t={}}=e,{style:i=""}=e,f;function r(u){if(!f){var b=document.createElement("canvas");f=b.getContext("2d")}f.fillStyle=u,f.fillRect(0,0,1,1);const[y,A,B,F]=f.getImageData(0,0,1,1).data;return f.clearRect(0,0,1,1),`rgba(${y}, ${A}, ${B}, ${255/F})`}let m;if(t===null&&(t={}),l.length>0){for(let[u,b]of l)if(b!==null)if(typeof b=="string"){if(m="categories",!(b in t)){let y=V(Object.keys(t).length);t[b]=y}}else m="scores"}function W(){for(const u in t)t[u].trim().startsWith("rgba")?n(0,t):n(0,t[u]=r(t[u]),t)}return W(),s.$$set=u=>{"value"in u&&n(1,l=u.value),"theme"in u&&n(2,o=u.theme),"show_legend"in u&&n(3,a=u.show_legend),"color_map"in u&&n(0,t=u.color_map),"style"in u&&n(5,i=u.style)},[t,l,o,a,m,i]}class $ extends I{constructor(e){super(),z(this,e,x,Z,L,{value:1,theme:2,show_legend:3,color_map:0,style:5})}}function ee(s){let e,n;return e=new $({props:{value:s[0],style:s[1],show_legend:s[2],color_map:s[3]}}),{c(){G(e.$$.fragment)},m(l,o){J(e,l,o),n=!0},p(l,[o]){const a={};o&1&&(a.value=l[0]),o&2&&(a.style=l[1]),o&4&&(a.show_legend=l[2]),o&8&&(a.color_map=l[3]),e.$set(a)},i(l){n||(K(e.$$.fragment,l),n=!0)},o(l){P(e.$$.fragment,l),n=!1},d(l){Q(e,l)}}}function le(s,e,n){let{value:l}=e,{default_value:o}=e,{style:a=""}=e,{show_legend:t}=e,{color_map:i={}}=e;const f=U();return o&&(l=o),s.$$set=r=>{"value"in r&&n(0,l=r.value),"default_value"in r&&n(4,o=r.default_value),"style"in r&&n(1,a=r.style),"show_legend"in r&&n(2,t=r.show_legend),"color_map"in r&&n(3,i=r.color_map)},s.$$.update=()=>{s.$$.dirty&1&&f("change")},[l,a,t,i,o]}class te extends I{constructor(e){super(),z(this,e,le,ee,L,{value:0,default_value:4,style:1,show_legend:2,color_map:3})}}var ae=te;const oe=["static"];export{ae as Component,oe as modes};
