@ambuj.bhaskar/react-component-library 0.24.11-alpha → 0.24.12-alpha
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/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -11
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -337,7 +337,7 @@ __p += '`),S1&&(It+=`' +
|
|
|
337
337
|
function print() { __p += __j.call(arguments, '') }
|
|
338
338
|
`:`;
|
|
339
339
|
`)+It+`return __p
|
|
340
|
-
}`;var c1=YP(function(){return m1(me,Bn+"return "+It).apply(n,ke)});if(c1.source=It,hp(c1))throw c1;return c1}function A_e(C){return G1(C).toLowerCase()}function b_e(C){return G1(C).toUpperCase()}function __e(C,_,I){if(C=G1(C),C&&(I||_===n))return v3(C);if(!C||!(_=R2(_)))return C;var Q=sr(C),te=sr(_),me=Ir(Q,te),ke=no(Q,te)+1;return p9(Q,me,ke).join("")}function y_e(C,_,I){if(C=G1(C),C&&(I||_===n))return C.slice(0,wi(C)+1);if(!C||!(_=R2(_)))return C;var Q=sr(C),te=no(Q,sr(_))+1;return p9(Q,0,te).join("")}function w_e(C,_,I){if(C=G1(C),C&&(I||_===n))return C.replace(pt,"");if(!C||!(_=R2(_)))return C;var Q=sr(C),te=Ir(Q,sr(_));return p9(Q,te).join("")}function x_e(C,_){var I=P,Q=T;if(w0(_)){var te="separator"in _?_.separator:te;I="length"in _?o1(_.length):I,Q="omission"in _?R2(_.omission):Q}C=G1(C);var me=C.length;if(ko(C)){var ke=sr(C);me=ke.length}if(I>=me)return C;var Ne=I-X0(Q);if(Ne<1)return Q;var We=ke?p9(ke,0,Ne).join(""):C.slice(0,Ne);if(te===n)return We+Q;if(ke&&(Ne+=We.length-Ne),gp(te)){if(C.slice(Ne).search(te)){var St,Mt=We;for(te.global||(te=Io(te.source,G1(Et.exec(te))+"g")),te.lastIndex=0;St=te.exec(Mt);)var It=St.index;We=We.slice(0,It===n?Ne:It)}}else if(C.indexOf(R2(te),Ne)!=Ne){var cn=We.lastIndexOf(te);cn>-1&&(We=We.slice(0,cn))}return We+Q}function E_e(C){return C=G1(C),C&&Yt.test(C)?C.replace(sn,la):C}var S_e=r4(function(C,_,I){return C+(I?" ":"")+_.toUpperCase()}),pp=qD("toUpperCase");function GP(C,_,I){return C=G1(C),_=I?n:_,_===n?ro(C)?ca(C):mi(C):C.match(_)||[]}var YP=f1(function(C,_){try{return d0(C,n,_)}catch(I){return hp(I)?I:new $n(I)}}),M_e=pa(function(C,_){return A0(_,function(I){I=Bi(I),Ca(C,I,dp(C[I],C))}),C});function H_e(C){var _=C==null?0:C.length,I=jn();return C=_?e0(C,function(Q){if(typeof Q[1]!="function")throw new H0(a);return[I(Q[0]),Q[1]]}):[],f1(function(Q){for(var te=-1;++te<_;){var me=C[te];if(d0(me[0],this,Q))return d0(me[1],this,Q)}})}function L_e(C){return epe(uo(C,h))}function vp(C){return function(){return C}}function B_e(C,_){return C==null||C!==C?_:C}var k_e=JD(),O_e=JD(!0);function m2(C){return C}function Ap(C){return LD(typeof C=="function"?C:uo(C,h))}function I_e(C){return kD(uo(C,h))}function D_e(C,_){return OD(C,uo(_,h))}var P_e=f1(function(C,_){return function(I){return kl(I,C,_)}}),N_e=f1(function(C,_){return function(I){return kl(C,I,_)}});function bp(C,_,I){var Q=dr(_),te=Cu(_,Q);I==null&&!(w0(_)&&(te.length||!Q.length))&&(I=_,_=C,C=this,te=Cu(_,dr(_)));var me=!(w0(I)&&"chain"in I)||!!I.chain,ke=Aa(C);return A0(te,function(Ne){var We=_[Ne];C[Ne]=We,ke&&(C.prototype[Ne]=function(){var St=this.__chain__;if(me||St){var Mt=C(this.__wrapped__),It=Mt.__actions__=h2(this.__actions__);return It.push({func:We,args:arguments,thisArg:C}),Mt.__chain__=St,Mt}return We.apply(C,Ar([this.value()],arguments))})}),C}function T_e(){return R0._===this&&(R0._=u9),this}function _p(){}function R_e(C){return C=o1(C),f1(function(_){return ID(_,C)})}var F_e=Xm(e0),z_e=Xm(di),j_e=Xm(gi);function qP(C){return ip(C)?vi(Bi(C)):ppe(C)}function V_e(C){return function(_){return C==null?n:w3(C,_)}}var Z_e=tP(),U_e=tP(!0);function yp(){return[]}function wp(){return!1}function $_e(){return{}}function W_e(){return""}function K_e(){return!0}function Q_e(C,_){if(C=o1(C),C<1||C>W)return[];var I=U,Q=ie(C,U);_=jn(_),C-=U;for(var te=p3(Q,_);++I<C;)_(I);return te}function G_e(C){return Jn(C)?e0(C,Bi):F2(C)?[C]:h2(pP(G1(C)))}function Y_e(C){var _=++Ml;return G1(C)+_}var q_e=_u(function(C,_){return C+_},0),X_e=Jm("ceil"),J_e=_u(function(C,_){return C/_},1),eye=Jm("floor");function tye(C){return C&&C.length?gu(C,m2,Rm):n}function nye(C,_){return C&&C.length?gu(C,jn(_,2),Rm):n}function rye(C){return ia(C,m2)}function oye(C,_){return ia(C,jn(_,2))}function iye(C){return C&&C.length?gu(C,m2,Vm):n}function aye(C,_){return C&&C.length?gu(C,jn(_,2),Vm):n}var sye=_u(function(C,_){return C*_},1),lye=Jm("round"),cye=_u(function(C,_){return C-_},0);function uye(C){return C&&C.length?Or(C,m2):0}function dye(C,_){return C&&C.length?Or(C,jn(_,2)):0}return ce.after=IAe,ce.ary=HP,ce.assign=bbe,ce.assignIn=VP,ce.assignInWith=Du,ce.assignWith=_be,ce.at=ybe,ce.before=LP,ce.bind=dp,ce.bindAll=M_e,ce.bindKey=BP,ce.castArray=$Ae,ce.chain=EP,ce.chunk=eve,ce.compact=tve,ce.concat=nve,ce.cond=H_e,ce.conforms=L_e,ce.constant=vp,ce.countBy=uAe,ce.create=wbe,ce.curry=kP,ce.curryRight=OP,ce.debounce=IP,ce.defaults=xbe,ce.defaultsDeep=Ebe,ce.defer=DAe,ce.delay=PAe,ce.difference=rve,ce.differenceBy=ove,ce.differenceWith=ive,ce.drop=ave,ce.dropRight=sve,ce.dropRightWhile=lve,ce.dropWhile=cve,ce.fill=uve,ce.filter=fAe,ce.flatMap=CAe,ce.flatMapDeep=mAe,ce.flatMapDepth=pAe,ce.flatten=_P,ce.flattenDeep=dve,ce.flattenDepth=fve,ce.flip=NAe,ce.flow=k_e,ce.flowRight=O_e,ce.fromPairs=hve,ce.functions=Obe,ce.functionsIn=Ibe,ce.groupBy=vAe,ce.initial=Cve,ce.intersection=mve,ce.intersectionBy=pve,ce.intersectionWith=vve,ce.invert=Pbe,ce.invertBy=Nbe,ce.invokeMap=bAe,ce.iteratee=Ap,ce.keyBy=_Ae,ce.keys=dr,ce.keysIn=C2,ce.map=Hu,ce.mapKeys=Rbe,ce.mapValues=Fbe,ce.matches=I_e,ce.matchesProperty=D_e,ce.memoize=Bu,ce.merge=zbe,ce.mergeWith=ZP,ce.method=P_e,ce.methodOf=N_e,ce.mixin=bp,ce.negate=ku,ce.nthArg=R_e,ce.omit=jbe,ce.omitBy=Vbe,ce.once=TAe,ce.orderBy=yAe,ce.over=F_e,ce.overArgs=RAe,ce.overEvery=z_e,ce.overSome=j_e,ce.partial=fp,ce.partialRight=DP,ce.partition=wAe,ce.pick=Zbe,ce.pickBy=UP,ce.property=qP,ce.propertyOf=V_e,ce.pull=yve,ce.pullAll=wP,ce.pullAllBy=wve,ce.pullAllWith=xve,ce.pullAt=Eve,ce.range=Z_e,ce.rangeRight=U_e,ce.rearg=FAe,ce.reject=SAe,ce.remove=Sve,ce.rest=zAe,ce.reverse=cp,ce.sampleSize=HAe,ce.set=$be,ce.setWith=Wbe,ce.shuffle=LAe,ce.slice=Mve,ce.sortBy=OAe,ce.sortedUniq=Dve,ce.sortedUniqBy=Pve,ce.split=C_e,ce.spread=jAe,ce.tail=Nve,ce.take=Tve,ce.takeRight=Rve,ce.takeRightWhile=Fve,ce.takeWhile=zve,ce.tap=tAe,ce.throttle=VAe,ce.thru=Mu,ce.toArray=FP,ce.toPairs=$P,ce.toPairsIn=WP,ce.toPath=G_e,ce.toPlainObject=jP,ce.transform=Kbe,ce.unary=ZAe,ce.union=jve,ce.unionBy=Vve,ce.unionWith=Zve,ce.uniq=Uve,ce.uniqBy=$ve,ce.uniqWith=Wve,ce.unset=Qbe,ce.unzip=up,ce.unzipWith=xP,ce.update=Gbe,ce.updateWith=Ybe,ce.values=a4,ce.valuesIn=qbe,ce.without=Kve,ce.words=GP,ce.wrap=UAe,ce.xor=Qve,ce.xorBy=Gve,ce.xorWith=Yve,ce.zip=qve,ce.zipObject=Xve,ce.zipObjectDeep=Jve,ce.zipWith=eAe,ce.entries=$P,ce.entriesIn=WP,ce.extend=VP,ce.extendWith=Du,bp(ce,ce),ce.add=q_e,ce.attempt=YP,ce.camelCase=t_e,ce.capitalize=KP,ce.ceil=X_e,ce.clamp=Xbe,ce.clone=WAe,ce.cloneDeep=QAe,ce.cloneDeepWith=GAe,ce.cloneWith=KAe,ce.conformsTo=YAe,ce.deburr=QP,ce.defaultTo=B_e,ce.divide=J_e,ce.endsWith=n_e,ce.eq=zo,ce.escape=r_e,ce.escapeRegExp=o_e,ce.every=dAe,ce.find=hAe,ce.findIndex=AP,ce.findKey=Sbe,ce.findLast=gAe,ce.findLastIndex=bP,ce.findLastKey=Mbe,ce.floor=eye,ce.forEach=SP,ce.forEachRight=MP,ce.forIn=Hbe,ce.forInRight=Lbe,ce.forOwn=Bbe,ce.forOwnRight=kbe,ce.get=Cp,ce.gt=qAe,ce.gte=XAe,ce.has=Dbe,ce.hasIn=mp,ce.head=yP,ce.identity=m2,ce.includes=AAe,ce.indexOf=gve,ce.inRange=Jbe,ce.invoke=Tbe,ce.isArguments=S3,ce.isArray=Jn,ce.isArrayBuffer=JAe,ce.isArrayLike=g2,ce.isArrayLikeObject=z0,ce.isBoolean=ebe,ce.isBuffer=v9,ce.isDate=tbe,ce.isElement=nbe,ce.isEmpty=rbe,ce.isEqual=obe,ce.isEqualWith=ibe,ce.isError=hp,ce.isFinite=abe,ce.isFunction=Aa,ce.isInteger=PP,ce.isLength=Ou,ce.isMap=NP,ce.isMatch=sbe,ce.isMatchWith=lbe,ce.isNaN=cbe,ce.isNative=ube,ce.isNil=fbe,ce.isNull=dbe,ce.isNumber=TP,ce.isObject=w0,ce.isObjectLike=B0,ce.isPlainObject=Tl,ce.isRegExp=gp,ce.isSafeInteger=hbe,ce.isSet=RP,ce.isString=Iu,ce.isSymbol=F2,ce.isTypedArray=i4,ce.isUndefined=gbe,ce.isWeakMap=Cbe,ce.isWeakSet=mbe,ce.join=Ave,ce.kebabCase=i_e,ce.last=ho,ce.lastIndexOf=bve,ce.lowerCase=a_e,ce.lowerFirst=s_e,ce.lt=pbe,ce.lte=vbe,ce.max=tye,ce.maxBy=nye,ce.mean=rye,ce.meanBy=oye,ce.min=iye,ce.minBy=aye,ce.stubArray=yp,ce.stubFalse=wp,ce.stubObject=$_e,ce.stubString=W_e,ce.stubTrue=K_e,ce.multiply=sye,ce.nth=_ve,ce.noConflict=T_e,ce.noop=_p,ce.now=Lu,ce.pad=l_e,ce.padEnd=c_e,ce.padStart=u_e,ce.parseInt=d_e,ce.random=e_e,ce.reduce=xAe,ce.reduceRight=EAe,ce.repeat=f_e,ce.replace=h_e,ce.result=Ube,ce.round=lye,ce.runInContext=Ze,ce.sample=MAe,ce.size=BAe,ce.snakeCase=g_e,ce.some=kAe,ce.sortedIndex=Hve,ce.sortedIndexBy=Lve,ce.sortedIndexOf=Bve,ce.sortedLastIndex=kve,ce.sortedLastIndexBy=Ove,ce.sortedLastIndexOf=Ive,ce.startCase=m_e,ce.startsWith=p_e,ce.subtract=cye,ce.sum=uye,ce.sumBy=dye,ce.template=v_e,ce.times=Q_e,ce.toFinite=ba,ce.toInteger=o1,ce.toLength=zP,ce.toLower=A_e,ce.toNumber=go,ce.toSafeInteger=Abe,ce.toString=G1,ce.toUpper=b_e,ce.trim=__e,ce.trimEnd=y_e,ce.trimStart=w_e,ce.truncate=x_e,ce.unescape=E_e,ce.uniqueId=Y_e,ce.upperCase=S_e,ce.upperFirst=pp,ce.each=SP,ce.eachRight=MP,ce.first=yP,bp(ce,function(){var C={};return Hi(ce,function(_,I){d1.call(ce.prototype,I)||(C[I]=_)}),C}(),{chain:!1}),ce.VERSION=r,A0(["bind","bindKey","curry","curryRight","partial","partialRight"],function(C){ce[C].placeholder=ce}),A0(["drop","take"],function(C,_){an.prototype[C]=function(I){I=I===n?1:X(o1(I),0);var Q=this.__filtered__&&!_?new an(this):this.clone();return Q.__filtered__?Q.__takeCount__=ie(I,Q.__takeCount__):Q.__views__.push({size:ie(I,U),type:C+(Q.__dir__<0?"Right":"")}),Q},an.prototype[C+"Right"]=function(I){return this.reverse()[C](I).reverse()}}),A0(["filter","map","takeWhile"],function(C,_){var I=_+1,Q=I==j||I==R;an.prototype[C]=function(te){var me=this.clone();return me.__iteratees__.push({iteratee:jn(te,3),type:I}),me.__filtered__=me.__filtered__||Q,me}}),A0(["head","last"],function(C,_){var I="take"+(_?"Right":"");an.prototype[C]=function(){return this[I](1).value()[0]}}),A0(["initial","tail"],function(C,_){var I="drop"+(_?"":"Right");an.prototype[C]=function(){return this.__filtered__?new an(this):this[I](1)}}),an.prototype.compact=function(){return this.filter(m2)},an.prototype.find=function(C){return this.filter(C).head()},an.prototype.findLast=function(C){return this.reverse().find(C)},an.prototype.invokeMap=f1(function(C,_){return typeof C=="function"?new an(this):this.map(function(I){return kl(I,C,_)})}),an.prototype.reject=function(C){return this.filter(ku(jn(C)))},an.prototype.slice=function(C,_){C=o1(C);var I=this;return I.__filtered__&&(C>0||_<0)?new an(I):(C<0?I=I.takeRight(-C):C&&(I=I.drop(C)),_!==n&&(_=o1(_),I=_<0?I.dropRight(-_):I.take(_-C)),I)},an.prototype.takeRightWhile=function(C){return this.reverse().takeWhile(C).reverse()},an.prototype.toArray=function(){return this.take(U)},Hi(an.prototype,function(C,_){var I=/^(?:filter|find|map|reject)|While$/.test(_),Q=/^(?:head|last)$/.test(_),te=ce[Q?"take"+(_=="last"?"Right":""):_],me=Q||/^find/.test(_);te&&(ce.prototype[_]=function(){var ke=this.__wrapped__,Ne=Q?[1]:arguments,We=ke instanceof an,St=Ne[0],Mt=We||Jn(ke),It=function(v1){var S1=te.apply(ce,Ar([v1],Ne));return Q&&cn?S1[0]:S1};Mt&&I&&typeof St=="function"&&St.length!=1&&(We=Mt=!1);var cn=this.__chain__,Bn=!!this.__actions__.length,Zn=me&&!cn,c1=We&&!Bn;if(!me&&Mt){ke=c1?ke:new an(this);var Un=C.apply(ke,Ne);return Un.__actions__.push({func:Mu,args:[It],thisArg:n}),new p1(Un,cn)}return Zn&&c1?C.apply(this,Ne):(Un=this.thru(It),Zn?Q?Un.value()[0]:Un.value():Un)})}),A0(["pop","push","shift","sort","splice","unshift"],function(C){var _=Do[C],I=/^(?:push|sort|unshift)$/.test(C)?"tap":"thru",Q=/^(?:pop|shift)$/.test(C);ce.prototype[C]=function(){var te=arguments;if(Q&&!this.__chain__){var me=this.value();return _.apply(Jn(me)?me:[],te)}return this[I](function(ke){return _.apply(Jn(ke)?ke:[],te)})}}),Hi(an.prototype,function(C,_){var I=ce[_];if(I){var Q=I.name+"";d1.call(Re,Q)||(Re[Q]=[]),Re[Q].push({name:_,func:I})}}),Re[bu(n,x).name]=[{name:"wrapper",func:n}],an.prototype.clone=L0,an.prototype.reverse=cr,an.prototype.value=Gr,ce.prototype.at=nAe,ce.prototype.chain=rAe,ce.prototype.commit=oAe,ce.prototype.next=iAe,ce.prototype.plant=sAe,ce.prototype.reverse=lAe,ce.prototype.toJSON=ce.prototype.valueOf=ce.prototype.value=cAe,ce.prototype.first=ce.prototype.head,so&&(ce.prototype[so]=aAe),ce},Kr=xi();Lr?((Lr.exports=Kr)._=Kr,vr._=Kr):R0._=Kr}).call(tJ)}(H4,H4.exports)),H4.exports}var L4=nJ();const $o=V2(L4),wd="/not_available.svg",rJ="/big_size_image.svg",xd="/user.png",qb={HARDCODED_FALL_BACK_IMAGE:wd,HARDCODED_FALL_BACK_BIG_IMAGE:rJ,DEFAULT_AVATAR_IMAGE:xd,generateImageUrl:(e,t=!1)=>e||wd,getImageKitUrl:(e,t=300,n=300,r=40)=>e||wd,getUserAvatar:e=>{var t;return!e||!((t=e.awi_personal_info)!=null&&t.awi_avatar)?xd:e.awi_personal_info.awi_avatar||xd}};var j3=Ju();const Ed=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Sd(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on".concat(t),n)}function B4(e,t,n,r){e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent&&e.detachEvent("on".concat(t),n)}function Xb(e,t){const n=t.slice(0,t.length-1);for(let r=0;r<n.length;r++)n[r]=e[n[r].toLowerCase()];return n}function Jb(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const t=e.split(",");let n=t.lastIndexOf("");for(;n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function oJ(e,t){const n=e.length>=t.length?e:t,r=e.length>=t.length?t:e;let o=!0;for(let i=0;i<n.length;i++)r.indexOf(n[i])===-1&&(o=!1);return o}const k4={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":Ed?173:189,"=":Ed?61:187,";":Ed?59:186,"'":222,"[":219,"]":221,"\\":220},mo={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},O4={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},hr={16:!1,18:!1,17:!1,91:!1},b0={};for(let e=1;e<20;e++)k4["f".concat(e)]=111+e;let p0=[],I4=null,e_="all";const Pi=new Map,D4=e=>k4[e.toLowerCase()]||mo[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),iJ=e=>Object.keys(k4).find(t=>k4[t]===e),aJ=e=>Object.keys(mo).find(t=>mo[t]===e);function t_(e){e_=e||"all"}function P4(){return e_||"all"}function sJ(){return p0.slice(0)}function lJ(){return p0.map(e=>iJ(e)||aJ(e)||String.fromCharCode(e))}function cJ(){const e=[];return Object.keys(b0).forEach(t=>{b0[t].forEach(n=>{let{key:r,scope:o,mods:i,shortcut:a}=n;e.push({scope:o,shortcut:a,mods:i,keys:r.split("+").map(s=>D4(s))})})}),e}function uJ(e){const t=e.target||e.srcElement,{tagName:n}=t;let r=!0;const o=n==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||n==="TEXTAREA"||n==="SELECT")&&!t.readOnly)&&(r=!1),r}function dJ(e){return typeof e=="string"&&(e=D4(e)),p0.indexOf(e)!==-1}function fJ(e,t){let n,r;e||(e=P4());for(const o in b0)if(Object.prototype.hasOwnProperty.call(b0,o))for(n=b0[o],r=0;r<n.length;)n[r].scope===e?n.splice(r,1).forEach(a=>{let{element:s}=a;return Md(s)}):r++;P4()===e&&t_(t||"all")}function hJ(e){let t=e.keyCode||e.which||e.charCode;const n=p0.indexOf(t);if(n>=0&&p0.splice(n,1),e.key&&e.key.toLowerCase()==="meta"&&p0.splice(0,p0.length),(t===93||t===224)&&(t=91),t in hr){hr[t]=!1;for(const r in mo)mo[r]===t&&(U2[r]=!1)}}function n_(e){if(typeof e>"u")Object.keys(b0).forEach(o=>{Array.isArray(b0[o])&&b0[o].forEach(i=>ic(i)),delete b0[o]}),Md(null);else if(Array.isArray(e))e.forEach(o=>{o.key&&ic(o)});else if(typeof e=="object")e.key&&ic(e);else if(typeof e=="string"){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let[o,i]=n;typeof o=="function"&&(i=o,o=""),ic({key:e,scope:o,method:i,splitKey:"+"})}}const ic=e=>{let{key:t,scope:n,method:r,splitKey:o="+"}=e;Jb(t).forEach(a=>{const s=a.split(o),c=s.length,u=s[c-1],d=u==="*"?"*":D4(u);if(!b0[d])return;n||(n=P4());const h=c>1?Xb(mo,s):[],g=[];b0[d]=b0[d].filter(m=>{const A=(r?m.method===r:!0)&&m.scope===n&&oJ(m.mods,h);return A&&g.push(m.element),!A}),g.forEach(m=>Md(m))})};function r_(e,t,n,r){if(t.element!==r)return;let o;if(t.scope===n||t.scope==="all"){o=t.mods.length>0;for(const i in hr)Object.prototype.hasOwnProperty.call(hr,i)&&(!hr[i]&&t.mods.indexOf(+i)>-1||hr[i]&&t.mods.indexOf(+i)===-1)&&(o=!1);(t.mods.length===0&&!hr[16]&&!hr[18]&&!hr[17]&&!hr[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(p0),t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function o_(e,t){const n=b0["*"];let r=e.keyCode||e.which||e.charCode;if(!U2.filter.call(this,e))return;if((r===93||r===224)&&(r=91),p0.indexOf(r)===-1&&r!==229&&p0.push(r),["metaKey","ctrlKey","altKey","shiftKey"].forEach(s=>{const c=O4[s];e[s]&&p0.indexOf(c)===-1?p0.push(c):!e[s]&&p0.indexOf(c)>-1?p0.splice(p0.indexOf(c),1):s==="metaKey"&&e[s]&&(p0=p0.filter(u=>u in O4||u===r))}),r in hr){hr[r]=!0;for(const s in mo)if(Object.prototype.hasOwnProperty.call(mo,s)){const c=O4[mo[s]];U2[s]=e[c]}if(!n)return}for(const s in hr)Object.prototype.hasOwnProperty.call(hr,s)&&(hr[s]=e[O4[s]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(p0.indexOf(17)===-1&&p0.push(17),p0.indexOf(18)===-1&&p0.push(18),hr[17]=!0,hr[18]=!0);const o=P4();if(n)for(let s=0;s<n.length;s++)n[s].scope===o&&(e.type==="keydown"&&n[s].keydown||e.type==="keyup"&&n[s].keyup)&&r_(e,n[s],o,t);if(!(r in b0))return;const i=b0[r],a=i.length;for(let s=0;s<a;s++)if((e.type==="keydown"&&i[s].keydown||e.type==="keyup"&&i[s].keyup)&&i[s].key){const c=i[s],{splitKey:u}=c,d=c.key.split(u),h=[];for(let g=0;g<d.length;g++)h.push(D4(d[g]));h.sort().join("")===p0.sort().join("")&&r_(e,c,o,t)}}function U2(e,t,n){p0=[];const r=Jb(e);let o=[],i="all",a=document,s=0,c=!1,u=!0,d="+",h=!1,g=!1;for(n===void 0&&typeof t=="function"&&(n=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(i=t.scope),t.element&&(a=t.element),t.keyup&&(c=t.keyup),t.keydown!==void 0&&(u=t.keydown),t.capture!==void 0&&(h=t.capture),typeof t.splitKey=="string"&&(d=t.splitKey),t.single===!0&&(g=!0)),typeof t=="string"&&(i=t),g&&n_(e,i);s<r.length;s++)e=r[s].split(d),o=[],e.length>1&&(o=Xb(mo,e)),e=e[e.length-1],e=e==="*"?"*":D4(e),e in b0||(b0[e]=[]),b0[e].push({keyup:c,keydown:u,scope:i,mods:o,shortcut:r[s],method:n,key:r[s],splitKey:d,element:a});if(typeof a<"u"&&window){if(!Pi.has(a)){const m=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return o_(A,a)},v=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;o_(A,a),hJ(A)};Pi.set(a,{keydownListener:m,keyupListenr:v,capture:h}),Sd(a,"keydown",m,h),Sd(a,"keyup",v,h)}if(!I4){const m=()=>{p0=[]};I4={listener:m,capture:h},Sd(window,"focus",m,h)}}}function gJ(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(b0).forEach(n=>{b0[n].filter(o=>o.scope===t&&o.shortcut===e).forEach(o=>{o&&o.method&&o.method()})})}function Md(e){const t=Object.values(b0).flat();if(t.findIndex(r=>{let{element:o}=r;return o===e})<0){const{keydownListener:r,keyupListenr:o,capture:i}=Pi.get(e)||{};r&&o&&(B4(e,"keyup",o,i),B4(e,"keydown",r,i),Pi.delete(e))}if((t.length<=0||Pi.size<=0)&&(Object.keys(Pi).forEach(o=>{const{keydownListener:i,keyupListenr:a,capture:s}=Pi.get(o)||{};i&&a&&(B4(o,"keyup",a,s),B4(o,"keydown",i,s),Pi.delete(o))}),Pi.clear(),Object.keys(b0).forEach(o=>delete b0[o]),I4)){const{listener:o,capture:i}=I4;B4(window,"focus",o,i),I4=null}}const Hd={getPressedKeyString:lJ,setScope:t_,getScope:P4,deleteScope:fJ,getPressedKeyCodes:sJ,getAllKeyCodes:cJ,isPressed:dJ,filter:uJ,trigger:gJ,unbind:n_,keyMap:k4,modifier:mo,modifierMap:O4};for(const e in Hd)Object.prototype.hasOwnProperty.call(Hd,e)&&(U2[e]=Hd[e]);if(typeof window<"u"){const e=window.hotkeys;U2.noConflict=t=>(t&&window.hotkeys===U2&&(window.hotkeys=e),U2),window.hotkeys=U2}class X1 extends O.Component{constructor(t){super(t),this.isKeyDown=!1,this.handle=void 0,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.handleKeyUpEvent=this.handleKeyUpEvent.bind(this),this.handle={}}componentDidMount(){var{filter:t,splitKey:n}=this.props;t&&(U2.filter=t),U2.unbind(this.props.keyName),U2(this.props.keyName,{splitKey:n},this.onKeyDown),document&&document.body.addEventListener("keyup",this.handleKeyUpEvent)}componentWillUnmount(){U2.unbind(this.props.keyName),this.isKeyDown=!0,this.handle={},document&&document.body.removeEventListener("keyup",this.handleKeyUpEvent)}onKeyUp(t,n){var{onKeyUp:r,disabled:o}=this.props;!o&&r&&r(n.shortcut,t,n)}onKeyDown(t,n){var{onKeyDown:r,allowRepeat:o,disabled:i}=this.props;this.isKeyDown&&!o||(this.isKeyDown=!0,this.handle=n,!i&&r&&r(n.shortcut,t,n))}handleKeyUpEvent(t){this.isKeyDown&&(this.isKeyDown=!1,!(this.props.keyName&&this.props.keyName.indexOf(this.handle.shortcut)<0)&&(this.onKeyUp(t,this.handle),this.handle={}))}render(){return this.props.children||null}}X1.defaultProps={filter(e){var t=e.target||e.srcElement,n=t.tagName;return!(t.isContentEditable||n==="INPUT"||n==="SELECT"||n==="TEXTAREA")}},X1.propTypes={keyName:j3.string,filter:j3.func,onKeyDown:j3.func,onKeyUp:j3.func,disabled:j3.bool,splitKey:j3.string};const i_=["shift","alt","meta","mod","ctrl","control"],CJ={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function Oa(e){return(CJ[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function a_(e){return i_.includes(e)}function Ld(e,t=","){return e.toLowerCase().split(t)}function Bd(e,t="+",n=">",r=!1,o){let i=[],a=!1;e.includes(n)?(a=!0,i=e.toLocaleLowerCase().split(n).map(u=>Oa(u))):i=e.toLocaleLowerCase().split(t).map(u=>Oa(u));const s={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},c=i.filter(u=>!i_.includes(u));return{...s,keys:c,description:o,isSequence:a}}typeof document<"u"&&(document.addEventListener("keydown",e=>{e.code!==void 0&&s_([Oa(e.code)])}),document.addEventListener("keyup",e=>{e.code!==void 0&&l_([Oa(e.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{Ni.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{Ni.clear()},0)}));const Ni=new Set;function kd(e){return Array.isArray(e)}function mJ(e,t=","){return(kd(e)?e:e.split(t)).every(n=>Ni.has(n.trim().toLowerCase()))}function s_(e){const t=Array.isArray(e)?e:[e];Ni.has("meta")&&Ni.forEach(n=>!a_(n)&&Ni.delete(n.toLowerCase())),t.forEach(n=>Ni.add(n.toLowerCase()))}function l_(e){const t=Array.isArray(e)?e:[e];e==="meta"?Ni.clear():t.forEach(n=>Ni.delete(n.toLowerCase()))}function pJ(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function vJ(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}function AJ(e){return c_(e,["input","textarea","select"])}function c_(e,t=!1){const{target:n,composed:r}=e;let o;return bJ(n)&&r?o=e.composedPath()[0]&&e.composedPath()[0].tagName:o=n&&n.tagName,kd(t)?!!(o&&t&&t.some(i=>i.toLowerCase()===o.toLowerCase())):!!(o&&t&&t)}function bJ(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function _J(e,t){return e.length===0&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):t?e.some(n=>t.includes(n))||e.includes("*"):!0}const yJ=(e,t,n=!1)=>{const{alt:r,meta:o,mod:i,shift:a,ctrl:s,keys:c,useKey:u}=t,{code:d,key:h,ctrlKey:g,metaKey:m,shiftKey:v,altKey:A}=e,p=Oa(d);if(u&&(c==null?void 0:c.length)===1&&c.includes(h))return!0;if(!(c!=null&&c.includes(p))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(p))return!1;if(!n){if(r!==A&&p!=="alt"||a!==v&&p!=="shift")return!1;if(i){if(!m&&!g)return!1}else if(o!==m&&p!=="meta"&&p!=="os"||s!==g&&p!=="ctrl"&&p!=="control")return!1}return c&&c.length===1&&c.includes(p)?!0:c?mJ(c):!c},wJ=O.createContext(void 0),xJ=()=>O.useContext(wJ);function u_(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&u_(e[r],t[r]),!0):e===t}const EJ=O.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),SJ=()=>O.useContext(EJ);function MJ(e){const t=O.useRef(void 0);return u_(t.current,e)||(t.current=e),t.current}const d_=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},HJ=typeof window<"u"?O.useLayoutEffect:O.useEffect;function f_(e,t,n,r){const o=O.useRef(null),i=O.useRef(!1),a=n instanceof Array?r instanceof Array?void 0:r:n,s=kd(e)?e.join(a==null?void 0:a.delimiter):e,c=n instanceof Array?n:r instanceof Array?r:void 0,u=O.useCallback(t,c??[]),d=O.useRef(u);c?d.current=u:d.current=t;const h=MJ(a),{activeScopes:g}=SJ(),m=xJ();return HJ(()=>{if((h==null?void 0:h.enabled)===!1||!_J(g,h==null?void 0:h.scopes))return;let v=[],A;const p=(E,S=!1)=>{var M;if(!(AJ(E)&&!c_(E,h==null?void 0:h.enableOnFormTags))){if(o.current!==null){const H=o.current.getRootNode();if((H instanceof Document||H instanceof ShadowRoot)&&H.activeElement!==o.current&&!o.current.contains(H.activeElement)){d_(E);return}}(M=E.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Ld(s,h==null?void 0:h.delimiter).forEach(H=>{var k,D,P,T;if(H.includes((h==null?void 0:h.splitKey)??"+")&&H.includes((h==null?void 0:h.sequenceSplitKey)??">")){console.warn(`Hotkey ${H} contains both ${(h==null?void 0:h.splitKey)??"+"} and ${(h==null?void 0:h.sequenceSplitKey)??">"} which is not supported.`);return}const N=Bd(H,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description);if(N.isSequence){A=setTimeout(()=>{v=[]},(h==null?void 0:h.sequenceTimeoutMs)??1e3);const F=N.useKey?E.key:Oa(E.code);if(a_(F.toLowerCase()))return;v.push(F);const j=(k=N.keys)==null?void 0:k[v.length-1];if(F!==j){v=[],A&&clearTimeout(A);return}v.length===((D=N.keys)==null?void 0:D.length)&&(d.current(E,N),A&&clearTimeout(A),v=[])}else if(yJ(E,N,h==null?void 0:h.ignoreModifiers)||(P=N.keys)!=null&&P.includes("*")){if((T=h==null?void 0:h.ignoreEventWhen)!=null&&T.call(h,E)||S&&i.current)return;if(pJ(E,N,h==null?void 0:h.preventDefault),!vJ(E,N,h==null?void 0:h.enabled)){d_(E);return}d.current(E,N),S||(i.current=!0)}})}},x=E=>{E.code!==void 0&&(s_(Oa(E.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&p(E))},y=E=>{E.code!==void 0&&(l_(Oa(E.code)),i.current=!1,h!=null&&h.keyup&&p(E,!0))},w=o.current||(a==null?void 0:a.document)||document;return w.addEventListener("keyup",y,a==null?void 0:a.eventListenerOptions),w.addEventListener("keydown",x,a==null?void 0:a.eventListenerOptions),m&&Ld(s,h==null?void 0:h.delimiter).forEach(E=>m.addHotkey(Bd(E,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description))),()=>{w.removeEventListener("keyup",y,a==null?void 0:a.eventListenerOptions),w.removeEventListener("keydown",x,a==null?void 0:a.eventListenerOptions),m&&Ld(s,h==null?void 0:h.delimiter).forEach(E=>m.removeHotkey(Bd(E,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description))),v=[],A&&clearTimeout(A)}},[s,h,g]),o}const gr={table:"_table_q0jcp_1",table__header:"_table__header_q0jcp_18",table__header__th:"_table__header__th_q0jcp_24",table__row:"_table__row_q0jcp_38",table__row__row_selected:"_table__row__row_selected_q0jcp_44",table__row__td:"_table__row__td_q0jcp_47",clickable:"_clickable_q0jcp_68",loadMoreButton:"_loadMoreButton_q0jcp_73",loadMoreButtonDiv:"_loadMoreButtonDiv_q0jcp_78",table_container:"_table_container_q0jcp_84",scrollable_table:"_scrollable_table_q0jcp_92",pagination_container:"_pagination_container_q0jcp_104",pagination_btn:"_pagination_btn_q0jcp_113",active:"_active_q0jcp_130",pagination_dots:"_pagination_dots_q0jcp_135",pagination_input:"_pagination_input_q0jcp_140",nextPrevArrow:"_nextPrevArrow_q0jcp_165",pagination_left:"_pagination_left_q0jcp_179",pagination_right:"_pagination_right_q0jcp_191",pagination_loading:"_pagination_loading_q0jcp_204"},h_=({children:e,disableOverflowY:t=!1,tableClass:n="",disableFixHeight:r,isPagination:o=!0})=>Z.jsx("div",{className:qn(gr.table_container,n),style:{overflowY:t?"unset":"auto",height:r?"unset":o?"70vh":"78vh",maxHeight:o?"70vh":"85vh"},children:Z.jsx("table",{id:"resizeMe",className:qn(gr.table,gr.scrollable_table),children:e})}),g_=({children:e})=>Z.jsx("tbody",{className:gr.table__body,children:e}),Od=({children:e,className:t="",title:n="",onclick:r})=>Z.jsx("tr",{className:qn(gr.table__row,{[t]:!!t}),title:n,...r&&{onClick:r},children:e}),N4=({children:e,className:t="",extraClass:n="",title:r="",...o})=>{const i=qn(gr.table__row__td,t,(n==null?void 0:n.length)>0&&gr.clickable);return Z.jsx("td",{className:i,title:r,children:Z.jsx("span",{...o,style:{textAlign:"left"},children:e})})},C_=({children:e,className:t="",title:n=""})=>Z.jsx("th",{className:qn(gr.table__header__th,{[t]:t}),title:n,children:Z.jsxs("span",{children:[e," "]})}),m_=({children:e,className:t=""})=>Z.jsx("thead",{className:qn(gr.table__header,{[t]:!!t}),children:e}),p_=({list:e,headerClass:t="",type:n=""})=>(console.log("AWIHEADER List,",e),Z.jsx(m_,{className:t,children:Z.jsx(Od,{children:e.map(r=>Z.jsx(C_,{children:r},r))},`row_${n}`)},n)),Id=({toggleSelectAnnotation:e=()=>{console.log("Not available")},handleLeftKeyDown:t=()=>{console.log("Not available")},handleRightKeyDown:n=()=>{console.log("Not available")},handleUpKeyDown:r=()=>{console.log("Not available")},handleDownKeyDown:o=()=>{console.log("Not available")},handleZoomInClick:i=()=>{console.log("Not available")},handleZoomOutClick:a=()=>{console.log("Not available")},handleCompleteAnnotation:s=()=>{console.log("Not available")},undoAnnotationPoint:c=()=>{console.log("Not available")},reLoadAndReDrawAnnotations:u=()=>{console.log("Not available")},togglePagination:d=()=>{console.log("Not available")},toggleFullscreen:h=()=>{console.log("Not available")},switchToAutoAnnotations:g=()=>{console.log("Not available")},openShortCutRequestDetails:m=()=>{console.log("Not available")},handleRecentAnnotatedVerifiedImages:v=()=>{console.log("Not available")},handleSendToSamFunctionPrompt:A=()=>{console.log("Not available")},samAPIactive:p,request:x,switchToEditMode:y=()=>{console.log("Not available")},switchToCreateMode:w=()=>{console.log("Not available")},goToNextImage:E=()=>{console.log("Not available")},goToPreviousImage:S=()=>{console.log("Not available")},loggedUser:M,handleGoToPendingAnnotations:H=()=>{console.log("Not available")},handleCopyByCtrlC:k=()=>{console.log("Not available")},handlePasteAnnotationsByControlV:D=()=>{console.log("Not available")},openShortCutKeyModal:P,setOpenShortCutKeyModal:T=()=>{console.log("Not available")},setIsAltViaToolPressHandle:N=()=>{console.log("Not available")},isCarousel:F=!1,selectedTool:j="",setCrossHairHandle:z=()=>{console.log("Not available")},controlMinusHotkey:R=()=>{console.log("Not available")},controlPlusHotkey:$=()=>{console.log("Not available")}})=>{const W=p2.isSAMAllowed(x==null?void 0:x.awi_annotation_type,x==null?void 0:x.awi_request_for)&&!p,q=["awi_annotator","awi_verifier","awi_developer"].includes(M.userObj.awi_level),K=()=>{const J=[{action:"next image",key:"next_image",displayKey:"d",title:"Move to the next image",isClose:!0},{action:"previous image",key:"prev_image",displayKey:"a",title:"Move to the previous image",isClose:!0}],Y=[{action:"Go to pending annotation",key:"pending_annotations",displayKey:"p",title:"Go to pending annotation",isClose:!0}],ee=[{action:"Switch to edit",key:"edit_mode",displayKey:"e",title:"Switch to edit mode",isClose:!0},{action:"Switch to create",key:"create_mode",displayKey:"q",title:"Switch to create mode",isClose:!0},{action:"Switch to pan mode",key:"pan_mode",displayKey:"m",title:"Switch to pan mode",isClose:!0},{action:"Show cross hair",key:"cross_hair",displayKey:"w",title:"Show cross hair",isClose:!0},{action:"Copy selected annotation",key:"copy",displayKey:"Ctrl + C",title:"Copy selected annotation",isClose:!1},{action:"Paste all annotations",key:"paste",displayKey:"Ctrl + V",title:"Paste all copied annotations",isClose:!1},{action:"Forward Toggle Annotations",key:"select_forward",displayKey:"T",title:"Forward Toggle annotations visibility, Long press to get next",isClose:!1},{action:"Backward Toggle Annotations",key:"select_backward",displayKey:"U",title:"Backward Toggle annotations visibility, Long press to get previous",isClose:!1},{action:"Go to last updated annotations",key:"select_last_update",displayKey:"L",title:"Go to last updated annotations",isClose:!0},{action:"Undo Annotation point / Last State",key:"undo",displayKey:"Ctrl + Z",title:"Undo last annotation action",isClose:!0},{action:"Complete Annotation / Generate Point Annotations",key:"complete",displayKey:"Enter",title:"Finalize or generate point annotations",isClose:!0},{action:"Switch to Auto Annotations",key:"auto_annotations",displayKey:"S",title:"Enable automatic annotation mode",isClose:!0},{action:"AI prompt popup",key:"send_to_sam",displayKey:"X (if AI is enabled)",title:"AI prompt popup",isClose:!0},{action:"Get request information",key:"open_shortcut_details",displayKey:"V",title:"View request-related information",isClose:!0},{action:"Refetch Annotations",key:"reload",displayKey:"R",title:"Reload annotations",isClose:!0},{action:"Toggle Image Pagination",key:"toggle_pagination",displayKey:"H",title:"Show or hide image pagination",isClose:!1},{action:"Zoom In",key:"zoom_in",displayKey:"I",title:"Zoom into the image, long press for more zoom in",isClose:!1},{action:"Zoom Out",key:"zoom_out",displayKey:"O",title:"Zoom out of the image, long press for more zoom out",isClose:!1},{action:"Moving Zoomed images",key:"",displayKey:"Alt + Mouse Move",title:"Move the zoomed-in image",isClose:!1},{action:"View Recently Annotated Images",key:"recent_verified",displayKey:"Alt + R",title:"Show recently annotated images",isClose:!0},{action:"Delete Annotation",key:"",displayKey:"Ctrl + Delete",title:"Delete the selected annotation",isClose:!1},{action:"Move image to left",key:"move_left",displayKey:"←",title:"Move image to left",isClose:!1},{action:"Move image to right",key:"move_right",displayKey:"→",title:"Move image to right",isClose:!1},{action:"Move image to top",key:"move_up",displayKey:"↑",title:"Move image to top",isClose:!1},{action:"Move image to bottom",key:"move_down",displayKey:"↓",title:"Move image to bottom",isClose:!1},{action:"Enter/Exit Fullscreen",key:"fullscreen",displayKey:"F",title:"Enter/Exit Fullscreen",isClose:!1}];return M.userObj.awi_level==="awi_verifier"?[...J,...ee,...Y]:M.userObj.awi_level==="awi_supervisor"?J:[...J,...ee]},U=J=>{switch(J){case"select_forward":return e("forward");case"select_backward":return e("backward");case"select_last_update":return e("last_update");case"move_left":return t();case"move_right":return n();case"move_up":return r();case"move_down":return o();case"zoom_in":return i();case"zoom_out":return a();case"complete":return s();case"undo":return c();case"reload":return u();case"toggle_pagination":return d(Y=>!Y);case"fullscreen":return h();case"auto_annotations":return g();case"open_shortcut_details":return m();case"recent_verified":return v();case"send_to_sam":if(W)return j!="SAM"&&g(),A();V1.error("SAM is not allowed");return;case"edit_mode":if(y)return y();break;case"create_mode":if(w)return w();break;case"next_image":if(E)return E();break;case"prev_image":if(S)return S();break;case"pending_annotations":if(H)return H();break;case"copy":if(k)return k();break;case"paste":if(D)return D();break;case"pan_mode":N();break;case"cross_hair":z&&typeof z=="function"&&z();break;default:console.warn(`Unhandled hotkey action: ${J}`)}},G=(J,Y)=>{U(J),Y&&T(!1)};return f_("ctrl+=",J=>{J.preventDefault(),$()}),f_("ctrl+-, ctrl+subtract, ctrl+minus",J=>{J.preventDefault(),R()}),Z.jsxs(Z.Fragment,{children:[Z.jsx(X1,{allowRepeat:!0,keyName:"t",onKeyDown:()=>U("select_forward")}),Z.jsx(X1,{allowRepeat:!0,keyName:"u",onKeyDown:()=>U("select_backward")}),Z.jsx(X1,{allowRepeat:!1,keyName:"l",onKeyDown:()=>U("select_last_update")}),Z.jsx(X1,{allowRepeat:!0,keyName:"left",onKeyDown:()=>U("move_left")}),Z.jsx(X1,{allowRepeat:!0,keyName:"right",onKeyDown:()=>U("move_right")}),Z.jsx(X1,{allowRepeat:!0,keyName:"up",onKeyDown:()=>U("move_up")}),Z.jsx(X1,{allowRepeat:!0,keyName:"down",onKeyDown:()=>U("move_down")}),Z.jsx(X1,{allowRepeat:!0,keyName:"i",onKeyDown:()=>U("zoom_in")}),Z.jsx(X1,{allowRepeat:!0,keyName:"o",onKeyDown:()=>U("zoom_out")}),Z.jsx(X1,{keyName:"enter",onKeyDown:()=>U("complete")}),Z.jsx(X1,{keyName:"ctrl+z",onKeyDown:()=>U("undo")}),Z.jsx(X1,{keyName:"r",onKeyDown:()=>U("reload")}),Z.jsx(X1,{keyName:"h",onKeyDown:()=>U("toggle_pagination")}),Z.jsx(X1,{keyName:"f",onKeyDown:()=>U("fullscreen")}),Z.jsx(X1,{keyName:"s",onKeyDown:()=>U("auto_annotations")}),Z.jsx(X1,{keyName:"v",onKeyDown:()=>U("open_shortcut_details")}),Z.jsx(X1,{keyName:"alt+r",onKeyDown:()=>U("recent_verified")}),W&&Z.jsx(X1,{keyName:"x",onKeyDown:()=>U("send_to_sam")}),q&&Z.jsxs(Z.Fragment,{children:[Z.jsx(X1,{keyName:"e",onKeyDown:()=>U("edit_mode")}),Z.jsx(X1,{keyName:"q",onKeyDown:()=>U("create_mode")})]}),Z.jsx(X1,{keyName:"d",onKeyDown:()=>U("next_image")}),Z.jsx(X1,{keyName:"a",onKeyDown:()=>U("prev_image")}),M.userObj.awi_level==="awi_verifier"&&Z.jsx(X1,{keyName:"p",onKeyDown:()=>U("pending_annotations")}),Z.jsx(X1,{keyName:"ctrl+c",onKeyDown:()=>U("copy")}),Z.jsx(X1,{keyName:"ctrl+v",onKeyDown:()=>U("paste")}),Z.jsx(X1,{keyName:"m",onKeyDown:()=>U("pan_mode")}),Z.jsx(X1,{keyName:"w",onKeyDown:()=>U("cross_hair")}),P&&!F&&Z.jsx(Z.Fragment,{children:Z.jsxs(F6,{popupPosition:"right",isBackdrop:!0,backdropAction:()=>T(!1),className:"noPadding",children:[Z.jsx(j6,{title:"Shortcut keys",onClose:()=>T(!1)}),Z.jsx(z6,{children:Z.jsxs(h_,{children:[Z.jsx(p_,{list:["S.NO.","Command","Key Binding","Action"]},"short_cut_keys"),Z.jsx(g_,{children:(K()||[]).map((J,Y)=>{var ee;return Z.jsxs(Od,{title:J.title,children:[Z.jsx(N4,{children:Y+1}),Z.jsx(N4,{children:J.action}),Z.jsx(N4,{children:Z.jsxs("div",{className:"shortcutKey",children:[" ",J.displayKey," "]})}),Z.jsx(N4,{children:((ee=J==null?void 0:J.key)==null?void 0:ee.length)>0&&Z.jsx("button",{className:"modalButton modalButton__purpleColor",onClick:()=>G(J.key,J.isClose),children:"Press"})})]})})})]})}),Z.jsx(Z6,{})]})})]})},LJ=10,BJ=12,v_=e=>{switch(e){case"rectangle":return q1.rectangleIcon.IconComponent;case"circle":return q1.circleIcon.IconComponent;case"polygon":return q1.polygonIcon.IconComponent;case"dot":return q1.dotIcon.IconComponent;default:return q1.rectangleIcon.IconComponent}},ac=({isEditing:e,handleSelectTool:t=()=>{console.log("handleSelectTool function is not provided")},handleSAMToggle:n=()=>{console.log("handleSAMToggle function is not provided")},hasAnnotation:r=!1,currentSelectedSAMTool:o="Normal",handleCopyAnnotations:i,setOpenRequestDetails:a=()=>{console.log("setOpenRequestDetails function is not provided")},openRequestDetails:s,show_guidelines_first:c,handleZoomInClick:u,zoomProperties:d,handleReset:h,handleZoomOutClick:g,handleCompleteAnnotation:m,toggleFullscreen:v,selectAnnotationId:A,selectedAnnotationInfo:p,undoLastStateAnnotation:x,usingSamFunction:y,samAPIactive:w,handleSendToSamFunction:E,coordinates:S,handleSendToSamFunctionPrompt:M,reLoadAndReDrawAnnotations:H,showGuidelinesFirst:k,isMobile:D,toggleSelectAnnotation:P,handleLeftKeyDown:T,handleRightKeyDown:N,handleUpKeyDown:F,handleDownKeyDown:j,undoAnnotationPoint:z,togglePagination:R,switchToEditMode:$,switchToCreateMode:W,goToNextImage:q,goToPreviousImage:K,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,showPagination:Y=!1,loggedUser:ee,isControlViaToolPress:oe,isAltViaToolPress:de,setIsControlViaToolPress:se,setIsAltViaToolPress:xe,isCarousel:we=!1,allowedToCopyPreview:ve,classColorMapToSend:he,request:le,parentReqData:ae,RequestInfoModal:_e,setCrossHair:Oe,isCrossHair:Ie,annotationViewType:ge="atom",REACT_APP_SAM_ENABLED:et="no",controlPlusHotkey:fe,controlMinusHotkey:ne,Carousel:pe})=>{var Yt,An,_n,Qt,kt,Ht,xt,Zt,Cn,mt;(a==null||typeof a!="function")&&(a=pt=>{console.log("setOpenRequestDetails function is not provided",pt)}),t||(t=pt=>{console.log("handleSelectTool function is not provided",pt)}),n||(n=pt=>{console.log("handleSAMToggle function is not provided",pt)});const[Se,Le]=O.useState(!1),[Be,Ve]=O.useState(!1),[Ke,ct]=O.useState(""),[tt,Qe]=O.useState(!1),[Fe,ot]=O.useState(o),Ue=()=>{ct(""),a(!1),Ve(!1),Le(!0)},ze=(pt="annotated")=>{ct(pt),a(!1),Le(!1),Ve(!0)},Ge=()=>{le!=null&&le.total_verified_images_count?ze("verified"):ze("annotated")},dt=pt=>{t("annotate"),n(pt),ot(pt)},qe=pt=>{typeof t=="function"&&t("edit"),typeof n=="function"&&n("Normal"),typeof ot=="function"&&ot("Normal")},ft=()=>{if(Fe=="Normal"){if(!p2.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for))return;dt("SAM")}else dt("Normal")},Nt=()=>{k&&s||typeof a=="function"&&a(pt=>!pt)};O.useEffect(()=>{o&&ot(o)},[o]);const Kt=pt=>{i&&typeof i=="function"&&i(pt,!0)},sn=()=>{xe(!de)},Nn=()=>{Oe(!Ie)};return ve&&we?null:we?Z.jsx(Z.Fragment,{children:Z.jsx(Id,{toggleSelectAnnotation:P,handleLeftKeyDown:T,handleRightKeyDown:N,handleUpKeyDown:F,handleDownKeyDown:j,handleZoomInClick:u,handleZoomOutClick:g,handleCompleteAnnotation:m,undoAnnotationPoint:z,reLoadAndReDrawAnnotations:H,togglePagination:R,toggleFullscreen:v,switchToAutoAnnotations:ft,openShortCutRequestDetails:Nt,handleRecentAnnotatedVerifiedImages:Ge,samAPIactive:w,request:le,handleSendToSamFunctionPrompt:M,switchToEditMode:$,switchToCreateMode:W,goToNextImage:q,goToPreviousImage:K,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,openShortCutKeyModal:tt,setOpenShortCutKeyModal:Qe,setIsAltViaToolPressHandle:sn,isCarousel:we,selectedTool:Fe,setCrossHairHandle:Nn,loggedUser:ee,controlMinusHotkey:ne,controlPlusHotkey:fe})}):Z.jsxs("div",{style:{...D||ge==="library"?{width:"100%",height:"40px"}:{height:"100%",width:"100%",maxHeight:"100%"},overflow:"auto"},children:[Z.jsx(Z.Fragment,{children:Z.jsx(Id,{toggleSelectAnnotation:P,handleLeftKeyDown:T,handleRightKeyDown:N,handleUpKeyDown:F,handleDownKeyDown:j,handleZoomInClick:u,handleZoomOutClick:g,handleCompleteAnnotation:m,undoAnnotationPoint:z,reLoadAndReDrawAnnotations:H,togglePagination:R,toggleFullscreen:v,switchToAutoAnnotations:ft,openShortCutRequestDetails:Nt,handleRecentAnnotatedVerifiedImages:Ge,samAPIactive:w,request:le,handleSendToSamFunctionPrompt:M,switchToEditMode:$,switchToCreateMode:W,goToNextImage:q,goToPreviousImage:K,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,openShortCutKeyModal:tt,setOpenShortCutKeyModal:Qe,setIsAltViaToolPressHandle:sn,selectedTool:Fe,setCrossHairHandle:Nn,loggedUser:ee,isCarousel:we,controlMinusHotkey:ne,controlPlusHotkey:fe})}),Z.jsxs("div",{className:Sn.annotation__tool__icons,style:{display:"flex",justifyContent:D?"center":"space-between",flexDirection:D?"row":"column",backgroundColor:"#fff",width:D?"100%":"auto",...D||ge=="library"?{maxWidth:"100%",overflowX:"auto",gap:"20px"}:{height:"100%"}},children:[Z.jsxs("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[(le==null?void 0:le.awi_request_for)!="attributes"?Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:!e},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>{typeof t=="function"&&t("annotate")},title:e?"Create to change from edit to create mode":"Create to start create mode",children:(le==null?void 0:le.awi_annotation_type)&&((Yt=le==null?void 0:le.awi_annotation_type)==null?void 0:Yt.length)>0&&Z.jsx("img",{src:v_(le==null?void 0:le.awi_annotation_type),alt:"annotation tool",title:"Annotate - keyboard(Q)",className:Sn.annotationIcon})}):Z.jsx("div",{className:Sn.annotationIconDiv,children:(le==null?void 0:le.awi_annotation_type)&&((An=le==null?void 0:le.awi_annotation_type)==null?void 0:An.length)>0&&Z.jsx("img",{src:v_(le==null?void 0:le.awi_annotation_type),alt:"annotation tool",title:"Annotate - keyboard(Q)",className:Sn.annotationIcon})}),r&&Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:e},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>qe(),title:"Edit - keyboard(E)",children:Z.jsx("img",{src:q1.editIcon.IconComponent,alt:"Edit",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:oe},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>se(!oe),title:"Control",children:Z.jsx("img",{src:q1.controlIcon.IconComponent,alt:"Control",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:de},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>xe(!de),title:"Alt press / Panning mode",children:Z.jsx("img",{src:q1.moveIcon.IconComponent,alt:"Alt",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:Ie},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>Oe(!Ie),title:"Cross Hair",children:Z.jsx("img",{src:q1.crosshairIcon.IconComponent,alt:"Cross Hair",className:Sn.annotationIcon})}),!e&&(le==null?void 0:le.awi_annotation_type)==="polygon"&&(le==null?void 0:le.awi_request_for)!="attributes"&&S.length>2?Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:m,title:"Click to complete your polygon annotation",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:q1.filledTickIcon.IconComponent,className:Sn.annotationIcon})})}):Z.jsx(Z.Fragment,{children:(le==null?void 0:le.awi_annotation_type)==="polygon"&&Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{title:"Works for create mode with minimum 3 coordinates",className:Sn.annotationIconDiv,style:{cursor:"not-allowed !important",opacity:"0.5"},children:Z.jsx("img",{src:q1.filledTickIcon.IconComponent,className:qn(Sn.annotationIcon,"not-allowed-pointer")})})})}),Z.jsx("div",{className:Sn.partitionLine})]}),Z.jsxs("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsxs("div",{onClick:((_n=p==null?void 0:p.past_coords)==null?void 0:_n.length)>0&&e&&A!=="-1"?x:void 0,title:((Qt=p==null?void 0:p.past_coords)==null?void 0:Qt.length)>0&&e&&A!=="-1"?"Click to revert annotation":"No undo available",style:{width:"1.8rem",height:"1.8rem",position:"relative",cursor:((kt=p==null?void 0:p.past_coords)==null?void 0:kt.length)>0&&e&&A!=="-1"?"pointer":"not-allowed",opacity:((Ht=p==null?void 0:p.past_coords)==null?void 0:Ht.length)>0&&e&&A!=="-1"?1:.5,pointerEvents:((xt=p==null?void 0:p.past_coords)==null?void 0:xt.length)>0&&e&&A!=="-1"?"auto":"none"},children:[Z.jsx("img",{src:q1.undoAnnotationIcon.IconComponent,alt:"Undo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"0.25rem"}}),((Zt=p==null?void 0:p.past_coords)==null?void 0:Zt.length)>0&&e&&A!=="-1"&&Z.jsx("div",{className:Sn.undoAnnotationCount,children:p.past_coords.length})]})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("img",{onClick:u,src:q1.zoomInIcon.IconComponent,className:`cursor-pointer ${d.scale===BJ?"cursor-pointer-disable":""} ${Sn.annotationIcon}`,title:"Zoom in - Keyboard(I)"})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("div",{onClick:h,title:`Click to Reset Zoom ${d.scale.toFixed(1)} to default`,className:Sn.annotationIcon,style:{fontSize:"12px",justifyContent:"center",display:"flex"},children:d.scale.toFixed(1)})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("img",{onClick:g,src:q1.zoomOutIcon.IconComponent,className:`cursor-pointer ${d.scale===1?"cursor-pointer-disable":""} ${Sn.annotationIcon}`,title:"Zoom out - Keyboard(O)"})}),Z.jsx("div",{onClick:()=>v(),className:Sn.annotationIconDiv,style:{display:"flex",alignItems:"center",justifyContent:"center"},title:"Toggle Fullscreen - Keyboard(F)",id:"toggle_full_screen",children:Z.jsx("img",{src:q1.toggleFullscreenIcon.IconComponent,className:Sn.annotationIcon})}),Z.jsx("div",{className:Sn.partitionLine})]}),Z.jsxs("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[et=="yes"&&p2.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for)&&Z.jsx("div",{style:{display:"flex",alignItems:"center"},title:"AI tools - keyboard(S)",children:Z.jsxs("label",{className:Sn.switch,style:{marginLeft:"4px",width:"30px important"},children:[Z.jsx("input",{type:"checkbox",checked:Fe==="SAM",onChange:()=>{dt(Fe==="SAM"?"Normal":"SAM")}}),Z.jsx("span",{className:qn(Sn.slider,Sn.round)})]})}),p2.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for)&&Z.jsxs("div",{className:qn({"disabled-class":!y}),style:{justifyContent:"space-between",display:"flex",flexDirection:D?"row":"column",gap:"15px"},children:[(le==null?void 0:le.awi_annotation_type)&&(le==null?void 0:le.awi_annotation_type)!="dot"&&Z.jsx("div",{onClick:()=>{!w&&(S!=null&&S.length)&&E()},className:qn({"disabled-class":!y||w||!(S!=null&&S.length)},Sn.annotationIconDiv,"cursor-pointer"),style:{pointerEvents:w||!y?"none":"auto",opacity:w||!y?.5:1},children:Z.jsx("img",{src:q1.pointAnnotationIcon.IconComponent,title:"Mark some points and then click here and get the power of AI auto annotation",className:Sn.annotationIcon})}),Z.jsx("div",{onClick:w?void 0:M,style:{pointerEvents:w||!y?"none":"auto",opacity:w||!y?.5:1},title:"Give your prompt and get the power of AI auto annotation",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:q1.promptAnnotationIcon.IconComponent,title:"auto annotation prompt - keyboard(X)",className:Sn.annotationIcon})})]}),Z.jsx("div",{onClick:H,title:"Click to refetch saved annotations, hard reset",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:q1.refetchAnnotationIcon.IconComponent,title:"Refetch annotations (Hard Reset) - keyboard(R)",className:Sn.annotationIcon})}),Z.jsx("div",{style:{width:"53%",height:"2px",backgroundColor:"#e4e0e6",margin:"8px auto"}})]}),Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:()=>{typeof a=="function"&&a(pt=>!pt)},title:"View details - keyboard(V)",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:q1.guidelinesIcon.IconComponent,alt:"info",style:{height:"30px !important",width:"30px !important",cursor:"pointer"}})})}),Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{children:Z.jsx("img",{src:q1.keyboardShortcutsIcon.IconComponent,title:"See short-cut keys",className:"cursor-pointer",width:"30px",onClick:()=>Qe(pt=>!pt)})})}),Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:R,children:Z.jsx("img",{src:q1.transparentBlackIcon.IconComponent,style:{height:"24px",width:" 24px",cursor:"pointer"},alt:"Previous",title:Y?"Hide Pagination":"Show Pagination"})})})]}),s&&_e&&Z.jsx(_e,{request:le,handleReferenceImageClick:Ue,handleRecentAnnotatedImages:ze,show_guidelines_first:c,setOpenRequestDetails:a,classColorMapToSend:he}),s&&_e&&Z.jsx("div",{className:qn(Sn.backdrop),onClick:()=>{c||typeof a=="function"&&a(!1)}}),s&&Z.jsx("div",{className:qn(Sn.backdrop),onClick:()=>{k||typeof a=="function"&&a(!1)}}),pe&&Se&&Z.jsx(Z.Fragment,{children:Z.jsx(pe,{handleToggleCarousel:()=>Le(!1),requestName:(le==null?void 0:le.awi_label)||"",showAnnotationType:"all",requestId:(ae==null?void 0:ae.awi_id)||(le==null?void 0:le.awi_id),imageKeys:((Cn=ae==null?void 0:ae.awi_reference_images)==null?void 0:Cn.awi_ids)||((mt=le==null?void 0:le.awi_reference_images)==null?void 0:mt.awi_ids)||[],awi_reference_image:!0,defaultAnnotationMode:"display_annotations",allowedToCopy:!0,copyCallBack:Kt})}),Se&&Z.jsx("div",{className:qn(Sn.backdrop,Sn.backdrop__transparent),onClick:()=>Le(!1)}),pe&&Be&&Z.jsx(Z.Fragment,{children:Z.jsx(pe,{handleToggleCarousel:()=>Ve(!1),requestName:(le==null?void 0:le.awi_label)||"",showAnnotationType:"all",requestId:(ae==null?void 0:ae.awi_id)||(le==null?void 0:le.awi_id),awi_reference_image:!1,contentAnnotationType:Ke||"annotated",primaryLimit:LJ,defaultAnnotationMode:"display_annotations",allowedToCopy:!0,copyCallBack:Kt})})]})},sc={canvas:"_canvas_145op_1",canvasContainer:"_canvasContainer_145op_9",canvasSubContainer:"_canvasSubContainer_145op_18"},lc=({canvasDimensions:e,zoomProperties:t,isEditing:n,canvasRef:r,bgCanvasRef:o,overlayCanvasRef:i,handleMouseDown:a,handleMouseUp:s,handleMouseMove:c,handleMouseMoveOut:u,handleOnMouseLeave:d,handleWheel:h,handleTouchStart:g,handleTouchMove:m,handleTouchEnd:v,handleTouchCancel:A})=>Z.jsxs("div",{className:sc.canvasSubContainer,style:{display:"flex",flexDirection:"row",width:e.width,height:e.height,position:"relative"},children:[Z.jsx("canvas",{ref:o,className:sc.bgCanvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,zIndex:0,pointerEvents:"none"}}),Z.jsx("canvas",{ref:r,className:sc.canvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,cursor:n?"default":"crosshair",transformOrigin:"top left",transform:`translate(${t.x}px, ${t.y}px)`},onMouseDown:a,onMouseUp:s,onMouseMove:c,onMouseOut:u,onMouseLeave:d,onWheel:h,onTouchStart:g,onTouchMove:m,onTouchEnd:v,onTouchCancel:A}),Z.jsx("canvas",{ref:i,className:sc.overlayCanvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,pointerEvents:"none",zIndex:2,transformOrigin:"top left",transform:`translate(${t.x}px, ${t.y}px)`}})]}),kJ=1e-5,OJ=.99999,IJ=.001,DJ=.005,cc=(e,t)=>e/(t||1),A_=(e,t,n,r)=>Math.sqrt(Math.pow(Math.abs(n-e),2)+Math.pow(Math.abs(r-t),2)),Dd=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(n.x-e.x)*(t.y-e.y),PJ=e=>{let t=1/0,n=1/0,r=-1/0,o=-1/0;return e.forEach(({x:i,y:a})=>{t=Math.min(t,i),n=Math.min(n,a),r=Math.max(r,i),o=Math.max(o,a)}),{minX:t,minY:n,maxX:r,maxY:o}},Pd=(e,t,n=0)=>{let r=0;for(let o=0;o<(t==null?void 0:t.length)-1;o++){const i=t[o],a=t[o+1];i.y<=e.y+n?a.y>e.y+n&&Dd(i,a,e)>0&&r++:a.y<=e.y-n&&Dd(i,a,e)<0&&r--}return r},Nd=e=>(e==null?void 0:e.length)<2?0:Math.sqrt(Math.pow(Math.abs(e[0].x-e[1].x),2)+Math.pow(Math.abs(e[0].y-e[1].y),2));function NJ(e,t,n=0){const r=Math.min(...t.map(u=>u.x)),o=Math.max(...t.map(u=>u.x)),i=Math.min(...t.map(u=>u.y)),a=Math.max(...t.map(u=>u.y)),{x:s,y:c}=e;return s>=r-n&&s<=o+n&&c>=i-n&&c<=a+n}const TJ=(e,t,n,r,o,i,a=1)=>{if(!(n!=null&&n.length))return!1;let s,c,u,d,h=!1;switch(i==null?void 0:i.awi_annotation_type){case"rectangle":h=NJ({x:e,y:t},n,r);break;case"polygon":h=Pd({x:e,y:t},n,r)!==0;break;case"circle":s=Nd(n)/2,c=(n[0].x+r+(n[1].x-o))/2,u=(n[0].y+n[1].y)/2,d=(e-c)*(e-c)+(t-u)*(t-u),d<s*s?h=!0:h=!1;break;case"dot":s=cc(.015,a),c=(n[0].x+r+(n[0].x-o))/2,u=(n[0].y+n[0].y)/2,d=(e-c)*(e-c)+(t-u)*(t-u),d<s*s?h=!0:h=!1;break;default:h=Pd({x:e,y:t},n,r)!==0}return h},RJ=e=>!(!e||e.x>1||e.x<0||e.y1>1||e.y<0),FJ=e=>{if((e==null?void 0:e.length)<3)return!1;for(let t=0;t<e.length;t++)if(!RJ(e[t]))return!1;return!0},zJ=(e,t,n=!1,r=1)=>{var a,s,c,u;const o=e==null?void 0:e.awi_annotation_type;let i=!1;switch(o){case"rectangle":const d=cc(IJ,r);(t==null?void 0:t.length)>3&&Math.abs(((a=t[0])==null?void 0:a.x)-((s=t[1])==null?void 0:s.x))>d&&Math.abs(((c=t[1])==null?void 0:c.y)-((u=t[3])==null?void 0:u.y))>d&&(i=!0);break;case"circle":const h=cc(DJ,r);Nd(t)>h&&(i=!0);break;case"polygon":i=FJ(t);break;case"dot":i=!0;break;default:n&&(i=!0);break}return i},b_=(e,t,n,r,o,i)=>{const a=e-n,s=t-r,c=o-n,u=i-r,d=a*c+s*u,h=c*c+u*u,g=h!==0?d/h:-1;let m,v;g<0?(m=n,v=r):g>1?(m=o,v=i):(m=n+g*c,v=r+g*u);const A=e-m,p=t-v;return Math.sqrt(A*A+p*p)},jJ=(e,t,n)=>{let r=1/0,o=-1;for(let i=0;i<(e==null?void 0:e.length);i++){const a=(i+1)%e.length,{x:s,y:c}=e[i],{x:u,y:d}=e[a],h=b_(t,n,s,c,u,d);h<r&&(r=h,o=a)}return{insertIndex:o,minDistance:r}},__=(e,t)=>t===0?e:__(t,e%t),VJ=(e,t,n,r)=>(e>0&&(e=0),Math.abs(e)>n&&(e=-1*n),Math.abs(t)>r&&(t=-1*r),t>0&&(t=0),{newXTransform:e,newYTransform:t}),ZJ=function(e){console.log("getBoundingBox called");const t=Math.min(...e.map(i=>i.x)),n=Math.max(...e.map(i=>i.x)),r=Math.min(...e.map(i=>i.y)),o=Math.max(...e.map(i=>i.y));return[{x:t,y:r},{x:n,y:r},{x:n,y:o},{x:t,y:o}]};function UJ(e,t,n){return Math.min(n,Math.max(t,e))}function $J(e,t=.05,n=null){const r=Math.min(...e.map(h=>h.x)),o=Math.max(...e.map(h=>h.x)),i=Math.min(...e.map(h=>h.y)),a=Math.max(...e.map(h=>h.y)),s=o-r,c=a-i;let u,d;if(n&&(n==null?void 0:n.x)>=0&&(n==null?void 0:n.y)>=0){const h=n.x,g=n.y;u=Math.max(-r,Math.min(1-o,h-(r+s/2))),d=Math.max(-i,Math.min(1-a,g-(i+c/2)))}else u=Math.max(-r,Math.min(1-o,(Math.random()*2-1)*t)),d=Math.max(-i,Math.min(1-a,(Math.random()*2-1)*t));return e.map(h=>({x:h.x+u,y:h.y+d}))}function WJ(e){const t=Math.min(...e.map(s=>s.x)),n=Math.max(...e.map(s=>s.x)),r=Math.min(...e.map(s=>s.y)),o=Math.max(...e.map(s=>s.y));return y_([{x:t,y:r},{x:n,y:o}])}function KJ(e){const t=Math.min(...e.map(s=>s.x)),n=Math.max(...e.map(s=>s.x)),r=Math.min(...e.map(s=>s.y)),o=Math.max(...e.map(s=>s.y)),i=(t+n)/2,a=(r+o)/2;return[{x:i,y:a}]}const Td=(e,t)=>(e.x-t.x)**2+(e.y-t.y)**2,QJ=(e,t,n)=>{const r=Td(t,n);if(r===0)return Td(e,t);let o=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;o=Math.max(0,Math.min(1,o));const i={x:t.x+o*(n.x-t.x),y:t.y+o*(n.y-t.y)};return Td(e,i)},GJ=(e,t)=>{let n=1/0;for(let r=0;r<(t==null?void 0:t.length);r++){const o=t[r],i=t[(r+1)%t.length],a=QJ(e,o,i);n=Math.min(n,a)}return Math.sqrt(n)},YJ=(e,t)=>{let n=1/0,r=-1;for(let o=0;o<(t==null?void 0:t.length);o++){const i=t[o],a=A_(e.x,e.y,i.x,i.y);if(a<n){const s=o%t.length;n=a,r=s}}return{minDistance:n,insertIndex:r}},Rd=(e=0)=>(e<=0?e=kJ:e>=1&&(e=OJ),e),qJ=e=>e.map(n=>({x:Rd(n.x),y:Rd(n.y)})),XJ=e=>{const t=new Set,n=[];for(let r=0;r<e.length;r++){const o=`${e[r].x},${e[r].y}`;t.has(o)||(t.add(o),n.push(e[r]))}return n.length>0&&n.push(n[0]),n},JJ=e=>{let t=0;for(let n=0;n<e.length;n++)if(e[n].x<=0){t=t+1;continue}else if(e[n].y<=0){t=t+1;continue}else if(e[n].x>=1){t=t+1;continue}else if(e[n].y>=1){t=t+1;continue}return t};function eee(e){const t=Math.min(...e.map(s=>s.x)),n=Math.min(...e.map(s=>s.y)),r=Math.max(...e.map(s=>s.x)),o=Math.max(...e.map(s=>s.y)),i=t<0?-t:r>1?1-r:0,a=n<0?-n:o>1?1-o:0;return e.map(({x:s,y:c})=>({x:s+i,y:c+a}))}const tee=(e,t)=>{const n=(e.x+t.x)/2,r=(e.y+t.y)/2,o=Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)/2,i=Math.min(n,1-n),a=Math.min(r,1-r),s=Math.min(o,i,a),c=Math.atan2(t.y-e.y,t.x-e.x),u={x:n-s*Math.cos(c),y:r-s*Math.sin(c)},d={x:n+s*Math.cos(c),y:r+s*Math.sin(c)};return[u,d]},nee=(e,t)=>{const n=(e[0].x+e[1].x)/2,r=t,i=Math.sqrt(Math.pow(e[1].x-e[0].x,2))/2;let a=0;return n-i<0?a=i-n:n+i>1&&(a=1-(n+i)),e[0].x+=a,e[1].x+=a,e[0].y=r,e[1].y=r,e},y_=e=>{e=tee(e[0],e[1]);const t=(e[0].x+e[1].x)/2,n=(e[0].y+e[1].y)/2,o=Math.sqrt(Math.pow(e[1].x-e[0].x,2)+Math.pow(e[1].y-e[0].y,2))/2;let i=0;t-o<0?i=o-t:t+o>1&&(i=1-(t+o));let a=0;return n-o<0?a=o-n:n+o>1&&(a=1-(n+o)),e[0].x+=i,e[0].y+=a,e[1].x+=i,e[1].y+=a,nee(e,n)},ree=(e,t,n)=>{let{x:r,y:o}=w_(e.current,t);const i=n;r=Math.min(r,1),o=Math.min(o,1);const a=r-i.x,s=o-i.y;let c=[];return a===0||s===0?c=[{x:i.x,y:i.y},{x:i.x,y:i.y},{x:i.x,y:i.y},{x:i.x,y:i.y}]:a>0&&s>0?c=[{x:i.x,y:i.y},{x:r,y:i.y},{x:r,y:o},{x:i.x,y:o}]:a>0&&s<0?c=[{x:i.x,y:o},{x:r,y:o},{x:r,y:i.y},{x:i.x,y:i.y}]:a<0&&s>0?c=[{x:r,y:i.y},{x:i.x,y:i.y},{x:i.x,y:o},{x:r,y:o}]:c=[{x:r,y:o},{x:i.x,y:o},{x:i.x,y:i.y},{x:r,y:i.y}],c},w_=(e,t)=>{if(!e)return{x:0,y:0};const n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/(n.right-n.left),y:(t.clientY-n.top)/(n.bottom-n.top)}},kn={gcd:__,getDistance:A_,isLeft:Dd,windingNumber:Pd,getDiameter:Nd,checkPointInsidePolygon:TJ,isAnnotationCoordinatesValid:zJ,distanceToSegment:b_,findClosestSegment:jJ,transformCoordinatesCheck:VJ,getBoundingBox:ZJ,translateCoordinatesWithFixedWidth:$J,clampValue:UJ,calculateCircleFromCoordinates:WJ,calculateCentroid:KJ,minDistanceToPolygon:GJ,closestCoordinates:YJ,fineTuneCoordinates:qJ,zoomLevelValue:cc,createPolygonLoop:XJ,breakPointCount:JJ,getBoundingBoxValues:PJ,shiftPolygon:eee,getPerfectPointValue:Rd,adjustToCircle:y_,getMousePos:w_,getMousePosAbsolute:(e,t)=>{if(!e)return{x:0,y:0};const n=e.getBoundingClientRect(),r={x:(t.clientX-n.left)/(n.right-n.left),y:(t.clientY-n.top)/(n.bottom-n.top)};return r.x<=0&&(r.x=1e-4),r.y<=0&&(r.y=1e-4),r.x>=1&&(r.x=1-1e-4),r.y>=1&&(r.y=1-1e-4),r},getUpdatedCoordinates:ree},oee=({imageUrl:e,showAnnotations:t=!1,createAnnotation:n,handleMultipleAnnotations:r,handleUpdateAnnotationCoordinates:o,content_id:i,request_id:a,className:s="",isEditing:c=!1,selectIndex:u="-1",handleSelectAnnotationIndex:d,handleSelectTool:h,showAnnotationType:g="all",loggedUser:m,isCarousel:v=!1,classColorMap:A=null,disableAnnotation:p=!1,SAMToggle:x,imageNumber:y=0,togglePagination:w,handleSAMToggle:E,unSelectedAnnotationIDsSet:S=new Set,setMousePosition:M,allowedToCopyPreview:H=!1,copyCallBackHandler:k,annotationSession:D,SAMToggleValue:P,selectedSAMTool:T,handleCopyAnnotations:N,setOpenRequestDetails:F,openRequestDetails:j,handleNextPage:z,handlePreviousPage:R,currentPage:$,handleUpdateImageIndex:W,requestId:q,showPagination:K,isAnnotationCreating:U,contentInfo:G,content_key:J,isAnnotationUpdating:Y,isDeleteAnnotationMutationLoading:ee,showGuidelinesFirst:oe,currentImage:de=0,selectedContent:se=null,switchToEditMode:xe,switchToCreateMode:we,goToNextImage:ve,goToPreviousImage:he,handleGoToPendingAnnotations:le,handlePasteAnnotationsByControlV:ae,annotationsResponse:_e,isAnnotationFetching:Oe,fetchAnnotationsKey:Ie,request:ge,parentReqData:et,clearAnnotationCache:fe,RequestInfoModal:ne,getAnnotationFromSAM:pe,getAnnotationsFromSAMPrompt:Se,fetchAnnotations:Le,pageCount:Be=10,annotationViewType:Ve="atom",AnnotationPagination:Ke,REACT_APP_SAM_ENABLED:ct="no",ImageGenerationHelper:tt=qb,fallbackImageUrl:Qe,activeColor:Fe,Carousel:ot,showTool:Ue=!0})=>{var Si,h9,f,b,B,V,X,ie,De,Je,rt,Bt,on,Pn,Yn,g0;const ze=km().isCtrlPressedFunc,Ge=km().isAltPressedFunc,[dt,qe]=O.useState(!1),[ft,Nt]=O.useState(!1),Kt=.007,sn=.03,Nn=.01,Yt=.005,An=.005,_n=.7,Qt=.005,kt=.005,Ht=.003,xt=.01,Zt="#40ff00",Cn="#fff",mt="#FFFF00",pt="red",Lt="rgba(0, 255, 255, 1)",Xe="rgba(0, 255, 255, 0.5)",Vt="#FF3131",Ae=4,it=5,$e={DEFAULT:1.5,SELECTED:4.5,CAROUSAL:2.5,CIRCLE:2},_t=O.useRef(""),Ye=O.useRef(null),Et=O.useRef(null),Ot=O.useRef(null),zt=Yv(),[Mn,At]=O.useState(!1),[bt,Tt]=O.useState(!1),[nt,Rt]=O.useState([]),[Ut,_1]=O.useState(),[O1,l1]=O.useState(),[e1,Kn]=O.useState({x:-1,y:-1}),[y1,Q1]=O.useState(-1),[tn,Hn]=O.useState({x:0,y:0}),[Pt,un]=O.useState(u),[Vn,T1]=O.useState("-1"),[r1,w1]=O.useState([]),[mn,$t]=O.useState(!1),[yn,Ln]=O.useState(null),[yt,Dt]=O.useState({width:0,height:0}),Ft=B1.INITIAL_ZOOM_PROPERTIES,[at,pn]=O.useState(Ft),[Tn,R1]=O.useState(!1),[u1,u0]=O.useState(!1),[fn,wn]=O.useState(-1),[rn,jt]=O.useState(!1),qt=B1.INITIAL_ZOOM_LEVEL,Qn=12,Gn=yt.width*qt,H1=O.useRef(null),[bn,Hr]=O.useState(_e),[Fn,ir]=O.useState(),[vn,hn]=O.useState([]),[In,I1]=O.useState(null),a0=B1.SAM_MODEL_NAME,L1=B1.SAM_MODEL_CONFIDENCE,J2=B1.SAM_MODEL_MAX_RESULTS,[Ur,zn]=O.useState(!1),[t1,ci]=O.useState(-1),[h3,o9]=O.useState(null),[eo,i9]=O.useState(null),[g3,C3]=O.useState(null),[C1,R0]=O.useState({modelName:"",modelConfidence:0,modelMaxResults:0,promptMessage:""}),[vr,Lr]=O.useState(null),[ui,a9]=O.useState(!1),[y0,W5]=O.useState({x:-1,y:-1}),[l2,K5]=O.useState({left:0,right:0,top:0,bottom:0}),[$r,s9]=O.useState(null),[c2,d0]=O.useState(""),Q5={SELECT:2e3,NOT_SELECT:500},[A0,to]=O.useState(""),di=window.devicePixelRatio,[j1,fi]=O.useState(window.innerWidth<768*di),[m3,e0]=O.useState(window.innerWidth<1200*di),Ar=O.useRef(null),hi=O.useRef(null),[G5,gi]=O.useState(!1);O.useEffect(()=>{const be=()=>{fi(window.innerWidth<768*di),e0(window.innerWidth<1200*di)};return window.addEventListener("resize",be),()=>window.removeEventListener("resize",be)},[]),O.useEffect(()=>{G5&&ha()},[G5,at,yt]),O.useEffect(()=>{if(!c2){hi.current=null,gi(!1);return}const be=new window.Image;be.onload=()=>{hi.current=be,gi(!0)},be.src=c2},[c2]),O.useEffect(()=>(ht(nt),vi(),()=>{$r&&clearTimeout($r)}),[Vn]),O.useEffect(()=>{v||document.fullscreenElement||ki.getItem("full_screen")=="yes"&&d2(!1),window.addEventListener("resize",Ir)},[]),O.useEffect(()=>{console.log("Change"),Rt([]),ia(),setTimeout(()=>{ht()},50)},[c]),O.useEffect(()=>{A&&ht(nt)},[A]),O.useEffect(()=>{i&&(i==null?void 0:i.length)>0&&r0()},[i]),O.useEffect(()=>{Hr(_e||null)},[_e,i]),O.useEffect(()=>{if(e){const be=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1));br(be)}Rt([])},[e]),O.useEffect(()=>{c2&&(_t.current=c2,D1())},[c2]),O.useEffect(()=>{_t.current&&Ir()},[_t.current,c2]),O.useEffect(()=>{x=="SAM"?R1(!0):R1(!1),Y5()},[x]),O.useEffect(()=>{at.scale==1&&(at.x!=0||at.y!=0)&&r0()},[at.scale]),O.useEffect(()=>{if(((bn==null?void 0:bn.result)||[]).length>=0){const{x:be,y:Ce}=kn.getMousePos(Ye.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});D1(nt,{x:be,y:Ce})}},[yt,t,at.scale,Vn]),O.useEffect(()=>{ia(),((bn==null?void 0:bn.result)||[]).length>=0&&ht()},[r1,Pt]),O.useEffect(()=>{if(ge&&bn&&(bn!=null&&bn.result)&&((bn==null?void 0:bn.result)||[]).length>=0){ht(nt);const be={},Ce={};for(let Me=0;Me<bn.result.length;Me++)be[bn.result[Me].awi_id]={...bn.result[Me],index:Me},(ge==null?void 0:ge.awi_annotation_type)=="polygon"&&(Ce[bn.result[Me].awi_id]=kn.getBoundingBoxValues(bn.result[Me].awi_coords));i9(be),(ge==null?void 0:ge.awi_annotation_type)=="polygon"&&I1(Ce),(ge==null?void 0:ge.awi_request_for)=="attributes"&&bn.result.length>0&&u=="-1"&&typeof d=="function"&&setTimeout(()=>{d(bn.result[0].awi_id)},100)}else i9(null),I1(null);v3()},[ge,bn]),O.useEffect(()=>{v3()},[S]),O.useEffect(()=>{console.log("Filter annotation change"),D1(nt),setTimeout(()=>{D1(nt)},100)},[vn]),O.useEffect(()=>{u!=="-1"?typeof h=="function"&&(ge==null?void 0:ge.awi_request_for)!=="outline"&&h("edit"):w1([]),Tn&&typeof h=="function"&&un("-1"),un(u||"-1")},[u]),O.useEffect(()=>{v||y==0&&Tn!==void 0&&(Tn?V1.success("Switched to Auto Annotation mode"):ge!=null&&ge.awi_annotation_type&&V1.success(`Switched to ${ge==null?void 0:ge.awi_annotation_type} Annotation mode`))},[Tn]),O.useEffect(()=>{if(!M||typeof M!="function")return;Ai();const be=setTimeout(()=>{const{x:Ce,y:Me}=kn.getMousePosAbsolute(Ye.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});M({x:Ce,y:Me})},30);return()=>clearTimeout(be)},[Ut]),O.useEffect(()=>{u1?Ai():yi(-1,-1)},[u1]),O.useEffect(()=>{u!="-1"&&eo&&ir(eo[u])},[u,eo]),O.useEffect(()=>{pi(),Ai()},[at,yt]);const El=be=>{const Ce=be.message;to(Ce)};O.useEffect(()=>{let be="";U?be="Creating Annotation...":ee?be="Deleting Annotation...":Y?be="Updating Annotation...":Oe?be="Fetching Annotations...":rn&&(be="Generating AI Annotations..."),El({message:be})},[U,Y,ee,Oe,rn]),O.useEffect(()=>{Ir()},[K]);const Ci=pe&&typeof pe=="function"?qv(pe):null,mi=Se&&typeof Se=="function"?qv(Se):null,Br=()=>!!(dt||ze()),ar=()=>!!(ft||Ge()),pi=()=>{const be=yt.width*at.scale,Ce=yt.height*at.scale;K5({left:Math.abs(at.x),right:Math.max(0,be-yt.width+at.x),top:Math.abs(at.y),bottom:Math.max(0,Ce-yt.height+at.y)})},oa=O.useMemo(()=>{const be=(bn==null?void 0:bn.result)||[];if(be.length>0&&Pt!=="-1"){let Ce=null,Me=null;const Re=be.reduce((Pe,ut)=>{const{awi_id:wt}=ut;return wt===Pt?Ce=ut:wt===Vn?Me=ut:S.has(wt)||Pe.push(ut),Pe},[]);return Me&&Re.push(Me),Ce&&Re.push(Ce),Re}else return vn},[Pt,Vn,vn]),br=async be=>{Hv.checkImageValidity(be,d0,i,Ve,Qe)},ia=()=>{Vn!="-1"&&($r&&clearTimeout($r),T1("-1"))},vi=()=>{if(Vn!=="-1")if(Pt=="-1"||B1.HOVER_TO_SELECT_ON_ALREADY_SELECTED){const be=Pt=="-1"?Q5.NOT_SELECT:Q5.SELECT;$r&&clearTimeout($r);const Ce=setTimeout(()=>{c&&Vn!="-1"&&Pt!=Vn&&(Pt=="-1"&&mn?vi():typeof d=="function"&&(d(Vn),V1.success("Annotation selected successfully",Vn)))},be);s9(Ce)}else $r&&clearTimeout($r);else $r&&clearTimeout($r)},Ai=()=>{const be=Et.current;if(!be)return;const Ce=yt.width*at.scale,Me=yt.height*at.scale;if(be.width=Ce,be.height=Me,u1){const{x:Re,y:Pe}=kn.getMousePosAbsolute(Et.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});yi(Re,Pe)}},kr=()=>{Rt([])},bi=(be=!1)=>{zt.invalidateQueries(Ie),be&&Rt([])},Or=be=>{var Ce;if(eo&&eo[be])if(c){const Me=eo[be].index,Re=bn==null?void 0:bn.result[Me];return Re||((Ce=bn==null?void 0:bn.result)==null?void 0:Ce.find(Pe=>Pe.awi_id==be))}else return eo[be];else return null},p3=be=>g3&&g3[be]?g3[be].index:-1,Y5=()=>{nt.length>0&&(console.log("clearCoordinate"),Rt([]),D1([],{x:0,y:0},!0))},v3=()=>{if(ge&&((bn==null?void 0:bn.result)||[]).length>=0){let be=[];(S==null?void 0:S.size)>0?be=((bn==null?void 0:bn.result)||[]).filter(Me=>!S.has(Me.awi_id)):be=(bn==null?void 0:bn.result)||[];const Ce={};for(let Me=0;Me<be.length;Me++)Ce[be[Me].awi_id]={...be[Me],index:Me};C3(Ce),hn(be)}else hn([])},n1=be=>(j1&&(be=be*3),kn.zoomLevelValue(be,at.scale)),Wr=new Map,aa=be=>{try{if(!be)return Promise.resolve(B1.DEFAULT_CANVAS_RATION);if(Wr.has(be))return Wr.get(be);const Ce=new Promise((Me,Re)=>{const Pe=new Image;Pe.onload=()=>{const wt={w:Pe.width,h:Pe.height};Wr.set(be,Promise.resolve(wt)),Me(wt)},Pe.onerror=Re;const ut=tt.getImageKitUrl(be,-1,-1,1);ut&&(Pe.src=ut)});return Wr.set(be,Ce),Ce}catch(Ce){return console.error(Ce),Promise.resolve(B1.DEFAULT_CANVAS_RATION)}},Ir=async()=>{var be,Ce,Me,Re,Pe;if(console.log("updateDimensions called"),((be=_t.current)==null?void 0:be.length)>0){console.log("Canvas true");let ut=B1.DEFAULT_CANVAS_RATION;a9(!0);try{ut=await aa(_t.current)}catch(Wt){console.error("Error fetching image dimensions:",Wt,_t.current),ut=B1.DEFAULT_CANVAS_RATION}const wt=kn.gcd(ut.w,ut.h),Jt={w:ut.w/wt,h:ut.h/wt};let gn=0,gt=0;if(gt=((Ce=Ot.current)==null?void 0:Ce.offsetHeight)||0,gn=gt*Jt.w/Jt.h,gn>(((Me=Ot.current)==null?void 0:Me.offsetWidth)||0)&&(gn=((Re=Ot.current)==null?void 0:Re.offsetWidth)||0,gt=gn*Jt.h/Jt.w),(Ye==null?void 0:Ye.current)!=null&&(Ye.current.width=gn,Ye.current.height=gt,vr==null)){const Wt=(Pe=Ye.current)==null?void 0:Pe.getBoundingClientRect();Lr({left:Wt==null?void 0:Wt.left,top:Wt==null?void 0:Wt.top})}Dt({width:gn,height:gt}),a9(!1),D1(nt)}},no=O.useCallback((be,Ce,Me,Re,Pe,ut)=>kn.checkPointInsidePolygon(be,Ce,Me,Re,Pe,ut,at.scale),[]),D2=(be,Ce=!0)=>{const{x:Me,y:Re}=kn.getMousePos(Ye.current,be);let Pe="",ut=1/0;if(c&&_i(Me,Re))return[Pt];const wt=vn||[];if(!Ce&&(wt==null?void 0:wt.length)>B1.MAX_ANNOTATIONS_TO_HOVER)return[];switch(ge==null?void 0:ge.awi_annotation_type){case"circle":{wt.forEach(({awi_coords:Jt,awi_id:gn})=>{if(no(Me,Re,Jt,0,0,ge)){const gt=kn.minDistanceToPolygon({x:Me,y:Re},Jt);gt<ut&&(Pe=gn,ut=gt)}});break}case"dot":{const Jt=n1(An);wt.forEach(({awi_coords:gn,awi_id:gt})=>{if(no(Me,Re,gn,Jt,Jt,ge)){const Wt=kn.minDistanceToPolygon({x:Me,y:Re},gn);Wt<ut&&(Pe=gt,ut=Wt)}});break}case"rectangle":{const Jt=n1(Qt)/2;for(let gn=0;gn<wt.length;gn++){const{awi_coords:gt,awi_id:Wt}=wt[gn];if(no(Me,Re,gt,Jt,0,ge)){const E1=kn.minDistanceToPolygon({x:Me,y:Re},gt);E1<ut&&(Pe=Wt,ut=E1)}}break}case"polygon":{for(let Jt=0;Jt<wt.length;Jt++){const{awi_coords:gn,awi_id:gt}=wt[Jt];if(In){const Wt=In[gt];if(Wt){const{minX:E1,minY:ce,maxX:C0,maxY:F0}=Wt;if(Me<E1||Me>C0||Re<ce||Re>F0)continue}}if(no(Me,Re,gn,0,0,ge)){const Wt=kn.minDistanceToPolygon({x:Me,y:Re},gn);Wt<ut&&(Pe=gt,ut=Wt)}}break}default:console.warn(`Unknown annotation type: ${ge==null?void 0:ge.awi_annotation_type}`);break}return Pe&&Pe.length>0?(Ce&&un(Pe),[Pe]):(Ce&&(console.log("setSelectAnnotationId "),typeof d=="function"&&u!="-1"&&d("-1",!1)),[])},Sl=L4.throttle(D2,50),_i=(be,Ce)=>{const Me=Or(u);if(Me){const Re=Me.awi_coords;if((ge==null?void 0:ge.awi_annotation_type)=="polygon"){const Pe=kn.minDistanceToPolygon({x:be,y:Ce},Re),ut=n1(kt);return Pe<=ut}else if((ge==null?void 0:ge.awi_annotation_type)=="rectangle"){const{insertIndex:Pe,minDistance:ut}=kn.closestCoordinates({x:be,y:Ce},Re),wt=n1(kt);return console.log(Pe),ut<=wt}}else return!1},q5=(be,Ce)=>{const{x:Me,y:Re}=kn.getMousePos(Ye.current,be),Pe=Or(Ce);if(console.log("selectAnnotation",Pe),Pe){const{awi_coords:ut}=Pe;if(ut.length===1){const gt=n1(Yt);no(Me,Re,ut,gt,gt,ge)&&(Tt(!0),$t(!0),l1({x:Me,y:Re}),Rt(ut));return}if(ut.length===2){const{x:gt,y:Wt}=ut[0],{x:E1,y:ce}=ut[1],C0=kn.getDiameter([{x:gt,y:Wt},{x:E1,y:ce}])/2,F0=(gt+E1)/2,p1=(Wt+ce)/2;Tt(!0),$t(!0),l1({x:Me,y:Re}),Kn({x:Me,y:Re}),Rt(ut);const an=(Me-F0)*(Me-F0)+(Re-p1)*(Re-p1),L0=n1(_n);an>L0*L0*C0*C0&&$t(!1);return}const wt=Br()?0:n1(Kt),Jt=no(Me,Re,ut,wt,0,ge),gn=_i(Me,Re);if(!Jt&&!gn)Kn({x:-1,y:-1}),l1({x:0,y:0}),$t(!1);else{if(l1({x:Me,y:Re}),Tt(!0),(ge==null?void 0:ge.awi_annotation_type)=="polygon")if(Br())$t(!0);else if(no(Me,Re,ut,wt,0,ge)){const{minDistance:Wt}=kn.findClosestSegment(ut,Me,Re),E1=n1(xt);Wt>=E1?$t(!0):$t(!1)}else $t(!1);else $t(!0);Rt(ut),Kn({x:-1,y:-1}),Br()||ut.forEach((gt,Wt)=>{if(Me<=gt.x+wt&&Me>=gt.x&&Re<=gt.y+wt&&Re>=gt.y||Me>=gt.x-wt&&Me<=gt.x&&Re>=gt.y-wt&&Re<=gt.y||Me<=gt.x+wt&&Me>=gt.x&&Re>=gt.y-wt&&Re<=gt.y||Me>=gt.x-wt&&Me<=gt.x&&Re<=gt.y+wt&&Re>=gt.y){if((ge==null?void 0:ge.awi_annotation_type)==="polygon")c?(Kn({x:Me,y:Re}),Q1(Wt)):(Q1(Wt),Kn(ut[Wt])),console.log("setSelectCornerCoordinates");else if((ge==null?void 0:ge.awi_annotation_type)==="rectangle"&&!Tn){const E1=ut[(Wt+2)%4];Kn(E1)}else if(c){const E1=ut[(Wt+2)%4];Kn(E1)}else Q1(Wt),Kn(ut[Wt]);$t(!1),Rt([])}})}}},sa=(be="all")=>{const Ce=window.devicePixelRatio;if(be!="cross"&&Ye.current)if(at.scale==1){const Me=+getComputedStyle(Ye.current).getPropertyValue("height").slice(0,-2),Re=+getComputedStyle(Ye.current).getPropertyValue("width").slice(0,-2);Ye.current.setAttribute("height",(Me*Ce).toString()),Ye.current.setAttribute("width",(Re*Ce).toString())}else{const Me=yt.height*at.scale,Re=yt.width*at.scale;Ye.current.setAttribute("height",(Me*Ce).toString()),Ye.current.setAttribute("width",(Re*Ce).toString())}if(Et.current)if(at.scale==1){const Me=+getComputedStyle(Et.current).getPropertyValue("height").slice(0,-2),Re=+getComputedStyle(Et.current).getPropertyValue("width").slice(0,-2);Et.current.setAttribute("height",(Me*Ce).toString()),Et.current.setAttribute("width",(Re*Ce).toString())}else{const Me=yt.height*at.scale,Re=yt.width*at.scale;Et.current.setAttribute("height",(Me*Ce).toString()),Et.current.setAttribute("width",(Re*Ce).toString())}},ko=(be,Ce)=>{const Me=kn.getDistance(be.x,be.y,Ce.x,Ce.y),Re=n1(Kt),Pe=n1(Nn);if(Me<=Pe){let ut=!1;return Me<=Re?ut=!1:Me<=Pe&&(ut=!0),{success:!0,distance:Me,zoomClosePoint:Re,zoomPointAnnotationValue:Pe,isExtraPointNeeded:ut}}else return{success:!1,distance:Me,zoomClosePoint:Re,zoomPointAnnotationValue:Pe,isExtraPointNeeded:!1}},ro=(be=[],Ce={x:0,y:0},Me=!1,Re=!1,Pe)=>{if((be||[]).length>0){Pe.beginPath();const ut=Dr(be);if((ge==null?void 0:ge.awi_annotation_type)==="rectangle")if(Tn){if(c){Pe.moveTo(ut[0].x,ut[0].y);for(let wt=1;wt<ut.length;wt++)Pe.lineTo(ut[wt].x,ut[wt].y);Pe.closePath()}else if(Tn){console.log("Sam function");const wt=Dr(be);Pe.clearRect(0,0,Pe.canvas.width,Pe.canvas.height),Pe.fillStyle="rgba(0, 0, 0, 0.35)",Pe.strokeStyle=Zt,Pe.lineWidth=$e.DEFAULT,wt.forEach(Jt=>{Pe.beginPath(),Pe.arc(Jt.x,Jt.y,it,0,B1.TWO_PIE,!0),Pe.fill(),Pe.stroke()})}}else{Pe.moveTo(ut[0].x,ut[0].y);for(let wt=1;wt<ut.length;wt++)Pe.lineTo(ut[wt].x,ut[wt].y);Pe.closePath()}else if((ge==null?void 0:ge.awi_annotation_type)==="circle")if(Tn&&!c){const wt=Dr(be);console.log("coordinatesVal ",wt),Pe.clearRect(0,0,Pe.canvas.width,Pe.canvas.height),Pe.fillStyle="rgba(0, 0, 0, 0.35)",Pe.strokeStyle=Zt,Pe.lineWidth=$e.DEFAULT,wt.forEach(Jt=>{Pe.beginPath(),Pe.arc(Jt.x,Jt.y,it,0,B1.TWO_PIE,!0),Pe.fill(),Pe.stroke()})}else{const wt=kn.getDiameter(ut);Pe.arc((ut[0].x+ut[1].x)/2,(ut[0].y+ut[1].y)/2,Math.floor(wt/2),0,B1.TWO_PIE)}Pe.save(),Pe.lineWidth=$e.DEFAULT,Pe.strokeStyle=Zt,Pe.stroke()}if((ge==null?void 0:ge.awi_annotation_type)==="polygon"&&(nt||[]).length>0&&!Me&&!c){if(!Tn){const ut=Dr(nt);if(Pe.beginPath(),Pe.lineWidth=$e.DEFAULT,Pe.strokeStyle=Zt,ut.forEach((wt,Jt)=>{if(Jt>0){const gn=ut[Jt-1];Pe.moveTo(gn.x,gn.y),Pe.lineTo(wt.x,wt.y)}}),Pe.stroke(),ut.forEach((wt,Jt)=>{Pe.beginPath(),Pe.arc(wt.x,wt.y,it,0,B1.TWO_PIE,!0),Pe.fillStyle=Jt===0?mt:Zt,Pe.fill()}),!ar()&&!Re&&Ce&&Ce.x>0&&Ce.y>0&&!(Ce.x>.998||Ce.y>.998||Ce.x<.002||Ce.y<.002)){const wt=Dr([Ce]);Pe.beginPath();const Jt=ko(nt[0],Ce);Jt!=null&&Jt.success&&(nt==null?void 0:nt.length)>2?Jt.isExtraPointNeeded?(Pe.beginPath(),Pe.rect(wt[0].x-Ae*3,wt[0].y-Ae*3,Ae*6,Ae*6),Pe.fillStyle=pt,Pe.fill(),Pe.lineWidth=4,Pe.strokeStyle=pt,Pe.stroke()):(Pe.beginPath(),Pe.rect(wt[0].x-Ae*3,wt[0].y-Ae*3,Ae*6,Ae*6),Pe.fillStyle=mt,Pe.fill(),Pe.lineWidth=2,Pe.strokeStyle=mt,Pe.stroke()):Pe.arc(wt[0].x,wt[0].y,Ae,0,B1.TWO_PIE,!0),Pe.fillStyle="rgba(0,0,0,0.35)",Pe.fill(),Pe.strokeStyle=Zt,Pe.stroke();const gn=ut[ut.length-1];Pe.beginPath(),Pe.moveTo(gn.x,gn.y),Pe.lineTo(wt[0].x,wt[0].y),Pe.strokeStyle="#ff0000",Pe.setLineDash([5,5]),Pe.lineWidth=$e.DEFAULT,Pe.stroke(),Pe.setLineDash([])}Pe.closePath(),Pe.lineWidth=$e.DEFAULT,Pe.stroke(),Pe.save()}if(Tn){const ut=Dr(be);Pe.clearRect(0,0,Pe.canvas.width,Pe.canvas.height),Pe.fillStyle="rgba(0, 0, 0, 0.35)",Pe.strokeStyle=Zt,Pe.lineWidth=$e.DEFAULT,ut.forEach(wt=>{Pe.beginPath(),Pe.arc(wt.x,wt.y,it,0,B1.TWO_PIE,!0),Pe.fill(),Pe.stroke()})}}},yi=(be,Ce)=>{const Me=Et.current;if(!Me)return;const Re=Me.getContext("2d");if(!Re||(Re.clearRect(0,0,Me.width,Me.height),be==-1&&Ce==-1))return;sa("cross");const Pe=Dr([{x:be,y:Ce}])[0],ut=Pe.x,wt=Pe.y;Re.strokeStyle="#800080",Re.lineWidth=$e.CAROUSAL,Re.setLineDash([3,3]),Re.beginPath(),Re.moveTo(ut,0),Re.lineTo(ut,Me.height),Re.stroke(),Re.beginPath(),Re.moveTo(0,wt),Re.lineTo(Me.width,wt),Re.stroke(),Re.setLineDash([])},D1=(be=[],Ce={x:0,y:0},Me=!1,Re=!1,Pe=0)=>{var ut,wt,Jt,gn;if(ge&&!ui){const gt=(ut=Ye.current)==null?void 0:ut.getContext("2d");if(sa(),gt!=null){gt.imageSmoothingEnabled=!1,gt.clearRect(0,0,yt.width,yt.height),!c&&(ge==null?void 0:ge.awi_request_for)!="attributes"&&ro(be,Ce,Me,Re,gt);const Wt=oa||[];for(let E1=0;E1<Wt.length;E1++){const ce=Wt[E1],{awi_coords:C0,awi_id:F0,awi_status:p1}=ce;if(C0.length===0)return;const an=Dr(C0);gt.beginPath(),gt.lineJoin="round";let L0=!1,cr="",Gr="";if(g==="all"||p1===g){ce.awi_status==="pending"?cr=ce.awi_outline_status==="approved"?"rgba(214, 204, 60, 0.3)":"rgba(0, 0, 0,0)":cr=B1.STATUS_COLOR_MAP[ce.awi_status]||"rgba(0, 0, 0,0)",Gr=cr;let lo=!1;if(F0===Pt?(gt.lineWidth=$e.SELECTED,gt.strokeStyle=Zt,gt.fillStyle="rgba(0,0,0,0.40)",lo=!0):F0===Vn&&(gt.lineWidth=$e.DEFAULT,gt.strokeStyle=Lt,gt.fillStyle=Xe,lo=!0),!lo)if(gt.fillStyle=cr,v?gt.lineWidth=$e.CAROUSAL:gt.lineWidth=$e.DEFAULT,A){const ur=A[ce.awi_classes[0].awi_id];ur?(Gr=ur,gt.strokeStyle=ur):(Gr=ce.awi_classes[0].awi_color,gt.strokeStyle=ce.awi_classes[0].awi_color)}else Gr=ce.awi_classes[0].awi_color,gt.strokeStyle=ce.awi_classes[0].awi_color;switch(ge==null?void 0:ge.awi_annotation_type){case"circle":{const ur=(an[0].x+an[1].x)/2,Mi=(an[0].y+an[1].y)/2,t4=Math.sqrt(Math.pow(an[1].x-an[0].x,2)+Math.pow(an[1].y-an[0].y,2));gt.beginPath(),gt.arc(ur,Mi,t4/2,0,B1.TWO_PIE),gt.stroke(),gt.closePath(),L0=!0;break}case"dot":{gt.beginPath(),gt.moveTo(an[0].x,an[0].y),gt.arc(an[0].x,an[0].y,Ae,0,B1.TWO_PIE,!0),gt.stroke(),gt.closePath(),L0=!0;break}case"rectangle":{gt.beginPath(),gt.moveTo((wt=an[0])==null?void 0:wt.x,(Jt=an[0])==null?void 0:Jt.y);for(let ur=1;ur<an.length;ur++)gt.lineTo(an[ur].x,an[ur].y);gt.closePath(),gt.stroke(),L0=!0;break}case"polygon":{L0=!0,gt.moveTo(an[0].x,an[0].y);const ur=an.length;for(let Mi=0;Mi<ur;Mi++)gt.lineTo(an[Mi].x,an[Mi].y);break}}if(gt.fill(),gt.save(),gt.stroke(),L0){gt.save();const ur=F0===Pt,Mi=F0===Vn,t4=ce.sam_status==="yes";an.forEach((fu,Hl)=>{gt.beginPath();let Pr=Ae,co="";ur?an.length==1&&(ge==null?void 0:ge.awi_annotation_type)=="dot"||Re&&Hl%(an.length-1)==Pe?(Pr=Ae*2,co=Zt):(co=Zt,Pr=Ae):Mi?(co=Lt,Pr=Ae):(co=Gr,Pr=Ae),(ge==null?void 0:ge.awi_annotation_type)==="polygon"?Hl%(an.length-1)==0&&(t4?co=Vt:co=mt):Hl==0&&an.length>1&&t4&&(co=Vt),gt.arc(fu.x,fu.y,Pr,0,2*Math.PI,!0),gt.fillStyle=co,gt.strokeStyle=co,gt.fill(),gt.stroke(),gt.restore()})}else console.log("Error")}}}Ai()}if(at.scale==1&&(Ye!=null&&Ye.current)){const gt=(gn=Ye==null?void 0:Ye.current)==null?void 0:gn.getBoundingClientRect();Lr({top:gt==null?void 0:gt.top,left:gt==null?void 0:gt.left})}},Dr=be=>be.map(Me=>({x:Me.x*Ye.current.width,y:Me.y*Ye.current.height})),oo=be=>{const{x:Ce,y:Me}=kn.getMousePos(Ye.current,be);Rt(Re=>{const Pe=[...Re];return Pe[1].x=Ce,Pe[1].y=Me,kn.adjustToCircle(Pe)})},f0=be=>{if(be.length===0)return!1;const Ce=kn.isAnnotationCoordinatesValid(ge,be,Tn,at.scale);return Ce||D1(),Ce},X5=(be,Ce)=>(console.log("Has Moved checking"),Math.abs(be.x-Ce.x)>0||Math.abs(be.y-Ce.y)>0),Oo=()=>{if((nt==null?void 0:nt.length)>1){const be=nt[nt.length-1],Ce=[];let Me=!1;for(let Re=0;Re<nt.length-1;Re++){const Pe=nt[Re],ut=n1(Yt);if(Math.abs(be.x-Pe.x)<=ut&&Math.abs(be.y-Pe.y)<=ut){Me=!0;continue}else Ce.push({x:Pe.x,y:Pe.y})}return Me||Ce.push(nt[nt.length-1]),Rt(Ce),Ce}else return nt},J5=()=>{if(typeof n=="function")if(nt.length>3){const be=ko(nt[0],nt[nt.length-1]);let Ce=[];be.success&&(be.isExtraPointNeeded==!1?(nt[nt.length-1].x=nt[0].x,nt[nt.length-1].y=nt[0].y,Ce=nt):be.isExtraPointNeeded&&(Ce=[...nt,{x:nt[0].x,y:nt[0].y}])),(Ce==null?void 0:Ce.length)>0?(Rt([]),n(Ce,null,!1,()=>{kr()})):D1(nt)}else D1(nt)},X0=(be,Ce)=>{console.log("deletePolygonPoint"),console.log("selectIndex ",Ce);const Me=[];for(let Re=0;Re<be.length;Re++)Re!=Ce&&Me.push(be[Re]);Ce==0&&(Me[Me.length-1]=Me[0]),Rt(Me),(Me==null?void 0:Me.length)>3?(D1(Me),typeof o=="function"&&f0(Me)&&!p&&(V1.success("Point deleted successfully"),o(Me,u,()=>{kr()}))):V1.error("Point can not be deleted, as polygon need minimum of three points"),ci(-1),o9(null)};function sr(be,Ce){console.log("handleAddAnnotationPoint");const Me=be.target;if(!(Me!=null&&Me.getBoundingClientRect))return;const Re=Me.getBoundingClientRect(),Pe=(be.clientX-Re.left)/Re.width,ut=(be.clientY-Re.top)/Re.height,{insertIndex:wt,minDistance:Jt}=kn.closestCoordinates({x:Pe,y:ut},Ce),gn=n1(Kt);if(Jt<gn){console.log("Very close point to insert"),console.log("minDistanceMin",Jt);const ce=n1(sn);if(Jt<ce&&Br())console.log("We can remove this"),(Ce==null?void 0:Ce.length)>3&&(o9(Ce),B1.POLYGON_POINT_REMOVE_CONFIRM_PROMPT?ci(wt):X0(Ce,wt));else{if(Jt<ce)V1.error("Press CTRL and then click to prompt for point deletion");else{const C0=(Jt*100).toFixed(1);V1.error("Very close point to draw "+C0+" it should be more than "+Kt*100)}ci(-1),o9(null)}return}if(Br())return;ci(-1),o9(null);const{insertIndex:gt,minDistance:Wt}=kn.findClosestSegment(Ce,Pe,ut),E1=n1(xt);Wt>=E1||(Ce.splice(gt,0,{x:Pe,y:ut}),Rt(Ce),D1(Ce),typeof o=="function"&&f0(nt)&&!p&&o(nt,u,()=>{kr()}))}const wi=be=>{M&&typeof M<"u"&&typeof M=="function"&&(M({x:-1,y:-1}),yi(-1,-1)),ca(be,!0),Vn!="-1"?ia():(ge==null?void 0:ge.awi_annotation_type)=="polygon"&&!c&&!v&&!Tn&&nt.length>0&&setTimeout(()=>{D1(nt)},200)},la=be=>{if(!Tn){if((mn||bt&&e1.x!==-1&&e1.y!==-1)&&X5(O1,kn.getMousePos(Ye.current,be))){const Ce=Or(u);if(Ce){const Me=f0(Ce.awi_coords);if(typeof o=="function"&&Me)if(e1.x!==-1&&e1.y!==-1)if((ge==null?void 0:ge.awi_annotation_type)=="polygon")o(Ce.awi_coords,Pt);else{const Re=kn.getUpdatedCoordinates(Ye,be,e1);o(Re,Pt)}else o(Ce.awi_coords,Pt);else Me||((ge==null?void 0:ge.awi_annotation_type)=="polygon"&&Kr(Ce.awi_coords,be),bi(!0))}}Mn?(At(!1),typeof n=="function"&&f0(nt)&&((ge==null?void 0:ge.awi_annotation_type)==="polygon"?J5():n(nt,null,!1,()=>{kr()}))):bt&&(Tt(!1),un("-1"),w1([]),typeof d=="function"&&d("-1"))}},l9=be=>{if(!(Ye!=null&&Ye.current))return;const Ce=Sl(be,!1);(Ce==null?void 0:Ce.length)>0&&Ce[0]!=Pt?(vi(),T1(Ce[0]),Ye.current.style.cursor="pointer"):Vn!="-1"&&(T1("-1"),Pt=="-1"&&(Ye.current.style.cursor="default"))},A3=(be,Ce=!1)=>{if(Ce){ht(nt);return}const{x:Me,y:Re}=kn.getMousePos(Ye.current,be),Pe=Or(u);if(Pe){const ut=Pe.awi_coords,{minDistance:wt,insertIndex:Jt}=kn.closestCoordinates({x:Me,y:Re},ut),gn=n1(Qt);if(wt<=gn&&Ye.current){const gt=Ye.current.getContext("2d");if(!gt||Jt==fn)return;Ye.current.style.cursor="pointer",wn(Jt),Ye.current.title="Point "+(Jt+1);const Wt=Dr([ut[Jt]])[0];gt.fillStyle=Cn,gt.beginPath(),gt.arc(Wt.x,Wt.y,Ae*2.5,0,B1.TWO_PIE),gt.strokeStyle="black",gt.lineWidth=$e.SELECTED,gt.stroke(),gt.fill()}else if(Ye.current){if(!Ye.current.getContext("2d"))return;const Wt=n1(Ht);fn!==-1&&(ht(),wn(-1)),(ge==null?void 0:ge.awi_annotation_type)=="polygon"&&kn.findClosestSegment(ut,Me,Re).minDistance<=Wt?(Ye.current.style.cursor="pointer",Ye.current.title="Add point"):(Ye.current.style.cursor="default",Ye.current.title="")}}},ca=p2.useThrottle(A3,100),xi=p2.useThrottle(l9,100),Kr=(be,Ce)=>{if(kn.breakPointCount(be)>0){console.log("================================BREAK================================"),$t(!1),Ce&&Ce.stopPropagation&&(Ce==null||Ce.stopPropagation());const Re=kn.shiftPolygon(be);if(typeof o=="function"&&f0(Re)){const Pe=u;o(Re,u,()=>{Pt!=Pe&&un(Pe),kr()})}}},Ze=()=>vn.length>B1.MAX_ANNOTATIONS_TO_RUN_FAST?ht:D1,ht=p2.useThrottle((be,Ce,Me=!1,Re=!1,Pe=-1)=>{D1(be,Ce,Me,Re,Pe)},50),st=(be="forward")=>{if((vn||[]).length!=0)if(be=="last_update"){const Ce=vn==null?void 0:vn.reduce((Me,Re)=>{const Pe=new Date(Me.awi_last_updation).getTime();return new Date(Re.awi_last_updation).getTime()>Pe?Re:Me});Ce&&(un(Ce.awi_id),typeof d=="function"&&d(Ce.awi_id))}else if(u==="-1")(vn||[]).length>0&&(un(vn[0].awi_id),typeof d=="function"&&d(vn[0].awi_id));else{const Ce=p3(u);be=="backward"?Ce!==-1?Ce>0?(un(vn[Ce-1].awi_id),typeof d=="function"&&d(vn[Ce-1].awi_id)):(un(vn[vn.length-1].awi_id),typeof d=="function"&&d(vn[vn.length-1].awi_id)):(vn||[]).length>0&&(un(vn[vn.length-1].awi_id),typeof d=="function"&&d(vn[vn.length-1].awi_id)):Ce!==-1?(vn||[]).length>Ce+1?(un((vn||[])[Ce+1].awi_id),typeof d=="function"&&d((vn||[])[Ce+1].awi_id)):(un((vn||[])[0].awi_id),typeof d=="function"&&d((vn||[])[0].awi_id)):(vn||[]).length>0&&(un(vn[0].awi_id),typeof d=="function"&&d(vn[0].awi_id))}},ln=()=>{if(console.log("handleCompleteAnnotation"),!(!ge||c))if(x==="SAM"){No();return}else{if((ge==null?void 0:ge.awi_annotation_type)!="polygon")return;if(typeof n=="function"&&f0(nt))if((nt==null?void 0:nt.length)>2){const be=[...nt,{x:nt[0].x,y:nt[0].y}];Rt([]),n(be,null,!1,()=>{kr()})}else{V1.error("Polygon requires minimum of three coordinates");return}else V1.error("Invalid coordinates, please create valid coordinates")}},$n=be=>{console.log("handle Complete Multiple Annotation SAM");const Ce=[];for(let Me=0;Me<(be==null?void 0:be.length);Me++){const Re=be[Me].outline,Pe=be[Me].classId;if(f0(Re)){const wt={coords:(ge==null?void 0:ge.awi_annotation_type)=="polygon"?kn.createPolygonLoop(Re):Re,classId:Pe,isSam:!0};Ce.push(wt)}}(Ce==null?void 0:Ce.length)>0&&typeof r=="function"&&(Rt([]),r(Ce,()=>{(Ce==null?void 0:Ce.length)>0&&bi()}))},m1=()=>{if(console.log("undoAnnotationPoint"),console.log("coordinates ------>",nt),u!="-1"){u9();return}if(nt.length>0&&(ge==null?void 0:ge.awi_annotation_type)==="polygon")nt.pop(),Rt([...nt]),D1(nt);else if(nt.length>0&&Tn)nt.pop(),Rt([...nt]),D1(nt);else return},r0=()=>{pn(Ft)},P1=(be,Ce="zoom-in")=>{if(Ye.current&&Ye)if(Ce=="zoom-in"){const Me=qt,Re=at.scale+Me,Pe=Ye.current.getBoundingClientRect(),ut=be.clientX-Pe.left,wt=be.clientY-Pe.top,Jt=Re/at.scale,gn=at.x-ut*(Jt-1),gt=at.y-wt*(Jt-1),Wt={scale:+Re.toFixed(2),x:gn,y:gt};pn(Wt),W5({x:be.clientX,y:be.clientY})}else{const Me=qt,Re=at.scale-Me;if(Re==1)r0();else{const Pe=Ye.current.getBoundingClientRect();(y0.x==-1||y0.y==-1)&&console.log("zoomTimeMousePoint");const ut=y0.x!=-1?y0.x:be.clientX,wt=y0.y!=-1?y0.y:be.clientY,Jt=ut-Pe.left,gn=wt-Pe.top,gt=Re/at.scale,Wt=-Math.abs(at.x+Jt*(1-gt)),E1=-Math.abs(at.y+gn*(1-gt)),ce=yt.width*(at.scale+qt-1),C0=yt.height*(at.scale+qt-1),{newXTransform:F0,newYTransform:p1}=kn.transformCoordinatesCheck(Wt,E1,ce,C0),an={scale:+Re.toFixed(2),x:F0,y:p1};pn(an)}}},Io=(be=null)=>{if(at.scale!==Qn&&Ye.current)if(!be||!be.clientX||!be.clientY||be.type=="click"){const Ce=yt.width*(at.scale+qt-1),Me=yt.height*(at.scale+qt-1),Re=at.x-yt.width*qt/2,Pe=at.y-yt.height*qt/2,{newXTransform:ut,newYTransform:wt}=kn.transformCoordinatesCheck(Re,Pe,Ce,Me),Jt={scale:+(at.scale+qt).toFixed(2),x:ut,y:wt};pn(Jt)}else P1(be,"zoom-in")},lr=(be=null)=>{if(at.scale!==1&&Ye.current)if(!be||!be.clientX||!be.clientY||be.type=="click"){const Ce=yt.width*(at.scale-qt-1),Me=yt.height*(at.scale-qt-1),Re=at.x+yt.width*qt/2,Pe=at.y+yt.height*qt/2,{newXTransform:ut,newYTransform:wt}=kn.transformCoordinatesCheck(Re,Pe,Ce,Me);pn({scale:+(at.scale-qt).toFixed(2),x:ut,y:wt})}else P1(be,"zoom-out")},H0=be=>{be.deltaY<0?Io(be):lr(be)},Do=()=>{const be=yt.width*(at.scale-1),Ce=yt.height*(at.scale-1),Me=at.x+Gn,Re=at.y,{newXTransform:Pe,newYTransform:ut}=kn.transformCoordinatesCheck(Me,Re,be,Ce);pn({...at,x:Pe,y:ut})},Po=()=>{const be=yt.width*(at.scale-1),Ce=yt.height*(at.scale-1),Me=at.x-Gn,Re=at.y,{newXTransform:Pe,newYTransform:ut}=kn.transformCoordinatesCheck(Me,Re,be,Ce);pn({...at,x:Pe,y:ut})},P2=()=>{const be=yt.width*(at.scale-1),Ce=yt.height*(at.scale-1),Me=at.x,Re=at.y+Gn,{newXTransform:Pe,newYTransform:ut}=kn.transformCoordinatesCheck(Me,Re,be,Ce);pn({...at,x:Pe,y:ut})},io=()=>{const be=yt.width*(at.scale-1),Ce=yt.height*(at.scale-1),Me=at.x,Re=at.y-Gn,{newXTransform:Pe,newYTransform:ut}=kn.transformCoordinatesCheck(Me,Re,be,Ce);pn({...at,x:Pe,y:ut})};if(!e||!i)return null;const No=()=>{if(rn){V1.error("Request already in progress");return}if(!(nt!=null&&nt.length)){V1.error("No points to send");return}const be={};be.image_url=e,be.coords=nt,console.log("Sent to SAM",be),ua(),typeof h=="function"&&h("annotate")},d1=()=>{if(Ur?zn(!1):Ur||zn(!0),rn){V1.error("Request already in progress");return}typeof h=="function"&&h("annotate")},Ml=be=>{console.log("Submitted data from SAMModal:",be),To(be),typeof h=="function"&&h("annotate")},To=be=>{if(!mi||!(mi!=null&&mi.mutate)){V1.error("SAM Prompt is not available");return}console.log("getSAMAnnotationsPrompt");const Ce=be.awi_annotation_prompt,Me=be.model_confidence,Re=be.model_name,Pe=be.model_max_results;R0({modelName:Re,modelConfidence:Me,modelMaxResults:Pe,promptMessage:Ce});const ut=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1)),Jt={requestId:a||0,contents:[{url:c2||ut,contentKey:i,directPrompt:Ce||""}],confidence:Me||L1,modelName:Re||a0,modelMaxResults:Pe||J2};jt(!0),mi.mutate(Jt,{onSuccess:gn=>{var gt,Wt,E1,ce,C0;if(jt(!1),!gn.success)V1.error(gn.message);else{zn(!1);const F0=((E1=(Wt=(gt=gn.data)==null?void 0:gt[0])==null?void 0:Wt.contours)==null?void 0:E1[0])??null;if(F0){const p1=F0.coordinates;if((p1==null?void 0:p1.length)==0||!((C0=(ce=p1[0])==null?void 0:ce.box)!=null&&C0.length))V1.error("No auto annotation is possible to create");else{const an=[];(ge==null?void 0:ge.awi_annotation_type)=="polygon"?(console.log("coordinates",p1),p1.forEach(L0=>{var cr;(cr=L0==null?void 0:L0.mask_polygon)==null||cr.forEach(Gr=>{const ur={outline:Gr.outline,classId:p1.classId};an.push(ur)})})):(ge==null?void 0:ge.awi_annotation_type)=="rectangle"?p1.forEach(L0=>{const cr=kn.getBoundingBox(L0.box);Rt(cr);const Gr={outline:cr,classId:p1.classId};an.push(Gr)}):(ge==null?void 0:ge.awi_annotation_type)=="circle"?p1.forEach(L0=>{const cr=kn.calculateCircleFromCoordinates(kn.getBoundingBox(L0.box));Rt(cr);const Gr={outline:cr,classId:p1.classId};an.push(Gr)}):(ge==null?void 0:ge.awi_annotation_type)=="dot"&&p1.forEach(L0=>{const cr=kn.calculateCentroid(L0.box);Rt(cr);const Gr={outline:cr,classId:p1.classId};an.push(Gr)}),$n(an),typeof E=="function"&&E("Normal")}}else V1.error("No Auto Annotation found")}},onError:gn=>{V1.exception(gn),jt(!1)}})},ua=()=>{if(!Ci||!(Ci!=null&&Ci.mutate)){V1.error("SAM is not available");return}const be=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1)),Ce=c2||be,Me=p2.chunkArray(nt),Re={img_url:Ce,coords:nt,coordinates:Me};jt(!0),Ci.mutate(Re,{onSuccess:Pe=>{var ut;if(jt(!1),!Pe.success)V1.error(Pe.message);else if(console.log("this is the SAM data",Pe),((ut=Pe==null?void 0:Pe.data)==null?void 0:ut.length)>0){const wt=[];(ge==null?void 0:ge.awi_annotation_type)=="polygon"?Pe.data.forEach(Jt=>{Jt.contours.forEach(gn=>{Rt(gn.outline);const Wt={outline:gn.outline,classId:null};wt.push(Wt)})}):(ge==null?void 0:ge.awi_annotation_type)=="rectangle"?Pe.data.forEach(Jt=>{Rt(Jt.bbox),console.log("this si the bbox",Jt.bbox);const gt={outline:Jt.bbox,classId:null};wt.push(gt)}):(ge==null?void 0:ge.awi_annotation_type)=="circle"?Pe.data.forEach(Jt=>{const gn=kn.calculateCircleFromCoordinates(Jt.bbox);Rt(gn);const gt={outline:gn,classId:null};wt.push(gt)}):(ge==null?void 0:ge.awi_annotation_type)=="dot"&&Pe.data.forEach(Jt=>{const gn=kn.calculateCentroid(Jt.bbox);Rt(gn);const gt={outline:gn,classId:null};wt.push(gt)}),$n(wt)}else V1.error("No annotations found from SAM")},onError:Pe=>{V1.exception(Pe),jt(!1)}})},c9=async()=>{if(fe&&typeof fe=="function"){V1.success("Loading Annotations...");const be=await fe();console.log("cacheRemoveAnnotationResponse ",be),be!=null&&be.success?(V1.success((be==null?void 0:be.message)+" and now loading final annotations..."),bi(!0)):V1.error(be==null?void 0:be.message)}},u9=()=>{var Ce;console.log("Undo last state annotation");const be=Or(u);if(((Ce=be.past_coords)==null?void 0:Ce.length)>0){const Me=be.past_coords[be.past_coords.length-1];typeof o=="function"&&f0(Me)&&!p&&o(Me,u,()=>{kr()})}},N2=be=>{console.log("Control p"),Ye.current&&Io(be)},da=be=>{console.log("Control m"),lr(be)},Qr=()=>{const be={clientX:(Ut==null?void 0:Ut.x)||0,clientY:(Ut==null?void 0:Ut.y)||0};N2(be)},u2=()=>{const be={clientX:(Ut==null?void 0:Ut.x)||0,clientY:(Ut==null?void 0:Ut.y)||0};da(be)},e4=()=>{console.log("Copying annotations"),k&&typeof k=="function"&&k((bn==null?void 0:bn.result)||[])},d2=(be=!0)=>{try{document.fullscreenElement?(document.exitFullscreen().then(()=>{console.log("Fullscreen exited")}).catch(Ce=>{console.log(Ce)}),be&&ki.setItem("full_screen","no")):(document.documentElement.requestFullscreen().then(()=>{console.log("Fullscreen entered")}).catch(Ce=>{console.log(Ce)}),be&&ki.setItem("full_screen","yes"))}catch(Ce){console.log(Ce)}},T2=be=>{var Ce;if(!(!v&&!["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level))){if((ge==null?void 0:ge.awi_request_for)=="attributes"){const Me=D2(be)||[];console.log("This is the temp annotation",Me),Me.length>0&&(w1(Me),typeof d=="function"&&d(Me[0]),D1()),mn&&$t(!1),Tt(!1);return}if(Mn)if(At(!1),Tn){if(nt&&(nt==null?void 0:nt.length)>0){let Me=[];j1?Br()?Me=Oo():Me=nt:Me=Oo(),D1(Me)}}else console.log("creating new annotation"),typeof n=="function"&&f0(nt)&&((ge==null?void 0:ge.awi_annotation_type)==="polygon"?J5():(Rt([]),n(nt,null,!1,()=>{kr()})));else if(c&&Pt!=="-1"||v){if((mn||e1.x!==-1&&e1.y!==-1)&&X5(O1,kn.getMousePos(Ye.current,be))){const Me=Or(Pt);if(Me){const Re=[...Me.awi_coords],Pe=f0(Re);typeof o=="function"&&Pe&&!p?o(Re,u,()=>{kr()}):Pe||((ge==null?void 0:ge.awi_annotation_type)=="polygon"?Kr(Re,be):bi(!0))}}else{const Me=D2(be)||[];if(Me.length>0)if(Me.every(Re=>r1.includes(Re))&&r1.every(Re=>Me.includes(Re))){if(un(Re=>(typeof d=="function"&&d(r1[(r1.indexOf(Re)+1)%r1.length]),ht(),r1[(r1.indexOf(Re)+1)%r1.length]==="-1"&&(l1({x:0,y:0}),Kn({x:-1,y:-1})),r1[(r1.indexOf(Re)+1)%r1.length])),(!mn||Br())&&(ge==null?void 0:ge.awi_annotation_type)=="polygon"){const Re=(Ce=Or(u))==null?void 0:Ce.awi_coords;sr(be,Re)}}else console.log("Selecting first temp"),un(Me[0]),typeof d=="function"&&d(Me[0]),D1();else un("-1"),D1();w1(Me)}mn&&$t(!1),Tt(!1)}else if(c){const Me=D2(be)||[];console.log("This is the temp annotation",Me),Me.length>0&&(w1(Me),typeof d=="function"&&d(Me[0]),D1()),Tt(!1)}}},Ei=be=>{if(console.log("Handle Mouse Down"),be.button==0&&!ar()){if(!["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level))return;if(!c&&!v){At(!0),console.log("Mouse down");const{x:Ce,y:Me}=kn.getMousePosAbsolute(Ye.current,be);Hn({x:Ce,y:Me}),Tn?j1&&Br()||Rt(Re=>[...Re||[],{x:Ce,y:Me}]):(ge==null?void 0:ge.awi_annotation_type)==="rectangle"?Rt([{x:Ce,y:Me},{x:Ce,y:Me},{x:Ce,y:Me},{x:Ce,y:Me}]):(ge==null?void 0:ge.awi_annotation_type)==="circle"?Rt([{x:Ce,y:Me},{x:Ce,y:Me}]):(ge==null?void 0:ge.awi_annotation_type)==="dot"?Rt([{x:Ce,y:Me}]):(ge==null?void 0:ge.awi_annotation_type)==="polygon"&&Rt(Re=>[...Re,{x:Ce,y:Me}])}else v||(q5(be,Pt),Tt(!0))}else if(be.button===1||be.button==0){const{clientX:Ce,clientY:Me}=be,{x:Re,y:Pe}=at,ut=Jt=>{console.log("PANNING!!!!!");const gn=Jt.clientX-Ce,gt=Jt.clientY-Me,Wt=Re+gn,E1=Pe+gt,ce=Math.max(Math.min(Wt,0),yt.width-yt.width*at.scale),C0=Math.max(Math.min(E1,0),yt.height-yt.height*at.scale);pn({scale:at.scale,x:ce,y:C0})},wt=()=>{window.removeEventListener("mousemove",ut),window.removeEventListener("mouseup",wt),window.addEventListener("touchmove",ut,{passive:!1}),window.addEventListener("touchend",wt)};at.scale>1&&(window.addEventListener("mousemove",ut),window.addEventListener("touchmove",ut,{passive:!1})),window.addEventListener("mouseup",wt),window.addEventListener("touchend",wt)}},ao=be=>{if(Ye!=null&&Ye.current&&_1({x:be.clientX,y:be.clientY}),c&&(Pt!="-1"&&(vn==null?void 0:vn.length)<=B1.MAX_ANNOTATIONS_TO_HOVER&&ca(be),!mn&&!bt?(vn==null?void 0:vn.length)<=B1.MAX_ANNOTATIONS_TO_HOVER&&xi(be):Vn!="-1"&&T1("-1")),p)return;let Ce=[];if(Mn){Tn?(Ce.length==0&&(Ce=[tn]),Rt(Me=>Me.length==0?[tn]:Me),D1(nt)):(ge==null?void 0:ge.awi_annotation_type)==="rectangle"?(Ce=kn.getUpdatedCoordinates(Ye,be,tn),Rt(Ce),D1(Ce)):(ge==null?void 0:ge.awi_annotation_type)==="circle"?(oo(be),D1(nt)):(ge==null||ge.awi_annotation_type,D1(nt));return}else if(c&&Pt!=="-1"&&bt){if(console.log("isDrawingAnnotation",Mn),mn){const{x:Me,y:Re}=kn.getMousePos(Ye.current,be),Pe=Me-(O1.x||0),ut=Re-(O1.y||0);if(u!=="-1"){Ce=[...nt].map(gn=>({x:gn.x+Pe,y:gn.y+ut}));const wt=Or(u);if(wt)switch(wt.awi_coords=[...Ce],ge==null?void 0:ge.awi_annotation_type){case"dot":{Ce.length===1&&(Ce[0].x=kn.getPerfectPointValue(Ce[0].x),Ce[0].y=kn.getPerfectPointValue(Ce[0].y));break}case"circle":{Ce.length===2&&(Ce=[...kn.adjustToCircle(Ce)],wt.awi_coords=[...Ce]);break}case"rectangle":{if(Ce.length===4){const gn=Math.abs(Ce[1].x-Ce[0].x),gt=Math.abs(Ce[3].y-Ce[1].y);for(let Wt=0;Wt<Ce.length;Wt++)Ce[Wt].x<0?(Ce[1].x=gn,Ce[2].x=gn,Ce[0].x=1e-4,Ce[3].x=1e-4):Ce[Wt].y<0?(Ce[2].y=gt,Ce[3].y=gt,Ce[0].y=1e-4,Ce[1].y=1e-4):Ce[Wt].x>1?(Ce[0].x=1-gn,Ce[3].x=1-gn,Ce[1].x=1-1e-4,Ce[2].x=1-1e-4):Ce[Wt].y>1&&(Ce[0].y=1-gt,Ce[1].y=1-gt,Ce[2].y=1-1e-4,Ce[3].y=1-1e-4)}break}case"polygon":{Ce.length>1&&Kr(Ce,be);break}default:{console.log("Unknown request type");break}}Ze()(Ce)}}else if(e1.x!==-1&&e1.y!==-1&&u!=="-1"){console.log("Corner coordinates");const Me=Or(u);if((ge==null?void 0:ge.awi_annotation_type)==="circle"){const Re=kn.getMousePos(Ye.current,be);if(Me){Ce=Me.awi_coords;const Pe=(Ce[0].x+Ce[1].x)/2,ut=(Ce[0].y+Ce[1].y)/2,wt=kn.getDistance(Re.x,Re.y,Pe,ut);Pe-wt<0?(Ce[0]={x:0,y:ut},Ce[1]={x:2*wt,y:ut}):Pe+wt>1?(Ce[0]={x:1-2*wt,y:ut},Ce[1]={x:1,y:ut}):ut-wt<0?(Ce[0]={x:Pe,y:0},Ce[1]={x:Pe,y:2*wt}):ut+wt>1?(Ce[0]={x:Pe,y:1-2*wt},Ce[1]={x:Pe,y:1}):(Ce[0]={x:Pe-wt,y:ut},Ce[1]={x:Pe+wt,y:ut}),Ce=[...kn.adjustToCircle(Ce)]}}else if((ge==null?void 0:ge.awi_annotation_type)==="polygon"&&!Tn){const Re=kn.getMousePos(Ye.current,be);Me!=null&&Me.awi_coords&&(Ce=[...Me.awi_coords],y1>-1&&(y1===0||y1===Ce.length-1?(Ce[0]={x:Re.x,y:Re.y},Ce[Ce.length-1]={x:Re.x,y:Re.y}):Ce[y1]={x:Re.x,y:Re.y},Kn({x:Re.x,y:Re.y})))}else Ce=kn.getUpdatedCoordinates(Ye,be,e1);if(f0(Ce)){Rt([...Ce]);const Re=Or(u);Re&&(Re.awi_coords=Ce,D1(Ce))}}}else if((ge==null?void 0:ge.awi_annotation_type)==="polygon"&&!c&&(nt==null?void 0:nt.length)>1){const{x:Me,y:Re}=kn.getMousePos(Ye.current,be);ht(nt,{x:Me,y:Re})}},d9=be=>{if(be.touches.length===1){const Ce=be.touches[0];if(ar()){if(at.scale==1)return;H1.current||(H1.current={x:Ce.clientX,y:Ce.clientY})}else{const Me={...Ce,clientX:Ce.clientX,clientY:Ce.clientY,currentTarget:be.currentTarget,button:0};Ei(Me)}}},so=be=>{if(be.preventDefault(),be.touches.length>=2){const[Ce,Me]=[be.touches[0],be.touches[1]],Re=Me.clientX-Ce.clientX,Pe=Me.clientY-Ce.clientY,ut=Math.hypot(Re,Pe);if(yn!==null){const wt=ut-yn,Jt=(Ce.clientX+Me.clientX)/2,gn=(Ce.clientY+Me.clientY)/2;H0({deltaY:-wt,clientX:Jt,clientY:gn,currentTarget:be.currentTarget})}Ln(ut)}if(be.touches.length===1){const Ce=be.touches[0];if(ar()){if(H1.current){console.log("PANNING!!!!!");const Me=Ce.clientX-H1.current.x,Re=Ce.clientY-H1.current.y,{x:Pe,y:ut}=at,wt=Pe+Me,Jt=ut+Re,gn=Math.max(Math.min(wt,0),yt.width-yt.width*at.scale),gt=Math.max(Math.min(Jt,0),yt.height-yt.height*at.scale);pn({scale:at.scale,x:gn,y:gt}),H1.current={x:Ce.clientX,y:Ce.clientY}}}else{H1.current&&(H1.current=null);const Me={...Ce,clientX:Ce.clientX,clientY:Ce.clientY,currentTarget:be.currentTarget};ao(Me)}}},f2=be=>{if(H1.current&&(H1.current=null),be.touches.length<2&&Ln(null),ar()){be.preventDefault();return}const Ce=be.touches[0]||be.changedTouches[0],Me={...Ce,clientX:Ce.clientX,clientY:Ce.clientY,currentTarget:be.currentTarget};T2(Me)},Ro=be=>{const Ce=be.touches[0]||be.changedTouches[0],Me={...Ce,clientX:Ce.clientX,clientY:Ce.clientY,currentTarget:be.currentTarget};wi(Me)},fa=(be="")=>{switch(be){case"left":Do();break;case"right":Po();break;case"top":P2();break;case"bottom":io();break;default:console.warn(`Unknown pan direction: ${be}`)}},f9=()=>{typeof w=="function"&&w(be=>!be)},b3=()=>{if(!u||u=="-1"){V1.error("Control copy will be work only when you have a selected annotation");return}else N&&typeof N=="function"&&N(bn==null?void 0:bn.result,!1)},ha=()=>{if(!Ar.current||!hi.current)return;const be=Ar.current,Ce=be.getContext("2d");if(!Ce)return;const Me=yt.width*at.scale,Re=yt.height*at.scale;!Me||!Re||(be.width=Me,be.height=Re,Ce.clearRect(0,0,Me,Re),Ce.save(),Ce.setTransform(1,0,0,1,0,0),Ce.clearRect(0,0,Me,Re),Ce.translate(at.x,at.y),Ce.scale(at.scale,at.scale),Ce.drawImage(hi.current,0,0,yt.width,yt.height),Ce.restore())};return Z.jsxs(Z.Fragment,{children:[Ur&&Z.jsx(zA,{closeSAMPromptModal:()=>zn(!1),onSubmit:Ml,directPrompt:C1,isLoading:rn,requestInfo:ge}),v&&H&&(bn==null?void 0:bn.success)&&Z.jsx(Z.Fragment,{children:Z.jsx("div",{style:{margin:"4px",display:"flex",justifyContent:"center"},children:Z.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"max-content"},children:Z.jsx("button",{className:"modalButton modalButton__purpleColor",onClick:e4,children:"Copy Annotations"})})})}),v&&Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Ot,style:{minHeight:j1?"50vh":"unset",touchAction:"none !important",position:"relative"},children:ui?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",p2.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",de+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",de+1," is loading..."]}):Z.jsxs(Z.Fragment,{children:[Ue&&Z.jsx(ac,{isEditing:c,handleSelectTool:h,annotator_name:((f=(h9=(Si=D==null?void 0:D.result)==null?void 0:Si.annotatorInfo)==null?void 0:h9.awi_personal_info)==null?void 0:f.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:bn,SAMToggleValue:P,currentSelectedSAMTool:T,handleCopyAnnotations:N,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:oe,handleZoomInClick:Io,zoomProperties:at,handleReset:r0,handleZoomOutClick:lr,handleCompleteAnnotation:ln,toggleFullscreen:d2,selectAnnotationId:Pt,selectedAnnotationInfo:Fn,undoLastStateAnnotation:u9,usingSamFunction:Tn,samAPIactive:rn,handleSendToSamFunction:No,coordinates:nt,reLoadAndReDrawAnnotations:c9,showGuidelinesFirst:oe,handleSendToSamFunctionPrompt:d1,isMobile:j1,toggleSelectAnnotation:st,handleLeftKeyDown:Do,handleRightKeyDown:Po,handleUpKeyDown:P2,handleDownKeyDown:io,undoAnnotationPoint:m1,togglePagination:f9,switchToEditMode:xe,switchToCreateMode:we,goToNextImage:ve,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:b3,handlePasteAnnotationsByControlV:ae,showPagination:K,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Nt,isCarousel:v,allowedToCopyPreview:H,classColorMapToSend:A,request:ge,parentReqData:et,RequestInfoModal:ne,setCrossHair:u0,isCrossHair:u1,annotationViewType:Ve,REACT_APP_SAM_ENABLED:ct,loggedUser:m,controlMinusHotkey:u2,controlPlusHotkey:Qr,Carousel:ot},i),Z.jsx(lc,{canvasDimensions:yt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:Ar,overlayCanvasRef:Et,handleMouseDown:Ei,handleMouseUp:T2,handleMouseMove:ao,handleMouseMoveOut:la,handleOnMouseLeave:wi,handleWheel:H0,handleTouchStart:d9,handleTouchMove:so,handleTouchEnd:f2,handleTouchCancel:Ro})]})}),!v&&Ve=="atom"&&Z.jsxs("div",{style:{display:"flex",flexDirection:j1?"column":"row"},children:[Z.jsx("div",{style:{height:j1?"unset":"100%",width:j1?"100%":"5.4%",border:"1px solid #E4E0E6",backgroundColor:"white"},children:["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level)&&Z.jsx("div",{style:{width:"100%",gap:"10px",marginTop:"2px",height:"100% ",display:"flex",justifyContent:"space-between",alignItems:"center",flexDirection:j1?"row":"column"},children:Ue&&Z.jsx(ac,{isEditing:c,handleSelectTool:h,annotator_name:((V=(B=(b=D==null?void 0:D.result)==null?void 0:b.annotatorInfo)==null?void 0:B.awi_personal_info)==null?void 0:V.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:bn,SAMToggleValue:P,currentSelectedSAMTool:T,handleCopyAnnotations:N,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:oe,handleZoomInClick:Io,zoomProperties:at,handleReset:r0,handleZoomOutClick:lr,handleCompleteAnnotation:ln,toggleFullscreen:d2,selectAnnotationId:Pt,selectedAnnotationInfo:Fn,undoLastStateAnnotation:u9,usingSamFunction:Tn,samAPIactive:rn,handleSendToSamFunction:No,coordinates:nt,reLoadAndReDrawAnnotations:c9,showGuidelinesFirst:oe,handleSendToSamFunctionPrompt:d1,isMobile:j1,toggleSelectAnnotation:st,handleLeftKeyDown:Do,handleRightKeyDown:Po,handleUpKeyDown:P2,handleDownKeyDown:io,undoAnnotationPoint:m1,togglePagination:f9,switchToEditMode:xe,switchToCreateMode:we,goToNextImage:ve,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:b3,handlePasteAnnotationsByControlV:ae,showPagination:K,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Nt,isCarousel:v,allowedToCopyPreview:H,classColorMapToSend:A,request:ge,parentReqData:et,RequestInfoModal:ne,setCrossHair:u0,isCrossHair:u1,annotationViewType:Ve,REACT_APP_SAM_ENABLED:ct,loggedUser:m,controlMinusHotkey:u2,controlPlusHotkey:Qr,Carousel:ot},i)})}),Z.jsxs("div",{style:j1?{height:"100%",width:"100%"}:{width:"94.6%"},children:[!j1&&Z.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",height:j1?"8%":"3%",border:"1px solid #E4E0E6",background:"white",justifyContent:"space-between"},children:[Z.jsxs("div",{style:{display:"flex",flexDirection:"row",height:"100%",alignItems:"center"},children:[Z.jsxs("div",{className:"color-black",style:{width:"4.8rem",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:[Z.jsx("span",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"50%",backgroundColor:" rgba(111, 41, 169, 0.20)",height:"100%"},children:de+1}),Z.jsx("span",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"50%",backgroundColor:Fe||"rgba(111, 41, 169, 0.1)",height:"100%"},children:(((X=D==null?void 0:D.result)==null?void 0:X.awi_contents)||[]).length})]}),Z.jsxs("p",{className:"color-black",style:{marginLeft:"1rem"},title:((ie=G==null?void 0:G.awi_label)==null?void 0:ie.length)>20?G.awi_label:J.length>20?J:"",children:["Image -"," ",((De=G==null?void 0:G.awi_label)==null?void 0:De.length)>0?G.awi_label.length>20?G.awi_label.substring(0,20)+"...":G.awi_label:J.length>20?J.substring(0,20)+"...":J]}),Z.jsx("p",{className:"color-black",style:{marginLeft:"1rem"},children:((_e==null?void 0:_e.result)||[]).length>0&&`Annotations - ${((_e==null?void 0:_e.result)||[]).length} (Recent First) ${S.size?`Selected - ${((_e==null?void 0:_e.result)||[]).length-S.size}`:""}`})]}),Z.jsx("div",{children:Z.jsxs("div",{style:{fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center"},className:"color-black",children:[Z.jsx("div",{children:A0}),(A0==null?void 0:A0.length)>0&&Z.jsx(V6,{color:"#000"})]})})]}),Z.jsx("div",{children:K&&j1&&Ke&&Z.jsx("div",{style:{border:"1px solid #E4E0E6"},children:Z.jsx(Ke,{handleNextPage:z,handlePreviousPage:R,currentPage:$,images:(Je=D==null?void 0:D.result)==null?void 0:Je.awi_contents,handleIndexUpdate:W,currentIndex:de,request_id:q,requestFor:(rt=D==null?void 0:D.result)==null?void 0:rt.awi_request_for,imagePagination:K,showImages:!0,fetchAnnotations:Le,pageCount:Be})})}),Z.jsx("div",{style:{height:j1||m3?"25px":"3%",border:"1px solid #E4E0E6",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px",backgroundColor:"#fff"},children:j1&&(A0==null?void 0:A0.length)>0?Z.jsx(Z.Fragment,{children:Z.jsx("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"center",alignItems:"center",fontWeight:"bold"},children:A0})}):Z.jsx(Z.Fragment,{children:at.scale>1?Z.jsx(Z.Fragment,{children:Z.jsxs("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"space-between",alignItems:"center"},children:[Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>fa("left"),children:"Left"}),Z.jsx("progress",{value:l2.left,max:yt.width,title:l2.left==0?"You can not move left more":"Showing how much you can move left more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>fa("right"),children:"Right"}),Z.jsx("progress",{value:l2.right,max:yt.width,title:l2.right==0?"You can not move right more":"Showing how much you can move right more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>fa("top"),children:"Top"}),Z.jsx("progress",{value:l2.top,max:yt.height,title:l2.top==0?"You can not move top more":"Showing how much you can move top more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>fa("bottom"),children:"Bottom"}),Z.jsx("progress",{value:l2.bottom,max:yt.height,title:l2.bottom==0?"You can not move bottom more":"Showing how much you can move bottom more"})]})}):Z.jsx("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"center",alignItems:"center"},children:"Zoom in to see image pan progress"})})}),Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Ot,style:{height:K?"80%":"90%",width:"100%",touchAction:"none !important",minHeight:j1?"50vh":"unset",position:"relative"},children:ui?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",p2.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",de+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",de+1," is loading..."]}):Z.jsx(lc,{canvasDimensions:yt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:Ar,overlayCanvasRef:Et,handleMouseDown:Ei,handleMouseUp:T2,handleMouseMove:ao,handleMouseMoveOut:la,handleOnMouseLeave:wi,handleWheel:H0,handleTouchStart:d9,handleTouchMove:so,handleTouchEnd:f2,handleTouchCancel:Ro})}),K&&!j1&&Ke&&Z.jsx("div",{children:K&&Z.jsx("div",{style:{border:"1px solid #E4E0E6"},children:Z.jsx(Ke,{handleNextPage:z,handlePreviousPage:R,currentPage:$,images:(Bt=D==null?void 0:D.result)==null?void 0:Bt.awi_contents,handleIndexUpdate:W,currentIndex:de,request_id:q,requestFor:(on=D==null?void 0:D.result)==null?void 0:on.awi_request_for,imagePagination:K,showImages:!0,fetchAnnotations:Le,pageCount:Be})})})]})]}),!v&&Ve=="library"&&Z.jsxs(Z.Fragment,{children:[Ue&&Z.jsx(ac,{isEditing:c,handleSelectTool:h,annotator_name:((g0=(Yn=(Pn=D==null?void 0:D.result)==null?void 0:Pn.annotatorInfo)==null?void 0:Yn.awi_personal_info)==null?void 0:g0.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:bn,SAMToggleValue:P,currentSelectedSAMTool:T,handleCopyAnnotations:N,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:oe,handleZoomInClick:Io,zoomProperties:at,handleReset:r0,handleZoomOutClick:lr,handleCompleteAnnotation:ln,toggleFullscreen:d2,selectAnnotationId:Pt,selectedAnnotationInfo:Fn,undoLastStateAnnotation:u9,usingSamFunction:Tn,samAPIactive:rn,handleSendToSamFunction:No,coordinates:nt,reLoadAndReDrawAnnotations:c9,showGuidelinesFirst:oe,handleSendToSamFunctionPrompt:d1,isMobile:!0,toggleSelectAnnotation:st,handleLeftKeyDown:Do,handleRightKeyDown:Po,handleUpKeyDown:P2,handleDownKeyDown:io,undoAnnotationPoint:m1,togglePagination:f9,switchToEditMode:xe,switchToCreateMode:we,goToNextImage:ve,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:b3,handlePasteAnnotationsByControlV:ae,showPagination:K,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Nt,isCarousel:v,allowedToCopyPreview:H,classColorMapToSend:A,request:ge,parentReqData:et,RequestInfoModal:ne,setCrossHair:u0,isCrossHair:u1,annotationViewType:Ve,REACT_APP_SAM_ENABLED:ct,loggedUser:m,controlMinusHotkey:u2,controlPlusHotkey:Qr,Carousel:ot},i),Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Ot,style:{height:K?"80%":"90%",width:"100%",touchAction:"none !important",minHeight:j1?"50vh":"unset",position:"relative"},children:ui?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",p2.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",de+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",de+1," is loading..."]}):Z.jsx(lc,{canvasDimensions:yt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:Ar,overlayCanvasRef:Et,handleMouseDown:Ei,handleMouseUp:T2,handleMouseMove:ao,handleMouseMoveOut:la,handleOnMouseLeave:wi,handleWheel:H0,handleTouchStart:d9,handleTouchMove:so,handleTouchEnd:f2,handleTouchCancel:Ro})})]}),t1!=-1&&h3&&Z.jsx(Gb,{callback:()=>X0(h3,t1),cancelCallBack:()=>{ci(-1)},trigger:"REMOVE_POLYGON_POINT",fireOnMount:!0,children:Z.jsx(Z.Fragment,{})})]})},_2={message__container:"_message__container_u7nyp_1",message__container__icon:"_message__container__icon_u7nyp_15",message__container__title:"_message__container__title_u7nyp_19",message__container__title__success:"_message__container__title__success_u7nyp_24",message__container__description:"_message__container__description_u7nyp_27",message__container__loading:"_message__container__loading_u7nyp_31",pulse:"_pulse_u7nyp_1"},uc=({iconUrl:e,title:t,description:n,messageType:r="information",isLoading:o=!1,textClass:i="",noPadding:a,iconName:s=""})=>{var c,u;return o?Z.jsxs("div",{className:qn(_2.message__container,_2.message__container__loading),children:[s&&(s==null?void 0:s.length)>0&&Z.jsx("img",{src:(c=q1[s])==null?void 0:c.IconComponent,className:_2.message__container__icon}),e&&(e==null?void 0:e.length)>0&&Z.jsx("img",{src:e,className:_2.message__container__icon}),Z.jsx("h1",{className:qn(_2.message__container__title,{[_2.message__container__title__success]:r==="success"}),children:t}),Z.jsx("p",{className:qn(_2.message__container__description,i),children:n})]}):Z.jsxs("div",{className:qn(_2.message__container,{noPadding:a}),children:[s&&(s==null?void 0:s.length)>0&&Z.jsx("img",{src:(u=q1[s])==null?void 0:u.IconComponent,className:_2.message__container__icon}),e&&(e==null?void 0:e.length)>0&&Z.jsx("img",{src:e,className:_2.message__container__icon}),Z.jsx("h1",{className:qn(_2.message__container__title,{[_2.message__container__title__success]:r==="success"}),children:t}),Z.jsx("p",{className:qn(_2.message__container__description,i),children:n})]})},x_={ATTRIBUTES:{labelValue:"Attributes",src:"noAttributes",description:"No attributes are available. Start by adding or configuring attributes.",messageType:"information",loadingMessage:"Loading attributes...",notFoundMessage:"No attributes found"},ORGANISATIONS:{labelValue:"Organisations",src:"noOrganisations",description:"There are no organisations available. Add a new organisation to get started.",messageType:"information",loadingMessage:"Loading organizations...",notFoundMessage:"No organisations found"},REQUESTS:{labelValue:"Requests",src:"noRequests",description:"There are no requests available. Raised requests will be displayed here.",messageType:"information",loadingMessage:"Loading requests...",notFoundMessage:"No requests found"},USERS:{labelValue:"Users",src:"noUsers",description:"No users have been added yet. Start by inviting or creating users.",messageType:"information",loadingMessage:"Loading users...",notFoundMessage:"No users found"},USERS_IN_REQUEST:{labelValue:"Users",src:"noUsers",description:"No users found.",messageType:"information",loadingMessage:"Loading users...",notFoundMessage:"No users found"},CLASSES:{labelValue:"Classes",src:"noClasses",description:"There are no classes available. Add a new class to begin.",messageType:"information",loadingMessage:"Loading classes...",notFoundMessage:"No classes found"},IMAGES:{labelValue:"Images",src:"noImages",description:"No images are currently available. Upload images to view them here.",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No images found"},ANNOTATOR_NO_SESSIONS:{labelValue:"Sessions",src:"noSessions",description:"No sessions are currently available. Annotator Sessions will be listed here.",messageType:"information",loadingMessage:"Loading sessions...",notFoundMessage:"No sessions found"},VERIFIER_NO_SESSIONS:{labelValue:"Sessions",src:"noSessions",description:"No sessions are currently available. Verifier Sessions will be listed here.",messageType:"information",loadingMessage:"Loading sessions...",notFoundMessage:"No sessions found"},MODELS:{labelValue:"Models",src:"noModels",description:"There are no models available. Run jobs and train models to get started.",messageType:"information",loadingMessage:"Loading models...",notFoundMessage:"No models found"},JOBS:{labelValue:"Jobs",src:"noJobs",description:"No jobs are currently scheduled or running. Create a job to see it listed here.",messageType:"information",loadingMessage:"Loading jobs...",notFoundMessage:"No jobs found"},MODEL_LOGS:{labelValue:"Model Logs",src:"noJobLogs",description:"There are no logs available for the models. Generate or upload logs to view them.",messageType:"information",loadingMessage:"Loading model logs...",notFoundMessage:"No model logs found"},DATASETS:{labelValue:"Datasets",src:"noDatasets",description:"No datasets are available. Upload or create datasets to start working.",messageType:"information",loadingMessage:"Loading datasets...",notFoundMessage:"No datasets found"},BILLS:{labelValue:"Bills",src:"noBills",description:"No bills are currently available. Generated bills will be listed here.",messageType:"information",loadingMessage:"Loading bills...",notFoundMessage:"No bills found"},MODEL_METRICS:{labelValue:"Model Metrics",src:"noModelMetrics",description:"No metrics are available for the models. Generated metrics for analyzing performance will be listed here.",messageType:"information",loadingMessage:"Loading model metrics...",notFoundMessage:"No model metrics found"},MODEL_DETAILS:{labelValue:"Model Details",src:"noModelDetails",description:"Details for the models are not available. Add or update model details to view them.",messageType:"information",loadingMessage:"Loading model details...",notFoundMessage:"No model details found"},MODEL_RESOURCES:{labelValue:"Model Resources",src:"noModelResources",description:"No resources are available for the models. Add resources to start utilizing them.",messageType:"information",loadingMessage:"Loading model resources...",notFoundMessage:"No model resources found"},NOTIFICATIONS:{labelValue:"Notifications",src:"noNotifications",description:"No notifications are available. New notifications will be displayed here.",messageType:"information",loadingMessage:"Loading notifications...",notFoundMessage:"No notifications found"},REQUEST_IMAGES:{labelValue:"Request Images",src:"noRequestImages",description:"No request images are currently available.",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No request images found"},REQUEST_PRICING:{labelValue:"Request Pricing",src:"noPrices",description:"No request pricing are currently available.",messageType:"information",loadingMessage:"Loading pricing...",notFoundMessage:"No request pricing found"},ANNOTATION_GRAPH:{labelValue:"Annotation Graph",src:"noAnnotationGraph",description:"No annotation analytics are available for the given date",messageType:"information",loadingMessage:"Loading annotation graph...",notFoundMessage:"No annotations"},LOADING_CAROUSAL:{labelValue:"Images",src:"noImages",description:"No images is available to load",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No images found"},TAGS:{labelValue:"Tags",src:"noTags",description:"No tags are available. Start by adding or configuring tags.",messageType:"information",loadingMessage:"Loading tags...",notFoundMessage:"No tags found"},NO_CSV_REQUESTS:{labelValue:"Requests",src:"noRequests",description:"There are no requests available in sheet, kindly add and upload.",messageType:"information",loadingMessage:"Loading requests...",notFoundMessage:"No requests found"},NO_CSV_CLASS:{labelValue:"Classes",src:"noClasses",description:"There are no classes available in sheet, kindly add and upload.",messageType:"information",loadingMessage:"Loading classes...",notFoundMessage:"No classes found"},CLASS_PROPORTION:{labelValue:"Class proportion",src:"noClasses",description:"No class proportion available.",messageType:"information",loadingMessage:"Loading class proportion...",notFoundMessage:"No class proportion found"},SINGLE_CLASS:{labelValue:"Class",src:"noClasses",description:"No class available.",messageType:"information",loadingMessage:"Loading class...",notFoundMessage:"No classes found"},LOADING_FILTER:{labelValue:"Filter",src:"noClasses",description:"No filter configuration.",messageType:"information",loadingMessage:"Loading filter information...",notFoundMessage:"No filter configuration found"},LOADING_ANNOTATION:{labelValue:"Annotation Loading",src:"noImages",description:"No annotation found",messageType:"information",loadingMessage:"Please wait, loading annotation...",notFoundMessage:"No annotations"},LOADING_REQUEST:{labelValue:"Request Loading",src:"noRequests",description:"No request found",messageType:"information",loadingMessage:"Please wait, loading request info...",notFoundMessage:"No request"},NOT_FOUND_GENERAL:{labelValue:"Data Loading",src:"notFoundGeneral",description:"No data found",messageType:"information",loadingMessage:"Please wait, loading data...",notFoundMessage:"No data"}},iee=({stateKey:e="NOT_FOUND_GENERAL",loadState:t=!1,stateDescription:n=null,stateLoadDescription:r=null,showImage:o=!1,textClass:i="",noPadding:a=!1,stateTitle:s=""})=>{const c=x_[e]||x_.NOT_FOUND_GENERAL;if(!c)return Z.jsx(Z.Fragment,{});const{labelValue:u,src:d,messageType:h,description:g,notFoundMessage:m}=c;if(t)return Z.jsxs("div",{style:{width:"100%"},children:[o&&Z.jsx(uc,{title:c.loadingMessage,iconName:d,description:r||"",isLoading:!0,noPadding:a}),!o&&Z.jsx(uc,{title:c.loadingMessage,description:r||"",isLoading:!0,noPadding:a})]});{const v=(s==null?void 0:s.length)>0?s:m?m||`No ${u} Found`:"",A=n||g;return Z.jsx("div",{style:{width:"100%"},children:Z.jsx(uc,{title:v,iconName:d,description:A,messageType:h,textClass:i,noPadding:a})})}},e2={tableBar:"_tableBar_103oy_1",buttonGroup:"_buttonGroup_103oy_13",btnIcon:"_btnIcon_103oy_34",searchBar:"_searchBar_103oy_41",searchInput:"_searchInput_103oy_53",searchIcon:"_searchIcon_103oy_58",removeBorder:"_removeBorder_103oy_63",button:"_button_103oy_13",isSelected:"_isSelected_103oy_74",isDisabled:"_isDisabled_103oy_80",isActive:"_isActive_103oy_85",isText:"_isText_103oy_92"},aee=({showSearch:e=!1,leftButtons:t=[],rightButtons:n=[],searchFunction:r,searchDelay:o=300,onSearchClick:i,searchPlaceHolder:a="Search...",showSearchEye:s=!0,borderRequired:c=!0,borderColor:u})=>{const d=O.useCallback(L4.debounce((v,A)=>{typeof A=="function"&&A(v)},o),[o]),h=v=>{const A=v.currentTarget.value.trim();d(A,r)},g=()=>{typeof i=="function"&&i()};if(!t.length&&!n.length&&!e)return null;const m=(v,A)=>{const p=v.type==="text";return Z.jsxs("button",{onClick:!p&&!v.isDisabled?v.onClick:void 0,title:v.title||"",disabled:v.isDisabled,className:qn(e2.button,{[e2.isText]:p,[e2.isSelected]:v.isSelected,[e2.isDisabled]:v.isDisabled,[e2.isActive]:v.isActive&&!v.isSelected}),children:[v.icon&&Z.jsx("img",{src:v.icon,alt:v.name,className:e2.btnIcon}),Z.jsx("div",{children:v.name})]},A)};return Z.jsxs("div",{className:qn(e2.tableBar,!c&&e2.removeBorder),style:{borderColor:c?u||"#909090":void 0},children:[Z.jsxs("div",{className:e2.buttonGroup,children:[t.map(m)," "]}),Z.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"10px"},children:[Z.jsx("div",{className:e2.buttonGroup,children:n.map(m)}),e&&Z.jsx("div",{className:e2.searchBar,title:a,children:Z.jsxs("form",{autoComplete:"off",style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",position:"relative"},children:[Z.jsx("input",{type:"text",name:"userSearchInput",autoComplete:"off",placeholder:a,className:e2.searchInput,onKeyUp:h}),s&&Z.jsx("img",{src:q1.searchUrl.IconComponent,alt:a,className:qn(e2.btnIcon,"cursor-pointer",e2.searchIcon),onClick:g})]})})]})]})},E_=({currentPage:e,totalPages:t,onPageChange:n,isLoading:r=!1})=>{const[o,i]=O.useState(`${e}`);O.useEffect(()=>{i(`${e}`)},[e]);const a=()=>{const s=Number(o);s>=1&&s<=t&&n(s),i("")};return Z.jsx(Z.Fragment,{children:Z.jsxs("div",{className:gr.pagination_container,children:[Z.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",maxHeight:"2vh"},children:r?Z.jsx(Z.Fragment,{children:Z.jsx("div",{className:gr.pagination_loading,children:"Loading..."})}):Z.jsxs(Z.Fragment,{children:[Z.jsx("div",{className:gr.pagination_left,children:Z.jsx("input",{type:"number",min:"1",max:t,value:o,onChange:s=>{i(s.target.value)},onBlur:()=>{if(o==""){i(`${e}`);return}const s=parseInt(o,10);if(!isNaN(s)){let c=Math.max(1,Math.min(t,s)).toString();c!=null&&c.length||(c="1"),i(c),a()}},onKeyDown:s=>{if(s.key==="Enter"){s==null||s.preventDefault(),s==null||s.stopPropagation();const c=parseInt(o,10);if(!isNaN(c)){const u=Math.max(1,Math.min(t,c)).toString();i(u),a()}}},placeholder:o,style:{background:"transparent",border:"0",width:"100%",height:"100%"}})}),Z.jsx("div",{className:gr.pagination_right,children:t})]})}),Z.jsxs("div",{style:{gap:"20px",display:"flex"},children:[Z.jsx("img",{src:q1.backArrow.IconComponent,onClick:()=>e>1&&n(e-1),style:{cursor:e>1?"pointer":"not-allowed"},className:gr.nextPrevArrow,title:e>1?`Go to page number ${e-1} `:"Go to previous page is not allowed"}),Z.jsx("img",{src:q1.forwardArrow.IconComponent,onClick:()=>e<t&&n(e+1),style:{cursor:e<t?"pointer":"not-allowed"},className:gr.nextPrevArrow,title:e<t?`Go to page number ${e+1}`:"Go to next page is not allowed"})]})]})})},see=({hasNextPage:e,isFetchingNextPage:t=!1,fetchNextPage:n,isLoading:r=!1,totalResults:o=0,totalFetchedResults:i=0,currentPage:a=1,totalPages:s=10,onPageChange:c,isPagination:u=!1,loadText:d=""})=>{let h="Load More";return i+1===o?h="Load last results":r||t?u?a==1?h="Loading...":h=`Loading page number ${a}`:o===0?h="Loading...":i+1===o?h="Loading last results...":h=`Loading ${i+1} to ${o}`:i===0?(d==null?void 0:d.length)==0?h="Load":h=d:h=`Load ${i+1} to ${o}`,u&&c?Z.jsx(E_,{currentPage:a,totalPages:s,onPageChange:c,isLoading:r||t}):Z.jsx("div",{className:gr.loadMoreButtonDiv,style:{display:"flex",justifyContent:"center",marginTop:"16px"},children:e&&!t&&Z.jsx("div",{className:gr.loadMoreButtonContainer,children:Z.jsx("button",{onClick:()=>n?n():void 0,className:"modalButton modalButton__purpleColor",disabled:r||t,children:h})})})},lee=({items:e,listType:t="ul",maxHeight:n="100px"})=>{const r=t;return!e||e.length===0?Z.jsx("div",{style:{minWidth:"30px"},children:"N/A"}):Z.jsx(r,{style:{maxHeight:n,overflow:"auto",paddingLeft:"20px"},children:e.map((o,i)=>Z.jsx("li",{style:{minWidth:"10vw"},children:o},i))})};var S_=(e=>(e.LARGE="l",e.MEDIUM="m",e))(S_||{});const cee=({badgeContent:e,variant:t=S_.LARGE,backgroundColor:n,textColor:r,className:o,style:i,...a})=>Z.jsx("span",{className:`badge badge_${t} ${o} ${e?"":"badge_dot"}`,style:{"--c_background":n,"--c_text":r,...i},...a,children:e}),uee=({items:e,value:t,onChange:n=()=>{},color:r,width:o,gap:i})=>Z.jsx("div",{className:"button_group",style:{gap:i},children:e==null?void 0:e.map((a,s)=>Z.jsx(er,{variant:"primary",content:a==null?void 0:a.label,icon:a==null?void 0:a.icon,iconPosition:(a==null?void 0:a.iconPosition)??"before",textColor:a==null?void 0:a.contentColor,iconColor:a==null?void 0:a.contentColor,onClick:()=>n(a.value),width:o,className:`button_group_button ${s==0?"first":""} ${s==e.length-1?"last":""} ${a.value==t?"active":""}`,backgroundColor:r,borderColor:r},a.value))});/*!
|
|
340
|
+
}`;var c1=YP(function(){return m1(me,Bn+"return "+It).apply(n,ke)});if(c1.source=It,hp(c1))throw c1;return c1}function A_e(C){return G1(C).toLowerCase()}function b_e(C){return G1(C).toUpperCase()}function __e(C,_,I){if(C=G1(C),C&&(I||_===n))return v3(C);if(!C||!(_=R2(_)))return C;var Q=sr(C),te=sr(_),me=Ir(Q,te),ke=no(Q,te)+1;return p9(Q,me,ke).join("")}function y_e(C,_,I){if(C=G1(C),C&&(I||_===n))return C.slice(0,wi(C)+1);if(!C||!(_=R2(_)))return C;var Q=sr(C),te=no(Q,sr(_))+1;return p9(Q,0,te).join("")}function w_e(C,_,I){if(C=G1(C),C&&(I||_===n))return C.replace(pt,"");if(!C||!(_=R2(_)))return C;var Q=sr(C),te=Ir(Q,sr(_));return p9(Q,te).join("")}function x_e(C,_){var I=P,Q=T;if(w0(_)){var te="separator"in _?_.separator:te;I="length"in _?o1(_.length):I,Q="omission"in _?R2(_.omission):Q}C=G1(C);var me=C.length;if(ko(C)){var ke=sr(C);me=ke.length}if(I>=me)return C;var Ne=I-X0(Q);if(Ne<1)return Q;var We=ke?p9(ke,0,Ne).join(""):C.slice(0,Ne);if(te===n)return We+Q;if(ke&&(Ne+=We.length-Ne),gp(te)){if(C.slice(Ne).search(te)){var St,Mt=We;for(te.global||(te=Io(te.source,G1(Et.exec(te))+"g")),te.lastIndex=0;St=te.exec(Mt);)var It=St.index;We=We.slice(0,It===n?Ne:It)}}else if(C.indexOf(R2(te),Ne)!=Ne){var cn=We.lastIndexOf(te);cn>-1&&(We=We.slice(0,cn))}return We+Q}function E_e(C){return C=G1(C),C&&Yt.test(C)?C.replace(sn,la):C}var S_e=r4(function(C,_,I){return C+(I?" ":"")+_.toUpperCase()}),pp=qD("toUpperCase");function GP(C,_,I){return C=G1(C),_=I?n:_,_===n?ro(C)?ca(C):mi(C):C.match(_)||[]}var YP=f1(function(C,_){try{return d0(C,n,_)}catch(I){return hp(I)?I:new $n(I)}}),M_e=pa(function(C,_){return A0(_,function(I){I=Bi(I),Ca(C,I,dp(C[I],C))}),C});function H_e(C){var _=C==null?0:C.length,I=jn();return C=_?e0(C,function(Q){if(typeof Q[1]!="function")throw new H0(a);return[I(Q[0]),Q[1]]}):[],f1(function(Q){for(var te=-1;++te<_;){var me=C[te];if(d0(me[0],this,Q))return d0(me[1],this,Q)}})}function L_e(C){return epe(uo(C,h))}function vp(C){return function(){return C}}function B_e(C,_){return C==null||C!==C?_:C}var k_e=JD(),O_e=JD(!0);function m2(C){return C}function Ap(C){return LD(typeof C=="function"?C:uo(C,h))}function I_e(C){return kD(uo(C,h))}function D_e(C,_){return OD(C,uo(_,h))}var P_e=f1(function(C,_){return function(I){return kl(I,C,_)}}),N_e=f1(function(C,_){return function(I){return kl(C,I,_)}});function bp(C,_,I){var Q=dr(_),te=Cu(_,Q);I==null&&!(w0(_)&&(te.length||!Q.length))&&(I=_,_=C,C=this,te=Cu(_,dr(_)));var me=!(w0(I)&&"chain"in I)||!!I.chain,ke=Aa(C);return A0(te,function(Ne){var We=_[Ne];C[Ne]=We,ke&&(C.prototype[Ne]=function(){var St=this.__chain__;if(me||St){var Mt=C(this.__wrapped__),It=Mt.__actions__=h2(this.__actions__);return It.push({func:We,args:arguments,thisArg:C}),Mt.__chain__=St,Mt}return We.apply(C,Ar([this.value()],arguments))})}),C}function T_e(){return R0._===this&&(R0._=u9),this}function _p(){}function R_e(C){return C=o1(C),f1(function(_){return ID(_,C)})}var F_e=Xm(e0),z_e=Xm(di),j_e=Xm(gi);function qP(C){return ip(C)?vi(Bi(C)):ppe(C)}function V_e(C){return function(_){return C==null?n:w3(C,_)}}var Z_e=tP(),U_e=tP(!0);function yp(){return[]}function wp(){return!1}function $_e(){return{}}function W_e(){return""}function K_e(){return!0}function Q_e(C,_){if(C=o1(C),C<1||C>W)return[];var I=U,Q=ie(C,U);_=jn(_),C-=U;for(var te=p3(Q,_);++I<C;)_(I);return te}function G_e(C){return Jn(C)?e0(C,Bi):F2(C)?[C]:h2(pP(G1(C)))}function Y_e(C){var _=++Ml;return G1(C)+_}var q_e=_u(function(C,_){return C+_},0),X_e=Jm("ceil"),J_e=_u(function(C,_){return C/_},1),eye=Jm("floor");function tye(C){return C&&C.length?gu(C,m2,Rm):n}function nye(C,_){return C&&C.length?gu(C,jn(_,2),Rm):n}function rye(C){return ia(C,m2)}function oye(C,_){return ia(C,jn(_,2))}function iye(C){return C&&C.length?gu(C,m2,Vm):n}function aye(C,_){return C&&C.length?gu(C,jn(_,2),Vm):n}var sye=_u(function(C,_){return C*_},1),lye=Jm("round"),cye=_u(function(C,_){return C-_},0);function uye(C){return C&&C.length?Or(C,m2):0}function dye(C,_){return C&&C.length?Or(C,jn(_,2)):0}return ce.after=IAe,ce.ary=HP,ce.assign=bbe,ce.assignIn=VP,ce.assignInWith=Du,ce.assignWith=_be,ce.at=ybe,ce.before=LP,ce.bind=dp,ce.bindAll=M_e,ce.bindKey=BP,ce.castArray=$Ae,ce.chain=EP,ce.chunk=eve,ce.compact=tve,ce.concat=nve,ce.cond=H_e,ce.conforms=L_e,ce.constant=vp,ce.countBy=uAe,ce.create=wbe,ce.curry=kP,ce.curryRight=OP,ce.debounce=IP,ce.defaults=xbe,ce.defaultsDeep=Ebe,ce.defer=DAe,ce.delay=PAe,ce.difference=rve,ce.differenceBy=ove,ce.differenceWith=ive,ce.drop=ave,ce.dropRight=sve,ce.dropRightWhile=lve,ce.dropWhile=cve,ce.fill=uve,ce.filter=fAe,ce.flatMap=CAe,ce.flatMapDeep=mAe,ce.flatMapDepth=pAe,ce.flatten=_P,ce.flattenDeep=dve,ce.flattenDepth=fve,ce.flip=NAe,ce.flow=k_e,ce.flowRight=O_e,ce.fromPairs=hve,ce.functions=Obe,ce.functionsIn=Ibe,ce.groupBy=vAe,ce.initial=Cve,ce.intersection=mve,ce.intersectionBy=pve,ce.intersectionWith=vve,ce.invert=Pbe,ce.invertBy=Nbe,ce.invokeMap=bAe,ce.iteratee=Ap,ce.keyBy=_Ae,ce.keys=dr,ce.keysIn=C2,ce.map=Hu,ce.mapKeys=Rbe,ce.mapValues=Fbe,ce.matches=I_e,ce.matchesProperty=D_e,ce.memoize=Bu,ce.merge=zbe,ce.mergeWith=ZP,ce.method=P_e,ce.methodOf=N_e,ce.mixin=bp,ce.negate=ku,ce.nthArg=R_e,ce.omit=jbe,ce.omitBy=Vbe,ce.once=TAe,ce.orderBy=yAe,ce.over=F_e,ce.overArgs=RAe,ce.overEvery=z_e,ce.overSome=j_e,ce.partial=fp,ce.partialRight=DP,ce.partition=wAe,ce.pick=Zbe,ce.pickBy=UP,ce.property=qP,ce.propertyOf=V_e,ce.pull=yve,ce.pullAll=wP,ce.pullAllBy=wve,ce.pullAllWith=xve,ce.pullAt=Eve,ce.range=Z_e,ce.rangeRight=U_e,ce.rearg=FAe,ce.reject=SAe,ce.remove=Sve,ce.rest=zAe,ce.reverse=cp,ce.sampleSize=HAe,ce.set=$be,ce.setWith=Wbe,ce.shuffle=LAe,ce.slice=Mve,ce.sortBy=OAe,ce.sortedUniq=Dve,ce.sortedUniqBy=Pve,ce.split=C_e,ce.spread=jAe,ce.tail=Nve,ce.take=Tve,ce.takeRight=Rve,ce.takeRightWhile=Fve,ce.takeWhile=zve,ce.tap=tAe,ce.throttle=VAe,ce.thru=Mu,ce.toArray=FP,ce.toPairs=$P,ce.toPairsIn=WP,ce.toPath=G_e,ce.toPlainObject=jP,ce.transform=Kbe,ce.unary=ZAe,ce.union=jve,ce.unionBy=Vve,ce.unionWith=Zve,ce.uniq=Uve,ce.uniqBy=$ve,ce.uniqWith=Wve,ce.unset=Qbe,ce.unzip=up,ce.unzipWith=xP,ce.update=Gbe,ce.updateWith=Ybe,ce.values=a4,ce.valuesIn=qbe,ce.without=Kve,ce.words=GP,ce.wrap=UAe,ce.xor=Qve,ce.xorBy=Gve,ce.xorWith=Yve,ce.zip=qve,ce.zipObject=Xve,ce.zipObjectDeep=Jve,ce.zipWith=eAe,ce.entries=$P,ce.entriesIn=WP,ce.extend=VP,ce.extendWith=Du,bp(ce,ce),ce.add=q_e,ce.attempt=YP,ce.camelCase=t_e,ce.capitalize=KP,ce.ceil=X_e,ce.clamp=Xbe,ce.clone=WAe,ce.cloneDeep=QAe,ce.cloneDeepWith=GAe,ce.cloneWith=KAe,ce.conformsTo=YAe,ce.deburr=QP,ce.defaultTo=B_e,ce.divide=J_e,ce.endsWith=n_e,ce.eq=zo,ce.escape=r_e,ce.escapeRegExp=o_e,ce.every=dAe,ce.find=hAe,ce.findIndex=AP,ce.findKey=Sbe,ce.findLast=gAe,ce.findLastIndex=bP,ce.findLastKey=Mbe,ce.floor=eye,ce.forEach=SP,ce.forEachRight=MP,ce.forIn=Hbe,ce.forInRight=Lbe,ce.forOwn=Bbe,ce.forOwnRight=kbe,ce.get=Cp,ce.gt=qAe,ce.gte=XAe,ce.has=Dbe,ce.hasIn=mp,ce.head=yP,ce.identity=m2,ce.includes=AAe,ce.indexOf=gve,ce.inRange=Jbe,ce.invoke=Tbe,ce.isArguments=S3,ce.isArray=Jn,ce.isArrayBuffer=JAe,ce.isArrayLike=g2,ce.isArrayLikeObject=z0,ce.isBoolean=ebe,ce.isBuffer=v9,ce.isDate=tbe,ce.isElement=nbe,ce.isEmpty=rbe,ce.isEqual=obe,ce.isEqualWith=ibe,ce.isError=hp,ce.isFinite=abe,ce.isFunction=Aa,ce.isInteger=PP,ce.isLength=Ou,ce.isMap=NP,ce.isMatch=sbe,ce.isMatchWith=lbe,ce.isNaN=cbe,ce.isNative=ube,ce.isNil=fbe,ce.isNull=dbe,ce.isNumber=TP,ce.isObject=w0,ce.isObjectLike=B0,ce.isPlainObject=Tl,ce.isRegExp=gp,ce.isSafeInteger=hbe,ce.isSet=RP,ce.isString=Iu,ce.isSymbol=F2,ce.isTypedArray=i4,ce.isUndefined=gbe,ce.isWeakMap=Cbe,ce.isWeakSet=mbe,ce.join=Ave,ce.kebabCase=i_e,ce.last=ho,ce.lastIndexOf=bve,ce.lowerCase=a_e,ce.lowerFirst=s_e,ce.lt=pbe,ce.lte=vbe,ce.max=tye,ce.maxBy=nye,ce.mean=rye,ce.meanBy=oye,ce.min=iye,ce.minBy=aye,ce.stubArray=yp,ce.stubFalse=wp,ce.stubObject=$_e,ce.stubString=W_e,ce.stubTrue=K_e,ce.multiply=sye,ce.nth=_ve,ce.noConflict=T_e,ce.noop=_p,ce.now=Lu,ce.pad=l_e,ce.padEnd=c_e,ce.padStart=u_e,ce.parseInt=d_e,ce.random=e_e,ce.reduce=xAe,ce.reduceRight=EAe,ce.repeat=f_e,ce.replace=h_e,ce.result=Ube,ce.round=lye,ce.runInContext=Ze,ce.sample=MAe,ce.size=BAe,ce.snakeCase=g_e,ce.some=kAe,ce.sortedIndex=Hve,ce.sortedIndexBy=Lve,ce.sortedIndexOf=Bve,ce.sortedLastIndex=kve,ce.sortedLastIndexBy=Ove,ce.sortedLastIndexOf=Ive,ce.startCase=m_e,ce.startsWith=p_e,ce.subtract=cye,ce.sum=uye,ce.sumBy=dye,ce.template=v_e,ce.times=Q_e,ce.toFinite=ba,ce.toInteger=o1,ce.toLength=zP,ce.toLower=A_e,ce.toNumber=go,ce.toSafeInteger=Abe,ce.toString=G1,ce.toUpper=b_e,ce.trim=__e,ce.trimEnd=y_e,ce.trimStart=w_e,ce.truncate=x_e,ce.unescape=E_e,ce.uniqueId=Y_e,ce.upperCase=S_e,ce.upperFirst=pp,ce.each=SP,ce.eachRight=MP,ce.first=yP,bp(ce,function(){var C={};return Hi(ce,function(_,I){d1.call(ce.prototype,I)||(C[I]=_)}),C}(),{chain:!1}),ce.VERSION=r,A0(["bind","bindKey","curry","curryRight","partial","partialRight"],function(C){ce[C].placeholder=ce}),A0(["drop","take"],function(C,_){an.prototype[C]=function(I){I=I===n?1:X(o1(I),0);var Q=this.__filtered__&&!_?new an(this):this.clone();return Q.__filtered__?Q.__takeCount__=ie(I,Q.__takeCount__):Q.__views__.push({size:ie(I,U),type:C+(Q.__dir__<0?"Right":"")}),Q},an.prototype[C+"Right"]=function(I){return this.reverse()[C](I).reverse()}}),A0(["filter","map","takeWhile"],function(C,_){var I=_+1,Q=I==j||I==R;an.prototype[C]=function(te){var me=this.clone();return me.__iteratees__.push({iteratee:jn(te,3),type:I}),me.__filtered__=me.__filtered__||Q,me}}),A0(["head","last"],function(C,_){var I="take"+(_?"Right":"");an.prototype[C]=function(){return this[I](1).value()[0]}}),A0(["initial","tail"],function(C,_){var I="drop"+(_?"":"Right");an.prototype[C]=function(){return this.__filtered__?new an(this):this[I](1)}}),an.prototype.compact=function(){return this.filter(m2)},an.prototype.find=function(C){return this.filter(C).head()},an.prototype.findLast=function(C){return this.reverse().find(C)},an.prototype.invokeMap=f1(function(C,_){return typeof C=="function"?new an(this):this.map(function(I){return kl(I,C,_)})}),an.prototype.reject=function(C){return this.filter(ku(jn(C)))},an.prototype.slice=function(C,_){C=o1(C);var I=this;return I.__filtered__&&(C>0||_<0)?new an(I):(C<0?I=I.takeRight(-C):C&&(I=I.drop(C)),_!==n&&(_=o1(_),I=_<0?I.dropRight(-_):I.take(_-C)),I)},an.prototype.takeRightWhile=function(C){return this.reverse().takeWhile(C).reverse()},an.prototype.toArray=function(){return this.take(U)},Hi(an.prototype,function(C,_){var I=/^(?:filter|find|map|reject)|While$/.test(_),Q=/^(?:head|last)$/.test(_),te=ce[Q?"take"+(_=="last"?"Right":""):_],me=Q||/^find/.test(_);te&&(ce.prototype[_]=function(){var ke=this.__wrapped__,Ne=Q?[1]:arguments,We=ke instanceof an,St=Ne[0],Mt=We||Jn(ke),It=function(v1){var S1=te.apply(ce,Ar([v1],Ne));return Q&&cn?S1[0]:S1};Mt&&I&&typeof St=="function"&&St.length!=1&&(We=Mt=!1);var cn=this.__chain__,Bn=!!this.__actions__.length,Zn=me&&!cn,c1=We&&!Bn;if(!me&&Mt){ke=c1?ke:new an(this);var Un=C.apply(ke,Ne);return Un.__actions__.push({func:Mu,args:[It],thisArg:n}),new p1(Un,cn)}return Zn&&c1?C.apply(this,Ne):(Un=this.thru(It),Zn?Q?Un.value()[0]:Un.value():Un)})}),A0(["pop","push","shift","sort","splice","unshift"],function(C){var _=Do[C],I=/^(?:push|sort|unshift)$/.test(C)?"tap":"thru",Q=/^(?:pop|shift)$/.test(C);ce.prototype[C]=function(){var te=arguments;if(Q&&!this.__chain__){var me=this.value();return _.apply(Jn(me)?me:[],te)}return this[I](function(ke){return _.apply(Jn(ke)?ke:[],te)})}}),Hi(an.prototype,function(C,_){var I=ce[_];if(I){var Q=I.name+"";d1.call(Re,Q)||(Re[Q]=[]),Re[Q].push({name:_,func:I})}}),Re[bu(n,x).name]=[{name:"wrapper",func:n}],an.prototype.clone=L0,an.prototype.reverse=cr,an.prototype.value=Gr,ce.prototype.at=nAe,ce.prototype.chain=rAe,ce.prototype.commit=oAe,ce.prototype.next=iAe,ce.prototype.plant=sAe,ce.prototype.reverse=lAe,ce.prototype.toJSON=ce.prototype.valueOf=ce.prototype.value=cAe,ce.prototype.first=ce.prototype.head,so&&(ce.prototype[so]=aAe),ce},Kr=xi();Lr?((Lr.exports=Kr)._=Kr,vr._=Kr):R0._=Kr}).call(tJ)}(H4,H4.exports)),H4.exports}var L4=nJ();const $o=V2(L4),wd="/not_available.svg",rJ="/big_size_image.svg",xd="/user.png",qb={HARDCODED_FALL_BACK_IMAGE:wd,HARDCODED_FALL_BACK_BIG_IMAGE:rJ,DEFAULT_AVATAR_IMAGE:xd,generateImageUrl:(e,t=!1)=>e||wd,getImageKitUrl:(e,t=300,n=300,r=40)=>e||wd,getUserAvatar:e=>{var t;return!e||!((t=e.awi_personal_info)!=null&&t.awi_avatar)?xd:e.awi_personal_info.awi_avatar||xd}};var j3=Ju();const Ed=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Sd(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on".concat(t),n)}function B4(e,t,n,r){e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent&&e.detachEvent("on".concat(t),n)}function Xb(e,t){const n=t.slice(0,t.length-1);for(let r=0;r<n.length;r++)n[r]=e[n[r].toLowerCase()];return n}function Jb(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const t=e.split(",");let n=t.lastIndexOf("");for(;n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function oJ(e,t){const n=e.length>=t.length?e:t,r=e.length>=t.length?t:e;let o=!0;for(let i=0;i<n.length;i++)r.indexOf(n[i])===-1&&(o=!1);return o}const k4={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":Ed?173:189,"=":Ed?61:187,";":Ed?59:186,"'":222,"[":219,"]":221,"\\":220},mo={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},O4={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},hr={16:!1,18:!1,17:!1,91:!1},b0={};for(let e=1;e<20;e++)k4["f".concat(e)]=111+e;let p0=[],I4=null,e_="all";const Pi=new Map,D4=e=>k4[e.toLowerCase()]||mo[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),iJ=e=>Object.keys(k4).find(t=>k4[t]===e),aJ=e=>Object.keys(mo).find(t=>mo[t]===e);function t_(e){e_=e||"all"}function P4(){return e_||"all"}function sJ(){return p0.slice(0)}function lJ(){return p0.map(e=>iJ(e)||aJ(e)||String.fromCharCode(e))}function cJ(){const e=[];return Object.keys(b0).forEach(t=>{b0[t].forEach(n=>{let{key:r,scope:o,mods:i,shortcut:a}=n;e.push({scope:o,shortcut:a,mods:i,keys:r.split("+").map(s=>D4(s))})})}),e}function uJ(e){const t=e.target||e.srcElement,{tagName:n}=t;let r=!0;const o=n==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||n==="TEXTAREA"||n==="SELECT")&&!t.readOnly)&&(r=!1),r}function dJ(e){return typeof e=="string"&&(e=D4(e)),p0.indexOf(e)!==-1}function fJ(e,t){let n,r;e||(e=P4());for(const o in b0)if(Object.prototype.hasOwnProperty.call(b0,o))for(n=b0[o],r=0;r<n.length;)n[r].scope===e?n.splice(r,1).forEach(a=>{let{element:s}=a;return Md(s)}):r++;P4()===e&&t_(t||"all")}function hJ(e){let t=e.keyCode||e.which||e.charCode;const n=p0.indexOf(t);if(n>=0&&p0.splice(n,1),e.key&&e.key.toLowerCase()==="meta"&&p0.splice(0,p0.length),(t===93||t===224)&&(t=91),t in hr){hr[t]=!1;for(const r in mo)mo[r]===t&&(U2[r]=!1)}}function n_(e){if(typeof e>"u")Object.keys(b0).forEach(o=>{Array.isArray(b0[o])&&b0[o].forEach(i=>ic(i)),delete b0[o]}),Md(null);else if(Array.isArray(e))e.forEach(o=>{o.key&&ic(o)});else if(typeof e=="object")e.key&&ic(e);else if(typeof e=="string"){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let[o,i]=n;typeof o=="function"&&(i=o,o=""),ic({key:e,scope:o,method:i,splitKey:"+"})}}const ic=e=>{let{key:t,scope:n,method:r,splitKey:o="+"}=e;Jb(t).forEach(a=>{const s=a.split(o),c=s.length,u=s[c-1],d=u==="*"?"*":D4(u);if(!b0[d])return;n||(n=P4());const h=c>1?Xb(mo,s):[],g=[];b0[d]=b0[d].filter(m=>{const A=(r?m.method===r:!0)&&m.scope===n&&oJ(m.mods,h);return A&&g.push(m.element),!A}),g.forEach(m=>Md(m))})};function r_(e,t,n,r){if(t.element!==r)return;let o;if(t.scope===n||t.scope==="all"){o=t.mods.length>0;for(const i in hr)Object.prototype.hasOwnProperty.call(hr,i)&&(!hr[i]&&t.mods.indexOf(+i)>-1||hr[i]&&t.mods.indexOf(+i)===-1)&&(o=!1);(t.mods.length===0&&!hr[16]&&!hr[18]&&!hr[17]&&!hr[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(p0),t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function o_(e,t){const n=b0["*"];let r=e.keyCode||e.which||e.charCode;if(!U2.filter.call(this,e))return;if((r===93||r===224)&&(r=91),p0.indexOf(r)===-1&&r!==229&&p0.push(r),["metaKey","ctrlKey","altKey","shiftKey"].forEach(s=>{const c=O4[s];e[s]&&p0.indexOf(c)===-1?p0.push(c):!e[s]&&p0.indexOf(c)>-1?p0.splice(p0.indexOf(c),1):s==="metaKey"&&e[s]&&(p0=p0.filter(u=>u in O4||u===r))}),r in hr){hr[r]=!0;for(const s in mo)if(Object.prototype.hasOwnProperty.call(mo,s)){const c=O4[mo[s]];U2[s]=e[c]}if(!n)return}for(const s in hr)Object.prototype.hasOwnProperty.call(hr,s)&&(hr[s]=e[O4[s]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(p0.indexOf(17)===-1&&p0.push(17),p0.indexOf(18)===-1&&p0.push(18),hr[17]=!0,hr[18]=!0);const o=P4();if(n)for(let s=0;s<n.length;s++)n[s].scope===o&&(e.type==="keydown"&&n[s].keydown||e.type==="keyup"&&n[s].keyup)&&r_(e,n[s],o,t);if(!(r in b0))return;const i=b0[r],a=i.length;for(let s=0;s<a;s++)if((e.type==="keydown"&&i[s].keydown||e.type==="keyup"&&i[s].keyup)&&i[s].key){const c=i[s],{splitKey:u}=c,d=c.key.split(u),h=[];for(let g=0;g<d.length;g++)h.push(D4(d[g]));h.sort().join("")===p0.sort().join("")&&r_(e,c,o,t)}}function U2(e,t,n){p0=[];const r=Jb(e);let o=[],i="all",a=document,s=0,c=!1,u=!0,d="+",h=!1,g=!1;for(n===void 0&&typeof t=="function"&&(n=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(i=t.scope),t.element&&(a=t.element),t.keyup&&(c=t.keyup),t.keydown!==void 0&&(u=t.keydown),t.capture!==void 0&&(h=t.capture),typeof t.splitKey=="string"&&(d=t.splitKey),t.single===!0&&(g=!0)),typeof t=="string"&&(i=t),g&&n_(e,i);s<r.length;s++)e=r[s].split(d),o=[],e.length>1&&(o=Xb(mo,e)),e=e[e.length-1],e=e==="*"?"*":D4(e),e in b0||(b0[e]=[]),b0[e].push({keyup:c,keydown:u,scope:i,mods:o,shortcut:r[s],method:n,key:r[s],splitKey:d,element:a});if(typeof a<"u"&&window){if(!Pi.has(a)){const m=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return o_(A,a)},v=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;o_(A,a),hJ(A)};Pi.set(a,{keydownListener:m,keyupListenr:v,capture:h}),Sd(a,"keydown",m,h),Sd(a,"keyup",v,h)}if(!I4){const m=()=>{p0=[]};I4={listener:m,capture:h},Sd(window,"focus",m,h)}}}function gJ(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(b0).forEach(n=>{b0[n].filter(o=>o.scope===t&&o.shortcut===e).forEach(o=>{o&&o.method&&o.method()})})}function Md(e){const t=Object.values(b0).flat();if(t.findIndex(r=>{let{element:o}=r;return o===e})<0){const{keydownListener:r,keyupListenr:o,capture:i}=Pi.get(e)||{};r&&o&&(B4(e,"keyup",o,i),B4(e,"keydown",r,i),Pi.delete(e))}if((t.length<=0||Pi.size<=0)&&(Object.keys(Pi).forEach(o=>{const{keydownListener:i,keyupListenr:a,capture:s}=Pi.get(o)||{};i&&a&&(B4(o,"keyup",a,s),B4(o,"keydown",i,s),Pi.delete(o))}),Pi.clear(),Object.keys(b0).forEach(o=>delete b0[o]),I4)){const{listener:o,capture:i}=I4;B4(window,"focus",o,i),I4=null}}const Hd={getPressedKeyString:lJ,setScope:t_,getScope:P4,deleteScope:fJ,getPressedKeyCodes:sJ,getAllKeyCodes:cJ,isPressed:dJ,filter:uJ,trigger:gJ,unbind:n_,keyMap:k4,modifier:mo,modifierMap:O4};for(const e in Hd)Object.prototype.hasOwnProperty.call(Hd,e)&&(U2[e]=Hd[e]);if(typeof window<"u"){const e=window.hotkeys;U2.noConflict=t=>(t&&window.hotkeys===U2&&(window.hotkeys=e),U2),window.hotkeys=U2}class X1 extends O.Component{constructor(t){super(t),this.isKeyDown=!1,this.handle=void 0,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.handleKeyUpEvent=this.handleKeyUpEvent.bind(this),this.handle={}}componentDidMount(){var{filter:t,splitKey:n}=this.props;t&&(U2.filter=t),U2.unbind(this.props.keyName),U2(this.props.keyName,{splitKey:n},this.onKeyDown),document&&document.body.addEventListener("keyup",this.handleKeyUpEvent)}componentWillUnmount(){U2.unbind(this.props.keyName),this.isKeyDown=!0,this.handle={},document&&document.body.removeEventListener("keyup",this.handleKeyUpEvent)}onKeyUp(t,n){var{onKeyUp:r,disabled:o}=this.props;!o&&r&&r(n.shortcut,t,n)}onKeyDown(t,n){var{onKeyDown:r,allowRepeat:o,disabled:i}=this.props;this.isKeyDown&&!o||(this.isKeyDown=!0,this.handle=n,!i&&r&&r(n.shortcut,t,n))}handleKeyUpEvent(t){this.isKeyDown&&(this.isKeyDown=!1,!(this.props.keyName&&this.props.keyName.indexOf(this.handle.shortcut)<0)&&(this.onKeyUp(t,this.handle),this.handle={}))}render(){return this.props.children||null}}X1.defaultProps={filter(e){var t=e.target||e.srcElement,n=t.tagName;return!(t.isContentEditable||n==="INPUT"||n==="SELECT"||n==="TEXTAREA")}},X1.propTypes={keyName:j3.string,filter:j3.func,onKeyDown:j3.func,onKeyUp:j3.func,disabled:j3.bool,splitKey:j3.string};const i_=["shift","alt","meta","mod","ctrl","control"],CJ={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function Oa(e){return(CJ[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function a_(e){return i_.includes(e)}function Ld(e,t=","){return e.toLowerCase().split(t)}function Bd(e,t="+",n=">",r=!1,o){let i=[],a=!1;e.includes(n)?(a=!0,i=e.toLocaleLowerCase().split(n).map(u=>Oa(u))):i=e.toLocaleLowerCase().split(t).map(u=>Oa(u));const s={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},c=i.filter(u=>!i_.includes(u));return{...s,keys:c,description:o,isSequence:a}}typeof document<"u"&&(document.addEventListener("keydown",e=>{e.code!==void 0&&s_([Oa(e.code)])}),document.addEventListener("keyup",e=>{e.code!==void 0&&l_([Oa(e.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{Ni.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{Ni.clear()},0)}));const Ni=new Set;function kd(e){return Array.isArray(e)}function mJ(e,t=","){return(kd(e)?e:e.split(t)).every(n=>Ni.has(n.trim().toLowerCase()))}function s_(e){const t=Array.isArray(e)?e:[e];Ni.has("meta")&&Ni.forEach(n=>!a_(n)&&Ni.delete(n.toLowerCase())),t.forEach(n=>Ni.add(n.toLowerCase()))}function l_(e){const t=Array.isArray(e)?e:[e];e==="meta"?Ni.clear():t.forEach(n=>Ni.delete(n.toLowerCase()))}function pJ(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function vJ(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}function AJ(e){return c_(e,["input","textarea","select"])}function c_(e,t=!1){const{target:n,composed:r}=e;let o;return bJ(n)&&r?o=e.composedPath()[0]&&e.composedPath()[0].tagName:o=n&&n.tagName,kd(t)?!!(o&&t&&t.some(i=>i.toLowerCase()===o.toLowerCase())):!!(o&&t&&t)}function bJ(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function _J(e,t){return e.length===0&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):t?e.some(n=>t.includes(n))||e.includes("*"):!0}const yJ=(e,t,n=!1)=>{const{alt:r,meta:o,mod:i,shift:a,ctrl:s,keys:c,useKey:u}=t,{code:d,key:h,ctrlKey:g,metaKey:m,shiftKey:v,altKey:A}=e,p=Oa(d);if(u&&(c==null?void 0:c.length)===1&&c.includes(h))return!0;if(!(c!=null&&c.includes(p))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(p))return!1;if(!n){if(r!==A&&p!=="alt"||a!==v&&p!=="shift")return!1;if(i){if(!m&&!g)return!1}else if(o!==m&&p!=="meta"&&p!=="os"||s!==g&&p!=="ctrl"&&p!=="control")return!1}return c&&c.length===1&&c.includes(p)?!0:c?mJ(c):!c},wJ=O.createContext(void 0),xJ=()=>O.useContext(wJ);function u_(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&u_(e[r],t[r]),!0):e===t}const EJ=O.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),SJ=()=>O.useContext(EJ);function MJ(e){const t=O.useRef(void 0);return u_(t.current,e)||(t.current=e),t.current}const d_=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},HJ=typeof window<"u"?O.useLayoutEffect:O.useEffect;function f_(e,t,n,r){const o=O.useRef(null),i=O.useRef(!1),a=n instanceof Array?r instanceof Array?void 0:r:n,s=kd(e)?e.join(a==null?void 0:a.delimiter):e,c=n instanceof Array?n:r instanceof Array?r:void 0,u=O.useCallback(t,c??[]),d=O.useRef(u);c?d.current=u:d.current=t;const h=MJ(a),{activeScopes:g}=SJ(),m=xJ();return HJ(()=>{if((h==null?void 0:h.enabled)===!1||!_J(g,h==null?void 0:h.scopes))return;let v=[],A;const p=(E,S=!1)=>{var M;if(!(AJ(E)&&!c_(E,h==null?void 0:h.enableOnFormTags))){if(o.current!==null){const H=o.current.getRootNode();if((H instanceof Document||H instanceof ShadowRoot)&&H.activeElement!==o.current&&!o.current.contains(H.activeElement)){d_(E);return}}(M=E.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Ld(s,h==null?void 0:h.delimiter).forEach(H=>{var k,D,P,T;if(H.includes((h==null?void 0:h.splitKey)??"+")&&H.includes((h==null?void 0:h.sequenceSplitKey)??">")){console.warn(`Hotkey ${H} contains both ${(h==null?void 0:h.splitKey)??"+"} and ${(h==null?void 0:h.sequenceSplitKey)??">"} which is not supported.`);return}const N=Bd(H,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description);if(N.isSequence){A=setTimeout(()=>{v=[]},(h==null?void 0:h.sequenceTimeoutMs)??1e3);const F=N.useKey?E.key:Oa(E.code);if(a_(F.toLowerCase()))return;v.push(F);const j=(k=N.keys)==null?void 0:k[v.length-1];if(F!==j){v=[],A&&clearTimeout(A);return}v.length===((D=N.keys)==null?void 0:D.length)&&(d.current(E,N),A&&clearTimeout(A),v=[])}else if(yJ(E,N,h==null?void 0:h.ignoreModifiers)||(P=N.keys)!=null&&P.includes("*")){if((T=h==null?void 0:h.ignoreEventWhen)!=null&&T.call(h,E)||S&&i.current)return;if(pJ(E,N,h==null?void 0:h.preventDefault),!vJ(E,N,h==null?void 0:h.enabled)){d_(E);return}d.current(E,N),S||(i.current=!0)}})}},x=E=>{E.code!==void 0&&(s_(Oa(E.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&p(E))},y=E=>{E.code!==void 0&&(l_(Oa(E.code)),i.current=!1,h!=null&&h.keyup&&p(E,!0))},w=o.current||(a==null?void 0:a.document)||document;return w.addEventListener("keyup",y,a==null?void 0:a.eventListenerOptions),w.addEventListener("keydown",x,a==null?void 0:a.eventListenerOptions),m&&Ld(s,h==null?void 0:h.delimiter).forEach(E=>m.addHotkey(Bd(E,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description))),()=>{w.removeEventListener("keyup",y,a==null?void 0:a.eventListenerOptions),w.removeEventListener("keydown",x,a==null?void 0:a.eventListenerOptions),m&&Ld(s,h==null?void 0:h.delimiter).forEach(E=>m.removeHotkey(Bd(E,h==null?void 0:h.splitKey,h==null?void 0:h.sequenceSplitKey,h==null?void 0:h.useKey,h==null?void 0:h.description))),v=[],A&&clearTimeout(A)}},[s,h,g]),o}const gr={table:"_table_q0jcp_1",table__header:"_table__header_q0jcp_18",table__header__th:"_table__header__th_q0jcp_24",table__row:"_table__row_q0jcp_38",table__row__row_selected:"_table__row__row_selected_q0jcp_44",table__row__td:"_table__row__td_q0jcp_47",clickable:"_clickable_q0jcp_68",loadMoreButton:"_loadMoreButton_q0jcp_73",loadMoreButtonDiv:"_loadMoreButtonDiv_q0jcp_78",table_container:"_table_container_q0jcp_84",scrollable_table:"_scrollable_table_q0jcp_92",pagination_container:"_pagination_container_q0jcp_104",pagination_btn:"_pagination_btn_q0jcp_113",active:"_active_q0jcp_130",pagination_dots:"_pagination_dots_q0jcp_135",pagination_input:"_pagination_input_q0jcp_140",nextPrevArrow:"_nextPrevArrow_q0jcp_165",pagination_left:"_pagination_left_q0jcp_179",pagination_right:"_pagination_right_q0jcp_191",pagination_loading:"_pagination_loading_q0jcp_204"},h_=({children:e,disableOverflowY:t=!1,tableClass:n="",disableFixHeight:r,isPagination:o=!0})=>Z.jsx("div",{className:qn(gr.table_container,n),style:{overflowY:t?"unset":"auto",height:r?"unset":o?"70vh":"78vh",maxHeight:o?"70vh":"85vh"},children:Z.jsx("table",{id:"resizeMe",className:qn(gr.table,gr.scrollable_table),children:e})}),g_=({children:e})=>Z.jsx("tbody",{className:gr.table__body,children:e}),Od=({children:e,className:t="",title:n="",onclick:r})=>Z.jsx("tr",{className:qn(gr.table__row,{[t]:!!t}),title:n,...r&&{onClick:r},children:e}),N4=({children:e,className:t="",extraClass:n="",title:r="",...o})=>{const i=qn(gr.table__row__td,t,(n==null?void 0:n.length)>0&&gr.clickable);return Z.jsx("td",{className:i,title:r,children:Z.jsx("span",{...o,style:{textAlign:"left"},children:e})})},C_=({children:e,className:t="",title:n=""})=>Z.jsx("th",{className:qn(gr.table__header__th,{[t]:t}),title:n,children:Z.jsxs("span",{children:[e," "]})}),m_=({children:e,className:t=""})=>Z.jsx("thead",{className:qn(gr.table__header,{[t]:!!t}),children:e}),p_=({list:e,headerClass:t="",type:n=""})=>(console.log("AWIHEADER List,",e),Z.jsx(m_,{className:t,children:Z.jsx(Od,{children:e.map(r=>Z.jsx(C_,{children:r},r))},`row_${n}`)},n)),Id=({toggleSelectAnnotation:e=()=>{console.log("Not available")},handleLeftKeyDown:t=()=>{console.log("Not available")},handleRightKeyDown:n=()=>{console.log("Not available")},handleUpKeyDown:r=()=>{console.log("Not available")},handleDownKeyDown:o=()=>{console.log("Not available")},handleZoomInClick:i=()=>{console.log("Not available")},handleZoomOutClick:a=()=>{console.log("Not available")},handleCompleteAnnotation:s=()=>{console.log("Not available")},undoAnnotationPoint:c=()=>{console.log("Not available")},reLoadAndReDrawAnnotations:u=()=>{console.log("Not available")},togglePagination:d=()=>{console.log("Not available")},toggleFullscreen:h=()=>{console.log("Not available")},switchToAutoAnnotations:g=()=>{console.log("Not available")},openShortCutRequestDetails:m=()=>{console.log("Not available")},handleRecentAnnotatedVerifiedImages:v=()=>{console.log("Not available")},handleSendToSamFunctionPrompt:A=()=>{console.log("Not available")},samAPIactive:p,request:x,switchToEditMode:y=()=>{console.log("Not available")},switchToCreateMode:w=()=>{console.log("Not available")},goToNextImage:E=()=>{console.log("Not available")},goToPreviousImage:S=()=>{console.log("Not available")},loggedUser:M,handleGoToPendingAnnotations:H=()=>{console.log("Not available")},handleCopyByCtrlC:k=()=>{console.log("Not available")},handlePasteAnnotationsByControlV:D=()=>{console.log("Not available")},openShortCutKeyModal:P,setOpenShortCutKeyModal:T=()=>{console.log("Not available")},setIsAltViaToolPressHandle:N=()=>{console.log("Not available")},isCarousel:F=!1,selectedTool:j="",setCrossHairHandle:z=()=>{console.log("Not available")},controlMinusHotkey:R=()=>{console.log("Not available")},controlPlusHotkey:$=()=>{console.log("Not available")}})=>{const W=p2.isSAMAllowed(x==null?void 0:x.awi_annotation_type,x==null?void 0:x.awi_request_for)&&!p,q=["awi_annotator","awi_verifier","awi_developer"].includes(M.userObj.awi_level),K=()=>{const J=[{action:"next image",key:"next_image",displayKey:"d",title:"Move to the next image",isClose:!0},{action:"previous image",key:"prev_image",displayKey:"a",title:"Move to the previous image",isClose:!0}],Y=[{action:"Go to pending annotation",key:"pending_annotations",displayKey:"p",title:"Go to pending annotation",isClose:!0}],ee=[{action:"Switch to edit",key:"edit_mode",displayKey:"e",title:"Switch to edit mode",isClose:!0},{action:"Switch to create",key:"create_mode",displayKey:"q",title:"Switch to create mode",isClose:!0},{action:"Switch to pan mode",key:"pan_mode",displayKey:"m",title:"Switch to pan mode",isClose:!0},{action:"Show cross hair",key:"cross_hair",displayKey:"w",title:"Show cross hair",isClose:!0},{action:"Copy selected annotation",key:"copy",displayKey:"Ctrl + C",title:"Copy selected annotation",isClose:!1},{action:"Paste all annotations",key:"paste",displayKey:"Ctrl + V",title:"Paste all copied annotations",isClose:!1},{action:"Forward Toggle Annotations",key:"select_forward",displayKey:"T",title:"Forward Toggle annotations visibility, Long press to get next",isClose:!1},{action:"Backward Toggle Annotations",key:"select_backward",displayKey:"U",title:"Backward Toggle annotations visibility, Long press to get previous",isClose:!1},{action:"Go to last updated annotations",key:"select_last_update",displayKey:"L",title:"Go to last updated annotations",isClose:!0},{action:"Undo Annotation point / Last State",key:"undo",displayKey:"Ctrl + Z",title:"Undo last annotation action",isClose:!0},{action:"Complete Annotation / Generate Point Annotations",key:"complete",displayKey:"Enter",title:"Finalize or generate point annotations",isClose:!0},{action:"Switch to Auto Annotations",key:"auto_annotations",displayKey:"S",title:"Enable automatic annotation mode",isClose:!0},{action:"AI prompt popup",key:"send_to_sam",displayKey:"X (if AI is enabled)",title:"AI prompt popup",isClose:!0},{action:"Get request information",key:"open_shortcut_details",displayKey:"V",title:"View request-related information",isClose:!0},{action:"Refetch Annotations",key:"reload",displayKey:"R",title:"Reload annotations",isClose:!0},{action:"Toggle Image Pagination",key:"toggle_pagination",displayKey:"H",title:"Show or hide image pagination",isClose:!1},{action:"Zoom In",key:"zoom_in",displayKey:"I",title:"Zoom into the image, long press for more zoom in",isClose:!1},{action:"Zoom Out",key:"zoom_out",displayKey:"O",title:"Zoom out of the image, long press for more zoom out",isClose:!1},{action:"Moving Zoomed images",key:"",displayKey:"Alt + Mouse Move",title:"Move the zoomed-in image",isClose:!1},{action:"View Recently Annotated Images",key:"recent_verified",displayKey:"Alt + R",title:"Show recently annotated images",isClose:!0},{action:"Delete Annotation",key:"",displayKey:"Ctrl + Delete",title:"Delete the selected annotation",isClose:!1},{action:"Move image to left",key:"move_left",displayKey:"←",title:"Move image to left",isClose:!1},{action:"Move image to right",key:"move_right",displayKey:"→",title:"Move image to right",isClose:!1},{action:"Move image to top",key:"move_up",displayKey:"↑",title:"Move image to top",isClose:!1},{action:"Move image to bottom",key:"move_down",displayKey:"↓",title:"Move image to bottom",isClose:!1},{action:"Enter/Exit Fullscreen",key:"fullscreen",displayKey:"F",title:"Enter/Exit Fullscreen",isClose:!1}];return M.userObj.awi_level==="awi_verifier"?[...J,...ee,...Y]:M.userObj.awi_level==="awi_supervisor"?J:[...J,...ee]},U=J=>{switch(J){case"select_forward":return e("forward");case"select_backward":return e("backward");case"select_last_update":return e("last_update");case"move_left":return t();case"move_right":return n();case"move_up":return r();case"move_down":return o();case"zoom_in":return i();case"zoom_out":return a();case"complete":return s();case"undo":return c();case"reload":return u();case"toggle_pagination":return d(Y=>!Y);case"fullscreen":return h();case"auto_annotations":return g();case"open_shortcut_details":return m();case"recent_verified":return v();case"send_to_sam":if(W)return j!="SAM"&&g(),A();V1.error("SAM is not allowed");return;case"edit_mode":if(y)return y();break;case"create_mode":if(w)return w();break;case"next_image":if(E)return E();break;case"prev_image":if(S)return S();break;case"pending_annotations":if(H)return H();break;case"copy":if(k)return k();break;case"paste":if(D)return D();break;case"pan_mode":N();break;case"cross_hair":z&&typeof z=="function"&&z();break;default:console.warn(`Unhandled hotkey action: ${J}`)}},G=(J,Y)=>{U(J),Y&&T(!1)};return f_("ctrl+=",J=>{J.preventDefault(),$()}),f_("ctrl+-, ctrl+subtract, ctrl+minus",J=>{J.preventDefault(),R()}),Z.jsxs(Z.Fragment,{children:[Z.jsx(X1,{allowRepeat:!0,keyName:"t",onKeyDown:()=>U("select_forward")}),Z.jsx(X1,{allowRepeat:!0,keyName:"u",onKeyDown:()=>U("select_backward")}),Z.jsx(X1,{allowRepeat:!1,keyName:"l",onKeyDown:()=>U("select_last_update")}),Z.jsx(X1,{allowRepeat:!0,keyName:"left",onKeyDown:()=>U("move_left")}),Z.jsx(X1,{allowRepeat:!0,keyName:"right",onKeyDown:()=>U("move_right")}),Z.jsx(X1,{allowRepeat:!0,keyName:"up",onKeyDown:()=>U("move_up")}),Z.jsx(X1,{allowRepeat:!0,keyName:"down",onKeyDown:()=>U("move_down")}),Z.jsx(X1,{allowRepeat:!0,keyName:"i",onKeyDown:()=>U("zoom_in")}),Z.jsx(X1,{allowRepeat:!0,keyName:"o",onKeyDown:()=>U("zoom_out")}),Z.jsx(X1,{keyName:"enter",onKeyDown:()=>U("complete")}),Z.jsx(X1,{keyName:"ctrl+z",onKeyDown:()=>U("undo")}),Z.jsx(X1,{keyName:"r",onKeyDown:()=>U("reload")}),Z.jsx(X1,{keyName:"h",onKeyDown:()=>U("toggle_pagination")}),Z.jsx(X1,{keyName:"f",onKeyDown:()=>U("fullscreen")}),Z.jsx(X1,{keyName:"s",onKeyDown:()=>U("auto_annotations")}),Z.jsx(X1,{keyName:"v",onKeyDown:()=>U("open_shortcut_details")}),Z.jsx(X1,{keyName:"alt+r",onKeyDown:()=>U("recent_verified")}),W&&Z.jsx(X1,{keyName:"x",onKeyDown:()=>U("send_to_sam")}),q&&Z.jsxs(Z.Fragment,{children:[Z.jsx(X1,{keyName:"e",onKeyDown:()=>U("edit_mode")}),Z.jsx(X1,{keyName:"q",onKeyDown:()=>U("create_mode")})]}),Z.jsx(X1,{keyName:"d",onKeyDown:()=>U("next_image")}),Z.jsx(X1,{keyName:"a",onKeyDown:()=>U("prev_image")}),M.userObj.awi_level==="awi_verifier"&&Z.jsx(X1,{keyName:"p",onKeyDown:()=>U("pending_annotations")}),Z.jsx(X1,{keyName:"ctrl+c",onKeyDown:()=>U("copy")}),Z.jsx(X1,{keyName:"ctrl+v",onKeyDown:()=>U("paste")}),Z.jsx(X1,{keyName:"m",onKeyDown:()=>U("pan_mode")}),Z.jsx(X1,{keyName:"w",onKeyDown:()=>U("cross_hair")}),P&&!F&&Z.jsx(Z.Fragment,{children:Z.jsxs(F6,{popupPosition:"right",isBackdrop:!0,backdropAction:()=>T(!1),className:"noPadding",children:[Z.jsx(j6,{title:"Shortcut keys",onClose:()=>T(!1)}),Z.jsx(z6,{children:Z.jsxs(h_,{children:[Z.jsx(p_,{list:["S.NO.","Command","Key Binding","Action"]},"short_cut_keys"),Z.jsx(g_,{children:(K()||[]).map((J,Y)=>{var ee;return Z.jsxs(Od,{title:J.title,children:[Z.jsx(N4,{children:Y+1}),Z.jsx(N4,{children:J.action}),Z.jsx(N4,{children:Z.jsxs("div",{className:"shortcutKey",children:[" ",J.displayKey," "]})}),Z.jsx(N4,{children:((ee=J==null?void 0:J.key)==null?void 0:ee.length)>0&&Z.jsx("button",{className:"modalButton modalButton__purpleColor",onClick:()=>G(J.key,J.isClose),children:"Press"})})]})})})]})}),Z.jsx(Z6,{})]})})]})},LJ=10,BJ=12,v_=e=>{switch(e){case"rectangle":return q1.rectangleIcon.IconComponent;case"circle":return q1.circleIcon.IconComponent;case"polygon":return q1.polygonIcon.IconComponent;case"dot":return q1.dotIcon.IconComponent;default:return q1.rectangleIcon.IconComponent}},ac=({isEditing:e,handleSelectTool:t=()=>{console.log("handleSelectTool function is not provided")},handleSAMToggle:n=()=>{console.log("handleSAMToggle function is not provided")},hasAnnotation:r=!1,currentSelectedSAMTool:o="Normal",handleCopyAnnotations:i,setOpenRequestDetails:a=()=>{console.log("setOpenRequestDetails function is not provided")},openRequestDetails:s,show_guidelines_first:c,handleZoomInClick:u,zoomProperties:d,handleReset:h,handleZoomOutClick:g,handleCompleteAnnotation:m,toggleFullscreen:v,selectAnnotationId:A,selectedAnnotationInfo:p,undoLastStateAnnotation:x,usingSamFunction:y,samAPIactive:w,handleSendToSamFunction:E,coordinates:S,handleSendToSamFunctionPrompt:M,reLoadAndReDrawAnnotations:H,showGuidelinesFirst:k,isMobile:D,toggleSelectAnnotation:P,handleLeftKeyDown:T,handleRightKeyDown:N,handleUpKeyDown:F,handleDownKeyDown:j,undoAnnotationPoint:z,togglePagination:R,switchToEditMode:$,switchToCreateMode:W,goToNextImage:q,goToPreviousImage:K,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,showPagination:Y=!1,loggedUser:ee,isControlViaToolPress:oe,isAltViaToolPress:de,setIsControlViaToolPress:se,setIsAltViaToolPress:xe,isCarousel:we=!1,allowedToCopyPreview:ve,classColorMapToSend:he,request:le,parentReqData:ae,RequestInfoModal:_e,setCrossHair:Oe,isCrossHair:Ie,annotationViewType:ge="atom",REACT_APP_SAM_ENABLED:et="no",controlPlusHotkey:fe,controlMinusHotkey:ne,Carousel:pe})=>{var Yt,An,_n,Qt,kt,Ht,xt,Zt,Cn,mt;(a==null||typeof a!="function")&&(a=pt=>{console.log("setOpenRequestDetails function is not provided",pt)}),t||(t=pt=>{console.log("handleSelectTool function is not provided",pt)}),n||(n=pt=>{console.log("handleSAMToggle function is not provided",pt)});const[Se,Le]=O.useState(!1),[Be,Ve]=O.useState(!1),[Ke,ct]=O.useState(""),[tt,Qe]=O.useState(!1),[Fe,ot]=O.useState(o),Ue=()=>{ct(""),a(!1),Ve(!1),Le(!0)},ze=(pt="annotated")=>{ct(pt),a(!1),Le(!1),Ve(!0)},Ge=()=>{le!=null&&le.total_verified_images_count?ze("verified"):ze("annotated")},dt=pt=>{t("annotate"),n(pt),ot(pt)},qe=pt=>{typeof t=="function"&&t("edit"),typeof n=="function"&&n("Normal"),typeof ot=="function"&&ot("Normal")},ft=()=>{if(Fe=="Normal"){if(!p2.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for))return;dt("SAM")}else dt("Normal")},Nt=()=>{k&&s||typeof a=="function"&&a(pt=>!pt)};O.useEffect(()=>{o&&ot(o)},[o]);const Kt=pt=>{i&&typeof i=="function"&&i(pt,!0)},sn=()=>{xe(!de)},Nn=()=>{Oe(!Ie)};return ve&&we?null:we?Z.jsx(Z.Fragment,{children:Z.jsx(Id,{toggleSelectAnnotation:P,handleLeftKeyDown:T,handleRightKeyDown:N,handleUpKeyDown:F,handleDownKeyDown:j,handleZoomInClick:u,handleZoomOutClick:g,handleCompleteAnnotation:m,undoAnnotationPoint:z,reLoadAndReDrawAnnotations:H,togglePagination:R,toggleFullscreen:v,switchToAutoAnnotations:ft,openShortCutRequestDetails:Nt,handleRecentAnnotatedVerifiedImages:Ge,samAPIactive:w,request:le,handleSendToSamFunctionPrompt:M,switchToEditMode:$,switchToCreateMode:W,goToNextImage:q,goToPreviousImage:K,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,openShortCutKeyModal:tt,setOpenShortCutKeyModal:Qe,setIsAltViaToolPressHandle:sn,isCarousel:we,selectedTool:Fe,setCrossHairHandle:Nn,loggedUser:ee,controlMinusHotkey:ne,controlPlusHotkey:fe})}):Z.jsxs("div",{style:{...D||ge==="library"?{width:"100%",height:"40px"}:{height:"100%",width:"100%",maxHeight:"100%"},overflow:"auto"},children:[Z.jsx(Z.Fragment,{children:Z.jsx(Id,{toggleSelectAnnotation:P,handleLeftKeyDown:T,handleRightKeyDown:N,handleUpKeyDown:F,handleDownKeyDown:j,handleZoomInClick:u,handleZoomOutClick:g,handleCompleteAnnotation:m,undoAnnotationPoint:z,reLoadAndReDrawAnnotations:H,togglePagination:R,toggleFullscreen:v,switchToAutoAnnotations:ft,openShortCutRequestDetails:Nt,handleRecentAnnotatedVerifiedImages:Ge,samAPIactive:w,request:le,handleSendToSamFunctionPrompt:M,switchToEditMode:$,switchToCreateMode:W,goToNextImage:q,goToPreviousImage:K,handleGoToPendingAnnotations:U,handleCopyByCtrlC:G,handlePasteAnnotationsByControlV:J,openShortCutKeyModal:tt,setOpenShortCutKeyModal:Qe,setIsAltViaToolPressHandle:sn,selectedTool:Fe,setCrossHairHandle:Nn,loggedUser:ee,isCarousel:we,controlMinusHotkey:ne,controlPlusHotkey:fe})}),Z.jsxs("div",{className:Sn.annotation__tool__icons,style:{display:"flex",justifyContent:D?"center":"space-between",flexDirection:D?"row":"column",backgroundColor:"#fff",width:D?"100%":"auto",...D||ge=="library"?{maxWidth:"100%",overflowX:"auto",gap:"20px"}:{height:"100%"}},children:[Z.jsxs("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[(le==null?void 0:le.awi_request_for)!="attributes"?Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:!e},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>{typeof t=="function"&&t("annotate")},title:e?"Create to change from edit to create mode":"Create to start create mode",children:(le==null?void 0:le.awi_annotation_type)&&((Yt=le==null?void 0:le.awi_annotation_type)==null?void 0:Yt.length)>0&&Z.jsx("img",{src:v_(le==null?void 0:le.awi_annotation_type),alt:"annotation tool",title:"Annotate - keyboard(Q)",className:Sn.annotationIcon})}):Z.jsx("div",{className:Sn.annotationIconDiv,children:(le==null?void 0:le.awi_annotation_type)&&((An=le==null?void 0:le.awi_annotation_type)==null?void 0:An.length)>0&&Z.jsx("img",{src:v_(le==null?void 0:le.awi_annotation_type),alt:"annotation tool",title:"Annotate - keyboard(Q)",className:Sn.annotationIcon})}),r&&Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:e},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>qe(),title:"Edit - keyboard(E)",children:Z.jsx("img",{src:q1.editIcon.IconComponent,alt:"Edit",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:oe},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>se(!oe),title:"Control",children:Z.jsx("img",{src:q1.controlIcon.IconComponent,alt:"Control",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:de},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>xe(!de),title:"Alt press / Panning mode",children:Z.jsx("img",{src:q1.moveIcon.IconComponent,alt:"Alt",className:Sn.annotationIcon})}),Z.jsx("div",{className:qn({[Sn.annotation__tool__icons__selected]:Ie},Sn.annotationIconDiv,"cursor-pointer"),onClick:()=>Oe(!Ie),title:"Cross Hair",children:Z.jsx("img",{src:q1.crosshairIcon.IconComponent,alt:"Cross Hair",className:Sn.annotationIcon})}),!e&&(le==null?void 0:le.awi_annotation_type)==="polygon"&&(le==null?void 0:le.awi_request_for)!="attributes"&&S.length>2?Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:m,title:"Click to complete your polygon annotation",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:q1.filledTickIcon.IconComponent,className:Sn.annotationIcon})})}):Z.jsx(Z.Fragment,{children:(le==null?void 0:le.awi_annotation_type)==="polygon"&&Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{title:"Works for create mode with minimum 3 coordinates",className:Sn.annotationIconDiv,style:{cursor:"not-allowed !important",opacity:"0.5"},children:Z.jsx("img",{src:q1.filledTickIcon.IconComponent,className:qn(Sn.annotationIcon,"not-allowed-pointer")})})})}),Z.jsx("div",{className:Sn.partitionLine})]}),Z.jsxs("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsxs("div",{onClick:((_n=p==null?void 0:p.past_coords)==null?void 0:_n.length)>0&&e&&A!=="-1"?x:void 0,title:((Qt=p==null?void 0:p.past_coords)==null?void 0:Qt.length)>0&&e&&A!=="-1"?"Click to revert annotation":"No undo available",style:{width:"1.8rem",height:"1.8rem",position:"relative",cursor:((kt=p==null?void 0:p.past_coords)==null?void 0:kt.length)>0&&e&&A!=="-1"?"pointer":"not-allowed",opacity:((Ht=p==null?void 0:p.past_coords)==null?void 0:Ht.length)>0&&e&&A!=="-1"?1:.5,pointerEvents:((xt=p==null?void 0:p.past_coords)==null?void 0:xt.length)>0&&e&&A!=="-1"?"auto":"none"},children:[Z.jsx("img",{src:q1.undoAnnotationIcon.IconComponent,alt:"Undo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"0.25rem"}}),((Zt=p==null?void 0:p.past_coords)==null?void 0:Zt.length)>0&&e&&A!=="-1"&&Z.jsx("div",{className:Sn.undoAnnotationCount,children:p.past_coords.length})]})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("img",{onClick:u,src:q1.zoomInIcon.IconComponent,className:`cursor-pointer ${d.scale===BJ?"cursor-pointer-disable":""} ${Sn.annotationIcon}`,title:"Zoom in - Keyboard(I)"})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("div",{onClick:h,title:`Click to Reset Zoom ${d.scale.toFixed(1)} to default`,className:Sn.annotationIcon,style:{fontSize:"12px",justifyContent:"center",display:"flex"},children:d.scale.toFixed(1)})}),Z.jsx("div",{className:Sn.annotationIconDiv,children:Z.jsx("img",{onClick:g,src:q1.zoomOutIcon.IconComponent,className:`cursor-pointer ${d.scale===1?"cursor-pointer-disable":""} ${Sn.annotationIcon}`,title:"Zoom out - Keyboard(O)"})}),Z.jsx("div",{onClick:()=>v(),className:Sn.annotationIconDiv,style:{display:"flex",alignItems:"center",justifyContent:"center"},title:"Toggle Fullscreen - Keyboard(F)",id:"toggle_full_screen",children:Z.jsx("img",{src:q1.toggleFullscreenIcon.IconComponent,className:Sn.annotationIcon})}),Z.jsx("div",{className:Sn.partitionLine})]}),Z.jsxs("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:[et=="yes"&&p2.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for)&&Z.jsx("div",{style:{display:"flex",alignItems:"center"},title:"AI tools - keyboard(S)",children:Z.jsxs("label",{className:Sn.switch,style:{marginLeft:"4px",width:"30px important"},children:[Z.jsx("input",{type:"checkbox",checked:Fe==="SAM",onChange:()=>{dt(Fe==="SAM"?"Normal":"SAM")}}),Z.jsx("span",{className:qn(Sn.slider,Sn.round)})]})}),p2.isSAMAllowed(le==null?void 0:le.awi_annotation_type,le==null?void 0:le.awi_request_for)&&Z.jsxs("div",{className:qn({"disabled-class":!y}),style:{justifyContent:"space-between",display:"flex",flexDirection:D?"row":"column",gap:"15px"},children:[(le==null?void 0:le.awi_annotation_type)&&(le==null?void 0:le.awi_annotation_type)!="dot"&&Z.jsx("div",{onClick:()=>{!w&&(S!=null&&S.length)&&E()},className:qn({"disabled-class":!y||w||!(S!=null&&S.length)},Sn.annotationIconDiv,"cursor-pointer"),style:{pointerEvents:w||!y?"none":"auto",opacity:w||!y?.5:1},children:Z.jsx("img",{src:q1.pointAnnotationIcon.IconComponent,title:"Mark some points and then click here and get the power of AI auto annotation",className:Sn.annotationIcon})}),Z.jsx("div",{onClick:w?void 0:M,style:{pointerEvents:w||!y?"none":"auto",opacity:w||!y?.5:1},title:"Give your prompt and get the power of AI auto annotation",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:q1.promptAnnotationIcon.IconComponent,title:"auto annotation prompt - keyboard(X)",className:Sn.annotationIcon})})]}),Z.jsx("div",{onClick:H,title:"Click to refetch saved annotations, hard reset",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:q1.refetchAnnotationIcon.IconComponent,title:"Refetch annotations (Hard Reset) - keyboard(R)",className:Sn.annotationIcon})}),Z.jsx("div",{style:{width:"53%",height:"2px",backgroundColor:"#e4e0e6",margin:"8px auto"}})]}),Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:()=>{typeof a=="function"&&a(pt=>!pt)},title:"View details - keyboard(V)",className:Sn.annotationIconDiv,children:Z.jsx("img",{src:q1.guidelinesIcon.IconComponent,alt:"info",style:{height:"30px !important",width:"30px !important",cursor:"pointer"}})})}),Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{children:Z.jsx("img",{src:q1.keyboardShortcutsIcon.IconComponent,title:"See short-cut keys",className:"cursor-pointer",width:"30px",onClick:()=>Qe(pt=>!pt)})})}),Z.jsx("div",{className:Sn.annotationIconPartition,style:D?{flexDirection:"row",padding:"0"}:{flexDirection:"column"},children:Z.jsx("div",{onClick:R,children:Z.jsx("img",{src:q1.transparentBlackIcon.IconComponent,style:{height:"24px",width:" 24px",cursor:"pointer"},alt:"Previous",title:Y?"Hide Pagination":"Show Pagination"})})})]}),s&&_e&&Z.jsx(_e,{request:le,handleReferenceImageClick:Ue,handleRecentAnnotatedImages:ze,show_guidelines_first:c,setOpenRequestDetails:a,classColorMapToSend:he}),s&&_e&&Z.jsx("div",{className:qn(Sn.backdrop),onClick:()=>{c||typeof a=="function"&&a(!1)}}),s&&Z.jsx("div",{className:qn(Sn.backdrop),onClick:()=>{k||typeof a=="function"&&a(!1)}}),pe&&Se&&Z.jsx(Z.Fragment,{children:Z.jsx(pe,{handleToggleCarousel:()=>Le(!1),requestName:(le==null?void 0:le.awi_label)||"",showAnnotationType:"all",requestId:(ae==null?void 0:ae.awi_id)||(le==null?void 0:le.awi_id),imageKeys:((Cn=ae==null?void 0:ae.awi_reference_images)==null?void 0:Cn.awi_ids)||((mt=le==null?void 0:le.awi_reference_images)==null?void 0:mt.awi_ids)||[],awi_reference_image:!0,defaultAnnotationMode:"display_annotations",allowedToCopy:!0,copyCallBack:Kt})}),Se&&Z.jsx("div",{className:qn(Sn.backdrop,Sn.backdrop__transparent),onClick:()=>Le(!1)}),pe&&Be&&Z.jsx(Z.Fragment,{children:Z.jsx(pe,{handleToggleCarousel:()=>Ve(!1),requestName:(le==null?void 0:le.awi_label)||"",showAnnotationType:"all",requestId:(ae==null?void 0:ae.awi_id)||(le==null?void 0:le.awi_id),awi_reference_image:!1,contentAnnotationType:Ke||"annotated",primaryLimit:LJ,defaultAnnotationMode:"display_annotations",allowedToCopy:!0,copyCallBack:Kt})})]})},sc={canvas:"_canvas_145op_1",canvasContainer:"_canvasContainer_145op_9",canvasSubContainer:"_canvasSubContainer_145op_18"},lc=({canvasDimensions:e,zoomProperties:t,isEditing:n,canvasRef:r,bgCanvasRef:o,overlayCanvasRef:i,handleMouseDown:a,handleMouseUp:s,handleMouseMove:c,handleMouseMoveOut:u,handleOnMouseLeave:d,handleWheel:h,handleTouchStart:g,handleTouchMove:m,handleTouchEnd:v,handleTouchCancel:A})=>Z.jsxs("div",{className:sc.canvasSubContainer,style:{display:"flex",flexDirection:"row",width:e.width,height:e.height,position:"relative"},children:[Z.jsx("canvas",{ref:o,className:sc.bgCanvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,zIndex:0,pointerEvents:"none"}}),Z.jsx("canvas",{ref:r,className:sc.canvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,cursor:n?"default":"crosshair",transformOrigin:"top left",transform:`translate(${t.x}px, ${t.y}px)`},onMouseDown:a,onMouseUp:s,onMouseMove:c,onMouseOut:u,onMouseLeave:d,onWheel:h,onTouchStart:g,onTouchMove:m,onTouchEnd:v,onTouchCancel:A}),Z.jsx("canvas",{ref:i,className:sc.overlayCanvas,style:{position:"absolute",top:0,left:0,width:`${e.width*t.scale}px`,height:`${e.height*t.scale}px`,pointerEvents:"none",zIndex:2,transformOrigin:"top left",transform:`translate(${t.x}px, ${t.y}px)`}})]}),kJ=1e-5,OJ=.99999,IJ=.001,DJ=.005,cc=(e,t)=>e/(t||1),A_=(e,t,n,r)=>Math.sqrt(Math.pow(Math.abs(n-e),2)+Math.pow(Math.abs(r-t),2)),Dd=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(n.x-e.x)*(t.y-e.y),PJ=e=>{let t=1/0,n=1/0,r=-1/0,o=-1/0;return e.forEach(({x:i,y:a})=>{t=Math.min(t,i),n=Math.min(n,a),r=Math.max(r,i),o=Math.max(o,a)}),{minX:t,minY:n,maxX:r,maxY:o}},Pd=(e,t,n=0)=>{let r=0;for(let o=0;o<(t==null?void 0:t.length)-1;o++){const i=t[o],a=t[o+1];i.y<=e.y+n?a.y>e.y+n&&Dd(i,a,e)>0&&r++:a.y<=e.y-n&&Dd(i,a,e)<0&&r--}return r},Nd=e=>(e==null?void 0:e.length)<2?0:Math.sqrt(Math.pow(Math.abs(e[0].x-e[1].x),2)+Math.pow(Math.abs(e[0].y-e[1].y),2));function NJ(e,t,n=0){const r=Math.min(...t.map(u=>u.x)),o=Math.max(...t.map(u=>u.x)),i=Math.min(...t.map(u=>u.y)),a=Math.max(...t.map(u=>u.y)),{x:s,y:c}=e;return s>=r-n&&s<=o+n&&c>=i-n&&c<=a+n}const TJ=(e,t,n,r,o,i,a=1)=>{if(!(n!=null&&n.length))return!1;let s,c,u,d,h=!1;switch(i==null?void 0:i.awi_annotation_type){case"rectangle":h=NJ({x:e,y:t},n,r);break;case"polygon":h=Pd({x:e,y:t},n,r)!==0;break;case"circle":s=Nd(n)/2,c=(n[0].x+r+(n[1].x-o))/2,u=(n[0].y+n[1].y)/2,d=(e-c)*(e-c)+(t-u)*(t-u),d<s*s?h=!0:h=!1;break;case"dot":s=cc(.015,a),c=(n[0].x+r+(n[0].x-o))/2,u=(n[0].y+n[0].y)/2,d=(e-c)*(e-c)+(t-u)*(t-u),d<s*s?h=!0:h=!1;break;default:h=Pd({x:e,y:t},n,r)!==0}return h},RJ=e=>!(!e||e.x>1||e.x<0||e.y1>1||e.y<0),FJ=e=>{if((e==null?void 0:e.length)<3)return!1;for(let t=0;t<e.length;t++)if(!RJ(e[t]))return!1;return!0},zJ=(e,t,n=!1,r=1)=>{var a,s,c,u;const o=e==null?void 0:e.awi_annotation_type;let i=!1;switch(o){case"rectangle":const d=cc(IJ,r);(t==null?void 0:t.length)>3&&Math.abs(((a=t[0])==null?void 0:a.x)-((s=t[1])==null?void 0:s.x))>d&&Math.abs(((c=t[1])==null?void 0:c.y)-((u=t[3])==null?void 0:u.y))>d&&(i=!0);break;case"circle":const h=cc(DJ,r);Nd(t)>h&&(i=!0);break;case"polygon":i=FJ(t);break;case"dot":i=!0;break;default:n&&(i=!0);break}return i},b_=(e,t,n,r,o,i)=>{const a=e-n,s=t-r,c=o-n,u=i-r,d=a*c+s*u,h=c*c+u*u,g=h!==0?d/h:-1;let m,v;g<0?(m=n,v=r):g>1?(m=o,v=i):(m=n+g*c,v=r+g*u);const A=e-m,p=t-v;return Math.sqrt(A*A+p*p)},jJ=(e,t,n)=>{let r=1/0,o=-1;for(let i=0;i<(e==null?void 0:e.length);i++){const a=(i+1)%e.length,{x:s,y:c}=e[i],{x:u,y:d}=e[a],h=b_(t,n,s,c,u,d);h<r&&(r=h,o=a)}return{insertIndex:o,minDistance:r}},__=(e,t)=>t===0?e:__(t,e%t),VJ=(e,t,n,r)=>(e>0&&(e=0),Math.abs(e)>n&&(e=-1*n),Math.abs(t)>r&&(t=-1*r),t>0&&(t=0),{newXTransform:e,newYTransform:t}),ZJ=function(e){console.log("getBoundingBox called");const t=Math.min(...e.map(i=>i.x)),n=Math.max(...e.map(i=>i.x)),r=Math.min(...e.map(i=>i.y)),o=Math.max(...e.map(i=>i.y));return[{x:t,y:r},{x:n,y:r},{x:n,y:o},{x:t,y:o}]};function UJ(e,t,n){return Math.min(n,Math.max(t,e))}function $J(e,t=.05,n=null){const r=Math.min(...e.map(h=>h.x)),o=Math.max(...e.map(h=>h.x)),i=Math.min(...e.map(h=>h.y)),a=Math.max(...e.map(h=>h.y)),s=o-r,c=a-i;let u,d;if(n&&(n==null?void 0:n.x)>=0&&(n==null?void 0:n.y)>=0){const h=n.x,g=n.y;u=Math.max(-r,Math.min(1-o,h-(r+s/2))),d=Math.max(-i,Math.min(1-a,g-(i+c/2)))}else u=Math.max(-r,Math.min(1-o,(Math.random()*2-1)*t)),d=Math.max(-i,Math.min(1-a,(Math.random()*2-1)*t));return e.map(h=>({x:h.x+u,y:h.y+d}))}function WJ(e){const t=Math.min(...e.map(s=>s.x)),n=Math.max(...e.map(s=>s.x)),r=Math.min(...e.map(s=>s.y)),o=Math.max(...e.map(s=>s.y));return y_([{x:t,y:r},{x:n,y:o}])}function KJ(e){const t=Math.min(...e.map(s=>s.x)),n=Math.max(...e.map(s=>s.x)),r=Math.min(...e.map(s=>s.y)),o=Math.max(...e.map(s=>s.y)),i=(t+n)/2,a=(r+o)/2;return[{x:i,y:a}]}const Td=(e,t)=>(e.x-t.x)**2+(e.y-t.y)**2,QJ=(e,t,n)=>{const r=Td(t,n);if(r===0)return Td(e,t);let o=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;o=Math.max(0,Math.min(1,o));const i={x:t.x+o*(n.x-t.x),y:t.y+o*(n.y-t.y)};return Td(e,i)},GJ=(e,t)=>{let n=1/0;for(let r=0;r<(t==null?void 0:t.length);r++){const o=t[r],i=t[(r+1)%t.length],a=QJ(e,o,i);n=Math.min(n,a)}return Math.sqrt(n)},YJ=(e,t)=>{let n=1/0,r=-1;for(let o=0;o<(t==null?void 0:t.length);o++){const i=t[o],a=A_(e.x,e.y,i.x,i.y);if(a<n){const s=o%t.length;n=a,r=s}}return{minDistance:n,insertIndex:r}},Rd=(e=0)=>(e<=0?e=kJ:e>=1&&(e=OJ),e),qJ=e=>e.map(n=>({x:Rd(n.x),y:Rd(n.y)})),XJ=e=>{const t=new Set,n=[];for(let r=0;r<e.length;r++){const o=`${e[r].x},${e[r].y}`;t.has(o)||(t.add(o),n.push(e[r]))}return n.length>0&&n.push(n[0]),n},JJ=e=>{let t=0;for(let n=0;n<e.length;n++)if(e[n].x<=0){t=t+1;continue}else if(e[n].y<=0){t=t+1;continue}else if(e[n].x>=1){t=t+1;continue}else if(e[n].y>=1){t=t+1;continue}return t};function eee(e){const t=Math.min(...e.map(s=>s.x)),n=Math.min(...e.map(s=>s.y)),r=Math.max(...e.map(s=>s.x)),o=Math.max(...e.map(s=>s.y)),i=t<0?-t:r>1?1-r:0,a=n<0?-n:o>1?1-o:0;return e.map(({x:s,y:c})=>({x:s+i,y:c+a}))}const tee=(e,t)=>{const n=(e.x+t.x)/2,r=(e.y+t.y)/2,o=Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)/2,i=Math.min(n,1-n),a=Math.min(r,1-r),s=Math.min(o,i,a),c=Math.atan2(t.y-e.y,t.x-e.x),u={x:n-s*Math.cos(c),y:r-s*Math.sin(c)},d={x:n+s*Math.cos(c),y:r+s*Math.sin(c)};return[u,d]},nee=(e,t)=>{const n=(e[0].x+e[1].x)/2,r=t,i=Math.sqrt(Math.pow(e[1].x-e[0].x,2))/2;let a=0;return n-i<0?a=i-n:n+i>1&&(a=1-(n+i)),e[0].x+=a,e[1].x+=a,e[0].y=r,e[1].y=r,e},y_=e=>{e=tee(e[0],e[1]);const t=(e[0].x+e[1].x)/2,n=(e[0].y+e[1].y)/2,o=Math.sqrt(Math.pow(e[1].x-e[0].x,2)+Math.pow(e[1].y-e[0].y,2))/2;let i=0;t-o<0?i=o-t:t+o>1&&(i=1-(t+o));let a=0;return n-o<0?a=o-n:n+o>1&&(a=1-(n+o)),e[0].x+=i,e[0].y+=a,e[1].x+=i,e[1].y+=a,nee(e,n)},ree=(e,t,n)=>{let{x:r,y:o}=w_(e.current,t);const i=n;r=Math.min(r,1),o=Math.min(o,1);const a=r-i.x,s=o-i.y;let c=[];return a===0||s===0?c=[{x:i.x,y:i.y},{x:i.x,y:i.y},{x:i.x,y:i.y},{x:i.x,y:i.y}]:a>0&&s>0?c=[{x:i.x,y:i.y},{x:r,y:i.y},{x:r,y:o},{x:i.x,y:o}]:a>0&&s<0?c=[{x:i.x,y:o},{x:r,y:o},{x:r,y:i.y},{x:i.x,y:i.y}]:a<0&&s>0?c=[{x:r,y:i.y},{x:i.x,y:i.y},{x:i.x,y:o},{x:r,y:o}]:c=[{x:r,y:o},{x:i.x,y:o},{x:i.x,y:i.y},{x:r,y:i.y}],c},w_=(e,t)=>{if(!e)return{x:0,y:0};const n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/(n.right-n.left),y:(t.clientY-n.top)/(n.bottom-n.top)}},kn={gcd:__,getDistance:A_,isLeft:Dd,windingNumber:Pd,getDiameter:Nd,checkPointInsidePolygon:TJ,isAnnotationCoordinatesValid:zJ,distanceToSegment:b_,findClosestSegment:jJ,transformCoordinatesCheck:VJ,getBoundingBox:ZJ,translateCoordinatesWithFixedWidth:$J,clampValue:UJ,calculateCircleFromCoordinates:WJ,calculateCentroid:KJ,minDistanceToPolygon:GJ,closestCoordinates:YJ,fineTuneCoordinates:qJ,zoomLevelValue:cc,createPolygonLoop:XJ,breakPointCount:JJ,getBoundingBoxValues:PJ,shiftPolygon:eee,getPerfectPointValue:Rd,adjustToCircle:y_,getMousePos:w_,getMousePosAbsolute:(e,t)=>{if(!e)return{x:0,y:0};const n=e.getBoundingClientRect(),r={x:(t.clientX-n.left)/(n.right-n.left),y:(t.clientY-n.top)/(n.bottom-n.top)};return r.x<=0&&(r.x=1e-4),r.y<=0&&(r.y=1e-4),r.x>=1&&(r.x=1-1e-4),r.y>=1&&(r.y=1-1e-4),r},getUpdatedCoordinates:ree},oee=({imageUrl:e,showAnnotations:t=!1,createAnnotation:n,handleMultipleAnnotations:r,handleUpdateAnnotationCoordinates:o,content_id:i,request_id:a,className:s="",isEditing:c=!1,selectIndex:u="-1",handleSelectAnnotationIndex:d,handleSelectTool:h,showAnnotationType:g="all",loggedUser:m,isCarousel:v=!1,classColorMap:A=null,disableAnnotation:p=!1,SAMToggle:x,imageNumber:y=0,togglePagination:w,handleSAMToggle:E,unSelectedAnnotationIDsSet:S=new Set,setMousePosition:M,allowedToCopyPreview:H=!1,copyCallBackHandler:k,annotationSession:D,SAMToggleValue:P,selectedSAMTool:T,handleCopyAnnotations:N,setOpenRequestDetails:F,openRequestDetails:j,handleNextPage:z,handlePreviousPage:R,currentPage:$,handleUpdateImageIndex:W,requestId:q,showPagination:K,isAnnotationCreating:U,contentInfo:G,content_key:J,isAnnotationUpdating:Y,isDeleteAnnotationMutationLoading:ee,showGuidelinesFirst:oe,currentImage:de=0,selectedContent:se=null,switchToEditMode:xe,switchToCreateMode:we,goToNextImage:ve,goToPreviousImage:he,handleGoToPendingAnnotations:le,handlePasteAnnotationsByControlV:ae,annotationsResponse:_e,isAnnotationFetching:Oe,fetchAnnotationsKey:Ie,request:ge,parentReqData:et,clearAnnotationCache:fe,RequestInfoModal:ne,getAnnotationFromSAM:pe,getAnnotationsFromSAMPrompt:Se,fetchAnnotations:Le,pageCount:Be=10,annotationViewType:Ve="atom",AnnotationPagination:Ke,REACT_APP_SAM_ENABLED:ct="no",ImageGenerationHelper:tt=qb,fallbackImageUrl:Qe,activeColor:Fe,Carousel:ot,showTool:Ue=!0})=>{var Si,h9,f,b,B,V,X,ie,De,Je,rt,Bt,on,Pn,Yn,g0;const ze=km().isCtrlPressedFunc,Ge=km().isAltPressedFunc,[dt,qe]=O.useState(!1),[ft,Nt]=O.useState(!1),Kt=.007,sn=.03,Nn=.01,Yt=.005,An=.005,_n=.7,Qt=.005,kt=.005,Ht=.003,xt=.01,Zt="#40ff00",Cn="#fff",mt="#FFFF00",pt="red",Lt="rgba(0, 255, 255, 1)",Xe="rgba(0, 255, 255, 0.5)",Vt="#FF3131",Ae=4,it=5,$e={DEFAULT:1.5,SELECTED:4.5,CAROUSAL:2.5,CIRCLE:2},_t=O.useRef(""),Ye=O.useRef(null),Et=O.useRef(null),Ot=O.useRef(null),zt=Yv(),[Mn,At]=O.useState(!1),[bt,Tt]=O.useState(!1),[nt,Rt]=O.useState([]),[Ut,_1]=O.useState(),[O1,l1]=O.useState(),[e1,Kn]=O.useState({x:-1,y:-1}),[y1,Q1]=O.useState(-1),[tn,Hn]=O.useState({x:0,y:0}),[Pt,un]=O.useState(u),[Vn,T1]=O.useState("-1"),[r1,w1]=O.useState([]),[mn,$t]=O.useState(!1),[yn,Ln]=O.useState(null),[yt,Dt]=O.useState({width:0,height:0}),Ft=B1.INITIAL_ZOOM_PROPERTIES,[at,pn]=O.useState(Ft),[Tn,R1]=O.useState(!1),[u1,u0]=O.useState(!1),[fn,wn]=O.useState(-1),[rn,jt]=O.useState(!1),qt=B1.INITIAL_ZOOM_LEVEL,Qn=12,Gn=yt.width*qt,H1=O.useRef(null),[bn,Hr]=O.useState(_e),[Fn,ir]=O.useState(),[vn,hn]=O.useState([]),[In,I1]=O.useState(null),a0=B1.SAM_MODEL_NAME,L1=B1.SAM_MODEL_CONFIDENCE,J2=B1.SAM_MODEL_MAX_RESULTS,[Ur,zn]=O.useState(!1),[t1,ci]=O.useState(-1),[h3,o9]=O.useState(null),[eo,i9]=O.useState(null),[g3,C3]=O.useState(null),[C1,R0]=O.useState({modelName:"",modelConfidence:0,modelMaxResults:0,promptMessage:""}),[vr,Lr]=O.useState(null),[ui,a9]=O.useState(!1),[y0,W5]=O.useState({x:-1,y:-1}),[l2,K5]=O.useState({left:0,right:0,top:0,bottom:0}),[$r,s9]=O.useState(null),[c2,d0]=O.useState(""),Q5={SELECT:2e3,NOT_SELECT:500},[A0,to]=O.useState(""),di=window.devicePixelRatio,[j1,fi]=O.useState(window.innerWidth<768*di),[m3,e0]=O.useState(window.innerWidth<1200*di),Ar=O.useRef(null),hi=O.useRef(null),[G5,gi]=O.useState(!1);O.useEffect(()=>{const be=()=>{fi(window.innerWidth<768*di),e0(window.innerWidth<1200*di)};return window.addEventListener("resize",be),()=>window.removeEventListener("resize",be)},[]),O.useEffect(()=>{G5&&ha()},[G5,at,yt]),O.useEffect(()=>{if(!c2){hi.current=null,gi(!1);return}const be=new window.Image;be.onload=()=>{hi.current=be,gi(!0)},be.src=c2},[c2]),O.useEffect(()=>(ht(nt),vi(),()=>{$r&&clearTimeout($r)}),[Vn]),O.useEffect(()=>{v||document.fullscreenElement||ki.getItem("full_screen")=="yes"&&d2(!1),window.addEventListener("resize",Ir)},[]),O.useEffect(()=>{console.log("Change"),Rt([]),ia(),setTimeout(()=>{ht()},50)},[c]),O.useEffect(()=>{A&&ht(nt)},[A]),O.useEffect(()=>{i&&(i==null?void 0:i.length)>0&&r0()},[i]),O.useEffect(()=>{Hr(_e||null)},[_e,i]),O.useEffect(()=>{if(e){const be=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1));br(be)}Rt([])},[e]),O.useEffect(()=>{c2&&(_t.current=c2,D1())},[c2]),O.useEffect(()=>{_t.current&&Ir()},[_t.current,c2]),O.useEffect(()=>{x=="SAM"?R1(!0):R1(!1),Y5()},[x]),O.useEffect(()=>{at.scale==1&&(at.x!=0||at.y!=0)&&r0()},[at.scale]),O.useEffect(()=>{if(((bn==null?void 0:bn.result)||[]).length>=0){const{x:be,y:Ce}=kn.getMousePos(Ye.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});D1(nt,{x:be,y:Ce})}},[yt,t,at.scale,Vn]),O.useEffect(()=>{ia(),((bn==null?void 0:bn.result)||[]).length>=0&&ht()},[r1,Pt]),O.useEffect(()=>{if(ge&&bn&&(bn!=null&&bn.result)&&((bn==null?void 0:bn.result)||[]).length>=0){ht(nt);const be={},Ce={};for(let Me=0;Me<bn.result.length;Me++)be[bn.result[Me].awi_id]={...bn.result[Me],index:Me},(ge==null?void 0:ge.awi_annotation_type)=="polygon"&&(Ce[bn.result[Me].awi_id]=kn.getBoundingBoxValues(bn.result[Me].awi_coords));i9(be),(ge==null?void 0:ge.awi_annotation_type)=="polygon"&&I1(Ce),(ge==null?void 0:ge.awi_request_for)=="attributes"&&bn.result.length>0&&u=="-1"&&typeof d=="function"&&setTimeout(()=>{d(bn.result[0].awi_id)},100)}else i9(null),I1(null);v3()},[ge,bn]),O.useEffect(()=>{v3()},[S]),O.useEffect(()=>{console.log("Filter annotation change"),D1(nt),setTimeout(()=>{D1(nt)},100)},[vn]),O.useEffect(()=>{u!=="-1"?typeof h=="function"&&(ge==null?void 0:ge.awi_request_for)!=="outline"&&h("edit"):w1([]),Tn&&typeof h=="function"&&un("-1"),un(u||"-1")},[u]),O.useEffect(()=>{v||y==0&&Tn!==void 0&&(Tn?V1.success("Switched to Auto Annotation mode"):ge!=null&&ge.awi_annotation_type&&V1.success(`Switched to ${ge==null?void 0:ge.awi_annotation_type} Annotation mode`))},[Tn]),O.useEffect(()=>{if(!M||typeof M!="function")return;Ai();const be=setTimeout(()=>{const{x:Ce,y:Me}=kn.getMousePosAbsolute(Ye.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});M({x:Ce,y:Me})},30);return()=>clearTimeout(be)},[Ut]),O.useEffect(()=>{u1?Ai():yi(-1,-1)},[u1]),O.useEffect(()=>{u!="-1"&&eo&&ir(eo[u])},[u,eo]),O.useEffect(()=>{pi(),Ai()},[at,yt]);const El=be=>{const Ce=be.message;to(Ce)};O.useEffect(()=>{let be="";U?be="Creating Annotation...":ee?be="Deleting Annotation...":Y?be="Updating Annotation...":Oe?be="Fetching Annotations...":rn&&(be="Generating AI Annotations..."),El({message:be})},[U,Y,ee,Oe,rn]),O.useEffect(()=>{Ir()},[K]);const Ci=pe&&typeof pe=="function"?qv(pe):null,mi=Se&&typeof Se=="function"?qv(Se):null,Br=()=>!!(dt||ze()),ar=()=>!!(ft||Ge()),pi=()=>{const be=yt.width*at.scale,Ce=yt.height*at.scale;K5({left:Math.abs(at.x),right:Math.max(0,be-yt.width+at.x),top:Math.abs(at.y),bottom:Math.max(0,Ce-yt.height+at.y)})},oa=O.useMemo(()=>{const be=(bn==null?void 0:bn.result)||[];if(be.length>0&&Pt!=="-1"){let Ce=null,Me=null;const Re=be.reduce((Pe,ut)=>{const{awi_id:wt}=ut;return wt===Pt?Ce=ut:wt===Vn?Me=ut:S.has(wt)||Pe.push(ut),Pe},[]);return Me&&Re.push(Me),Ce&&Re.push(Ce),Re}else return vn},[Pt,Vn,vn]),br=async be=>{Hv.checkImageValidity(be,d0,i,Ve,Qe)},ia=()=>{Vn!="-1"&&($r&&clearTimeout($r),T1("-1"))},vi=()=>{if(Vn!=="-1")if(Pt=="-1"||B1.HOVER_TO_SELECT_ON_ALREADY_SELECTED){const be=Pt=="-1"?Q5.NOT_SELECT:Q5.SELECT;$r&&clearTimeout($r);const Ce=setTimeout(()=>{c&&Vn!="-1"&&Pt!=Vn&&(Pt=="-1"&&mn?vi():typeof d=="function"&&(d(Vn),V1.success("Annotation selected successfully",Vn)))},be);s9(Ce)}else $r&&clearTimeout($r);else $r&&clearTimeout($r)},Ai=()=>{const be=Et.current;if(!be)return;const Ce=yt.width*at.scale,Me=yt.height*at.scale;if(be.width=Ce,be.height=Me,u1){const{x:Re,y:Pe}=kn.getMousePosAbsolute(Et.current,{clientX:Ut==null?void 0:Ut.x,clientY:Ut==null?void 0:Ut.y});yi(Re,Pe)}},kr=()=>{Rt([])},bi=(be=!1)=>{zt.invalidateQueries(Ie),be&&Rt([])},Or=be=>{var Ce;if(eo&&eo[be])if(c){const Me=eo[be].index,Re=bn==null?void 0:bn.result[Me];return Re||((Ce=bn==null?void 0:bn.result)==null?void 0:Ce.find(Pe=>Pe.awi_id==be))}else return eo[be];else return null},p3=be=>g3&&g3[be]?g3[be].index:-1,Y5=()=>{nt.length>0&&(console.log("clearCoordinate"),Rt([]),D1([],{x:0,y:0},!0))},v3=()=>{if(ge&&((bn==null?void 0:bn.result)||[]).length>=0){let be=[];(S==null?void 0:S.size)>0?be=((bn==null?void 0:bn.result)||[]).filter(Me=>!S.has(Me.awi_id)):be=(bn==null?void 0:bn.result)||[];const Ce={};for(let Me=0;Me<be.length;Me++)Ce[be[Me].awi_id]={...be[Me],index:Me};C3(Ce),hn(be)}else hn([])},n1=be=>(j1&&(be=be*3),kn.zoomLevelValue(be,at.scale)),Wr=new Map,aa=be=>{try{if(!be)return Promise.resolve(B1.DEFAULT_CANVAS_RATION);if(Wr.has(be))return Wr.get(be);const Ce=new Promise((Me,Re)=>{const Pe=new Image;Pe.onload=()=>{const wt={w:Pe.width,h:Pe.height};Wr.set(be,Promise.resolve(wt)),Me(wt)},Pe.onerror=Re;const ut=tt.getImageKitUrl(be,-1,-1,1);ut&&(Pe.src=ut)});return Wr.set(be,Ce),Ce}catch(Ce){return console.error(Ce),Promise.resolve(B1.DEFAULT_CANVAS_RATION)}},Ir=async()=>{var be,Ce,Me,Re,Pe;if(console.log("updateDimensions called"),((be=_t.current)==null?void 0:be.length)>0){console.log("Canvas true");let ut=B1.DEFAULT_CANVAS_RATION;a9(!0);try{ut=await aa(_t.current)}catch(Wt){console.error("Error fetching image dimensions:",Wt,_t.current),ut=B1.DEFAULT_CANVAS_RATION}const wt=kn.gcd(ut.w,ut.h),Jt={w:ut.w/wt,h:ut.h/wt};let gn=0,gt=0;if(gt=((Ce=Ot.current)==null?void 0:Ce.offsetHeight)||0,gn=gt*Jt.w/Jt.h,gn>(((Me=Ot.current)==null?void 0:Me.offsetWidth)||0)&&(gn=((Re=Ot.current)==null?void 0:Re.offsetWidth)||0,gt=gn*Jt.h/Jt.w),(Ye==null?void 0:Ye.current)!=null&&(Ye.current.width=gn,Ye.current.height=gt,vr==null)){const Wt=(Pe=Ye.current)==null?void 0:Pe.getBoundingClientRect();Lr({left:Wt==null?void 0:Wt.left,top:Wt==null?void 0:Wt.top})}Dt({width:gn,height:gt}),a9(!1),D1(nt)}},no=O.useCallback((be,Ce,Me,Re,Pe,ut)=>kn.checkPointInsidePolygon(be,Ce,Me,Re,Pe,ut,at.scale),[]),D2=(be,Ce=!0)=>{const{x:Me,y:Re}=kn.getMousePos(Ye.current,be);let Pe="",ut=1/0;if(c&&_i(Me,Re))return[Pt];const wt=vn||[];if(!Ce&&(wt==null?void 0:wt.length)>B1.MAX_ANNOTATIONS_TO_HOVER)return[];switch(ge==null?void 0:ge.awi_annotation_type){case"circle":{wt.forEach(({awi_coords:Jt,awi_id:gn})=>{if(no(Me,Re,Jt,0,0,ge)){const gt=kn.minDistanceToPolygon({x:Me,y:Re},Jt);gt<ut&&(Pe=gn,ut=gt)}});break}case"dot":{const Jt=n1(An);wt.forEach(({awi_coords:gn,awi_id:gt})=>{if(no(Me,Re,gn,Jt,Jt,ge)){const Wt=kn.minDistanceToPolygon({x:Me,y:Re},gn);Wt<ut&&(Pe=gt,ut=Wt)}});break}case"rectangle":{const Jt=n1(Qt)/2;for(let gn=0;gn<wt.length;gn++){const{awi_coords:gt,awi_id:Wt}=wt[gn];if(no(Me,Re,gt,Jt,0,ge)){const E1=kn.minDistanceToPolygon({x:Me,y:Re},gt);E1<ut&&(Pe=Wt,ut=E1)}}break}case"polygon":{for(let Jt=0;Jt<wt.length;Jt++){const{awi_coords:gn,awi_id:gt}=wt[Jt];if(In){const Wt=In[gt];if(Wt){const{minX:E1,minY:ce,maxX:C0,maxY:F0}=Wt;if(Me<E1||Me>C0||Re<ce||Re>F0)continue}}if(no(Me,Re,gn,0,0,ge)){const Wt=kn.minDistanceToPolygon({x:Me,y:Re},gn);Wt<ut&&(Pe=gt,ut=Wt)}}break}default:console.warn(`Unknown annotation type: ${ge==null?void 0:ge.awi_annotation_type}`);break}return Pe&&Pe.length>0?(Ce&&un(Pe),[Pe]):(Ce&&(console.log("setSelectAnnotationId "),typeof d=="function"&&u!="-1"&&d("-1",!1)),[])},Sl=L4.throttle(D2,50),_i=(be,Ce)=>{const Me=Or(u);if(Me){const Re=Me.awi_coords;if((ge==null?void 0:ge.awi_annotation_type)=="polygon"){const Pe=kn.minDistanceToPolygon({x:be,y:Ce},Re),ut=n1(kt);return Pe<=ut}else if((ge==null?void 0:ge.awi_annotation_type)=="rectangle"){const{insertIndex:Pe,minDistance:ut}=kn.closestCoordinates({x:be,y:Ce},Re),wt=n1(kt);return console.log(Pe),ut<=wt}}else return!1},q5=(be,Ce)=>{const{x:Me,y:Re}=kn.getMousePos(Ye.current,be),Pe=Or(Ce);if(console.log("selectAnnotation",Pe),Pe){const{awi_coords:ut}=Pe;if(ut.length===1){const gt=n1(Yt);no(Me,Re,ut,gt,gt,ge)&&(Tt(!0),$t(!0),l1({x:Me,y:Re}),Rt(ut));return}if(ut.length===2){const{x:gt,y:Wt}=ut[0],{x:E1,y:ce}=ut[1],C0=kn.getDiameter([{x:gt,y:Wt},{x:E1,y:ce}])/2,F0=(gt+E1)/2,p1=(Wt+ce)/2;Tt(!0),$t(!0),l1({x:Me,y:Re}),Kn({x:Me,y:Re}),Rt(ut);const an=(Me-F0)*(Me-F0)+(Re-p1)*(Re-p1),L0=n1(_n);an>L0*L0*C0*C0&&$t(!1);return}const wt=Br()?0:n1(Kt),Jt=no(Me,Re,ut,wt,0,ge),gn=_i(Me,Re);if(!Jt&&!gn)Kn({x:-1,y:-1}),l1({x:0,y:0}),$t(!1);else{if(l1({x:Me,y:Re}),Tt(!0),(ge==null?void 0:ge.awi_annotation_type)=="polygon")if(Br())$t(!0);else if(no(Me,Re,ut,wt,0,ge)){const{minDistance:Wt}=kn.findClosestSegment(ut,Me,Re),E1=n1(xt);Wt>=E1?$t(!0):$t(!1)}else $t(!1);else $t(!0);Rt(ut),Kn({x:-1,y:-1}),Br()||ut.forEach((gt,Wt)=>{if(Me<=gt.x+wt&&Me>=gt.x&&Re<=gt.y+wt&&Re>=gt.y||Me>=gt.x-wt&&Me<=gt.x&&Re>=gt.y-wt&&Re<=gt.y||Me<=gt.x+wt&&Me>=gt.x&&Re>=gt.y-wt&&Re<=gt.y||Me>=gt.x-wt&&Me<=gt.x&&Re<=gt.y+wt&&Re>=gt.y){if((ge==null?void 0:ge.awi_annotation_type)==="polygon")c?(Kn({x:Me,y:Re}),Q1(Wt)):(Q1(Wt),Kn(ut[Wt])),console.log("setSelectCornerCoordinates");else if((ge==null?void 0:ge.awi_annotation_type)==="rectangle"&&!Tn){const E1=ut[(Wt+2)%4];Kn(E1)}else if(c){const E1=ut[(Wt+2)%4];Kn(E1)}else Q1(Wt),Kn(ut[Wt]);$t(!1),Rt([])}})}}},sa=(be="all")=>{const Ce=window.devicePixelRatio;if(be!="cross"&&Ye.current)if(at.scale==1){const Me=+getComputedStyle(Ye.current).getPropertyValue("height").slice(0,-2),Re=+getComputedStyle(Ye.current).getPropertyValue("width").slice(0,-2);Ye.current.setAttribute("height",(Me*Ce).toString()),Ye.current.setAttribute("width",(Re*Ce).toString())}else{const Me=yt.height*at.scale,Re=yt.width*at.scale;Ye.current.setAttribute("height",(Me*Ce).toString()),Ye.current.setAttribute("width",(Re*Ce).toString())}if(Et.current)if(at.scale==1){const Me=+getComputedStyle(Et.current).getPropertyValue("height").slice(0,-2),Re=+getComputedStyle(Et.current).getPropertyValue("width").slice(0,-2);Et.current.setAttribute("height",(Me*Ce).toString()),Et.current.setAttribute("width",(Re*Ce).toString())}else{const Me=yt.height*at.scale,Re=yt.width*at.scale;Et.current.setAttribute("height",(Me*Ce).toString()),Et.current.setAttribute("width",(Re*Ce).toString())}},ko=(be,Ce)=>{const Me=kn.getDistance(be.x,be.y,Ce.x,Ce.y),Re=n1(Kt),Pe=n1(Nn);if(Me<=Pe){let ut=!1;return Me<=Re?ut=!1:Me<=Pe&&(ut=!0),{success:!0,distance:Me,zoomClosePoint:Re,zoomPointAnnotationValue:Pe,isExtraPointNeeded:ut}}else return{success:!1,distance:Me,zoomClosePoint:Re,zoomPointAnnotationValue:Pe,isExtraPointNeeded:!1}},ro=(be=[],Ce={x:0,y:0},Me=!1,Re=!1,Pe)=>{if((be||[]).length>0){Pe.beginPath();const ut=Dr(be);if((ge==null?void 0:ge.awi_annotation_type)==="rectangle")if(Tn){if(c){Pe.moveTo(ut[0].x,ut[0].y);for(let wt=1;wt<ut.length;wt++)Pe.lineTo(ut[wt].x,ut[wt].y);Pe.closePath()}else if(Tn){console.log("Sam function");const wt=Dr(be);Pe.clearRect(0,0,Pe.canvas.width,Pe.canvas.height),Pe.fillStyle="rgba(0, 0, 0, 0.35)",Pe.strokeStyle=Zt,Pe.lineWidth=$e.DEFAULT,wt.forEach(Jt=>{Pe.beginPath(),Pe.arc(Jt.x,Jt.y,it,0,B1.TWO_PIE,!0),Pe.fill(),Pe.stroke()})}}else{Pe.moveTo(ut[0].x,ut[0].y);for(let wt=1;wt<ut.length;wt++)Pe.lineTo(ut[wt].x,ut[wt].y);Pe.closePath()}else if((ge==null?void 0:ge.awi_annotation_type)==="circle")if(Tn&&!c){const wt=Dr(be);console.log("coordinatesVal ",wt),Pe.clearRect(0,0,Pe.canvas.width,Pe.canvas.height),Pe.fillStyle="rgba(0, 0, 0, 0.35)",Pe.strokeStyle=Zt,Pe.lineWidth=$e.DEFAULT,wt.forEach(Jt=>{Pe.beginPath(),Pe.arc(Jt.x,Jt.y,it,0,B1.TWO_PIE,!0),Pe.fill(),Pe.stroke()})}else{const wt=kn.getDiameter(ut);Pe.arc((ut[0].x+ut[1].x)/2,(ut[0].y+ut[1].y)/2,Math.floor(wt/2),0,B1.TWO_PIE)}Pe.save(),Pe.lineWidth=$e.DEFAULT,Pe.strokeStyle=Zt,Pe.stroke()}if((ge==null?void 0:ge.awi_annotation_type)==="polygon"&&(nt||[]).length>0&&!Me&&!c){if(!Tn){const ut=Dr(nt);if(Pe.beginPath(),Pe.lineWidth=$e.DEFAULT,Pe.strokeStyle=Zt,ut.forEach((wt,Jt)=>{if(Jt>0){const gn=ut[Jt-1];Pe.moveTo(gn.x,gn.y),Pe.lineTo(wt.x,wt.y)}}),Pe.stroke(),ut.forEach((wt,Jt)=>{Pe.beginPath(),Pe.arc(wt.x,wt.y,it,0,B1.TWO_PIE,!0),Pe.fillStyle=Jt===0?mt:Zt,Pe.fill()}),!ar()&&!Re&&Ce&&Ce.x>0&&Ce.y>0&&!(Ce.x>.998||Ce.y>.998||Ce.x<.002||Ce.y<.002)){const wt=Dr([Ce]);Pe.beginPath();const Jt=ko(nt[0],Ce);Jt!=null&&Jt.success&&(nt==null?void 0:nt.length)>2?Jt.isExtraPointNeeded?(Pe.beginPath(),Pe.rect(wt[0].x-Ae*3,wt[0].y-Ae*3,Ae*6,Ae*6),Pe.fillStyle=pt,Pe.fill(),Pe.lineWidth=4,Pe.strokeStyle=pt,Pe.stroke()):(Pe.beginPath(),Pe.rect(wt[0].x-Ae*3,wt[0].y-Ae*3,Ae*6,Ae*6),Pe.fillStyle=mt,Pe.fill(),Pe.lineWidth=2,Pe.strokeStyle=mt,Pe.stroke()):Pe.arc(wt[0].x,wt[0].y,Ae,0,B1.TWO_PIE,!0),Pe.fillStyle="rgba(0,0,0,0.35)",Pe.fill(),Pe.strokeStyle=Zt,Pe.stroke();const gn=ut[ut.length-1];Pe.beginPath(),Pe.moveTo(gn.x,gn.y),Pe.lineTo(wt[0].x,wt[0].y),Pe.strokeStyle="#ff0000",Pe.setLineDash([5,5]),Pe.lineWidth=$e.DEFAULT,Pe.stroke(),Pe.setLineDash([])}Pe.closePath(),Pe.lineWidth=$e.DEFAULT,Pe.stroke(),Pe.save()}if(Tn){const ut=Dr(be);Pe.clearRect(0,0,Pe.canvas.width,Pe.canvas.height),Pe.fillStyle="rgba(0, 0, 0, 0.35)",Pe.strokeStyle=Zt,Pe.lineWidth=$e.DEFAULT,ut.forEach(wt=>{Pe.beginPath(),Pe.arc(wt.x,wt.y,it,0,B1.TWO_PIE,!0),Pe.fill(),Pe.stroke()})}}},yi=(be,Ce)=>{const Me=Et.current;if(!Me)return;const Re=Me.getContext("2d");if(!Re||(Re.clearRect(0,0,Me.width,Me.height),be==-1&&Ce==-1))return;sa("cross");const Pe=Dr([{x:be,y:Ce}])[0],ut=Pe.x,wt=Pe.y;Re.strokeStyle="#800080",Re.lineWidth=$e.CAROUSAL,Re.setLineDash([3,3]),Re.beginPath(),Re.moveTo(ut,0),Re.lineTo(ut,Me.height),Re.stroke(),Re.beginPath(),Re.moveTo(0,wt),Re.lineTo(Me.width,wt),Re.stroke(),Re.setLineDash([])},D1=(be=[],Ce={x:0,y:0},Me=!1,Re=!1,Pe=0)=>{var ut,wt,Jt,gn;if(ge&&!ui){const gt=(ut=Ye.current)==null?void 0:ut.getContext("2d");if(sa(),gt!=null){gt.imageSmoothingEnabled=!1,gt.clearRect(0,0,yt.width,yt.height),!c&&(ge==null?void 0:ge.awi_request_for)!="attributes"&&ro(be,Ce,Me,Re,gt);const Wt=oa||[];for(let E1=0;E1<Wt.length;E1++){const ce=Wt[E1],{awi_coords:C0,awi_id:F0,awi_status:p1}=ce;if(C0.length===0)return;const an=Dr(C0);gt.beginPath(),gt.lineJoin="round";let L0=!1,cr="",Gr="";if(g==="all"||p1===g){ce.awi_status==="pending"?cr=ce.awi_outline_status==="approved"?"rgba(214, 204, 60, 0.3)":"rgba(0, 0, 0,0)":cr=B1.STATUS_COLOR_MAP[ce.awi_status]||"rgba(0, 0, 0,0)",Gr=cr;let lo=!1;if(F0===Pt?(gt.lineWidth=$e.SELECTED,gt.strokeStyle=Zt,gt.fillStyle="rgba(0,0,0,0.40)",lo=!0):F0===Vn&&(gt.lineWidth=$e.DEFAULT,gt.strokeStyle=Lt,gt.fillStyle=Xe,lo=!0),!lo)if(gt.fillStyle=cr,v?gt.lineWidth=$e.CAROUSAL:gt.lineWidth=$e.DEFAULT,A){const ur=A[ce.awi_classes[0].awi_id];ur?(Gr=ur,gt.strokeStyle=ur):(Gr=ce.awi_classes[0].awi_color,gt.strokeStyle=ce.awi_classes[0].awi_color)}else Gr=ce.awi_classes[0].awi_color,gt.strokeStyle=ce.awi_classes[0].awi_color;switch(ge==null?void 0:ge.awi_annotation_type){case"circle":{const ur=(an[0].x+an[1].x)/2,Mi=(an[0].y+an[1].y)/2,t4=Math.sqrt(Math.pow(an[1].x-an[0].x,2)+Math.pow(an[1].y-an[0].y,2));gt.beginPath(),gt.arc(ur,Mi,t4/2,0,B1.TWO_PIE),gt.stroke(),gt.closePath(),L0=!0;break}case"dot":{gt.beginPath(),gt.moveTo(an[0].x,an[0].y),gt.arc(an[0].x,an[0].y,Ae,0,B1.TWO_PIE,!0),gt.stroke(),gt.closePath(),L0=!0;break}case"rectangle":{gt.beginPath(),gt.moveTo((wt=an[0])==null?void 0:wt.x,(Jt=an[0])==null?void 0:Jt.y);for(let ur=1;ur<an.length;ur++)gt.lineTo(an[ur].x,an[ur].y);gt.closePath(),gt.stroke(),L0=!0;break}case"polygon":{L0=!0,gt.moveTo(an[0].x,an[0].y);const ur=an.length;for(let Mi=0;Mi<ur;Mi++)gt.lineTo(an[Mi].x,an[Mi].y);break}}if(gt.fill(),gt.save(),gt.stroke(),L0){gt.save();const ur=F0===Pt,Mi=F0===Vn,t4=ce.sam_status==="yes";an.forEach((fu,Hl)=>{gt.beginPath();let Pr=Ae,co="";ur?an.length==1&&(ge==null?void 0:ge.awi_annotation_type)=="dot"||Re&&Hl%(an.length-1)==Pe?(Pr=Ae*2,co=Zt):(co=Zt,Pr=Ae):Mi?(co=Lt,Pr=Ae):(co=Gr,Pr=Ae),(ge==null?void 0:ge.awi_annotation_type)==="polygon"?Hl%(an.length-1)==0&&(t4?co=Vt:co=mt):Hl==0&&an.length>1&&t4&&(co=Vt),gt.arc(fu.x,fu.y,Pr,0,2*Math.PI,!0),gt.fillStyle=co,gt.strokeStyle=co,gt.fill(),gt.stroke(),gt.restore()})}else console.log("Error")}}}Ai()}if(at.scale==1&&(Ye!=null&&Ye.current)){const gt=(gn=Ye==null?void 0:Ye.current)==null?void 0:gn.getBoundingClientRect();Lr({top:gt==null?void 0:gt.top,left:gt==null?void 0:gt.left})}},Dr=be=>be.map(Me=>({x:Me.x*Ye.current.width,y:Me.y*Ye.current.height})),oo=be=>{const{x:Ce,y:Me}=kn.getMousePos(Ye.current,be);Rt(Re=>{const Pe=[...Re];return Pe[1].x=Ce,Pe[1].y=Me,kn.adjustToCircle(Pe)})},f0=be=>{if(be.length===0)return!1;const Ce=kn.isAnnotationCoordinatesValid(ge,be,Tn,at.scale);return Ce||D1(),Ce},X5=(be,Ce)=>(console.log("Has Moved checking"),Math.abs(be.x-Ce.x)>0||Math.abs(be.y-Ce.y)>0),Oo=()=>{if((nt==null?void 0:nt.length)>1){const be=nt[nt.length-1],Ce=[];let Me=!1;for(let Re=0;Re<nt.length-1;Re++){const Pe=nt[Re],ut=n1(Yt);if(Math.abs(be.x-Pe.x)<=ut&&Math.abs(be.y-Pe.y)<=ut){Me=!0;continue}else Ce.push({x:Pe.x,y:Pe.y})}return Me||Ce.push(nt[nt.length-1]),Rt(Ce),Ce}else return nt},J5=()=>{if(typeof n=="function")if(nt.length>3){const be=ko(nt[0],nt[nt.length-1]);let Ce=[];be.success&&(be.isExtraPointNeeded==!1?(nt[nt.length-1].x=nt[0].x,nt[nt.length-1].y=nt[0].y,Ce=nt):be.isExtraPointNeeded&&(Ce=[...nt,{x:nt[0].x,y:nt[0].y}])),(Ce==null?void 0:Ce.length)>0?(Rt([]),n(Ce,null,!1,()=>{kr()})):D1(nt)}else D1(nt)},X0=(be,Ce)=>{console.log("deletePolygonPoint"),console.log("selectIndex ",Ce);const Me=[];for(let Re=0;Re<be.length;Re++)Re!=Ce&&Me.push(be[Re]);Ce==0&&(Me[Me.length-1]=Me[0]),Rt(Me),(Me==null?void 0:Me.length)>3?(D1(Me),typeof o=="function"&&f0(Me)&&!p&&(V1.success("Point deleted successfully"),o(Me,u,()=>{kr()}))):V1.error("Point can not be deleted, as polygon need minimum of three points"),ci(-1),o9(null)};function sr(be,Ce){console.log("handleAddAnnotationPoint");const Me=be.target;if(!(Me!=null&&Me.getBoundingClientRect))return;const Re=Me.getBoundingClientRect(),Pe=(be.clientX-Re.left)/Re.width,ut=(be.clientY-Re.top)/Re.height,{insertIndex:wt,minDistance:Jt}=kn.closestCoordinates({x:Pe,y:ut},Ce),gn=n1(Kt);if(Jt<gn){console.log("Very close point to insert"),console.log("minDistanceMin",Jt);const ce=n1(sn);if(Jt<ce&&Br())console.log("We can remove this"),(Ce==null?void 0:Ce.length)>3&&(o9(Ce),B1.POLYGON_POINT_REMOVE_CONFIRM_PROMPT?ci(wt):X0(Ce,wt));else{if(Jt<ce)V1.error("Press CTRL and then click to prompt for point deletion");else{const C0=(Jt*100).toFixed(1);V1.error("Very close point to draw "+C0+" it should be more than "+Kt*100)}ci(-1),o9(null)}return}if(Br())return;ci(-1),o9(null);const{insertIndex:gt,minDistance:Wt}=kn.findClosestSegment(Ce,Pe,ut),E1=n1(xt);Wt>=E1||(Ce.splice(gt,0,{x:Pe,y:ut}),Rt(Ce),D1(Ce),typeof o=="function"&&f0(nt)&&!p&&o(nt,u,()=>{kr()}))}const wi=be=>{M&&typeof M<"u"&&typeof M=="function"&&(M({x:-1,y:-1}),yi(-1,-1)),ca(be,!0),Vn!="-1"?ia():(ge==null?void 0:ge.awi_annotation_type)=="polygon"&&!c&&!v&&!Tn&&nt.length>0&&setTimeout(()=>{D1(nt)},200)},la=be=>{if(!Tn){if((mn||bt&&e1.x!==-1&&e1.y!==-1)&&X5(O1,kn.getMousePos(Ye.current,be))){const Ce=Or(u);if(Ce){const Me=f0(Ce.awi_coords);if(typeof o=="function"&&Me)if(e1.x!==-1&&e1.y!==-1)if((ge==null?void 0:ge.awi_annotation_type)=="polygon")o(Ce.awi_coords,Pt);else{const Re=kn.getUpdatedCoordinates(Ye,be,e1);o(Re,Pt)}else o(Ce.awi_coords,Pt);else Me||((ge==null?void 0:ge.awi_annotation_type)=="polygon"&&Kr(Ce.awi_coords,be),bi(!0))}}Mn?(At(!1),typeof n=="function"&&f0(nt)&&((ge==null?void 0:ge.awi_annotation_type)==="polygon"?J5():n(nt,null,!1,()=>{kr()}))):bt&&(Tt(!1),un("-1"),w1([]),typeof d=="function"&&d("-1"))}},l9=be=>{if(!(Ye!=null&&Ye.current))return;const Ce=Sl(be,!1);(Ce==null?void 0:Ce.length)>0&&Ce[0]!=Pt?(vi(),T1(Ce[0]),Ye.current.style.cursor="pointer"):Vn!="-1"&&(T1("-1"),Pt=="-1"&&(Ye.current.style.cursor="default"))},A3=(be,Ce=!1)=>{if(Ce){ht(nt);return}const{x:Me,y:Re}=kn.getMousePos(Ye.current,be),Pe=Or(u);if(Pe){const ut=Pe.awi_coords,{minDistance:wt,insertIndex:Jt}=kn.closestCoordinates({x:Me,y:Re},ut),gn=n1(Qt);if(wt<=gn&&Ye.current){const gt=Ye.current.getContext("2d");if(!gt||Jt==fn)return;Ye.current.style.cursor="pointer",wn(Jt),Ye.current.title="Point "+(Jt+1);const Wt=Dr([ut[Jt]])[0];gt.fillStyle=Cn,gt.beginPath(),gt.arc(Wt.x,Wt.y,Ae*2.5,0,B1.TWO_PIE),gt.strokeStyle="black",gt.lineWidth=$e.SELECTED,gt.stroke(),gt.fill()}else if(Ye.current){if(!Ye.current.getContext("2d"))return;const Wt=n1(Ht);fn!==-1&&(ht(),wn(-1)),(ge==null?void 0:ge.awi_annotation_type)=="polygon"&&kn.findClosestSegment(ut,Me,Re).minDistance<=Wt?(Ye.current.style.cursor="pointer",Ye.current.title="Add point"):(Ye.current.style.cursor="default",Ye.current.title="")}}},ca=p2.useThrottle(A3,100),xi=p2.useThrottle(l9,100),Kr=(be,Ce)=>{if(kn.breakPointCount(be)>0){console.log("================================BREAK================================"),$t(!1),Ce&&Ce.stopPropagation&&(Ce==null||Ce.stopPropagation());const Re=kn.shiftPolygon(be);if(typeof o=="function"&&f0(Re)){const Pe=u;o(Re,u,()=>{Pt!=Pe&&un(Pe),kr()})}}},Ze=()=>vn.length>B1.MAX_ANNOTATIONS_TO_RUN_FAST?ht:D1,ht=p2.useThrottle((be,Ce,Me=!1,Re=!1,Pe=-1)=>{D1(be,Ce,Me,Re,Pe)},50),st=(be="forward")=>{if((vn||[]).length!=0)if(be=="last_update"){const Ce=vn==null?void 0:vn.reduce((Me,Re)=>{const Pe=new Date(Me.awi_last_updation).getTime();return new Date(Re.awi_last_updation).getTime()>Pe?Re:Me});Ce&&(un(Ce.awi_id),typeof d=="function"&&d(Ce.awi_id))}else if(u==="-1")(vn||[]).length>0&&(un(vn[0].awi_id),typeof d=="function"&&d(vn[0].awi_id));else{const Ce=p3(u);be=="backward"?Ce!==-1?Ce>0?(un(vn[Ce-1].awi_id),typeof d=="function"&&d(vn[Ce-1].awi_id)):(un(vn[vn.length-1].awi_id),typeof d=="function"&&d(vn[vn.length-1].awi_id)):(vn||[]).length>0&&(un(vn[vn.length-1].awi_id),typeof d=="function"&&d(vn[vn.length-1].awi_id)):Ce!==-1?(vn||[]).length>Ce+1?(un((vn||[])[Ce+1].awi_id),typeof d=="function"&&d((vn||[])[Ce+1].awi_id)):(un((vn||[])[0].awi_id),typeof d=="function"&&d((vn||[])[0].awi_id)):(vn||[]).length>0&&(un(vn[0].awi_id),typeof d=="function"&&d(vn[0].awi_id))}},ln=()=>{if(console.log("handleCompleteAnnotation"),!(!ge||c))if(x==="SAM"){No();return}else{if((ge==null?void 0:ge.awi_annotation_type)!="polygon")return;if(typeof n=="function"&&f0(nt))if((nt==null?void 0:nt.length)>2){const be=[...nt,{x:nt[0].x,y:nt[0].y}];Rt([]),n(be,null,!1,()=>{kr()})}else{V1.error("Polygon requires minimum of three coordinates");return}else V1.error("Invalid coordinates, please create valid coordinates")}},$n=be=>{console.log("handle Complete Multiple Annotation SAM");const Ce=[];for(let Me=0;Me<(be==null?void 0:be.length);Me++){const Re=be[Me].outline,Pe=be[Me].classId;if(f0(Re)){const wt={coords:(ge==null?void 0:ge.awi_annotation_type)=="polygon"?kn.createPolygonLoop(Re):Re,classId:Pe,isSam:!0};Ce.push(wt)}}(Ce==null?void 0:Ce.length)>0&&typeof r=="function"&&(Rt([]),r(Ce,()=>{(Ce==null?void 0:Ce.length)>0&&bi()}))},m1=()=>{if(console.log("undoAnnotationPoint"),console.log("coordinates ------>",nt),u!="-1"){u9();return}if(nt.length>0&&(ge==null?void 0:ge.awi_annotation_type)==="polygon")nt.pop(),Rt([...nt]),D1(nt);else if(nt.length>0&&Tn)nt.pop(),Rt([...nt]),D1(nt);else return},r0=()=>{pn(Ft)},P1=(be,Ce="zoom-in")=>{if(Ye.current&&Ye)if(Ce=="zoom-in"){const Me=qt,Re=at.scale+Me,Pe=Ye.current.getBoundingClientRect(),ut=be.clientX-Pe.left,wt=be.clientY-Pe.top,Jt=Re/at.scale,gn=at.x-ut*(Jt-1),gt=at.y-wt*(Jt-1),Wt={scale:+Re.toFixed(2),x:gn,y:gt};pn(Wt),W5({x:be.clientX,y:be.clientY})}else{const Me=qt,Re=at.scale-Me;if(Re==1)r0();else{const Pe=Ye.current.getBoundingClientRect();(y0.x==-1||y0.y==-1)&&console.log("zoomTimeMousePoint");const ut=y0.x!=-1?y0.x:be.clientX,wt=y0.y!=-1?y0.y:be.clientY,Jt=ut-Pe.left,gn=wt-Pe.top,gt=Re/at.scale,Wt=-Math.abs(at.x+Jt*(1-gt)),E1=-Math.abs(at.y+gn*(1-gt)),ce=yt.width*(at.scale+qt-1),C0=yt.height*(at.scale+qt-1),{newXTransform:F0,newYTransform:p1}=kn.transformCoordinatesCheck(Wt,E1,ce,C0),an={scale:+Re.toFixed(2),x:F0,y:p1};pn(an)}}},Io=(be=null)=>{if(at.scale!==Qn&&Ye.current)if(!be||!be.clientX||!be.clientY||be.type=="click"){const Ce=yt.width*(at.scale+qt-1),Me=yt.height*(at.scale+qt-1),Re=at.x-yt.width*qt/2,Pe=at.y-yt.height*qt/2,{newXTransform:ut,newYTransform:wt}=kn.transformCoordinatesCheck(Re,Pe,Ce,Me),Jt={scale:+(at.scale+qt).toFixed(2),x:ut,y:wt};pn(Jt)}else P1(be,"zoom-in")},lr=(be=null)=>{if(at.scale!==1&&Ye.current)if(!be||!be.clientX||!be.clientY||be.type=="click"){const Ce=yt.width*(at.scale-qt-1),Me=yt.height*(at.scale-qt-1),Re=at.x+yt.width*qt/2,Pe=at.y+yt.height*qt/2,{newXTransform:ut,newYTransform:wt}=kn.transformCoordinatesCheck(Re,Pe,Ce,Me);pn({scale:+(at.scale-qt).toFixed(2),x:ut,y:wt})}else P1(be,"zoom-out")},H0=be=>{be.deltaY<0?Io(be):lr(be)},Do=()=>{const be=yt.width*(at.scale-1),Ce=yt.height*(at.scale-1),Me=at.x+Gn,Re=at.y,{newXTransform:Pe,newYTransform:ut}=kn.transformCoordinatesCheck(Me,Re,be,Ce);pn({...at,x:Pe,y:ut})},Po=()=>{const be=yt.width*(at.scale-1),Ce=yt.height*(at.scale-1),Me=at.x-Gn,Re=at.y,{newXTransform:Pe,newYTransform:ut}=kn.transformCoordinatesCheck(Me,Re,be,Ce);pn({...at,x:Pe,y:ut})},P2=()=>{const be=yt.width*(at.scale-1),Ce=yt.height*(at.scale-1),Me=at.x,Re=at.y+Gn,{newXTransform:Pe,newYTransform:ut}=kn.transformCoordinatesCheck(Me,Re,be,Ce);pn({...at,x:Pe,y:ut})},io=()=>{const be=yt.width*(at.scale-1),Ce=yt.height*(at.scale-1),Me=at.x,Re=at.y-Gn,{newXTransform:Pe,newYTransform:ut}=kn.transformCoordinatesCheck(Me,Re,be,Ce);pn({...at,x:Pe,y:ut})};if(!e||!i)return null;const No=()=>{if(rn){V1.error("Request already in progress");return}if(!(nt!=null&&nt.length)){V1.error("No points to send");return}const be={};be.image_url=e,be.coords=nt,console.log("Sent to SAM",be),ua(),typeof h=="function"&&h("annotate")},d1=()=>{if(Ur?zn(!1):Ur||zn(!0),rn){V1.error("Request already in progress");return}typeof h=="function"&&h("annotate")},Ml=be=>{console.log("Submitted data from SAMModal:",be),To(be),typeof h=="function"&&h("annotate")},To=be=>{if(!mi||!(mi!=null&&mi.mutate)){V1.error("SAM Prompt is not available");return}console.log("getSAMAnnotationsPrompt");const Ce=be.awi_annotation_prompt,Me=be.model_confidence,Re=be.model_name,Pe=be.model_max_results;R0({modelName:Re,modelConfidence:Me,modelMaxResults:Pe,promptMessage:Ce});const ut=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1)),Jt={requestId:a||0,contents:[{url:c2||ut,contentKey:i,directPrompt:Ce||""}],confidence:Me||L1,modelName:Re||a0,modelMaxResults:Pe||J2};jt(!0),mi.mutate(Jt,{onSuccess:gn=>{var gt,Wt,E1,ce,C0;if(jt(!1),!gn.success)V1.error(gn.message);else{zn(!1);const F0=((E1=(Wt=(gt=gn.data)==null?void 0:gt[0])==null?void 0:Wt.contours)==null?void 0:E1[0])??null;if(F0){const p1=F0.coordinates;if((p1==null?void 0:p1.length)==0||!((C0=(ce=p1[0])==null?void 0:ce.box)!=null&&C0.length))V1.error("No auto annotation is possible to create");else{const an=[];(ge==null?void 0:ge.awi_annotation_type)=="polygon"?(console.log("coordinates",p1),p1.forEach(L0=>{var cr;(cr=L0==null?void 0:L0.mask_polygon)==null||cr.forEach(Gr=>{const ur={outline:Gr.outline,classId:p1.classId};an.push(ur)})})):(ge==null?void 0:ge.awi_annotation_type)=="rectangle"?p1.forEach(L0=>{const cr=kn.getBoundingBox(L0.box);Rt(cr);const Gr={outline:cr,classId:p1.classId};an.push(Gr)}):(ge==null?void 0:ge.awi_annotation_type)=="circle"?p1.forEach(L0=>{const cr=kn.calculateCircleFromCoordinates(kn.getBoundingBox(L0.box));Rt(cr);const Gr={outline:cr,classId:p1.classId};an.push(Gr)}):(ge==null?void 0:ge.awi_annotation_type)=="dot"&&p1.forEach(L0=>{const cr=kn.calculateCentroid(L0.box);Rt(cr);const Gr={outline:cr,classId:p1.classId};an.push(Gr)}),$n(an),typeof E=="function"&&E("Normal")}}else V1.error("No Auto Annotation found")}},onError:gn=>{V1.exception(gn),jt(!1)}})},ua=()=>{if(!Ci||!(Ci!=null&&Ci.mutate)){V1.error("SAM is not available");return}const be=tt.generateImageUrl(tt.getImageKitUrl(e,-1,-1,-1)),Ce=c2||be,Me=p2.chunkArray(nt),Re={img_url:Ce,coords:nt,coordinates:Me};jt(!0),Ci.mutate(Re,{onSuccess:Pe=>{var ut;if(jt(!1),!Pe.success)V1.error(Pe.message);else if(console.log("this is the SAM data",Pe),((ut=Pe==null?void 0:Pe.data)==null?void 0:ut.length)>0){const wt=[];(ge==null?void 0:ge.awi_annotation_type)=="polygon"?Pe.data.forEach(Jt=>{Jt.contours.forEach(gn=>{Rt(gn.outline);const Wt={outline:gn.outline,classId:null};wt.push(Wt)})}):(ge==null?void 0:ge.awi_annotation_type)=="rectangle"?Pe.data.forEach(Jt=>{Rt(Jt.bbox),console.log("this si the bbox",Jt.bbox);const gt={outline:Jt.bbox,classId:null};wt.push(gt)}):(ge==null?void 0:ge.awi_annotation_type)=="circle"?Pe.data.forEach(Jt=>{const gn=kn.calculateCircleFromCoordinates(Jt.bbox);Rt(gn);const gt={outline:gn,classId:null};wt.push(gt)}):(ge==null?void 0:ge.awi_annotation_type)=="dot"&&Pe.data.forEach(Jt=>{const gn=kn.calculateCentroid(Jt.bbox);Rt(gn);const gt={outline:gn,classId:null};wt.push(gt)}),$n(wt)}else V1.error("No annotations found from SAM")},onError:Pe=>{V1.exception(Pe),jt(!1)}})},c9=async()=>{if(fe&&typeof fe=="function"){V1.success("Loading Annotations...");const be=await fe();console.log("cacheRemoveAnnotationResponse ",be),be!=null&&be.success?(V1.success((be==null?void 0:be.message)+" and now loading final annotations..."),bi(!0)):V1.error(be==null?void 0:be.message)}},u9=()=>{var Ce;console.log("Undo last state annotation");const be=Or(u);if(((Ce=be.past_coords)==null?void 0:Ce.length)>0){const Me=be.past_coords[be.past_coords.length-1];typeof o=="function"&&f0(Me)&&!p&&o(Me,u,()=>{kr()})}},N2=be=>{console.log("Control p"),Ye.current&&Io(be)},da=be=>{console.log("Control m"),lr(be)},Qr=()=>{const be={clientX:(Ut==null?void 0:Ut.x)||0,clientY:(Ut==null?void 0:Ut.y)||0};N2(be)},u2=()=>{const be={clientX:(Ut==null?void 0:Ut.x)||0,clientY:(Ut==null?void 0:Ut.y)||0};da(be)},e4=()=>{console.log("Copying annotations"),k&&typeof k=="function"&&k((bn==null?void 0:bn.result)||[])},d2=(be=!0)=>{try{document.fullscreenElement?(document.exitFullscreen().then(()=>{console.log("Fullscreen exited")}).catch(Ce=>{console.log(Ce)}),be&&ki.setItem("full_screen","no")):(document.documentElement.requestFullscreen().then(()=>{console.log("Fullscreen entered")}).catch(Ce=>{console.log(Ce)}),be&&ki.setItem("full_screen","yes"))}catch(Ce){console.log(Ce)}},T2=be=>{var Ce;if(!(!v&&!["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level))){if((ge==null?void 0:ge.awi_request_for)=="attributes"){const Me=D2(be)||[];console.log("This is the temp annotation",Me),Me.length>0&&(w1(Me),typeof d=="function"&&d(Me[0]),D1()),mn&&$t(!1),Tt(!1);return}if(Mn)if(At(!1),Tn){if(nt&&(nt==null?void 0:nt.length)>0){let Me=[];j1?Br()?Me=Oo():Me=nt:Me=Oo(),D1(Me)}}else console.log("creating new annotation"),typeof n=="function"&&f0(nt)&&((ge==null?void 0:ge.awi_annotation_type)==="polygon"?J5():(Rt([]),n(nt,null,!1,()=>{kr()})));else if(c&&Pt!=="-1"||v){if((mn||e1.x!==-1&&e1.y!==-1)&&X5(O1,kn.getMousePos(Ye.current,be))){const Me=Or(Pt);if(Me){const Re=[...Me.awi_coords],Pe=f0(Re);typeof o=="function"&&Pe&&!p?o(Re,u,()=>{kr()}):Pe||((ge==null?void 0:ge.awi_annotation_type)=="polygon"?Kr(Re,be):bi(!0))}}else{const Me=D2(be)||[];if(Me.length>0)if(Me.every(Re=>r1.includes(Re))&&r1.every(Re=>Me.includes(Re))){if(un(Re=>(typeof d=="function"&&d(r1[(r1.indexOf(Re)+1)%r1.length]),ht(),r1[(r1.indexOf(Re)+1)%r1.length]==="-1"&&(l1({x:0,y:0}),Kn({x:-1,y:-1})),r1[(r1.indexOf(Re)+1)%r1.length])),(!mn||Br())&&(ge==null?void 0:ge.awi_annotation_type)=="polygon"){const Re=(Ce=Or(u))==null?void 0:Ce.awi_coords;sr(be,Re)}}else console.log("Selecting first temp"),un(Me[0]),typeof d=="function"&&d(Me[0]),D1();else un("-1"),D1();w1(Me)}mn&&$t(!1),Tt(!1)}else if(c){const Me=D2(be)||[];console.log("This is the temp annotation",Me),Me.length>0&&(w1(Me),typeof d=="function"&&d(Me[0]),D1()),Tt(!1)}}},Ei=be=>{if(console.log("Handle Mouse Down"),be.button==0&&!ar()){if(!["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level))return;if(!c&&!v){At(!0),console.log("Mouse down");const{x:Ce,y:Me}=kn.getMousePosAbsolute(Ye.current,be);Hn({x:Ce,y:Me}),Tn?j1&&Br()||Rt(Re=>[...Re||[],{x:Ce,y:Me}]):(ge==null?void 0:ge.awi_annotation_type)==="rectangle"?Rt([{x:Ce,y:Me},{x:Ce,y:Me},{x:Ce,y:Me},{x:Ce,y:Me}]):(ge==null?void 0:ge.awi_annotation_type)==="circle"?Rt([{x:Ce,y:Me},{x:Ce,y:Me}]):(ge==null?void 0:ge.awi_annotation_type)==="dot"?Rt([{x:Ce,y:Me}]):(ge==null?void 0:ge.awi_annotation_type)==="polygon"&&Rt(Re=>[...Re,{x:Ce,y:Me}])}else v||(q5(be,Pt),Tt(!0))}else if(be.button===1||be.button==0){const{clientX:Ce,clientY:Me}=be,{x:Re,y:Pe}=at,ut=Jt=>{console.log("PANNING!!!!!");const gn=Jt.clientX-Ce,gt=Jt.clientY-Me,Wt=Re+gn,E1=Pe+gt,ce=Math.max(Math.min(Wt,0),yt.width-yt.width*at.scale),C0=Math.max(Math.min(E1,0),yt.height-yt.height*at.scale);pn({scale:at.scale,x:ce,y:C0})},wt=()=>{window.removeEventListener("mousemove",ut),window.removeEventListener("mouseup",wt),window.addEventListener("touchmove",ut,{passive:!1}),window.addEventListener("touchend",wt)};at.scale>1&&(window.addEventListener("mousemove",ut),window.addEventListener("touchmove",ut,{passive:!1})),window.addEventListener("mouseup",wt),window.addEventListener("touchend",wt)}},ao=be=>{if(Ye!=null&&Ye.current&&_1({x:be.clientX,y:be.clientY}),c&&(Pt!="-1"&&(vn==null?void 0:vn.length)<=B1.MAX_ANNOTATIONS_TO_HOVER&&ca(be),!mn&&!bt?(vn==null?void 0:vn.length)<=B1.MAX_ANNOTATIONS_TO_HOVER&&xi(be):Vn!="-1"&&T1("-1")),p)return;let Ce=[];if(Mn){Tn?(Ce.length==0&&(Ce=[tn]),Rt(Me=>Me.length==0?[tn]:Me),D1(nt)):(ge==null?void 0:ge.awi_annotation_type)==="rectangle"?(Ce=kn.getUpdatedCoordinates(Ye,be,tn),Rt(Ce),D1(Ce)):(ge==null?void 0:ge.awi_annotation_type)==="circle"?(oo(be),D1(nt)):(ge==null||ge.awi_annotation_type,D1(nt));return}else if(c&&Pt!=="-1"&&bt){if(console.log("isDrawingAnnotation",Mn),mn){const{x:Me,y:Re}=kn.getMousePos(Ye.current,be),Pe=Me-(O1.x||0),ut=Re-(O1.y||0);if(u!=="-1"){Ce=[...nt].map(gn=>({x:gn.x+Pe,y:gn.y+ut}));const wt=Or(u);if(wt)switch(wt.awi_coords=[...Ce],ge==null?void 0:ge.awi_annotation_type){case"dot":{Ce.length===1&&(Ce[0].x=kn.getPerfectPointValue(Ce[0].x),Ce[0].y=kn.getPerfectPointValue(Ce[0].y));break}case"circle":{Ce.length===2&&(Ce=[...kn.adjustToCircle(Ce)],wt.awi_coords=[...Ce]);break}case"rectangle":{if(Ce.length===4){const gn=Math.abs(Ce[1].x-Ce[0].x),gt=Math.abs(Ce[3].y-Ce[1].y);for(let Wt=0;Wt<Ce.length;Wt++)Ce[Wt].x<0?(Ce[1].x=gn,Ce[2].x=gn,Ce[0].x=1e-4,Ce[3].x=1e-4):Ce[Wt].y<0?(Ce[2].y=gt,Ce[3].y=gt,Ce[0].y=1e-4,Ce[1].y=1e-4):Ce[Wt].x>1?(Ce[0].x=1-gn,Ce[3].x=1-gn,Ce[1].x=1-1e-4,Ce[2].x=1-1e-4):Ce[Wt].y>1&&(Ce[0].y=1-gt,Ce[1].y=1-gt,Ce[2].y=1-1e-4,Ce[3].y=1-1e-4)}break}case"polygon":{Ce.length>1&&Kr(Ce,be);break}default:{console.log("Unknown request type");break}}Ze()(Ce)}}else if(e1.x!==-1&&e1.y!==-1&&u!=="-1"){console.log("Corner coordinates");const Me=Or(u);if((ge==null?void 0:ge.awi_annotation_type)==="circle"){const Re=kn.getMousePos(Ye.current,be);if(Me){Ce=Me.awi_coords;const Pe=(Ce[0].x+Ce[1].x)/2,ut=(Ce[0].y+Ce[1].y)/2,wt=kn.getDistance(Re.x,Re.y,Pe,ut);Pe-wt<0?(Ce[0]={x:0,y:ut},Ce[1]={x:2*wt,y:ut}):Pe+wt>1?(Ce[0]={x:1-2*wt,y:ut},Ce[1]={x:1,y:ut}):ut-wt<0?(Ce[0]={x:Pe,y:0},Ce[1]={x:Pe,y:2*wt}):ut+wt>1?(Ce[0]={x:Pe,y:1-2*wt},Ce[1]={x:Pe,y:1}):(Ce[0]={x:Pe-wt,y:ut},Ce[1]={x:Pe+wt,y:ut}),Ce=[...kn.adjustToCircle(Ce)]}}else if((ge==null?void 0:ge.awi_annotation_type)==="polygon"&&!Tn){const Re=kn.getMousePos(Ye.current,be);Me!=null&&Me.awi_coords&&(Ce=[...Me.awi_coords],y1>-1&&(y1===0||y1===Ce.length-1?(Ce[0]={x:Re.x,y:Re.y},Ce[Ce.length-1]={x:Re.x,y:Re.y}):Ce[y1]={x:Re.x,y:Re.y},Kn({x:Re.x,y:Re.y})))}else Ce=kn.getUpdatedCoordinates(Ye,be,e1);if(f0(Ce)){Rt([...Ce]);const Re=Or(u);Re&&(Re.awi_coords=Ce,D1(Ce))}}}else if((ge==null?void 0:ge.awi_annotation_type)==="polygon"&&!c&&(nt==null?void 0:nt.length)>1){const{x:Me,y:Re}=kn.getMousePos(Ye.current,be);ht(nt,{x:Me,y:Re})}},d9=be=>{if(be.touches.length===1){const Ce=be.touches[0];if(ar()){if(at.scale==1)return;H1.current||(H1.current={x:Ce.clientX,y:Ce.clientY})}else{const Me={...Ce,clientX:Ce.clientX,clientY:Ce.clientY,currentTarget:be.currentTarget,button:0};Ei(Me)}}},so=be=>{if(be.preventDefault(),be.touches.length>=2){const[Ce,Me]=[be.touches[0],be.touches[1]],Re=Me.clientX-Ce.clientX,Pe=Me.clientY-Ce.clientY,ut=Math.hypot(Re,Pe);if(yn!==null){const wt=ut-yn,Jt=(Ce.clientX+Me.clientX)/2,gn=(Ce.clientY+Me.clientY)/2;H0({deltaY:-wt,clientX:Jt,clientY:gn,currentTarget:be.currentTarget})}Ln(ut)}if(be.touches.length===1){const Ce=be.touches[0];if(ar()){if(H1.current){console.log("PANNING!!!!!");const Me=Ce.clientX-H1.current.x,Re=Ce.clientY-H1.current.y,{x:Pe,y:ut}=at,wt=Pe+Me,Jt=ut+Re,gn=Math.max(Math.min(wt,0),yt.width-yt.width*at.scale),gt=Math.max(Math.min(Jt,0),yt.height-yt.height*at.scale);pn({scale:at.scale,x:gn,y:gt}),H1.current={x:Ce.clientX,y:Ce.clientY}}}else{H1.current&&(H1.current=null);const Me={...Ce,clientX:Ce.clientX,clientY:Ce.clientY,currentTarget:be.currentTarget};ao(Me)}}},f2=be=>{if(H1.current&&(H1.current=null),be.touches.length<2&&Ln(null),ar()){be.preventDefault();return}const Ce=be.touches[0]||be.changedTouches[0],Me={...Ce,clientX:Ce.clientX,clientY:Ce.clientY,currentTarget:be.currentTarget};T2(Me)},Ro=be=>{const Ce=be.touches[0]||be.changedTouches[0],Me={...Ce,clientX:Ce.clientX,clientY:Ce.clientY,currentTarget:be.currentTarget};wi(Me)},fa=(be="")=>{switch(be){case"left":Do();break;case"right":Po();break;case"top":P2();break;case"bottom":io();break;default:console.warn(`Unknown pan direction: ${be}`)}},f9=()=>{typeof w=="function"&&w(be=>!be)},b3=()=>{if(!u||u=="-1"){V1.error("Control copy will be work only when you have a selected annotation");return}else N&&typeof N=="function"&&N(bn==null?void 0:bn.result,!1)},ha=()=>{if(!Ar.current||!hi.current)return;const be=Ar.current,Ce=be.getContext("2d");if(!Ce)return;const Me=yt.width*at.scale,Re=yt.height*at.scale;!Me||!Re||(be.width=Me,be.height=Re,Ce.clearRect(0,0,Me,Re),Ce.save(),Ce.setTransform(1,0,0,1,0,0),Ce.clearRect(0,0,Me,Re),Ce.translate(at.x,at.y),Ce.scale(at.scale,at.scale),Ce.drawImage(hi.current,0,0,yt.width,yt.height),Ce.restore())};return Z.jsxs(Z.Fragment,{children:[Ur&&Z.jsx(zA,{closeSAMPromptModal:()=>zn(!1),onSubmit:Ml,directPrompt:C1,isLoading:rn,requestInfo:ge}),v&&H&&(bn==null?void 0:bn.success)&&Z.jsx(Z.Fragment,{children:Z.jsx("div",{style:{margin:"4px",display:"flex",justifyContent:"center"},children:Z.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"max-content"},children:Z.jsx("button",{className:"modalButton modalButton__purpleColor",onClick:e4,children:"Copy Annotations"})})})}),v&&Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Ot,style:{minHeight:j1?"50vh":"unset",touchAction:"none !important",position:"relative"},children:ui?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",p2.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",de+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",de+1," is loading..."]}):Z.jsxs(Z.Fragment,{children:[Ue&&Z.jsx(ac,{isEditing:c,handleSelectTool:h,annotator_name:((f=(h9=(Si=D==null?void 0:D.result)==null?void 0:Si.annotatorInfo)==null?void 0:h9.awi_personal_info)==null?void 0:f.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:bn,SAMToggleValue:P,currentSelectedSAMTool:T,handleCopyAnnotations:N,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:oe,handleZoomInClick:Io,zoomProperties:at,handleReset:r0,handleZoomOutClick:lr,handleCompleteAnnotation:ln,toggleFullscreen:d2,selectAnnotationId:Pt,selectedAnnotationInfo:Fn,undoLastStateAnnotation:u9,usingSamFunction:Tn,samAPIactive:rn,handleSendToSamFunction:No,coordinates:nt,reLoadAndReDrawAnnotations:c9,showGuidelinesFirst:oe,handleSendToSamFunctionPrompt:d1,isMobile:j1,toggleSelectAnnotation:st,handleLeftKeyDown:Do,handleRightKeyDown:Po,handleUpKeyDown:P2,handleDownKeyDown:io,undoAnnotationPoint:m1,togglePagination:f9,switchToEditMode:xe,switchToCreateMode:we,goToNextImage:ve,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:b3,handlePasteAnnotationsByControlV:ae,showPagination:K,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Nt,isCarousel:v,allowedToCopyPreview:H,classColorMapToSend:A,request:ge,parentReqData:et,RequestInfoModal:ne,setCrossHair:u0,isCrossHair:u1,annotationViewType:Ve,REACT_APP_SAM_ENABLED:ct,loggedUser:m,controlMinusHotkey:u2,controlPlusHotkey:Qr,Carousel:ot},i),Z.jsx(lc,{canvasDimensions:yt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:Ar,overlayCanvasRef:Et,handleMouseDown:Ei,handleMouseUp:T2,handleMouseMove:ao,handleMouseMoveOut:la,handleOnMouseLeave:wi,handleWheel:H0,handleTouchStart:d9,handleTouchMove:so,handleTouchEnd:f2,handleTouchCancel:Ro})]})}),!v&&Ve=="atom"&&Z.jsxs("div",{style:{display:"flex",flexDirection:j1?"column":"row"},children:[Z.jsx("div",{style:{height:j1?"unset":"100%",width:j1?"100%":"5.4%",border:"1px solid #E4E0E6",backgroundColor:"white"},children:["awi_annotator","awi_verifier","awi_developer"].includes(m.userObj.awi_level)&&Z.jsx("div",{style:{width:"100%",gap:"10px",marginTop:"2px",height:"100% ",display:"flex",justifyContent:"space-between",alignItems:"center",flexDirection:j1?"row":"column"},children:Ue&&Z.jsx(ac,{isEditing:c,handleSelectTool:h,annotator_name:((V=(B=(b=D==null?void 0:D.result)==null?void 0:b.annotatorInfo)==null?void 0:B.awi_personal_info)==null?void 0:V.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:bn,SAMToggleValue:P,currentSelectedSAMTool:T,handleCopyAnnotations:N,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:oe,handleZoomInClick:Io,zoomProperties:at,handleReset:r0,handleZoomOutClick:lr,handleCompleteAnnotation:ln,toggleFullscreen:d2,selectAnnotationId:Pt,selectedAnnotationInfo:Fn,undoLastStateAnnotation:u9,usingSamFunction:Tn,samAPIactive:rn,handleSendToSamFunction:No,coordinates:nt,reLoadAndReDrawAnnotations:c9,showGuidelinesFirst:oe,handleSendToSamFunctionPrompt:d1,isMobile:j1,toggleSelectAnnotation:st,handleLeftKeyDown:Do,handleRightKeyDown:Po,handleUpKeyDown:P2,handleDownKeyDown:io,undoAnnotationPoint:m1,togglePagination:f9,switchToEditMode:xe,switchToCreateMode:we,goToNextImage:ve,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:b3,handlePasteAnnotationsByControlV:ae,showPagination:K,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Nt,isCarousel:v,allowedToCopyPreview:H,classColorMapToSend:A,request:ge,parentReqData:et,RequestInfoModal:ne,setCrossHair:u0,isCrossHair:u1,annotationViewType:Ve,REACT_APP_SAM_ENABLED:ct,loggedUser:m,controlMinusHotkey:u2,controlPlusHotkey:Qr,Carousel:ot},i)})}),Z.jsxs("div",{style:j1?{height:"100%",width:"100%"}:{width:"94.6%"},children:[!j1&&Z.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",height:j1?"8%":"3%",border:"1px solid #E4E0E6",background:"white",justifyContent:"space-between"},children:[Z.jsxs("div",{style:{display:"flex",flexDirection:"row",height:"100%",alignItems:"center"},children:[Z.jsxs("div",{className:"color-black",style:{width:"4.8rem",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:[Z.jsx("span",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"50%",backgroundColor:" rgba(111, 41, 169, 0.20)",height:"100%"},children:de+1}),Z.jsx("span",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"50%",backgroundColor:Fe||"rgba(111, 41, 169, 0.1)",height:"100%"},children:(((X=D==null?void 0:D.result)==null?void 0:X.awi_contents)||[]).length})]}),Z.jsxs("p",{className:"color-black",style:{marginLeft:"1rem"},title:((ie=G==null?void 0:G.awi_label)==null?void 0:ie.length)>20?G.awi_label:J.length>20?J:"",children:["Image -"," ",((De=G==null?void 0:G.awi_label)==null?void 0:De.length)>0?G.awi_label.length>20?G.awi_label.substring(0,20)+"...":G.awi_label:J.length>20?J.substring(0,20)+"...":J]}),Z.jsx("p",{className:"color-black",style:{marginLeft:"1rem"},children:((_e==null?void 0:_e.result)||[]).length>0&&`Annotations - ${((_e==null?void 0:_e.result)||[]).length} (Recent First) ${S.size?`Selected - ${((_e==null?void 0:_e.result)||[]).length-S.size}`:""}`})]}),Z.jsx("div",{children:Z.jsxs("div",{style:{fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center"},className:"color-black",children:[Z.jsx("div",{children:A0}),(A0==null?void 0:A0.length)>0&&Z.jsx(V6,{color:"#000"})]})})]}),Z.jsx("div",{children:K&&j1&&Ke&&Z.jsx("div",{style:{border:"1px solid #E4E0E6"},children:Z.jsx(Ke,{handleNextPage:z,handlePreviousPage:R,currentPage:$,images:(Je=D==null?void 0:D.result)==null?void 0:Je.awi_contents,handleIndexUpdate:W,currentIndex:de,request_id:q,requestFor:(rt=D==null?void 0:D.result)==null?void 0:rt.awi_request_for,imagePagination:K,showImages:!0,fetchAnnotations:Le,pageCount:Be})})}),Z.jsx("div",{style:{height:j1||m3?"25px":"3%",border:"1px solid #E4E0E6",justifyContent:"space-between",paddingLeft:"10px",paddingRight:"10px",backgroundColor:"#fff"},children:j1&&(A0==null?void 0:A0.length)>0?Z.jsx(Z.Fragment,{children:Z.jsx("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"center",alignItems:"center",fontWeight:"bold"},children:A0})}):Z.jsx(Z.Fragment,{children:at.scale>1?Z.jsx(Z.Fragment,{children:Z.jsxs("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"space-between",alignItems:"center"},children:[Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>fa("left"),children:"Left"}),Z.jsx("progress",{value:l2.left,max:yt.width,title:l2.left==0?"You can not move left more":"Showing how much you can move left more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>fa("right"),children:"Right"}),Z.jsx("progress",{value:l2.right,max:yt.width,title:l2.right==0?"You can not move right more":"Showing how much you can move right more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>fa("top"),children:"Top"}),Z.jsx("progress",{value:l2.top,max:yt.height,title:l2.top==0?"You can not move top more":"Showing how much you can move top more"}),Z.jsx("button",{className:"modalButton modalButton__tertiaryChoice pan_small",onClick:()=>fa("bottom"),children:"Bottom"}),Z.jsx("progress",{value:l2.bottom,max:yt.height,title:l2.bottom==0?"You can not move bottom more":"Showing how much you can move bottom more"})]})}):Z.jsx("div",{className:qn(Sn.zoom__container,"color-black"),style:{height:"25px",justifyContent:"center",alignItems:"center"},children:"Zoom in to see image pan progress"})})}),Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Ot,style:{height:K?"80%":"90%",width:"100%",touchAction:"none !important",minHeight:j1?"50vh":"unset",position:"relative"},children:ui?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",p2.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",de+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",de+1," is loading..."]}):Z.jsx(lc,{canvasDimensions:yt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:Ar,overlayCanvasRef:Et,handleMouseDown:Ei,handleMouseUp:T2,handleMouseMove:ao,handleMouseMoveOut:la,handleOnMouseLeave:wi,handleWheel:H0,handleTouchStart:d9,handleTouchMove:so,handleTouchEnd:f2,handleTouchCancel:Ro})}),K&&!j1&&Ke&&Z.jsx("div",{children:K&&Z.jsx("div",{style:{border:"1px solid #E4E0E6"},children:Z.jsx(Ke,{handleNextPage:z,handlePreviousPage:R,currentPage:$,images:(Bt=D==null?void 0:D.result)==null?void 0:Bt.awi_contents,handleIndexUpdate:W,currentIndex:de,request_id:q,requestFor:(on=D==null?void 0:D.result)==null?void 0:on.awi_request_for,imagePagination:K,showImages:!0,fetchAnnotations:Le,pageCount:Be})})})]})]}),!v&&Ve=="library"&&Z.jsxs(Z.Fragment,{children:[Ue&&Z.jsx(ac,{isEditing:c,handleSelectTool:h,annotator_name:((g0=(Yn=(Pn=D==null?void 0:D.result)==null?void 0:Pn.annotatorInfo)==null?void 0:Yn.awi_personal_info)==null?void 0:g0.awi_full_name)||"",handleSAMToggle:E,hasAnnotation:bn,SAMToggleValue:P,currentSelectedSAMTool:T,handleCopyAnnotations:N,setOpenRequestDetails:F,openRequestDetails:j,show_guidelines_first:oe,handleZoomInClick:Io,zoomProperties:at,handleReset:r0,handleZoomOutClick:lr,handleCompleteAnnotation:ln,toggleFullscreen:d2,selectAnnotationId:Pt,selectedAnnotationInfo:Fn,undoLastStateAnnotation:u9,usingSamFunction:Tn,samAPIactive:rn,handleSendToSamFunction:No,coordinates:nt,reLoadAndReDrawAnnotations:c9,showGuidelinesFirst:oe,handleSendToSamFunctionPrompt:d1,isMobile:!0,toggleSelectAnnotation:st,handleLeftKeyDown:Do,handleRightKeyDown:Po,handleUpKeyDown:P2,handleDownKeyDown:io,undoAnnotationPoint:m1,togglePagination:f9,switchToEditMode:xe,switchToCreateMode:we,goToNextImage:ve,goToPreviousImage:he,handleGoToPendingAnnotations:le,handleCopyByCtrlC:b3,handlePasteAnnotationsByControlV:ae,showPagination:K,isControlViaToolPress:dt,setIsControlViaToolPress:qe,isAltViaToolPress:ft,setIsAltViaToolPress:Nt,isCarousel:v,allowedToCopyPreview:H,classColorMapToSend:A,request:ge,parentReqData:et,RequestInfoModal:ne,setCrossHair:u0,isCrossHair:u1,annotationViewType:Ve,REACT_APP_SAM_ENABLED:ct,loggedUser:m,controlMinusHotkey:u2,controlPlusHotkey:Qr,Carousel:ot},i),Z.jsx("div",{className:qn(Sn.canvasContainer,{[s]:!!s}),ref:Ot,style:{height:K?"80%":"90%",width:"100%",touchAction:"none !important",minHeight:j1?"50vh":"unset",position:"relative"},children:ui?se&&(se!=null&&se.file_size)?Z.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.1)",width:"280px"},children:[Z.jsx("div",{style:{fontSize:"16px",fontWeight:"bold",color:"#333"},children:"📷 Image Details"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Name:"})," ",se==null?void 0:se.awi_label]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#555"},children:[Z.jsx("strong",{children:"Size:"})," ",p2.byteToSize(se.file_size)]}),Z.jsxs("div",{style:{fontSize:"14px",color:"#007bff",fontWeight:"bold"},children:["🔄 Loading Image ",de+1,"..."]})]}):Z.jsxs("div",{children:["Image number ",de+1," is loading..."]}):Z.jsx(lc,{canvasDimensions:yt,zoomProperties:at,isEditing:c,canvasRef:Ye,bgCanvasRef:Ar,overlayCanvasRef:Et,handleMouseDown:Ei,handleMouseUp:T2,handleMouseMove:ao,handleMouseMoveOut:la,handleOnMouseLeave:wi,handleWheel:H0,handleTouchStart:d9,handleTouchMove:so,handleTouchEnd:f2,handleTouchCancel:Ro})})]}),t1!=-1&&h3&&Z.jsx(Gb,{callback:()=>X0(h3,t1),cancelCallBack:()=>{ci(-1)},trigger:"REMOVE_POLYGON_POINT",fireOnMount:!0,children:Z.jsx(Z.Fragment,{})})]})},_2={message__container:"_message__container_u7nyp_1",message__container__icon:"_message__container__icon_u7nyp_15",message__container__title:"_message__container__title_u7nyp_19",message__container__title__success:"_message__container__title__success_u7nyp_24",message__container__description:"_message__container__description_u7nyp_27",message__container__loading:"_message__container__loading_u7nyp_31",pulse:"_pulse_u7nyp_1"},uc=({iconUrl:e,title:t,description:n,messageType:r="information",isLoading:o=!1,textClass:i="",noPadding:a,iconName:s=""})=>{var c,u;return o?Z.jsxs("div",{className:qn(_2.message__container,_2.message__container__loading),children:[s&&(s==null?void 0:s.length)>0&&Z.jsx("img",{src:(c=q1[s])==null?void 0:c.IconComponent,className:_2.message__container__icon}),e&&(e==null?void 0:e.length)>0&&Z.jsx("img",{src:e,className:_2.message__container__icon}),Z.jsx("h1",{className:qn(_2.message__container__title,{[_2.message__container__title__success]:r==="success"}),children:t}),Z.jsx("p",{className:qn(_2.message__container__description,i),children:n})]}):Z.jsxs("div",{className:qn(_2.message__container,{noPadding:a}),children:[s&&(s==null?void 0:s.length)>0&&Z.jsx("img",{src:(u=q1[s])==null?void 0:u.IconComponent,className:_2.message__container__icon}),e&&(e==null?void 0:e.length)>0&&Z.jsx("img",{src:e,className:_2.message__container__icon}),Z.jsx("h1",{className:qn(_2.message__container__title,{[_2.message__container__title__success]:r==="success"}),children:t}),Z.jsx("p",{className:qn(_2.message__container__description,i),children:n})]})},x_={ATTRIBUTES:{labelValue:"Attributes",src:"noAttributes",description:"No attributes are available. Start by adding or configuring attributes.",messageType:"information",loadingMessage:"Loading attributes...",notFoundMessage:"No attributes found"},ORGANISATIONS:{labelValue:"Organisations",src:"noOrganisations",description:"There are no organisations available. Add a new organisation to get started.",messageType:"information",loadingMessage:"Loading organizations...",notFoundMessage:"No organisations found"},REQUESTS:{labelValue:"Requests",src:"noRequests",description:"There are no requests available. Raised requests will be displayed here.",messageType:"information",loadingMessage:"Loading requests...",notFoundMessage:"No requests found"},USERS:{labelValue:"Users",src:"noUsers",description:"No users have been added yet. Start by inviting or creating users.",messageType:"information",loadingMessage:"Loading users...",notFoundMessage:"No users found"},USERS_IN_REQUEST:{labelValue:"Users",src:"noUsers",description:"No users found.",messageType:"information",loadingMessage:"Loading users...",notFoundMessage:"No users found"},CLASSES:{labelValue:"Classes",src:"noClasses",description:"There are no classes available. Add a new class to begin.",messageType:"information",loadingMessage:"Loading classes...",notFoundMessage:"No classes found"},IMAGES:{labelValue:"Images",src:"noImages",description:"No images are currently available. Upload images to view them here.",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No images found"},ANNOTATOR_NO_SESSIONS:{labelValue:"Sessions",src:"noSessions",description:"No sessions are currently available. Annotator Sessions will be listed here.",messageType:"information",loadingMessage:"Loading sessions...",notFoundMessage:"No sessions found"},VERIFIER_NO_SESSIONS:{labelValue:"Sessions",src:"noSessions",description:"No sessions are currently available. Verifier Sessions will be listed here.",messageType:"information",loadingMessage:"Loading sessions...",notFoundMessage:"No sessions found"},MODELS:{labelValue:"Models",src:"noModels",description:"There are no models available. Run jobs and train models to get started.",messageType:"information",loadingMessage:"Loading models...",notFoundMessage:"No models found"},JOBS:{labelValue:"Jobs",src:"noJobs",description:"No jobs are currently scheduled or running. Create a job to see it listed here.",messageType:"information",loadingMessage:"Loading jobs...",notFoundMessage:"No jobs found"},MODEL_LOGS:{labelValue:"Model Logs",src:"noJobLogs",description:"There are no logs available for the models. Generate or upload logs to view them.",messageType:"information",loadingMessage:"Loading model logs...",notFoundMessage:"No model logs found"},DATASETS:{labelValue:"Datasets",src:"noDatasets",description:"No datasets are available. Upload or create datasets to start working.",messageType:"information",loadingMessage:"Loading datasets...",notFoundMessage:"No datasets found"},BILLS:{labelValue:"Bills",src:"noBills",description:"No bills are currently available. Generated bills will be listed here.",messageType:"information",loadingMessage:"Loading bills...",notFoundMessage:"No bills found"},MODEL_METRICS:{labelValue:"Model Metrics",src:"noModelMetrics",description:"No metrics are available for the models. Generated metrics for analyzing performance will be listed here.",messageType:"information",loadingMessage:"Loading model metrics...",notFoundMessage:"No model metrics found"},MODEL_DETAILS:{labelValue:"Model Details",src:"noModelDetails",description:"Details for the models are not available. Add or update model details to view them.",messageType:"information",loadingMessage:"Loading model details...",notFoundMessage:"No model details found"},MODEL_RESOURCES:{labelValue:"Model Resources",src:"noModelResources",description:"No resources are available for the models. Add resources to start utilizing them.",messageType:"information",loadingMessage:"Loading model resources...",notFoundMessage:"No model resources found"},NOTIFICATIONS:{labelValue:"Notifications",src:"noNotifications",description:"No notifications are available. New notifications will be displayed here.",messageType:"information",loadingMessage:"Loading notifications...",notFoundMessage:"No notifications found"},REQUEST_IMAGES:{labelValue:"Request Images",src:"noRequestImages",description:"No request images are currently available.",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No request images found"},REQUEST_PRICING:{labelValue:"Request Pricing",src:"noPrices",description:"No request pricing are currently available.",messageType:"information",loadingMessage:"Loading pricing...",notFoundMessage:"No request pricing found"},ANNOTATION_GRAPH:{labelValue:"Annotation Graph",src:"noAnnotationGraph",description:"No annotation analytics are available for the given date",messageType:"information",loadingMessage:"Loading annotation graph...",notFoundMessage:"No annotations"},LOADING_CAROUSAL:{labelValue:"Images",src:"noImages",description:"No images is available to load",messageType:"information",loadingMessage:"Loading images...",notFoundMessage:"No images found"},TAGS:{labelValue:"Tags",src:"noTags",description:"No tags are available. Start by adding or configuring tags.",messageType:"information",loadingMessage:"Loading tags...",notFoundMessage:"No tags found"},NO_CSV_REQUESTS:{labelValue:"Requests",src:"noRequests",description:"There are no requests available in sheet, kindly add and upload.",messageType:"information",loadingMessage:"Loading requests...",notFoundMessage:"No requests found"},NO_CSV_CLASS:{labelValue:"Classes",src:"noClasses",description:"There are no classes available in sheet, kindly add and upload.",messageType:"information",loadingMessage:"Loading classes...",notFoundMessage:"No classes found"},CLASS_PROPORTION:{labelValue:"Class proportion",src:"noClasses",description:"No class proportion available.",messageType:"information",loadingMessage:"Loading class proportion...",notFoundMessage:"No class proportion found"},SINGLE_CLASS:{labelValue:"Class",src:"noClasses",description:"No class available.",messageType:"information",loadingMessage:"Loading class...",notFoundMessage:"No classes found"},LOADING_FILTER:{labelValue:"Filter",src:"noClasses",description:"No filter configuration.",messageType:"information",loadingMessage:"Loading filter information...",notFoundMessage:"No filter configuration found"},LOADING_ANNOTATION:{labelValue:"Annotation Loading",src:"noImages",description:"No annotation found",messageType:"information",loadingMessage:"Please wait, loading annotation...",notFoundMessage:"No annotations"},LOADING_REQUEST:{labelValue:"Request Loading",src:"noRequests",description:"No request found",messageType:"information",loadingMessage:"Please wait, loading request info...",notFoundMessage:"No request"},NOT_FOUND_GENERAL:{labelValue:"Data Loading",src:"notFoundGeneral",description:"No data found",messageType:"information",loadingMessage:"Please wait, loading data...",notFoundMessage:"No data"}},iee=({stateKey:e="NOT_FOUND_GENERAL",loadState:t=!1,stateDescription:n=null,stateLoadDescription:r=null,showImage:o=!1,textClass:i="",noPadding:a=!1,stateTitle:s=""})=>{const c=x_[e]||x_.NOT_FOUND_GENERAL;if(!c)return Z.jsx(Z.Fragment,{});const{labelValue:u,src:d,messageType:h,description:g,notFoundMessage:m}=c;if(t)return Z.jsxs("div",{style:{width:"100%"},children:[o&&Z.jsx(uc,{title:c.loadingMessage,iconName:d,description:r||"",isLoading:!0,noPadding:a}),!o&&Z.jsx(uc,{title:c.loadingMessage,description:r||"",isLoading:!0,noPadding:a})]});{const v=(s==null?void 0:s.length)>0?s:m?m||`No ${u} Found`:"",A=n||g;return Z.jsx("div",{style:{width:"100%"},children:Z.jsx(uc,{title:v,iconName:d,description:A,messageType:h,textClass:i,noPadding:a})})}},e2={tableBar:"_tableBar_103oy_1",buttonGroup:"_buttonGroup_103oy_13",btnIcon:"_btnIcon_103oy_34",searchBar:"_searchBar_103oy_41",searchInput:"_searchInput_103oy_53",searchIcon:"_searchIcon_103oy_58",removeBorder:"_removeBorder_103oy_63",button:"_button_103oy_13",isSelected:"_isSelected_103oy_74",isDisabled:"_isDisabled_103oy_80",isActive:"_isActive_103oy_85",isText:"_isText_103oy_92"},aee=({showSearch:e=!1,leftButtons:t=[],rightButtons:n=[],searchFunction:r,searchDelay:o=300,onSearchClick:i,searchPlaceHolder:a="Search...",showSearchEye:s=!0,borderRequired:c=!0,borderColor:u})=>{const d=O.useCallback(L4.debounce((v,A)=>{typeof A=="function"&&A(v)},o),[o]),h=v=>{const A=v.currentTarget.value.trim();d(A,r)},g=()=>{typeof i=="function"&&i()};if(!t.length&&!n.length&&!e)return null;const m=(v,A)=>{const p=v.type==="text";return Z.jsxs("button",{onClick:!p&&!v.isDisabled?v.onClick:void 0,title:v.title||"",disabled:v.isDisabled,className:qn(e2.button,{[e2.isText]:p,[e2.isSelected]:v.isSelected,[e2.isDisabled]:v.isDisabled,[e2.isActive]:v.isActive&&!v.isSelected}),children:[v.icon&&Z.jsx("img",{src:v.icon,alt:v.name,className:e2.btnIcon}),Z.jsx("div",{children:v.name})]},A)};return Z.jsxs("div",{className:qn(e2.tableBar,!c&&e2.removeBorder),style:{borderColor:c?u||"#909090":void 0},children:[Z.jsxs("div",{className:e2.buttonGroup,children:[t.map(m)," "]}),Z.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"10px"},children:[Z.jsx("div",{className:e2.buttonGroup,children:n.map(m)}),e&&Z.jsx("div",{className:e2.searchBar,title:a,children:Z.jsxs("form",{autoComplete:"off",style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",position:"relative"},children:[Z.jsx("input",{type:"text",name:"userSearchInput",autoComplete:"off",placeholder:a,className:e2.searchInput,onKeyUp:h}),s&&Z.jsx("img",{src:q1.searchUrl.IconComponent,alt:a,className:qn(e2.btnIcon,"cursor-pointer",e2.searchIcon),onClick:g})]})})]})]})},E_=({currentPage:e,totalPages:t,onPageChange:n,isLoading:r=!1})=>{const[o,i]=O.useState(`${e}`);O.useEffect(()=>{i(`${e}`)},[e]);const a=()=>{const s=Number(o);s>=1&&s<=t&&n(s),i("")};return Z.jsx(Z.Fragment,{children:Z.jsxs("div",{className:gr.pagination_container,children:[Z.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",maxHeight:"2vh"},children:r?Z.jsx(Z.Fragment,{children:Z.jsx("div",{className:gr.pagination_loading,children:"Loading..."})}):Z.jsxs(Z.Fragment,{children:[Z.jsx("div",{className:gr.pagination_left,children:Z.jsx("input",{type:"number",min:"1",max:t,value:o,onChange:s=>{i(s.target.value)},onBlur:()=>{if(o==""){i(`${e}`);return}const s=parseInt(o,10);if(!isNaN(s)){let c=Math.max(1,Math.min(t,s)).toString();c!=null&&c.length||(c="1"),i(c),a()}},onKeyDown:s=>{if(s.key==="Enter"){s==null||s.preventDefault(),s==null||s.stopPropagation();const c=parseInt(o,10);if(!isNaN(c)){const u=Math.max(1,Math.min(t,c)).toString();i(u),a()}}},placeholder:o,style:{background:"transparent",border:"0",width:"100%",height:"100%"}})}),Z.jsx("div",{className:gr.pagination_right,children:t})]})}),Z.jsxs("div",{style:{gap:"20px",display:"flex"},children:[Z.jsx("img",{src:q1.backArrow.IconComponent,onClick:()=>e>1&&n(e-1),style:{cursor:e>1?"pointer":"not-allowed"},className:gr.nextPrevArrow,title:e>1?`Go to page number ${e-1} `:"Go to previous page is not allowed"}),Z.jsx("img",{src:q1.forwardArrow.IconComponent,onClick:()=>e<t&&n(e+1),style:{cursor:e<t?"pointer":"not-allowed"},className:gr.nextPrevArrow,title:e<t?`Go to page number ${e+1}`:"Go to next page is not allowed"})]})]})})},see=({hasNextPage:e,isFetchingNextPage:t=!1,fetchNextPage:n,isLoading:r=!1,totalResults:o=0,totalFetchedResults:i=0,currentPage:a=1,totalPages:s=10,onPageChange:c,isPagination:u=!1,loadText:d=""})=>{let h="Load More";return i+1===o?h="Load last results":r||t?u?a==1?h="Loading...":h=`Loading page number ${a}`:o===0?h="Loading...":i+1===o?h="Loading last results...":h=`Loading ${i+1} to ${o}`:i===0?(d==null?void 0:d.length)==0?h="Load":h=d:h=`Load ${i+1} to ${o}`,u&&c?Z.jsx(E_,{currentPage:a,totalPages:s,onPageChange:c,isLoading:r||t}):Z.jsx("div",{className:gr.loadMoreButtonDiv,style:{display:"flex",justifyContent:"center",marginTop:"16px"},children:e&&!t&&Z.jsx("div",{className:gr.loadMoreButtonContainer,children:Z.jsx("button",{onClick:()=>n?n():void 0,className:"modalButton modalButton__purpleColor",disabled:r||t,children:h})})})},lee=({items:e,listType:t="ul",maxHeight:n="100px"})=>{const r=t;return!e||e.length===0?Z.jsx("div",{style:{minWidth:"30px"},children:"N/A"}):Z.jsx(r,{style:{maxHeight:n,overflow:"auto",paddingLeft:"20px"},children:e.map((o,i)=>Z.jsx("li",{style:{minWidth:"10vw"},children:o},i))})};var S_=(e=>(e.LARGE="l",e.MEDIUM="m",e))(S_||{});const cee=({badgeContent:e,variant:t=S_.LARGE,backgroundColor:n,textColor:r,className:o,style:i,...a})=>Z.jsx("span",{className:`badge badge_${t} ${o} ${e?"":"badge_dot"}`,style:{"--c_background":n,"--c_text":r,...i},...a,children:e}),uee=({items:e,value:t,onChange:n=()=>{},color:r,width:o,size:i="s",gap:a})=>Z.jsx("div",{className:"button_group",style:{gap:a},children:e==null?void 0:e.map((s,c)=>Z.jsx(er,{variant:"primary",content:s==null?void 0:s.label,icon:s==null?void 0:s.icon,iconPosition:(s==null?void 0:s.iconPosition)??"before",textColor:s==null?void 0:s.contentColor,iconColor:s==null?void 0:s.contentColor,onClick:()=>n(s.value),width:o,className:`button_group_button ${c==0?"first":""} ${c==e.length-1?"last":""} ${s.value==t?"active":""}`,backgroundColor:r,borderColor:r,disabled:s.disabled,size:i},s.value))});/*!
|
|
341
341
|
* @kurkle/color v0.3.4
|
|
342
342
|
* https://github.com/kurkle/color#readme
|
|
343
343
|
* (c) 2024 Jukka Kurkela
|