'use strict';
import { readFile } from 'node:fs/promises';
import { aliasSymbols } from '../../../base-repo/app-constants/aliases.js';
import { createEarlyInfraError } from '../tools/create-early-infra-error.js';
import { packageJsonPath } from '../constants/job-constants.js';
import { stringEncodingNames, fileExtensions } from '../../../base-repo/app-constants/internal-system-constants.js';

var __defProp=Object['defineProperty'],__name=(_0x7b7f24,_0x3c4a5f)=>__defProp(_0x7b7f24,'name',{'value':_0x3c4a5f,'configurable':!![]});async function getBuildPackageInfo(){const _0x1836b2=await readFile(packageJsonPath,stringEncodingNames['utfDash8']),_0x567796=JSON['parse'](_0x1836b2);if(!_0x567796['name']||!_0x567796['version'])throw createEarlyInfraError('Could\x20not\x20read\x20name\x20or\x20version\x20from\x20\x27'+packageJsonPath+'\x27');const _0x524d88=buildTgzFileName(_0x567796['name'],_0x567796['version']);return {'name':_0x567796['name'],'version':_0x567796['version'],'tgzFileName':_0x524d88};}__name(getBuildPackageInfo,'getBuildPackageInfo');function buildTgzFileName(_0x1e8e9c,_0x18e93b){const _0x48b7b8=_0x1e8e9c+'-'+_0x18e93b+fileExtensions['tgz'];if(!_0x1e8e9c['startsWith'](aliasSymbols['atSign']))return _0x48b7b8;const _0x139796=_0x1e8e9c['slice'](-0x1322+-0x638+0x195b)['split']('/');if(_0x139796['length']!==0x13*0x15d+0xa*-0x291+0x3b*-0x1)return _0x48b7b8;const [_0x4381b7,_0x36702d]=_0x139796;return _0x4381b7+'-'+_0x36702d+'-'+_0x18e93b+fileExtensions['tgz'];}__name(buildTgzFileName,'buildTgzFileName');

export { buildTgzFileName, getBuildPackageInfo };
