{"version":3,"file":"Rive_v5.I5Sv7UtS.mjs","names":["Rive"],"sources":["https:/framerusercontent.com/modules/zIrRZoIgteGH4KvNSVbF/0fq7lD8yeBknaxdZUvlU/Rive_v5.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useMemo,useRef}from\"react\";import Rive,{useRive,useStateMachineInput}from\"@rive-app/react-canvas\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// Mapping for fit options to Fit enum\nconst getFitValue=fit=>{switch(fit){case\"layout\":return Rive.Fit.Layout;case\"contain\":return Rive.Fit.Contain;case\"cover\":return Rive.Fit.Cover;case\"fill\":return Rive.Fit.Fill;case\"fitWidth\":return Rive.Fit.FitWidth;case\"fitHeight\":return Rive.Fit.FitHeight;case\"none\":return Rive.Fit.None;case\"scaleDown\":return Rive.Fit.ScaleDown;default:return Rive.Fit.Contain;}};// Mapping for alignment options to Alignment enum\nconst getAlignmentValue=alignment=>{switch(alignment){case\"center\":return Rive.Alignment.Center;case\"topLeft\":return Rive.Alignment.TopLeft;case\"topCenter\":return Rive.Alignment.TopCenter;case\"topRight\":return Rive.Alignment.TopRight;case\"centerLeft\":return Rive.Alignment.CenterLeft;case\"centerRight\":return Rive.Alignment.CenterRight;case\"bottomLeft\":return Rive.Alignment.BottomLeft;case\"bottomCenter\":return Rive.Alignment.BottomCenter;case\"bottomRight\":return Rive.Alignment.BottomRight;default:return Rive.Alignment.Center;}};function useRiveInputs(rive,stateMachines,inputsJSON){const inputConfigs=useMemo(()=>{try{return JSON.parse(inputsJSON||\"[]\");}catch(error){console.error(\"Error parsing inputsJSON:\",error);return[];}},[inputsJSON]);return inputConfigs.map(config=>{const handler=useStateMachineInput(rive,stateMachines,config.name,config.type===\"Trigger\"?true:config.value);return{...config,handler};});}/**\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerDisableUnlink\n */export default function RivePlayer_v5(props){const{src,artboard,stateMachines,autoplay,fit,alignment,play,playOnCanvas,onEventTriggered,inputsJSON,isTouchScrollEnabled,layoutScaleFactor}=props;const layout=useMemo(()=>new Rive.Layout({fit:getFitValue(fit),alignment:getAlignmentValue(alignment),...fit===\"layout\"&&{layoutScaleFactor}}),[fit,alignment,layoutScaleFactor]);const{rive,RiveComponent}=useRive({src,artboard,stateMachines,autoplay,layout,isTouchScrollEnabled:isTouchScrollEnabled});const inputs=useRiveInputs(rive,stateMachines,inputsJSON);const prevInputsRef=useRef(inputs);useEffect(()=>{if(rive&&inputs.length){inputs.forEach((input,index)=>{if(input.handler){const prevInput=prevInputsRef.current[index];if(input.type===\"Trigger\"&&input.value&&(!prevInput||!prevInput.value)){input.handler.fire();}else if(input.type!==\"Trigger\"&&\"value\"in input){input.handler.value=input.value;}}});}prevInputsRef.current=inputs;},[rive,inputs]);useEffect(()=>{if(rive){const handleEvent=event=>{console.log(\"Rive event triggered:\",event);if(onEventTriggered){onEventTriggered(event.data);console.log(\"Event data:\",event.data);}};rive.on(\"riveevent\",handleEvent);return()=>{rive.off(\"riveevent\",handleEvent);};}},[rive,onEventTriggered]);useEffect(()=>{if(rive){const shouldPlay=RenderTarget.current()===RenderTarget.canvas?playOnCanvas:play;shouldPlay?rive.play():rive.pause();}},[rive,play,playOnCanvas]);useEffect(()=>{if(rive){rive.layout=layout;}},[rive,layout]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\"},children:/*#__PURE__*/_jsx(RiveComponent,{style:{width:\"100%\",height:\"100%\"}})});}// Property controls\naddPropertyControls(RivePlayer_v5,{src:{title:\"Source\",type:ControlType.String},artboard:{title:\"Artboard\",type:ControlType.String},stateMachines:{title:\"State Machines\",type:ControlType.String},autoplay:{title:\"Autoplay\",type:ControlType.Boolean,hidden:()=>true},isTouchScrollEnabled:{title:\"Touch Screen Enabled\",type:ControlType.Boolean},fit:{title:\"Fit\",type:ControlType.Enum,options:[\"layout\",\"contain\",\"cover\",\"fill\",\"fitWidth\",\"fitHeight\",\"none\",\"scaleDown\"],optionTitles:[\"Layout\",\"Contain\",\"Cover\",\"Fill\",\"Fit Width\",\"Fit Height\",\"None\",\"Scale Down\"],defaultValue:\"contain\"},layoutScaleFactor:{title:\"Layout Scale Factor\",type:ControlType.Number,defaultValue:1,min:.25,max:10,displayStepper:true,step:.25,hidden:props=>props.fit!==\"layout\"},alignment:{title:\"Alignment\",type:ControlType.Enum,options:[\"center\",\"topLeft\",\"topCenter\",\"topRight\",\"centerLeft\",\"centerRight\",\"bottomLeft\",\"bottomCenter\",\"bottomRight\"],optionTitles:[\"Center\",\"Top Left\",\"Top Center\",\"Top Right\",\"Center Left\",\"Center Right\",\"Bottom Left\",\"Bottom Center\",\"Bottom Right\"],defaultValue:\"center\"},play:{title:\"Auto-Play\",type:ControlType.Boolean},playOnCanvas:{title:\"Play on Canvas\",type:ControlType.Boolean},onEventTriggered:{type:ControlType.EventHandler},inputsJSON:{title:\"Inputs JSON\",type:ControlType.String,hidden:()=>true}});// Default props\nRivePlayer_v5.defaultProps={src:\"https://public.rive.app/hosted/63978/135405/cRjq3a7l40ScM-l2peKfBQ.riv\",artboard:\"AB_BG\",stateMachines:\"SM_BG\",autoplay:true,fit:\"contain\",alignment:\"center\",play:true,playOnCanvas:true,onEventTriggered:eventData=>null,inputsJSON:\"[]\",isTouchScrollEnabled:false,layoutScaleFactor:1};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RivePlayer_v5\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Rive_v5.map"],"mappings":"yWAEohB,SAAS,EAAc,EAAK,EAAc,EAAW,CAAC,IAAM,EAAa,EAAQ,IAAI,CAAC,GAAG,CAAC,MAAO,MAAK,MAAM,GAAY,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