text: (window.webpackJsonp=window.webpackJsonp||[]).push([[2],{i5u5:function(t,e,n){"use strict";n.r(e),n.d(e,"ImageLabellingLayoutModule",function(){return ln});var i=n("ofXK"),a=n("mrSG"),o=n("5+tZ"),s=n("SxV6"),r=n("1G5W"),l=n("XNiG"),c=n("cp0P"),h=n("l5mm"),d=n("z6cu"),u=n("fXoL"),b=n("tyNb"),g=n("/uUt"),f=n("cxbk"),m=n("tk/3"),p=n("14na");let _=(()=>{class t{constructor(t,e,n){this.http=t,this.mode=e,this.router=n,this.hostPort=f.a.baseURL,this.imageLabellingMode=null,this.getBase64Thumbnail=(t,e)=>this.http.get(`${this.hostPort}${this.imageLabellingMode}/projects/${t}/uuid/${e}/imgsrc`),this.updateLabelList=(t,e)=>this.http.put(`${this.hostPort}${this.imageLabellingMode}/projects/${t}/newlabels`,{label_list:e}),this.updateProjectProgress=(t,e,n)=>this.http.put(`${this.hostPort}${this.imageLabellingMode}/projects/${t}/uuid/${e}/update`,Object.assign({},n)),this.exportProject=(t,e)=>this.http.put(`${this.hostPort}v2/${this.imageLabellingMode}/projects/${t}/export/${e}`,{newprojectid:t}),this.reloadProject=t=>this.http.put(`${this.hostPort}v2/${this.imageLabellingMode}/projects/${t}/reload`,{newprojectid:t}),this.reloadProjectStatus=t=>this.http.get(`${this.hostPort}v2/${this.imageLabellingMode}/projects/${t}/reloadstatus`),this.renameImage=(t,e,n)=>this.http.put(`${this.hostPort}v2/${this.imageLabellingMode}/projects/${n}/imgsrc/rename`,{uuid:t,new_fname:e}),this.deleteImage=(t,e,n)=>{const i={headers:new m.e({"Content-Type":"application/json"}),body:{uuid_list:[t],img_path_list:[e]}};return this.http.delete(`${this.hostPort}v2/${this.imageLabellingMode}/projects/${n}/uuids`,i)},this.mode.imgLabelMode$.pipe(Object(g.a)()).subscribe(t=>t?this.imageLabellingMode=t:this.router.navigate(["/"]))}checkIfBboxMetaType(t){return Array.isArray(t)?void 0!==t[0].bnd_box:void 0!==t.bnd_box}exportProjectStatus(){return this.http.get(`${this.hostPort}v2/${this.imageLabellingMode}/projects/exportstatus`)}}return t.\u0275fac=function(e){return new(e||t)(u.Qb(m.b),u.Qb(p.a),u.Qb(b.a))},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})();var v=n("1F7/"),y=n("LY9J"),x=n("2Vo4");const w={annotation:-1,isDlbClick:!1};let S=(()=>{class t{constructor(){this.labelStateSubject=new x.a(w),this.labelStaging$=this.labelStateSubject.asObservable(),this.setState=t=>{this.labelStateSubject.next(t?Object.assign(Object.assign({},w),t):w)}}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})();const C={scroll:!1,drag:!1,draw:!1,fitCenter:!1,clear:!1,isActiveModal:!1,save:!1,keyInfo:!1};let M=(()=>{class t{constructor(){this.actionSubject=new x.a(C),this.action$=this.actionSubject.asObservable(),this.setState=t=>{this.actionSubject.next(t?Object.assign(Object.assign({},C),t):C)}}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})(),k=(()=>{class t{constructor(t){this._imgLblApiService=t,this.getRouteState=t=>{const{state:e}=t;return Object.assign({},e)},this.displayLabelList=(t,e)=>t.map(t=>t.label_list?Object.assign(Object.assign({},t),{label_list:e}):t),this.calculateIndex=(t,e,n)=>{let i=e;return 1===t?i>=n-1?n-1:i+=1:i<=0?0:e-=1},this.checkAnnotationMetadataProp=({bnd_box:t,polygons:e})=>null!=t?t:e,this.changeAnnotationLabel=(t,{label:e,index:n})=>t.map(t=>t.annotation?Object.assign(Object.assign({},t),{annotation:t.annotation.map(t=>{var{bnd_box:i,polygons:o}=t,s=Object(a.b)(t,["bnd_box","polygons"]);return Object.assign(Object.assign({},s),{bnd_box:null==i?void 0:i.map((t,i)=>i===n?Object.assign(Object.assign({},t),{label:e}):t),polygons:null==o?void 0:o.map((t,i)=>i===n?Object.assign(Object.assign({},t),{label:e}):t)})})}):t),this.deleteAnnotation=(t,e)=>t.map(t=>t.annotation?Object.assign(Object.assign({},t),{annotation:t.annotation.map(t=>{var{bnd_box:n,polygons:i}=t,o=Object(a.b)(t,["bnd_box","polygons"]);return Object.assign(Object.assign({},o),{bnd_box:null==n?void 0:n.filter((t,n)=>n!==e),polygons:null==i?void 0:i.filter((t,n)=>n!==e)})})}):t),this.submitLabel=(t,e,n,{mainLabelRegion:i,subLabelRegion:o})=>t.map(t=>t.annotation?Object.assign(Object.assign({},t),{annotation:t.annotation.map(t=>{var{bnd_box:s,polygons:r}=t,l=Object(a.b)(t,["bnd_box","polygons"]);return Object.assign(Object.assign({},l),{bnd_box:null==s?void 0:s.map((t,a)=>a===n?Object.assign(Object.assign({},t),{region:i,subLabel:t.subLabel&&t.subLabel.length>0?[...t.subLabel,{label:e,region:o}]:[{label:e,region:o}]}):t),polygons:null==r?void 0:r.map((t,a)=>a===n?Object.assign(Object.assign({},t),{region:i,subLabel:t.subLabel&&t.subLabel.length>0?[...t.subLabel,{label:e,region:o}]:[{label:e,region:o}]}):t)})})}):t),this.removeSubLabel=(t,{selectedAnnoIndex:e,selectedSubLabelIndex:n})=>t.map(t=>t.annotation?Object.assign(Object.assign({},t),{annotation:t.annotation.map(t=>{var{bnd_box:i,polygons:o}=t,s=Object(a.b)(t,["bnd_box","polygons"]);return Object.assign(Object.assign({},s),{bnd_box:null==i?void 0:i.map((t,i)=>{var a;return i===e?Object.assign(Object.assign({},t),{subLabel:null===(a=t.subLabel)||void 0===a?void 0:a.filter((t,e)=>e!==n)}):t}),polygons:null==o?void 0:o.map((t,i)=>{var a;return i===e?Object.assign(Object.assign({},t),{subLabel:null===(a=t.subLabel)||void 0===a?void 0:a.filter((t,e)=>e!==n)}):t})})})}):t),this.setLocalStorageProjectProgress=(t,e)=>{localStorage.setItem(`${t}_${this._imgLblApiService.imageLabellingMode}`,JSON.stringify({cache:e}))},this.getLocalStorageProjectProgress=t=>{const e=localStorage.getItem(`${t}_${this._imgLblApiService.imageLabellingMode}`);return e?JSON.parse(e):null},this.updateProjectProgress=(t,e)=>{t.forEach(({annotation:t})=>{t&&(this.setLocalStorageProjectProgress(e,t),null==t||t.forEach(t=>{this._imgLblApiService.updateProjectProgress(e,t.uuid,t).pipe(Object(s.a)()).subscribe(({})=>{})}))})}}}return t.\u0275fac=function(e){return new(e||t)(u.Qb(_))},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})();var P=n("I7yr"),O=n("F7l1"),L=n("Iab2"),I=n("xOOu");let A=(()=>{class t{exportSaveFormat({saveCurrentImage:t,saveFormat:e,metadata:n,projectName:i,fullLabelList:o,labelList:s,projectFullMetadata:r}){return Object(a.a)(this,void 0,void 0,function*(){switch(e){case"pascalVoc":if(!n)return{message:0,msg:"warning.noMetadata"};if(!(null==n?void 0:n.bnd_box))return{message:0,msg:"warning.noBoundingBox"};if(!s)return{message:0,msg:"warning.noLabelList"};if(t){const t=this.calBoxCoorOriginalImages(n),e=this.getFileName(n.img_path),{img_path:i,img_depth:a,img_ori_w:o,img_ori_h:r}=n,l=this.generatePascalVocFormat({img_path:i,img_depth:a,img_ori_w:o,img_ori_h:r,bnd_box:t},s),c=e.split(".");return this.saveFile({content:l,filename:c[0]+".xml",type:"text/xml;charset=utf-8"}),{message:1,msg:"success"}}{if(!r)return{message:0,msg:"warning.noImageList"};const t=[];let e=!0;return r.forEach(n=>{const i=(n.bnd_box?n.bnd_box.map(t=>t.label):[]).some(t=>s.indexOf(t)>=0);if(n.bnd_box&&n.bnd_box.length>0&&i){e=!1;const i=this.calBoxCoorOriginalImages(n),a=this.getFileName(n.img_path),{img_path:o,img_depth:r,img_ori_w:l,img_ori_h:c}=n,h=this.generatePascalVocFormat({img_path:o,img_depth:r,img_ori_w:l,img_ori_h:c,bnd_box:i},s),d=a.split(".");t.push({filename:d[0]+".xml",content:h})}}),e?{message:0,msg:"warning.noLabelSelected"}:t?(yield this.saveAsZip(t,"pascal_voc",i),{message:1,msg:"success"}):{message:0,msg:"warning.noProgress"}}case"yolo":if(!n)return{message:0,msg:"warning.noMetadata"};if(!(null==n?void 0:n.bnd_box))return{message:0,msg:"warning.noBoundingBox"};if(!s)return{message:0,msg:"warning.noLabelList"};if(t){const t=this.calBoxCoorOriginalImages(n),e=this.getFileName(n.img_path),{img_ori_w:i,img_ori_h:a}=n,o=this.generateYoloFormat(Object.assign({},{img_ori_w:i,img_ori_h:a,bnd_box:t}),s),r=e.split(".");return this.saveFile({content:o,filename:r[0]+".txt",type:"text/plain;charset=utf-8"}),{message:1,msg:"success"}}{if(!r)return{message:0,msg:"warning.noImageList"};const t=[];let n=!0;return r.forEach(e=>{const i=(e.bnd_box?e.bnd_box.map(t=>t.label):[]).some(t=>s.indexOf(t)>=0);if(e.bnd_box&&e.bnd_box.length>0&&i){n=!1;const i=this.calBoxCoorOriginalImages(e),a=this.getFileName(e.img_path),{img_ori_w:o,img_ori_h:r}=e,l=this.generateYoloFormat(Object.assign({},{img_ori_w:o,img_ori_h:r,bnd_box:i}),s),c=a.split(".");t.push({filename:c[0]+".txt",content:l})}}),n?{message:0,msg:"warning.noLabelSelected"}:t?(yield this.saveAsZip(t,e,i),{message:1,msg:"success"}):{message:0,msg:"warning.noProgress"}}case"ocr":if(!n)return{message:0,msg:"warning.noMetadata"};if(!(null==n?void 0:n.bnd_box))return{message:0,msg:"warning.noBoundingBox"};if(!r)return{message:0,msg:"warning.noImageList"};if(!o)return{message:0,msg:"warning.noImageList"};let a="",l=0;return r.forEach((t,e)=>{0===e&&(a+="filename,x1,y1,x2,y2,label\n");const n=this.calBoxCoorOriginalImages(t),i=this.getFileName(t.img_path),s=this.generateOCRFormat({bnd_box:n},i,o);""===s&&l++,a+=""+s}),a&&l!==r.length?(this.saveFile({content:a,filename:i+"_text_ocr_labels.csv",type:"text/csv;charset=utf-8"}),{message:1,msg:"success"}):{message:0,msg:"warning.noProgress"};case"label":if(!s)return{message:0,msg:"warning.noLabelList"};const c=i+"_label.txt",h=this.generateLabelFormat(s);return""===h?{message:0,msg:"warning.noLabelSelected"}:(this.saveFile({content:h,filename:c,type:"text/plain;charset=utf-8"}),{message:1,msg:"success"});case"coco":if(!r)return{message:0,msg:"warning.noImageList"};const d=this.calPolyCoorOriginalImages(r),u=this.getCocoContent(d,s),b=this.getCocoFileName(i);return this.saveFile({content:u,filename:b,type:"text/json;charset=utf-8"}),{message:1,msg:"success"};case"json":if(!n)return{message:0,msg:"warning.noMetadata"};if(!(null==n?void 0:n.polygons))return{message:0,msg:"warning.noPolygon"};if(!r)return{message:0,msg:"warning.noImageList"};const g=this.calPolyCoorOriginalImages(r),f=this.getJsonContent(g),m=this.getJsonFileName(i);return this.saveFile({content:f,filename:m,type:"text/json;charset=utf-8"}),{message:1,msg:"success"}}})}calBoxCoorOriginalImages({bnd_box:t,img_w:e,img_h:n,img_ori_w:i,img_ori_h:o}){const s=i/e,r=o/n;return t.map(t=>{const e=Object(a.b)(t,["subLabel","region"]),n=t.distancetoImg.x*s,i=n+(t.x2-t.x1)*s,o=t.distancetoImg.y*r,l=o+(t.y2-t.y1)*r;return Object.assign(Object.assign({},e),{x1:n,x2:i,y1:o,y2:l})})}calPolyCoorOriginalImages(t){return t.map(t=>{var{img_ori_w:e,img_ori_h:n,img_w:i,img_h:o,polygons:s}=t,r=Object(a.b)(t,["img_ori_w","img_ori_h","img_w","img_h","polygons"]);const l=e/i,c=n/o,h=s.filter(({coorPt:t})=>t.map(({distancetoImg:t})=>({distancetoImg:t,x:t.x*l,y:t.y*c})));return Object.assign(Object.assign({},r),{img_ori_w:e,img_ori_h:n,img_w:i,img_h:o,polygons:h})})}generatePascalVocFormat({bnd_box:t,img_path:e,img_depth:n,img_ori_w:i,img_ori_h:a},o){let s="<annotation>\n";const r=this.getItemName("file",e),l=this.getItemName("folder",e),c=this.createNode("folder");s+="\t"+c[0]+l+c[1];const h=this.createNode("filename");s+="\t"+h[0]+r+h[1];const d=this.createNode("path");s+="\t"+d[0]+e.split("\\").join("/")+d[1];const u=this.createNode("source"),b=this.createNode("database");s+="\t"+u[0]+"\n",s+="\t\t"+b[0]+"unknown"+b[1],s+="\t"+u[1];const g=this.createNode("size");s+="\t"+g[0]+"\n";const f=this.createNode("width"),m=this.createNode("height"),p=this.createNode("depth");s+="\t\t"+f[0]+i.toString()+f[1],s+="\t\t"+m[0]+a.toString()+m[1],s+="\t\t"+p[0]+(null==n?void 0:n.toString())+p[1],s+="\t"+g[1];const _=this.createNode("segmented");s+="\t"+_[0]+"0"+_[1];const v=this.createNode("object");for(const[y,{label:x,x1:w,x2:S,y1:C,y2:M}]of t.entries())if(-1!==o.indexOf(x)){s+="\t"+v[0]+"\n";const t=this.createNode("name"),e=this.createNode("pose"),n=this.createNode("truncated"),i=this.createNode("difficult"),a=this.createNode("bndbox"),o=this.createNode("xmin"),r=this.createNode("ymin"),l=this.createNode("xmax"),c=this.createNode("ymax");s+="\t\t"+t[0]+x+t[1],s+="\t\t"+e[0]+"Unspecified"+e[1],s+="\t\t"+n[0]+"0"+n[1],s+="\t\t"+i[0]+"0"+i[1],s+="\t\t"+a[0]+"\n",s+="\t\t\t"+o[0]+Math.floor(w).toString()+o[1],s+="\t\t\t"+r[0]+Math.floor(C).toString()+r[1],s+="\t\t\t"+l[0]+Math.floor(S).toString()+l[1],s+="\t\t\t"+c[0]+Math.floor(M).toString()+c[1],s+="\t\t"+a[1],s+="\t"+v[1]}return s+="</annotation>",s}generateYoloFormat({bnd_box:t,img_ori_w:e,img_ori_h:n},i){return t.reduce((a,{x1:o,x2:s,y1:r,y2:l,label:c},h)=>{if(-1===i.indexOf(c))return a;const d=(o+s)/2,u=(r+l)/2,b=s-o,g=l-r;return a+=i.indexOf(c).toString()+" ",a+=`${(d/e).toString()} ${(u/n).toString()} `,a+=`${(b/e).toString()} ${(g/n).toString()} `,h!==t.length&&(a+="\n"),a},"")}generateOCRFormat({bnd_box:t},e,n){return t.reduce((t,{x1:i,x2:a,y1:o,y2:s,label:r})=>-1===n.indexOf(r)?(t+=`${e},${i.toString()},${o.toString()}`,t+=`,${a.toString()},${s.toString()},${r.toString()}\n`):t,"")}getItemName(t,e){const n=e.split("\\").join("/").split("/");return"folder"===t?(n.pop(),n.join("/")):n[n.length-1]}createNode(t){return["<"+t+">","</"+t+">\n"]}generateLabelFormat(t){return t.reduce((t,e,n)=>n!==(t+=e).length?t+"\n":t,"")}saveFile({content:t,filename:e,type:n}){const i=new Blob([t],{type:n});L.saveAs(i,e)}saveAsZip(t,e,n){return Object(a.a)(this,void 0,void 0,function*(){const i=new I;for(const[e,{content:n,filename:o}]of t.entries())i.file(o,n);const a=yield i.generateAsync({type:"blob"});L.saveAs(a,`${n}_${e}_labels.zip`)})}getFileName(t){const e=t.split("\\").join("/").split("/");return e[e.length-1]}getCocoFileName(t){return t+"_segmentation_coco.json"}getJsonFileName(t){return t+"_segmentation_JSON.json"}getCocoContent(t,e){let n="{";return n+=this.generateCocoInfo(),n+=this.generateCocoImage(t),n+=this.generateCocoAnnotation(t,e),n+=this.generateCocoLicense(),n+=this.generateCocoCategory(e),n+="}",n=n.replace(/(}{)/gi,"},{"),n}generateCocoInfo(){const t=new Date;let e='"info":{';return e+=`year:"${t.getFullYear().toString()}",`,e+='version:"1.0",',e+='description:"VIA project exported to COCO format using classifai(https://classifai.ai/)",',e+='contributor:"",',e+='url:"https://classifai.ai/",',e+=`date_created:"${t.toUTCString()}"`,e+="},",e}generateCocoImage(t){let e="images:[";return e+=t.reduce((e,{img_ori_w:n,img_ori_h:i,img_path:a},o)=>(e+=`{id:${(o+1).toString()},`,e+=`width:${n.toString()},`,e+=`height:${i.toString()},`,e+=`file_name:"${this.getFileName(a)}",`,e+="license:0,",e+='date_captured:""}',o!==t.length&&(e+=","),e),""),e+="],",e}generateCocoAnnotation(t,e){let n="annotations:[",i=0;return n+=t.reduce((n,{polygons:o},s)=>(o.length>0&&(i+=1,n+=this.calPolyCoorOriginalImages(t).map(({polygons:t})=>t)[0].reduce((t,n,o)=>{var{coorPt:r,label:l}=n,c=Object(a.b)(n,["coorPt","label"]);t+="{segmentation:[",r.length>0&&(t+="[",t+=r.reduce((t,{x:e,y:n},i)=>(t+=e.toString()+",",t+=""+n.toString(),i!==r.length-1&&(t+=","),t),""),t+="]");const h=this.getPolyBBox(Object.assign({coorPt:r,label:l},c));return h&&(t+="],",t+=`area:${((h.x2-h.x1)*(h.y2-h.y1)).toString()},`,t+=`bbox:[${h.x1.toString()},${h.y1.toString()},${(h.x2-h.x1).toString()},${(h.y2-h.y1).toString()}],`,t+="iscrowd:0,",t+=`id:${i.toString()},`,t+=`image_id:${(s+1).toString()},`,t+=`category_id:${null==e?void 0:e.indexOf(l)}}`),t},"")),n),""),n+="]",n+=",",n}getPolyBBox({coorPt:t}){if(t.length>0){const e={x1:1e7,x2:-1e8,y1:1e7,y2:-1e8};for(const[n,{x:i,y:a}]of t.entries())i<e.x1&&(e.x1=i),i<e.x2&&(e.x2=i),a<e.y1&&(e.y1=a),a<e.y2&&(e.y2=a);return e}return null}generateCocoLicense(){let t="licenses:[{";return t+="id:1,",t+='name:"APACHE LICENSE, VERSION 2.0",',t+='url:"https://www.apache.org/licenses/LICENSE-2.0",',t+="}],",'licenses:[{id:1,name:"APACHE LICENSE, VERSION 2.0",url:"https://www.apache.org/licenses/LICENSE-2.0",}],'}generateCocoCategory(t){let e="categories:[";return t&&(e+=t.reduce((t,e,n)=>(t+='{supercategory:"type",',t+=`id:${n.toString()},`,(t+=`name:"${e}"`)+"},"),"")),e+="]",e}getJsonContent(t){let e="{";return e+=t.reduce((t,{polygons:e,file_size:n,img_path:i},a)=>{const o=this.getFileName(i),s=n>0?n.toString():"";return(t+=this.generateImageString(e,o,s))+"},"},""),e+="}",e}generateImageString(t,e,n){let i=`'${e}':{`;return i+='fileref:"",',i+=`size:"${n}",`,i+=`filename:"${e}",`,i+='base64_img_data:"",',i+="file_attributes:{},",i+=`regions:{${this.generateRegion(t)}}`,i}generateRegion(t){if(t.length>0)return t.reduce((e,{coorPt:n,label:i,region:a,subLabel:o},s)=>{let r="[",l="[";if(n.forEach(({x:t,y:e},i)=>{r+=t.toString(),l+=e.toString(),i===n.length-1?(r+="]",l+="]"):(r+=",",l+=",")},""),e+=s.toString()+":{",e+="shape_attributes:{name:polygon,",e+=`all_points_x:${r},`,e+=`all_points_y:${l}},`,e+=`region_attributes:{${i.trim()}:"${a.trim()}"}`,e+="}",0===o.length);else{e+=",";for(const[t,{label:n,region:i}]of o.entries())e+=`"${n.trim()}":"${i.trim()}"`,e+="},"}return s!==t.length-1&&(e+=","),e},"")}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})();var B=n("x2Se");let j=(()=>{class t{transform(t){return t?window.navigator.platform.startsWith("Mac")||window.navigator.platform.startsWith("Linux")?t.split("/").slice(-1)[0]:t.split("\\").slice(-1)[0]:""}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275pipe=u.Gb({name:"fileNameSlice",type:t,pure:!0}),t})();var E=n("sYmb");function z(t,e){if(1&t&&(u.Kb(0),u.Ib(1,"div",4),u.Mb(2,"label",6),u.oc(3),u.Wb(4,"fileNameSlice"),u.Lb(),u.Jb()),2&t){const t=u.Vb();u.xb(1),u.ac("ngClass",t._onChange.hasAnnotation?"indicator":"no-indicator"),u.xb(2),u.pc(u.Xb(4,2,t._onChange.thumbnailName))}}function D(t,e){1&t&&u.Ib(0,"label",6)}function T(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"label"),u.oc(2),u.Lb(),u.Jb()),2&t){const t=u.Vb(3);u.xb(2),u.rc("",t._onChange.currentThumbnailIndex||0," / ",t._totalUuid,"")}}function N(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"div",8),u.Mb(2,"img",9),u.Tb("click",function(){return u.hc(t),u.Vb().$implicit.onClick()}),u.Wb(3,"translate"),u.Lb(),u.Lb(),u.Mb(4,"div",10),u.mc(5,T,3,2,"ng-container",11),u.Lb(),u.Jb()}if(2&t){const t=u.Vb(),e=t.$implicit,n=t.index,i=u.Vb();u.xb(2),u.ac("src",e.imgPath,u.jc)("alt",e.alt)("title",u.Xb(3,5,e.hoverLabel)),u.yb("data-index",n+e.alt),u.xb(3),u.ac("ngIf",i._onChange&&i._onChange.totalNumThumbnail)}}function R(t,e){if(1&t){const t=u.Nb();u.Mb(0,"div",8),u.Mb(1,"img",9),u.Tb("click",function(){return u.hc(t),u.Vb().$implicit.onClick()}),u.Wb(2,"translate"),u.Lb(),u.Lb()}if(2&t){const t=u.Vb(),e=t.$implicit,n=t.index;u.xb(1),u.ac("src",e.imgPath,u.jc)("alt",e.alt)("title",u.Xb(2,4,e.hoverLabel)),u.yb("data-index",n+e.alt)}}function F(t,e){if(1&t&&(u.Kb(0),u.mc(1,N,6,7,"ng-container",2),u.mc(2,R,3,6,"ng-template",null,7,u.nc),u.Jb()),2&t){const t=e.index,n=u.fc(3);u.xb(1),u.ac("ngIf",0===t)("ngIfElse",n)}}function W(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"div",8),u.Mb(2,"img",9),u.Tb("click",function(){return e.$implicit.onClick()}),u.Wb(3,"translate"),u.Lb(),u.Lb(),u.Jb()),2&t){const t=e.$implicit,n=e.index;u.xb(2),u.ac("src",t.imgPath,u.jc)("alt",t.alt)("title",u.Xb(3,4,t.hoverLabel)),u.yb("data-index",n+t.alt)}}let X=(()=>{class t{constructor(){this._totalUuid=0,this._tabStatus=[],this._onClick=new u.n,this.isTabStillOpen=!0,this.bindImagePath=()=>{this.jsonSchema={logosCenter:[{imgPath:"../../../assets/icons/previous.svg",hoverLabel:"labellingInfo.previous",alt:"Previous",onClick:()=>this.emitParentEvent({thumbnailAction:-1})},{imgPath:"../../../assets/icons/next.svg",hoverLabel:"labellingInfo.next",alt:"Next",onClick:()=>this.emitParentEvent({thumbnailAction:1})}],logosEnd:[{imgPath:"../../../assets/icons/undo.svg",hoverLabel:"labellingInfo.undo",alt:"Undo",onClick:()=>null},{imgPath:"../../../assets/icons/redo.svg",hoverLabel:"labellingInfo.redo",alt:"Redo",onClick:()=>null}]}},this.emitParentEvent=({url:t,thumbnailAction:e})=>{this._onClick.emit({url:t,thumbnailAction:e})}}ngOnInit(){this.bindImagePath()}ngOnChanges(t){if(t._onChange){const{totalNumThumbnail:e}=t._onChange.currentValue;this._onChange.totalNumThumbnail=e,this.bindImagePath()}if(t._tabStatus){this.isTabStillOpen=!1;for(const{closed:t}of this._tabStatus)if(!t){this.isTabStillOpen=!0;break}}}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=u.Bb({type:t,selectors:[["image-labelling-info"]],inputs:{_totalUuid:"_totalUuid",_onChange:"_onChange",_tabStatus:"_tabStatus"},outputs:{_onClick:"_onClick"},features:[u.vb],decls:9,vars:6,consts:[[1,"header-container"],[1,"container-flex-start"],[4,"ngIf","ngIfElse"],["defaultName",""],[3,"ngClass"],[4,"ngFor","ngForOf"],[1,"imageTitle"],["renderOtherIcons",""],[1,"utility-icon-container"],[1,"utility-icon-light",3,"src","alt","title","click"],[1,"totalThumbnail"],[4,"ngIf"]],template:function(t,e){if(1&t&&(u.Mb(0,"div",0),u.Mb(1,"div",1),u.mc(2,z,5,4,"ng-container",2),u.mc(3,D,1,0,"ng-template",null,3,u.nc),u.Lb(),u.Mb(5,"div",4),u.mc(6,F,4,2,"ng-container",5),u.Lb(),u.Mb(7,"div",4),u.mc(8,W,4,6,"ng-container",5),u.Lb(),u.Lb()),2&t){const t=u.fc(4);u.xb(2),u.ac("ngIf",e._onChange.thumbnailName)("ngIfElse",t),u.xb(3),u.ac("ngClass",e.isTabStillOpen?"container-flex-center":"container-flex-center-adjust"),u.xb(1),u.ac("ngForOf",e.jsonSchema.logosCenter),u.xb(1),u.ac("ngClass",e.isTabStillOpen?"container-flex-end":"container-flex-end-adjust"),u.xb(1),u.ac("ngForOf",e.jsonSchema.logosEnd)}},directives:[i.k,i.i,i.j],pipes:[j,E.c],styles:[".header-container[_ngcontent-%COMP%]{min-width:100vw;max-width:100vw;min-height:4vh;max-height:4vh;background:#525353;border-bottom:.0625vw solid hsla(0,0%,100%,.25);display:flex;justify-content:space-between;z-index:1000;position:absolute}.container-flex-start[_ngcontent-%COMP%]{margin-left:3vw}.container-flex-center[_ngcontent-%COMP%], .container-flex-start[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:inherit;max-height:inherit}.container-flex-center[_ngcontent-%COMP%]{margin-left:8vw}.container-flex-end[_ngcontent-%COMP%]{display:flex;margin-right:19vw}.container-flex-center-adjust[_ngcontent-%COMP%]{display:flex;margin-left:2vw;align-items:center;min-height:inherit;max-height:inherit}.container-flex-end-adjust[_ngcontent-%COMP%]{display:flex;margin-right:3vw}.logo-container[_ngcontent-%COMP%]{min-width:2.2vw;max-width:2.2vw}.logo[_ngcontent-%COMP%], .utility-icon-light[_ngcontent-%COMP%]{min-width:1.5vw;max-width:1.5vw;min-height:2.2vh;max-height:2.2vh;padding:.3vw;position:fixed;cursor:pointer}.utility-icon-light[_ngcontent-%COMP%]:active, .utility-icon-light[_ngcontent-%COMP%]:focus{background:#a9a9a9}.position-absolute[_ngcontent-%COMP%]{position:absolute}.utility-icon-container[_ngcontent-%COMP%]{display:flex;min-height:3.5vh;max-height:3.5vh;min-width:2vw;max-width:2vw}.totalThumbnail[_ngcontent-%COMP%]{font-size:1.7vh;padding:.4vw 1vw 0;display:inline-block;color:#fff;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.img-container[_ngcontent-%COMP%]:hover   .img-description[_ngcontent-%COMP%]{visibility:visible;opacity:1}.imageTitle[_ngcontent-%COMP%]{font-size:1.7vh;color:#fff;align-items:center;margin-left:1vw;max-width:20vw;min-width:20vw;position:absolute;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.indicator[_ngcontent-%COMP%]{background-color:#75fe7c}.indicator[_ngcontent-%COMP%], .no-indicator[_ngcontent-%COMP%]{height:1vh;width:.5vw;border-radius:50%;position:aboslute}.no-indicator[_ngcontent-%COMP%]{background-color:#ffba54}.horizontal-line[_ngcontent-%COMP%]{padding:1vh 0;margin:0 1vw;border:.01rem solid #707070}"],changeDetection:0}),t})();var U=n("oSzE"),$=n("DlmY");function Y(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new $.a;++e<n;)this.add(t[e])}Y.prototype.add=Y.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Y.prototype.has=function(t){return this.__data__.has(t)};var V=Y,H=function(t,e){for(var n=-1,i=null==t?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1},Z=function(t,e,n,i,a,o){var s=1&n,r=t.length,l=e.length;if(r!=l&&!(s&&l>r))return!1;var c=o.get(t);if(c&&o.get(e))return c==e;var h=-1,d=!0,u=2&n?new V:void 0;for(o.set(t,e),o.set(e,t);++h<r;){var b=t[h],g=e[h];if(i)var f=s?i(g,b,h,e,t,o):i(b,g,h,t,e,o);if(void 0!==f){if(f)continue;d=!1;break}if(u){if(!H(e,function(t,e){if(!u.has(e)&&(b===t||a(b,t,n,i,o)))return u.push(e)})){d=!1;break}}else if(b!==g&&!a(b,g,n,i,o)){d=!1;break}}return o.delete(t),o.delete(e),d},K=n("ylTp"),J=n("Ce4a"),G=n("YHEm"),q=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t,i){n[++e]=[i,t]}),n},Q=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n},tt=K.a?K.a.prototype:void 0,et=tt?tt.valueOf:void 0,nt=n("TFwu"),it=Object.prototype.hasOwnProperty,at=n("YM6B"),ot=n("/1FC"),st=n("WOAq"),rt=n("oYcn"),lt="[object Object]",ct=Object.prototype.hasOwnProperty,ht=n("EUcb"),dt=function t(e,n,i,a,o){return e===n||(null==e||null==n||!Object(ht.a)(e)&&!Object(ht.a)(n)?e!=e&&n!=n:function(t,e,n,i,a,o){var s=Object(ot.a)(t),r=Object(ot.a)(e),l=s?"[object Array]":Object(at.a)(t),c=r?"[object Array]":Object(at.a)(e),h=(l="[object Arguments]"==l?lt:l)==lt,d=(c="[object Arguments]"==c?lt:c)==lt,u=l==c;if(u&&Object(st.a)(t)){if(!Object(st.a)(e))return!1;s=!0,h=!1}if(u&&!h)return o||(o=new U.a),s||Object(rt.a)(t)?Z(t,e,n,i,a,o):function(t,e,n,i,a,o,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new J.a(t),new J.a(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Object(G.a)(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var r=q;case"[object Set]":if(r||(r=Q),t.size!=e.size&&!(1&i))return!1;var l=s.get(t);if(l)return l==e;i|=2,s.set(t,e);var c=Z(r(t),r(e),i,a,o,s);return s.delete(t),c;case"[object Symbol]":if(et)return et.call(t)==et.call(e)}return!1}(t,e,l,n,i,a,o);if(!(1&n)){var b=h&&ct.call(t,"__wrapped__"),g=d&&ct.call(e,"__wrapped__");if(b||g){var f=b?t.value():t,m=g?e.value():e;return o||(o=new U.a),a(f,m,n,i,o)}}return!!u&&(o||(o=new U.a),function(t,e,n,i,a,o){var s=1&n,r=Object(nt.a)(t),l=r.length;if(l!=Object(nt.a)(e).length&&!s)return!1;for(var c=l;c--;){var h=r[c];if(!(s?h in e:it.call(e,h)))return!1}var d=o.get(t);if(d&&o.get(e))return d==e;var u=!0;o.set(t,e),o.set(e,t);for(var b=s;++c<l;){var g=t[h=r[c]],f=e[h];if(i)var m=s?i(f,g,h,e,t,o):i(g,f,h,t,e,o);if(!(void 0===m?g===f||a(g,f,n,i,o):m)){u=!1;break}b||(b="constructor"==h)}if(u&&!b){var p=t.constructor,_=e.constructor;p==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof p&&p instanceof p&&"function"==typeof _&&_ instanceof _||(u=!1)}return o.delete(t),o.delete(e),u}(t,e,n,i,a,o))}(e,n,i,a,t,o))},ut=function(t,e){return dt(t,e)};function bt(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"img",4),u.Tb("click",function(){u.hc(t);const e=u.Vb(),n=e.index,i=e.$implicit;return u.Vb().getIndex(n),i.onClick()}),u.Wb(2,"translate"),u.Lb(),u.Jb()}if(2&t){const t=u.Vb(),e=t.$implicit,n=t.index,i=u.Vb();u.xb(1),u.ac("ngClass",i.conditionalIconTheme(!(null==e||!e.nonClickable)))("ngStyle",(null==e?null:e.toggleable)&&i.conditionalActiveIcon(n))("src",e.imgPath,u.jc)("alt",e.alt)("title",u.Xb(2,6,e.hoverLabel)),u.yb("data-index",n)}}function gt(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"div",2),u.mc(2,bt,3,8,"ng-container",3),u.Lb(),u.Jb()),2&t){const t=e.$implicit;u.xb(2),u.ac("ngIf",t)}}let ft=(()=>{class t{constructor(t,e){this._imgLabelState=t,this._annotateService=e,this._currentUrl="",this._tabStatus=[],this._navigate=new u.n,this._modalNoLabel=new u.n,this.labelList=[],this.updateLabelList=()=>{this.labelList=this._tabStatus[1].label_list?this._tabStatus[1].label_list:[]},this.resetSelectedAnnotate=()=>{this._annotateService.setState()},this.bindImagePath=()=>{this.jsonSchema={logos:[{imgPath:"../../../assets/icons/separator.svg",hoverLabel:"",alt:"",nonClickable:!0,toggleable:!1,onClick:()=>null},{imgPath:"../../../assets/icons/pointer.svg",hoverLabel:"leftSideBar.pointer",alt:"Pointer",toggleable:!0,onClick:()=>{this.resetSelectedAnnotate(),this._imgLabelState.setState({draw:!1,drag:!0,scroll:!0})}},"/imglabel/bndbox"===this._currentUrl?{imgPath:"../../../assets/icons/rec_bounding_box.svg",hoverLabel:"leftSideBar.rectangularBB",alt:"RectangularBB",toggleable:!0,onClick:()=>{this.resetSelectedAnnotate(),this._imgLabelState.setState({draw:!0,drag:!1,scroll:!1})}}:{imgPath:"../../../assets/icons/polygon.svg",hoverLabel:"leftSideBar.polygon",alt:"Polygon",toggleable:!0,onClick:()=>{0!==this.labelList.length?(this.resetSelectedAnnotate(),this._imgLabelState.setState({draw:!0,drag:!1,scroll:!1})):this.showAlertNoLabel()}},{imgPath:"../../../assets/icons/eraser.svg",hoverLabel:"leftSideBar.eraser",alt:"Eraser",toggleable:!1,onClick:()=>{this.resetSelectedAnnotate(),this._imgLabelState.setState({draw:!1,drag:!1,fitCenter:!1,scroll:!1,clear:!0}),this._imgLabelState.setState(null)}},{imgPath:"../../../assets/icons/fit_center.svg",hoverLabel:"leftSideBar.fitCenter",alt:"Fit Center",toggleable:!1,onClick:()=>{this.resetSelectedAnnotate(),this._imgLabelState.setState({draw:!1,drag:!1,fitCenter:!0,scroll:!1}),this._imgLabelState.setState(null)}},{imgPath:"../../../assets/icons/save.svg",hoverLabel:"leftSideBar.save",alt:"Save",toggleable:!1,onClick:()=>{this.resetSelectedAnnotate(),this._imgLabelState.setState({draw:!1,drag:!1,fitCenter:!1,scroll:!1,clear:!1,save:!0,keyInfo:!1})}},{imgPath:"../../../assets/icons/info.svg",hoverLabel:"leftSideBar.info",alt:"KeyPoint",toggleable:!1,onClick:()=>{this.resetSelectedAnnotate(),this._imgLabelState.setState({draw:!1,drag:!1,fitCenter:!1,scroll:!1,clear:!1,save:!1,keyInfo:!0})}}]}},this.checkStateEqual=(t,e)=>!ut(t,e),this.getIndex=t=>{this.iconIndex=t},this.conditionalIconTheme=t=>t?"plain-icon":"utility-icon-light",this.conditionalActiveIcon=t=>t===this.iconIndex?{background:"rgb(59 59 59)"}:null}ngOnInit(){this.updateLabelList(),this.bindImagePath()}ngOnChanges(t){if(this.bindImagePath(),t._tabStatus&&this.checkStateEqual(t._tabStatus.currentValue,t._tabStatus.previousValue)){const{currentValue:e}=t._tabStatus;this._tabStatus=[...e],this.updateLabelList()}}showAlertNoLabel(){alert("No label exist yet. Please add new label.")}}return t.\u0275fac=function(e){return new(e||t)(u.Hb(M),u.Hb(S))},t.\u0275cmp=u.Bb({type:t,selectors:[["image-labelling-left-sidebar"]],inputs:{_onChange:"_onChange",_currentUrl:"_currentUrl",_tabStatus:"_tabStatus"},outputs:{_navigate:"_navigate",_modalNoLabel:"_modalNoLabel"},features:[u.vb],decls:2,vars:1,consts:[[1,"utility-left-sidebar-container"],[4,"ngFor","ngForOf"],[1,"utility-icon-container"],[4,"ngIf"],[3,"ngClass","ngStyle","src","alt","title","click"]],template:function(t,e){1&t&&(u.Mb(0,"div",0),u.mc(1,gt,3,1,"ng-container",1),u.Lb()),2&t&&(u.xb(1),u.ac("ngForOf",e.jsonSchema.logos))},directives:[i.j,i.k,i.i,i.l],pipes:[E.c],styles:[".utility-left-sidebar-container[_ngcontent-%COMP%]{position:absolute;top:4.5vh;min-width:2.14vw;max-width:2.14vw;min-height:95.4vh;max-height:95.4vh;background:#525353;border:.0625vw solid hsla(0,0%,100%,.25);z-index:1000}.utility-icon-container[_ngcontent-%COMP%]{min-height:5vh;max-height:5vh;align-items:baseline}.utility-icon-light[_ngcontent-%COMP%]{min-width:1.5vw;max-width:1.5vw;min-height:3vh;max-height:3vh;padding:.3vw;position:absolute;cursor:pointer}.utility-icon-light[_ngcontent-%COMP%]:active, .utility-icon-light[_ngcontent-%COMP%]:focus{background:#a9a9a9}.plain-icon[_ngcontent-%COMP%]{min-width:1.5vw;max-width:1.5vw;min-height:3vh;max-height:3vh;padding:.3vw;position:absolute;cursor:auto}"],changeDetection:0}),t})();var mt=n("XIp8");class pt{constructor(){}stringifyObject(t){try{return JSON.stringify(t)}catch(e){return console.log("StringifyObject(content) ----\x3e ",e.name+": ",e.message),""}}deepCloneObject(t){try{return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DeepCloneObject(content) ----\x3e ",e.name+": ",e.message),null}}deepCloneVariable(t){try{const e=t?JSON.parse(JSON.stringify({item:t})):"",{item:n}=e;return n}catch(e){return console.log("DeepCloneVariable(variable) ----\x3e ",e.name+": ",e.message),""}}generateUniquesID(){try{let t="";const e=new Date;return t+=e.getDate().toString(),t+=(e.getMonth()+1).toString(),t+=e.getFullYear().toString(),t+=e.getHours().toString(),t+=e.getMinutes().toString(),t+=e.getSeconds().toString(),t+=e.getMilliseconds().toString(),parseInt(t,10)}catch(t){return console.log("GenerateUniquesID() ----\x3e ",t.name+": ",t.message),-1}}matchStringHead(t,e){try{return e.substr(0,t.length)===t}catch(n){return console.log("MatchStringHead(StrToMatch:string, oristr:string) ----\x3e ",n.name+": ",n.message),!1}}getFilename(t){try{const e=this.deepCloneVariable(t).split("\\").join("/").split("/");return e[e.length-1]}catch(e){return console.log("GetFilename(strs) ----\x3e ",e.name+": ",e.message),""}}GetFoldername(t){try{const e=JSON.parse(JSON.stringify({st:t})).st.split("\\").join("/").split("/");return e.pop(),e.join("/")}catch(e){return console.log("GetFoldername(strs) ----\x3e ",e.name+": ",e.message),""}}RemoveHTMLElement(t){var e;try{const n=document.getElementById(t);null!=n&&(null===(e=n.parentNode)||void 0===e||e.removeChild(n))}catch(n){console.log("RemoveHTMLElement(ids) ----\x3e ",n.name+": ",n.message)}}}let _t=(()=>{class t{constructor(){this.currentArr=[],this.undoArr=[],this.redoArr=[],this.maxStageSize=51,this.allowUndo=!1,this.allowRedo=!1,this.utility=new pt,this.removeLastArray=t=>t.splice(-1,1)[0]}getCurrentArray(){return{undoArr:this.undoArr,redoArr:this.redoArr,curr:this.currentArr}}appendStages(t){t&&(this.redoArr=[],this.allowRedo=!1,0===this.currentArr.length?this.currentArr.push(this.utility.deepCloneVariable(t)):(this.undoArr.length===this.maxStageSize&&this.undoArr.splice(0,1),this.undoArr.push(this.removeLastArray(this.currentArr)),this.currentArr.push(this.utility.deepCloneVariable(t)),this.allowUndo=!0))}clearAllStages(){this.currentArr=[],this.undoArr=[],this.redoArr=[],this.allowUndo=!1,this.allowRedo=!1}undo(){if(this.allowRedo=!0,this.undoArr.length>0){this.redoArr.push(this.removeLastArray(this.currentArr));const t=this.removeLastArray(this.undoArr);return this.currentArr.push(t),this.allowUndo=0!==this.undoArr.length,t}return null}redo(){let t=null;return 0!==this.redoArr.length&&(this.undoArr.push(this.removeLastArray(this.currentArr)),t=this.removeLastArray(this.redoArr),this.currentArr.push(t),this.allowRedo=0!==this.redoArr.length),this.allowUndo=this.undoArr.length>0,t}clearRedundantStages(){var t,e;(null===(t=this.currentArr[0])||void 0===t?void 0:t.meta)&&"polygons"in this.currentArr[0].meta||this.undoArr.length>0&&(!this.isStateChange((null===(e=this.undoArr[this.undoArr.length-1])||void 0===e?void 0:e.meta).bnd_box)||(this.currentArr.pop(),this.currentArr.push(this.removeLastArray(this.undoArr))))}isAllowRedo(){return this.allowRedo}isAllowUndo(){return this.allowUndo}isMethodChange(t){var e;return(null===(e=this.currentArr[0])||void 0===e?void 0:e.method)!==t}replaceStages(t){t&&(this.currentArr[0]=this.utility.deepCloneVariable(t))}isStateChange(t){return!!t&&!!(t&&this.isAnnotationChange(t)||this.isLabelChange(t))}isLabelChange(t){var e,n,i,a;if((null===(e=this.currentArr[0])||void 0===e?void 0:e.meta)&&"polygons"in(null===(n=this.currentArr[0])||void 0===n?void 0:n.meta)){const e=t,n=(null===(i=this.currentArr[0])||void 0===i?void 0:i.meta).polygons;if(e.length!==n.length)return!0;for(const[t,{label:i}]of n.entries());}else{const e=t,n=(null===(a=this.currentArr[0])||void 0===a?void 0:a.meta).bnd_box;if(e.length!==n.length)return!0;for(const[t,{label:i}]of n.entries())if(e[t].label!==i)return!0}return!1}isAnnotationChange(t){var e,n,i,a;if((null===(e=this.currentArr[0])||void 0===e?void 0:e.meta)&&"polygons"in(null===(n=this.currentArr[0])||void 0===n?void 0:n.meta)){if(this.currentArr.length<1)return!0;{const e=t,n=(null===(i=this.currentArr[0])||void 0===i?void 0:i.meta).polygons;return e.length!==n.length||!!n.some(({coorPt:t},n)=>e.some(({coorPt:e},i)=>t[n].x!==e[i].x||t[n].y!==e[i].y))||null}}if(this.currentArr.length<1)return!0;{const e=t,n=(null===(a=this.currentArr[0])||void 0===a?void 0:a.meta).bnd_box;if(e.length!==n.length)return!0;for(const[t,{x1:i,x2:a,y1:o,y2:s,label:r}]of e.entries())if(Math.ceil(i)!==Math.ceil(n[t].x1)||Math.ceil(a)!==Math.ceil(n[t].x2)||Math.ceil(o)!==Math.ceil(n[t].y1)||Math.ceil(s)!==Math.ceil(n[t].y2)||r!==n[t].label)return!0}return!1}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})(),vt=(()=>{class t{constructor(t){this.el=t,this.srcAttr=null,this.canLazyLoad=()=>window&&"IntersectionObserver"in window,this.lazyLoadImage=()=>{new IntersectionObserver(t=>{t.forEach(({isIntersecting:t})=>{t?this.loadImage():this.unloadImage()})}).observe(this.el.nativeElement)},this.loadImage=()=>{this.srcAttr=this.src},this.unloadImage=()=>{this.srcAttr=""}}ngAfterViewInit(){this.canLazyLoad()?this.lazyLoadImage():this.loadImage()}}return t.\u0275fac=function(e){return new(e||t)(u.Hb(u.l))},t.\u0275dir=u.Cb({type:t,selectors:[["img","imgLazyLoad",""]],hostVars:1,hostBindings:function(t,e){2&t&&u.yb("src",e.srcAttr,u.jc)},inputs:{src:"src"}}),t})();var yt=n("3Pt+");const xt=["thumbnailList"],wt=function(t){return{"img-selected":t}};function St(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"div",12),u.Tb("click",function(){u.hc(t);const n=e.$implicit,i=e.index;return u.Vb(4).onClick(n,i)}),u.Mb(2,"div",13),u.Ib(3,"img",14),u.Lb(),u.Mb(4,"div",15),u.Mb(5,"label",16),u.oc(6),u.Wb(7,"fileNameSlice"),u.Lb(),u.Lb(),u.Mb(8,"div",17),u.Mb(9,"img",18),u.Tb("click",function(){u.hc(t);const n=e.$implicit;return u.Vb(4).renameImage(n)}),u.Wb(10,"translate"),u.Lb(),u.Mb(11,"img",19),u.Tb("click",function(){u.hc(t);const n=e.$implicit,i=e.index;return u.Vb(4).deleteImage(n,i)}),u.Wb(12,"translate"),u.Lb(),u.Lb(),u.Mb(13,"div"),u.Ib(14,"div",20),u.Lb(),u.Lb(),u.Jb()}if(2&t){const t=e.$implicit,n=e.index,i=u.Vb(4);u.xb(1),u.ac("ngClass",u.dc(12,wt,n===i._onChange.currentThumbnailIndex-1)),u.xb(2),u.ac("src",t.img_thumbnail,u.jc),u.xb(3),u.pc(u.Xb(7,6,t.img_path)),u.xb(3),u.ac("title",u.Xb(10,8,"renameModal.renameImg")),u.xb(2),u.ac("title",u.Xb(12,10,"Delete Image")),u.xb(3),u.ac("ngClass",(null==t.bnd_box?null:t.bnd_box.length)>0||(null==t.polygons?null:t.polygons.length)>0?"indicator":"no-indicator")}}function Ct(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"div",5),u.Mb(2,"label",6),u.oc(3),u.Wb(4,"translate"),u.Lb(),u.Mb(5,"div",7),u.Mb(6,"span",8),u.Mb(7,"div",9),u.Tb("click",function(){u.hc(t);const e=u.Vb().$implicit;return u.Vb(2).onClose(e)}),u.oc(8,"\u2716"),u.Lb(),u.Lb(),u.Lb(),u.Mb(9,"div",10,11),u.Tb("scroll",function(){return u.hc(t),u.Vb(3).mouseScroll()}),u.mc(11,St,15,14,"ng-container",2),u.Lb(),u.Lb(),u.Jb()}if(2&t){const t=u.Vb(),e=t.$implicit,n=t.index,i=u.Vb(2);u.xb(1),u.ac("ngClass",i.checkCloseToggle(e)),u.yb("data-index",n),u.xb(2),u.sc("",u.Xb(4,6,e.name)," (",i._thumbnailList.length,"/",i._totalUuid,")"),u.xb(8),u.ac("ngForOf",i._thumbnailList)}}function Mt(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"span",32),u.Tb("click",function(){u.hc(t);const e=u.Vb().$implicit;return u.Vb(5).onDeleteLabel(e)}),u.oc(2,"-"),u.Lb(),u.Jb()}if(2&t){const t=u.Vb(6);u.xb(1),u.ac("ngClass",t.clickAbilityToggle?"pointer":null)}}function kt(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"div",27),u.Mb(2,"label",28),u.Mb(3,"div",29),u.Tb("click",function(){u.hc(t);const n=e.$implicit,i=u.Vb(5);return i.clickAbilityToggle?i.onClickLabel(n):null}),u.oc(4),u.Lb(),u.Lb(),u.Mb(5,"label",30),u.mc(6,Mt,3,1,"ng-container",31),u.Lb(),u.Lb(),u.Jb()}if(2&t){const t=e.$implicit,n=u.Vb(5);u.xb(1),u.ac("ngClass",t===n.selectedLabel?"label-active":null),u.xb(2),u.ac("ngClass",n.clickAbilityToggle?"pointer":null),u.xb(1),u.qc(" ",t," "),u.xb(2),u.ac("ngIf",t===n.selectedLabel)}}function Pt(t,e){1&t&&(u.Mb(0,"label",33),u.oc(1),u.Wb(2,"translate"),u.Lb()),2&t&&(u.xb(1),u.qc(" ",u.Xb(2,1,"labellingProject.labelNotExist")," "))}function Ot(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"div",5),u.Mb(2,"label",6),u.oc(3),u.Wb(4,"translate"),u.Lb(),u.Mb(5,"div",7),u.Mb(6,"span",8),u.Mb(7,"div",9),u.Tb("click",function(){u.hc(t);const e=u.Vb(2).$implicit;return u.Vb(2).onClose(e)}),u.oc(8,"\u2716"),u.Lb(),u.Lb(),u.Lb(),u.Mb(9,"div",22),u.Mb(10,"input",23),u.Tb("ngModelChange",function(e){return u.hc(t),u.Vb(4).inputLabel=e})("ngModelChange",function(e){return u.hc(t),u.Vb(4).inputLabelChange(e)})("keydown.enter",function(e){return u.hc(t),u.Vb(4).validateInputLabel(e)}),u.Wb(11,"translate"),u.Lb(),u.Lb(),u.Mb(12,"div",24),u.Mb(13,"div",25),u.mc(14,kt,7,4,"ng-container",2),u.mc(15,Pt,3,3,"label",26),u.Lb(),u.Lb(),u.Lb(),u.Jb()}if(2&t){const t=u.Vb(2),e=t.$implicit,n=t.index,i=u.Vb(2);u.xb(1),u.ac("ngClass",i.checkCloseToggle(e)),u.yb("data-index",n),u.xb(2),u.pc(u.Xb(4,8,e.name)),u.xb(7),u.ac("ngClass",i.invalidInput?"input-invalid":null)("ngModel",i.inputLabel)("placeholder",u.Xb(11,10,"labellingProject.enterLabel")),u.xb(4),u.ac("ngForOf",i.labelList),u.xb(1),u.ac("ngIf",0===i.labelList.length)}}function Lt(t,e){if(1&t){const t=u.Nb();u.Mb(0,"div",39),u.Tb("click",function(){return u.hc(t),u.Vb(9).onDeleteAnnotation()}),u.oc(1," - "),u.Lb()}if(2&t){const t=u.Vb(9);u.ac("ngClass",t.clickAbilityToggle?"pointer":null)}}function It(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"label",37),u.Tb("click",function(){u.hc(t);const n=e.index,i=e.$implicit,a=u.Vb(8);return a.clickAbilityToggle?a.onClickAnnotation(n,i):null}),u.Mb(2,"div",20),u.oc(3),u.Lb(),u.mc(4,Lt,2,1,"div",38),u.Lb(),u.Jb()}if(2&t){const t=e.$implicit,n=e.index,i=u.Vb(8);u.xb(1),u.ac("ngClass",n===i.selectedIndexAnnotation?"annotation-active":null),u.yb("data-index",n),u.xb(1),u.ac("ngClass",i.clickAbilityToggle?"pointer":null),u.xb(1),u.rc(" ",t.label," : ",t.id," "),u.xb(1),u.ac("ngIf",n===i.selectedIndexAnnotation)}}function At(t,e){if(1&t&&(u.Kb(0),u.mc(1,It,5,6,"ng-container",2),u.Jb()),2&t){const t=u.Vb().$implicit;u.xb(1),u.ac("ngForOf",t.bnd_box)}}function Bt(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"label",37),u.Tb("click",function(){u.hc(t);const n=e.index,i=e.$implicit,a=u.Vb(8);return a.clickAbilityToggle?a.onClickAnnotation(n,i):null}),u.Mb(2,"div",20),u.oc(3),u.Lb(),u.Lb(),u.Jb()}if(2&t){const t=e.$implicit,n=e.index,i=u.Vb(8);u.xb(1),u.ac("ngClass",n===i.selectedIndexAnnotation?"annotation-active":null),u.yb("data-index",n),u.xb(1),u.ac("ngClass",i.clickAbilityToggle?"pointer":null),u.xb(1),u.rc(" ",t.label," : ",t.id," ")}}function jt(t,e){if(1&t&&u.mc(0,Bt,4,5,"ng-container",2),2&t){const t=u.Vb().$implicit;u.ac("ngForOf",t.polygons)}}function Et(t,e){if(1&t&&(u.Kb(0),u.mc(1,At,2,1,"ng-container",3),u.mc(2,jt,1,1,"ng-template",null,36,u.nc),u.Jb()),2&t){const t=e.$implicit,n=u.fc(3);u.xb(1),u.ac("ngIf",t.bnd_box)("ngIfElse",n)}}function zt(t,e){if(1&t&&(u.Kb(0),u.mc(1,Et,4,2,"ng-container",2),u.Jb()),2&t){const t=u.Vb(3).$implicit;u.xb(1),u.ac("ngForOf",t.annotation)}}function Dt(t,e){if(1&t){const t=u.Nb();u.Mb(0,"div",5),u.Mb(1,"label",6),u.oc(2),u.Wb(3,"translate"),u.Lb(),u.Mb(4,"div",7),u.Mb(5,"span",8),u.Mb(6,"div",9),u.Tb("click",function(){u.hc(t);const e=u.Vb(2).$implicit;return u.Vb(2).onClose(e)}),u.oc(7,"\u2716"),u.Lb(),u.Lb(),u.Lb(),u.Mb(8,"div",34),u.Mb(9,"div",25),u.Mb(10,"div",35),u.mc(11,zt,2,1,"ng-container",31),u.Lb(),u.Lb(),u.Lb(),u.Lb()}if(2&t){const t=u.Vb(2),e=t.$implicit,n=t.index,i=u.Vb(2);u.ac("ngClass",i.checkCloseToggle(e)),u.yb("data-index",n),u.xb(2),u.pc(u.Xb(3,4,e.name)),u.xb(9),u.ac("ngIf",null==e?null:e.annotation)}}function Tt(t,e){if(1&t&&(u.mc(0,Ot,16,12,"ng-container",3),u.mc(1,Dt,12,6,"ng-template",null,21,u.nc)),2&t){const t=u.fc(2),e=u.Vb().index;u.ac("ngIf",1===e)("ngIfElse",t)}}function Nt(t,e){if(1&t&&(u.Kb(0),u.mc(1,Ct,12,8,"ng-container",3),u.mc(2,Tt,3,2,"ng-template",null,4,u.nc),u.Jb()),2&t){const t=e.index,n=u.fc(3);u.xb(1),u.ac("ngIf",0===t)("ngIfElse",n)}}function Rt(t,e){if(1&t&&(u.Mb(0,"div",1),u.mc(1,Nt,4,2,"ng-container",2),u.Lb()),2&t){const t=u.Vb();u.xb(1),u.ac("ngForOf",t._tabStatus)}}let Ft=(()=>{class t{constructor(t,e,n,i){this._annotateService=t,this._imgLblState=e,this._languageService=n,this._undoRedoService=i,this._totalUuid=0,this._thumbnailList=[],this._tabStatus=[],this._onClose=new u.n,this._onClickThumbnail=new u.n,this._onClickLabel=new u.n,this._onEnterLabel=new u.n,this._onChangeAnnotationLabel=new u.n,this._onDeleteAnnotation=new u.n,this._loadMoreThumbnails=new u.n,this._onRenameImage=new u.n,this._onDeleteImage=new u.n,this.action=-1,this.displayInputLabel=!1,this.inputLabel="",this.selectedIndexAnnotation=-1,this.selectedLabel="",this.unsubscribe$=new l.a,this.clickAbilityToggle=!1,this.invalidInput=!1,this.labelList=[],this.isTabStillOpen=!0,this.tempMax=0,this.max=0,this.updateLabelList=()=>{this.labelList=this._tabStatus[1].label_list?this._tabStatus[1].label_list:[]},this.onClose=t=>{this._onClose.emit({name:t.name,closed:!0})},this.onClick=(t,e)=>{this._onClickThumbnail.emit(Object.assign(Object.assign({},t),{thumbnailIndex:e})),this.selectedIndexAnnotation=-1,this.selectedLabel=""},this.onDisplayInputModal=()=>{this.displayInputLabel=!this.displayInputLabel,this.inputLabel=""},this.validateInputLabel=({target:t})=>{const{value:e}=t,n=e.trim();if(n)if(n.match(/^[a-zA-Z0-9-]*$/))if(this._tabStatus.some(({label_list:t})=>t&&t.length&&t.some(t=>t===n)))this.invalidInput=!0,console.error("Invalid existing label input");else{this.invalidInput=!1;const t=this._tabStatus.map(({label_list:t})=>t||[]).filter(t=>t.length>0)[0];this._onEnterLabel.emit({action:1,label_list:t?[...t,e]:[e]}),this.displayInputLabel=!1,this.inputLabel=""}else this.invalidInput=!0,console.error("Invalid input value")},this.onDeleteLabel=t=>{let e=!1;if(this._thumbnailList.forEach(n=>{n.bnd_box&&n.bnd_box.forEach(n=>{n.label===t&&(e=!0)}),n.polygons&&n.polygons.forEach(n=>{n.label===t&&(e=!0)})}),e)this._languageService._translate.get("labelExist").subscribe(t=>{alert(t)});else{const[{label_list:e}]=this._tabStatus.filter(t=>t.label_list);this._onClickLabel.emit({selectedLabel:t,label_list:e&&e.length>0?e:[],action:0})}},this.onClickLabel=t=>{this.selectedLabel=t,this._onChangeAnnotationLabel.emit({label:t,index:this.selectedIndexAnnotation}),this._undoRedoService.appendStages({meta:this._selectMetadata,method:"draw"})},this.onClickAnnotation=(t,{label:e})=>{this.selectedLabel=e,this._annotateService.setState({annotation:t})},this.onDeleteAnnotation=()=>{this.selectedIndexAnnotation>-1&&(this._onDeleteAnnotation.emit(this.selectedIndexAnnotation),this._selectMetadata.bnd_box.splice(this.selectedIndexAnnotation,1)&&this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}))},this.checkCloseToggle=t=>{let e="";return"labellingProject.label"===t.name&&this._tabStatus[2].closed||"labellingProject.project"===t.name&&this._tabStatus[1].closed&&this._tabStatus[2].closed||"labellingProject.annotation"===t.name||(e="flex-content"),t.closed&&(e+=" closed"),e},this.checkStateEqual=(t,e)=>!ut(t,e)}ngOnInit(){this.updateLabelList(),this._imgLblState.action$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(({draw:t})=>this.clickAbilityToggle=t),this._thumbnailList.length>0&&this._annotateService.labelStaging$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(({annotation:t})=>{var e;this.selectedIndexAnnotation=t;const[{annotation:n}]=this._tabStatus.filter(t=>t.annotation),i=null==n?void 0:n.map(({bnd_box:e,polygons:n})=>e?e.find((e,n)=>n===t):n?n.find((e,n)=>n===t):void 0)[0];this.selectedLabel=null!==(e=null==i?void 0:i.label)&&void 0!==e?e:""})}inputLabelChange(t){var e;this.labelList=this._tabStatus[1].label_list?null===(e=this._tabStatus[1].label_list)||void 0===e?void 0:e.filter(e=>e.includes(t)):[]}ngOnChanges(t){if(t._thumbnailList){const{currentValue:e}=t._thumbnailList;this._thumbnailList=Object.assign([],this._thumbnailList,[...e])}if(t._tabStatus&&this.checkStateEqual(t._tabStatus.currentValue,t._tabStatus.previousValue)){const{currentValue:e}=t._tabStatus;this._tabStatus=[...e],this.updateLabelList(),this.isTabStillOpen=!1;for(const{closed:t}of this._tabStatus)if(!t){this.isTabStillOpen=!0;break}}}openAllTab(){this._tabStatus.forEach(t=>{t.closed=!1})}mouseScroll(){const t=this.thumbnailList.nativeElement.scrollTop+this.thumbnailList.nativeElement.clientHeight;this.max=this.thumbnailList.nativeElement.scrollHeight,t+1500>=this.max&&this.tempMax!==this.max&&(this.tempMax=this.max,this._loadMoreThumbnails.emit())}renameImage(t){this._onRenameImage.emit(t)}deleteImage(t,e){this.onClick(t,e),this._onDeleteImage.emit(t)}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}}return t.\u0275fac=function(e){return new(e||t)(u.Hb(S),u.Hb(M),u.Hb(P.a),u.Hb(_t))},t.\u0275cmp=u.Bb({type:t,selectors:[["image-labelling-project"]],viewQuery:function(t,e){if(1&t&&u.tc(xt,!0),2&t){let t;u.ec(t=u.Ub())&&(e.thumbnailList=t.first)}},hostBindings:function(t,e){1&t&&u.Tb("scroll",function(t){return e.mouseScroll(t)})},inputs:{_onChange:"_onChange",_totalUuid:"_totalUuid",_selectMetadata:"_selectMetadata",_thumbnailList:"_thumbnailList",_tabStatus:"_tabStatus"},outputs:{_onClose:"_onClose",_onClickThumbnail:"_onClickThumbnail",_onClickLabel:"_onClickLabel",_onEnterLabel:"_onEnterLabel",_onChangeAnnotationLabel:"_onChangeAnnotationLabel",_onDeleteAnnotation:"_onDeleteAnnotation",_loadMoreThumbnails:"_loadMoreThumbnails",_onRenameImage:"_onRenameImage",_onDeleteImage:"_onDeleteImage"},features:[u.vb],decls:1,vars:1,consts:[["class","tab-container",4,"ngIf"],[1,"tab-container"],[4,"ngFor","ngForOf"],[4,"ngIf","ngIfElse"],["nonThumbnailTab",""],[1,"utility-right-project-container","tab","flex-fill-remaining",3,"ngClass"],[1,"tab-name"],[1,"flex-tab-icons"],[1,"tab-close-thumbnailless"],[1,"div-close",3,"click"],["id","thumbnailList",1,"utility-inner-container","tab-height","scroll",3,"scroll"],["thumbnailList",""],[1,"img-container",3,"ngClass","click"],[1,"img-skeleton"],["imgLazyLoad","",1,"img",3,"src"],[1,"img-name"],[1,"img-path"],[1,"thumbnail-actions"],["src","../../../assets/icons/last_modify.svg","alt","edit","height","20vh","width","20vw",1,"thumbnail-actions-icon",3,"title","click"],["src","../../../assets/icons/trash.svg","alt","edit","height","20vh","width","20vw",1,"thumbnail-actions-icon",3,"title","click"],[3,"ngClass"],["annotationTab",""],[1,"div-input"],["type","text",1,"input",3,"ngClass","ngModel","placeholder","ngModelChange","keydown.enter"],["id","inner-container",1,"utility-inner-container","tab-height","scroll"],[1,"flex-item"],["class","not-exist",4,"ngIf"],[1,"flex-center-width",3,"ngClass"],[1,"label"],[3,"ngClass","click"],[1,"action"],[4,"ngIf"],[1,"delete-label",3,"ngClass","click"],[1,"not-exist"],["id","inner-container",1,"utility-inner-container","scroll","tab-smaller-height"],[1,"flex-center-width"],["polygon",""],[1,"label",3,"ngClass","click"],["class","delete-annotation",3,"ngClass","click",4,"ngIf"],[1,"delete-annotation",3,"ngClass","click"]],template:function(t,e){1&t&&u.mc(0,Rt,2,1,"div",0),2&t&&u.ac("ngIf",e.isTabStillOpen)},directives:[i.k,i.j,i.i,vt,yt.a,yt.f,yt.i],pipes:[E.c,j],styles:['.tab-container[_ngcontent-%COMP%]{display:flex;flex-flow:column;height:100%;right:0;position:fixed;z-index:1000;min-width:18.5vw;max-width:18.5vw}.utility-right-project-container[_ngcontent-%COMP%]{height:100%;min-width:16.3vw;max-width:16.3vw;background:#383535;border:.0325vw solid hsla(0,0%,100%,.25);border-top:none;z-index:1000;align-items:stretch}.utility-right-project-container[_ngcontent-%COMP%]:after{position:absolute;content:"";top:0;min-width:8.5vw;max-width:8.5vw;min-height:4vh;max-height:4vh;background:#383535;z-index:-1;font-size:1.5vh;line-height:3vh;color:#fff;padding:.5vh 0 0 2vw}.tab[_ngcontent-%COMP%]{position:sticky;overflow:hidden}.tab[_ngcontent-%COMP%]:before{position:absolute;content:"";top:4vh;min-width:100vw;max-width:100vw;min-height:93vh;max-height:93vh;background:#383535;z-index:-1}.flex-fixed[_ngcontent-%COMP%]{flex:0 1 25vh}.flex-fill-remaining[_ngcontent-%COMP%]{flex:1 1 auto}.flex-content[_ngcontent-%COMP%]{display:flex;flex-flow:column;height:33%;min-height:10%;flex-shrink:0;flex-grow:0;resize:vertical}.tab-name[_ngcontent-%COMP%]{font-size:1.7vh;padding:.5vw 2vw 0 1vw;display:inline-block;color:#fff;position:absolute}.tab-close-thumbnail[_ngcontent-%COMP%]{margin-left:3vw;justify-content:center}.tab-close-thumbnail[_ngcontent-%COMP%], .tab-close-thumbnailless[_ngcontent-%COMP%]{float:right;vertical-align:middle;min-height:4vh;max-height:4vh;color:#696969;font-size:1.8vh;line-height:4vh;text-align:center;display:inline-grid;padding-bottom:1vh}.tab-close-thumbnailless[_ngcontent-%COMP%]{flex:1 0 60%;justify-content:right}.div-close[_ngcontent-%COMP%]{margin-right:.5vw;min-width:1.6vw;max-width:1.6vw;min-height:4vh;max-height:4vh;color:#fff;cursor:pointer;text-align:center;float:right}.div-close[_ngcontent-%COMP%]:active{background:grey}.utility-inner-container[_ngcontent-%COMP%]{padding:2.5vh 0 0 .2vw;scroll-behavior:smooth;overflow:hidden auto;z-index:100;min-width:15.5vw;max-width:15.5vw}.tab-height[_ngcontent-%COMP%]{height:85%}.tab-smaller-height[_ngcontent-%COMP%]{height:60%}.scroll[_ngcontent-%COMP%]::-webkit-scrollbar-track{box-shadow:inset 0 0 6px rgba(0,0,0,.3);border-radius:10px;background-color:#000}.scroll[_ngcontent-%COMP%]::-webkit-scrollbar{width:.5vw}.scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{border-radius:10px;box-shadow:inset 0 0 6px rgba(0,0,0,.3);background-color:#525353}.img-container[_ngcontent-%COMP%], .utility-icon-container[_ngcontent-%COMP%]{min-height:5vh;max-height:5vh}.img-container[_ngcontent-%COMP%]{font-size:1.5vh;color:#fff;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;cursor:pointer;margin:0 .3vw;padding:.1vh .4vw}.img-container[_ngcontent-%COMP%]:hover{background-color:#444;border-radius:2px}.img-selected[_ngcontent-%COMP%]{background:#555}.img[_ngcontent-%COMP%]{margin-left:auto;margin-right:auto;display:block}.img[_ngcontent-%COMP%], .img-skeleton[_ngcontent-%COMP%]{max-height:4.3vh;min-height:4.3vh;max-width:3vw}.img-skeleton[_ngcontent-%COMP%]{min-width:3vw;border:.005vh dotted #525353}.img-name[_ngcontent-%COMP%]{margin-left:.5vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.closed[_ngcontent-%COMP%]{display:none}.utility-icon-dark[_ngcontent-%COMP%], .utility-icon-light[_ngcontent-%COMP%]{min-width:1.5vw;max-width:1.5vw;min-height:3vh;max-height:3vh;padding:.3vw;position:absolute}.flex-item[_ngcontent-%COMP%]{align-items:center;flex-direction:column;font-size:1.5vh;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.flex-center-width[_ngcontent-%COMP%], .flex-item[_ngcontent-%COMP%]{display:flex;justify-content:center}.flex-center-width[_ngcontent-%COMP%]{width:90%;flex-wrap:wrap}.label[_ngcontent-%COMP%]{flex:1 1 80%;display:flex;justify-content:flex-start;margin:.25vh 0}.pointer[_ngcontent-%COMP%]{cursor:pointer}.annotation-active[_ngcontent-%COMP%], .label-active[_ngcontent-%COMP%]{border:.15vw solid #ff0}.utility-info-btn[_ngcontent-%COMP%]{font-size:1vw;min-width:0;max-width:0;min-height:2.5vh;max-height:2.5vh;line-height:0;right:21vh;position:absolute;background:#383535;border:none;color:#fff}.flex-tab-icons[_ngcontent-%COMP%]{display:flex;width:100%}.extra-icons[_ngcontent-%COMP%]{cursor:pointer}.extra-icons[_ngcontent-%COMP%]:active{background:grey}.tab-extra-icons[_ngcontent-%COMP%]{float:right;vertical-align:middle;font-size:1.7vh;line-height:4vh;text-align:center;color:#fff;flex:1 0 15%;justify-content:flex-start}.tab-text[_ngcontent-%COMP%]{font-size:1.7vh;min-width:6vw;max-width:6vw}.inner-content[_ngcontent-%COMP%]{max-height:25vh;min-height:25vh;min-width:3vw;max-width:3vw}.div-input[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;margin:.5vh .9vw}.input[_ngcontent-%COMP%]{border-radius:8vw;border:none;outline:none;padding:.3vw 0 .3vw 1vw;min-height:1.5vh;max-height:1.5vh;min-width:13vw;max-width:13vw;font-size:1.3vh;background:#525353;color:#fff}.input-invalid[_ngcontent-%COMP%]{border:.2vw solid red}.img-path[_ngcontent-%COMP%]{margin-top:4vh}.indicator[_ngcontent-%COMP%]{background-color:#75fe7c}.indicator[_ngcontent-%COMP%], .no-indicator[_ngcontent-%COMP%]{height:1vh;width:.5vw;border-radius:50%;position:relative}.no-indicator[_ngcontent-%COMP%]{background-color:#ffba54}.not-exist[_ngcontent-%COMP%]{font-size:1.5vh;color:#999}.delete-annotation[_ngcontent-%COMP%], .delete-label[_ngcontent-%COMP%]{position:absolute;right:2vw}.open-all-tabs[_ngcontent-%COMP%]{cursor:pointer;padding:.2vh .2vw;border-radius:.7vw}.open-all-tabs[_ngcontent-%COMP%]:hover{background:#636363}.open-all-tabs[_ngcontent-%COMP%]:active, .open-all-tabs[_ngcontent-%COMP%]:focus{background:#737474}.tab-skeleton[_ngcontent-%COMP%]{position:absolute;height:100vh;width:16.5vw;background:#525353;border-left:.0625vw solid hsla(0,0%,100%,.25);text-align:center;color:#cac8c8;font-size:2vh}.choose-tab[_ngcontent-%COMP%]{margin-top:42vh}.thumbnail-actions[_ngcontent-%COMP%]{text-align:end;padding-right:1vw;width:10vw}.thumbnail-actions-icon[_ngcontent-%COMP%]{border-radius:50%;padding:.2vh}.thumbnail-actions-icon[_ngcontent-%COMP%]:hover{background:#555}']}),t})();function Wt(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"div",3),u.Mb(2,"label"),u.Mb(3,"img",4),u.Tb("click",function(){return e.$implicit.onClick()}),u.Wb(4,"translate"),u.Lb(),u.Lb(),u.Lb(),u.Jb()),2&t){const t=e.$implicit,n=e.index,i=u.Vb();u.xb(3),u.lc(t.style),u.ac("ngClass",i.conditionalIconTheme())("src",t.imgPath,u.jc)("alt",t.alt)("title",u.Xb(4,7,t.hoverLabel)),u.yb("data-index",n)}}let Xt=(()=>{class t{constructor(){this._onClick=new u.n,this._onExport=new u.n,this._onReload=new u.n,this.bindImagePath=()=>{this.jsonSchema={logos:[{imgPath:"../../../assets/icons/folder.svg",hoverLabel:"rightSideBar.folderOrFiles",alt:"Folder",onClick:()=>{this._onClick.emit({name:"labellingProject.project",closed:!1})}},{imgPath:"../../../assets/icons/tag.svg",hoverLabel:"rightSideBar.label",alt:"Label",onClick:()=>{this._onClick.emit({name:"labellingProject.label",closed:!1})}},{imgPath:"../../../assets/icons/bounding_box.svg",hoverLabel:"rightSideBar.annotation",alt:"Annotation",onClick:()=>{this._onClick.emit({name:"labellingProject.annotation",closed:!1})}},{imgPath:"../../../assets/icons/statistic.svg",hoverLabel:"rightSideBar.statistic",alt:"Statistic",onClick:()=>{}},{imgPath:"../../../assets/icons/export.svg",hoverLabel:"rightSideBar.export",alt:"Export",style:"padding: 1.5vh 0.5vw;",onClick:()=>{this._onExport.emit()}},{imgPath:"../../../assets/icons/reload.svg",hoverLabel:"rightSideBar.reload",alt:"Reload",style:"padding: 1.5vh 0.5vw;",onClick:()=>{this._onReload.emit()}}]}},this.conditionalIconTheme=()=>"utility-icon-light"}ngOnInit(){this.bindImagePath()}ngOnChanges(t){this.bindImagePath()}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=u.Bb({type:t,selectors:[["image-labelling-right-sidebar"]],inputs:{_onChange:"_onChange"},outputs:{_onClick:"_onClick",_onExport:"_onExport",_onReload:"_onReload"},features:[u.vb],decls:3,vars:1,consts:[[1,"utility-right-sidebar-container"],[1,"utility-inner-container"],[4,"ngFor","ngForOf"],[1,"utility-icon-container"],[3,"ngClass","src","alt","title","click"]],template:function(t,e){1&t&&(u.Mb(0,"div",0),u.Mb(1,"div",1),u.mc(2,Wt,5,9,"ng-container",2),u.Lb(),u.Lb()),2&t&&(u.xb(2),u.ac("ngForOf",e.jsonSchema.logos))},directives:[i.j,i.i],pipes:[E.c],styles:[".utility-right-sidebar-container[_ngcontent-%COMP%]{position:absolute;top:4.5vh;min-width:2.2vw;max-width:2.2vw;min-height:95.5vh;max-height:95.5vh;background:#525353;border:.0625vw solid hsla(0,0%,100%,.25);z-index:1000}.utility-inner-container[_ngcontent-%COMP%]{min-width:2.2vw;max-width:2.2vw;position:absolute}.utility-icon-container[_ngcontent-%COMP%], .utility-inner-container[_ngcontent-%COMP%]{min-height:5vh;max-height:5vh}.utility-icon-light[_ngcontent-%COMP%]{min-width:1.5vw;max-width:1.5vw;min-height:3vh;max-height:3vh;padding:.3vw;position:absolute;cursor:pointer}.utility-icon-light[_ngcontent-%COMP%]:active, .utility-icon-light[_ngcontent-%COMP%]:focus{background:#a9a9a9}.input-none[_ngcontent-%COMP%]{display:none}"],changeDetection:0}),t})();function Ut(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"div",4),u.oc(2),u.Wb(3,"translate"),u.Lb(),u.Jb()),2&t){const t=u.Vb(2);u.xb(2),u.rc("",u.Xb(3,2,"footer.image"),": ",t.thumbnailType,"")}}function $t(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"div",2),u.Mb(2,"div",3),u.oc(3),u.Wb(4,"translate"),u.Lb(),u.Mb(5,"div",4),u.oc(6),u.Wb(7,"translate"),u.Lb(),u.mc(8,Ut,4,4,"ng-container",1),u.Mb(9,"div",4),u.oc(10),u.Lb(),u.Mb(11,"div",5),u.Wb(12,"translate"),u.Mb(13,"label",6),u.Tb("click",function(){u.hc(t);const e=u.Vb();return e.copyMessage(e._thumbnailInfo.img_path)}),u.oc(14),u.Lb(),u.Lb(),u.Lb(),u.Jb()}if(2&t){const t=u.Vb();u.xb(3),u.rc(" ",u.Xb(4,9,"footer.projectName"),": ",t._thumbnailInfo.project_name," "),u.xb(3),u.rc("",u.Xb(7,11,"footer.size"),": ",t.thumbnailSize,""),u.xb(2),u.ac("ngIf",t.thumbnailType),u.xb(2),u.rc("",t._thumbnailInfo.img_ori_w," x ",t._thumbnailInfo.img_ori_h,""),u.xb(1),u.ac("title",u.Xb(12,13,"footer.copyToClipboard")),u.xb(3),u.pc(t._thumbnailInfo.img_path)}}let Yt=(()=>{class t{constructor(){this._imgSrc="",this.thumbnailSize="",this.thumbnailType="",this.formatBytes=(t,e=2)=>{if(0===t)return"0 Bytes";const n=e<0?0:e,i=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,i)).toFixed(n))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][i]}}ngOnInit(){}copyMessage(t){const e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}ngOnChanges(t){if(t._thumbnailInfo&&t._imgSrc){const{currentValue:e}=t._thumbnailInfo,{currentValue:n}=t._imgSrc;this._thumbnailInfo=Object.assign(Object.assign({},this._thumbnailInfo),e),this.thumbnailSize=this.formatBytes(n.length);const i=n.match(/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/);if(i&&i.length){const t=i[1].split("/")[1];this.thumbnailType=t}}}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=u.Bb({type:t,selectors:[["image-labelling-footer"]],inputs:{_thumbnailInfo:"_thumbnailInfo",_imgSrc:"_imgSrc"},features:[u.vb],decls:3,vars:3,consts:[[1,"footer-container"],[4,"ngIf"],[1,"footer-label-container"],[1,"footer-label","footer-project-name"],[1,"footer-label"],[1,"footer-image-path",3,"title"],[1,"footer-path-label",3,"click"]],template:function(t,e){1&t&&(u.Mb(0,"div",0),u.mc(1,$t,15,15,"ng-container",1),u.Wb(2,"json"),u.Lb()),2&t&&(u.xb(1),u.ac("ngIf","{}"!=u.Xb(2,1,e._thumbnailInfo)))},directives:[i.k],pipes:[i.e,E.c],styles:[".footer-container[_ngcontent-%COMP%]{position:absolute;background:#525353;border:.0625vw solid hsla(0,0%,100%,.25);min-height:2.3vh;max-height:2.3vh;min-width:100vw;max-width:100vw;bottom:0;padding-left:2.5vw}.footer-label-container[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:baseline;width:80%}.footer-label[_ngcontent-%COMP%]{font-size:1.6vh;color:#fff;outline:none;border-right:.05vw solid #fff;padding:0 1vw;text-align:left}.footer-project-name[_ngcontent-%COMP%]{max-width:20vw}.footer-image-path[_ngcontent-%COMP%], .footer-project-name[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.footer-image-path[_ngcontent-%COMP%]{display:flex;font-size:1.6vh;color:#fff;outline:none;border-right:.05vw solid #fff;padding:0 1vw}.border-right[_ngcontent-%COMP%]{border-right:1rem #fff}.utility-icon-container[_ngcontent-%COMP%]{min-height:5vh;max-height:5vh;align-items:baseline}.utility-icon-light[_ngcontent-%COMP%]{min-width:1.5vw;max-width:1.5vw;min-height:1.5vh;max-height:1.5vh;padding:0;position:absolute;cursor:context-menu}.footer-path-label[_ngcontent-%COMP%]{cursor:pointer;padding:0 .2vw;border-radius:.5vw}.footer-path-label[_ngcontent-%COMP%]:hover{background:#636363}.footer-path-label[_ngcontent-%COMP%]:active, .footer-path-label[_ngcontent-%COMP%]:focus{background:#737474}"],changeDetection:0}),t})();var Vt=n("44N4"),Ht=n("OObL"),Zt=n("TJKd");function Kt(t,e){if(1&t&&(u.Mb(0,"span"),u.oc(1),u.Lb()),2&t){const t=u.Vb(2);u.xb(1),u.qc("Zipping ",t._processingNum," file")}}function Jt(t,e){1&t&&(u.Mb(0,"span"),u.oc(1,"Done"),u.Lb())}function Gt(t,e){1&t&&u.Ib(0,"div",5)}function qt(t,e){1&t&&(u.Mb(0,"div",6),u.oc(1,"\u2714"),u.Lb())}function Qt(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"div",1),u.Mb(2,"div",2),u.mc(3,Kt,2,1,"span",0),u.mc(4,Jt,2,0,"span",0),u.Lb(),u.mc(5,Gt,1,0,"div",3),u.mc(6,qt,2,0,"div",4),u.Lb(),u.Jb()),2&t){const t=u.Vb();u.xb(3),u.ac("ngIf",t._processingNum>0),u.xb(1),u.ac("ngIf",0===t._processingNum),u.xb(1),u.ac("ngIf",t._processingNum>0),u.xb(1),u.ac("ngIf",0===t._processingNum)}}let te=(()=>{class t{constructor(){this._processingNum=0,this.doneProcess=!1}ngOnInit(){}delay(t){return new Promise(e=>setTimeout(e,t))}ngOnChanges(t){return Object(a.a)(this,void 0,void 0,function*(){t._processingNum&&(console.log(t._processingNum),1===t._processingNum.previousValue&&0===t._processingNum.currentValue&&(this.doneProcess=!0,yield this.delay(1e3),this.doneProcess=!1))})}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=u.Bb({type:t,selectors:[["toastr"]],inputs:{_processingNum:"_processingNum"},features:[u.vb],decls:1,vars:1,consts:[[4,"ngIf"],[1,"toastr"],[1,"text"],["class","loader",4,"ngIf"],["class","done",4,"ngIf"],[1,"loader"],[1,"done"]],template:function(t,e){1&t&&u.mc(0,Qt,7,4,"ng-container",0),2&t&&u.ac("ngIf",e._processingNum>0||e.doneProcess)},directives:[i.k],styles:[".toastr[_ngcontent-%COMP%]{position:absolute;z-index:10000;background:#262a2e;border-radius:1vh;color:#fff;bottom:5vh;right:5vw;padding:2vh 2vw;display:flex;justify-content:center}.text[_ngcontent-%COMP%]{margin:auto 1vw auto auto;font-size:2vh}.loader[_ngcontent-%COMP%]{border-radius:50%;border:.5vh solid #f3f3f3;border-top-color:#de1c44;width:2vh;height:2vh;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}.done[_ngcontent-%COMP%]{color:#92c91b;font-size:2vh}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}"]}),t})();var ee=n("CfRg"),ne=function(t){return Object(ee.a)(t,4)};let ie=(()=>{class t{constructor(){this.globalXY={x:0,y:0},this.panXY={x:0,y:0},this.currentClickedBox={box:-1,pos:"o"},this.lineOffset=3,this.anchrSize=2.5,this.currentDrawing={x1:0,x2:0,y1:0,y2:0},this.currentSelectedBndBox=-1,this.util=new pt}getDiffXY({offsetX:t,offsetY:e}){try{const n={diffX:0,diffY:0};return n.diffX=this.globalXY.x+(t-this.panXY.x),n.diffY=this.globalXY.y+(e-this.panXY.y),n}catch(n){return console.log("ObjectDetection getDiffXY(offsetX: number,offsetY: number): { diffX: number; diffY: number }",n.name+": ",n.message),{diffX:-1,diffY:-1}}}setCurrentX1Y1(t,e){try{null!==t&&null!==e&&void 0!==t&&void 0!==e&&(this.currentDrawing.x1=t,this.currentDrawing.y1=e)}catch(n){console.log("ObjectDetection setCurrentX1Y1(MouseX:number, MouseY:number):void",n.name+": ",n.message)}}setCurrentX2Y2(t,e){try{null!==t&&null!==e&&void 0!==t&&void 0!==e&&(this.currentDrawing.x2=t,this.currentDrawing.y2=e)}catch(n){console.log("ObjectDetection setCurrentX2Y2(MouseX:number, MouseY:number):void",n.name+": ",n.message)}}moveAllBbox(t,e,n,i){try{for(const i of t){const t=i.x2-i.x1,a=i.y2-i.y1;i.x1=ne(e+i.distancetoImg.x),i.y1=ne(n+i.distancetoImg.y),i.x2=ne(i.x1+t),i.y2=ne(i.y1+a)}i&&i(!0)}catch(a){}}calScaleTofitScreen(t,e,n,i){try{const a={factor:-1,newX:-1,newY:-1};return a.factor=Math.min(n/t,i/e),a.factor=a.factor-.05*a.factor,a.newX=n/2-t/2*a.factor,a.newY=i/2-e/2*a.factor,a}catch(a){return{factor:-1,newX:-1,newY:-1}}}deleteSingleBox(t,e,n){try{t.splice(e,1),this.currentSelectedBndBox=-1,this.currentClickedBox={box:-1,pos:"o"},n(!0)}catch(i){}}keyboardMoveBox(t,e,{img_w:n,img_h:i,img_x:a,img_y:o},s){try{switch(t){case"up":this.moveBoxWithinPointPath(a,o,n,i,0,-3,e)&&(e.y1-=3,e.y2-=3);break;case"down":this.moveBoxWithinPointPath(a,o,n,i,0,3,e)&&(e.y1+=3,e.y2+=3);break;case"left":this.moveBoxWithinPointPath(a,o,n,i,-3,0,e)&&(e.x1-=3,e.x2-=3);break;case"right":this.moveBoxWithinPointPath(a,o,n,i,3,0,e)&&(e.x1+=3,e.x2+=3)}s(!0)}catch(r){}}moveBoxWithinPointPath(t,e,n,i,a,o,s){try{return!(s.x1+a<t||s.x2+a>t+n||s.y1+o<e||s.y2+o>e+i)}catch(r){return console.log("ObjectDetection isWithinPointPath(imgx:number, imgy:number, imgw:number, imgh:number, addx:number, addy:number, box:Boundingbox):Boolean",r.name+": ",r.message),!1}}mouseMoveBox(t,e,n){try{if(this.moveBoxWithinPointPath(n.img_x,n.img_y,n.img_w,n.img_h,t-this.currentDrawing.x1,e-this.currentDrawing.y1,n.bnd_box[this.currentSelectedBndBox])){this.setCurrentX2Y2(t,e);const i=this.currentDrawing.x2-this.currentDrawing.x1,a=this.currentDrawing.y2-this.currentDrawing.y1;this.setCurrentX1Y1(this.currentDrawing.x2,this.currentDrawing.y2),"i"!==this.currentClickedBox.pos&&"tl"!==this.currentClickedBox.pos&&"l"!==this.currentClickedBox.pos&&"bl"!==this.currentClickedBox.pos||(n.bnd_box[this.currentSelectedBndBox].x1+=i),"i"!==this.currentClickedBox.pos&&"tl"!==this.currentClickedBox.pos&&"t"!==this.currentClickedBox.pos&&"tr"!==this.currentClickedBox.pos||(n.bnd_box[this.currentSelectedBndBox].y1+=a),"i"!==this.currentClickedBox.pos&&"tr"!==this.currentClickedBox.pos&&"r"!==this.currentClickedBox.pos&&"br"!==this.currentClickedBox.pos||(n.bnd_box[this.currentSelectedBndBox].x2+=i),"i"!==this.currentClickedBox.pos&&"bl"!==this.currentClickedBox.pos&&"b"!==this.currentClickedBox.pos&&"br"!==this.currentClickedBox.pos||(n.bnd_box[this.currentSelectedBndBox].y2+=a)}}catch(i){console.log("ObjectDetection mouseMoveBox(MouseX:number, MouseY:number, CurrMeta:Metadata):void",i.name+": ",i.message)}}getCurrentSelectedBox(){try{return this.currentSelectedBndBox}catch(t){return-1}}setCurrentSelectedbBox(t){try{this.currentSelectedBndBox=t}catch(e){console.log("ObjectDetection setCurrentSelectedbBox(newNUM:number):void",e.name+": ",e.message)}}mouseUpDrawEnable(t,e,n){try{const i={selBox:-1,isNew:!1};if(-1===this.currentClickedBox.box&&null!==this.tmpbox)t.bnd_box.push(this.tmpbox),this.currentSelectedBndBox=t.bnd_box.length-1,t.bnd_box[this.currentSelectedBndBox].label=e.length>0?e[0].name:"",i.isNew=!0,i.selBox=ne(this.currentSelectedBndBox);else if(this.currentClickedBox.box>-1&&this.tmpbox){if(t.bnd_box[this.currentSelectedBndBox].x1>t.bnd_box[this.currentSelectedBndBox].x2){const e=ne(t.bnd_box[this.currentSelectedBndBox].x1);t.bnd_box[this.currentSelectedBndBox].x1=ne(t.bnd_box[this.currentSelectedBndBox].x2),t.bnd_box[this.currentSelectedBndBox].x2=e}if(t.bnd_box[this.currentSelectedBndBox].y1>t.bnd_box[this.currentSelectedBndBox].y2){const e=ne(t.bnd_box[this.currentSelectedBndBox].y1);t.bnd_box[this.currentSelectedBndBox].y1=ne(t.bnd_box[this.currentSelectedBndBox].y2),t.bnd_box[this.currentSelectedBndBox].y2=e}}return this.currentClickedBox={box:-1,pos:"o"},this.setCurrentX1Y1(0,0),this.setCurrentX2Y2(0,0),this.tmpbox=null,n(!0),i}catch(i){return console.log("ObjectDetection MouseUpDrawEnable(CurrMeta: Metadata): number",i.name+": ",i.message),{selBox:-1,isNew:!1}}}panRectangle(t,e,n,i){try{for(const i of t){const t=i.x2-i.x1,a=i.y2-i.y1;i.x1=e+i.distancetoImg.x,i.y1=n+i.distancetoImg.y,i.x2=i.x1+t,i.y2=i.y1+a}i(!0)}catch(a){console.log("ObjectDetection panRectangle(bbox:Boundingbox[], img_X:number, img_Y:number)",a.name+": ",a.message)}}scaleAllBoxes(t,e,n,i,a){try{for(const a of e){const e=a.distancetoImg.x*t+n,o=a.distancetoImg.y*t+i,s=e+(a.x2-a.x1)*t,r=o+(a.y2-a.y1)*t;a.x1=ne(e),a.y1=ne(o),a.x2=ne(s),a.y2=ne(r);const l=a.y1-i;a.distancetoImg.x=ne(a.x1-n),a.distancetoImg.y=ne(l)}a&&a(!0)}catch(o){console.log("ObjectDetection scaleAllBoxes(scalefactor: number,boxes:Boundingbox[],imgX:number,imgY:number)",o.name+": ",o.message)}}mouseMoveDrawEnable(t,e,n){try{-1===this.currentClickedBox.box?this.setCurrentX2Y2(t,e):this.mouseMoveBox(t,e,n)}catch(i){console.log("ObjectDetection MouseMoveDrawEnable(MouseX: number,MouseY: number,SelectedMeta: Metadata): void",i.name+": ",i.message)}}mouseDownDrawEnable(t,e,n){try{return this.getCurrentClickBox(t,e,n),this.setCurrentX1Y1(t,e),this.setCurrentX2Y2(t,e),this.currentSelectedBndBox=-1!==this.currentClickedBox.box?this.currentClickedBox.box:-1,this.currentClickedBox.box}catch(i){return console.log("ObjectDetection MouseDownDrawEnable(MouseX:number,MouseY:number,BBox:Boundingbox[]):number",i.name+": ",i.message),-1}}setPanXY(t,e){try{return!(!t||!e||(this.panXY.x=t,this.panXY.y=e,0))}catch(n){return console.log("ObjectDetection setPanXY(newX: number, newY: number):boolean",n.name+": ",n.message),!1}}setGlobalXY(t,e){try{return!(!t||!e||(this.globalXY.x=t,this.globalXY.y=e,0))}catch(n){return console.log("ObjectDetection SetGlobalXY(newX: number, newY: number):boolean",n.name+": ",n.message),!1}}changeLabel(t,e){t&&e&&(t.label=e)}mouseClickWithinPointPath({img_x:t,img_y:e,img_w:n,img_h:i},{offsetX:a,offsetY:o}){try{return a>t&&a<t+n&&o>e&&o<e+i}catch(s){return console.log(s),!1}}drawAllBoxOn(t,e,n){try{if(e.length>0)for(const[i,a]of e.entries())i===this.currentClickedBox.box||i===this.currentSelectedBndBox?(a.color="rgba(0,255,0,1.0)",a.lineWidth=2,this.drawEachBoxOn(t,a,n,!0)):(a.color="rgba(255,255,0,0.8)",a.lineWidth=1,this.drawEachBoxOn(t,a,n,!1));if(-1===this.currentClickedBox.box&&-1===this.currentSelectedBndBox){for(const r of e)r.color="rgba(255,255,0,0.8)",this.drawEachBoxOn(t,r,n,!1);const{x1:i,x2:a,y1:o,y2:s}=this.currentDrawing;this.tmpbox=this.generateNewBox(i,a,o,s),this.tmpbox&&this.drawEachBoxOn(t,this.tmpbox,n,!0)}}catch(i){console.log("redraw(boundbox) ----\x3e ",i.name+": ",i.message)}}drawEachBoxOn(t,e,n,i){try{if(n){const a=e.x1+(e.x2-e.x1)/2,o=e.y1+(e.y2-e.y1)/2;n.strokeStyle="white",n.fillStyle="black",n.font="bold 12px Arial",""==e.label?(n.strokeText("",e.x1+10,e.y1+15),n.fillText("",e.x1+10,e.y1+15)):t.find(t=>t.name===e.label)?(n.strokeText(e.label,e.x1+10,e.y1+15),n.fillText(e.label,e.x1+10,e.y1+15)):(n.strokeText("Text",e.x1+10,e.y1+15),n.fillText("Text",e.x1+10,e.y1+15)),n.strokeStyle=e.color,n.beginPath(),n.rect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),n.lineWidth=e.lineWidth,n.stroke(),n.fillStyle=e.color,i&&(n.beginPath(),n.fillRect(e.x1-this.anchrSize,e.y1-this.anchrSize,2*this.anchrSize,2*this.anchrSize),n.fillRect(e.x1-this.anchrSize,o-this.anchrSize,2*this.anchrSize,2*this.anchrSize),n.fillRect(e.x1-this.anchrSize,e.y2-this.anchrSize,2*this.anchrSize,2*this.anchrSize),n.fillRect(a-this.anchrSize,e.y1-this.anchrSize,2*this.anchrSize,2*this.anchrSize),n.fillRect(a-this.anchrSize,o-this.anchrSize,2*this.anchrSize,2*this.anchrSize),n.fillRect(a-this.anchrSize,e.y2-this.anchrSize,2*this.anchrSize,2*this.anchrSize),n.fillRect(e.x2-this.anchrSize,e.y1-this.anchrSize,2*this.anchrSize,2*this.anchrSize),n.fillRect(e.x2-this.anchrSize,o-this.anchrSize,2*this.anchrSize,2*this.anchrSize),n.fillRect(e.x2-this.anchrSize,e.y2-this.anchrSize,2*this.anchrSize,2*this.anchrSize))}}catch(a){console.log("ObjectDetection drawEachBoxOn(box:Boundingbox, context:CanvasRenderingContext2D, isSelected:boolean):void",a.name+": ",a.message)}}generateNewBox(t,e,n,i){try{const a=t<e?t:e,o=n<i?n:i,s=t>e?t:e,r=n>i?n:i;return s-a>this.lineOffset&&r-o>this.lineOffset?{x1:a,y1:o,x2:s,y2:r,lineWidth:2,color:"rgba(0,255,0,1.0)",distancetoImg:{x:0,y:0},label:"",id:this.util.generateUniquesID()}:null}catch(a){return console.log("ObjectDetection GenerateNewBox(x1:number,x2:number,y1:number,y2:number):Boundingbox",a.name+": ",a.message),null}}getBBoxDistfromImg(t,e,n){try{for(const{x1:i,y1:a,distancetoImg:o}of t){const t=a-n;o.x=ne(i-e),o.y=ne(t)}}catch(i){console.log("ObjectDetection GetBBoxDistfromImg(bbox:Boundingbox[],imgX:number,imgY:number)",i.name+": ",i.message)}}getCurrentClickBox(t,e,n){try{return this.currentClickedBox=this.mouseClickOnBoxes(t,e,n),this.currentClickedBox}catch(i){return console.log("ObjectDetection getCurrentClickBox(MouseX:number, MouseY:number, box:Boundingbox[]):{box:number,pos:string}",i.name+": ",i.message),{box:-1,pos:"o"}}}mouseClickOnBoxes(t,e,n){try{for(let i=0;i<n.length;++i){const a=n[i].x1+(n[i].x2-n[i].x1)/2,o=n[i].y1+(n[i].y2-n[i].y1)/2;if(n[i].x1-this.lineOffset<t&&t<n[i].x1+this.lineOffset){if(n[i].y1-this.lineOffset<e&&e<n[i].y1+this.lineOffset)return{box:i,pos:"tl"};if(n[i].y2-this.lineOffset<e&&e<n[i].y2+this.lineOffset)return{box:i,pos:"bl"};if(o-this.lineOffset<e&&e<o+this.lineOffset)return{box:i,pos:"l"}}else if(n[i].x2-this.lineOffset<t&&t<n[i].x2+this.lineOffset){if(n[i].y1-this.lineOffset<e&&e<n[i].y1+this.lineOffset)return{box:i,pos:"tr"};if(n[i].y2-this.lineOffset<e&&e<n[i].y2+this.lineOffset)return{box:i,pos:"br"};if(o-this.lineOffset<e&&e<o+this.lineOffset)return{box:i,pos:"r"}}else if(a-this.lineOffset<t&&t<a+this.lineOffset){if(n[i].y1-this.lineOffset<e&&e<n[i].y1+this.lineOffset)return{box:i,pos:"t"};if(n[i].y2-this.lineOffset<e&&e<n[i].y2+this.lineOffset)return{box:i,pos:"b"};if(n[i].y1-this.lineOffset<e&&e<n[i].y2+this.lineOffset)return{box:i,pos:"i"}}else if(n[i].x1-this.lineOffset<t&&t<n[i].x2+this.lineOffset&&n[i].y1-this.lineOffset<e&&e<n[i].y2+this.lineOffset)return{box:i,pos:"i"}}return{box:-1,pos:"o"}}catch(i){return console.log("ObjectDetection mouseClickOnBoxes(MouseX:number, MouseY:number, box:Boundingbox[]):{box:number,pos:string}",i.name+": ",i.message),{box:-1,pos:"o"}}}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})(),ae=(()=>{class t{constructor(){this.MEMO=null,this.utility=new pt}copy(t){this.MEMO=this.utility.deepCloneVariable(t)}paste(){return this.MEMO?"coorPt"in this.MEMO?this.polygonPaste():this.boundingBoxPaste():null}isAvailable(){return!!this.MEMO}clear(){this.MEMO=null}polygonPaste(){const t=this.utility.deepCloneObject(this.MEMO);let{coorPt:e,id:n}=t;for(const i of e)i.x+=8,i.y+=8,i.distancetoImg.x=0,i.distancetoImg.y=0;return n=this.utility.generateUniquesID(),t}boundingBoxPaste(){const t=this.utility.deepCloneObject(this.MEMO),e=t.x2-t.x1,n=t.y2-t.y1;return t.x1+=8,t.y1+=8,t.x2=t.x1+e,t.y2=t.y1+n,t.id=this.utility.generateUniquesID(),t.distancetoImg.x=0,t.distancetoImg.y=0,t}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})();const oe={scale:1,factor:.05,max_scale:4};let se=(()=>{class t{constructor(){this.zoomSubject=new x.a(oe),this.zoom$=this.zoomSubject.asObservable(),this.setState=t=>{this.zoomSubject.next(t?Object.assign(Object.assign({},oe),t):oe)}}resetZoomScale(){this.zoomSubject.next(oe)}calculateZoomScale(t,e,n){let{scale:i}=e;const{factor:a,max_scale:o}=e;let s=t.wheelDelta;void 0===s&&(s=t.detail),s=Math.max(-1,Math.min(1,s));const{scrollLeft:r,scrollTop:l}=n,c=(t.pageX+r)/i,h=(t.pageY+l)/i;return i+=s*a*i,i=Math.max(1,Math.min(o,i)),Object.assign(Object.assign({},{x:c*i-t.pageX,y:h*i-t.pageY}),{scale:i})}validateZoomScale({canvas:{style:{transform:t}}},e){return t!==`scale(${e}, ${e})`}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})();const re={move:!1,pointer:!1,grab:!1,grabbing:!1,crosshair:!1,"zoom-in":!1,"zoom-out":!1,"n-resize":!1,"w-resize":!1,"ne-resize":!1,"nw-resize":!1,"se-resize":!1,"sw-resize":!1};let le=(()=>{class t{constructor(){this.mouseCursorSubject=new x.a(re),this.mouseCursor$=this.mouseCursorSubject.asObservable(),this.setState=t=>{this.mouseCursorSubject.next(t?Object.assign(Object.assign({},re),t):re)}}changeCursor(t,e){if(e){const{wheelDelta:t,detail:n}=e;void 0!==t?150===t?this.setState({"zoom-in":!0}):-150===t&&this.setState({"zoom-out":!0}):3===n?this.setState({"zoom-in":!0}):-3===n&&this.setState({"zoom-out":!0})}else for(const[n,i]of Object.entries(t))if(!0===i)return n}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})();const ce=["canvasdrawing"],he=["floatdiv"],de=["lbltypetxt"],ue=["availablelbl"];function be(t,e){if(1&t){const t=u.Nb();u.Mb(0,"li",12),u.Tb("click",function(){u.hc(t);const n=e.$implicit;return u.Vb().labelNameClicked(n.name)}),u.Mb(1,"span",13),u.oc(2),u.Lb(),u.Mb(3,"span",14),u.oc(4),u.Lb(),u.Lb()}if(2&t){const t=e.$implicit;u.xb(2),u.pc(t.name),u.xb(2),u.pc(t.count)}}function ge(t,e){1&t&&(u.Mb(0,"li",15),u.Mb(1,"div",16),u.oc(2),u.Wb(3,"translate"),u.Lb(),u.Mb(4,"div",16),u.oc(5),u.Wb(6,"translate"),u.Lb(),u.Lb()),2&t&&(u.xb(2),u.pc(u.Xb(3,2,"searchLabel.labelNotExist")),u.xb(3),u.pc(u.Xb(6,4,"searchLabel.enterToAdd")))}const fe=function(){return{standalone:!0}},me=function(t){return{cursor:t}};let pe=(()=>{class t{constructor(t,e,n,i,a,o,s,r){this._ref=t,this._boundingBoxCanvas=e,this._imgLblStateService=n,this._undoRedoService=i,this._copyPasteService=a,this._annotateSelectState=o,this._zoomService=s,this._mouseCursorService=r,this.image=new Image,this.mousedown=!1,this.unsubscribe$=new l.a,this.labelSearch="",this.labelList=[],this.allLabelList=[],this.showDropdownLabelBox=!1,this.invalidInput=!1,this.closeEnough=5,this._imgSrc="",this._tabStatus=[],this._onChangeMetadata=new u.n,this._onChangeAnnotationLabel=new u.n,this._onEnterLabel=new u.n,this.validateInputLabel=({target:t})=>{const{value:e}=t,n=e.trim();n&&(this._tabStatus.some(({label_list:t})=>t&&t.length&&t.some(t=>t===n))?(this.invalidInput=!0,console.error("Invalid existing label input")):(this.invalidInput=!1,this.showDropdownLabelBox=!1,this._onChangeAnnotationLabel.emit({label:e,index:this.annotateState.annotation}),this._selectMetadata.bnd_box[this.annotateState.annotation].label=e,this._undoRedoService.isStateChange(this._selectMetadata.bnd_box)&&this._undoRedoService.appendStages({meta:this._selectMetadata,method:"draw"}),this.labelSearch=""))}}ngOnInit(){this.getLabelList(),this._imgLblStateService.action$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(t=>{var{clear:e,fitCenter:n}=t,i=Object(a.b)(t,["clear","fitCenter"]);(e||n||i.drag||i.draw||i.save||i.keyInfo)&&(this.showDropdownLabelBox=!1,this._ref.detectChanges()),this.boundingBoxState=Object.assign(Object.assign({},i),{clear:e,fitCenter:n}),n&&this.imgFitToCenter(),e&&(this._selectMetadata.bnd_box=[],this._undoRedoService.appendStages({meta:this._selectMetadata,method:"draw"}),this.redrawImage(this._selectMetadata),this.emitMetadata())}),this._annotateSelectState.labelStaging$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(t=>{this.annotateState=t,this._boundingBoxCanvas.setCurrentSelectedbBox(t.annotation),this._selectMetadata&&this.redrawImage(this._selectMetadata)}),this._zoomService.zoom$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(t=>this.zoom=t),this._mouseCursorService.mouseCursor$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(t=>this.mouseCursor=t)}ngOnChanges(t){var e,n,i;if((null===(e=t._selectMetadata)||void 0===e?void 0:e.previousValue)&&(null===(n=t._selectMetadata)||void 0===n?void 0:n.currentValue)&&this.redrawImage(this._selectMetadata),(null===(i=t._imgSrc)||void 0===i?void 0:i.currentValue)&&(this.initializeCanvas(),this._undoRedoService.clearAllStages(),this.loadImage(t._imgSrc.currentValue),this._boundingBoxCanvas.setCurrentSelectedbBox(-1)),t._tabStatus){let t=!0;for(const{closed:e}of this._tabStatus)if(!e){t=!1;break}this.canvas&&(!0===t?(this.initializeCanvas("96%"),this.imgFitToCenter()):this.redrawImage(this._selectMetadata))}}initializeCanvas(t="80%"){this.canvas.nativeElement.style.width=t,this.canvas.nativeElement.style.height="90%",this.canvas.nativeElement.width=this.canvas.nativeElement.offsetWidth,this.canvas.nativeElement.height=this.canvas.nativeElement.offsetHeight,this.canvasContext=this.canvas.nativeElement.getContext("2d")}emitMetadata(){this._onChangeMetadata.emit(this._selectMetadata)}annotateSelectChange(t){this._annotateSelectState.setState(t)}resetZoom(){this._zoomService.resetZoomScale()}imgFitToCenter(){try{const t=this._boundingBoxCanvas.calScaleTofitScreen(this._selectMetadata.img_w,this._selectMetadata.img_h,this.canvas.nativeElement.offsetWidth,this.canvas.nativeElement.offsetHeight);this._selectMetadata.img_w*=t.factor,this._selectMetadata.img_h*=t.factor,this._boundingBoxCanvas.scaleAllBoxes(t.factor,this._selectMetadata.bnd_box,this._selectMetadata.img_x,this._selectMetadata.img_y),this._selectMetadata.img_x=t.newX,this._selectMetadata.img_y=t.newY,this._boundingBoxCanvas.setGlobalXY(t.newX,t.newY),this._boundingBoxCanvas.moveAllBbox(this._selectMetadata.bnd_box,this._selectMetadata.img_x,this._selectMetadata.img_y),this.redrawImage(this._selectMetadata),this.resetZoom(),this.canvasContext.canvas.style.transformOrigin="0 0",this.canvasContext.canvas.style.transform="scale(1, 1)"}catch(t){console.log(t)}}keyStrokeEvent({ctrlKey:t,shiftKey:e,key:n}){try{const{isActiveModal:i}=this.boundingBoxState;if(!this.mousedown&&!i&&!this.showDropdownLabelBox&&this._selectMetadata)if(!t||"c"!==n&&"C"!==n)if(!t||"v"!==n&&"V"!==n){if(t&&e&&("z"===n||"Z"===n)){if(this._undoRedoService.isAllowRedo()){const t=this._undoRedoService.redo();this._selectMetadata=Object(mt.a)(null==t?void 0:t.meta),this.redrawImage(this._selectMetadata),this.getBBoxDistanceFromImage(),this.emitMetadata()}}else if(!t||"z"!==n&&"Z"!==n)if(!i&&this.annotateState.annotation>-1&&("Delete"===n||"Backspace"===n))this._boundingBoxCanvas.deleteSingleBox(this._selectMetadata.bnd_box,this.annotateState.annotation,t=>{t&&(this.annotateSelectChange({annotation:-1,isDlbClick:!1}),this.redrawImage(this._selectMetadata),this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this.emitMetadata())});else{const t="ArrowLeft"===n?"left":"ArrowRight"===n?"right":"ArrowUp"===n?"up":"ArrowDown"===n&&"down";t&&this.keyMoveBox(t)}else if(this._undoRedoService.isAllowUndo()){const t=this._undoRedoService.undo();this._selectMetadata=Object(mt.a)(null==t?void 0:t.meta),this.redrawImage(this._selectMetadata),this.getBBoxDistanceFromImage(),this.emitMetadata()}}else{if(this._copyPasteService.isAvailable()){this._copyPasteService.copy(this._selectMetadata.bnd_box[this.annotateState.annotation]);const t=this._copyPasteService.paste();t&&this._selectMetadata.bnd_box.push(t),this.annotateSelectChange({annotation:this._selectMetadata.bnd_box.length-1,isDlbClick:!1}),this.getBBoxDistanceFromImage(),this.redrawImage(this._selectMetadata)}this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this.emitMetadata()}else this.annotateState.annotation>-1&&this._copyPasteService.copy(this._selectMetadata.bnd_box[this.annotateState.annotation])}catch(i){console.log(i)}}toggleEvent(t){try{this.annotateState.annotation>-1&&(this._undoRedoService.clearRedundantStages(),this.annotateSelectChange({annotation:this.annotateState.annotation,isDlbClick:!0}))}catch(e){console.log(e)}}mouseScroll(t){try{if(this._boundingBoxCanvas.mouseClickWithinPointPath(this._selectMetadata,t)){const{scale:e,x:n,y:i}=this._zoomService.calculateZoomScale(t,this.zoom,this.canvas.nativeElement);this.boundingBoxState.scroll&&(this._mouseCursorService.changeCursor(this.mouseCursor,t),this._zoomService.validateZoomScale(this.canvasContext,e)&&(this.canvasContext.canvas.style.transformOrigin=`${t.offsetX}px ${t.offsetY}px`,this.canvasContext.canvas.style.transform=`scale(${e}, ${e})`,this._zoomService.setState({scale:e}))),this.canvasContext.canvas.scrollTop=i,this.canvasContext.canvas.scrollLeft=n,this._copyPasteService.isAvailable()&&this._copyPasteService.clear()}}catch(e){console.log(e)}}mouseDown(t){try{if(this._boundingBoxCanvas.mouseClickWithinPointPath(this._selectMetadata,t)){if(this.mousedown=!0,this.boundingBoxState.drag&&(this.changeMouseCursorState({grabbing:!0}),this._boundingBoxCanvas.setPanXY(t.offsetX,t.offsetY)),this.boundingBoxState.draw){const e=this._boundingBoxCanvas.mouseDownDrawEnable(t.offsetX,t.offsetY,this._selectMetadata.bnd_box);this.annotateSelectChange({annotation:e,isDlbClick:!1}),this.redrawImage(this._selectMetadata)}}else this.mousedown=!1}catch(e){console.log(e)}}mouseUp(t){try{this.boundingBoxState.draw&&this.mousedown&&this.finishDrawBoundingBox(t),this._boundingBoxCanvas.mouseClickWithinPointPath(this._selectMetadata,t)&&(this.boundingBoxState.drag&&this.mousedown&&this._boundingBoxCanvas.setGlobalXY(this._selectMetadata.img_x,this._selectMetadata.img_y),this.mousedown=!1)}catch(e){console.log(e)}}mouseMove(t){try{if(this._selectMetadata)if(this._boundingBoxCanvas.mouseClickWithinPointPath(this._selectMetadata,t)&&!this.showDropdownLabelBox){if(this.boundingBoxState.drag&&this.mousedown){const e=this._boundingBoxCanvas.getDiffXY(t);this._selectMetadata.img_x=e.diffX,this._selectMetadata.img_y=e.diffY,this._boundingBoxCanvas.panRectangle(this._selectMetadata.bnd_box,this._selectMetadata.img_x,this._selectMetadata.img_y,t=>{if(t){const t=Object(mt.a)(this._selectMetadata);this._undoRedoService.isMethodChange("pan")?this._undoRedoService.appendStages({meta:t,method:"pan"}):this._undoRedoService.replaceStages({meta:t,method:"pan"})}}),this.redrawImage(this._selectMetadata)}else this.boundingBoxState.drag&&!this.mousedown&&this.changeMouseCursorState({grab:!0});if(this.boundingBoxState.draw&&this.mousedown&&(this._boundingBoxCanvas.mouseMoveDrawEnable(t.offsetX,t.offsetY,this._selectMetadata),this.redrawImage(this._selectMetadata)),this.boundingBoxState.draw&&!this.mousedown){const{box:e,pos:n}=this._boundingBoxCanvas.getCurrentClickBox(t.offsetX,t.offsetY,this._selectMetadata.bnd_box);this.changeMouseCursorState(-1!==e?"tl"===n?{"nw-resize":!0}:"tr"===n?{"ne-resize":!0}:"bl"===n?{"sw-resize":!0}:"br"===n?{"se-resize":!0}:"l"===n||"r"===n?{"w-resize":!0}:"t"===n||"b"===n?{"n-resize":!0}:{move:!0}:{crosshair:!0})}}else this.changeMouseCursorState()}catch(e){console.log(e)}}finishDrawBoundingBox(t){this.getLabelList(),this.sortingLabelList(this.labelList,this._tabStatus[2].annotation&&this._tabStatus[2].annotation[0].bnd_box?this._tabStatus[2].annotation[0].bnd_box:[]);const e=this._boundingBoxCanvas.mouseUpDrawEnable(this._selectMetadata,this.labelList,t=>{t&&(this._undoRedoService.isStateChange(this._selectMetadata.bnd_box)&&this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this.getBBoxDistanceFromImage(),this.emitMetadata())});if(e.isNew||"mouseout"===t.type){let e=t.offsetY*(100/document.documentElement.clientHeight)+8.5,n=t.offsetX*(100/document.documentElement.clientWidth)+2.5;e<9&&(e=9),e>76&&(e=76),n<2.5&&(n=2.5),n>66&&(n=66),this.floatdiv.nativeElement.style.top=e.toString()+"vh",this.floatdiv.nativeElement.style.left=n.toString()+"vw",this.showDropdownLabelBox=!0,this.labelSearch="",this.invalidInput=!1,setTimeout(()=>{this.lbltypetxt.nativeElement.focus()},100)}else this.showDropdownLabelBox=!1;e.isNew&&this.annotateSelectChange({annotation:e.selBox,isDlbClick:!1})}changeMouseCursorState(t){this._mouseCursorService.setState(t)}mouseOut(t){var e,n;try{this.boundingBoxState.draw&&this.mousedown&&this.finishDrawBoundingBox(t),"canvasstyle"!==t.target.className&&!t.target.className.includes("unclosedOut")||(null===(e=t.relatedTarget)||void 0===e?void 0:e.className.includes("unclosedOut"))||(null===(n=t.relatedTarget)||void 0===n?void 0:n.className.includes("canvasstyle"))||0!==this._selectMetadata.bnd_box.filter(t=>""===t.label).length&&(this.showDropdownLabelBox=!1,this._selectMetadata.bnd_box=this._selectMetadata.bnd_box.filter(t=>""!==t.label),this._onChangeMetadata.emit(this._selectMetadata),this.redrawImage(this._selectMetadata),alert("Some bounding boxes will be deleted because they were not labelled.")),this.boundingBoxState.drag&&this.mousedown&&(this._boundingBoxCanvas.setGlobalXY(this._selectMetadata.img_x,this._selectMetadata.img_y),this.redrawImage(this._selectMetadata)),this.mousedown=!1}catch(i){console.log(i)}}loadImage(t){try{this.showDropdownLabelBox=!1,this.image.src=t,this.image.onload=()=>{this._selectMetadata.img_w=this._selectMetadata.img_w<1?this._selectMetadata.img_ori_w:this._selectMetadata.img_w,this._selectMetadata.img_h=this._selectMetadata.img_h<1?this._selectMetadata.img_ori_h:this._selectMetadata.img_h,this._boundingBoxCanvas.setGlobalXY(this._selectMetadata.img_x,this._selectMetadata.img_y),this.imgFitToCenter(),this.emitMetadata(),this.changeMouseCursorState(),this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"})}}catch(e){console.log(e)}}keyMoveBox(t){try{const e=this._selectMetadata.bnd_box[this.annotateState.annotation];e&&this._boundingBoxCanvas.keyboardMoveBox(t,e,this._selectMetadata,t=>{t&&(this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this.getBBoxDistanceFromImage(),this.redrawImage(this._selectMetadata),this.emitMetadata())})}catch(e){console.log(e)}}redrawImage({img_x:t,img_y:e,img_w:n,img_h:i}){var a;this.clearCanvas(),this.canvasContext.drawImage(this.image,t,e,n,i),0!==(null===(a=this._tabStatus[2].annotation)||void 0===a?void 0:a.length)&&(this.getLabelList(),this.sortingLabelList(this.labelList,this._tabStatus[2].annotation&&this._tabStatus[2].annotation[0].bnd_box?this._tabStatus[2].annotation[0].bnd_box:[])),this._boundingBoxCanvas.drawAllBoxOn(this.labelList,this._selectMetadata.bnd_box,this.canvasContext)}clearCanvas(){this.canvasContext.clearRect(0,0,this.canvas.nativeElement.width,this.canvas.nativeElement.height)}getBBoxDistanceFromImage(){this._boundingBoxCanvas.getBBoxDistfromImg(this._selectMetadata.bnd_box,this._selectMetadata.img_x,this._selectMetadata.img_y)}getLabelList(){this.labelList=[],this.allLabelList=[],(this._tabStatus[1].label_list?this._tabStatus[1].label_list:[]).forEach(t=>{this.labelList.push({name:t,count:0}),this.allLabelList.push({name:t,count:0})})}labelTypeTextChange(t){this.labelList=this.allLabelList.filter(e=>e.name.includes(t))}labelNameClicked(t){this.showDropdownLabelBox=!1,this._onChangeAnnotationLabel.emit({label:t,index:this.annotateState.annotation}),this._selectMetadata.bnd_box[this.annotateState.annotation].label=t,this._undoRedoService.isStateChange(this._selectMetadata.bnd_box)&&this._undoRedoService.appendStages({meta:this._selectMetadata,method:"draw"})}sortingLabelList(t,e){t.forEach(({name:t},n)=>{this.labelList[n].count=e.filter(({label:e})=>e===t).length,this.allLabelList[n].count=e.filter(({label:e})=>e===t).length}),this.labelList.sort((t,e)=>t.count<e.count?1:e.count<t.count?-1:0),this.allLabelList.sort((t,e)=>t.count<e.count?1:e.count<t.count?-1:0)}currentCursor(){return this._mouseCursorService.changeCursor(this.mouseCursor)}ngOnDestroy(){this._annotateSelectState.setState(),this.unsubscribe$.next(),this.unsubscribe$.complete()}}return t.\u0275fac=function(e){return new(e||t)(u.Hb(u.h),u.Hb(ie),u.Hb(M),u.Hb(_t),u.Hb(ae),u.Hb(S),u.Hb(se),u.Hb(le))},t.\u0275cmp=u.Bb({type:t,selectors:[["image-labelling-object-detection"]],viewQuery:function(t,e){if(1&t&&(u.tc(ce,!0),u.tc(he,!0),u.tc(de,!0),u.tc(ue,!0)),2&t){let t;u.ec(t=u.Ub())&&(e.canvas=t.first),u.ec(t=u.Ub())&&(e.floatdiv=t.first),u.ec(t=u.Ub())&&(e.lbltypetxt=t.first),u.ec(t=u.Ub())&&(e.availablelbl=t.first)}},hostBindings:function(t,e){1&t&&u.Tb("keydown",function(t){return e.keyStrokeEvent(t)},!1,u.gc)("dblclick",function(t){return e.toggleEvent(t)})("wheel",function(t){return e.mouseScroll(t)})("DOMMouseScroll",function(t){return e.mouseScroll(t)})("mousedown",function(t){return e.mouseDown(t)})("mouseup",function(t){return e.mouseUp(t)})("mousemove",function(t){return e.mouseMove(t)})("mouseout",function(t){return e.mouseOut(t)})},inputs:{_selectMetadata:"_selectMetadata",_imgSrc:"_imgSrc",_tabStatus:"_tabStatus"},outputs:{_onChangeMetadata:"_onChangeMetadata",_onChangeAnnotationLabel:"_onChangeAnnotationLabel",_onEnterLabel:"_onEnterLabel"},features:[u.vb],decls:13,vars:10,consts:[[1,"floatdiv","unclosedOut",3,"hidden"],["floatdiv",""],["autocomplete","off","spellcheck","false",1,"unclosedOut"],["type","text",1,"lbltypetxt","unclosedOut",3,"ngClass","ngModel","ngModelOptions","ngModelChange","keydown.enter"],["lbltypetxt",""],[1,"availablelbl","unclosedOut"],["availablelbl",""],[1,"lblList","unclosedOut"],["class","lblElement unclosedOut",3,"click",4,"ngFor","ngForOf"],["class","unclosedOut notExist",4,"ngIf"],[1,"canvasstyle",3,"ngStyle"],["canvasdrawing",""],[1,"lblElement","unclosedOut",3,"click"],[1,"lblName","unclosedOut"],[1,"lblCount","unclosedOut"],[1,"unclosedOut","notExist"],[1,"unclosedOut"]],template:function(t,e){1&t&&(u.Mb(0,"div"),u.Mb(1,"div",0,1),u.Mb(3,"form",2),u.Mb(4,"input",3,4),u.Tb("ngModelChange",function(t){return e.labelSearch=t})("ngModelChange",function(t){return e.labelTypeTextChange(t)})("keydown.enter",function(t){return e.validateInputLabel(t)}),u.Lb(),u.Lb(),u.Mb(6,"div",5,6),u.Mb(8,"ul",7),u.mc(9,be,5,2,"li",8),u.mc(10,ge,7,6,"li",9),u.Lb(),u.Lb(),u.Lb(),u.Ib(11,"canvas",10,11),u.Lb()),2&t&&(u.xb(1),u.ac("hidden",!e.showDropdownLabelBox),u.xb(3),u.ac("ngClass",e.invalidInput?"invalidInput":"validInput")("ngModel",e.labelSearch)("ngModelOptions",u.cc(7,fe)),u.xb(5),u.ac("ngForOf",e.labelList),u.xb(1),u.ac("ngIf",0===e.labelList.length),u.xb(1),u.ac("ngStyle",u.dc(8,me,e.currentCursor())))},directives:[yt.n,yt.g,yt.h,yt.a,i.i,yt.f,yt.i,i.j,i.k,i.l],pipes:[E.c],styles:[".canvasstyle[_ngcontent-%COMP%]{position:fixed;left:2.2vw;right:auto;top:8vh;overflow:scroll;scrollbar-width:none;margin:0;padding:0;outline:none;border:none}.floatdiv[_ngcontent-%COMP%]{position:absolute;z-index:10000}.lbltypetxt[_ngcontent-%COMP%]{height:4vh;border-radius:.2vh;border:.2vw solid grey;border-bottom:none;padding:0;text-indent:.4vw}.availablelbl[_ngcontent-%COMP%], .lbltypetxt[_ngcontent-%COMP%]{width:11vw;color:snow;font-size:2vh;background-color:#000;outline:none}.availablelbl[_ngcontent-%COMP%]{height:15vh;font-weight:700;border-radius:.2vh;border:.2vw solid grey;border-top:.1vh dotted snow;overflow:auto;scrollbar-width:none}.availablelbl[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}.lblList[_ngcontent-%COMP%]{padding:0 .2vw}.lblElement[_ngcontent-%COMP%]{list-style-type:none;margin:.3vh 0;padding:0;justify-content:space-between;display:flex}.lblElement[_ngcontent-%COMP%]:hover{background-color:#111}.lblName[_ngcontent-%COMP%]{margin-left:.2vw;overflow:hidden;text-overflow:ellipsis}.lblCount[_ngcontent-%COMP%]{background-color:#222;margin-right:.2vw;padding:.1vh .2vw;border-radius:.2vw}.notExist[_ngcontent-%COMP%]{color:#999;font-size:1.5vh}.invalidInput[_ngcontent-%COMP%]{border:.2vw solid red}.validInput[_ngcontent-%COMP%]{border:.2vw solid grey}"],changeDetection:0}),t})(),_e=(()=>{class t{constructor(){this.globalXY={x:-1,y:-1},this.panXY={x:0,y:0},this.clickPoint={polygonIndex:-1,pointIndex:-1},this.clipPath=null,this.radius=3.5,this.distanceOffset=8,this.polygonAreaIndex=-1,this.selectedPolygonIndex=-1,this.util=new pt,this.isNewPoly=!1,this.labelList=[]}mouseDownDraw(t,e,n,i,a,o,s,r){this.labelList=r;const{offsetX:l,offsetY:c}=t;this.polygonAreaIndex=this.findPolygonArea(t,e),this.clickPoint=this.findClickPoint(l,c,e);const h=this.isNewPolygon();return h&&o?this.setPanXY(t):!this.returnTempPoly()&&this.polygonAreaIndex<0&&this.clickPoint.pointIndex<0?(this.setPolygonLineWidth(e,-1),this.selectedPolygonIndex=-1,this.pushTempPoint(t,e),this.setNewPolygon(!0)):h?(this.pushTempPoint(t,e),this.drawNewPolygon(e,i,a,n,!1),this.drawfromPreviousPoint(t,a)):(this.selectedPolygonIndex=this.findPolygonArea(t,e)>-1?this.findPolygonArea(t,e):this.findClickPoint(l,c,e).polygonIndex,this.setPolygonLineWidth(e,this.selectedPolygonIndex),this.setNewPolygon(!1)),this.selectedPolygonIndex}mouseMoveDraw(t,e,n,i,a,o,s,r){const l=this.findPolygonArea(a,t),c=this.isNewPolygon(),{pointIndex:h,polygonIndex:d}=this.clickPoint;if(c&&s&&o){const{diffX:e,diffY:n}=this.getDiffXY(a);t.img_x=e,t.img_y=n,this.panPolygons(t,!0),r("pan")}else c?(this.drawNewPolygon(t,e,n,i,!1),this.drawfromPreviousPoint(a,n)):s&&-1===h&&this.selectedPolygonIndex>-1?(this.mouseMovePolygon(a,t,n,this.selectedPolygonIndex,e,i),this.resetClipPath(t),r("pan")):s&&h>-1&&d>-1&&(this.setPolygonCoordinate(a,t,this.clickPoint),r("draw"));return l>-1}setPanXY({offsetX:t,offsetY:e}){try{this.panXY={x:t,y:e}}catch(n){console.log("setPanXY",n)}}getPanXY(){return this.panXY}getDiffXY({offsetX:t,offsetY:e}){try{const n={diffX:0,diffY:0},{x:i,y:a}=this.getGlobalXY();return n.diffX=i+(t-this.panXY.x),n.diffY=a+(e-this.panXY.y),n}catch(n){return console.log(n),{diffX:-1,diffY:-1}}}setSelectedPolygon(t,e){this.selectedPolygonIndex=t,e&&this.setPolygonLineWidth(e,this.selectedPolygonIndex)}getSelectedPolygonIndex(){return this.selectedPolygonIndex}mouseClickWithinPointPath({img_x:t,img_y:e,img_w:n,img_h:i},{offsetX:a,offsetY:o}){return a>t&&a<t+n&&o>e&&o<e+i}calScaleToFitScreen({img_w:t,img_h:e},{offsetWidth:n,offsetHeight:i}){try{const a={factor:-1,newX:-1,newY:-1},o=Math.min(n/t,i/e);return a.factor=o-.05*o,a.newX=n/2-t/2*a.factor,a.newY=i/2-e/2*a.factor,a}catch(a){return console.log("calScaleToFitScreen",a),{factor:-1,newX:-1,newY:-1}}}pushTempPoint({offsetX:t,offsetY:e},{img_x:n,img_y:i,polygons:a}){try{const o=t-n,s=e-i,r=a.length;!this.tmpPolygon&&this.generateNewTempPolygon(r),this.tmpPolygon.coorPt.push({x:t,y:e,distancetoImg:{x:o,y:s}})}catch(o){console.log("pushTempPoint",o)}}removeLastPoint(t,e,n,i){var a;try{return(null===(a=this.tmpPolygon)||void 0===a?void 0:a.coorPt)&&this.tmpPolygon.coorPt.length>1?(this.tmpPolygon.coorPt.pop(),!1):(this.resetDrawing(t,n,e,i),!0)}catch(o){return console.log("removeLastPoint",o),!1}}calculatePointDistance(t,e,n,i){try{const a=t-n,o=e-i;return Math.sqrt(a*a+o*o)}catch(a){return void console.log("calculatePointDistance",a)}}generateNewTempPolygon(t){try{const e=this.util.generateUniquesID(),n=(t+1).toString();this.tmpPolygon={coorPt:[],label:this.labelList.length>0?this.labelList[0].name:"",id:e,lineWidth:2,color:"rgba(0,255,0,1.0)",region:n,subLabel:[]}}catch(e){console.log("generateNewTempPolygon",e)}}getClickPoint(){return this.clickPoint}resetClickPoint(){this.clickPoint={pointIndex:-1,polygonIndex:-1}}resetDrawing(t,e,n,i){try{this.tmpPolygon=null,this.setNewPolygon(!1),this.redraw(t,e,n,i,-1)}catch(a){console.log("resetDrawing",a)}}setNewPolygon(t){this.isNewPoly=t}redraw(t,e,n,{width:i,height:a},o){try{const{img_w:s,img_h:r,img_x:l,img_y:c}=t;n.restore(),n.clearRect(0,0,i,a),n.save(),n.beginPath(),n.rect(l,c,s,r),n.clip(),n.beginPath(),n.drawImage(e,l,c,s,r),this.drawAllPolygon(t,n,o)}catch(s){console.log("redraw",s)}}drawAllPolygon(t,e,n){try{this.validatePolygonMetadata(t.polygons)&&(this.drawAllPolygonLine(t,e),this.drawAllPolygonsDots(t,e,n,this.radius),this.plotAllFloatLabel(t,e))}catch(i){console.log("drawAllPolygon",i)}}validatePolygonMetadata(t){return t.length>0}drawAllPolygonLine({polygons:t},e){try{for(const[n,{lineWidth:i,color:a,coorPt:o}]of t.entries()){e.lineWidth=i,e.strokeStyle=a||"white",e.fillStyle=a||"white",e.beginPath(),e.moveTo(o[0].x,o[0].y);for(const[t]of o.entries())t+1<o.length&&e.lineTo(o[t+1].x,o[t+1].y);e.closePath(),e.stroke()}}catch(n){console.log("drawAllPolygonLine",n)}}drawAllPolygonsDots({polygons:t},e,n,i){try{for(const[a,{coorPt:o}]of t.entries())if(n===a){e.strokeStyle="green",e.fillStyle="green";for(const[t]of o.entries())e.beginPath(),e.arc(o[t].x,o[t].y,i,0,2*Math.PI),e.fill(),e.closePath(),e.stroke()}}catch(a){console.log("drawAllPolygonsDots",a)}}plotAllFloatLabel({polygons:t},e){try{t.forEach(({label:t,coorPt:n})=>{const{x:i,y:a}=n[0];e.strokeStyle="white",e.fillStyle="black",e.font="bold 12px Arial",e.strokeText(t,i+10,a+15),e.fillText(t,i+10,a+15)})}catch(n){console.log("plotAllFloatLabel",n)}}setGlobalXY({offsetX:t,offsetY:e}){try{this.globalXY={x:t,y:e}}catch(n){console.log("setGlobalXY",n)}}getGlobalXY(){return this.globalXY}mouseMovePolygon({offsetX:t,offsetY:e},n,i,a,o,s){try{const{x:r,y:l}=this.getGlobalXY(),c=t-r,h=e-l;if(this.withinPointPath(n,a,{offsetX:c,offsetY:h})){this.setGlobalXY({offsetX:t,offsetY:e});for(const[t]of n.polygons[a].coorPt.entries())n.polygons[a].coorPt[t].x+=c,n.polygons[a].coorPt[t].y+=h;this.redraw(n,o,i,s,a)}}catch(r){console.log("mouseMovePolygon",r)}}keyboardMovePolygon(t,e,n,i,a,o,s){try{if(n>-1){const r=-3;switch(e){case"up":if(this.withinPointPath(t,n,{offsetX:0,offsetY:r}))for(const[e]of t.polygons[n].coorPt.entries())t.polygons[n].coorPt[e].y+=r;break;case"down":if(this.withinPointPath(t,n,{offsetX:0,offsetY:r}))for(const[e]of t.polygons[n].coorPt.entries())t.polygons[n].coorPt[e].y-=r;break;case"left":if(this.withinPointPath(t,n,{offsetX:r,offsetY:0}))for(const[e]of t.polygons[n].coorPt.entries())t.polygons[n].coorPt[e].x+=r;break;case"right":if(this.withinPointPath(t,n,{offsetX:r,offsetY:0}))for(const[e]of t.polygons[n].coorPt.entries())t.polygons[n].coorPt[e].x-=r}this.redraw(t,i,a,o,n),s(!0)}return!0}catch(r){return console.log("keyboardMovePolygon",r),!0}}withinPointPath({polygons:t,img_x:e,img_y:n,img_w:i,img_h:a},o,{offsetX:s,offsetY:r}){try{for(const[l]of t[o].coorPt.entries())return!(t[o].coorPt[l].x+s<e||t[o].coorPt[l].x+s>e+i||t[o].coorPt[l].y+r<n||t[o].coorPt[l].y+r>n+a)}catch(l){return!1}}validateXYDistance(t){try{for(const[e]of t.polygons.entries())for(const[n]of t.polygons[e].coorPt.entries()){const i=t.polygons[e].coorPt[n].y-t.img_y;t.polygons[e].coorPt[n].distancetoImg.x=t.polygons[e].coorPt[n].x-t.img_x,t.polygons[e].coorPt[n].distancetoImg.y=i}}catch(e){console.log("validateXYDistance",e)}}setPolygonLineWidth(t,e){try{t.polygons=t.polygons.map((t,n)=>Object.assign(Object.assign({},t),{lineWidth:t.lineWidth=n===e?2:1,color:t.color=n===e?"rgba(0,255,0,1.0)":"rgba(255,255,0,0.8)"}))}catch(n){console.log("setPolygonLineWidth",n)}}drawNewPolygon(t,e,n,i,a){var o;try{if(this.redraw(t,e,n,i,-1),null===(o=this.tmpPolygon)||void 0===o?void 0:o.coorPt){for(const[t,{x:e,y:i}]of this.tmpPolygon.coorPt.entries())n.strokeStyle="green",n.fillStyle="green",n.beginPath(),n.arc(e,i,this.radius,0,2*Math.PI),n.fill(),n.closePath(),n.stroke();n.beginPath(),n.lineWidth=this.tmpPolygon.lineWidth,n.strokeStyle=this.tmpPolygon.color,n.fillStyle=this.tmpPolygon.color,n.moveTo(this.tmpPolygon.coorPt[0].x,this.tmpPolygon.coorPt[0].y);for(const[t]of this.tmpPolygon.coorPt.entries())t+1<this.tmpPolygon.coorPt.length&&n.lineTo(this.tmpPolygon.coorPt[t+1].x,this.tmpPolygon.coorPt[t+1].y);if(a){n.closePath(),n.stroke();const{length:e}=t.polygons;this.tmpPolygon&&(t.polygons.push(Object(mt.a)(this.tmpPolygon)),this.setPolygonLineWidth(t,e),this.tmpPolygon=null),this.setNewPolygon(!1)}else n.stroke()}}catch(s){console.log("drawNewPolygon",s)}}drawfromPreviousPoint({offsetX:t,offsetY:e},n){var i;try{if(null===(i=this.tmpPolygon)||void 0===i?void 0:i.coorPt){const{length:i}=this.tmpPolygon.coorPt,a=i-1;n.beginPath(),n.moveTo(this.tmpPolygon.coorPt[a].x,this.tmpPolygon.coorPt[a].y),n.lineTo(t,e),n.stroke()}}catch(a){console.log("drawfromPreviousPoint",a)}}returnTempPoly(){try{return this.tmpPolygon}catch(t){return console.log("returnTempPoly",t),null}}setPolygonCoordinate({offsetX:t,offsetY:e},n,{polygonIndex:i,pointIndex:a}){try{i>-1&&a>-1&&(n.polygons[i].coorPt[a].x=t,n.polygons[i].coorPt[a].y=e)}catch(o){console.log("setPolygonCoordinate",o)}}insidePolygonArea(t,{offsetX:e,offsetY:n}){try{let i=!1;for(let a=0,o=t.length-1;a<t.length;o=a++)t[a].y>n!=t[o].y>n&&e<(t[o].x-t[a].x)*(n-t[a].y)/(t[o].y-t[a].y)+t[a].x&&(i=!i);return i}catch(i){return console.log("insidePolygonArea",i),!1}}calPolygonArea({coorPt:t}){try{let e=0,n=t.length-1;for(let i=0;i<t.length;++i)e+=(t[n].x+t[i].x)*(t[n].y-t[i].y),n=i;return Math.abs(e/2)}catch(e){return console.log("calPolygonArea",e),-1}}findPolygonArea(t,{polygons:e}){try{let n=-1,i=1e7;for(const[a,o]of e.entries())if(this.insidePolygonArea(o.coorPt,t)){const t=this.calPolygonArea(o);t<i&&(n=a,i=t)}return n}catch(n){return console.log("findPolygonArea",n),-1}}findClickPoint(t,e,n){try{let i;const a={polygonIndex:-1,pointIndex:-1};for(let o=0;o<n.polygons.length;++o)for(let s=0;s<n.polygons[o].coorPt.length;++s)if(i=Math.sqrt(Math.pow(t-n.polygons[o].coorPt[s].x,2)+Math.pow(e-n.polygons[o].coorPt[s].y,2)),i<=this.radius){a.polygonIndex=o,a.pointIndex=s;break}return a}catch(i){return console.log("findClickPoint",i),{polygonIndex:-1,pointIndex:-1}}}isNewPolygon(){try{return this.isNewPoly}catch(t){return console.log("isNewPolygon",t),!1}}deleteSinglePolygon(t,e,n){try{t.polygons.splice(e,1),this.selectedPolygonIndex=-1,n(!0)}catch(i){console.log("deleteSinglePolygon",i)}}scalePolygons(t,{factor:e,newX:n,newY:i},a){try{for(const[a]of t.polygons.entries())for(const[o]of t.polygons[a].coorPt.entries())t.polygons[a].coorPt[o].x=t.polygons[a].coorPt[o].distancetoImg.x*e+n,t.polygons[a].coorPt[o].y=t.polygons[a].coorPt[o].distancetoImg.y*e+i,t.polygons[a].coorPt[o].distancetoImg.x=t.polygons[a].coorPt[o].x-n,t.polygons[a].coorPt[o].distancetoImg.y=t.polygons[a].coorPt[o].y-i;this.setPolygonLineWidth(t,-1),a&&a(!0)}catch(o){console.log("scalePolygons",o)}}panPolygons(t,e,n){var i;try{if(e&&(null===(i=this.tmpPolygon)||void 0===i?void 0:i.coorPt))for(const[e]of this.tmpPolygon.coorPt.entries())this.tmpPolygon.coorPt[e].x=t.img_x+this.tmpPolygon.coorPt[e].distancetoImg.x,this.tmpPolygon.coorPt[e].y=t.img_y+this.tmpPolygon.coorPt[e].distancetoImg.y;for(const[e]of t.polygons.entries())for(const[n]of t.polygons[e].coorPt.entries())t.polygons[e].coorPt[n].x=t.img_x+t.polygons[e].coorPt[n].distancetoImg.x,t.polygons[e].coorPt[n].y=t.img_y+t.polygons[e].coorPt[n].distancetoImg.y;n&&n(!0)}catch(a){console.log("panPolygons",a)}}resetClipPath({img_x:t,img_y:e,img_w:n,img_h:i}){try{this.clipPath=null,this.clipPath=new Path2D,this.clipPath.rect(t,e,n,i)}catch(a){console.log(a)}}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=u.Db({token:t,factory:t.\u0275fac,providedIn:"any"}),t})();const ve=["canvasdrawing"],ye=["floatdiv"],xe=["lbltypetxt"],we=["availablelbl"];function Se(t,e){if(1&t){const t=u.Nb();u.Mb(0,"li",12),u.Tb("click",function(){u.hc(t);const n=e.$implicit;return u.Vb().labelNameClicked(n.name)}),u.Mb(1,"span",13),u.oc(2),u.Lb(),u.Mb(3,"span",14),u.oc(4),u.Lb(),u.Lb()}if(2&t){const t=e.$implicit;u.xb(2),u.pc(t.name),u.xb(2),u.pc(t.count)}}function Ce(t,e){1&t&&(u.Mb(0,"li",15),u.Mb(1,"div",16),u.oc(2),u.Wb(3,"translate"),u.Lb(),u.Mb(4,"div",16),u.oc(5),u.Wb(6,"translate"),u.Lb(),u.Lb()),2&t&&(u.xb(2),u.pc(u.Xb(3,2,"searchLabel.labelNotExist")),u.xb(3),u.pc(u.Xb(6,4,"searchLabel.enterToAdd")))}const Me=function(){return{standalone:!0}},ke=function(t){return{cursor:t}};let Pe=(()=>{class t{constructor(t,e,n,i,a,o,s){this._segCanvasService=t,this._imgLblStateService=e,this._undoRedoService=n,this._copyPasteService=i,this._annotateSelectState=a,this._zoomService=o,this._mouseCursorService=s,this.image=new Image,this.isMouseWithinPoint=!1,this.altKey=!1,this.ctrlKey=!1,this.unsubscribe$=new l.a,this.mousedown=!1,this.showDropdownLabelBox=!1,this.labelSearch="",this.labelList=[],this.allLabelList=[],this._imgSrc="",this._tabStatus=[],this._onChangeMetadata=new u.n,this._onChangeAnnotationLabel=new u.n}ngOnInit(){this.getLabelList(),this._imgLblStateService.action$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(t=>{var{clear:e,fitCenter:n}=t,i=Object(a.b)(t,["clear","fitCenter"]);this.segState=Object.assign(Object.assign({},i),{clear:e,fitCenter:n}),n&&this.imgFitToCenter(),e&&(this._selectMetadata.polygons=[],this._undoRedoService.appendStages({meta:this._selectMetadata,method:"draw"}),this.redrawImage(this._selectMetadata),this.emitMetadata())}),this._annotateSelectState.labelStaging$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(t=>{this.annotateState=t,this._selectMetadata&&(this._segCanvasService.setSelectedPolygon(t.annotation,this._selectMetadata),this.redrawImage(this._selectMetadata))}),this._zoomService.zoom$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(t=>this.zoom=t),this._mouseCursorService.mouseCursor$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(t=>this.mouseCursor=t)}ngOnChanges(t){var e,n,i;(null===(e=t._selectMetadata)||void 0===e?void 0:e.previousValue)&&(null===(n=t._selectMetadata)||void 0===n?void 0:n.currentValue)&&this.redrawImage(this._selectMetadata),(null===(i=t._imgSrc)||void 0===i?void 0:i.currentValue)&&(this.initializeCanvas(),this._undoRedoService.clearAllStages(),this._segCanvasService.setSelectedPolygon(-1),this.loadImage(t._imgSrc.currentValue))}initializeCanvas(){this.canvas.nativeElement.style.width="80%",this.canvas.nativeElement.style.height="90%",this.canvas.nativeElement.width=this.canvas.nativeElement.offsetWidth,this.canvas.nativeElement.height=this.canvas.nativeElement.offsetHeight,this.canvasContext=this.canvas.nativeElement.getContext("2d")}loadImage(t){this.image.src=t,this.image.onload=()=>{const{img_x:t,img_y:e}=this._selectMetadata;this._selectMetadata.img_w=this._selectMetadata.img_w<1?this._selectMetadata.img_ori_w:this._selectMetadata.img_w,this._selectMetadata.img_h=this._selectMetadata.img_h<1?this._selectMetadata.img_ori_h:this._selectMetadata.img_h,this._segCanvasService.setGlobalXY({offsetX:t,offsetY:e}),this.imgFitToCenter(),this.emitMetadata(),this.changeMouseCursorState()}}emitMetadata(){this._onChangeMetadata.emit(this._selectMetadata)}annotateStateChange(t){t&&this._annotateSelectState.setState(t)}resetZoom(){this._zoomService.resetZoomScale()}imgFitToCenter(){try{const t=this._segCanvasService.calScaleToFitScreen(this._selectMetadata,this.canvas.nativeElement);this._selectMetadata.img_w*=t.factor,this._selectMetadata.img_h*=t.factor,this._selectMetadata.img_x=t.newX,this._selectMetadata.img_y=t.newY,this._segCanvasService.scalePolygons(this._selectMetadata,t),this._segCanvasService.setGlobalXY({offsetX:t.newX,offsetY:t.newY}),this._segCanvasService.panPolygons(this._selectMetadata,!1,t=>{if(t){const t=Object(mt.a)(this._selectMetadata);this._undoRedoService.isMethodChange("zoom")?this._undoRedoService.appendStages({meta:t,method:"zoom"}):this._undoRedoService.replaceStages({meta:t,method:"zoom"})}}),this.redrawImage(this._selectMetadata),this.resetZoom(),this.canvasContext.canvas.style.transformOrigin="0 0",this.canvasContext.canvas.style.transform="scale(1, 1)"}catch(t){console.log("imgFitToCenter",t)}}redrawImage({img_x:t,img_y:e,img_w:n,img_h:i}){var a,o;if(this.clearcanvas(),this.canvasContext.drawImage(this.image,t,e,n,i),0!==(null===(a=this._tabStatus[2].annotation)||void 0===a?void 0:a.length)){this.getLabelList();const t=this._tabStatus[2].annotation&&null!==(o=this._tabStatus[2].annotation[0].polygons)&&void 0!==o?o:[];this.sortingLabelList(this.labelList,t)}this._segCanvasService.drawAllPolygon(this._selectMetadata,this.canvasContext,this.annotateState.annotation)}clearcanvas(){const{width:t,height:e}=this.canvas.nativeElement;this.canvasContext.clearRect(0,0,t,e)}mouseScroll(t){try{if(this.isMouseWithinPoint=this._segCanvasService.mouseClickWithinPointPath(this._selectMetadata,t),this.isMouseWithinPoint){const{scale:e,x:n,y:i}=this._zoomService.calculateZoomScale(t,this.zoom,this.canvas.nativeElement);this.segState.scroll&&(this._mouseCursorService.changeCursor(this.mouseCursor,t),this._zoomService.validateZoomScale(this.canvasContext,e)&&(this.canvasContext.canvas.style.transformOrigin=`${t.offsetX}px ${t.offsetY}px`,this.canvasContext.canvas.style.transform=`scale(${e}, ${e})`,this._zoomService.setState({scale:e}))),this.canvasContext.canvas.scrollTop=i,this.canvasContext.canvas.scrollLeft=n,this._copyPasteService.isAvailable()&&this._copyPasteService.clear()}}catch(e){console.log("mouseScroll",e)}}validateEndDrawPolygon({isActiveModal:t,draw:e},n,i){return!t&&e&&n&&"none"!==i.canvas.style.pointerEvents}canvasDblClickEvent(t){this.validateEndDrawPolygon(this.segState,this.isMouseWithinPoint,this.canvasContext)&&(this._segCanvasService.isNewPolygon()&&(this._segCanvasService.drawNewPolygon(this._selectMetadata,this.image,this.canvasContext,this.canvas.nativeElement,!0),this.positioningLabelListPopup(this._selectMetadata.polygons),this._segCanvasService.validateXYDistance(this._selectMetadata),this.redrawImage(this._selectMetadata),this.emitMetadata()),this.annotateState.annotation>-1&&this.annotateStateChange({annotation:this.annotateState.annotation,isDlbClick:!0}))}canvasKeyDownEvent({ctrlKey:t,shiftKey:e,key:n}){try{if(this.validateEndDrawPolygon(this.segState,this.isMouseWithinPoint,this.canvasContext)){if(this._segCanvasService.isNewPolygon())switch(n){case"Enter":this._segCanvasService.drawNewPolygon(this._selectMetadata,this.image,this.canvasContext,this.canvas.nativeElement,!0),this.positioningLabelListPopup(this._selectMetadata.polygons),this.annotateStateChange({annotation:this._selectMetadata.polygons.length-1}),this._segCanvasService.validateXYDistance(this._selectMetadata),this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this.redrawImage(this._selectMetadata),this.emitMetadata();break;case"Escape":this._segCanvasService.resetDrawing(this._selectMetadata,this.image,this.canvasContext,this.canvas.nativeElement)}else switch(n){case"Delete":case"Backspace":this._segCanvasService.deleteSinglePolygon(this._selectMetadata,this.annotateState.annotation,t=>{t&&(this.annotateStateChange(),this.redrawImage(this._selectMetadata),this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this.emitMetadata())})}const t="ArrowLeft"===n?"left":"ArrowRight"===n?"right":"ArrowUp"===n?"up":"ArrowDown"===n&&"down";t&&this.keyMoveBox(t)}if(!t||"c"!==n&&"C"!==n)if(!t||"v"!==n&&"V"!==n){if(t&&e&&("z"===n||"Z"===n)){if(this._undoRedoService.isAllowRedo()){const t=this._undoRedoService.redo();this._selectMetadata=Object(mt.a)(null==t?void 0:t.meta),this.redrawImage(this._selectMetadata),this.emitMetadata()}}else if(t&&("z"===n||"Z"===n)&&this._undoRedoService.isAllowUndo()){const t=this._undoRedoService.undo();this._selectMetadata=Object(mt.a)(null==t?void 0:t.meta),this.redrawImage(this._selectMetadata),this.emitMetadata()}}else this._copyPasteService.isAvailable()&&(this._selectMetadata.polygons.push(this._copyPasteService.paste()),this.annotateStateChange({annotation:this._selectMetadata.polygons.length-1}),this._segCanvasService.validateXYDistance(this._selectMetadata)),this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this.emitMetadata();else this.annotateState.annotation>-1&&this._copyPasteService.copy(this._selectMetadata.polygons[this.annotateState.annotation])}catch(i){console.log("canvasKeyDownEvent",i)}}keyMoveBox(t){try{this._selectMetadata.polygons[this.annotateState.annotation]&&this._segCanvasService.keyboardMovePolygon(this._selectMetadata,t,this.annotateState.annotation,this.image,this.canvasContext,this.canvas.nativeElement,t=>{t&&(this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this._segCanvasService.validateXYDistance(this._selectMetadata),this.redrawImage(this._selectMetadata),this.emitMetadata())})}catch(e){console.log("keyMoveBox",e)}}mouseDown(t){var e;try{if(this.isMouseWithinPoint=this._segCanvasService.mouseClickWithinPointPath(this._selectMetadata,t),this.isMouseWithinPoint)if(this.mousedown=!0,this.segState.drag&&(this.changeMouseCursorState({grabbing:!0}),this._segCanvasService.setPanXY(t),this.initializeCanvas(),this.redrawImage(this._selectMetadata)),this.segState.draw){this.getLabelList();const n=this._tabStatus[2].annotation&&null!==(e=this._tabStatus[2].annotation[0].polygons)&&void 0!==e?e:[];this.sortingLabelList(this.labelList,n),this.showDropdownLabelBox=!1;const i=this._segCanvasService.mouseDownDraw(t,this._selectMetadata,this.canvas.nativeElement,this.image,this.canvasContext,this.ctrlKey,this.altKey,this.labelList);if(i>-1)this._segCanvasService.setGlobalXY(t);else{const{img_x:t,img_y:e}=this._selectMetadata;this._segCanvasService.setGlobalXY({offsetX:t,offsetY:e})}this.annotateStateChange({annotation:i}),this.redrawImage(this._selectMetadata),this.mouseMoveDrawCanvas(t)}else this.segState.draw&&!this.mousedown&&this.redrawImage(this._selectMetadata);else this.mousedown=!1}catch(n){console.log("mouseDown",n)}}mouseUp(t){try{this.isMouseWithinPoint=this._segCanvasService.mouseClickWithinPointPath(this._selectMetadata,t);const e=this._segCanvasService.isNewPolygon();if(this._selectMetadata&&this.isMouseWithinPoint)if(this.mousedown){const{img_x:t,img_y:n}=this._selectMetadata;this.segState.drag&&this._segCanvasService.setGlobalXY({offsetX:t,offsetY:n}),this.segState.draw&&!e&&this.annotateState.annotation>-1&&this._undoRedoService.isStateChange(this._selectMetadata.polygons)&&(this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this._segCanvasService.setGlobalXY({offsetX:t,offsetY:n}),this._segCanvasService.validateXYDistance(this._selectMetadata),this.redrawImage(this._selectMetadata),this.emitMetadata())}else{const{pointIndex:t,polygonIndex:e}=this._segCanvasService.getClickPoint();this.segState.draw&&e>-1&&t>-1?this._undoRedoService.isStateChange(this._selectMetadata.polygons)&&(this._undoRedoService.appendStages({meta:Object(mt.a)(this._selectMetadata),method:"draw"}),this._segCanvasService.resetClickPoint(),this._segCanvasService.validateXYDistance(this._selectMetadata),this.redrawImage(this._selectMetadata),this.emitMetadata()):this.segState.draw&&(this._segCanvasService.validateXYDistance(this._selectMetadata),this.redrawImage(this._selectMetadata),this.emitMetadata())}this.mousedown=!1}catch(e){console.log("mouseUp",e)}}mouseMove(t){try{if(this.isMouseWithinPoint=this._selectMetadata&&this._segCanvasService.mouseClickWithinPointPath(this._selectMetadata,t),this.isMouseWithinPoint){if(this.segState.drag&&this.mousedown){const{diffX:e,diffY:n}=this._segCanvasService.getDiffXY(t);this._selectMetadata.img_x=e,this._selectMetadata.img_y=n,this._segCanvasService.panPolygons(this._selectMetadata,!1,t=>{if(t){const t=Object(mt.a)(this._selectMetadata);this._undoRedoService.isMethodChange("pan")?this._undoRedoService.appendStages({meta:t,method:"pan"}):this._undoRedoService.replaceStages({meta:t,method:"pan"})}}),this.redrawImage(this._selectMetadata)}else this.segState.drag&&!this.mousedown&&this.changeMouseCursorState({grab:!0});if(this.segState.draw){const e=this.mouseMoveDrawCanvas(t);this.changeMouseCursorState(e?{move:!0}:{crosshair:!0})}}else this.changeMouseCursorState(),this.mousedown=!1}catch(e){console.log("mouseMove",e)}}mouseMoveDrawCanvas(t){return this._segCanvasService.mouseMoveDraw(this._selectMetadata,this.image,this.canvasContext,this.canvas.nativeElement,t,this.ctrlKey,this.mousedown,t=>{this.redrawImage(this._selectMetadata)})}changeMouseCursorState(t){this._mouseCursorService.setState(t)}mouseOut(t){var e,n;try{this.segState.drag&&this.isMouseWithinPoint&&this.mousedown&&(this._segCanvasService.setGlobalXY(t),this.redrawImage(this._selectMetadata)),"canvasstyle"!==t.target.className&&!t.target.className.includes("unclosedOut")||(null===(e=t.relatedTarget)||void 0===e?void 0:e.className.includes("unclosedOut"))||(null===(n=t.relatedTarget)||void 0===n?void 0:n.className.includes("canvasstyle"))||(this.showDropdownLabelBox=!1,0!==this._selectMetadata.polygons.filter(t=>!t.label).length&&(this._selectMetadata.polygons=this._selectMetadata.polygons.filter(t=>""!==t.label),this._onChangeMetadata.emit(this._selectMetadata),this.redrawImage(this._selectMetadata),alert("Some bounding boxes will be deleted because they were not labelled."))),this.isMouseWithinPoint=!1}catch(i){console.log("mouseOut",i)}}currentCursor(){return this._mouseCursorService.changeCursor(this.mouseCursor)}positioningLabelListPopup(t){let e=t[this._selectMetadata.polygons.length-1].coorPt[this._selectMetadata.polygons[this._selectMetadata.polygons.length-1].coorPt.length-1].y*(100/document.documentElement.clientHeight)+8.5,n=t[this._selectMetadata.polygons.length-1].coorPt[this._selectMetadata.polygons[this._selectMetadata.polygons.length-1].coorPt.length-1].x*(100/document.documentElement.clientWidth)+2.5;e<9&&(e=9),e>76&&(e=76),n<2.5&&(n=2.5),n>66&&(n=66),this.floatdiv.nativeElement.style.top=e.toString()+"vh",this.floatdiv.nativeElement.style.left=n.toString()+"vw",this.showDropdownLabelBox=!0,this.labelSearch="",setTimeout(()=>{this.lbltypetxt.nativeElement.focus()},100)}getLabelList(){var t;this.labelList=[],this.allLabelList=[],(null!==(t=this._tabStatus[1].label_list)&&void 0!==t?t:[]).forEach(t=>{const e={name:t,count:0};this.labelList.push(e),this.allLabelList.push(e)})}sortingLabelList(t,e){t.forEach(({name:t},n)=>{this.labelList[n].count=e.filter(({label:e})=>e===t).length,this.allLabelList[n].count=e.filter(({label:e})=>e===t).length}),this.labelList.sort((t,e)=>t.count<e.count?1:e.count<t.count?-1:0),this.allLabelList.sort((t,e)=>t.count<e.count?1:e.count<t.count?-1:0)}labelNameClicked(t){this.showDropdownLabelBox=!1,this._onChangeAnnotationLabel.emit({label:t,index:this.annotateState.annotation}),this._selectMetadata.polygons[this.annotateState.annotation].label=t,this._undoRedoService.isStateChange(this._selectMetadata.polygons)&&this._undoRedoService.appendStages({meta:this._selectMetadata,method:"draw"})}labelTypeTextChange(t){this.labelList=this.allLabelList.filter(e=>e.name.includes(t))}ngOnDestroy(){this._annotateSelectState.setState(),this.unsubscribe$.next(),this.unsubscribe$.complete()}}return t.\u0275fac=function(e){return new(e||t)(u.Hb(_e),u.Hb(M),u.Hb(_t),u.Hb(ae),u.Hb(S),u.Hb(se),u.Hb(le))},t.\u0275cmp=u.Bb({type:t,selectors:[["image-labelling-segmentation"]],viewQuery:function(t,e){if(1&t&&(u.tc(ve,!0),u.tc(ye,!0),u.tc(xe,!0),u.tc(we,!0)),2&t){let t;u.ec(t=u.Ub())&&(e.canvas=t.first),u.ec(t=u.Ub())&&(e.floatdiv=t.first),u.ec(t=u.Ub())&&(e.lbltypetxt=t.first),u.ec(t=u.Ub())&&(e.availablelbl=t.first)}},hostBindings:function(t,e){1&t&&u.Tb("wheel",function(t){return e.mouseScroll(t)})("DOMMouseScroll",function(t){return e.mouseScroll(t)})("dblclick",function(t){return e.canvasDblClickEvent(t)})("keydown",function(t){return e.canvasKeyDownEvent(t)},!1,u.gc)("mousedown",function(t){return e.mouseDown(t)})("mouseup",function(t){return e.mouseUp(t)})("mousemove",function(t){return e.mouseMove(t)})("mouseout",function(t){return e.mouseOut(t)})},inputs:{_selectMetadata:"_selectMetadata",_imgSrc:"_imgSrc",_tabStatus:"_tabStatus"},outputs:{_onChangeMetadata:"_onChangeMetadata",_onChangeAnnotationLabel:"_onChangeAnnotationLabel"},features:[u.vb],decls:13,vars:9,consts:[[1,"floatdiv","unclosedOut",3,"hidden"],["floatdiv",""],["autocomplete","off","spellcheck","false",1,"unclosedOut"],["type","text",1,"lbltypetxt","unclosedOut",3,"ngModel","ngModelOptions","ngModelChange"],["lbltypetxt",""],[1,"availablelbl","unclosedOut"],["availablelbl",""],[1,"lblList","unclosedOut"],["class","lblElement unclosedOut",3,"click",4,"ngFor","ngForOf"],["class","unclosedOut notExist",4,"ngIf"],[1,"canvasstyle",3,"ngStyle"],["canvasdrawing",""],[1,"lblElement","unclosedOut",3,"click"],[1,"lblName","unclosedOut"],[1,"lblCount","unclosedOut"],[1,"unclosedOut","notExist"],[1,"unclosedOut"]],template:function(t,e){1&t&&(u.Mb(0,"div"),u.Mb(1,"div",0,1),u.Mb(3,"form",2),u.Mb(4,"input",3,4),u.Tb("ngModelChange",function(t){return e.labelSearch=t})("ngModelChange",function(t){return e.labelTypeTextChange(t)}),u.Lb(),u.Lb(),u.Mb(6,"div",5,6),u.Mb(8,"ul",7),u.mc(9,Se,5,2,"li",8),u.mc(10,Ce,7,6,"li",9),u.Lb(),u.Lb(),u.Lb(),u.Ib(11,"canvas",10,11),u.Lb()),2&t&&(u.xb(1),u.ac("hidden",!e.showDropdownLabelBox),u.xb(3),u.ac("ngModel",e.labelSearch)("ngModelOptions",u.cc(6,Me)),u.xb(5),u.ac("ngForOf",e.labelList),u.xb(1),u.ac("ngIf",0===e.labelList.length),u.xb(1),u.ac("ngStyle",u.dc(7,ke,e.currentCursor())))},directives:[yt.n,yt.g,yt.h,yt.a,yt.f,yt.i,i.j,i.k,i.l],pipes:[E.c],styles:[".canvasstyle[_ngcontent-%COMP%]{position:fixed;left:2.2vw;right:auto;top:8vh;overflow:scroll;scrollbar-width:none;margin:0;padding:0;outline:none;border:none}.floatdiv[_ngcontent-%COMP%]{position:absolute;z-index:10000}.availablelbl[_ngcontent-%COMP%]{background-color:#000;width:11vw;height:15vh;color:snow;font-size:2vh;font-weight:700;outline:none;border-radius:.2vh;border:.2vw solid grey;border-top:.1vh dotted snow;overflow:auto;scrollbar-width:none}.availablelbl[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}.lblList[_ngcontent-%COMP%]{padding:0 .2vw}.lblElement[_ngcontent-%COMP%]{list-style-type:none;margin:.3vh 0;padding:0;justify-content:space-between;display:flex}.lblElement[_ngcontent-%COMP%]:hover{background-color:#111}.lblName[_ngcontent-%COMP%]{margin-left:.2vw;overflow:hidden;text-overflow:ellipsis}.lblCount[_ngcontent-%COMP%]{background-color:#222;margin-right:.2vw;padding:.1vh .2vw;border-radius:.2vw}.notExist[_ngcontent-%COMP%]{color:#999;font-size:1.5vh}.lbltypetxt[_ngcontent-%COMP%]{width:11vw;height:4vh;color:snow;font-size:2vh;background-color:#000;outline:none;border-radius:.2vh;border:.2vw solid grey;border-bottom:none;padding:0;text-indent:.4vw}.invalidInput[_ngcontent-%COMP%]{border:.2vw solid red}.validInput[_ngcontent-%COMP%]{border:.2vw solid grey}"],changeDetection:0}),t})();const Oe=["subLabelSelect"],Le=["renameInput"],Ie=["deleteBtn"];function Ae(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"image-labelling-object-detection",61),u.Tb("_onChangeMetadata",function(e){return u.hc(t),u.Vb().onChangeMetadata(e)})("_onChangeAnnotationLabel",function(e){return u.hc(t),u.Vb().onChangeAnnotationLabel(e)})("_onEnterLabel",function(e){return u.hc(t),u.Vb().onProcessLabel(e)}),u.Lb(),u.Jb()}if(2&t){const t=u.Vb();u.xb(1),u.ac("_selectMetadata",t.selectedMetaData)("_imgSrc",t.imgSrc)("_tabStatus",t.tabStatus)}}function Be(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"image-labelling-segmentation",62),u.Tb("_onChangeMetadata",function(e){return u.hc(t),u.Vb().onChangeMetadata(e)})("_onChangeAnnotationLabel",function(e){return u.hc(t),u.Vb().onChangeAnnotationLabel(e)}),u.Lb(),u.Jb()}if(2&t){const t=u.Vb();u.xb(1),u.ac("_selectMetadata",t.selectedMetaData)("_imgSrc",t.imgSrc)("_tabStatus",t.tabStatus)}}function je(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"div",63),u.Mb(2,"label",64),u.Mb(3,"input",65),u.Tb("change",function(){return u.hc(t),u.Vb().onSwitchSaveType()}),u.Lb(),u.Ib(4,"span",66),u.Mb(5,"p"),u.oc(6),u.Wb(7,"translate"),u.Lb(),u.Lb(),u.Ib(8,"span",67),u.Mb(9,"label",64),u.Mb(10,"input",65),u.Tb("change",function(){return u.hc(t),u.Vb().onSwitchSaveType()}),u.Lb(),u.Ib(11,"span",66),u.Mb(12,"p"),u.oc(13),u.Wb(14,"translate"),u.Lb(),u.Lb(),u.Lb(),u.Mb(15,"div",68),u.Tb("click",function(){return u.hc(t),u.Vb().showAdvSettings()}),u.oc(16),u.Wb(17,"translate"),u.Lb(),u.Mb(18,"button",69),u.Tb("click",function(){return u.hc(t),u.Vb().onClickDownload("pascalVoc")}),u.oc(19,"Pascal VOC"),u.Lb(),u.Ib(20,"br"),u.Mb(21,"button",69),u.Tb("click",function(){return u.hc(t),u.Vb().onClickDownload("yolo")}),u.oc(22,"YOLO"),u.Lb(),u.Ib(23,"br"),u.Mb(24,"button",69),u.Tb("click",function(){return u.hc(t),u.Vb().onClickDownload("ocr")}),u.oc(25,"Text OCR"),u.Lb(),u.Ib(26,"br"),u.Mb(27,"button",69),u.Tb("click",function(){return u.hc(t),u.Vb().onClickDownload("label")}),u.oc(28,"Label"),u.Lb(),u.Ib(29,"br"),u.Jb()}if(2&t){const t=u.Vb();u.xb(3),u.ac("checked",t.saveType.saveCurrentImage),u.xb(3),u.pc(u.Xb(7,5,"singleSave")),u.xb(4),u.ac("checked",t.saveType.saveBulk),u.xb(3),u.pc(u.Xb(14,7,"bulkSave")),u.xb(3),u.pc(u.Xb(17,9,"advModal.title"))}}function Ee(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"button",69),u.Tb("click",function(){return u.hc(t),u.Vb().onClickDownload("coco")}),u.oc(2,"COCO"),u.Lb(),u.Ib(3,"br"),u.Mb(4,"button",69),u.Tb("click",function(){return u.hc(t),u.Vb().onClickDownload("json")}),u.oc(5,"JSON"),u.Lb(),u.Ib(6,"br"),u.Mb(7,"button",69),u.Tb("click",function(){return u.hc(t),u.Vb().onClickDownload("label")}),u.oc(8,"Label"),u.Lb(),u.Ib(9,"br"),u.Jb()}}function ze(t,e){1&t&&(u.Mb(0,"p",70),u.oc(1),u.Wb(2,"translate"),u.Lb()),2&t&&(u.xb(1),u.qc(" ",u.Xb(2,1,"advModal.instructionText")," "))}function De(t,e){if(1&t&&(u.Mb(0,"div",71),u.Mb(1,"label",72),u.Mb(2,"input",65),u.Tb("change",function(){const t=e.$implicit;return t.isChoosen=!t.isChoosen}),u.Lb(),u.Ib(3,"span",66),u.Lb(),u.Mb(4,"label",73),u.oc(5),u.Lb(),u.Lb()),2&t){const t=e.$implicit;u.xb(2),u.ac("checked",t.isChoosen),u.xb(3),u.pc(t.label)}}function Te(t,e){1&t&&(u.Mb(0,"div"),u.oc(1),u.Wb(2,"translate"),u.Lb()),2&t&&(u.xb(1),u.qc(" ",u.Xb(2,1,"advModal.noLabel")," "))}function Ne(t,e){if(1&t){const t=u.Nb();u.Mb(0,"button",74),u.Tb("click",function(){return u.hc(t),u.Vb().saveAdvSettings()}),u.oc(1),u.Wb(2,"translate"),u.Lb()}2&t&&(u.xb(1),u.qc(" ",u.Xb(2,1,"advModal.btnSave")," "))}function Re(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"option",75),u.oc(2),u.Lb(),u.Jb()),2&t){const t=e.$implicit,n=u.Vb(2);u.xb(1),u.ac("value",t)("selected",t===n.currentAnnotationLabel),u.xb(1),u.qc(" ",t," ")}}function Fe(t,e){if(1&t&&(u.Kb(0),u.mc(1,Re,3,3,"ng-container",23),u.Jb()),2&t){const t=e.$implicit;u.xb(1),u.ac("ngForOf",t.label_list)}}function We(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"option",75),u.oc(2),u.Lb(),u.Jb()),2&t){const t=e.$implicit,n=u.Vb().$implicit;u.xb(1),u.ac("value",t)("selected",n.label_list[0].label),u.xb(1),u.qc(" ",t," ")}}function Xe(t,e){if(1&t&&(u.Kb(0),u.mc(1,We,3,3,"ng-container",23),u.Jb()),2&t){const t=e.$implicit;u.xb(1),u.ac("ngForOf",t.label_list)}}function Ue(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"div",76),u.oc(2),u.Lb(),u.Jb()),2&t){const t=u.Vb();u.xb(2),u.qc(" ",t.subLabelValidateMsg," ")}}function $e(t,e){if(1&t){const t=u.Nb();u.Kb(0),u.Mb(1,"div",77),u.Mb(2,"label",78),u.oc(3),u.Wb(4,"translate"),u.Lb(),u.Mb(5,"label",79),u.oc(6),u.Wb(7,"translate"),u.Lb(),u.Ib(8,"span",80),u.Mb(9,"button",81),u.Tb("click",function(){u.hc(t);const n=e.index,i=u.Vb(2).index;return u.Vb(3).onRemoveSubLabel(i,n)}),u.oc(10," X "),u.Lb(),u.Lb(),u.Jb()}if(2&t){const t=e.$implicit;u.xb(3),u.rc("",u.Xb(4,4,"labellingArea.label"),": ",t.label,""),u.xb(3),u.rc("",u.Xb(7,6,"labellingArea.regionInfo"),": ",t.region,"")}}function Ye(t,e){if(1&t&&(u.Kb(0),u.Mb(1,"h2",19),u.oc(2),u.Wb(3,"translate"),u.Lb(),u.mc(4,$e,11,8,"ng-container",23),u.Jb()),2&t){const t=u.Vb().$implicit;u.xb(2),u.pc(u.Xb(3,2,"labellingArea.addedSubLabel")),u.xb(2),u.ac("ngForOf",t.subLabel)}}function Ve(t,e){if(1&t&&(u.Kb(0),u.mc(1,Ye,5,4,"ng-container",5),u.Jb()),2&t){const t=e.$implicit,n=e.index,i=u.Vb(3);u.xb(1),u.ac("ngIf",(null==t||null==t.subLabel?null:t.subLabel.length)>0&&n===i.currentAnnotationIndex)}}function He(t,e){if(1&t&&(u.Kb(0),u.mc(1,Ve,2,1,"ng-container",23),u.Jb()),2&t){const t=e.$implicit;u.xb(1),u.ac("ngForOf",null==t?null:t.bnd_box)}}function Ze(t,e){if(1&t&&(u.Kb(0),u.mc(1,He,2,1,"ng-container",23),u.Jb()),2&t){const t=e.$implicit;u.xb(1),u.ac("ngForOf",t.annotation)}}function Ke(t,e){if(1&t&&(u.Mb(0,"tr"),u.Ib(1,"td",82),u.Wb(2,"translate"),u.Ib(3,"td",82),u.Wb(4,"translate"),u.Lb()),2&t){const t=e.$implicit;u.xb(1),u.bc("innerHTML",u.Xb(2,2,t.shortcutKey),u.ic),u.xb(2),u.bc("innerHTML",u.Xb(4,4,t.functionality),u.ic)}}function Je(t,e){if(1&t&&(u.Mb(0,"p",49),u.oc(1),u.Wb(2,"translate"),u.Ib(3,"br"),u.oc(4),u.Lb()),2&t){const t=u.Vb();u.xb(1),u.qc(" ",u.Xb(2,2,"location"),""),u.xb(3),u.qc("",t.modalSpanLocationPath," ")}}function Ge(t,e){1&t&&(u.Mb(0,"label",76),u.oc(1),u.Wb(2,"translate"),u.Lb()),2&t&&(u.xb(1),u.pc(u.Xb(2,1,"renameModal.fail")))}function qe(t,e){1&t&&(u.Mb(0,"label",76),u.oc(1),u.Wb(2,"translate"),u.Lb()),2&t&&(u.xb(1),u.pc(u.Xb(2,1,"renameModal.nameExist")))}function Qe(t,e){1&t&&(u.Mb(0,"label",76),u.oc(1),u.Wb(2,"translate"),u.Lb()),2&t&&(u.xb(1),u.pc(u.Xb(2,1,"renameModal.illegal")))}function tn(t,e){1&t&&(u.Mb(0,"label",76),u.oc(1),u.Wb(2,"translate"),u.Lb()),2&t&&(u.xb(1),u.pc(u.Xb(2,1,"renameModal.nameEmpty")))}const en=[{path:"",component:(()=>{class t{constructor(t,e,n,i,u,b,g,f,m,p,_){this._router=t,this._imgLblApiService=e,this._modalService=n,this._dataSetService=i,this._annotateService=u,this._imgLblActionService=b,this._imgLblLayoutService=g,this._imgLblModeService=f,this._languageService=m,this._spinnerService=p,this._exportSaveFormatService=_,this.currentUrl="",this.selectedProjectName="",this.imgSrc="",this.loading=!1,this.thumbnailList=[],this.unsubscribe$=new l.a,this.subject$=new l.a,this.tabStatus=[{name:"labellingProject.project",closed:!1},{name:"labellingProject.label",closed:!1,label_list:[]},{name:"labellingProject.annotation",closed:!1,annotation:[]}],this.mainLabelRegionVal="",this.subLabelRegionVal="",this.subLabelValidateMsg="",this.currentAnnotationLabel="",this.currentAnnotationIndex=-1,this.currentImageDisplayIndex=-1,this.isLoading=!1,this.showLoading=!1,this.processingNum=0,this.unsupportedImageList=[],this.spanClass="",this.modalSpanMessage="",this.modalSpanLocationPath="",this.sliceNum=0,this.labelList=[],this.isOverlayOn=!1,this.blockLoadThumbnails=!1,this.totalUuid=0,this.labelChoosen=[],this.tempLabelChoosen=[],this.warningMessage="",this.imgPath="",this.imgPathSplit=[],this.newImageName="",this.selectedUuid="",this.renameImageErrorCode=-1,this.dontAskDelete=!1,this.modalExportOptions="modal-export-options",this.modalExportProject="modal-export-project",this.modalShortcutKeyInfo="modal-shortcut-key-info",this.modalUnsupportedImage="modal-unsupported-image",this.modalExportWarning="modalExportWarning",this.modalRenameImage="modal-rename-image",this.modalDeleteImage="modal-delete-image",this.exportModalBodyStyle={minHeight:"15vh",maxHeight:"15vh",minWidth:"19.5vw",maxWidth:"19.5vw",margin:"15vw 71vh",overflow:"none"},this.saveModalBodyStyle={maxHeight:"80vh",minWidth:"28vw",maxWidth:"28vw",margin:"10vh 28vw",overflow:"none"},this.advModalBodyStyle={maxHeight:"80vh",minWidth:"18vw",maxWidth:"18vw",margin:"10vh 28vw",overflow:"none"},this.infoModalBodyStyle={maxHeight:"80vh",minWidth:"40vw",maxWidth:"40vw",margin:"20vh 23vw",padding:"0vh 0vw 3vh 0vw",overflow:"none"},this.exportProjectBodyStyle={minHeight:"10vh",maxHeight:"30vh",minWidth:"31vw",maxWidth:"31vw",margin:"15vw 71vh",overflow:"none"},this.exportWarningBodyStyle={minHeight:"10vh",maxHeight:"20vh",minWidth:"31vw",maxWidth:"31vw",margin:"15vw 71vh",overflow:"none"},this.unsupportedImageBodyStyle={minHeight:"18vh",maxHeight:"30vh",minWidth:"31vw",maxWidth:"31vw",margin:"15vw 71vh",overflow:"none"},this.renameImageBodyStyle={minHeight:"18vh",maxHeight:"30vh",minWidth:"20vw",maxWidth:"20vw",margin:"15vw 71vh",overflow:"none"},this.deleteImageBodyStyle={minHeight:"18vh",maxHeight:"30vh",minWidth:"20vw",maxWidth:"20vw",margin:"15vw 71vh",overflow:"none"},this.saveType={saveCurrentImage:!0,saveBulk:!1},this.projectList={projects:[],isUploading:!1,isFetching:!1},this.startProject=t=>{this.isLoading=!0,this.selectedProjectName=t;const e=this._dataSetService.checkProjectStatus(t),n=this._dataSetService.updateProjectLoadStatus(t),i=this._dataSetService.checkExistProjectStatus(t),a=this._dataSetService.getThumbnailList;this.subjectSubscription=this.subject$.pipe(Object(o.a)(()=>Object(c.a)([e])),Object(s.a)(([{message:t,content:e}])=>{this.totalUuid=e[0].total_uuid,this.projectList={isUploading:this.projectList.isUploading,isFetching:this.projectList.isFetching,projects:this.projectList.projects.map(t=>t.project_name===e[0].project_name?Object.assign(Object.assign({},e[0]),{created_date:t.created_date}):t)};const{is_loaded:n}=e[0];return 1===t&&!n}),Object(o.a)(([{message:t}])=>t?Object(c.a)([n,i]):[]),Object(o.a)(([{},{message:e,uuid_list:n,label_list:r}])=>2===e?(this.labelList=[...r],this.tabStatus[1].label_list=this.labelList,n.length>0?n.map(e=>a(t,e)):[]):Object(h.a)(500).pipe(Object(o.a)(()=>i),Object(s.a)(({message:t})=>2===t),Object(o.a)(({uuid_list:e,label_list:n})=>(this.tabStatus[1].label_list=n,e.length>0?e.slice(this.sliceNum,this.sliceNum+=20).map(e=>a(t,e)):[])))),Object(o.a)(t=>t)).subscribe(t=>{this.thumbnailList=[...this.thumbnailList,t],this.onChangeSchema=Object.assign(Object.assign({},this.onChangeSchema),{totalNumThumbnail:this.thumbnailList.length})},t=>{},()=>{this.isLoading=!1,this._annotateService.labelStaging$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(({annotation:t,isDlbClick:e})=>{e?(this.currentAnnotationIndex=t,this.tabStatus.forEach(({annotation:e})=>null==e?void 0:e.forEach(({bnd_box:e,polygons:n})=>{const i=null!=e?e:n;if(i){const{label:e,region:n}=i[t];this.currentAnnotationLabel=e,this.mainLabelRegionVal=n||""}else console.log("missing prop bnd_box OR polygons")})),this._imgLblActionService.setState({isActiveModal:!0,draw:!1,drag:!1,scroll:!1}),this.onDisplayModal()):(this.currentAnnotationLabel="",this.currentAnnotationIndex=t)}),this._imgLblActionService.action$.pipe(Object(r.a)(this.unsubscribe$)).subscribe(({clear:t,save:e,keyInfo:n})=>{t&&(this.thumbnailList[0].bnd_box&&(this.thumbnailList[this.currentImageDisplayIndex].bnd_box=[]),this.thumbnailList[0].polygons&&(this.thumbnailList[this.currentImageDisplayIndex].polygons=[]),this.onChangeSchema=Object.assign(Object.assign({},this.onChangeSchema),{hasAnnotation:!1})),e&&(this.labelChoosen=this.tabStatus[1].label_list?this.tabStatus[1].label_list.map(t=>({label:t,isChoosen:!0})):[],this.onDisplayModal("modal-save")),n&&this.onDisplayShortcutKeyInfo()}),this.navigateByAction({thumbnailAction:1}),this._spinnerService.hideSpinner()}),this.subject$.next()},this.loadThumbnails=()=>{if(!this.blockLoadThumbnails&&this.sliceNum<this.totalUuid){this.blockLoadThumbnails=!0;const t=this._dataSetService.checkExistProjectStatus(this.selectedProjectName),e=this._dataSetService.getThumbnailList;this.subjectSubscription=this.subject$.pipe(Object(s.a)(),Object(o.a)(()=>Object(h.a)(500).pipe(Object(o.a)(()=>t),Object(s.a)(({message:t})=>2===t),Object(o.a)(({uuid_list:t})=>t.length>0?t.slice(this.sliceNum,this.sliceNum+=10).map(t=>e(this.selectedProjectName,t)):[]))),Object(o.a)(t=>t)).subscribe(t=>{this.thumbnailList=[...this.thumbnailList,t],this.onChangeSchema=Object.assign(Object.assign({},this.onChangeSchema),{totalNumThumbnail:this.thumbnailList.length})},t=>{},()=>{this.blockLoadThumbnails=!1,this._spinnerService.hideSpinner()}),this.subject$.next()}},this.onCheckBboxMetadata=()=>{this.tabStatus.forEach(({annotation:t})=>{t&&(null==t||t.forEach(t=>{var e;null===(e=t.bnd_box)||void 0===e||e.forEach((t,e)=>{if(t.x1>t.x2){const e=t.x1;t.x1=t.x2,t.x2=e}if(t.y1>t.y2){const e=t.y1;t.y1=t.y2,t.y2=e}})}))})},this.updateProjectProgress=()=>{const t=this.selectedProjectName;this.onCheckBboxMetadata(),this._imgLblLayoutService.updateProjectProgress(this.tabStatus,t)},this.onChangeMetadata=t=>{this.tabStatus=this.tabStatus.map(e=>e.annotation?Object.assign(Object.assign({},e),{annotation:[t]}):e),this.thumbnailList=this.thumbnailList.map((e,n)=>this.currentImageDisplayIndex===n?t:e);const e=t.bnd_box?t.bnd_box.length>0:t.polygons.length>0;this.onChangeSchema=Object.assign(Object.assign({},this.onChangeSchema),{hasAnnotation:e}),this.updateProjectProgress()},this.onToggleTab=({name:t,closed:e})=>{!this.tabStatus.some(n=>n.name.toLowerCase()===t.toLowerCase()&&n.closed===e)&&(this.tabStatus=this.tabStatus.map(n=>n.name.toLowerCase()===t.toLowerCase()?Object.assign(Object.assign({},n),{closed:e}):Object.assign({},n)))},this.onExport=()=>{this.modalSpanMessage="",this.modalSpanLocationPath="",this._modalService.open(this.modalExportOptions)},this.exportProject=t=>{"cfgdata"===t&&this.processingNum++;const e=this.selectedProjectName,n=this._imgLblApiService.exportProject(e,t),i=this._imgLblApiService.exportProjectStatus(),a=({message:t})=>1===t?Object(h.a)(500).pipe(Object(o.a)(()=>i),Object(s.a)(({export_status:t})=>(this.isOverlayOn=1===t,this.isLoading=1===t,0===t||2===t||3===t))):Object(d.a)(t=>(console.error(t),t));this.subjectSubscription=this.subject$.pipe(Object(s.a)(),Object(o.a)(()=>n),Object(o.a)(t=>a(t))).subscribe(({export_status:n,project_config_path:i})=>{"cfgdata"===t&&this.processingNum--,2===n?this._languageService._translate.get("exportSuccess").subscribe(t=>{this.toggleExportProjectModalMessage(!0),this.modalSpanMessage=e+t,this.modalSpanLocationPath=i,this.processIsSuccess(!0)}):this._languageService._translate.get("exportFailed").subscribe(t=>{this.toggleExportProjectModalMessage(!0),this.modalSpanMessage=t+e,this.processIsSuccess(!1)})},t=>{},()=>{this.closeExportProjectModal()}),this.subject$.next()},this.toggleExportProjectModalMessage=t=>{this._modalService.open(this.modalExportProject)},this.processIsSuccess=t=>{this.spanClass=t?"validation-success":"validation-error"},this.onReload=()=>{const t=this.selectedProjectName,e=this._imgLblApiService.reloadProject(t),n=this._imgLblApiService.reloadProjectStatus(t),i=this._dataSetService.getThumbnailList,a=[],r=({message:e})=>5!==e&&1===e?Object(h.a)(500).pipe(Object(o.a)(()=>n),Object(s.a)(({file_system_status:t,unsupported_image_list:e})=>(this.unsupportedImageList=e,3===t||0===t)),Object(o.a)(e=>{this.isLoading=!0;let n=[];this.thumbnailList.forEach(t=>{n.push(t.uuid)}),e.uuid_add_list.forEach(t=>{n.push(t),this.totalUuid++}),e.uuid_delete_list.forEach(t=>{n=n.filter(e=>e!==t),this.totalUuid--}),this.sliceNum=0;const a=3===e.file_system_status&&n.length>0?n.slice(this.sliceNum,this.sliceNum+=20).map(e=>i(t,e)):[];return this.thumbnailList=[],a}),Object(o.a)(t=>t)):Object(d.a)(t=>(console.error(t),this.isLoading=!1,t));this.subjectSubscription=this.subject$.pipe(Object(s.a)(),Object(o.a)(()=>e),Object(o.a)(t=>r(t))).subscribe(t=>{this.isLoading=!0,a.push(t)},t=>{},()=>{this.thumbnailList=a,this.onChangeSchema=Object.assign(Object.assign({},this.onChangeSchema),{totalNumThumbnail:this.thumbnailList.length}),this.currentImageDisplayIndex=-1,this.navigateByAction({thumbnailAction:1}),this.isLoading=!1,this.unsupportedImageList.length>0&&this._dataSetService.downloadUnsupportedImageList(t,this.unsupportedImageList).then(t=>{t&&this._modalService.open(this.modalUnsupportedImage)})}),this.subject$.next()},this.navigateByUrl=({url:t})=>{t?this._router.navigate([t]):console.error("No url received from child component")},this.keyDownEvent=({key:t,repeat:e})=>{if(!this.selectedMetaData||this._modalService.isOpened())return;const n=this.selectedMetaData;switch(t){case"ArrowLeft":this._imgLblActionService.action$.pipe(Object(s.a)()).subscribe(({draw:t})=>{t||e||this.navigateByAction({thumbnailAction:-1})});break;case"ArrowRight":this._imgLblActionService.action$.pipe(Object(s.a)()).subscribe(({draw:t})=>{t||e||this.navigateByAction({thumbnailAction:1})});break;case"F2":this.getImageNameFromPath(n),this.renameImageErrorCode=-1,this._modalService.open(this.modalRenameImage),this._renameInput.nativeElement.focus();break;case"Delete":if(-1!==this.currentAnnotationIndex)break;if(this.getImageNameFromPath(n),!this.dontAskDelete){this._modalService.open(this.modalDeleteImage),this._deleteBtn.nativeElement.focus();break}this.onSubmitDeleteImage()}},this.navigateByAction=({thumbnailAction:t})=>{if(t){const e=this._imgLblLayoutService.calculateIndex(t,this.currentImageDisplayIndex,this.thumbnailList.length);if(e!==this.currentImageDisplayIndex){this.currentImageDisplayIndex=e;const t=this.thumbnailList.find((t,n)=>n===e),n=this.thumbnailList.findIndex((t,n)=>n===e);n+3===this.thumbnailList.length&&this.loadThumbnails(),t&&-1!==n&&!this.showLoading&&this.displayImage(Object.assign(Object.assign({},t),{thumbnailIndex:n}))}}},this.displayImage=(t,e=this.selectedProjectName)=>{var n,{thumbnailIndex:i}=t,o=Object(a.b)(t,["thumbnailIndex"]);(null===(n=this.selectedMetaData)||void 0===n?void 0:n.uuid)!==o.uuid&&(this.showLoading=!0,this._imgLblApiService.getBase64Thumbnail(e,o.uuid).pipe(Object(s.a)()).subscribe(({message:t,img_src:e})=>{if(1===t){this.selectedMetaData=o,this.imgSrc=e,this.currentImageDisplayIndex=i;const t=o.bnd_box?o.bnd_box.length>0:o.polygons&&o.polygons.length>0||!1;this.onChangeSchema=Object.assign(Object.assign({},this.onChangeSchema),{currentThumbnailIndex:i+1,thumbnailName:o.img_path,hasAnnotation:t})}},t=>console.error(t),()=>this.showLoading=!1))},this.onProcessLabel=({selectedLabel:t,label_list:e,action:n})=>{const i=t&&!n?e.filter(e=>e!==t):e;this._imgLblApiService.updateLabelList(this.selectedProjectName,i.length>0?i:[]).pipe(Object(s.a)()).subscribe(({message:t})=>{1===t?this.tabStatus=this._imgLblLayoutService.displayLabelList(this.tabStatus,i):console.error("Error while updating label")}),this.updateProjectProgress()},this.onChangeAnnotationLabel=t=>{t.index=this.currentAnnotationIndex,this.selectedMetaData&&this.selectedMetaData.polygons&&(this.selectedMetaData.polygons[t.index].label=t.label),this.tabStatus=this._imgLblLayoutService.changeAnnotationLabel(this.tabStatus,t),this.updateStateToRenderChild(),this.updateProjectProgress()},this.onDeleteAnnotation=t=>{this.tabStatus=this._imgLblLayoutService.deleteAnnotation(this.tabStatus,t),this.updateStateToRenderChild(),this.updateProjectProgress()},this.onDisplayModal=(t="modal-image-labelling")=>{this.subLabelRegionVal="",this.subLabelValidateMsg="",this._modalService.open(t)},this.onCloseModal=(t="modal-image-labelling")=>{this._imgLblActionService.setState({isActiveModal:!1,draw:!0,scroll:!0}),this._modalService.close(t)},this.onChangeInput=(t,e)=>{const{value:n}=t.target;"main"===e?this.mainLabelRegionVal=n:this.subLabelRegionVal=n},this.onSubmitLabel=()=>{const{value:t}=this._subLabelSelect.nativeElement;if(!t.trim())return;let e=!1,n=!1;this.tabStatus.forEach(({annotation:i})=>null==i?void 0:i.forEach(({bnd_box:i,polygons:a})=>{const o=null!=i?i:a;if(o){const{subLabel:i}=o[this.currentAnnotationIndex];e=!!(i&&(null==i?void 0:i.length)>0),e&&(null==i||i.some(({label:e})=>n=e===t))}else console.log("missing prop bnd_box OR polygons")})),n?this.subLabelValidateMsg="Invalid of duplicate label: "+t:(this.tabStatus=this._imgLblLayoutService.submitLabel(this.tabStatus,t,this.currentAnnotationIndex,{mainLabelRegion:this.mainLabelRegionVal,subLabelRegion:this.subLabelRegionVal}),this.subLabelValidateMsg="",this.updateStateToRenderChild(),this.updateProjectProgress()),this.subLabelRegionVal=""},this.onRemoveSubLabel=(t,e)=>{this.tabStatus=this._imgLblLayoutService.removeSubLabel(this.tabStatus,{selectedAnnoIndex:t,selectedSubLabelIndex:e}),this.updateStateToRenderChild(),this.updateProjectProgress()},this.updateStateToRenderChild=()=>{this.tabStatus.forEach(({annotation:t})=>{t&&(this.thumbnailList=this.thumbnailList.map(e=>{var n;return null!==(n=t.find(({uuid:t})=>e.uuid===t))&&void 0!==n?n:e}),this.selectedMetaData=t[0])})},this.resetProjectStatus=(t=this.selectedProjectName)=>{t.trim()&&this._dataSetService.manualCloseProject(t).pipe(Object(r.a)(this.unsubscribe$)).subscribe(({})=>{this._router.navigate(["/"])})},this.onSwitchSaveType=()=>{this.saveType={saveCurrentImage:!this.saveType.saveCurrentImage,saveBulk:!this.saveType.saveBulk}},this.onClickDownload=t=>Object(a.a)(this,void 0,void 0,function*(){const e=this.labelChoosen.filter(t=>!0===t.isChoosen).map(t=>t.label),n=this.labelChoosen.map(t=>t.label);this.saveType.saveBulk&&this.processingNum++;const i=yield this._exportSaveFormatService.exportSaveFormat(Object.assign(Object.assign(Object.assign(Object.assign({},this.saveType),{saveFormat:t,metadata:this.selectedMetaData,index:this.currentAnnotationIndex,projectName:this.selectedProjectName,fullLabelList:n}),(this.saveType.saveBulk||"ocr"===t||"json"===t||"coco"===t)&&{projectFullMetadata:this.thumbnailList}),"json"!==t&&{labelList:e}));0===i.message&&(this.warningMessage=i.msg,this._modalService.open(this.modalExportWarning)),this.saveType.saveBulk&&this.processingNum--}),this._languageService.initializeLanguage("image-labelling",["image-labelling-en","image-labelling-cn","image-labelling-ms"])}ngOnInit(){this.currentUrl=this._router.url;const{projectName:t}=this._imgLblLayoutService.getRouteState(history);this.selectedProjectName=t,this.onChangeSchema=Object.assign(Object.assign({},this.onChangeSchema),{totalNumThumbnail:this.thumbnailList.length}),this.startProject(this.selectedProjectName)}closeExportProjectModal(){this._modalService.close(this.modalExportOptions)}getImageNameFromPath(t){this.imgPath=t.img_path;let e="";const n=window.navigator.platform;e=n.startsWith("Mac")||n.startsWith("Linux")?"/":"\\",this.imgPathSplit=this.imgPath.split(e);const i=this.imgPathSplit.pop();this.newImageName=i?i.split(".")[0]:"",this.imageExt=i?"."+i.split(".").pop():"",this.selectedUuid=t.uuid}onWindowClose(t){this.resetProjectStatus(),t.preventDefault()}onChangeLabel(t){this.onChangeAnnotationLabel({index:this.currentAnnotationIndex,label:t})}onDisplayShortcutKeyInfo(){this._modalService.open(this.modalShortcutKeyInfo)}onLoadMoreThumbnails(){this.loadThumbnails()}onRenameImage(t){this.getImageNameFromPath(t),this.renameImageErrorCode=-1,this._modalService.open(this.modalRenameImage),this._renameInput.nativeElement.focus()}onDeleteImage(t){if(-1===this.currentAnnotationIndex){if(this.getImageNameFromPath(t),!this.dontAskDelete)return this._modalService.open(this.modalDeleteImage),void this._deleteBtn.nativeElement.focus();this.onSubmitDeleteImage()}}onChangeImageName(t){this.newImageName=t.target.value}onSubmitRenameImage(){""!==this.newImageName?this._imgLblApiService.renameImage(this.selectedUuid,this.newImageName+this.imageExt,this.selectedProjectName).subscribe(t=>{if(1===t.message){const t=this.thumbnailList.findIndex(t=>t.uuid===this.selectedUuid);let e="";const n=window.navigator.platform;e=n.startsWith("Mac")||n.startsWith("Linux")?"/":"\\",this.thumbnailList[t].img_path=this.imgPathSplit.join(e)+e+this.newImageName+this.imageExt,this.newImageName="",this._modalService.close(this.modalRenameImage)}else 3!==t.error_code&&(this.renameImageErrorCode=t.error_code)}):this.renameImageErrorCode=3}onSubmitDeleteImage(){this._imgLblApiService.deleteImage(this.selectedUuid,this.imgPath,this.selectedProjectName).subscribe(t=>{1===t.message&&(this.thumbnailList=this.thumbnailList.filter(e=>t.uuid_list.includes(e.uuid)),this.totalUuid=t.uuid_list.length,this.onChangeSchema.currentThumbnailIndex===this.totalUuid+1?(this.onChangeSchema.currentThumbnailIndex--,this.currentImageDisplayIndex--,this.displayOtherImgAfterDelete()):this.displayOtherImgAfterDelete(),this.sliceNum--,this.thumbnailList.length<15&&this.onLoadMoreThumbnails(),this._modalService.close(this.modalDeleteImage))})}displayOtherImgAfterDelete(){const t=this.thumbnailList.find((t,e)=>e===this.currentImageDisplayIndex),e=this.thumbnailList.findIndex((t,e)=>e===this.currentImageDisplayIndex);e+3===this.thumbnailList.length&&this.loadThumbnails(),t&&-1!==e&&!this.showLoading&&this.displayImage(Object.assign(Object.assign({},t),{thumbnailIndex:e}))}showAdvSettings(){this.tempLabelChoosen=this.labelChoosen.map(t=>Object.assign({},t)),this.onDisplayModal("modal-adv")}saveAdvSettings(){this.labelChoosen=this.tempLabelChoosen.map(t=>Object.assign({},t)),this.onCloseModal("modal-adv")}shortcutKeyInfo(){return[{no:1,shortcutKey:"info.shortcut.1.key",functionality:"info.shortcut.1.functionality"},{no:2,shortcutKey:"info.shortcut.2.key",functionality:"info.shortcut.2.functionality"},{no:3,shortcutKey:"info.shortcut.3.key",functionality:"info.shortcut.3.functionality"},{no:4,shortcutKey:"info.shortcut.4.key",functionality:"info.shortcut.4.functionality"},{no:5,shortcutKey:"info.shortcut.5.key",functionality:"info.shortcut.5.functionality"},{no:6,shortcutKey:"info.shortcut.6.key",functionality:"info.shortcut.6.functionality"}]}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete(),this._imgLblModeService.setState(null),this._imgLblActionService.setState(null),this.resetProjectStatus()}}return t.\u0275fac=function(e){return new(e||t)(u.Hb(b.a),u.Hb(_),u.Hb(v.a),u.Hb(y.a),u.Hb(S),u.Hb(M),u.Hb(k),u.Hb(p.a),u.Hb(P.a),u.Hb(O.a),u.Hb(A))},t.\u0275cmp=u.Bb({type:t,selectors:[["image-labelling-layout"]],viewQuery:function(t,e){if(1&t&&(u.tc(Oe,!0),u.tc(Le,!0),u.tc(Ie,!0)),2&t){let t;u.ec(t=u.Ub())&&(e._subLabelSelect=t.first),u.ec(t=u.Ub())&&(e._renameInput=t.first),u.ec(t=u.Ub())&&(e._deleteBtn=t.first)}},hostBindings:function(t,e){1&t&&u.Tb("keydown",function(t){return e.keyDownEvent(t)},!1,u.gc)("beforeunload",function(t){return e.onWindowClose(t)},!1,u.gc)},decls:148,vars:162,consts:[[1,"layout-container"],[3,"_onChange"],[3,"_totalUuid","_onChange","_tabStatus","_onClick"],[1,"content-container"],[3,"_onChange","_currentUrl","_tabStatus"],[4,"ngIf"],[3,"_onChange","_selectMetadata","_totalUuid","_thumbnailList","_tabStatus","_onClose","_onClickThumbnail","_onClickLabel","_onEnterLabel","_onChangeAnnotationLabel","_onDeleteAnnotation","_loadMoreThumbnails","_onRenameImage","_onDeleteImage"],[3,"_onChange","_onClick","_onExport","_onReload"],[3,"_thumbnailInfo","_imgSrc"],["id","modal-save",3,"id","modalBodyStyle","scrollable"],[1,"save-format-list"],[1,"save-format-content"],["id","modal-adv",3,"id","modalBodyStyle","modalTitle","scrollable","zIndex"],[1,"modal-adv-container"],["class","modal-adv-instruction",4,"ngIf"],["class","margin-bottom",4,"ngFor","ngForOf"],["class","button-style modal-adv-btn",3,"click",4,"ngIf"],["id","modal-image-labelling",3,"id","scrollable","showHeader"],[1,"modal-button","close-button","float-right",3,"click"],[1,"font-title"],[1,"main-label-container"],[1,"font-label"],[1,"static-select",3,"change"],[4,"ngFor","ngForOf"],["type","text",1,"static-input",3,"value","placeholder","change"],[1,"hr-line"],[1,"sub-label-container"],[1,"static-select"],["subLabelSelect",""],[1,"modal-button",3,"click"],[3,"id","modalBodyStyle","modalTitle","scrollable"],[1,"export-content-container"],[1,"modal-button-container"],[1,"button-style","confg-btn",3,"click"],[1,"button-style","confgdata-btn",3,"click"],[1,"with-data"],[1,"help-icon-container"],["src","../../assets/icons/help.svg",1,"help-icon"],[1,"tooltiptext"],[3,"id","modalBodyStyle","scrollable"],[1,"shortcut-key-info-header"],[1,"table-box"],["cellpadding","20"],[1,"modal-content-container"],[1,"modal-message-container"],["class","message",4,"ngIf"],[3,"ngClass"],[1,"error-msg",3,"innerHTML"],[3,"id","modalBodyStyle","modalTitle","scrollable","zIndex"],[1,"message"],["type","text",1,"static-input",3,"value","placeholder","change","keydown.enter"],["renameInput",""],["class","validate-msg",4,"ngIf"],[1,"button-style","renameimg-btn",3,"click"],[1,"font-delete-img"],["type","checkbox",1,"checkbox",3,"checked","change"],[1,"button-style","deleteimg-btn",3,"click"],["deleteBtn",""],[3,"_modalUnsupportedImage","_unsupportedImageBodyStyle","_unsupportedImageList"],[3,"_loading"],[3,"_processingNum"],[3,"_selectMetadata","_imgSrc","_tabStatus","_onChangeMetadata","_onChangeAnnotationLabel","_onEnterLabel"],[3,"_selectMetadata","_imgSrc","_tabStatus","_onChangeMetadata","_onChangeAnnotationLabel"],[1,"switch-container"],[1,"switch"],["type","checkbox",1,"checkBox",3,"checked","change"],[1,"slider","round"],[1,"space-verticle"],[1,"adv-settings",3,"click"],[1,"save-format-btn",3,"click"],[1,"modal-adv-instruction"],[1,"margin-bottom"],[1,"switch-2","no-margin-left"],[1,"modal-adv-label"],[1,"button-style","modal-adv-btn",3,"click"],[3,"value","selected"],[1,"validate-msg"],[1,"sub-label-flex-container","sub-label-padding"],[1,"font-label","flex-first"],[1,"font-label","flex-second"],[1,"flex-third"],[1,"modal-butto","flex-fourth",3,"click"],[3,"innerHTML"]],template:function(t,e){1&t&&(u.Mb(0,"div",0),u.Mb(1,"div"),u.Ib(2,"page-header",1),u.Mb(3,"image-labelling-info",2),u.Tb("_onClick",function(t){return e.navigateByAction(t)}),u.Lb(),u.Lb(),u.Mb(4,"div",3),u.Ib(5,"image-labelling-left-sidebar",4),u.mc(6,Ae,2,3,"ng-container",5),u.mc(7,Be,2,3,"ng-container",5),u.Mb(8,"image-labelling-project",6),u.Tb("_onClose",function(t){return e.onToggleTab(t)})("_onClickThumbnail",function(t){return e.displayImage(t)})("_onClickLabel",function(t){return e.onProcessLabel(t)})("_onEnterLabel",function(t){return e.onProcessLabel(t)})("_onChangeAnnotationLabel",function(t){return e.onChangeAnnotationLabel(t)})("_onDeleteAnnotation",function(t){return e.onDeleteAnnotation(t)})("_loadMoreThumbnails",function(){return e.onLoadMoreThumbnails()})("_onRenameImage",function(t){return e.onRenameImage(t)})("_onDeleteImage",function(t){return e.onDeleteImage(t)}),u.Lb(),u.Mb(9,"image-labelling-right-sidebar",7),u.Tb("_onClick",function(t){return e.onToggleTab(t)})("_onExport",function(){return e.onExport()})("_onReload",function(){return e.onReload()}),u.Lb(),u.Lb(),u.Ib(10,"image-labelling-footer",8),u.Lb(),u.Mb(11,"modal",9),u.Mb(12,"div",10),u.Mb(13,"div",11),u.mc(14,je,30,11,"ng-container",5),u.mc(15,Ee,10,0,"ng-container",5),u.Lb(),u.Lb(),u.Lb(),u.Mb(16,"modal",12),u.Wb(17,"translate"),u.Mb(18,"div",13),u.mc(19,ze,3,3,"p",14),u.mc(20,De,6,2,"div",15),u.mc(21,Te,3,3,"div",5),u.mc(22,Ne,3,3,"button",16),u.Lb(),u.Lb(),u.Mb(23,"modal",17),u.Mb(24,"button",18),u.Tb("click",function(){return e.onCloseModal()}),u.oc(25,"\u2716"),u.Lb(),u.Mb(26,"div"),u.Mb(27,"h2",19),u.oc(28),u.Wb(29,"translate"),u.Lb(),u.Mb(30,"div",20),u.Mb(31,"label",21),u.oc(32),u.Wb(33,"translate"),u.Lb(),u.Mb(34,"select",22),u.Tb("change",function(t){return e.onChangeLabel(t.target.value)}),u.mc(35,Fe,2,1,"ng-container",23),u.Lb(),u.Mb(36,"label",21),u.oc(37),u.Wb(38,"translate"),u.Lb(),u.Mb(39,"input",24),u.Tb("change",function(t){return e.onChangeInput(t,"main")}),u.Wb(40,"translate"),u.Lb(),u.Lb(),u.Lb(),u.Ib(41,"hr",25),u.Mb(42,"div"),u.Mb(43,"h2",19),u.oc(44),u.Wb(45,"translate"),u.Lb(),u.Mb(46,"div",26),u.Mb(47,"label",21),u.oc(48),u.Wb(49,"translate"),u.Lb(),u.Mb(50,"select",27,28),u.mc(52,Xe,2,1,"ng-container",23),u.Lb(),u.Mb(53,"label",21),u.oc(54),u.Wb(55,"translate"),u.Lb(),u.Mb(56,"input",24),u.Tb("change",function(t){return e.onChangeInput(t,"sub")}),u.Wb(57,"translate"),u.Lb(),u.Mb(58,"button",29),u.Tb("click",function(){return e.onSubmitLabel()}),u.oc(59),u.Wb(60,"translate"),u.Lb(),u.Lb(),u.mc(61,Ue,3,1,"ng-container",5),u.Lb(),u.Ib(62,"hr",25),u.mc(63,Ze,2,1,"ng-container",23),u.Lb(),u.Mb(64,"modal",30),u.Wb(65,"translate"),u.Mb(66,"div",31),u.Mb(67,"div",32),u.Mb(68,"button",33),u.Tb("click",function(){return e.exportProject("cfg")}),u.oc(69),u.Wb(70,"translate"),u.Lb(),u.Mb(71,"button",34),u.Tb("click",function(){return e.exportProject("cfgdata")}),u.oc(72),u.Wb(73,"translate"),u.Ib(74,"br"),u.Mb(75,"span",35),u.oc(76),u.Wb(77,"translate"),u.Lb(),u.Lb(),u.Mb(78,"div",36),u.Ib(79,"img",37),u.Mb(80,"span",38),u.Mb(81,"p"),u.oc(82),u.Wb(83,"translate"),u.Lb(),u.Mb(84,"p"),u.oc(85),u.Wb(86,"translate"),u.Lb(),u.Mb(87,"p"),u.oc(88),u.Wb(89,"translate"),u.Lb(),u.Lb(),u.Lb(),u.Lb(),u.Lb(),u.Lb(),u.Mb(90,"modal",39),u.Mb(91,"div",40),u.oc(92),u.Wb(93,"translate"),u.Lb(),u.Mb(94,"div",41),u.Mb(95,"table",42),u.mc(96,Ke,5,6,"tr",23),u.Lb(),u.Lb(),u.Lb(),u.Mb(97,"modal",30),u.Wb(98,"translate"),u.Ib(99,"br"),u.Mb(100,"div",43),u.Mb(101,"div",44),u.mc(102,Je,5,4,"p",45),u.Lb(),u.Mb(103,"div",46),u.Ib(104,"p",47),u.Lb(),u.Lb(),u.Lb(),u.Mb(105,"modal",48),u.Wb(106,"translate"),u.Ib(107,"br"),u.Mb(108,"div",43),u.Mb(109,"div",44),u.Mb(110,"p",49),u.oc(111),u.Wb(112,"translate"),u.Lb(),u.Lb(),u.Lb(),u.Lb(),u.Mb(113,"modal",30),u.Wb(114,"translate"),u.Mb(115,"div",43),u.Mb(116,"label",21),u.oc(117),u.Wb(118,"translate"),u.Lb(),u.Mb(119,"input",50,51),u.Tb("change",function(t){return e.onChangeImageName(t)})("keydown.enter",function(t){return e.onChangeImageName(t),e.onSubmitRenameImage()}),u.Wb(121,"translate"),u.Lb(),u.Ib(122,"br"),u.Ib(123,"br"),u.mc(124,Ge,3,3,"label",52),u.mc(125,qe,3,3,"label",52),u.mc(126,Qe,3,3,"label",52),u.mc(127,tn,3,3,"label",52),u.Mb(128,"button",53),u.Tb("click",function(){return e.onSubmitRenameImage()}),u.oc(129),u.Wb(130,"translate"),u.Lb(),u.Lb(),u.Lb(),u.Mb(131,"modal",30),u.Wb(132,"translate"),u.Mb(133,"div",43),u.Mb(134,"p",54),u.oc(135),u.Wb(136,"translate"),u.Lb(),u.Mb(137,"p",54),u.Mb(138,"input",55),u.Tb("change",function(){return e.dontAskDelete=!e.dontAskDelete}),u.Lb(),u.oc(139),u.Wb(140,"translate"),u.Lb(),u.Mb(141,"button",56,57),u.Tb("click",function(){return e.onSubmitDeleteImage()}),u.oc(143),u.Wb(144,"translate"),u.Lb(),u.Lb(),u.Lb(),u.Ib(145,"unsupported-image-modal",58),u.Ib(146,"spinner",59),u.Ib(147,"toastr",60)),2&t&&(u.xb(2),u.ac("_onChange",e.onChangeSchema),u.xb(1),u.ac("_totalUuid",e.totalUuid)("_onChange",e.onChangeSchema)("_tabStatus",e.tabStatus),u.xb(2),u.ac("_onChange",e.onChangeSchema)("_currentUrl",e.currentUrl)("_tabStatus",e.tabStatus),u.xb(1),u.ac("ngIf",e._router.url.includes("imglabel/bndbox")),u.xb(1),u.ac("ngIf",e._router.url.includes("imglabel/seg")),u.xb(1),u.ac("_onChange",e.onChangeSchema)("_selectMetadata",e.selectedMetaData)("_totalUuid",e.totalUuid)("_thumbnailList",e.thumbnailList)("_tabStatus",e.tabStatus),u.xb(1),u.ac("_onChange",e.onChangeSchema),u.xb(1),u.ac("_thumbnailInfo",e.selectedMetaData)("_imgSrc",e.imgSrc),u.xb(1),u.ac("id","modal-save")("modalBodyStyle",e.saveModalBodyStyle)("scrollable",!0),u.xb(3),u.ac("ngIf",null==e.selectedMetaData?null:e.selectedMetaData.bnd_box),u.xb(1),u.ac("ngIf",null==e.selectedMetaData?null:e.selectedMetaData.polygons),u.xb(1),u.ac("id","modal-adv")("modalBodyStyle",e.advModalBodyStyle)("modalTitle",u.Xb(17,104,"advModal.title"))("scrollable",!0)("zIndex",2),u.xb(3),u.ac("ngIf",0!==e.tempLabelChoosen.length),u.xb(1),u.ac("ngForOf",e.tempLabelChoosen),u.xb(1),u.ac("ngIf",0===e.tempLabelChoosen.length),u.xb(1),u.ac("ngIf",0!==e.tempLabelChoosen.length),u.xb(1),u.ac("id","modal-image-labelling")("scrollable",!0)("showHeader",!1),u.xb(5),u.pc(u.Xb(29,106,"labellingArea.mainLabel")),u.xb(4),u.qc("",u.Xb(33,108,"labellingArea.label"),": "),u.xb(3),u.ac("ngForOf",e.tabStatus),u.xb(2),u.qc("",u.Xb(38,110,"labellingArea.regionInfo"),": "),u.xb(2),u.ac("value",e.mainLabelRegionVal)("placeholder",u.Xb(40,112,"labellingArea.mainRegionInfo")),u.xb(5),u.pc(u.Xb(45,114,"labellingArea.subLabel")),u.xb(4),u.qc("",u.Xb(49,116,"labellingArea.label"),": "),u.xb(4),u.ac("ngForOf",e.tabStatus),u.xb(2),u.qc("",u.Xb(55,118,"labellingArea.regionInfo"),": "),u.xb(2),u.ac("value",e.subLabelRegionVal)("placeholder",u.Xb(57,120,"labellingArea.subRegionInfo")),u.xb(3),u.qc(" ",u.Xb(60,122,"labellingArea.add")," "),u.xb(2),u.ac("ngIf",e.subLabelValidateMsg),u.xb(2),u.ac("ngForOf",e.tabStatus),u.xb(1),u.ac("id",e.modalExportOptions)("modalBodyStyle",e.exportModalBodyStyle)("modalTitle",u.Xb(65,124,"exportModal.exportOptions"))("scrollable",!1),u.xb(5),u.qc(" ",u.Xb(70,126,"exportModal.configFile")," "),u.xb(3),u.qc(" ",u.Xb(73,128,"exportModal.zipFile")," "),u.xb(4),u.pc(u.Xb(77,130,"exportModal.withData")),u.xb(6),u.qc("",u.Xb(83,132,"configFileInfoTitle"),":"),u.xb(3),u.pc(u.Xb(86,134,"configFileInfoDest1")),u.xb(3),u.pc(u.Xb(89,136,"configFileInfoDest2")),u.xb(2),u.ac("id",e.modalShortcutKeyInfo)("modalBodyStyle",e.infoModalBodyStyle)("scrollable",!0),u.xb(2),u.pc(u.Xb(93,138,"info.header")),u.xb(4),u.ac("ngForOf",e.shortcutKeyInfo()),u.xb(1),u.ac("id",e.modalExportProject)("modalBodyStyle",e.exportProjectBodyStyle)("modalTitle",u.Xb(98,140,"exportTitle"))("scrollable",!1),u.xb(5),u.ac("ngIf",e.modalSpanLocationPath.trim()),u.xb(1),u.ac("ngClass",e.spanClass),u.xb(1),u.ac("innerHTML",e.modalSpanMessage,u.ic),u.xb(1),u.ac("id",e.modalExportWarning)("modalBodyStyle",e.exportWarningBodyStyle)("modalTitle",u.Xb(106,142,"exportTitle"))("scrollable",!1)("zIndex",2),u.xb(6),u.pc(u.Xb(112,144,e.warningMessage)),u.xb(2),u.ac("id",e.modalRenameImage)("modalBodyStyle",e.renameImageBodyStyle)("modalTitle",u.Xb(114,146,"renameModal.renameImg"))("scrollable",!1),u.xb(4),u.qc("",u.Xb(118,148,"renameModal.imageName"),": "),u.xb(2),u.ac("value",e.newImageName)("placeholder",u.Xb(121,150,"renameModal.typeNewName")),u.xb(5),u.ac("ngIf",0===e.renameImageErrorCode),u.xb(1),u.ac("ngIf",1===e.renameImageErrorCode),u.xb(1),u.ac("ngIf",2===e.renameImageErrorCode),u.xb(1),u.ac("ngIf",3===e.renameImageErrorCode),u.xb(2),u.qc(" ",u.Xb(130,152,"renameModal.submit")," "),u.xb(2),u.ac("id",e.modalDeleteImage)("modalBodyStyle",e.deleteImageBodyStyle)("modalTitle",u.Xb(132,154,"deleteModal.deleteImg"))("scrollable",!1),u.xb(4),u.sc("",u.Xb(136,156,"deleteModal.confirmation")," ",e.newImageName,"",e.imageExt," ?"),u.xb(3),u.ac("checked",e.dontAskDelete),u.xb(1),u.qc(" ",u.Xb(140,158,"deleteModal.dontask")," "),u.xb(4),u.qc(" ",u.Xb(144,160,"deleteModal.confirm")," "),u.xb(2),u.ac("_modalUnsupportedImage",e.modalUnsupportedImage)("_unsupportedImageBodyStyle",e.unsupportedImageBodyStyle)("_unsupportedImageList",e.unsupportedImageList),u.xb(1),u.ac("_loading",e.isLoading),u.xb(1),u.ac("_processingNum",e.processingNum))},directives:[B.a,X,ft,i.k,Ft,Xt,Yt,Vt.a,i.j,i.i,Ht.a,Zt.a,te,pe,Pe,yt.j,yt.m],pipes:[E.c],styles:['.layout-container[_ngcontent-%COMP%]{-webkit-user-select:none;-moz-user-select:none;user-select:none}.content-container[_ngcontent-%COMP%]{display:flex;justify-content:space-between;min-width:97.8vw;max-width:97.8vw}.modal-button[_ngcontent-%COMP%]{line-height:1vh;font-size:1vw;padding:.5vw;background:#262a2e;color:azure}.close-button[_ngcontent-%COMP%]{border:none;cursor:pointer}.float-right[_ngcontent-%COMP%]{float:right}.font-title[_ngcontent-%COMP%]{font-size:1.7vw}.font-label[_ngcontent-%COMP%]{line-height:4vh;font-size:1vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.main-label-container[_ngcontent-%COMP%]{min-width:35vw;max-width:35vw}.main-label-container[_ngcontent-%COMP%], .sub-label-container[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.sub-label-container[_ngcontent-%COMP%]{min-width:40vw;max-width:40vw}.sub-label-flex-container[_ngcontent-%COMP%]{display:flex;align-items:center;flex:1 1 100%;min-width:0}.static-select[_ngcontent-%COMP%]{min-height:4vh;max-height:4vh;min-width:10vw;max-width:10vw;line-height:3vh;font-size:.9vw;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:5vh;margin:0;-moz-text-align-last:center;text-align-last:center;background:#262a2e;color:#fff;box-shadow:inset -.5vw 6.25vw 1vw 0 rgba(0,0,0,.2),inset -.5vw -.5vw 1vw 0 hsla(0,0%,100%,.4)}.static-select[_ngcontent-%COMP%]:hover{box-shadow:inset -.375vw -.375vw .625vw 0 rgba(0,0,0,.2),inset .375vw .375vw .625vw 0 hsla(0,0%,100%,.5)}.static-select[_ngcontent-%COMP%]:active{box-shadow:inset .375vw .375vw .625vw 0 rgba(0,0,0,.2),inset -.375vw -.375vw .625vw 0 hsla(0,0%,100%,.5)}.static-input[_ngcontent-%COMP%]{min-height:4vh;max-height:4vh;min-width:10vw;max-width:10vw;line-height:3vh;font-size:.9vw;border-radius:2vw;border:none;outline:none;background-color:#363636;color:#fff;padding:0 1vw}.hr-line[_ngcontent-%COMP%]{margin:5vh 0}.sub-label-padding[_ngcontent-%COMP%]{padding:0 0 2vh}.validate-msg[_ngcontent-%COMP%]{color:red;font-size:1vw}.flex-first[_ngcontent-%COMP%]{flex:1 1 35%}.flex-second[_ngcontent-%COMP%]{flex:1 1 55%}.flex-third[_ngcontent-%COMP%]{flex:0 0 5%}.flex-fourth[_ngcontent-%COMP%]{line-height:1vh;font-size:1vw;padding:.5vw;background:#262a2e;color:azure;flex:0 0 5%}.modal[_ngcontent-%COMP%]{z-index:1000;padding-top:10vh;top:0;width:100%;height:100%;overflow:auto;background-color:transparent;scrollbar-width:none;position:fixed;background:rgba(0,0,0,.8)}.modal-content[_ngcontent-%COMP%]{background-color:#525353;padding:1vw;max-width:20vw;min-width:20vw;border-radius:1vw;margin:15vh auto auto}.modal-content-container[_ngcontent-%COMP%]{margin-left:1.3vw}.modal-content-header[_ngcontent-%COMP%]{text-align:center;color:#fff;font-size:3vh}.modal-button-container[_ngcontent-%COMP%]{display:flex;justify-content:center;padding:1vw 1vw 1vw 2vw}.modal-button-cancel[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.export-content-container[_ngcontent-%COMP%]{margin-left:.5vw}.button-style[_ngcontent-%COMP%]{border-radius:1vh;border:none;outline:none;color:#fff;cursor:pointer}.confg-btn[_ngcontent-%COMP%]{margin-right:.7vw}.confg-btn[_ngcontent-%COMP%], .confgdata-btn[_ngcontent-%COMP%]{padding:1vh .5vw;background-color:#2d8ceb;font-size:2vh;min-width:7.5vw}.cancel-btn[_ngcontent-%COMP%], .with-data[_ngcontent-%COMP%]{font-size:1.5vh}.cancel-btn[_ngcontent-%COMP%]{padding:1vh 1vw;background-color:#444}.error-msg[_ngcontent-%COMP%]{padding-top:1vh;font-size:2vh}.help-icon[_ngcontent-%COMP%]{height:3vh}.help-icon-container[_ngcontent-%COMP%]{padding-right:1vw;padding-left:.4vw}.help-icon-container[_ngcontent-%COMP%]   .tooltiptext[_ngcontent-%COMP%]{visibility:hidden;width:15vw;background-color:#000;color:#fff;text-align:left;border-radius:6px;padding:1vh .5vw;position:absolute;top:65%;margin-left:-60px;text-align:justify;text-justify:inter-word}.help-icon-container[_ngcontent-%COMP%]:hover   .tooltiptext[_ngcontent-%COMP%]{visibility:visible}.message[_ngcontent-%COMP%]{font-size:1vw;overflow-wrap:break-word}.modal-message-container[_ngcontent-%COMP%]{padding-right:3.5vw}.break[_ngcontent-%COMP%]{overflow-wrap:break-word}.save-format-list[_ngcontent-%COMP%]{left:0;top:0;width:100%;height:100%;overflow:auto}.save-format-content[_ngcontent-%COMP%]{margin:auto;padding:10px}.switch-container[_ngcontent-%COMP%]{font-size:small;align-content:center;text-align:center}.switch[_ngcontent-%COMP%]{position:relative;display:inline-block;width:4em;height:1.8em;margin-left:auto;margin-right:auto}.switch[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{opacity:0;width:0;height:0}.switch[_ngcontent-%COMP%]   .checkBox[_ngcontent-%COMP%]:checked + .slider[_ngcontent-%COMP%]{background:#000;background-size:100% 100%;background-position:50%}.switch[_ngcontent-%COMP%]   .checkBox[_ngcontent-%COMP%]:checked + .slider[_ngcontent-%COMP%]:before{transform:translateX(2.2em)}.switch[_ngcontent-%COMP%]   .slider[_ngcontent-%COMP%]{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;transition:.8s}.switch[_ngcontent-%COMP%]   .slider[_ngcontent-%COMP%]:before{position:absolute;content:"";height:1.6em;width:1.6em;left:.14em;bottom:.15em;background-color:snow;transition:.8s}.switch[_ngcontent-%COMP%]   .round[_ngcontent-%COMP%]{border-radius:1.2em}.switch[_ngcontent-%COMP%]   .round[_ngcontent-%COMP%]:before{border-radius:50%}.switch[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{padding-top:8px;margin-top:.5em;outline:none}.switch-2[_ngcontent-%COMP%]{position:relative;display:inline-block;width:2.5em;height:1.2em;margin-left:auto;margin-right:auto}.switch-2[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{opacity:0;width:0;height:0}.switch-2[_ngcontent-%COMP%]   .checkBox[_ngcontent-%COMP%]:checked + .slider[_ngcontent-%COMP%]{background:#000;background-size:100% 100%;background-position:50%}.switch-2[_ngcontent-%COMP%]   .checkBox[_ngcontent-%COMP%]:checked + .slider[_ngcontent-%COMP%]:before{transform:translateX(1.5em)}.switch-2[_ngcontent-%COMP%]   .slider[_ngcontent-%COMP%]{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;transition:.5s}.switch-2[_ngcontent-%COMP%]   .slider[_ngcontent-%COMP%]:before{position:absolute;content:"";height:1.2em;width:1.2em;left:.14em;background-color:snow;transition:.5s}.switch-2[_ngcontent-%COMP%]   .round[_ngcontent-%COMP%]{border-radius:1.2em}.switch-2[_ngcontent-%COMP%]   .round[_ngcontent-%COMP%]:before{border-radius:50%}.switch-2[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{padding-top:8px;margin-top:.5em;outline:none}.no-margin-left[_ngcontent-%COMP%]{margin-left:0}.space-verticle[_ngcontent-%COMP%]{background-color:transparent;outline:none;border:none;margin-left:1.5em;margin-right:1.5em}.save-format-btn[_ngcontent-%COMP%]{width:90%;height:6em;margin-top:2%;margin-bottom:2%;margin-left:4.5%;background:#000;background-size:100% 100%;background-position:50%;font-size:medium;outline:none;border:none;color:snow;overflow:hidden;border-radius:5px}.save-format-btn[_ngcontent-%COMP%]:hover{text-shadow:0 0 30px #888;box-shadow:5px 5px 10px #888,-5px -5px 10px #888;cursor:pointer}.save-format-btn[_ngcontent-%COMP%]:active:hover{border:3px dashed green}.adv-settings[_ngcontent-%COMP%]{padding:1vh;margin:1vh 1.5vw;color:#ccc;font-size:.6vw;cursor:pointer;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;background:#30353a;border-radius:.5vh;float:right}.adv-settings[_ngcontent-%COMP%]:hover{background:#373d42}.modal-adv-container[_ngcontent-%COMP%]{margin:1vh 1vw}.modal-adv-instruction[_ngcontent-%COMP%]{color:#fff;opacity:.5}.modal-adv-label[_ngcontent-%COMP%]{font-size:1.5vh;margin-left:2vw;white-space:nowrap;width:9vw;overflow:hidden;text-overflow:ellipsis;display:inline-block}.modal-adv-btn[_ngcontent-%COMP%]{float:right;padding:.5vh 1vw;background-color:#2d8ceb;font-size:1.5vh;min-width:3vw}.shortcut-key-info-header[_ngcontent-%COMP%]{font-size:1.2vw;color:#fff;text-align:center;margin-bottom:2vh}.table-box[_ngcontent-%COMP%]{width:100%;height:90%;overflow-y:auto}table[_ngcontent-%COMP%]{width:100%}table[_ngcontent-%COMP%], td[_ngcontent-%COMP%], th[_ngcontent-%COMP%]{border-collapse:collapse;text-align:center;color:#fff}th[_ngcontent-%COMP%]{top:0;background:#262a2e;color:#fff;border-top:none!important}tr[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(2){color:#bebebe}tr[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child{width:60px;text-align:center;background:#262a2e}.validation-error[_ngcontent-%COMP%]{margin:1px;color:red}.validation-success[_ngcontent-%COMP%]{margin:1px;color:green}.label[_ngcontent-%COMP%]{color:#fff;font-size:2vh;margin-right:1vw}.label-file[_ngcontent-%COMP%]{padding-top:.5vh}.margin-bottom[_ngcontent-%COMP%]{margin-bottom:.5vh}.deleteimg-btn[_ngcontent-%COMP%], .renameimg-btn[_ngcontent-%COMP%]{padding:1vh .5vw;background-color:#2d8ceb;margin-top:.7vw;margin-right:.7vw;font-size:2vh;min-width:7.5vw;float:right}.font-delete-img[_ngcontent-%COMP%]{line-height:4vh;font-size:1vw}.checkbox[_ngcontent-%COMP%]{height:1.5vh;width:1.5vw}']}),t})()}];let nn=(()=>{class t{}return t.\u0275mod=u.Fb({type:t}),t.\u0275inj=u.Eb({factory:function(e){return new(e||t)},imports:[[b.d.forChild(en)]]}),t})();var an=n("KZX/");let on=(()=>{class t{}return t.\u0275mod=u.Fb({type:t}),t.\u0275inj=u.Eb({factory:function(e){return new(e||t)},imports:[[i.b,an.a,E.b]]}),t})();var sn=n("RKnZ"),rn=n("O+1G");let ln=(()=>{class t{}return t.\u0275mod=u.Fb({type:t}),t.\u0275inj=u.Eb({factory:function(e){return new(e||t)},imports:[[i.b,an.a,E.b,nn,sn.a,b.d,rn.a,on]]}),t})()},xOOu:function(t,e,n){t.exports=function t(e,n,i){function a(s,r){if(!n[s]){if(!e[s]){if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){return a(e[s][1][t]||t)},c,c.exports,t,e,n,i)}return n[s].exports}for(var o=!1,s=0;s<i.length;s++)a(i[s]);return a}({1:[function(t,e,n){"use strict";var i=t("./utils"),a=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(t){for(var e,n,a,s,r,l,c=[],h=0,d=t.length,u=d,b="string"!==i.getTypeOf(t);h<t.length;)u=d-h,a=b?(e=t[h++],n=h<d?t[h++]:0,h<d?t[h++]:0):(e=t.charCodeAt(h++),n=h<d?t.charCodeAt(h++):0,h<d?t.charCodeAt(h++):0),s=(3&e)<<4|n>>4,r=1<u?(15&n)<<2|a>>6:64,l=2<u?63&a:64,c.push(o.charAt(e>>2)+o.charAt(s)+o.charAt(r)+o.charAt(l));return c.join("")},n.decode=function(t){var e,n,i,s,r,l,c=0,h=0,d="data:";if(t.substr(0,d.length)===d)throw new Error("Invalid base64 input, it looks like a data url.");var u,b=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===o.charAt(64)&&b--,t.charAt(t.length-2)===o.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(u=a.uint8array?new Uint8Array(0|b):new Array(0|b);c<t.length;)e=o.indexOf(t.charAt(c++))<<2|(s=o.indexOf(t.charAt(c++)))>>4,n=(15&s)<<4|(r=o.indexOf(t.charAt(c++)))>>2,i=(3&r)<<6|(l=o.indexOf(t.charAt(c++))),u[h++]=e,64!==r&&(u[h++]=n),64!==l&&(u[h++]=i);return u}},{"./support":30,"./utils":32}],2:[function(t,e,n){"use strict";var i=t("./external"),a=t("./stream/DataWorker"),o=t("./stream/DataLengthProbe"),s=t("./stream/Crc32Probe");function r(t,e,n,i,a){this.compressedSize=t,this.uncompressedSize=e,this.crc32=n,this.compression=i,this.compressedContent=a}o=t("./stream/DataLengthProbe"),r.prototype={getContentWorker:function(){var t=new a(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new a(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},r.createWorkerFrom=function(t,e,n){return t.pipe(new s).pipe(new o("uncompressedSize")).pipe(e.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",e)},e.exports=r},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,n){"use strict";var i=t("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(t){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},n.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,n){"use strict";var i=t("./utils"),a=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==i.getTypeOf(t)?function(t,e,n,i){var o=a,s=0+n;t^=-1;for(var r=0;r<s;r++)t=t>>>8^o[255&(t^e[r])];return-1^t}(0|e,t,t.length):function(t,e,n,i){var o=a,s=0+n;t^=-1;for(var r=0;r<s;r++)t=t>>>8^o[255&(t^e.charCodeAt(r))];return-1^t}(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(t,e,n){"use strict";var i;i="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:i}},{lie:37}],7:[function(t,e,n){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,a=t("pako"),o=t("./utils"),s=t("./stream/GenericWorker"),r=i?"uint8array":"array";function l(t,e){s.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}n.magic="\b\0",o.inherits(l,s),l.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(r,t.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},n.compressWorker=function(t){return new l("Deflate",t)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,n){"use strict";function i(t,e){var n,i="";for(n=0;n<e;n++)i+=String.fromCharCode(255&t),t>>>=8;return i}function a(t,e,n,a,s,h){var d,u,b=t.file,g=t.compression,f=h!==r.utf8encode,m=o.transformTo("string",h(b.name)),p=o.transformTo("string",r.utf8encode(b.name)),_=b.comment,v=o.transformTo("string",h(_)),y=o.transformTo("string",r.utf8encode(_)),x=p.length!==b.name.length,w=y.length!==_.length,S="",C="",M="",k=b.dir,P=b.date,O={crc32:0,compressedSize:0,uncompressedSize:0};e&&!n||(O.crc32=t.crc32,O.compressedSize=t.compressedSize,O.uncompressedSize=t.uncompressedSize);var L=0;e&&(L|=8),f||!x&&!w||(L|=2048);var I=0,A=0;k&&(I|=16),"UNIX"===s?(A=798,I|=function(t,e){var n=t;return t||(n=e?16893:33204),(65535&n)<<16}(b.unixPermissions,k)):(A=20,I|=function(t){return 63&(t||0)}(b.dosPermissions)),d=P.getUTCHours(),d<<=6,d|=P.getUTCMinutes(),d<<=5,d|=P.getUTCSeconds()/2,u=P.getUTCFullYear()-1980,u<<=4,u|=P.getUTCMonth()+1,u<<=5,u|=P.getUTCDate(),x&&(C=i(1,1)+i(l(m),4)+p,S+="up"+i(C.length,2)+C),w&&(M=i(1,1)+i(l(v),4)+y,S+="uc"+i(M.length,2)+M);var B="";return B+="\n\0",B+=i(L,2),B+=g.magic,B+=i(d,2),B+=i(u,2),B+=i(O.crc32,4),B+=i(O.compressedSize,4),B+=i(O.uncompressedSize,4),B+=i(m.length,2),B+=i(S.length,2),{fileRecord:c.LOCAL_FILE_HEADER+B+m+S,dirRecord:c.CENTRAL_FILE_HEADER+i(A,2)+B+i(v.length,2)+"\0\0\0\0"+i(I,4)+i(a,4)+m+S+v}}var o=t("../utils"),s=t("../stream/GenericWorker"),r=t("../utf8"),l=t("../crc32"),c=t("../signature");function h(t,e,n,i){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=n,this.encodeFileName=i,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(h,s),h.prototype.push=function(t){var e=t.meta.percent||0,n=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,s.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:n?(e+100*(n-i-1))/n:100}}))},h.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var n=a(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,n=a(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),e)this.push({data:function(t){return c.DATA_DESCRIPTOR+i(t.crc32,4)+i(t.compressedSize,4)+i(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var n=function(t,e,n,a,s){var r=o.transformTo("string",s(a));return c.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(t,2)+i(t,2)+i(e,4)+i(n,4)+i(r.length,2)+r}(this.dirRecords.length,this.bytesWritten-t,t,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()}),t.on("error",function(t){e.error(t)}),this},h.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(t){var e=this._sources;if(!s.prototype.error.call(this,t))return!1;for(var n=0;n<e.length;n++)try{e[n].error(t)}catch(t){}return!0},h.prototype.lock=function(){s.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()},e.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,n){"use strict";var i=t("../compressions"),a=t("./ZipFileWorker");n.generateWorker=function(t,e,n){var o=new a(e.streamFiles,n,e.platform,e.encodeFileName),s=0;try{t.forEach(function(t,n){s++;var a=function(t,e){var n=t||e,a=i[n];if(!a)throw new Error(n+" is not a valid compression method !");return a}(n.options.compression,e.compression),r=n.dir,l=n.date;n._compressWorker(a,n.options.compressionOptions||e.compressionOptions||{}).withStreamInfo("file",{name:t,dir:r,date:l,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(o)}),o.entriesCount=s}catch(t){o.error(t)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,n){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files={},this.comment=null,this.root="",this.clone=function(){var t=new i;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(i.prototype=t("./object")).loadAsync=t("./load"),i.support=t("./support"),i.defaults=t("./defaults"),i.version="3.5.0",i.loadAsync=function(t,e){return(new i).loadAsync(t,e)},i.external=t("./external"),e.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,n){"use strict";var i=t("./utils"),a=t("./external"),o=t("./utf8"),s=(i=t("./utils"),t("./zipEntries")),r=t("./stream/Crc32Probe"),l=t("./nodejsUtils");function c(t){return new a.Promise(function(e,n){var i=t.decompressed.getContentWorker().pipe(new r);i.on("error",function(t){n(t)}).on("end",function(){i.streamInfo.crc32!==t.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}e.exports=function(t,e){var n=this;return e=i.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),l.isNode&&l.isStream(t)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then(function(t){var n=new s(e);return n.load(t),n}).then(function(t){var n=[a.Promise.resolve(t)],i=t.files;if(e.checkCRC32)for(var o=0;o<i.length;o++)n.push(c(i[o]));return a.Promise.all(n)}).then(function(t){for(var i=t.shift(),a=i.files,o=0;o<a.length;o++){var s=a[o];n.file(s.fileNameStr,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir,comment:s.fileCommentStr.length?s.fileCommentStr:null,unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions,createFolders:e.createFolders})}return i.zipComment.length&&(n.comment=i.zipComment),n})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,n){"use strict";var i=t("../utils"),a=t("../stream/GenericWorker");function o(t,e){a.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}i.inherits(o,a),o.prototype._bindStream=function(t){var e=this;(this._stream=t).pause(),t.on("data",function(t){e.push({data:t,meta:{percent:0}})}).on("error",function(t){e.isPaused?this.generatedError=t:e.error(t)}).on("end",function(){e.isPaused?e._upstreamEnded=!0:e.end()})},o.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,n){"use strict";var i=t("readable-stream").Readable;function a(t,e,n){i.call(this,e),this._helper=t;var a=this;t.on("data",function(t,e){a.push(t)||a._helper.pause(),n&&n(e)}).on("error",function(t){a.emit("error",t)}).on("end",function(){a.push(null)})}t("../utils").inherits(a,i),a.prototype._read=function(){this._helper.resume()},e.exports=a},{"../utils":32,"readable-stream":16}],14:[function(t,e,n){"use strict";e.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}}},{}],15:[function(t,e,n){"use strict";function i(t,e,n){var i,a,r=o.getTypeOf(e),d=o.extend(n||{},l);d.date=d.date||new Date,null!==d.compression&&(d.compression=d.compression.toUpperCase()),"string"==typeof d.unixPermissions&&(d.unixPermissions=parseInt(d.unixPermissions,8)),d.unixPermissions&&16384&d.unixPermissions&&(d.dir=!0),d.dosPermissions&&16&d.dosPermissions&&(d.dir=!0),d.dir&&(t=f(t)),d.createFolders&&(i=g(t))&&m.call(this,i,!0),n&&void 0!==n.binary||(d.binary=!("string"===r&&!1===d.binary&&!1===d.base64)),(e instanceof c&&0===e.uncompressedSize||d.dir||!e||0===e.length)&&(d.base64=!1,d.binary=!0,e="",d.compression="STORE",r="string"),a=e instanceof c||e instanceof s?e:u.isNode&&u.isStream(e)?new b(t,e):o.prepareContent(t,e,d.binary,d.optimizedBinaryString,d.base64);var p=new h(t,a,d);this.files[t]=p}var a=t("./utf8"),o=t("./utils"),s=t("./stream/GenericWorker"),r=t("./stream/StreamHelper"),l=t("./defaults"),c=t("./compressedObject"),h=t("./zipObject"),d=t("./generate"),u=t("./nodejsUtils"),b=t("./nodejs/NodejsStreamInputAdapter"),g=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return 0<e?t.substring(0,e):""},f=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},m=function(t,e){return e=void 0!==e?e:l.createFolders,t=f(t),this.files[t]||i.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function p(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,n,i;for(e in this.files)this.files.hasOwnProperty(e)&&(i=this.files[e],(n=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(n,i))},filter:function(t){var e=[];return this.forEach(function(n,i){t(n,i)&&e.push(i)}),e},file:function(t,e,n){if(1!==arguments.length)return i.call(this,t=this.root+t,e,n),this;if(p(t)){var a=t;return this.filter(function(t,e){return!e.dir&&a.test(t)})}var o=this.files[this.root+t];return o&&!o.dir?o:null},folder:function(t){if(!t)return this;if(p(t))return this.filter(function(e,n){return n.dir&&t.test(e)});var e=m.call(this,this.root+t),n=this.clone();return n.root=e.name,n},remove:function(t){var e=this.files[t=this.root+t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var n=this.filter(function(e,n){return n.name.slice(0,t.length)===t}),i=0;i<n.length;i++)delete this.files[n[i].name];return this},generate:function(t){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,n={};try{if((n=o.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),"binarystring"===n.type&&(n.type="string"),!n.type)throw new Error("No output type specified.");o.checkSupport(n.type),"darwin"!==n.platform&&"freebsd"!==n.platform&&"linux"!==n.platform&&"sunos"!==n.platform||(n.platform="UNIX"),"win32"===n.platform&&(n.platform="DOS"),e=d.generateWorker(this,n,n.comment||this.comment||"")}catch(t){(e=new s("error")).error(t)}return new r(e,n.type||"string",n.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}};e.exports=_},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,n){e.exports=t("stream")},{stream:void 0}],17:[function(t,e,n){"use strict";var i=t("./DataReader");function a(t){i.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}t("../utils").inherits(a,i),a.prototype.byteAt=function(t){return this.data[this.zero+t]},a.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),n=t.charCodeAt(1),i=t.charCodeAt(2),a=t.charCodeAt(3),o=this.length-4;0<=o;--o)if(this.data[o]===e&&this.data[o+1]===n&&this.data[o+2]===i&&this.data[o+3]===a)return o-this.zero;return-1},a.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),n=t.charCodeAt(1),i=t.charCodeAt(2),a=t.charCodeAt(3),o=this.readData(4);return e===o[0]&&n===o[1]&&i===o[2]&&a===o[3]},a.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=a},{"../utils":32,"./DataReader":18}],18:[function(t,e,n){"use strict";var i=t("../utils");function a(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(t){},readInt:function(t){var e,n=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)n=(n<<8)+this.byteAt(e);return this.index+=t,n},readString:function(t){return i.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=a},{"../utils":32}],19:[function(t,e,n){"use strict";var i=t("./Uint8ArrayReader");function a(t){i.call(this,t)}t("../utils").inherits(a,i),a.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,n){"use strict";var i=t("./DataReader");function a(t){i.call(this,t)}t("../utils").inherits(a,i),a.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},a.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},a.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},a.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,e,n){"use strict";var i=t("./ArrayReader");function a(t){i.call(this,t)}t("../utils").inherits(a,i),a.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,n){"use strict";var i=t("../utils"),a=t("../support"),o=t("./ArrayReader"),s=t("./StringReader"),r=t("./NodeBufferReader"),l=t("./Uint8ArrayReader");e.exports=function(t){var e=i.getTypeOf(t);return i.checkSupport(e),"string"!==e||a.uint8array?"nodebuffer"===e?new r(t):a.uint8array?new l(i.transformTo("uint8array",t)):new o(i.transformTo("array",t)):new s(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,n){"use strict";n.LOCAL_FILE_HEADER="PK\x03\x04",n.CENTRAL_FILE_HEADER="PK\x01\x02",n.CENTRAL_DIRECTORY_END="PK\x05\x06",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07",n.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06",n.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,e,n){"use strict";var i=t("./GenericWorker"),a=t("../utils");function o(t){i.call(this,"ConvertWorker to "+t),this.destType=t}a.inherits(o,i),o.prototype.processChunk=function(t){this.push({data:a.transformTo(this.destType,t.data),meta:t.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,n){"use strict";var i=t("./GenericWorker"),a=t("../crc32");function o(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,i),o.prototype.processChunk=function(t){this.streamInfo.crc32=a(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,n){"use strict";var i=t("../utils"),a=t("./GenericWorker");function o(t){a.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}i.inherits(o,a),o.prototype.processChunk=function(t){t&&(this.streamInfo[this.propName]=(this.streamInfo[this.propName]||0)+t.data.length),a.prototype.processChunk.call(this,t)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,n){"use strict";var i=t("../utils"),a=t("./GenericWorker");function o(t){a.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=i.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}i.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,n){"use strict";function i(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var n=0;n<this._listeners[t].length;n++)this._listeners[t][n].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.end()}),t.on("error",function(t){e.error(t)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var t=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},e.exports=i},{}],29:[function(t,e,n){"use strict";var i=t("../utils"),a=t("./ConvertWorker"),o=t("./GenericWorker"),s=t("../base64"),r=t("../support"),l=t("../external"),c=null;if(r.nodestream)try{c=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function h(t,e,n){var s=e;switch(e){case"blob":case"arraybuffer":s="uint8array";break;case"base64":s="string"}try{this._internalType=s,this._outputType=e,this._mimeType=n,i.checkSupport(s),this._worker=t.pipe(new a(s)),t.lock()}catch(t){this._worker=new o("error"),this._worker.error(t)}}h.prototype={accumulate:function(t){return function(t,e){return new l.Promise(function(n,a){var o=[],r=t._internalType,l=t._outputType,c=t._mimeType;t.on("data",function(t,n){o.push(t),e&&e(n)}).on("error",function(t){o=[],a(t)}).on("end",function(){try{var t=function(t,e,n){switch(t){case"blob":return i.newBlob(i.transformTo("arraybuffer",e),n);case"base64":return s.encode(e);default:return i.transformTo(t,e)}}(l,function(t,e){var n,i=0,a=null,o=0;for(n=0;n<e.length;n++)o+=e[n].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(a=new Uint8Array(o),n=0;n<e.length;n++)a.set(e[n],i),i+=e[n].length;return a;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(r,o),c);n(t)}catch(t){a(t)}o=[]}).resume()})}(this,t)},on:function(t,e){var n=this;return this._worker.on(t,"data"===t?function(t){e.call(n,t.data,t.meta)}:function(){i.delay(e,arguments,n)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new c(this,{objectMode:"nodebuffer"!==this._outputType},t)}},e.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,n){"use strict";if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer="undefined"!=typeof Buffer,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var i=new ArrayBuffer(0);try{n.blob=0===new Blob([i],{type:"application/zip"}).size}catch(t){try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(i),n.blob=0===a.getBlob("application/zip").size}catch(t){n.blob=!1}}}try{n.nodestream=!!t("readable-stream").Readable}catch(t){n.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,n){"use strict";for(var i=t("./utils"),a=t("./support"),o=t("./nodejsUtils"),s=t("./stream/GenericWorker"),r=new Array(256),l=0;l<256;l++)r[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function c(){s.call(this,"utf-8 decode"),this.leftOver=null}function h(){s.call(this,"utf-8 encode")}r[254]=r[254]=1,n.utf8encode=function(t){return a.nodebuffer?o.newBufferFrom(t,"utf-8"):function(t){var e,n,i,o,s,r=t.length,l=0;for(o=0;o<r;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<r&&56320==(64512&(i=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),l+=n<128?1:n<2048?2:n<65536?3:4;for(e=a.uint8array?new Uint8Array(l):new Array(l),o=s=0;s<l;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<r&&56320==(64512&(i=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),n<128?e[s++]=n:(n<2048?e[s++]=192|n>>>6:(n<65536?e[s++]=224|n>>>12:(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63),e[s++]=128|n>>>6&63),e[s++]=128|63&n);return e}(t)},n.utf8decode=function(t){return a.nodebuffer?i.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,n,a,o,s=t.length,l=new Array(2*s);for(e=n=0;e<s;)if((a=t[e++])<128)l[n++]=a;else if(4<(o=r[a]))l[n++]=65533,e+=o-1;else{for(a&=2===o?31:3===o?15:7;1<o&&e<s;)a=a<<6|63&t[e++],o--;1<o?l[n++]=65533:a<65536?l[n++]=a:(l[n++]=55296|(a-=65536)>>10&1023,l[n++]=56320|1023&a)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),i.applyFromCharCode(l)}(t=i.transformTo(a.uint8array?"uint8array":"array",t))},i.inherits(c,s),c.prototype.processChunk=function(t){var e=i.transformTo(a.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var o=e;(e=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),e.set(o,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var s=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return n<0||0===n?e:n+r[t[n]]>e?n:e}(e),l=e;s!==e.length&&(a.uint8array?(l=e.subarray(0,s),this.leftOver=e.subarray(s,e.length)):(l=e.slice(0,s),this.leftOver=e.slice(s,e.length))),this.push({data:n.utf8decode(l),meta:t.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,i.inherits(h,s),h.prototype.processChunk=function(t){this.push({data:n.utf8encode(t.data),meta:t.meta})},n.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,n){"use strict";var i=t("./support"),a=t("./base64"),o=t("./nodejsUtils"),s=t("set-immediate-shim"),r=t("./external");function l(t){return t}function c(t,e){for(var n=0;n<t.length;++n)e[n]=255&t.charCodeAt(n);return e}n.newBlob=function(e,i){n.checkSupport("blob");try{return new Blob([e],{type:i})}catch(t){try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return a.append(e),a.getBlob(i)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(t,e,n){var i=[],a=0,o=t.length;if(o<=n)return String.fromCharCode.apply(null,t);for(;a<o;)i.push(String.fromCharCode.apply(null,"array"===e||"nodebuffer"===e?t.slice(a,Math.min(a+n,o)):t.subarray(a,Math.min(a+n,o)))),a+=n;return i.join("")},stringifyByChar:function(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(t){return!1}}()}};function d(t){var e=65536,i=n.getTypeOf(t),a=!0;if("uint8array"===i?a=h.applyCanBeUsed.uint8array:"nodebuffer"===i&&(a=h.applyCanBeUsed.nodebuffer),a)for(;1<e;)try{return h.stringifyByChunk(t,i,e)}catch(t){e=Math.floor(e/2)}return h.stringifyByChar(t)}function u(t,e){for(var n=0;n<t.length;n++)e[n]=t[n];return e}n.applyFromCharCode=d;var b={};b.string={string:l,array:function(t){return c(t,new Array(t.length))},arraybuffer:function(t){return b.string.uint8array(t).buffer},uint8array:function(t){return c(t,new Uint8Array(t.length))},nodebuffer:function(t){return c(t,o.allocBuffer(t.length))}},b.array={string:d,array:l,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return o.newBufferFrom(t)}},b.arraybuffer={string:function(t){return d(new Uint8Array(t))},array:function(t){return u(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:l,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return o.newBufferFrom(new Uint8Array(t))}},b.uint8array={string:d,array:function(t){return u(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:l,nodebuffer:function(t){return o.newBufferFrom(t)}},b.nodebuffer={string:d,array:function(t){return u(t,new Array(t.length))},arraybuffer:function(t){return b.nodebuffer.uint8array(t).buffer},uint8array:function(t){return u(t,new Uint8Array(t.length))},nodebuffer:l},n.transformTo=function(t,e){if(e=e||"",!t)return e;n.checkSupport(t);var i=n.getTypeOf(e);return b[i][t](e)},n.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":i.nodebuffer&&o.isBuffer(t)?"nodebuffer":i.uint8array&&t instanceof Uint8Array?"uint8array":i.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(t){if(!i[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(t){var e,n,i="";for(n=0;n<(t||"").length;n++)i+="\\x"+((e=t.charCodeAt(n))<16?"0":"")+e.toString(16).toUpperCase();return i},n.delay=function(t,e,n){s(function(){t.apply(n||null,e||[])})},n.inherits=function(t,e){function n(){}n.prototype=e.prototype,t.prototype=new n},n.extend=function(){var t,e,n={};for(t=0;t<arguments.length;t++)for(e in arguments[t])arguments[t].hasOwnProperty(e)&&void 0===n[e]&&(n[e]=arguments[t][e]);return n},n.prepareContent=function(t,e,o,s,l){return r.Promise.resolve(e).then(function(t){return i.blob&&(t instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t)))&&"undefined"!=typeof FileReader?new r.Promise(function(e,n){var i=new FileReader;i.onload=function(t){e(t.target.result)},i.onerror=function(t){n(t.target.error)},i.readAsArrayBuffer(t)}):t}).then(function(e){var h=n.getTypeOf(e);return h?("arraybuffer"===h?e=n.transformTo("uint8array",e):"string"===h&&(l?e=a.decode(e):o&&!0!==s&&(e=function(t){return c(t,i.uint8array?new Uint8Array(t.length):new Array(t.length))}(e))),e):r.Promise.reject(new Error("Can't read the data of '"+t+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(t,e,n){"use strict";var i=t("./reader/readerFor"),a=t("./utils"),o=t("./signature"),s=t("./zipEntry"),r=(t("./utf8"),t("./support"));function l(t){this.files=[],this.loadOptions=t}l.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(e)+", expected "+a.pretty(t)+")")}},isSignature:function(t,e){var n=this.reader.index;this.reader.setIndex(t);var i=this.reader.readString(4)===e;return this.reader.setIndex(n),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=a.transformTo(r.uint8array?"uint8array":"array",t);this.zipComment=this.loadOptions.decodeFileName(e)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,n,i=this.zip64EndOfCentralSize-44;0<i;)t=this.reader.readInt(2),e=this.reader.readInt(4),n=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)this.reader.setIndex((e=this.files[t]).localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(t=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(t<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(t);var e=t;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var i=e-n;if(0<i)this.isSignature(e,o.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(t){this.reader=i(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(t,e,n){"use strict";var i=t("./reader/readerFor"),a=t("./utils"),o=t("./compressedObject"),s=t("./crc32"),r=t("./utf8"),l=t("./compressions"),c=t("./support");function h(t,e){this.options=t,this.loadOptions=e}h.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(t){var e,n;if(t.skip(22),this.fileNameLength=t.readInt(2),n=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(e=function(t){for(var e in l)if(l.hasOwnProperty(e)&&l[e].magic===t)return l[e];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,n,i,a=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<a;)e=t.readInt(2),n=t.readInt(2),i=t.readData(n),this.extraFields[e]={id:e,length:n,value:i};t.setIndex(a)},handleUTF8:function(){var t=c.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=r.utf8decode(this.fileName),this.fileCommentStr=r.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var n=a.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var o=a.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=i(t.value);return 1!==e.readInt(1)||s(this.fileName)!==e.readInt(4)?null:r.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=i(t.value);return 1!==e.readInt(1)||s(this.fileComment)!==e.readInt(4)?null:r.utf8decode(e.readData(t.length-5))}return null}},e.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,n){"use strict";function i(t,e,n){this.name=t,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=e,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}}var a=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),s=t("./utf8"),r=t("./compressedObject"),l=t("./stream/GenericWorker");i.prototype={internalStream:function(t){var e=null,n="string";try{if(!t)throw new Error("No output type specified.");var i="string"===(n=t.toLowerCase())||"text"===n;"binarystring"!==n&&"text"!==n||(n="string"),e=this._decompressWorker();var o=!this._dataBinary;o&&!i&&(e=e.pipe(new s.Utf8EncodeWorker)),!o&&i&&(e=e.pipe(new s.Utf8DecodeWorker))}catch(t){(e=new l("error")).error(t)}return new a(e,n,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof r&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new s.Utf8EncodeWorker)),r.createWorkerFrom(n,t,e)},_decompressWorker:function(){return this._data instanceof r?this._data.getContentWorker():this._data instanceof l?this._data:new o(this._data)}};for(var c=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<c.length;d++)i.prototype[c[d]]=h;e.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,e,n){(function(t){"use strict";var n,i,a=t.MutationObserver||t.WebKitMutationObserver;if(a){var o=0,s=new a(h),r=t.document.createTextNode("");s.observe(r,{characterData:!0}),n=function(){r.data=o=++o%2}}else if(t.setImmediate||void 0===t.MessageChannel)n="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){h(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(h,0)};else{var l=new t.MessageChannel;l.port1.onmessage=h,n=function(){l.port2.postMessage(0)}}var c=[];function h(){var t,e;i=!0;for(var n=c.length;n;){for(e=c,c=[],t=-1;++t<n;)e[t]();n=c.length}i=!1}e.exports=function(t){1!==c.push(t)||i||n()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(t,e,n){"use strict";var i=t("immediate");function a(){}var o={},s=["REJECTED"],r=["FULFILLED"],l=["PENDING"];function c(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,t!==a&&b(this,t)}function h(t,e,n){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function d(t,e,n){i(function(){var i;try{i=e(n)}catch(i){return o.reject(t,i)}i===t?o.reject(t,new TypeError("Cannot resolve promise with itself")):o.resolve(t,i)})}function u(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function b(t,e){var n=!1;function i(e){n||(n=!0,o.reject(t,e))}function a(e){n||(n=!0,o.resolve(t,e))}var s=g(function(){e(a,i)});"error"===s.status&&i(s.value)}function g(t,e){var n={};try{n.value=t(e),n.status="success"}catch(t){n.status="error",n.value=t}return n}(e.exports=c).prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){throw n})})},c.prototype.catch=function(t){return this.then(null,t)},c.prototype.then=function(t,e){if("function"!=typeof t&&this.state===r||"function"!=typeof e&&this.state===s)return this;var n=new this.constructor(a);return this.state!==l?d(n,this.state===r?t:e,this.outcome):this.queue.push(new h(n,t,e)),n},h.prototype.callFulfilled=function(t){o.resolve(this.promise,t)},h.prototype.otherCallFulfilled=function(t){d(this.promise,this.onFulfilled,t)},h.prototype.callRejected=function(t){o.reject(this.promise,t)},h.prototype.otherCallRejected=function(t){d(this.promise,this.onRejected,t)},o.resolve=function(t,e){var n=g(u,e);if("error"===n.status)return o.reject(t,n.value);var i=n.value;if(i)b(t,i);else{t.state=r,t.outcome=e;for(var a=-1,s=t.queue.length;++a<s;)t.queue[a].callFulfilled(e)}return t},o.reject=function(t,e){t.state=s,t.outcome=e;for(var n=-1,i=t.queue.length;++n<i;)t.queue[n].callRejected(e);return t},c.resolve=function(t){return t instanceof this?t:o.resolve(new this(a),t)},c.reject=function(t){var e=new this(a);return o.reject(e,t)},c.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,i=!1;if(!n)return this.resolve([]);for(var s=new Array(n),r=0,l=-1,c=new this(a);++l<n;)h(t[l],l);return c;function h(t,a){e.resolve(t).then(function(t){s[a]=t,++r!==n||i||(i=!0,o.resolve(c,s))},function(t){i||(i=!0,o.reject(c,t))})}},c.race=function(t){if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var e=t.length,n=!1;if(!e)return this.resolve([]);for(var i=-1,s=new this(a);++i<e;)this.resolve(t[i]).then(function(t){n||(n=!0,o.resolve(s,t))},function(t){n||(n=!0,o.reject(s,t))});return s}},{immediate:36}],38:[function(t,e,n){"use strict";var i={};(0,t("./lib/utils/common").assign)(i,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,n){"use strict";var i=t("./zlib/deflate"),a=t("./utils/common"),o=t("./utils/strings"),s=t("./zlib/messages"),r=t("./zlib/zstream"),l=Object.prototype.toString;function c(t){if(!(this instanceof c))return new c(t);this.options=a.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new r,this.strm.avail_out=0;var n=i.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==n)throw new Error(s[n]);if(e.header&&i.deflateSetHeader(this.strm,e.header),e.dictionary){var h;if(h="string"==typeof e.dictionary?o.string2buf(e.dictionary):"[object ArrayBuffer]"===l.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(n=i.deflateSetDictionary(this.strm,h)))throw new Error(s[n]);this._dict_set=!0}}function h(t,e){var n=new c(e);if(n.push(t,!0),n.err)throw n.msg||s[n.err];return n.result}c.prototype.push=function(t,e){var n,s,r=this.strm,c=this.options.chunkSize;if(this.ended)return!1;s=e===~~e?e:!0===e?4:0,r.input="string"==typeof t?o.string2buf(t):"[object ArrayBuffer]"===l.call(t)?new Uint8Array(t):t,r.next_in=0,r.avail_in=r.input.length;do{if(0===r.avail_out&&(r.output=new a.Buf8(c),r.next_out=0,r.avail_out=c),1!==(n=i.deflate(r,s))&&0!==n)return this.onEnd(n),!(this.ended=!0);0!==r.avail_out&&(0!==r.avail_in||4!==s&&2!==s)||this.onData("string"===this.options.to?o.buf2binstring(a.shrinkBuf(r.output,r.next_out)):a.shrinkBuf(r.output,r.next_out))}while((0<r.avail_in||0===r.avail_out)&&1!==n);return 4===s?(n=i.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==s||(this.onEnd(0),!(r.avail_out=0))},c.prototype.onData=function(t){this.chunks.push(t)},c.prototype.onEnd=function(t){0===t&&(this.result="string"===this.options.to?this.chunks.join(""):a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},n.Deflate=c,n.deflate=h,n.deflateRaw=function(t,e){return(e=e||{}).raw=!0,h(t,e)},n.gzip=function(t,e){return(e=e||{}).gzip=!0,h(t,e)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,n){"use strict";var i=t("./zlib/inflate"),a=t("./utils/common"),o=t("./utils/strings"),s=t("./zlib/constants"),r=t("./zlib/messages"),l=t("./zlib/zstream"),c=t("./zlib/gzheader"),h=Object.prototype.toString;function d(t){if(!(this instanceof d))return new d(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=i.inflateInit2(this.strm,e.windowBits);if(n!==s.Z_OK)throw new Error(r[n]);this.header=new c,i.inflateGetHeader(this.strm,this.header)}function u(t,e){var n=new d(e);if(n.push(t,!0),n.err)throw n.msg||r[n.err];return n.result}d.prototype.push=function(t,e){var n,r,l,c,d,u,b=this.strm,g=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?s.Z_FINISH:s.Z_NO_FLUSH,b.input="string"==typeof t?o.binstring2buf(t):"[object ArrayBuffer]"===h.call(t)?new Uint8Array(t):t,b.next_in=0,b.avail_in=b.input.length;do{if(0===b.avail_out&&(b.output=new a.Buf8(g),b.next_out=0,b.avail_out=g),(n=i.inflate(b,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&f&&(u="string"==typeof f?o.string2buf(f):"[object ArrayBuffer]"===h.call(f)?new Uint8Array(f):f,n=i.inflateSetDictionary(this.strm,u)),n===s.Z_BUF_ERROR&&!0===m&&(n=s.Z_OK,m=!1),n!==s.Z_STREAM_END&&n!==s.Z_OK)return this.onEnd(n),!(this.ended=!0);b.next_out&&(0!==b.avail_out&&n!==s.Z_STREAM_END&&(0!==b.avail_in||r!==s.Z_FINISH&&r!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(l=o.utf8border(b.output,b.next_out),c=b.next_out-l,d=o.buf2string(b.output,l),b.next_out=c,b.avail_out=g-c,c&&a.arraySet(b.output,b.output,l,c,0),this.onData(d)):this.onData(a.shrinkBuf(b.output,b.next_out)))),0===b.avail_in&&0===b.avail_out&&(m=!0)}while((0<b.avail_in||0===b.avail_out)&&n!==s.Z_STREAM_END);return n===s.Z_STREAM_END&&(r=s.Z_FINISH),r===s.Z_FINISH?(n=i.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===s.Z_OK):r!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(b.avail_out=0))},d.prototype.onData=function(t){this.chunks.push(t)},d.prototype.onEnd=function(t){t===s.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},n.Inflate=d,n.inflate=u,n.inflateRaw=function(t,e){return(e=e||{}).raw=!0,u(t,e)},n.ungzip=u},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,n){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])}}return t},n.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var a={arraySet:function(t,e,n,i,a){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+i),a);else for(var o=0;o<i;o++)t[a+o]=e[n+o]},flattenChunks:function(t){var e,n,i,a,o,s;for(e=i=0,n=t.length;e<n;e++)i+=t[e].length;for(s=new Uint8Array(i),e=a=0,n=t.length;e<n;e++)s.set(o=t[e],a),a+=o.length;return s}},o={arraySet:function(t,e,n,i,a){for(var o=0;o<i;o++)t[a+o]=e[n+o]},flattenChunks:function(t){return[].concat.apply([],t)}};n.setTyped=function(t){t?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,a)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(i)},{}],42:[function(t,e,n){"use strict";var i=t("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var s=new i.Buf8(256),r=0;r<256;r++)s[r]=252<=r?6:248<=r?5:240<=r?4:224<=r?3:192<=r?2:1;function l(t,e){if(e<65537&&(t.subarray&&o||!t.subarray&&a))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var n="",s=0;s<e;s++)n+=String.fromCharCode(t[s]);return n}s[254]=s[254]=1,n.string2buf=function(t){var e,n,a,o,s,r=t.length,l=0;for(o=0;o<r;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<r&&56320==(64512&(a=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(a-56320),o++),l+=n<128?1:n<2048?2:n<65536?3:4;for(e=new i.Buf8(l),o=s=0;s<l;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<r&&56320==(64512&(a=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(a-56320),o++),n<128?e[s++]=n:(n<2048?e[s++]=192|n>>>6:(n<65536?e[s++]=224|n>>>12:(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63),e[s++]=128|n>>>6&63),e[s++]=128|63&n);return e},n.buf2binstring=function(t){return l(t,t.length)},n.binstring2buf=function(t){for(var e=new i.Buf8(t.length),n=0,a=e.length;n<a;n++)e[n]=t.charCodeAt(n);return e},n.buf2string=function(t,e){var n,i,a,o,r=e||t.length,c=new Array(2*r);for(n=i=0;n<r;)if((a=t[n++])<128)c[i++]=a;else if(4<(o=s[a]))c[i++]=65533,n+=o-1;else{for(a&=2===o?31:3===o?15:7;1<o&&n<r;)a=a<<6|63&t[n++],o--;1<o?c[i++]=65533:a<65536?c[i++]=a:(c[i++]=55296|(a-=65536)>>10&1023,c[i++]=56320|1023&a)}return l(c,i)},n.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return n<0||0===n?e:n+s[t[n]]>e?n:e}},{"./common":41}],43:[function(t,e,n){"use strict";e.exports=function(t,e,n,i){for(var a=65535&t|0,o=t>>>16&65535|0,s=0;0!==n;){for(n-=s=2e3<n?2e3:n;o=o+(a=a+e[i++]|0)|0,--s;);a%=65521,o%=65521}return a|o<<16|0}},{}],44:[function(t,e,n){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,n){"use strict";var i=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e,n,a){var o=i,s=a+n;t^=-1;for(var r=a;r<s;r++)t=t>>>8^o[255&(t^e[r])];return-1^t}},{}],46:[function(t,e,n){"use strict";var i,a=t("../utils/common"),o=t("./trees"),s=t("./adler32"),r=t("./crc32"),l=t("./messages"),c=-2,h=258,d=262,u=113;function b(t,e){return t.msg=l[e],e}function g(t){return(t<<1)-(4<t?9:0)}function f(t){for(var e=t.length;0<=--e;)t[e]=0}function m(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(a.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function p(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,m(t.strm)}function _(t,e){t.pending_buf[t.pending++]=e}function v(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function y(t,e){var n,i,a=t.max_chain_length,o=t.strstart,s=t.prev_length,r=t.nice_match,l=t.strstart>t.w_size-d?t.strstart-(t.w_size-d):0,c=t.window,u=t.w_mask,b=t.prev,g=t.strstart+h,f=c[o+s-1],m=c[o+s];t.prev_length>=t.good_match&&(a>>=2),r>t.lookahead&&(r=t.lookahead);do{if(c[(n=e)+s]===m&&c[n+s-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&o<g);if(i=h-(g-o),o=g-h,s<i){if(t.match_start=e,r<=(s=i))break;f=c[o+s-1],m=c[o+s]}}}while((e=b[e&u])>l&&0!=--a);return s<=t.lookahead?s:t.lookahead}function x(t){var e,n,i,o,l,c,h,u,b,g,f=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-d)){for(a.arraySet(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=n=t.hash_size;i=t.head[--e],t.head[e]=f<=i?i-f:0,--n;);for(e=n=f;i=t.prev[--e],t.prev[e]=f<=i?i-f:0,--n;);o+=f}if(0===t.strm.avail_in)break;if(h=t.window,u=t.strstart+t.lookahead,g=void 0,(b=o)<(g=(c=t.strm).avail_in)&&(g=b),n=0===g?0:(c.avail_in-=g,a.arraySet(h,c.input,c.next_in,g,u),1===c.state.wrap?c.adler=s(c.adler,h,g,u):2===c.state.wrap&&(c.adler=r(c.adler,h,g,u)),c.next_in+=g,c.total_in+=g,g),t.lookahead+=n,t.lookahead+t.insert>=3)for(t.ins_h=t.window[l=t.strstart-t.insert],t.ins_h=(t.ins_h<<t.hash_shift^t.window[l+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[l+3-1])&t.hash_mask,t.prev[l&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=l,l++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<d&&0!==t.strm.avail_in)}function w(t,e){for(var n,i;;){if(t.lookahead<d){if(x(t),t.lookahead<d&&0===e)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-d&&(t.match_length=y(t,n)),t.match_length>=3)if(i=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(p(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(p(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(p(t,!1),0===t.strm.avail_out)?1:2}function S(t,e){for(var n,i,a;;){if(t.lookahead<d){if(x(t),t.lookahead<d&&0===e)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-d&&(t.match_length=y(t,n),t.match_length<=5&&(1===t.strategy||3===t.match_length&&4096<t.strstart-t.match_start)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){for(a=t.strstart+t.lookahead-3,i=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=a&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(p(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((i=o._tr_tally(t,0,t.window[t.strstart-1]))&&p(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(p(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(p(t,!1),0===t.strm.avail_out)?1:2}function C(t,e,n,i,a){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=a}function M(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(1146),this.dyn_dtree=new a.Buf16(122),this.bl_tree=new a.Buf16(78),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(16),this.heap=new a.Buf16(573),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(573),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:u,t.adler=2===e.wrap?0:1,e.last_flush=0,o._tr_init(e),0):b(t,c)}function P(t){var e=k(t);return 0===e&&function(t){t.window_size=2*t.w_size,f(t.head),t.max_lazy_match=i[t.level].max_lazy,t.good_match=i[t.level].good_length,t.nice_match=i[t.level].nice_length,t.max_chain_length=i[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0}(t.state),e}function O(t,e,n,i,o,s){if(!t)return c;var r=1;if(-1===e&&(e=6),i<0?(r=0,i=-i):15<i&&(r=2,i-=16),o<1||9<o||8!==n||i<8||15<i||e<0||9<e||s<0||4<s)return b(t,c);8===i&&(i=9);var l=new M;return(t.state=l).strm=t,l.wrap=r,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=o+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new a.Buf8(2*l.w_size),l.head=new a.Buf16(l.hash_size),l.prev=new a.Buf16(l.w_size),l.lit_bufsize=1<<o+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new a.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=e,l.strategy=s,l.method=n,P(t)}i=[new C(0,0,0,0,function(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(x(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+n;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,p(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-d&&(p(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(p(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&p(t,!1),1)}),new C(4,4,8,4,w),new C(4,5,16,8,w),new C(4,6,32,32,w),new C(4,4,16,16,S),new C(8,16,32,32,S),new C(8,16,128,128,S),new C(8,32,128,256,S),new C(32,128,258,1024,S),new C(32,258,258,4096,S)],n.deflateInit=function(t,e){return O(t,e,8,15,8,0)},n.deflateInit2=O,n.deflateReset=P,n.deflateResetKeep=k,n.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?c:(t.state.gzhead=e,0):c},n.deflate=function(t,e){var n,a,s,l;if(!t||!t.state||5<e||e<0)return t?b(t,c):c;if(a=t.state,!t.output||!t.input&&0!==t.avail_in||666===a.status&&4!==e)return b(t,0===t.avail_out?-5:c);if(a.strm=t,n=a.last_flush,a.last_flush=e,42===a.status)if(2===a.wrap)t.adler=0,_(a,31),_(a,139),_(a,8),a.gzhead?(_(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),_(a,255&a.gzhead.time),_(a,a.gzhead.time>>8&255),_(a,a.gzhead.time>>16&255),_(a,a.gzhead.time>>24&255),_(a,9===a.level?2:2<=a.strategy||a.level<2?4:0),_(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(_(a,255&a.gzhead.extra.length),_(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=r(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69):(_(a,0),_(a,0),_(a,0),_(a,0),_(a,0),_(a,9===a.level?2:2<=a.strategy||a.level<2?4:0),_(a,3),a.status=u);else{var d=8+(a.w_bits-8<<4)<<8;d|=(2<=a.strategy||a.level<2?0:a.level<6?1:6===a.level?2:3)<<6,0!==a.strstart&&(d|=32),d+=31-d%31,a.status=u,v(a,d),0!==a.strstart&&(v(a,t.adler>>>16),v(a,65535&t.adler)),t.adler=1}if(69===a.status)if(a.gzhead.extra){for(s=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>s&&(t.adler=r(t.adler,a.pending_buf,a.pending-s,s)),m(t),s=a.pending,a.pending!==a.pending_buf_size));)_(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>s&&(t.adler=r(t.adler,a.pending_buf,a.pending-s,s)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=73)}else a.status=73;if(73===a.status)if(a.gzhead.name){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(t.adler=r(t.adler,a.pending_buf,a.pending-s,s)),m(t),s=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,_(a,l)}while(0!==l);a.gzhead.hcrc&&a.pending>s&&(t.adler=r(t.adler,a.pending_buf,a.pending-s,s)),0===l&&(a.gzindex=0,a.status=91)}else a.status=91;if(91===a.status)if(a.gzhead.comment){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(t.adler=r(t.adler,a.pending_buf,a.pending-s,s)),m(t),s=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,_(a,l)}while(0!==l);a.gzhead.hcrc&&a.pending>s&&(t.adler=r(t.adler,a.pending_buf,a.pending-s,s)),0===l&&(a.status=103)}else a.status=103;if(103===a.status&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&m(t),a.pending+2<=a.pending_buf_size&&(_(a,255&t.adler),_(a,t.adler>>8&255),t.adler=0,a.status=u)):a.status=u),0!==a.pending){if(m(t),0===t.avail_out)return a.last_flush=-1,0}else if(0===t.avail_in&&g(e)<=g(n)&&4!==e)return b(t,-5);if(666===a.status&&0!==t.avail_in)return b(t,-5);if(0!==t.avail_in||0!==a.lookahead||0!==e&&666!==a.status){var y=2===a.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(x(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(p(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(p(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(p(t,!1),0===t.strm.avail_out)?1:2}(a,e):3===a.strategy?function(t,e){for(var n,i,a,s,r=t.window;;){if(t.lookahead<=h){if(x(t),t.lookahead<=h&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&0<t.strstart&&(i=r[a=t.strstart-1])===r[++a]&&i===r[++a]&&i===r[++a]){s=t.strstart+h;do{}while(i===r[++a]&&i===r[++a]&&i===r[++a]&&i===r[++a]&&i===r[++a]&&i===r[++a]&&i===r[++a]&&i===r[++a]&&a<s);t.match_length=h-(s-a),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(p(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(p(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(p(t,!1),0===t.strm.avail_out)?1:2}(a,e):i[a.level].func(a,e);if(3!==y&&4!==y||(a.status=666),1===y||3===y)return 0===t.avail_out&&(a.last_flush=-1),0;if(2===y&&(1===e?o._tr_align(a):5!==e&&(o._tr_stored_block(a,0,0,!1),3===e&&(f(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),m(t),0===t.avail_out))return a.last_flush=-1,0}return 4!==e?0:a.wrap<=0?1:(2===a.wrap?(_(a,255&t.adler),_(a,t.adler>>8&255),_(a,t.adler>>16&255),_(a,t.adler>>24&255),_(a,255&t.total_in),_(a,t.total_in>>8&255),_(a,t.total_in>>16&255),_(a,t.total_in>>24&255)):(v(a,t.adler>>>16),v(a,65535&t.adler)),m(t),0<a.wrap&&(a.wrap=-a.wrap),0!==a.pending?0:1)},n.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&e!==u&&666!==e?b(t,c):(t.state=null,e===u?b(t,-3):0):c},n.deflateSetDictionary=function(t,e){var n,i,o,r,l,h,d,u,b=e.length;if(!t||!t.state)return c;if(2===(r=(n=t.state).wrap)||1===r&&42!==n.status||n.lookahead)return c;for(1===r&&(t.adler=s(t.adler,e,b,0)),n.wrap=0,b>=n.w_size&&(0===r&&(f(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new a.Buf8(n.w_size),a.arraySet(u,e,b-n.w_size,n.w_size,0),e=u,b=n.w_size),l=t.avail_in,h=t.next_in,d=t.input,t.avail_in=b,t.next_in=0,t.input=e,x(n);n.lookahead>=3;){for(i=n.strstart,o=n.lookahead-2;n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+3-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++,--o;);n.strstart=i,n.lookahead=2,x(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=h,t.input=d,t.avail_in=l,n.wrap=r,0},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,n){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,n){"use strict";e.exports=function(t,e){var n,i,a,o,s,r,l,c,h,d,u,b,g,f,m,p,_,v,y,x,w,S,C,M,k;M=t.input,a=(i=t.next_in)+(t.avail_in-5),k=t.output,s=(o=t.next_out)-(e-t.avail_out),r=o+(t.avail_out-257),l=(n=t.state).dmax,c=n.wsize,h=n.whave,d=n.wnext,u=n.window,b=n.hold,g=n.bits,f=n.lencode,m=n.distcode,p=(1<<n.lenbits)-1,_=(1<<n.distbits)-1;t:do{g<15&&(b+=M[i++]<<g,b+=M[i++]<<(g+=8),g+=8),v=f[b&p];e:for(;;){if(b>>>=y=v>>>24,g-=y,0==(y=v>>>16&255))k[o++]=65535&v;else{if(!(16&y)){if(0==(64&y)){v=f[(65535&v)+(b&(1<<y)-1)];continue e}if(32&y){n.mode=12;break t}t.msg="invalid literal/length code",n.mode=30;break t}x=65535&v,(y&=15)&&(g<y&&(b+=M[i++]<<g,g+=8),x+=b&(1<<y)-1,b>>>=y,g-=y),g<15&&(b+=M[i++]<<g,b+=M[i++]<<(g+=8),g+=8),v=m[b&_];n:for(;;){if(b>>>=y=v>>>24,g-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=m[(65535&v)+(b&(1<<y)-1)];continue n}t.msg="invalid distance code",n.mode=30;break t}if(w=65535&v,g<(y&=15)&&(b+=M[i++]<<g,(g+=8)<y&&(b+=M[i++]<<g,g+=8)),l<(w+=b&(1<<y)-1)){t.msg="invalid distance too far back",n.mode=30;break t}if(b>>>=y,g-=y,(y=o-s)<w){if(h<(y=w-y)&&n.sane){t.msg="invalid distance too far back",n.mode=30;break t}if(C=u,(S=0)===d){if(S+=c-y,y<x){for(x-=y;k[o++]=u[S++],--y;);S=o-w,C=k}}else if(d<y){if(S+=c+d-y,(y-=d)<x){for(x-=y;k[o++]=u[S++],--y;);if(S=0,d<x){for(x-=y=d;k[o++]=u[S++],--y;);S=o-w,C=k}}}else if(S+=d-y,y<x){for(x-=y;k[o++]=u[S++],--y;);S=o-w,C=k}for(;2<x;)k[o++]=C[S++],k[o++]=C[S++],k[o++]=C[S++],x-=3;x&&(k[o++]=C[S++],1<x&&(k[o++]=C[S++]))}else{for(S=o-w;k[o++]=k[S++],k[o++]=k[S++],k[o++]=k[S++],2<(x-=3););x&&(k[o++]=k[S++],1<x&&(k[o++]=k[S++]))}break}}break}}while(i<a&&o<r);i-=x=g>>3,b&=(1<<(g-=x<<3))-1,t.next_in=i,t.next_out=o,t.avail_in=i<a?a-i+5:5-(i-a),t.avail_out=o<r?r-o+257:257-(o-r),n.hold=b,n.bits=g}},{}],49:[function(t,e,n){"use strict";var i=t("../utils/common"),a=t("./adler32"),o=t("./crc32"),s=t("./inffast"),r=t("./inftrees"),l=-2;function c(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(t){var e;return t&&t.state?(t.total_in=t.total_out=(e=t.state).total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new i.Buf32(852),e.distcode=e.distdyn=new i.Buf32(592),e.sane=1,e.back=-1,0):l}function u(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,d(t)):l}function b(t,e){var n,i;return t&&t.state?(i=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15<e)?l:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,u(t))):l}function g(t,e){var n,i;return t?(i=new h,(t.state=i).window=null,0!==(n=b(t,e))&&(t.state=null),n):l}var f,m,p=!0;function _(t){if(p){var e;for(f=new i.Buf32(512),m=new i.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(r(1,t.lens,0,288,f,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;r(2,t.lens,0,32,m,0,t.work,{bits:5}),p=!1}t.lencode=f,t.lenbits=9,t.distcode=m,t.distbits=5}function v(t,e,n,a){var o,s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new i.Buf8(s.wsize)),a>=s.wsize?(i.arraySet(s.window,e,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(a<(o=s.wsize-s.wnext)&&(o=a),i.arraySet(s.window,e,n-a,o,s.wnext),(a-=o)?(i.arraySet(s.window,e,n-a,a,0),s.wnext=a,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=o))),0}n.inflateReset=u,n.inflateReset2=b,n.inflateResetKeep=d,n.inflateInit=function(t){return g(t,15)},n.inflateInit2=g,n.inflate=function(t,e){var n,h,d,u,b,g,f,m,p,y,x,w,S,C,M,k,P,O,L,I,A,B,j,E,z=0,D=new i.Buf8(4),T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return l;12===(n=t.state).mode&&(n.mode=13),b=t.next_out,d=t.output,u=t.next_in,h=t.input,m=n.hold,p=n.bits,y=g=t.avail_in,x=f=t.avail_out,B=0;t:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;p<16;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(2&n.wrap&&35615===m){D[n.check=0]=255&m,D[1]=m>>>8&255,n.check=o(n.check,D,2,0),p=m=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&m)<<8)+(m>>8))%31){t.msg="incorrect header check",n.mode=30;break}if(8!=(15&m)){t.msg="unknown compression method",n.mode=30;break}if(p-=4,A=8+(15&(m>>>=4)),0===n.wbits)n.wbits=A;else if(A>n.wbits){t.msg="invalid window size",n.mode=30;break}n.dmax=1<<A,t.adler=n.check=1,n.mode=512&m?10:12,p=m=0;break;case 2:for(;p<16;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(n.flags=m,8!=(255&n.flags)){t.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=m>>8&1),512&n.flags&&(D[0]=255&m,D[1]=m>>>8&255,n.check=o(n.check,D,2,0)),p=m=0,n.mode=3;case 3:for(;p<32;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}n.head&&(n.head.time=m),512&n.flags&&(D[0]=255&m,D[1]=m>>>8&255,D[2]=m>>>16&255,D[3]=m>>>24&255,n.check=o(n.check,D,4,0)),p=m=0,n.mode=4;case 4:for(;p<16;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}n.head&&(n.head.xflags=255&m,n.head.os=m>>8),512&n.flags&&(D[0]=255&m,D[1]=m>>>8&255,n.check=o(n.check,D,2,0)),p=m=0,n.mode=5;case 5:if(1024&n.flags){for(;p<16;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}n.length=m,n.head&&(n.head.extra_len=m),512&n.flags&&(D[0]=255&m,D[1]=m>>>8&255,n.check=o(n.check,D,2,0)),p=m=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(g<(w=n.length)&&(w=g),w&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),i.arraySet(n.head.extra,h,u,w,A)),512&n.flags&&(n.check=o(n.check,h,w,u)),g-=w,u+=w,n.length-=w),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===g)break t;for(w=0;A=h[u+w++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A)),A&&w<g;);if(512&n.flags&&(n.check=o(n.check,h,w,u)),g-=w,u+=w,A)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===g)break t;for(w=0;A=h[u+w++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A)),A&&w<g;);if(512&n.flags&&(n.check=o(n.check,h,w,u)),g-=w,u+=w,A)break t}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;p<16;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(m!==(65535&n.check)){t.msg="header crc mismatch",n.mode=30;break}p=m=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=12;break;case 10:for(;p<32;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}t.adler=n.check=c(m),p=m=0,n.mode=11;case 11:if(0===n.havedict)return t.next_out=b,t.avail_out=f,t.next_in=u,t.avail_in=g,n.hold=m,n.bits=p,2;t.adler=n.check=1,n.mode=12;case 12:if(5===e||6===e)break t;case 13:if(n.last){m>>>=7&p,p-=7&p,n.mode=27;break}for(;p<3;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}switch(n.last=1&m,p-=1,3&(m>>>=1)){case 0:n.mode=14;break;case 1:if(_(n),n.mode=20,6!==e)break;m>>>=2,p-=2;break t;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=30}m>>>=2,p-=2;break;case 14:for(m>>>=7&p,p-=7&p;p<32;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if((65535&m)!=(m>>>16^65535)){t.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&m,p=m=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(w=n.length){if(g<w&&(w=g),f<w&&(w=f),0===w)break t;i.arraySet(d,h,u,w,b),g-=w,u+=w,f-=w,b+=w,n.length-=w;break}n.mode=12;break;case 17:for(;p<14;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(n.nlen=257+(31&m),p-=5,n.ndist=1+(31&(m>>>=5)),p-=5,n.ncode=4+(15&(m>>>=5)),m>>>=4,p-=4,286<n.nlen||30<n.ndist){t.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;p<3;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}n.lens[T[n.have++]]=7&m,m>>>=3,p-=3}for(;n.have<19;)n.lens[T[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,B=r(0,n.lens,0,19,n.lencode,0,n.work,j={bits:n.lenbits}),n.lenbits=j.bits,B){t.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;k=(z=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,P=65535&z,!((M=z>>>24)<=p);){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(P<16)m>>>=M,p-=M,n.lens[n.have++]=P;else{if(16===P){for(E=M+2;p<E;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(m>>>=M,p-=M,0===n.have){t.msg="invalid bit length repeat",n.mode=30;break}A=n.lens[n.have-1],w=3+(3&m),m>>>=2,p-=2}else if(17===P){for(E=M+3;p<E;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}p-=M,A=0,w=3+(7&(m>>>=M)),m>>>=3,p-=3}else{for(E=M+7;p<E;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}p-=M,A=0,w=11+(127&(m>>>=M)),m>>>=7,p-=7}if(n.have+w>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=30;break}for(;w--;)n.lens[n.have++]=A}}if(30===n.mode)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,B=r(1,n.lens,0,n.nlen,n.lencode,0,n.work,j={bits:n.lenbits}),n.lenbits=j.bits,B){t.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,B=r(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,j={bits:n.distbits}),n.distbits=j.bits,B){t.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(6<=g&&258<=f){t.next_out=b,t.avail_out=f,t.next_in=u,t.avail_in=g,n.hold=m,n.bits=p,s(t,x),b=t.next_out,d=t.output,f=t.avail_out,u=t.next_in,h=t.input,g=t.avail_in,m=n.hold,p=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;k=(z=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,P=65535&z,!((M=z>>>24)<=p);){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(k&&0==(240&k)){for(O=M,L=k,I=P;k=(z=n.lencode[I+((m&(1<<O+L)-1)>>O)])>>>16&255,P=65535&z,!(O+(M=z>>>24)<=p);){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}m>>>=O,p-=O,n.back+=O}if(m>>>=M,p-=M,n.back+=M,n.length=P,0===k){n.mode=26;break}if(32&k){n.back=-1,n.mode=12;break}if(64&k){t.msg="invalid literal/length code",n.mode=30;break}n.extra=15&k,n.mode=22;case 22:if(n.extra){for(E=n.extra;p<E;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}n.length+=m&(1<<n.extra)-1,m>>>=n.extra,p-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;k=(z=n.distcode[m&(1<<n.distbits)-1])>>>16&255,P=65535&z,!((M=z>>>24)<=p);){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(0==(240&k)){for(O=M,L=k,I=P;k=(z=n.distcode[I+((m&(1<<O+L)-1)>>O)])>>>16&255,P=65535&z,!(O+(M=z>>>24)<=p);){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}m>>>=O,p-=O,n.back+=O}if(m>>>=M,p-=M,n.back+=M,64&k){t.msg="invalid distance code",n.mode=30;break}n.offset=P,n.extra=15&k,n.mode=24;case 24:if(n.extra){for(E=n.extra;p<E;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}n.offset+=m&(1<<n.extra)-1,m>>>=n.extra,p-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===f)break t;if(n.offset>(w=x-f)){if((w=n.offset-w)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=30;break}S=w>n.wnext?n.wsize-(w-=n.wnext):n.wnext-w,w>n.length&&(w=n.length),C=n.window}else C=d,S=b-n.offset,w=n.length;for(f<w&&(w=f),f-=w,n.length-=w;d[b++]=C[S++],--w;);0===n.length&&(n.mode=21);break;case 26:if(0===f)break t;d[b++]=n.length,f--,n.mode=21;break;case 27:if(n.wrap){for(;p<32;){if(0===g)break t;g--,m|=h[u++]<<p,p+=8}if(t.total_out+=x-=f,n.total+=x,x&&(t.adler=n.check=n.flags?o(n.check,d,x,b-x):a(n.check,d,x,b-x)),x=f,(n.flags?m:c(m))!==n.check){t.msg="incorrect data check",n.mode=30;break}p=m=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;p<32;){if(0===g)break t;g--,m+=h[u++]<<p,p+=8}if(m!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=30;break}p=m=0}n.mode=29;case 29:B=1;break t;case 30:B=-3;break t;case 31:return-4;case 32:default:return l}return t.next_out=b,t.avail_out=f,t.next_in=u,t.avail_in=g,n.hold=m,n.bits=p,(n.wsize||x!==t.avail_out&&n.mode<30&&(n.mode<27||4!==e))&&v(t,t.output,t.next_out,x-t.avail_out)?(n.mode=31,-4):(x-=t.avail_out,t.total_in+=y-=t.avail_in,t.total_out+=x,n.total+=x,n.wrap&&x&&(t.adler=n.check=n.flags?o(n.check,d,x,t.next_out-x):a(n.check,d,x,t.next_out-x)),t.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==y&&0===x||4===e)&&0===B&&(B=-5),B)},n.inflateEnd=function(t){if(!t||!t.state)return l;var e=t.state;return e.window&&(e.window=null),t.state=null,0},n.inflateGetHeader=function(t,e){var n;return t&&t.state?0==(2&(n=t.state).wrap)?l:((n.head=e).done=!1,0):l},n.inflateSetDictionary=function(t,e){var n,i=e.length;return t&&t.state?0!==(n=t.state).wrap&&11!==n.mode?l:11===n.mode&&a(1,e,i,0)!==n.check?-3:v(t,e,i,i)?(n.mode=31,-4):(n.havedict=1,0):l},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,n){"use strict";var i=t("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],r=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,n,l,c,h,d,u){var b,g,f,m,p,_,v,y,x,w=u.bits,S=0,C=0,M=0,k=0,P=0,O=0,L=0,I=0,A=0,B=0,j=null,E=0,z=new i.Buf16(16),D=new i.Buf16(16),T=null,N=0;for(S=0;S<=15;S++)z[S]=0;for(C=0;C<l;C++)z[e[n+C]]++;for(P=w,k=15;1<=k&&0===z[k];k--);if(k<P&&(P=k),0===k)return c[h++]=20971520,c[h++]=20971520,u.bits=1,0;for(M=1;M<k&&0===z[M];M++);for(P<M&&(P=M),S=I=1;S<=15;S++)if(I<<=1,(I-=z[S])<0)return-1;if(0<I&&(0===t||1!==k))return-1;for(D[1]=0,S=1;S<15;S++)D[S+1]=D[S]+z[S];for(C=0;C<l;C++)0!==e[n+C]&&(d[D[e[n+C]]++]=C);if(_=0===t?(j=T=d,19):1===t?(j=a,E-=257,T=o,N-=257,256):(j=s,T=r,-1),S=M,p=h,L=C=B=0,f=-1,m=(A=1<<(O=P))-1,1===t&&852<A||2===t&&592<A)return 1;for(;;){for(v=S-L,x=d[C]<_?(y=0,d[C]):d[C]>_?(y=T[N+d[C]],j[E+d[C]]):(y=96,0),b=1<<S-L,M=g=1<<O;c[p+(B>>L)+(g-=b)]=v<<24|y<<16|x|0,0!==g;);for(b=1<<S-1;B&b;)b>>=1;if(0!==b?(B&=b-1,B+=b):B=0,C++,0==--z[S]){if(S===k)break;S=e[n+d[C]]}if(P<S&&(B&m)!==f){for(0===L&&(L=P),p+=M,I=1<<(O=S-L);O+L<k&&!((I-=z[O+L])<=0);)O++,I<<=1;if(A+=1<<O,1===t&&852<A||2===t&&592<A)return 1;c[f=B&m]=P<<24|O<<16|p-h|0}}return 0!==B&&(c[p+B]=S-L<<24|64<<16|0),u.bits=P,0}},{"../utils/common":41}],51:[function(t,e,n){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,n){"use strict";var i=t("../utils/common");function a(t){for(var e=t.length;0<=--e;)t[e]=0}var o=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],s=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],l=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);a(c);var h=new Array(60);a(h);var d=new Array(512);a(d);var u=new Array(256);a(u);var b=new Array(29);a(b);var g,f,m,p=new Array(30);function _(t,e,n,i,a){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=a,this.has_stree=t&&t.length}function v(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function y(t){return t<256?d[t]:d[256+(t>>>7)]}function x(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function w(t,e,n){t.bi_valid>16-n?(t.bi_buf|=e<<t.bi_valid&65535,x(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function S(t,e,n){w(t,n[2*e],n[2*e+1])}function C(t,e){for(var n=0;n|=1&t,t>>>=1,n<<=1,0<--e;);return n>>>1}function M(t,e,n){var i,a,o=new Array(16),s=0;for(i=1;i<=15;i++)o[i]=s=s+n[i-1]<<1;for(a=0;a<=e;a++){var r=t[2*a+1];0!==r&&(t[2*a]=C(o[r]++,r))}}function k(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function P(t){8<t.bi_valid?x(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function O(t,e,n,i){var a=2*e,o=2*n;return t[a]<t[o]||t[a]===t[o]&&i[e]<=i[n]}function L(t,e,n){for(var i=t.heap[n],a=n<<1;a<=t.heap_len&&(a<t.heap_len&&O(e,t.heap[a+1],t.heap[a],t.depth)&&a++,!O(e,i,t.heap[a],t.depth));)t.heap[n]=t.heap[a],n=a,a<<=1;t.heap[n]=i}function I(t,e,n){var i,a,r,l,c=0;if(0!==t.last_lit)for(;i=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],a=t.pending_buf[t.l_buf+c],c++,0===i?S(t,a,e):(S(t,(r=u[a])+256+1,e),0!==(l=o[r])&&w(t,a-=b[r],l),S(t,r=y(--i),n),0!==(l=s[r])&&w(t,i-=p[r],l)),c<t.last_lit;);S(t,256,e)}function A(t,e){var n,i,a,o=e.dyn_tree,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,l=e.stat_desc.elems,c=-1;for(t.heap_len=0,t.heap_max=573,n=0;n<l;n++)0!==o[2*n]?(t.heap[++t.heap_len]=c=n,t.depth[n]=0):o[2*n+1]=0;for(;t.heap_len<2;)o[2*(a=t.heap[++t.heap_len]=c<2?++c:0)]=1,t.depth[a]=0,t.opt_len--,r&&(t.static_len-=s[2*a+1]);for(e.max_code=c,n=t.heap_len>>1;1<=n;n--)L(t,o,n);for(a=l;n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],L(t,o,1),i=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=i,o[2*a]=o[2*n]+o[2*i],t.depth[a]=(t.depth[n]>=t.depth[i]?t.depth[n]:t.depth[i])+1,o[2*n+1]=o[2*i+1]=a,t.heap[1]=a++,L(t,o,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,i,a,o,s,r,l=e.dyn_tree,c=e.max_code,h=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,b=e.stat_desc.extra_base,g=e.stat_desc.max_length,f=0;for(o=0;o<=15;o++)t.bl_count[o]=0;for(l[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<573;n++)g<(o=l[2*l[2*(i=t.heap[n])+1]+1]+1)&&(o=g,f++),l[2*i+1]=o,c<i||(t.bl_count[o]++,s=0,b<=i&&(s=u[i-b]),t.opt_len+=(r=l[2*i])*(o+s),d&&(t.static_len+=r*(h[2*i+1]+s)));if(0!==f){do{for(o=g-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[g]--,f-=2}while(0<f);for(o=g;0!==o;o--)for(i=t.bl_count[o];0!==i;)c<(a=t.heap[--n])||(l[2*a+1]!==o&&(t.opt_len+=(o-l[2*a+1])*l[2*a],l[2*a+1]=o),i--)}}(t,e),M(o,c,t.bl_count)}function B(t,e,n){var i,a,o=-1,s=e[1],r=0,l=7,c=4;for(0===s&&(l=138,c=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)a=s,s=e[2*(i+1)+1],++r<l&&a===s||(r<c?t.bl_tree[2*a]+=r:0!==a?(a!==o&&t.bl_tree[2*a]++,t.bl_tree[32]++):r<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=a,c=(r=0)===s?(l=138,3):a===s?(l=6,3):(l=7,4))}function j(t,e,n){var i,a,o=-1,s=e[1],r=0,l=7,c=4;for(0===s&&(l=138,c=3),i=0;i<=n;i++)if(a=s,s=e[2*(i+1)+1],!(++r<l&&a===s)){if(r<c)for(;S(t,a,t.bl_tree),0!=--r;);else 0!==a?(a!==o&&(S(t,a,t.bl_tree),r--),S(t,16,t.bl_tree),w(t,r-3,2)):r<=10?(S(t,17,t.bl_tree),w(t,r-3,3)):(S(t,18,t.bl_tree),w(t,r-11,7));o=a,c=(r=0)===s?(l=138,3):a===s?(l=6,3):(l=7,4)}}a(p);var E=!1;function z(t,e,n,a){w(t,0+(a?1:0),3),function(t,e,n,a){P(t),x(t,n),x(t,~n),i.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}(t,e,n)}n._tr_init=function(t){E||(function(){var t,e,n,i,a,l=new Array(16);for(i=n=0;i<28;i++)for(b[i]=n,t=0;t<1<<o[i];t++)u[n++]=i;for(u[n-1]=i,i=a=0;i<16;i++)for(p[i]=a,t=0;t<1<<s[i];t++)d[a++]=i;for(a>>=7;i<30;i++)for(p[i]=a<<7,t=0;t<1<<s[i]-7;t++)d[256+a++]=i;for(e=0;e<=15;e++)l[e]=0;for(t=0;t<=143;)c[2*t+1]=8,t++,l[8]++;for(;t<=255;)c[2*t+1]=9,t++,l[9]++;for(;t<=279;)c[2*t+1]=7,t++,l[7]++;for(;t<=287;)c[2*t+1]=8,t++,l[8]++;for(M(c,287,l),t=0;t<30;t++)h[2*t+1]=5,h[2*t]=C(t,5);g=new _(c,o,257,286,15),f=new _(h,s,0,30,15),m=new _(new Array(0),r,0,19,7)}(),E=!0),t.l_desc=new v(t.dyn_ltree,g),t.d_desc=new v(t.dyn_dtree,f),t.bl_desc=new v(t.bl_tree,m),t.bi_buf=0,t.bi_valid=0,k(t)},n._tr_stored_block=z,n._tr_flush_block=function(t,e,n,i){var a,o,s=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),A(t,t.l_desc),A(t,t.d_desc),s=function(t){var e;for(B(t,t.dyn_ltree,t.l_desc.max_code),B(t,t.dyn_dtree,t.d_desc.max_code),A(t,t.bl_desc),e=18;3<=e&&0===t.bl_tree[2*l[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),(o=t.static_len+3+7>>>3)<=(a=t.opt_len+3+7>>>3)&&(a=o)):a=o=n+5,n+4<=a&&-1!==e?z(t,e,n,i):4===t.strategy||o===a?(w(t,2+(i?1:0),3),I(t,c,h)):(w(t,4+(i?1:0),3),function(t,e,n,i){var a;for(w(t,e-257,5),w(t,n-1,5),w(t,i-4,4),a=0;a<i;a++)w(t,t.bl_tree[2*l[a]+1],3);j(t,t.dyn_ltree,e-1),j(t,t.dyn_dtree,n-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),I(t,t.dyn_ltree,t.dyn_dtree)),k(t),i&&P(t)},n._tr_tally=function(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(u[n]+256+1)]++,t.dyn_dtree[2*y(e)]++),t.last_lit===t.lit_bufsize-1},n._tr_align=function(t){w(t,2,3),S(t,256,c),function(t){16===t.bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":41}],53:[function(t,e,n){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,n){"use strict";e.exports="function"==typeof setImmediate?setImmediate:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}},{}]},{},[10])(10)}}]);