Build 533169stable
Module 40056
2,002 characters · in 3ee4253b98e73f4f.jsDependencies
Source Raw
function(e,t,n){n.d(t,{Ay:()=>_,e9:()=>A,qd:()=>m});var i=n(627968),l=n(64700),a=n(735438),s=n(451988),r=n(964486),o=n(652896),c=n(834757),d=n(290863),u=n(954571),h=n(652215);let m={x:0,y:0},A=l.createContext({enabled:!1,zoomLevel:1,minZoom:1,maxZoom:5,setZoomLevel:()=>{},isZooming:!1,setIsZooming:()=>{},isDragging:!1,setIsDragging:()=>{},isWheeling:!1,setIsWheeling:()=>{},isSlidering:!1,setIsSlidering:()=>{},videoAspectRatio:16/9,setVideoAspectRatio:()=>{},panOffset:m,setPanOffset:()=>{},clampPanOffset:()=>m,doZoom:()=>{},wrapperRef:l.createRef()}),g=(0,a.debounce)((e,t,n)=>{let i=null,l=null;if(null!=n&&(0,o.wL)(n)){let e=(0,o.Iy)(n),t=(0,c.Ee)(e,d.A);i=t?.name??null,l=t?.id??null}u.default.track(h.HAw.VIDEO_STREAM_ZOOM_CHANGED,{zoom_level:e,method:t,share_application_name:i,share_application_id:l})},2e3),p=l.memo(function(e){let{streamKey:t,minZoom:n=1,maxZoom:o=5,children:c}=e,[d,u]=l.useState(n),[h,p]=l.useState(!1),[_,f]=l.useState(!1),[E,C]=l.useState(!1),[x,S]=l.useState(!1),[I,T]=l.useState(16/9),[v,N]=l.useState({x:0,y:0}),y=l.useRef(null),b=l.useRef(null);(0,r.l0)(()=>{b.current?.stop()});let j=l.useCallback((e,t)=>{if(null==y.current)return m;let n=t??d,i=y.current.clientWidth,l=y.current.clientHeight,s=i*(n-1)/2,r=l*(n-1)/2;return{x:(0,a.clamp)(e.x,-s,s),y:(0,a.clamp)(e.y,-r,r)}},[d]),R=l.useCallback((e,i,l)=>{let r=(0,a.clamp)(e,n,o);if(null==i||r===d)return;p(!0);let c=r/d;N(e=>j({x:(e.x-i.x)*c+i.x,y:(e.y-i.y)*c+i.y},r)),u(r),g(r,l,t),null==b.current&&(b.current=new s.Ep),b.current.start(2e3,()=>{p(!1)})},[j,o,n,t,d]),M=l.useMemo(()=>({enabled:!0,zoomLevel:d,minZoom:n,maxZoom:o,setZoomLevel:u,isZooming:h,setIsZooming:p,isDragging:_,setIsDragging:f,isWheeling:E,setIsWheeling:C,isSlidering:x,setIsSlidering:S,videoAspectRatio:I,setVideoAspectRatio:T,doZoom:R,panOffset:v,setPanOffset:N,wrapperRef:y,clampPanOffset:j}),[j,R,_,x,E,h,o,n,v,I,d]);return(0,i.jsx)(A.Provider,{value:M,children:c})});function _(e){return e.enableZoom?(0,i.jsx)(p,{...e}):e.children}}