{"version":3,"file":"Customized_Video.BBeTLMuG.mjs","names":["useRef","useMemo","useCallback","p"],"sources":["https:/framerusercontent.com/modules/5o4aODgbWmVksylKY1QT/uwTAHOxPwHht69Z5rvX8/Customized_Video.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useMemo,useRef,useCallback}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 640\n * @framerIntrinsicHeight 360\n */export default function VideoLikeWithDelay(props){const{// Source\nsourceType,file,url,// Playback\nplaying,delay,startTime,loop,muted,controls,playbackRate,// Visual\nfit,radius,background,posterFile,posterImage,style}=props;const ref=useRef(null);const timerRef=useRef(null);const src=useMemo(()=>{if(sourceType===\"url\")return url?.trim()||undefined;return file||undefined;},[sourceType,file,url]);const poster=useMemo(()=>{if(posterImage?.src)return posterImage.src;if(posterFile)return posterFile;return undefined;},[posterImage,posterFile]);const clearTimer=useCallback(()=>{if(timerRef.current){clearTimeout(timerRef.current);timerRef.current=null;}},[]);// set playback rate whenever changed\nuseEffect(()=>{if(ref.current&&playbackRate>0){ref.current.playbackRate=playbackRate;}},[playbackRate]);// set start time after metadata is ready\nconst onLoadedMetadata=useCallback(()=>{const v=ref.current;if(!v)return;if(startTime>0&&startTime<(v.duration||Infinity)){try{v.currentTime=startTime;}catch{}}},[startTime]);// handle play / pause with delay\nuseEffect(()=>{const v=ref.current;if(!v)return;clearTimer();if(!playing){v.pause();return;}const ms=Math.max(0,(delay??0)*1e3);timerRef.current=window.setTimeout(async()=>{try{await v.play();}catch{// 自動再生ブロック時は無視\n}},ms);return clearTimer;},[playing,delay,src,clearTimer]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:radius,background,...style},children:/*#__PURE__*/_jsx(\"video\",{ref:ref,src:src,poster:poster,loop:loop,muted:muted,controls:controls,playsInline:true,onLoadedMetadata:onLoadedMetadata,style:{width:\"100%\",height:\"100%\",objectFit:fit,display:\"block\"}})});}VideoLikeWithDelay.displayName=\"Video (Std Props + Delay + Speed)\";addPropertyControls(VideoLikeWithDelay,{// ===== Source =====\nsourceType:{type:ControlType.Enum,title:\"Source\",options:[\"file\",\"url\"],optionTitles:[\"File\",\"URL\"],defaultValue:\"file\"},file:{type:ControlType.File,title:\"File\",allowedFileTypes:[\"mp4\",\"webm\",\"ogg\"],hidden:p=>p.sourceType!==\"file\"},url:{type:ControlType.String,title:\"URL\",placeholder:\"https://example.com/video.mp4\",hidden:p=>p.sourceType!==\"url\"},// ===== Playing / Delay =====\nplaying:{type:ControlType.Boolean,title:\"Playing\",defaultValue:true},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:2,min:0,max:120,step:.5,unit:\"s\"},// ===== Visual =====\nradius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:64,unit:\"px\"},posterFile:{type:ControlType.File,title:\"Poster\",allowedFileTypes:[\"jpg\",\"jpeg\",\"png\",\"gif\",\"webp\"],optional:true},posterImage:{type:ControlType.ResponsiveImage,title:\"Image\",optional:true},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"transparent\"},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\",\"fill\",\"scale-down\",\"none\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\",\"Scale-down\",\"None\"],defaultValue:\"cover\"},// ===== Playback options =====\nstartTime:{type:ControlType.Number,title:\"Start Time\",defaultValue:0,min:0,max:3600,step:.1,unit:\"s\"},playbackRate:{type:ControlType.Number,title:\"Speed\",defaultValue:1,min:.25,max:3,step:.25},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false},controls:{type:ControlType.Boolean,title:\"Controls\",defaultValue:true},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoLikeWithDelay\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicWidth\":\"640\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"360\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Customized_Video.map"],"mappings":"6MAKG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAC1D,aAAW,OAAK,MAChB,UAAQ,QAAM,YAAU,OAAK,QAAM,WAAS,eAC5C,MAAI,SAAO,aAAW,aAAW,cAAY,SAAO,EAAY,EAAIA,EAAO,KAAK,CAAO,EAASA,EAAO,KAAK,CAAO,EAAIC,MAAgB,IAAa,MAAa,GAAK,MAAM,EAAE,IAAA,GAAiB,GAAM,IAAA,GAAY,CAAC,EAAW,EAAK,EAAI,CAAC,CAAO,EAAOA,MAAY,CAAC,GAAG,GAAa,IAAI,OAAO,EAAY,IAAI,GAAG,EAAW,OAAO,GAA8B,CAAC,EAAY,EAAW,CAAC,CAAO,EAAWC,MAAgB,CAAC,AAAoD,EAAS,WAAxC,aAAa,EAAS,QAAQ,CAAkB,OAAQ,EAAE,CAAC,CAC5e,MAAc,CAAI,EAAI,SAAS,EAAa,IAAG,EAAI,QAAQ,aAAa,IAAgB,CAAC,EAAa,CAAC,CACvG,IAAM,EAAiBA,MAAgB,CAAC,IAAM,EAAE,EAAI,QAAY,MAAY,EAAU,GAAG,GAAW,EAAE,UAAU,KAAW,GAAG,CAAC,EAAE,YAAY,OAAgB,IAAK,CAAC,EAAU,CAAC,CAEnH,OAD3D,MAAc,CAAC,IAAM,EAAE,EAAI,QAAQ,GAAG,CAAC,EAAE,OAAoB,GAAb,GAAY,CAAI,CAAC,EAAQ,CAAC,EAAE,OAAO,CAAC,OAAQ,IAAM,EAAG,KAAK,IAAI,GAAG,GAAO,GAAG,IAAI,CACxH,MADyH,GAAS,QAAQ,EAAO,WAAW,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,MAAO,IACnM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