{"title":"Quinta Valida Motocross","description":"\u003csection class=\"tmf-collection-entry\" aria-labelledby=\"tmf-collection-title\"\u003e\n  \u003cp class=\"tmf-collection-entry__eyebrow\"\u003eQuinta Valida Motocross\u003c\/p\u003e\n  \u003ch2 id=\"tmf-collection-title\"\u003eTus fotos del evento\u003c\/h2\u003e\n\n  \u003cdiv class=\"tmf-collection-entry__intro\"\u003e\n    \u003cp\u003e\n      Sube una foto tuya donde se te vea bien el rostro para que puedas ver todas las fotos que te tomamos y coloca tu número de participante para que no se quede ninguna foto por fuera.\n    \u003c\/p\u003e\n    \u003cp\u003e\n      Recuerda que puedes comprar una foto, paquetes de varias fotos individuales o todas tus fotos.\n    \u003c\/p\u003e\n  \u003c\/div\u003e\n\n  \u003cdiv id=\"tmf-config-loading\" class=\"tmf-collection-entry__status\" role=\"status\" aria-live=\"polite\"\u003e\n    Preparando la búsqueda…\n  \u003c\/div\u003e\n\n  \u003cdiv id=\"tmf-config-error\" class=\"tmf-collection-entry__error\" hidden\u003e\n    \u003cstrong\u003eEste servicio no está disponible en este momento.\u003c\/strong\u003e\n    \u003cspan id=\"tmf-config-error-message\"\u003eIntenta nuevamente en unos minutos.\u003c\/span\u003e\n  \u003c\/div\u003e\n\n  \u003cdiv id=\"tmf-config-content\" class=\"tmf-collection-entry__paths\" hidden\u003e\n    \u003cdiv class=\"tmf-collection-entry__personal-search\"\u003e\n      \u003cdiv class=\"tmf-collection-entry__step\"\u003e\n        \u003ch3\u003e1. Selfie\u003c\/h3\u003e\n\n        \u003cinput id=\"tmf-selfie-input\" type=\"file\" accept=\"image\/jpeg,image\/png,image\/webp\" hidden\u003e\n\n        \u003cbutton id=\"tmf-selfie-button\" class=\"button button--primary tmf-collection-entry__button\" type=\"button\"\u003e\n          Sube una foto tuya\n        \u003c\/button\u003e\n\n        \u003cp id=\"tmf-selfie-selection\" class=\"tmf-collection-entry__selection\" role=\"status\" aria-live=\"polite\" hidden\u003e\u003c\/p\u003e\n      \u003c\/div\u003e\n\n      \u003cdiv class=\"tmf-collection-entry__step\"\u003e\n        \u003clabel class=\"tmf-collection-entry__label\" for=\"tmf-bib-input\"\u003e\n          2. Número \u003cspan\u003e(opcional)\u003c\/span\u003e\n        \u003c\/label\u003e\n        \u003cinput type=\"text\" id=\"tmf-bib-input\" class=\"tmf-collection-entry__number-input\" placeholder=\"Ej. 1234\" inputmode=\"numeric\" autocomplete=\"off\" maxlength=\"5\"\u003e\n      \u003c\/div\u003e\n\n      \u003cbutton id=\"tmf-search-button\" class=\"button button--primary tmf-collection-entry__button tmf-collection-entry__search-button\" type=\"button\" disabled\u003e\n        Buscar mis fotos\n      \u003c\/button\u003e\n\n      \u003cp class=\"tmf-collection-entry__privacy\"\u003e\n        Tu información está 100% segura y privada.\n      \u003c\/p\u003e\n\n      \u003cp id=\"tmf-search-status\" class=\"tmf-collection-entry__status\" role=\"status\" aria-live=\"polite\" hidden\u003e\u003c\/p\u003e\n    \u003c\/div\u003e\n\n    \u003cdiv class=\"tmf-collection-entry__all-photos\"\u003e\n      \u003ch3\u003e3. Todas las fotos\u003c\/h3\u003e\n      \u003cp\u003eInicia sesión o crea tu cuenta para ver todas las fotos del evento.\u003c\/p\u003e\n\n      \u003cbutton id=\"tmf-all-photos-button\" class=\"button button--secondary tmf-collection-entry__button\" type=\"button\"\u003e\n        Ver todas las fotos\n      \u003c\/button\u003e\n\n      \u003cul class=\"tmf-collection-entry__benefits\" aria-label=\"Beneficios de compra\"\u003e\n        \u003cli\u003eCompra segura\u003c\/li\u003e\n        \u003cli\u003eDescarga inmediata\u003c\/li\u003e\n        \u003cli\u003eFotos en alta calidad\u003c\/li\u003e\n      \u003c\/ul\u003e\n    \u003c\/div\u003e\n  \u003c\/div\u003e\n\u003c\/section\u003e\n\n\u003cstyle\u003e\n  html:not(.tmf-all-photos-visible) #ProductGridContainer,\n  html:not(.tmf-all-photos-visible) #product-grid,\n  html:not(.tmf-all-photos-visible) .product-grid-container,\n  html:not(.tmf-all-photos-visible) .collection-product-grid,\n  html:not(.tmf-all-photos-visible) .collection .product-grid {\n    display: none !important;\n  }\n\n  .tmf-collection-entry,\n  .tmf-collection-entry * {\n    box-sizing: border-box;\n  }\n\n  .tmf-collection-entry {\n    max-width: 120rem;\n    margin: 2.5rem auto;\n    padding: clamp(1.5rem, 4vw, 3rem);\n    color: rgb(var(--color-foreground));\n    background: rgb(var(--color-background));\n    border: 0.1rem solid rgba(var(--color-foreground), 0.16);\n    border-radius: var(--media-radius);\n    font-family: var(--font-body-family);\n  }\n\n  .tmf-collection-entry [hidden] {\n    display: none !important;\n  }\n\n  .tmf-collection-entry__eyebrow {\n    margin: 0 0 0.75rem;\n    font-size: 0.85em;\n    font-weight: 700;\n    letter-spacing: 0.12em;\n    text-align: center;\n    text-transform: uppercase;\n  }\n\n  .tmf-collection-entry h2,\n  .tmf-collection-entry h3 {\n    color: inherit;\n    font-family: var(--font-heading-family);\n  }\n\n  .tmf-collection-entry h2 {\n    margin: 0;\n    font-size: clamp(2rem, 5vw, 3.5rem);\n    line-height: 1.08;\n    text-align: center;\n  }\n\n  .tmf-collection-entry h3,\n  .tmf-collection-entry__label {\n    margin: 0 0 1rem;\n    font-size: clamp(1.65rem, 2.5vw, 2.2rem);\n    font-weight: 700;\n    line-height: 1.2;\n  }\n\n  .tmf-collection-entry__intro {\n    max-width: 76rem;\n    margin: 1.25rem auto 0;\n    font-size: 1.05em;\n    text-align: center;\n  }\n\n  .tmf-collection-entry__intro p {\n    margin: 0;\n  }\n\n  .tmf-collection-entry__intro p + p {\n    margin-top: 1rem;\n  }\n\n  .tmf-collection-entry__paths {\n    display: grid;\n    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);\n    gap: clamp(1.5rem, 3vw, 3rem);\n    margin-top: 2.5rem;\n  }\n\n  .tmf-collection-entry__personal-search,\n  .tmf-collection-entry__all-photos {\n    padding: clamp(1.5rem, 3vw, 2.5rem);\n    border: 0.1rem solid rgba(var(--color-foreground), 0.16);\n    border-radius: var(--media-radius);\n  }\n\n  .tmf-collection-entry__personal-search {\n    display: flex;\n    flex-direction: column;\n  }\n\n  .tmf-collection-entry__step + .tmf-collection-entry__step {\n    margin-top: 2rem;\n  }\n\n  .tmf-collection-entry__label {\n    display: block;\n  }\n\n  .tmf-collection-entry__label span {\n    font-weight: 400;\n  }\n\n  .tmf-collection-entry__button {\n    width: 100%;\n    min-height: 4.8rem;\n  }\n\n  .tmf-collection-entry__button:disabled {\n    cursor: wait;\n    opacity: 0.55;\n  }\n\n  .tmf-collection-entry__selection,\n  .tmf-collection-entry__privacy,\n  .tmf-collection-entry__status {\n    margin: 1rem 0 0;\n    font-size: 0.95em;\n  }\n\n  .tmf-collection-entry__selection {\n    overflow-wrap: anywhere;\n    font-weight: 600;\n  }\n\n  .tmf-collection-entry__number-input {\n    width: 100%;\n    min-height: 4.8rem;\n    padding: 0 1.25rem;\n    color: inherit;\n    background: rgb(var(--color-background));\n    border: 0.1rem solid rgba(var(--color-foreground), 0.3);\n    border-radius: var(--inputs-radius);\n    font: inherit;\n  }\n\n  .tmf-collection-entry__number-input:focus-visible {\n    outline: 0.2rem solid rgb(var(--color-foreground));\n    outline-offset: 0.3rem;\n  }\n\n  .tmf-collection-entry__search-button {\n    margin-top: 2rem;\n  }\n\n  .tmf-collection-entry__privacy {\n    text-align: center;\n    opacity: 0.76;\n  }\n\n  .tmf-collection-entry__status {\n    min-height: 1.5rem;\n    font-weight: 600;\n    text-align: center;\n  }\n\n  .tmf-collection-entry \u003e .tmf-collection-entry__status {\n    margin-top: 2rem;\n  }\n\n  .tmf-collection-entry__status--error {\n    color: #b42318;\n  }\n\n  .tmf-collection-entry__error {\n    display: grid;\n    gap: 0.45rem;\n    margin-top: 2rem;\n    padding: 1.25rem;\n    background: rgba(var(--color-foreground), 0.04);\n    border: 0.1rem solid rgba(var(--color-foreground), 0.16);\n    border-radius: var(--inputs-radius);\n    text-align: left;\n  }\n\n  .tmf-collection-entry__all-photos {\n    display: flex;\n    flex-direction: column;\n  }\n\n  .tmf-collection-entry__all-photos \u003e p {\n    margin: 0 0 2rem;\n  }\n\n  .tmf-collection-entry__benefits {\n    display: grid;\n    gap: 0.75rem;\n    margin: auto 0 0;\n    padding: 2rem 0 0;\n    list-style: none;\n  }\n\n  .tmf-collection-entry__benefits li {\n    position: relative;\n    padding-left: 1.75rem;\n  }\n\n  .tmf-collection-entry__benefits li::before {\n    position: absolute;\n    left: 0;\n    content: \"✓\";\n    font-weight: 700;\n  }\n\n  @media screen and (max-width: 749px) {\n    .tmf-collection-entry {\n      margin: 1.5rem auto;\n    }\n\n    .tmf-collection-entry__paths {\n      grid-template-columns: 1fr;\n    }\n\n    .tmf-collection-entry__all-photos {\n      min-height: 0;\n    }\n  }\n\u003c\/style\u003e\n\n\u003cscript\u003e\n  (() =\u003e {\n    document.documentElement.classList.remove(\"tmf-all-photos-visible\");\n\n    const EVENT_KEY = \"96QuintaValidaMotocross\";\n    const CONFIG_ENDPOINT = \"\/apps\/todas-mis-fotos\/search-session\";\n    const PRESIGNED_ENDPOINT = \"https:\/\/0o8ptvnz12.execute-api.us-east-1.amazonaws.com\/prod\/presigned-url\";\n    const RESULTS_PATH = \"\/pages\/resultados-tmf-v2\";\n    const MAX_FILE_BYTES = 15 * 1024 * 1024;\n\n    const loading = document.getElementById(\"tmf-config-loading\");\n    const content = document.getElementById(\"tmf-config-content\");\n    const errorBox = document.getElementById(\"tmf-config-error\");\n    const errorMessage = document.getElementById(\"tmf-config-error-message\");\n    const selfieInput = document.getElementById(\"tmf-selfie-input\");\n    const selfieButton = document.getElementById(\"tmf-selfie-button\");\n    const selfieSelection = document.getElementById(\"tmf-selfie-selection\");\n    const bibInput = document.getElementById(\"tmf-bib-input\");\n    const searchButton = document.getElementById(\"tmf-search-button\");\n    const allPhotosButton = document.getElementById(\"tmf-all-photos-button\");\n    const status = document.getElementById(\"tmf-search-status\");\n\n    let selectedSelfie = null;\n    let configReady = false;\n    let searchInProgress = false;\n\n    const showStatus = (message, isError = false) =\u003e {\n      if (!status) return;\n      status.hidden = false;\n      status.textContent = message;\n      status.classList.toggle(\"tmf-collection-entry__status--error\", isError);\n    };\n\n    const clearStatus = () =\u003e {\n      if (!status) return;\n      status.hidden = true;\n      status.textContent = \"\";\n      status.classList.remove(\"tmf-collection-entry__status--error\");\n    };\n\n    const showConfigError = (message) =\u003e {\n      loading.hidden = true;\n      content.hidden = true;\n      errorBox.hidden = false;\n      errorMessage.textContent = message || \"Intenta nuevamente en unos minutos.\";\n    };\n\n    const responseJson = async (response) =\u003e {\n      const data = await response.json().catch(() =\u003e ({}));\n      if (!response.ok || !data.ok) {\n        throw new Error(data.message || \"No se pudo completar la solicitud.\");\n      }\n      return data;\n    };\n\n    const validateSelfie = (file) =\u003e {\n      const allowedTypes = [\"image\/jpeg\", \"image\/png\", \"image\/webp\"];\n      if (!file || !allowedTypes.includes(file.type)) {\n        throw new Error(\"Selecciona una imagen JPG, PNG o WEBP.\");\n      }\n      if (file.size \u003e MAX_FILE_BYTES) {\n        throw new Error(\"La imagen no puede superar 15 MB.\");\n      }\n    };\n\n    const selectedBibNumber = () =\u003e {\n      const bibNumber = bibInput ? bibInput.value.trim() : \"\";\n      if (bibNumber \u0026\u0026 !\/^[0-9]{1,5}$\/.test(bibNumber)) {\n        bibInput.focus();\n        throw new Error(\"El número de participante debe tener hasta 5 dígitos.\");\n      }\n      return bibNumber;\n    };\n\n    const updateSearchButton = () =\u003e {\n      if (!searchButton) return;\n      searchButton.disabled = !configReady || !selectedSelfie || searchInProgress;\n    };\n\n    const loadConfiguration = async () =\u003e {\n      loading.hidden = false;\n      content.hidden = true;\n      errorBox.hidden = true;\n\n      try {\n        const response = await fetch(CONFIG_ENDPOINT, {\n          method: \"POST\",\n          headers: { \"Content-Type\": \"application\/json\" },\n          cache: \"no-store\",\n          body: JSON.stringify({\n            action: \"config\",\n            eventKey: EVENT_KEY\n          })\n        });\n        const data = await responseJson(response);\n        const config = data.todasMisFotos || {};\n\n        if (!config.enabled || config.status !== \"valid\") {\n          throw new Error(\"La búsqueda todavía no está habilitada para este evento.\");\n        }\n\n        if (!config.identity || !config.identity.selfieRequired) {\n          throw new Error(\"La configuración de identidad no es válida.\");\n        }\n\n        configReady = true;\n        loading.hidden = true;\n        content.hidden = false;\n        updateSearchButton();\n      } catch (error) {\n        console.error(error);\n        configReady = false;\n        updateSearchButton();\n        showConfigError(error.message);\n      }\n    };\n\n    const safeFilename = (originalName) =\u003e {\n      const normalized = String(originalName || \"selfie.jpg\")\n        .normalize(\"NFD\")\n        .replace(\/[\\u0300-\\u036f]\/g, \"\")\n        .replace(\/[^A-Za-z0-9_.-]+\/g, \"-\")\n        .replace(\/^-+|-+$\/g, \"\");\n      const filename = normalized || \"selfie.jpg\";\n      const random = crypto.getRandomValues(new Uint32Array(1))[0].toString(16);\n      return Date.now() + \"-\" + random + \"-\" + filename;\n    };\n\n    const uploadAndSearch = async () =\u003e {\n      if (!selectedSelfie) {\n        selfieButton.focus();\n        throw new Error(\"Primero sube una foto tuya.\");\n      }\n\n      validateSelfie(selectedSelfie);\n      const bibNumber = selectedBibNumber();\n      const filename = safeFilename(selectedSelfie.name);\n      const objectKey = \"selfies\/rf-evento-\" + EVENT_KEY + \"\/\" + filename;\n\n      const presignedResponse = await fetch(\n        PRESIGNED_ENDPOINT + \"?filename=\" + encodeURIComponent(objectKey),\n        { cache: \"no-store\" }\n      );\n      const presigned = await presignedResponse.json().catch(() =\u003e ({}));\n\n      if (!presignedResponse.ok || !presigned.url) {\n        throw new Error(\"No se pudo preparar la carga de la selfie.\");\n      }\n\n      const uploadResponse = await fetch(presigned.url, {\n        method: \"PUT\",\n        headers: { \"Content-Type\": selectedSelfie.type },\n        body: selectedSelfie\n      });\n\n      if (!uploadResponse.ok) {\n        throw new Error(\"No se pudo cargar la selfie.\");\n      }\n\n      const params = new URLSearchParams({\n        eventKey: EVENT_KEY,\n        selfieId: filename\n      });\n      if (bibNumber) params.set(\"bibNumber\", bibNumber);\n\n      window.location.assign(RESULTS_PATH + \"?\" + params.toString());\n    };\n\n    const revealAllPhotos = () =\u003e {\n      document.documentElement.classList.add(\"tmf-all-photos-visible\");\n      const productGrid = document.getElementById(\"ProductGridContainer\");\n      if (productGrid) {\n        productGrid.hidden = false;\n        productGrid.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n      }\n    };\n\n    const revealAllPhotosAfterLogin = () =\u003e {\n      const currentUrl = new URL(window.location.href);\n      if (currentUrl.searchParams.get(\"tmf_all_photos\") !== \"1\") return;\n\n      currentUrl.searchParams.delete(\"tmf_all_photos\");\n      window.history.replaceState({}, \"\", currentUrl.pathname + currentUrl.search + currentUrl.hash);\n      revealAllPhotos();\n    };\n\n    if (selfieInput \u0026\u0026 selfieButton) {\n      selfieButton.addEventListener(\"click\", () =\u003e selfieInput.click());\n\n      selfieInput.addEventListener(\"change\", () =\u003e {\n        const file = selfieInput.files \u0026\u0026 selfieInput.files[0];\n        if (!file) return;\n\n        try {\n          validateSelfie(file);\n          selectedSelfie = file;\n          selfieSelection.hidden = false;\n          selfieSelection.textContent = \"Foto seleccionada: \" + file.name;\n          selfieButton.textContent = \"Cambiar foto\";\n          clearStatus();\n        } catch (error) {\n          selectedSelfie = null;\n          selfieInput.value = \"\";\n          selfieSelection.hidden = true;\n          selfieSelection.textContent = \"\";\n          selfieButton.textContent = \"Sube una foto tuya\";\n          showStatus(error.message, true);\n        }\n\n        updateSearchButton();\n      });\n    }\n\n    if (bibInput) {\n      bibInput.addEventListener(\"input\", () =\u003e {\n        bibInput.value = bibInput.value.replace(\/\\D\/g, \"\").slice(0, 5);\n        clearStatus();\n      });\n    }\n\n    if (searchButton) {\n      searchButton.addEventListener(\"click\", async () =\u003e {\n        if (searchInProgress) return;\n\n        searchInProgress = true;\n        updateSearchButton();\n        searchButton.textContent = \"Buscando tus fotos…\";\n        showStatus(\"Estamos preparando tu búsqueda.\");\n\n        try {\n          await uploadAndSearch();\n        } catch (error) {\n          console.error(error);\n          searchInProgress = false;\n          searchButton.textContent = \"Buscar mis fotos\";\n          updateSearchButton();\n          showStatus(error.message || \"No pudimos iniciar la búsqueda.\", true);\n        }\n      });\n    }\n\n    if (allPhotosButton) {\n      allPhotosButton.addEventListener(\"click\", () =\u003e {\n        allPhotosButton.disabled = true;\n        allPhotosButton.textContent = \"Abriendo acceso…\";\n\n        const returnUrl = new URL(window.location.href);\n        returnUrl.searchParams.set(\"tmf_all_photos\", \"1\");\n        returnUrl.hash = \"ProductGridContainer\";\n\n        const relativeReturnUrl = returnUrl.pathname + returnUrl.search + returnUrl.hash;\n        window.location.assign(\n          \"\/customer_authentication\/login?return_to=\" + encodeURIComponent(relativeReturnUrl)\n        );\n      });\n    }\n\n    revealAllPhotosAfterLogin();\n    loadConfiguration();\n  })();\n\u003c\/script\u003e","products":[{"product_id":"quintavalidamotocross-rauldom-0665","title":"QuintaValidaMotocross-rauldom-0665.jpg","description":"Derecho de contenido para uso personal. Contactar para derechos de usos publicitarios al Wht: +507 6028-2182","brand":"rauldom","offers":[{"title":"Default Title","offer_id":48171255136492,"sku":"96QuintaValidaMotocross-rauldom-0665","price":10.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0715\/5692\/3628\/files\/QuintaValidaMotocross-rauldom-0665.jpg?v=1786803167"},{"product_id":"quintavalidamotocross-rauldom-9725","title":"QuintaValidaMotocross-rauldom-9725.jpg","description":"Derecho de contenido para uso personal. Contactar para derechos de usos publicitarios al Wht: +507 6028-2182","brand":"rauldom","offers":[{"title":"Default Title","offer_id":48171257135340,"sku":"96QuintaValidaMotocross-rauldom-9725","price":10.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0715\/5692\/3628\/files\/QuintaValidaMotocross-rauldom-9725.jpg?v=1786803171"},{"product_id":"quintavalidamotocross-rauldom-9788","title":"QuintaValidaMotocross-rauldom-9788.jpg","description":"Derecho de contenido para uso personal. Contactar para derechos de usos publicitarios al Wht: +507 6028-2182","brand":"rauldom","offers":[{"title":"Default Title","offer_id":48171258151148,"sku":"96QuintaValidaMotocross-rauldom-9788","price":10.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0715\/5692\/3628\/files\/QuintaValidaMotocross-rauldom-9788.jpg?v=1786803174"},{"product_id":"quintavalidamotocross-rauldom-9848","title":"QuintaValidaMotocross-rauldom-9848.jpg","description":"Derecho de contenido para uso personal. Contactar para derechos de usos publicitarios al Wht: +507 6028-2182","brand":"rauldom","offers":[{"title":"Default Title","offer_id":48171260149996,"sku":"96QuintaValidaMotocross-rauldom-9848","price":10.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0715\/5692\/3628\/files\/QuintaValidaMotocross-rauldom-9848.jpg?v=1786803178"},{"product_id":"quintavalidamotocross-rauldom-9632","title":"QuintaValidaMotocross-rauldom-9632.jpg","description":"Derecho de contenido para uso personal. Contactar para derechos de usos publicitarios al Wht: +507 6028-2182","brand":"rauldom","offers":[{"title":"Default Title","offer_id":48171264114924,"sku":"96QuintaValidaMotocross-rauldom-9632","price":10.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0715\/5692\/3628\/files\/QuintaValidaMotocross-rauldom-9632.jpg?v=1786803185"},{"product_id":"quintavalidamotocross-rauldom-9243","title":"QuintaValidaMotocross-rauldom-9243.jpg","description":"Derecho de contenido para uso personal. Contactar para derechos de usos publicitarios al Wht: +507 6028-2182","brand":"rauldom","offers":[{"title":"Default Title","offer_id":48171269554412,"sku":"96QuintaValidaMotocross-rauldom-9243","price":10.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0715\/5692\/3628\/files\/QuintaValidaMotocross-rauldom-9243.jpg?v=1786803196"}],"url":"https:\/\/rauldom.com\/collections\/quinta-valida-motocross.oembed","provider":"RaulDom Sport Images","version":"1.0","type":"link"}