1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2631],{56029:function(e,l,t){var a=t(33448);e.exports=function(e,l,t){for(var i=-1,n=e.length;++i<n;){var s=e[i],o=l(s);if(null!=o&&(void 0===r?o==o&&!a(o):t(o,r)))var r=o,c=s}return c}},53325:function(e){e.exports=function(e,l){return e>l}},6162:function(e,l,t){var a=t(56029),i=t(53325),n=t(6557);e.exports=function(e){return e&&e.length?a(e,n,i):void 0}},19056:function(e,l,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/watches/density-map",function(){return t(24866)}])},54388:function(e,l){"use strict";l.Z={src:"/_next/static/media/list-filter.afd2005a.svg",height:10,width:16,blurWidth:0,blurHeight:0}},24866:function(e,l,t){"use strict";t.r(l),t.d(l,{__N_SSG:function(){return F},default:function(){return B}});var a=t(85893),i=t(29529),n=t(67294),s=t(85433),o=t(8673),r=t(25675),c=t.n(r),u=t(40201),d=t(54388),m=e=>{let{companyInfo:l}=e,[t,i]=(0,n.useState)(!1);return(0,a.jsx)("div",{className:"flex flex-wrap w-[300px] pb-4 gap-3 min-w-[300px] relative",children:(0,a.jsx)("div",{className:"flex w-auto flex-col ".concat(t?"text-black":""),children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)(o.zx,{variant:"transparent",onClick:()=>i(e=>!e),className:"flex items-center justify-center gap-2 sm:justify-center border-none bg-white w-[300px]",onMouseEnter:()=>i(!1),children:[(0,a.jsx)("b",{children:t?"Hide Company Info":"Show Company Info"}),t?(0,a.jsx)(c(),{alt:"close",src:u.Z}):(0,a.jsx)(c(),{alt:"list filter",src:d.Z})]}),(0,a.jsx)("div",{className:"filter-type-select absolute z-[100] mt-[5px] w-full min-w-[175px] rounded-sm bg-white p-1 shadow-[0px_4px_30px_0px_rgba(58,_57,_53,_0.30)] ".concat(t?"block":"hidden"," overflow-auto"),children:l?(0,a.jsx)("div",{className:"h-[80vh]",children:(0,a.jsx)("div",{className:"flex flex-wrap",children:(0,a.jsx)("label",{className:"w-full",children:"Company Type:"})})}):null})]})})})},v=t(17514),p=t(98349),f=t(3510),y=t(49108),h=e=>{let{selectedItems:l,dateRange:t,externalFilters:i,onChangeAreaFilters:s,onChangeFilters:r}=e,d={key:"all",label:"All",isAsc:!1},m=[{key:"ct_caliber_",name:"Caliber"},{key:"ct_case_diameter_",name:"Case Diameter"},{key:"ct_collection_",name:"Collections"},{key:"ct_color_",name:"Colors"},{key:"ct_material_",name:"Materials"},{key:"ct_strap_material_",name:"Strap Materials"}],[v,h]=(0,n.useState)([{key:"ct_price_range_",section:null,name:"Price:",filters:[]},{key:"vertical_basic_items",section:"vertical",name:"Vertical:",filters:[]},{key:"horizontal_basic_items",section:"horizontal",name:"Horizontal:",filters:[]},{key:"area_items",section:"area",name:"Area:",filters:[{key:"ct_model_",label:"Models",volume:2},{key:"mentions_watches",label:"Mentions | Media",volume:1,filters:["mediaType:1"]},{key:"mentions_newsletters",label:"Mentions | Newsletters",volume:1},{key:"mentions_kols",label:"Mentions | Influencers",volume:1,filters:["objectType:(1 4 5 15)"]},{key:"visibility_retailers",label:"Mentions | Retailers Visibility",volume:1,filters:["customTags:ct_author_*"]},{key:"visibility_marketplaces",label:"Mentions | Pre-Owned Visibility",volume:1,filters:["customTags:ct_author_*"]}]}]),[x,g]=(0,n.useState)(null),[b,_]=(0,n.useState)({vertical:null,horizontal:null,area:null,isManualSelection:!1});(0,n.useEffect)(()=>{l.brands.length>0&&T([])},[l.brands]),(0,n.useEffect)(()=>{b.isManualSelection&&k()},[b,x]);let k=()=>{var e;let l=[];for(let e in b)"isManualSelection"===e||!b[e]||b[e].key.includes("mentions_")||b[e].key.includes("visibility_")||l.push("customTags:".concat(b[e].key,"*"));T([...l,...null!==(e=null==x?void 0:x.filter(e=>"all"!==e.key).map(e=>"customTags:".concat(e.key)))&&void 0!==e?e:[]]),s(b)},T=async e=>{let l={filters:["customTags:ct_brand_*","customTags:ct_model_*","customTags:ct_i_novelties_*",...e,...null!=i?i:[]],query:"*",workspaceId:y.tW.novelties,startDateTime:t.startDateTime,endDateTime:t.endDateTime,type:null,fields:["customTags"]},a=await (0,f.YO)(l);if(a){let e=[];m.forEach(l=>{let{key:t,name:i}=l,n=a.filter(e=>e.Key.includes(t)).length;n&&e.push({key:t,label:i,value:n})});let l=[...v];l.forEach(l=>
1{l.key.includes("basic_items")||"area_items"===l.key?"area_items"!==l.key&&(l.filters=e.sort((e,l)=>l.value-e.value)):l.filters=(null==x?void 0:x.some(e=>e.key.includes(l.key)))?l.filters:[d,...a.filter(e=>e.Key.includes(l.key)).map(e=>{let l=e.label;if(l.includes(":")){let e=l.split(":");e.length>1&&e.shift(),l=e.join(":")}return{key:e.Key,label:l,value:e.Value}}).sort((e,l)=>l.value-e.value)]}),h(l),w(l)}},w=e=>{if(b.vertical&&b.horizontal&&b.area)return;let l={vertical:0,horizontal:1,area:0};e.forEach(e=>{let{key:t,filters:a}=e,[i]=t.split("_");void 0!==l[i]&&(l[i]=a[l[i]]),l.isManualSelection=!1}),_(l),s(l)},j=(e,l)=>{if(l){_(t=>({...t,[l]:e,isManualSelection:!0}));return}g([e]),r("all"===e.key?[]:[e])};return(0,a.jsxs)("div",{className:"flex w-full gap-2 border-b border-black pb-2 dm-filters-wrapper",children:[v.map((e,l)=>{var t,i;return(0,a.jsx)(p.Z,{sortingModes:e.filters,selectedSortingMode:e.section?null!==(t=b[e.section])&&void 0!==t?t:d:null!==(i=null==x?void 0:x.find(l=>l.key.includes(e.key)))&&void 0!==i?i:d,selectorPrefix:e.name,className:"",menuClassName:"min-w-[max-content]",togglerLabelClassName:"max-w-[180px] overflow-hidden text-ellipsis",togglerClassName:"py-[12px] px-0 pl-3 pr-2 rounded-sm dm-filters-selector",isHover:!1,isHideIcon:!0,isShowVolume:!0,onChangeSortingMode:l=>j(l,e.section),disabled:e.isDisabled},"filter_section_".concat(l))}),(0,a.jsxs)(o.zx,{variant:"clear",className:"uppercase",onClick:()=>{_({vertical:null,horizontal:null,area:null,isManualSelection:!0}
1),s({vertical:null,horizontal:null,area:null,isManualSelection:!0}),g(null)},children:["Clear ",(0,a.jsx)(c(),{className:"h-3 w-3",alt:"close",src:u.Z})]})]})},x=t(48643),g=e=>{let{leaf:l,width:t,height:i,color:n,handleClick:s,onLeafHover:o}=e,r=l.x1-l.x0,c=l.y1-l.y0;return(0,a.jsx)(a.Fragment,{children:l.data.value?(0,a.jsxs)("g",{className:"cursor-pointer",onMouseEnter:e=>{o({visible:!0,x:l.x0,y:l.y0,content:"".concat(l.data.name,": ").concat(l.data.value)})},onMouseMove:e=>{o(()=>({x:l.x0,y:l.y0}))},onMouseLeave:()=>{o({visible:!1,x:0,y:0,content:""})},onClick:()=>s(l),children:[(0,a.jsx)("rect",{x:l.x0,y:l.y0,width:r,height:c,stroke:"transparent",fill:n,className:"opacity-80 hover:opacity-100 cursor-pointer"}),(0,a.jsx)("text",{x:l.x0+8,y:l.y0+10,fontSize:16,textAnchor:"start",alignmentBaseline:"hanging",fill:"white",className:"font-bold",children:c<30||r<30?"":l.data.value}),(0,a.jsx)("text",{x:l.x0+8,y:c-15,fontSize:12,textAnchor:"start",alignmentBaseline:"hanging",fill:"white",className:"font-bold",children:c<30||r<30?"":l.data.name})]},l.id):(0,a.jsx)("text",{x:l.x0+t/2,y:l.y0+i/2,fontSize:12,textAnchor:"middle",alignmentBaseline:"middle",fill:"gray",className:"font-bold",children:"N/A"})})},b=e=>{let{width:l,height:t,data:i,color:s,onToggleModal:o}=e,r=x.bT9(i).sum(e=>
1e.value),[c,u]=(0,n.useState)({visible:!1,x:0,y:0,content:""}),d=x.pNI().size([l,t]).padding(2),m=d(r),v=e=>{o(e)},p=e=>{u(l=>({...l,...e}))},f=m.leaves().map((e,l)=>{let t=e.x1-e.x0,i=e.y1-e.y0;return(0,a.jsx)(g,{leaf:e,width:t,height:i,color:s,handleClick:v,onLeafHover:p},"custom_leaf_".concat(l))});return(0,a.jsx)("div",{children:(0,a.jsxs)("svg",{width:l,height:t,children:[f,c.visible&&(0,a.jsx)("foreignObject",{x:l/2-50,y:t/2-15,width:"200",height:"30",style:{overflow:"visible"},onMouseEnter:e=>{p(c)},children:(0,a.jsx)("div",{style:{position:"absolute",top:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"5px 10px",borderRadius:"5px",fontSize:"12px",pointerEvents:"none",width:"auto"},children:c.content})})]})})};let _=async(e,l,t,a,i)=>{try{var n;let s=["customTags:".concat(e)],[,o]=null!==(n=null==t?void 0:t.key.split("_"))&&void 0!==n?n:["","watches"];(null==t?void 0:t.filters)&&(s=[...s]);let r=l.map(e=>{let l={filters:[...s],query:"customTags:".concat(e.Key),workspaceId:i[o],startDateTime:a.startDateTime,endDateTime:a.endDateTime,type:"ct_author_",fields:["customTags"]};return(0,f.YO)(l)}),c=await Promise.allSettled(r),u=c.reduce((e,l)=>"fulfilled"===l.status&&Array.isArray(l.value)?e+l.value.length:e,0);return u}catch(e){throw console.error("Error loading visibility item mentions:",e),e}};var k=t(6162),T=t.n(k),w=t(44908),j=t.n(w);let D=[{range:[70,100],color:"#D49E64"},{range:[40,70],color:"#967651"},{range:[10,40],color:"#685743"},{range:[0,10],color:"#49433a"}];var N=e=>{let{selectedItems:l,companyDetails:t,verticalAxisItem:i,horizontalAxisItem:s,areaFilter:o,dateRange:r,selectedFilters:c,sectionsVolumes:u,sectionsCount:d,externalFilters:m,isAllLoaded:v,onShowItemsView:p,onSectionLoaded:h}=e,x=(0,n.useRef)(null),[g,k]=(0,n.useState)({width:0,height:0}),[w,N]=(0,n.useState)({type:"node",name:"boss",value:0,children:null}),E=(0,n.useMemo)(()=>{var e,l,t;if(u.length!==d)return"#49433a";let a=T()(u),i=null===(e=w.children)||void 0===e?void 0:e.reduce((e,l)=>e+l.value,0),n=i&&a?Number((i/a*100).toFixed(0)):0;return null!==(t=null===(l=D.find(e=>n>=e.range[0]&&n<=e.range[1]))||void 0===l?void 0:l.color)&&void 0!==t?t:"#49433a"},[w,u]);(0,n.useEffect)(()=>{if(x.current){let{offsetWidth:e,offsetHeight:l}=x.current;k({width:e,height:l})}},[]),(0,n.useEffect)(()=>{l[t.type].length>0&&i&&s&&o&&C()},[null==i?void 0:i.key,null==i?void 0:i.volume,null==s?void 0:s.key,null==s?void 0:s.volume,null==o?void 0:o.key,null==o?void 0:o.volume,l]);let C=async()=>{var e,a,n,u;let d=null!==(e=null==o?void 0:o.key)&&void 0!==e?e:"",v=["customTags:".concat(null==o?void 0:o.key,"*")],p=[];if(h(0,!1),(null==o?void 0:o.key)&&(o.key.includes("mentions_")||(null==o?void 0:o.key.includes("visibility_")))&&(d="ct_model_",v=[]),"brands"===t.type){let e=null!==(a=l.retailers)&&void 0!==a?a:[];p=e.length>0?["customTags:(".concat(e.map(e=>e.key).join(" "),")")]:[]}else{let e=null!==(n=l.brands)&&void 0!==n?n:[];p=e.length>0?["customTags:(".concat(e.map(e=>e.key).join(" "),")")]:[]}let x=null!==(u=null==c?void 0:c.map(e=>"customTags:".concat(e.key)))&&void 0!==u?u:[],g=l[t.type].map(e=>{let l={filters:["customTags:ct_crawler_watch_retailer","customTags:ct_model_*",...p],query:"customTags:".concat(e.key),workspaceId:y.tW.retailers,startDateTime:r.startDateTime,endDateTime:r.endDateTime,type:d,fields:["customTags"],skipTranslation:!0};return(0,f.YO)(l)}),b=await Promise.all(g),_=l[t.type].map((e,l)=>{let a=b[l];if(!a||0===a.length)return Promise.resolve([]);let n=a.map(e=>e.Key),o=["customTags:(".concat(n.join(" "),")")],r=j()(["customTags:ct_i_novelties_*","customTags:ct_model_*","customTags:".concat(null==i?void 0:i.key),"customTags:".concat(null==s?void 0:s.key),...v,...x,...o,...null!=m?m:[]]),c={filters:r,query:"brands"===t.type?"customTags:".concat(e.key):"*",workspaceId:y.tW.novelties,startDateTime:y.WATCHES_DATE_RANGE.startDateTime,endDateTime:y.WATCHES_DATE_RANGE.endDateTime,type:d,fields:["customTags"],skipTranslation:!0};return(0,f.YO)(c)}),k=await Promise.all(_);if(null==o?void 0:o.key.includes("mentions_")){S(k);return}if(null==o?void 0:o.key.includes("visibility_")){A(k);return}let T=l[t.type].map((e,l)=>{let t=k[l];return{type:"leaf",key:e.key,value:null==t?void 0:t.length,childItems:t.map(e=>e.Key),name:e.label}}).filter(e=>e.value),w=T.reduce((e,l)=>e+l.value,0);h(w,!0),N(e=>({...e,children:T}))},S=e=>{var a,n;let u=null!==(a=null==c?void 0:c.map(e=>"customTags:".concat(e.key)))&&void 0!==a?a:[],d=null!==(n=null==o?void 0:o.key.split("_")[1])&&void 0!==n?n:"watches";(null==o?void 0:o.filters)&&(u=[...u,...null==o?void 0:o.filters]);let m=l[t.type].map((l,a)=>{var n;let o=null!==(n=e[a])&&void 0!==n?n:[];if(!o||0===o.length)return Promise.resolve({data:null,itemsCount:0});let c=(null==o?void 0:o.length)>0?["customTags:(".concat(null==o?void 0:o.map(e=>e.Key).join(" "),")")]:[],m={filters:["customTags:".concat(null==i?void 0:i.key),"customTags:".concat(null==s?void 0:s.key),...u,...c],query:"brands"===t.type?"customTags:".concat(l.key):"*",workspaceId:y.tW[d],limit:2,startDateTime:r.startDateTime,endDateTime:r.endDateTime};return(0,f.ge)(m)});Promise.all(m).then(async a=>{let i=l[t.type].map((l,t)=>{var i;let n=a[t],s=null!==(i=e[t])&&void 0!==i?i:[];return{type:"leaf",key:l.key,value:null==n?void 0:n.itemsCount,name:l.label,childItems:s.map(e=>e.Key)}}).filter(e=>e.value),n=i.reduce((e,l)=>e+l.value,0);h(n,!0),N(e=>({...e,children:i}))})},A=async e=>{var a;let i=null!==(a=null==c?void 0:c.map(e=>"customTags:".concat(e.key)))&&void 0!==a?a:[];(null==o?void 0:o.filters)&&(i=[...i,...null==o?void 0:o.filters]);try{let a=l[t.type].map((l,t)=>{var a;let i=null!==(a=e[t])&&void 0!==a?a:[];return _(l.key,i,o,r,y.tW)}),i=await Promise.allSettled(a),n=l[t.type].map((l,t)=>{var a;let n=i[t],s=null!==(a=e[t])&&void 0!==a?a:[];return"fulfilled"===n.status?{type:"leaf",key:l.key,value:n.value,
1name:l.label,childItems:s.map(e=>e.Key)}:null}).filter(e=>e&&e.value),s=n.reduce((e,l)=>e+l.value,0);h(s,!0),N(e=>({...e,children:n}))}catch(e){console.error("Error processing selected items:",e),h(0,!0),N(e=>({...e,children:[]}))}};return(0,a.jsx)("div",{ref:x,className:"min-w-[200px] min-h-[150px]",children:g.width&&g.height&&w.children&&d&&v?(0,a.jsx)(b,{data:w,width:g.width,height:g.height,color:E,onToggleModal:e=>{var l,a;let{key:n,childItems:u}=e.data;if(null==o?void 0:o.key.includes("visibility_"))return;let d=null!==(l=null==c?void 0:c.map(e=>"customTags:".concat(e.key)))&&void 0!==l?l:[],m=null!==(a=null==o?void 0:o.key.split("_")[1])&&void 0!==a?a:"novelties";(null==o?void 0:o.filters)&&(d=[...d,...null==o?void 0:o.filters]),(null==o?void 0:o.key.includes("mentions_"))||(m="novelties");let v=[];u&&(v=(null==u?void 0:u.length)>0?["customTags:(".concat(null==u?void 0:u.join(" "),")")]:[]);let f={query:"brands"===t.type?"customTags:".concat(n):"*",dateRange:"novelties"===m?y.WATCHES_DATE_RANGE:r,filtersList:["customTags:".concat(null==i?void 0:i.key),"customTags:".concat(null==s?void 0:s.key),...d,...v],workspaceId:y.tW[m]};p&&p(f)}}):null})},E=t(15644),C=t(10254),S=t(27562),A=t(5152),z=t.n(A),M=t(41609),I=t.n(M);let R=z()(()=>Promise.all([t.e(296),t.e(9260)]).then(t.t.bind(t,69260,23)),{loadableGenerated:{webpack:()=>[69260]},ssr:!1});var W=e=>{var l;let{dateRange:t,selectedItems:i,companyDetails:s,areaFilters:o,selectedFilters:r,externalFilters:c,mode:u,session:d,isEmptyResponse:m}=e,[v,p]=(0,n.useState)({vertical:null,horizontal:null,sectionsCount:0}),[h,x]=(0,n.useState)(null),[g,b]=(0,n.useState)(!0),[_,k]=(0,n.useState)(!1),[T,w]=(0,n.useState)([]),[j,D]=(0,n.useState)({}),A=(0,n.useMemo)(()=>!I()(j)&&Object.values(j).every(e=>!0===e),[j]);(0,n.useEffect)(()=>{i.brands.length>0&&o.horizontal&&o.vertical&&o.area?z():O()},[i,o,r]),(0,n.useEffect)(()=>{h&&k(!0)},[h]),(0,n.useEffect)(()=>{A&&b(!1)},[A]);let z=async()=>{var e,l,t;w([]),D({}),b(!0);let a=null!==(t=null==r?void 0:r.map(e=>"customTags:".concat(e.key)))&&void 0!==t?t:[],i={filters:["customTags:".concat(null===(e=o.horizontal)||void 0===e?void 0:e.key,"*"),"customTags:".concat(null===(l=o.vertical)||void 0===l?void 0:l.key,"*"),"customTags:ct_i_novelties_*",...a,...null!=c?c:[]],query:"*",workspaceId:y.tW.novelties,startDateTime:y.WATCHES_DATE_RANGE.startDateTime,endDateTime:y.WATCHES_DATE_RANGE.endDateTime,type:null,fields:["customTags"]},n=await (0,f.YO)(i);if(n){let e=n.filter(e=>{var l;return e.Key.includes(null===(l=o.vertical)||void 0===l?void 0:l.key)}).slice(0,3).map(e=>{let l=e.label;if(l.includes(":")){let e=l.split(":");e.length>1&&e.shift(),l=e.join(":")}return{key:e.Key,volume:e.Value,label:l}}),l=n.filter(e=>{var l;return e.Key.includes(null===(l=o.horizontal)||void 0===l?void 0:l.key)}).slice(0,3).map(e=>{let l=e.label;if(l.includes(":")){let e=l.split(":");e.length>1&&e.shift(),l=e.join(":")}return{key:e.Key,volume:e.Value,label:l}});p({vertical:e,horizontal:l,sectionsCount:e.length*l.length})}else O()},M=e=>{x(e)},W=(e,l,t)=>{w(l=>l.length===v.sectionsCount?[e]:[...l,e]),D(e=>({...e,[t]:l}))},O=()=>{p({vertical:null,horizontal:null,sectionsCount:0})};return(0,a.jsxs)("div",{className:"lex w-full min-h-[30vh] relative dm-area-wrapper",children:[v.horizontal&&v.vertical?(0,a.jsxs)("div",{className:"flex w-full pt-2 pb-4",children:[(0,a.jsx)("div",{className:"max-h-[626px] w-full",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{className:"bg-".concat("embedded"===u?"transparent":"paperWhite"," sticky top-0"),children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"text-[#7B7B7A] w-[150px] dm-area-label"}),v.horizontal.map((e,l)=>(0,a.jsx)("td",{className:"text-[#7B7B7A] text-center dm-area-label",children:e.label},"density_map_horizontal_item_".concat(l)))]})}),(0,a.jsx)("tbody",{className:"bg-".concat("embedded"===u?"transparent":"paperWhite"),children:v.vertical.map((e,l)=>{var n;return(0,a.jsxs)("tr",{className:"text-[#7B7B7A] dm-area-label",children:[(0,a.jsx)("td",{className:"text-[#7B7B7A]dm-area-label ",children:e.label}),null===(n=v.horizontal)||void 0===n?void 0:n.map((n,u)=>(0,a.jsx)("td",{className:"text-[#7B7B7A] min-w-[200px] min-h-[150px]",style:{width:"(calc(100% / 3) - 150px)"},children:(0,a.jsx)(N,{selectedItems:i,companyDetails:s,dateRange:t,verticalAxisItem:e,horizontalAxisItem:n,areaFilter:o.area,selectedFilters:r,externalFilters:c,sectionsVolumes:T,sectionsCount:v.sectionsCount,isAllLo
1aded:A,onShowItemsView:M,onSectionLoaded:(e,t)=>W(e,t,"".concat(u,"_").concat(l))})},"density_map_haxis_".concat(u,"_item_").concat(l)))]},"density_map_vaxis_item_".concat(l))})})]})}),(0,a.jsx)(C.Z,{open:_,setOpen:e=>{k(e),x(null)},className:"lg:w-fit p-0 pb-4 overflow-hidden gap-0",children:h?(0,a.jsx)(E.Z,{...h,dateRange:null!==(l=h.dateRange)&&void 0!==l?l:t,filtersList:h.filtersList,session:d,isShowRecordsCount:!0}):null})]}):null,g&&!m?(0,a.jsx)("div",{className:"justify-center flex items-center backdrop-blur-[2px] z-10 flex-col absolute h-full w-full top-0",children:(0,a.jsx)(R,{animationData:S,loop:!0})}):null]})},O=t(17871),P=t(30381),K=t.n(P),V=e=>{let{session:l,mode:t,customDateRange:i,className:o,externalFilters:r,isSelectAllOptions:c,itemOptionsLimit:u}=e,[d,p]=(0,n.useState)({startDateTime:K()().subtract(12,"months").startOf("day").unix(),endDateTime:K()().endOf("day").unix(),periodType:"12 months",isCustom:!1}),x=(0,n.useMemo)(()=>{var e,t,a,i,n,s,o;let r=null!==(o=null!==(s=null==l?void 0:null===(a=l.customOptions)||void 0===a?void 0:null===(t=a.itemRelatedArchiveDepth)||void 0===t?void 0:null===(e=t.find(e=>"/watches/density-map"===e.url))||void 0===e?void 0:e.maxDepth)&&void 0!==s?s:null==l?void 0:null===(n=l.customOptions)||void 0===n?void 0:null===(i=n.archiveDepth)||void 0===i?void 0:i.maxDepth)&&void 0!==o?o:null;return r},[l]),g=[{key:"ct_brand_",type:"brands",organizationType:"brand",datalake:"novelties",isAutoselect:!0},{key:"ct_author_",type:"retailers",organizationType:"retailer",datalake:"retailers",isAutoselect:!1}
1],[b,_]=(0,n.useState)(g[0]),[k,T]=(0,n.useState)(!1),[w,j]=(0,n.useState)({brands:[],retailers:[]}),[D,N]=(0,n.useState)({brands:[],retailers:[]}),[E,C]=(0,n.useState)({vertical:null,horizontal:null,area:null,isManualSelection:!1}),[S,A]=(0,n.useState)([]),z=(0,n.useMemo)(()=>null,[l.customOptions]);(0,n.useEffect)(()=>{M()},[z,i]);let M=async()=>{let{organizationType:e}=null!=z?z:{},l={},t={};if(T(!1),e)_(g[1]),I();else{let e=g.map(e=>{let l={filters:["customTags:ct_brand_*","customTags:ct_model_*",...null!=r?r:[]],query:"*",workspaceId:y.tW[e.datalake],startDateTime:(null!=i?i:d).startDateTime,endDateTime:(null!=i?i:d).endDateTime,type:e.key,fields:["customTags"]};return(0,f.YO)(l)});Promise.all(e).then(async e=>{let a=0;g.forEach((i,n)=>{let s=e[n],o=R(s,i.type,i.isAutoselect);l[i.type]=o.all,t[i.type]=u&&"brands"===i.type?o.all.slice(0,u):o.selected,!o.all.length&&a++}),j(l),N(t),T(a===g.length)})}},I=async()=>{let{organizationType:e,mainRetailers:l}=z,t={},a={};if("retailer"===e){let n=g.find(l=>l.organizationType===e),s={filters:["customTags:ct_brand_*","customTags:ct_model_*",...null!=r?r:[]],query:"*",workspaceId:y.tW[n.datalake],startDateTime:(null!=i?i:d).startDateTime,endDateTime:(null!=i?i:d).endDateTime,type:n.key,fields:["customTags"]},o=await (0,f.YO)(s),c=R(o,n.type,n.isAutoselect);t[n.type]=c.all,a[n.type]=c.selected;let u={filters:["customTags:(".concat(l.join(" "),")"),"customTags:ct_model_*",...null!=r?r:[]],query:"*",workspaceId:y.tW[n.datalake],startDateTime:(null!=i?i:d).startDateTime,endDateTime:(null!=i?i:d).endDateTime,type:"ct_brand_",fields:["customTags"],skipTranslation:!0},m=await (0,f.YO)(u),v="customTags:(".concat(m.map(e=>e.Key).join(" "),")"),p=g.find(e=>"brand"===e.organizationType),h={filters:[v,"customTags:ct_model_*",...null!=r?r:[]],query:"*",workspaceId:y.tW[p.datalake],startDateTime:(null!=i?i:d).startDateTime,endDateTime:(null!=i?i:d).endDateTime,type:p.key,fields:["customTags"]},x=await (0,f.YO)(h),b=R(x,p.type,p.isAutoselect);t[p.type]=b.all,a[p.type]=b.all,j(t),N(a);return}},R=(e,l,t)=>{let a={all:[],selected:[]},i=e.map(e=>{let l=e.label;if(l.includes(":")){let e=l.split(":");e.length>1&&e.shift(),l=e.join(":")}return{key:e.Key,value:e.Key,volume:e.Value,label:l,color:""}});a.all=i;let n=t?[i[0]]:[];if(z&&z["main".concat((0,O.fm)(l))]){let e=i.filter(e=>z["main".concat((0,O.fm)(l))].includes(e.key)).map(e=>({...e,color:"#033365"}));n=e}if(z&&z["competitor".concat((0,O.fm)(l))]){let e=i.filter(e=>z["competitor".concat((0,O.fm)(l))].includes(e.key)).map(e=>({...e,color:"#D49E64"}));n=[...n,...e]}return a.selected=n,a};return(0,a.jsx)("div",{className:"flex max-w-[1440px] w-full mx-auto px-8 gap-4 density-map-wrapper ".concat(null!=o?o:"dm-light"),children:(0,a.jsxs)("div",{className:"flex flex-wrap w-full mb-5 gap-4",children:[(0,a.jsxs)("div",{className:"flex w-fit mb-5 gap-4",children:["default"===t?(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"pr-1",children:"Retailers:"}),(0,a.jsx)(s.ZP,{isSearchable:!1,options:w.retailers,value:D.retailers,onChange:e=>N(l=>({...l,retailers:e})),className:"workflow-select-input min-w-[400px] w-auto",styles:{control:e=>({...e,boxShadow:"none",backgroundColor:"#EEEDEC",borderColor:"#3A3935","&:focus":{borderColor:"#a77e50"},"&:active":{borderColor:"#a77e50"},"&:hover":{borderColor:"#a77e50"}}),valueContainer:e=>({...e,fontFamily:"Montserrat",fontSize:"15px",fontStyle:"normal",fontWeight:"400",padding:"6px 8px",backgroundColor:"#EEEDEC",borderRadius:"5px"}),option:(e,l)=>{let{isFocused:t,isSelected:a}=l;return{...e,backgroundColor:a?"#a0c9f9":t?"#E9EEF1":void 0}},multiValue:(e,l)=>{let{data:t}=l;return{...e,color:t.color&&""!==t.color?"#fff":"#333",backgroundColor:t.color&&""!==t.color?t.color:"#fff"}},multiValueLabel:(e,l)=>{let{data:t}=l;return{...e,color:t.color&&""!==t.color?"#fff":"#333"}},multiValueRemove:(e,l)=>{let{data:t}=l;return{...e,padding:"5px"}}},isMulti:!0})]}):null,(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"pr-1",children:"Brands:"}),(0,a.jsx)(s.ZP,{isSearchable:!1,options:w.brands,value:D.brands,onChange:e=>N(l=>({...l,brands:e})),className:"workflow-select-input min-w-[400px] w-auto dm-items-multiselect",classNamePrefix:"dm-items",styles:{control:e=>({...e,boxShadow:"none",backgroundColor:"#EEEDEC",borderColor:"#3A3935","&:focus":{borderColor:"#a77e50"},"&:active":{borderColor:"#a77e50"},"&:hover":{borderColor:"#a77e50"}}),valueContainer:e=>({...e,fontFamily:"Montserrat",fontSize:"15px",fontStyle:"normal",fontWeight:"400",padding:"6px 8px",backgroundColor:"#EEEDEC",borderRadius:"5px"}),option:(e,l)=>{let{isFocused:t,isSelected:a}=l;return{...e,backgroundColor:a?"#a0c9f9":t?"#E9EEF1":void 0}},multiValue:(e,l)=>{let{data:t}=l;return{...e,color:t.color&&""!==t.color?"#fff":"#333",backgroundColor:t.color&&""!==t.color?t.color:"#fff"}},multiValueLabel:(e,l)=>{let{data:t}=l;return{...e,color:t.color&&""!==t.color?"#fff":"#333"}},multiValueRemove:(e,l)=>{let{data:t}=l;return{...e,padding:"5px"}}},isMulti:!0})]}),"default"===t?(0,a.jsxs)("div",{className:"flex flex-wrap items-start content-start gap-4",children:[d?(0,a.jsxs)("div",{className:"flex flex-wrap",children:[(0,a.jsx)("label",{className:"w-full",children:"Selected Period:"}),(0,a.jsx)(v.Z,{dateRange:d,availableArchiveDepth:x,dropdowTogglerClassName:"w-full",onCh
1angeDate:p})]}):null,(0,a.jsx)(m,{companyInfo:z})]}):null]}),(0,a.jsxs)("div",{className:"flex flex-wrap w-full gap-2 relative",children:[(0,a.jsx)(h,{selectedItems:D,dateRange:null!=i?i:d,externalFilters:r,onChangeAreaFilters:C,onChangeFilters:A}),(0,a.jsx)(W,{selectedItems:D,companyDetails:b,dateRange:null!=i?i:d,areaFilters:E,selectedFilters:S,externalFilters:r,mode:t,session:l,isEmptyResponse:k})]})]})})},F=!0;function B(e){let{objectID:l,global:t,session:n}=e;return(0,a.jsx)(i.Z,{global:t,session:n,children:n?(0,a.jsx)(V,{session:n,mode:"embedded"}):null})}}},function(e){e.O(0,[3662,2194,1866,5899,3867,4601,8643,9529,8402,1668,8349,9774,2888,179],function(){return e(e.s=19056)}),_N_E=e.O()}]);
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.