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