{"version":3,"file":"shared.DoBrvFBX.mjs","names":["useRef","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/AB8pyoBPB9XoKYGMZL7P/fSbaAiKSFBN5QXxShu3m/VturbPlayer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function VturbPlayer({vturbCode,secondsToDisplay,classToDisplay}){const containerRef=useRef(null);const[elementsShown,setElementsShown]=useState(false);// Função para obter a URL base sem parâmetros\nconst getBaseUrl=useCallback(()=>{const url1=new URL(window.location.href);return`${url1.origin}${url1.pathname}`;},[]);const initializePlayer=useCallback(()=>{const container=containerRef.current;// Limpa o contêiner antes de adicionar um novo player\nwhile(container.firstChild){container.removeChild(container.firstChild);}// Cria um novo elemento div para conter o código do player\nconst playerContainer=document.createElement(\"div\");playerContainer.innerHTML=vturbCode;// Adiciona o código do player ao contêiner\ncontainer.appendChild(playerContainer);// Obtém a tag script do código do player\nconst scriptTag=playerContainer.querySelector(\"script\");// Executa o código dentro da tag script\ntry{eval(scriptTag.innerHTML);}catch(error){console.error(\"Erro ao inicializar o player:\",error);}},[vturbCode]);const showEls=useCallback(()=>{const baseUrl1=getBaseUrl();const storageKey1=`alreadyElsDisplayed_${baseUrl1}`;const elements1=document.querySelectorAll(classToDisplay);elements1.forEach(element1=>{element1.classList.remove(\"esconder\");element1.style.removeProperty(\"display\");});localStorage.setItem(storageKey1,\"true\");console.log(\"show hidden elements\");window.updateCheckoutButtonURL&&window.updateCheckoutButtonURL();},[classToDisplay,getBaseUrl]);const startWatchVideoProgress=useCallback(()=>{let attempts1=0;const checkPlayer1=()=>{if(typeof smartplayer===\"undefined\"||!(smartplayer.instances&&smartplayer.instances.length)){attempts1+=1;if(attempts1>=10)return;return setTimeout(checkPlayer1,1e3);}smartplayer.instances[0].on(\"timeupdate\",()=>{if(smartplayer.instances[0].video.currentTime>=secondsToDisplay){setElementsShown(true);}});};checkPlayer1();},[secondsToDisplay]);useEffect(()=>{const baseUrl1=getBaseUrl();const storageKey1=`alreadyElsDisplayed_${baseUrl1}`;initializePlayer();// Verifica se os elementos já foram exibidos anteriormente\nconst alreadyElsDisplayed1=localStorage.getItem(storageKey1);if(alreadyElsDisplayed1===\"true\"){setElementsShown(true);}else{startWatchVideoProgress();}const handleResize1=()=>{if(typeof smartplayer!==\"undefined\"&&smartplayer.instances&&smartplayer.instances.length){const currentTime1=smartplayer.instances[0].video.currentTime;if(currentTime1>=secondsToDisplay){setElementsShown(true);}}};window.addEventListener(\"resize\",handleResize1);window.addEventListener(\"orientationchange\",handleResize1);return()=>{window.removeEventListener(\"resize\",handleResize1);window.removeEventListener(\"orientationchange\",handleResize1);};},[vturbCode,secondsToDisplay,classToDisplay,getBaseUrl,initializePlayer,startWatchVideoProgress]);useEffect(()=>{if(elementsShown){showEls();}},[elementsShown,showEls]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef});}// ... (o resto do código permanece o mesmo)\nVturbPlayer.defaultProps={vturbCode:`\n   <div id=\"vid_677d42eb0db0d64b19b5edbe\" style=\"position: relative; width: 100%; padding: 177.77777777777777% 0 0;\"> <img id=\"thumb_677d42eb0db0d64b19b5edbe\" src=\"https://images.converteai.net/ebef166f-f418-4075-9e5d-d1174f009cc1/players/677d42eb0db0d64b19b5edbe/thumbnail.jpg\" style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block;\" alt=\"thumbnail\"> <div id=\"backdrop_677d42eb0db0d64b19b5edbe\" style=\" -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); position: absolute; top: 0; height: 100%; width: 100%; \"></div> </div> <script type=\"text/javascript\" id=\"scr_677d42eb0db0d64b19b5edbe\"> var s=document.createElement(\"script\"); s.src=\"https://scripts.converteai.net/ebef166f-f418-4075-9e5d-d1174f009cc1/players/677d42eb0db0d64b19b5edbe/player.js\", s.async=!0,document.head.appendChild(s); </script> <style> .elementor-element:has(#smartplayer) { width: 100%; } </style>\n  `,secondsToDisplay:5,classToDisplay:\".esconder\"};addPropertyControls(VturbPlayer,{vturbCode:{type:ControlType.String,title:\"C\\xf3digo do Player do Vturb\",defaultValue:VturbPlayer.defaultProps.vturbCode,displayTextArea:true},secondsToDisplay:{type:ControlType.Number,title:\"Segundos para Exibir\",defaultValue:VturbPlayer.defaultProps.secondsToDisplay,min:0,step:1},classToDisplay:{type:ControlType.String,title:\"Classe dos Elementos a Exibir\",defaultValue:VturbPlayer.defaultProps.classToDisplay}});\nexport const __FramerMetadata__ = {\"exports\":{\"VturbPlayer\":{\"type\":\"reactComponent\",\"name\":\"VturbPlayer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VturbPlayer.map"],"mappings":"oUAAwJ,SAAgB,YAAY,CAAC,UAAU,iBAAiB,gBAAgB,CAAC,MAAM,aAAaA,GAAO,IAAI,EAAO,CAAC,cAAc,kBAAkBC,GAAS,EAAK,EAC/S,WAAWC,OAAgB,CAAC,IAAM,EAAK,IAAI,IAAI,OAAO,SAAS,IAAI,EAAE,MAAM,GAAG,EAAK,SAAS,EAAK,UAAW,EAAE,CAAC,CAAC,EAAQ,iBAAiBA,OAAgB,CAAC,MAAM,UAAU,aAAa,QAC7L,KAAM,UAAU,YAAY,UAAU,YAAY,UAAU,UAAU,EACtE,MAAM,gBAAgB,SAAS,cAAc,KAAK,EAAE,gBAAgB,UAAU,UAC9E,UAAU,YAAY,eAAe,EACrC,MAAM,UAAU,gBAAgB,cAAc,QAAQ,EACtD,GAAG,CAAC,KAAK,UAAU,SAAS,CAAE,OAAO,EAAM,CAAC,QAAQ,MAAM,gCAAgC,CAAK,CAAE,CAAC,EAAE,CAAC,SAAS,CAAC,EAAQ,QAAQA,OAAgB,CAA6B,IAAM,EAAY,uBAA/B,WAA6D,IAA8D,SAAjC,iBAAiB,cAAwB,CAAC,CAAC,QAAQ,GAAU,CAAC,EAAS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