1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5433,72576],{45160:(e,s,t)=>{t.d(s,{E:()=>o});var a=t(95155),r=t(12115),l=t(40980);let o=(0,r.forwardRef)(({className:e,variant:s="default",size:t="md",...r},o)=>(0,a.jsx)("div",{ref:o,className:(0,l.cn)("inline-flex items-center rounded-full font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{"bg-primary text-primary-foreground hover:bg-primary/80":"default"===s,"bg-secondary text-secondary-foreground hover:bg-secondary/80":"secondary"===s,"bg-destructive text-destructive-foreground hover:bg-destructive/80":"destructive"===s,"border border-input bg-background hover:bg-accent hover:text-accent-foreground":"outline"===s,"px-2 py-1 text-xs":"sm"===t,"px-2.5 py-0.5 text-sm":"md"===t,"px-3 py-1 text-base":"lg"===t},e),...r}));o.displayName="Badge"},50195:(e,s,t)=>{t.r(s),t.d(s,{default:()=>j});var a=t(95155),r=t(12115),l=t(41853),o=t(89239),i=t(45160),c=t(88208),n=t(83843),d=t(35263),x=t(18935),m=t(21553),h=t(74374),u=t(51735),p=t(40828),g=t(1569),b=t(97241),f=t(66609),y=t(18747);let N={COVER:{label:"Cover",icon:c.A,color:"violet"},PROFILE:{label:"Profile",icon:n.A,color:"blue"},LOGO:{label:"Logo",icon:d.A,color:"emerald"},EXTERIOR:{label:"Exterior",icon:x.A,color:"amber"},INTERIOR:{label:"Interior",icon:x.A,color:"rose"},ADDITIONAL:{label:"Additional",icon:m.A,color:"gray"},FOOD_AND_DRINK:{label:"Food & Drink",icon:x.A,color:"orange"},TEAMS:{label:"Team",icon:n.A,color:"indigo"}};function j({locationId:e}){let{brandId:s}=(0,l.P)(),[t,c]=(0,r.useState)([]),[n,d]=(0,r.useState)(!0),[j,v]=(0,r.useState)(null),[w,A]=(0,r.useState)(!1),[k,E]=(0,r.useState)(null),[C,O]=(0,r.useState)(!1),[U,I]=(0,r.useState)(""),[S,D]=(0,r.useState)("ADDITIONAL"),L=(0,r.useCallback)(async()=>{if(s){d(!0),v(null);try{let t=new URLSearchParams({brandId:s});e&&t.set("locationId",e);let a=await fetch(`/api/market-intel/gbp-photos?${t}`,{headers:await (0,y.authedJsonHeaders)()}),r=await a.json();if(a.ok&&r.success)c(r.photos);else{let e="string"==typeof r.setupUrl&&r.setupUrl.startsWith("https://console.developers.google.com/")?r.setupUrl:void 0;v({message:r.error||"Failed to load photos",setupUrl:e})}}catch{v({message:"Network error"})}finally{d(!1)}}},[s,e]);(0,r.useEffect)(()=>{L()},[L]);let P=async()=>{if(s&&U.trim()){A(!0);try{let t=await fetch("/api/market-intel/gbp-photos",{method:"POST",headers:await (0,y.authedJsonHeaders)(),body:JSON.stringify({brandId:s,locationId:e,sourceUrl:U.trim(),category:S})}),a=await t.json();t.ok&&a.success?(f.toast.success("Photo uploaded to Google Business"),O(!1),I(""),L()):f.toast.error(a.error||"Upload failed")}catch{f.toast.error("Failed to upload photo")}finally{A(!1)}}},R=async e=>{if(s){E(e);try{let t=await fetch("/api/market-intel/gbp-photos",{method:"DELETE",headers:await (0,y.authedJsonHeaders)(),body:JSON.stringify({brandId:s,photoName:e})}),a=await t.json();t.ok&&a.success?(c(s=>s.filter(s=>s.name!==e)),f.toast.success("Photo deleted")):f.toast.error(a.error||"Delete failed")}catch{f.toast.error("Failed to delete photo")}finally{E(null)}}};return n?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,a.jsx)(h.A,{className:"h-5 w-5 animate-spin text-blue-400 mr-2"}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:"Loading photos..."})]}):j?(0,a.jsxs)("div",{className:"text-center py-10 bg-gray-50 rounded-xl border border-dashed border-gray-200",children:[(0,a.jsx)(u.A,{className:"h-7 w-7 mx-auto mb-2 text-amber-400"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-3 max-w-md mx-auto",children:j.message}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[j.setupUrl&&(0,a.jsx)(o.$,{size:"sm",asChild:!0,className:"text-xs",children:(0,a.jsx)("a",{href:j.setupUrl,target:"_blank",rel:"noreferrer",children:"Enable API"})}),(0,a.jsxs)(o.$,{size:"sm",variant:"outline",onClick:L,className:"text-xs",children:[(0,a.jsx)(p.A,{className:"h-3 w-3 mr-1"})," Retry"]})]})]}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(x.A,{className:"h-4 w-4 text-gray-500"}),(0,a.jsxs)("span",{className:"text-xs font-semibold text-gray-700",children:["Photos (",t.length,")"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsxs)(o.$,{size:"sm",variant:"outline",onClick:()=>O(!C),className:"h-7 text-[10px] gap-1",children:[(0,a.jsx)(g.A,{className:"h-3 w-3"})," Upload"]}),(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:L,className:"h-7 w-7 p-0",children:(0,a.jsx)(p.A,{className:"h-3 w-3"})})]})]}),C&&(0,a.jsxs)("div",{className:"bg-blue-50/50 rounded-xl border border-blue-200 p-3 space-y-2",children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-blue-700",children:"Upload Photo"}),(0,a.jsx)("input",{type:"text",placeholder:"Paste image URL...",value:U,onChange:e=>I(e.target.value),className:"w-full bg-white rounded-lg border border-blue-200 px-2.5 py-1.5 text-[11px] text-gray-800 outline-none focus:border-blue-400"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("select",{value:S,onChange:e=>D(e.target.value),className:"bg-white rounded-lg border border-blue-200 px-2 py-1 text-[10px] text-gray-700 outline-none",children:Object.entries(N).map(([e,{label:s}])=>(0,a.jsx)("option",{value:e,children:s},e))}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:()=>O(!1),className:"h-6 text-[10px]",children:"Cancel"}),(0,a.jsxs)(o.$,{size:"sm",onClick:P,disabled:w||!U.trim(),className:"h-6 text-[10px] bg-blue-500 hover:bg-blue-600 text-white",children:[w?(0,a.jsx)(h.A,{className:"h-3 w-3 animate-spin mr-1"}):(0,a.jsx)(g.A,{className:"h-3 w-3 mr-1"}),"Upload"]})]})]}),0===t.length?(0,a.jsxs)("div",{className:"text-center py-10 bg-gray-50 rounded-xl border border-dashed border-gray-200",children:[(0,a.jsx)(m.A,{className:"h-8 w-8 mx-auto mb-2 text-gray-300"}),(0,a.jsx)("p",{className:"text-xs text-gray-400",children:"No photos yet"}),(0,a.jsx)("p",{className:"text-[10px] text-gray-300 mt-1",children:"Upload photos to appear on your Google listing"})]}):(0,a.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2",children:t.map(e=>{let s=N[e.category]||N.ADDITIONAL;return(0,a.jsxs)("div",{className:"group relative rounded-xl overflow-hidden border border-gray-200 aspect-square bg-gray-100",children:[(0,a.jsx)("img",{src:e.thumbnailUrl||e.googleUrl,alt:e.description||"Business photo",className:"w-full h-full object-cover"}),(0,a.jsx)(i.E,{className:`absolute top-1.5 left-1.5 text-[8px] px-1.5 py-0 bg-${s.color}-100 text-${s.color}-700 border border-${s.color}-200`,children:s.label}),(0,a.jsx)("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:()=>R(e.name),disabled:k===e.name,className:"h-8 w-8 p-0 bg-white/90 hover:bg-red-50 text-red-600 rounded-full",children:k===e.name?(0,a.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(b.A,{className:"h-3.5 w-3.5"})})})]},e.name)})})]})}},88208:(e,s,t)=>{t.d(s,{A:()=>a});let a=(0,t(8698).A)("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]])}}]);
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.