import{t as D,a as S,n as R,s as Q}from"./C1951IdI.js";import{p as W,f as z,s as C,a as X,j as n,l as x,t as G,c as M,r as E,q as U,v as V}from"./CdjFANdp.js";import{p as w,i as O,c as Y,d as j,b as Z}from"./OpdB38Ru.js";import"./BBLiiV7J.js";import{u as $,c as e}from"./8eNpkxEe.js";import{g as P,u as tt}from"./HhvvIgyN.js";import"./DZOxPCae.js";import{S as et}from"./DXC1p2cl.js";var ot=D("<!> <!>",1),at=D("<!> <!>",1);function _t(b,t){W(t,!0);const[c,g]=Y(),u=()=>j(d,"$taskMap",c),m=()=>j(_,"$customLabelColorsStore",c),s=w(t,"showLabel",3,!1),{taskMap:d}=$(),{customLabelColorsStore:_}=tt(),{x:r,y:h,width:f,height:i,annotation_label:{annotation_label_name:a},annotation_task_id:y}=t.annotation,l=x(()=>y&&u().has(y)?u().get(y).is_prediction:!1);let k=P(a,1);const v=x(()=>{var o;return((o=m()[a])==null?void 0:o.color)??P(a,1).color}),p=x(()=>{var o;return((o=m()[a])==null?void 0:o.color)??P(a,.4).color}),L=x(()=>{var o;return((o=m()[a])==null?void 0:o.alpha)*.4});var A=at(),F=z(A);{var H=o=>{it(o,{coordinates:[r,h],colorText:k,label:a,get isPrediction(){return n(l)}})};O(F,o=>{s()&&o(H)})}var I=C(F,2);{var J=o=>{var B=ot(),T=z(B);et(T,{get segmentation(){return t.annotation.segmentation__binary_mask__rle_row_wise},get width(){return t.imageWidth},get colorFill(){return n(p)},get opacity(){return n(L)}});var N=C(T,2);q(N,{bbox:[r,h,f,i],label:a,get colorStroke(){return n(v)},get colorFill(){return n(p)},get opacity(){return n(L)},get isPrediction(){return n(l)}}),S(o,B)},K=o=>{q(o,{bbox:[r,h,f,i],label:a,get colorStroke(){return n(v)},get colorFill(){return n(p)},get opacity(){return n(L)},get isPrediction(){return n(l)}})};O(I,o=>{t.annotation.segmentation__binary_mask__rle_row_wise?o(J):o(K,!1)})}S(b,A),X(),g()}var rt=R('<rect vector-effect="non-scaling-stroke" stroke-width="2" pointer-events="all"></rect>');function q(b,t){const c=w(t,"isPrediction",3,!1),[g,u,m,s]=t.bbox,d=c()?"5,5":"none",_=c()?.8:1;var r=rt();e(r,"x",g),e(r,"y",u),e(r,"width",m),e(r,"height",s),e(r,"stroke-opacity",_),e(r,"stroke-dasharray",d),G(()=>{e(r,"stroke",t.colorStroke),e(r,"fill",t.colorFill),e(r,"fill-opacity",t.opacity),e(r,"aria-label",t.label)}),S(b,r)}var nt=R('<g class="unscaled"><rect></rect><text class="annotation-label-text"> </text></g>');function it(b,t){W(t,!0);const c=w(t,"fontSize",3,14),g=w(t,"isPrediction",3,!1),[u,m]=t.coordinates;let s=U(null);const d=x(()=>{if(n(s))return n(s).getBBox()}),_=5,r=g()?.8:1,h=g()?"italic":"normal";var f=nt();e(f,"transform",`translate(${u}, ${m})`);var i=M(f);e(i,"opacity",r);var a=C(i);e(a,"x",_),e(a,"y",-5),e(a,"font-style",h);var y=M(a,!0);E(a),Z(a,l=>V(s,l),()=>n(s)),E(f),G(()=>{var l,k,v;e(i,"y",-((l=n(d))==null?void 0:l.height)),e(i,"width",((k=n(d))==null?void 0:k.width)+_*2),e(i,"height",(v=n(d))==null?void 0:v.height),e(i,"fill",t.colorText.color),e(a,"fill",t.colorText.contrastColor),e(a,"font-size",c()),Q(y,g()?`${t.label} (pred)`:t.label)}),S(b,f),X()}export{_t as S};
