{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/mbFPzZYTzIhSrigRSb6s/WlnJOre1X3CDSYtVS4Dk/Rive.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\";/**\n * Version 0.0.1\n * - Initial release\n */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(props){const{src,artboard,stateMachines,autoplay,fit,alignment,play,playOnCanvas,onEventTriggered,inputsJSON,isTouchScrollEnabled}=props;const layout=useMemo(()=>new Rive.Layout({fit,alignment}),[fit,alignment]);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]);// Handle Rive events\nuseEffect(()=>{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]);// Control playback\nuseEffect(()=>{if(rive){const shouldPlay=RenderTarget.current()===RenderTarget.canvas?playOnCanvas:play;shouldPlay?rive.play():rive.pause();}},[rive,play,playOnCanvas]);// Update layout\nuseEffect(()=>{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,{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:[\"contain\",\"cover\",\"fill\",\"fitWidth\",\"fitHeight\",\"none\",\"scaleDown\"],optionTitles:[\"Contain\",\"Cover\",\"Fill\",\"Fit Width\",\"Fit Height\",\"None\",\"Scale Down\"]},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\"]},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.defaultProps={src:\"https://public.rive.app/hosted/63978/135405/cRjq3a7l40ScM-l2peKfBQ.riv\",artboard:\"AB_BG\",stateMachines:\"SM_BG\",autoplay:true,fit:\"cover\",alignment:\"center\",play:true,playOnCanvas:true,onEventTriggered:eventData=>null,inputsJSON:\"[]\",isTouchScrollEnabled:false};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RivePlayer\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Rive.map"],
  "mappings": "6IAGG,SAASA,EAAcC,EAAKC,EAAcC,EAAW,CAAkK,OAA9IC,EAAQ,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,MAAMD,GAAY,IAAI,CAAE,OAAOE,EAAM,CAAC,eAAQ,MAAM,4BAA4BA,CAAK,EAAQ,CAAC,CAAE,CAAC,EAAE,CAACF,CAAU,CAAC,EAAsB,IAAIG,GAAQ,CAAC,IAAMC,EAAQC,EAAqBP,EAAKC,EAAcI,EAAO,KAAKA,EAAO,OAAO,UAAU,GAAKA,EAAO,KAAK,EAAE,MAAM,CAAC,GAAGA,EAAO,QAAAC,CAAO,CAAE,CAAC,CAAE,CAKnX,SAARE,EAA4BC,EAAM,CAAC,GAAK,CAAC,IAAAC,EAAI,SAAAC,EAAS,cAAAV,EAAc,SAAAW,EAAS,IAAAC,EAAI,UAAAC,EAAU,KAAAC,EAAK,aAAAC,EAAa,iBAAAC,EAAiB,WAAAf,EAAW,qBAAAgB,CAAoB,EAAET,EAAYU,EAAOhB,EAAQ,IAAI,IAAIiB,EAAK,OAAO,CAAC,IAAAP,EAAI,UAAAC,CAAS,CAAC,EAAE,CAACD,EAAIC,CAAS,CAAC,EAAO,CAAC,KAAAd,EAAK,cAAAqB,CAAa,EAAEC,EAAQ,CAAC,IAAAZ,EAAI,SAAAC,EAAS,cAAAV,EAAc,SAAAW,EAAS,OAAAO,EAAO,qBAAqBD,CAAoB,CAAC,EAAQK,EAAOxB,EAAcC,EAAKC,EAAcC,CAAU,EAAQsB,EAAcC,EAAOF,CAAM,EAAE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KAAKA,EAAY,MAAM,EAAE,cAAc,CAAC,MAAM,iBAAiB,KAAKA,EAAY,MAAM,EAAE,SAAS,CAAC,MAAM,WAAW,KAAKA,EAAY,QAAQ,OAAO,IAAI,EAAI,EAAE,qBAAqB,CAAC,MAAM,uBAAuB,KAAKA,EAAY,OAAO,EAAE,IAAI,CAAC,MAAM,MAAM,KAAKA,EAAY,KAAK,QAAQ,CAAC,UAAU,QAAQ,OAAO,WAAW,YAAY,OAAO,WAAW,EAAE,aAAa,CAAC,UAAU,QAAQ,OAAO,YAAY,aAAa,OAAO,YAAY,CAAC,EAAE,UAAU,CAAC,MAAM,YAAY,KAAKA,EAAY,KAAK,QAAQ,CAAC,SAAS,UAAU,YAAY,WAAW,aAAa,cAAc,aAAa,eAAe,aAAa,EAAE,aAAa,CAAC,SAAS,WAAW,aAAa,YAAY,cAAc,eAAe,cAAc,gBAAgB,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,YAAY,KAAKA,EAAY,OAAO,EAAE,aAAa,CAAC,MAAM,iBAAiB,KAAKA,EAAY,OAAO,EAAE,iBAAiB,CAAC,KAAKA,EAAY,YAAY,EAAE,WAAW,CAAC,MAAM,cAAc,KAAKA,EAAY,OAAO,OAAO,IAAI,EAAI,CAAC,CAAC,EAC1jC3B,EAAW,aAAa,CAAC,IAAI,yEAAyE,SAAS,QAAQ,cAAc,QAAQ,SAAS,GAAK,IAAI,QAAQ,UAAU,SAAS,KAAK,GAAK,aAAa,GAAK,iBAAiB4B,GAAW,KAAK,WAAW,KAAK,qBAAqB,EAAK",
  "names": ["useRiveInputs", "rive", "stateMachines", "inputsJSON", "se", "error", "config", "handler", "D", "RivePlayer", "props", "src", "artboard", "autoplay", "fit", "alignment", "play", "playOnCanvas", "onEventTriggered", "isTouchScrollEnabled", "layout", "v", "RiveComponent", "H", "inputs", "prevInputsRef", "pe", "ue", "input", "index", "prevInput", "handleEvent", "event", "RenderTarget", "p", "addPropertyControls", "ControlType", "eventData"]
}
