{"version":3,"file":"utils.cjs","names":["TEMPLATE_APP_VERSION"],"sources":["../../src/sdk/utils.ts"],"sourcesContent":["import { TEMPLATE_APP_VERSION } from '../resources/constants/index.ts';\n\nexport const validateAppID = (appID: unknown): string | undefined => {\n  if (appID === undefined) return undefined;\n  if (typeof appID !== 'string') {\n    throw new Error(\n      `appID must be a string, or omitted if not using Embrace. Received ${String(appID)}`,\n    );\n  }\n  if (appID.length !== 5) {\n    throw new Error(\n      `appID should be 5 characters long, or omitted if not using Embrace. Received \"${appID}\"`,\n    );\n  }\n  return appID;\n};\n\nexport const validateAppVersion = (appVersion: unknown): string => {\n  if (appVersion === undefined) {\n    // TEMPLATE_APP_VERSION is rewritten by the CLI at build time and may be empty\n    const trimmedTemplate = TEMPLATE_APP_VERSION.trim();\n    if (trimmedTemplate === '') {\n      return 'unspecified';\n    }\n    return trimmedTemplate;\n  }\n  if (typeof appVersion !== 'string') {\n    throw new Error(\n      `if appVersion is specified, it must be a string. Received ${String(appVersion)}`,\n    );\n  }\n  const trimmedAppVersion = appVersion.trim();\n  if (trimmedAppVersion === '') {\n    throw new Error(\n      'if appVersion is specified, it cannot be an empty string.',\n    );\n  }\n  return trimmedAppVersion;\n};\n"],"mappings":";;;AAEA,MAAa,iBAAiB,UAAuC;CACnE,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,IAAI,OAAO,UAAU,UACnB,MAAM,IAAI,MACR,qEAAqE,OAAO,KAAK,GACnF;CAEF,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MACR,iFAAiF,MAAM,EACzF;CAEF,OAAO;AACT;AAEA,MAAa,sBAAsB,eAAgC;CACjE,IAAI,eAAe,KAAA,GAAW;EAE5B,MAAM,kBAAkBA,kCAAAA,qBAAqB,KAAK;EAClD,IAAI,oBAAoB,IACtB,OAAO;EAET,OAAO;CACT;CACA,IAAI,OAAO,eAAe,UACxB,MAAM,IAAI,MACR,6DAA6D,OAAO,UAAU,GAChF;CAEF,MAAM,oBAAoB,WAAW,KAAK;CAC1C,IAAI,sBAAsB,IACxB,MAAM,IAAI,MACR,2DACF;CAEF,OAAO;AACT"}