PageSourceSearch

https://blacksheepbi.com/assets/RemoteSupport-FTgV8am3.js

js blacksheepbi.com collected 2026-09-30 08:26:53 UTC 6,356 bytes, 6 lines download raw bytes

1import{r,j as s}from"./ui-CPW3-RCR.js";import{a0 as _,l as M,m as P,o as U,aI as $,B as R,u as B,a as z,d as u,bV as H,bW as V,y as k,S as W,bX as F,I as K,L as X,bY as Y}from"./index-BraPXa8T.js";import"./supabase-B2z4OhLQ.js";import"./charts-DCB9_QAo.js";import"./vendor-CIXof4MH.js";/**
2 * @license lucide-react v0.462.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 G=_("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]),J={idle:"ממתין",connecting:"מתחבר...",connected:"מחובר",failed:"החיבור נכשל - ייתכן שהרשת חוסמת חיבור ישיר",ended:"נותק"};function Q({open:t,clientName:b,state:p,stream:m,onDisconnect:x}){const c=r.useRef(null);return r.useEffect(()=>{const i=c.current;if(i)return i.srcObject=m,m&&i.play().catch(()=>{}),()=>{i.srcObject=null}},[m]),s.jsx(M,{open:t,onOpenChange:i=>{i||x()},children:s.jsxs(P,{className:"max-w-[95vw] w-[95vw] h-[90vh] p-0 gap-0 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 border-b px-4 py-2 shrink-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs(U,{className:"text-sm truncate",children:["שיתוף מסך - ",b]}),s.jsx($,{className:"text-[11px]",children:J[p]})]}),s.jsxs(R,{size:"sm",variant:"destructive",className:"gap-1 shrink-0",onClick:x,children:[s.jsx(G,{className:"w-4 h-4","aria-hidden":!0}),"ניתוק"]})]}),s.jsx("video",{ref:c,autoPlay:!0,playsInline:!0,controls:!0,muted:!0,className:"w-full h-full bg-black object-contain"})]})})}function ae(){const{user:t,clearanceLevel:b}=B(),{clients:p,loading:m}=z(),x=b<=3,[c,i]=r.useState(""),[S,I]=r.useState(null),[g,N]=r.useState(null),f=r.useRef(null),h=r.useCallback(()=>{f.current&&(window.clearTimeout(f.current.timer),f.current=null),I(null)},[]),A=r.useCallback(e=>{const n=f.current;!n||n.requestId!==e.requestId||(h(),e.status==="approved"?(u.success(`${e.byName} אישר את החיבור`),N({requestId:e.requestId,clientUserId:e.byUserId,clientName:e.byName})):e.status==="declined"?u.error(`${e.byName} דחה את בקשת החיבור`):u.warning("הבקשה פגה - הלקוח לא הגיב בזמן"))},[h]),j=r.useRef(null),w=r.useRef(null),{presence:C,sendRequest:E,sendSignal:L,sendSessionEnded:q}=H({onResponse:A,onSignal:e=>{var n;return(n=j.current)==null?void 0:n.call(j,e)},onSessionEnded:e=>{var n;return(n=w.current)==null?void 0:n.call(w,e)},enabled:x}),l=V({role:"viewer",selfId:t==null?void 0:t.id,sendSignal:L,sendSessionEnded:q,onEnded:()=>N(null)});j.current=e=>{if(e.type==="offer"){l.acceptOffer(e.requestId,e.senderId,e.data);return}l.handleSignal(e)},w.current=()=>{l.stop(null),N(null),u.info("הלקוח סיים את שיתוף המסך")};const D=r.useCallback(()=>{l.stop("agent-disconnect"),N(null)},[l]);r.useEffect(()=>()=>h(),[h]);const O=r.useMemo(()=>{const e=new Map;for(const n of C){if(!n||n.user_id===(t==null?void 0:t.id))continue;const a=Number(n.clearance_level);if(!Number.isFinite(a)||a<5)continue;const o=n.client_ids,v=Array.isArray(o)?o:typeof o=="string"&&o?[o]:[];for(const d of v)d&&!e.has(d)&&e.set(d,{name:n.display_name,ip:n.ip||"-"})}return e},[C,t==null?void 0:t.id]),y=r.useMemo(()=>{const e=c.trim().toLowerCase(),n=(p||[]).filter(a=>a&&!a.is_archived);return e?n.filter(a=>(a.name||"").toLowerCase().includes(e)||(a.slug||"").toLowerCase().includes(e)):n},[p,c]),T=(e,n)=>{var d;if(!t)return;const a=crypto.randomUUID();if(!E({requestId:a,agentUserId:t.id,agentName:((d=t.email)==null?void 0:d.split("@")[0])||"נציג",targetClientId:e,sentAt:new Date().toISOString()})){u.error("החיבור בזמן אמת לא זמין כרגע - נסה שוב");return}I(e);const v=window.setTimeout(()=>{h(),u.warning(`אין תגובה מ-${n} - הבקשה פגה`)},Y+2e3);f.current={requestId:a,timer:v}};return x?s.jsxs("div",{className:"max-w-5xl mx-auto p-4 md:p-6 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(F,{className:"w-5 h-5 text-primary"}),s.jsx("h1",{className:"text-xl font-semibold",children:"חיבור מרחוק ללקוח"})]}),s.jsx(K,{value:c,onChange:e=>i(e.target.value),placeholder:"חיפוש לקוח","aria-label":"חיפוש לקוח",className:"max-w-xs"}),m?s.jsx("p",{className:"text-sm text-muted-foreground",children:"טוען לקוחות..."}):s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[y.map(e=>{const n=O.get(e.id),a=S===e.id;return s.jsxs(k,{className:"p-3 flex items-center gap-3",children:[s.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${n?"bg-green-500":"bg-red-500"}`,"aria-label":n?"מחובר":"לא מחובר"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:e.name}),s.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:n?`${n.name} - ${n.ip}`:"לא מחובר - IP לא זמין"})]}),s.jsx(R,{size:"sm",disabled:!n||a||S!==null,onClick:()=>T(e.id,e.name),className:"shrink-0",children:a?s.jsx(X,{className:"w-4 h-4 animate-spin"}):"התחבר"})]},e.id)}),y.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"לא נמצאו לקוחות"})]}),s.jsx(Q,{open:!!g,clientName:(g==null?void 0:g.clientName)||"",state:l.state,stream
6:l.remoteStream,onDisconnect:D})]}):s.jsx("div",{className:"max-w-2xl mx-auto p-6",children:s.jsxs(k,{className:"p-8 text-center space-y-3",children:[s.jsx(W,{className:"w-10 h-10 mx-auto text-primary"}),s.jsx("h1",{className:"text-xl font-semibold",children:"תמיכה מרחוק"}),s.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"צוות ויראלי יכול לבקש להתחבר למסך שלך כדי לעזור. הבקשה תוצג לך כחלון אישור - החיבור מתבצע רק לאחר אישור מפורש שלך, וניתן לבטל אותו בכל רגע."})]})})}export{ae as default};

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.