import{Modal as e,Button as r}from"antd";import{forwardRef as t,useState as n,useRef as a,useImperativeHandle as o,useEffect as i}from"react";import{getFileUrl as l}from"../../utils/index.js";import s from"./AliPlayer.js";import{jsx as c}from"react/jsx-runtime";const u=t(({source:t="",vid:u="",playAuth:p="",cover:d="",autoplay:m=!0,showProgress:y=!0,playTime:h=0,inline:P=!1,isLive:f=!1,width:v="100%",height:g="600px",title:w="视频",visible:x=!1,onCancel:C,onEnded:I,onTimeupdate:T,onGetPlayerInstance:j,aliPlayerProps:A={}},b)=>{const[k,E]=n(!1),G=a(null);o(b,()=>({play:()=>{G.current&&G.current.play()},pause:()=>{G.current&&G.current.pause()},getPlayerInstance:()=>G.current&&G.current.getPlayerInstance()}));const L=C?x:k,N=C||E;i(()=>{P||(L?G.current&&G.current.play():G.current&&G.current.pause())},[L,P]);const V=c(s,{ref:G,source:(()=>{if(t)return t.includes("http")||t.includes("https")?t:l()+t})(),vid:u,playAuth:p,cover:d,autoplay:m,showProgress:y,playTime:h,isLive:f,width:v,height:g,aliPlayerProps:A,onEnded:I,onTimeupdate:T,onGetPlayerInstance:j});return P?V:c(e,{open:L,width:800,title:w,footer:[c(r,{onClick:()=>N(!1),children:"关闭"},"cancel")],maskClosable:!1,onCancel:()=>N(!1),children:V})});u.displayName="Video";export{u as default};
