PageSourceSearch

https://app.typehero.ai/assets/TrustSignalDetail-Br7muhXM.js

js typehero.ai collected 2026-10-05 13:10:40 UTC 64,884 bytes, 15 lines download raw bytes

vendor: 8,965 bytes, lines 1-11
1import{j as e}from"./mui-B0LTB4Xe.js";import{a as o,u as ws,h as Gt}from"./redux-DDxi_uyf.js";import{c as xr,d as fr}from"./vendor-CHWUsKI7.js";import{c as Cs,b5 as br,b6 as js,dH as yr,b7 as Sr,b8 as vr,be as Ns,b9 as wr,ba as Cr,bb as _e,bc as Ts,bd as jr,dI as Nr,bf as Tr,bg as kr,dJ as Ir,dK as Rr,a as Qe,_ as t,s as Wt,dL as ks,dM as ss,au as Pr,j as Dr,$ as _t,E as Er,h as Ot,dN as rs,af as F,ag as U,dO as ns,dP as os,aa as gt,dQ as pt,ab as as,ad as is,aq as Lr,i as Ar,dR as ls,dS as Mr,dT as Z,dU as _r,dV as Or,dW as Fr,dX as Ur,dY as Br,dZ as zr,cF as Hr,cE as Gr,d_ as Kr,d$ as $r,e0 as Wr,e1 as qr,az as ce,aA as de,aB as ue,aC as me,aD as ge,N as W,B as R,H as Xe,aE as pe,am as Is,e2 as Qr,e3 as Ft,e4 as Yr,e5 as Xr,cs as Jr,e6 as Zr,e7 as Vr,aF as en,b as tn,D as sn,o as rn,z as nn,Z as Rs,q as on,r as cs,X as ds,g as us,t as Ut,bC as an,e8 as ln}from"./index-Cbydq_EN.js";import{u as cn}from"./store-cQfmD1h3.js";import{b as ms}from"./apiError-BQxKAbu9.js";import{t as Ps,r as dn,a as un,R as Ds,n as mn}from"./recognitionColumns-CSz4Nnit.js";import{P as gs}from"./PageHeader-DTeJzJRf.js";import{D as Bt,a as zt}from"./DataListPagination-D3syWBg8.js";import{F as gn}from"./FilterPopover-CwYd4mDC.js";import{E as pn}from"./EmptyState-R2N-B3BH.js";import{L as hn}from"./link-2-DDJmZHBS.js";import"./dataListView-B0wvoDX2.js";import"./popover-Bz_uMGRQ.js";/**
2 * @license lucide-react v0.546.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const xn=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],fn=Cs("clipboard-paste",xn);/**
7 * @license lucide-react v0.546.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const bn=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],ps=Cs("message-square-quote",bn);var yn=Object.defineProperty,E=(r,s)=>yn(r,"name",{value:s,configurable:!0}),[qt,Lo]=br("Tooltip",[js]),Qt=js(),Sn="TooltipProvider",vn=700,Kt="tooltip.open",[wn,Yt]=qt(Sn),Cn=E(r=>{const{__scopeTooltip:s,delayDuration:n=vn,skipDelayDuration:d=300,disableHoverableContent:c=!1,children:u}=r,g=o.useRef(!0),l=o.useRef(!1),m=o.useRef(0);return o.useEffect(()=>{const x=m.current;return()=>window.clearTimeout(x)},[]),e.jsx(wn,{scope:s,isOpenDelayedRef:g,delayDuration:n,onOpen:o.useCallback(()=>{d<=0||(window.clearTimeout(m.current),g.current=!1)},[d]),onClose:o.useCallback(()=>{d<=0||(window.clearTimeout(m.current),m.current=window.setTimeout(()=>g.current=!0,d))},[d]),isPointerInTransitRef:l,onPointerInTransitChange:o.useCallback(x=>{l.current=x},[]),disableHoverableContent:c,children:u})},"TooltipProvider"),$t="Tooltip",[jn,Je]=qt($t),Nn=E(r=>{const{__scopeTooltip:s,children:n,open:d,defaultOpen:c,onOpenChange:u,disableHoverableContent:g,delayDuration:l}=r,m=Yt($t,r.__scopeTooltip),x=Qt(s),[f,p]=o.useState(null),[b,j]=o.useState(void 0),v=yr(),y=o.useRef(0),S=g??m.disableHoverableContent,I=l??m.delayDuration,k=o.useRef(!1),[N,P]=Sr({prop:d,defaultProp:c??!1,onChange:E(V=>{V?(m.onOpen(),document.dispatchEvent(new CustomEvent(Kt))):m.onClose(),u==null||u(V)},"onChange"),caller:$t}),A=o.useMemo(()=>N?k.current?"delayed-open":"instant-open":"closed",[N]),M=o.useCallback(()=>{window.clearTimeout(y.current),y.current=0,k.current=!1,P(!0)},[P]),q=o.useCallback(()=>{window.clearTimeout(y.current),y.current=0,P(!1)},[P]),L=o.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{k.current=!0,P(!0),y.current=0},I)},[I,P]);o.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]);const H=b??v;return e.jsx(vr,{...x,children:e.jsx(jn,{scope:s,contentId:H,setContentId:j,open:N,stateAttribute:A,trigger:f,onTriggerChange:p,onTriggerEnter:o.useCallback(()=>{m.isOpenDelayedRef.current?L():M()},[m.isOpenDelayedRef,L,M]),onTriggerLeave:o.useCallback(()=>{S?q():(window.clearTimeout(y.current),y.current=0)},[q,S]),onOpen:M,onClose:q,disableHoverableContent:S,children:n})})},"Tooltip"),hs="TooltipTrigger",Tn=o.forwardRef(E(function(s,n){const{__scopeTooltip:d,...c}=s,u=Je(hs,d),g=Yt(hs,d),l=Qt(d),m=o.useRef(null),x=Ns(n,m,u.onTriggerChange),f=o.useRef(!1),p=o.useRef(!1),b=o.useCallback(()=>f.current=!1,[]);return o.useEffect(()=>()=>document.removeEventListener("pointerup",b),[b]),e.jsx(wr,{asChild:!0,...l,children:e.jsx(Cr.button,{"aria-describedby":u.open?u.contentId:void 0,"data-state":u.stateAttribute,...c,ref:x,onPointerMove:_e(s.onPointerMove,j=>{j.pointerType!=="touch"&&!p.current&&!g.isPointerInTransitRef.current&&(u.onTriggerEnter(),p.current=!0)}),onPointerLeave:_e(s.onPointerLeave,()=>{u.onTriggerLeave(),p.current=!1}),onPointerDown:_e(s.onPointerDown,()=>{u.open&&u.onClose(),f.current=!0,document.addEventListener("pointerup",b,{once:!0})}),onFocus:_e(s.onFocus,()=>{f.current||u.onOpen()}),onBlur:_e(s.onBlur,u.onClose),onClick:_e(s.onClick,u.onClose)})})},"TooltipTrigger")),Es="TooltipPortal",[kn,In]=qt(Es,{forceMount:void 0}),Rn=E(r=>{const{__scopeTooltip:s,forceMount:n,children:d,container:c}=r,u=Je(Es,s);return e.jsx(kn,{scope:s,forceMount:n,children:e.jsx(Ts,{present:n||u.open,children:e.jsx(jr,{asChild:!0,container:c,children:d})})})},"TooltipPortal"),Ye="TooltipContent",Pn=o.forwardRef(E(function(s,n){const d=In(Ye,s.__scopeTooltip),{forceMount:c=d.forceMount,side:u="top",...g}=s,l=Je(Ye,s.__scopeTooltip);return e.jsx(Ts,{present:c||l.open,children:l.disableHoverableContent?e.jsx(Ls,{side:u,...g,ref:n}):e.jsx(Dn,{side:u,...g,ref:n})})},"TooltipContent")),Dn=o.forwardRef(E(function(s,n){const d=Je(Ye,s.__scopeTooltip),c=Yt(Ye,s.__scopeTooltip),u=o.useRef(null),g=Ns(n,u),[l,m]=o.useState(null),{trigger:x,onClose:f}=d,p=u.current,{onPointerInTransitChange:b}=c,j=o.useCallback(()=>{m(null),b(!1)},[b]),v=o.useCallback((y,S)=>{const I=y.currentTarget,k={x:y.clientX,y:y.clientY},N=As(k,I.getBoundingClientRect()),P=Ms(k,N),A=_s(S.getBoundingClientRect()),M=Fs([...P,...A]);m(M),b(!0)},[b]);return o.useEffect(()=>()=>j(),[j]),o.useEffect(()=>{if(x&&p){const y=E(I=>v(I,p),"handleTriggerLeave"),S=E(I=>v(I,x),"handleContentLeave");return x.addEventListener("pointerleave",y),p.addEventListener("pointerleave",S),()=>{x.removeEventListener("pointerleave",y),p.removeEventListener("pointerleave",S)}}},[x,p,v,j]),o.useEffect(()=>{if(l){const y=E(S=>{const I=S.target,k={x:S.clientX,y:S.clientY},N=(x==null?void 0:x.contains(I))||(p==null?void 0:p.contains(I)),P=!Os(k,l);N?j():P&&(j(),f())},"handleTrackPointerGrace");return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[x,p,l,f,j]),e.jsx(Ls,{...s,ref:g})},"TooltipContentHoverable")),En=Rr("TooltipContent"),Ls=o.forwardRef(E(function(s,n){const{__scopeTooltip:d,children:c,"aria-label":u,id:g,onEscapeKeyDown:l,onPointerDownOutside:m,...x}=s,f=Je(Ye,d),p=Qt(d),{onClose:b}=f;o.useEffect(()=>(document.addEventListener(Kt,b),()=>document.removeEventListener(Kt,b)),[b]),o.useEffect(()=>{if(f.trigger){const v=E(y=>{y.target instanceof Node&&y.target.contains(f.trigger)&&b()},"handleScroll");return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[f.trigger,b]);const{setContentId:j}=f;return Nr(()=>(j(g),()=>{j(void 0)}),[g,j]),e.jsx(Tr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:m,onFocusOutside:v=>v.preventDefault(),onDismiss:b,children:e.jsxs(kr,{"data-state":f.stateAttribute,role:u?void 0:"tooltip",id:u?void 0:f.contentId,...p,...x,ref:n,style:{...x.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[e.jsx(En,{children:c}),u?e.jsx(Ir,{id:f.contentId,role:"tooltip",children:u}):null]})})},"TooltipContentImpl"));function As(r,s){const n=Math.abs(s.top-r.y),d=Math.abs(s.bottom-r.y),c=Math.abs(s.right-r.x),u=Math.abs(s.left-r.x);switch(Math.min(n,d,c,u)){case u:return"left";case c:return"right";case n:return"top";case d:return"bottom";default:throw new Error("unreachable")}}E(As,"getExitSideFromRect");function Ms(r,s,n=5){const d=[];switch(s){case"top":d.push({x:r.x-n,y:r.y+n},{x:r.x+n,y:r.y+n});break;case"bottom":d.push({x:r.x-n,y:r.y-n},{x:r.x+n,y:r.y-n}
11);break;case"left":d.push({x:r.x+n,y:r.y-n},{x:r.x+n,y:r.y+n});break;case"right":d.push({x:r.x-n,y:r.y-n},{x:r.x-n,y:r.y+n});break}return d}E(Ms,"getPaddedExitPoints");function _s(r){const{top:s,right:n,bottom:d,left:c}=r;return[{x:c,y:s},{x:n,y:s},{x:n,y:d},{x:c,y:d}]}E(_s,"getPointsFromRect");function Os(r,s){const{x:n,y:d}=r;let c=!1;for(let u=0,g=s.length-1;u<s.length;g=u++){const l=s[u],m=s[g],x=l.x,f=l.y,p=m.x,b=m.y;f>d!=b>d&&n<(p-x)*(d-f)/(b-f)+x&&(c=!c)}return c}E(Os,"isPointInPolygon");function Fs(r){const s=r.slice();return s.sort((n,d)=>n.x<d.x?-1:n.x>d.x?1:n.y<d.y?-1:n.y>d.y?1:0),Us(s)}E(Fs,"getHull");function Us(r){if(r.length<=1)return r.slice();const s=[];for(let d=0;d<r.length;d++){const c=r[d];for(;s.length>=2;){const u=s[s.length-1],g=s[s.length-2];if((u.x-g.x)*(c.y-g.y)>=(u.y-g.y)*(c.x-g.x))s.pop();else break}s.push(c)}s.pop();const n=[];for(let d=r.length-1;d>=0;d--){const c=r[d];for(;n.length>=2;){const u=n[n.length-1],g=n[n.length-2];if((u.x-g.x)*(c.y-g.y)>=(u.y-g.y)*(c.x-g.x))n.pop();else break}n.push(c)}return n.pop(),s.length===1&&n.length===1&&s[0].x===n[0].x&&s[0].y===n[0].y?s:s.concat(n)}E(Us,"getHullPresorted");var Ln=Cn,An=Nn,Mn=Tn,_n=Rn,On=Pn;const Fn="th-suggestion-data";function xs(r,s={}){if(!(typeof BroadcastChannel>"u"))try{const n=new BroadcastChannel(Fn);n.postMessage({type:r,assetId:s.assetId??null,companyId:s.companyId??null}),n.close()}catch{}}function Un({delayDuration:r=200,...s}){return e.jsx(Ln,{delayDuration:r,children:e.jsx(An,{"data-slot":"tooltip",...s})})}function Bn({...r}){return e.jsx(Mn,{"data-slot":"tooltip-trigger",...r})}function zn({className:r,side:s="top",align:n="start",sideOffset:d=6,...c}){return e.jsx(_n,{children:e.jsx(On,{"data-slot":"tooltip-content",side:s,align:n,sideOffset:d,collisionPadding:8,className:Qe("z-50 max-w-sm rounded-md bg-foreground px-3 py-2 text-xs font-normal normal-case leading-snug tracking-normal text-background shadow-lg","[overflow-wrap:anywhere] data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",r),...c})})}const Hn=({row:r})=>{const s=String(r.description??"").trim();return s?e.jsxs(Un,{children:[e.jsx(Bn,{asChild:!0,children:e.jsx("span",{className:"line-clamp-3 cursor-help pr-5 [overflow-wrap:anywhere]",children:s})}),e.jsx(zn,{children:s})]}):e.jsx("span",{className:"block pr-5 text-sm italic text-placeholder-foreground [overflow-wrap:anywhere]",children:t("trustSignal.link.missingDescription")})},Gn=({row:r})=>{const s=String(r.url||""),n=Ps(s);return n?e.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-start gap-1 text-sm text-primary hover:underline",onClick:d=>d.stopPropagation(),children:[e.jsx(Wt,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"break-all",children:s})]}):e.jsx("span",{className:"text-sm text-muted-foreground",children:t("common.na")})},Kn=[{key:"title",header:"Title",toggleable:!1,width:"260px",wrap:!0,valueFunction:r=>r||"Untitled"},{key:"url",header:"URL",width:"300px",sortable:!1,wrap:!0,component:Gn},{key:"description",header:"Description",width:"300px",wrap:!0,component:Hn}],$n=["title","url","description"],Wn=({row:r})=>{const s=Number(r.rating||0);return s?e.jsxs("div",{className:"flex items-center gap-0.5",children:[[1,2,3,4,5].map(n=>e.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 20 20",fill:n<=s?"#F59E0B":"none",stroke:n<=s?"#F59E0B":"#D1D5DB",strokeWidth:"1.5",children:e.jsx("path",{d:ks})},n)),e.jsx("span",{className:"ml-1 text-sm tabular-nums text-muted-foreground",children:s.toFixed(1)})]}):e.jsx("span",{className:"text-sm text-muted-foreground",children:t("common.noRating")})},qn=({row:r})=>{const s=String(r.type||t("common.manual")),n=s==="TripAdvisor"?"border-[hsl(152,60%,82%)] bg-[hsl(152,60%,92%)] text-[hsl(152,60%,28%)]":s==="Google"?"border-[hsl(214,80%,83%)] bg-[hsl(214,80%,93%)] text-[hsl(214,80%,35%)]":"border-border bg-muted text-muted-foreground";return e.jsx("span",{className:`inline-block max-w-full break-words rounded border px-2 py-0.5 text-xs font-medium ${n}`,children:s})},Qn=[{key:"title",header:"Title",toggleable:!1,width:"320px",valueFunction:(r,s)=>{const n=String(r||s.text||"Review");return n.length>80?`${n.slice(0,80)}…`:n}},{key:"type",header:"Type",width:"80px",sortable:!1,wrap:!0,component:qn},{key:"locationName",header:"Location",toggleable:!1,width:"180px",wrap:!0,valueFunction:r=>r||"N/A"}
11,{key:"rating",header:"Rating",width:"160px",sortable:!1,component:Wn},{key:"createdOn",header:"Created",width:"200px",dataType:ss,format:"MM/dd/yyyy hh:mm a"},{key:"text",header:"Review Text",width:"260px",wrap:!0,valueFunction:r=>r||"—"},{key:"publishDate",header:"Publish Date",width:"200px",dataType:ss,format:"MM/dd/yyyy hh:mm a"}],Yn=["title","type","locationName","rating","createdOn"],Xn=900,Y=10,fs=r=>{const s=String(r||"").trim();return s?/^https?:\/\//i.test(s)?s:`https://${s}`:""},$=r=>String(r||"").toLowerCase(),bs=(r,s)=>{const n=Number(r.createdCount||0),d=Number(r.updatedCount||0),c=Number(r.upToDateCount||0);if(n===0&&d===0)return c>0?`${c} link${c===1?"":"s"} already up to date`:"";const u=[];return n>0&&u.push(`${n} links added`),d>0&&u.push(`${d} links updated`),`${s} links: ${u.join(", ")}`},Jn=r=>{var Vt,es;const{id:s}=xr(),n=Pr(),d=cn(a=>{var i;return(i=a.auth.user)==null?void 0:i.id}),{activeCompanyId:c,activeCompany:u}=Dr(),g=(u==null?void 0:u.label)||"",l=r??Number(s),m=Number.isFinite(l)&&l>0,[x]=fr(),f=(()=>{const a=x.get("tab");return a==="recognitions"||a==="testimonials"||a==="links"?a:"links"})(),[p,b]=o.useState(f),j=x.get("from")==="content",v=(()=>{const a=x.get("doc");if(!a)return null;const i=Number(a);return Number.isFinite(i)&&i>0?i:null})(),[y,S]=o.useState(!1),[I,k]=o.useState(null);o.useEffect(()=>{if(!j||v==null){k(null);return}let a=!1;return(async()=>{var i;try{const h=await _t(Er,v);a||k(((i=h==null?void 0:h.title)==null?void 0:i.trim())||null)}catch{a||k(null)}})(),()=>{a=!0}},[j,v]);const N=j&&!y&&p==="testimonials",P=I?t("trustSignal.testimonial.contextBanner.message",{title:I}):t("trustSignal.testimonial.contextBanner.fallback"),A=o.useCallback(()=>S(!0),[]),[M,q]=o.useState(""),[L,H]=o.useState(""),[V,X]=o.useState(!1),[w,D]=o.useState(!1),[B,G]=o.useState(!1),[ht,Oe]=o.useState(!1),[Ze,Fe]=o.useState(!1),[xt,ft]=o.useState(!1),[bt,Ve]=o.useState(null),[yt,et]=o.useState(!1),[St,tt]=o.useState(!1),[vt,wt]=o.useState(null),[Ct,Q]=o.use
11State(!1),[Ue,K]=o.useState([]),[we,ee]=o.useState(new Set),[he,te]=o.useState(new Set),[Ce,se]=o.useState(new Set),[xe,st]=o.useState([]),[je,jt]=o.useState("title"),[Ne,rt]=o.useState("asc"),[Nt,Tt]=o.useState($n),[Be,kt]=o.useState("createdOn"),[ze,nt]=o.useState("desc"),[It,Rt]=o.useState(Yn),[He,Pt]=o.useState("createdOn"),[Ge,ot]=o.useState("desc"),[Dt,Et]=o.useState(dn),[Te,re]=o.useState(1),[ke,ne]=o.useState(1),[Ie,oe]=o.useState(1);o.useEffect(()=>{if(M===""){H(""),X(!1);return}X(!0);const a=window.setTimeout(()=>{H(M),X(!1)},Xn);return()=>window.clearTimeout(a)},[M]);const fe=Ot({queryKey:["v2","trust-signal",l,"asset"],queryFn:()=>_t(zr,l),enabled:m,staleTime:30*1e3,gcTime:600*1e3}),Re=Ot({queryKey:["v2","trust-signal",l,"testimonials"],queryFn:()=>Hr(l),enabled:m,staleTime:30*1e3,gcTime:600*1e3}),Pe=Ot({queryKey:["v2","trust-signal",l,"recognitions"],queryFn:()=>Gr(l),enabled:m,staleTime:30*1e3,gcTime:600*1e3}),be=o.useMemo(()=>{var a;return((a=fe.data)==null?void 0:a.links)||[]},[(Vt=fe.data)==null?void 0:Vt.links]),ye=o.useMemo(()=>Re.data||[],[Re.data]),De=o.useMemo(()=>Pe.data||[],[Pe.data]),Ee=o.useMemo(()=>{if(!L)return be;const a=L.toLowerCase();return be.filter(i=>$(i.title).includes(a)||$(i.url).includes(a)||$(i.description).includes(a))},[L,be]),Le=o.useMemo(()=>{if(!L)return ye;const a=L.toLowerCase();return ye.filter(i=>$(i.locationName).includes(a)||$(i.title).includes(a)||$(i.text).includes(a)||$(i.username).includes(a))},[L,ye]),Ae=o.useMemo(()=>{const a=L.toLowerCase();return De.filter(i=>xe.length<1||xe.includes(String(i.type||""))?a?$(i.name).includes(a)||$(i.type).includes(a)||$(i.organizationSource).includes(a)||$(i.description).includes(a):!0:!1)},[L,De,xe]),Se=(a,i,h)=>i?[...a].sort((C,_)=>{const mt=String(C[i]??"").toLowerCase(),hr=String(_[i]??"").toLowerCase(),ts=mt.localeCompare(hr);return h==="desc"?-ts:ts}):a,ae=o.useMemo(()=>Se(Ee,je,Ne),[Ee,je,Ne]),O=o.useMemo(()=>Se(Le,Be,ze),[Le,Be,ze]),ie=o.useMemo(()=>Se(Ae,He,Ge),[Ae,He,Ge]),at=o.useMemo(()=>ae.slice((Te-1)*Y,Te*Y),[ae,Te]),it=o.useMemo(()=>O.slice((ke-1)*Y,ke*Y),[O,ke]),lt=o.useMemo(()=>ie.slice((Ie-1)*Y,Ie*Y),[ie,Ie]),le=p==="links"?we:p==="testimonials"?he:Ce,Ke=le.size,ct=p==="links"?at:p==="testimonials"?it:lt,z=o.useMemo(()=>ct.map(a=>Number(a.id)).filter(a=>Number.isFinite(a)),[ct]),J=z.length>0&&z.every(a=>le.has(a)),Lt=z.some(a=>le.has(a)),dt=Math.ceil(ae.length/Y),ut=Math.ceil(O.length/Y),Me=Math.ceil(ie.length/Y),T=o.useCallback(a=>{re(1),jt(i=>i===a?(rt(h=>h==="asc"?"desc":"asc"),i):(rt("asc"),a))},[]),$e=o.useCallback(a=>{ne(1),kt(i=>i===a?(nt(h=>h==="asc"?"desc":"asc"),i):(nt("asc"),a))},[]),At=o.useCallback(a=>{oe(1),Pt(i=>i===a?(ot(h=>h==="asc"?"desc":"asc"),i):(ot("asc"),a))},[]),Bs=o.useCallback((a,i)=>{Tt(h=>{const C=i?[...new Set([...h,a])]:h.filter(_=>_!==a);return C.length>0?C:h})},[]),zs=o.useCallback((a,i)=>{Rt(h=>{const C=i?[...new Set([...h,a])]:h.filter(_=>_!==a);return C.length>0?C:h})},[]),Hs=o.useCallback((a,i)=>{Et(h=>{const C=i?[...new Set([...h,a])]:h.filter(_=>_!==a);return C.length>0?C:h})},[]),We=()=>n.invalidateQueries({queryKey:["v2","trust-signal",l,"asset"]}),qe=()=>(xs("testimonials-updated",{assetId:l}),n.invalidateQueries({queryKey:["v2","trust-signal",l,"testimonials"]})),ve=()=>(xs("recognitions-updated",{assetId:l}),n.invalidateQueries({queryKey:["v2","trust-signal",l,"recognitions"]})),Gs=o.useCallback(async a=>{if(m)try{await rs(l,Number(a.id)),F(t("trustSignal.toasts.linkDeleteSuccess")),We()}catch{U(t("trustSignal.toasts.linkDeleteFailure"))}},[l,m]),Ks=o.useCallback(async a=>{if(m)try{await ns(l,Number(a.id)),F(t("trustSignal.toasts.testimonialDeleteSuccess")),qe()}catch{U(t("trustSignal.toasts.testimonialDeleteFailure"))}},[l,m]),$s=o.useCallback(async a=>{if(m)try{await os(l,Number(a.id)),F(t("trustSignal.toasts.recognitionDeleteSuccess")),ve()}catch{U(t("trustSignal.toasts.recognitionDeleteFailure"))}},[l,m]),Ws=o.useCallback(()=>{if(p==="links"){ee(a=>{if(J){const h=new Set(a);return z.forEach(C=>h.delete(C)),h}const i=new Set(a);return z.forEach(h=>i.add(h)),i});return}if(p==="testimonials"){te(a=>
11{if(J){const h=new Set(a);return z.forEach(C=>h.delete(C)),h}const i=new Set(a);return z.forEach(h=>i.add(h)),i});return}se(a=>{if(J){const h=new Set(a);return z.forEach(C=>h.delete(C)),h}const i=new Set(a);return z.forEach(h=>i.add(h)),i})},[p,J,z]),qs=o.useCallback(a=>{const i=Number(a.id);if(Number.isFinite(i)){if(p==="links"){ee(h=>{const C=new Set(h);return C.has(i)?C.delete(i):C.add(i),C});return}if(p==="testimonials"){te(h=>{const C=new Set(h);return C.has(i)?C.delete(i):C.add(i),C});return}se(h=>{const C=new Set(h);return C.has(i)?C.delete(i):C.add(i),C})}},[p]),Qs=o.useCallback(()=>{p==="links"?ee(new Set):p==="testimonials"?te(new Set):se(new Set)},[p]),Ys=o.useCallback(async()=>{if(!(!m||Ke===0)){if(p==="links"){try{await Promise.all(Array.from(we).map(a=>rs(l,a))),F(t("trustSignal.toasts.linkBulkDeleteSuccess",{count:String(we.size)})),ee(new Set),We()}catch{U(t("trustSignal.toasts.linkBulkDeleteFailure"))}return}if(p==="testimonials"){try{await Promise.all(Array.from(he).map(a=>ns(l,a))),F(t("trustSignal.toasts.testimonialBulkDeleteSuccess",{count:String(he.size)})),te(new Set),qe()}catch{U(t("trustSignal.toasts.testimonialBulkDeleteFailure"))}return}try{await Promise.all(Array.from(Ce).map(a=>os(l,a))),F(t("trustSignal.toasts.recognitionBulkDeleteSuccess",{count:String(Ce.size)})),se(new Set),ve()}catch{U(t("trustSignal.toasts.recognitionBulkDeleteFailure"))}}},[p,l,m,We,ve,qe,Ke,we,Ce,he]),Xt=gt.hasEntityPermission(String(pt.ENTITY_NAME_LINK),as),Jt=gt.hasEntityPermission(String(pt.ENTITY_NAME_LINK),is),Xs=gt.hasEntityPermission(String(pt.ENTITY_NAME_TESTIMONIAL),as),Js=gt.hasEntityPermission(String(pt.ENTITY_NAME_TESTIMONIAL),is),Zt=Xt,Zs=Jt,Vs=Zt,Mt=a=>{K(i=>[...i,{message:String(a.message||"")}])},er=async a=>{if(m){Q(!0),K([{message:"Processing links..."}
11]);try{const i=await Br(l,a,Mt),h=bs(i,"Processed");h?Number(i.createdCount||0)===0&&Number(i.updatedCount||0)===0?Z(h):F(h):Z(t("trustSignal.toasts.noNewLinks")),D(!1),We()}catch(i){U(i.message||t("trustSignal.toasts.addLinksFailed"))}finally{Q(!1),K([])}}},tr=a=>{const i=bs(a,"Imported");i?Number(a.createdCount||0)===0&&Number(a.updatedCount||0)===0?Z(i):F(i):Z(t("trustSignal.toasts.noNewLinksPage")),G(!1),We()},sr=async a=>{if(m){et(!1),Q(!0),K([{message:"Importing testimonials..."}]);try{const h=(await Ur(l,a,Mt)).data||{},C=String(h.message||"Testimonials imported successfully.");Number(h.newCount||0)===0&&(Number(h.duplicateCount||0)>0||Number(h.excludedCount||0)>0)?Z(C):F(C),qe()}catch(i){U(ms(i,t("trustSignal.toasts.testimonialImportFailure")))}finally{Q(!1),K([])}}},rr=async a=>{if(m){tt(!1),Q(!0),K([{message:"Importing Google reviews..."}]);try{const h=(await Fr(l,a,Mt)).data||{},C=String(h.message||"Google reviews imported successfully.");Number(h.newCount||0)===0&&(Number(h.duplicateCount||0)>0||Number(h.excludedCount||0)>0)?Z(C):F(C),qe()}catch(i){U(ms(i,t("trustSignal.toasts.googleReviewImportFailure")))}finally{Q(!1),K([])}}},nr=async a=>{if(m)try{await ls(l,a),F(t("trustSignal.toasts.recognitionCreateSuccess")),ve()}catch(i){throw U(i.message||t("trustSignal.toasts.recognitionCreateFailure")),i}},or=o.useCallback(a=>{Ve(a),Fe(!0)},[]),ar=async(a,i)=>{if(m)try{await Or(l,a,i),F(t("trustSignal.toasts.recognitionUpdateSuccess")),ve()}catch(h){throw U(h.message||t("trustSignal.toasts.recognitionUpdateFailure")),h}},ir=async a=>{if(m){Q(!0),K([{message:t("trustSignal.recognition.import.loading")}]);try{const i=await _r(l,a),h=Number(i.createdCount||0),C=Number(i.duplicateCount||0);h>0?F(t("trustSignal.toasts.recognitionImportSuccess",{count:String(h)})):C>0?Z(t("trustSignal.toasts.recognitionImportNoNew")):Z(t("trustSignal.toasts.recognitionImportEmpty")),ve()}catch(i){throw U(i.message||t("trustSignal.toasts.recognitionImportFailure")),i}finally{Q(!1),K([])}}},lr=o.useCallback(async()=>{if(!c)return"";try{const a=await _t(Lr,Number(c));return String((a==null?void 0:a.website)||"").trim()}catch{return""}},[c]),cr=async(a,i)=>{if(!m)return[];try{const h=await Mr(l,{companyName:a,website:i});return h.length||Z(t("trustSignal.toasts.recognitionDiscoverEmpty")),h}catch{return U(t("trustSignal.toasts.recognitionDiscoverFailure")),[]}},dr=async a=>{if(!(!m||a.length<1))try{await Promise.all(a.map(i=>ls(l,i))),F(t("trustSignal.toasts.recognitionSaveSelectedSuccess",{count:String(a.length)})),ve()}catch(i){throw U(t("trustSignal.toasts.recognitionSaveSelectedFailure")),i}},ur=()=>{q(""),H(""),X(!1),st([]),re(1),ne(1),oe(1)};o.useEffect(()=>{re(1),ne(1),oe(1)},[L,xe]),o.useEffect(()=>{re(1),ne(1),oe(1)},[p]),o.useEffect(()=>{p==="links"?(se(new Set),te(new Set)):p==="testimonials"?(ee(new Set),se(new Set)):(ee(new Set),te(new Set))},[p]);const mr=fe.isLoading||p==="testimonials"&&Re.isLoading||p==="recognitions"&&Pe.isLoading,gr=Ue.length>0?((es=Ue[Ue.length-1])==null?void 0:es.message)||"":p==="links"?"Processing links...":p==="testimonials"?"Importing testimonials...":t("trustSignal.recognition.import.loading"),pr=async a=>{var i,h,C;if(a.url){window.open(fs(a.url),"_blank","noopener,noreferrer");return}if(!(!a.id||!m))try{const _=await Ar(`asset/${l}/testimonials/${a.id}`,null,"get",!0),mt=((h=(i=_==null?void 0:_.data)==null?void 0:i.item)==null?void 0:h.url)||((C=_==null?void 0:_.item)==null?void 0:C.url);mt&&window.open(fs(mt),"_blank","noopener,noreferrer")}catch{}};return{assetId:l,asset:fe.data,activeTab:p,setActiveTab:b,showContentContextBanner:N,contentContextMessage:P,dismissContentContextBanner:A,searchQuery:M,setSearchQuery:q,clearSearch:ur,isSearching:V,isLoading:mr,paginatedLinks:at,paginatedTestimonials:it,paginatedRecognitions:lt,linkTotalRecords:ae.length,testimonialTotalRecords:O.length,recognitionTotalRecords:ie.length,isPasteUrlsOpen:w,setIsPasteUrlsOpen:D,isWebsiteImportOpen:B,setIsWebsiteImportOpen:G,isRecognitionImportOpen:ht,setIsRecognitionImportOpen:Oe,isAddRecognitionOpen:Ze,setIsAddRecognitionOpen:Fe,isLoadRecognitionsOpen:xt,setIsLoadRecognitionsOpen:ft,editingRecognition:bt,setEditingRecognition:Ve,isTripAdvisorOpen:yt,setIsTripAdvisorOpen:et,isGoogleOpen:St,setIsGoogleOpen:tt,selectedTestimonial:vt,setSelectedTestimonial:wt,handlePasteUrls:er,handleWebsiteImportSuccess:tr,handleTripAdvisorConnect:sr,handleGoogleConnect:rr,handleCreateRecognition:nr,handleEditRecognition:or,handleUpdateRecognition:ar,handleImportRecognitions:ir,handleDiscoverRecognitions:cr,handleSaveSelectedRecognitions:dr,activeCompanyName:g,resolve
11CompanyWebsite:lr,isImporting:Ct,currentProgressMessage:gr,canCreateLinks:Xt,canDeleteLinks:Jt,canCreateTestimonials:Xs,canDeleteTestimonials:Js,canCreateRecognitions:Zt,canUpdateRecognitions:Vs,canDeleteRecognitions:Zs,recognitionTypeFilters:xe,setRecognitionTypeFilters:st,recognitionTypeOptions:Ds,userId:d,handleOpenOriginal:pr,hasError:fe.isError||Re.isError||Pe.isError,errorMessage:"Failed to load trust signal details. Please try again.",linkColumns:Kn,linkVisibleColumnKeys:Nt,linkOrderBy:je,linkSortDirection:Ne,handleLinkSort:T,handleLinkToggleColumn:Bs,handleDeleteLink:Gs,testimonialColumns:Qn,testimonialVisibleColumnKeys:It,testimonialOrderBy:Be,testimonialSortDirection:ze,handleTestimonialSort:$e,handleTestimonialToggleColumn:zs,handleDeleteTestimonial:Ks,recognitionColumns:un,recognitionVisibleColumnKeys:Dt,recognitionOrderBy:He,recognitionSortDirection:Ge,handleRecognitionSort:At,handleRecognitionToggleColumn:Hs,handleDeleteRecognition:$s,selectedIds:le,selectedCount:Ke,allCurrentPageSelected:J,someCurrentPageSelected:Lt,toggleSelectAllCurrentPage:Ws,toggleSelectRow:qs,clearSelection:Qs,handleBulkDelete:Ys,PAGE_SIZE:Y,linkCurrentPage:Te,linkTotalPages:dt,onLinkPreviousPage:()=>re(a=>Math.max(1,a-1)),onLinkNextPage:()=>re(a=>Math.min(dt,a+1)),testimonialCurrentPage:ke,testimonialTotalPages:ut,onTestimonialPreviousPage:()=>ne(a=>Math.max(1,a-1)),onTestimonialNextPage:()=>ne(a=>Math.min(ut,a+1)),recognitionCurrentPage:Ie,recognitionTotalPages:Me,onRecognitionPreviousPage:()=>oe(a=>Math.max(1,a-1)),onRecognitionNextPage:()=>oe(a=>Math.min(Me,a+1))}},Zn=({rating:r})=>{const s=Math.floor(r);return e.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[Array.from({length:5},(n,d)=>e.jsx("span",{className:d<s?"text-yellow-400":"text-gray-300",children:"★"},d)),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:r.toFixed(1)})]})},Vn=({open:r,onOpenChange:s,onConnect:n,userId:d,assetId:c})=>{const u=ws(),g=Gt(Kr),l=Gt($r),[m,x]=o.useState(""),[f,p]=o.use
11State(null),b=c?`google_places_search_${c}`:"";o.useEffect(()=>{if(r&&b){const S=localStorage.getItem(b);S&&!m&&x(S)}r||(p(null),u(Wr()))},[r,b,u]);const j=o.useCallback(()=>{m.trim()&&u(qr(m.trim()))},[u,m]),v=()=>{if(!f)return;b&&localStorage.setItem(b,m);const S=g==null?void 0:g.find(I=>I.id===f);n({placeId:f,placeName:(S==null?void 0:S.name)||m,address:(S==null?void 0:S.address)||"",searchKeyword:m,displayData:S||{name:m}})},y=()=>{b&&localStorage.removeItem(b),x(""),p(null),s(!1)};return e.jsx(ce,{open:r,onOpenChange:S=>{S||y()},children:e.jsxs(de,{className:"w-full max-w-xl rounded-xl border border-border bg-card p-0 shadow-dialog",children:[e.jsx("div",{className:"border-b border-border px-6 py-5",children:e.jsxs(ue,{className:"pr-10",children:[e.jsx(me,{className:"text-xl font-semibold text-foreground",children:t("trustSignal.google.title")}),e.jsx(ge,{className:"mt-2 text-sm text-muted-foreground",children:t("trustSignal.google.description")})]})}),e.jsxs("div",{className:"space-y-4 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-blue-200 bg-blue-50 px-3 py-2 text-xs text-blue-700",children:[e.jsx("i",{className:"bx bx-info-circle text-base"}),e.jsx("span",{children:t("trustSignal.google.info")})]}),e.jsx("div",{className:"space-y-1.5",children:e.jsx(W,{label:e.jsxs(e.Fragment,{children:[t("trustSignal.google.searchLabel"),e.jsx("span",{className:"text-destructive",children:" *"})]}),value:m,onChange:S=>{x(S.target.value),p(null)},placeholder:t("trustSignal.google.searchPlaceholder"),disabled:l,onEnterPress:j,trailingContent:e.jsx(R,{variant:"primary",size:"sm",onClick:j,disabled:!m.trim()||l,className:"!min-h-[32px] !max-h-[32px] !px-3 !text-xs",children:l?e.jsx(Xe,{className:"h-4 w-4 animate-spin text-primary-foreground","aria-hidden":"true"}):t("trustSignal.google.search")})})}),g&&g.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"block text-form-label text-v2-label",children:t("trustSignal.google.selectPlace")}),e.jsx("div",{className:"max-h-56 space-y-1.5 overflow-y-auto rounded-lg border border-border p-1.5",children:g.map(S=>e.jsxs("button",{type:"button",onClick:()=>p(S.id),className:`w-full rounded-md px-3 py-2.5 text-left transition-colors ${f===S.id?"border border-primary bg-primary/5":"border border-transparent hover:bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:S.name}),S.rating&&e.jsx(Zn,{rating:Number(S.rating)})]}),S.address?e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:S.address}):null,e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-xs text-muted-foreground",children:[S.numReviews?e.jsx("span",{children:t("trustSignal.google.reviews",{count:S.numReviews})}):null,S.types&&S.types.length>0?e.jsx("span",{children:S.types.slice(0,3).map(I=>I.replace(/_/g," ")).join(" · ")}):null]})]},S.id))})]})]}),e.jsxs(pe,{className:"border-t border-border px-6 py-4",children:[e.jsx(R,{variant:"secondary",onClick:y,children:t("kb.actions.cancel")}),e.jsx(R,{variant:"primary",onClick:v,disabled:!f,children:t("trustSignal.google.connect")})]})]})})},eo=({open:r,onOpenChange:s,onAdd:n})=>{const[d,c]=o.useState(""),u=()=>{const l=d.split(`
12`).map(m=>m.trim()).filter(m=>m.length>0);l.length>0&&(n(l),c(""),s(!1))},g=()=>{c(""),s(!1)};return e.jsx(ce,{open:r,onOpenChange:l=>{l?s(!0):g()},children:e.jsxs(de,{className:"w-full max-w-lg rounded-xl border border-border bg-card p-0 shadow-dialog",children:[e.jsx("div",{className:"border-b border-border px-6 py-5",children:e.jsxs(ue,{className:"pr-10",children:[e.jsx(me,{className:"text-xl font-semibold text-foreground",children:t("trustSignal.pasteUrls.title")}),e.jsx(ge,{className:"mt-2 text-sm text-muted-foreground",children:t("trustSignal.pasteUrls.description")})]})}),e.jsx("div",{className:"px-6 py-5",children:e.jsx(Is,{label:t("trustSignal.pasteUrls.label"),value:d,onChange:l=>c(l.target.value),placeholder:`https://example.com/
13https://example.com/menu
14https://example.com/reservations`,rows:8})}),e.jsxs(pe,{className:"border-t border-border px-6 py-4",children:[e.jsx(R,{variant:"secondary",onClick:g,children:t("kb.actions.cancel")}),e.jsx(R,{variant:"primary",onClick:u,disabled:!d.trim(),children:t("trustSignal.pasteUrls.addLinks")})]})]})})},to=({mode:r,onModeChange:s,url:n,onUrlChange:d,companyName:c,onCompanyNameChange:u})=>{const g=(l,m)=>e.jsx(R,{variant:r===l?"primary":"secondary",size:"sm",onClick:()=>s(l),className:Qe(r===l&&"pointer-events-none"),children:m},l);return e.jsxs("div",{className:"mt-5 rounded-lg border border-border bg-muted/10 p-4 sm:p-5",children:[e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t("trustSignal.tripadvisor.direct.description")}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[g("url",t("trustSignal.tripadvisor.direct.byUrl")),g("name",t("trustSignal.tripadvisor.direct.byName"))]}),e.jsx("div",{className:"mt-4",children:r==="url"?e.jsx(W,{label:t("trustSignal.tripadvisor.direct.urlLabel"),placeholder:t("trustSignal.tripadvisor.direct.urlPlaceholder"),value:n,onChange:l=>d(l.target.value),"data-testid":"tripadvisor-direct-url"}):e.jsx(W,{label:t("trustSignal.tripadvisor.direct.nameLabel"),placeholder:t("trustSignal.tripadvisor.direct.namePlaceholder"),value:c,onChange:l=>u(l.target.value),"data-testid":"tripadvisor-direct-name"})}),e.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:r==="url"?t("trustSignal.tripadvisor.direct.urlHint"):t("trustSignal.tripadvisor.direct.nameHint")})]})},so=["tripadvisor.com","tripadvisor.ca","tripadvisor.co.uk","tripadvisor.ie","tripadvisor.com.au","tripadvisor.co.nz","tripadvisor.in","tripadvisor.co.id","tripadvisor.com.sg","tripadvisor.com.my","tripadvisor.com.ph","tripadvisor.com.vn","tripadvisor.com.hk","tripadvisor.cn","tripadvisor.jp","tripadvisor.co.kr","tripadvisor.de","tripadvisor.fr","tripadvisor.es","tripadvisor.it","tripadvisor.nl","tripadvisor.be","tripadvisor.at","tripadvisor.ch","tripadvisor.dk","tripadvisor.se","tripadvisor.fi","tripadvisor.no","tripadvisor.pt","tripadvisor.gr","tripadvisor.pl","tripadvisor.cz","tripadvisor.ru","tripadvisor.com.tr","tripadvisor.co.il","tripadvisor.ae","tripadvisor.com.br","tripadvisor.com.ar","tripadvisor.com.mx","tripadvisor.cl","tripadvisor.co.za","tripadvisor.com.pe","tripadvisor.com.eg"],ro=r=>{const s=String(r??"").trim();if(!s)return!1;let n;try{n=new URL(s)}catch{return!1}if(n.protocol!=="http:"&&n.protocol!=="https:"||n.pathname==="/"||n.pathname==="")return!1;const d=n.hostname.toLowerCase().replace(/\.$/,"");return so.some(c=>d===c||d.endsWith(`.${c}`))},no=(r,s,n)=>r==="url"?ro(s):String(n??"").trim().length>1,oo=(r,s,n)=>r==="url"?{tripadvisorUrl:String(s??"").trim()}:{companyName:String(n??"").trim()},ao=({open:r,searchTerm:s})=>
14{const[n,d]=o.useState("url"),[c,u]=o.useState(""),[g,l]=o.useState(""),[m,x]=o.useState(!1);o.useEffect(()=>{r||(d("url"),u(""),l(""),x(!1))},[r]),o.useEffect(()=>{!m&&s&&s!==g&&l(s)},[s,g,m]);const f=o.useCallback(b=>{x(!0),l(b)},[]),p=o.useCallback(()=>oo(n,c,g),[n,c,g]);return{mode:n,setMode:d,url:c,setUrl:u,companyName:g,setCompanyName:f,isValid:no(n,c,g),buildLocationData:p}},io=({open:r,onOpenChange:s,onConnect:n,userId:d,assetId:c,currentLocationId:u})=>{const g=ws(),l=Gt(Qr),[m,x]=o.useState({articleTypeId:Ft,tripadvisorCategory:"all",source:"",locationId:null,metadata:{}}),f=c?`tripadvisor_category_${c}`:"",p=c?`tripadvisor_search_${c}`:"",b=ao({open:r,searchTerm:m.source}),j=o.useCallback(()=>{if(!f||!p)return;const N=localStorage.getItem(f),P=localStorage.getItem(p);(N||P)&&x({articleTypeId:Ft,tripadvisorCategory:N||"all",source:P||"",locationId:null,metadata:{}})},[f,p]);o.useEffect(()=>{r?j():(x(N=>({...N,locationId:null,metadata:{}})),g(Yr()))},[r,j,g]);const v=()=>{if(!m.locationId){if(!b.isValid)return;n({...b.buildLocationData(),searchKeyword:m.source});return}f&&p&&(localStorage.setItem(f,m.tripadvisorCategory),localStorage.setItem(p,m.source));const N=l==null?void 0:l.find(P=>P.id===m.locationId);n({locationId:m.locationId,locationName:(N==null?void 0:N.name)||m.source,category:m.tripadvisorCategory||"all",searchKeyword:m.source,displayData:N||{name:m.source}})},y=()=>{f&&p&&(localStorage.removeItem(f),localStorage.removeItem(p)),x({articleTypeId:Ft,tripadvisorCategory:"all",source:"",locationId:null,metadata:{}}),s(!1)},S=(N,P)=>{x(A=>({...A,[N]:P}))},I=(N,P)=>{x(A=>({...A,[P]:N}))},k=!!m.locationId||b.isValid;return e.jsx(ce,{open:r,onOpenChange:N=>{N||y()},children:e.jsxs(de,{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-0 shadow-dialog",children:[e.jsx("div",{className:"border-b border-border px-7 py-4",children:e.jsxs(ue,{className:"pr-10",children:[e.jsx(me,{className:"text-xl font-semibold text-foreground",children:t("trustSignal.tripadvisor.title")}),e.jsx(ge,{className:"mt-2.5 text-sm leading-6 text-muted-foreground",children:t("trustSignal.tripadvisor.description")})]})}),e.jsxs("div",{className:"px-7 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-blue-200 bg-blue-50 px-4 py-3 text-[13px] leading-5 text-blue-700",children:[e.jsx("i",{className:"bx bx-info-circle text-[18px]"}),e.jsx("span",{children:t("trustSignal.tripadvisor.info")})]}),e.jsx("div",{className:"mt-5 rounded-lg border border-border/60 bg-muted/10 p-4 sm:p-5 [&_.tripadvisor-category-label]:mb-2.5 [&_.tripadvisor-search-section]:!mt-0 [&_.tripadvisor-search-section]:mb-4 [&_.tripadvisor-search-section_label]:mb-2 [&_.tripadvisor-search-section_label]:block [&_.tripadvisor-results-section]:!mt-0 [&_.tripadvisor-results-section]:mb-1",children:e.jsx(Xr,{record:m,forceRecordUpdate:S,onChange:I,layoutType:"separate-label",isDisabled:!1,showPreview:!1,stickyHeader:!1,initialCategory:m.tripadvisorCategory,initialSearchTerm:m.source})}),!m.locationId&&e.jsx(to,{mode:b.mode,onModeChange:b.setMode,url:b.url,onUrlChange:b.setUrl,companyName:b.companyName,onCompanyNameChange:b.setCompanyName})]}),e.jsxs(pe,{className:"border-t border-border bg-card/95 px-7 py-4",children:[e.jsx(R,{variant:"secondary",onClick:y,children:t("kb.actions.cancel")}),e.jsx(R,{variant:"primary",onClick:v,disabled:!k,children:t("trustSignal.tripadvisor.connect")})]})]})})},lo=({open:r,onOpenChange:s,onSuccess:n,assetId:d})=>{const[c,u]=o.useState(""),[g,l]=o.useState("idle"),[m,x]=o.useState(""),[f,p]=o.use
14State(null),b=()=>{u(""),l("idle"),x(""),p(null)},j=()=>{b(),s(!1)},v=async()=>{if(c.trim()){l("loading"),x(""),p(null);try{const k=await Zr(d,c.trim(),N=>{p(N)});n(k),j()}catch(k){const N=k instanceof Error?k.message:"";N.includes("cancelled")||N.includes("not found")?j():(x(t("trustSignal.website.importFailed")),l("error"))}}},y=async()=>{if(f)try{l("cancelling"),await Vr(f)}catch{}finally{j()}else j()},S=()=>{l("idle"),x(""),p(null)},I=!(g==="loading"&&!f)&&g!=="cancelling";return e.jsx(ce,{open:r,onOpenChange:k=>{!k&&I&&y()},children:e.jsxs(de,{className:"w-full max-w-lg rounded-xl border border-border bg-card p-0 shadow-dialog",onInteractOutside:k=>{I||k.preventDefault()},onEscapeKeyDown:k=>{I||k.preventDefault()},children:[e.jsx("div",{className:"border-b border-border px-6 py-5",children:e.jsxs(ue,{className:"pr-10",children:[e.jsx(me,{className:"text-xl font-semibold text-foreground",children:t("trustSignal.website.title")}),e.jsx(ge,{className:"mt-2 text-sm text-muted-foreground",children:t("trustSignal.website.description")})]})}),e.jsxs("div",{className:"px-6 py-5",children:[g==="idle"&&e.jsx(W,{label:t("trustSignal.website.pageUrlLabel"),type:"url",value:c,onChange:k=>u(k.target.value),placeholder:"https://example.com",onEnterPress:()=>{v()},autoFocus:!0}),(g==="loading"||g==="cancelling")&&e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx(Xe,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:g==="cancelling"?t("trustSignal.website.cancelling"):t("trustSignal.website.extracting")})]}),g==="error"&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:e.jsx(Jr,{className:"h-5 w-5 text-destructive"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("trustSignal.website.extractionError")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:m})]}),e.jsx(R,{variant:"secondary",size:"sm",onClick:S,children:t("trustSignal.website.tryAgain")})]})]}),e.jsxs(pe,{className:"border-t border-border px-6 py-4",children:[g==="idle"&&e.jsxs(e.Fragment,{children:[e.jsx(R,{variant:"secondary",onClick:j,children:t("kb.actions.cancel")}),e.jsx(R,{variant:"primary",onClick:()=>{v()},disabled:!c.trim(),children:t("trustSignal.website.extract")})]}),(g==="loading"||g==="cancelling")&&e.jsx(R,{variant:"secondary",onClick:()=>{y()},disabled:g==="cancelling"||!f,children:g==="cancelling"?"...":t("kb.actions.cancel")}),g==="error"&&e.jsx(R,{variant:"secondary",onClick:j,children:t("common.close")})]})]})})},co=({open:r,onOpenChange:s,onImport:n})=>{const[d,c]=o.useState(""),[u,g]=o.useState(!1),l=()=>{c(""),g(!1),s(!1)},m=async()=>{if(!(!d.trim()||u)){g(!0);try{await n(d.trim()),l()}finally{g(!1)}}};return e.jsx(ce,{open:r,onOpenChange:x=>{if(!x&&!u){l();return}s(x)},children:e.jsxs(de,{className:"w-full max-w-lg rounded-xl border border-border bg-card p-0 shadow-dialog",children:[e.jsx("div",{className:"border-b border-border px-6 py-5",children:e.jsxs(ue,{className:"pr-10",children:[e.jsx(me,{className:"text-xl font-semibold text-foreground",children:t("trustSignal.recognition.import.title")}),e.jsx(ge,{className:"mt-2 text-sm text-muted-foreground",children:t("trustSignal.recognition.import.description")})]})}),e.jsx("div",{className:"px-6 py-5",children:u?e.jsxs("div",{className:"flex items-center justify-center gap-3 py-8 text-sm text-muted-foreground",children:[e.jsx(Xe,{className:"h-5 w-5 animate-spin"}),t("trustSignal.recognition.import.loading")]}):e.jsx(W,{label:t("trustSignal.recognition.import.urlLabel"),type:"url",value:d,onChange:x=>c(x.target.value),placeholder:t("trustSignal.recognition.import.urlPlaceholder"),onEnterPress:()=>{m()}})}),e.jsxs(pe,{className:"border-t border-border px-6 py-4",children:[e.jsx(R,{variant:"secondary",onClick:l,disabled:u,children:t("kb.actions.cancel")}),e.jsx(R,{variant:"primary",onClick:()=>{m()},disabled:u||!d.trim(),children:t("trustSignal.recognition.import.action")})]})]})})},Ht=()=>({type:"Awards",name:"",organizationSource:"",description:"",yearDate:"",sourceUrl:"",verificationUrl:"",status:"Unverified"}),uo=({open:r,onOpenChange:s,onSubmit:n,mode:d="create",initialValue:c=null})=>{const[u,g]=o.useState({...Ht()}),[l,m]=o.useState(!1),x=o.useMemo(()=>
14Ds.map(v=>({value:v,label:v})),[]),f=Ps(u.sourceUrl),p=()=>{g(Ht()),m(!1)};o.useEffect(()=>{r&&g({...Ht(),...c||{},type:mn(c==null?void 0:c.type),name:String((c==null?void 0:c.name)||""),organizationSource:String((c==null?void 0:c.organizationSource)||""),description:String((c==null?void 0:c.description)||""),yearDate:String((c==null?void 0:c.yearDate)||""),sourceUrl:String((c==null?void 0:c.sourceUrl)||"")})},[r,c]);const b=()=>{p(),s(!1)},j=async()=>{if(u.name.trim()){m(!0);try{await n({...u,name:u.name.trim(),organizationSource:u.organizationSource.trim(),description:u.description.trim(),yearDate:u.yearDate.trim(),sourceUrl:u.sourceUrl.trim()}),b()}finally{m(!1)}}};return e.jsx(ce,{open:r,onOpenChange:v=>{if(!v){b();return}s(v)},children:e.jsxs(de,{className:"w-full max-w-3xl rounded-xl border border-border bg-card p-0 shadow-dialog",children:[e.jsx("div",{className:"border-b border-border px-6 py-5",children:e.jsxs(ue,{className:"pr-10",children:[e.jsx(me,{className:"text-xl font-semibold text-foreground",children:d==="edit"?t("trustSignal.recognition.modal.editTitle"):t("trustSignal.recognition.modal.title")}),e.jsx(ge,{className:"mt-2 text-sm text-muted-foreground",children:t("trustSignal.recognition.modal.description")})]})}),e.jsxs("div",{className:"px-6 py-5",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsx(en,{label:t("trustSignal.recognition.fields.type"),value:u.type,options:x,onValueChange:v=>g(y=>({...y,type:v}))}),e.jsx(W,{label:t("trustSignal.recognition.fields.yearDate"),value:u.yearDate,onChange:v=>g(y=>({...y,yearDate:v.target.value})),placeholder:t("trustSignal.recognition.placeholders.yearDate")})]}),e.jsx("div",{className:"mt-4",children:e.jsx(W,{label:t("trustSignal.recognition.fields.name"),value:u.name,onChange:v=>g(y=>({...y,name:v.target.value})),placeholder:t("trustSignal.recognition.placeholders.name")})}),e.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsx(W,{label:t("trustSignal.recognition.fields.organizationSource"),value:u.organizationSource,onChange:v=>g(y=>({...y,organizationSource:v.target.value})),placeholder:t("trustSignal.recognition.placeholders.organizationSource")}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(W,{wrapperClassName:"min-w-0 flex-1",label:t("trustSignal.recognition.fields.sourceUrl"),value:u.sourceUrl,onChange:v=>g(y=>({...y,sourceUrl:v.target.value})),placeholder:t("trustSignal.recognition.placeholders.sourceUrl")}),f&&e.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer","aria-label":t("trustSignal.recognition.actions.openSourceUrl"),title:t("trustSignal.recognition.actions.openSourceUrl"),className:"flex h-11 shrink-0 items-center px-1 text-muted-foreground transition-colors hover:text-primary",children:e.jsx(Wt,{"aria-hidden":"true",className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx(Is,{label:t("trustSignal.recognition.fields.description"),value:u.description,onChange:v=>g(y=>({...y,description:v.target.value})),placeholder:t("trustSignal.recognition.placeholders.description"),rows:5})})]}),e.jsxs(pe,{className:"border-t border-border px-6 py-4",children:[e.jsx(R,{variant:"secondary",onClick:b,disabled:l,children:t("kb.actions.cancel")}),e.jsx(R,{variant:"primary",onClick:()=>{j()},disabled:!u.name.trim()||l,children:d==="edit"?t("trustSignal.recognition.actions.save"):t("trustSignal.recognition.actions.add")})]})]})})},mo=(r,s)=>r.filter((n,d)=>s.has(d)),ys=["trustSignal.recognition.load.steps.searching","trustSignal.recognition.load.steps.analyzing","trustSignal.recognition.load.steps.extracting"],go=1400,po=({open:r,onOpenChange:s,companyName:n,onResolveWebsite:d,onDiscover:c,onSave:u})=>
14{const[g,l]=o.useState(""),[m,x]=o.useState(!1),[f,p]=o.useState([]),[b,j]=o.useState(new Set),[v,y]=o.useState(!1),[S,I]=o.useState(0),[k,N]=o.useState(!1),[P,A]=o.useState(!1);o.useEffect(()=>{if(!v)return;I(0);const w=window.setInterval(()=>{I(D=>Math.min(D+1,ys.length-1))},go);return()=>window.clearInterval(w)},[v]),o.useEffect(()=>{if(!r){l(""),x(!1),p([]),j(new Set),y(!1),N(!1),A(!1);return}let w=!1;return x(!0),d().then(D=>{w||l(D)}).finally(()=>{w||x(!1)}),()=>{w=!0}},[r,d]);const M=!!g.trim()&&!v&&!m,q=async()=>{if(M){y(!0),j(new Set);try{const w=await c(n.trim(),g.trim());p(w),A(!0)}finally{y(!1)}}},L=w=>{j(D=>{const B=new Set(D);return B.has(w)?B.delete(w):B.add(w),B})},H=f.length>0&&b.size===f.length,V=()=>j(H?new Set:new Set(f.map((w,D)=>D))),X=async()=>{if(!(b.size<1||k)){N(!0);try{await u(mo(f,b)),s(!1)}finally{N(!1)}}};return e.jsx(ce,{open:r,onOpenChange:s,children:e.jsxs(de,{className:"w-full max-w-3xl rounded-xl border border-border bg-card p-0 shadow-dialog",children:[e.jsx("div",{className:"border-b border-border px-6 py-5",children:e.jsxs(ue,{className:"pr-10",children:[e.jsx(me,{className:"text-xl font-semibold text-foreground",children:t("trustSignal.recognition.load.title")}),e.jsx(ge,{className:"mt-2 text-sm text-muted-foreground",children:t("trustSignal.recognition.load.description")})]})}),e.jsxs("div",{className:"px-6 py-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(W,{label:t("trustSignal.recognition.load.websiteLabel"),value:g,onChange:w=>l(w.target.value),placeholder:m?t("trustSignal.recognition.load.websiteResolving"):t("trustSignal.recognition.load.websitePlaceholder"),disabled:m}),!m&&!g.trim()?e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("trustSignal.recognition.load.websiteManualHint")}):null]}),e.jsx("div",{className:"pt-[26px]",children:e.jsx(R,{variant:"primary",onClick:()=>{q()},disabled:!M,children:t("trustSignal.recognition.load.loadButton")})})]}),e.jsx("div",{className:"mt-5 max-h-80 overflow-y-auto",children:v?e.jsx("ol",{className:"flex flex-col gap-3 py-6",children:ys.map((w,D)=>{const B=D<S,G=D===S;return e.jsxs("li",{className:"flex items-center gap-3",children:[e.jsx("span",{className:Qe("flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full border",B&&"border-primary bg-primary text-primary-foreground",G&&"border-primary text-primary",!B&&!G&&"border-border text-muted-foreground"),children:B?e.jsx(tn,{className:"h-3 w-3"}):G?e.jsx(Xe,{className:"h-3 w-3 animate-spin"}):null}),e.jsx("span",{className:Qe("text-sm",B||G?"text-foreground":"text-muted-foreground"),children:t(w)})]},w)})}):P?f.length<1?e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:t("trustSignal.recognition.load.noResults")}):e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 cursor-pointer accent-primary",checked:H,onChange:V}),t("trustSignal.recognition.load.selectAll")]}),f.map((w,D)=>e.jsxs("label",{className:Qe("flex cursor-pointer items-start gap-3 rounded-md border border-border p-3 transition-colors hover:bg-accent",b.has(D)&&"border-primary bg-accent"),children:[e.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 cursor-pointer accent-primary",checked:b.has(D),onChange:()=>L(D)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:w.name}),e.jsx("span",{className:"flex-shrink-0 rounded-sm bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:w.type})]}),e.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[w.organizationSource||t("trustSignal.recognition.load.unknownSource"),w.yearDate?` · ${w.yearDate}`:""]}),w.description?e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:w.description}):null]})]},`${w.name}-${D}`))]}):e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:t("trustSignal.recognition.load.emptyHint")})})]}),e.jsxs(pe,{className:"border-t border-border px-6 py-4",children:[e.jsx(R,{variant:"secondary",onClick:()=>s(!1),disabled:k,children:t("kb.actions.cancel")}),e.jsx(R,{variant:"primary",onClick:()=>{X()},disabled:b.size<1||k,children:t("trustSignal.recognition.load.saveSelected")})]})]})})},ho=({rating:r})=>{const s=Number(r||0);return s?e.jsxs("div",{className:"flex items-center gap-0.5",children:[[1,2,3,4,5].map(n=>e.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:n<=s?"#F59E0B":"none",stroke:n<=s?"#F59E0B":"#D1D5DB",strokeWidth:"1.5",children:e.jsx("path",{d:ks})},n)),e.jsx("span",{className:"ml-1 text-sm tabular-nums text-muted-foreground",children:s.toFixed(1)})]}):e.jsx("span",{className:"text-sm text-muted-foreground",children:t("trustSignal.detail.noRating")})},xo=({type:r})=>{const s=String(r||t("common.manual")),n=s==="TripAdvisor"?"border-[hsl(152,60%,82%)] bg-[hsl(152,60%,92%)] text-[hsl(152,60%,28%)]":s==="Google"?"border-[hsl(214,80%,83%)] bg-[hsl(214,80%,93%)] text-[hsl(214,80%,35%)]":"border-border bg-muted text-muted-foreground";return e.jsx("span",{className:`inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium ${n}`,children:s})},Ss=r=>{if(!r)return t("common.na");const s=new Date(r);return Number.isNaN(s.getTime())?t("common.na"):new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(s)},fo=({testimonial:r,open:s,onClose:n,onOpenOriginal:d})=>{if(!r)return null;const c=r.type==="Google"?t("trustSignal.detail.googleReview"):r.title||t("trustSignal.detail.review");return e.jsx(ce,{open:s,onOpenChange:u=>{u||n()},children:e.jsxs(de,{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-0 shadow-dialog",children:[e.jsx("div",{className:"border-b border-border px-6 py-5",children:e.jsxs(ue,{className:"pr-10",children:[e.jsx(me,{className:"text-xl font-semibold text-foreground",children:c}),e.jsx(ge,{className:"mt-2 text-sm text-muted-foreground",children:r.locationName?t("trustSignal.detail.byWithLocation",{author:r.username||t("trustSignal.detail.anonymous"),date:Ss(r.publishDate),location:r.locationName}):t("trustSignal.detail.by",{author:r.username||t("trustSignal.detail.anonymous"),date:Ss(r.publishDate)})})]})}),e.jsxs("div",{className:"space-y-5 px-6 py-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(ho,{rating:r.rating}),e.jsx(xo,{type:r.type})]}),d&&r.url?e.jsx(R,{type:"button",variant:"secondary",size:"sm",leftIcon:e.jsx(Wt,{className:"h-4 w-4"}),onClick:()=>d(r),className:"shrink-0",children:t("common.viewOriginal")}):null]}),e.jsx("div",{className:"rounded-lg border border-border bg-background px-4 py-4",children:e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-6 text-foreground",children:r.text||t("trustSignal.detail.noReviewText")})})]}),e.jsx(pe,{className:"border-t border-border px-6 py-4",children:e.jsx(R,{variant:"secondary",onClick:n,children:t("common.close")})})]})})},vs=({onImportFromTripAdvisor:r,onImportFromGoogle:s,label:n,variant:d="primary",align:c="end"})=>e.jsxs(sn,{children:[e.jsx(rn,{asChild:!0,children:e.jsx("div",{children:e.jsxs(R,{size:"sm",variant:d,leftIcon:e.jsx(Rs,{className:"h-4 w-4"}),children:[e.jsx("span",{children:n??t("common.import")}),e.jsx(nn,{className:"ml-1 h-3.5 w-3.5"})]})})}),e.jsxs(on,{align:c,className:"w-44 border border-border bg-popover shadow-lg",children:[e.jsx(cs,{className:"cursor-pointer",onClick:r,children:t("common.fromTripAdvisor")}),e.jsx(cs,{className:"cursor-pointer",onClick:s,children:t("common.fromGoogle")})]})]}),bo=[{key:"links",label:"Internal Links",icon:e.jsx(hn,{className:"h-4 w-4"})},{key:"testimonials",label:"Testimonials",icon:e.jsx(an,{className:"h-4 w-4"})},{key:"recognitions",label:"Recognitions",icon:e.jsx(ln,{className:"h-4 w-4"})}],Ao=({assetId:r}={})=>{const{assetId:s,activeTab:n,showContentContextBanner:d,contentContextMessage:c,dismissContentContextBanner:u,setActiveTab:g,searchQuery:l,setSearchQuery:m,clearSearch:x,isSearching:f,isLoading:p,paginatedLinks:b,paginatedTestimonials:j,paginatedRecognitions:v,linkTotalRecords:y,testimonialTotalRecords:S,recognitionTotalRecords:I,isPasteUrlsOpen:k,setIsPasteUrlsOpen:N,isWebsiteImportOpen:P,setIsWebsiteImportOpen:A,isRecognitionImportOpen:M,setIsRecognitionImportOpen:q,isAddRecognitionOpen:L,setIsAddRecognitionOpen:H,isLoadRecognitionsOpen:V,setIsLoadRecognitionsOpen:X,editingRecognition:w,setEditingRecognition:D,isTripAdvisorOpen:B,setIsTripAdvisorOpen:G,isGoogleOpen:ht,setIsGoogleOpen:Oe,selectedTestimonial:Ze,setSelectedTestimonial:Fe,handlePasteUrls:xt,handleWebsiteImportSuccess:ft,handleTripAdvisorConnect:bt,handleGoogleConnect:Ve,handleCreateRecognition:yt,handleEditRecognition:et,handleUpdateRecognition:St,handleImportRecognitions:tt,handleDiscoverRecognitions:vt,handleSaveSelectedRecognitions:wt,activeCompanyName:Ct,resolve
14CompanyWebsite:Q,isImporting:Ue,currentProgressMessage:K,canCreateLinks:we,canDeleteLinks:ee,canCreateTestimonials:he,canDeleteTestimonials:te,canCreateRecognitions:Ce,canUpdateRecognitions:se,canDeleteRecognitions:xe,recognitionTypeFilters:st,setRecognitionTypeFilters:je,recognitionTypeOptions:jt,userId:Ne,handleOpenOriginal:rt,hasError:Nt,errorMessage:Tt,linkColumns:Be,linkVisibleColumnKeys:kt,linkOrderBy:ze,linkSortDirection:nt,handleLinkSort:It,handleLinkToggleColumn:Rt,handleDeleteLink:He,testimonialColumns:Pt,testimonialVisibleColumnKeys:Ge,testimonialOrderBy:ot,testimonialSortDirection:Dt,handleTestimonialSort:Et,handleTestimonialToggleColumn:Te,handleDeleteTestimonial:re,recognitionColumns:ke,recognitionVisibleColumnKeys:ne,recognitionOrderBy:Ie,recognitionSortDirection:oe,handleRecognitionSort:fe,handleRecognitionToggleColumn:Re,handleDeleteRecognition:Pe,selectedIds:be,selectedCount:ye,allCurrentPageSelected:De,someCurrentPageSelected:Ee,toggleSelectAllCurrentPage:Le,toggleSelectRow:Ae,clearSelection:Se,handleBulkDelete:ae,PAGE_SIZE:O,linkCurrentPage:ie,linkTotalPages:at,onLinkPreviousPage:it,onLinkNextPage:lt,testimonialCurrentPage:le,testimonialTotalPages:Ke,onTestimonialPreviousPage:ct,onTestimonialNextPage:z,recognitionCurrentPage:J,recognitionTotalPages:Lt,onRecognitionPreviousPage:dt,onRecognitionNextPage:ut}=Jn(r),Me=n==="testimonials"&&!p&&!f&&!l.trim()&&S===0;return Nt?e.jsxs(e.Fragment,{children:[e.jsx(gs,{title:t("trustSignal.page.title"),subheading:t("trustSignal.page.subheading"),className:"border-b-0"}),e.jsx("div",{className:"px-10 py-10 text-sm text-destructive",children:Tt})]}):e.jsxs(e.Fragment,{children:[e.jsx(gs,{title:t("trustSignal.page.title"),subheading:t("trustSignal.page.subheading"),className:"border-b-0"}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-10 pb-0",children:[d?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-card border border-solid border-border bg-muted px-4 py-3",children:[e.jsx(ps,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground",strokeWidth:1.5}),e.jsx("p",{className:"m-0 flex-1 text-sm text-foreground",children:c}),e.jsx("button",{type:"button",onClick:u,"aria-label":t("trustSignal.testimonial.contextBanner.dismiss"),className:"inline-flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-sm border-0 bg-transparent p-0 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(ds,{className:"h-4 w-4"})})]}):null,e.jsx("div",{className:"flex items-center border-x-0 border-t-0 border-b border-solid border-border",children:e.jsx("div",{className:"flex items-center gap-0",children:bo.map(T=>e.jsxs("button",{type:"button",onClick:()=>{g(T.key),x()},className:`relative flex items-center gap-1.5 px-4 py-2 text-sm font-medium transition-colors ${n===T.key?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[T.icon,T.label,n===T.key?e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] rounded-full bg-primary"}):null]},T.key))})}),Me?null:e.jsxs("div",{className:"mt-5 flex h-9 items-center gap-2",children:[e.jsx("div",{className:"w-[32%] min-w-[180px] max-w-[340px] flex-shrink-0",children:e.jsx(W,{type:"text",placeholder:n==="recognitions"?t("trustSignal.recognition.searchPlaceholder"):t("common.searchPlaceholder"),value:l,onChange:T=>m(T.target.value),icon:e.jsx(us,{className:"h-4 w-4"}),trailingContent:l?e.jsx("button",{onClick:x,className:"inline-flex h-6 w-6 items-center justify-center rounded-sm bg-transparent p-0 text-muted-foreground transition-colors hover:text-foreground",type:"button",children:e.jsx(ds,{className:"h-4 w-4"})}):null,className:"h-9 rounded-card bg-card text-sm"})}),n==="recognitions"?e.jsx(gn,{definition:{key:"recognitionType",label:t("trustSignal.recognition.filters.type"),options:jt.map(T=>({value:T,label:T})),multi:!0},selected:st,onToggle:T=>{je($e=>$e.includes(T)?$e.filter(At=>At!==T):[...$e,T])},onClear:()=>je([])}):null,e.jsxs("div",{className:"ml-auto flex flex-shrink-0 items-center gap-2",children:[n==="links"&&we?e.jsxs(e.Fragment,{children:[e.jsx(R,{size:"sm",leftIcon:e.jsx(Rs,{className:"h-4 w-4"}),onClick:()=>A(!0),children:t("common.import")}),e.jsx(R,{size:"sm",variant:"secondary",leftIcon:e.jsx(fn,{className:"h-4 w-4"}),onClick:()=>N(!0),children:t("common.pasteUrls")})]}):null,n==="testimonials"&&he&&!Me?e.jsx(vs,{onImportFromTripAdvisor:()=>G(!0),onImportFromGoogle:()=>Oe(!0)}):null,n==="recognitions"&&Ce?e.jsxs(e.Fragment,{children:[e.jsx(R,{size:"sm",variant:"secondary",leftIcon:e.jsx(us,{className:"h-4 w-4"}),onClick:()=>X(!0),children:t("trustSignal.recognition.load.action")}),e.jsx(R,{size:"sm",onClick:()=>{D(null),H(!0)},children:t("trustSignal.recognition.actions.add")})]}):null]})]}),e.jsxs("div",{className:"mt-7 flex min-h-0 flex-1 flex-col bg-card rounded-sm",children:[Ue?e.jsxs("div",{className:"mb-4 flex items-center gap-2.5 rounded-md border border-border bg-background/70 px-4 py-3 text-sm text-foreground shadow-sm",children:[e.jsx(Xe,{className:"h-4 w-4 shrink-0 animate-spin text-primary motion-reduce:animate-none","aria-hidden":"true"}),e.jsx("span",{children:K})]}):null,n==="links"?e.jsx(Bt,{columns:Be,visibleColumnKeys:kt,onToggleColumn:Rt,orderBy:ze,sortDirection:nt,onSort:It,data:b,selectableRows:!0,selectedRowIds:be,allRowsSelected:De,someRowsSelected:Ee,onToggleSelectAllRows:Le,onToggleSelectRow:Ae,selectedCount:ye,onBulkDelete:ae,onClearSelection:Se,isLoading:p||f,rowActions:ee?[{key:"delete",icon:Ut,label:t("kb.row.delete"),onClick:He,showInDropdown:!1,variant:"destructive",confirm:!0,confirmTitle:"Delete link?",confirmDescription:"This action cannot be undone. This will permanently delete the selected link."}]:void 0}):n==="testimonials"?Me?e.jsx(pn,{className:"flex flex-1 flex-col items-center justify-center py-20",icon:e.jsx(ps,{className:"h-8 w-8 text-muted-foreground",strokeWidth:1.5}),title:t("trustSignal.testimonial.empty.title"),subtitle:t("trustSignal.testimonial.empty.subtitle"),action:he?e.jsx(vs,{align:"center",label:t("trustSignal.testimonial.empty.action"),onImportFromTripAdvisor:()=>G(!0),onImportFromGoogle:()=>Oe(!0)}):null}):e.jsx(Bt,{columns:Pt,visibleColumnKeys:Ge,onToggleColumn:Te,orderBy:ot,sortDirection:Dt,onSort:Et,data:j,selectableRows:!0,selectedRowIds:be,allRowsSelected:De,someRowsSelected:Ee,onToggleSelectAllRows:Le,onToggleSelectRow:Ae,selectedCount:ye,onBulkDelete:ae,onClearSelection:Se,isLoading:p||f,onRowClick:T=>Fe(T),rowActions:te?[{key:"delete",icon:Ut,label:t("kb.row.delete"),onClick:re,showInDropdown:!1,variant:"destructive",confirm:!0,confirmTitle:"Delete testimonial?",confirmDescription:"This action cannot be undone. This will permanently delete the selected testimonial."}]:void 0}):e.jsx(Bt,{columns:ke,visibleColumnKeys:ne,onToggleColumn:Re,orderBy:Ie,sortDirection:oe,onSort:fe,data:v,selectableRows:!0,selectedRowIds:be,allRowsSelected:De,someRowsSelected:Ee,onToggleSelectAllRows:Le,onToggleSelectRow:Ae,selectedCount:ye,onBulkDelete:ae,onClearSelection:Se,isLoading:p||f,onRowClick:se?et:void 0,rowActions:[...xe?[{key:"delete",icon:Ut,label:t("kb.row.delete"),onClick:Pe,showInDropdown:!1,variant:"destructive",confirm:!0,confirmTitle:t("trustSignal.recognition.deleteTitle"),confirmDescription:t("trustSignal.recognition.deleteDescription")}]:[]]}),n==="links"&&y>
140?e.jsx(zt,{startIndex:(ie-1)*O+1,endIndex:Math.min(ie*O,y),totalRecords:y,pageSize:O,currentPage:ie,totalPages:at,onPreviousPage:it,onNextPage:lt}):null,n==="testimonials"&&S>0?e.jsx(zt,{startIndex:(le-1)*O+1,endIndex:Math.min(le*O,S),totalRecords:S,pageSize:O,currentPage:le,totalPages:Ke,onPreviousPage:ct,onNextPage:z}):null,n==="recognitions"&&I>0?e.jsx(zt,{startIndex:(J-1)*O+1,endIndex:Math.min(J*O,I),totalRecords:I,pageSize:O,currentPage:J,totalPages:Lt,onPreviousPage:dt,onNextPage:ut}):null]})]}),e.jsx(eo,{open:k,onOpenChange:N,onAdd:T=>{xt(T)}}),e.jsx(lo,{open:P,onOpenChange:A,onSuccess:ft,assetId:s}),e.jsx(co,{open:M,onOpenChange:q,onImport:T=>tt(T)}),e.jsx(po,{open:V,onOpenChange:X,companyName:Ct,onResolveWebsite:Q,onDiscover:vt,onSave:wt}),e.jsx(uo,{open:L,onOpenChange:T=>{H(T),T||D(null)},mode:w?"edit":"create",initialValue:w?{type:String(w.type||"Awards"),name:String(w.name||""),organizationSource:String(w.organizationSource||""),description:String(w.description||""),yearDate:String(w.yearDate||""),sourceUrl:String(w.sourceUrl||""),verificationUrl:String(w.verificationUrl||""),status:String(w.status||"Unverified")}:null,onSubmit:T=>w!=null&&w.id?St(Number(w.id),T):yt(T)}),e.jsx(io,{open:B,onOpenChange:G,onConnect:T=>{bt(T)},userId:Ne,assetId:s,currentLocationId:null}),e.jsx(Vn,{open:ht,onOpenChange:Oe,onConnect:T=>{Ve(T)},userId:Ne,assetId:s}),e.jsx(fo,{testimonial:Ze,open:!!Ze,onClose:()=>Fe(null),onOpenOriginal:T=>{rt(T)}})]})};export{Ao as default};
15//# sourceMappingURL=TrustSignalDetail-Br7muhXM.js.map

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.