1"use strict";(self.webpackChunkminostech_admin_angular=self.webpackChunkminostech_admin_angular||[]).push([[990],{47990:(rt,w,m)=>{m.r(w),m.d(w,{ProductDetectionModule:()=>it});var g=m(36895),C=m(19347),h=m(49671),P=m(81042),e=m(94650),f=m(51491),x=m(64383),E=m(90457),b=m(37923),k=m(11481),v=m(4484),N=m(12153),y=m(1637),_=m(24006);const V=["resultCard"];function R(r,a){1&r&&(e.\u0275\u0275elementStart(0,"div"),e.\u0275\u0275text(1),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275elementEnd()),2&r&&(e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(2,1,"AI_DETECTION_DRAWER.NO_RESULTS")," "))}const L=function(){return{width:"100%",height:"100%","border-radius":"0"}};function B(r,a){1&r&&e.\u0275\u0275element(0,"ngx-skeleton-loader",31),2&r&&e.\u0275\u0275property("theme",e.\u0275\u0275pureFunction0(1,L))}function F(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",32)(1,"div",33)(2,"div",34)(3,"label",35),e.\u0275\u0275text(4),e.\u0275\u0275pipe(5,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(6,"input",36),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext().$implicit,s=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(s.estimatedQtyMap[o.id]=i)})("keypress",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext(3);return e.\u0275\u0275resetView(o.allowNumbersOnly(i))}),e.\u0275\u0275pipe(7,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(8,"div",37)(9,"button",38),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit,o=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(o.closePopup(i.id))}),e.\u0275\u0275text(10),e.\u0275\u0275pipe(11,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(12,"button",39),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit,o=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(o.confirmPopupAction(i))}),e.\u0275\u0275text(13),e.\u0275\u0275pipe(14,"translate"),e.\u0275\u0275pipe(15,"translate"),e.\u0275\u0275elementEnd()()()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit,n=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(3),e.\u0275\u0275propertyInterpolate1("for","estimatedQty-",t.id,""),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(5,7,"AI_DETECTION_DRAWER.ESTIMATED_QTY_LABEL")),e.\u0275\u0275advance(2),e.\u0275\u0275propertyInterpolate1("id","estimatedQty-",t.id,""),e.\u0275\u0275property("ngModel",n.estimatedQtyMap[t.id])("placeholder",e.\u0275\u0275pipeBind1(7,9,"AI_DETECTION_DRAWER.ENTER_QUANTITY_PLACEHOLDER")),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(11,11,"AI_DETECTION_DRAWER.CANCEL")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ","community"===n.openPopups[t.id]?e.\u0275\u0275pipeBind1(14,13,"AI_DETECTION_DRAWER.CREATE_POST"):e.\u0275\u0275pipeBind1(15,15,"AI_DETECTION_DRAWER.CREATE_WTS_REQUEST")," ")}}function U(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"button",40),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit,o=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(o.createEbayListing(i))}),e.\u0275\u0275text(1),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275elementEnd()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275property("disabled",!(null!=t&&t.modelName&&null!=t&&t.imageUrl&&null!=t&&t.id)),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(2,2,"AI_DETECTION_DRAWER.CREATE_EBAY_LISTING")," ")}}function G(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",19,20)(2,"div",21),e.\u0275\u0275template(3,B,1,2,"ngx-skeleton-loader",22),e.\u0275\u0275elementStart(4,"img",23),e.\u0275\u0275listener("load",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext(2);
1return e.\u0275\u0275resetView(i.imageLoaded=!0)}),e.\u0275\u0275pipe(5,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275element(6,"div",24),e.\u0275\u0275elementStart(7,"div",25)(8,"p")(9,"strong"),e.\u0275\u0275text(10),e.\u0275\u0275pipe(11,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(12),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(13,"p")(14,"strong"),e.\u0275\u0275text(15),e.\u0275\u0275pipe(16,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(17),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(18,"p")(19,"strong"),e.\u0275\u0275text(20),e.\u0275\u0275pipe(21,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(22),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(23,"p")(24,"strong"),e.\u0275\u0275text(25),e.\u0275\u0275pipe(26,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(27),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(28,"p")(29,"strong"),e.\u0275\u0275text(30),e.\u0275\u0275pipe(31,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(32),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(33,"p")(34,"strong"),e.\u0275\u0275text(35),e.\u0275\u0275pipe(36,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(37),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(38,"p")(39,"strong"),e.\u0275\u0275text(40),e.\u0275\u0275pipe(41,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(42),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(43,"p")(44,"strong"),e.\u0275\u0275text(45),e.\u0275\u0275pipe(46,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(47),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(48,"p")(49,"strong"),e.\u0275\u0275text(50),e.\u0275\u0275pipe(51,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(52),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(53,"p")(54,"strong"),e.\u0275\u0275text(55),e.\u0275\u0275pipe(56,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(57),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(58,"p")(59,"strong"),e.\u0275\u0275text(60),e.\u0275\u0275pipe(61,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(62),e.\u0275\u0275pipe(63,"date"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(64,"div",26)(65,"button",27),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(s.connectWithBuyers(o))}),e.\u0275\u0275text(66),e.\u0275\u0275pipe(67,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(68,F,16,17,"div",28),e.\u0275\u0275elementStart(69,"button",29),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(s.openPopup(o,"wts"))}),e.\u0275\u0275text(70),e.\u0275\u0275pipe(71,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(72,U,3,4,"button",30),e.\u0275\u0275elementEnd()()}if(2&r){const t=a.$implicit,n=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(3),e.\u0275\u0275property("ngIf",!t.modelName),e.\u0275\u0275advance(1),e.\u0275\u0275property("src",t.imageUrl,e.\u0275\u0275sanitizeUrl)("alt",e.\u0275\u0275pipeBind1(5,31,"IMAGES.PRODUCT_IMAGE")),e.\u0275\u0275advance(6),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(11,33,"AI_DETECTION_DRAWER.PICTURE_ID")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.id," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(16,35,"AI_DETECTION_DRAWER.POTENTIAL_BUYERS")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",null==t?null:t.potentialBuyerCount," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(21,37,"AI_DETECTION_DRAWER.EBAY_AVG_SALE_PRICE")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",null==t?null:t.eBayAvgSalePrice," USD "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(26,39,"AI_DETECTION_DRAWER.MSP_AUCTION_PRICE")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.mspAvgSalePrice," USD "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(31,41,"AI_DETECTION_DRAWER.MANUFACTURER")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.manufacturer," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(36,43,"AI_DETECTION_DRAWER.MODEL_NAME")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.modelName," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(41,45,"AI_DETECTION_DRAWER.CATEGORY")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.category," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(46,47,"AI_DETECTION_DRAWER.DESCRIPTION")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.description," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(51,49,"AI_DETECTION_DRAWER.SPECS")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.specs," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(56,51,"AI_DETECTION_DRAWER.ESTIMATED_QTY")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.qty," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(61,53,"AI_DETECTION_DRAWER.TIME")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind2(63,55,t.timestamp,"short")," "),e.\u0275\u0275advance(3),e.\u0275\u0275property("disabled",!(null!=t&&t.modelName&&null!=t&&t.imageUrl&&null!=t&&t.id)),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(67,58,"AI_DETECTION_DRAWER.CONNECT_WITH_BUYERS")," "),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",n.openPopups[t.id]),e.\u0275\u0275advance(1),e.\u0275\u0275property("disabled",!(null!=t&&t.modelName&&null!=t&&t.imageUrl&&null!=t&&t.id)),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(71,60,"AI_DETECTION_DRAWER.CREATE_WTS_REQUEST")," "),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",n.adminService.isAdmin)}}function $(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"div",16),e.\u0275\u0275template(1,R,3,3,"div",17),e.\u0275\u0275template(2,G,73,62,"div",18),e.\u0275\u0275elementEnd()),2&r){const t=e.\u0275\u0275nextContext();e.\u0275\u0275classProp("show","vision"===t.selectedTab)("active","vision"===t.selectedTab),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",0===t.drawerService.aiProductDetectionResults.length),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngForOf",t.drawerService.aiProductDetectionResults)}}let j=(()=>
1{class r{constructor(t,n,i,o,s,l,c){this.socketService=t,this.toastr=n,this.drawerService=i,this.api=o,this.router=s,this.translate=l,this.adminService=c,this.imageLoaded=!1,this.isDrawerOpen=!0,this.lastIsMobile=!1,this.potentialBuyerCounts={},this.selectedTab="vision",this.inactivityLimit=9e5,this.loadingResults=!0,this.localWtsList=[],this.wtsSentProducts=new Set,this.openPopups={},this.estimatedQtyMap={}}ngOnInit(){this.drawerService.drawerState$.subscribe(t=>{this.isDrawerOpen=t}),this.lastIsMobile=window.innerWidth<=1024,this.lastIsMobile?this.drawerService.closeDrawer():this.drawerService.openDrawer(),this.startInactivityWatcher(),this.socketService.aiProductDetection$.subscribe(t=>{const n=this.drawerService.aiProductDetectionResults.findIndex(i=>i.imageRefId===t.imageRefId);-1===n?this.drawerService.aiProductDetectionResults.unshift({...t,qty:t.qty??null,imageKey:t.imageKey,imageUrl:t.imageUrl,imageRefId:t.imageRefId,potentialBuyerCount:t.potentialBuyerCount??t.buyerCount,potentialBuyers:t.potentialBuyers??[]}):this.drawerService.aiProductDetectionResults[n]={...this.drawerService.aiProductDetectionResults[n],...t,qty:t.qty??null,imageKey:t.imageKey,imageUrl:t.imageUrl,imageRefId:t.imageRefId,potentialBuyerCount:t.potentialBuyerCount??t.buyerCount,potentialBuyers:t.potentialBuyers??[],eBayAvgSalePrice:t.eBayAvgSalePrice,mspAvgSalePrice:t.mspAvgSalePrice}})}ngOnChanges(t){}onResize(){const t=window.innerWidth<=1024;t!==this.lastIsMobile&&(t&&(this.isDrawerOpen=!1),t||(this.isDrawerOpen=!0),this.lastIsMobile=t)}scrollToLatest(){this.resultCards.length&&this.resultCards.last.nativeElement.scrollIntoView({behavior:"smooth",block:"start"})}toggleDrawer(){this.drawerService.toggleDrawer()}closeDrawer(){this.drawerService.closeDrawer()}ngOnDestroy(){this.inactivityTimeout&&clearTimeout(this.inactivityTimeout)}startInactivityWatcher(){const t=()=>{this.inactivityTimeout&&clearTimeout(this.inactivityTimeout),this.inactivityTimeout=setTimeout(()=>{"vision"===this.selectedTab&&(console.warn(this.translate.instant("AI_DETECTION_DRAWER.INACTIVITY_WARNING")),this.selectedTab="item")},this.inactivityLimit)};["mousemove","keydown","mousedown","touchstart"].forEach(i=>window.addEventListener(i,t,{passive:!0})),t()}openPopup(t,n){this.openPopups[t.id]=n,this.estimatedQtyMap[t.id]=t.qty??1}closePopup(t){delete this.openPopups[t],delete this.estimatedQtyMap[t]}confirmPopupAction(t){var n=this;return(0,h.Z)(function*(){const i=t.id,o=n.openPopups[i];if(!o)return;const s=n.estimatedQtyMap[i]??1,l=`ai-product-detection/${i}/update-qty`;try{yield n.api.post(l,{qty:s},!1,!1),t.qty=s}catch(c){console.error("Failed to update quantity:",c),n.toastr.error(n.translate.instant("AI_DETECTION_DRAWER.UPDATE_QTY_FAILED"))}"wts"===o&&(yield n.drawerService.createWTS({id:i,modelName:t.modelName,manufacturer:t.manufacturer,description:t.description,specs:t.specs,category:t.category,qty:s,imageKey:t.imageKey})),n.closePopup(i)})()}connectWithBuyers(t){this.drawerService.connectWithBuyers(t)}openCommunityPostPopup(t){this.openPopup(t,"community"),this.estimatedQtyMap[t.id]=t.qty??null}allowNumbersOnly(t){const n=String.fromCharCode(t.keyCode||t.which);/[0-9]/.test(n)||t.preventDefault()}createEbayListing(t){this.drawerService.openMarketValueTrend(t)}}return r.\u0275fac=function(t){return new(t||r)(e.\u0275\u0275directiveInject(N.y),e.\u0275\u0275directiveInject(x._W),e.\u0275\u0275directiveInject(b.d),e.\u0275\u0275directiveInject(f.t),e.\u0275\u0275directiveInject(C.F0),e.\u0275\u0275directiveInject(v.sK),e.\u0275\u0275directiveInject(E.l))},r.\u0275cmp=e.\u0275\u0275defineComponent({type:r,selectors:[["app-product-detection-drawer"]],viewQuery:function(t,n){if(1&t&&e.\u0275\u0275viewQuery(V,5),2&t){let i;e.\u0275\u0275queryRefresh(i=e.\u0275\u0275loadQuery())&&(n.resultCards=i)}},hostBindings:function(t,n){1&t&&e.\u0275\u0275listener("resize",function(){return n.onResize()},!1,e.\u0275\u0275resolveWindow)},features:[e.\u0275\u0275NgOnChangesFeature],decls:24,vars:14,consts:[[1,"drawer-section"],[1,"top-to-bottom",3,"click"],[1,"fas","fa-arrow-down"],[1,"drawer-close-btn",3,"click"],[2,"text-align","center","display","flex","align-items","center","width","100%","justify-content","center","padding","10px 0px","gap","5px"],["src","assets/imgs/msp-gpt-logo.png",2,"width","34px","height","34px",3,"alt"],[2,"margin","0","padding","10px 0","font-size","20px","color","goldenrod"],[1,"col-12"],[1,"card","card-primary","card-tabs"],[1,"card-header","p-0","pt-1"],["id","custom-tabs-one-tab","role","tablist",1,"nav","nav-tabs"],[1,"nav-item"],["id","custom-tabs-one-profile-tab","data-toggle","pill","href","","role","tab","aria-controls","custom-tabs-one-profile","aria-selected","false",1,"nav-link",3,"click"],[1,"card-body"],["id","custom-tabs-one-tabContent",1,"tab-content"],["class","tab-pane fade","id","custom-tabs-one-profile","role","tabpanel","aria-labelledby","custom-tabs-one-profile-tab",3,"show","active",4,"ngIf"],["id","custom-tabs-one-profile","role","tabpanel","aria-labelledby","custom-tabs-one-profile-tab",1,"tab-pane","fade"],[4,"ngIf"],["class","popup-box",4,"ngFor","ngForOf"],[1,"popup-box"],["resultCard",""],[1,"card","mt-5","position-relative",2,"width","100%","height","300px","overflow","hidden"],["count","1","appearance","line","class","skeleton-overlay","style","opacity: 0.8",3,"theme",4,"ngIf"],["loading","lazy",2,"width","100%","height","100%","object-fit","cover",3,"src","alt","load"],[1,"popup-arrow"],[1,"popup-content"],[1,"button-group"],[1,"btn","btn-success",3,"disabled","click"],["class","modal-overlay","style","\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.6);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n ",4,"ngIf"],[1,"btn","btn-info",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"ngIf"],["count","1","appearance","line",1,"skeleton-overlay",2,"opacity","0.8",3,"theme"],[1,"modal-overlay",2,"position","fixed","top","0","left","0","width","100%","height","100%","background","rgba(0, 0, 0, 0.6)","display","flex","justify-content","center","align-items","center","z-index","9999"],[1,"modal-content",2,"background","#fff","padding","20px","border-radius","10px","width","400px","max-width","95%"],[1,"form-group"],[3,"for"],["type","number","min","1",1,"form-control",3,"id","ngModel","placeholder","ngModelChange","keypress"],[2,"margin-top","20px","display","flex","justify-content","flex-end","gap","10px"],[1,"btn","btn-secondary",3,"click"],[1,"btn","btn-primary",3,"click"],[1,"btn","btn-primary",3,"disabled","click"]],template:function(t,n){1&t&&(e.\u0275\u0275elementStart(0,"div",0)(1,"div",1),e.\u0275\u0275listener("click",function(){return n.scrollToLatest()}),e.\u0275\u0275element(2,"i",2),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(3,"div",0)(4,"button",3),e.\u0275\u0275listener("click",function(){return n.closeDrawer()}),e.\u0275\u0275elementStart(5,"span"),e.\u0275\u0275text(6,"\u2716"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(7,"div",4),e.\u0275\u0275element(8,"img",5),e.\u0275\u0275pipe(9,"translate"),e.\u0275\u0275elementStart(10,"h1",6),e.\u0275\u0275text(11),e.\u0275\u0275pipe(12,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(13,"div",7)(14,"div",8)(15,"div",9)(16,"ul",10)(17,"li",11)(18,"a",12),e.\u0275\u0275listener("click",function(o){return n.selectedTab="vision",o.preventDefault()}),e.\u0275\u0275text(19),e.\u0275\u0275pipe(20,"translate"),e.\u0275\u0275elementEnd()()()(),e.\u0275\u0275elementStart(21,"div",13)(22,"div",14),e.\u0275\u0275template(23,$,3,6,"div",15),e.\u0275\u0275elementEnd()()()()()()),2&t&&(e.\u0275\u0275classProp("drawer
1-collapsed",!n.isDrawerOpen),e.\u0275\u0275advance(8),e.\u0275\u0275property("alt",e.\u0275\u0275pipeBind1(9,8,"IMAGES.MSP_GPT_LOGO")),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(12,10,"AI_DETECTION_DRAWER.HEADER_TITLE")," "),e.\u0275\u0275advance(7),e.\u0275\u0275classProp("active","vision"===n.selectedTab),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(20,12,"AI_DETECTION_DRAWER.TAB_RESULTS")),e.\u0275\u0275advance(4),e.\u0275\u0275property("ngIf","vision"===n.selectedTab))},dependencies:[g.NgForOf,g.NgIf,y.xr,_.Fj,_.wV,_.JJ,_.qQ,_.On,g.DatePipe,v.X$],styles:[".drawer-section[_ngcontent-%COMP%]{width:350px;display:flex;flex-direction:column;background-color:#343a3f;position:fixed;right:0;top:0;z-index:9998;height:100vh;overflow-y:auto;transform:translate(0);transition:transform .9s ease-in-out}.drawer-section.open[_ngcontent-%COMP%]{right:0}.top-to-bottom[_ngcontent-%COMP%]{width:50px;height:50px;border-radius:50%;background-color:#daa520;z-index:99999;position:absolute;right:10px;bottom:10px;display:flex;justify-content:center;align-items:center}.top-to-bottom[_ngcontent-%COMP%] .fa-arrow-down[_ngcontent-%COMP%]{color:#fff}.drawer-collapsed[_ngcontent-%COMP%]{transform:translate(100%)}.popup-box[_ngcontent-%COMP%]{background:#150a30;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:12px;padding:20px;box-shadow:0 10px 30px #0000001a;z-index:10;animation:fadeSlideIn .9s ease-out;width:100%;margin-top:10px}.popup-arrow[_ngcontent-%COMP%]{position:absolute;top:-10px;left:30px;width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-bottom:10px solid #150a30;z-index:1}.popup-button[_ngcontent-%COMP%]{background-color:#daa520;font-size:16px;color:#150a30;border-radius:10px;border:none;padding:10px 30px;font-weight:500}.all-popup-btn[_ngcontent-%COMP%]{padding:10px 0}.popup-content[_ngcontent-%COMP%]{color:#fff}.button-group[_ngcontent-%COMP%]{display:flex;gap:5px;flex-direction:column;max-width:300px}.card-header.p-0.pt-1[_ngcontent-%COMP%]{background-color:#daa520;justify-content:center}.nav-tabs[_ngcontent-%COMP%] .nav-link.active[_ngcontent-%COMP%]{background-color:#150a30;color:#fff;margin-left:20px;border:none}@media (max-width: 540px){.drawer-section[_ngcontent-%COMP%]{width:100%}}.drawer-close-btn[_ngcontent-%COMP%]{position:absolute;border:none;font-size:16px;cursor:pointer;border-radius:50px;margin:20px 10px;display:none}@media (max-width: 768px){.drawer-close-btn[_ngcontent-%COMP%]{display:block}}.nav-item[_ngcontent-%COMP%]{margin:auto}.skeleton-overlay[_ngcontent-%COMP%]{position:absolute!important;top:0;left:0;width:100%!important;height:100%!important;z-index:10}"]}),r})();function W(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"button",25),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(i.toggleCamera())}),e.\u0275\u0275pipe(1,"translate"),e.\u0275\u0275element(2,"i",26),e.\u0275\u0275elementEnd()}2&r&&e.\u0275\u0275property("title",e.\u0275\u0275pipeBind1(1,1,"AI_DETECTION.CAMERA.SWITCHED"))}function z(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"div",27),e.\u0275\u0275text(1),e.\u0275\u0275elementEnd()),2&r){const t=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.timerSeconds," ")}}function H(r,a){1&r&&e.\u0275\u0275element(0,"i",42)}function Q(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"li")(1,"a",40),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext(3);return e.\u0275\u0275resetView(s.selectCamera(o.deviceId))}),e.\u0275\u0275text(2),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275template(4,H,1,0,"i",41),e.\u0275\u0275elementEnd()()}if(2&r){const t=a.$implicit,n=e.\u0275\u0275nextContext(3);e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.label||e.\u0275\u0275pipeBind1(3,2,"AI_DETECTION.CAMERA.LIVE_VIEW")," "),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",n.selectedCameraId===t.deviceId)}}function Y(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",32)(1,"button",33),e.\u0275\u0275listener("click",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext(2);
1return e.\u0275\u0275resetView(o.toggleDropdown(i))}),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275element(3,"i",34),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(4,"ul",35)(5,"div",36),e.\u0275\u0275template(6,Q,5,4,"li",37),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(7,"button",38),e.\u0275\u0275pipe(8,"translate"),e.\u0275\u0275element(9,"i",39),e.\u0275\u0275elementEnd()()}if(2&r){const t=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(1),e.\u0275\u0275property("title",e.\u0275\u0275pipeBind1(2,7,"AI_DETECTION.CAMERA.SWITCH_FAILED")),e.\u0275\u0275advance(2),e.\u0275\u0275classProp("rotate",t.isDropdownOpen),e.\u0275\u0275advance(1),e.\u0275\u0275classProp("show",t.isDropdownOpen),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngForOf",t.availableCameras),e.\u0275\u0275advance(1),e.\u0275\u0275property("title",e.\u0275\u0275pipeBind1(8,9,"AI_DETECTION.CAMERA.ACCESS_DENIED"))}}function K(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"button",30),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(i.startScreenShare())}),e.\u0275\u0275text(1),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275elementEnd()}if(2&r){const t=e.\u0275\u0275nextContext(2);e.\u0275\u0275property("ngClass",t.isScreenSharing?"btn-danger":"btn-success"),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.isScreenSharing?e.\u0275\u0275pipeBind1(2,2,"AI_DETECTION.BUTTONS.STOP_SCREEN"):e.\u0275\u0275pipeBind1(3,4,"AI_DETECTION.BUTTONS.START_SCREEN")," ")}}function q(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",28),e.\u0275\u0275template(1,Y,10,11,"div",29),e.\u0275\u0275elementStart(2,"button",30),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(i.startAILabeling())}),e.\u0275\u0275text(3),e.\u0275\u0275pipe(4,"translate"),e.\u0275\u0275pipe(5,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(6,K,4,6,"button",31),e.\u0275\u0275elementEnd()}if(2&r){const t=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",t.isLabeling&&t.availableCameras.length),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngClass",t.isLabeling?"btn-danger":"btn-primary"),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.isLabeling?e.\u0275\u0275pipeBind1(4,4,"AI_DETECTION.BUTTONS.STOP_LABELING"):e.\u0275\u0275pipeBind1(5,6,"AI_DETECTION.BUTTONS.START_LABELING")," "),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngIf",!t.isMobileDevice)}}let Z=(()=>{class r{constructor(t,n,i,o,s,l,c){this.api=t,this.toastr=n,this.adminService=i,this.drawerService=o,this.sanitizer=s,this.translate=l,this.cdr=c,this.isLabeling=!1,this.stream=null,this.timerSeconds=5,this.screenStream=null,this.isScreenSharing=!1,this.isUsingCamera=!1,this.isUsingFrontCamera=!0,this.inactivityLimit=9e5,this.hasMultipleCameras=!1,this.availableCameras=[],this.selectedCameraId=null,this.isMobileDevice=!1,this.isDrawerOpen=!1}ngOnInit(){this.isMobileDevice=this.checkIfMobile(),localStorage.getItem("aiProductDetectionWelcome")||(this.showWelcomeAlert(),localStorage.setItem("aiProductDetectionWelcome","1")),this.drawerService.drawerState$.subscribe(t=>{this.isDrawerOpen=t,this.cdr.detectChanges()}),this.loadAvailableCameras(),this.resetInactivityTimer(),["mousemove","keydown","mousedown","touchstart"].forEach(t=>window.addEventListener(t,()=>this.resetInactivityTimer())),navigator.mediaDevices.ondevicechange=()=>{this.loadAvailableCameras()}}showWelcomeAlert(){Promise.resolve().then(m.t.bind(m,35226,23)).then(t=>{t.default.fire({title:this.translate.instant("AI_DETECTION.ALERTS.WELCOME_TITLE"),html:this.translate.instant("AI_DETECTION.ALERTS.WELCOME_MESSAGE"),icon:"info",confirmButtonText:this.translate.instant("AI_DETECTION.ALERTS.WELCOME_CONFIRM")})})}ngOnDestroy(){this.cleanupAll(),this.sub&&this.sub.unsubscribe(),clearTimeout(this.inactivityTimeout),["mousemove","keydown","mousedown","touchstart"].forEach(t=>window.removeEventListener(t,()=>this.resetInactivityTimer()))}resetInactivityTimer(){clearTimeout(this.inactivityTimeout),this.inactivityTimeout=setTimeout(()=>{this.handleInactivity()},this.inactivityLimit)}handleInactivity(){this.stopCameraLabeling(),this.stopScreenShare()}
1cleanupAll(){this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null),this.screenStream&&(this.screenStream.getTracks().forEach(t=>t.stop()),this.screenStream=null),this.videoElement&&(this.videoElement.pause(),this.videoElement.srcObject=null),this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.snapshotCountdownInterval&&(clearInterval(this.snapshotCountdownInterval),this.snapshotCountdownInterval=null),this.isLabeling=!1,this.isScreenSharing=!1,this.isUsingCamera=!1}toggleDrawer(){this.drawerService.toggleDrawer()}loadAvailableCameras(){var t=this;return(0,h.Z)(function*(){try{const n=yield navigator.mediaDevices.enumerateDevices();t.availableCameras=n.filter(i=>"videoinput"===i.kind),t.hasMultipleCameras=t.availableCameras.length>1,!t.selectedCameraId&&t.availableCameras.length>0&&(t.selectedCameraId=t.availableCameras[0].deviceId)}catch{t.availableCameras=[]}})()}selectCamera(t){var n=this;return(0,h.Z)(function*(){n.selectedCameraId=t,n.isLabeling&&(yield n.startCameraLabeling(),n.toastr.info(n.translate.instant("AI_DETECTION.MESSAGES.SWITCHED_CAMERA")))})()}checkForMultipleCameras(){var t=this;return(0,h.Z)(function*(){try{const i=(yield navigator.mediaDevices.enumerateDevices()).filter(o=>"videoinput"===o.kind);t.hasMultipleCameras=i.length>1}catch{t.hasMultipleCameras=!1}})()}toggleCamera(){var t=this;return(0,h.Z)(function*(){if(t.isUsingFrontCamera=!t.isUsingFrontCamera,t.isLabeling)try{const i=(yield navigator.mediaDevices.enumerateDevices()).filter(c=>"videoinput"===c.kind);let o;for(const c of i){const p=c.label.toLowerCase().includes("front");if(t.isUsingFrontCamera&&p||!t.isUsingFrontCamera&&!p){o=c.deviceId;break}}const s=o?{video:{deviceId:{exact:o}}}:{video:!0},l=yield navigator.mediaDevices.getUserMedia(s);t.stream?.getTracks().forEach(c=>c.stop()),t.stream=l,t.videoElement&&(t.videoElement.srcObject=t.stream,yield t.videoElement.play()),t.toastr.info(t.translate.instant(t.isUsingFrontCamera?"AI_DETECTION.MESSAGES.FRONT_CAMERA":"AI_DETECTION.MESSAGES.BACK_CAMERA"))}catch{t.toastr.error(t.translate.instant("AI_DETECTION.ERRORS.SWITCH_CAMERA_FAILED"))}})()}startCameraLabeling(){var t=this;return(0,h.Z)(function*(){try{const i=(yield navigator.mediaDevices.enumerateDevices()).filter(l=>"videoinput"===l.kind);let o;for(const l of i){const c=l.label.toLowerCase().includes("front");if(t.isUsingFrontCamera&&c||!t.isUsingFrontCamera&&!c){o=l.deviceId;break}}!o&&i.length>0&&(o=i[0].deviceId);const s=o?{video:{deviceId:{exact:o}}}:{video:!0};t.stream=yield navigator.mediaDevices.getUserMedia(s),t.isLabeling=!0,t.isUsingCamera=!0,t.videoElement=document.getElementById("cameraView"),t.videoElement&&(t.videoElement.srcObject=t.stream,t.videoElement.onloadeddata=()=>{t.videoElement.play().then(()=>{t.startSnapshotCountdown(),t.toastr.success(t.translate.instant("AI_DETECTION.MESSAGES.LABELING_STARTED"))})})}catch{t.toastr.error(t.translate.instant("AI_DETECTION.ERRORS.CAMERA_DENIED"))}})()}stopCameraLabeling(){this.isLabeling=!1,this.snapshotInterval&&(clearInterval(this.snapshotInterval),this.snapshotInterval=null),this.videoElement&&(this.videoElement.pause(),this.videoElement.srcObject=null),this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null,this.toastr.info(this.translate.instant("AI_DETECTION.MESSAGES.LABELING_STOPPED")))}startAILabeling(){this.isLabeling?this.stopCameraLabeling():this.startCameraLabeling()}captureAndUploadSnapshot(){if(!this.videoElement)return;const t=document.createElement("canvas");t.width=this.videoElement.videoWidth,t.height=this.videoElement.videoHeight;const n=t.getContext("2d");!n||(n.drawImage(this.videoElement,0,0,t.width,t.height),t.toBlob(i=>{if(i){const o=Date.now().toString(),s=URL.createObjectURL(i),l=this.sanitizer.bypassSecurityTrustUrl(s),c=(0,P.Z)();this.drawerService.aiProductDetectionResults.push({qty:null,imageKey:null,imageUrl:l,imageRefId:c,potentialBuyerCount:null});const p=new FormData;p.append("image",i,"snapshot.jpg"),p.append("imageRefId",c),this.api.post("ai-product-detection/detect",p,!1,!1).then(u=>{this.drawerService.updateSnapshot(o,{...u,loading:!1}),URL.revokeObjectURL(URL.createObjectURL(i)),i=null}).catch(u=>{this.drawerService.updateSnapshot(o,{loading:!1})})}},"image/jpeg"))}startSnapshotCountdown(){this.timerSeconds=5,this.snapshotCountdownInterval&&clearInterval(this.snapshotCountdownInterval),this.snapshotCountdownInterval=setInterval(()=>{this.timerSeconds>
10?this.timerSeconds--:(this.captureAndUploadSnapshot(),this.timerSeconds=5)},1e3)}stopSnapshotCountdown(){this.snapshotCountdownInterval&&(clearInterval(this.snapshotCountdownInterval),this.snapshotCountdownInterval=null)}stopScreenShare(){this.screenStream&&(this.screenStream.getTracks().forEach(n=>n.stop()),this.screenStream=null);const t=document.getElementById("cameraView");t&&(t.pause(),t.srcObject=null),this.isScreenSharing=!1,this.stopSnapshotCountdown()}startScreenShare(){this.isScreenSharing?this.stopScreenShare():navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1}).then(t=>{this.isScreenSharing=!0,this.isUsingCamera=!1,this.screenStream=t;const n=document.getElementById("cameraView");n&&(n.srcObject=t,this.videoElement=n,n.play(),this.captureAndUploadSnapshot(),this.startSnapshotCountdown()),t.getVideoTracks()[0].addEventListener("ended",()=>{this.isScreenSharing=!1,this.stopSnapshotCountdown()}),this.toastr.success(this.translate.instant("AI_DETECTION.MESSAGES.SCREEN_SHARE_STARTED"))}).catch(t=>{console.error("Screen sharing error:",t),this.toastr.info(this.translate.instant("AI_DETECTION.ERRORS.SCREEN_SHARE_FAILED"))})}checkIfMobile(){const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(t.toLowerCase())}}return r.\u0275fac=function(t){return new(t||r)(e.\u0275\u0275directiveInject(f.t),e.\u0275\u0275directiveInject(x._W),e.\u0275\u0275directiveInject(E.l),e.\u0275\u0275directiveInject(b.d),e.\u0275\u0275directiveInject(k.DomSanitizer),e.\u0275\u0275directiveInject(v.sK),e.\u0275\u0275directiveInject(e.ChangeDetectorRef))},r.\u0275cmp=e.\u0275\u0275defineComponent({type:r,selectors:[["app-ai-product-detection"]],decls:34,vars:26,consts:[[1,"main-content"],[1,"content-wrapper"],[1,"content"],[1,"row"],[1,"col-md"],[1,"card","p-2","mt-2"],[1,"title-container"],[2,"display","inline-block"],[2,"cursor","pointer","margin-left","8px","margin-top","10px","color","#2196f3","font-size","1.5rem",3,"title","click"],[1,""],[1,"card","fixed-camera-card"],[1,"tab-content","h-100"],[1,"position-relative","h-100","overflow-hidden"],[1,"card-header","text-white","fw-bold",2,"background-color","goldenrod"],[1,"card-body","p-0","position-relative","flex-grow-1","d-flex","flex-column","overflow-hidden"],["class","btn btn-light rounded-circle shadow-sm","style","position: absolute; right: 10px; top: 60px; width: 40px; height: 40px; z-index: 10",3,"title","click",4,"ngIf"],["class","bg-light rounded-circle fw-bold d-flex align-items-center justify-content-center","style","\n position: absolute;\n right: 10px;\n top: 10px;\n width: 40px;\n height: 40px;\n font-size: 1.2rem;\n z-index: 10;\n opacity: 0.8;\n ",4,"ngIf"],[1,"video-wrapper","flex-grow-1"],["id","cameraView","auto
1play","","muted","","playsinline","",1,"w-100","h-100"],["class","d-flex flex-wrap align-items-center gap-2",4,"ngIf"],[1,"mt-4","text-center"],[3,"innerHTML"],[1,"scanner-section"],["src","/assets/imgs/ai-detection-qrcode.png",3,"alt"],[1,"drawer"],[1,"btn","btn-light","rounded-circle","shadow-sm",2,"position","absolute","right","10px","top","60px","width","40px","height","40px","z-index","10",3,"title","click"],[1,"fas","fa-camera"],[1,"bg-light","rounded-circle","fw-bold","d-flex","align-items-center","justify-content-center",2,"position","absolute","right","10px","top","10px","width","40px","height","40px","font-size","1.2rem","z-index","10","opacity","0.8"],[1,"d-flex","flex-wrap","align-items-center","gap-2"],["class","custom-btn-group",4,"ngIf"],[1,"btn","m-2",3,"ngClass","click"],["class","btn m-2",3,"ngClass","click",4,"ngIf"],[1,"custom-btn-group"],["type","button",1,"chevron-btn",3,"title","click"],[1,"fas","fa-chevron-down"],[1,"dropdown-menu","animated-dropdown"],[1,"dropdown-scroll"],[4,"ngFor","ngForOf"],["type","button",1,"video-btn",3,"title"],[1,"fas","fa-video-slash"],["href","#",1,"dropdown-item",3,"click"],["class","fas fa-check",4,"ngIf"],[1,"fas","fa-check"]],template:function(t,n){1&t&&(e.\u0275\u0275elementStart(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"div",5)(6,"div",6)(7,"h2",7),e.\u0275\u0275text(8),e.\u0275\u0275pipe(9,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(10,"span",8),e.\u0275\u0275listener("click",function(){return n.showWelcomeAlert()}),e.\u0275\u0275pipe(11,"translate"),e.\u0275\u0275text(12," ? "),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(13,"div",9)(14,"div",10)(15,"div",11)(16,"div",12)(17,"div",13),e.\u0275\u0275text(18),e.\u0275\u0275pipe(19,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(20,"div",14),e.\u0275\u0275template(21,W,3,3,"button",15),e.\u0275\u0275template(22,z,2,1,"div",16),e.\u0275\u0275elementStart(23,"div",17),e.\u0275\u0275element(24,"video",18),e.\u0275\u0275elementEnd()()()()(),e.\u0275\u0275template(25,q,7,8,"div",19),e.\u0275\u0275elementStart(26,"div",20),e.\u0275\u0275element(27,"p",21),e.\u0275\u0275pipe(28,"translate"),e.\u0275\u0275elementStart(29,"div",22),e.\u0275\u0275element(30,"img",23),e.\u0275\u0275pipe(31,"translate"),e.\u0275\u0275elementEnd()()()()()()()()(),e.\u0275\u0275elementStart(32,"div",24),e.\u0275\u0275element(33,"app-product-detection-drawer"),e.\u0275\u0275elementEnd()),2&t&&(e.\u0275\u0275classProp("shifted",n.isDrawerOpen),e.\u0275\u0275advance(8),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(9,16,"AI_DETECTION.HEADER.TITLE")," "),e.\u0275\u0275advance(2),e.\u0275\u0275property("title",e.\u0275\u0275pipeBind1(11,18,"AI_DETECTION.HEADER.HELP_TOOLTIP")),e.\u0275\u0275advance(8),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(19,20,"AI_DETECTION.CAMERA.LIVE_VIEW")," "),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngIf",n.isLabeling&&n.hasMultipleCameras),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",n.isLabeling||n.isScreenSharing),e.\u0275\u0275advance(2),e.\u0275\u0275styleProp("object-fit","cover")("transform",n.isUsingCamera?"scaleX(-1)":"none"),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",(null==n.adminService?null:n.adminService.isAdmin)||(null==n.adminService?null:n.adminService.isBroker)),e.\u0275\u0275advance(2),e.\u0275\u0275property("innerHTML",e.\u0275\u0275pipeBind1(28,22,"AI_DETECTION.QR_SECTION.MESSAGE"),e.\u0275\u0275sanitizeHtml),e.\u0275\u0275advance(3),e.\u0275\u0275propertyInterpolate("alt",e.\u0275\u0275pipeBind1(31,24,"AI_DETECTION.HEADER.TITLE")),e.\u0275\u0275advance(2),e.\u0275\u0275classProp("open",n.isDrawerOpen))}
1,dependencies:[g.NgClass,g.NgForOf,g.NgIf,j,v.X$],styles:[".main-content[_ngcontent-%COMP%]{transition:margin-right .9s ease-in-out}.main-content.shifted[_ngcontent-%COMP%]{margin-right:350px}@media (max-width: 640px){.main-content.shifted[_ngcontent-%COMP%]{margin-right:0}}.title-container[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:24px;padding:5px 2px}@media (max-width: 768px){.title-container[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:18px}}.fixed-camera-card[_ngcontent-%COMP%]{overflow:hidden}@media (max-width: 1280px){.fixed-camera-card[_ngcontent-%COMP%]{height:auto}.video-wrapper[_ngcontent-%COMP%]{flex-grow:0;height:auto}.video-wrapper[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{height:auto;max-height:300px;object-fit:cover}}.video-wrapper[_ngcontent-%COMP%]{flex-grow:1;min-height:300px;overflow:hidden;border-bottom-left-radius:.375rem;border-bottom-right-radius:.375rem}.video-wrapper[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.custom-btn-group[_ngcontent-%COMP%]{position:relative;display:inline-flex;background-color:#daa520;border-radius:10px;overflow:visible;height:44px}.chevron-btn[_ngcontent-%COMP%], .video-btn[_ngcontent-%COMP%]{border:none;padding:0 16px;background-color:transparent;color:#fff;cursor:pointer;height:100%}.video-btn[_ngcontent-%COMP%]{background-color:#ffffff59}.chevron-btn[_ngcontent-%COMP%]:hover, .video-btn[_ngcontent-%COMP%]:hover{background-color:#ffffff26}.custom-btn-group[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%]{top:auto!important;bottom:calc(100% + 6px)!important;left:0!important;right:auto!important}.dropdown-menu.animated-dropdown[_ngcontent-%COMP%]{margin:0;padding:0;min-width:280px;border-radius:10px;background-color:#190930;color:#fff;opacity:0;transform:translateY(40px);pointer-events:none;box-shadow:0 4px 12px #0000004d;z-index:999;display:flex;flex-direction:column}.dropdown-menu.animated-dropdown.show[_ngcontent-%COMP%]{opacity:1;transform:translateY(0);pointer-events:auto;animation:slideUpBounce .9s ease forwards}@keyframes slideUpBounce{0%{opacity:0;transform:translateY(40px)}60%{opacity:1;transform:translateY(-6px)}80%{transform:translateY(3px)}to{transform:translateY(0)}}.dropdown-menu.animated-dropdown[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{list-style:none}.defult-set[_ngcontent-%COMP%]{flex:0 0 auto;padding:12px 16px;border-bottom:1px solid rgba(255,255,255,.055);display:flex;justify-content:space-between;align-items:center}.dropdown-scroll[_ngcontent-%COMP%]{flex:1 1 auto;max-height:200px;overflow-y:auto;-webkit-overflow-scrolling:touch}.dropdown-item[_ngcontent-%COMP%]{color:#daa520;padding:8px 16px;cursor:pointer;display:block}.dropdown-item[_ngcontent-%COMP%]:hover{background-color:#ffffff1a}.chevron-btn[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{transition:transform .3s ease}.chevron-btn[_ngcontent-%COMP%] i.rotate[_ngcontent-%COMP%]{transform:rotate(180deg)}.scanner-section[_ngcontent-%COMP%]{width:250px;margin:auto}.scanner-section[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%}"]}),r})();var J=m(77579),X=m(78372),M=m(4854),ee=m(35226),te=m.n(ee),ne=m(5811),ie=m(81305),T=m(68567),S=m(41037);const re=["dropdownContainer"];function oe(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"li",25),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.selectOption(o))}),e.\u0275\u0275text(1),e.\u0275\u0275elementEnd()}if(2&r){const t=a.$implicit,n=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",n.getOptionText(t)," ")}}function ae(r,a){if(1&r&&e.\u0275\u0275text(0),2&r){const t=a.item;e.\u0275\u0275textInterpolate2(" ",null==t?null:t.firstName," ",null==t?null:t.lastName," ")}}function se(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",26)(1,"ng-select",27),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext();
1return e.\u0275\u0275resetView(o.selectedCustomer=i)})("search",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(o.onCustomerSearch(i))}),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275template(3,ae,1,2,"ng-template",28),e.\u0275\u0275elementEnd()()}if(2&r){const t=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275property("items",t.customers)("ngModel",t.selectedCustomer)("searchFn",t.customCustomerSearchFn)("placeholder",e.\u0275\u0275pipeBind1(2,4,"AI_DETECTION_IMAGES.PLACEHOLDER_SEARCH_CUSTOMER"))}}function le(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"a",56),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext(2).$implicit;return e.\u0275\u0275resetView(i.showFullModelName=!i.showFullModelName)}),e.\u0275\u0275text(1),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275elementEnd()}if(2&r){const t=e.\u0275\u0275nextContext(2).$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.showFullModelName?e.\u0275\u0275pipeBind1(2,1,"AI_DETECTION_IMAGES.READ_LESS"):e.\u0275\u0275pipeBind1(3,3,"AI_DETECTION_IMAGES.READ_MORE")," ")}}const A=function(r){return{"text-clamp":r}};function ce(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div")(1,"span",54),e.\u0275\u0275text(2),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(3,le,4,5,"a",39),e.\u0275\u0275elementStart(4,"button",55),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.editingModelName=!0)}),e.\u0275\u0275text(5),e.\u0275\u0275pipe(6,"translate"),e.\u0275\u0275elementEnd()()}if(2&r){const t=e.\u0275\u0275nextContext(),n=t.index,i=t.$implicit,o=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275propertyInterpolate1("id","modelName-",n,""),e.\u0275\u0275property("ngClass",e.\u0275\u0275pureFunction1(7,A,!i.showFullModelName)),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(i.modelName),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",o.hasLongModelName[n]),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(6,5,"AI_DETECTION_IMAGES.EDIT")," ")}}function de(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",57)(1,"input",58),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(o.modelName=i)}),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(3,"div",57)(4,"button",59),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit,o=e.\u0275\u0275nextContext();return i.editingModelName=!1,e.\u0275\u0275resetView(o.saveDetectionDetails(i))}),e.\u0275\u0275text(5),e.\u0275\u0275pipe(6,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(7,"button",60),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.editingModelName=!1)}),e.\u0275\u0275text(8),e.\u0275\u0275pipe(9,"translate"),e.\u0275\u0275elementEnd()()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275property("placeholder",e.\u0275\u0275pipeBind1(2,4,"AI_DETECTION_IMAGES.ENTER_MODEL_NAME_PLACEHOLDER"))("ngModel",t.modelName),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(6,6,"AI_DETECTION_IMAGES.SAVE")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(9,8,"AI_DETECTION_IMAGES.CANCEL")," ")}}function pe(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"a",56),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;
1return e.\u0275\u0275resetView(i.showFullModelName=!i.showFullModelName)}),e.\u0275\u0275text(1),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275elementEnd()}if(2&r){const t=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.showFullModelName?e.\u0275\u0275pipeBind1(2,1,"AI_DETECTION_IMAGES.READ_LESS"):e.\u0275\u0275pipeBind1(3,3,"AI_DETECTION_IMAGES.READ_MORE")," ")}}function me(r,a){if(1&r&&e.\u0275\u0275text(0),2&r){const t=a.item;e.\u0275\u0275textInterpolate2(" ",t.firstName," ",t.lastName," ")}}function _e(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",61)(1,"label",62),e.\u0275\u0275text(2),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(4,"ng-select",63),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(o.selectedCustomer=i)})("search",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(o.onCustomerSearch(i))})("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext().$implicit,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.onCustomerSelect(o,i))}),e.\u0275\u0275pipe(5,"translate"),e.\u0275\u0275template(6,me,1,2,"ng-template",28),e.\u0275\u0275elementEnd()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit,n=e.\u0275\u0275nextContext();e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1("",e.\u0275\u0275pipeBind1(3,6,"AI_DETECTION_IMAGES.CUSTOMER_LABEL")," "),e.\u0275\u0275advance(2),e.\u0275\u0275property("items",n.customers)("ngModel",t.selectedCustomer)("compareWith",n.compareCustomers)("searchFn",n.customCustomerSearchFn)("placeholder",e.\u0275\u0275pipeBind1(5,8,"AI_DETECTION_IMAGES.SELECT_AN_OPTION"))}}function ue(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"span"),e.\u0275\u0275text(1),e.\u0275\u0275elementEnd()),2&r){const t=e.\u0275\u0275nextContext(2).$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate2(" ",t.selectedCustomer.firstName," ",t.selectedCustomer.lastName," ")}}function ge(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"li")(1,"strong"),e.\u0275\u0275text(2),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(4,ue,2,2,"span",37),e.\u0275\u0275elementEnd()),2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(3,2,"AI_DETECTION_IMAGES.SELECTED_CUSTOMER")),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",t.selectedCustomer)}}function he(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div")(1,"span",64),e.\u0275\u0275text(2),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(4,"div",65)(5,"a",66),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.showFullSpecs=!i.showFullSpecs)}),e.\u0275\u0275text(6),e.\u0275\u0275pipe(7,"translate"),e.\u0275\u0275pipe(8,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(9,"button",67),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.editingSpecs=!0)}),e.\u0275\u0275text(10),e.\u0275\u0275pipe(11,"translate"),e.\u0275\u0275elementEnd()()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275property("ngClass",e.\u0275\u0275pureFunction1(12,A,!t.showFullSpecs)),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.specs||e.\u0275\u0275pipeBind1(3,4,"AI_DETECTION_IMAGES.NO_SPECS_ADDED")," "),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",t.showFullSpecs?e.\u0275\u0275pipeBind1(7,6,"AI_DETECTION_IMAGES.READ_LESS"):e.\u0275\u0275pipeBind1(8,8,"AI_DETECTION_IMAGES.READ_MORE")," "),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(11,10,"AI_DETECTION_IMAGES.EDIT")," ")}}function ve(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div")(1,"textarea",42),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext().$implicit;
1return e.\u0275\u0275resetView(o.specs=i)}),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(3,"div",57)(4,"button",68),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit,o=e.\u0275\u0275nextContext();return i.editingSpecs=!1,e.\u0275\u0275resetView(o.saveDetectionDetails(i))}),e.\u0275\u0275text(5),e.\u0275\u0275pipe(6,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(7,"button",69),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.editingSpecs=!1)}),e.\u0275\u0275text(8),e.\u0275\u0275pipe(9,"translate"),e.\u0275\u0275elementEnd()()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275property("placeholder",e.\u0275\u0275pipeBind1(2,4,"AI_DETECTION_IMAGES.ENTER_SPECS_PLACEHOLDER"))("ngModel",t.specs),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(6,6,"AI_DETECTION_IMAGES.SAVE")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(9,8,"AI_DETECTION_IMAGES.CANCEL")," ")}}function Ce(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div")(1,"span",64),e.\u0275\u0275text(2),e.\u0275\u0275pipe(3,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(4,"div",65)(5,"a",66),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.showFullDescription=!i.showFullDescription)}),e.\u0275\u0275text(6),e.\u0275\u0275pipe(7,"translate"),e.\u0275\u0275pipe(8,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(9,"button",67),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.editingDescription=!0)}),e.\u0275\u0275text(10),e.\u0275\u0275pipe(11,"translate"),e.\u0275\u0275elementEnd()()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275property("ngClass",e.\u0275\u0275pureFunction1(12,A,!t.showFullDescription)),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.description||e.\u0275\u0275pipeBind1(3,4,"AI_DETECTION_IMAGES.NO_DESCRIPTION_ADDED")," "),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",t.showFullDescription?e.\u0275\u0275pipeBind1(7,6,"AI_DETECTION_IMAGES.READ_LESS"):e.\u0275\u0275pipeBind1(8,8,"AI_DETECTION_IMAGES.READ_MORE")," "),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(11,10,"AI_DETECTION_IMAGES.EDIT")," ")}}function fe(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div")(1,"textarea",42),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(o.description=i)}),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(3,"div",57)(4,"button",68),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit,o=e.\u0275\u0275nextContext();return i.editingDescription=!1,e.\u0275\u0275resetView(o.saveDetectionDetails(i))}),e.\u0275\u0275text(5),e.\u0275\u0275pipe(6,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(7,"button",69),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.editingDescription=!1)}),e.\u0275\u0275text(8),e.\u0275\u0275pipe(9,"translate"),e.\u0275\u0275elementEnd()()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275property("placeholder",e.\u0275\u0275pipeBind1(2,4,"AI_DETECTION_IMAGES.ENTER_DESCRIPTION_PLACEHOLDER"))("ngModel",t.description),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(6,6,"AI_DETECTION_IMAGES.SAVE")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(9,8,"AI_DETECTION_IMAGES.CANCEL")," ")}}function xe(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"span"),e.\u0275\u0275text(1),e.\u0275\u0275elementStart(2,"button",67),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;
1return e.\u0275\u0275resetView(i.editingQty=!0)}),e.\u0275\u0275text(3),e.\u0275\u0275pipe(4,"translate"),e.\u0275\u0275elementEnd()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.qty," "),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(4,2,"AI_DETECTION_IMAGES.EDIT")," ")}}function Ee(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",57)(1,"input",70),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(o.qty=i)})("wheel",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext(2);return e.\u0275\u0275resetView(o.disableScroll(i))}),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(3,"div",57)(4,"button",71),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit,o=e.\u0275\u0275nextContext();return i.editingQty=!1,e.\u0275\u0275resetView(o.saveDetectionDetails(i))}),e.\u0275\u0275text(5),e.\u0275\u0275pipe(6,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(7,"button",69),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit;return e.\u0275\u0275resetView(i.editingQty=!1)}),e.\u0275\u0275text(8),e.\u0275\u0275pipe(9,"translate"),e.\u0275\u0275elementEnd()()()}if(2&r){const t=e.\u0275\u0275nextContext().$implicit,n=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275property("placeholder",e.\u0275\u0275pipeBind1(2,5,"AI_DETECTION_IMAGES.ENTER_QUANTITY_PLACEHOLDER"))("ngModel",t.qty),e.\u0275\u0275advance(3),e.\u0275\u0275property("disabled",!n.isValidQuantity(t.qty)),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(6,7,"AI_DETECTION_IMAGES.SAVE")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(9,9,"AI_DETECTION_IMAGES.CANCEL")," ")}}function Ie(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"button",72),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext().$implicit,o=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(o.createEbayListing(i))}),e.\u0275\u0275text(1),e.\u0275\u0275pipe(2,"translate"),e.\u0275\u0275elementEnd()}2&r&&(e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(2,1,"AI_DETECTION_IMAGES.CREATE_EBAY_LISTING")," "))}function be(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",29)(1,"div",30)(2,"div",31)(3,"img",32),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.openBannerImage(o.url))}),e.\u0275\u0275pipe(4,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(5,"button",33),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).index,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.confirmDelete(o))}),e.\u0275\u0275pipe(6,"translate"),e.\u0275\u0275element(7,"i",34),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(8,"div",35)(9,"h5",36),e.\u0275\u0275template(10,ce,7,9,"div",37),e.\u0275\u0275template(11,de,10,10,"div",38),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(12,pe,4,5,"a",39),e.\u0275\u0275elementStart(13,"ul",40)(14,"li",41)(15,"strong"),e.\u0275\u0275text(16),e.\u0275\u0275pipe(17,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(18,"textarea",42),e.\u0275\u0275listener("ngModelChange",function(i){const s=e.\u0275\u0275restoreView(t).$implicit;return e.\u0275\u0275resetView(s.notes=i)}),e.\u0275\u0275pipe(19,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(20,"strong"),e.\u0275\u0275text(21),e.\u0275\u0275pipe(22,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(23,"select",43),e.\u0275\u0275listener("ngModelChange",function(i){const s=e.\u0275\u0275restoreView(t).$implicit;
1return e.\u0275\u0275resetView(s.action=i)}),e.\u0275\u0275elementStart(24,"option",44),e.\u0275\u0275text(25),e.\u0275\u0275pipe(26,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(27,"option",45),e.\u0275\u0275text(28),e.\u0275\u0275pipe(29,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(30,"option",46),e.\u0275\u0275text(31),e.\u0275\u0275pipe(32,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275template(33,_e,7,10,"div",47),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(34,"button",48),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.saveDetectionDetails(o))}),e.\u0275\u0275text(35),e.\u0275\u0275pipe(36,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(37,"li")(38,"strong"),e.\u0275\u0275text(39),e.\u0275\u0275pipe(40,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(41),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(42,"li")(43,"strong"),e.\u0275\u0275text(44),e.\u0275\u0275pipe(45,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(46),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(47,"li")(48,"strong"),e.\u0275\u0275text(49),e.\u0275\u0275pipe(50,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(51),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(52,"li")(53,"strong"),e.\u0275\u0275text(54),e.\u0275\u0275pipe(55,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(56),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(57,"li")(58,"strong"),e.\u0275\u0275text(59),e.\u0275\u0275pipe(60,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(61,"a",49),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.goToProfile(o.profileUrl))}),e.\u0275\u0275text(62),e.\u0275\u0275elementEnd()(),e.\u0275\u0275template(63,ge,5,4,"li",37),e.\u0275\u0275elementStart(64,"li")(65,"strong"),e.\u0275\u0275text(66),e.\u0275\u0275pipe(67,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(68),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(69,"li",41)(70,"strong"),e.\u0275\u0275text(71),e.\u0275\u0275pipe(72,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(73,he,12,14,"div",37),e.\u0275\u0275template(74,ve,10,10,"div",37),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(75,"li",41)(76,"strong"),e.\u0275\u0275text(77),e.\u0275\u0275pipe(78,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(79,Ce,12,14,"div",37),e.\u0275\u0275template(80,fe,10,10,"div",37),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(81,"li")(82,"strong"),e.\u0275\u0275text(83),e.\u0275\u0275pipe(84,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(85,xe,5,4,"span",37),e.\u0275\u0275template(86,Ee,10,11,"div",38),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(87,"li")(88,"strong"),e.\u0275\u0275text(89),e.\u0275\u0275pipe(90,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(91),e.\u0275\u0275pipe(92,"date"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(93,"div",50)(94,"button",51),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.connectWithBuyers(o))}),e.\u0275\u0275text(95),e.\u0275\u0275pipe(96,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(97,"button",52),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.createWTSFromAIProduct(o))}),e.\u0275\u0275text(98),e.\u0275\u0275pipe(99,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(100,Ie,3,3,"button",53),e.\u0275\u0275elementEnd()()()()}if(2&r){const t=a.$implicit,n=a.index,i=e.\u0275\u0275nextContext();e.\u0275\u0275advance(3),e.\u0275\u0275propertyInterpolate("alt",e.\u0275\u0275pipeBind1(4,46,"AI_DETECTION_IMAGES.ALT_PICTURE")),e.\u0275\u0275property("src",t.url,e.\u0275\u0275sanitizeUrl),e.\u0275\u0275advance(2),e.\u0275\u0275property("title",e.\u0275\u0275pipeBind1(6,48,"AI_DETECTION_IMAGES.DELETE_IMAGE_TITLE")),e.\u0275\u0275advance(5),e.\u0275\u0275property("ngIf",!t.editingModelName),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",t.editingModelName),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",i.hasLongModelName[n]),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(17,50,"AI_DETECTION_IMAGES.NOTES")),e.\u0275\u0275advance(2),e.\u0275\u0275property("placeholder",e.\u0275\u0275pipeBind1(19,52,"AI_DETECTION_IMAGES.ENTER_NOTES_PLACEHOLDER"))("ngModel",t.notes),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(22,54,"AI_DETECTION_IMAGES.ACTION")),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngModel",t.action),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(26,56,"AI_DETECTION_IMAGES.SELECT_AN_OPTION")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(29,58,"AI_DETECTION_IMAGES.OPTION_REUSE")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(32,60,"AI_DETECTION_IMAGES.OPTION_RECYCLE")," "),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",i.adminService.isAdmin),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(36,62,"AI_DETECTION_IMAGES.SAVE")," "),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(40,64,"AI_DETECTION_IMAGES.PICTURE_ID")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.pictureId," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(45,66,"AI_DETECTION_IMAGES.POTENTIAL_BUYERS")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.potentialBuyerCount," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(50,68,"AI_DETECTION_IMAGES.EBAY_AVG_SALE_PRICE")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.eBayAvgSalePrice," USD "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(55,70,"AI_DETECTION_IMAGES.MSP_AUCTION_PRICE")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.mspAvgSalePrice," USD "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(60,72,"AI_DETECTION_IMAGES.USER_LABEL")),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate4(" ",t.userName," | ",t.email," | ",t.company," | ",t.country," "),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",i.adminService.isAdmin),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(67,74,"AI_DETECTION_IMAGES.MANUFACTURER")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",t.manufacturer," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(72,76,"AI_DETECTION_IMAGES.SPECS")),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",!t.editingSpecs),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",t.editingSpecs),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(78,78,"AI_DETECTION_IMAGES.DESCRIPTION_LABEL")),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",!t.editingDescription),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",t.editingDescription),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(84,80,"AI_DETECTION_IMAGES.ESTIMATED_QTY")),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",!t.editingQty),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",t.editingQty),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(90,82,"AI_DETECTION_IMAGES.TIME")),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind2(92,84,t.timestamp,"short")," "),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(96,87,"AI_DETECTION_IMAGES.CONNECT_WITH_BUYERS")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(99,89,"AI_DETECTION_IMAGES.CREATE_WTS_REQUEST")," "),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",i.adminService.isAdmin)}}function Te(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",73)(1,"div",74)(2,"div",75)(3,"div",76)(4,"div",77)(5,"h5",78),e.\u0275\u0275text(6),e.\u0275\u0275pipe(7,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(8,"div",79)(9,"p"),e.\u0275\u0275text(10),e.\u0275\u0275pipe(11,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(12,"div",80)(13,"button",81),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext();
1return e.\u0275\u0275resetView(i.closeModal())}),e.\u0275\u0275text(14),e.\u0275\u0275pipe(15,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(16,"button",82),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(i.deleteConfirmed())}),e.\u0275\u0275text(17),e.\u0275\u0275pipe(18,"translate"),e.\u0275\u0275elementEnd()()()()()()}2&r&&(e.\u0275\u0275advance(6),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(7,4,"AI_DETECTION_IMAGES.CONFIRM_DELETE_TITLE")," "),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(11,6,"AI_DETECTION_IMAGES.CONFIRM_DELETE_BODY")),e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(15,8,"AI_DETECTION_IMAGES.CANCEL")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(18,10,"AI_DETECTION_IMAGES.DELETE")," "))}const Se=function(r,a,t){return{itemsPerPage:r,currentPage:a,totalItems:t}};let Ae=(()=>{class r{constructor(t,n,i,o,s,l,c){this.api=t,this.router=n,this.toastr=i,this._lightbox=o,this.drawerService=s,this.adminService=l,this.translate=c,this.images=[],this.filteredImages=[],this.itemsPerPage=10,this.currentPage=1,this.totalItems=0,this.searchText="",this.imageToDelete=null,this.showConfirmModal=!1,this.searchSubject=new J.x,this.showFullModelName=!1,this.hasLongModelName=[],this.searchId=null,this.customers=[],this.selectedCustomer=null,this.isAdmin=!1,this.isOpen=!1,this.selectedOption=null,this.options=[],this.showFullSpecs=!1,this.showFullDescription=!1}ngOnInit(){this.isAdmin=this.adminService.userType===M.FW.admin,this.options=[{code:"all",titleKey:"AI_DETECTION_IMAGES.ALL_OPTION"},...M.gT.lotTypes.map(t=>({code:t.code,titleKey:t.titleKey}))],this.selectedOption=this.options[0],this.loadDetections(this.currentPage),this.searchSubject.pipe((0,X.b)(500)).subscribe(t=>{this.currentPage=1,this.loadDetections(this.currentPage,"all"===this.selectedOption?.code?null:this.selectedOption?.code,t)})}onDocumentClick(t){this.isOpen&&this.dropdownContainer&&(this.dropdownContainer.nativeElement.contains(t.target)||(this.isOpen=!1))}toggleDropdown(){this.isOpen=!this.isOpen}selectOption(t){this.selectedOption=t,this.isOpen=!1,this.currentPage=1}getSelectedOptionText(){return this.translate.instant(this.selectedOption?this.selectedOption.titleKey:"AI_DETECTION_IMAGES.SELECT_OPTION")}getOptionText(t){return this.translate.instant(t.titleKey)}applySearch(){this.currentPage=1,this.filteredImages=[],this.images=[];const t="all"===this.selectedOption?.code?null:this.selectedOption?.code,n=this.searchText?this.searchText.trim():"",i=null!=this.searchId?this.searchId.toString():"",o=this.resolveSelectedCustomerId(this.selectedCustomer);this.loadDetections(this.currentPage,t,n,i,o)}openBannerImage(t){this._lightbox.open([{src:t}],0,{wrapAround:!0,showImageNumberLabel:!0,disableScrolling:!0,showZoom:!0,showRotate:!1})}loadDetections(t,n=null,i="",o="",s=null){let c=`ai-product-detection/results?page=${t}&limit=${this.itemsPerPage}&filter=${n&&"All"!==n?n:""}&search=${i}`;o&&(c+=`&pictureId=${o}`),null!=s&&(c+=`&customerUid=${encodeURIComponent(s)}`),this.api.get(c).then(p=>{this.totalItems=p.total||0,this.images=(p.data||[]).map(d=>({url:d.imageUrl,modelName:d.model,pictureId:d.id,specs:d.specs,timestamp:new Date(d.timestamp),userName:d.user?`${d.user.firstName} ${d.user.lastName}`:"N/A",email:d.user?.email||"N/A",company:d.user?.company||"N/A",country:d.user?.country||"N/A",profileUrl:`/users/${d.uid}`,qty:d.qty,description:d.description,manufacturer:d.manufacturer,imageKey:d.imageKey,potentialBuyerCount:d.potentialBuyerCount??d.buyerCount,potentialBuyers:d.potentialBuyers||[],eBayAvgSalePrice:d.eBayAvgSalePrice,mspAvgSalePrice:d.mspAvgSalePrice,notes:d.notes||"",action:d.action||"",selectedCustomer:d.selectedCustomer||null})),this.filteredImages=[...this.images]}).catch(p=>console.error("Failed to load AI detections:",p))}goToProfile(t){this.router.navigateByUrl(t)}pageChange(t){this.currentPage=t;const n="all"===this.selectedOption?.code?null:this.selectedOption?.code,i=null!=this.searchId?this.searchId.toString():"",o=this.resolveSelectedCustomerId(this.selectedCustomer);this.loadDetections(t,n,this.searchText,i,o)}confirmDelete(t){this.imageToDelete=t,this.showConfirmModal=!0}deleteConfirmed(){if(null===this.imageToDelete)return;const t=this.filteredImages[this.imageToDelete];!t||this.api.delete(`ai-product-detection/${t.pictureId}`).then(()=>{this.filteredImages.splice(this.imageToDelete,1),this.closeModal(),this.toastr.success(this.translate.instant("AI_DETECTION_IMAGES.IMAGE_DELETED_SUCCESS"))}).catch(n=>{console.error("Failed to delete image:",n),this.toastr.error(this.translate.instant("AI_DETECTION_IMAGES.IMAGE_DELETE_FAILED"))})}closeModal(){this.showConfirmModal=!1,this.imageToDelete=null}deleteAllOnPage(){const t=this.filteredImages.map(n=>n.pictureId);0!==t.length?this.api.post("ai-product-detection/bulk-delete",{ids:t}).then(()=>{this.toastr.success(this.translate.instant("AI_DETECTION_IMAGES.DELETED_ALL_IMAGES_SUCCESS")),this.filteredImages=[],this.totalItems-=t.length}
1).catch(n=>{console.error("Bulk delete failed:",n),this.toastr.error(this.translate.instant("AI_DETECTION_IMAGES.FAILED_TO_DELETE_IMAGES"))}):this.toastr.info(this.translate.instant("AI_DETECTION_IMAGES.NO_IMAGES_ON_PAGE"))}toggleModelName(){this.showFullModelName=!this.showFullModelName}ngAfterViewInit(){setTimeout(()=>{this.filteredImages.forEach((t,n)=>{const i=document.getElementById(`modelName-${n}`);i&&(this.hasLongModelName[n]=i.scrollHeight>i.clientHeight)})})}saveDetectionDetails(t){if(!t.pictureId)return void this.toastr.error(this.translate.instant("AI_DETECTION_IMAGES.IMAGE_ID_MISSING"));const n=Number(t.qty);if(!this.isValidQuantity(n))return void this.toastr.error(this.translate.instant("AI_DETECTION_IMAGES.SWAL_POSITIVE_NUMBER"));const i={id:t.pictureId,notes:t.notes,action:t.action,customerUid:t.selectedCustomer?.id||t.selectedCustomer,modelName:t.modelName,specs:t.specs,description:t.description,qty:n};t.customer&&t.customer.id&&(i.customerUid=t.customer.id),this.api.post("ai-product-detection/update-detection-details",i).then(o=>{o.success?this.toastr.success(this.translate.instant("AI_DETECTION_IMAGES.DETECTION_UPDATED_SUCCESS")):this.toastr.error(this.translate.instant("AI_DETECTION_IMAGES.DETECTION_UPDATE_FAILED"))}).catch(o=>{console.error(o),this.toastr.error(this.translate.instant("AI_DETECTION_IMAGES.DETECTION_UPDATE_SERVER_ERROR"))})}isValidQuantity(t){const n=Number(t);return Number.isInteger(n)&&n>0}toggleSpecs(){this.showFullSpecs=!this.showFullSpecs}toggleDescription(){this.showFullDescription=!this.showFullDescription}disableScroll(t){t.target.blur(),t.preventDefault()}createWTSFromAIProduct(t){var n=this;return(0,h.Z)(function*(){n.showNumberPrompt(t)})()}showNumberPrompt(t){var n=this;te().fire({title:this.translate.instant("AI_DETECTION_IMAGES.SWAL_ENTER_QUANTITY"),input:"number",inputPlaceholder:this.translate.instant("AI_DETECTION_IMAGES.SWAL_INPUT_PLACEHOLDER"),showCancelButton:!0,confirmButtonText:this.translate.instant("AI_DETECTION_IMAGES.SWAL_CONFIRM_CREATE_WTS"),cancelButtonText:this.translate.instant("AI_DETECTION_IMAGES.SWAL_CANCEL_BUTTON"),inputAttributes:{min:"1"},inputValidator:i=>{const o=Number(i);return!i||isNaN(o)?this.translate.instant("AI_DETECTION_IMAGES.SWAL_ONLY_NUMBERS"):o<=0?this.translate.instant("AI_DETECTION_IMAGES.SWAL_POSITIVE_NUMBER"):null},customClass:{confirmButton:"btn btn-info mr-2",cancelButton:"btn btn-secondary"},buttonsStyling:!1}).then(function(){var i=(0,h.Z)(function*(o){if(o.isConfirmed){const s=Number(o.value);yield n.drawerService.createWTS({pictureId:t.pictureId,modelName:t.modelName,manufacturer:t.manufacturer,description:t.description,specs:t.specs,category:t.category,qty:s??1,imageKey:t.imageKey})}});return function(o){return i.apply(this,arguments)}}())}createEbayListing(t){this.drawerService.openMarketValueTrend(t)}connectWithBuyers(t){this.drawerService.connectWithBuyers(t)}onCustomerSearch(t){const n="string"==typeof t?t:t?.term||"";n.trim()?this.getCustomers(n):this.customers=[]}getCustomers(t){const n=`admins/find?q=${encodeURIComponent(t)}`;this.api.get(n).then(i=>{const o=Array.isArray(i?.data)?i.data:[];this.customers=o.map(s=>new ne.w(s))})}customCustomerSearchFn(t,n){return t=t.toLowerCase(),n.firstName?.toLowerCase().includes(t)||n.lastName?.toLowerCase().includes(t)||n.userName?.toLowerCase().includes(t)}onCustomerSelect(t,n){const i=String(n);t.customer=this.customers.find(o=>String(o.id)===i)||null}onTopCustomerChange(t){let n=null;null!=t&&""!==t?("number"==typeof t?n=String(t):"string"==typeof t?n=t:t?.id&&(n=String(t.id)),this.filteredImages=null!=n?this.images.filter(i=>{if(!i)return!1;const o=String(i.selectedCustomer??""),s=i.customer?String(i.customer.id):"";return o===n||s===n}):[...this.images]):this.filteredImages=[...this.images]}resolveSelectedCustomerId(t){if(null==t||""===t)return null;const n="number"==typeof t?String(t):"string"==typeof t?t:t?.id?String(t.id):null;return n&&!isNaN(+n)?+n:null}compareCustomers(t,n){return String(t?.id??"")===String(n?.id??"")}}return r.\u0275fac=function(t){return new(t||r)(e.\u0275\u0275directiveInject(f.t),e.\u0275\u0275directiveInject(C.F0),e.\u0275\u0275directiveInject(x._W),e.\u0275\u0275directiveInject(ie.ey),e.\u0275\u0275directiveInject(b.d),e.\u0275\u0275directiveInject(E.l),e.\u0275\u0275directiveInject(v.sK))},r.\u0275cmp=e.\u0275\u0275defineComponent({type:r,selectors:[["app-ai-detection-images"]],viewQuery:function(t,n){if(1&t&&e.\u0275\u0275viewQuery(re,5),2&t){let i;e.\u0275\u0275queryRefresh(i=e.\u0275\u0275loadQuery())&&(n.dropdownContainer=i.first)}},hostBindings:function(t,n){1&t&&e.\u0275\u0275listener("click",function(o){return n.onDocumentClick(o)},!1,e.\u0275\u0275resolveDocument)},decls:35,vars:30,consts:[[1,"content-wrapper"],[1,"d-flex","justify-content-between","align-items-center","flex-wrap",2,"padding","0 10px"],[1,"title-container","m-0"],[1,"row","justify-content-center","align-items-center",2,"padding","20px 5px"],[1,"col-8","col-sm-3","col-lg-2","d-flex","justify-content-center","mb-3","mb-sm-0"],[1,"custom-dropdown","w-100"],["dropdownContainer",""],[1,"dropdown-btn","w-100",3,"click"],[1,"fas","fa-chevron-down"],[1,"dropdown-list"],[3,"click",4,"ngFor","ngForOf"],[1,"col-4","col-sm-3","col-lg-2","search-bar","d-flex","justify-content-center","mb-3","mb-sm-0"],["type","number","min","0","max","100",3,"placeholder","ngModel","ngModelChange","wheel","keyup.enter"],["class","col-12 col-sm-6 col-lg-4",4,"ngIf"],[1,"d-flex","justify-content-center","col-12","col-lg-8"],[1,"search-bar","w-100",2,"display","flex"],["type","text",1,"form-control",3,"placeholder","ngModel","ngModelChange","keyup.enter"],["type","button",1,"btn","btn-primary","ms-2",3,"click"],[1,"fas","fa-search"],[1,"d-flex","justify-content-end",2,"padding","10px 10px"],[1,"btn","btn-danger",2,"font-size","12px",3,"click"],[1,"grid-section","row","g-3"],["class","d-flex",4,"ngFor","ngForOf"],[3,"pageChange"],["class","modal-backdrop",4,"ngIf"],[3,"click"],[1,"col-12","col-sm-6","col-lg-4"],["bindLabel","firstName","bindValue","id",1,"custom-ng-select",3,"items","ngModel","searchFn","placeholder","ngModelChange","search"],["ng-option-tmp",""],[1,"d-flex"],[1,"card","modern-card","shadow","border-0","flex-fill","d-flex","flex-column"],[1,"card-img-wrapper"],[1,"card-img-top",3,"src","alt","click"],[1,"delete-btn","btn-danger",3,"title","click"],[1,"fas","fa-tras
1h-alt",2,"color","white"],[1,"card-body"],[1,"fw-semibold","mb-1","model-title"],[4,"ngIf"],["class","mt-2",4,"ngIf"],["href","javascript:void(0)","style","color: goldenrod; cursor: pointer; margin-left: 5px",3,"click",4,"ngIf"],[1,"list-unstyled","small","text-secondary","mt-3"],[1,"mb-3"],["rows","3",1,"custom-input","mt-1",3,"placeholder","ngModel","ngModelChange"],[1,"custom-input","mt-1","py-2","w-100",3,"ngModel","ngModelChange"],["value","","disabled","","selected","","hidden",""],["value","reuse"],["value","recycle"],["class","form-group",4,"ngIf"],[1,"btn","small","btn-primary","float-right",3,"click"],["href","javascript:void(0)",2,"color","inherit","text-decoration","none","cursor","pointer",3,"click"],[1,"d-flex","flex-column"],[1,"btn","btn-success",3,"click"],[1,"btn","btn-info","my-2",3,"click"],["class","btn btn-primary",3,"click",4,"ngIf"],[3,"id","ngClass"],[1,"btn-primary","ms-2","border-0",2,"font-size","12px",3,"click"],["href","javascript:void(0)",2,"color","goldenrod","cursor","pointer","margin-left","5px",3,"click"],[1,"mt-2"],["type","text",1,"custom-input",3,"placeholder","ngModel","ngModelChange"],[1,"btn","btn-sm","btn-success","me-2",3,"click"],[1,"btn","btn-sm","btn-secondary","ml-2",3,"click"],[1,"form-group"],["for","inputName"],["bindLabel","firstName","bindValue","id",3,"items","ngModel","compareWith","searchFn","placeholder","ngModelChange","search"],[3,"ngClass"],[1,"mt-1"],["href","javascript:void(0)",1,"",2,"color","goldenrod","cursor","pointer",3,"click"],[1,"btn-primary","ml-2","border-0",2,"font-size","12px",3,"click"],[1,"btn","btn-sm","btn-success","mr-2",3,"click"],[1,"btn","btn-sm","btn-secondary",3,"click"],["type","number","min","1","step","1",1,"custom-input",3,"placeholder","ngModel","ngModelChange","wheel"],[1,"btn","btn-sm","btn-success","mr-2",3,"disabled","click"],[1,"btn","btn-primary",3,"click"],[1,"modal-backdrop"],["tabindex","-1",1,"modal","fade","show","d-block"],[1,"modal-dialog","modal
1-dialog-centered"],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],[1,"modal-body"],[1,"modal-footer"],[1,"btn","btn-secondary",3,"click"],[1,"btn","btn-danger",3,"click"]],template:function(t,n){1&t&&(e.\u0275\u0275elementStart(0,"div",0)(1,"div")(2,"div",1)(3,"h2",2),e.\u0275\u0275text(4),e.\u0275\u0275pipe(5,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(6,"div",3)(7,"div",4)(8,"div",5,6)(10,"button",7),e.\u0275\u0275listener("click",function(){return n.toggleDropdown()}),e.\u0275\u0275text(11),e.\u0275\u0275element(12,"i",8),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(13,"ul",9),e.\u0275\u0275template(14,oe,2,1,"li",10),e.\u0275\u0275elementEnd()()(),e.\u0275\u0275elementStart(15,"div",11)(16,"input",12),e.\u0275\u0275listener("ngModelChange",function(o){return n.searchId=o})("wheel",function(o){return n.disableScroll(o)})("keyup.enter",function(){return n.applySearch()}),e.\u0275\u0275pipe(17,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275template(18,se,4,6,"div",13),e.\u0275\u0275elementStart(19,"div",14)(20,"div",15)(21,"input",16),e.\u0275\u0275listener("ngModelChange",function(o){return n.searchText=o})("keyup.enter",function(){return n.applySearch()}),e.\u0275\u0275pipe(22,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(23,"button",17),e.\u0275\u0275listener("click",function(){return n.applySearch()}),e.\u0275\u0275element(24,"i",18),e.\u0275\u0275elementEnd()()()(),e.\u0275\u0275element(25,"hr"),e.\u0275\u0275elementStart(26,"div",19)(27,"button",20),e.\u0275\u0275listener("click",function(){return n.deleteAllOnPage()}),e.\u0275\u0275text(28),e.\u0275\u0275pipe(29,"translate"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(30,"div",21),e.\u0275\u0275template(31,be,101,91,"div",22),e.\u0275\u0275pipe(32,"paginate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(33,"pagination-controls",23),e.\u0275\u0275listener("pageChange",function(o){return n.pageChange(o)}),e.\u0275\u0275elementEnd()()(),e.\u0275\u0275template(34,Te,19,12,"div",24)),2&t&&(e.\u0275\u0275advance(4),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(5,15,"AI_DETECTION_IMAGES.TITLE")," "),e.\u0275\u0275advance(7),e.\u0275\u0275textInterpolate1(" ",n.getSelectedOptionText()," "),e.\u0275\u0275advance(2),e.\u0275\u0275classProp("show",n.isOpen),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngForOf",n.options),e.\u0275\u0275advance(2),e.\u0275\u0275propertyInterpolate("placeholder",e.\u0275\u0275pipeBind1(17,17,"AI_DETECTION_IMAGES.PLACEHOLDER_ID")),e.\u0275\u0275property("ngModel",n.searchId),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",n.adminService.isAdmin),e.\u0275\u0275advance(1),e.\u0275\u0275classProp("mt-3",n.adminService.isAdmin),e.\u0275\u0275advance(2),e.\u0275\u0275propertyInterpolate("placeholder",e.\u0275\u0275pipeBind1(22,19,"AI_DETECTION_IMAGES.PLACEHOLDER_SEARCH_MODEL")),e.\u0275\u0275property("ngModel",n.searchText),e.\u0275\u0275advance(7),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(29,21,"AI_DETECTION_IMAGES.DELETE_ALL_ON_PAGE")," "),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngForOf",e.\u0275\u0275pipeBind2(32,23,n.filteredImages,e.\u0275\u0275pureFunction3(26,Se,n.itemsPerPage,n.currentPage,n.totalItems))),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngIf",n.showConfirmModal))},dependencies:[g.NgClass,g.NgForOf,g.NgIf,_.YN,_.Kr,_.Fj,_.wV,_.EJ,_.JJ,_.qQ,_.Fd,_.On,T.LS,S.w9,S.Z2,g.DatePipe,T._s,v.X$],styles:['.grid-section[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;justify-content:center}.title-container[_ngcontent-%COMP%]{font-size:24px;padding:20px 0}.modern-card[_ngcontent-%COMP%]{border-radius:1rem;overflow:hidden;transition:transform .3s ease,box-shadow .3s ease;background:#fff;width:350px;margin:10px}@media (max-width: 440px){.modern-card[_ngcontent-%COMP%]{width:300px}}.modern-card[_ngcontent-%COMP%]:hover{transform:translateY(-8px);box-shadow:0 12px 24px #0000001f}.card-img-wrapper[_ngcontent-%COMP%]{position:relative;overflow:hidden}.card-img-top[_ngcontent-%COMP%]{height:220px;width:100%;object-fit:cover;transition:transform .4s ease}.modern-card[_ngcontent-%COMP%]:hover .card-img-top[_ngcontent-%COMP%]{transform:scale(1.05)}.custom-close[_ngcontent-%COMP%]{position:absolute;top:0;right:0;background:rgba(255,255,255,.85);border:none;display:flex;align-items:center;justify-content:center}.custom-close[_ngcontent-%COMP%]:hover{background:rgb(255,255,255)}.delete-btn[_ngcontent-%COMP%]{position:absolute;top:0;right:0;padding:10px;border:none;display:flex;align-items:center;justify-content:center;border-radius:0 0 0 10px}.custom-dropdown[_ngcontent-%COMP%]{position:relative;display:inline-block;
1width:200px}.dropdown-btn[_ngcontent-%COMP%]{width:100%;padding:10px;background:#fff;border:1px solid goldenrod;border-radius:8px;text-align:left;cursor:pointer;display:flex;justify-content:space-between;align-items:center;color:#000;appearance:none;-webkit-appearance:none;-moz-appearance:none}.dropdown-btn[_ngcontent-%COMP%]:focus, .dropdown-btn[_ngcontent-%COMP%]:active{outline:none;color:#000;background-color:#f9f9f9}.dropdown-list[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;position:absolute;width:100%;background:#fff;border-radius:8px;max-height:0;overflow:hidden;transition:max-height .3s ease;z-index:1000}.dropdown-list.show[_ngcontent-%COMP%]{max-height:200px;overflow-y:auto}.dropdown-list[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{padding:10px;cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}.dropdown-list[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:hover{background:#f1f1f1}.fa-chevron-down[_ngcontent-%COMP%]{color:#daa520}.search-bar[_ngcontent-%COMP%]{display:flex;align-items:center;border:1px solid goldenrod;border-radius:6px;overflow:hidden;background:#fff}.search-bar[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{flex:1;border:none;padding:10px;outline:none}.search-bar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{background:goldenrod;border:none;padding:10px 30px;cursor:pointer;color:#fff}.search-bar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:14px}.search-bar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover{background:goldenrod}@media (max-width: 992px){.grid-section[_ngcontent-%COMP%]{justify-content:center}}.content-wrapper[_ngcontent-%COMP%]{padding:0 10px}.modal-backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:1050}.model-title[_ngcontent-%COMP%]{position:relative;display:inline-block;width:100%}.clamp[_ngcontent-%COMP%]{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}.read-more[_ngcontent-%COMP%]{color:#daa520;cursor:pointer;font-size:14px}.custom-input[_ngcontent-%COMP%]{width:100%;padding:6px 10px;border:1px solid #ced4da;border-radius:4px;font-size:14px;box-sizing:border-box;color:#757575}.custom-input[_ngcontent-%COMP%]:focus{border-color:#80bdff;outline:none;box-shadow:0 0 0 .2rem #007bff40}textarea.custom-input[_ngcontent-%COMP%]{resize:vertical;min-height:60px}select.custom-input[_ngcontent-%COMP%]{width:100%;padding:6px 35px 6px 10px;border:1px solid #ced4da;border-radius:4px;font-size:14px;box-sizing:border-box;appearance:none;background-color:#fff;background-image:url(\'data:image/svg+xml;utf8,<svg fill="%23333" height="12" viewBox="0 0 10 6" width="12" xmlns="http://www.w3.org/2000/svg"><path d="M0 0l5 6 5-6z"/></svg>\');background-repeat:no-repeat;background-position:right 10px center;background-size:12px 12px;transition:border-color .2s ease}.text-clamp[_ngcontent-%COMP%]{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;transition:all ease-in-out .9s}input[type=number][_ngcontent-%COMP%]::-webkit-outer-spin-button, input[type=number][_ngcontent-%COMP%]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number][_ngcontent-%COMP%]{-moz-appearance:textfield}select.custom-input[_ngcontent-%COMP%]:focus{border-color:#80bdff;outline:none;box-shadow:0 0 0 .2rem #007bff40}.custom-ng-select[_ngcontent-%COMP%] .ng-select-container{border:1px solid goldenrod;border-radius:6px;padding:8px 10px;min-height:42px;margin-top:0}.custom-ng-select[_ngcontent-%COMP%] .ng-select-container:hover{border-color:#daa520}']}),r})(),D=(()=>{class r{constructor(t){this.api=t}resolve(t,n){return this.api.post(`ai-product-detection/${t}/market-value/resolve`,{condition:n},!1,!1)}refresh(t,n){return this.api.post(`ai-product-detection/${t}/market-value/refresh`,{condition:n},!1,!1)}}return r.\u0275fac=function(t){return new(t||r)(e.\u0275\u0275inject(f.t))},r.\u0275prov=e.\u0275\u0275defineInjectable({token:r,factory:r.\u0275fac}),r})();var O=m(64155);function we(r,a){1&r&&e.\u0275\u0275element(0,"span",20)}function ye(r,a){1&r&&e.\u0275\u0275element(0,"i",21)}function Me(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"button",17),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext(2);
1return e.\u0275\u0275resetView(i.refresh())}),e.\u0275\u0275template(1,we,1,0,"span",18),e.\u0275\u0275template(2,ye,1,0,"i",19),e.\u0275\u0275text(3,"Refresh "),e.\u0275\u0275elementEnd()}if(2&r){const t=e.\u0275\u0275nextContext(2);e.\u0275\u0275property("disabled",t.refreshing),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",t.refreshing),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",!t.refreshing)}}function De(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",13)(1,"button",14),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(i.share())}),e.\u0275\u0275element(2,"i",15),e.\u0275\u0275text(3,"Share "),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(4,Me,4,3,"button",16),e.\u0275\u0275elementEnd()}if(2&r){const t=e.\u0275\u0275nextContext();e.\u0275\u0275advance(4),e.\u0275\u0275property("ngIf",t.isAdmin)}}function Oe(r,a){1&r&&e.\u0275\u0275element(0,"div",22)}function Pe(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"small",31),e.\u0275\u0275text(1),e.\u0275\u0275elementEnd()),2&r){const t=e.\u0275\u0275nextContext().$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(t.error)}}function ke(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"span",28),e.\u0275\u0275element(1,"span",29),e.\u0275\u0275text(2),e.\u0275\u0275elementStart(3,"small"),e.\u0275\u0275text(4),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(5,Pe,2,1,"small",30),e.\u0275\u0275elementEnd()),2&r){const t=a.$implicit,n=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(1),e.\u0275\u0275styleProp("background",n.providerColors[t.provider]),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",n.providerLabel(t.provider)," "),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1("(",n.statusLabel(t.status),")"),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",t.error)}}function Ne(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"header",23)(1,"h1"),e.\u0275\u0275text(2),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(3,"p",24),e.\u0275\u0275text(4),e.\u0275\u0275pipe(5,"titlecase"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(6,"p",25),e.\u0275\u0275text(7),e.\u0275\u0275pipe(8,"date"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(9,"div",26),e.\u0275\u0275template(10,ke,6,5,"span",27),e.\u0275\u0275elementEnd()()),2&r){const t=e.\u0275\u0275nextContext();e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate2("",t.report.product.manufacturer," ",t.report.product.model," market value trend"),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(5,5,t.activeCondition)," grounded observations and provider-modeled 13-month estimates in USD per single item, excluding shipping and tax. "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" Updated ",e.\u0275\u0275pipeBind2(8,7,t.report.generatedAt,"medium"),". Dashed lines are modeled estimates; larger standalone points are grounded observations. "),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngForOf",t.report.providerStatuses)}}function Ve(r,a){1&r&&e.\u0275\u0275element(0,"span",34)}function Re(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"button",32),e.\u0275\u0275listener("click",function(){const o=e.\u0275\u0275restoreView(t).$implicit,s=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(s.selectCondition(o))}),e.\u0275\u0275text(1),e.\u0275\u0275pipe(2,"titlecase"),e.\u0275\u0275template(3,Ve,1,0,"span",33),e.\u0275\u0275elementEnd()}if(2&r){const t=a.$implicit,n=e.\u0275\u0275nextContext();e.\u0275\u0275classProp("active",n.activeCondition===t),e.\u0275\u0275attribute("aria-selected",n.activeCondition===t),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(2,5,t)," "),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",n.loading[t])}}function Le(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementStart(0,"div",35),e.\u0275\u0275text(1),e.\u0275\u0275elementStart(2,"button",36),e.\u0275\u0275listener("click",function(){e.\u0275\u0275restoreView(t);const i=e.\u0275\u0275nextContext();
1return e.\u0275\u0275resetView(i.retry())}),e.\u0275\u0275text(3," Try again "),e.\u0275\u0275elementEnd()()}if(2&r){const t=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1(" ",t.errorMessage," "),e.\u0275\u0275advance(1),e.\u0275\u0275property("disabled",t.isRetrying)}}function Be(r,a){1&r&&(e.\u0275\u0275elementStart(0,"div",37)(1,"div",38)(2,"span",39),e.\u0275\u0275text(3,"Loading"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(4,"p"),e.\u0275\u0275text(5,"Searching current web sources and verifying citations from all three providers\u2026"),e.\u0275\u0275elementEnd()())}function Fe(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"div",54),e.\u0275\u0275element(1,"canvas",55),e.\u0275\u0275elementEnd()),2&r){const t=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(1),e.\u0275\u0275property("type","line")("data",t.trendChartData)("options",t.trendChartOptions)}}function Ue(r,a){1&r&&(e.\u0275\u0275elementStart(0,"p",56)(1,"strong"),e.\u0275\u0275text(2,"Observed:"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(3," one representative real source-backed price per available month (solid line/points); missing months stay empty. "),e.\u0275\u0275elementStart(4,"strong"),e.\u0275\u0275text(5,"Modeled:"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(6," AI-estimated monthly trend from observed anchors (dashed lines), not actual listings or sales. "),e.\u0275\u0275elementEnd())}function Ge(r,a){1&r&&(e.\u0275\u0275elementStart(0,"p",56)(1,"strong"),e.\u0275\u0275text(2,"Linear:"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(3," equal dollar spacing. "),e.\u0275\u0275elementStart(4,"strong"),e.\u0275\u0275text(5,"Logarithmic:"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(6," equal percentage-change spacing. "),e.\u0275\u0275elementStart(7,"strong"),e.\u0275\u0275text(8,"Shared:"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(9," fixed common Y-axis range. "),e.\u0275\u0275elementStart(10,"strong"),e.\u0275\u0275text(11,"Per-chart auto:"),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(12," fits the Y-axis to displayed values. "),e.\u0275\u0275elementEnd())}function $e(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"div",57),e.\u0275\u0275text(1),e.\u0275\u0275elementEnd()),2&r){const t=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate1("No observed or modeled ",t.activeCondition," prices are available.")}}function je(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"div",54),e.\u0275\u0275element(1,"canvas",55),e.\u0275\u0275elementEnd()),2&r){const t=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(1),e.\u0275\u0275property("type","bar")("data",t.changeChartData)("options",t.changeChartOptions)}}function We(r,a){1&r&&(e.\u0275\u0275elementStart(0,"div",57),e.\u0275\u0275text(1,"No provider has endpoints exactly 12 months apart."),e.\u0275\u0275elementEnd())}function ze(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"tr")(1,"td"),e.\u0275\u0275text(2),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(3,"td"),e.\u0275\u0275text(4),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(5,"td"),e.\u0275\u0275text(6),e.\u0275\u0275pipe(7,"currency"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(8,"td")(9,"a",62),e.\u0275\u0275text(10),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(11,"td"),e.\u0275\u0275text(12),e.\u0275\u0275elementEnd()()),2&r){const t=a.$implicit,n=e.\u0275\u0275nextContext(3);e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate(t.date),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate(n.pointTypeLabel(t)),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind2(7,6,t.priceUsd,"USD")),e.\u0275\u0275advance(3),e.\u0275\u0275property("href",t.sourceUrl,e.\u0275\u0275sanitizeUrl),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(t.sourceTitle),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate(t.notes||"\u2014")}}function He(r,a){1&r&&(e.\u0275\u0275elementStart(0,"tr")(1,"td",63),e.\u0275\u0275text(2,"No accepted points."),e.\u0275\u0275elementEnd()())}function Qe(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"div",58)(1,"h3"),e.\u0275\u0275text(2),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(3,"p",56),e.\u0275\u0275text(4),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(5,"div",59)(6,"table",60)(7,"thead")(8,"tr")(9,"th"),e.\u0275\u0275text(10,"Date"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(11,"th"),e.\u0275\u0275text(12,"Type"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(13,"th"),e.\u0275\u0275text(14,"Price"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(15,"th"),e.\u0275\u0275text(16,"Listing/source"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(17,"th"),e.\u0275\u0275text(18,"Notes"),e.\u0275\u0275elementEnd()()(),e.\u0275\u0275elementStart(19,"tbody"),e.\u0275\u0275template(20,ze,13,9,"tr",61),e.\u0275\u0275template(21,He,3,0,"tr",12),e.\u0275\u0275elementEnd()()()()),2&r){const t=a.$implicit,n=e.\u0275\u0275nextContext(2);e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate(n.providerLabel(t.provider)),e.\u0275\u0275advance(2),e.\u0275\u0275textInterpolate1(" ",n.statusLabel(t.status)," \u2014 observed and modeled values are labeled separately. "),e.\u0275\u0275advance(16),e.\u0275\u0275property("ngForOf",t.points)("ngForTrackBy",n.trackPoint),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",!t.points.length)}}function Ye(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"li")(1,"a",62),e.\u0275\u0275text(2),e.\u0275\u0275elementEnd()()),2&r){const t=a.$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275property("href",t.url,e.\u0275\u0275sanitizeUrl),e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(t.title)}}function Ke(r,a){1&r&&(e.\u0275\u0275elementStart(0,"li"),e.\u0275\u0275text(1,"No accepted sources."),e.\u0275\u0275elementEnd())}function qe(r,a){if(1&r&&(e.\u0275\u0275elementStart(0,"li"),e.\u0275\u0275text(1),e.\u0275\u0275elementEnd()),2&r){const t=a.$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(t)}}function Ze(r,a){if(1&r){const t=e.\u0275\u0275getCurrentView();e.\u0275\u0275elementContainerStart(0),e.\u0275\u0275elementStart(1,"section",40)(2,"fieldset")(3,"legend"),e.\u0275\u0275text(4,"Y axis"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(5,"label")(6,"input",41),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext();
1return e.\u0275\u0275resetView(o.scale=i)}),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(7," Linear"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(8,"label")(9,"input",42),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(o.scale=i)}),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(10," Logarithmic"),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(11,"fieldset")(12,"legend"),e.\u0275\u0275text(13,"Axis range"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(14,"label")(15,"input",43),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(o.range=i)}),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(16," Shared"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(17,"label")(18,"input",44),e.\u0275\u0275listener("ngModelChange",function(i){e.\u0275\u0275restoreView(t);const o=e.\u0275\u0275nextContext();return e.\u0275\u0275resetView(o.range=i)}),e.\u0275\u0275elementEnd(),e.\u0275\u0275text(19," Per-chart auto"),e.\u0275\u0275elementEnd()()(),e.\u0275\u0275elementStart(20,"section")(21,"h2"),e.\u0275\u0275text(22,"Market value history and modeled trend"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(23,Fe,2,3,"div",45),e.\u0275\u0275template(24,Ue,7,0,"p",46),e.\u0275\u0275template(25,Ge,13,0,"p",46),e.\u0275\u0275template(26,$e,2,1,"ng-template",null,47,e.\u0275\u0275templateRefExtractor),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(28,"section")(29,"h2"),e.\u0275\u0275text(30,"12-month change per source"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(31,je,2,3,"div",45),e.\u0275\u0275template(32,We,2,0,"ng-template",null,48,e.\u0275\u0275templateRefExtractor),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(34,"details",49)(35,"summary"),e.\u0275\u0275text(36,"Underlying data tables"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(37,Qe,22,5,"div",50),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(38,"section")(39,"h2"),e.\u0275\u0275text(40,"Sources"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(41,"ul",51),e.\u0275\u0275template(42,Ye,3,2,"li",52),e.\u0275\u0275template(43,Ke,2,0,"li",12),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementStart(44,"section",53)(45,"h2"),e.\u0275\u0275text(46,"Notes"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(47,"ul")(48,"li"),e.\u0275\u0275text(49," Active listings and historical observations are source-grounded. Dashed monthly values are provider-modeled estimates, not observed listings or transactions. "),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(50,"li"),e.\u0275\u0275text(51," Modeled estimates cover the current month and previous 12 months and require at least one grounded observation from the same provider. "),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(52,"li"),e.\u0275\u0275text(53,"Prices are USD per single item and exclude shipping and tax."),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(54,qe,2,1,"li",52),e.\u0275\u0275elementEnd()(),e.\u0275\u0275elementContainerEnd()}if(2&r){const t=a.ngIf,n=e.\u0275\u0275reference(27),i=e.\u0275\u0275reference(33),o=e.\u0275\u0275nextContext();e.\u0275\u0275advance(6),e.\u0275\u0275property("ngModel",o.scale),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngModel",o.scale),e.\u0275\u0275advance(6),e.\u0275\u0275property("ngModel",o.range),e.\u0275\u0275advance(3),e.\u0275\u0275property("ngModel",o.range),e.\u0275\u0275advance(5),e.\u0275\u0275property("ngIf",null==o.trendChartData.labels?null:o.trendChartData.labels.length)("ngIfElse",n),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",null==o.trendChartData.labels?null:o.trendChartData.labels.length),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",null==o.trendChartData.labels?null:o.trendChartData.labels.length),e.\u0275\u0275advance(6),e.\u0275\u0275property("ngIf",t.twelveMonthChange.length)("ngIfElse",i),e.\u0275\u0275advance(6),e.\u0275\u0275property("ngForOf",t.series),e.\u0275\u0275advance(5),e.\u0275\u0275property("ngForOf",t.sources),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",!t.sources.length),e.\u0275\u0275advance(11),e.\u0275\u0275property("ngForOf",t.n
1otes)}}const Je=[{path:"",component:Z},{path:"results",component:Ae},{path:"market-value/:id",component:(()=>{class r{constructor(t,n,i,o,s){this.route=t,this.router=n,this.marketValueService=i,this.adminService=o,this.toastr=s,this.conditions=["used","new"],this.providerColors={openai:"#047857",anthropic:"#c2410c",gemini:"#1d4ed8"},this.detectionId=0,this.activeCondition="used",this.reports={},this.loading={},this.refreshing=!1,this.errorMessages={},this.failedOperations={},this.requestVersions={},this.scale="linear",this.range="shared",this.trendChartData={labels:[],datasets:[]},this.changeChartData={labels:[],datasets:[]},this.changeChartOptions={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{y:{title:{display:!0,text:"% change over 12 months"},ticks:{callback:l=>`${l}%`}}}}}ngOnInit(){this.detectionId=Number(this.route.snapshot.paramMap.get("id")),!Number.isInteger(this.detectionId)||this.detectionId<=0?this.router.navigate(["/ai-product-detection/results"]):this.load(this.activeCondition)}get report(){return this.reports[this.activeCondition]}get isLoading(){return Boolean(this.loading[this.activeCondition])}get errorMessage(){return this.errorMessages[this.activeCondition]||""}get isRetrying(){return this.isLoading||this.refreshingCondition===this.activeCondition}get isAdmin(){return Boolean(this.adminService.isAdmin)}selectCondition(t){this.activeCondition!==t&&(this.activeCondition=t,this.reports[t]?this.rebuildCharts():this.load(t))}retry(){var t=this;return(0,h.Z)(function*(){const n=t.activeCondition;"refresh"!==t.failedOperations[n]?yield t.load(n):yield t.refresh()})()}load(t){var n=this;return(0,h.Z)(function*(){if(n.loading[t]||n.refreshingCondition===t)return;n.loading[t]=!0;const i=n.beginRequest(t);try{const o=yield n.marketValueService.resolve(n.detectionId,t);if(!n.isCurrentRequest(t,i))return;n.reports[t]=o.data,n.clearFailure(t),n.activeCondition===t&&n.rebuildCharts()}catch(o){if(!n.isCurrentRequest(t,i))return;n.recordFailure(t,"load",o?.error?.message||"Unable to load verified market value data. Please try again.")}finally{n.loading[t]=!1}})()}refresh(){var t=this;return(0,h.Z)(function*(){const n=t.activeCondition;if(!t.isAdmin||t.refreshing||t.loading[n])return;t.refreshing=!0,t.refreshingCondition=n;const i=t.beginRequest(n);try{const o=yield t.marketValueService.refresh(t.detectionId,n);if(!t.isCurrentRequest(n,i))return;t.reports[n]=o.data,t.clearFailure(n),t.activeCondition===n&&t.rebuildCharts(),t.toastr.success("Market value data refreshed.")}catch(o){if(!t.isCurrentRequest(n,i))return;t.recordFailure(n,"refresh",o?.error?.message||"Unable to refresh market value data.")}finally{t.refreshing=!1,t.refreshingCondition===n&&(t.refreshingCondition=void 0)}})()}beginRequest(t){const n=(this.requestVersions[t]||0)+1;return this.requestVersions[t]=n,delete this.errorMessages[t],delete this.failedOperations[t],n}isCurrentRequest(t,n){return this.requestVersions[t]===n}recordFailure(t,n,i){this.errorMessages[t]=i,this.failedOperations[t]=n}clearFailure(t){delete this.errorMessages[t],delete this.failedOperations[t]}share(){var t=this;return(0,h.Z)(function*(){const n=t.report?.product.publicUrl;if(n)try{navigator.share?yield navigator.share({title:`${t.report?.product.model} Market Value Trend`,url:n}):(yield navigator.clipboard.writeText(n),t.toastr.success("Public link copied."))}catch(i){"AbortError"!==i?.name&&t.toastr.error("Unable to share the public link.")}})()}providerLabel(t){return"anthropic"===t?"Claude":"openai"===t?"OpenAI":"Gemini"}statusLabel(t){return"no_valid_points"===t?"no qualifying listings":t.replace(/_/g," ")}pointTypeLabel(t){const n=t.dataType||"active_listing";return"modeled_estimate"===n?"Modeled estimate":"historical_observation"===n?"Historical observation":"Active listing"}trackPoint(t,n){return`${n.date}-${n.sourceUrl}-${t}`}get trendChartOptions(){const t=(this.report?.series||[]).reduce((o,s)=>o.concat(s.points.map(l=>l.priceUsd)),[]),n=t.length?50*Math.ceil(Math.max(...t)/50):void 0,i=t.length?Math.max(.01,Math.min(...t)):void 0;return{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"x",intersect:!1},plugins:{legend:{position:"bottom"},tooltip:{callbacks:{label:o=>{const s=o.raw;if(null==s.y)return`${o.dataset.label}: No observation`;const l=s.sourceTitle?` \u2014 ${s.sourceTitle}`:"",c="modeled_estimate"===s.dataType?" (modeled estimate)":"historical_observation"===s.dataType?" (historical observation)":" (active listing)";return`${o.dataset.label}: $${s.y.toFixed(2)}${c}${l}`}}}},scales:{x:{grid:{display:!1}},y:{type:this.scale,min:"shared"===this.range?"logarithmic"===this.scale?i:0:void 0,max:"shared"===this.range?n:void 0,title:{display:!0,text:"USD per item"},ticks:{callback:o=>`$${o}`}}}}}monthlyObservedPoints(t){const n=new Date,i=12*n.getUTCFullYear()+n.getUTCMonth(),o={};return t.filter(s=>"modeled_estimate"!==s.dataType).forEach(s=>{const l=/^(\d{4})-(\d{2})-\d{2}$/.exec(s.date);if(!l)return;const c=12*Number(l[1])+Number(l[2])-1,p=i-c;if(p<0||p>12)return;const u=`${l[1]}-${l[2]}`;o[u]=o[u]||[],o[u].push(s)}),Object.keys(o).sort().map(s=>{const l=o[s].slice().sort((d,I)=>d.priceUsd-I.priceUsd),c=Math.floor(l.length/2),p=l.length%2?l[c].priceUsd:(l[c-1].priceUsd+l[c].priceUsd)/2,u=l.reduce((d,I)=>Math.abs(I.priceUsd-p)<Math.abs(d.priceUsd-p)?I:d);return{...u,date:`${s}-01`,sourceTitle:`Representative of ${l.length} observed price${1===l.length?"":"s"}; observed ${u.date} \u2014 ${u.sourceTitle}`}})}rebuildCharts(){const t=this.report;if(!t)return;const n=t.series.map(l=>({series:l,modeled:l.points.filter(c=>"modeled_estimate"===c.dataType),observed:this.monthlyObservedPoints(l.points)})),i=Array.from(new Set(n.reduce((l,c)=>l.concat(c.modeled.map(p=>p.date),c.observed.map(p=>p.date)),[]))).sort(),o=l=>i.reduce((c,p)=>{const u=l.filter(d=>d.date===p);return u.length?u.forEach(d=>c.push({x:p,y:d.priceUsd,sourceTitle:d.sourceTitle,sourceUrl:d.sourceUrl,dataType:d.dataType||"active_listing"})):c.push({x:p,y:null}),c},[]),s=n.reduce((l,c)=>{const{series:p,modeled:u,observed:d}=c;return u.length&&l.push({label:`${this.providerLabel(p.provider)} modeled`,data:o(u),borderColor:this.providerColors[p.provider],backgroundColor:this.providerColors[p.provider],borderDash:[6,4],pointRadius:2.5,pointHoverRadius:5,borderWidth:2,tension:.2,spanGaps:!1}),d.length&&l.push({label:`${this.providerLabel(p.provider)} observed`,data:o(d),borderColor:this.providerColors[p.provider],backgroundColor:this.providerColors[p.provider],showLine:!0,spanGaps:!0,borderWidth:2,tension:.2,pointRadius:4,pointHoverRadius:6}),l},[]);this.trendChartData={labels:i,datasets:s},this.changeChartData={labels:t.twelveMonthChange.map(l=>this.providerLabel(l.provider)),datasets:[{label:"12-month change",data:t.twelveMonthChange.map(l=>l.percent),backgroundColor:t.twelveMonthChange.map(l=>this.providerColors[l.provider])}]}}}return r.\u0275fac=function(t){return new(t||r)(e.\u0275\u0275directiveInject(C.gz),e.\u0275\u0275directiveInject(C.F0),e.\u0275\u0275directiveInject(D),e.\u0275\u0275directiveInject(E.l),e.\u0275\u0275directiveInject(x._W))},r.\u0275cmp=e.\u0275\u0275defineComponent({type:r,selectors:[["app-market-value"]],features:[e.\u0275\u0275ProvidersFeature([D])],decls:14,vars:7,consts:[[1,"content-wrapper"],[1,"market-value-page"],[1,"page-header",2,"margin-bottom","0 !important"],["type","button",1,"btn","btn-link","pl-0",3,"click"],[1,"fas","fa-arrow-left","mr-2"],["class","header-actions",4,"ngIf"],["aria-hidden","true","style","height: 12px",4,"ngIf"],["class","report-header",4,"ngIf"],["role","tablist","aria-label","Product condition",1,"condition-tabs"],["type","button","role","tab","class","condition-tab",3,"active","click",4,"ngFor","ngForOf"],["class","alert alert-danger","role","alert",4,"ngIf"],["class","loading-card",4,"ngIf"],[4,"ngIf"],[1,"header-actions"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-share-alt","mr-2"],["class","btn btn-primary","type","button",3,"disabled","click",4,"ngIf"],["type","button",1,"btn","btn-primary",3,"disabled","click"],["class","spinner-border spinner-border-sm mr-2",4,"ngIf"],["class","fas fa-sync-alt mr-2",4,"ngIf"],[1,"spinner-border","spinner-border-sm","mr-2"],[1,"fas","fa-sync-alt","mr-2"],["aria-hidden","true",2,"height","12px"],[1,"report-header"],[1,"subtitle"],[1,"meta"],[1,"provider-legend"],["class","provider-item",4,"ngFor","ngForOf"],[1,"provider-item"],[1,"swatch"],["class","provider-error",4,"ngIf"],[1,"provider-error"],["type","button","role","tab",1,"condition-tab",3,"click"],["class","spinner-border spinner-border-sm ml-2",4,"ngIf"],[1,"spinner-border","spinner-border-sm","ml-2"],["role","alert",1,"alert","alert-danger"],["type","button",1,"btn","btn-sm","btn-outline-danger","ml-2",3,"disabled","click"],[1,"loading-card"],["role","status",1,"spinner-border","text-primary"],[1,"sr-only"],["aria-label","Chart controls",1,"controls"],["type","radio","name","scale","value","linear",3,"ngModel","ngModelChange"],["type","radio","name","scale","value","logarithmic",3,"ngModel","ngModelChange"],["type","radio","name","range","value","shared",3,"ngModel","ngModelChange"],["type","radio","name","range","value","auto",3,"ngModel","ngModelChange"],["class","chart-card",4,"ngIf","ngIfElse"],["class","section-note",4,"ngIf"],["noTrend",""],["noChange",""],[1,"data-section"],["class","provider-table",4,"ngFor","ngForOf"],[1,"sources"],[4,"ngFor","ngForOf"],[1,"notes"],[1,"chart-card"],["baseChart","",3,"type","data","options"],[1,"section-note"],[1,"empty-card"],[1,"provider-table"],[1,"table-responsive"],[1,"table","table-bordered","table-sm"],[4,"ngFor","ngForOf","ngForTrackBy"],["target","_blank","rel","nofollow noopener",3,"href"],["colspan","5"]],template:function(t,n){1&t&&(e.\u0275\u0275elementStart(0,"div",0)(1,"div",1)(2,"div",2)(3,"button",3),e.\u0275\u0275listener("click",function(){return n.router.navigate(["/ai-product-detection/results"])}),e.\u0275\u0275element(4,"i",4),e.\u0275\u0275text(5,"AI Results "),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(6,De,5,1,"div",5),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(7,Oe,1,0,"div",6),e.\u0275\u0275template(8,Ne,11,10,"header",7),e.\u0275\u0275elementStart(9,"nav",8),e.\u0275\u0275template(10,Re,4,7,"button",9),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(11,Le,4,2,"div",10),e.\u0275\u0275template(12,Be,6,0,"div",11),e.\u0275\u0275template(13,Ze,55,14,"ng-container",12),e.\u0275\u0275elementEnd()()),2&t&&(e.\u0275\u0275advance(6),e.\u0275\u0275property("ngIf",n.report),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",n.report),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",n.report),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngForOf",n.conditions),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",n.errorMessage),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",n.isLoading&&!n.report),e.\u0275\u0275advance(1),e.\u0275\u0275property("ngIf",n.report))},dependencies:[g.NgForOf,g.NgIf,_.Fj,_._,_.JJ,_.On,O.jh,g.TitleCasePipe,g.CurrencyPipe,g.DatePipe],styles:["[_nghost-%COMP%]{display:block;min-height:100vh;background:#f5f6f8}.market-value-page[_ngcontent-%COMP%]{max-width:1200px;margin:0 auto;padding:24px;
1color:#1a1a1a}.page-header[_ngcontent-%COMP%], .header-actions[_ngcontent-%COMP%], .provider-legend[_ngcontent-%COMP%], .controls[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap}.page-header[_ngcontent-%COMP%]{justify-content:space-between;gap:12px}.header-actions[_ngcontent-%COMP%], .provider-legend[_ngcontent-%COMP%], .controls[_ngcontent-%COMP%]{gap:12px}.report-header[_ngcontent-%COMP%], .controls[_ngcontent-%COMP%], .chart-card[_ngcontent-%COMP%], .empty-card[_ngcontent-%COMP%], .loading-card[_ngcontent-%COMP%], .data-section[_ngcontent-%COMP%], .notes[_ngcontent-%COMP%]{background:#fff;border:1px solid #d8d8d8;border-radius:8px;padding:16px;margin-bottom:20px}.report-header[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0 0 6px;font-size:24px}.subtitle[_ngcontent-%COMP%], .meta[_ngcontent-%COMP%], .section-note[_ngcontent-%COMP%]{color:#5a5a5a}.meta[_ngcontent-%COMP%], .section-note[_ngcontent-%COMP%]{font-size:13px}.provider-item[_ngcontent-%COMP%]{text-transform:capitalize}.provider-error[_ngcontent-%COMP%]{display:block;max-width:360px;color:#b42318;text-transform:none}.swatch[_ngcontent-%COMP%]{display:inline-block;width:11px;height:11px;border-radius:2px;margin-right:5px}.condition-tabs[_ngcontent-%COMP%]{display:flex;margin:0 0 20px;border-bottom:1px solid #d8d8d8}.condition-tab[_ngcontent-%COMP%]{min-width:120px;padding:12px 20px;border:0;border-bottom:3px solid transparent;background:transparent;font-weight:600}.condition-tab.active[_ngcontent-%COMP%]{color:#174ea6;border-bottom-color:#174ea6}.controls[_ngcontent-%COMP%] fieldset[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;border:0;padding:0;margin:0 24px 0 0}.controls[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{width:auto;margin:0;font-size:14px;font-weight:700}.controls[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{margin:0;font-weight:400}.chart-card[_ngcontent-%COMP%]{height:360px}.empty-card[_ngcontent-%COMP%], .loading-card[_ngcontent-%COMP%]{text-align:center;color:#5a5a5a}.loading-card[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:12px 0 0}.data-section[_ngcontent-%COMP%] summary[_ngcontent-%COMP%]{cursor:pointer;font-weight:700;padding:4px 0}.provider-table[_ngcontent-%COMP%]{margin-top:20px}.provider-table[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:17px;margin-bottom:2px}.sources[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{overflow-wrap:anywhere}h2[_ngcontent-%COMP%]{margin:28px 0 10px;font-size:19px}@media (max-width: 650px){.market-value-page[_ngcontent-%COMP%]{padding:14px}.page-header[_ngcontent-%COMP%], .header-actions[_ngcontent-%COMP%]{align-items:stretch}.header-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{flex:1}.condition-tab[_ngcontent-%COMP%]{flex:1;min-width:0}.controls[_ngcontent-%COMP%], .controls[_ngcontent-%COMP%] fieldset[_ngcontent-%COMP%]{align-items:flex-start;flex-direction:column}.chart-card[_ngcontent-%COMP%]{height:280px;padding:8px}}"]}),r})()}];let Xe=(()=>{class r{}return r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=e.\u0275\u0275defineNgModule({type:r}),r.\u0275inj=e.\u0275\u0275defineInjector({imports:[C.Bz.forChild(Je),C.Bz]}),r})();var et=m(71059),tt=m(23513),nt=m(80529);let it=(()=>{class r{}return r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=e.\u0275\u0275defineNgModule({type:r}),r.\u0275inj=e.\u0275\u0275defineInjector({imports:[g.CommonModule,Xe,et.O,tt.ef,y.hx,_.u5,T.JX,nt.JF,S.A0,O.vQ,v.aw.forChild({isolate:!1})]}),r})()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.