{"version":3,"file":"KMVideoPlayer.B6eaQpaf.mjs","names":["React.useRef","React.useState","Pause","Play","VolumeX","Volume2"],"sources":["https:/framerusercontent.com/modules/XmyC8nfHIlDiRwkMfVvw/q6Udnhd4J3PKLoLMZFa9/KMVideoPlayer.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{Play,Pause,Volume2,VolumeX}from\"lucide-react\";/**\n * KONICA MINOLTA ENTERPRISE VIDEO PLAYER v5\n * (Full Accessibility + Decorative Mode support)\n * @framerIntrinsicWidth 800\n * @framerIntrinsicHeight 450\n */export function KMVideoPlayer(props){const videoRef=React.useRef(null);// Stati\nconst[isPlaying,setIsPlaying]=React.useState(false);const[isMuted,setIsMuted]=React.useState(props.startMuted);const[progress,setProgress]=React.useState(0);const[currentTime,setCurrentTime]=React.useState(0);const[duration,setDuration]=React.useState(0);const[isHovered,setIsHovered]=React.useState(false);const[captionsActive,setCaptionsActive]=React.useState(false);const src=props.sourceType===\"file\"?props.videoFile:props.videoUrl;// -- LOGICA DECORATIVA (A11Y) --\n// Se è decorativo, nascondiamo tutto all'albero di accessibilità\nconst ariaHiddenValue=props.isDecorative?\"true\":undefined;const tabIndexValue=props.isDecorative?-1:0;const roleValue=props.isDecorative?\"presentation\":\"region\";// Gestione Iniziale Sottotitoli\nReact.useEffect(()=>{if(videoRef.current&&props.subtitles){const tracks=videoRef.current.textTracks;if(tracks&&tracks[0]){tracks[0].mode=\"hidden\";setCaptionsActive(false);}}},[props.subtitles]);React.useEffect(()=>{if(videoRef.current){videoRef.current.muted=props.startMuted;setIsMuted(props.startMuted);}},[props.startMuted]);// --- EVENT HANDLERS ---\nconst onPlayHandler=()=>setIsPlaying(true);const onPauseHandler=()=>setIsPlaying(false);const onVolumeChangeHandler=()=>{if(videoRef.current)setIsMuted(videoRef.current.muted);};const handleTimeUpdate=()=>{if(videoRef.current){const current=videoRef.current.currentTime;const total=videoRef.current.duration||0;setCurrentTime(current);setDuration(total);if(total>0)setProgress(current/total*100);}};const togglePlay=()=>{if(videoRef.current){if(isPlaying)videoRef.current.pause();else videoRef.current.play();}};const toggleMute=()=>{if(videoRef.current)videoRef.current.muted=!isMuted;};const handleSeek=e=>{// Se decorativo, impediamo interazione via tastiera sullo slider se per caso riceve focus\nif(props.isDecorative)return;const seekValue=parseFloat(e.target.value);if(videoRef.current&&videoRef.current.duration){const seekTime=seekValue/100*videoRef.current.duration;videoRef.current.currentTime=seekTime;setProgress(seekValue);}};const toggleCaptions=()=>{if(videoRef.current&&videoRef.current.textTracks[0]){const currentMode=videoRef.current.textTracks[0].mode;const newMode=currentMode===\"showing\"?\"hidden\":\"showing\";videoRef.current.textTracks[0].mode=newMode;setCaptionsActive(newMode===\"showing\");}};const formatTime=time=>{if(isNaN(time))return\"0:00\";const minutes=Math.floor(time/60);const seconds=Math.floor(time%60);return`${minutes}:${seconds<10?\"0\":\"\"}${seconds}`;};const handleKeyDown=e=>{// Se decorativo, ignoriamo i comandi tastiera\nif(props.isDecorative)return;if(e.key===\" \"||e.key===\"Enter\"){e.preventDefault();togglePlay();}};return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),role:roleValue,\"aria-label\":props.isDecorative?undefined:\"Video Player Konica Minolta\",\"aria-hidden\":ariaHiddenValue,children:[/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:src,style:{...videoStyle,// Se mostriamo i controlli o è decorativo, gestiamo il cursore\ncursor:props.showControls&&!props.isDecorative?\"default\":\"pointer\"},onClick:togglePlay,poster:props.poster,crossOrigin:\"anonymous\",autoPlay:props.autoplay,muted:props.startMuted,loop:props.loop,playsInline:true,tabIndex:-1,onPlay:onPlayHandler,onPause:onPauseHandler,onVolumeChange:onVolumeChangeHandler,onTimeUpdate:handleTimeUpdate,onLoadedMetadata:handleTimeUpdate,children:props.subtitles&&!props.isDecorative&&/*#__PURE__*/_jsx(\"track\",{kind:\"subtitles\",src:props.subtitles,srcLang:\"en\",label:\"English\",default:false})}),props.showControls&&!props.isDecorative&&/*#__PURE__*/_jsxs(\"div\",{style:{...controlsContainerStyle,opacity:isHovered||!isPlaying?1:0},\"aria-hidden\":ariaHiddenValue,children:[/*#__PURE__*/_jsx(\"input\",{type:\"range\",min:\"0\",max:\"100\",value:progress,onChange:handleSeek,style:sliderStyle(props.accentColor),\"aria-label\":\"Controllo scorrimento video\",tabIndex:tabIndexValue}),/*#__PURE__*/_jsxs(\"div\",{style:controlsRowStyle,children:[/*#__PURE__*/_jsxs(\"div\",{style:leftControlsStyle,children:[/*#__PURE__*/_jsx(\"button\",{onClick:togglePlay,onKeyDown:handleKeyDown,style:iconButtonStyle,\"aria-label\":isPlaying?\"Pausa\":\"Riproduci\",tabIndex:tabIndexValue,children:isPlaying?/*#__PURE__*/_jsx(Pause,{color:\"white\",size:20,fill:\"white\"}):/*#__PURE__*/_jsx(Play,{color:\"white\",size:20,fill:\"white\"})}),/*#__PURE__*/_jsxs(\"span\",{style:timeStyle,children:[formatTime(currentTime),\" /\",\" \",formatTime(duration)]})]}),/*#__PURE__*/_jsxs(\"div\",{style:rightControlsStyle,children:[props.logo&&/*#__PURE__*/_jsx(\"img\",{src:props.logo,alt:\"Konica Minolta Logo\",style:logoStyle}),!props.logo&&/*#__PURE__*/_jsx(\"span\",{style:textLogoStyle,children:\"KONICA MINOLTA\"}),props.subtitles&&/*#__PURE__*/_jsx(\"button\",{onClick:toggleCaptions,style:iconButtonStyle,\"aria-label\":captionsActive?\"Disattiva sottotitoli\":\"Attiva sottotitoli\",title:\"Sottotitoli\",tabIndex:tabIndexValue,children:/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:captionsActive?props.accentColor:\"white\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"rect\",{x:\"2\",y:\"4\",width:\"20\",height:\"16\",rx:\"2\",ry:\"2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M7 15h2c1 0 2-.9 2-2v-2c0-1.1-1-2-2-2H7\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M17 15h2c1 0 2-.9 2-2v-2c0-1.1-1-2-2-2h-2\"})]})}),/*#__PURE__*/_jsx(\"button\",{onClick:toggleMute,style:iconButtonStyle,\"aria-label\":isMuted?\"Attiva audio\":\"Disattiva audio\",tabIndex:tabIndexValue,children:isMuted?/*#__PURE__*/_jsx(VolumeX,{color:\"white\",size:20}):/*#__PURE__*/_jsx(Volume2,{color:\"white\",size:20})})]})]})]})]});}// --- Stili CSS-in-JS ---\nconst containerStyle={width:\"100%\",height:\"100%\",backgroundColor:\"#000\",position:\"relative\",overflow:\"hidden\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\"};const videoStyle={width:\"100%\",height:\"100%\",objectFit:\"cover\"};const controlsContainerStyle={position:\"absolute\",bottom:0,left:0,right:0,background:\"linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0))\",padding:\"0px 0px 10px 0px\",display:\"flex\",flexDirection:\"column\",transition:\"opacity 0.3s ease\",zIndex:10};const controlsRowStyle={display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",padding:\"10px 20px\",width:\"100%\"};const leftControlsStyle={display:\"flex\",alignItems:\"center\",gap:\"15px\"};const rightControlsStyle={display:\"flex\",alignItems:\"center\",gap:\"15px\"};const timeStyle={color:\"#fff\",fontFamily:\"Inter, sans-serif\",fontSize:\"12px\",fontVariantNumeric:\"tabular-nums\",opacity:.9};const textLogoStyle={color:\"#0066B3\",fontWeight:700,fontSize:12,marginRight:10,letterSpacing:1};const iconButtonStyle={background:\"transparent\",border:\"none\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",padding:0,outline:\"none\"};const logoStyle={height:\"14px\",objectFit:\"contain\",marginRight:\"10px\"};const sliderStyle=accentColor=>({width:\"100%\",height:\"4px\",WebkitAppearance:\"none\",appearance:\"none\",background:`rgba(255, 255, 255, 0.2)`,cursor:\"pointer\",outline:\"none\",marginBottom:\"5px\"});// --- Property Controls ---\naddPropertyControls(KMVideoPlayer,{sourceType:{type:ControlType.Enum,title:\"Source\",options:[\"file\",\"link\"],optionTitles:[\"File Upload\",\"External Link\"],defaultValue:\"file\"},videoFile:{type:ControlType.File,title:\"Video File\",allowedFileTypes:[\"mp4\",\"webm\"],hidden:props=>props.sourceType===\"link\"},videoUrl:{type:ControlType.String,title:\"Video URL\",placeholder:\"https://example.com/video.mp4\",hidden:props=>props.sourceType===\"file\"},poster:{type:ControlType.Image,title:\"Poster Image\"},logo:{type:ControlType.Image,title:\"KM Logo\"},// -- Sezione Controlli --\nshowControls:{type:ControlType.Boolean,title:\"Show Controls\",defaultValue:true,hidden:props=>props.isDecorative},isDecorative:{type:ControlType.Boolean,title:\"Decorative (A11y)\",defaultValue:false,description:\"Hides video from Screen Readers (aria-hidden). Ideal for backgrounds.\"},// -- Sezione Playback --\nautoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:false},startMuted:{type:ControlType.Boolean,title:\"Start Muted\",defaultValue:false,description:\"Required for Autoplay in most browsers\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false},subtitles:{type:ControlType.File,title:\"Subtitles (.vtt)\",allowedFileTypes:[\"vtt\"],hidden:props=>props.isDecorative},accentColor:{type:ControlType.Color,title:\"Accent Color\",defaultValue:\"#0066B3\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"KMVideoPlayer\":{\"type\":\"reactComponent\",\"name\":\"KMVideoPlayer\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"800\",\"framerIntrinsicHeight\":\"450\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./KMVideoPlayer.map"],"mappings":"uQAKG,SAAgB,EAAc,EAAM,CAAC,IAAM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