1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[36326],{19344:(e,r,t)=>{t.d(r,{extractServerErrors:()=>i,u:()=>s});var o=t(12115),n=t(84537);function a(e){return e.includes("Ya existe una empresa con este correo")?(0,n.t)("validationErrors.duplicateEmail"):e.includes("Ya existe una empresa con este nombre")?(0,n.t)("validationErrors.duplicateName"):e.includes("A company with this email already exists")?(0,n.t)("validationErrors.duplicateEmail"):e.includes("A company with this name already exists")?(0,n.t)("validationErrors.duplicateName"):e.includes("Email is not valid")||e.includes("Invalid email")?(0,n.t)("validationErrors.invalidEmail"):e.includes("URL is not valid")||e.includes("Invalid URL")?(0,n.t)("validationErrors.invalidUrl"):e}function s(e,r){return(0,o.useEffect)(()=>{var t,o;r&&(e.clearErrors(),(t=r)&&"object"==typeof t&&"string"==typeof t.message&&t.errors&&Array.isArray(t.errors)?r.errors.forEach(r=>{if(r.key&&r.message){let t=a(r.message);e.setError(r.key,{type:"server",message:t})}}):(o=r)&&"object"==typeof o&&"string"==typeof o.message&&o.errors&&"object"==typeof o.errors&&!Array.isArray(o.errors)?Object.entries(r.errors).forEach(r=>{let[t,o]=r;if(Array.isArray(o)&&o.length>0){let r=a(o[0]);e.setError(t,{type:"server",message:r})}}):console.warn("[useServerErrors] Server error format not recognized:",r))},[r,e]),{clearServerErrors:()=>{e.clearErrors()}}}function i(e){try{if(e&&Array.isArray(e.details)&&e.details.length>0){var r;return{message:(null==(r=e.details[0])?void 0:r.message)||e.error||"Validation failed",errors:e.details}}if(e&&e.errors&&Array.isArray(e.errors)||e&&e.errors&&"object"==typeof e.errors)return{message:e.message||"Validation failed",errors:e.errors};if("string"==typeof e){let r=JSON.parse(e);if(r&&r.errors)return{message:r.message||"Validation failed",errors:r.errors}}return null}catch(r){return{message:"An error occurred",errors:{general:["string"==typeof e?e:"Unknown error"]}}}}},81435:(e,r,t)=>{t.d(r,{Xn:()=>i,authenticatedFetch:()=>c,p9:()=>s,z5:()=>a});var o=t(59253),n=t(19344);async function a(){let e=(0,o.getAuth)().currentUser;if(!e)return console.warn("[getAuthHeaders] No current user found. Request will be unauthenticated."),{"Content-Type":"application/json"};try{let r=await e.getIdToken();return console.log("[getAuthHeaders] Successfully retrieved token for UID: ".concat(e.uid,". Token length: ").concat(r.length)),{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)}}catch(e){return console.error("[getAuthHeaders] Error getting ID token:",e),{"Content-Type":"application/json"}}}async function s(){let e=(0,o.getAuth)().currentUser;if(!e)return null;try{return await e.getIdToken()}catch(e){return console.error("[getIdToken] Error getting ID token:",e),null}}async function i(e){if(!e.ok)try{let r=await e.json(),t=(0,n.extractServerErrors)(r);if(t){let r=Error(t.message||"Error ".concat(e.status));throw r.serverErrors=t,r.status=e.status,r}let o=Error(r.message||"Error ".concat(e.status));throw o.status=e.status,o}catch(r){if(r instanceof Error&&r.serverErrors)throw r;throw Error("Error ".concat(e.status,": ").concat(e.statusText))}return e.json()}async function c(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0,n=(0,o.getAuth)().currentUser,a=null;if(t)a=t,console.log("[authenticatedFetch] Using provided auth token.");else if(n)try{a=await n.getIdToken(),console.log("[authenticatedFetch] Fetched token for UID: ".concat(n.uid,". Token length: ").concat(a.length))}catch(e){console.error("[authenticatedFetch] Error getting ID token from currentUser:",e)}else console.warn("[authenticatedFetch] No current user, request will be unauthenticated.");let s={};return a&&(s.Authorization="Bearer ".concat(a),console.log("[authenticatedFetch] Attaching 'Authorization: Bearer ...' header.")),r.body instanceof FormData||(s["Content-Type"]="application/json"),console.log("[authenticatedFetch] Making request to: ".concat(e)),fetch(e,{...r,headers:{...s,...r.headers}})}},87708:(e,r,t)=>{t.d(r,{c:()=>n,y:()=>o});let o="client-plan-usage-changed";function n(){window.dispatchEvent(new Event(o))}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.