/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
import"./index.js";import{f as o,g as e,l as c,h as s}from"./p-YQJevg3-.js";const t="0.2.4",a={"-":["locales/"],errors:["locales/errors/"],forms:["locales/forms/","locales/forms/contactUs/","locales/forms/demo/","locales/forms/testDriveDemo/","locales/forms/vehicleQuotation/"],"forms.contactUs":["locales/forms/contactUs/"],"forms.demo":["locales/forms/demo/"],"forms.testDriveDemo":["locales/forms/testDriveDemo/"],"forms.vehicleQuotation":["locales/forms/vehicleQuotation/"],general:["locales/general/"],generalTicketTypes:["locales/generalTicketTypes/"],"partLookup.deadStock":["locales/partLookup/deadStock/"],partLookup:["locales/partLookup/deadStock/","locales/partLookup/distributor/","locales/partLookup/manufacturer/"],"partLookup.distributor":["locales/partLookup/distributor/"],"partLookup.manufacturer":["locales/partLookup/manufacturer/"],"vehicleLookup.accessories":["locales/vehicleLookup/accessories/"],vehicleLookup:["locales/vehicleLookup/accessories/","locales/vehicleLookup/claimableItems/","locales/vehicleLookup/paintThickness/","locales/vehicleLookup/saleInformation/","locales/vehicleLookup/serviceHistory/","locales/vehicleLookup/specification/","locales/vehicleLookup/warranty/"],"vehicleLookup.claimableItems":["locales/vehicleLookup/claimableItems/"],"vehicleLookup.paintThickness":["locales/vehicleLookup/paintThickness/"],"vehicleLookup.serviceHistory":["locales/vehicleLookup/serviceHistory/"],"vehicleLookup.saleInformation":["locales/vehicleLookup/saleInformation/"],"vehicleLookup.specification":["locales/vehicleLookup/specification/"],"vehicleLookup.warranty":["locales/vehicleLookup/warranty/"],"forms*":["locales/forms/"]},l={};async function r(c){const[s,t]=await Promise.all([n(c,"errors",o),n(c,"-",e)]);return Object.assign({errors:s},t)}async function i(c){const[t,a,l]=await Promise.all([n(c,"errors",o),n(c,"-",e),n(c,"forms*",s)]);return Object.assign(Object.assign(Object.assign({},a),l),t)}async function n(o,e,s){const t=c[o]||c.en,l=a[e];if(!l||!l.length)throw new Error(`Locale file not found for component: ${e}`);if(1===l.length){const o=l[0]+t,e=await f(o);try{s.validateSync(e,{strict:!0,abortEarly:!1})}catch(e){console.error(`Failed to parse locale file: ${o}`),console.error(e)}return e}{const o=l.map((o=>f(o+t))),c=await Promise.all(o),a={};u(e,s.getDefault(),a,t);try{s.validateSync(a,{strict:!0,abortEarly:!1})}catch(o){console.error(`Failed to parse locale file component: ${e}`),console.error(o)}return c}}function p(o){return"object"==typeof o&&null!==o&&!Array.isArray(o)}function u(o,e,c,s){let t=!1;Object.entries(e).forEach((([e,r])=>{if("string"!=typeof r||t){if(p(r)){const t=o+"."+e;if(Object.entries(r).some((([o,e])=>p(e))))c[e]={},u(t,r,c[e],s);else if(a[t]&&a[t].length){const o=a[t][0]+s;l[o]&&(c[e]=l[o])}}}else{if(a[o]){const e=a[o][0]+s;l[e]&&Object.assign(c,l[e])}t=!0}}))}async function f(o){if(l[o])return await l[o];try{const e=fetch(`https://cdn.jsdelivr.net/npm/adp-web-components@${t}/dist/${o}`).then((e=>(e.ok||delete l[o],e.json())));l[o]=e;const c=await e;return l[o]=c,c}catch(e){return delete l[o],{}}}export{n as a,i as b,r as g,t as v}